daemon/config: reorganize code between unix and windows files

Put variables and functions in the same owrder between both,
to allow for easier comparing between platforms.

Also synchronised some comments/godoc between both.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2021-07-10 14:40:25 +02:00
parent c81abefdb1
commit a65f83317c
No known key found for this signature in database
GPG Key ID: 76698F39D527CE8C
2 changed files with 28 additions and 28 deletions

View File

@ -15,6 +15,25 @@ const (
DefaultIpcMode = "private"
)
// BridgeConfig stores all the bridge driver specific
// configuration.
type BridgeConfig struct {
commonBridgeConfig
// These fields are common to all unix platforms.
commonUnixBridgeConfig
// Fields below here are platform specific.
EnableIPv6 bool `json:"ipv6,omitempty"`
EnableIPTables bool `json:"iptables,omitempty"`
EnableIP6Tables bool `json:"ip6tables,omitempty"`
EnableIPForward bool `json:"ip-forward,omitempty"`
EnableIPMasq bool `json:"ip-masq,omitempty"`
EnableUserlandProxy bool `json:"userland-proxy,omitempty"`
UserlandProxyPath string `json:"userland-proxy-path,omitempty"`
FixedCIDRv6 string `json:"fixed-cidr-v6,omitempty"`
}
// Config defines the configuration of a docker daemon.
// It includes json tags to deserialize configuration from a file
// using the same names that the flags in the command line uses.
@ -43,25 +62,6 @@ type Config struct {
Rootless bool `json:"rootless,omitempty"`
}
// BridgeConfig stores all the bridge driver specific
// configuration.
type BridgeConfig struct {
commonBridgeConfig
// These fields are common to all unix platforms.
commonUnixBridgeConfig
// Fields below here are platform specific.
EnableIPv6 bool `json:"ipv6,omitempty"`
EnableIPTables bool `json:"iptables,omitempty"`
EnableIP6Tables bool `json:"ip6tables,omitempty"`
EnableIPForward bool `json:"ip-forward,omitempty"`
EnableIPMasq bool `json:"ip-masq,omitempty"`
EnableUserlandProxy bool `json:"userland-proxy,omitempty"`
UserlandProxyPath string `json:"userland-proxy-path,omitempty"`
FixedCIDRv6 string `json:"fixed-cidr-v6,omitempty"`
}
// IsSwarmCompatible defines if swarm mode can be enabled in this config
func (conf *Config) IsSwarmCompatible() error {
if conf.ClusterStore != "" || conf.ClusterAdvertise != "" {
@ -104,7 +104,7 @@ func (conf *Config) ValidatePlatformConfig() error {
return verifyDefaultCgroupNsMode(conf.CgroupNamespaceMode)
}
// IsRootless returns conf.Rootless
// IsRootless returns conf.Rootless on Linux but false on Windows
func (conf *Config) IsRootless() bool {
return conf.Rootless
}

View File

@ -11,8 +11,8 @@ type BridgeConfig struct {
}
// Config defines the configuration of a docker daemon.
// These are the configuration settings that you pass
// to the docker daemon when you launch it with say: `dockerd -e windows`
// It includes json tags to deserialize configuration from a file
// using the same names that the flags in the command line uses.
type Config struct {
CommonConfig
@ -26,11 +26,6 @@ func (conf *Config) GetRuntime(name string) *types.Runtime {
return nil
}
// GetInitPath returns the configure docker-init path
func (conf *Config) GetInitPath() string {
return ""
}
// GetDefaultRuntimeName returns the current default runtime
func (conf *Config) GetDefaultRuntimeName() string {
return StockRuntimeName
@ -46,6 +41,11 @@ func (conf *Config) GetExecRoot() string {
return ""
}
// GetInitPath returns the configured docker-init path
func (conf *Config) GetInitPath() string {
return ""
}
// IsSwarmCompatible defines if swarm mode can be enabled in this config
func (conf *Config) IsSwarmCompatible() error {
return nil
@ -56,7 +56,7 @@ func (conf *Config) ValidatePlatformConfig() error {
return nil
}
// IsRootless returns conf.Rootless on Unix but false on Windows
// IsRootless returns conf.Rootless on Linux but false on Windows
func (conf *Config) IsRootless() bool {
return false
}