diff options
author | Emile <hanemile@protonmail.com> | 2019-10-11 11:56:08 +0200 |
---|---|---|
committer | Emile <hanemile@protonmail.com> | 2019-10-11 11:56:08 +0200 |
commit | ddbe382aa58505d7822ff9d4f8bdbc4c3b4e988a (patch) | |
tree | 588fcbbbff67938e68de091112b061aded9e43fd | |
parent | c76b16a9c10565306477b91fb359c6d31442dfe5 (diff) |
vpnremoteport as flag
-rw-r--r-- | src/docker.go | 11 | ||||
-rw-r--r-- | src/http.go | 6 |
2 files changed, 9 insertions, 8 deletions
diff --git a/src/docker.go b/src/docker.go index e3ff19c..adc94fb 100644 --- a/src/docker.go +++ b/src/docker.go @@ -20,9 +20,8 @@ const ( ) var ( - dockerCtx context.Context - dockerCLI *client.Client - currentVpnRemptePort = 1194 + dockerCtx context.Context + dockerCLI *client.Client ) func setupContext() { @@ -49,9 +48,9 @@ func spawnCompanion(username string, accesscode string) { vpnRemoteAddress := os.Getenv("HOSTNAME") // get the vpnRemoteport and increment it - vpnRemotePort := currentVpnRemptePort - log.Println("vpnRemptePort ", currentVpnRemptePort) - currentVpnRemptePort++ + vpnRemotePort := *currentVpnRemotePort + log.Println("vpnRemptePort ", *currentVpnRemotePort) + *currentVpnRemotePort++ log.Println("Generating the container config") diff --git a/src/http.go b/src/http.go index 2c62eaf..13276f7 100644 --- a/src/http.go +++ b/src/http.go @@ -15,8 +15,9 @@ import ( ) var ( - port *int // port the http server listens on - usernames []string // list of usernames + port *int // port the http server listens on + usernames []string // list of usernames + currentVpnRemotePort *int ) // Credentials stores user credentials @@ -28,6 +29,7 @@ type Credentials struct { func registerHTTPFlags() { port = flag.Int("port", 8081, "The port the http server should listen on") + currentVpnRemotePort = flag.Int("initialVPNPort", 1194, "the initial vpn port") } func setupHTTPServer() http.Server { |