moby/daemon/config
Sebastiaan van Stijn 84036d3e18
daemon/config: change DNSConfig.DNS to a []net.IP
Use a strong type for the DNS IP-addresses so that we can use flags.IPSliceVar,
instead of implementing our own option-type and validation.

Behavior should be the same, although error-messages have slightly changed:

Before this patch:

    dockerd --dns 1.1.1.1oooo --validate
    Status: invalid argument "1.1.1.1oooo" for "--dns" flag: 1.1.1.1oooo is not an ip address
    See 'dockerd --help'., Code: 125

    cat /etc/docker/daemon.json
    {"dns": ["1.1.1.1"]}

    dockerd --dns 2.2.2.2 --validate
    unable to configure the Docker daemon with file /etc/docker/daemon.json: the following directives are specified both as a flag and in the configuration file: dns: (from flag: [2.2.2.2], from file: [1.1.1.1])

    cat /etc/docker/daemon.json
    {"dns": ["1.1.1.1oooo"]}

    dockerd --validate
    unable to configure the Docker daemon with file /etc/docker/daemon.json: merged configuration validation from file and command line flags failed: 1.1.1.1ooooo is not an ip address

With this patch:

    dockerd --dns 1.1.1.1oooo --validate
    Status: invalid argument "1.1.1.1oooo" for "--dns" flag: invalid string being converted to IP address: 1.1.1.1oooo
    See 'dockerd --help'., Code: 125

    cat /etc/docker/daemon.json
    {"dns": ["1.1.1.1"]}

    dockerd --dns 2.2.2.2 --validate
    unable to configure the Docker daemon with file /etc/docker/daemon.json: the following directives are specified both as a flag and in the configuration file: dns: (from flag: [2.2.2.2], from file: [1.1.1.1])

    cat /etc/docker/daemon.json
    {"dns": ["1.1.1.1oooo"]}

    dockerd --validate
    unable to configure the Docker daemon with file /etc/docker/daemon.json: invalid IP address: 1.1.1.1oooo

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-11-13 12:22:51 +01:00
..
builder.go builder-next: adopt new wrapped types 2023-09-21 14:18:48 -06:00
builder_test.go daemon/config: use strings.Cut(), fix panic in BuilderGCFilter 2022-11-16 15:15:05 +01:00
config.go daemon/config: change DNSConfig.DNS to a []net.IP 2023-11-13 12:22:51 +01:00
config_linux.go daemon/config: Put params for the default network into a dedicated struct 2023-11-03 14:10:41 +01:00
config_linux_test.go daemon: consolidate runtimes config validation 2023-06-01 14:45:25 -04:00
config_test.go daemon/config: change DNSConfig.DNS to a []net.IP 2023-11-13 12:22:51 +01:00
config_windows.go daemon/config: Put params for the default network into a dedicated struct 2023-11-03 14:10:41 +01:00
config_windows_test.go daemon/config: clean up tests to use common helper 2023-01-10 13:54:17 -07:00
opts.go Bump swarmkit to v2 2022-04-21 17:33:07 -04:00