go-dpi: github.com/mushorg/go-dpi Index | Files | Directories

package godpi

import "github.com/mushorg/go-dpi"

Package godpi provides the main API interface for utilizing the go-dpi library.

Package godpi provides the main API interface for utilizing the go-dpi library.

Index

Package Files

godpi.go options.go

func ClassifyFlow Uses

func ClassifyFlow(flow *types.Flow) (result types.ClassificationResult)

ClassifyFlow takes a Flow and tries to classify it with all of the activated modules in order, until one of them manages to classify it. It returns the detected protocol as well as the source that made the classification. If no classification is made, the protocol Unknown is returned.

func ClassifyFlowAllModules Uses

func ClassifyFlowAllModules(flow *types.Flow) (results []types.ClassificationResult)

ClassifyFlowAllModules takes a Flow and tries to classify it with all of the activated modules. However, as opposed to ClassifyFlow, it will return all of the results returned from the modules, not only the first successful one.

func Destroy Uses

func Destroy() (errs []error)

Destroy frees all allocated resources and deactivates the active modules.

func GetPacketFlow Uses

func GetPacketFlow(packet gopacket.Packet) (*types.Flow, bool)

GetPacketFlow returns a Flow for the given packet. If another packet has been processed before that was part of the same communication flow, the same Flow will be returned, with the new packet added. Otherwise, a new Flow will be created with only this packet. The function also returns whether the returned Flow is a new one, and not one that already existed.

func Initialize Uses

func Initialize(opts ...Options) (errs []error)

Initialize initializes the library and the selected modules.

func SetCacheExpiration Uses

func SetCacheExpiration(expiration time.Duration)

SetCacheExpiration sets how long after being inactive flows should be discarded from the flow tracker. If a negative value is passed, flows will never expire. By default, this value is 5 minutes. After calling this method, Initialize should be called, in order to initialize the cache. If Initialize has already been called before, Destroy should be called as well before Initialize.

func SetModules Uses

func SetModules(modules []types.Module)

SetModules selects the modules to be used by the library and their order. After calling this method, Initialize should be called, in order to initialize any new modules. If Initialize has already been called before, Destroy should be called as well before Initialize.

type ClassifierOption Uses

type ClassifierOption struct {
}

ClassifierOption take classifier options to override default values for now this option was added for test

func (ClassifierOption) Apply Uses

func (o ClassifierOption) Apply(mod types.Module)

type MLOption Uses

type MLOption struct {
    TCPModelPath string
    UDPModelPath string
    Threshold    float32
}

MLOption take ml module options to override default values

func (MLOption) Apply Uses

func (o MLOption) Apply(mod types.Module)

Apply ml module option to LinearSVCModule

type Options Uses

type Options interface {
    Apply(types.Module)
}

Options allow end users init module with custom options NOTE. it's necessary to check the module passed in Apply func

Directories

PathSynopsis
godpi_example
modules/classifiersPackage classifiers contains the custom classifiers for each protocol and the helpers for applying them on a flow.
modules/mlPackage ml contains machine learning methods for flow classification.
modules/wrappersPackage wrappers contains wrappers for external libraries such as nDPI in order to use them for flow classification.
typesPackage types contains the basic types used by the library.
utilsPackage utils provides some useful utility functions to the library.

Package godpi imports 6 packages (graph) and is imported by 2 packages. Updated 2020-10-29. Refresh now. Tools for package owners.