Documentation ¶
Index ¶
- Variables
- func InitConfig()
- func InitConfigFile(cnfFile string)
- type Action
- type Config
- type DisruptiveAction
- type FirewallRule
- type HTTPLog
- func (h *HTTPLog) Build(target *Target, request *http.Request, response *http.Response) *HTTPLog
- func (h *HTTPLog) NoResponse() *HTTPLog
- func (h *HTTPLog) OriginRequestEnd() *HTTPLog
- func (h *HTTPLog) OriginRequestStart() *HTTPLog
- func (h *HTTPLog) RequestRulesExecutionEnd() *HTTPLog
- func (h *HTTPLog) ResponseRulesExecutionEnd() *HTTPLog
- func (h *HTTPLog) ResponseRulesExecutionStart() *HTTPLog
- type IPRateLimiter
- type LogAction
- type Operator
- type Phase
- type Rule
- type RuleExecutionResult
- type Target
- type Variable
Constants ¶
This section is empty.
Variables ¶
var RulesCollection map[int][]*Rule
RulesCollection Rules collection
Functions ¶
func InitConfigFile ¶
func InitConfigFile(cnfFile string)
InitConfigFile initializes the config file
Types ¶
type Action ¶
type Action struct { ID string Phase Phase Transformations []string DisruptiveAction DisruptiveAction LogAction LogAction }
Action definition for Rules
func (*Action) ExecuteTransformation ¶
func (a *Action) ExecuteTransformation(variableData interface{}) interface{}
ExecuteTransformation transformation function executer
type Config ¶
type Config struct { ConnectionString string `json:"connectionString"` RateLimitSec int `json:"rateLimitSec"` RateLimitBurst int `json:"rateLimitBurst"` }
Config Application settings
var Configuration Config
Configuration ...
type DisruptiveAction ¶
type DisruptiveAction uint8
DisruptiveAction WAF Disruptive action
const ( //DisruptiveActionPass Pass DisruptiveActionPass DisruptiveAction = iota //DisruptiveActionBlock Blocks DisruptiveActionBlock //DisruptiveActionDrop Drop DisruptiveActionDrop //DisruptiveActionDeny Deny DisruptiveActionDeny //DisruptiveActionProxy Proxy(WTF) DisruptiveActionProxy )
func GetDisruptiveAction ¶
func GetDisruptiveAction(action string) DisruptiveAction
GetDisruptiveAction Gets the waf action with given action string
func (DisruptiveAction) ToString ¶
func (action DisruptiveAction) ToString() string
ToString for waf action
type FirewallRule ¶
FirewallRule The firewall rule
type HTTPLog ¶
type HTTPLog struct { TargetID string RequestURI string StatusCode int RequestRulesCheckElapsed int64 ResponseRulesCheckElapsed int64 HTTPElapsed int64 RequestSize int64 ResponseSize int64 // contains filtered or unexported fields }
HTTPLog represents http log
func (*HTTPLog) NoResponse ¶
NoResponse handles when no response
func (*HTTPLog) OriginRequestEnd ¶
OriginRequestEnd Origin request execution time measure ender
func (*HTTPLog) OriginRequestStart ¶
OriginRequestStart Origin request time measure starter
func (*HTTPLog) RequestRulesExecutionEnd ¶
RequestRulesExecutionEnd Calculates the time for execution of rules
func (*HTTPLog) ResponseRulesExecutionEnd ¶
ResponseRulesExecutionEnd Response execution time measure ender
func (*HTTPLog) ResponseRulesExecutionStart ¶
ResponseRulesExecutionStart Response execution time measure starter
type IPRateLimiter ¶
type IPRateLimiter struct {
// contains filtered or unexported fields
}
IPRateLimiter .
func NewIPRateLimiter ¶
func NewIPRateLimiter(r rate.Limit, b int) *IPRateLimiter
NewIPRateLimiter .
func (*IPRateLimiter) AddIP ¶
func (i *IPRateLimiter) AddIP(ip string) *rate.Limiter
AddIP creates a new rate limiter and adds it to the ips map, using the IP address as the key
func (*IPRateLimiter) GetLimiter ¶
func (i *IPRateLimiter) GetLimiter(ip string) *rate.Limiter
GetLimiter returns the rate limiter for the provided IP address if it exists. Otherwise calls AddIP to add IP address to the map
func (*IPRateLimiter) GetLimiterIP ¶
func (i *IPRateLimiter) GetLimiterIP(ip string) *rate.Limiter
GetLimiterIP splits given address and returns the limiter belongs to that ip address.
func (*IPRateLimiter) IsAllowed ¶
func (i *IPRateLimiter) IsAllowed(ip string) bool
IsAllowed splits given ip string and checks is ip address allowed to go
type Rule ¶
Rule the rule model
func (*Rule) ExecuteRule ¶
func (rule *Rule) ExecuteRule(variableData interface{}) *matches.MatchResult
ExecuteRule Executes rule and returns match result
func (*Rule) ShouldBlock ¶
ShouldBlock Determines whether rule is blocking action
type RuleExecutionResult ¶
type RuleExecutionResult struct { MatchResult *matches.MatchResult Rule *Rule }
RuleExecutionResult the result object