tunnels

Tunnel and connection forwarding internals.

If you’re looking for simple, end-user-focused connection forwarding, please see Connection, e.g. Connection.forward_local.

class fabric.tunnels.Tunnel(channel, sock, finished)

Bidirectionally forward data between an SSH channel and local socket.

New in version 2.0.

read_and_write(reader, writer, chunk_size)

Read chunk_size from reader, writing result to writer.

Returns None if successful, or True if the read was empty.

New in version 2.0.

class fabric.tunnels.TunnelManager(local_host, local_port, remote_host, remote_port, transport, finished)

Thread subclass for tunnelling connections over SSH between two endpoints.

Specifically, one instance of this class is sufficient to sit around forwarding any number of individual connections made to one end of the tunnel or the other. If you need to forward connections between more than one set of ports, you’ll end up instantiating multiple TunnelManagers.

Wraps a Transport, which should already be connected to the remote server.

New in version 2.0.