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)The controller for the given tunnel index. |
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)Whether 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)Comma-separated list of destinations to whitelist or blacklist. |
void | setAccessMode(String val)Set the access mode, 0 for none, 1 for whitelist, 2 for blacklist. |
void | setAction(String action)Set the action to process. |
void | setAddClient(String val) |
void | setAllowAccept(String val)Allow the Accept header to pass through the HTTP client. |
void | setAllowInternalSSL(String val)Allow SSL connections through the HTTP client. |
void | setAllowReferer(String val)Allow the Referer header to pass through the HTTP client. |
void | setAllowUserAgent(String val)Allow the User-Agent header to pass through the HTTP client. |
void | setAltPrivKeyFile(String file)What filename is this server tunnel's alternate private keys stored in |
void | setCert(String val)Set the certificate type, from the form selection. |
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 val)Close connections when idle. |
void | setCloseTime(String val)Idle time in minutes before closing connections. |
void | setConnectDelay(String val)Delay the connection to the target until the first client connects. |
void | setDCC(String val) |
void | setDelayOpen(String val)Delay opening to the target until the first client connects. |
void | setEncrypt(String val)Encrypt the lease set. |
void | setEncryptKey(String val)Key for encrypting the lease set. |
void | setEncryptMode(String val)Set the LeaseSet encryption mode. |
void | setEncType(String s)Adds to existing, comma separated |
void | setFilterDefinition(String val)Set the filter definition. |
void | setJumpList(String val)Comma-separated list of HTTP outproxy jump servers. |
void | setKey1(String s)Random keys, hidden in forms |
void | setKey2(String s)Random outbound key, hidden in forms. |
void | setKey3(String s)Lease set signing private key, hidden in forms. |
void | setKey4(String s)Lease set private key, hidden in forms. |
void | setLimitDay(String s)Maximum total number of connections per day. |
void | setLimitHour(String s)Maximum total number of connections per hour. |
void | setLimitMinute(String s)Maximum total number of connections per minute. |
void | setMaxStreams(String s)Maximum number of concurrent streams. |
void | setMsgid(String id)Set the message ID for clearing messages. |
void | setMultihome(String val)Bundle reply info for multihoming. |
void | setNewClientKey(String s) |
void | setNewDest(String val)Control how ephemeral the destination is. |
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)Password for outproxy authentication. |
void | setNofilter_proxyPassword(String s)Password for client proxy authentication. |
void | setNonce(String nonce)Set the current nonce. |
void | setOutproxyAuth(String s)Require authentication for the outproxies. |
void | setOutproxyType(String s)Set the type of the outproxy. |
void | setOutproxyUsername(String s)Username for outproxy authentication. |
void | setPort(String port)what port should this client/httpclient/ircclient listen on |
void | setPostBanTime(String s)How long to ban a client that exceeds the POST limits, in minutes. |
void | setPostCheckTime(String s)How often the total POST limit is checked, in minutes. |
void | setPostMax(String s)Maximum total size of POST requests. |
void | setPostTotalBanTime(String s)How long to ban a client that exceeds the total POST limit, in minutes. |
void | setPostTotalMax(String s)Maximum total size of all POST requests in the check interval. |
void | setPrivKeyFile(String file)What filename is this server tunnel's private keys stored in |
void | setProfile(String profile)Set the streaming profile. |
void | setProxyAuth(String s)Set the proxy authentication type. |
void | setProxyList(String proxyList)what HTTP outproxies should be used (httpclient specific) |
void | setProxyUsername(String s)Username for client proxy authentication. |
void | setReachableBy(String reachableBy)what interface should this client/httpclient/ircclient listen on |
void | setReduce(String val)Reduce the number of connections when idle. |
void | setReduceCount(String val)Number of connections to reduce to when idle. |
void | setReduceTime(String val)Idle time in minutes before reducing connections. |
void | setRejectInproxy(String val) |
void | setRejectReferer(String val) |
void | setRejectUserAgents(String val) |
void | setRemoveConfirm(String val)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)Share the private key with other client tunnels. |
void | setShared(String val)Share the private key with other client tunnels. |
void | setShutdownDelayMax(String val)The maximum shutdown delay in seconds for server tunnels. |
void | setShutdownDelayMin(String val)The minimum shutdown delay in seconds for server tunnels. |
void | setSigner(String val)Set the certificate signer. |
void | setSigType(String val) |
void | setSpoofedHost(String host)What host does this http server tunnel spoof |
void | setSslProxies(String s)Comma-separated list of SSL-capable outproxies. |
void | setStartOnLoad(String 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(String val)The maximum startup delay in seconds for server tunnels. |
void | setStartupDelayMin(String val)The minimum startup delay in seconds for server tunnels. |
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)Maximum total number of connections per day, enforced by the total limit. |
void | setTotalHour(String s)Maximum total number of connections per hour, enforced by the total limit. |
void | setTotalMinute(String s)Maximum total number of connections per minute, enforced by the total limit. |
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 val) |
void | setUseOutproxyPlugin(String val)Use the outproxy plugin for HTTP requests. |
void | setUserAgents(String agents) |
void | setUseSSL(String val) |
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 val)
public void setAllowAccept(String val)
public void setAllowInternalSSL(String val)
public void setAllowReferer(String val)
public void setAllowUserAgent(String val)
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 val)
public void setCloseTime(String val)
public void setConnectDelay(String val)
public void setDCC(String val)
public void setDelayOpen(String val)
public void setEncrypt(String val)
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 val)
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 val)
public void setReduceCount(String val)
public void setReduceTime(String val)
public void setRejectInproxy(String val)
public void setRejectReferer(String val)
public void setRejectUserAgents(String val)
public void setRemoveConfirm(String val)
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 val)
val - 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 val)
val - 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 val)
public void setUseOutproxyPlugin(String val)
public void setUserAgents(String agents)
public void setUseSSL(String val)
public void storeMethod(String method)
method - the request methodpublic boolean useSoraFont()