Skip to content
Snippets Groups Projects
Commit 6f5446dd authored by Josh Brooks's avatar Josh Brooks
Browse files

Use flag constants in cmd/connect.go

parent c4c63b43
No related branches found
No related tags found
2 merge requests!510Release,!275Implement connection CLI
...@@ -29,16 +29,16 @@ var connectionCmd = &cobra.Command{ ...@@ -29,16 +29,16 @@ var connectionCmd = &cobra.Command{
Short: "Runs clients and servers in the connections paradigm.", Short: "Runs clients and servers in the connections paradigm.",
Args: cobra.NoArgs, Args: cobra.NoArgs,
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
logLevel := viper.GetUint("logleval") logLevel := viper.GetUint(logLevelFlag)
logPath := viper.GetString("log") logPath := viper.GetString(logFlag)
initLog(logLevel, logPath) initLog(logLevel, logPath)
jww.INFO.Printf(Version()) jww.INFO.Printf(Version())
statePass := parsePassword(viper.GetString("password")) statePass := parsePassword(viper.GetString(passwordFlag))
statePath := viper.GetString("session") statePath := viper.GetString(sessionFlag)
regCode := viper.GetString("regcode") regCode := viper.GetString(regCodeFlag)
cmixParams, e2eParams := initParams() cmixParams, e2eParams := initParams()
forceLegacy := viper.GetBool("force-legacy") forceLegacy := viper.GetBool(forceLegacyFlag)
if viper.GetBool(connectionStartServerFlag) { if viper.GetBool(connectionStartServerFlag) {
if viper.GetBool(connectionAuthenticatedFlag) { if viper.GetBool(connectionAuthenticatedFlag) {
secureConnServer(forceLegacy, statePass, statePath, regCode, secureConnServer(forceLegacy, statePass, statePath, regCode,
...@@ -460,7 +460,7 @@ func insecureConnClient(forceLegacy bool, statePass []byte, statePath, regCode s ...@@ -460,7 +460,7 @@ func insecureConnClient(forceLegacy bool, statePass []byte, statePath, regCode s
// This functionality should be shared between client & server. // This functionality should be shared between client & server.
func miscConnectionFunctions(client *xxdk.E2e, conn connect.Connection) { func miscConnectionFunctions(client *xxdk.E2e, conn connect.Connection) {
// Send a message to connection partner-------------------------------------------- // Send a message to connection partner--------------------------------------------
msgBody := viper.GetString("message") msgBody := viper.GetString(messageFlag)
paramsE2E := e2e.GetDefaultParams() paramsE2E := e2e.GetDefaultParams()
if msgBody != "" { if msgBody != "" {
// Send message // Send message
...@@ -475,7 +475,7 @@ func miscConnectionFunctions(client *xxdk.E2e, conn connect.Connection) { ...@@ -475,7 +475,7 @@ func miscConnectionFunctions(client *xxdk.E2e, conn connect.Connection) {
} }
// Verify message sends were successful when verifySendFlag is present // Verify message sends were successful when verifySendFlag is present
if viper.GetBool("verify-sends") { if viper.GetBool(verifySendFlag) {
if !verifySendSuccess(client, paramsE2E, roundIDs, if !verifySendSuccess(client, paramsE2E, roundIDs,
conn.GetPartner().PartnerId(), payload) { conn.GetPartner().PartnerId(), payload) {
continue continue
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment