net.i2p.router

## Interface TunnelInfo

- All Known Implementing Classes:
    PooledTunnelCreatorConfig, TunnelCreatorConfig

      public interface TunnelInfo

  Defines the information associated with a tunnel

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `getConsecutiveFailures()` Get the number of consecutive test failures.
    `Hash` | `getDestination()` if this is a client tunnel, what destination is it for?
    `Hash` | `getEndpoint()` For convenience
    `long` | `getExpiration()` Get the tunnel's expiration time.
    `Hash` | `getFarEnd()` For convenience
    `Hash` | `getGateway()` For convenience
    `int` | `getLastLatency()` Get the last recorded round-trip latency for this tunnel from the most recent test.
    `int` | `getLength()` how many peers are there in the tunnel (including the creator)?
    `Hash` | `getPeer(int hop)` retrieve the peer at the given hop.
    `int` | `getProcessedMessagesCount()` Get the count of messages that have been processed through this tunnel.
    `TunnelId` | `getReceiveTunnelId(int hop)` retrieve the tunnelId that the given hop receives messages on.
    `TunnelId` | `getSendTunnelId(int hop)` retrieve the tunnelId that the given hop sends messages on.
    `TunnelTestStatus` | `getTestStatus()` Get the current test status of this tunnel for UI display.
    `boolean` | `getTunnelFailed()` Has the tunnel failed completely?
    `long` | `getVerifiedBytesTransferred()` we know for sure that this many bytes travelled through the tunnel in its lifetime
    `void` | `incrementVerifiedBytesTransferred(int numBytes)` Increment the verified byte count for data successfully sent through the tunnel.
    `boolean` | `isInbound()` is this an inbound tunnel?
    `void` | `setReused()` Note that we reused this tunnel
    `void` | `setTestFailed()` Set the test status when a test fails.
    `void` | `setTestStarted()` Set the test status when a test is started.
    `void` | `testSuccessful(int responseTime)` Record that the tunnel successfully processed a test with the given response time.
    `boolean` | `wasReused()` Did we reuse this tunnel?

- - ### Method Detail

    - #### getConsecutiveFailures

          int getConsecutiveFailures()

      Get the number of consecutive test failures.
      Returns:
        the count of consecutive failures

    - #### getDestination

          Hash getDestination()

      if this is a client tunnel, what destination is it for?

    - #### getEndpoint

          Hash getEndpoint()

      For convenience
      Returns:
        getPeer(getLength() - 1)

    - #### getExpiration

          long getExpiration()

      Get the tunnel's expiration time.
      Returns:
        expiration time in milliseconds since epoch

    - #### getFarEnd

          Hash getFarEnd()

      For convenience
      Returns:
        isInbound() ? getGateway() : getEndpoint()

    - #### getGateway

          Hash getGateway()

      For convenience
      Returns:
        getPeer(0)

    - #### getLastLatency

          int getLastLatency()

      Get the last recorded round-trip latency for this tunnel from the most recent test.
      Returns:
        latency in milliseconds, or -1 if not available

    - #### getLength

          int getLength()

      how many peers are there in the tunnel (including the creator)?

    - #### getPeer

          Hash getPeer(int hop)

      retrieve the peer at the given hop. the gateway is hop 0

    - #### getProcessedMessagesCount

          int getProcessedMessagesCount()

      Get the count of messages that have been processed through this tunnel.
      Returns:
        the number of processed messages

    - #### getReceiveTunnelId

          TunnelId getReceiveTunnelId(int hop)

      retrieve the tunnelId that the given hop receives messages on. the gateway is hop 0.

    - #### getSendTunnelId

          TunnelId getSendTunnelId(int hop)

      retrieve the tunnelId that the given hop sends messages on. the gateway is hop 0.

    - #### getTestStatus

          TunnelTestStatus getTestStatus()

      Get the current test status of this tunnel for UI display.
      Returns:
        the current test status (UNTESTED, TESTING, GOOD, FAILING, or FAILED)

    - #### getTunnelFailed

          boolean getTunnelFailed()

      Has the tunnel failed completely?

    - #### getVerifiedBytesTransferred

          long getVerifiedBytesTransferred()

      we know for sure that this many bytes travelled through the tunnel in its lifetime

    - #### incrementVerifiedBytesTransferred

          void incrementVerifiedBytesTransferred(int numBytes)

      Increment the verified byte count for data successfully sent through the tunnel.
      Parameters:
        `numBytes` - the number of bytes to add to the verified total

    - #### isInbound

          boolean isInbound()

      is this an inbound tunnel?

    - #### setReused

          void setReused()

      Note that we reused this tunnel

    - #### setTestFailed

          void setTestFailed()

      Set the test status when a test fails. Called by TestJob when a tunnel test fails.

    - #### setTestStarted

          void setTestStarted()

      Set the test status when a test is started. Called by TestJob when beginning a tunnel test.

    - #### testSuccessful

          void testSuccessful(int responseTime)

      Record that the tunnel successfully processed a test with the given response time.
      Parameters:
        `responseTime` - the response time in milliseconds

    - #### wasReused

          boolean wasReused()

      Did we reuse this tunnel?