- All Implemented Interfaces:
Logging
These objects are bundled together under a TunnelControllerGroup where the entire group is stored / loaded from a single config file.
This is the class used by several plugins to create tunnels, so take care to maintain the public methods as a stable API.
Nested Class Summary
Modifier and TypeClassDescriptionprivate classPeriodically check for an updated offline-signed private key file.static enumThe tunnel state.Field Summary
Modifier and TypeFieldDescriptionprivate PropertiesThe tunnel's configuration properties.private FileFile the configuration is saved to.private final LogLogger for the tunnel controller.Status messages shown on the tunnel page.private SimpleTimer2.TimedEventThe queued private key file check event.private List<I2PSession> The tunnel's open I2CP sessions.private longWhen the startup delay ends, zero while running.private TunnelController.TunnelStateCurrent state of the tunnel.private booleanSuppress log messages during tunnel restart.private final I2PTunnelThe tunnel object being controlled.static final intPer-source connection limit over a one-day window, used when unset.static final intPer-source connection limit over a one-hour window, used when unset.static final intPer-source connection limit over a one-minute window, used when unset.static final intMaximum concurrent streams used when unset.static final intAll-source connection limit over a one-day window, used when unset.static final intAll-source connection limit over a one-hour window, used when unset.static final intAll-source connection limit over a one-minute window, used when unset.static final intDefault maximum shutdown delay in seconds.static final intDefault minimum shutdown delay in seconds.static final intDefault maximum startup delay in seconds.static final intDefault minimum startup delay in seconds.static final StringKey backup directory name.private static final StringOption naming an alternate private key file.static final StringConfig key to bundle reply keys.private static final StringOption listing the lease set encryption types.private static final StringOption turning I2CP gzip compression on or off.private static final StringOption choosing the action when limits are hit.private static final StringOption marking the connection limits as set.private static final StringOption setting the low tag replenishment threshold.private static final StringOption limiting connections per day.private static final StringOption limiting connections per hour.private static final StringStreaming connection limit options.private static final StringOption limiting simultaneous streams.private static final StringOption limiting all connections per day.private static final StringOption limiting all connections per hour.private static final StringOption limiting all connections per minute.private static final StringOption keeping the client key across restarts.static final StringConfig key for max posts (delegated to HTTPServer).static final StringConfig key for max total posts (delegated to HTTPServer).private static final StringOption setting the outbound message priority.private static final StringOption setting the signature type of the tunnel key.private static final StringOption setting the transient tags sent per session.static final StringOption prefix.static final SigTypeThis is guaranteed to be available.static final StringConfiguration file property.static final StringHuman-readable description, shown in the tunnel list.static final StringBase64-encoded I2P destination, for the client types that require one.static final StringPath to the private key file, which may be relative.static final StringPath to the streaming filter definition file.static final StringHost the router's I2CP listener is on.static final StringPort the router's I2CP listener is on.static final StringLocal interface the tunnel binds its localhost side to.static final StringStreaming limit action property.static final StringSet "true" once the user has chosen a limit, so the defaults are not written over it.static final StringLocal port the tunnel's localhost side listens on.static final StringPer-source connection limit over a one-day window.static final StringPer-source connection limit over a one-hour window.static final StringPer-source connection limit over a one-minute window.static final StringMaximum streams open on the tunnel at once.static final StringConnection limit summed over all sources over a one-day window.static final StringConnection limit summed over all sources over a one-hour window.static final StringConnection limit summed over all sources over a one-minute window.static final StringDisplay name of the tunnel.static final StringComma-separated proxy list to chain a client tunnel through.static final String"true" to let client tunnels share tunnels with each other.static final StringConfiguration property for the maximum shutdown delay in seconds.static final StringConfiguration property for the minimum shutdown delay in seconds.static final StringHost sent in the HTTP Host header while spoofing.static final String"true" to start the tunnel when the router starts.static final StringConfiguration property for the maximum startup delay in seconds.static final StringConfiguration property for the minimum startup delay in seconds.static final StringHost or IP address of the target on the localhost side.static final StringPort of the target on the localhost side.static final StringTunnel gzip property.static final StringTunnel type, one of the TYPE_ values below.static final StringOutbound HTTP CONNECT proxy for tunnelling, optionally via an outproxy.static final StringHTTP server that also runs a proxy port on the same destination.static final StringOutbound HTTP proxy.static final StringHTTP server forwarding requests to a localhost target, spoofing the Host header.static final StringOutbound IRC client.static final StringIRC server forwarding to a localhost target.static final StringOutbound SOCKS4a/5 proxy.static final StringOutbound SOCKS proxy that also runs the IRC filters over the connection.static final StringClient listening on a local port and forwarding to a fixed destination.static final StringServer forwarding incoming streams to a localhost host and port.static final StringClient in the UI and I2P side but a server on the localhost side.static final StringServer in the UI and I2P side but a client on the localhost side.Constructor Summary
ConstructorsConstructorDescriptionTunnelController(Properties config, String prefix) Create a new controller for a tunnel out of the specific config options.TunnelController(Properties config, String prefix, boolean createKey) Create a new controller for a tunnel out of the specific config options.Method Summary
Modifier and TypeMethodDescriptionprivate voidacquire()Note the fact that we are using some sessions, so that they don't get closed by some other tunnels.voidChanges the tunnel state and notifies any waiting threads.Pull off any messages that the I2PTunnel has produced.private static booleanconfigChanged(Properties p1, Properties p2, String p) Is property p different in p1 and p2?private booleanCreates alternate Destination with the same encryption keys as the primary Destination, but a different signing key.private booleanCreate a new private key, if no filename is specified or creation fails.voidMay NOT be restarted with restartTunnel() orstartTunnel()later.private voidConfigures and controls a single tunnel.(package private) static FileDoes not necessarily exist.private static PropertiesfilterProperties(Properties config, String prefix) Copy the properties with the given prefix stripped, or return the given properties unchanged if the prefix is empty.private Collection<I2PSession> Get all the sessions we may be using.Does not necessarily exist.These are the ones stored with a prefix of "option." Defaults in config properties are not honored.The tunnel config, with each key prefixed, or a copy if the prefix is empty.The config file as passed into the constructor via the "configFile" property, or as set later.private intRead a delay option, clamped to non-negative.Returns the tunnel's description.Get the destination from the first session that has one.Absolute path to filter definition file.The I2CP host the router is on.The I2CP port the router is on.booleanCheck whether the primary session uses offline keys.private booleanCheck whether any session or subsession uses offline keys.booleanChecks if the tunnel is currently running.booleanChecks if the tunnel is in standby mode.booleanChecks if the tunnel is starting or starting on load.The interface the tunnel listens on.The port the tunnel listens on.Get my destination's base32 address.Get my destination as a Base64 string.getName()Returns the tunnel's display name.booleanWhether a persistent client key is used.Does not necessarily exist.Probably not absolute.The comma-separated list of proxies for the tunnel.intGet the remaining startup delay time for tunnels with delayed startup.Whether this tunnel shares its tunnels with other client tunnels.intWhen combined with a positive shutdownDelayMin less than this value, the tunnel will stop with a random delay between min and max seconds during router shutdown.intWhen combined with a greater shutdownDelayMax, the tunnel will stop with a random delay between min and max seconds during router shutdown.The hostname sent in the HTTP Host header when spoofing is enabled.booleanWhether this tunnel is configured to start when the router starts.intWhen combined with a positive startupDelayMin less than this value, the tunnel will start with a random delay between min and max seconds.intWhen combined with a greater startupDelayMax, the tunnel will start with a random delay between min and max seconds.getState()The current state of this tunnel.The base64-encoded target destination.The hostname or IP address of the target.The port number of the target.The I2PTunnelgetType()Returns the tunnel's type as configured.booleanisClient()Whether this tunnel is a client type in the UI and I2P side.static booleanWhether the given type is a client type in the UI and I2P side.voidLogs a message unless suppressed, keeping only the most recent 10.private voidrelease(Collection<I2PSession> sessions) Note the fact that we are no longer using some sessions, and if no other tunnels are using them, close them.voidStops and restarts the tunnel.voidRestore log messages after restart.private voidsetClientDefaults(String type) Apply the default encryption type for HTTP proxy and shared client tunnels.voidsetConfig(Properties config, String prefix) Update the options on an existing session.voidsetConfigFile(File file) Set the config file.private voidApply the default connection and post limits, plus the filter definition and profile, for server tunnels.private voidApplies the I2CP options from the config to the tunnel.private voidsetIrcDefaults(String type) Apply the default session tags, enctype, and priority for IRC and streaming tunnels.private voidSets the local address the tunnel listens on.private voidsetServerDefaults(String type) Apply the default options for web server tunnels, including gzip and bundle-reply handling.private voidApplies the session-level options to the tunnel.private voidsetSignatureDefault(String type) Apply the default signature type for tunnels that support it, mirroringEditBean.getSigType(int, String)andGeneralHelper.getSigType(int, String).(package private) voidsetStartupDelayEndTime(long delayMs) Set the startup delay end time.private voidStarts a generic client tunnel.private voidStarts a connect client tunnel.private voidStarts a bidirectional http server tunnel.private voidStarts an http proxy client tunnel.private voidStarts an http server tunnel.private voidStarts an IRC client tunnel.private voidStarts an IRC server tunnel.private voidStarts a generic server tunnel.private voidStarts a SOCKS proxy client tunnel.private voidStarts a combined SOCKS and IRC client tunnel.private voidStarts a streaming client tunnel.private voidStreamr server is a UDP client, use the targetPort field for listenPort.voidStart up the tunnel (if it isn't already running).voidStarts the tunnel in a background thread.voidMay be restarted withrestartTunnel()or startTunnel() later.voidSuppress log messages during tunnel restart.toString()
Field Details
_log
Logger for the tunnel controller._config
The tunnel's configuration properties._configFile
File the configuration is saved to._tunnel
The tunnel object being controlled._messages
_sessions
The tunnel's open I2CP sessions._state
Current state of the tunnel._pkfc
The queued private key file check event._startupDelayEndTime
private volatile long _startupDelayEndTimeWhen the startup delay ends, zero while running._suppressLog
private boolean _suppressLogSuppress log messages during tunnel restart.KEY_BACKUP_DIR
PROP_DESCR
Human-readable description, shown in the tunnel list.- See Also:
PROP_DEST
Base64-encoded I2P destination, for the client types that require one.- See Also:
PROP_I2CP_HOST
Host the router's I2CP listener is on.- See Also:
PROP_I2CP_PORT
Port the router's I2CP listener is on.- See Also:
PROP_INTFC
Local interface the tunnel binds its localhost side to.- See Also:
PROP_FILE
Path to the private key file, which may be relative.- See Also:
PROP_LISTEN_PORT
Local port the tunnel's localhost side listens on.- See Also:
PROP_NAME
PROP_PROXIES
Comma-separated proxy list to chain a client tunnel through.- See Also:
PROP_SHARED
"true" to let client tunnels share tunnels with each other.- See Also:
PROP_SPOOFED_HOST
Host sent in the HTTP Host header while spoofing.- See Also:
PROP_START
"true" to start the tunnel when the router starts.- See Also:
PROP_TARGET_HOST
Host or IP address of the target on the localhost side.- See Also:
PROP_TARGET_PORT
Port of the target on the localhost side.- See Also:
PROP_TYPE
Tunnel type, one of the TYPE_ values below.- See Also:
PROP_FILTER
Path to the streaming filter definition file.- See Also:
PROP_CONFIG_FILE
Configuration file property.- See Also:
PROP_TUN_GZIP
PROP_STARTUP_DELAY_MIN
Configuration property for the minimum startup delay in seconds. Only applies to server tunnels.- See Also:
PROP_STARTUP_DELAY_MAX
Configuration property for the maximum startup delay in seconds. Only applies to server tunnels.- See Also:
DEFAULT_STARTUP_DELAY_MIN
public static final int DEFAULT_STARTUP_DELAY_MINDefault minimum startup delay in seconds.- See Also:
DEFAULT_STARTUP_DELAY_MAX
public static final int DEFAULT_STARTUP_DELAY_MAXDefault maximum startup delay in seconds.- See Also:
PROP_SHUTDOWN_DELAY_MIN
Configuration property for the minimum shutdown delay in seconds. Only applies to server tunnels.- See Also:
PROP_SHUTDOWN_DELAY_MAX
Configuration property for the maximum shutdown delay in seconds. Only applies to server tunnels.- See Also:
DEFAULT_SHUTDOWN_DELAY_MIN
public static final int DEFAULT_SHUTDOWN_DELAY_MINDefault minimum shutdown delay in seconds.- See Also:
DEFAULT_SHUTDOWN_DELAY_MAX
public static final int DEFAULT_SHUTDOWN_DELAY_MAXDefault maximum shutdown delay in seconds.- See Also:
PROP_MAX_CONNS_MIN
Per-source connection limit over a one-minute window.- See Also:
PROP_MAX_CONNS_HOUR
Per-source connection limit over a one-hour window.- See Also:
PROP_MAX_CONNS_DAY
Per-source connection limit over a one-day window.- See Also:
PROP_MAX_TOTAL_CONNS_MIN
Connection limit summed over all sources over a one-minute window.- See Also:
PROP_MAX_TOTAL_CONNS_HOUR
Connection limit summed over all sources over a one-hour window.- See Also:
PROP_MAX_TOTAL_CONNS_DAY
Connection limit summed over all sources over a one-day window.- See Also:
PROP_MAX_STREAMS
Maximum streams open on the tunnel at once.- See Also:
PROP_LIMITS_SET
Set "true" once the user has chosen a limit, so the defaults are not written over it.- See Also:
DEFAULT_MAX_CONNS_MIN
public static final int DEFAULT_MAX_CONNS_MINPer-source connection limit over a one-minute window, used when unset.- See Also:
DEFAULT_MAX_CONNS_HOUR
public static final int DEFAULT_MAX_CONNS_HOURPer-source connection limit over a one-hour window, used when unset.- See Also:
DEFAULT_MAX_CONNS_DAY
public static final int DEFAULT_MAX_CONNS_DAYPer-source connection limit over a one-day window, used when unset.- See Also:
DEFAULT_MAX_TOTAL_CONNS_MIN
public static final int DEFAULT_MAX_TOTAL_CONNS_MINAll-source connection limit over a one-minute window, used when unset.- See Also:
DEFAULT_MAX_TOTAL_CONNS_HOUR
public static final int DEFAULT_MAX_TOTAL_CONNS_HOURAll-source connection limit over a one-hour window, used when unset.- See Also:
DEFAULT_MAX_TOTAL_CONNS_DAY
public static final int DEFAULT_MAX_TOTAL_CONNS_DAYAll-source connection limit over a one-day window, used when unset.- See Also:
DEFAULT_MAX_STREAMS
public static final int DEFAULT_MAX_STREAMSMaximum concurrent streams used when unset.- See Also:
PROP_LIMIT_ACTION
Streaming limit action property.- See Also:
PFX_OPTION
OPT_PERSISTENT
Option keeping the client key across restarts.- See Also:
OPT_BUNDLE_REPLY
Config key to bundle reply keys.- See Also:
OPT_TAGS_SEND
Option setting the transient tags sent per session.- See Also:
OPT_LOW_TAGS
Option setting the low tag replenishment threshold.- See Also:
OPT_SIG_TYPE
Option setting the signature type of the tunnel key.- See Also:
OPT_ALT_PKF
Option naming an alternate private key file.- See Also:
OPT_MAX_CONNS_MIN
Streaming connection limit options.- See Also:
OPT_MAX_CONNS_HOUR
Option limiting connections per hour.- See Also:
OPT_MAX_CONNS_DAY
Option limiting connections per day.- See Also:
OPT_MAX_TOTAL_CONNS_MIN
Option limiting all connections per minute.- See Also:
OPT_MAX_TOTAL_CONNS_HOUR
Option limiting all connections per hour.- See Also:
OPT_MAX_TOTAL_CONNS_DAY
Option limiting all connections per day.- See Also:
OPT_MAX_STREAMS
Option limiting simultaneous streams.- See Also:
OPT_LIMITS_SET
Option marking the connection limits as set.- See Also:
OPT_POST_MAX
Config key for max posts (delegated to HTTPServer).- See Also:
OPT_POST_TOTAL_MAX
Config key for max total posts (delegated to HTTPServer).- See Also:
OPT_LIMIT_ACTION
Option choosing the action when limits are hit.- See Also:
OPT_I2CP_GZIP
Option turning I2CP gzip compression on or off.- See Also:
OPT_ENCTYPE
Option listing the lease set encryption types.- See Also:
OPT_PRIORITY
Option setting the outbound message priority.- See Also:
TYPE_CONNECT
Outbound HTTP CONNECT proxy for tunnelling, optionally via an outproxy.- See Also:
TYPE_HTTP_BIDIR_SERVER
HTTP server that also runs a proxy port on the same destination.- See Also:
TYPE_HTTP_CLIENT
TYPE_HTTP_SERVER
HTTP server forwarding requests to a localhost target, spoofing the Host header.- See Also:
TYPE_IRC_CLIENT
TYPE_IRC_SERVER
IRC server forwarding to a localhost target.- See Also:
TYPE_SOCKS
TYPE_SOCKS_IRC
Outbound SOCKS proxy that also runs the IRC filters over the connection.- See Also:
TYPE_STD_CLIENT
Client listening on a local port and forwarding to a fixed destination.- See Also:
TYPE_STD_SERVER
Server forwarding incoming streams to a localhost host and port.- See Also:
TYPE_STREAMR_CLIENT
Client in the UI and I2P side but a server on the localhost side.- See Also:
TYPE_STREAMR_SERVER
Server in the UI and I2P side but a client on the localhost side.- See Also:
PREFERRED_SIGTYPE
This is guaranteed to be available.
Constructor Details
TunnelController
Create a new controller for a tunnel out of the specific config options. The config may contain a large number of options - only ones that begin in the prefix should be used (and, in turn, that prefix should be stripped off before being interpreted by this controller)If config contains the "configFile" property, it will be set as the config path and may be retrieved with
getConfigFile().Defaults in config properties are not recommended, they may or may not be honored.
- Parameters:
config- original key=value mapping non-nullprefix- beginning of key values that are relevant to this tunnel
TunnelController
Create a new controller for a tunnel out of the specific config options. The config may contain a large number of options - only ones that begin in the prefix should be used (and, in turn, that prefix should be stripped off before being interpreted by this controller)If config contains the "configFile" property, it will be set as the config path and may be retrieved with getConfigFile().
Defaults in config properties are not recommended, they may or may not be honored.
- Parameters:
config- original key=value mapping non-nullprefix- beginning of key values that are relevant to this tunnelcreateKey- for servers, whether we want to create a brand new destination with private keys at the location specified or not (does not overwrite existing ones)
Method Details
getTunnel
The I2PTunnelfor advanced plugin usage.
- Returns:
- the I2PTunnel client built around this controller, which holds the I2CP session and runs the tunnel on
startTunnel()
createPrivateKey
private boolean createPrivateKey()Create a new private key, if no filename is specified or creation fails.- Returns:
- true if the key file already existed or a new one was written
createAltPrivateKey
private boolean createAltPrivateKey()Creates alternate Destination with the same encryption keys as the primary Destination, but a different signing key.Must have already called
createPrivateKey()successfully. Does nothing unless option OPT_ALT_PKF is set with the privkey file name. Does nothing if the file already exists.- Returns:
- true if the alternate key file already existed or a new one was written, false if the option or signature type disallows it
startTunnelBackground
public void startTunnelBackground()Starts the tunnel in a background thread.This method spawns a new thread to start the tunnel, allowing the calling thread to return immediately. The tunnel state transitions to STARTING, and the actual startup is performed in the background thread.
- See Also:
startTunnel
public void startTunnel()Start up the tunnel (if it isn't already running).doStartTunnel
private void doStartTunnel()Configures and controls a single tunnel.Contains persistent configuration (loaded/saved from config file) and runtime state. Used to start, stop, and monitor individual tunnels. Generally one TunnelController per user-configured tunnel, though some (e.g. shared clients) may have multiple.
Bundled under TunnelControllerGroup for storage/loading from single config file. Used by plugins to create tunnels - maintain public methods as stable API.
startHttpClient
private void startHttpClient()Starts an http proxy client tunnel.startConnectClient
private void startConnectClient()Starts a connect client tunnel.startIrcClient
private void startIrcClient()Starts an IRC client tunnel.startSocksClient
private void startSocksClient()Starts a SOCKS proxy client tunnel.startSocksIRCClient
private void startSocksIRCClient()Starts a combined SOCKS and IRC client tunnel.startStreamrClient
private void startStreamrClient()Starts a streaming client tunnel.startStreamrServer
private void startStreamrServer()Streamr server is a UDP client, use the targetPort field for listenPort.acquire
private void acquire()Note the fact that we are using some sessions, so that they don't get closed by some other tunnels.release
Note the fact that we are no longer using some sessions, and if no other tunnels are using them, close them.- Parameters:
sessions- the sessions to release, empty for none
getAllSessions
Get all the sessions we may be using.- Returns:
- a copy, non-null
startClient
private void startClient()Starts a generic client tunnel.startServer
private void startServer()Starts a generic server tunnel.startHttpServer
private void startHttpServer()Starts an http server tunnel.startHttpBidirServer
private void startHttpBidirServer()Starts a bidirectional http server tunnel.startIrcServer
private void startIrcServer()Starts an IRC server tunnel.setListenOn
private void setListenOn()Sets the local address the tunnel listens on.getClientOptionProps
These are the ones stored with a prefix of "option." Defaults in config properties are not honored.- Returns:
- keys with the "option." prefix stripped, non-null Much better than
getClientOptions()
setSessionOptions
private void setSessionOptions()Applies the session-level options to the tunnel.setI2CPOptions
private void setI2CPOptions()Applies the I2CP options from the config to the tunnel.stopTunnel
public void stopTunnel()May be restarted withrestartTunnel()or startTunnel() later. This may not release all resources. In particular, the I2PSocketManager remains and it may have timer threads that continue running.getStartupDelayMin
public int getStartupDelayMin()When combined with a greater startupDelayMax, the tunnel will start with a random delay between min and max seconds.- Returns:
- the minimum startup delay in seconds for server tunnels.
getStartupDelayMax
public int getStartupDelayMax()When combined with a positive startupDelayMin less than this value, the tunnel will start with a random delay between min and max seconds.- Returns:
- the maximum startup delay in seconds for server tunnels.
getShutdownDelayMin
public int getShutdownDelayMin()When combined with a greater shutdownDelayMax, the tunnel will stop with a random delay between min and max seconds during router shutdown.- Returns:
- the minimum shutdown delay in seconds for server tunnels.
getShutdownDelayMax
public int getShutdownDelayMax()When combined with a positive shutdownDelayMin less than this value, the tunnel will stop with a random delay between min and max seconds during router shutdown.- Returns:
- the maximum shutdown delay in seconds for server tunnels.
getDelay
Read a delay option, clamped to non-negative.- Parameters:
key- the config keydef- the default when unset or unparsable- Returns:
- the delay in seconds
getRemainingStartupDelay
public int getRemainingStartupDelay()Get the remaining startup delay time for tunnels with delayed startup.- Returns:
- remaining delay in seconds, or 0 if not in delayed startup state or delay has passed
setStartupDelayEndTime
void setStartupDelayEndTime(long delayMs) Set the startup delay end time. Called byTunnelControllerGroupwhen setting up delayed startup.- Parameters:
delayMs- the delay in milliseconds
destroyTunnel
public void destroyTunnel()May NOT be restarted with restartTunnel() orstartTunnel()later. This should release all resources.restartTunnel
public void restartTunnel()Stops and restarts the tunnel.This method stops the tunnel if running, waits briefly, then starts the tunnel again. The restart is performed synchronously, blocking until complete.
- See Also:
setConfig
Update the options on an existing session.- Parameters:
config- key=value mapping for all tunnels; only the entries whose key starts with prefix are takenprefix- tunnel's key prefix, stripped from the keys it matched; an empty prefix takes config as-is
filterProperties
Copy the properties with the given prefix stripped, or return the given properties unchanged if the prefix is empty.- Parameters:
config- the incoming propertiesprefix- the key prefix to strip- Returns:
- the filtered properties
setServerDefaults
Apply the default options for web server tunnels, including gzip and bundle-reply handling.- Parameters:
type- the tunnel type
setIrcDefaults
Apply the default session tags, enctype, and priority for IRC and streaming tunnels.- Parameters:
type- the tunnel type
setSignatureDefault
Apply the default signature type for tunnels that support it, mirroringEditBean.getSigType(int, String)andGeneralHelper.getSigType(int, String).- Parameters:
type- the tunnel type
setConnectionLimitsDefaults
Apply the default connection and post limits, plus the filter definition and profile, for server tunnels.- Parameters:
type- the tunnel type
setClientDefaults
Apply the default encryption type for HTTP proxy and shared client tunnels.- Parameters:
type- the tunnel type
configChanged
Is property p different in p1 and p2?- Parameters:
p1- the old propertiesp2- the new propertiesp- the property key to compare- Returns:
- true if the value changed or was newly set
getConfig
The tunnel config, with each key prefixed, or a copy if the prefix is empty.- Parameters:
prefix- prepended to every key; an empty prefix copies the keys as-is- Returns:
- a new Properties, never the live config
getConfigFile
The config file as passed into the constructor via the "configFile" property, or as set later.- Returns:
- the config file, or null
setConfigFile
Set the config file. Only do this if previously null.- Parameters:
file- where this tunnel's config was loaded from, for saving later
getType
Returns the tunnel's type as configured.- Returns:
- the type name from the config
getName
getDescription
Returns the tunnel's description.- Returns:
- the free-text description from the config
getI2CPHost
getI2CPPort
getFilter
Absolute path to filter definition file.- Returns:
- the configured filter definition path, or null if no filter is set
isClient
public boolean isClient()Whether this tunnel is a client type in the UI and I2P side.- Returns:
- true if this tunnel is a client type
isClient
Whether the given type is a client type 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.- Parameters:
type- one of the TYPE_ values, or null when unset- Returns:
- false if type == null
getListenOnInterface
The interface the tunnel listens on.- Returns:
- the listen interface
getTargetHost
getTargetPort
getSpoofedHost
The hostname sent in the HTTP Host header when spoofing is enabled.- Returns:
- the spoofed host
getPrivKeyFile
Probably not absolute. May be null.getPrivateKeyFile()recommended.- Returns:
- the priv key file
getListenPort
getTargetDestination
The base64-encoded target destination.- Returns:
- the target destination
getProxyList
The comma-separated list of proxies for the tunnel.- Returns:
- the proxy list
getStartOnLoad
public boolean getStartOnLoad()Whether this tunnel is configured to start when the router starts. Defaults to true when unset.- Returns:
- true if this tunnel starts on router startup
getPersistentClientKey
public boolean getPersistentClientKey()Whether a persistent client key is used.- Returns:
- true if persistent client key is enabled
getPrivateKeyFile
getAlternatePrivateKeyFile
Does not necessarily exist.- Returns:
- absolute path or null if unset
filenameToFile
getMyDestination
getMyDestHashBase32
Get my destination's base32 address.- Returns:
- "{52 chars}.b32.i2p" or null
getDestination
Get the destination from the first session that has one.- Returns:
- Destination or null
getIsOfflineKeys
public boolean getIsOfflineKeys()Check whether the primary session uses offline keys.- Returns:
- true if the primary session has offline keys
getIsOfflineKeysAnySession
private boolean getIsOfflineKeysAnySession()Check whether any session or subsession uses offline keys.- Returns:
- true if ANY session or subsession has offline keys
getIsRunning
public boolean getIsRunning()Checks if the tunnel is currently running.- Returns:
- true if the tunnel state is RUNNING
getIsStarting
public boolean getIsStarting()Checks if the tunnel is starting or starting on load.- Returns:
- true if the tunnel is in the process of starting
getState
The current state of this tunnel.- Returns:
- the current TunnelState
getIsStandby
public boolean getIsStandby()Checks if the tunnel is in standby mode.A tunnel is in standby when it is running but has no open sessions.
- Returns:
- true if the tunnel is running but has no active sessions
changeState
Changes the tunnel state and notifies any waiting threads.- Parameters:
state- the new value forgetState()
log
suppressLog
public void suppressLog()Suppress log messages during tunnel restart.restoreLog
public void restoreLog()Restore log messages after restart.clearMessages
toString