public class I2PTunnel extends EventDispatcherImpl implements Logging
Modifier and Type | Class and Description |
---|---|
static interface |
I2PTunnel.ConnectionEventListener
Callback routine to find out
|
Modifier and Type | Field and Description |
---|---|
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
|
Modifier and Type | Method and Description |
---|---|
void |
addConnectionEventListener(I2PTunnel.ConnectionEventListener lsnr) |
(package private) void |
addSession(I2PSession session) |
static Destination |
destFromName(String name)
Deprecated.
Don't use i2ptunnel for lookup! Use I2PAppContext.getGlobalContext().namingService().lookup(name) from i2p.jar
|
Properties |
getClientOptions()
Generic options used for clients and servers.
|
I2PAppContext |
getContext() |
(package private) 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) |
(package private) void |
removeSession(I2PSession session) |
(package private) void |
routerDisconnected()
Call this whenever we lose touch with the router involuntarily (aka the router
is off / crashed / etc)
|
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) |
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, waitEventValue
public static final int PACKET_DELAY
public boolean ownDest
public String port
public String host
public String listenHost
public long readTimeout
public I2PTunnel()
public I2PTunnel(String[] args)
IllegalArgumentException
public I2PTunnel(String[] args, I2PTunnel.ConnectionEventListener lsnr)
lsnr
- may be nullIllegalArgumentException
public static void main(String[] args)
List<I2PSession> getSessions()
void addSession(I2PSession session)
session
- null okvoid removeSession(I2PSession session)
session
- null okpublic Properties getClientOptions()
public 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 setClientOptions(Properties opts)
opts
- non-nullpublic 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 runIrcServer(String[] args, Logging l)
IllegalArgumentException
- 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 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 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 runClient(String[] args, Logging l)
args
- {portNumber, destinationBase64 or "file:filename"[, sharedClient [, privKeyFile]]}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 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 runIrcClient(String[] args, Logging l)
args
- {portNumber,destinationBase64 or "file:filename" [, sharedClient [, privKeyFile]]}l
- logger to receive events and outputIllegalArgumentException
- 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 runSOCKSIRCTunnel(String[] args, Logging l)
args
- {portNumber [, sharedClient]} or (portNumber, ignored (false), privKeyFile)IllegalArgumentException
- 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 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 runClose(String[] args, Logging l)
args
- {jobNumber}, {"forced", jobNumber}, {"forced", "all"}, {"destroy", jobNumber}, {"destroy", "all"}l
- logger to receive events and outputpublic void log(String s)
@Deprecated public static Destination destFromName(String name) throws DataFormatException
DataFormatException
public void addConnectionEventListener(I2PTunnel.ConnectionEventListener lsnr)
public void removeConnectionEventListener(I2PTunnel.ConnectionEventListener lsnr)
public I2PAppContext getContext()
void routerDisconnected()