dpi

package
v0.16.6 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2026 License: BSD-3-Clause, GPL-3.0 Imports: 16 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

Overview

Package dpi implements an interface for application layer classification via bindings to nDPI and libprotoident

Index

Constants

This section is empty.

Variables

View Source
var (
	// NDPIVersion is the version of nDPI library linked against
	NDPIVersion = "unknown"

	// LibprotoidentVersion is the version of libprotoident library linked against
	LibprotoidentVersion = "unknown"

	// GoDPIVersion is the version of go-dpi wrapper used
	GoDPIVersion = "v1.5.0"
)

These variables can be set at build time using ldflags Example: -ldflags "-X github.com/dreadl0ck/netcap/internal/dpi.NDPIVersion=4.14.0"

Functions

func Destroy

func Destroy()

Destroy releases native contexts and all tracked flow state. Concurrent calls are safe; already disabled engines are left untouched.

func GetModuleProtocols

func GetModuleProtocols() map[string][]string

GetModuleProtocols returns a map of module names to their supported protocols using the new GetSupportedProtocols APIs introduced in go-dpi v1.3.0

func GetProtocols

func GetProtocols(packet gopacket.Packet) map[string]ClassificationResult

GetProtocols returns a map of all the identified protocol names to a result datastructure packets are identified with libprotoident, nDPI and a few custom heuristics from godpi. Will return nil if dpi is disabled. Native engines keep incremental state until detection or the inspection budget.

func GetVersionInfo

func GetVersionInfo() string

GetVersionInfo returns a formatted string with DPI library versions

func HasDPISupport

func HasDPISupport() bool

HasDPISupport returns true when DPI support is compiled in

func Init

func Init(modules string)

Init initializes the deep packet inspection engines. modules is a comma-separated list of modules to enable: lpi, ndpi, go If empty, all modules will be enabled. This function is thread-safe and will only execute once if called concurrently.

func InitWithConfig

func InitWithConfig(modules string, config RuntimeConfig)

func IsEnabled

func IsEnabled() bool

IsEnabled will return true if goDPI has been initialized

func NewProto

func NewProto(res *ClassificationResult) *types.Protocol

NewProto initializes a new protocol.

func Reset

func Reset(modules string)

Reset tears down the current DPI state without reinitializing it.

Types

type RuntimeConfig

type RuntimeConfig struct {
	Workers     int
	MaxFlows    int
	IdleTimeout time.Duration
}

RuntimeConfig controls the throughput/native-context-memory tradeoff and flow retention. Zero values select automatic workers (up to 8), 65,536 flows, and a five-minute idle timeout.

Jump to

Keyboard shortcuts

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