types

package
v1.20.0-pre.4 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2026 License: Apache-2.0 Imports: 11 Imported by: 15

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 EmptyNidPortSeq

func EmptyNidPortSeq(func(identity.NumericIdentity, uint16) bool)

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) FromAddr added in v1.15.0

func (v4 *IPv4) FromAddr(addr netip.Addr)

FromAddr will populate the receiver with the specified address if and only if the provided address is a valid IPv4 address. Any other address, including the "invalid ip" value netip.Addr{} will zero the receiver.

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) FromAddr added in v1.15.0

func (v6 *IPv6) FromAddr(addr netip.Addr)

FromAddr will populate the receiver with the specified address if and only if the provided address is a valid IPv6 address. Any other address, including the "invalid ip" value netip.Addr{} will zero the receiver.

func (IPv6) IsZero added in v1.18.0

func (v6 IPv6) IsZero() bool

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) 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 u8proto.U8proto) (uint16, error)

GetNamedPort returns the port number for the named port, if any. proto must be a concrete protocol; u8proto.ANY does not match named ports.

type NamedPortMultiMap

type NamedPortMultiMap interface {
	// GetNamedPort returns the port number for the named port, if any. proto
	// must be a concrete protocol; u8proto.ANY does not match named ports.
	GetNamedPort(name string, proto u8proto.U8proto, nids iter.Seq[identity.NumericIdentity]) (uint16, error)

	// GetNamedPorts returns the port numbers for the named port, if any, by
	// numeric identity. proto must be a concrete protocol; u8proto.ANY does
	// not match named ports.
	GetNamedPorts(name string, proto u8proto.U8proto, nids iter.Seq[identity.NumericIdentity]) NidPortSeq

	// Len returns the number of named port/protocol mappings known.
	Len() int
}

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

type NidPortSeq

func (NidPortSeq) Ports

func (s NidPortSeq) Ports() []uint16

type PortProto

type PortProto struct {
	Proto u8proto.U8proto // concrete protocol; u8proto.ANY is invalid
	Port  uint16          // non-0
}

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

type XfrmStateInfo added in v1.19.0

type XfrmStateInfo struct {
	Encrypt  bool   `json:"encrypt"`
	Src      string `json:"src"`
	Dst      string `json:"dst"`
	SPI      uint32 `json:"spi"`
	ReqID    uint32 `json:"reqid"`
	AuthAlg  string `json:"auth_alg,omitempty"`
	AuthKey  string `json:"auth_key,omitempty"`
	CryptAlg string `json:"crypt_alg,omitempty"`
	CryptKey string `json:"crypt_key,omitempty"`
	AeadAlg  string `json:"aead_alg,omitempty"`
	AeadKey  string `json:"aead_key,omitempty"`
}

XfrmStateInfo represents the key information from an XFRM state This struct is used for JSON serialization of XFRM state information and is shared between cilium-dbg and cilium-cli for consistency

Jump to

Keyboard shortcuts

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