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.
Click to show internal directories.
Click to hide internal directories.