ebpf

package
v0.0.0-...-afd2089 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2024 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrAlreadyAttached = fmt.Errorf("already attached to the interface")
	ErrNoAttach        = fmt.Errorf("not attached to the interface")
)
View Source
var ErrDeleteFromMap = errors.New("could not delete from map")
View Source
var ErrInsertToMap = errors.New("could not insert to map")
View Source
var (
	ErrInvalidUsage = errors.New("invalid usage")
)
View Source
var (
	ErrListMap = errors.New("could not list the map")
)
View Source
var FS = "/sys/fs/bpf"

Functions

func TDNSLookup

func TDNSLookup(c *qt.C, dns string, ok bool)

TDNSLookup tests if the DNS lookup works well without using DNS cache.

func TTCPWrite

func TTCPWrite(c *qt.C, address string, ok bool)

TTCPWrite tests the TCP connection through the address.

func WrapForAttached

func WrapForAttached(f func(e *EBPF) error) error

func WrapForDetached

func WrapForDetached(f func(e *EBPF) error) error

Types

type EBPF

type EBPF struct {
	Objects *generated.BpfObjects
	L       link.Link
}

EBPF keeps eBPF Objects(BpfPrograms, BpfMaps) and Link.

func New

func New() *EBPF

New returns a new EBPF.

func NewEBPF

func NewEBPF() (*EBPF, error)

NewEBPF returns a new loaded EBPF.

func NewEBPFWithLink() (*EBPF, error)

NewEBPFWithLink returns a new loaded EBPF by loading the link.

func (*EBPF) Attach

func (e *EBPF) Attach(iface *net.Interface) error

Attach attaches the eBPF program to the kernel with retry logic.

func (*EBPF) Close

func (e *EBPF) Close() error

Close cleans all resources.

func (*EBPF) Detach

func (e *EBPF) Detach() error

Detach unpins and closes FS and maps.

func (*EBPF) DropDNS

func (e *EBPF) DropDNS(dnss ...string) error

func (*EBPF) DropSrc

func (e *EBPF) DropSrc(srcs ...net.IP) error

func (*EBPF) ListDNS

func (e *EBPF) ListDNS() (map[string]int, error)

func (*EBPF) ListSrc

func (e *EBPF) ListSrc() (map[string]int, error)

func (*EBPF) Load

func (e *EBPF) Load() error

Load loads pre-compiled eBPF program.

func (*EBPF) UndropDNS

func (e *EBPF) UndropDNS(dnss ...string) error

func (*EBPF) UndropSrc

func (e *EBPF) UndropSrc(srcs ...net.IP) error

Jump to

Keyboard shortcuts

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