Class ConnectionOptions

java.lang.Object
net.i2p.client.streaming.impl.I2PSocketOptionsImpl
net.i2p.client.streaming.impl.ConnectionOptions
All Implemented Interfaces:
I2PSocketOptions

class ConnectionOptions
extends I2PSocketOptionsImpl
Define the current options for the con (and allow custom tweaking midstream) TODO many of these are not per-connection options, and should be migrated somewhere so they aren't copied for every connection
  • Field Details

  • Constructor Details

    • ConnectionOptions

      public ConnectionOptions()
      Sets max buffer size, connect timeout, read timeout, and write timeout from System properties. Does not set local port or remote port.
    • ConnectionOptions

      public ConnectionOptions​(Properties opts)
      Sets max buffer size, connect timeout, read timeout, and write timeout from properties. Does not set local port or remote port. As of 0.9.19, defaults in opts are honored.
      Parameters:
      opts - may be null
    • ConnectionOptions

      public ConnectionOptions​(I2PSocketOptions opts)
      Initializes from System properties then copies over all options.
      Parameters:
      opts - may be null
    • ConnectionOptions

      public ConnectionOptions​(ConnectionOptions opts)
      Initializes from System properties then copies over all options.
      Parameters:
      opts - may be null
  • Method Details

    • updateAll

      public void updateAll​(ConnectionOptions opts)
      Update everything by copying over from opts
      Parameters:
      opts - non-null
      Since:
      0.9.1
    • setProperties

      public void setProperties​(Properties opts)
      Note: NOT part of the interface As of 0.9.19, defaults in opts are honored.
      Overrides:
      setProperties in class I2PSocketOptionsImpl
      Parameters:
      opts - may be null
    • getConnectDelay

      public int getConnectDelay()
      how long will we wait after instantiating a new con before actually attempting to connect. If this is set to 0, connect ASAP. If it is greater than 0, wait until the output stream is flushed, the buffer fills, or that many milliseconds pass.
      Returns:
      how long to wait before actually attempting to connect
    • setConnectDelay

      public void setConnectDelay​(int delayMs)
    • getRequireFullySigned

      public boolean getRequireFullySigned()
      Do we want all packets in both directions to be signed, or can we deal with signatures on the SYN and FIN packets only? There is no property name defined for this, so it's safe to say this is unused and always false.
      Returns:
      if we want signatures on all packets.
    • setRequireFullySigned

      public void setRequireFullySigned​(boolean sign)
      unused, see above
    • getAnswerPings

      public boolean getAnswerPings()
      Do we respond to a ping?
      Returns:
      if we do
    • setAnswerPings

      public void setAnswerPings​(boolean yes)
    • getEnforceProtocol

      public boolean getEnforceProtocol()
      Do we receive all traffic, or only traffic marked with I2PSession.PROTO_STREAMING (6) ? Default true. If PROTO is enforced, we cannot communicate with destinations earlier than version 0.7.1 (released March 2009), which is when streaming started sending the PROTO_STREAMING indication. Set to true if you are running multiple protocols on a single Destination.
      Returns:
      if we do
      Since:
      0.9.1
    • setEnforceProtocol

      public void setEnforceProtocol​(boolean yes)
    • getDisableRejectLogging

      public boolean getDisableRejectLogging()
      Do we disable connection rejected logging? Default false.
      Returns:
      if we do
      Since:
      0.9.4
    • setDisableRejectLogging

      public void setDisableRejectLogging​(boolean yes)
    • getWindowSize

      public int getWindowSize()
      How many messages will we send before waiting for an ACK?
      Returns:
      Maximum amount of messages that can be in-flight
    • setWindowSize

      public void setWindowSize​(int numMsgs)
    • getReceiveWindow

      @Deprecated public int getReceiveWindow()
      Deprecated.
      This doesn't appear to be used.
      after how many consecutive messages should we ack?
      Returns:
      receive window size.
    • setReceiveWindow

      public void setReceiveWindow​(int numMsgs)
    • getRTT

      public int getRTT()
      What to set the round trip time estimate to (in milliseconds)
      Returns:
      round trip time estimate in ms
    • getMinRTT

      public int getMinRTT()
      Returns:
      minimum RTT observed over the life of the connection, greater than zero
      Since:
      0.9.46
    • getRTO

      public int getRTO()
      Returns:
      Connection.MIN_RESEND_DELAY to Connection.MAX_RESEND_DELAY
    • getRTTDev

      int getRTTDev()
      used in TCB @since 0.9.8
    • loadFromCache

      void loadFromCache​(int rtt, int rttDev, int wdw)
      Loads options from TCB cache.
    • doubleRTO

      int doubleRTO()
      Double the RTO (after congestion). See RFC 6298 section 5 item 5.5
      Returns:
      new value, Connection.MIN_RESEND_DELAY to Connection.MAX_RESEND_DELAY
      Since:
      0.9.33
    • getRTTTrend

      public int getRTTTrend()
      If we have 3 consecutive rtt increases, we are trending upwards (1), or if we have 3 consecutive rtt decreases, we are trending downwards (-1), else we're stable.
      Returns:
      positive/flat/negative trend in round trip time
    • updateRTT

      public void updateRTT​(int measuredValue)
      Parameters:
      measuredValue - must be positive
    • receivedAck

      public boolean receivedAck()
    • getResendDelay

      public int getResendDelay()
      How long after sending a packet will we wait before resending?
      Returns:
      delay for a retransmission in ms
    • setResendDelay

      public void setResendDelay​(int ms)
    • getSendAckDelay

      public int getSendAckDelay()
      if there are packets we haven't ACKed yet and we don't receive _receiveWindow messages before (_lastSendTime+_sendAckDelay), send an ACK of what we have received so far. Ref: RFC 5681 sec. 4.3, RFC 1122 sec. 4.2.3.3, ticket #2706
      Returns:
      ACK delay in ms
    • setSendAckDelay

      public void setSendAckDelay​(int delayMs)
      Unused except here, so expect the default initial delay of DEFAULT_INITIAL_ACK_DELAY unless set by the user to remain constant. Changing the default is not recommended. Ref: RFC 5681 sec. 4.3, RFC 1122 sec. 4.2.3.3, ticket #2706
    • getMaxMessageSize

      public int getMaxMessageSize()
      What is the largest message we want to send or receive?
      Returns:
      Maximum message size (MTU/MRU)
    • setMaxMessageSize

      public void setMaxMessageSize​(int bytes)
    • getMaxInitialMessageSize

      public int getMaxInitialMessageSize()
      What is the largest message to send in the SYN from Alice to Bob?
      Returns:
      the max
      Since:
      0.9.47
    • setMaxInitialMessageSize

      public void setMaxInitialMessageSize​(int bytes)
      What is the largest message to send in the SYN from Alice to Bob?
      Since:
      0.9.47
    • getProfile

      public int getProfile()
      What profile do we want to use for this connection? TODO: Only bulk is supported so far.
      Returns:
      the profile of the connection.
    • setProfile

      public void setProfile​(int profile)
    • getMaxResends

      public int getMaxResends()
      How many times will we try to send a message before giving up?
      Returns:
      Maximum retrys before failing a sent message.
    • setMaxResends

      public void setMaxResends​(int numSends)
    • getInactivityTimeout

      public int getInactivityTimeout()
      What period of inactivity qualifies as "too long"?
      Returns:
      period of inactivity qualifies as "too long"
    • setInactivityTimeout

      public void setInactivityTimeout​(int timeout)
    • getInactivityAction

      public int getInactivityAction()
    • setInactivityAction

      public void setInactivityAction​(int action)
    • getMaxWindowSize

      public int getMaxWindowSize()
    • setMaxWindowSize

      public void setMaxWindowSize​(int msgs)
    • getInboundBufferSize

      public int getInboundBufferSize()
      how much data are we willing to accept in our buffer?
      Returns:
      size of the buffer used to accept data
    • setInboundBufferSize

      public void setInboundBufferSize​(int bytes)
    • getCongestionAvoidanceGrowthRateFactor

      public int getCongestionAvoidanceGrowthRateFactor()
      When we're in congestion avoidance, we grow the window size at the rate of 1/(windowSize*factor). In standard TCP, window sizes are in bytes, while in I2P, window sizes are in messages, so setting factor=maxMessageSize mimics TCP, but using a smaller factor helps grow a little more rapidly.
      Returns:
      window size to grow by to attempt to avoid congestion.
    • setCongestionAvoidanceGrowthRateFactor

      public void setCongestionAvoidanceGrowthRateFactor​(int factor)
    • getSlowStartGrowthRateFactor

      public int getSlowStartGrowthRateFactor()
      When we're in slow start, we grow the window size at the rate of 1/(factor). In standard TCP, window sizes are in bytes, while in I2P, window sizes are in messages, so setting factor=maxMessageSize mimics TCP, but using a smaller factor helps grow a little more rapidly.
      Returns:
      slow start window size to grow by to attempt to avoid sending many small packets.
    • setSlowStartGrowthRateFactor

      public void setSlowStartGrowthRateFactor​(int factor)
    • getMaxConnsPerMinute

      public int getMaxConnsPerMinute()
      all of these are @since 0.7.14; no public setters
    • getMaxConnsPerHour

      public int getMaxConnsPerHour()
    • getMaxConnsPerDay

      public int getMaxConnsPerDay()
    • getMaxTotalConnsPerMinute

      public int getMaxTotalConnsPerMinute()
    • getMaxTotalConnsPerHour

      public int getMaxTotalConnsPerHour()
    • getMaxTotalConnsPerDay

      public int getMaxTotalConnsPerDay()
    • getMaxConns

      public int getMaxConns()
      Since:
      0.9.3; no public setter
    • isAccessListEnabled

      public boolean isAccessListEnabled()
    • isBlacklistEnabled

      public boolean isBlacklistEnabled()
    • getAccessList

      public Set<Hash> getAccessList()
    • getBlacklist

      public Set<Hash> getBlacklist()
    • getLimitAction

      public String getLimitAction()
      "reset", "drop", "http", or custom string. Default "reset".
      Since:
      0.9.34
    • getTagsToSend

      public int getTagsToSend()
      This option is mostly handled on the router side, but PacketQueue also needs to know, so that when it overrides, it doesn't exceed the setting.
      Since:
      0.9.34
    • getTagThreshold

      public int getTagThreshold()
      This option is mostly handled on the router side, but PacketQueue also needs to know, so that when it overrides, it doesn't exceed the setting.
      Since:
      0.9.34
    • toString

      public String toString()
      doesn't include everything
      Overrides:
      toString in class Object