ebpf

package
v1.12.2 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2022 License: Apache-2.0 Imports: 11 Imported by: 5

Documentation

Overview

Package ebpf provides functions that allow golang programs to interact with ebpf maps by wrapping the cilium/ebpf library. +groupName=pkg

Index

Constants

View Source
const (
	PerCPUHash = ciliumebpf.PerCPUHash
	Array      = ciliumebpf.Array
	HashOfMaps = ciliumebpf.HashOfMaps
	LPMTrie    = ciliumebpf.LPMTrie

	PinByName = ciliumebpf.PinByName
)

Variables

View Source
var (
	ErrKeyNotExist = ciliumebpf.ErrKeyNotExist
)

Functions

func GetOpenMaps

func GetOpenMaps() []*models.BPFMap

GetOpenMaps returns a slice of all open BPF maps. This is identical to calling GetMap() on all open maps.

Types

type IterateCallback

type IterateCallback func(key, value interface{})

IterateCallback represents the signature of the callback function expected by the IterateWithCallback method, which in turn is used to iterate all the keys/values of a map.

type Map

type Map struct {
	*ciliumebpf.Map
	// contains filtered or unexported fields
}

Map represents an eBPF map.

func GetMap

func GetMap(name string) *Map

GetMap returns the registered map with the given name or absolute path

func LoadPinnedMap

func LoadPinnedMap(fileName string) (*Map, error)

LoadPinnedMap wraps cilium/ebpf's LoadPinnedMap.

func LoadRegisterMap

func LoadRegisterMap(mapName string) (*Map, error)

LoadRegisterMap loads the specified map from a bpffs pin path and registers its handle in the package-global map register.

func MapFromID

func MapFromID(id int) (*Map, error)

func NewMap

func NewMap(spec *MapSpec) *Map

NewMap creates a new Map object.

func (*Map) GetModel

func (m *Map) GetModel() *models.BPFMap

GetModel returns a BPF map in the representation served via the API.

func (*Map) IterateWithCallback

func (m *Map) IterateWithCallback(key, value interface{}, cb IterateCallback) error

IterateWithCallback iterates through all the keys/values of a map, passing each key/value pair to the cb callback.

func (*Map) OpenOrCreate

func (m *Map) OpenOrCreate() error

OpenOrCreate tries to open or create the eBPF map identified by the spec in the Map object.

type MapSpec

type MapSpec = ciliumebpf.MapSpec

Jump to

Keyboard shortcuts

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