Package net.i2p.router
Class TunnelPoolSettings
- java.lang.Object
-
- net.i2p.router.TunnelPoolSettings
-
public class TunnelPoolSettings extends Object
Wrap up the settings for a pool of tunnels.
-
-
Field Summary
Fields Modifier and Type Field Description static booleanDEFAULT_ALLOW_ZERO_HOPstatic intDEFAULT_BACKUP_QUANTITYstatic intDEFAULT_DURATIONstatic intDEFAULT_IP_RESTRICTIONstatic intDEFAULT_QUANTITYstatic StringPREFIX_INBOUND_EXPLORATORYprefix used to configure the inbound exploratory poolstatic StringPREFIX_OUTBOUND_EXPLORATORYprefix used to configure the outbound exploratory poolstatic StringPROP_ALLOW_ZERO_HOPdon't trust this, always truestatic StringPROP_BACKUP_QUANTITYstatic StringPROP_DURATIONstatic StringPROP_IP_RESTRICTIONstatic StringPROP_LENGTHstatic StringPROP_LENGTH_VARIANCEstatic StringPROP_NICKNAMEstatic StringPROP_PRIORITYstatic StringPROP_QUANTITYstatic StringPROP_RANDOM_KEY
-
Constructor Summary
Constructors Constructor Description TunnelPoolSettings(boolean isInbound)Exploratory tunnelTunnelPoolSettings(Hash dest, boolean isInbound)Client tunnel unless dest == null
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description Set<Hash>getAliases()Other destinations that use the same tunnel (or null if exploratory) Modifiable, concurrent, not a copyHashgetAliasOf()Other destination that this is an alias of (or null).booleangetAllowZeroHop()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.intgetBackupQuantity()how many backup tunnels should be kept waiting in the wingsHashgetDestination()what destination is this a client tunnel for (or null if exploratory)StringgetDestinationNickname()what user supplied name was given to the client connected (can be null)intgetIPRestriction()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)intgetLength()How many remote hops should be in the tunnel NOT including usintgetLengthOverride()A temporary length to be used due to network conditions.intgetLengthVariance()how should the length be varied.intgetPriority()Outbound message priority - for outbound tunnels onlyintgetQuantity()how many tunnels should be available at all timesSessionKeygetRandomKey()random key used for peer orderingintgetTotalQuantity()ConveniencePropertiesgetUnknownOptions()booleanisExploratory()is this an exploratory tunnel (or a client tunnel)booleanisInbound()is this an inbound tunnel?voidreadFromProperties(String prefix, Properties props)Defaults in props are NOT honored.voidsetAliasOf(Hash h)Set other destination that this is an alias of (or null).voidsetAllowZeroHop(boolean ok)Deprecated.unusedvoidsetBackupQuantity(int quantity)voidsetDestinationNickname(String name)voidsetIPRestriction(int b)voidsetLength(int length)How many remote hops should be in the tunnel NOT including usvoidsetLengthOverride(int length)A temporary length to be used due to network conditions.voidsetLengthVariance(int variance)voidsetQuantity(int quantity)StringtoString()voidwriteToProperties(String prefix, Properties props)
-
-
-
Field Detail
-
PREFIX_INBOUND_EXPLORATORY
public static final String PREFIX_INBOUND_EXPLORATORY
prefix used to configure the inbound exploratory pool- See Also:
- Constant Field Values
-
PREFIX_OUTBOUND_EXPLORATORY
public static final String PREFIX_OUTBOUND_EXPLORATORY
prefix used to configure the outbound exploratory pool- See Also:
- Constant Field Values
-
PROP_NICKNAME
public static final String PROP_NICKNAME
- See Also:
- Constant Field Values
-
PROP_QUANTITY
public static final String PROP_QUANTITY
- See Also:
- Constant Field Values
-
PROP_BACKUP_QUANTITY
public static final String PROP_BACKUP_QUANTITY
- See Also:
- Constant Field Values
-
PROP_DURATION
public static final String PROP_DURATION
- See Also:
- Constant Field Values
-
PROP_LENGTH
public static final String PROP_LENGTH
- See Also:
- Constant Field Values
-
PROP_LENGTH_VARIANCE
public static final String PROP_LENGTH_VARIANCE
- See Also:
- Constant Field Values
-
PROP_ALLOW_ZERO_HOP
public static final String PROP_ALLOW_ZERO_HOP
don't trust this, always true- See Also:
- Constant Field Values
-
PROP_IP_RESTRICTION
public static final String PROP_IP_RESTRICTION
- See Also:
- Constant Field Values
-
PROP_PRIORITY
public static final String PROP_PRIORITY
- See Also:
- Constant Field Values
-
PROP_RANDOM_KEY
public static final String PROP_RANDOM_KEY
- Since:
- 0.9.17
- See Also:
- Constant Field Values
-
DEFAULT_QUANTITY
public static final int DEFAULT_QUANTITY
- See Also:
- Constant Field Values
-
DEFAULT_BACKUP_QUANTITY
public static final int DEFAULT_BACKUP_QUANTITY
- See Also:
- Constant Field Values
-
DEFAULT_DURATION
public static final int DEFAULT_DURATION
- See Also:
- Constant Field Values
-
DEFAULT_ALLOW_ZERO_HOP
public static final boolean DEFAULT_ALLOW_ZERO_HOP
- See Also:
- Constant Field Values
-
DEFAULT_IP_RESTRICTION
public static final int DEFAULT_IP_RESTRICTION
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
TunnelPoolSettings
public TunnelPoolSettings(boolean isInbound)
Exploratory tunnel
-
TunnelPoolSettings
public TunnelPoolSettings(Hash dest, boolean isInbound)
Client tunnel unless dest == null
-
-
Method Detail
-
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 public void setAllowZeroHop(boolean ok)
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
public Hash getDestination()
what destination is this a client tunnel for (or null if exploratory)
-
getAliases
public Set<Hash> getAliases()
Other destinations that use the same tunnel (or null if exploratory) Modifiable, concurrent, not a copy- Since:
- 0.9.21
-
getAliasOf
public Hash getAliasOf()
Other destination that this is an alias of (or null). If non-null, don't build tunnels.- Since:
- 0.9.21
-
setAliasOf
public void setAliasOf(Hash h)
Set other destination that this is an alias of (or null). If non-null, don't build tunnels.- Since:
- 0.9.21
-
getRandomKey
public SessionKey getRandomKey()
random key used for peer ordering- Returns:
- non-null
-
getDestinationNickname
public String getDestinationNickname()
what user supplied name was given to the client connected (can be null)
-
setDestinationNickname
public void setDestinationNickname(String name)
-
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)
-
setIPRestriction
public void setIPRestriction(int b)
-
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
public Properties getUnknownOptions()
- Returns:
- non-null
-
readFromProperties
public void readFromProperties(String prefix, Properties props)
Defaults in props are NOT honored. In-JVM client side must promote defaults to the primary map.- Parameters:
prefix- non-null
-
writeToProperties
public void writeToProperties(String prefix, Properties props)
- Parameters:
prefix- non-null
-
-