From a65f83317c88734536219209d975e7e3ca6c4f85 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Sat, 10 Jul 2021 14:40:25 +0200 Subject: [PATCH] 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 --- daemon/config/config_unix.go | 40 ++++++++++++++++----------------- daemon/config/config_windows.go | 16 ++++++------- 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/daemon/config/config_unix.go b/daemon/config/config_unix.go index 3aef861475..54922eb323 100644 --- a/daemon/config/config_unix.go +++ b/daemon/config/config_unix.go @@ -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 } diff --git a/daemon/config/config_windows.go b/daemon/config/config_windows.go index 47624fab46..eb9e71cbc4 100644 --- a/daemon/config/config_windows.go +++ b/daemon/config/config_windows.go @@ -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 }