java.lang.Object
net.i2p.router.transport.ntcp.NTCP2Options
NTCP2 Padding/Dummy/Delay configuration for data phase. Any other options TBD.
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final intDelay we apply ourselves, in milliseconds.private final intDummy data rate we accept, in bytes per second.private final floatHighest padding ratio we will accept.private final floatLowest padding ratio we will accept.private final intDelay we ask the peer to apply, in milliseconds.private final intDummy data rate we send, in bytes per second.private final floatHighest padding ratio we will send at.private final floatLowest padding ratio we will send at.Constructor Summary
ConstructorsConstructorDescriptionNTCP2Options(float sendMin, float sendMax, float recvMin, float recvMax, int sendDummy, int recvDummy, int sendDelay, int recvDelay) All params are as named.Method Summary
Modifier and TypeMethodDescriptionstatic NTCP2OptionsfromByteArray(byte[] options) Padding bytes per side, two dummy-rate bytes and two delay bytes.intThe receive delay in milliseconds.intThe receive dummy data rate in bytes per second.floatThe receive padding max.floatThe receive padding min.intThe send delay in milliseconds.intThe send dummy data rate in bytes per second.floatThe send padding max.floatThe send padding min.merge(NTCP2Options his) Merge our options with the peer's options.toString()String representation of these padding options.
Field Details
_sendMin
private final float _sendMinLowest padding ratio we will send at._sendMax
private final float _sendMaxHighest padding ratio we will send at._recvMin
private final float _recvMinLowest padding ratio we will accept._recvMax
private final float _recvMaxHighest padding ratio we will accept._sendDummy
private final int _sendDummyDummy data rate we send, in bytes per second._recvDummy
private final int _recvDummyDummy data rate we accept, in bytes per second._sendDelay
private final int _sendDelayDelay we ask the peer to apply, in milliseconds._recvDelay
private final int _recvDelayDelay we apply ourselves, in milliseconds.
Constructor Details
NTCP2Options
public NTCP2Options(float sendMin, float sendMax, float recvMin, float recvMax, int sendDummy, int recvDummy, int sendDelay, int recvDelay) All params are as named.- Parameters:
sendMin- the lowest padding ratio we will send at, 0.0 to 1.0sendMax- the highest padding ratio we will send at, 0.0 to 1.0recvMin- the lowest padding ratio we will accept, 0.0 to 1.0recvMax- the highest padding ratio we will accept, 0.0 to 1.0sendDummy- the dummy data rate we send, in bytes per secondrecvDummy- the dummy data rate we will accept, in bytes per secondsendDelay- the delay we ask the peer to apply, in millisecondsrecvDelay- the delay we apply ourselves, in milliseconds
Method Details
getSendMin
public float getSendMin()The send padding min.- Returns:
- the send min
getSendMax
public float getSendMax()The send padding max.- Returns:
- the send max
getRecvMin
public float getRecvMin()The receive padding min.- Returns:
- the recv min
getRecvMax
public float getRecvMax()The receive padding max.- Returns:
- the recv max
getSendDummy
public int getSendDummy()The send dummy data rate in bytes per second.- Returns:
- the send dummy
getRecvDummy
public int getRecvDummy()The receive dummy data rate in bytes per second.- Returns:
- the recv dummy
getSendDelay
public int getSendDelay()The send delay in milliseconds.- Returns:
- the send delay
getRecvDelay
public int getRecvDelay()The receive delay in milliseconds.- Returns:
- the recv delay
merge
Merge our options with the peer's options.- Parameters:
his- the peer's advertised options, whose send values are clamped against our receive values and vice versa- Returns:
- new merged options
fromByteArray
Padding bytes per side, two dummy-rate bytes and two delay bytes.- Parameters:
options- the 12 byte options block from the peer's OBWH, as two- Returns:
- null on error
toString