xdpcap: github.com/cloudflare/xdpcap Index | Files | Directories

package xdpcap

import "github.com/cloudflare/xdpcap"


Package Files



var HookMapABI = ebpf.MapABI{
    Type:      ebpf.ProgramArray,
    KeySize:   4,
    ValueSize: 4,

HookMapABI is the ABI of the underlying prog map created

type Hook Uses

type Hook struct {
    // contains filtered or unexported fields

Hook represents an xdpcap hook point. This hook can be reused with several programs.

func NewHook Uses

func NewHook(fileName string) (*Hook, error)

NewHook creates a new Hook, that can be Pin()'d to fileName. fileName must be inside a bpffs

func (*Hook) Close Uses

func (h *Hook) Close() error

Close releases any resources held It does not Rm()

func (*Hook) Patch Uses

func (h *Hook) Patch(spec *ebpf.CollectionSpec, hookMapSymbol string) error

Patch edits all programs in the spec that refer to hookMapSymbol to use this hook.

This function is a no-op if called on a nil Hook.

func (*Hook) Pin Uses

func (h *Hook) Pin() error

Pin persists the underlying map to a file, overwriting it if it already exists

func (*Hook) Rm Uses

func (h *Hook) Rm() error

Rm deletes files created by Pin()


cmd/bpfoffProgram bpfoff converts a tcpdump / libpcap filter expression to a BPF filter matching packets with a fixed set of byte offsets.
cmd/xdpcapProgram xdpcap produces tcpdump compatible PCAPs from a BPF map.

Package xdpcap imports 4 packages (graph) and is imported by 1 packages. Updated 2019-09-06. Refresh now. Tools for package owners.