feat(botfilter): add clientCache.observeRequest

This commit is contained in:
hoelee committed 2026-02-12 11:29:00 +08:00
1 parent 06a8ccb0d6
commit 7cc5d27322
1 file changed
+7
+7
View File
@@ -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}
}