java.lang.Object
net.i2p.router.transport.ntcp.NTCP2Options

class NTCP2Optionsextends Object
NTCP2 Padding/Dummy/Delay configuration for data phase. Any other options TBD.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final int
    Delay we apply ourselves, in milliseconds.
    private final int
    Dummy data rate we accept, in bytes per second.
    private final float
    Highest padding ratio we will accept.
    private final float
    Lowest padding ratio we will accept.
    private final int
    Delay we ask the peer to apply, in milliseconds.
    private final int
    Dummy data rate we send, in bytes per second.
    private final float
    Highest padding ratio we will send at.
    private final float
    Lowest padding ratio we will send at.
  • Constructor Summary

    Constructors
    Constructor
    Description
    NTCP2Options(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 Type
    Method
    Description
    fromByteArray(byte[] options)
    Padding bytes per side, two dummy-rate bytes and two delay bytes.
    int
    The receive delay in milliseconds.
    int
    The receive dummy data rate in bytes per second.
    float
    The receive padding max.
    float
    The receive padding min.
    int
    The send delay in milliseconds.
    int
    The send dummy data rate in bytes per second.
    float
    The send padding max.
    float
    The send padding min.
    Merge our options with the peer's options.
    String representation of these padding options.

    Methods inherited from class Object

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

    • _sendMin

      private final float _sendMin
      Lowest padding ratio we will send at.
    • _sendMax

      private final float _sendMax
      Highest padding ratio we will send at.
    • _recvMin

      private final float _recvMin
      Lowest padding ratio we will accept.
    • _recvMax

      private final float _recvMax
      Highest padding ratio we will accept.
    • _sendDummy

      private final int _sendDummy
      Dummy data rate we send, in bytes per second.
    • _recvDummy

      private final int _recvDummy
      Dummy data rate we accept, in bytes per second.
    • _sendDelay

      private final int _sendDelay
      Delay we ask the peer to apply, in milliseconds.
    • _recvDelay

      private final int _recvDelay
      Delay 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.0
      sendMax - the highest padding ratio we will send at, 0.0 to 1.0
      recvMin - the lowest padding ratio we will accept, 0.0 to 1.0
      recvMax - the highest padding ratio we will accept, 0.0 to 1.0
      sendDummy - the dummy data rate we send, in bytes per second
      recvDummy - the dummy data rate we will accept, in bytes per second
      sendDelay - the delay we ask the peer to apply, in milliseconds
      recvDelay - 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

      public NTCP2Options merge(NTCP2Options his)
      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

      public static NTCP2Options fromByteArray(byte[] options)
      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

      public String toString()
      String representation of these padding options.
      Overrides:
      toString in class Object