net.i2p.router.tunnel.pool

## Class ParticipatingThrottler

- java.lang.Object
- - net.i2p.router.tunnel.pool.ParticipatingThrottler

-     class ParticipatingThrottler
      extends Object

  Count how often we have accepted a tunnel with the peer as the previous or next hop. We limit each peer to a percentage of all participating tunnels, subject to minimum and maximum values for the limit. This offers basic protection against simple attacks but is not a complete solution, as by design, we don't know the originator of a tunnel request. This also effectively limits the number of tunnels between any given pair of routers, which probably isn't a bad thing.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `ParticipatingThrottler.Result` Result of throttling decision for tunnel participation requests.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ParticipatingThrottler(RouterContext ctx)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `(package private) ParticipatingThrottler.Result` | `shouldThrottle(Hash h)` Determines whether to throttle tunnel participation for the given router.

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

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

- - ### Constructor Detail

    - #### ParticipatingThrottler

          ParticipatingThrottler(RouterContext ctx)

  - ### Method Detail

    - #### shouldThrottle

          ParticipatingThrottler.Result shouldThrottle(Hash h)

      Determines whether to throttle tunnel participation for the given router. Increments the participation count for the router and evaluates conditions including router version, capabilities, and request count limits to decide if the tunnel request should be accepted, rejected, or dropped.
      Parameters:
        `h` - the hash of the router to check
      Returns:
        the throttling Result (ACCEPT, REJECT, or DROP)