Class TunnelCreatorConfig

  • All Implemented Interfaces:
    TunnelInfo
    Direct Known Subclasses:
    PooledTunnelCreatorConfig

    public class TunnelCreatorConfig
    extends Object
    implements TunnelInfo
    Coordinate the info that the tunnel creator keeps track of, including what peers are in the tunnel and what their configuration is
    • Constructor Detail

      • TunnelCreatorConfig

        public TunnelCreatorConfig​(RouterContext ctx,
                                   int length,
                                   boolean isInbound)
        For exploratory only (null destination)
        Parameters:
        length - 1 minimum (0 hop is length 1)
      • TunnelCreatorConfig

        public TunnelCreatorConfig​(RouterContext ctx,
                                   int length,
                                   boolean isInbound,
                                   Hash destination)
        Parameters:
        length - 1 minimum (0 hop is length 1)
        destination - null for exploratory
    • Method Detail

      • getLength

        public int getLength()
        How many hops are there in the tunnel? INCLUDING US. i.e. one more than the TunnelCreatorConfig length.
        Specified by:
        getLength in interface TunnelInfo
      • getConfig

        public HopConfig getConfig​(int hop)
        retrieve the config for the given hop. the gateway is hop 0.
      • getReceiveTunnelId

        public TunnelId getReceiveTunnelId​(int hop)
        retrieve the tunnelId that the given hop receives messages on. the gateway is hop 0.
        Specified by:
        getReceiveTunnelId in interface TunnelInfo
      • getSendTunnelId

        public TunnelId getSendTunnelId​(int hop)
        retrieve the tunnelId that the given hop sends messages on. the gateway is hop 0.
        Specified by:
        getSendTunnelId in interface TunnelInfo
      • getPeer

        public Hash getPeer​(int hop)
        retrieve the peer at the given hop. the gateway is hop 0
        Specified by:
        getPeer in interface TunnelInfo
      • setPeer

        public void setPeer​(int hop,
                            Hash peer)
      • getGateway

        public Hash getGateway()
        For convenience
        Specified by:
        getGateway in interface TunnelInfo
        Returns:
        getPeer(0)
        Since:
        0.8.9
      • getEndpoint

        public Hash getEndpoint()
        For convenience
        Specified by:
        getEndpoint in interface TunnelInfo
        Returns:
        getPeer(getLength() - 1)
        Since:
        0.8.9
      • getFarEnd

        public Hash getFarEnd()
        For convenience
        Specified by:
        getFarEnd in interface TunnelInfo
        Returns:
        isInbound() ? getGateway() : getEndpoint()
        Since:
        0.8.9
      • isInbound

        public boolean isInbound()
        is this an inbound tunnel?
        Specified by:
        isInbound in interface TunnelInfo
      • getDestination

        public Hash getDestination()
        If this is a client tunnel, what destination is it for?
        Specified by:
        getDestination in interface TunnelInfo
        Returns:
        null for exploratory
      • setExpiration

        public void setExpiration​(long when)
      • getReplyOrder

        public List<Integer> getReplyOrder()
        component ordering in the new style request
      • setReplyOrder

        public void setReplyOrder​(List<Integer> order)
      • getReplyMessageId

        public long getReplyMessageId()
        new style reply message id
      • setReplyMessageId

        public void setReplyMessageId​(long id)
      • incrementProcessedMessages

        public void incrementProcessedMessages()
        take note of a message being pumped through this tunnel
      • incrementVerifiedBytesTransferred

        public void incrementVerifiedBytesTransferred​(int bytes)
        This calls profile manager tunnelDataPushed1m() for each peer
        Specified by:
        incrementVerifiedBytesTransferred in interface TunnelInfo
      • getVerifiedBytesTransferred

        public long getVerifiedBytesTransferred()
        Description copied from interface: TunnelInfo
        we know for sure that this many bytes travelled through the tunnel in its lifetime
        Specified by:
        getVerifiedBytesTransferred in interface TunnelInfo
      • tunnelFailed

        public boolean tunnelFailed()
        The tunnel failed a test, so (maybe) stop using it
      • getTunnelFailed

        public boolean getTunnelFailed()
      • getTunnelFailures

        public int getTunnelFailures()
      • testSuccessful

        public void testSuccessful​(int ms)
        Description copied from interface: TunnelInfo
        take note that the tunnel was able to measurably Do Good in the given time
        Specified by:
        testSuccessful in interface TunnelInfo
      • wasReused

        public boolean wasReused()
        Did we reuse this tunnel?
        Specified by:
        wasReused in interface TunnelInfo
        Since:
        0.8.11
      • setReused

        public void setReused()
        Note that we reused this tunnel
        Specified by:
        setReused in interface TunnelInfo
        Since:
        0.8.11
      • getPriority

        public int getPriority()
        Outbound message priority - for outbound tunnels only
        Returns:
        -25 to +25, default 0
        Since:
        0.9.4
      • setPriority

        public void setPriority​(int priority)
        Outbound message priority - for outbound tunnels only
        Parameters:
        priority - -25 to +25, default 0
        Since:
        0.9.4
      • format

        static String format​(long date)