ebpf

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2026 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Overview

Package ebpf provides eBPF program generation for protocol parsing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MapDef

type MapDef struct {
	Name       string `json:"name"`
	Type       string `json:"type"` // hash, array, percpu_hash
	KeySize    int    `json:"key_size"`
	ValueSize  int    `json:"value_size"`
	MaxEntries int    `json:"max_entries"`
}

MapDef represents an eBPF map definition.

type Program

type Program struct {
	Protocol string      `json:"protocol"`
	Type     ProgramType `json:"type"`
	Maps     []MapDef    `json:"maps"`
}

Program represents a generated eBPF program.

func Generate

func Generate(protocol string, progType ProgramType) *Program

Generate generates an eBPF C program for protocol parsing.

func (*Program) Describe

func (p *Program) Describe() string

Describe returns a program description.

func (*Program) ToC

func (p *Program) ToC() string

ToC generates the eBPF C source code.

type ProgramType

type ProgramType string

ProgramType represents an eBPF program type.

const (
	ProgXDP ProgramType = "xdp"
	ProgTC  ProgramType = "tc"
)

Jump to

Keyboard shortcuts

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