From 939ef7db9b3f209c4fa521a8d6ef4231ee397760 Mon Sep 17 00:00:00 2001 From: maride Date: Tue, 4 Sep 2018 11:07:18 +0200 Subject: Un-hardcode network name, remove fixed IP block to avoid collision on the host system --- src/access.go | 14 +++++--------- 1 file 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, }) -- cgit 1.4.1