Constructor and Description |
---|
Socks5Tunnel(TcpAddress address,
boolean remoteDns,
Supplier<Async<UserPass>> userPassSupplier)
Create a SOCKS5 tunnel.
|
Socks5Tunnel(String host,
int port,
String username,
String password)
Create a SOCK5 tunnel.
|
Socks5Tunnel(String host,
int port)
Create a SOCK5 tunnel.
|
Instance Methods | |
---|---|
TcpAddress |
address()
The address of the tunnel service.
|
Async<TcpConnection> |
tunnelTo(TcpConnection tcpConn,
String host,
int port)
Tunnel to the remote host:port.
|
public Socks5Tunnel(TcpAddress address, boolean remoteDns, Supplier<Async<UserPass>> userPassSupplier)
If remoteDns==true, `host` in tunnelTo()
is sent to the tunnel service to be resolved there;
otherwise, `host` is resolved by local DNS, and the IP address is sent to the tunnel.
See "ATYP" in RFC1928 §4.
If userPassSupplier!=null, username/password authentication is supported.
public Socks5Tunnel(String host, int port, String username, String password)
This is convenience method for
Socks5Tunnel(address, remoteDns, userPassSupplier)
with address.ssl=false, remoteDns=false.
public Socks5Tunnel(String host, int port)
This is convenience method for
Socks5Tunnel(address, remoteDns, userPassSupplier)
with address.ssl=false, remoteDns=false, userPassSupplier=null.
public TcpAddress address()
TcpTunnel
If address.ssl
==true,
traffic between the client and the tunnel must be encrypted in SSL.
public Async<TcpConnection> tunnelTo(TcpConnection tcpConn, String host, int port)
TcpTunnel
The `connection` is established between the client and the tunnel service. The implementation of this method does necessary protocol dance to instruct the tunnel service to tunnel to the server (at host:port).
When this action succeeds, the resulting TcpConnection is used by the client to communicate to the server, as if it's a direct connection. The resulting TcpConnection could be the same object as the `connection` argument.