class LookupBanHammer extends Object
Uses burst detection over a sliding 1-second window and an overall lookup count threshold to decide when to ban peers. Bans last for a fixed duration and expire automatically.
Thread-safe implementation utilizing concurrent data structures and finer-grained synchronization for improved performance under concurrent access.
This mechanism is a partial DOS protection and does not prevent spoofed reply identifiers or multiple reply tunnels.
| Constructor and Description |
|---|
LookupBanHammer()
Constructs a newly initialized LookupBanHammer instance.
|
| Modifier and Type | Method and Description |
|---|---|
(package private) boolean |
shouldBan(Hash key,
TunnelId id)
Records a lookup request from a requester identified by key and tunnel ID,
and determines whether the requester should be banned based on recent activity.
|
LookupBanHammer()
boolean shouldBan(Hash key, TunnelId id)
This method increments the request count for the requester, tracks burst-frequency within a sliding window, and enforces bans if thresholds are exceeded.
key - non-null Hash representing the requester identifying keyid - TunnelId of the target reply tunnel, or null if direct lookups