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} + } +