From 12126232ce65fa3a21b2f9f1a26ba2f2716c9bb4 Mon Sep 17 00:00:00 2001 From: hoelee Date: Wed, 11 Feb 2026 11:29:00 +0800 Subject: [PATCH] feat(botfilter): add clientCache.observeRequest --- cache.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cache.go b/cache.go index 8611acda..deffc3b6 100644 --- a/cache.go +++ b/cache.go @@ -75,3 +75,10 @@ func (c *clientCache) isBanned(ip string, now time.Time) cacheResult { return cacheResult{banned: true, banUntil: state.banUntil} } +func (c *clientCache) observeRequest(ip string, observation requestObservation) cacheResult { + if ip == "" { + // An invalid peer address must never share a cache entry with another + // malformed request. The request can still be rejected by its headers. + return cacheResult{banned: observation.forceBan} + } +