public class I2PTunnelServer extends I2PTunnelTask implements Runnable
Modifier and Type | Field and Description |
---|---|
protected static long |
__serverId
apparently unused
|
protected ThreadPoolExecutor |
_clientExecutor |
protected Log |
_log |
protected boolean |
bidir |
protected I2PServerSocket |
i2pss |
protected Logging |
l |
protected int |
localPort |
static String |
PROP_ALT_PKF |
static String |
PROP_UNIQUE_LOCAL |
static String |
PROP_USE_SSL |
protected long |
readTimeout
default timeout to 5 minutes - override if desired
|
protected InetAddress |
remoteHost |
protected int |
remotePort |
protected Object |
slock |
protected I2PSocketManager |
sockMgr |
protected Object |
sslLock |
protected I2PTunnelTask |
task |
open
Constructor and Description |
---|
I2PTunnelServer(InetAddress host,
int port,
File privkey,
String privkeyname,
Logging l,
EventDispatcher notifyThis,
I2PTunnel tunnel)
Non-blocking
|
I2PTunnelServer(InetAddress host,
int port,
I2PSocketManager sktMgr,
Logging l,
EventDispatcher notifyThis,
I2PTunnel tunnel)
Non-blocking
|
I2PTunnelServer(InetAddress host,
int port,
InputStream privData,
String privkeyname,
Logging l,
EventDispatcher notifyThis,
I2PTunnel tunnel)
Non-blocking
|
I2PTunnelServer(InetAddress host,
int port,
String privData,
Logging l,
EventDispatcher notifyThis,
I2PTunnel tunnel)
Non-blocking
|
Modifier and Type | Method and Description |
---|---|
protected void |
blockingHandle(I2PSocket socket)
This is run in a thread from a limited-size thread pool via Handler.run(),
except for a standard server (this class, no extension, as determined in getUsePool()),
it is run directly in the acceptor thread (see run()).
|
boolean |
close(boolean forced)
Note that the tunnel can be reopened after this by calling startRunning().
|
boolean |
destroy()
Note that the tunnel cannot be reopened after this by calling startRunning(),
as it will destroy the underlying socket manager.
|
protected int |
getHandlerCount() |
long |
getReadTimeout()
Get the read idle timeout for newly-created connections (in
milliseconds).
|
protected Socket |
getSocket(Hash from,
InetAddress remoteHost,
int remotePort)
Get a regular or SSL socket depending on config.
|
protected Socket |
getSocket(Hash from,
int incomingPort)
Get a regular or SSL socket depending on config and the incoming port.
|
void |
optionsUpdated(I2PTunnel tunnel)
Update the I2PSocketManager.
|
void |
run()
If usePool is set, this starts the executor pool.
|
void |
setReadTimeout(long ms)
Set the read idle timeout for newly-created connections (in
milliseconds).
|
boolean |
shouldUsePool() |
void |
startRunning()
Start running the I2PTunnelServer.
|
connected, disconnected, errorOccurred, getId, getTunnel, isOpen, reportAbuse, routerDisconnected, setId, setName, setTunnel, toString
attachEventDispatcher, detachEventDispatcher, getEventDispatcher, getEvents, getEventValue, ignoreEvents, notifyEvent, unIgnoreEvents, waitEventValue
protected final Log _log
protected final I2PSocketManager sockMgr
protected volatile I2PServerSocket i2pss
protected final Object slock
protected final Object sslLock
protected InetAddress remoteHost
protected int remotePort
protected final Logging l
protected long readTimeout
public static final String PROP_USE_SSL
public static final String PROP_UNIQUE_LOCAL
public static final String PROP_ALT_PKF
protected static volatile long __serverId
protected I2PTunnelTask task
protected boolean bidir
protected volatile ThreadPoolExecutor _clientExecutor
protected int localPort
public I2PTunnelServer(InetAddress host, int port, String privData, Logging l, EventDispatcher notifyThis, I2PTunnel tunnel)
privData
- Base64-encoded private key data,
format is specified in PrivateKeyFile
IllegalArgumentException
- if the I2CP configuration is b0rked so
badly that we cant create a socketManagerpublic I2PTunnelServer(InetAddress host, int port, File privkey, String privkeyname, Logging l, EventDispatcher notifyThis, I2PTunnel tunnel)
privkey
- file containing the private key data,
format is specified in PrivateKeyFile
privkeyname
- the name of the privKey file, just for loggingIllegalArgumentException
- if the I2CP configuration is b0rked so
badly that we cant create a socketManagerpublic I2PTunnelServer(InetAddress host, int port, InputStream privData, String privkeyname, Logging l, EventDispatcher notifyThis, I2PTunnel tunnel)
privData
- stream containing the private key data,
format is specified in PrivateKeyFile
privkeyname
- the name of the privKey file, just for loggingIllegalArgumentException
- if the I2CP configuration is b0rked so
badly that we cant create a socketManagerpublic I2PTunnelServer(InetAddress host, int port, I2PSocketManager sktMgr, Logging l, EventDispatcher notifyThis, I2PTunnel tunnel)
sktMgr
- the existing socket managerpublic void startRunning()
IllegalArgumentException
- if the I2CP configuration is b0rked so
badly that we cant create a socketManagerpublic void setReadTimeout(long ms)
public long getReadTimeout()
public boolean close(boolean forced)
close
in class I2PTunnelTask
public boolean destroy()
destroy
in class I2PTunnelTask
public void optionsUpdated(I2PTunnel tunnel)
optionsUpdated
in class I2PTunnelTask
protected int getHandlerCount()
public void run()
public boolean shouldUsePool()
protected void blockingHandle(I2PSocket socket)
protected Socket getSocket(Hash from, int incomingPort) throws IOException
from
- may be used to construct local address since 0.9.13IOException
protected Socket getSocket(Hash from, InetAddress remoteHost, int remotePort) throws IOException
from
- may be used to construct local address since 0.9.13IOException