|
@ -1,62 +1,7 @@ |
|
|
#!/usr/bin/env python3 |
|
|
#!/usr/bin/env python3 |
|
|
# -*- coding: utf-8 -*- |
|
|
# -*- coding: utf-8 -*- |
|
|
|
|
|
|
|
|
import os |
|
|
mbedtlsMethods = [ # mbedtls methods in shadowsocks-python |
|
|
import yaml |
|
|
|
|
|
|
|
|
|
|
|
# Global Options |
|
|
|
|
|
Version = 'dev' |
|
|
|
|
|
|
|
|
|
|
|
ApiPath = '/' |
|
|
|
|
|
ApiPort = 7839 |
|
|
|
|
|
ApiToken = '' |
|
|
|
|
|
|
|
|
|
|
|
CheckThread = 64 |
|
|
|
|
|
|
|
|
|
|
|
LogLevel = 'INFO' |
|
|
|
|
|
LogFile = 'runtime.log' |
|
|
|
|
|
|
|
|
|
|
|
DnsServer = None |
|
|
|
|
|
WorkDir = '/tmp/ProxyC' |
|
|
|
|
|
TestHost = 'proxyc.net' |
|
|
|
|
|
TestSite = 'www.bing.com' |
|
|
|
|
|
PathEnv = '/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin' |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Load Env Options |
|
|
|
|
|
envOptions = {} |
|
|
|
|
|
try: |
|
|
|
|
|
yamlFile = os.path.join(os.path.dirname(os.path.realpath(__file__)), '../env.yaml') |
|
|
|
|
|
yamlContent = open(yamlFile, 'r', encoding = 'utf-8').read() |
|
|
|
|
|
envOptions = yaml.load(yamlContent, Loader = yaml.FullLoader) |
|
|
|
|
|
except: # something error in env.yaml |
|
|
|
|
|
pass |
|
|
|
|
|
if 'version' in envOptions: |
|
|
|
|
|
Version = envOptions['version'] |
|
|
|
|
|
if 'loglevel' in envOptions: |
|
|
|
|
|
LogLevel = envOptions['loglevel'] |
|
|
|
|
|
if 'dir' in envOptions: |
|
|
|
|
|
WorkDir = envOptions['dir'] |
|
|
|
|
|
if 'dns' in envOptions: |
|
|
|
|
|
DnsServer = envOptions['dns'] |
|
|
|
|
|
if 'api' in envOptions: |
|
|
|
|
|
if 'port' in envOptions['api']: |
|
|
|
|
|
ApiPort = envOptions['api']['port'] |
|
|
|
|
|
if 'path' in envOptions['api']: |
|
|
|
|
|
ApiPath = envOptions['api']['path'] |
|
|
|
|
|
if 'token' in envOptions['api']: |
|
|
|
|
|
ApiToken = envOptions['api']['token'] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# WorkDir Create |
|
|
|
|
|
try: |
|
|
|
|
|
os.makedirs(WorkDir) # just like `mkdir -p ...` |
|
|
|
|
|
except: |
|
|
|
|
|
pass # folder exist or target is another thing |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Shadowsocks Info |
|
|
|
|
|
mbedtlsMethods = [ |
|
|
|
|
|
'aes-128-cfb128', |
|
|
'aes-128-cfb128', |
|
|
'aes-192-cfb128', |
|
|
'aes-192-cfb128', |
|
|
'aes-256-cfb128', |
|
|
'aes-256-cfb128', |
|
@ -126,32 +71,9 @@ ssMethods = { # methods support of different Shadowsocks project |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
ssAllMethods = set() |
|
|
ssAllMethods = set() |
|
|
[ssAllMethods.update(ssMethods[x]) for x in ssMethods] |
|
|
[ssAllMethods.update(x) for _, x in ssMethods.items()] |
|
|
ssAllMethods = sorted(list(ssAllMethods)) # methods of Shadowsocks |
|
|
ssAllMethods = sorted(list(ssAllMethods)) # methods of Shadowsocks |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Plugin Info |
|
|
|
|
|
Plugins = { |
|
|
|
|
|
'simple-obfs': ['obfs-local', 'obfs-server'], |
|
|
|
|
|
'simple-tls': ['simple-tls'], |
|
|
|
|
|
'v2ray': ['v2ray-plugin'], |
|
|
|
|
|
'xray': ['xray-plugin'], |
|
|
|
|
|
'kcptun': ['kcptun-client', 'kcptun-server'], |
|
|
|
|
|
'gost': ['gost-plugin'], |
|
|
|
|
|
'cloak': ['ck-client', 'ck-server'], |
|
|
|
|
|
'go-quiet': ['gq-client', 'gq-server'], |
|
|
|
|
|
'mos-tls-tunnel': ['mtt-client', 'mtt-server'], |
|
|
|
|
|
'rabbit': ['rabbit-plugin', 'rabbit'], |
|
|
|
|
|
'qtun': ['qtun-client', 'qtun-server'], |
|
|
|
|
|
'gun': ['gun-plugin'], |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Plugins = {x: [Plugins[x][0], Plugins[x][1 if len(Plugins[x]) == 2 else 0]] for x in Plugins} |
|
|
|
|
|
Plugins = {x: {'client': Plugins[x][0], 'server': Plugins[x][1]} for x in Plugins} # format plugins info |
|
|
|
|
|
pluginClients = [Plugins[x]['client'] for x in Plugins] # plugin client list -> obfs-local / simple-tls / ... |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# ShadowsocksR Info |
|
|
|
|
|
ssrMethods = [ # methods of ShadowsocksR |
|
|
ssrMethods = [ # methods of ShadowsocksR |
|
|
'aes-128-ctr', 'aes-192-ctr', 'aes-256-ctr', |
|
|
'aes-128-ctr', 'aes-192-ctr', 'aes-256-ctr', |
|
|
'aes-128-gcm', 'aes-192-gcm', 'aes-256-gcm', |
|
|
'aes-128-gcm', 'aes-192-gcm', 'aes-256-gcm', |
|
@ -178,21 +100,3 @@ ssrObfuscations = [ # obfuscations of ShadowsocksR (obfs) |
|
|
'plain', 'http_post', 'http_simple', 'random_head', |
|
|
'plain', 'http_post', 'http_simple', 'random_head', |
|
|
'tls_simple', 'tls1.2_ticket_auth', 'tls1.2_ticket_fastauth', |
|
|
'tls_simple', 'tls1.2_ticket_auth', 'tls1.2_ticket_fastauth', |
|
|
] |
|
|
] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# V2ray / Xray Info |
|
|
|
|
|
vmessMethods = ['aes-128-gcm', 'chacha20-poly1305', 'auto', 'none', 'zero'] |
|
|
|
|
|
|
|
|
|
|
|
quicMethods = ['none', 'aes-128-gcm', 'chacha20-poly1305'] |
|
|
|
|
|
udpObfuscations = ['none', 'srtp', 'utp', 'wechat-video', 'dtls', 'wireguard'] |
|
|
|
|
|
|
|
|
|
|
|
xtlsFlows = ['xtls-origin', 'xtls-direct', 'xtls-splice'] |
|
|
|
|
|
xtlsFlows = {x: x.replace('-', '-rprx-') for x in xtlsFlows} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Trojan-Go Info |
|
|
|
|
|
trojanGoMethods = ['aes-128-gcm', 'aes-256-gcm', 'chacha20-ietf-poly1305'] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Hysteria Info |
|
|
|
|
|
hysteriaProtocols = ['udp', 'wechat-video', 'faketcp'] |
|
|
|