Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
client
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
elixxir
client
Commits
c42f5836
Commit
c42f5836
authored
5 years ago
by
Rick Carback
Browse files
Options
Downloads
Patches
Plain Diff
add debug info to the client outputs
parent
ad325704
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
cmd/root.go
+13
-0
13 additions, 0 deletions
cmd/root.go
with
13 additions
and
0 deletions
cmd/root.go
+
13
−
0
View file @
c42f5836
...
@@ -87,10 +87,13 @@ func sessionInitialization() (*id.User, *api.Client) {
...
@@ -87,10 +87,13 @@ func sessionInitialization() (*id.User, *api.Client) {
}
}
// Verify the signature
// Verify the signature
globals
.
Log
.
INFO
.
Println
(
"Verifying NDF..."
)
ndfJSON
:=
api
.
VerifyNDF
(
string
(
ndfBytes
),
ndfPubKey
)
ndfJSON
:=
api
.
VerifyNDF
(
string
(
ndfBytes
),
ndfPubKey
)
globals
.
Log
.
INFO
.
Printf
(
"NDF Verified: %v"
,
ndfJSON
)
// Overwrite the network definition with any specified flags
// Overwrite the network definition with any specified flags
overwriteNDF
(
ndfJSON
)
overwriteNDF
(
ndfJSON
)
globals
.
Log
.
INFO
.
Printf
(
"Overwrote NDF Vars: %v"
,
ndfJSON
)
//If no session file is passed initialize with RAM Storage
//If no session file is passed initialize with RAM Storage
if
sessionFile
==
""
{
if
sessionFile
==
""
{
...
@@ -100,6 +103,7 @@ func sessionInitialization() (*id.User, *api.Client) {
...
@@ -100,6 +103,7 @@ func sessionInitialization() (*id.User, *api.Client) {
err
.
Error
())
err
.
Error
())
return
id
.
ZeroID
,
nil
return
id
.
ZeroID
,
nil
}
}
globals
.
Log
.
INFO
.
Println
(
"Initialized Ram Storage"
)
register
=
true
register
=
true
}
else
{
}
else
{
//If a session file is passed, check if it's valid
//If a session file is passed, check if it's valid
...
@@ -123,9 +127,12 @@ func sessionInitialization() (*id.User, *api.Client) {
...
@@ -123,9 +127,12 @@ func sessionInitialization() (*id.User, *api.Client) {
globals
.
Log
.
ERROR
.
Printf
(
"Could Not Initialize OS Storage: %s
\n
"
,
err
.
Error
())
globals
.
Log
.
ERROR
.
Printf
(
"Could Not Initialize OS Storage: %s
\n
"
,
err
.
Error
())
return
id
.
ZeroID
,
nil
return
id
.
ZeroID
,
nil
}
}
globals
.
Log
.
INFO
.
Println
(
"Initialized OS Storage"
)
}
}
if
noBlockingTransmission
{
if
noBlockingTransmission
{
globals
.
Log
.
INFO
.
Println
(
"Disabling Blocking Transmissions"
)
client
.
DisableBlockingTransmission
()
client
.
DisableBlockingTransmission
()
}
}
...
@@ -142,17 +149,21 @@ func sessionInitialization() (*id.User, *api.Client) {
...
@@ -142,17 +149,21 @@ func sessionInitialization() (*id.User, *api.Client) {
}
}
// Connect to gateways and reg server
// Connect to gateways and reg server
globals
.
Log
.
INFO
.
Println
(
"Connecting..."
)
err
=
client
.
Connect
()
err
=
client
.
Connect
()
if
err
!=
nil
{
if
err
!=
nil
{
globals
.
Log
.
FATAL
.
Panicf
(
"Could not call connect on client: %+v"
,
err
)
globals
.
Log
.
FATAL
.
Panicf
(
"Could not call connect on client: %+v"
,
err
)
}
}
globals
.
Log
.
INFO
.
Println
(
"Connected!"
)
// Holds the User ID
// Holds the User ID
var
uid
*
id
.
User
var
uid
*
id
.
User
// Register a new user if requested
// Register a new user if requested
if
register
{
if
register
{
globals
.
Log
.
INFO
.
Println
(
"Registering..."
)
regCode
:=
registrationCode
regCode
:=
registrationCode
// If precanned user, use generated code instead
// If precanned user, use generated code instead
if
userId
!=
0
{
if
userId
!=
0
{
...
@@ -176,6 +187,7 @@ func sessionInitialization() (*id.User, *api.Client) {
...
@@ -176,6 +187,7 @@ func sessionInitialization() (*id.User, *api.Client) {
uid
=
id
.
NewUserFromUints
(
&
[
4
]
uint64
{
0
,
0
,
0
,
userId
})
uid
=
id
.
NewUserFromUints
(
&
[
4
]
uint64
{
0
,
0
,
0
,
userId
})
// clear userEmail if it was defined, since login was previously done
// clear userEmail if it was defined, since login was previously done
userEmail
=
""
userEmail
=
""
globals
.
Log
.
INFO
.
Println
(
"Skipped Registration, user: %v"
,
uid
)
}
}
// Log the user in, for now using the first gateway specified
// Log the user in, for now using the first gateway specified
...
@@ -185,6 +197,7 @@ func sessionInitialization() (*id.User, *api.Client) {
...
@@ -185,6 +197,7 @@ func sessionInitialization() (*id.User, *api.Client) {
globals
.
Log
.
ERROR
.
Printf
(
"Could Not Log In: %s
\n
"
,
err
)
globals
.
Log
.
ERROR
.
Printf
(
"Could Not Log In: %s
\n
"
,
err
)
return
id
.
ZeroID
,
nil
return
id
.
ZeroID
,
nil
}
}
globals
.
Log
.
INFO
.
Println
(
"Logged In!"
)
return
uid
,
client
return
uid
,
client
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment