xdp

package
v0.0.0-...-6c9d7dc Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LoadModeGeneric = "generic"
	LoadModeDriver  = "native"
	LoadModeOffload = "hw"
)

Variables

This section is empty.

Functions

func Get

func Get[K, V comparable](m map[K]V, key K, defaultValue V) V

func ReadCountMap

func ReadCountMap[K comparable, V any, A Adder[V]](
	m *ebpf.Map,
	keyParser func([]byte) K,
	valueParser func([]byte) A,
) (map[K]V, error)

Types

type Adder

type Adder[T any] interface {
	Add(T) T
}

func ParseCountValue

func ParseCountValue(value []byte) Adder[CountValue]

type CountValue

type CountValue struct {
	ByteCnt uint64
	PktCnt  uint64
}

func (CountValue) Add

func (lhs CountValue) Add(rhs CountValue) CountValue

type ProtoKey

type ProtoKey struct {
	L2           uint8
	L4           uint8
	L3           uint16
	L7           uint16
	TopProtoType uint16
}

func ParseProtoKey

func ParseProtoKey(key []byte) ProtoKey

func (*ProtoKey) Layers

func (*ProtoKey) Layers() []string

func (*ProtoKey) Protocols

func (p *ProtoKey) Protocols() []string

type XDP

type XDP struct {
	// contains filtered or unexported fields
}

func LoadAndAttach

func LoadAndAttach(nic string, prog io.ReaderAt, mode string) (*XDP, error)

func (*XDP) Close

func (x *XDP) Close()

func (*XDP) CountMap

func (x *XDP) CountMap() (map[ProtoKey]CountValue, error)

Jump to

Keyboard shortcuts

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