[go: up one dir, main page]

types

package
v2.0.0-beta.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 5, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package types contains types that are common across libnetwork project

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompareIPNet

func CompareIPNet(a, b *net.IPNet) bool

CompareIPNet returns equal if the two IP Networks are equal

func ForbiddenErrorf

func ForbiddenErrorf(format string, params ...any) error

ForbiddenErrorf creates an instance of errdefs.ErrForbidden.

func GetBroadcastIP

func GetBroadcastIP(ip net.IP, mask net.IPMask) (net.IP, error)

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

func GetHostPartIP(ip net.IP, mask net.IPMask) (net.IP, error)

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

func GetIPNetCanonical(nw *net.IPNet) *net.IPNet

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

func GetIPNetCopy(from *net.IPNet) *net.IPNet

GetIPNetCopy returns a copy of the passed IP Network. If the input is nil, it returns nil.

func InternalErrorf

func InternalErrorf(format string, params ...any) error

InternalErrorf creates an instance of InternalError

func InternalMaskableErrorf

func InternalMaskableErrorf(format string, params ...any) error

InternalMaskableErrorf creates an instance of InternalError and MaskableError

func InvalidParameterErrorf

func InvalidParameterErrorf(format string, params ...any) error

InvalidParameterErrorf creates an instance of errdefs.ErrInvalidParameter.

func NotFoundErrorf

func NotFoundErrorf(format string, params ...any) error

NotFoundErrorf creates an instance of errdefs.ErrNotFound.

func NotImplementedErrorf

func NotImplementedErrorf(format string, params ...any) error

NotImplementedErrorf creates an instance of errdefs.ErrNotImplemented.

func ParseCIDR

func ParseCIDR(cidr string) (*net.IPNet, error)

ParseCIDR returns the *net.IPNet represented by the passed CIDR notation

func UnavailableErrorf

func UnavailableErrorf(format string, params ...any) error

UnavailableErrorf creates an instance of errdefs.ErrUnavailable

Types

type EncryptionKey

type EncryptionKey struct {
	Subsystem   string
	Algorithm   int32
	Key         []byte
	LamportTime uint64
}

EncryptionKey is the libnetwork representation of the key distributed by the lead manager.

type IPFamily

type IPFamily int

IPFamily specify IP address type(s).

const (
	IP   IPFamily = syscall.AF_UNSPEC // Either IPv4 or IPv6.
	IPv4 IPFamily = syscall.AF_INET   // Internet Protocol version 4 (IPv4).
	IPv6 IPFamily = syscall.AF_INET6  // Internet Protocol version 6 (IPv6).
)

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

func ParseProtocol(s string) Protocol

ParseProtocol returns the respective Protocol type for the passed string

func (Protocol) String

func (p Protocol) String() string

type QosPolicy

type QosPolicy struct {
	MaxEgressBandwidth uint64
}

QosPolicy represents a quality of service policy on an endpoint

type RouteType

type RouteType int
const (
	NEXTHOP   RouteType = iota // NEXTHOP indicates a StaticRoute with an IP next hop.
	CONNECTED                  // CONNECTED indicates a StaticRoute with an interface for directly connected peers.
)

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

type TransportPort struct {
	Proto Protocol
	Port  uint16
}

TransportPort represents a local Layer 4 endpoint

func (*TransportPort) String

func (t *TransportPort) String() string

String returns the TransportPort structure in string form

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL