linux

package
v0.1.23 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2026 License: AGPL-3.0 Imports: 12 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

View Source
const BlockMark = 0x4d475442 // "MGTB"

BlockMark is the packet mark of the runtime's block verdict (NF_REPEAT): on the repeat the guard's nft chain stores it as the connection's ct mark and drops the packet, and the kernel drops every later packet of that connection, in both directions, without queueing it. An unusual constant, so no other software's marks match it.

Variables

This section is empty.

Functions

This section is empty.

Types

type Detection

type Detection struct {
	L4Protocol  string
	Signature   torrentguard.Protocol
	TunnelIface string
	TunnelIP    netip.Addr
}

Detection is one BitTorrent request a tunnel client sent. It names who (the tunnel address, which the agent maps to a user and does not report), never where to.

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