From 0556ca848c8615964b30a4fcbdb5eb595911bfbd Mon Sep 17 00:00:00 2001 From: jaketaylor <jake@privategrity.com> Date: Fri, 22 Mar 2019 12:30:29 -0400 Subject: [PATCH] Added CL argument for registration server address --- README.md | 3 ++- cmd/root.go | 11 +++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index f3827a783..f7ac3f429 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ Optional args: |Long flag|Short flag|Effect|Example| |---|---|---|---| -|--gwaddresses|-g|Addresses of the gateway to connect to, separated by commas (Overrides config file)|-g localhost:8443,localhost:8444| +|--gwaddresses|-g|Addresses:port of the gateway to connect to, separated by commas (Overrides config file)|-g localhost:8443,localhost:8444| |--destid|-d|ID of the user to send messages to|-d 6| |--message|-m|Text message to send|-m "let's both have a good day"| |--verbose|-v|Prints more logging messages for debugging|-v| @@ -41,6 +41,7 @@ Optional args: |--help|-h|Prints a help message with all of these flags|-h| |--gwcertpath|-c|Enables TLS by passing in path to the gateway certificate file|-c "~/Documents/gateway.cert"| |--registrationcertpath|-r|Enables TLS by passing in path to the registration server certificate file|-r "~/Documents/registration.cert"| +|--registrationaddr|-a|Address:Port for connecting to the registration server|-a "localhost:11420"| |--dummyfrequency| |How often dummy messages should be sent per second. This flag is likely to be replaced when we implement better dummy message sending.|--dummyfrequency 0.5| ##Project Structure diff --git a/cmd/root.go b/cmd/root.go index 434c2676b..d4e3bbf05 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -44,6 +44,7 @@ var rateLimiting uint32 var showVer bool var gwCertPath string var registrationCertPath string +var registrationAddr string // Execute adds all child commands to the root command and sets flags // appropriately. This is called by main.main(). It only needs to @@ -119,7 +120,7 @@ func sessionInitialization() { // to allow testing with IDs that are long enough to exercise more than // 64 bits regCode := new(id.User).SetUints(&[4]uint64{0, 0, 0, userId}).RegistrationCode() - _, err := bindings.Register(regCode, "", gwAddresses, mint) + _, err := bindings.Register(regCode, registrationAddr, gwAddresses, mint) if err != nil { fmt.Printf("Could Not Register User: %s\n", err.Error()) return @@ -366,13 +367,19 @@ func init() { rootCmd.PersistentFlags().Uint64VarP(&userId, "userid", "i", 0, "ID to sign in as") rootCmd.PersistentFlags().StringSliceVarP(&gwAddresses, "gwaddresses", - "g", make([]string, 0), "Gateway addresses for message sending, comma-separated") + "g", make([]string, 0), "Gateway addresses:port for message sending, "+ + "comma-separated") rootCmd.PersistentFlags().StringVarP(&gwCertPath, "gwcertpath", "c", "", "Path to the certificate file for connecting to gateway using TLS") rootCmd.PersistentFlags().StringVarP(®istrationCertPath, "registrationcertpath", "r", "", "Path to the certificate file for connecting to registration server"+ " using TLS") + rootCmd.PersistentFlags().StringVarP(®istrationAddr, + "registrationaddr", "a", + "", + "Address:Port for connecting to registration server"+ + " using TLS") rootCmd.PersistentFlags().StringVarP(&sessionFile, "sessionfile", "f", "", "Passes a file path for loading a session. "+ -- GitLab