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
26f83438
Commit
26f83438
authored
Oct 15, 2020
by
Richard T. Carback III
Browse files
Options
Downloads
Patches
Plain Diff
Add unsafe flag
parent
0c07f478
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
+15
-2
15 additions, 2 deletions
cmd/root.go
with
15 additions
and
2 deletions
cmd/root.go
+
15
−
2
View file @
26f83438
...
@@ -186,13 +186,22 @@ var rootCmd = &cobra.Command{
...
@@ -186,13 +186,22 @@ var rootCmd = &cobra.Command{
Payload
:
[]
byte
(
msgBody
),
Payload
:
[]
byte
(
msgBody
),
MessageType
:
message
.
Text
,
MessageType
:
message
.
Text
,
}
}
params
:=
params
.
GetDefaultE2E
()
paramsE2E
:=
params
.
GetDefaultE2E
()
paramsUnsafe
:=
params
.
GetDefaultUnsafe
()
sendCnt
:=
int
(
viper
.
GetUint
(
"sendCount"
))
sendCnt
:=
int
(
viper
.
GetUint
(
"sendCount"
))
sendDelay
:=
time
.
Duration
(
viper
.
GetUint
(
"sendDelay"
))
sendDelay
:=
time
.
Duration
(
viper
.
GetUint
(
"sendDelay"
))
unsafe
:=
viper
.
GetBool
(
"unsafe"
)
for
i
:=
0
;
i
<
sendCnt
;
i
++
{
for
i
:=
0
;
i
<
sendCnt
;
i
++
{
fmt
.
Printf
(
"Sending to %s: %s
\n
"
,
recipientID
,
msgBody
)
fmt
.
Printf
(
"Sending to %s: %s
\n
"
,
recipientID
,
msgBody
)
roundIDs
,
_
,
err
:=
client
.
SendE2E
(
msg
,
params
)
var
roundIDs
[]
id
.
Round
if
unsafe
{
roundIDs
,
err
=
client
.
SendUnsafe
(
msg
,
paramsUnsafe
)
}
else
{
roundIDs
,
_
,
err
=
client
.
SendE2E
(
msg
,
paramsE2E
)
}
if
err
!=
nil
{
if
err
!=
nil
{
jww
.
FATAL
.
Panicf
(
"%+v"
,
err
)
jww
.
FATAL
.
Panicf
(
"%+v"
,
err
)
}
}
...
@@ -432,6 +441,10 @@ func init() {
...
@@ -432,6 +441,10 @@ func init() {
viper
.
BindPFlag
(
"waitTimeout"
,
viper
.
BindPFlag
(
"waitTimeout"
,
rootCmd
.
Flags
()
.
Lookup
(
"waitTimeout"
))
rootCmd
.
Flags
()
.
Lookup
(
"waitTimeout"
))
rootCmd
.
Flags
()
.
BoolP
(
"unsafe"
,
""
,
false
,
"Send raw, unsafe messages without e2e encryption."
)
viper
.
BindPFlag
(
"unsafe"
,
rootCmd
.
Flags
()
.
Lookup
(
"unsafe"
))
// Cobra also supports local flags, which will only run
// Cobra also supports local flags, which will only run
// when this action is called directly.
// when this action is called directly.
// rootCmd.Flags().StringVarP(¬ificationToken, "nbRegistration", "x", "",
// rootCmd.Flags().StringVarP(¬ificationToken, "nbRegistration", "x", "",
...
...
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