types

package
v1.13.8 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2023 License: Apache-2.0 Imports: 9 Imported by: 14

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNilMap               = errors.New("nil map")
	ErrUnknownNamedPort     = errors.New("unknown named port")
	ErrIncompatibleProtocol = errors.New("incompatible protocol")
	ErrNamedPortIsZero      = errors.New("named port is zero")
	ErrDuplicateNamedPorts  = errors.New("duplicate named ports")
)

Functions

func NewNamedPortMultiMap

func NewNamedPortMultiMap() *namedPortMultiMap

func ValidatePortName

func ValidatePortName(name string) (string, error)

ValidatePortName checks that the port name conforms to the IANA Service Names spec and converts the port name to lower case for case-insensitive comparisons.

Types

type IPv4

type IPv4 [4]byte

IPv4 is the binary representation for encoding in binary structs.

func (IPv4) Addr

func (v4 IPv4) Addr() netip.Addr

func (*IPv4) DeepCopyInto

func (v4 *IPv4) DeepCopyInto(out *IPv4)

DeepCopyInto is a deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (IPv4) IP

func (v4 IPv4) IP() net.IP

func (IPv4) IsZero

func (v4 IPv4) IsZero() bool

func (IPv4) String

func (v4 IPv4) String() string

type IPv6

type IPv6 [16]byte

IPv6 is the binary representation for encoding in binary structs.

func (IPv6) Addr

func (v6 IPv6) Addr() netip.Addr

func (*IPv6) DeepCopyInto

func (v6 *IPv6) DeepCopyInto(out *IPv6)

DeepCopyInto is a deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (IPv6) IP

func (v6 IPv6) IP() net.IP

func (IPv6) String

func (v6 IPv6) String() string

type MACAddr

type MACAddr [6]byte

MACAddr is the binary representation for encoding in binary structs.

func (*MACAddr) DeepCopyInto

func (addr *MACAddr) DeepCopyInto(out *MACAddr)

DeepCopyInto is a deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (MACAddr) String

func (addr MACAddr) String() string

type NamedPortMap

type NamedPortMap map[string]PortProto

NamedPortMap maps port names to port numbers and protocols.

func (NamedPortMap) AddPort

func (npm NamedPortMap) AddPort(name string, port int, protocol string) error

AddPort adds a new PortProto to the NamedPortMap

func (NamedPortMap) GetNamedPort

func (npm NamedPortMap) GetNamedPort(name string, proto uint8) (uint16, error)

GetNamedPort returns the port number for the named port, if any.

type NamedPortMultiMap

type NamedPortMultiMap interface {
	// GetNamedPort returns the port number for the named port, if any.
	GetNamedPort(name string, proto uint8) (uint16, error)
	// Len returns the number of Name->PortProtoSet mappings known.
	Len() int
}

NamedPortMultiMap may have multiple entries for a name if multiple PODs define the same name with different values.

type PortProto

type PortProto struct {
	Port  uint16 // non-0
	Proto uint8  // 0 for any
}

PortProto is a pair of port number and protocol and is used as the value type in named port maps.

type PortProtoSet

type PortProtoSet counter.Counter[PortProto]

PortProtoSet is a reference-counted set of unique PortProto values.

func (PortProtoSet) Add

func (pps PortProtoSet) Add(pp PortProto) bool

Add increments the reference count for the specified key.

func (PortProtoSet) Delete

func (pps PortProtoSet) Delete(pp PortProto) bool

Delete decrements the reference count for the specified key.

func (PortProtoSet) Equal

func (pps PortProtoSet) Equal(other PortProtoSet) bool

Equal returns true if the PortProtoSets are equal.

Jump to

Keyboard shortcuts

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