nfqueue

package module
v0.0.0-...-1ca01ec Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CbCleanUp

type CbCleanUp func()

CbCleanUp defines callback for cleanups

type CbPacket

type CbPacket func(gopacket.Packet) (bool, Verdict, error)

CbPacket defines a callback on packet

type Hooks

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

Hooks is responsible for packet processor

func NewHooks

func NewHooks() *Hooks

NewHooks returns a new hooks collection

func (*Hooks) CleanUp

func (h *Hooks) CleanUp(fn CbCleanUp)

CleanUp adds a callback function when cleanup

func (*Hooks) OnPacket

func (h *Hooks) OnPacket(layer gopacket.LayerType, fn CbPacket)

OnPacket adds a callback function on new packet

type Nfqueue

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

Nfqueue is the main class of the component

func Open

func Open(qid int, hooks *Hooks, policy Verdict, opt ...Option) (*Nfqueue, error)

Open netfilter queue with qid and register hooks

func (*Nfqueue) Close

func (q *Nfqueue) Close() error

Close the queue

type Option

type Option func(*options)

Option encapsules options for server

func SetLogger

func SetLogger(l yalogi.Logger) Option

SetLogger option allows set a custom logger

func SetOnError

func SetOnError(v Verdict) Option

SetOnError option allows set verdict for errors in package decoding

type Verdict

type Verdict int

Verdict represents the actions that the firewall can do

const (
	Drop   Verdict = nfq.NfDrop
	Accept Verdict = nfq.NfAccept
)

Action types

func ToVerdict

func ToVerdict(s string) (Verdict, error)

ToVerdict returns action from a string

func (Verdict) String

func (v Verdict) String() string

Jump to

Keyboard shortcuts

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