Documentation ¶
Overview ¶
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 ¶
- func ClassifyFlow(flow *types.Flow) (result types.ClassificationResult)
- func ClassifyFlowAllModules(flow *types.Flow) (results []types.ClassificationResult)
- func Destroy() (errs []error)
- func GetPacketFlow(packet gopacket.Packet) (*types.Flow, bool)
- func Initialize(opts ...Options) (errs []error)
- func SetCacheExpiration(expiration time.Duration)
- func SetModules(modules []types.Module)
- type ClassifierOption
- type Options
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClassifyFlow ¶
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 ¶
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 ¶
func Destroy() (errs []error)
Destroy frees all allocated resources and deactivates the active modules.
func GetPacketFlow ¶
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 ¶
Initialize initializes the library and the selected modules.
func SetCacheExpiration ¶
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 ¶
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.
Types ¶
type ClassifierOption ¶
type ClassifierOption struct { }
ClassifierOption take classifier options to override default values for now this option was added for test
func (ClassifierOption) Apply ¶
func (o ClassifierOption) Apply(mod types.Module)
Directories ¶
Path | Synopsis |
---|---|
modules
|
|
classifiers
Package classifiers contains the custom classifiers for each protocol and the helpers for applying them on a flow.
|
Package classifiers contains the custom classifiers for each protocol and the helpers for applying them on a flow. |
Package types contains the basic types used by the library.
|
Package types contains the basic types used by the library. |
Package utils provides some useful utility functions to the library.
|
Package utils provides some useful utility functions to the library. |