feat(botfilter): add clientCache

This commit is contained in:
hoelee committed 2026-02-10 18:44:00 +08:00
1 parent 9f8f6e289a
commit 1903429d81
1 file changed
+16
+16
View File
@@ -33,3 +33,19 @@ type cacheResult struct {
score int
}
// clientCache deliberately has no background goroutine. A middleware
// instance can be discarded on a Traefik reload without needing goroutine
// cleanup, and opportunistic cleanup keeps its memory use bounded.
type clientCache struct {
mu sync.Mutex
entries map[string]*clientState
maxEntries int
maxEvents int
scoreWindow time.Duration
banDuration time.Duration
threshold int
randomPaths []string
randomScore int
operations uint64
}