Package x2go :: Package backends :: Package proxy :: Module base :: Class X2GoProxyBASE
[frames] | no frames]

Class X2GoProxyBASE

source code

        object --+        
                 |        
threading._Verbose --+    
                     |    
      threading.Thread --+
                         |
                        X2GoProxyBASE
Known Subclasses:

X2GoProxy is an abstract class for X2Go proxy connections.

This class needs to be inherited from a concrete proxy class. Only currently available proxy class is: X2GoProxyNX3.

Instance Methods
 
__init__(self, session_info=None, ssh_transport=None, session_log='session.log', sessions_rootdir='/sbuild-nonexistent/.x2go', proxy_options={}, session_instance=None, logger=None, loglevel=56)
This constructor should always be called with keyword arguments.
source code
 
__del__(self)
On instance destruction make sure this proxy thread is stopped properly.
source code
 
stop_thread(self)
End the thread runner and tidy up.
source code
 
run(self)
Start the X2Go proxy command.
source code
 
process_proxy_options(self)
Override this method to incorporate elements from proxy_options into actual proxy subprocess execution.
source code
obj
start_proxy(self)
Start the thread runner and wait for the proxy to come up.
source code
 
ok(self)
Check if a proxy instance is up and running.
source code

Inherited from threading.Thread: __repr__, getName, isAlive, isDaemon, is_alive, join, setDaemon, setName, start

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables
  PROXY_CMD = ''
Proxy command.
  PROXY_ARGS = []
Arguments to be passed to the proxy command.
  PROXY_ENV = {}
Provide environment variables to the proxy command.
  session_info = None
  session_log_stdout = None
  session_log_stderr = None
  fw_tunnel = None
  proxy = None
Properties

Inherited from threading.Thread: daemon, ident, name

Inherited from object: __class__

Method Details

__init__(self, session_info=None, ssh_transport=None, session_log='session.log', sessions_rootdir='/sbuild-nonexistent/.x2go', proxy_options={}, session_instance=None, logger=None, loglevel=56)
(Constructor)

source code 

This constructor should always be called with keyword arguments. Arguments are:

*group* should be None; reserved for future extension when a ThreadGroup class is implemented.

*target* is the callable object to be invoked by the run() method. Defaults to None, meaning nothing is called.

*name* is the thread name. By default, a unique name is constructed of the form "Thread-N" where N is a small decimal number.

*args* is the argument tuple for the target invocation. Defaults to ().

*kwargs* is a dictionary of keyword arguments for the target invocation. Defaults to {}.

If a subclass overrides the constructor, it must make sure to invoke the base class constructor (Thread.__init__()) before doing anything else to the thread.

Parameters:
  • session_info (X2GoServerSessionInfo* instance) - session information provided as an X2GoServerSessionInfo* backend instance
  • ssh_transport (paramiko.Transport instance) - SSH transport object from paramiko.SSHClient
  • session_log (str) - name of the proxy's session logfile
  • sessions_rootdir (str) - base dir where X2Go session files are stored (by default: ~/.x2go)
  • proxy_options (dict) - a set of very X2GoProxy* backend specific options; any option that is not known to the X2GoProxy* backend will simply be ignored
  • logger (X2GoLogger instance) - you can pass an X2GoLogger object to the X2GoProxy constructor
  • session_instance (X2GoSession instance) - the X2GoSession instance this X2GoProxy* instance belongs to
  • loglevel (int) - if no X2GoLogger object has been supplied a new one will be constructed with the given loglevel
Overrides: object.__init__

run(self)

source code 

Start the X2Go proxy command. The X2Go proxy command utilizes a Paramiko/SSH based forwarding tunnel (openssh -L option). This tunnel gets started here and is forked into background (Greenlet/gevent).

Overrides: threading.Thread.run

process_proxy_options(self)

source code 

Override this method to incorporate elements from proxy_options into actual proxy subprocess execution.

This method (if overridden) should (by design) never fail nor raise an exception. Make sure to catch all possible errors appropriately.

If you want to log ignored proxy_options then

  1. remove processed proxy_options from self.proxy_options
  2. once you have finished processing the proxy_options call the parent class method X2GoProxyBASE.process_proxy_options()

start_proxy(self)

source code 

Start the thread runner and wait for the proxy to come up.

Returns: obj
a subprocess instance that knows about the externally started proxy command.

ok(self)

source code 

Check if a proxy instance is up and running.

Returns:
Proxy state, True for proxy being up-and-running, False otherwise @rtype bool

Class Variable Details

PROXY_CMD

Proxy command. Needs to be set by a potential child class, might be OS specific.

Value:
''

PROXY_ARGS

Arguments to be passed to the proxy command. This needs to be set by a potential child class.

Value:
[]

PROXY_ENV

Provide environment variables to the proxy command. This also needs to be set by a child class.

Value:
{}