about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/docker.go11
-rw-r--r--src/http.go6
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 {