portmaster: github.com/safing/portmaster/firewall/interception/nfqueue Index | Files

package nfqueue

import "github.com/safing/portmaster/firewall/interception/nfqueue"

Package nfqueue provides network interception capabilities on linux via iptables nfqueue.


Package Files

doc.go multiqueue.go nfqueue.go packet.go


const (
    NFQ_DROP   uint32 = 0 // discarded the packet
    NFQ_ACCEPT uint32 = 1 // the packet passes, continue iterations
    NFQ_STOLEN uint32 = 2 // gone away
    NFQ_QUEUE  uint32 = 3 // inject the packet into a different queue (the target queue number is in the high 16 bits of the verdict)
    NFQ_REPEAT uint32 = 4 // iterate the same cycle once more
    NFQ_STOP   uint32 = 5 // accept, but don't continue iterations

NFQ Packet Constants nolint:golint,stylecheck // FIXME


var (
    ErrVerdictSentOrTimedOut = errors.New("the verdict was already sent or timed out")

NFQ Errors

type NFQueue Uses

type NFQueue struct {
    DefaultVerdict uint32
    Timeout        time.Duration

    Packets chan packet.Packet
    // contains filtered or unexported fields

NFQueue holds a Linux NFQ Handle and associated information. nolint:maligned // FIXME

func NewNFQueue Uses

func NewNFQueue(qid uint16) (nfq *NFQueue, err error)

NewNFQueue initializes a new netfilter queue.

func (*NFQueue) Destroy Uses

func (nfq *NFQueue) Destroy()

Destroy closes all the nfqueues.

func (*NFQueue) Valid Uses

func (nfq *NFQueue) Valid() bool

Valid returns whether the NFQueue is still valid.

type Packet Uses

type Packet struct {

    QueueID    uint16
    ID         uint32
    HWProtocol uint16
    Hook       uint8
    Mark       uint32
    // contains filtered or unexported fields

Packet represents a packet with a NFQ reference.

func (*Packet) Accept Uses

func (pkt *Packet) Accept() error

Accept implements the packet interface.

func (*Packet) Block Uses

func (pkt *Packet) Block() error

Block implements the packet interface.

func (*Packet) Drop Uses

func (pkt *Packet) Drop() error

Drop implements the packet interface.

func (*Packet) PermanentAccept Uses

func (pkt *Packet) PermanentAccept() error

PermanentAccept implements the packet interface.

func (*Packet) PermanentBlock Uses

func (pkt *Packet) PermanentBlock() error

PermanentBlock implements the packet interface.

func (*Packet) PermanentDrop Uses

func (pkt *Packet) PermanentDrop() error

PermanentDrop implements the packet interface.

func (*Packet) RerouteToNameserver Uses

func (pkt *Packet) RerouteToNameserver() error

RerouteToNameserver implements the packet interface.

func (*Packet) RerouteToTunnel Uses

func (pkt *Packet) RerouteToTunnel() error

RerouteToTunnel implements the packet interface.

Package nfqueue imports 11 packages (graph) and is imported by 1 packages. Updated 2020-06-01. Refresh now. Tools for package owners.