Package net.i2p.router
Class TunnelPoolSettings
java.lang.Object
net.i2p.router.TunnelPoolSettings
Wrap up the settings for a pool of tunnels.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final boolean
static final int
static final int
static final int
static final int
static final String
prefix used to configure the inbound exploratory poolstatic final String
prefix used to configure the outbound exploratory poolstatic final String
don't trust this, always truestatic final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
-
Constructor Summary
ConstructorDescriptionTunnelPoolSettings
(boolean isInbound) Exploratory tunnelTunnelPoolSettings
(Hash dest, boolean isInbound) Client tunnel unless dest == null -
Method Summary
Modifier and TypeMethodDescriptionOther destinations that use the same tunnel (or null if exploratory) Modifiable, concurrent, not a copyOther destination that this is an alias of (or null).boolean
If there are no tunnels to build with, will this pool allow 0 hop tunnels? As of 0.9.44, same goes for exploratory: Prior to 0.9.35, generally true for client.int
how many backup tunnels should be kept waiting in the wingswhat destination is this a client tunnel for (or null if exploratory)what user supplied name was given to the client connected (can be null)int
How many bytes to match to determine if a router's IP is too close to another's to be in the same tunnel (1-4, 0 to disable) Support removed in the ClientPeerSelector in 0.8.6; restored in 0.9.53int
How many remote hops should be in the tunnel NOT including usint
A temporary length to be used due to network conditions.int
how should the length be varied.int
Outbound message priority - for outbound tunnels onlyint
how many tunnels should be available at all timesrandom key used for peer orderingint
Convenienceboolean
is this an exploratory tunnel (or a client tunnel)boolean
is this an inbound tunnel?void
readFromProperties
(String prefix, Properties props) Defaults in props are NOT honored.void
setAliasOf
(Hash h) Set other destination that this is an alias of (or null).void
setAllowZeroHop
(boolean ok) Deprecated.unusedvoid
setBackupQuantity
(int quantity) void
setDestinationNickname
(String name) void
setLength
(int length) How many remote hops should be in the tunnel NOT including usvoid
setLengthOverride
(int length) A temporary length to be used due to network conditions.void
setLengthVariance
(int variance) void
setQuantity
(int quantity) toString()
void
writeToProperties
(String prefix, Properties props)
-
Field Details
-
PREFIX_INBOUND_EXPLORATORY
prefix used to configure the inbound exploratory pool- See Also:
-
PREFIX_OUTBOUND_EXPLORATORY
prefix used to configure the outbound exploratory pool- See Also:
-
PROP_NICKNAME
- See Also:
-
PROP_QUANTITY
- See Also:
-
PROP_BACKUP_QUANTITY
- See Also:
-
PROP_DURATION
- See Also:
-
PROP_LENGTH
- See Also:
-
PROP_LENGTH_VARIANCE
- See Also:
-
PROP_ALLOW_ZERO_HOP
don't trust this, always true- See Also:
-
PROP_IP_RESTRICTION
- See Also:
-
PROP_PRIORITY
- See Also:
-
PROP_RANDOM_KEY
- Since:
- 0.9.17
- See Also:
-
DEFAULT_QUANTITY
public static final int DEFAULT_QUANTITY- See Also:
-
DEFAULT_BACKUP_QUANTITY
public static final int DEFAULT_BACKUP_QUANTITY- See Also:
-
DEFAULT_DURATION
public static final int DEFAULT_DURATION- See Also:
-
DEFAULT_ALLOW_ZERO_HOP
public static final boolean DEFAULT_ALLOW_ZERO_HOP- See Also:
-
DEFAULT_IP_RESTRICTION
public static final int DEFAULT_IP_RESTRICTION- See Also:
-
-
Constructor Details
-
TunnelPoolSettings
public TunnelPoolSettings(boolean isInbound) Exploratory tunnel -
TunnelPoolSettings
Client tunnel unless dest == null
-
-
Method Details
-
getQuantity
public int getQuantity()how many tunnels should be available at all times -
setQuantity
public void setQuantity(int quantity) -
getBackupQuantity
public int getBackupQuantity()how many backup tunnels should be kept waiting in the wings -
setBackupQuantity
public void setBackupQuantity(int quantity) -
getTotalQuantity
public int getTotalQuantity()Convenience- Returns:
- getQuantity() + getBackupQuantity()
- Since:
- 0.8.11
-
getLength
public int getLength()How many remote hops should be in the tunnel NOT including us- Returns:
- 0 to 7
-
setLength
public void setLength(int length) How many remote hops should be in the tunnel NOT including us- Parameters:
length
- 0 to 7 (not enforced here)
-
getAllowZeroHop
public boolean getAllowZeroHop()If there are no tunnels to build with, will this pool allow 0 hop tunnels? As of 0.9.44, same goes for exploratory: Prior to 0.9.35, generally true for client. As of 0.9.35, generally false for client, but true if getLength() + Math.min(getLengthVariance(), 0) <= 0, OR if getLengthOverride() == 0 OR if setAllowZeroHop(true) was called or set in properties. -
setAllowZeroHop
Deprecated.unusedIf there are no tunnels to build with, will this pool allow 0 hop tunnels? No effect on exploratory (always true)- Parameters:
ok
- if true, getAllowZeroHop() will always return true if false, getAllowZeroHop will return as documented.
-
getLengthVariance
public int getLengthVariance()how should the length be varied. if negative, this randomly skews from (length - variance) to (length + variance), or if positive, from length to (length + variance), inclusive. -
setLengthVariance
public void setLengthVariance(int variance) -
getLengthOverride
public int getLengthOverride()A temporary length to be used due to network conditions. If less than zero, the standard length should be used. Unused until 0.8.11 -
setLengthOverride
public void setLengthOverride(int length) A temporary length to be used due to network conditions. If less than zero, the standard length will be used. Unused until 0.8.11 -
isInbound
public boolean isInbound()is this an inbound tunnel? -
isExploratory
public boolean isExploratory()is this an exploratory tunnel (or a client tunnel) -
getDestination
what destination is this a client tunnel for (or null if exploratory) -
getAliases
Other destinations that use the same tunnel (or null if exploratory) Modifiable, concurrent, not a copy- Since:
- 0.9.21
-
getAliasOf
Other destination that this is an alias of (or null). If non-null, don't build tunnels.- Since:
- 0.9.21
-
setAliasOf
Set other destination that this is an alias of (or null). If non-null, don't build tunnels.- Since:
- 0.9.21
-
getRandomKey
random key used for peer ordering- Returns:
- non-null
-
getDestinationNickname
what user supplied name was given to the client connected (can be null) -
setDestinationNickname
-
getIPRestriction
public int getIPRestriction()How many bytes to match to determine if a router's IP is too close to another's to be in the same tunnel (1-4, 0 to disable) Support removed in the ClientPeerSelector in 0.8.6; restored in 0.9.53- Returns:
- 0-4 Number of bytes to match to determine if peers in the same IP range should not be in the same tunnel. 0 = disable check; 1 = /8; 2 = /16; 3 = /24; 4 = exact IP match
-
getPriority
public int getPriority()Outbound message priority - for outbound tunnels only- Returns:
- -25 to +30, default 30 for outbound exploratory and 0 for others
- Since:
- 0.9.4
-
getUnknownOptions
- Returns:
- non-null
-
readFromProperties
Defaults in props are NOT honored. In-JVM client side must promote defaults to the primary map.- Parameters:
prefix
- non-null
-
writeToProperties
- Parameters:
prefix
- non-null
-
toString
-