Documentation ¶
Overview ¶
Package wrappers contains wrappers for external libraries such as nDPI in order to use them for flow classification.
Index ¶
- Constants
- type NDPIWrapper
- type NDPIWrapperProvider
- type Wrapper
- type WrapperError
- type WrapperModule
- func (module *WrapperModule) ClassifyFlow(flow *types.Flow) (result types.ClassificationResult)
- func (module *WrapperModule) ClassifyFlowAll(flow *types.Flow) (results []types.ClassificationResult)
- func (module *WrapperModule) ConfigureModule(config WrapperModuleConfig)
- func (module *WrapperModule) Destroy() error
- func (module *WrapperModule) Initialize() error
- type WrapperModuleConfig
Constants ¶
const NDPIWrapperName = "nDPI"
NDPIWrapperName is the identification of the nDPI library.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type NDPIWrapper ¶
type NDPIWrapper struct {
// contains filtered or unexported fields
}
NDPIWrapper is the wrapper for the nDPI deep inspection library, providing the methods used to interface with it from go-dpi.
func NewNDPIWrapper ¶
func NewNDPIWrapper() *NDPIWrapper
NewNDPIWrapper constructs an NDPIWrapper with the default implementation for its methods.
func (*NDPIWrapper) ClassifyFlow ¶
ClassifyFlow classifies a flow using the nDPI library. It returns the detected protocol and any error.
func (*NDPIWrapper) DestroyWrapper ¶
func (wrapper *NDPIWrapper) DestroyWrapper() error
DestroyWrapper destroys the nDPI wrapper.
func (*NDPIWrapper) GetWrapperName ¶
func (wrapper *NDPIWrapper) GetWrapperName() types.ClassificationSource
GetWrapperName returns the name of the wrapper, in order to identify which wrapper provided a classification.
func (*NDPIWrapper) InitializeWrapper ¶
func (wrapper *NDPIWrapper) InitializeWrapper() int
InitializeWrapper initializes the nDPI wrapper.
type NDPIWrapperProvider ¶
type NDPIWrapperProvider struct {
// contains filtered or unexported fields
}
NDPIWrapperProvider provides NDPIWrapper with the implementations of the methods to use.
type Wrapper ¶
type Wrapper interface { InitializeWrapper() int DestroyWrapper() error ClassifyFlow(*types.Flow) (types.Protocol, error) GetWrapperName() types.ClassificationSource }
Wrapper is implemented by every wrapper. It contains methods for initializing and destroying the wrapper, as well as for classifying a flow.
type WrapperError ¶
type WrapperError struct { WrapperName types.ClassificationSource // contains filtered or unexported fields }
WrapperError contains the error and the name of the wrapper for a wrapper that failed to initialize.
type WrapperModule ¶
type WrapperModule struct { WrapperErrors []WrapperError // contains filtered or unexported fields }
WrapperModule is the module that contains wrappers for other protocol identification libraries.
func NewWrapperModule ¶
func NewWrapperModule() *WrapperModule
NewWrapperModule returns a new WrapperModule with the default configuration. By default, all wrappers will be enabled.
func (*WrapperModule) ClassifyFlow ¶
func (module *WrapperModule) ClassifyFlow(flow *types.Flow) (result types.ClassificationResult)
ClassifyFlow applies all the wrappers to a flow and returns the protocol that is detected by a wrapper if there is one. Otherwise, it returns the Undefined protocol.
func (*WrapperModule) ClassifyFlowAll ¶
func (module *WrapperModule) ClassifyFlowAll(flow *types.Flow) (results []types.ClassificationResult)
ClassifyFlowAll applies all the wrappers to a flow and returns the protocols that are detected by each one in an array.
func (*WrapperModule) ConfigureModule ¶
func (module *WrapperModule) ConfigureModule(config WrapperModuleConfig)
ConfigureModule configures this module instance with the given configuration. This should called before the module instance is initialized, otherwise Destroy and Initialize should be called on the module manually.
func (*WrapperModule) Destroy ¶
func (module *WrapperModule) Destroy() error
Destroy destroys all active wrappers.
func (*WrapperModule) Initialize ¶
func (module *WrapperModule) Initialize() error
Initialize initializes all wrappers and filters out the ones that don't get initialized correctly. It returns the errors thrown during the initialization of the wrappers and the names of the wrappers that errored.
type WrapperModuleConfig ¶
type WrapperModuleConfig struct {
Wrappers []Wrapper
}
WrapperModuleConfig is given to the module's ConfigureModule method, in order to set which wrappers are active and their order.