about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/docker.go13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/docker.go b/src/docker.go
index c949815..76c90e9 100644
--- a/src/docker.go
+++ b/src/docker.go
@@ -20,8 +20,9 @@ const (
 )
 
 var (
-	dockerCtx context.Context
-	dockerCLI *client.Client
+	dockerCtx            context.Context
+	dockerCLI            *client.Client
+	currentVpnRemptePort = 1194
 )
 
 func setupContext() {
@@ -46,13 +47,17 @@ func spawnCompanion(username string, accesscode string) {
 
 	sessionSalt := generateSessionSalt()
 	vpnRemoteAddress := "127.0.0.1"
-	vpnRemotePort := "1194"
+
+	// get the vpnRemoteport and increment it
+	vpnRemotePort := currentVpnRemptePort
+	log.Println("vpnRemptePort ", currentVpnRemptePort)
+	currentVpnRemptePort++
 
 	log.Println("Generating the container config")
 
 	Config := &container.Config{
 		Image: "circus-companion:latest",
-		Cmd:   []string{"-username", username, "-accessCode", accesscode, "-sessionSalt", sessionSalt, "-vpnRemoteAddress", vpnRemoteAddress, "-vpnRemotePort", vpnRemotePort},
+		Cmd:   []string{"-username", username, "-accessCode", accesscode, "-sessionSalt", sessionSalt, "-vpnRemoteAddress", vpnRemoteAddress, "-vpnRemotePort", fmt.Sprintf("%d", vpnRemotePort)},
 		ExposedPorts: nat.PortSet{
 			"8080/tcp": struct{}{},
 		},