Versions in this module Expand all Collapse all v0 v0.1.72 Sep 3, 2019 v0.1.12 Jun 25, 2020 Changes in this version + type CaptchaValidator struct + func (this *CaptchaValidator) Run(request *requests.Request, writer http.ResponseWriter) + type IPAction = string + const IPActionAccept + const IPActionReject + type IPTable struct + Action IPAction + IP string + Id string + On bool + Port string + Remark string + TimeFrom int64 + TimeTo int64 + func NewIPTable() *IPTable + func (this *IPTable) Init() error + func (this *IPTable) Match(ip string, port int) (isMatched bool) type WAF + IPTables []*IPTable v0.1.10 Mar 29, 2020 Changes in this version + const ActionAllow + const ActionBlock + const ActionCaptcha + const ActionGoGroup + const ActionGoSet + const ActionLog + const CaptchaSeconds + const RuleConnectorAnd + const RuleConnectorOr + var AllActions = []*ActionDefinition + var AllRuleOperators = []*RuleOperatorDefinition + func FindActionName(action ActionString) string + type Action struct + type ActionDefinition struct + Code ActionString + Description string + Instance ActionInterface + Name string + Type reflect.Type + type ActionInterface interface + Perform func(waf *WAF, request *requests.Request, writer http.ResponseWriter) (allow bool) + func FindActionInstance(action ActionString, options maps.Map) ActionInterface + type ActionString = string + type AllowAction struct + func (this *AllowAction) Perform(waf *WAF, request *requests.Request, writer http.ResponseWriter) (allow bool) + type BlockAction struct + Body string + StatusCode int + URL string + func (this *BlockAction) Perform(waf *WAF, request *requests.Request, writer http.ResponseWriter) (allow bool) + type CaptchaAction struct + func (this *CaptchaAction) Perform(waf *WAF, request *requests.Request, writer http.ResponseWriter) (allow bool) + type GoGroupAction struct + GroupId string + func (this *GoGroupAction) Perform(waf *WAF, request *requests.Request, writer http.ResponseWriter) (allow bool) + type GoSetAction struct + GroupId string + SetId string + func (this *GoSetAction) Perform(waf *WAF, request *requests.Request, writer http.ResponseWriter) (allow bool) + type LogAction struct + func (this *LogAction) Perform(waf *WAF, request *requests.Request, writer http.ResponseWriter) (allow bool) + type Rule struct + CheckpointOptions map[string]string + Description string + IsCaseInsensitive bool + Operator RuleOperator + Param string + Value string + func NewRule() *Rule + func (this *Rule) Init() error + func (this *Rule) IsSingleCheckpoint() bool + func (this *Rule) MatchRequest(req *requests.Request) (b bool, err error) + func (this *Rule) MatchResponse(req *requests.Request, resp *requests.Response) (b bool, err error) + func (this *Rule) SetCheckpointFinder(finder func(prefix string) checkpoints.CheckpointInterface) + func (this *Rule) Test(value interface{}) bool + type RuleCaseInsensitive = string + type RuleConnector = string + type RuleGroup struct + Code string + Description string + Id string + IsInbound bool + Name string + On bool + RuleSets []*RuleSet + func NewRuleGroup() *RuleGroup + func (this *RuleGroup) AddRuleSet(ruleSet *RuleSet) + func (this *RuleGroup) FindRuleSet(id string) *RuleSet + func (this *RuleGroup) FindRuleSetWithCode(code string) *RuleSet + func (this *RuleGroup) Init() error + func (this *RuleGroup) MatchRequest(req *requests.Request) (b bool, set *RuleSet, err error) + func (this *RuleGroup) MatchResponse(req *requests.Request, resp *requests.Response) (b bool, set *RuleSet, err error) + func (this *RuleGroup) MoveRuleSet(fromIndex int, toIndex int) + func (this *RuleGroup) RemoveRuleSet(id string) + type RuleOperator = string + const RuleCaseInsensitiveNo + const RuleCaseInsensitiveNone + const RuleCaseInsensitiveYes + const RuleOperatorContains + const RuleOperatorEq + const RuleOperatorEqIP + const RuleOperatorEqString + const RuleOperatorGt + const RuleOperatorGtIP + const RuleOperatorGte + const RuleOperatorGteIP + const RuleOperatorHasKey + const RuleOperatorIPMod + const RuleOperatorIPMod10 + const RuleOperatorIPMod100 + const RuleOperatorIPRange + const RuleOperatorLt + const RuleOperatorLtIP + const RuleOperatorLte + const RuleOperatorLteIP + const RuleOperatorMatch + const RuleOperatorNeq + const RuleOperatorNeqString + const RuleOperatorNotContains + const RuleOperatorNotIPRange + const RuleOperatorNotMatch + const RuleOperatorPrefix + const RuleOperatorSuffix + const RuleOperatorVersionGt + const RuleOperatorVersionLt + const RuleOperatorVersionRange + type RuleOperatorDefinition struct + CaseInsensitive RuleCaseInsensitive + Code string + Description string + Name string + type RuleSet struct + Action ActionString + ActionOptions maps.Map + Code string + Connector RuleConnector + Description string + Id string + Name string + On bool + Rules []*Rule + func NewRuleSet() *RuleSet + func (this *RuleSet) AddRule(rule ...*Rule) + func (this *RuleSet) Init() error + func (this *RuleSet) MatchRequest(req *requests.Request) (b bool, err error) + func (this *RuleSet) MatchResponse(req *requests.Request, resp *requests.Response) (b bool, err error) v0.1.9 Nov 25, 2019 v0.1.8 Sep 30, 2019 Changes in this version type WAF + Cond []*shared.RequestCond + func (this *WAF) MatchConds(formatter func(string) string) bool v0.1.7 Sep 1, 2019 Changes in this version type WAF + func (this *WAF) MatchKeyword(keyword string) (matched bool, name string, tags []string) v0.1.6 Jul 21, 2019 Changes in this version type WAF + ActionBlock *actions.BlockAction v0.1.5 Jun 9, 2019 v0.1.4 May 19, 2019 v0.1.3 May 4, 2019 Changes in this version + type WAF struct + CreatedVersion string + Id string + Inbound []*rules.RuleGroup + Name string + On bool + Outbound []*rules.RuleGroup + func NewWAF() *WAF + func NewWAFFromFile(path string) (waf *WAF, err error) + func Template() *WAF + func (this *WAF) AddRuleGroup(ruleGroup *rules.RuleGroup) + func (this *WAF) ContainsGroupCode(code string) bool + func (this *WAF) Copy() *WAF + func (this *WAF) CountInboundRuleSets() int + func (this *WAF) CountOutboundRuleSets() int + func (this *WAF) FindCheckpointInstance(prefix string) checkpoints.CheckpointInterface + func (this *WAF) FindRuleGroup(ruleGroupId string) *rules.RuleGroup + func (this *WAF) FindRuleGroupWithCode(ruleGroupCode string) *rules.RuleGroup + func (this *WAF) Init() error + func (this *WAF) MatchRequest(rawReq *http.Request, writer http.ResponseWriter) (goNext bool, set *rules.RuleSet, err error) + func (this *WAF) MatchResponse(rawReq *http.Request, rawResp *http.Response, writer http.ResponseWriter) (goNext bool, set *rules.RuleSet, err error) + func (this *WAF) MergeTemplate() (changedItems []string) + func (this *WAF) MoveInboundRuleGroup(fromIndex int, toIndex int) + func (this *WAF) MoveOutboundRuleGroup(fromIndex int, toIndex int) + func (this *WAF) OnAction(onActionCallback func(action actions.ActionString) (goNext bool)) + func (this *WAF) RemoveRuleGroup(ruleGroupId string) + func (this *WAF) Save(path string) error + func (this *WAF) Start() + func (this *WAF) Stop()