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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
elixxir
client
Commits
f718f1a5
Commit
f718f1a5
authored
Dec 7, 2021
by
Richard T. Carback III
Browse files
Options
Downloads
Plain Diff
Merge remote-tracking branch 'origin/release' into quantumSecure
parents
20745d90
b4e276e0
No related branches found
No related tags found
2 merge requests
!117
Release
,
!73
Quantum secure xx messenger key negotiation
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
README.md
+14
-12
14 additions, 12 deletions
README.md
cmd/root.go
+59
-30
59 additions, 30 deletions
cmd/root.go
with
73 additions
and
42 deletions
README.md
+
14
−
12
View file @
f718f1a5
...
@@ -140,17 +140,19 @@ Full usage of client can be found with `client --help`:
...
@@ -140,17 +140,19 @@ Full usage of client can be found with `client --help`:
```
```
$ ./client --help
$ ./client --help
Runs a client for cMix anonymous communication platform
Usage:
Usage:
client [flags]
client [flags]
client [command]
client [command]
Available Commands:
Available Commands:
fileTransfer Send and receive file for cMix client
generate Generates version and dependency information for the Elixxir binary
generate Generates version and dependency information for the Elixxir binary
getndf Download the network definition file from the network and print it.
getndf Download the network definition file from the network and print it.
group Group commands for cMix client
group Group commands for cMix client
help Help about any command
help Help about any command
init Initialize a user ID but do not connect to the network
init Initialize a user ID but do not connect to the network
proto Load client with a proto client JSON file.
single Send and respond to single-use messages.
single Send and respond to single-use messages.
ud Register for and search users using the xx network user discovery service.
ud Register for and search users using the xx network user discovery service.
version Print the version and dependency information for the Elixxir binary
version Print the version and dependency information for the Elixxir binary
...
@@ -173,8 +175,8 @@ Flags:
...
@@ -173,8 +175,8 @@ Flags:
-n, --ndf string Path to the network definition JSON file (default "ndf.json")
-n, --ndf string Path to the network definition JSON file (default "ndf.json")
-p, --password string Password to the session file
-p, --password string Password to the session file
--profile-cpu string Enable cpu profiling to this file
--profile-cpu string Enable cpu profiling to this file
--protoUserOut string Path to which a normally constructed client will write proto user JSON file
(default "protoUser.json")
--protoUserOut string Path to which a normally constructed client will write proto user JSON file
--protoUserPath string Path to proto user JSON file containing cryptographic primitives the client will load
(default "protoUser.json")
--protoUserPath string Path to proto user JSON file containing cryptographic primitives the client will load
--receiveCount uint How many messages we should wait for before quitting (default 1)
--receiveCount uint How many messages we should wait for before quitting (default 1)
--regcode string Identity code (optional)
--regcode string Identity code (optional)
--send-auth-request Send an auth request to the specified destination and waitfor confirmation
--send-auth-request Send an auth request to the specified destination and waitfor confirmation
...
@@ -186,9 +188,9 @@ Flags:
...
@@ -186,9 +188,9 @@ Flags:
--unsafe Send raw, unsafe messages without e2e encryption.
--unsafe Send raw, unsafe messages without e2e encryption.
--unsafe-channel-creation Turns off the user identity authenticated channel check, automatically approving authenticated channels
--unsafe-channel-creation Turns off the user identity authenticated channel check, automatically approving authenticated channels
--verboseRoundTracking Verbose round tracking, keeps track and prints all rounds the client was aware of while running. Defaults to false if not set.
--verboseRoundTracking Verbose round tracking, keeps track and prints all rounds the client was aware of while running. Defaults to false if not set.
--verify-sends Ensure successful message sending by checking for round completion
--waitTimeout uint The number of seconds to wait for messages to arrive (default 15)
--waitTimeout uint The number of seconds to wait for messages to arrive (default 15)
-w, --writeContact string Write contact information, if any, to this file, defaults to stdout (default "-")
-w, --writeContact string Write contact information, if any, to this file, defaults to stdout (default "-")
file
Use "client [command] --help" for more information about a command.
Use "client [command] --help" for more information about a command.
```
```
...
...
This diff is collapsed.
Click to expand it.
cmd/root.go
+
59
−
30
View file @
f718f1a5
...
@@ -12,7 +12,6 @@ import (
...
@@ -12,7 +12,6 @@ import (
"encoding/base64"
"encoding/base64"
"encoding/binary"
"encoding/binary"
"encoding/hex"
"encoding/hex"
"errors"
"fmt"
"fmt"
"github.com/spf13/cobra"
"github.com/spf13/cobra"
jww
"github.com/spf13/jwalterweatherman"
jww
"github.com/spf13/jwalterweatherman"
...
@@ -198,6 +197,8 @@ var rootCmd = &cobra.Command{
...
@@ -198,6 +197,8 @@ var rootCmd = &cobra.Command{
go
func
(
i
int
)
{
go
func
(
i
int
)
{
defer
wg
.
Done
()
defer
wg
.
Done
()
fmt
.
Printf
(
"Sending to %s: %s
\n
"
,
recipientID
,
msgBody
)
fmt
.
Printf
(
"Sending to %s: %s
\n
"
,
recipientID
,
msgBody
)
for
{
// Send messages
var
roundIDs
[]
id
.
Round
var
roundIDs
[]
id
.
Round
var
roundTimeout
time
.
Duration
var
roundTimeout
time
.
Duration
if
unsafe
{
if
unsafe
{
...
@@ -213,20 +214,44 @@ var rootCmd = &cobra.Command{
...
@@ -213,20 +214,44 @@ var rootCmd = &cobra.Command{
jww
.
FATAL
.
Panicf
(
"%+v"
,
err
)
jww
.
FATAL
.
Panicf
(
"%+v"
,
err
)
}
}
// Construct the callback function which prints out the rounds' results
if
viper
.
GetBool
(
"verify-sends"
)
{
// Verify message sends were successful
retryChan
:=
make
(
chan
struct
{})
done
:=
make
(
chan
struct
{},
1
)
// Construct the callback function which
// verifies successful message send or retries
f
:=
func
(
allRoundsSucceeded
,
timedOut
bool
,
f
:=
func
(
allRoundsSucceeded
,
timedOut
bool
,
rounds
map
[
id
.
Round
]
api
.
RoundResult
)
{
rounds
map
[
id
.
Round
]
api
.
RoundResult
)
{
printRoundResults
(
allRoundsSucceeded
,
timedOut
,
rounds
,
roundIDs
,
msg
)
printRoundResults
(
allRoundsSucceeded
,
timedOut
,
rounds
,
roundIDs
,
msg
)
if
!
allRoundsSucceeded
{
retryChan
<-
struct
{}{}
}
else
{
done
<-
struct
{}{}
}
}
}
// Have the client report back the round results
// Monitor rounds for results
err
=
errors
.
New
(
"derp"
)
for
j
:=
0
;
j
<
5
&&
err
!=
nil
;
j
++
{
err
=
client
.
GetRoundResults
(
roundIDs
,
roundTimeout
,
f
)
err
=
client
.
GetRoundResults
(
roundIDs
,
roundTimeout
,
f
)
if
err
!=
nil
{
jww
.
DEBUG
.
Printf
(
"Could not verify messages were sent successfully, resending messages..."
)
continue
}
select
{
case
<-
retryChan
:
// On a retry, go to the top of the loop
jww
.
DEBUG
.
Printf
(
"Messages were not sent successfully, resending messages..."
)
continue
case
<-
done
:
// Close channels on verification success
close
(
done
)
close
(
retryChan
)
break
}
}
if
err
!=
nil
{
}
jww
.
FATAL
.
Panicf
(
"Message sending for send %d failed: %+v"
,
i
,
err
)
break
}
}
}(
i
)
}(
i
)
}
}
...
@@ -842,6 +867,10 @@ func init() {
...
@@ -842,6 +867,10 @@ func init() {
""
,
500
,
"The delay between sending the messages in ms"
)
""
,
500
,
"The delay between sending the messages in ms"
)
viper
.
BindPFlag
(
"sendDelay"
,
rootCmd
.
Flags
()
.
Lookup
(
"sendDelay"
))
viper
.
BindPFlag
(
"sendDelay"
,
rootCmd
.
Flags
()
.
Lookup
(
"sendDelay"
))
rootCmd
.
Flags
()
.
BoolP
(
"verify-sends"
,
""
,
false
,
"Ensure successful message sending by checking for round completion"
)
viper
.
BindPFlag
(
"verify-sends"
,
rootCmd
.
Flags
()
.
Lookup
(
"verify-sends"
))
rootCmd
.
Flags
()
.
UintP
(
"receiveCount"
,
rootCmd
.
Flags
()
.
UintP
(
"receiveCount"
,
""
,
1
,
"How many messages we should wait for before quitting"
)
""
,
1
,
"How many messages we should wait for before quitting"
)
viper
.
BindPFlag
(
"receiveCount"
,
rootCmd
.
Flags
()
.
Lookup
(
"receiveCount"
))
viper
.
BindPFlag
(
"receiveCount"
,
rootCmd
.
Flags
()
.
Lookup
(
"receiveCount"
))
...
...
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