Package 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.- Since:
- 0.9.19 logic moved from IndexBean
-
-
Field Summary
Fields Modifier and Type Field Description protected I2PAppContext_context(package private) static Set<String>_nonProxyNoShowSet(package private) static Set<String>_noShowSetprotected static StringPROP_ENABLE_ACCESS_LISTprotected static StringPROP_ENABLE_BLACKLISTstatic StringPROP_MAX_CONNS_DAYstatic StringPROP_MAX_CONNS_HOURstatic StringPROP_MAX_CONNS_MINall of these are @since 0.8.3 (moved from IndexBean)static StringPROP_MAX_STREAMSstatic StringPROP_MAX_TOTAL_CONNS_DAYstatic StringPROP_MAX_TOTAL_CONNS_HOURstatic StringPROP_MAX_TOTAL_CONNS_MINstatic StringSHARED_CLIENT_NICKNAME
-
Constructor Summary
Constructors Constructor Description TunnelConfig()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddClientKeys(String[] s)Multiple entries in form Handles either order addClientName/addClientKeyvoidaddClientNames(String[] s)Multiple entries in formPropertiesgetConfig()Based on all provided data, create a set of configuration parameters suitable for use in a TunnelController.StringgetPrivKeyFile()StringgetType()voidnewClientKey(String s)Handles either order newClientName/newClientKeyvoidnewClientName(String s)Handles either order newClientName/newClientKeyvoidrevokeClients(String[] s)Multiple entries in formvoidsetAccessList(String val)voidsetAccessMode(int mode)Controls how other tunnels are checked for access.voidsetAddClient(boolean val)voidsetAllowAccept(boolean val)voidsetAllowInternalSSL(boolean val)voidsetAllowReferer(boolean val)voidsetAllowUserAgent(boolean val)voidsetAltPrivKeyFile(String file)What filename is this server tunnel's alternate private keys stored invoidsetBlindedPassword(String s)voidsetClientHost(String host)I2CP host the router is on, ignored when in router contextvoidsetClientPort(String port)I2CP port the router is on, ignored when in router contextvoidsetClose(boolean val)voidsetCloseTime(int val)voidsetConnectDelay(boolean val)voidsetCustomOptions(String customOptions)what I2P session overrides should be usedvoidsetDCC(boolean val)voidsetDelayOpen(boolean val)voidsetDescription(String description)one line descriptionvoidsetDestination(Destination dest)This is easier than requiring TunnelConfig to talk to TunnelControllerGroup and TunnelController.voidsetEncrypt(boolean val)voidsetEncryptKey(String val)voidsetEncryptMode(int mode)voidsetEncType(String val)Adds to existing, comma separatedvoidsetFilterDefinition(String filterDefinition)voidsetInboundRandomKey(String s)Random keysvoidsetJumpList(String val)voidsetLeaseSetPrivateKey(String s)voidsetLeaseSetSigningPrivateKey(String s)voidsetLimitDay(int val)voidsetLimitHour(int val)voidsetLimitMinute(int val)voidsetMaxStreams(int val)voidsetMultihome(boolean val)voidsetName(String name)Short name of the tunnelvoidsetNewDest(int mode)Controls how ephemeral the I2P Destination of a client tunnel is.voidsetOutboundRandomKey(String s)voidsetOutproxyAuth(boolean val)Sets whether authentication is required for any of the configured outproxies.voidsetOutproxyPassword(String s)voidsetOutproxyUsername(String s)voidsetPort(int port)what port should this client/httpclient/ircclient listen onvoidsetPostBanTime(int val)voidsetPostCheckTime(int val)voidsetPostMax(int val)POST limitsvoidsetPostTotalBanTime(int val)voidsetPostTotalMax(int val)voidsetPrivKeyFile(String file)What filename is this server tunnel's private keys stored invoidsetProfile(String profile)voidsetProxyAuth(String authType)Sets whether authentication should be used for client proxy tunnels.voidsetProxyList(String proxyList)what HTTP outproxies should be used (httpclient specific)voidsetProxyPassword(String s)voidsetProxyUsername(String s)voidsetReachableBy(String reachableBy)what interface should this client/httpclient/ircclient listen onvoidsetReduce(boolean val)voidsetReduceCount(int val)voidsetReduceTime(int val)voidsetRejectInproxy(boolean val)voidsetRejectReferer(boolean val)voidsetRejectUserAgents(boolean val)voidsetShared(boolean val)voidsetSigType(String val)voidsetSpoofedHost(String host)What host does this http server tunnel spoofvoidsetSslProxies(String s)voidsetStartOnLoad(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)voidsetTargetDestination(String dest)What peer does this client tunnel point atvoidsetTargetHost(String host)What host does this server tunnel point atvoidsetTargetPort(int port)What port does this server tunnel point atvoidsetTotalDay(int val)voidsetTotalHour(int val)voidsetTotalMinute(int val)voidsetTunnelBackupQuantity(int tunnelBackupQuantity)how many tunnels to hold in reserve to guard against failures In or both in/outvoidsetTunnelBackupQuantityOut(int tunnelBackupQuantity)how many tunnels to hold in reserve to guard against failuresvoidsetTunnelDepth(int tunnelDepth)how many hops to use for inbound tunnels In or both in/outvoidsetTunnelDepthOut(int tunnelDepth)how many hops to use for outbound tunnelsvoidsetTunnelQuantity(int tunnelQuantity)how many parallel inbound tunnels to use In or both in/outvoidsetTunnelQuantityOut(int tunnelQuantity)how many parallel outbound tunnels to usevoidsetTunnelVariance(int tunnelVariance)how much randomisation to apply to the depth of tunnels In or both in/outvoidsetTunnelVarianceOut(int tunnelVariance)how much randomisation to apply to the depth of tunnelsvoidsetType(String type)What type of tunnel (httpclient, ircclient, client, or server).voidsetUniqueLocal(boolean val)voidsetUseOutproxyPlugin(boolean val)voidsetUserAgents(String val)voidsetUseSSL(boolean val)voidupdateTunnelQuantities(Properties config)Update tunnel quantities for the provided config from this TunnelConfig.
-
-
-
Field Detail
-
SHARED_CLIENT_NICKNAME
public static final String SHARED_CLIENT_NICKNAME
- See Also:
- Constant Field Values
-
_context
protected final I2PAppContext _context
-
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_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_CONNS_HOUR
public static final String PROP_MAX_CONNS_HOUR
- See Also:
- Constant Field Values
-
PROP_MAX_CONNS_DAY
public static final String PROP_MAX_CONNS_DAY
- See Also:
- Constant Field Values
-
PROP_MAX_TOTAL_CONNS_MIN
public static final String PROP_MAX_TOTAL_CONNS_MIN
- 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_DAY
public static final String PROP_MAX_TOTAL_CONNS_DAY
- See Also:
- Constant Field Values
-
PROP_MAX_STREAMS
public static final String PROP_MAX_STREAMS
- See Also:
- Constant Field Values
-
-
Method Detail
-
setType
public void setType(String type)
What type of tunnel (httpclient, ircclient, client, or server). This is required when adding a new tunnel.
-
getType
public String getType()
-
setName
public void setName(String name)
Short name of the tunnel
-
setDescription
public void setDescription(String description)
one line description
-
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
-
setTunnelDepth
public void setTunnelDepth(int tunnelDepth)
how many hops to use for inbound tunnels In or both in/out
-
setTunnelQuantity
public void setTunnelQuantity(int tunnelQuantity)
how many parallel inbound tunnels to use In or both in/out
-
setTunnelVariance
public void setTunnelVariance(int tunnelVariance)
how much randomisation to apply to the depth of tunnels In or both in/out
-
setTunnelBackupQuantity
public void setTunnelBackupQuantity(int tunnelBackupQuantity)
how many tunnels to hold in reserve to guard against failures In or both in/out
-
setTunnelDepthOut
public void setTunnelDepthOut(int tunnelDepth)
how many hops to use for outbound tunnels- Since:
- 0.9.33
-
setTunnelQuantityOut
public void setTunnelQuantityOut(int tunnelQuantity)
how many parallel outbound tunnels to use- Since:
- 0.9.33
-
setTunnelVarianceOut
public void setTunnelVarianceOut(int tunnelVariance)
how much randomisation to apply to the depth of tunnels- Since:
- 0.9.33
-
setTunnelBackupQuantityOut
public void setTunnelBackupQuantityOut(int tunnelBackupQuantity)
how many tunnels to hold in reserve to guard against failures- Since:
- 0.9.33
-
setCustomOptions
public void setCustomOptions(String customOptions)
what I2P session overrides should be used
-
setProxyList
public void setProxyList(String proxyList)
what HTTP outproxies should be used (httpclient specific)
-
setPort
public void setPort(int port)
what port should this client/httpclient/ircclient listen on
-
setReachableBy
public void setReachableBy(String reachableBy)
what interface should this client/httpclient/ircclient listen on
-
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
-
setSpoofedHost
public void setSpoofedHost(String host)
What host does this http server tunnel spoof
-
setPrivKeyFile
public void setPrivKeyFile(String file)
What filename is this server tunnel's private keys stored in
-
getPrivKeyFile
public String getPrivKeyFile()
-
setAltPrivKeyFile
public void setAltPrivKeyFile(String file)
What filename is this server tunnel's alternate private keys stored in- Since:
- 0.9.30
-
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)
-
setShared
public void setShared(boolean val)
-
setConnectDelay
public void setConnectDelay(boolean val)
-
setProfile
public void setProfile(String profile)
-
setReduce
public void setReduce(boolean val)
-
setClose
public void setClose(boolean val)
-
setEncrypt
public void setEncrypt(boolean val)
-
setEncryptMode
public void setEncryptMode(int mode)
- Since:
- 0.9.40
-
setBlindedPassword
public void setBlindedPassword(String s)
- Since:
- 0.9.40
-
addClientNames
public void addClientNames(String[] s)
Multiple entries in form- Since:
- 0.9.41
-
addClientKeys
public void addClientKeys(String[] s)
Multiple entries in form Handles either order addClientName/addClientKey- Since:
- 0.9.41
-
revokeClients
public void revokeClients(String[] s)
Multiple entries in form- Since:
- 0.9.41
-
newClientName
public void newClientName(String s)
Handles either order newClientName/newClientKey- Since:
- 0.9.41
-
newClientKey
public void newClientKey(String s)
Handles either order newClientName/newClientKey- Since:
- 0.9.41
-
setAddClient
public void setAddClient(boolean val)
- Since:
- 0.9.41
-
setDCC
public void setDCC(boolean val)
-
setUseSSL
public void setUseSSL(boolean val)
-
setRejectInproxy
public void setRejectInproxy(boolean val)
-
setRejectReferer
public void setRejectReferer(boolean val)
- Since:
- 0.9.25
-
setRejectUserAgents
public void setRejectUserAgents(boolean val)
- Since:
- 0.9.25
-
setUserAgents
public void setUserAgents(String val)
- Since:
- 0.9.25
-
setUniqueLocal
public void setUniqueLocal(boolean 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
-
setFilterDefinition
public void setFilterDefinition(String filterDefinition)
- Since:
- 0.9.40
-
setDelayOpen
public void setDelayOpen(boolean val)
-
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
-
setReduceTime
public void setReduceTime(int val)
-
setReduceCount
public void setReduceCount(int val)
-
setEncryptKey
public void setEncryptKey(String val)
-
setAccessList
public void setAccessList(String val)
-
setJumpList
public void setJumpList(String val)
-
setCloseTime
public void setCloseTime(int val)
-
setAllowUserAgent
public void setAllowUserAgent(boolean val)
-
setAllowReferer
public void setAllowReferer(boolean val)
-
setAllowAccept
public void setAllowAccept(boolean val)
-
setAllowInternalSSL
public void setAllowInternalSSL(boolean val)
-
setMultihome
public void setMultihome(boolean val)
-
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
-
setProxyUsername
public void setProxyUsername(String s)
-
setProxyPassword
public void setProxyPassword(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
-
setOutproxyUsername
public void setOutproxyUsername(String s)
-
setOutproxyPassword
public void setOutproxyPassword(String s)
-
setSslProxies
public void setSslProxies(String s)
-
setUseOutproxyPlugin
public void setUseOutproxyPlugin(boolean val)
-
setLimitMinute
public void setLimitMinute(int val)
-
setLimitHour
public void setLimitHour(int val)
-
setLimitDay
public void setLimitDay(int val)
-
setTotalMinute
public void setTotalMinute(int val)
-
setTotalHour
public void setTotalHour(int val)
-
setTotalDay
public void setTotalDay(int val)
-
setMaxStreams
public void setMaxStreams(int val)
-
setPostMax
public void setPostMax(int val)
POST limits
-
setPostTotalMax
public void setPostTotalMax(int val)
-
setPostCheckTime
public void setPostCheckTime(int val)
-
setPostBanTime
public void setPostBanTime(int val)
-
setPostTotalBanTime
public void setPostTotalBanTime(int val)
-
setSigType
public void setSigType(String val)
-
setEncType
public void setEncType(String val)
Adds to existing, comma separated- Since:
- 0.9.44
-
setInboundRandomKey
public void setInboundRandomKey(String s)
Random keys
-
setOutboundRandomKey
public void setOutboundRandomKey(String s)
-
setLeaseSetSigningPrivateKey
public void setLeaseSetSigningPrivateKey(String s)
-
setLeaseSetPrivateKey
public void setLeaseSetPrivateKey(String s)
-
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.
-
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.
-
updateTunnelQuantities
public void updateTunnelQuantities(Properties config)
Update tunnel quantities for the provided config from this TunnelConfig.- Parameters:
config- the config to update.
-
-