net.i2p.router
Class TunnelPoolSettings

java.lang.Object
  extended by net.i2p.router.TunnelPoolSettings

public class TunnelPoolSettings
extends Object

Wrap up the settings for a pool of tunnels.


Field Summary
static boolean DEFAULT_ALLOW_ZERO_HOP
           
static int DEFAULT_BACKUP_QUANTITY
           
static int DEFAULT_DURATION
           
static int DEFAULT_IP_RESTRICTION
           
static int DEFAULT_LENGTH
           
static int DEFAULT_LENGTH_VARIANCE
           
static int DEFAULT_QUANTITY
           
static String PREFIX_DEFAULT
          prefix used to override the router's defaults for clients
static String PREFIX_INBOUND_EXPLORATORY
          prefix used to configure the inbound exploratory pool
static String PREFIX_OUTBOUND_EXPLORATORY
          prefix used to configure the outbound exploratory pool
static String PROP_ALLOW_ZERO_HOP
           
static String PROP_BACKUP_QUANTITY
           
static String PROP_DURATION
           
static String PROP_IP_RESTRICTION
           
static String PROP_LENGTH
           
static String PROP_LENGTH_VARIANCE
           
static String PROP_NICKNAME
           
static String PROP_QUANTITY
           
 
Constructor Summary
TunnelPoolSettings(boolean isExploratory, boolean isInbound)
           
 
Method Summary
 boolean getAllowZeroHop()
          if there are no tunnels to build with, will this pool allow 0 hop tunnels?
 int getBackupQuantity()
          how many backup tunnels should be kept waiting in the wings
 Hash getDestination()
          what destination is this a tunnel for (or null if none)
 String getDestinationNickname()
          what user supplied name was given to the client connected (can be null)
 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)
 int getLength()
          How many remote hops should be in the tunnel NOT including us
 int getLengthOverride()
          A temporary length to be used due to network conditions.
 int getLengthVariance()
          how should the length be varied.
 int getQuantity()
          how many tunnels should be available at all times
 Hash getRandomKey()
          random key used for peer ordering
 int getTotalQuantity()
          Convenience
 Properties getUnknownOptions()
           
 boolean isExploratory()
          is this an exploratory tunnel (or a client tunnel)
 boolean isInbound()
          is this an inbound tunnel?
 void readFromProperties(String prefix, Map<Object,Object> props)
           
 void setAllowZeroHop(boolean ok)
           
 void setBackupQuantity(int quantity)
           
 void setDestination(Hash dest)
           
 void setDestinationNickname(String name)
           
 void setIPRestriction(int b)
           
 void setLength(int length)
          How many remote hops should be in the tunnel NOT including us
 void setLengthOverride(int length)
          A temporary length to be used due to network conditions.
 void setLengthVariance(int variance)
           
 void setQuantity(int quantity)
           
 String toString()
           
 void writeToProperties(String prefix, Properties props)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PREFIX_DEFAULT

public static final String PREFIX_DEFAULT
prefix used to override the router's defaults for clients

See Also:
Constant Field Values

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
See Also:
Constant Field Values

PROP_IP_RESTRICTION

public static final String PROP_IP_RESTRICTION
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_LENGTH

public static final int DEFAULT_LENGTH
See Also:
Constant Field Values

DEFAULT_LENGTH_VARIANCE

public static final int DEFAULT_LENGTH_VARIANCE
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 isExploratory,
                          boolean isInbound)
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?


setAllowZeroHop

public void setAllowZeroHop(boolean ok)

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 tunnel for (or null if none)


setDestination

public void setDestination(Hash dest)

getRandomKey

public Hash getRandomKey()
random key used for peer ordering


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)

getUnknownOptions

public Properties getUnknownOptions()

readFromProperties

public void readFromProperties(String prefix,
                               Map<Object,Object> props)

writeToProperties

public void writeToProperties(String prefix,
                              Properties props)

toString

public String toString()
Overrides:
toString in class Object