def __init__(self, host, port=None, protocol=None, security_policy=None, logger=None, reactor=None): logger = logger or log.get_default() or log.FluLogKeeper() log.LogProxy.__init__(self, logger) log.Logger.__init__(self, logger) self.reactor = reactor or treactor self._host = host self._port = port self._security_policy = security.ensure_policy(security_policy) if self._security_policy.use_ssl: self._http_scheme = http.Schemes.HTTPS else: self._http_scheme = http.Schemes.HTTP if self._port is None: if self._http_scheme is http.Schemes.HTTP: self._port = 80 if self._http_scheme is http.Schemes.HTTPS: self._port = 443 proto = self.default_http_protocol if protocol is None else protocol self._http_protocol = proto self._protocol = None self._pending = 0 self.log_name = '%s:%d (%s)' % ( self._host, self._port, self._http_scheme.name)
def __init__(self, host, port=None, protocol=None, security_policy=None, logger=None): logger = logger if logger is not None else log.FluLogKeeper() log.LogProxy.__init__(self, logger) log.Logger.__init__(self, logger) self._host = host self._port = port self._security_policy = security.ensure_policy(security_policy) if self._security_policy.use_ssl: self._http_scheme = http.Schemes.HTTPS else: self._http_scheme = http.Schemes.HTTP if self._port is None: if self._http_scheme is http.Schemes.HTTP: self._port = 80 if self._http_scheme is http.Schemes.HTTPS: self._port = 443 proto = self.default_http_protocol if protocol is None else protocol self._http_protocol = proto self._protocol = None self._pending = 0
def __init__(self, root, port_range=None, hostname=None, static_path=None, security_policy=None, log_keeper=None, label=None, web_statistics=None, interface=''): log.Logger.__init__(self, self) log.LogProxy.__init__(self, log_keeper or log.get_default()) self._root = root self._label = label if not static_path: from feat.configure import configure static_path = configure.gatewaydir self._static_path = static_path tmp_range = port_range if isinstance(tmp_range, int): tmp_range = (tmp_range, tmp_range) try: min_port, max_port = tmp_range if not (isinstance(min_port, int) and isinstance(max_port, int) and min_port <= max_port): raise ValueError() self._ports = (min_port, max_port) except ValueError: raise ValueError("Invalid gateway port/range specified: %r" % (port_range, )) self._host = hostname or socket.gethostbyaddr(socket.gethostname())[0] self._security = security.ensure_policy(security_policy) self._server = None self._interface = interface self._statistics = (web_statistics and webserver.IWebStatistics(web_statistics))
def __init__(self, log_keeper, port_range, dispatcher, public_host=None, version=None, registry=None, server_security_policy=None, client_security_policy=None, max_delay=None): base.RangeServer.__init__(self, port_range, hostname=public_host, security_policy=server_security_policy, log_keeper=log_keeper) self._dispatcher = ITunnelDispatcher(dispatcher) ### protected attributes, used by Peer and/or Request ### ver = version if version is not None else feat.version self._version = int(ver) self._registry = registry self._client_security = security.ensure_policy(client_security_policy) self._uri = None self._retries = {} # {PEER_KEY: IDelayedCall} self._delays = {} # {PEER_KEY: DELAY} self._quarantined = set([]) # set([PEER_KEY]) self._pendings = {} # {PEER_KEY: [(DEFERRED, PATH, DATA, EXPIRATION)]} self._peers = {} # {KEY: Peer} self._max_delay = max_delay or type(self).max_delay
def __init__(self, root, port_range=None, security_policy=None): log.Logger.__init__(self, self) log.LogProxy.__init__(self, root) self._root = root self._ports = port_range self._security = security.ensure_policy(security_policy) self._server = None
def __init__(self, agency, port_range=None, static_path=None, security_policy=None): log.Logger.__init__(self, self) log.LogProxy.__init__(self, agency) self._agency = agency if not static_path: static_path = os.path.join(os.path.dirname(__file__), "static") self._static_path = static_path self._host = socket.gethostbyaddr(socket.gethostname())[0] self._ports = port_range self._security = security.ensure_policy(security_policy) self._server = None
def __init__(self, log_keeper, port_range, dispatcher, public_host=None, version=None, registry=None, server_security_policy=None, client_security_policy=None): log.LogProxy.__init__(self, log_keeper) log.Logger.__init__(self, log_keeper) if public_host is None: public_host = socket.gethostbyaddr(socket.gethostname())[0] if isinstance(port_range, int): port_range = [port_range] self._port_range = port_range self._dispatcher = ITunnelDispatcher(dispatcher) self._public_host = public_host ### protected attributes, used by Peer and/or Request ### ver = version if version is not None else feat.version self._version = int(ver) self._registry = registry self._scheme = None self._server_security = security.ensure_policy(server_security_policy) self._client_security = security.ensure_policy(client_security_policy) self._server = httpserver.Factory(self, self) self._server.request_factory_class = RequestFactory self._port = None self._uri = None self._retries = {} # {PEER_KEY: IDelayedCall} self._delays = {} # {PEER_KEY: DELAY} self._quarantined = set([]) # set([PEER_KEY]) self._pendings = {} # {PEER_KEY: [(DEFERRED, PATH, DATA, EXPIRATION)]} self._peers = {} # {KEY: Peer}
def __init__(self, port_or_range, hostname=None, security_policy=None, log_keeper=None): log_keeper = log_keeper or log.get_default() or log.FluLogKeeper() log.LogProxy.__init__(self, log_keeper) log.Logger.__init__(self, log_keeper) if hostname is None: hostname = socket.gethostbyaddr(socket.gethostname())[0] if isinstance(port_or_range, int): port_range = [port_or_range] else: port_range = port_or_range self._hostname = hostname self._port_range = port_range self._scheme = None self._security = security.ensure_policy(security_policy) self._factory = None self._port = None