feat(botfilter): add CreateConfig

This commit is contained in:
hoelee committed 2026-03-11 08:51:00 +08:00
1 parent 6af94f6931
commit 3299e1a847
1 file changed
+21
+21
View File
@@ -39,3 +39,24 @@ type Config struct {
LogBlockedRequests bool `json:"logBlockedRequests,omitempty" yaml:"logBlockedRequests,omitempty" toml:"logBlockedRequests,omitempty"`
}
// CreateConfig creates the default configuration. The defaults protect common
// public HTTP services without requiring a third-party dependency.
func CreateConfig() *Config {
return &Config{
StatusCode: 403,
TemporaryBanMinutes: 15,
ScoreThreshold: 100,
ScoreWindowMinutes: 15,
MaxTrackedIPs: 50000,
MaxScoreEventsPerIP: 16,
EmptyUserAgentScore: 40,
MissingAcceptScore: 20,
BlockedUserAgentScore: 80,
BadPathScore: 50,
RandomArticleScore: 15,
NotFoundScore: 40,
FakeBrowserScore: 40,
RandomArticlePatterns: []string{"/content/"},
}
}