From 1160d7c59110a8237479abc5a0e8ecf36004f27f Mon Sep 17 00:00:00 2001 From: hoelee Date: Fri, 6 Feb 2026 18:44:00 +0800 Subject: [PATCH] feat(botfilter): add clientCache --- cache.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/cache.go b/cache.go index cb941b66..16dbc1c2 100644 --- a/cache.go +++ b/cache.go @@ -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 +} +