Skip to content
Snippets Groups Projects
Commit 0556ca84 authored by Jake Taylor's avatar Jake Taylor :lips:
Browse files

Added CL argument for registration server address

parent 50a28ad3
Branches
Tags
No related merge requests found
......@@ -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
......
......@@ -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(&registrationCertPath, "registrationcertpath", "r",
"",
"Path to the certificate file for connecting to registration server"+
" using TLS")
rootCmd.PersistentFlags().StringVarP(&registrationAddr,
"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. "+
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment