Ejemplo n.º 1
0
 def __init__(self, config):
     Backend = import_backend(config).ServerBackend
     self.backend = Backend(**config['backend'])
     self.new_frontend = import_frontend(config)
     self.key = config['key']
     # tunnels dictionary, in which values are dictionaries of the
     # connections belong to it. Those dictionaries' key is the
     # Connection ID and value is the frontend instance.
     self.tunnels = ObjectDict()
     # dictionary of frontend instances, in which keys are the
     # frontend instances and values are tuples of their
     # corresponding Connection IDs and tunnel one belongs to.
     self.frontends = ObjectDict()
Ejemplo n.º 2
0
 def __init__(self, config):
     Backend = import_backend(config).ServerBackend
     self.backend = Backend(**config['backend'])
     self.new_frontend = import_frontend(config)
     self.key = config['key']
     # tunnels dictionary, in which values are dictionaries of the
     # connections belong to it. Those dictionaries' key is the
     # Connection ID and value is the frontend instance.
     self.tunnels = ObjectDict()
     # dictionary of frontend instances, in which keys are the
     # frontend instances and values are tuples of their
     # corresponding Connection IDs and tunnel one belongs to.
     self.frontends = ObjectDict()
Ejemplo n.º 3
0
 def __init__(self, config):
     self.local_conn = Connection(socket.socket(), -1)
     # read config
     if 'address' in config:
         self.address = config['address']
     if 'port' in config:
         self.port = config['port']
     # initialize local port
     self.local_conn.conn.setsockopt(
             socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
     self.local_conn.bind((self.address, self.port))
     self.local_conn.listen(10)
     # initialize backend & record layer
     Backend = import_backend(config).ClientBackend
     self.backend = Backend(**config['backend'])
     self.record_conn = RecordConnection(config['key'], self.backend)
     self.tunnel = TunnelConnection(self.record_conn)
     # initialize connection dict
     self.conns = {}
Ejemplo n.º 4
0
 def __init__(self, config):
     self.local_conn = Connection(socket.socket(), -1)
     # read config
     if 'address' in config:
         self.address = config['address']
     if 'port' in config:
         self.port = config['port']
     # initialize local port
     self.local_conn.conn.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR,
                                     1)
     self.local_conn.bind((self.address, self.port))
     self.local_conn.listen(10)
     # initialize backend & record layer
     Backend = import_backend(config).ClientBackend
     self.backend = Backend(**config['backend'])
     self.record_conn = RecordConnection(config['key'], self.backend)
     self.tunnel = TunnelConnection(self.record_conn)
     # initialize connection dict
     self.conns = {}