java.lang.Object
net.i2p.util.EventDispatcherImpl
net.i2p.i2ptunnel.I2PTunnelTask
net.i2p.i2ptunnel.I2PTunnelClientBase
net.i2p.i2ptunnel.socks.I2PSOCKSTunnel
net.i2p.i2ptunnel.socks.I2PSOCKSIRCTunnel
- All Implemented Interfaces:
Runnable, EventDispatcher
SOCKS tunnel specialized for IRC traffic with I2P filtering and security.
This class extends I2PSOCKSTunnel to provide IRC-specific filtering through I2PTunnelIRCClient filters, combining the flexibility of SOCKS (dynamic destination specification) with IRC security features. It applies inbound and outbound IRC filters to protect against common IRC attacks and ensure proper IRC protocol handling.
This allows users to connect to any IRC server through I2P without pre-configuring individual tunnels for each server, while maintaining the security benefits of IRC-specific filtering.
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final AtomicIntegerHands out the client number for each new connection.Fields inherited from class I2PSOCKSTunnel
AUTH_REALM, DEFAULT, INITIAL_SO_TIMEOUT, PROP_OUTPROXY_TYPE, PROP_PROXY_DEFAULT, PROP_PROXY_PREFIXModifier and TypeFieldDescriptionstatic final StringThe HTTP auth realm presented to clients that authenticate.static final StringThe key used for the default (first) proxy.protected static final intThis is a standard soTimeout, not a total timeout.static final StringThe property naming the outproxy type ("none", "HTTP", "SOCKS", "SOCKS4a").static final StringThe full property name of the default proxy.static final StringPrefix of the per-port proxy property names.Fields inherited from class I2PTunnelClientBase
_clientId, _context, _executor, _log, _ownDest, DEFAULT_MAX_CONNECTIONS, DEFAULT_SOCKET_OPEN_TIMEOUT, dest, l, listenerReady, mySockets, PROP_MAX_CONNECTIONS, PROP_USE_SSL, sockLock, sockMgr, ssModifier and TypeFieldDescriptionprotected longThis client's ID.protected final I2PAppContextThe application context.protected ThreadPoolExecutorThread pool executor.protected final LogThe logger.protected booleanWhether we own our destination.static final intDefault cap on concurrently handled client connections.static final longDefault socket open timeout in ms, after whichI2PTunnelClientBase.close(boolean)will proceed even with active sockets.protected DestinationThe destination.protected final LoggingThe logging instance.protected booleanProtected for I2Ping since 0.9.11.List of active sockets.static final StringProperty name: max concurrently active client connections handled by one client tunnel.static final StringProperty turning on SSL between the proxy and the client.protected final ObjectGuards sockMgr and mySockets.protected I2PSocketManagerThe socket manager.protected ServerSocketServer socket.Constructor Summary
ConstructorsConstructorDescriptionI2PSOCKSIRCTunnel(int localPort, Logging l, boolean ownDest, EventDispatcher notifyThis, I2PTunnel tunnel, String pkf) Construct a SOCKS IRC tunnel.Method Summary
All MethodsModifier and TypeMethodDescriptionprotected voidSame as inI2PSOCKSTunnel, but run the filters from I2PTunnelIRCClient instead of I2PTunnelRunner.Methods inherited from class I2PSOCKSTunnel
buildOptions, getDefaultProxies, getProxies, getProxyMap, optionsUpdatedModifier and TypeMethodDescriptionbuildOptions(Properties overrides) Build socket options from the tunnel config merged with overrides.Get the default proxy list.getProxies(int port) Gets the proxy list for a specific port.Gets the proxy map for all configured ports.voidoptionsUpdated(I2PTunnel tunnel) Update the outproxy list then call super.Methods inherited from class I2PTunnelClientBase
buildSocketManager, buildSocketManager, buildSocketManager, buildSocketManager, close, closeSocket, createI2PSocket, createI2PSocket, createI2PSocket, destroy, getDefaultOptions, getDefaultOptions, getListenHost, getLocalPort, getSocketManager, getSocketManager, getSocketOpenTimeout, manageConnection, poolIsDefinitivelyDown, poolState, run, startRunning, verifySocketManager, writeShedResponseModifier and TypeMethodDescriptionprotected I2PSocketManagerFor NON-SHARED clients (ownDest = true).protected static I2PSocketManagerbuildSocketManager(I2PTunnel tunnel) Create a disconnected socket manager for the tunnel, with no private key file.protected static I2PSocketManagerbuildSocketManager(I2PTunnel tunnel, String pkf) Create a disconnected socket manager for the tunnel, loading the persistent client dest from pkf if it is non-null.protected static I2PSocketManagerbuildSocketManager(I2PTunnel tunnel, String pkf, Logging log) Create a disconnected socket manager for the tunnel, loading the persistent client dest from pkf if it is non-null, and logging any key file error to log.booleanclose(boolean forced) Note that the tunnel can be reopened after this by calling startRunning().static voidClose a socket silently.createI2PSocket(Destination dest) Create a new I2PSocket towards to the specified destination, adding it to the list of connections actually managed by this tunnel.createI2PSocket(Destination dest, int port) Create a new I2PSocket towards to the specified destination, adding it to the list of connections actually managed by this tunnel.createI2PSocket(Destination dest, I2PSocketOptions opt) Create a new I2PSocket towards to the specified destination, adding it to the list of connections actually managed by this tunnel.booleandestroy()Note that the tunnel cannot be reopened after this by calling startRunning(), as it will destroy the underlying socket manager.protected I2PSocketOptionsCreate the default options (using the default timeout, etc).protected I2PSocketOptionsgetDefaultOptions(Properties overrides) Create the default options (using the default timeout, etc).protected final InetAddressGet the listen host address.final intGet the local port.Returns the I2PSocketManager for this task.protected static I2PSocketManagergetSocketManager(I2PTunnel tunnel, String pkf) This is ONLY for shared clients.longReturns the socket open timeout in ms; close() will proceed after this even with active sockets.protected voidManage the connection just opened on the specified socket.protected booleanAnd none are being built, so further connect retries cannot succeed.protected intRouter-context only, best-effort check of the client outbound tunnel pool.voidrun()Non-final since 0.9.11.voidActually open the local socket and start working on incoming connections.protected voidCreate the manager if it doesn't exist, AND connect it to the router and build tunnels.protected voidBest-effort shed response on the browser-facing socket, then close it.Methods inherited from class I2PTunnelTask
connected, disconnected, errorOccurred, getBooleanOption, getId, getTunnel, isOpen, reportAbuse, routerDisconnected, setId, setName, setTunnel, toStringModifier and TypeMethodDescriptionvoidconnected(I2PSession session) For tasks that don't callI2PTunnel.addSession(I2PSession)directly.voiddisconnected(I2PSession session) Called when a session is disconnected.voiderrorOccurred(I2PSession session, String message, Throwable error) Does nothing here.protected booleangetBooleanOption(String opt, boolean dflt) Read a boolean client option from the tunnel's properties.intgetId()The id of the client list entry for this task.The I2PTunnel this task runs inside.booleanisOpen()Whether the tunnel is running and accepting connections.voidreportAbuse(I2PSession session, int severity) Does nothing here.protected voidTell the tunnel that the router connection has dropped.voidsetId(int id) Record the client list entry id for this task.protected voidRecord the display name for this task.voidRebind this task to a different tunnel.toString()The display name given to this task when it was constructed.Methods inherited from class EventDispatcherImpl
attachEventDispatcher, detachEventDispatcher, getEventDispatcher, getEvents, getEventValue, ignoreEvents, notifyEvent, unIgnoreEvents, waitEventValueModifier and TypeMethodDescriptionvoidAttach an EventDispatcher object to the events dispatching chain.voidDetach the specified EventDispatcher object from the events dispatching chain.Object to be used to deliver events (usuallythis, but YMMV).Retrieve the names of all the events that have been received.getEventValue(String name) Retrieve the value currently associated with the specified event value.voidIgnore further event notifications.voidnotifyEvent(String eventName, Object args) Deliver an event.voidAlmost like the method above :-).waitEventValue(String name) Wait until the given event has received a value.
Field Details
__clientId
Hands out the client number for each new connection.
Constructor Details
I2PSOCKSIRCTunnel
public I2PSOCKSIRCTunnel(int localPort, Logging l, boolean ownDest, EventDispatcher notifyThis, I2PTunnel tunnel, String pkf) Construct a SOCKS IRC tunnel.- Parameters:
localPort- the local port to listen onl- the logging instanceownDest- true if the tunnel has its own destinationnotifyThis- the event dispatcher for notificationstunnel- the I2P tunnelpkf- private key file name or null for transient key
Method Details
clientConnectionRun
Same as inI2PSOCKSTunnel, but run the filters from I2PTunnelIRCClient instead of I2PTunnelRunner.- Overrides:
clientConnectionRunin classI2PSOCKSTunnel- Parameters:
s- the socket to manage