Package net.i2p.i2ptunnel.web
Class IndexBean
- java.lang.Object
-
- net.i2p.i2ptunnel.web.IndexBean
-
-
Field Summary
Fields Modifier and Type Field Description protected I2PAppContext_contextprotected TunnelControllerGroup_groupprotected GeneralHelper_helperprotected Log_logstatic intNOT_RUNNINGstatic intRUNNINGstatic intSTANDBYstatic intSTARTING
-
Constructor Summary
Constructors Constructor Description IndexBean()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected String_t(String key)protected Stringencrypt(int tunnel, String k, String v)Encrypt a property using an in-memory key, for interaction with the UI only, using ChaCha20.StringgetAltDestHashBase32(int tunnel)Works even if tunnel is not running.protected DestinationgetAltDestination(int tunnel)Works even if tunnel is not running.StringgetAltDestinationBase64(int tunnel)Works even if tunnel is not running.StringgetClientDestination(int tunnel)StringgetClientInterface(int tunnel)StringgetClientPort(int tunnel)No validationStringgetClientPort2(int tunnel)Returns error message if blank or invalidprotected TunnelControllergetController(int tunnel)StringgetDestHashBase32(int tunnel)Works even if tunnel is not running.protected DestinationgetDestination(int tunnel)Works even if tunnel is not running.StringgetDestinationBase64(int tunnel)Works even if tunnel is not running.StringgetEncryptedBase32(int tunnel)Works even if tunnel is not running.StringgetInternalType(int tunnel)booleangetIsOfflineKeys(int tunnel)Works even if tunnel is not running.booleangetIsUsingOutproxyPlugin(int tunnel)For index.jspintgetLastMessageID()The last stored message IDStringgetMessages()Executes any action requested (start/stop/etc) and dump out the messages.static StringgetNextNonce()StringgetServerTarget(int tunnel)StringgetSharedClient(int tunnel)StringgetSpoofedHost(int tunnel)StringgetTheme()intgetTunnelCount()StringgetTunnelDescription(int tunnel)StringgetTunnelName(int tunnel)intgetTunnelStatus(int tunnel)StringgetTunnelType(int tunnel)(package private) StringgetType()StringgetTypeName(String internalType)static booleanhaveNonce(String nonce)do we know this nonce?booleanisClient(int tunnelNum)Is it a client or server in the UI and I2P side? Note that a streamr client is a UI and I2P client but a server on the localhost side.static booleanisClient(String type)Is it a client or server in the UI and I2P side? Note that a streamr client is a UI and I2P client but a server on the localhost side.booleanisInitialized()booleanisRejectInproxy(int tunnel)booleanisRejectReferer(int tunnel)booleanisRejectUserAgents(int tunnel)booleanisServerTargetLinkValid(int tunnel)Call this to see if it is ok to linkify getServerTarget()booleanisSharedClient(int tunnel)booleanisSSLEnabled(int tunnel)protected Stringngettext(String s, String p, int n)translate (ngettext)voidsetAccessList(String val)voidsetAccessMode(String val)voidsetAction(String action)voidsetAddClient(String moo)voidsetAllowAccept(String moo)voidsetAllowInternalSSL(String moo)voidsetAllowReferer(String moo)voidsetAllowUserAgent(String moo)voidsetAltPrivKeyFile(String file)What filename is this server tunnel's alternate private keys stored invoidsetCert(String val)voidsetClientHost(String host)I2CP host the router is on, ignored when in router contextvoidsetclientKey(String[] s)Multiple entries in formvoidsetClientport(String port)I2CP port the router is on, ignored when in router contextvoidsetClose(String moo)voidsetCloseTime(String val)voidsetConnectDelay(String moo)voidsetDCC(String moo)voidsetDelayOpen(String moo)voidsetEffort(String val)params needed for hashcash and dest modificationvoidsetEncrypt(String moo)voidsetEncryptKey(String val)voidsetEncryptMode(String val)voidsetEncType(String s)Adds to existing, comma separatedvoidsetFilterDefinition(String val)voidsetJumpList(String val)voidsetKey1(String s)Random keys, hidden in formsvoidsetKey2(String s)voidsetKey3(String s)voidsetKey4(String s)voidsetLimitDay(String s)voidsetLimitHour(String s)voidsetLimitMinute(String s)voidsetMaxStreams(String s)voidsetMsgid(String id)voidsetMultihome(String moo)voidsetName(String name)Short name of the tunnelvoidsetNewClientKey(String s)voidsetNewDest(String val)voidsetNofilter_blindedPassword(String s)voidsetNofilter_clientName(String[] s)Multiple entries in formvoidsetNofilter_customOptions(String customOptions)what I2P session overrides should be usedvoidsetNofilter_description(String description)one line descriptionvoidsetNofilter_newClientName(String s)voidsetNofilter_outproxyPassword(String s)voidsetNofilter_proxyPassword(String s)voidsetNonce(String nonce)voidsetOutproxyAuth(String s)voidsetOutproxyUsername(String s)voidsetPort(String port)what port should this client/httpclient/ircclient listen onvoidsetPostBanTime(String s)voidsetPostCheckTime(String s)voidsetPostMax(String s)POST limitsvoidsetPostTotalBanTime(String s)voidsetPostTotalMax(String s)voidsetPrivKeyFile(String file)What filename is this server tunnel's private keys stored invoidsetProfile(String profile)voidsetProxyAuth(String s)all proxy auth @since 0.8.2voidsetProxyList(String proxyList)what HTTP outproxies should be used (httpclient specific)voidsetProxyUsername(String s)voidsetReachableBy(String reachableBy)what interface should this client/httpclient/ircclient listen onvoidsetReduce(String moo)voidsetReduceCount(String val)voidsetReduceTime(String val)voidsetRejectInproxy(String moo)voidsetRejectReferer(String moo)voidsetRejectUserAgents(String moo)voidsetRemoveConfirm(String moo)If called with any value (and the form submitted with action=Remove), we really do want to stop and remove the tunnel.voidsetRevokeClient(String[] s)Multiple entries in form Values are integersvoidsetShared(boolean val)voidsetShared(String moo)voidsetSigner(String val)voidsetSigType(String val)voidsetSpoofedHost(String host)What host does this http server tunnel spoofvoidsetSslProxies(String s)voidsetStartOnLoad(String moo)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(String port)What port does this server tunnel point atvoidsetTotalDay(String s)voidsetTotalHour(String s)voidsetTotalMinute(String s)voidsetTunnel(String tunnel)voidsetTunnelBackupQuantity(String tunnelBackupQuantity)how many tunnels to hold in reserve to guard against failures In or both in/outvoidsetTunnelBackupQuantityOut(String tunnelBackupQuantity)how many outbound tunnels to hold in reserve to guard against failuresvoidsetTunnelDepth(String tunnelDepth)how many hops to use for inbound tunnels In or both in/outvoidsetTunnelDepthOut(String tunnelDepth)how many hops to use for outbound tunnelsvoidsetTunnelQuantity(String tunnelQuantity)how many parallel inbound tunnels to use In or both in/outvoidsetTunnelQuantityOut(String tunnelQuantity)how many parallel outbound tunnels to usevoidsetTunnelVariance(String tunnelVariance)how much randomisation to apply to the depth of tunnels In or both in/outvoidsetTunnelVarianceOut(String tunnelVariance)how much randomisation to apply to the depth of outbound tunnelsvoidsetType(String type)What type of tunnel (httpclient, ircclient, client, or server).voidsetUniqueLocal(String moo)voidsetUseOutproxyPlugin(String moo)voidsetUserAgents(String agents)voidsetUseSSL(String moo)
-
-
-
Field Detail
-
_context
protected final I2PAppContext _context
-
_log
protected final Log _log
-
_group
protected final TunnelControllerGroup _group
-
_helper
protected final GeneralHelper _helper
-
RUNNING
public static final int RUNNING
- See Also:
- Constant Field Values
-
STARTING
public static final int STARTING
- See Also:
- Constant Field Values
-
NOT_RUNNING
public static final int NOT_RUNNING
- See Also:
- Constant Field Values
-
STANDBY
public static final int STANDBY
- See Also:
- Constant Field Values
-
-
Method Detail
-
isInitialized
public boolean isInitialized()
- Since:
- 0.9.4
-
getNextNonce
public static String getNextNonce()
-
setNonce
public void setNonce(String nonce)
-
haveNonce
public static boolean haveNonce(String nonce)
do we know this nonce?- Since:
- 0.8.1 public since 0.9.35
-
setAction
public void setAction(String action)
-
setTunnel
public void setTunnel(String tunnel)
-
setMsgid
public void setMsgid(String id)
- Since:
- 0.9.33
-
getMessages
public String getMessages()
Executes any action requested (start/stop/etc) and dump out the messages. Only call this ONCE! Or you will get duplicate tunnels on save.- Returns:
- HTML escaped or "" if empty
-
getLastMessageID
public int getLastMessageID()
The last stored message ID- Since:
- 0.9.33
-
getTheme
public String getTheme()
-
getTunnelCount
public int getTunnelCount()
-
isClient
public boolean isClient(int tunnelNum)
Is it a client or server in the UI and I2P side? Note that a streamr client is a UI and I2P client but a server on the localhost side. Note that a streamr server is a UI and I2P server but a client on the localhost side.
-
isClient
public static boolean isClient(String type)
Is it a client or server in the UI and I2P side? Note that a streamr client is a UI and I2P client but a server on the localhost side. Note that a streamr server is a UI and I2P server but a client on the localhost side.
-
isSharedClient
public boolean isSharedClient(int tunnel)
- Since:
- 0.9.46 moved from subclass
-
getTunnelName
public String getTunnelName(int tunnel)
-
getClientPort
public String getClientPort(int tunnel)
No validation
-
getClientPort2
public String getClientPort2(int tunnel)
Returns error message if blank or invalid- Since:
- 0.9.3
-
getTunnelType
public String getTunnelType(int tunnel)
-
getInternalType
public String getInternalType(int tunnel)
-
getClientInterface
public String getClientInterface(int tunnel)
-
getTunnelStatus
public int getTunnelStatus(int tunnel)
-
getTunnelDescription
public String getTunnelDescription(int tunnel)
-
getSharedClient
public String getSharedClient(int tunnel)
-
getClientDestination
public String getClientDestination(int tunnel)
-
isServerTargetLinkValid
public boolean isServerTargetLinkValid(int tunnel)
Call this to see if it is ok to linkify getServerTarget()- Since:
- 0.8.3
-
getServerTarget
public String getServerTarget(int tunnel)
- Returns:
- valid host:port only if isServerTargetLinkValid() is true
-
getDestination
protected Destination getDestination(int tunnel)
Works even if tunnel is not running.- Returns:
- Destination or null
- Since:
- 0.9.17
-
getDestinationBase64
public String getDestinationBase64(int tunnel)
Works even if tunnel is not running.- Returns:
- Base64 or ""
-
getDestHashBase32
public String getDestHashBase32(int tunnel)
Works even if tunnel is not running.- Returns:
- "{52 chars}.b32.i2p" or ""
-
getEncryptedBase32
public String getEncryptedBase32(int tunnel)
Works even if tunnel is not running.- Returns:
- "{56 chars}.b32.i2p" or "" if not blinded
- Since:
- 0.9.40
-
getAltDestination
protected Destination getAltDestination(int tunnel)
Works even if tunnel is not running.- Returns:
- Destination or null
- Since:
- 0.9.30
-
getAltDestinationBase64
public String getAltDestinationBase64(int tunnel)
Works even if tunnel is not running.- Returns:
- Base64 or ""
- Since:
- 0.9.30
-
getAltDestHashBase32
public String getAltDestHashBase32(int tunnel)
Works even if tunnel is not running.- Returns:
- "{52 chars}.b32.i2p" or ""
- Since:
- 0.9.30
-
getIsOfflineKeys
public boolean getIsOfflineKeys(int tunnel)
Works even if tunnel is not running.- Returns:
- true if offline keys
- Since:
- 0.9.40
-
getIsUsingOutproxyPlugin
public boolean getIsUsingOutproxyPlugin(int tunnel)
For index.jsp- Returns:
- true if the plugin is enabled, installed, and running
- Since:
- 0.9.11
-
getSpoofedHost
public String getSpoofedHost(int tunnel)
- Since:
- 0.9.32 moved from EditBean
-
setType
public void setType(String type)
What type of tunnel (httpclient, ircclient, client, or server). This is required when adding a new tunnel.
-
getType
String getType()
-
setName
public void setName(String name)
Short name of the tunnel
-
setNofilter_description
public void setNofilter_description(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(String tunnelDepth)
how many hops to use for inbound tunnels In or both in/out
-
setTunnelQuantity
public void setTunnelQuantity(String tunnelQuantity)
how many parallel inbound tunnels to use In or both in/out
-
setTunnelVariance
public void setTunnelVariance(String tunnelVariance)
how much randomisation to apply to the depth of tunnels In or both in/out
-
setTunnelBackupQuantity
public void setTunnelBackupQuantity(String tunnelBackupQuantity)
how many tunnels to hold in reserve to guard against failures In or both in/out
-
setTunnelDepthOut
public void setTunnelDepthOut(String tunnelDepth)
how many hops to use for outbound tunnels- Since:
- 0.9.33
-
setTunnelQuantityOut
public void setTunnelQuantityOut(String tunnelQuantity)
how many parallel outbound tunnels to use- Since:
- 0.9.33
-
setTunnelVarianceOut
public void setTunnelVarianceOut(String tunnelVariance)
how much randomisation to apply to the depth of outbound tunnels- Since:
- 0.9.33
-
setTunnelBackupQuantityOut
public void setTunnelBackupQuantityOut(String tunnelBackupQuantity)
how many outbound tunnels to hold in reserve to guard against failures- Since:
- 0.9.33
-
setNofilter_customOptions
public void setNofilter_customOptions(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(String 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(String 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
-
setAltPrivKeyFile
public void setAltPrivKeyFile(String file)
What filename is this server tunnel's alternate private keys stored in- Since:
- 0.9.30
-
setRemoveConfirm
public void setRemoveConfirm(String moo)
If called with any value (and the form submitted with action=Remove), we really do want to stop and remove the tunnel.
-
setStartOnLoad
public void setStartOnLoad(String moo)
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(String moo)
-
setShared
public void setShared(boolean val)
-
setConnectDelay
public void setConnectDelay(String moo)
-
setProfile
public void setProfile(String profile)
-
setReduce
public void setReduce(String moo)
-
setClose
public void setClose(String moo)
-
setEncrypt
public void setEncrypt(String moo)
-
setEncryptMode
public void setEncryptMode(String val)
- Since:
- 0.9.40
-
setNofilter_blindedPassword
public void setNofilter_blindedPassword(String s)
- Since:
- 0.9.40
-
setNofilter_clientName
public void setNofilter_clientName(String[] s)
Multiple entries in form- Since:
- 0.9.41
-
setclientKey
public void setclientKey(String[] s)
Multiple entries in form- Since:
- 0.9.41
-
setRevokeClient
public void setRevokeClient(String[] s)
Multiple entries in form Values are integers- Since:
- 0.9.41
-
setNofilter_newClientName
public void setNofilter_newClientName(String s)
- Since:
- 0.9.41
-
setNewClientKey
public void setNewClientKey(String s)
- Since:
- 0.9.41
-
setAddClient
public void setAddClient(String moo)
- Since:
- 0.9.41
-
setDCC
public void setDCC(String moo)
- Since:
- 0.8.9
-
setUseSSL
public void setUseSSL(String moo)
- Since:
- 0.9.9
-
isSSLEnabled
public boolean isSSLEnabled(int tunnel)
- Since:
- 0.9.9
-
setRejectInproxy
public void setRejectInproxy(String moo)
- Since:
- 0.9.12
-
isRejectInproxy
public boolean isRejectInproxy(int tunnel)
- Since:
- 0.9.12
-
setRejectReferer
public void setRejectReferer(String moo)
- Since:
- 0.9.25
-
isRejectReferer
public boolean isRejectReferer(int tunnel)
- Since:
- 0.9.25
-
setRejectUserAgents
public void setRejectUserAgents(String moo)
- Since:
- 0.9.25
-
isRejectUserAgents
public boolean isRejectUserAgents(int tunnel)
- Since:
- 0.9.25
-
setUserAgents
public void setUserAgents(String agents)
- Since:
- 0.9.25
-
setUniqueLocal
public void setUniqueLocal(String moo)
- Since:
- 0.9.13
-
setAccessMode
public void setAccessMode(String val)
-
setFilterDefinition
public void setFilterDefinition(String val)
- Since:
- 0.9.40
-
setDelayOpen
public void setDelayOpen(String moo)
-
setNewDest
public void setNewDest(String val)
-
setReduceTime
public void setReduceTime(String val)
-
setReduceCount
public void setReduceCount(String val)
-
setEncryptKey
public void setEncryptKey(String val)
-
setAccessList
public void setAccessList(String val)
-
setJumpList
public void setJumpList(String val)
-
setCloseTime
public void setCloseTime(String val)
-
setAllowUserAgent
public void setAllowUserAgent(String moo)
- Since:
- 0.9.14
-
setAllowReferer
public void setAllowReferer(String moo)
- Since:
- 0.9.14
-
setAllowAccept
public void setAllowAccept(String moo)
- Since:
- 0.9.14
-
setAllowInternalSSL
public void setAllowInternalSSL(String moo)
- Since:
- 0.9.14
-
setMultihome
public void setMultihome(String moo)
- Since:
- 0.9.18
-
setProxyAuth
public void setProxyAuth(String s)
all proxy auth @since 0.8.2
-
setProxyUsername
public void setProxyUsername(String s)
-
setNofilter_proxyPassword
public void setNofilter_proxyPassword(String s)
-
setOutproxyAuth
public void setOutproxyAuth(String s)
-
setOutproxyUsername
public void setOutproxyUsername(String s)
-
setNofilter_outproxyPassword
public void setNofilter_outproxyPassword(String s)
-
setSslProxies
public void setSslProxies(String s)
- Since:
- 0.9.11
-
setUseOutproxyPlugin
public void setUseOutproxyPlugin(String moo)
- Since:
- 0.9.11
-
setLimitMinute
public void setLimitMinute(String s)
-
setLimitHour
public void setLimitHour(String s)
-
setLimitDay
public void setLimitDay(String s)
-
setTotalMinute
public void setTotalMinute(String s)
-
setTotalHour
public void setTotalHour(String s)
-
setTotalDay
public void setTotalDay(String s)
-
setMaxStreams
public void setMaxStreams(String s)
-
setPostMax
public void setPostMax(String s)
POST limits- Since:
- 0.9.9
-
setPostTotalMax
public void setPostTotalMax(String s)
-
setPostCheckTime
public void setPostCheckTime(String s)
-
setPostBanTime
public void setPostBanTime(String s)
-
setPostTotalBanTime
public void setPostTotalBanTime(String s)
-
setEffort
public void setEffort(String val)
params needed for hashcash and dest modification
-
setCert
public void setCert(String val)
-
setSigner
public void setSigner(String val)
-
setSigType
public void setSigType(String val)
- Since:
- 0.9.12
-
setEncType
public void setEncType(String s)
Adds to existing, comma separated- Since:
- 0.9.44
-
setKey1
public void setKey1(String s)
Random keys, hidden in forms- Since:
- 0.9.18
-
setKey2
public void setKey2(String s)
-
setKey3
public void setKey3(String s)
-
setKey4
public void setKey4(String s)
-
encrypt
protected String encrypt(int tunnel, String k, String v)
Encrypt a property using an in-memory key, for interaction with the UI only, using ChaCha20. IV is SHA256(k). These are transient keys by design, but are persisted to hide restarts. They are hidden inputs in the edit form. Storage in config files is not encrypted.- Parameters:
k- non-nullv- may be empty or null- Returns:
- Base64, or empty, or null
- Since:
- 0.9.46
-
getController
protected TunnelController getController(int tunnel)
-
-