mirror of
https://github.com/moby/moby.git
synced 2026-01-11 10:41:43 +00:00
Merge pull request #51150 from austinvazquez/fix-swarm-type
api: fix swarm network field from addr to prefix
This commit is contained in:
@@ -56,8 +56,8 @@ const (
|
||||
|
||||
// EndpointVirtualIP represents the virtual ip of a port.
|
||||
type EndpointVirtualIP struct {
|
||||
NetworkID string `json:",omitempty"`
|
||||
Addr netip.Addr `json:",omitempty"`
|
||||
NetworkID string `json:",omitempty"`
|
||||
Addr netip.Prefix `json:",omitempty"`
|
||||
}
|
||||
|
||||
// Network represents a network.
|
||||
@@ -91,8 +91,8 @@ type NetworkAttachmentConfig struct {
|
||||
|
||||
// NetworkAttachment represents a network attachment.
|
||||
type NetworkAttachment struct {
|
||||
Network Network `json:",omitempty"`
|
||||
Addresses []netip.Addr `json:",omitempty"`
|
||||
Network Network `json:",omitempty"`
|
||||
Addresses []netip.Prefix `json:",omitempty"`
|
||||
}
|
||||
|
||||
// IPAMOptions represents ipam options.
|
||||
|
||||
@@ -22,7 +22,7 @@ func networkAttachmentFromGRPC(na *swarmapi.NetworkAttachment) types.NetworkAtta
|
||||
if na != nil {
|
||||
return types.NetworkAttachment{
|
||||
Network: networkFromGRPC(na.Network),
|
||||
Addresses: sliceutil.Map(na.Addresses, func(s string) netip.Addr { a, _ := netip.ParseAddr(s); return a }),
|
||||
Addresses: sliceutil.Map(na.Addresses, func(s string) netip.Prefix { a, _ := netip.ParsePrefix(s); return a }),
|
||||
}
|
||||
}
|
||||
return types.NetworkAttachment{}
|
||||
@@ -130,7 +130,7 @@ func endpointFromGRPC(e *swarmapi.Endpoint) types.Endpoint {
|
||||
}
|
||||
|
||||
for _, v := range e.VirtualIPs {
|
||||
vip, _ := netip.ParseAddr(v.Addr)
|
||||
vip, _ := netip.ParsePrefix(v.Addr)
|
||||
endpoint.VirtualIPs = append(endpoint.VirtualIPs, types.EndpointVirtualIP{
|
||||
NetworkID: v.NetworkID,
|
||||
Addr: vip,
|
||||
|
||||
8
vendor/github.com/moby/moby/api/types/swarm/network.go
generated
vendored
8
vendor/github.com/moby/moby/api/types/swarm/network.go
generated
vendored
@@ -56,8 +56,8 @@ const (
|
||||
|
||||
// EndpointVirtualIP represents the virtual ip of a port.
|
||||
type EndpointVirtualIP struct {
|
||||
NetworkID string `json:",omitempty"`
|
||||
Addr netip.Addr `json:",omitempty"`
|
||||
NetworkID string `json:",omitempty"`
|
||||
Addr netip.Prefix `json:",omitempty"`
|
||||
}
|
||||
|
||||
// Network represents a network.
|
||||
@@ -91,8 +91,8 @@ type NetworkAttachmentConfig struct {
|
||||
|
||||
// NetworkAttachment represents a network attachment.
|
||||
type NetworkAttachment struct {
|
||||
Network Network `json:",omitempty"`
|
||||
Addresses []netip.Addr `json:",omitempty"`
|
||||
Network Network `json:",omitempty"`
|
||||
Addresses []netip.Prefix `json:",omitempty"`
|
||||
}
|
||||
|
||||
// IPAMOptions represents ipam options.
|
||||
|
||||
Reference in New Issue
Block a user