xdp

package
v0.0.0-...-0e195c0 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrXDPLinkClose

type ErrXDPLinkClose struct {
	Errors []error
}

ErrXDPLinkClose is an error when closing fails (which can fail in multiple errors).

func (ErrXDPLinkClose) Error

func (e ErrXDPLinkClose) Error() string
type XDPLink struct {
	// contains filtered or unexported fields
}

XDPLink lets you interact with Quicpipe's eBPF XDP filter.

func Open

func Open() (*XDPLink, error)

Open loads the eBPF code. You should call Attach and AttachPort to load the code on an interface and activate it on a UDP port.

func (*XDPLink) AddIPv4Redirect

func (l *XDPLink) AddIPv4Redirect(addr *net.UDPAddr, cids ...[]byte) error

AddIPv4Redirect adds the UDP address to the IPv4 redirect map of the eBPF filter for all of the provided CIDs. The UDP address is assumed to be IPv4.

func (*XDPLink) Attach

func (l *XDPLink) Attach(iface *net.Interface) error

Attach attaches the eBPF filter to the provided interface.

func (*XDPLink) AttachPort

func (l *XDPLink) AttachPort(port uint16) error

AttachPort activates the eBPF filter on the provided UDP port on all attached interfaces.

func (*XDPLink) Close

func (l *XDPLink) Close() error

Close closes the eBPF XDP filter, releasing it from all attached interfaces.

func (*XDPLink) DetachPort

func (l *XDPLink) DetachPort(port uint16) error

DetachPort deactivates the eBPF filter on the provided UDP port on all attached interfaces.

func (*XDPLink) ReadRejectedCID

func (l *XDPLink) ReadRejectedCID(fn func(cid []byte) error) error

ReadRejectedCID reads a single CID from the rejected CID ring buffer. It waits until the read dedline set with SetReadDeadline. Once a CID is available, the provided callback is called. The CID bytes are available only for the duration of the function!

func (*XDPLink) RemoveIPv4Redirect

func (l *XDPLink) RemoveIPv4Redirect(cids ...[]byte) error

RemoveIPv4Redirect removes any redirects assigned to the provided CIDs.

func (*XDPLink) SetReadDeadline

func (l *XDPLink) SetReadDeadline(deadline time.Time) error

SetReadDeadline sets the read deadline (for use with ReadRejectedCID).

Jump to

Keyboard shortcuts

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