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.

__init__(channel, sock, finished)

Create a new exception-handling thread instance.

Takes all regular threading.Thread keyword arguments, via **kwargs for easier display of thread identity when raising captured exceptions.

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.

__init__(local_host, local_port, remote_host, remote_port, transport, finished)

Create a new exception-handling thread instance.

Takes all regular threading.Thread keyword arguments, via **kwargs for easier display of thread identity when raising captured exceptions.