Package net.i2p.router.tunnel
Class TunnelCreatorConfig
- java.lang.Object
-
- net.i2p.router.tunnel.TunnelCreatorConfig
-
- All Implemented Interfaces:
TunnelInfo
- Direct Known Subclasses:
PooledTunnelCreatorConfig
public abstract 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 See PooledTunnelCreatorConfig for the non-abstract class
-
-
Field Summary
Fields Modifier and Type Field Description protected RouterContext
_context
static int
REPLY_IV_LENGTH
IV length forgetAESReplyIV(int)
-
Constructor Summary
Constructors Constructor Description TunnelCreatorConfig(RouterContext ctx, int length, boolean isInbound)
For exploratory only (null destination)TunnelCreatorConfig(RouterContext ctx, int length, boolean isInbound, Hash destination)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]
getAESReplyIV(int hop)
IV used to encrypt the reply sent for the tunnel creation crypto.SessionKey
getAESReplyKey(int hop)
Key to encrypt the reply sent for the tunnel creation crypto.Hash
getBlankHash()
Checksum for blank recordbyte[]
getChaChaReplyAD(int hop)
Get ECIES reply ADSessionKey
getChaChaReplyKey(int hop)
Get ECIES reply keyHopConfig
getConfig(int hop)
retrieve the config for the given hop.Hash
getDestination()
If this is a client tunnel, what destination is it for?Hash
getEndpoint()
For conveniencelong
getExpiration()
Hash
getFarEnd()
For convenienceMessageWrapper.OneTimeSession
getGarlicReplyKeys()
ECIES short OBEP record only.Hash
getGateway()
For convenienceint
getLength()
How many hops are there in the tunnel? INCLUDING US.Properties
getOptions()
Hash
getPeer(int hop)
retrieve the peer at the given hop.int
getPriority()
Outbound message priority - for outbound tunnels onlyint
getProcessedMessagesCount()
TunnelId
getReceiveTunnelId(int hop)
retrieve the tunnelId that the given hop receives messages on.long
getReplyMessageId()
new style reply message idList<Integer>
getReplyOrder()
component ordering in the new style requestTunnelId
getSendTunnelId(int hop)
retrieve the tunnelId that the given hop sends messages on.boolean
getTunnelFailed()
int
getTunnelFailures()
long
getVerifiedBytesTransferred()
we know for sure that this many bytes travelled through the tunnel in its lifetimevoid
incrementProcessedMessages()
take note of a message being pumped through this tunnelvoid
incrementVerifiedBytesTransferred(int bytes)
This calls profile manager tunnelDataPushed1m() for each peerboolean
isEC(int hop)
Is it an ECIES hop?boolean
isInbound()
is this an inbound tunnel?void
setAESReplyKeys(int hop, SessionKey key, byte[] iv)
Key and IV to encrypt the reply sent for the tunnel creation crypto.void
setBlankHash(Hash h)
Checksum for blank recordvoid
setChaChaReplyKeys(int hop, SessionKey key, byte[] ad)
Set ECIES reply key and IVvoid
setExpiration(long when)
void
setGarlicReplyKeys(MessageWrapper.OneTimeSession keys)
ECIES short OBEP record only.void
setPeer(int hop, Hash peer)
void
setPriority(int priority)
Outbound message priority - for outbound tunnels onlyvoid
setReplyMessageId(long id)
void
setReplyOrder(List<Integer> order)
void
setReused()
Note that we reused this tunnelvoid
testSuccessful(int ms)
take note that the tunnel was able to measurably Do Good in the given timeString
toString()
String
toStringFull()
boolean
tunnelFailed()
The tunnel failed a test, so (maybe) stop using itboolean
wasReused()
Did we reuse this tunnel?
-
-
-
Field Detail
-
_context
protected final RouterContext _context
-
REPLY_IV_LENGTH
public static final int REPLY_IV_LENGTH
IV length forgetAESReplyIV(int)
- Since:
- 0.9.48 moved from HopConfig
- See Also:
- Constant Field Values
-
-
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 interfaceTunnelInfo
-
getOptions
public Properties getOptions()
-
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 interfaceTunnelInfo
-
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 interfaceTunnelInfo
-
getPeer
public Hash getPeer(int hop)
retrieve the peer at the given hop. the gateway is hop 0- Specified by:
getPeer
in interfaceTunnelInfo
-
setPeer
public void setPeer(int hop, Hash peer)
-
getGateway
public Hash getGateway()
For convenience- Specified by:
getGateway
in interfaceTunnelInfo
- Returns:
- getPeer(0)
- Since:
- 0.8.9
-
getEndpoint
public Hash getEndpoint()
For convenience- Specified by:
getEndpoint
in interfaceTunnelInfo
- Returns:
- getPeer(getLength() - 1)
- Since:
- 0.8.9
-
getFarEnd
public Hash getFarEnd()
For convenience- Specified by:
getFarEnd
in interfaceTunnelInfo
- Returns:
- isInbound() ? getGateway() : getEndpoint()
- Since:
- 0.8.9
-
isInbound
public boolean isInbound()
is this an inbound tunnel?- Specified by:
isInbound
in interfaceTunnelInfo
-
getDestination
public Hash getDestination()
If this is a client tunnel, what destination is it for?- Specified by:
getDestination
in interfaceTunnelInfo
- Returns:
- null for exploratory
-
getExpiration
public long getExpiration()
- Specified by:
getExpiration
in interfaceTunnelInfo
-
setExpiration
public void setExpiration(long when)
-
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
-
getProcessedMessagesCount
public int getProcessedMessagesCount()
- Specified by:
getProcessedMessagesCount
in interfaceTunnelInfo
-
incrementVerifiedBytesTransferred
public void incrementVerifiedBytesTransferred(int bytes)
This calls profile manager tunnelDataPushed1m() for each peer- Specified by:
incrementVerifiedBytesTransferred
in interfaceTunnelInfo
-
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 interfaceTunnelInfo
-
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 interfaceTunnelInfo
-
wasReused
public boolean wasReused()
Did we reuse this tunnel?- Specified by:
wasReused
in interfaceTunnelInfo
- Since:
- 0.8.11
-
setReused
public void setReused()
Note that we reused this tunnel- Specified by:
setReused
in interfaceTunnelInfo
- 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
-
setAESReplyKeys
public void setAESReplyKeys(int hop, SessionKey key, byte[] iv)
Key and IV to encrypt the reply sent for the tunnel creation crypto.- Throws:
IllegalArgumentException
- if iv not 16 bytes- Since:
- 0.9.48 moved from HopConfig
-
getAESReplyKey
public SessionKey getAESReplyKey(int hop)
Key to encrypt the reply sent for the tunnel creation crypto. Null for short build record.- Returns:
- key or null
- Throws:
IllegalArgumentException
- if iv not 16 bytes- Since:
- 0.9.48 moved from HopConfig
-
getAESReplyIV
public byte[] getAESReplyIV(int hop)
IV used to encrypt the reply sent for the tunnel creation crypto. Null for short build record.- Returns:
- 16 bytes or null
- Since:
- 0.9.48 moved from HopConfig
-
getBlankHash
public Hash getBlankHash()
Checksum for blank record- Since:
- 0.9.48
-
setBlankHash
public void setBlankHash(Hash h)
Checksum for blank record- Since:
- 0.9.48
-
setChaChaReplyKeys
public void setChaChaReplyKeys(int hop, SessionKey key, byte[] ad)
Set ECIES reply key and IV- Since:
- 0.9.48
-
isEC
public boolean isEC(int hop)
Is it an ECIES hop?- Since:
- 0.9.48
-
getChaChaReplyKey
public SessionKey getChaChaReplyKey(int hop)
Get ECIES reply key- Since:
- 0.9.48
-
getChaChaReplyAD
public byte[] getChaChaReplyAD(int hop)
Get ECIES reply AD- Since:
- 0.9.48
-
setGarlicReplyKeys
public void setGarlicReplyKeys(MessageWrapper.OneTimeSession keys)
ECIES short OBEP record only.- Since:
- 0.9.51
-
getGarlicReplyKeys
public MessageWrapper.OneTimeSession getGarlicReplyKeys()
ECIES short OBEP record only.- Returns:
- null for ElGamal or ECIES long record or non-OBEP
- Since:
- 0.9.51
-
toStringFull
public String toStringFull()
- Since:
- 0.9.51
-
-