linux

package
v0.1.11 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2026 License: AGPL-3.0 Imports: 11 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Detection

type Detection struct {
	SourceIP        netip.Addr
	SourcePort      uint16
	DestinationIP   netip.Addr
	DestinationPort uint16
	L4Protocol      string
	Signature       torrentguard.Protocol
	TunnelIface     string
	TunnelIP        netip.Addr
}

type Runtime

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

Runtime owns one kernel queue and a bounded userspace flow table. The nft rules that reference it must always use queue bypass.

func Start

func Start(queue uint16, ifaces []string, callback func(Detection)) (*Runtime, error)

Start binds a fail-open netfilter queue and starts its packet and event loops. The caller must install nft rules with queue bypass after this succeeds and remove those rules before Close.

func (*Runtime) Close

func (r *Runtime) Close() error

Close unbinds the owned queue and closes its netlink socket. Callers should remove the nft table first; its queue statements use bypass as a second fail-open safeguard.

func (*Runtime) SetCallback

func (r *Runtime) SetCallback(callback func(Detection))

SetCallback replaces the current event callback without interrupting packet inspection. Callback execution is isolated from the NFQUEUE receive loop.

func (*Runtime) SetInterfaces

func (r *Runtime) SetInterfaces(ifaces []string) error

SetInterfaces refreshes the exact active interface-index mapping and drops flow state only for interfaces whose identity changed or was removed.

func (*Runtime) Stopped

func (r *Runtime) Stopped() bool

Stopped reports whether the packet receive loop has exited.

Jump to

Keyboard shortcuts

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