about summary refs log tree commit diff
diff options
context:
space:
mode:
authormaride <maride@darknebu.la>2018-09-04 11:07:18 +0200
committermaride <maride@darknebu.la>2018-09-04 11:07:18 +0200
commit939ef7db9b3f209c4fa521a8d6ef4231ee397760 (patch)
treeb5133ec3db5512d9cdc1c1e137bcbf6990baf9ac
parentcbb1ab24a40b5e84adcd44a4d0d4d7fdd9f49f5f (diff)
Un-hardcode network name, remove fixed IP block to avoid collision on the host system
-rw-r--r--src/access.go14
1 files changed, 5 insertions, 9 deletions
diff --git a/src/access.go b/src/access.go
index 34b2470..6f9cd73 100644
--- a/src/access.go
+++ b/src/access.go
@@ -13,6 +13,10 @@ import (
 	"time"
 )
 
+const(
+	vpnHostNetworkName = "vpnhostnet"
+)
+
 var vpnContainerID string
 var vpnNetworkID string
 var vpnHostNetworkID string
@@ -107,14 +111,6 @@ func setupNetwork() (error) {
 	if vpnNetworkID == "" {
 		response, err := dockerCli.NetworkCreate(dockerCtx, VPNNetworkName, types.NetworkCreate{
 			Internal: true,
-			IPAM: &network.IPAM{
-				Config: []network.IPAMConfig{
-					{
-						Subnet: "10.13.37.0/24",
-						Gateway: "10.13.37.254",
-					},
-				},
-			},
 		})
 
 		if err != nil {
@@ -132,7 +128,7 @@ func setupVPNHostNetwork() (error) {
 	setupDockerCLI()
 
 	if vpnHostNetworkID == "" {
-		response, err := dockerCli.NetworkCreate(dockerCtx, "vpnhostnet", types.NetworkCreate{
+		response, err := dockerCli.NetworkCreate(dockerCtx, vpnHostNetworkName, types.NetworkCreate{
 			Internal: false,
 		})