public interface TcpTunnel
A tunnel sits between a client and a server, forwarding data in both directions. For example a SOCKS proxy is a TCP tunnel.
This interface is from the client's perspective.
The client first establishes a `connection` to the tunnel's address()
,
then calls tunnelTo(connection, host, port)
to instruct it to tunnel to the server.
Abstract Methods | |
---|---|
TcpAddress |
address()
The address of the tunnel service.
|
Async<TcpConnection> |
tunnelTo(TcpConnection connection,
String host,
int port)
Tunnel to the remote host:port.
|
TcpAddress address()
If address.ssl
==true,
traffic between the client and the tunnel must be encrypted in SSL.
Async<TcpConnection> tunnelTo(TcpConnection connection, String host, int port)
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.