net.i2p.router.networkdb.kademlia

## Class LookupThrottler

- java.lang.Object
- - net.i2p.router.networkdb.kademlia.LookupThrottler

-     class LookupThrottler
      extends Object

  Provides denial-of-service protection for network database lookup operations.

  Tracks the frequency of recent lookup requests targeting specific reply peer/tunnel pairs to prevent abuse. Implements burst detection over sliding time windows and configurable request limits.

  Note this is basic DOS protection and does not prevent spoofed reply identifiers or multiple reply tunnels from malicious requestors.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `LookupThrottler(FloodfillNetworkDatabaseFacade facade)`
    `LookupThrottler(FloodfillNetworkDatabaseFacade facade, int maxlookups, int maxnonfflookups, long cleanTime)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `(package private) boolean` | `shouldThrottle(Hash key, TunnelId id)` increments and checks throttling

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### LookupThrottler

          LookupThrottler(FloodfillNetworkDatabaseFacade facade)

    - #### LookupThrottler

          LookupThrottler(FloodfillNetworkDatabaseFacade facade,
                          int maxlookups,
                          int maxnonfflookups,
                          long cleanTime)

      Parameters:
        `maxlookups` - when floodfill
        `maxnonfflookups` - when not floodfill

  - ### Method Detail

    - #### shouldThrottle

          boolean shouldThrottle(Hash key,
                                 TunnelId id)

      increments and checks throttling
      Parameters:
        `key` - non-null
        `id` - null if for direct lookups
      Returns:
        true if throttled