bpf

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const ConfigPrefix = "__cfg_"

ConfigPrefix is the prefix for configuration data in the BPF object layout

View Source
const ConfigSection = ".rodata.config"

ConfigSection is the section name for configuration data in the BPF object layout

Variables

This section is empty.

Functions

func Configure

func Configure(spec *ebpf.CollectionSpec, cfg interface{}) error

Configure populates eBPF CollectionSpec variables from a configuration struct. It uses reflection to read struct tags in the format `ebpf:"variable_name[,transform]"` and sets the corresponding variables in the spec using the ConfigPrefix.

Supported transformations:

  • bytes32: converts string to [32]byte array

Example:

type Config struct {
    Port uint16 `ebpf:"port"`
    Key  string `ebpf:"key,bytes32"`
}

Types

This section is empty.