def main(args): global ready load_config() front_dispatcher.init() g.data_path = data_path xlog.info("xxnet_version:%s", xxnet_version()) g.running = True if not g.server_host or not g.server_port: if g.config.server_host and g.config.server_port == 443: xlog.info("Session Server:%s:%d", g.config.server_host, g.config.server_port) g.server_host = g.config.server_host g.server_port = g.config.server_port g.balance = 99999999 elif g.config.api_server: pass else: xlog.debug("please check x-tunnel server in config") g.http_client = front_dispatcher g.session = proxy_session.ProxySession() allow_remote = args.get("allow_remote", 0) if allow_remote: listen_ip = "0.0.0.0" else: listen_ip = g.config.socks_host g.socks5_server = simple_http_server.HTTPServer((listen_ip, g.config.socks_port), Socks5Server, logger=xlog) xlog.info("Socks5 server listen:%s:%d.", g.config.socks_host, g.config.socks_port) ready = True g.socks5_server.serve_forever()
def main(args): global ready g.xxnet_version = xxnet_version() load_config() front_dispatcher.init() g.data_path = data_path xlog.info("xxnet_version:%s", g.xxnet_version) g.running = True if not g.server_host or not g.server_port: if g.config.server_host and g.config.server_port == 443: xlog.info("Session Server:%s:%d", g.config.server_host, g.config.server_port) g.server_host = g.config.server_host g.server_port = g.config.server_port g.balance = 99999999 elif g.config.api_server: pass else: xlog.debug("please check x-tunnel server in config") g.http_client = front_dispatcher g.session = proxy_session.ProxySession() allow_remote = args.get("allow_remote", 0) listen_ips = g.config.socks_host if isinstance(listen_ips, basestring): listen_ips = [listen_ips] else: listen_ips = list(listen_ips) if allow_remote and ("0.0.0.0" not in listen_ips or "::" not in listen_ips): listen_ips.append("0.0.0.0") addresses = [(listen_ip, g.config.socks_port) for listen_ip in listen_ips] g.socks5_server = simple_http_server.HTTPServer(addresses, Socks5Server, logger=xlog) xlog.info("Socks5 server listen:%s:%d.", g.config.socks_host, g.config.socks_port) ready = True g.socks5_server.serve_forever()
def main(args): global ready g.xxnet_version = xxnet_version() load_config() front_dispatcher.init() g.data_path = data_path xlog.info("xxnet_version:%s", g.xxnet_version) g.running = True if not g.server_host or not g.server_port: if g.config.server_host and g.config.server_port == 443: xlog.info("Session Server:%s:%d", g.config.server_host, g.config.server_port) g.server_host = g.config.server_host g.server_port = g.config.server_port g.balance = 99999999 elif g.config.api_server: pass else: xlog.debug("please check x-tunnel server in config") g.http_client = front_dispatcher g.session = proxy_session.ProxySession() allow_remote = args.get("allow_remote", 0) listen_ips = g.config.socks_host if isinstance(listen_ips, basestring): listen_ips = [listen_ips] else: listen_ips = list(listen_ips) if allow_remote and ("0.0.0.0" not in listen_ips or "::" not in listen_ips): listen_ips.append("0.0.0.0") addresses = [(listen_ip, g.config.socks_port) for listen_ip in listen_ips] g.socks5_server = simple_http_server.HTTPServer(addresses, Socks5Server, logger=xlog) xlog.info("Socks5 server listen:%s:%d.", g.config.socks_host, g.config.socks_port) ready = True g.socks5_server.serve_forever()