github.com/vieux/docker@v0.6.3-0.20161004191708-e097c2a938c7/runconfig/hostconfig_windows.go (about) 1 package runconfig 2 3 import ( 4 "fmt" 5 "strings" 6 7 "github.com/docker/docker/api/types/container" 8 ) 9 10 // DefaultDaemonNetworkMode returns the default network stack the daemon should 11 // use. 12 func DefaultDaemonNetworkMode() container.NetworkMode { 13 return container.NetworkMode("nat") 14 } 15 16 // IsPreDefinedNetwork indicates if a network is predefined by the daemon 17 func IsPreDefinedNetwork(network string) bool { 18 return !container.NetworkMode(network).IsUserDefined() 19 } 20 21 // ValidateNetMode ensures that the various combinations of requested 22 // network settings are valid. 23 func ValidateNetMode(c *container.Config, hc *container.HostConfig) error { 24 if hc == nil { 25 return nil 26 } 27 parts := strings.Split(string(hc.NetworkMode), ":") 28 if len(parts) > 1 { 29 return fmt.Errorf("invalid --net: %s", hc.NetworkMode) 30 } 31 return nil 32 } 33 34 // ValidateIsolation performs platform specific validation of the 35 // isolation in the hostconfig structure. Windows supports 'default' (or 36 // blank), 'process', or 'hyperv'. 37 func ValidateIsolation(hc *container.HostConfig) error { 38 // We may not be passed a host config, such as in the case of docker commit 39 if hc == nil { 40 return nil 41 } 42 if !hc.Isolation.IsValid() { 43 return fmt.Errorf("invalid --isolation: %q. Windows supports 'default', 'process', or 'hyperv'", hc.Isolation) 44 } 45 return nil 46 } 47 48 // ValidateQoS performs platform specific validation of the Qos settings 49 func ValidateQoS(hc *container.HostConfig) error { 50 return nil 51 }