dpi

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2026 License: BSD-3-Clause, GPL-3.0 Imports: 12 Imported by: 0

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.4.1"
)

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

Functions

func Destroy

func Destroy()

Destroy tears down godpi and frees the memory allocated for cgo. It also explicitly resets the internal flow tracker to release all tracked flows. Returned errors are logged to stdout. This function is NOT thread-safe!

func GetModuleProtocols added in v0.9.0

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. Classification is invoked for each packet up to MaxPacketsPerFlow; godpi internally manages when to actually perform classification based on MinPacketsForClassification.

func GetVersionInfo added in v0.7.3

func GetVersionInfo() string

GetVersionInfo returns a formatted string with DPI library versions

func HasDPISupport added in v0.7.3

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 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 added in v0.7.5

func Reset(modules string)

Reset destroys the current DPI state and reinitializes it. This should be called when resetting state between processing different files. It performs the following cleanup:

  1. Destroys all DPI modules (nDPI, LPI, go-dpi)
  2. Flushes and nils the FlowTrackerInstance (releases all tracked flows)
  3. Waits for C libraries to release memory
  4. Reinitializes with the same modules

Types

This section is empty.

Jump to

Keyboard shortcuts

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