bpf

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2019 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AND  Operator = "and"
	OR            = "or"
	NOOP          = ""
)

Supported operators

View Source
const (
	SRC   Dir = "src"
	DST       = "dst"
	NODIR     = ""
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Dir

type Dir string

type Encoder

type Encoder struct {
	// contains filtered or unexported fields
}

func NewEncoder

func NewEncoder(w io.Writer) *Encoder

func (*Encoder) Encode

func (e *Encoder) Encode(set []onf.ONF) error

type Expr

type Expr string

Expr represents a BPF expression. It's zero value is ready to use.

func FromAddr

func FromAddr(d Dir, addr net.Addr) Expr

FromAddr returns a BPF from a network address, plus direction information. Use NODIR to make a filter that matches both src and dst packets.

func (Expr) And

func (l Expr) And(r string) Expr

And works as `Join`, but uses "and" to join the two expressions.

func (Expr) Join

func (l Expr) Join(r string) Expr

Join returns a new expression, made of the conjunction of the caller with `r`, wrapped in an Expr. Callers have to ensure that operator precedence is preserved.

func (Expr) NewReader

func (e Expr) NewReader() *strings.Reader

NewReader returns an io.Reader implementation, which will read the BPF expression from `e`. Later modifications of `e` will not affect the content of the reader.

func (Expr) Or

func (l Expr) Or(r string) Expr

Or is the same as `And`, but with "or".

func (Expr) Wrap

func (e Expr) Wrap() Expr

Wrap surrounds `e` with ().

type Operator

type Operator string

Jump to

Keyboard shortcuts

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