vendor: github.com/moby/moby/api, client 0769fe708773 (master)

full diff: 4ca8aedf92...0769fe7087

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn
2025-10-06 12:54:54 +02:00
parent 6ddff81bee
commit f81816ef88
175 changed files with 1514 additions and 1830 deletions

View File

@ -4,6 +4,7 @@ import (
"context"
"fmt"
"net"
"net/netip"
"strings"
"github.com/docker/cli/cli"
@ -67,9 +68,22 @@ func newInitCommand(dockerCLI command.Cli) *cobra.Command {
func runInit(ctx context.Context, dockerCLI command.Cli, flags *pflag.FlagSet, opts initOptions) error {
apiClient := dockerCLI.Client()
defaultAddrPool := make([]string, 0, len(opts.defaultAddrPools))
// TODO(thaJeztah): change opts.defaultAddrPools a []netip.Prefix; see https://github.com/docker/cli/pull/6545#discussion_r2420361609
defaultAddrPool := make([]netip.Prefix, 0, len(opts.defaultAddrPools))
for _, p := range opts.defaultAddrPools {
defaultAddrPool = append(defaultAddrPool, p.String())
if len(p.IP) == 0 {
continue
}
ip := p.IP.To4()
if ip == nil {
ip = p.IP.To16()
}
addr, ok := netip.AddrFromSlice(ip)
if !ok {
return fmt.Errorf("invalid IP address: %s", p.IP)
}
ones, _ := p.Mask.Size()
defaultAddrPool = append(defaultAddrPool, netip.PrefixFrom(addr, ones))
}
req := swarm.InitRequest{
ListenAddr: opts.listenAddr.String(),