Documentation ¶
Index ¶
- Constants
- Variables
- func CheckKeyValuePair(condOperator *string, condKey *string, condValue *string, keyValuePairs []NV) bool
- func CheckStatusCode(condOperator *string, condStatusCode *string, reqStatusCode *int) bool
- func CheckStringCondition(condOperator *string, condValue *string, reqValue *string) bool
- func CheckUser(condOperator *string, condValue *string, authentication *Authentication, ...) bool
- func GetConditionBoolean(req TraceReq, traceMeta TraceMeta, condition ConditionItem, ...) bool
- func GetCookiesFromString(cookieString string) []*http.Cookie
- func GetIntervalDuration(thresholdInterval string) time.Duration
- func GetKeyValuePairValue(key string, keyValuePairs []NV) *string
- func GetRateLimitKey(rule WafRule, req TraceReq, traceMeta TraceMeta, ...) string
- func GetSourceIp(reqHeaders []NV, traceMeta TraceMeta) *string
- func GetWindowInfo(thresholdInterval string, thresholdStart time.Time, now time.Time) (float64, float64)
- func GetXForwardedForFromValue(value *string) *string
- func HandleBlockRule(req TraceReq, traceMeta TraceMeta, conditionGroups []ConditionGroup, ...) bool
- func HandleRateLimitRule(req TraceReq, traceMeta TraceMeta, rule WafRule, ...) bool
- func HandleRateLimitRuleUpdate(data MetloTrace, rule WafRule, authentication *Authentication)
- func HandleRateLimitStateAction(ruleAction WafAction, key string, action RateLimitStateAction, ...)
- func HandleSessionIdentifier(authentication *Authentication, headers []NV, key *strings.Builder)
- func HandleUserIdentifier(authentication *Authentication, headers []NV, user *string, ...)
- func InitMetlo(metloHost string, metloKey string) *metlo
- func InitMetloCustom(metloHost string, metloKey string, rps int, backendPort int, collectorPort int, ...) *metlo
- func IsConditionGroupMatch(req TraceReq, traceMeta TraceMeta, conditionGroup ConditionGroup, ...) bool
- func MapLogLevelToString(lvl LogLevel) string
- func MapMetloTraceToMetloIngestRPC(trace MetloTrace) mi.ApiTrace
- type AgentConfig
- type Authentication
- type ConditionGroup
- type ConditionItem
- type HostMap
- type HostMapCompiled
- type LogLevel
- type MetloTrace
- type NV
- type RateLimitEntry
- type RateLimitMap
- type RateLimitStateAction
- type RateLimitWindow
- type TraceMeta
- type TraceReq
- type TraceRes
- type TraceUrl
- type WafAction
- type WafConfig
- type WafRateLimit
- type WafRateLimitDuration
- type WafRule
Constants ¶
View Source
const MaxConnectTries int = 10
View Source
const MaxConnectionRetries int = 1000
View Source
const MaxRestartTries int = 10
View Source
const MetloDefaultRPS int = 100
Variables ¶
View Source
var AgentConfigClient = &http.Client{Timeout: 5 * time.Second}
Functions ¶
func CheckKeyValuePair ¶ added in v1.0.2
func CheckStatusCode ¶ added in v1.0.2
func CheckStringCondition ¶ added in v1.0.2
func GetConditionBoolean ¶ added in v1.0.2
func GetConditionBoolean(req TraceReq, traceMeta TraceMeta, condition ConditionItem, authentication *Authentication, statusCode *int) bool
func GetCookiesFromString ¶ added in v1.0.2
func GetIntervalDuration ¶ added in v1.0.2
func GetKeyValuePairValue ¶ added in v1.0.2
func GetRateLimitKey ¶ added in v1.0.2
func GetRateLimitKey(rule WafRule, req TraceReq, traceMeta TraceMeta, authentication *Authentication) string
func GetSourceIp ¶ added in v1.0.2
func GetWindowInfo ¶ added in v1.0.2
func GetXForwardedForFromValue ¶ added in v1.0.2
func HandleBlockRule ¶ added in v1.0.2
func HandleBlockRule(req TraceReq, traceMeta TraceMeta, conditionGroups []ConditionGroup, authentication *Authentication, statusCode *int) bool
func HandleRateLimitRule ¶ added in v1.0.2
func HandleRateLimitRule(req TraceReq, traceMeta TraceMeta, rule WafRule, authentication *Authentication) bool
func HandleRateLimitRuleUpdate ¶ added in v1.0.2
func HandleRateLimitRuleUpdate(data MetloTrace, rule WafRule, authentication *Authentication)
func HandleRateLimitStateAction ¶ added in v1.0.2
func HandleRateLimitStateAction(ruleAction WafAction, key string, action RateLimitStateAction, entries map[string]RateLimitEntry)
func HandleSessionIdentifier ¶ added in v1.0.2
func HandleSessionIdentifier(authentication *Authentication, headers []NV, key *strings.Builder)
func HandleUserIdentifier ¶ added in v1.0.2
func HandleUserIdentifier(authentication *Authentication, headers []NV, user *string, key *strings.Builder)
func InitMetloCustom ¶
func IsConditionGroupMatch ¶ added in v1.0.2
func IsConditionGroupMatch(req TraceReq, traceMeta TraceMeta, conditionGroup ConditionGroup, authentication *Authentication, statusCode *int) bool
func MapLogLevelToString ¶ added in v1.0.1
func MapMetloTraceToMetloIngestRPC ¶
func MapMetloTraceToMetloIngestRPC(trace MetloTrace) mi.ApiTrace
Types ¶
type AgentConfig ¶ added in v1.0.2
type AgentConfig struct { WafConfig *[]WafRule `json:"wafConfig"` AuthenticationConfig *[]Authentication `json:"authenticationConfig"` HostMap *[]HostMap `json:"hostMap"` }
type Authentication ¶ added in v1.0.2
type ConditionGroup ¶ added in v1.0.2
type ConditionGroup struct { Conditions []ConditionItem `json:"conditions"` Rule string `json:"rule"` }
type ConditionItem ¶ added in v1.0.2
type HostMapCompiled ¶ added in v1.0.2
type MetloTrace ¶
type RateLimitEntry ¶ added in v1.0.2
type RateLimitMap ¶ added in v1.0.2
type RateLimitMap struct {
// contains filtered or unexported fields
}
type RateLimitStateAction ¶ added in v1.0.2
type RateLimitStateAction int64
const ( Create RateLimitStateAction = iota Reset Increment )
type RateLimitWindow ¶ added in v1.0.2
type WafAction ¶ added in v1.0.2
type WafAction struct { ActionType string `json:"actionType"` RateLimit *WafRateLimit `json:"rateLimit"` BlockEndTime *int64 `json:"blockEndTime"` }
type WafConfig ¶ added in v1.0.2
type WafConfig struct { WafRules []WafRule AuthenticationConfig []Authentication HostMap []HostMapCompiled // contains filtered or unexported fields }
type WafRateLimit ¶ added in v1.0.2
type WafRateLimit struct { Threshold uint16 `json:"threshold"` Interval string `json:"interval"` Duration WafRateLimitDuration `json:"duration"` }
type WafRateLimitDuration ¶ added in v1.0.2
Click to show internal directories.
Click to hide internal directories.