Browse Source

feat: shadowsocksr of ProxyTester

master
Dnomd343 3 years ago
parent
commit
cc274eb5b7
  1. 74
      ProxyTester/ShadowsocksR.py
  2. 3
      ProxyTester/tester.py

74
ProxyTester/ShadowsocksR.py

@ -1,6 +1,8 @@
#!/usr/bin/python
# -*- coding:utf-8 -*-
config = {}
ssrMethodList = [
"aes-128-cfb",
"aes-192-cfb",
@ -71,57 +73,43 @@ ssrObfsList = [
"random_head",
]
def test(port, password):
testList = []
for method in ssrMethodList:
def __ssrServerConfig(method: str, protocol: str, obfs: str, caption: str) -> list:
proxyInfo = {
'type': 'ssr',
'server': '127.0.0.1',
'port': int(port),
'password': password,
'port': config['port'],
'passwd': config['passwd'],
'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,
'protocolParam': '',
'obfs': obfs,
'obfsParam': ''
'obfs': obfs
}
serverCommand = [
'ssr-server',
'-p', str(port),
'-k', password,
'-m', 'table',
'-p', str(config['port']),
'-k', config['passwd'],
'-m', method,
'-O', protocol,
'-o', obfs
]
testList.append({
'caption': 'ShadowsocksR protocol ' + protocol + ' obfs ' + obfs,
'proxyInfo': proxyInfo,
'serverCommand': serverCommand
})
return testList
return [{
'caption': caption,
'proxy': proxyInfo,
'server': {
'startCommand': serverCommand,
'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

3
ProxyTester/tester.py

@ -2,12 +2,13 @@
# -*- coding:utf-8 -*-
from ProxyTester import Shadowsocks
from ProxyTester import ShadowsocksR
def test(key: str, config: dict) -> list:
if key == 'ss':
return Shadowsocks.ssTest(config)
elif key == 'ssr':
pass
return ShadowsocksR.ssrTest(config)
elif key == 'vmess':
pass
else:

Loading…
Cancel
Save