refactor: review pass over the auto-denylist ring
Three things the review turned up, no behaviour change: Hold recomputed address.ToUInt128() three times where the original hoisted it to a local. Restored. Drain cleared _warnedFull on every iteration; it now clears once, after, and only when something was actually retired. The store was inside the loop whose cost this whole design exists to keep small. Grow doubled without a ceiling, so a 324,449 cap reserved 524,288 ring slots -- 4.8 MB that can never be used. Push only runs below the cap, so the ring never needs more than maxEntries; growth is capped there. Progress is still guaranteed: Grow is only reached when capacity == _ringCount, which is at most maxEntries - 1 at that point, so the capped size is always larger. Adds a test for that last one, since a cap that is not a power of two is where a wrapped write would run off the end, and notes the new default in the configuration table. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
8e5b7af1cf
commit
5b7304addd
3 changed files with 41 additions and 10 deletions
|
|
@ -201,7 +201,7 @@ firewalled off. Shortening the 5s handshake window has been tried and broke real
|
|||
| `blocklist.json` | `enabled` (default `false`), `file`, `reloadInterval`, `reportHits`, `banDuration`, `promoteSuppression` |
|
||||
| `ip-allowlist.json` | `enabled` (default `false`), `files` (wildcards allowed), `reloadInterval` |
|
||||
| `login-allowlist.json` | `enabled`, `file`, `ttl`, `flushInterval`, `escalateAfterStrikes`, `strikeWindow` |
|
||||
| `auto-denylist.json` | `enabled`, `duration`, `maxEntries` |
|
||||
| `auto-denylist.json` | `enabled`, `duration`, `maxEntries` (default `324,449` — sized for the floods seen in practice; see the remark on the setting before raising it) |
|
||||
| `crowdsec.json` | `lapiUrl`, `machineId`, `password`, `origin`, `manualBanDuration`, `flushInterval`, `maxQueue` |
|
||||
| `firewall.json` | Admin-curated entries |
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue