java.lang.Object
net.i2p.i2ptunnel.access.Threshold

class Thresholdextends Object
Connection threshold definition.

Defined by maximum connection attempts over a time period in seconds.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    (package private) static final Threshold
    A Threshold that is never breached.
    private final int
    Connections allowed in the window.
    (package private) static final Threshold
    A Threshold that is always breached.
    private final int
    Length of the window, in seconds.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Threshold(int connections, int seconds)
    Pairs an access count with the sliding window it is measured over, rejecting a negative count or a window under one second.
  • Method Summary

    All Methods
    Modifier and Type
    Method
    Description
    (package private) int
    The connection count that defines a breach of this threshold.
    (package private) int
    The sliding window over which connecting attempts are counted.

    Methods inherited from class Object

    clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • ALLOW

      static final Threshold ALLOW
      A Threshold that is never breached.
    • DENY

      static final Threshold DENY
      A Threshold that is always breached.
    • connections

      private final int connections
      Connections allowed in the window.
    • seconds

      private final int seconds
      Length of the window, in seconds.
  • Constructor Details

    • Threshold

      Threshold(int connections, int seconds)
      Pairs an access count with the sliding window it is measured over, rejecting a negative count or a window under one second.
      Parameters:
      connections - the number of accesses allowed in the window, not negative
      seconds - the length of the sliding window, at least 1
  • Method Details

    • getConnections

      int getConnections()
      The connection count that defines a breach of this threshold.
      Returns:
      the maximum connections permitted within the window
    • getSeconds

      int getSeconds()
      The sliding window over which connecting attempts are counted.
      Returns:
      the window length in seconds, always at least 1