Categorygithub.com/rogercoll/ebpfutil
modulepackage
0.0.2
Repository: https://github.com/rogercoll/ebpfutil.git
Documentation: pkg.go.dev

# README

eBPFutil

Go Reference

Retrieves basic information of the pinned BPF programs and maps running in the host. This package cannot be used to load, attach, link or unload BPF programs, it can only be used to gather BPF stats.

Package Features

BPF Programs

stats.BPFPrograms() -> Returns an array of all the available BPF programs loaded in the system as a BPFProgram structure which contains the ID, FD and BPFProgInfo of the corresponding program. See examples/programs/main.go

BPF Maps

stats.BPFMaps() -> Returns an array of all the available BPF maps in the system as a BPFMap structure which contains the ID, FD and BPFMapInfo of the corresponding map. See examples/maps/main.go

For additional exported functionalities you check the public documentation.

Usage

Import it into your Go program and use any of the exported functions:

go get github.com/rogercoll/ebpfutil

# Packages

No description provided by the author
No description provided by the author

# Functions

GetMapFileDescriptor return the file descirptor of a given BPF map ID.
GetMapInfoByFD returns the BPF map information given its file descriptor.
GetProgramFileDescriptor return the file descirptor of a given BPF program ID.
GetProgInfoByFD returns the BPF program information given its file descriptor.
MapsID returns the ID of the attached BPF programs running in the host.
ProgramsID returns the ID of the attached BPF programs running in the host.

# Structs

https://elixir.bootlin.com/linux/latest/source/include/uapi/linux/bpf.h#L6003.
https://elixir.bootlin.com/linux/latest/source/include/uapi/linux/bpf.h#L5840.