model

package
v1.9.2-community Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	DirectionIngress = 0
	DirectionEgress  = 1
	MacLen           = 6
	// IPv4Type / IPv6Type value as defined in IEEE 802: https://www.iana.org/assignments/ieee-802-numbers/ieee-802-numbers.xhtml
	IPv6Type                 = 0x86DD
	NetworkEventsMaxEventsMD = 8
	MaxNetworkEvents         = 4
	MaxObservedInterfaces    = 6
)

Values according to field 61 in https://www.iana.org/assignments/ipfix/ipfix.xhtml

Variables

This section is empty.

Functions

func AccumulateBase

func AccumulateBase(p *ebpf.BpfFlowMetrics, other *ebpf.BpfFlowMetrics) *ebpf.BpfFlowMetrics

func AllZeroIP

func AllZeroIP(ip net.IP) bool

func AllZerosMac

func AllZerosMac(s [6]uint8) bool

func AllZerosMetaData

func AllZerosMetaData(s [NetworkEventsMaxEventsMD]uint8) bool

func IP

func IP(ia IPAddr) net.IP

IP returns the net.IP equivalent object

func IntEncodeV4

func IntEncodeV4(ia [net.IPv6len]uint8) uint32

IntEncodeV4 encodes an IPv4 address as an integer (in network encoding, big endian). It assumes that the passed IP is already IPv4. Otherwise, it would just encode the last 4 bytes of an IPv6 address

func SetGlobalIP

func SetGlobalIP(ip net.IP)

func SetInterfaceNamer

func SetInterfaceNamer(ifaceNamer InterfaceNamer)

Types

type BpfFlowContent

type BpfFlowContent struct {
	*ebpf.BpfFlowMetrics
	AdditionalMetrics *ebpf.BpfAdditionalMetrics
}

func NewBpfFlowContent

func NewBpfFlowContent(metrics ebpf.BpfFlowMetrics) BpfFlowContent

nolint:gocritic // hugeParam: metric is reported as heavy; but it needs to be copied anyway, we don't want a pointer here

func (*BpfFlowContent) AccumulateAdditional

func (p *BpfFlowContent) AccumulateAdditional(other *ebpf.BpfAdditionalMetrics)

func (*BpfFlowContent) AccumulateBase

func (p *BpfFlowContent) AccumulateBase(other *ebpf.BpfFlowMetrics)

type Direction

type Direction uint8

type HumanBytes

type HumanBytes uint64

type IPAddr

type IPAddr [net.IPv6len]uint8

IPAddr encodes v4 and v6 IPs with a fixed length. IPv4 addresses are encoded as IPv6 addresses with prefix ::ffff/96 as described in https://datatracker.ietf.org/doc/html/rfc4038#section-4.2 (same behavior as Go's net.IP type)

func IPAddrFromNetIP

func IPAddrFromNetIP(netIP net.IP) IPAddr

IPAddrFromNetIP returns IPAddr from net.IP

func (*IPAddr) MarshalJSON

func (ia *IPAddr) MarshalJSON() ([]byte, error)

type InterfaceNamer

type InterfaceNamer func(ifIndex int, mac MacAddr) string

type IntfDirUdn

type IntfDirUdn struct {
	Interface string
	Direction int
	Udn       string
}

func NewIntfDirUdn

func NewIntfDirUdn(intf string, dir int, cache map[string]string) IntfDirUdn

type MacAddr

type MacAddr [MacLen]uint8

func (*MacAddr) MarshalJSON

func (m *MacAddr) MarshalJSON() ([]byte, error)

func (*MacAddr) String

func (m *MacAddr) String() string

type PacketRecord

type PacketRecord struct {
	Stream []byte
	Time   time.Time
}

func NewPacketRecord

func NewPacketRecord(
	stream []byte,
	length uint32,
	ts time.Time,
) *PacketRecord

NewPacketRecord contains packet bytes

func ReadRawPacket

func ReadRawPacket(reader io.Reader) (*PacketRecord, error)

ReadRawPacket reads a PacketRecord from a binary source, in NativeEndian order

type RawByte

type RawByte byte

type RawRecord

type RawRecord ebpf.BpfFlowRecordT

record structure as parsed from eBPF

func ReadFrom

func ReadFrom(reader io.Reader) (*RawRecord, error)

ReadFrom reads a Record from a binary source, in NativeEndian order

type Record

type Record struct {
	ID      ebpf.BpfFlowId
	Metrics BpfFlowContent

	// TODO: redundant field from RecordMetrics. Reorganize structs
	TimeFlowStart time.Time
	TimeFlowEnd   time.Time
	DNSLatency    time.Duration
	Interfaces    []IntfDirUdn
	// AgentIP provides information about the source of the flow (the Agent that traced it)
	AgentIP net.IP
	// Calculated RTT which is set when record is created by calling NewRecord
	TimeFlowRtt            time.Duration
	NetworkMonitorEventsMD []map[string]string
}

Record contains accumulated metrics from a flow

func NewRecord

func NewRecord(
	key ebpf.BpfFlowId,
	metrics *BpfFlowContent,
	currentTime time.Time,
	monotonicCurrentTime uint64,
	s *ovnobserv.SampleDecoder,
	udnsCache map[string]string,
) *Record

Jump to

Keyboard shortcuts

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