net.i2p.i2ptunnel.ui

## Class TunnelConfig

- java.lang.Object
- - net.i2p.i2ptunnel.ui.TunnelConfig

-     public class TunnelConfig
      extends Object

  Helper class to generate a valid TunnelController configuration from provided settings. This class is also used by Android. Maintain as a stable API and take care not to break Android.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected I2PAppContext` | `_context`
    `(package private) static Set<String>` | `_nonProxyNoShowSet`
    `(package private) static Set<String>` | `_noShowSet`
    `protected static String` | `PROP_ENABLE_ACCESS_LIST`
    `protected static String` | `PROP_ENABLE_BLACKLIST`
    `static String` | `PROP_MAX_CONNS_DAY`
    `static String` | `PROP_MAX_CONNS_HOUR`
    `static String` | `PROP_MAX_CONNS_MIN` all of these are @since 0.8.3 (moved from IndexBean)
    `static String` | `PROP_MAX_STREAMS`
    `static String` | `PROP_MAX_TOTAL_CONNS_DAY`
    `static String` | `PROP_MAX_TOTAL_CONNS_HOUR`
    `static String` | `PROP_MAX_TOTAL_CONNS_MIN`
    `static String` | `SHARED_CLIENT_NICKNAME`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `TunnelConfig()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addClientKeys(String[] s)` Multiple entries in form Handles either order addClientName/addClientKey
    `void` | `addClientNames(String[] s)` Multiple entries in form
    `Properties` | `getConfig()` Based on all provided data, create a set of configuration parameters suitable for use in a TunnelController.
    `String` | `getPrivKeyFile()`
    `int` | `getShutdownDelayMax()`
    `int` | `getShutdownDelayMin()`
    `int` | `getStartupDelayMax()`
    `int` | `getStartupDelayMin()`
    `String` | `getType()`
    `void` | `newClientKey(String s)` Handles either order newClientName/newClientKey
    `void` | `newClientName(String s)` Handles either order newClientName/newClientKey
    `void` | `revokeClients(String[] s)` Multiple entries in form
    `void` | `setAccessList(String val)`
    `void` | `setAccessMode(int mode)` Controls how other tunnels are checked for access.
    `void` | `setAddClient(boolean val)`
    `void` | `setAllowAccept(boolean val)`
    `void` | `setAllowInternalSSL(boolean val)`
    `void` | `setAllowReferer(boolean val)`
    `void` | `setAllowUserAgent(boolean val)`
    `void` | `setAltPrivKeyFile(String file)` What filename is this server tunnel's alternate private keys stored in
    `void` | `setBlindedPassword(String s)`
    `void` | `setClientHost(String host)` I2CP host the router is on, ignored when in router context
    `void` | `setClientPort(String port)` I2CP port the router is on, ignored when in router context
    `void` | `setClose(boolean val)`
    `void` | `setCloseTime(int val)`
    `void` | `setConnectDelay(boolean val)`
    `void` | `setCustomOptions(String customOptions)` what I2P session overrides should be used
    `void` | `setDCC(boolean val)`
    `void` | `setDelayOpen(boolean val)`
    `void` | `setDescription(String description)` one line description
    `void` | `setDestination(Destination dest)` This is easier than requiring TunnelConfig to talk to TunnelControllerGroup and TunnelController.
    `void` | `setEncrypt(boolean val)`
    `void` | `setEncryptKey(String val)`
    `void` | `setEncryptMode(int mode)`
    `void` | `setEncType(String val)` Adds to existing, comma separated
    `void` | `setFilterDefinition(String filterDefinition)`
    `void` | `setInboundRandomKey(String s)` Random keys
    `void` | `setJumpList(String val)`
    `void` | `setLeaseSetPrivateKey(String s)`
    `void` | `setLeaseSetSigningPrivateKey(String s)`
    `void` | `setLimitDay(int val)`
    `void` | `setLimitHour(int val)`
    `void` | `setLimitMinute(int val)`
    `void` | `setMaxStreams(int val)`
    `void` | `setMultihome(boolean val)`
    `void` | `setName(String name)` Short name of the tunnel
    `void` | `setNewDest(int mode)` Controls how ephemeral the I2P Destination of a client tunnel is.
    `void` | `setOutboundRandomKey(String s)`
    `void` | `setOutproxyAuth(boolean val)` Sets whether authentication is required for any of the configured outproxies.
    `void` | `setOutproxyPassword(String s)`
    `void` | `setOutproxyType(String s)`
    `void` | `setOutproxyUsername(String s)`
    `void` | `setPort(int port)` what port should this client/httpclient/ircclient listen on
    `void` | `setPostBanTime(int val)`
    `void` | `setPostCheckTime(int val)`
    `void` | `setPostMax(int val)` POST limits
    `void` | `setPostTotalBanTime(int val)`
    `void` | `setPostTotalMax(int val)`
    `void` | `setPrivKeyFile(String file)` What filename is this server tunnel's private keys stored in
    `void` | `setProfile(String profile)`
    `void` | `setProxyAuth(String authType)` Sets whether authentication should be used for client proxy tunnels.
    `void` | `setProxyList(String proxyList)` what HTTP outproxies should be used (httpclient specific)
    `void` | `setProxyPassword(String s)`
    `void` | `setProxyUsername(String s)`
    `void` | `setReachableBy(String reachableBy)` what interface should this client/httpclient/ircclient listen on
    `void` | `setReduce(boolean val)`
    `void` | `setReduceCount(int val)`
    `void` | `setReduceTime(int val)`
    `void` | `setRejectInproxy(boolean val)`
    `void` | `setRejectReferer(boolean val)`
    `void` | `setRejectUserAgents(boolean val)`
    `void` | `setShared(boolean val)`
    `void` | `setShutdownDelayMax(int val)`
    `void` | `setShutdownDelayMin(int val)`
    `void` | `setSigType(String val)`
    `void` | `setSpoofedHost(String host)` What host does this http server tunnel spoof
    `void` | `setSslProxies(String s)`
    `void` | `setStartOnLoad(boolean val)` If called with any value, we want this tunnel to start whenever it is loaded (aka right now and whenever the router is started up)
    `void` | `setStartupDelayMax(int val)`
    `void` | `setStartupDelayMin(int val)`
    `void` | `setTargetDestination(String dest)` What peer does this client tunnel point at
    `void` | `setTargetHost(String host)` What host does this server tunnel point at
    `void` | `setTargetPort(int port)` What port does this server tunnel point at
    `void` | `setTotalDay(int val)`
    `void` | `setTotalHour(int val)`
    `void` | `setTotalMinute(int val)`
    `void` | `setTunnelBackupQuantity(int tunnelBackupQuantity)` how many tunnels to hold in reserve to guard against failures In or both in/out
    `void` | `setTunnelBackupQuantityOut(int tunnelBackupQuantity)` how many tunnels to hold in reserve to guard against failures
    `void` | `setTunnelDepth(int tunnelDepth)` how many hops to use for inbound tunnels In or both in/out
    `void` | `setTunnelDepthOut(int tunnelDepth)` how many hops to use for outbound tunnels
    `void` | `setTunnelQuantity(int tunnelQuantity)` how many parallel inbound tunnels to use In or both in/out
    `void` | `setTunnelQuantityOut(int tunnelQuantity)` how many parallel outbound tunnels to use
    `void` | `setTunnelVariance(int tunnelVariance)` how much randomisation to apply to the depth of tunnels In or both in/out
    `void` | `setTunnelVarianceOut(int tunnelVariance)` how much randomisation to apply to the depth of tunnels
    `void` | `setType(String type)` What type of tunnel (httpclient, ircclient, client, or server).
    `void` | `setUniqueLocal(boolean val)`
    `void` | `setUseOutproxyPlugin(boolean val)`
    `void` | `setUserAgents(String val)`
    `void` | `setUseSSL(boolean val)`
    `void` | `updateTunnelQuantities(Properties config)` Update tunnel quantities for the provided config from this TunnelConfig.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### _context

          protected final I2PAppContext _context

    - #### _nonProxyNoShowSet

          static final Set<String> _nonProxyNoShowSet

    - #### _noShowSet

          static final Set<String> _noShowSet

    - #### PROP_ENABLE_ACCESS_LIST

          protected static final String PROP_ENABLE_ACCESS_LIST

      See Also:
        Constant Field Values

    - #### PROP_ENABLE_BLACKLIST

          protected static final String PROP_ENABLE_BLACKLIST

      See Also:
        Constant Field Values

    - #### PROP_MAX_CONNS_DAY

          public static final String PROP_MAX_CONNS_DAY

      See Also:
        Constant Field Values

    - #### PROP_MAX_CONNS_HOUR

          public static final String PROP_MAX_CONNS_HOUR

      See Also:
        Constant Field Values

    - #### PROP_MAX_CONNS_MIN

          public static final String PROP_MAX_CONNS_MIN

      all of these are @since 0.8.3 (moved from IndexBean)
      See Also:
        Constant Field Values

    - #### PROP_MAX_STREAMS

          public static final String PROP_MAX_STREAMS

      See Also:
        Constant Field Values

    - #### PROP_MAX_TOTAL_CONNS_DAY

          public static final String PROP_MAX_TOTAL_CONNS_DAY

      See Also:
        Constant Field Values

    - #### PROP_MAX_TOTAL_CONNS_HOUR

          public static final String PROP_MAX_TOTAL_CONNS_HOUR

      See Also:
        Constant Field Values

    - #### PROP_MAX_TOTAL_CONNS_MIN

          public static final String PROP_MAX_TOTAL_CONNS_MIN

      See Also:
        Constant Field Values

    - #### SHARED_CLIENT_NICKNAME

          public static final String SHARED_CLIENT_NICKNAME

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### TunnelConfig

          public TunnelConfig()

  - ### Method Detail

    - #### addClientKeys

          public void addClientKeys(String[] s)

      Multiple entries in form Handles either order addClientName/addClientKey

    - #### addClientNames

          public void addClientNames(String[] s)

      Multiple entries in form

    - #### getConfig

          public Properties getConfig()

      Based on all provided data, create a set of configuration parameters suitable for use in a TunnelController. This will replace (not add to) any existing parameters, so this should return a comprehensive mapping.

    - #### getPrivKeyFile

          public String getPrivKeyFile()

    - #### getShutdownDelayMax

          public int getShutdownDelayMax()

      Returns:
        the maximum shutdown delay in seconds

    - #### getShutdownDelayMin

          public int getShutdownDelayMin()

      Returns:
        the minimum shutdown delay in seconds

    - #### getStartupDelayMax

          public int getStartupDelayMax()

      Returns:
        the maximum startup delay in seconds

    - #### getStartupDelayMin

          public int getStartupDelayMin()

      Returns:
        the minimum startup delay in seconds

    - #### getType

          public String getType()

    - #### newClientKey

          public void newClientKey(String s)

      Handles either order newClientName/newClientKey

    - #### newClientName

          public void newClientName(String s)

      Handles either order newClientName/newClientKey

    - #### revokeClients

          public void revokeClients(String[] s)

      Multiple entries in form

    - #### setAccessList

          public void setAccessList(String val)

    - #### setAccessMode

          public void setAccessMode(int mode)

      Controls how other tunnels are checked for access.

      The list used for whitelisting/blacklisting can be set with `setAccessList(String)`.

      Parameters:
        `mode` - 0 for no control, 1 for whitelist, 2 for blacklist

    - #### setAddClient

          public void setAddClient(boolean val)

    - #### setAllowAccept

          public void setAllowAccept(boolean val)

    - #### setAllowInternalSSL

          public void setAllowInternalSSL(boolean val)

    - #### setAllowReferer

          public void setAllowReferer(boolean val)

    - #### setAllowUserAgent

          public void setAllowUserAgent(boolean val)

    - #### setAltPrivKeyFile

          public void setAltPrivKeyFile(String file)

      What filename is this server tunnel's alternate private keys stored in

    - #### setBlindedPassword

          public void setBlindedPassword(String s)

    - #### setClientHost

          public void setClientHost(String host)

      I2CP host the router is on, ignored when in router context

    - #### setClientPort

          public void setClientPort(String port)

      I2CP port the router is on, ignored when in router context

    - #### setClose

          public void setClose(boolean val)

    - #### setCloseTime

          public void setCloseTime(int val)

    - #### setConnectDelay

          public void setConnectDelay(boolean val)

      Parameters:
        `val` - true to delay the connection to the target until the first client connects

    - #### setCustomOptions

          public void setCustomOptions(String customOptions)

      what I2P session overrides should be used

    - #### setDCC

          public void setDCC(boolean val)

    - #### setDelayOpen

          public void setDelayOpen(boolean val)

    - #### setDescription

          public void setDescription(String description)

      one line description

    - #### setDestination

          public void setDestination(Destination dest)

      This is easier than requiring TunnelConfig to talk to TunnelControllerGroup and TunnelController.
      Parameters:
        `dest` - the current Destination for this tunnel.

    - #### setEncrypt

          public void setEncrypt(boolean val)

    - #### setEncryptKey

          public void setEncryptKey(String val)

    - #### setEncryptMode

          public void setEncryptMode(int mode)

    - #### setEncType

          public void setEncType(String val)

      Adds to existing, comma separated

    - #### setFilterDefinition

          public void setFilterDefinition(String filterDefinition)

    - #### setInboundRandomKey

          public void setInboundRandomKey(String s)

      Random keys

    - #### setJumpList

          public void setJumpList(String val)

    - #### setLeaseSetPrivateKey

          public void setLeaseSetPrivateKey(String s)

    - #### setLeaseSetSigningPrivateKey

          public void setLeaseSetSigningPrivateKey(String s)

    - #### setLimitDay

          public void setLimitDay(int val)

    - #### setLimitHour

          public void setLimitHour(int val)

    - #### setLimitMinute

          public void setLimitMinute(int val)

    - #### setMaxStreams

          public void setMaxStreams(int val)

    - #### setMultihome

          public void setMultihome(boolean val)

    - #### setName

          public void setName(String name)

      Short name of the tunnel

    - #### setNewDest

          public void setNewDest(int mode)

      Controls how ephemeral the I2P Destination of a client tunnel is.

      If `setClose(boolean)` is set to false then mode 1 == mode 0.

      Parameters:
        `mode` - 0 for new dest on restart, 1 for new dest on resume from idle, 2 for persistent key

    - #### setOutboundRandomKey

          public void setOutboundRandomKey(String s)

    - #### setOutproxyAuth

          public void setOutproxyAuth(boolean val)

      Sets whether authentication is required for any of the configured outproxies.
      Parameters:
        `val` - true if authentication is required, false otherwise

    - #### setOutproxyPassword

          public void setOutproxyPassword(String s)

    - #### setOutproxyType

          public void setOutproxyType(String s)

      Parameters:
        `s` - "connect" or "socks"

    - #### setOutproxyUsername

          public void setOutproxyUsername(String s)

    - #### setPort

          public void setPort(int port)

      what port should this client/httpclient/ircclient listen on

    - #### setPostBanTime

          public void setPostBanTime(int val)

    - #### setPostCheckTime

          public void setPostCheckTime(int val)

    - #### setPostMax

          public void setPostMax(int val)

      POST limits

    - #### setPostTotalBanTime

          public void setPostTotalBanTime(int val)

    - #### setPostTotalMax

          public void setPostTotalMax(int val)

    - #### setPrivKeyFile

          public void setPrivKeyFile(String file)

      What filename is this server tunnel's private keys stored in

    - #### setProfile

          public void setProfile(String profile)

    - #### setProxyAuth

          public void setProxyAuth(String authType)

      Sets whether authentication should be used for client proxy tunnels. Supported authentication types: "basic", "digest".
      Parameters:
        `authType` - the authentication type, or "false" for no authentication

    - #### setProxyList

          public void setProxyList(String proxyList)

      what HTTP outproxies should be used (httpclient specific)

    - #### setProxyPassword

          public void setProxyPassword(String s)

    - #### setProxyUsername

          public void setProxyUsername(String s)

    - #### setReachableBy

          public void setReachableBy(String reachableBy)

      what interface should this client/httpclient/ircclient listen on

    - #### setReduce

          public void setReduce(boolean val)

    - #### setReduceCount

          public void setReduceCount(int val)

    - #### setReduceTime

          public void setReduceTime(int val)

    - #### setRejectInproxy

          public void setRejectInproxy(boolean val)

    - #### setRejectReferer

          public void setRejectReferer(boolean val)

    - #### setRejectUserAgents

          public void setRejectUserAgents(boolean val)

    - #### setShared

          public void setShared(boolean val)

      Parameters:
        `val` - true to share the private key with other client tunnels

    - #### setShutdownDelayMax

          public void setShutdownDelayMax(int val)

      Parameters:
        `val` - the maximum shutdown delay in seconds for server tunnels

    - #### setShutdownDelayMin

          public void setShutdownDelayMin(int val)

      Parameters:
        `val` - the minimum shutdown delay in seconds for server tunnels

    - #### setSigType

          public void setSigType(String val)

    - #### setSpoofedHost

          public void setSpoofedHost(String host)

      What host does this http server tunnel spoof

    - #### setSslProxies

          public void setSslProxies(String s)

    - #### setStartOnLoad

          public void setStartOnLoad(boolean val)

      If called with any value, we want this tunnel to start whenever it is loaded (aka right now and whenever the router is started up)

    - #### setStartupDelayMax

          public void setStartupDelayMax(int val)

      Parameters:
        `val` - the maximum startup delay in seconds for server tunnels

    - #### setStartupDelayMin

          public void setStartupDelayMin(int val)

      Parameters:
        `val` - the minimum startup delay in seconds for server tunnels

    - #### setTargetDestination

          public void setTargetDestination(String dest)

      What peer does this client tunnel point at

    - #### setTargetHost

          public void setTargetHost(String host)

      What host does this server tunnel point at

    - #### setTargetPort

          public void setTargetPort(int port)

      What port does this server tunnel point at

    - #### setTotalDay

          public void setTotalDay(int val)

    - #### setTotalHour

          public void setTotalHour(int val)

    - #### setTotalMinute

          public void setTotalMinute(int val)

    - #### setTunnelBackupQuantity

          public void setTunnelBackupQuantity(int tunnelBackupQuantity)

      how many tunnels to hold in reserve to guard against failures In or both in/out

    - #### setTunnelBackupQuantityOut

          public void setTunnelBackupQuantityOut(int tunnelBackupQuantity)

      how many tunnels to hold in reserve to guard against failures

    - #### setTunnelDepth

          public void setTunnelDepth(int tunnelDepth)

      how many hops to use for inbound tunnels In or both in/out

    - #### setTunnelDepthOut

          public void setTunnelDepthOut(int tunnelDepth)

      how many hops to use for outbound tunnels

    - #### setTunnelQuantity

          public void setTunnelQuantity(int tunnelQuantity)

      how many parallel inbound tunnels to use In or both in/out

    - #### setTunnelQuantityOut

          public void setTunnelQuantityOut(int tunnelQuantity)

      how many parallel outbound tunnels to use

    - #### setTunnelVariance

          public void setTunnelVariance(int tunnelVariance)

      how much randomisation to apply to the depth of tunnels In or both in/out

    - #### setTunnelVarianceOut

          public void setTunnelVarianceOut(int tunnelVariance)

      how much randomisation to apply to the depth of tunnels

    - #### setType

          public void setType(String type)

      What type of tunnel (httpclient, ircclient, client, or server). This is required when adding a new tunnel.

    - #### setUniqueLocal

          public void setUniqueLocal(boolean val)

    - #### setUseOutproxyPlugin

          public void setUseOutproxyPlugin(boolean val)

    - #### setUserAgents

          public void setUserAgents(String val)

    - #### setUseSSL

          public void setUseSSL(boolean val)

    - #### updateTunnelQuantities

          public void updateTunnelQuantities(Properties config)

      Update tunnel quantities for the provided config from this TunnelConfig.
      Parameters:
        `config` - the config to update.