x2go.forward module

Python Gevent based port forwarding server (openssh -L option) for the proxying of graphical X2Go elements.

class x2go.forward.X2GoFwServer(listener, remote_host, remote_port, ssh_transport, session_instance=None, session_name=None, subsystem=None, logger=None, loglevel=56)[source]

Bases: gevent.server.StreamServer

x2go.forward.X2GoFwServer implements a gevent’s StreamServer based Paramiko/SSH port forwarding server.

An x2go.forward.X2GoFwServer class object is used to tunnel graphical trafic through an external proxy command launched by a X2GoProxy* backend.


Close an open channel again.


Close the forwarding tunnel’s socket again.


Stop the forwarding tunnel.

x2go_forward_tunnel_handle(fw_socket, address)[source]

Handle for SSH/Paramiko forwarding tunnel.

  • fw_socket (obj) – local end of the forwarding tunnel
  • address (tuple) – unused/ignored
x2go.forward.start_forward_tunnel(local_host='', local_port=22022, remote_host='', remote_port=22, ssh_transport=None, session_instance=None, session_name=None, subsystem=None, logger=None)[source]

Setup up a Paramiko/SSH port forwarding tunnel (like openssh -L option).

The tunnel is used to transport X2Go graphics data through a proxy application like nxproxy.

  • local_host (int) – local starting point of the forwarding tunnel (Default value = ‘’)
  • local_port (int) – listen port of the local starting point (Default value = 22022)
  • remote_host (str) – from the endpoint of the tunnel, connect to host <remote_host>... (Default value = ‘’)
  • remote_port (int) – on port <remote_port> (Default value = 22)
  • ssh_transport (obj) – the Paramiko/SSH transport (i.e. the X2Go session’s Paramiko/SSH transport object) (Default value = None)
  • session_instance (obj) – the x2go.session.X2GoSession instance that initiates this tunnel (Default value = None)
  • session_name (str) – the session name of the X2Go session this port forwarding server belongs to (Default value = None)
  • subsystem (str) – a custom string with a component name that tries to evoke a new tunnel setup (Default value = None)
  • logger (obj) – an X2GoLogger object (Default value = None)

returns an x2go.forward.X2GoFwServer instance

Return type:



Tear down a given Paramiko/SSH port forwarding tunnel.

Parameters:fw_server (obj) – an x2go.forward.X2GoFwServer instance as returned by the L{start_forward_tunnel()} function