github.com/Heebron/moby@v0.0.0-20221111184709-6eab4f55faf7/libnetwork/default_gateway_linux.go (about)

     1  package libnetwork
     2  
     3  import (
     4  	"fmt"
     5  	"strconv"
     6  
     7  	"github.com/docker/docker/libnetwork/drivers/bridge"
     8  )
     9  
    10  const libnGWNetwork = "docker_gwbridge"
    11  
    12  func getPlatformOption() EndpointOption {
    13  	return nil
    14  }
    15  
    16  func (c *controller) createGWNetwork() (Network, error) {
    17  	netOption := map[string]string{
    18  		bridge.BridgeName:         libnGWNetwork,
    19  		bridge.EnableICC:          strconv.FormatBool(false),
    20  		bridge.EnableIPMasquerade: strconv.FormatBool(true),
    21  	}
    22  
    23  	n, err := c.NewNetwork("bridge", libnGWNetwork, "",
    24  		NetworkOptionDriverOpts(netOption),
    25  		NetworkOptionEnableIPv6(false),
    26  	)
    27  
    28  	if err != nil {
    29  		return nil, fmt.Errorf("error creating external connectivity network: %v", err)
    30  	}
    31  	return n, err
    32  }