Skip to content
Snippets Groups Projects
Commit 26f83438 authored by Richard T. Carback III's avatar Richard T. Carback III
Browse files

Add unsafe flag

parent 0c07f478
No related branches found
No related tags found
No related merge requests found
...@@ -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(&notificationToken, "nbRegistration", "x", "", // rootCmd.Flags().StringVarP(&notificationToken, "nbRegistration", "x", "",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment