Merge pull request #49350 from thaJeztah/windows_clean_errors

libnetwork/drivers/windows: remove ErrUnsupportedAddressType
This commit is contained in:
Sebastiaan van Stijn
2025-01-28 16:30:49 +01:00
committed by GitHub

View File

@@ -15,16 +15,7 @@ import (
"github.com/ishidawataru/sctp"
)
const (
maxAllocatePortAttempts = 10
)
// ErrUnsupportedAddressType is returned when the specified address type is not supported.
type ErrUnsupportedAddressType string
func (uat ErrUnsupportedAddressType) Error() string {
return fmt.Sprintf("unsupported address type: %s", string(uat))
}
const maxAllocatePortAttempts = 10
// AllocatePorts allocates ports specified in bindings from the portMapper
func AllocatePorts(portMapper *portmapper.PortMapper, bindings []types.PortBinding, containerIP net.IP) ([]types.PortBinding, error) {
@@ -98,7 +89,7 @@ func allocatePort(portMapper *portmapper.PortMapper, bnd *types.PortBinding, con
break
default:
// For completeness
return ErrUnsupportedAddressType(fmt.Sprintf("%T", netAddr))
return fmt.Errorf("unsupported address type: %T", netAddr)
}
// Windows does not support host port ranges.
bnd.HostPortEnd = bnd.HostPort