From 9ee92da5e3d52fe11415193a9391eee3ad541c72 Mon Sep 17 00:00:00 2001 From: maride Date: Sat, 8 Sep 2018 01:29:22 +0200 Subject: Avoid collision by adding the hashed username to networks --- src/container.go | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'src/container.go') diff --git a/src/container.go b/src/container.go index 29046e2..c06a9ed 100644 --- a/src/container.go +++ b/src/container.go @@ -8,10 +8,6 @@ import ( "time" ) -const ( - containerNetworkName = "circus-vpnnet" -) - type ChallengeContainer struct { Challenge *Challenge ContainerID string @@ -26,7 +22,7 @@ func (cc ChallengeContainer) startContainer() (address string, containerID strin // Set up container network if containerNetworkID == "" { - id, err := setupNetwork(containerNetworkName, true) + id, err := setupNetwork(getChallengeNetworkName(), true) if (err != nil) { return "", "", err } @@ -40,7 +36,7 @@ func (cc ChallengeContainer) startContainer() (address string, containerID strin Tty: false, }, nil, &network.NetworkingConfig{ EndpointsConfig: map[string]*network.EndpointSettings{ - containerNetworkName: { + getChallengeNetworkName(): { NetworkID: containerNetworkID, }, }, @@ -63,7 +59,7 @@ func (cc ChallengeContainer) startContainer() (address string, containerID strin } // Return IP, Container ID and error - return inspectJSON.NetworkSettings.Networks[containerNetworkName].IPAddress, resp.ID,nil + return inspectJSON.NetworkSettings.Networks[getChallengeNetworkName()].IPAddress, resp.ID,nil } // Stops the container with a timeout of one second -- cgit 1.4.1