def load_config(): if len(sys.argv) > 2 and sys.argv[1] == "-f": config_path = sys.argv[2] else: config_path = os.path.join(data_xtunnel_path, 'client.json') xlog.info("use config_path:%s", config_path) config = xconfig.Config(config_path) config.set_var("log_level", "DEBUG") config.set_var("write_log_file", 0) config.set_var("encrypt_data", 0) config.set_var("encrypt_password", "encrypt_pass") config.set_var("encrypt_method", "aes-256-cfb") config.set_var("api_server", "center.xx-net.net") config.set_var("server_host", "") config.set_var("server_port", 0) config.set_var("use_https", 1) config.set_var("port_range", 1) config.set_var("login_account", "") config.set_var("login_password", "") config.set_var("conn_life", 30) config.set_var("socks_host", "127.0.0.1") config.set_var("socks_port", 1080) # performance parameters # range 2 - 100 config.set_var("concurent_thread_num", 50) # range 1 - 1000 config.set_var("send_delay", 10) # max 10M config.set_var("block_max_size", 256 * 1024) # range 1 - 60 config.set_var("roundtrip_timeout", 10) config.set_var("network_timeout", 10) config.set_var("windows_size", 32 * 1024 * 1024) config.load() config.windows_ack = 0.05 * config.windows_size xlog.info("X-Tunnel window:%d", config.windows_size) if config.write_log_file: xlog.log_to_file(os.path.join(data_path, "client.log")) xlog.setLevel(config.log_level) g.config = config
def load_config(): global g if not os.path.isdir(data_path): os.mkdir(data_path) config_path = os.path.join(data_path, 'config.json') config = xconfig.Config(config_path) config.set_var("dns_port", 53) config.set_var("redirect_port", 8083) config.set_var("bind_ip", "127.0.0.1") config.set_var("cache_size", 200) config.set_var("ttl", 24 * 3600) config.set_var("redirect_to", "x_tunnel") config.load() g.config = config
def load_config(): global g if not os.path.isdir(data_path): os.mkdir(data_path) config_path = os.path.join(data_path, 'config.json') config = xconfig.Config(config_path) config.set_var("PROXY_ENABLE", 0) config.set_var("PROXY_TYPE", "HTTP") config.set_var("PROXY_HOST", "") config.set_var("PROXY_PORT", 0) config.set_var("PROXY_USER", "") config.set_var("PROXY_PASSWD", "") config.set_var("dns_bind_ip", "127.0.0.1") config.set_var("dns_port", 53) config.set_var("dns_backup_port", 8053) config.set_var("proxy_bind_ip", "127.0.0.1") config.set_var("proxy_port", 8086) config.set_var("dns_cache_size", 200) config.set_var("pip_cache_size", 32 * 1024) config.set_var("ip_cache_size", 1000) config.set_var("dns_ttl", 60 * 30) config.set_var("direct_split_SNI", 1) config.set_var("pac_policy", "black_X-Tunnel") config.set_var("country_code", "CN") config.set_var("auto_direct", 1) config.set_var("auto_direct6", 0) config.set_var("auto_gae", 1) config.set_var("enable_fake_ca", 1) config.set_var("block_advertisement", 1) config.set_var("log_debug", 0) config.load() if config.PROXY_ENABLE: xlog.info("use LAN proxy:%s://%s:%d/", config.PROXY_TYPE, config.PROXY_HOST, config.PROXY_PORT) g.config = config
def load_config(): global g if not os.path.isdir(data_path): os.mkdir(data_path) config_path = os.path.join(data_path, 'config.json') config = xconfig.Config(config_path) config.set_var("PROXY_ENABLE", 0) config.set_var("PROXY_TYPE", "HTTP") config.set_var("PROXY_HOST", "") config.set_var("PROXY_PORT", 0) config.set_var("PROXY_USER", "") config.set_var("PROXY_PASSWD", "") config.set_var("dns_bind_ip", "127.0.0.1") config.set_var("dns_port", 53) config.set_var("proxy_bind_ip", "127.0.0.1") config.set_var("proxy_port", 8086) config.set_var("dns_cache_size", 200) config.set_var("pip_cache_size", 16*1024) config.set_var("ip_cache_size", 1000) config.set_var("dns_ttl", 24*3600) config.set_var("direct_split_SNI", 1) config.set_var("pac_policy", "black_GAE") config.set_var("country_code", "CN") config.set_var("auto_direct", True) config.set_var("auto_gae", True) config.load() if config.PROXY_ENABLE: xlog.info("use LAN proxy:%s://%s:%d/", config.PROXY_TYPE, config.PROXY_HOST, config.PROXY_PORT) g.config = config
def load_config(): if len(sys.argv) > 2 and sys.argv[1] == "-f": config_path = sys.argv[2] else: config_path = os.path.join(data_xtunnel_path, 'client.json') xlog.info("use config_path:%s", config_path) config = xconfig.Config(config_path) config.set_var("log_level", "DEBUG") config.set_var("write_log_file", 0) config.set_var("encrypt_data", 0) config.set_var("encrypt_password", "encrypt_pass") config.set_var("encrypt_method", "aes-256-cfb") config.set_var("api_server", "http://center.xx-net.net:8888/") config.set_var("server_host", "") config.set_var("server_port", 0) config.set_var("use_https", 0) config.set_var("port_range", 1) config.set_var("login_account", "") config.set_var("login_password", "") # can use gae_proxy "127.0.0.1", 8087 config.set_var("http_proxy_host", "127.0.0.1") config.set_var("http_proxy_port", 8087) config.set_var("conn_life", 30) config.set_var("socks_host", "127.0.0.1") config.set_var("socks_port", 1080) # performance parameters # range 2 - 100 config.set_var("concurent_thread_num", 20) # range 1 - 1000 config.set_var("send_delay", 100) # max 10M config.set_var("block_max_size", 256 * 1024) # range 1 - 60 config.set_var("roundtrip_timeout", 120) config.load() config.windows_size = config.block_max_size * config.concurent_thread_num config.windows_ack = 0.2 * config.windows_size if config.write_log_file: xlog.log_to_file(os.path.join(data_path, "client.log")) xlog.setLevel(config.log_level) g.config = config if g.config.http_proxy_host and g.config.http_proxy_port: xlog.info("Use proxy:%s:%d", g.config.http_proxy_host, g.config.http_proxy_port) g.proxy = (g.config.http_proxy_host, g.config.http_proxy_port) else: g.proxy = None
def load_config(): if len(sys.argv) > 2 and sys.argv[1] == "-f": config_path = sys.argv[2] else: config_path = os.path.join(data_xtunnel_path, 'client.json') xlog.info("use config_path:%s", config_path) config = xconfig.Config(config_path) config.set_var("log_level", "DEBUG") config.set_var("write_log_file", 0) config.set_var("encrypt_data", 0) config.set_var("encrypt_password", "encrypt_pass") config.set_var("encrypt_method", "aes-256-cfb") config.set_var("api_server", "center.xx-net.net") config.set_var("scan_servers", ["scan1"]) config.set_var("server_host", "") config.set_var("server_port", 443) config.set_var("use_https", 1) config.set_var("port_range", 1) config.set_var("login_account", "") config.set_var("login_password", "") config.set_var("conn_life", 30) config.set_var("socks_host", "127.0.0.1") config.set_var("socks_port", 1080) # performance parameters # range 2 - 100 config.set_var("concurent_thread_num", 50) # min roundtrip on road if connectoin exist config.set_var("min_on_road", 1) # range 1 - 1000, ms config.set_var("send_delay", 30) # range 1 - 20000, ms config.set_var("resend_timeout", 5000) # range 1 - resend_timeout, ms config.set_var("ack_delay", 300) # max 10M config.set_var("max_payload", 128 * 1024) # range 1 - 30 config.set_var("roundtrip_timeout", 25) config.set_var("network_timeout", 10) config.set_var("windows_size", 16 * 1024 * 1024) # reporter config.set_var("timeout_threshold", 2) config.set_var("enable_gae_proxy", 1) config.set_var("enable_cloudflare", 1) config.set_var("enable_cloudfront", 0) config.set_var("enable_heroku", 0) config.set_var("enable_tls_relay", 1) config.set_var("enable_direct", 0) config.load() config.windows_ack = 0.05 * config.windows_size xlog.info("X-Tunnel window:%d", config.windows_size) if config.write_log_file: xlog.log_to_file(os.path.join(data_path, "client.log")) xlog.setLevel(config.log_level) xlog.set_buffer(500) g.config = config
import json import sys_platform from simple_http_client import request import xconfig from xlog import getLogger xlog = getLogger("launcher") current_path = os.path.dirname(os.path.abspath(__file__)) version_path = os.path.abspath(os.path.join(current_path, os.pardir)) root_path = os.path.abspath(os.path.join(version_path, os.pardir, os.pardir)) data_path = os.path.join(root_path, 'data') config_path = os.path.join(data_path, 'launcher', 'config.json') config = xconfig.Config(config_path) config.set_var("control_ip", "127.0.0.1") config.set_var("control_port", 8085) # System config config.set_var("language", "") # en_US, config.set_var("allow_remote_connect", 0) config.set_var("show_systray", 1) config.set_var("show_android_notification", 1) config.set_var("no_mess_system", 0) config.set_var("auto_start", 0) config.set_var("popup_webui", 1) config.set_var("gae_show_detail", 0) config.set_var("show_compat_suggest", 1)