Documentation
¶
Overview ¶
Package types contains types that are common across libnetwork project
Index ¶
- func CompareIPNet(a, b *net.IPNet) bool
- func ForbiddenErrorf(format string, params ...any) error
- func GetBroadcastIP(ip net.IP, mask net.IPMask) (net.IP, error)
- func GetHostPartIP(ip net.IP, mask net.IPMask) (net.IP, error)
- func GetIPNetCanonical(nw *net.IPNet) *net.IPNet
- func GetIPNetCopy(from *net.IPNet) *net.IPNet
- func InternalErrorf(format string, params ...any) error
- func InternalMaskableErrorf(format string, params ...any) error
- func InvalidParameterErrorf(format string, params ...any) error
- func NotFoundErrorf(format string, params ...any) error
- func NotImplementedErrorf(format string, params ...any) error
- func ParseCIDR(cidr string) (*net.IPNet, error)
- func UnavailableErrorf(format string, params ...any) error
- type EncryptionKey
- type IPFamily
- type InterfaceStatistics
- type InternalError
- type MaskableError
- type PortBinding
- type Protocol
- type QosPolicy
- type RouteType
- type StaticRoute
- type TransportPort
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CompareIPNet ¶
CompareIPNet returns equal if the two IP Networks are equal
func ForbiddenErrorf ¶
ForbiddenErrorf creates an instance of errdefs.ErrForbidden.
func GetBroadcastIP ¶
GetBroadcastIP returns the broadcast ip address for the passed network (ip and mask). IP address representation is not modified. If address and mask are not compatible an error is returned.
func GetHostPartIP ¶
GetHostPartIP returns the host portion of the ip address identified by the mask. IP address representation is not modified. If address and mask are not compatible an error is returned.
func GetIPNetCanonical ¶
GetIPNetCanonical returns the canonical form of the given IP network, where the IP is masked with the subnet mask. If the input is nil, it returns nil.
func GetIPNetCopy ¶
GetIPNetCopy returns a copy of the passed IP Network. If the input is nil, it returns nil.
func InternalErrorf ¶
InternalErrorf creates an instance of InternalError
func InternalMaskableErrorf ¶
InternalMaskableErrorf creates an instance of InternalError and MaskableError
func InvalidParameterErrorf ¶
InvalidParameterErrorf creates an instance of errdefs.ErrInvalidParameter.
func NotFoundErrorf ¶
NotFoundErrorf creates an instance of errdefs.ErrNotFound.
func NotImplementedErrorf ¶
NotImplementedErrorf creates an instance of errdefs.ErrNotImplemented.
func UnavailableErrorf ¶
UnavailableErrorf creates an instance of errdefs.ErrUnavailable
Types ¶
type EncryptionKey ¶
EncryptionKey is the libnetwork representation of the key distributed by the lead manager.
type InterfaceStatistics ¶
type InterfaceStatistics struct { RxBytes uint64 RxPackets uint64 RxErrors uint64 RxDropped uint64 TxBytes uint64 TxPackets uint64 TxErrors uint64 TxDropped uint64 }
InterfaceStatistics represents the interface's statistics
func (*InterfaceStatistics) String ¶
func (is *InterfaceStatistics) String() string
type InternalError ¶
type InternalError interface {
// Internal makes implementer into InternalError type
Internal()
}
InternalError is an interface for errors raised because of an internal error
type MaskableError ¶
type MaskableError interface {
// Maskable makes implementer into MaskableError type
Maskable()
}
MaskableError is an interface for errors which can be ignored by caller
type PortBinding ¶
type PortBinding struct { Proto Protocol IP net.IP Port uint16 HostIP net.IP HostPort uint16 HostPortEnd uint16 }
PortBinding represents a port binding between the container and the host
func (PortBinding) ContainerAddr ¶
func (p PortBinding) ContainerAddr() (net.Addr, error)
ContainerAddr returns the container side transport address
func (PortBinding) Copy ¶
func (p PortBinding) Copy() PortBinding
Copy returns a deep copy of the PortBinding.
func (PortBinding) Equal ¶
func (p PortBinding) Equal(o PortBinding) bool
Equal returns true if o has the same values as p, else false.
func (PortBinding) HostAddr ¶
func (p PortBinding) HostAddr() (net.Addr, error)
HostAddr returns the host side transport address
func (PortBinding) String ¶
func (p PortBinding) String() string
String returns the PortBinding structure in the form "HostIP:HostPort:IP:Port/Proto", omitting un-set fields apart from Port.
type Protocol ¶
type Protocol uint8
Protocol represents an IP protocol number
const ( ICMP Protocol = 1 // ICMP (Internet Control Message Protocol) — [syscall.IPPROTO_ICMP] TCP Protocol = 6 // TCP (Transmission Control Protocol) — [syscall.IPPROTO_TCP] UDP Protocol = 17 // UDP (User Datagram Protocol) — [syscall.IPPROTO_UDP] SCTP Protocol = 132 // SCTP (Stream Control Transmission Protocol) — [syscall.IPPROTO_SCTP] (not supported on Windows). )
func ParseProtocol ¶
ParseProtocol returns the respective Protocol type for the passed string
type QosPolicy ¶
type QosPolicy struct {
MaxEgressBandwidth uint64
}
QosPolicy represents a quality of service policy on an endpoint
type StaticRoute ¶
type StaticRoute struct { Destination *net.IPNet RouteType RouteType // NEXTHOP or CONNECTED NextHop net.IP // NextHop will be resolved by the kernel (i.e., as a loose hop). }
StaticRoute is a statically provisioned IP route.
func (*StaticRoute) Copy ¶
func (r *StaticRoute) Copy() *StaticRoute
Copy returns a copy of this StaticRoute structure
type TransportPort ¶
TransportPort represents a local Layer 4 endpoint
func (*TransportPort) String ¶
func (t *TransportPort) String() string
String returns the TransportPort structure in string form