feat(botfilter): add newClientCache

This commit is contained in:
hoelee committed 2026-02-10 10:05:00 +08:00
1 parent 1903429d81
commit b2ac2ce43d
1 file changed
+13
+13
View File
@@ -49,3 +49,16 @@ type clientCache struct {
operations uint64
}
func newClientCache(cfg *compiledConfig) *clientCache {
return &clientCache{
entries: make(map[string]*clientState),
maxEntries: cfg.MaxTrackedIPs,
maxEvents: cfg.MaxScoreEventsPerIP,
scoreWindow: cfg.scoreWindow,
banDuration: cfg.banDuration,
threshold: cfg.ScoreThreshold,
randomPaths: append([]string(nil), cfg.randomPaths...),
randomScore: cfg.RandomArticleScore,
}
}