2015-06-23 13:13:42 -04:00
|
|
|
package runconfig
|
|
|
|
|
2015-07-25 05:11:45 -04:00
|
|
|
// IsDefault indicates whether container uses the default network stack.
|
2015-06-23 13:13:42 -04:00
|
|
|
func (n NetworkMode) IsDefault() bool {
|
|
|
|
return n == "default"
|
|
|
|
}
|
|
|
|
|
2015-07-25 05:11:45 -04:00
|
|
|
// DefaultDaemonNetworkMode returns the default network stack the daemon should
|
|
|
|
// use.
|
2015-06-23 13:13:42 -04:00
|
|
|
func DefaultDaemonNetworkMode() NetworkMode {
|
|
|
|
return NetworkMode("default")
|
|
|
|
}
|
|
|
|
|
2015-07-25 05:11:45 -04:00
|
|
|
// NetworkName returns the name of the network stack.
|
2015-06-23 13:13:42 -04:00
|
|
|
func (n NetworkMode) NetworkName() string {
|
|
|
|
if n.IsDefault() {
|
|
|
|
return "default"
|
|
|
|
}
|
|
|
|
return ""
|
|
|
|
}
|
2015-07-09 18:12:36 -04:00
|
|
|
|
|
|
|
// MergeConfigs merges the specified container Config and HostConfig.
|
|
|
|
// It creates a ContainerConfigWrapper.
|
|
|
|
func MergeConfigs(config *Config, hostConfig *HostConfig) *ContainerConfigWrapper {
|
|
|
|
return &ContainerConfigWrapper{
|
|
|
|
config,
|
|
|
|
hostConfig,
|
|
|
|
}
|
|
|
|
}
|