public class IndexBean extends Object
Simple accessor for exposing tunnel info, but also an ugly form handler.
Warning - This class is not part of the i2ptunnel API, it has been moved from the jar to the war. Usage by classes outside of i2ptunnel.war is deprecated.
| Modifier and Type | Field and Description |
|---|---|
protected I2PAppContext | _context |
protected TunnelControllerGroup | _group |
protected GeneralHelper | _helper |
protected Log | _log |
static int | NOT_RUNNINGTunnel status: not running. |
static int | RUNNINGTunnel status: running. |
static int | STANDBYTunnel status: standby. |
static int | STARTINGTunnel status: starting. |
| Constructor and Description |
|---|
IndexBean()Create the IndexBean, initializing the tunnel controller group and helper. |
| Modifier and Type | Method and Description |
|---|---|
protected String | _t(String key) |
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. |
String | getAltDestHashBase32(int tunnel)Works even if tunnel is not running. |
protected Destination | getAltDestination(int tunnel)Works even if tunnel is not running. |
String | getAltDestinationBase64(int tunnel)Works even if tunnel is not running. |
String | getClientDestination(int tunnel)The destination Base64 for the specified client tunnel. |
String | getClientInterface(int tunnel)The interface the specified client tunnel is configured to listen on. |
String | getClientPort(int tunnel)No validation |
String | getClientPort2(int tunnel)Returns error message if blank or invalid |
protected TunnelController | getController(int tunnel) |
List<Integer> | getControllerNumbers(boolean isClient)Return tunnel numbers of clients or servers only, sorted by tunnel name |
String | getDestHashBase32(int tunnel)Works even if tunnel is not running. |
protected Destination | getDestination(int tunnel)Works even if tunnel is not running. |
String | getDestinationBase64(int tunnel)Works even if tunnel is not running. |
String | getEncryptedBase32(int tunnel)Works even if tunnel is not running. |
String | getInternalType(int tunnel)The internal type string for the specified tunnel. |
boolean | getIsOfflineKeys(int tunnel)Works even if tunnel is not running. |
boolean | getIsUsingOutproxyPlugin(int tunnel)For index.jsp |
int | getLastMessageID()The last stored message ID |
String | getMessages()Executes any action requested (start/stop/etc) and dump out the messages. |
static String | getNextNonce()Get the next nonce from the queue. |
static String | getNextNonce(HttpSession session)Session-bound nonce generation - replaces static nonce when session available |
int | getRemainingStartupDelay(int tunnel)The remaining startup delay for the specified tunnel. |
String | getServerTarget(int tunnel)Get the server target. |
String | getSharedClient(int tunnel)Get the shared client for a tunnel. |
String | getSpoofedHost(int tunnel)Get the spoofed host for a tunnel. |
String | getTheme()Get the theme path. |
String | getThemeName()Get the theme name. |
int | getTunnelCount()Get the number of tunnels. |
String | getTunnelDescription(int tunnel)The description for the specified tunnel, HTML-escaped. |
String | getTunnelName(int tunnel)Get the tunnel name. |
int | getTunnelStatus(int tunnel)The current status of the specified tunnel. |
String | getTunnelType(int tunnel)Get the tunnel type. |
(package private) String | getType()The tunnel type. |
String | getTypeName(String internalType)Get the display name for an internal type. |
static boolean | haveNonce(String nonce)do we know this nonce? |
static boolean | haveNonce(String nonce,
HttpSession session)Session-bound nonce validation |
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. |
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. |
boolean | isInitialized()Check if the tunnel group is initialized. |
boolean | isRejectInproxy(int tunnel) |
boolean | isRejectReferer(int tunnel) |
boolean | isRejectUserAgents(int tunnel) |
boolean | isServer(int tunnel)Is this a server tunnel? |
boolean | isServerTargetLinkValid(int tunnel)Call this to see if it is ok to linkify getServerTarget() |
boolean | isSharedClient(int tunnel)Check if the tunnel is a shared client. |
boolean | isSSLEnabled(int tunnel) |
boolean | isValidIRCServer(int tunnel)Is this an IRC server? Call to establish if we should provide irc://
link on index page |
protected String | ngettext(String s,
String p,
int n)translate (ngettext) |
void | setAccessList(String val) |
void | setAccessMode(String val) |
void | setAction(String action)Set the action to process. |
void | setAddClient(String moo) |
void | setAllowAccept(String moo) |
void | setAllowInternalSSL(String moo) |
void | setAllowReferer(String moo) |
void | setAllowUserAgent(String moo) |
void | setAltPrivKeyFile(String file)What filename is this server tunnel's alternate private keys stored in |
void | setCert(String val) |
void | setClientHost(String host)I2CP host the router is on, ignored when in router context |
void | setclientKey(String[] s)Set client keys for access control (multiple entries in form). |
void | setClientport(String port)I2CP port the router is on, ignored when in router context |
void | setClose(String moo) |
void | setCloseTime(String val) |
void | setConnectDelay(String moo) |
void | setDCC(String moo) |
void | setDelayOpen(String moo) |
void | setEncrypt(String moo) |
void | setEncryptKey(String val) |
void | setEncryptMode(String val)Set the LeaseSet encryption mode. |
void | setEncType(String s)Adds to existing, comma separated |
void | setFilterDefinition(String val) |
void | setJumpList(String val) |
void | setKey1(String s)Random keys, hidden in forms |
void | setKey2(String s) |
void | setKey3(String s) |
void | setKey4(String s) |
void | setLimitDay(String s) |
void | setLimitHour(String s) |
void | setLimitMinute(String s) |
void | setMaxStreams(String s) |
void | setMsgid(String id)Set the message ID for clearing messages. |
void | setMultihome(String moo) |
void | setNewClientKey(String s) |
void | setNewDest(String val) |
void | setNofilter_blindedPassword(String s)Set the blinded password for hidden encrypted LeaseSets. |
void | setNofilter_clientName(String[] s)Set client names for access control (multiple entries in form). |
void | setNofilter_customOptions(String customOptions)what I2P session overrides should be used |
void | setNofilter_description(String description)One line host description |
void | setNofilter_name(String name)Short name of the tunnel |
void | setNofilter_newClientName(String s) |
void | setNofilter_outproxyPassword(String s) |
void | setNofilter_proxyPassword(String s) |
void | setNonce(String nonce)Set the current nonce. |
void | setOutproxyAuth(String s) |
void | setOutproxyType(String s) |
void | setOutproxyUsername(String s) |
void | setPort(String port)what port should this client/httpclient/ircclient listen on |
void | setPostBanTime(String s) |
void | setPostCheckTime(String s) |
void | setPostMax(String s)POST limits |
void | setPostTotalBanTime(String s) |
void | setPostTotalMax(String s) |
void | setPrivKeyFile(String file)What filename is this server tunnel's private keys stored in |
void | setProfile(String profile) |
void | setProxyAuth(String s)all proxy auth @since 0.8.2 |
void | setProxyList(String proxyList)what HTTP outproxies should be used (httpclient specific) |
void | setProxyUsername(String s) |
void | setReachableBy(String reachableBy)what interface should this client/httpclient/ircclient listen on |
void | setReduce(String moo) |
void | setReduceCount(String val) |
void | setReduceTime(String val) |
void | setRejectInproxy(String moo) |
void | setRejectReferer(String moo) |
void | setRejectUserAgents(String moo) |
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. |
void | setRevokeClient(String[] s)Revoke access for specified clients (multiple entries in form, values are integers). |
void | setSession(HttpSession session)For session-bound nonce generation and validation |
void | setShared(boolean val) |
void | setShared(String moo) |
void | setShutdownDelayMax(String val) |
void | setShutdownDelayMin(String val) |
void | setSigner(String val) |
void | setSigType(String val) |
void | setSpoofedHost(String host)What host does this http server tunnel spoof |
void | setSslProxies(String s) |
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) |
void | setStartupDelayMax(String val) |
void | setStartupDelayMin(String 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(String port)What port does this server tunnel point at |
void | setTotalDay(String s) |
void | setTotalHour(String s) |
void | setTotalMinute(String s) |
void | setTunnel(String tunnel)Set the tunnel number. |
void | setTunnelBackupQuantity(String tunnelBackupQuantity)How many tunnels to hold in reserve to guard against failures
In or both in/out |
void | setTunnelBackupQuantityOut(String tunnelBackupQuantity)How many outbound tunnels to hold in reserve to guard against failures |
void | setTunnelDepth(String tunnelDepth)How many hops to use for inbound tunnels
In or both in/out |
void | setTunnelDepthOut(String tunnelDepth)How many hops to use for outbound tunnels |
void | setTunnelQuantity(String tunnelQuantity)How many parallel inbound tunnels to use
In or both in/out |
void | setTunnelQuantityOut(String tunnelQuantity)How many parallel outbound tunnels to use |
void | setTunnelVariance(String tunnelVariance)How much randomisation to apply to the depth of tunnels
In or both in/out |
void | setTunnelVarianceOut(String tunnelVariance)How much randomisation to apply to the depth of outbound tunnels |
void | setType(String type)What type of tunnel (httpclient, ircclient, client, or server). |
void | setUniqueLocal(String moo) |
void | setUseOutproxyPlugin(String moo) |
void | setUserAgents(String agents) |
void | setUseSSL(String moo) |
void | storeMethod(String method)Store request method for P-R-G pattern |
boolean | useSoraFont()Check if the Sora font is enabled. |
protected final I2PAppContext _context
protected final TunnelControllerGroup _group
protected final GeneralHelper _helper
protected final Log _log
public static final int NOT_RUNNING
public static final int RUNNING
public static final int STANDBY
public static final int STARTING
public IndexBean()
protected String encrypt(int tunnel, String k, String v)
k - non-nullv - may be empty or nullpublic String getAltDestHashBase32(int tunnel)
tunnel - the tunnelprotected Destination getAltDestination(int tunnel)
tunnel - the tunnelpublic String getAltDestinationBase64(int tunnel)
tunnel - the tunnelpublic String getClientDestination(int tunnel)
tunnel - the tunnelpublic String getClientInterface(int tunnel)
tunnel - the tunnelpublic String getClientPort(int tunnel)
tunnel - the tunnelpublic String getClientPort2(int tunnel)
tunnel - the tunnelprotected TunnelController getController(int tunnel)
public List<Integer> getControllerNumbers(boolean isClient)
isClient - true for clients, false for serverspublic String getDestHashBase32(int tunnel)
tunnel - the tunnelprotected Destination getDestination(int tunnel)
tunnel - the tunnelpublic String getDestinationBase64(int tunnel)
tunnel - the tunnelpublic String getEncryptedBase32(int tunnel)
tunnel - the tunnelpublic String getInternalType(int tunnel)
tunnel - the tunnelpublic boolean getIsOfflineKeys(int tunnel)
tunnel - the tunnelpublic boolean getIsUsingOutproxyPlugin(int tunnel)
tunnel - the tunnelpublic int getLastMessageID()
public String getMessages()
public static String getNextNonce()
public static String getNextNonce(HttpSession session)
session - returns static nonce if nullpublic int getRemainingStartupDelay(int tunnel)
tunnel - the tunnelpublic String getServerTarget(int tunnel)
tunnel - the tunnelpublic String getSharedClient(int tunnel)
tunnel - the tunnelpublic String getSpoofedHost(int tunnel)
tunnel - the tunnelpublic String getTheme()
public String getThemeName()
public int getTunnelCount()
public String getTunnelDescription(int tunnel)
tunnel - the tunnelpublic String getTunnelName(int tunnel)
tunnel - the tunnelpublic int getTunnelStatus(int tunnel)
tunnel - the tunnelpublic String getTunnelType(int tunnel)
tunnel - the tunnelString getType()
public String getTypeName(String internalType)
internalType - the internal typepublic static boolean haveNonce(String nonce)
nonce - the nonce to checkpublic static boolean haveNonce(String nonce, HttpSession session)
nonce - returns false if nullsession - returns static nonce check if nullpublic boolean isClient(int tunnelNum)
tunnelNum - the tunnel numberpublic static boolean isClient(String type)
type - the tunnel typepublic boolean isInitialized()
public boolean isRejectInproxy(int tunnel)
public boolean isRejectReferer(int tunnel)
public boolean isRejectUserAgents(int tunnel)
public boolean isServer(int tunnel)
tunnel - the tunnelpublic boolean isServerTargetLinkValid(int tunnel)
tunnel - the tunnelpublic boolean isSharedClient(int tunnel)
tunnel - the tunnelpublic boolean isSSLEnabled(int tunnel)
public boolean isValidIRCServer(int tunnel)
tunnel - the tunnelpublic void setAccessList(String val)
public void setAccessMode(String val)
public void setAction(String action)
action - the action stringpublic void setAddClient(String moo)
public void setAllowAccept(String moo)
public void setAllowInternalSSL(String moo)
public void setAllowReferer(String moo)
public void setAllowUserAgent(String moo)
public void setAltPrivKeyFile(String file)
public void setCert(String val)
public void setClientHost(String host)
host - the client hostpublic void setclientKey(String[] s)
s - the client keyspublic void setClientport(String port)
port - the client portpublic void setClose(String moo)
public void setCloseTime(String val)
public void setConnectDelay(String moo)
public void setDCC(String moo)
public void setDelayOpen(String moo)
public void setEncrypt(String moo)
public void setEncryptKey(String val)
public void setEncryptMode(String val)
val - the encryption mode valuepublic void setEncType(String s)
public void setFilterDefinition(String val)
public void setJumpList(String val)
public void setKey1(String s)
public void setKey2(String s)
public void setKey3(String s)
public void setKey4(String s)
public void setLimitDay(String s)
public void setLimitHour(String s)
public void setLimitMinute(String s)
public void setMaxStreams(String s)
public void setMsgid(String id)
id - the message IDpublic void setMultihome(String moo)
public void setNewClientKey(String s)
public void setNewDest(String val)
public void setNofilter_blindedPassword(String s)
s - the blinded passwordpublic void setNofilter_clientName(String[] s)
s - the client namespublic void setNofilter_customOptions(String customOptions)
customOptions - the custom optionspublic void setNofilter_description(String description)
description - the tunnel descriptionpublic void setNofilter_name(String name)
name - the tunnel namepublic void setNofilter_newClientName(String s)
public void setNofilter_outproxyPassword(String s)
public void setNofilter_proxyPassword(String s)
public void setNonce(String nonce)
nonce - the nonce valuepublic void setOutproxyAuth(String s)
public void setOutproxyType(String s)
s - "connect" or "socks"public void setOutproxyUsername(String s)
public void setPort(String port)
port - the port numberpublic void setPostBanTime(String s)
public void setPostCheckTime(String s)
public void setPostMax(String s)
public void setPostTotalBanTime(String s)
public void setPostTotalMax(String s)
public void setPrivKeyFile(String file)
public void setProfile(String profile)
public void setProxyAuth(String s)
public void setProxyList(String proxyList)
proxyList - the proxy listpublic void setProxyUsername(String s)
public void setReachableBy(String reachableBy)
reachableBy - the reachable interfacepublic void setReduce(String moo)
public void setReduceCount(String val)
public void setReduceTime(String val)
public void setRejectInproxy(String moo)
public void setRejectReferer(String moo)
public void setRejectUserAgents(String moo)
public void setRemoveConfirm(String moo)
public void setRevokeClient(String[] s)
s - the client indices to revokepublic void setSession(HttpSession session)
session - the HTTP sessionpublic void setShared(boolean val)
val - true to share the private key with other client tunnelspublic void setShared(String moo)
moo - any value triggers shared private key modepublic void setShutdownDelayMax(String val)
val - the maximum shutdown delay in seconds for server tunnelspublic void setShutdownDelayMin(String val)
val - the minimum shutdown delay in seconds for server tunnelspublic void setSigner(String val)
public void setSigType(String val)
public void setSpoofedHost(String host)
host - the spoofed hostpublic void setSslProxies(String s)
public void setStartOnLoad(String moo)
moo - any value triggers startup on loadpublic void setStartupDelayMax(String val)
val - the maximum startup delay in seconds for server tunnelspublic void setStartupDelayMin(String val)
val - the minimum startup delay in seconds for server tunnelspublic void setTargetDestination(String dest)
dest - the target destinationpublic void setTargetHost(String host)
host - the target hostpublic void setTargetPort(String port)
port - the target portpublic void setTotalDay(String s)
public void setTotalHour(String s)
public void setTotalMinute(String s)
public void setTunnel(String tunnel)
tunnel - the tunnelpublic void setTunnelBackupQuantity(String tunnelBackupQuantity)
tunnelBackupQuantity - the backup quantitypublic void setTunnelBackupQuantityOut(String tunnelBackupQuantity)
tunnelBackupQuantity - the outbound backup quantitypublic void setTunnelDepth(String tunnelDepth)
tunnelDepth - the tunnel depthpublic void setTunnelDepthOut(String tunnelDepth)
tunnelDepth - the outbound tunnel depthpublic void setTunnelQuantity(String tunnelQuantity)
tunnelQuantity - the tunnel quantitypublic void setTunnelQuantityOut(String tunnelQuantity)
tunnelQuantity - the outbound tunnel quantitypublic void setTunnelVariance(String tunnelVariance)
tunnelVariance - the tunnel variancepublic void setTunnelVarianceOut(String tunnelVariance)
tunnelVariance - the outbound tunnel variancepublic void setType(String type)
type - the tunnel typepublic void setUniqueLocal(String moo)
public void setUseOutproxyPlugin(String moo)
public void setUserAgents(String agents)
public void setUseSSL(String moo)
public void storeMethod(String method)
method - the request methodpublic boolean useSoraFont()