Documentation
¶
Overview ¶
Package pluginmanager handles the communication with the model and decision plugins
Index ¶
- func ModelProcessHandler(modelId string, modelProcess func(ModelInput) (ModelResults, error))
- type DecisionInput
- type ModelInput
- type ModelResults
- type ModelStatus
- type ModelTransmitionResults
- type PluginManager
- func (p *PluginManager) AddModelChannel(transactionId string, t cf.ModelPluginType, modelPlugStatus chan ModelStatus, ...)
- func (p *PluginManager) AddToQueue(modelId, transactionId, payload string) error
- func (p *PluginManager) CheckResult(transactionId, decisionId string, wafParams map[string]string) (bool, error)
- func (p *PluginManager) CloseTransaction(transactionId string)
- func (p *PluginManager) InitTransaction(transactionId string)
- func (p *PluginManager) ModelResultsHandler(modelId string)
- func (p *PluginManager) Process(modelID, transactionId, payload string, t cf.ModelPluginType, ...)
- func (p *PluginManager) RemoveAsyncModelChannel(transactionId string, t cf.ModelPluginType)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ModelProcessHandler ¶
func ModelProcessHandler(modelId string, modelProcess func(ModelInput) (ModelResults, error))
ModelProcessHandler listens for messages on the model queue
Types ¶
type DecisionInput ¶
type DecisionInput struct { TransactionId string Results map[string]ModelResults ModelWeight map[string]float64 WAFdata map[string]string }
DecisionInput is the struct that contains the input data for the decision plugin
type ModelInput ¶
type ModelInput struct { TransactionId string `json:"transactionId"` Payload string `json:"payload"` }
ModelInput is the struct that contains the input data for the model plugin
type ModelResults ¶
type ModelResults struct { ProbAttack float64 `json:"probattack"` Data map[string]interface{} `json:"data"` }
ResultData maps the model plugin ID with the corresponding analysis result.
type ModelStatus ¶
ModelStatus stores whether there was an error while processing a request (response) by the modelID model plugin
type ModelTransmitionResults ¶
type ModelTransmitionResults struct { TransactionId string `json:"transactionId"` ModelResults `json:",inline"` Error error `json:"error"` }
ModelTransmitionResults is the struct that contains the results of the model plugin
type PluginManager ¶
type PluginManager struct {
// contains filtered or unexported fields
}
PluginManager is the main plugin struct storing information of every plugin execution.
func (*PluginManager) AddModelChannel ¶
func (p *PluginManager) AddModelChannel(transactionId string, t cf.ModelPluginType, modelPlugStatus chan ModelStatus, modelType string)
AddModelChannel adds a channel to result channel map
func (*PluginManager) AddToQueue ¶
func (p *PluginManager) AddToQueue(modelId, transactionId, payload string) error
AddToQueue adds a payload to the model queue
func (*PluginManager) CheckResult ¶
func (p *PluginManager) CheckResult(transactionId, decisionId string, wafParams map[string]string) (bool, error)
CheckResult is in charge of calling the decision plugin with id decisionID over the transaction with id transactID
func (*PluginManager) CloseTransaction ¶
func (p *PluginManager) CloseTransaction(transactionId string)
CloseTransaction closes the transaction with the given ID removing all sync model data
func (*PluginManager) InitTransaction ¶
func (p *PluginManager) InitTransaction(transactionId string)
InitTransaction initializes the transaction with the given ID
func (*PluginManager) ModelResultsHandler ¶
func (p *PluginManager) ModelResultsHandler(modelId string)
ModelResultsHandler listens for messages on the model results queue
func (*PluginManager) Process ¶
func (p *PluginManager) Process(modelID, transactionId, payload string, t cf.ModelPluginType, modelPlugStatus chan ModelStatus)
Process is in charge of calling the model plugin with id modelID
func (*PluginManager) RemoveAsyncModelChannel ¶
func (p *PluginManager) RemoveAsyncModelChannel(transactionId string, t cf.ModelPluginType)
RemoveModelChannel removes a channel from the result channel map