public class I2PTunnel extends EventDispatcherImpl implements Logging
Typically one of each. TODO: Poor error propagation as most events aren't listened to elsewhere.
| Modifier and Type | Class and Description |
|---|---|
static interface |
I2PTunnel.ConnectionEventListener
Callback routine to find out
|
| Modifier and Type | Field and Description |
|---|---|
String |
filterDefinition
Absolute path to filter definition file
|
String |
host
the I2CP host, non-null
|
String |
listenHost
the listen-on host.
|
boolean |
ownDest |
static int |
PACKET_DELAY |
String |
port
the I2CP port, non-null
|
long |
readTimeout |
| Constructor and Description |
|---|
I2PTunnel()
Standard constructor for embedded, uses args "-nocli -die" to return immediately
|
I2PTunnel(String[] args)
See usage() for options
|
I2PTunnel(String[] args,
I2PTunnel.ConnectionEventListener lsnr)
See usage() for options
|
I2PTunnel(TunnelController tc)
New standard constructor in router, with back ref to tc
|
| Modifier and Type | Method and Description |
|---|---|
void |
addConnectionEventListener(I2PTunnel.ConnectionEventListener lsnr)
Registers a listener for connection events.
|
(package private) void |
addSession(I2PSession session) |
Properties |
getClientOptions()
Generic options used for clients and servers.
|
I2PAppContext |
getContext()
Gets the application context.
|
(package private) TunnelController |
getController()
TunnelController that constructed this, or null.
|
List<I2PSession> |
getSessions() |
void |
log(String s)
Log the given message (using both the logging subsystem and standard output...)
|
static void |
main(String[] args) |
void |
removeConnectionEventListener(I2PTunnel.ConnectionEventListener lsnr)
Unregisters a connection event listener.
|
(package private) void |
removeSession(I2PSession session) |
(package private) void |
routerDisconnected()
Called when the router disconnects unexpectedly.
|
void |
runClient(String[] args,
Logging l)
Run the client on the given port number pointing at the specified destination
(either the base64 of the destination or file:fileNameContainingDestination).
|
void |
runClientOptions(String[] args,
Logging l)
Configure the extra I2CP options to use in any subsequent I2CP sessions.
|
void |
runClose(String[] args,
Logging l)
Close the given task (or all tasks), optionally forcing them to die a hard
death
Sets the event "closeResult" = "ok" after the closing is complete
|
void |
runCommand(String cmd,
Logging l)
Parses and executes a tunnel management command.
|
void |
runConnectClient(String[] args,
Logging l)
Run a CONNECT client on the given port number
|
void |
runHttpBidirServer(String[] args,
Logging l)
Run the HTTP server pointing at the host and port specified using the private i2p
destination loaded from the specified file, replacing the HTTP headers
so that the Host: specified is the one spoofed.
|
void |
runHttpClient(String[] args,
Logging l)
Run an HTTP client on the given port number
Sets the event "httpclientTaskId" = Integer(taskId) after the tunnel has been started (or -1 on error).
|
void |
runHttpServer(String[] args,
Logging l)
Run the HTTP server pointing at the host and port specified using the private i2p
destination loaded from the specified file, replacing the HTTP headers
so that the Host: specified is the one spoofed.
|
void |
runIrcClient(String[] args,
Logging l)
Run an IRC client on the given port number
Sets the event "ircclientTaskId" = Integer(taskId) after the tunnel has been started (or -1 on error).
|
void |
runIrcServer(String[] args,
Logging l)
Same args as runServer
(we should stop duplicating all this code...)
|
void |
runListenOn(String[] args,
Logging l)
Specify the hostname / IP address of the interface that the tunnels should bind to
Sets the event "listen_onResult" = "ok" or "error" after the interface has been specified
|
void |
runReadTimeout(String[] args,
Logging l)
Specify the read timeout going to be used for newly-created I2PSockets
Sets the event "read_timeoutResult" = "ok" or "error" after the interface has been specified
|
void |
runServer(String[] args,
Logging l)
Run the server pointing at the host and port specified using the private i2p
destination loaded from the specified file.
|
void |
runSOCKSIRCTunnel(String[] args,
Logging l)
Run an SOCKS IRC tunnel on the given port number
|
void |
runSOCKSTunnel(String[] args,
Logging l)
Run an SOCKS tunnel on the given port number
Sets the event "sockstunnelTaskId" = Integer(taskId) after the
tunnel has been started (or -1 on error).
|
void |
runStreamrClient(String[] args,
Logging l)
Streamr client
|
void |
runStreamrServer(String[] args,
Logging l)
Streamr server
|
void |
runTextServer(String[] args,
Logging l)
Run the server pointing at the host and port specified using the private i2p
destination loaded from the given base64 stream.
|
void |
setClientOptions(Properties opts)
Generic options used for clients and servers.
|
attachEventDispatcher, detachEventDispatcher, getEventDispatcher, getEvents, getEventValue, ignoreEvents, notifyEvent, unIgnoreEvents, waitEventValuepublic String filterDefinition
public String host
public String listenHost
public volatile boolean ownDest
public static final int PACKET_DELAY
public String port
public long readTimeout
public I2PTunnel()
public I2PTunnel(String[] args)
IllegalArgumentExceptionpublic I2PTunnel(String[] args, I2PTunnel.ConnectionEventListener lsnr)
lsnr - may be nullIllegalArgumentExceptionpublic I2PTunnel(TunnelController tc)
tc - may be nullIllegalArgumentExceptionpublic void addConnectionEventListener(I2PTunnel.ConnectionEventListener lsnr)
The listener will be notified of router disconnection events.
lsnr - the listener to add; ignored if nullvoid addSession(I2PSession session)
session - null okpublic Properties getClientOptions()
public I2PAppContext getContext()
TunnelController getController()
public List<I2PSession> getSessions()
public void log(String s)
public static void main(String[] args)
public void removeConnectionEventListener(I2PTunnel.ConnectionEventListener lsnr)
lsnr - the listener to remove; ignored if nullvoid removeSession(I2PSession session)
session - null okvoid routerDisconnected()
This method notifies all registered ConnectionEventListeners that the router connection has been lost.
public void runClient(String[] args, Logging l)
args - {portNumber, destinationBase64 or "file:filename"[, sharedClient [, privKeyFile]]}l - logger to receive events and outputIllegalArgumentException - on config problempublic void runClientOptions(String[] args, Logging l)
args - each args[i] is a key=value pair to add to the optionsl - logger to receive events and outputpublic void runClose(String[] args, Logging l)
args - {jobNumber}, {"forced", jobNumber}, {"forced", "all"}, {"destroy", jobNumber}, {"destroy", "all"}l - logger to receive events and outputpublic void runCommand(String cmd, Logging l)
This method is the command dispatcher for tunnel management operations. It parses the command string into command name and arguments, then dispatches to the appropriate handler method.
Supported Commands:
cmd - the command string to execute, format: "commandName arg1 arg2 ..."l - the Logging instance for command outputrunHelp(Logging)public void runConnectClient(String[] args, Logging l)
args - {portNumber[, sharedClient][, proxy to be used for the WWW]}l - logger to receive events and outputIllegalArgumentException - on config problempublic void runHttpBidirServer(String[] args, Logging l)
Sets the event "serverTaskId" = Integer(taskId) after the tunnel has been started (or -1 on error) Also sets the event "openServerResult" = "ok" or "error" (displaying "Ready!" on the logger after 'ok'). So, success = serverTaskId != -1 and openServerResult = ok.
args - {hostname, portNumber, proxyPortNumber, spoofedHost, privKeyFilename}l - logger to receive events and outputIllegalArgumentException - on config problempublic void runHttpClient(String[] args, Logging l)
args - {portNumber[, sharedClient][, proxy to be used for the WWW]}l - logger to receive events and outputIllegalArgumentException - on config problempublic void runHttpServer(String[] args, Logging l)
Sets the event "serverTaskId" = Integer(taskId) after the tunnel has been started (or -1 on error) Also sets the event "openServerResult" = "ok" or "error" (displaying "Ready!" on the logger after 'ok'). So, success = serverTaskId != -1 and openServerResult = ok.
args - {hostname, portNumber, spoofedHost, privKeyFilename}l - logger to receive events and outputIllegalArgumentException - on config problempublic void runIrcClient(String[] args, Logging l)
args - {portNumber,destinationBase64 or "file:filename" [, sharedClient [, privKeyFile]]}l - logger to receive events and outputIllegalArgumentException - on config problempublic void runIrcServer(String[] args, Logging l)
IllegalArgumentException - on config problempublic void runListenOn(String[] args, Logging l)
args - {hostname}l - logger to receive events and outputpublic void runReadTimeout(String[] args, Logging l)
args - {hostname}l - logger to receive events and outputpublic void runServer(String[] args, Logging l)
Sets the event "serverTaskId" = Integer(taskId) after the tunnel has been started (or -1 on error) Also sets the event "openServerResult" = "ok" or "error" (displaying "Ready!" on the logger after 'ok'). So, success = serverTaskId != -1 and openServerResult = ok.
args - {hostname, portNumber, privKeyFilename}l - logger to receive events and outputIllegalArgumentException - on config problempublic void runSOCKSIRCTunnel(String[] args, Logging l)
args - {portNumber [, sharedClient]} or (portNumber, ignored (false), privKeyFile)IllegalArgumentException - on config problempublic void runSOCKSTunnel(String[] args, Logging l)
args - {portNumber [, sharedClient]} or (portNumber, ignored (false), privKeyFile)l - logger to receive events and outputIllegalArgumentException - on config problempublic void runStreamrClient(String[] args, Logging l)
args - {targethost, targetport, destinationString}l - logger to receive events and outputIllegalArgumentException - on config problempublic void runStreamrServer(String[] args, Logging l)
args - {port, privkeyfile}l - logger to receive events and outputIllegalArgumentException - on config problempublic void runTextServer(String[] args, Logging l)
Deprecated? Why run a server with a private destination? Not available from the war GUI Sets the event "serverTaskId" = Integer(taskId) after the tunnel has been started (or -1 on error) Also sets the event "openServerResult" = "ok" or "error" (displaying "Ready!" on the logger after 'ok'). So, success = serverTaskId != -1 and openServerResult = ok.
args - {hostname, portNumber, privKeyBase64}l - logger to receive events and outputIllegalArgumentException - on config problempublic void setClientOptions(Properties opts)
opts - non-null