java.lang.Object
net.i2p.i2ptunnel.access.Threshold
Connection threshold definition.
Defined by maximum connection attempts over a time period in seconds.
Field Summary
Constructor Summary
ConstructorsConstructorDescriptionThreshold(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 MethodsModifier and TypeMethodDescription(package private) intThe connection count that defines a breach of this threshold.(package private) intThe sliding window over which connecting attempts are counted.
Field Details
ALLOW
A Threshold that is never breached.DENY
A Threshold that is always breached.connections
private final int connectionsConnections allowed in the window.seconds
private final int secondsLength 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 negativeseconds- 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