def socket_parms_parser(self, server): data = Storage() # defaults port = Env.listener_tls_port data.scheme = "h2" data.tls = True data.encrypted = False data.server = server if server.startswith("https://"): host = server[8:] data.context = self.get_cluster_context() elif server.startswith("raw://"): data.tls = False data.scheme = "raw" data.encrypted = True port = Env.listener_port host = server[6:] elif "://" in server: scheme = server.split("://", 1)[0] raise ex.Error("unknown scheme '%s'. use 'raw' or 'https'" % scheme) try: addr, port = host.split(":", 1) port = int(port) except: addr = host data.af = socket.AF_INET data.to = (addr, port) data.to_s = "%s:%d" % data.to return data
def socket_parms_ux_raw(self, server): data = Storage() data.scheme = "raw" data.af = socket.AF_UNIX data.to = Env.paths.lsnruxsock data.to_s = Env.paths.lsnruxsock data.encrypted = False data.server = server data.context = None return data
def socket_parms_from_context(self, server): if not has_ssl: raise ex.Error("tls1.2 capable ssl module is required but not available") data = Storage() context = get_context() addr = context["cluster"]["addr"] port = context["cluster"]["port"] data.context = context data.scheme = "h2" data.af = socket.AF_INET data.to = (addr, port) data.to_s = "%s:%d" % (addr, port) data.encrypted = False data.tls = True data.server = server return data