class SOCKS5Server extends SOCKSServer
This class handles SOCKS version 5 protocol including authentication (username/password and no-auth), multiple address types (IPv4, IPv6, domain), and extended commands including Tor RESOLVE for hostname resolution. It supports UDP ASSOCIATE commands and provides outproxy connectivity through both SOCKS and HTTP CONNECT methods.
The server includes security features like localhost blocking, IP-to-domain mapping, and integrates with I2P naming service for destination resolution. It also supports torsocks compatibility through hostname caching mechanisms.
Supports torsocks as of 0.9.57._context, _log, addressType, clientSock, connHostName, connPort, props| Constructor and Description |
|---|
SOCKS5Server(I2PAppContext ctx,
Socket clientSock,
Properties props)
Create a SOCKS5 server that communicates with the client using
the specified socket.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
confirmConnection()
Confirm to the client that the connection has succeeded
|
Socket |
getClientSocket()
Get a socket that can be used to send/receive 8-bit clean data
to/from the client.
|
I2PSocket |
getDestinationI2PSocket(I2PSOCKSTunnel t)
Get an I2PSocket that can be used to send/receive 8-bit clean data
to/from the destination of the SOCKS connection.
|
void |
httpsConnect(I2PSocket destSock,
OutputStream pout,
String connHostName,
int connPort,
String configUser,
String configPW)
Act as a https client to connect to a CONNECT outproxy.
|
protected void |
setupServer()
Perform server initialization (expecially regarding protected
variables).
|
getMappedDomainNameForIP, getOutproxyPluginpublic SOCKS5Server(I2PAppContext ctx, Socket clientSock, Properties props)
clientSock - client socketprops - non-nullprotected void confirmConnection()
throws SOCKSException
SOCKSServerconfirmConnection in class SOCKSServerSOCKSExceptionpublic Socket getClientSocket() throws SOCKSException
SOCKSServergetClientSocket in class SOCKSServerSOCKSExceptionpublic I2PSocket getDestinationI2PSocket(I2PSOCKSTunnel t) throws SOCKSException
getDestinationI2PSocket in class SOCKSServerSOCKSExceptionpublic void httpsConnect(I2PSocket destSock, OutputStream pout, String connHostName, int connPort, String configUser, String configPW) throws IOException
destSock - socket to the proxypout - output stream to the proxyconnHostName - hostname or IP for the proxy to connect toconnPort - port for the proxy to connect toconfigUser - username unsupportedconfigPW - password unsupportedIOExceptionprotected void setupServer()
throws SOCKSException
SOCKSServersetupServer in class SOCKSServerSOCKSException