|
@ -1,6 +1,8 @@ |
|
|
#!/usr/bin/python |
|
|
#!/usr/bin/python |
|
|
# -*- coding:utf-8 -*- |
|
|
# -*- coding:utf-8 -*- |
|
|
|
|
|
|
|
|
|
|
|
config = {} |
|
|
|
|
|
|
|
|
ssrMethodList = [ |
|
|
ssrMethodList = [ |
|
|
"aes-128-cfb", |
|
|
"aes-128-cfb", |
|
|
"aes-192-cfb", |
|
|
"aes-192-cfb", |
|
@ -71,57 +73,43 @@ ssrObfsList = [ |
|
|
"random_head", |
|
|
"random_head", |
|
|
] |
|
|
] |
|
|
|
|
|
|
|
|
def test(port, password): |
|
|
def __ssrServerConfig(method: str, protocol: str, obfs: str, caption: str) -> list: |
|
|
testList = [] |
|
|
|
|
|
for method in ssrMethodList: |
|
|
|
|
|
proxyInfo = { |
|
|
proxyInfo = { |
|
|
'type': 'ssr', |
|
|
'type': 'ssr', |
|
|
'server': '127.0.0.1', |
|
|
'server': '127.0.0.1', |
|
|
'port': int(port), |
|
|
'port': config['port'], |
|
|
'password': password, |
|
|
'passwd': config['passwd'], |
|
|
'method': method, |
|
|
'method': method, |
|
|
'protocol': 'origin', |
|
|
|
|
|
'protocolParam': '', |
|
|
|
|
|
'obfs': 'plain', |
|
|
|
|
|
'obfsParam': '' |
|
|
|
|
|
} |
|
|
|
|
|
serverCommand = [ |
|
|
|
|
|
'ssr-server', |
|
|
|
|
|
'-p', str(port), |
|
|
|
|
|
'-k', password, |
|
|
|
|
|
'-m', method, |
|
|
|
|
|
'-O', 'origin', |
|
|
|
|
|
'-o', 'plain' |
|
|
|
|
|
] |
|
|
|
|
|
testList.append({ |
|
|
|
|
|
'caption': 'ShadowsocksR method ' + method, |
|
|
|
|
|
'proxyInfo': proxyInfo, |
|
|
|
|
|
'serverCommand': serverCommand |
|
|
|
|
|
}) |
|
|
|
|
|
for protocol in ssrProtocolList: |
|
|
|
|
|
for obfs in ssrObfsList: |
|
|
|
|
|
proxyInfo = { |
|
|
|
|
|
'type': 'ssr', |
|
|
|
|
|
'server': '127.0.0.1', |
|
|
|
|
|
'port': int(port), |
|
|
|
|
|
'password': password, |
|
|
|
|
|
'method': 'table', |
|
|
|
|
|
'protocol': protocol, |
|
|
'protocol': protocol, |
|
|
'protocolParam': '', |
|
|
'obfs': obfs |
|
|
'obfs': obfs, |
|
|
|
|
|
'obfsParam': '' |
|
|
|
|
|
} |
|
|
} |
|
|
serverCommand = [ |
|
|
serverCommand = [ |
|
|
'ssr-server', |
|
|
'ssr-server', |
|
|
'-p', str(port), |
|
|
'-p', str(config['port']), |
|
|
'-k', password, |
|
|
'-k', config['passwd'], |
|
|
'-m', 'table', |
|
|
'-m', method, |
|
|
'-O', protocol, |
|
|
'-O', protocol, |
|
|
'-o', obfs |
|
|
'-o', obfs |
|
|
] |
|
|
] |
|
|
testList.append({ |
|
|
return [{ |
|
|
'caption': 'ShadowsocksR protocol ' + protocol + ' obfs ' + obfs, |
|
|
'caption': caption, |
|
|
'proxyInfo': proxyInfo, |
|
|
'proxy': proxyInfo, |
|
|
'serverCommand': serverCommand |
|
|
'server': { |
|
|
}) |
|
|
'startCommand': serverCommand, |
|
|
return testList |
|
|
'fileContent': None, |
|
|
|
|
|
'filePath': None, |
|
|
|
|
|
'envVar': {} |
|
|
|
|
|
}, |
|
|
|
|
|
'aider': None |
|
|
|
|
|
}] |
|
|
|
|
|
|
|
|
|
|
|
def ssrTest(ssrConfig: dict) -> list: |
|
|
|
|
|
result = [] |
|
|
|
|
|
for key, value in ssrConfig.items(): # ssrConfig -> config |
|
|
|
|
|
config[key] = value |
|
|
|
|
|
for method in ssrMethodList: # all ShadowsocksR methods |
|
|
|
|
|
result += __ssrServerConfig(method, 'origin', 'plain', 'ShadowsocksR method ' + method) |
|
|
|
|
|
for protocol in ssrProtocolList: # all ShadowsocksR protocol and obfs |
|
|
|
|
|
for obfs in ssrObfsList: |
|
|
|
|
|
result += __ssrServerConfig('table', protocol, obfs, 'ShadowsocksR protocol ' + protocol + ' obfs ' + obfs) |
|
|
|
|
|
return result |
|
|