feat(botfilter): cache.go part 2/5
This commit is contained in:
1 parent
f9cc4181b7
commit
6f09675ff9
1 file changed
+10
@@ -87,3 +87,13 @@ func (c *clientCache) observeRequest(ip string, observation requestObservation)
|
||||
c.operations++
|
||||
c.cleanupLocked(observation.at)
|
||||
|
||||
state := c.entries[ip]
|
||||
if state != nil && state.banUntil.After(observation.at) {
|
||||
return cacheResult{banned: true, banUntil: state.banUntil}
|
||||
}
|
||||
if state == nil {
|
||||
c.ensureCapacityLocked(observation.at)
|
||||
state = &clientState{}
|
||||
c.entries[ip] = state
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user