Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNoBotRulesDefined = errors.New("config: must define at least one (1) bot rule") ErrBotMustHaveName = errors.New("config.Bot: must set name") ErrBotMustHaveUserAgentOrPath = errors.New("config.Bot: must set either user_agent_regex, path_regex, headers_regex, or remote_addresses") ErrBotMustHaveUserAgentOrPathNotBoth = errors.New("config.Bot: must set either user_agent_regex, path_regex, and not both") ErrUnknownAction = errors.New("config.Bot: unknown action") ErrInvalidUserAgentRegex = errors.New("config.Bot: invalid user agent regex") ErrInvalidPathRegex = errors.New("config.Bot: invalid path regex") ErrInvalidHeadersRegex = errors.New("config.Bot: invalid headers regex") ErrInvalidCIDR = errors.New("config.Bot: invalid CIDR") ErrRegexEndsWithNewline = errors.New("config.Bot: regular expression ends with newline (try >- instead of > in yaml)") ErrInvalidImportStatement = errors.New("config.ImportStatement: invalid source file") ErrCantSetBotAndImportValuesAtOnce = errors.New("config.BotOrImport: can't set bot rules and import values at the same time") ErrMustSetBotOrImportRules = errors.New("config.BotOrImport: rule definition is invalid, you must set either bot rules or an import statement, not both") ErrStatusCodeNotValid = errors.New("config.StatusCode: status code not valid, must be between 100 and 599") )
View Source
var ( ErrChallengeRuleHasWrongAlgorithm = errors.New("config.Bot.ChallengeRules: algorithm is invalid") ErrChallengeDifficultyTooLow = errors.New("config.Bot.ChallengeRules: difficulty is too low (must be >= 1)") ErrChallengeDifficultyTooHigh = errors.New("config.Bot.ChallengeRules: difficulty is too high (must be <= 64)") )
Functions ¶
This section is empty.
Types ¶
type BotConfig ¶
type BotConfig struct {
Name string `json:"name"`
UserAgentRegex *string `json:"user_agent_regex"`
PathRegex *string `json:"path_regex"`
HeadersRegex map[string]string `json:"headers_regex"`
RemoteAddr []string `json:"remote_addresses"`
Expression *ExpressionOrList `json:"expression"`
Action Rule `json:"action"`
Challenge *ChallengeRules `json:"challenge,omitempty"`
}
type BotOrImport ¶ added in v1.17.0
type BotOrImport struct {
*BotConfig `json:",inline"`
*ImportStatement `json:",inline"`
}
func (*BotOrImport) Valid ¶ added in v1.17.0
func (boi *BotOrImport) Valid() error
type ChallengeRules ¶
type ChallengeRules struct {
Difficulty int `json:"difficulty"`
ReportAs int `json:"report_as"`
Algorithm Algorithm `json:"algorithm"`
}
func (ChallengeRules) Valid ¶
func (cr ChallengeRules) Valid() error
type Config ¶
type Config struct {
Bots []BotConfig
DNSBL bool
StatusCodes StatusCodes
}
type ExpressionOrList ¶ added in v1.18.0
type ExpressionOrList struct {
Expression string `json:"-"`
All []string `json:"all"`
Any []string `json:"any"`
}
func (ExpressionOrList) Equal ¶ added in v1.18.0
func (eol ExpressionOrList) Equal(rhs *ExpressionOrList) bool
func (*ExpressionOrList) UnmarshalJSON ¶ added in v1.18.0
func (eol *ExpressionOrList) UnmarshalJSON(data []byte) error
func (*ExpressionOrList) Valid ¶ added in v1.18.0
func (eol *ExpressionOrList) Valid() error
type ImportStatement ¶ added in v1.17.0
func (*ImportStatement) Valid ¶ added in v1.17.0
func (is *ImportStatement) Valid() error
type StatusCodes ¶ added in v1.17.1
func (StatusCodes) Valid ¶ added in v1.17.1
func (sc StatusCodes) Valid() error
Click to show internal directories.
Click to hide internal directories.