java.lang.Object
net.i2p.i2ptunnel.ui.GeneralHelper
General helper functions used by all UIs.
This class is also used by Android. Maintain as a stable API and take care not to break Android.
Field Summary
Modifier and TypeFieldDescriptionprivate final I2PAppContextThe context the tunnel settings live in.protected final TunnelControllerGroupThe group of tunnel controllers, or null if the helper was constructed without one.static final intTunnel is not running.private static final StringPrefix of a tunnel option's property name.protected static final StringProperty key for enabling access list filtering.protected static final StringProperty key for enabling blacklist filtering.static final intTunnel is fully operational.private static final String[]I2CP/Dest/LS options affecting shared client tunnels.static final intTunnel is alive but idle, ready for activity.static final intTunnel is in the process of starting up.Constructor Summary
ConstructorsConstructorDescriptionGeneralHelper(I2PAppContext context, TunnelControllerGroup tcg) Construct a new helper with a specific context.Construct a new helper with the global context.Method Summary
Modifier and TypeMethodDescriptionprotected static String_t(String key, I2PAppContext context) Translate a string using the given context.private static voidcopySharedOptions(TunnelConfig fromConfig, Properties from, TunnelController to) Copy relevant options over.deleteTunnel(int tunnel, String privKeyFile) Stop and delete the tunnel, remove its configuration, and rename the private key file if it uses a default name in the default directory.deleteTunnel(I2PAppContext context, TunnelControllerGroup tcg, int tunnel, String privKeyFile) Stop the tunnel, delete from config, rename the private key file if in the default directory.getAccessList(int tunnel) Return the access control list (comma-separated destinations), newline-delimited.intgetAccessMode(int tunnel) Return the access control mode for the tunnel.booleangetAllowAccept(int tunnel) Check whether the HTTP client allows custom Accept headers.booleangetAllowInternalSSL(int tunnel) Check whether internal SSL connections are allowed through the HTTP client.booleangetAllowReferer(int tunnel) Check whether the HTTP client allows custom Referer headers.booleangetAllowUserAgent(int tunnel) Check whether the HTTP client allows custom User-Agent headers.getAltDestination(int tunnel) Retrieve the alternate tunnel Destination from the key file.getAltPrivateKeyFile(int tunnel) Return the alternate private key file path.getAltPrivateKeyFile(TunnelControllerGroup tcg, int tunnel) Return the alternate private key file path from a specific group.getBlindedPassword(int tunnel) Return the blinded password for the tunnel's lease set.private booleangetBooleanProperty(int tunnel, String prop) Default is false.private booleangetBooleanProperty(int tunnel, String prop, boolean def) Reads one true/false tunnel option.intgetCert(int tunnel) Return the certificate type for the tunnel (currently unused, always 0).getClientAuths(int tunnel, boolean isDH) Return the list of authorized client authentications for the lease set.getClientDestination(int tunnel) Return the client destination (base64) or proxy list for the tunnel.getClientInterface(int tunnel) Return the interface address the client tunnel listens on.intgetClientPort(int tunnel) Return the port the client tunnel listens on.booleangetCloseOnIdle(int tunnel, boolean def) Check whether I2CP close-on-idle is enabled.intgetCloseTime(int tunnel, int def) Return the I2CP close-on-idle timeout in minutes.getController(int tunnel) Retrieve a tunnel controller by index.static TunnelControllergetController(TunnelControllerGroup tcg, int tunnel) Get the controller for the given tunnel index.getCustomOptionsString(int tunnel) Return the custom client options as a single URL-parameter-style string.booleangetDCC(int tunnel) Check whether DCC (direct client-to-client) is enabled for IRC tunnels.booleangetDelayOpen(int tunnel) Check whether I2CP delay-open is enabled.getDestination(int tunnel) Retrieve the tunnel Destination, reading from the key file if the tunnel is not running.intgetEffort(int tunnel) Return the proof-of-work effort for blinded leases (currently unused, always 23).booleangetEncrypt(int tunnel) Check whether the lease set should be encrypted.getEncryptKey(int tunnel) Return the lease set encryption key.intgetEncryptMode(int tunnel) Determine the encryption mode for the tunnel's lease set.getFilterDefinition(int tunnel) Return the connect filter definition for the tunnel.getInboundRandomKey(int tunnel) Return the inbound random key (used for testing LS encryption).getJumpList(int tunnel) Return the jump server list for HTTP clients (one per line).getLeaseSetPrivateKey(int tunnel) Return the lease set private key (for encrypted LS).getLeaseSetSigningPrivateKey(int tunnel) Return the lease set signing private key.intgetLimitDay(int tunnel) Return the per-day connection limit.intgetLimitHour(int tunnel) Return the per-hour connection limit.intgetLimitMinute(int tunnel) Return the per-minute connection limit.intgetMaxStreams(int tunnel) Return the maximum concurrent streams for the tunnel.booleangetMultihome(int tunnel) Check whether the tunnel should bundle reply information (multihome mode).booleangetNewDest(int tunnel) Check whether the tunnel should get a new destination on resume.getOutboundRandomKey(int tunnel) Return the outbound random key (used for testing LS encryption).booleangetOutproxyAuth(int tunnel) Check whether outproxy authentication is required.getOutproxyPassword(int tunnel) Return the outproxy password (only if a username is set).getOutproxyType(int tunnel) Return the outproxy connection type.getOutproxyUsername(int tunnel) Return the outproxy username.booleangetPersistentClientKey(int tunnel) Check whether the tunnel uses a persistent client key file.intgetPostBanTime(int tunnel) Return the POST ban duration in minutes.intgetPostCheckTime(int tunnel) Return the POST check window size in minutes.intgetPostMax(int tunnel) Return the maximum POST request size in bytes.intgetPostTotalBanTime(int tunnel) Return the total POST ban duration in minutes.intgetPostTotalMax(int tunnel) Return the maximum total POST request size for the window.getPrivateKeyFile(int tunnel) Return the private key file path for the tunnel.getPrivateKeyFile(TunnelControllerGroup tcg, int tunnel) Return the private key file path, computing a default if none is configured.private intgetProperty(int tunnel, String prop, int def) Reads one numeric tunnel option.private StringgetProperty(int tunnel, String prop, String def) Reads one text tunnel option.getProxyAuth(int tunnel) Return the proxy authentication mode.intgetReduceCount(int tunnel, int def) Return the I2CP reduce quantity (target number of tunnels when idle).booleangetReduceOnIdle(int tunnel, boolean def) Check whether I2CP session reduction on idle is enabled.intgetReduceTime(int tunnel, int def) Return the I2CP idle reduction time threshold.booleangetRejectInproxy(int tunnel) Check whether inproxy connections are rejected.booleangetRejectReferer(int tunnel) Check whether connections with a Referer header are rejected.booleangetRejectUserAgents(int tunnel) Check whether connections with known bad User-Agents are rejected.intgetRemainingStartupDelay(int tunnel) Get the remaining startup delay time for tunnels with delayed startup.getSigner(int tunnel) Return the signer for blinded leases (currently unused, always empty).intgetSigType(int tunnel, String newTunnelType) Return the signature type code for the tunnel.getSpoofedHost(int tunnel) Return the spoofed HTTP host header.getSslProxies(int tunnel) Return the list of SSL outproxies.getTargetHost(int tunnel) Return the target host for the tunnel.intgetTargetPort(int tunnel) Return the target port for the tunnel.intgetTotalDay(int tunnel) Return the per-day total connection limit across all sources.intgetTotalHour(int tunnel) Return the per-hour total connection limit across all sources.intgetTotalMinute(int tunnel) Return the per-minute total connection limit across all sources.intgetTunnelBackupQuantity(int tunnel, int defaultBackupQuantity) Return the inbound backup tunnel quantity (applies to both in/out if not split).intgetTunnelBackupQuantityOut(int tunnel, int defaultBackupQuantity) Return the outbound backup tunnel quantity.intgetTunnelDepth(int tunnel, int defaultLength) Return the inbound tunnel depth (applies to both in/out if not split).intgetTunnelDepthOut(int tunnel, int defaultLength) Return the outbound tunnel depth.getTunnelDescription(int tunnel) Return the tunnel description.getTunnelName(int tunnel) Return the tunnel name.static StringgetTunnelName(TunnelControllerGroup tcg, int tunnel) Return the tunnel name from a specific group.intgetTunnelQuantity(int tunnel, int defaultQuantity) Return the inbound tunnel quantity (applies to both in/out if not split).intgetTunnelQuantityOut(int tunnel, int defaultQuantity) Return the outbound tunnel quantity.intgetTunnelStatus(int tunnel) Return the operational status of the tunnel.getTunnelType(int tunnel) Return the tunnel type string (e.g.intgetTunnelVariance(int tunnel, int defaultVariance) Return the inbound tunnel length variance (applies to both in/out if not split).intgetTunnelVarianceOut(int tunnel, int defaultVariance) Return the outbound tunnel length variance.booleangetUniqueLocal(int tunnel) Check whether the server tunnel uses unique local addresses for each client.booleangetUseOutproxyPlugin(int tunnel) Check whether the outproxy plugin is enabled.getUserAgents(int tunnel) Return the blocked User-Agent list.booleanhasEncType(int tunnel, int encType) Check whether the tunnel supports a given encryption type.booleanisInteractive(int tunnel) Check whether the tunnel is configured for interactive streaming (small window).booleanisOfflineKeys(int tunnel) Check whether the tunnel uses offline keys.booleanisSharedClient(int tunnel) Check whether this tunnel shares its I2CP session with other clients.booleanisSSLEnabled(int tunnel) Check whether SSL is enabled for the server tunnel.saveConfig(I2PAppContext context, TunnelControllerGroup tcg, int tunnel) Save the configuration for an existing tunnel to disk.saveConfig(TunnelControllerGroup tcg, TunnelController cur) Save the configuration to disk.saveTunnel(int tunnel, TunnelConfig config) Save the configuration for a new or existing tunnel to disk.saveTunnel(I2PAppContext context, TunnelControllerGroup tcg, int tunnel, TunnelConfig config) Save the configuration for a new or existing tunnel to disk.booleanshouldDelayConnect(int tunnel) Check whether the tunnel has a streaming connect delay configured.booleanshouldStartAutomatically(int tunnel) Check whether the tunnel is configured to start automatically.updateTunnelConfig(TunnelControllerGroup tcg, int tunnel, TunnelConfig config) Update the config and if shared, adjust and save the config of other shared clients.private static TunnelControllerupdateTunnelConfig(TunnelControllerGroup tcg, int tunnel, TunnelConfig config, List<String> msgs) Update the config and if shared, adjust and save the config of other shared clients.
Field Details
RUNNING
STARTING
public static final int STARTINGTunnel is in the process of starting up.- See Also:
NOT_RUNNING
STANDBY
public static final int STANDBYTunnel is alive but idle, ready for activity.- See Also:
PROP_ENABLE_ACCESS_LIST
Property key for enabling access list filtering.- See Also:
PROP_ENABLE_BLACKLIST
Property key for enabling blacklist filtering.- See Also:
OPT
Prefix of a tunnel option's property name.- See Also:
_context
The context the tunnel settings live in._group
The group of tunnel controllers, or null if the helper was constructed without one.SHARED_OPTIONS
I2CP/Dest/LS options affecting shared client tunnels. Streaming options should not be here, each client gets its own SocketManger. All must be prefixed with "option.".
Constructor Details
GeneralHelper
Construct a new helper with the global context.- Parameters:
tcg- the group of tunnel controllers, may be null
GeneralHelper
Construct a new helper with a specific context.- Parameters:
context- the I2P app context to usetcg- the group of tunnel controllers, may be null
Method Details
getController
Retrieve a tunnel controller by index.- Parameters:
tunnel- the index of the tunnel in the controller group, or -1 if there is none- Returns:
- the controller, or null if not found
getController
Get the controller for the given tunnel index.- Parameters:
tcg- may be nulltunnel- the index of the tunnel in the controller group, or -1 if there is none- Returns:
- null if not found or tcg is null
saveTunnel
Save the configuration for a new or existing tunnel to disk. For new tunnels, adds to controller and (if configured) starts it.- Parameters:
tunnel- the index of the tunnel in the controller group, or -1 if there is noneconfig- the configuration to apply- Returns:
- list of status messages
saveTunnel
public static List<String> saveTunnel(I2PAppContext context, TunnelControllerGroup tcg, int tunnel, TunnelConfig config) Save the configuration for a new or existing tunnel to disk. For new tunnels, adds to controller and (if configured) starts it.- Parameters:
context- unused, taken from tcgtcg- the group of tunnel controllers, may be nulltunnel- the index of the tunnel in the controller group, or -1 to create a new tunnelconfig- the configuration to apply- Returns:
- the status and error messages generated by the update and save, for display to the user
updateTunnelConfig
protected static List<String> updateTunnelConfig(TunnelControllerGroup tcg, int tunnel, TunnelConfig config) Update the config and if shared, adjust and save the config of other shared clients. If a new tunnel, this will call tcg.addController(), and start it if so configured. This does NOT save this tunnel's config. Caller must callsaveConfig(I2PAppContext, TunnelControllerGroup, int)also.- Parameters:
tcg- the group of tunnel controllers, may be nulltunnel- the index of the tunnel in the controller group, or -1 to create a new tunnelconfig- the configuration to apply- Returns:
- the status messages generated by the update, for display to the user
updateTunnelConfig
private static TunnelController updateTunnelConfig(TunnelControllerGroup tcg, int tunnel, TunnelConfig config, List<String> msgs) Update the config and if shared, adjust and save the config of other shared clients. If a new tunnel, this will call tcg.addController(), and start it if so configured. This does NOT save this tunnel's config. Caller must call saveConfig() also.- Parameters:
tcg- the group of tunnel controllers to update or add totunnel- the tunnel number being updatedconfig- the new configuration read from the formmsgs- out parameter, messages will be added- Returns:
- the old or new controller, non-null.
saveConfig
protected static List<String> saveConfig(I2PAppContext context, TunnelControllerGroup tcg, int tunnel) Save the configuration for an existing tunnel to disk. New tunnels must use saveConfig(..., TunnelController).- Parameters:
context- unused, taken from tcgtcg- the group of tunnel controllers, may be nulltunnel- must already exist- Returns:
- the status and error messages generated by the save, for display to the user
saveConfig
Save the configuration to disk. For new and existing tunnels. Does NOT call tcg.addController() for new tunnels. See udpateConfig().- Parameters:
tcg- the group that writes the config file and clears messagescur- the controller whose configuration is written- Returns:
- the status and error messages generated by the save, for display
deleteTunnel
Stop and delete the tunnel, remove its configuration, and rename the private key file if it uses a default name in the default directory.- Parameters:
tunnel- the index of the tunnel in the controller group, or -1 if there is noneprivKeyFile- the private key file name from the edit form, may be null- Returns:
- list of status messages
deleteTunnel
public static List<String> deleteTunnel(I2PAppContext context, TunnelControllerGroup tcg, int tunnel, String privKeyFile) Stop the tunnel, delete from config, rename the private key file if in the default directory.- Parameters:
context- the I2P app context, used to locate the config directory for the key file renametcg- the group of tunnel controllers, may be nulltunnel- the index of the tunnel in the controller group, or -1 if there is noneprivKeyFile- The priv key file name from the tunnel edit form. Can be null if not known.- Returns:
- the status and error messages generated by the deletion, for display to the user
getTunnelType
Return the tunnel type string (e.g. "httpclient", "httpserver").- Parameters:
tunnel- the index of the tunnel in the controller group, or -1 if there is none- Returns:
- the type string, or empty string if tunnel not found
getTunnelName
Return the tunnel name.- Parameters:
tunnel- the index of the tunnel in the controller group, or -1 if there is none- Returns:
- null if unset
getTunnelName
Return the tunnel name from a specific group.- Parameters:
tcg- the controller group, may be nulltunnel- the index of the tunnel in the controller group, or -1 if there is none- Returns:
- null if unset
getTunnelDescription
Return the tunnel description.- Parameters:
tunnel- the index of the tunnel in the controller group, or -1 if there is none- Returns:
- the description, or empty string if not found
getTargetHost
Return the target host for the tunnel.- Parameters:
tunnel- the index of the tunnel in the controller group, or -1 if there is none- Returns:
- the target host, defaults to "127.0.0.1"
getTargetPort
public int getTargetPort(int tunnel) Return the target port for the tunnel.- Parameters:
tunnel- the index of the tunnel in the controller group, or -1 if there is none- Returns:
- the port number, or -1 if unset or invalid
getSpoofedHost
Return the spoofed HTTP host header.- Parameters:
tunnel- the index of the tunnel in the controller group, or -1 if there is none- Returns:
- the spoofed host, or empty string if not set
getPrivateKeyFile
Return the private key file path for the tunnel.- Parameters:
tunnel- the index of the tunnel in the controller group, or -1 if there is none- Returns:
- path, non-null, non-empty
getPrivateKeyFile
Return the private key file path, computing a default if none is configured.- Parameters:
tcg- the controller group, may be nulltunnel- the index of the tunnel in the controller group, or -1 if there is none- Returns:
- path, non-null, non-empty
getAltPrivateKeyFile
Return the alternate private key file path.- Parameters:
tunnel- the index of the tunnel in the controller group, or -1 if there is none- Returns:
- path or ""
getAltPrivateKeyFile
Return the alternate private key file path from a specific group.- Parameters:
tcg- the controller group, may be nulltunnel- the index of the tunnel in the controller group, or -1 if there is none- Returns:
- path or ""
getClientInterface
Return the interface address the client tunnel listens on.- Parameters:
tunnel- the index of the tunnel in the controller group, or -1 if there is none- Returns:
- the interface address, defaults to "127.0.0.1"
getClientPort
public int getClientPort(int tunnel) Return the port the client tunnel listens on.- Parameters:
tunnel- the index of the tunnel in the controller group, or -1 if there is none- Returns:
- the port number, or -1 if unset or invalid
getTunnelStatus
public int getTunnelStatus(int tunnel) Return the operational status of the tunnel.- Parameters:
tunnel- the index of the tunnel in the controller group, or -1 if there is none- Returns:
- RUNNING, STARTING, NOT_RUNNING, or STANDBY
getRemainingStartupDelay
public int getRemainingStartupDelay(int tunnel) Get the remaining startup delay time for tunnels with delayed startup.- Parameters:
tunnel- the index of the tunnel in the controller group, or -1 if there is none- Returns:
- remaining delay in seconds, or 0 if not applicable
getClientDestination
Return the client destination (base64) or proxy list for the tunnel.- Parameters:
tunnel- the index of the tunnel in the controller group, or -1 if there is none- Returns:
- the destination string or proxy list, never null
getDestination
Retrieve the tunnel Destination, reading from the key file if the tunnel is not running.- Parameters:
tunnel- the index of the tunnel in the controller group, or -1 if there is none- Returns:
- Destination or null
getAltDestination
Retrieve the alternate tunnel Destination from the key file.- Parameters:
tunnel- the index of the tunnel in the controller group, or -1 if there is none- Returns:
- Destination or null
isOfflineKeys
public boolean isOfflineKeys(int tunnel) Check whether the tunnel uses offline keys.- Parameters:
tunnel- the index of the tunnel in the controller group, or -1 if there is none- Returns:
- true if offline keys
shouldStartAutomatically
public boolean shouldStartAutomatically(int tunnel) Check whether the tunnel is configured to start automatically.- Parameters:
tunnel- the index of the tunnel in the controller group, or -1 if there is none- Returns:
- true if auto-start is enabled
shouldDelayConnect
public boolean shouldDelayConnect(int tunnel) Check whether the tunnel has a streaming connect delay configured.- Parameters:
tunnel- the index of the tunnel in the controller group, or -1 if there is none- Returns:
- true if connect delay is positive
isInteractive
public boolean isInteractive(int tunnel) Check whether the tunnel is configured for interactive streaming (small window).- Parameters:
tunnel- the index of the tunnel in the controller group, or -1 if there is none- Returns:
- true if max window size is 16
getTunnelDepth
public int getTunnelDepth(int tunnel, int defaultLength) Return the inbound tunnel depth (applies to both in/out if not split).- Parameters:
tunnel- the index of the tunnel in the controller group, or -1 if there is nonedefaultLength- default value if not configured- Returns:
- tunnel depth in hops
getTunnelQuantity
public int getTunnelQuantity(int tunnel, int defaultQuantity) Return the inbound tunnel quantity (applies to both in/out if not split).- Parameters:
tunnel- the index of the tunnel in the controller group, or -1 if there is nonedefaultQuantity- default value if not configured- Returns:
- number of tunnels
getTunnelBackupQuantity
public int getTunnelBackupQuantity(int tunnel, int defaultBackupQuantity) Return the inbound backup tunnel quantity (applies to both in/out if not split).- Parameters:
tunnel- the index of the tunnel in the controller group, or -1 if there is nonedefaultBackupQuantity- default value if not configured- Returns:
- number of backup tunnels
getTunnelVariance
public int getTunnelVariance(int tunnel, int defaultVariance) Return the inbound tunnel length variance (applies to both in/out if not split).- Parameters:
tunnel- the index of the tunnel in the controller group, or -1 if there is nonedefaultVariance- default value if not configured- Returns:
- length variance in hops
getTunnelDepthOut
public int getTunnelDepthOut(int tunnel, int defaultLength) Return the outbound tunnel depth.- Parameters:
tunnel- the index of the tunnel in the controller group, or -1 if there is nonedefaultLength- default value if not configured- Returns:
- tunnel depth in hops
getTunnelQuantityOut
public int getTunnelQuantityOut(int tunnel, int defaultQuantity) Return the outbound tunnel quantity.- Parameters:
tunnel- the index of the tunnel in the controller group, or -1 if there is nonedefaultQuantity- default value if not configured- Returns:
- number of tunnels
getTunnelBackupQuantityOut
public int getTunnelBackupQuantityOut(int tunnel, int defaultBackupQuantity) Return the outbound backup tunnel quantity.- Parameters:
tunnel- the index of the tunnel in the controller group, or -1 if there is nonedefaultBackupQuantity- default value if not configured- Returns:
- number of backup tunnels
getTunnelVarianceOut
public int getTunnelVarianceOut(int tunnel, int defaultVariance) Return the outbound tunnel length variance.- Parameters:
tunnel- the index of the tunnel in the controller group, or -1 if there is nonedefaultVariance- default value if not configured- Returns:
- length variance in hops
getReduceOnIdle
public boolean getReduceOnIdle(int tunnel, boolean def) Check whether I2CP session reduction on idle is enabled.- Parameters:
tunnel- the index of the tunnel in the controller group, or -1 if there is nonedef- default value if not configured- Returns:
- true if reduction on idle is enabled
getReduceCount
public int getReduceCount(int tunnel, int def) Return the I2CP reduce quantity (target number of tunnels when idle).- Parameters:
tunnel- the index of the tunnel in the controller group, or -1 if there is nonedef- default value if not configured- Returns:
- the target number of tunnels to leave running when idle
getReduceTime
public int getReduceTime(int tunnel, int def) Return the I2CP idle reduction time threshold.- Parameters:
tunnel- the index of the tunnel in the controller group, or -1 if there is nonedef- default idle time in minutes- Returns:
- idle time in minutes
getCert
public int getCert(int tunnel) Return the certificate type for the tunnel (currently unused, always 0).- Parameters:
tunnel- the index of the tunnel in the controller group, or -1 if there is none- Returns:
- 0, since the certificate type is not configurable
getEffort
public int getEffort(int tunnel) Return the proof-of-work effort for blinded leases (currently unused, always 23).- Parameters:
tunnel- the index of the tunnel in the controller group, or -1 if there is none- Returns:
- 23, since the proof-of-work effort is not configurable
getSigner
Return the signer for blinded leases (currently unused, always empty).- Parameters:
tunnel- the index of the tunnel in the controller group, or -1 if there is none- Returns:
- the empty string, since the signer is not configurable
getEncrypt
public boolean getEncrypt(int tunnel) Check whether the lease set should be encrypted.- Parameters:
tunnel- the index of the tunnel in the controller group, or -1 if there is none- Returns:
- true if encryption is enabled
getEncryptMode
public int getEncryptMode(int tunnel) Determine the encryption mode for the tunnel's lease set.- Parameters:
tunnel- the index of the tunnel in the controller group, or -1 if there is none- Returns:
- encryption mode code (0=none, 1=full, 2=blinded, etc.)
getBlindedPassword
Return the blinded password for the tunnel's lease set.- Parameters:
tunnel- the index of the tunnel in the controller group, or -1 if there is none- Returns:
- the decoded blinded password, or empty string
getClientAuths
Return the list of authorized client authentications for the lease set. Each entry is a base64-encoded name:key pair.- Parameters:
tunnel- the index of the tunnel in the controller group, or -1 if there is noneisDH- true for DH public keys, false for PSK private keys- Returns:
- non-null list of auth entries
getSigType
Return the signature type code for the tunnel.- Parameters:
tunnel- the index of the tunnel in the controller group, or -1 if there is nonenewTunnelType- used if tunnel < 0 to determine default- Returns:
- the current type if a destination exists, else the default for that tunnel type
hasEncType
public boolean hasEncType(int tunnel, int encType) Check whether the tunnel supports a given encryption type.- Parameters:
tunnel- the index of the tunnel in the controller group, or -1 if there is noneencType- encryption type code- Returns:
- true if the encryption type is in the configured list
getInboundRandomKey
Return the inbound random key (used for testing LS encryption).- Parameters:
tunnel- the index of the tunnel in the controller group, or -1 if there is none- Returns:
- the key, or empty string if not set
getOutboundRandomKey
Return the outbound random key (used for testing LS encryption).- Parameters:
tunnel- the index of the tunnel in the controller group, or -1 if there is none- Returns:
- the key, or empty string if not set
getLeaseSetSigningPrivateKey
Return the lease set signing private key.- Parameters:
tunnel- the index of the tunnel in the controller group, or -1 if there is none- Returns:
- the key, or empty string if not set
getLeaseSetPrivateKey
Return the lease set private key (for encrypted LS).- Parameters:
tunnel- the index of the tunnel in the controller group, or -1 if there is none- Returns:
- the key, or empty string if not set
getDCC
public boolean getDCC(int tunnel) Check whether DCC (direct client-to-client) is enabled for IRC tunnels.- Parameters:
tunnel- the index of the tunnel in the controller group, or -1 if there is none- Returns:
- true if DCC is enabled
isSSLEnabled
public boolean isSSLEnabled(int tunnel) Check whether SSL is enabled for the server tunnel.- Parameters:
tunnel- the index of the tunnel in the controller group, or -1 if there is none- Returns:
- true if SSL is enabled
getEncryptKey
Return the lease set encryption key.- Parameters:
tunnel- the index of the tunnel in the controller group, or -1 if there is none- Returns:
- the key, or empty string if not set
getAccessMode
public int getAccessMode(int tunnel) Return the access control mode for the tunnel.- Parameters:
tunnel- the index of the tunnel in the controller group, or -1 if there is none- Returns:
- 0=none, 1=whitelist, 2=blacklist
getAccessList
Return the access control list (comma-separated destinations), newline-delimited.- Parameters:
tunnel- the index of the tunnel in the controller group, or -1 if there is none- Returns:
- the access list entries, one per line
getFilterDefinition
Return the connect filter definition for the tunnel.- Parameters:
tunnel- the index of the tunnel in the controller group, or -1 if there is none- Returns:
- the filter definition, or empty string if not set
getJumpList
Return the jump server list for HTTP clients (one per line).- Parameters:
tunnel- the index of the tunnel in the controller group, or -1 if there is none- Returns:
- the jump server list, newline-delimited
getCloseOnIdle
public boolean getCloseOnIdle(int tunnel, boolean def) Check whether I2CP close-on-idle is enabled.- Parameters:
tunnel- the index of the tunnel in the controller group, or -1 if there is nonedef- default value if not configured- Returns:
- true if close-on-idle is enabled
getCloseTime
public int getCloseTime(int tunnel, int def) Return the I2CP close-on-idle timeout in minutes.- Parameters:
tunnel- the index of the tunnel in the controller group, or -1 if there is nonedef- default value in minutes- Returns:
- idle timeout in minutes
getNewDest
public boolean getNewDest(int tunnel) Check whether the tunnel should get a new destination on resume.- Parameters:
tunnel- the index of the tunnel in the controller group, or -1 if there is none- Returns:
- true if a new destination will be created on resume
getPersistentClientKey
public boolean getPersistentClientKey(int tunnel) Check whether the tunnel uses a persistent client key file.- Parameters:
tunnel- the index of the tunnel in the controller group, or -1 if there is none- Returns:
- true if the key is persistent
getDelayOpen
public boolean getDelayOpen(int tunnel) Check whether I2CP delay-open is enabled.- Parameters:
tunnel- the index of the tunnel in the controller group, or -1 if there is none- Returns:
- true if delay-open is enabled
getAllowUserAgent
public boolean getAllowUserAgent(int tunnel) Check whether the HTTP client allows custom User-Agent headers.- Parameters:
tunnel- the index of the tunnel in the controller group, or -1 if there is none- Returns:
- true if custom User-Agent is allowed
getAllowReferer
public boolean getAllowReferer(int tunnel) Check whether the HTTP client allows custom Referer headers.- Parameters:
tunnel- the index of the tunnel in the controller group, or -1 if there is none- Returns:
- true if custom Referer is allowed
getAllowAccept
public boolean getAllowAccept(int tunnel) Check whether the HTTP client allows custom Accept headers.- Parameters:
tunnel- the index of the tunnel in the controller group, or -1 if there is none- Returns:
- true if custom Accept is allowed
getAllowInternalSSL
public boolean getAllowInternalSSL(int tunnel) Check whether internal SSL connections are allowed through the HTTP client. As of 0.9.35, defaults to true unless explicitly disabled.- Parameters:
tunnel- the index of the tunnel in the controller group, or -1 if there is none- Returns:
- true if internal SSL is allowed
getMultihome
public boolean getMultihome(int tunnel) Check whether the tunnel should bundle reply information (multihome mode).- Parameters:
tunnel- the index of the tunnel in the controller group, or -1 if there is none- Returns:
- true if bundling is enabled
getProxyAuth
Return the proxy authentication mode.- Parameters:
tunnel- the index of the tunnel in the controller group, or -1 if there is none- Returns:
- "false", "true", or "basic"
getOutproxyAuth
public boolean getOutproxyAuth(int tunnel) Check whether outproxy authentication is required.- Parameters:
tunnel- the index of the tunnel in the controller group, or -1 if there is none- Returns:
- true if outproxy auth is enabled
getOutproxyUsername
Return the outproxy username.- Parameters:
tunnel- the index of the tunnel in the controller group, or -1 if there is none- Returns:
- the username, or empty string
getOutproxyPassword
Return the outproxy password (only if a username is set).- Parameters:
tunnel- the index of the tunnel in the controller group, or -1 if there is none- Returns:
- the password, or empty string
getSslProxies
Return the list of SSL outproxies.- Parameters:
tunnel- the index of the tunnel in the controller group, or -1 if there is none- Returns:
- comma-separated SSL outproxy list
getUseOutproxyPlugin
public boolean getUseOutproxyPlugin(int tunnel) Check whether the outproxy plugin is enabled.- Parameters:
tunnel- the index of the tunnel in the controller group, or -1 if there is none- Returns:
- true if the outproxy plugin is used, defaults to true
getOutproxyType
Return the outproxy connection type.- Parameters:
tunnel- the index of the tunnel in the controller group, or -1 if there is none- Returns:
- "connect" or "socks", default depends on tunnel type
getLimitMinute
public int getLimitMinute(int tunnel) Return the per-minute connection limit.- Parameters:
tunnel- the index of the tunnel in the controller group, or -1 if there is none- Returns:
- max connections per minute
getLimitHour
public int getLimitHour(int tunnel) Return the per-hour connection limit.- Parameters:
tunnel- the index of the tunnel in the controller group, or -1 if there is none- Returns:
- max connections per hour
getLimitDay
public int getLimitDay(int tunnel) Return the per-day connection limit.- Parameters:
tunnel- the index of the tunnel in the controller group, or -1 if there is none- Returns:
- max connections per day
getTotalMinute
public int getTotalMinute(int tunnel) Return the per-minute total connection limit across all sources.- Parameters:
tunnel- the index of the tunnel in the controller group, or -1 if there is none- Returns:
- max total connections per minute
getTotalHour
public int getTotalHour(int tunnel) Return the per-hour total connection limit across all sources.- Parameters:
tunnel- the index of the tunnel in the controller group, or -1 if there is none- Returns:
- max total connections per hour
getTotalDay
public int getTotalDay(int tunnel) Return the per-day total connection limit across all sources.- Parameters:
tunnel- the index of the tunnel in the controller group, or -1 if there is none- Returns:
- max total connections per day
getMaxStreams
public int getMaxStreams(int tunnel) Return the maximum concurrent streams for the tunnel.- Parameters:
tunnel- the index of the tunnel in the controller group, or -1 if there is none- Returns:
- the maximum concurrent streams, or the tunnel default if unconfigured
getPostMax
public int getPostMax(int tunnel) Return the maximum POST request size in bytes.- Parameters:
tunnel- the index of the tunnel in the controller group, or -1 if there is none- Returns:
- max POST size in bytes
getPostTotalMax
public int getPostTotalMax(int tunnel) Return the maximum total POST request size for the window.- Parameters:
tunnel- the index of the tunnel in the controller group, or -1 if there is none- Returns:
- max total POST size in bytes
getPostCheckTime
public int getPostCheckTime(int tunnel) Return the POST check window size in minutes.- Parameters:
tunnel- the index of the tunnel in the controller group, or -1 if there is none- Returns:
- check window in minutes
getPostBanTime
public int getPostBanTime(int tunnel) Return the POST ban duration in minutes.- Parameters:
tunnel- the index of the tunnel in the controller group, or -1 if there is none- Returns:
- ban time in minutes
getPostTotalBanTime
public int getPostTotalBanTime(int tunnel) Return the total POST ban duration in minutes.- Parameters:
tunnel- the index of the tunnel in the controller group, or -1 if there is none- Returns:
- total ban time in minutes
getRejectInproxy
public boolean getRejectInproxy(int tunnel) Check whether inproxy connections are rejected.- Parameters:
tunnel- the index of the tunnel in the controller group, or -1 if there is none- Returns:
- true if inproxy connections are rejected
getRejectReferer
public boolean getRejectReferer(int tunnel) Check whether connections with a Referer header are rejected.- Parameters:
tunnel- the index of the tunnel in the controller group, or -1 if there is none- Returns:
- true if Referer connections are rejected
getRejectUserAgents
public boolean getRejectUserAgents(int tunnel) Check whether connections with known bad User-Agents are rejected.- Parameters:
tunnel- the index of the tunnel in the controller group, or -1 if there is none- Returns:
- true if User-Agent rejection is enabled
getUserAgents
Return the blocked User-Agent list.- Parameters:
tunnel- the index of the tunnel in the controller group, or -1 if there is none- Returns:
- comma-separated user agents to block
getUniqueLocal
public boolean getUniqueLocal(int tunnel) Check whether the server tunnel uses unique local addresses for each client.- Parameters:
tunnel- the index of the tunnel in the controller group, or -1 if there is none- Returns:
- true if unique local addressing is enabled
getCustomOptionsString
Return the custom client options as a single URL-parameter-style string.- Parameters:
tunnel- the index of the tunnel in the controller group, or -1 if there is none- Returns:
- the options string, HTML-escaped, or empty string
getProperty
Reads one numeric tunnel option.- Parameters:
tunnel- which tunnel's option to readprop- the option's namedef- the value to use when it is not set- Returns:
- the option's value
getProperty
getBooleanProperty
Default is false.- Parameters:
tunnel- the tunnel number whose client options are readprop- the client option key to parse- Returns:
- true only when the option is set to a parseable true value
getBooleanProperty
Reads one true/false tunnel option.- Parameters:
tunnel- which tunnel's option to readprop- the option's namedef- the value to use when it is not set- Returns:
- the option's value
_t
Translate a string using the given context.- Parameters:
key- the untranslated stringcontext- the app context for translation- Returns:
- the translated string