|  | @ -4,9 +4,7 @@ | 
			
		
	
		
		
			
				
					|  |  | import copy |  |  | import copy | 
			
		
	
		
		
			
				
					|  |  | import ProxyTester.Plugin as sip003 |  |  | import ProxyTester.Plugin as sip003 | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  | defaultHost = 'dns.343.re' |  |  | config = {} | 
			
				
				
			
		
	
		
		
			
				
					|  |  | defaultCert = '/etc/ssl/certs/dns.343.re/certificate.crt' |  |  |  | 
			
		
	
		
		
			
				
					|  |  | defaultKey = '/etc/ssl/certs/dns.343.re/private.key' |  |  |  | 
			
		
	
		
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  | ssMethodList = [ |  |  | ssMethodList = [ | 
			
		
	
		
		
			
				
					|  |  |     'aes-128-gcm', |  |  |     'aes-128-gcm', | 
			
		
	
	
		
		
			
				
					|  | @ -76,32 +74,28 @@ sip003PluginList = [ # SIP003插件列表 | 
			
		
	
		
		
			
				
					|  |  | ] |  |  | ] | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  | def __ssServerConfig(method: str, plugin: str or None) -> list: |  |  | def __ssServerConfig(method: str, plugin: str or None) -> list: | 
			
		
	
		
		
			
				
					|  |  |     port = 12345 |  |  |  | 
			
		
	
		
		
			
				
					|  |  |     rabbitPort = 20191 |  |  |     rabbitPort = 20191 | 
			
		
	
		
		
			
				
					|  |  |     passwd = 'dnomd343' |  |  |  | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  |  | 
			
		
	
		
		
			
				
					|  |  |     proxyInfo = { |  |  |     proxyInfo = { | 
			
		
	
		
		
			
				
					|  |  |         'type': 'ss', |  |  |         'type': 'ss', | 
			
		
	
		
		
			
				
					|  |  |         'server': '127.0.0.1', |  |  |         'server': '127.0.0.1', | 
			
		
	
		
		
			
				
					
					|  |  |         'port': port, |  |  |         'port': config['port'], | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |         'passwd': passwd, |  |  |         'passwd': config['passwd'], | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					|  |  |         'method': method |  |  |         'method': method | 
			
		
	
		
		
			
				
					|  |  |     } |  |  |     } | 
			
		
	
		
		
			
				
					|  |  |     serverCommand = [] |  |  |  | 
			
		
	
		
		
			
				
					|  |  |     caption = 'Shadowsocks method ' + method |  |  |     caption = 'Shadowsocks method ' + method | 
			
		
	
		
		
			
				
					|  |  |     if method in ['plain', 'none']: # plain / none -> ss-rust |  |  |     if method in ['plain', 'none']: # plain / none -> ss-rust | 
			
		
	
		
		
			
				
					|  |  |         serverCommand = [ |  |  |         serverCommand = [ | 
			
		
	
		
		
			
				
					|  |  |             'ss-rust-server', |  |  |             'ss-rust-server', | 
			
		
	
		
		
			
				
					
					|  |  |             '-s', '0.0.0.0:' + str(port), |  |  |             '-s', '0.0.0.0:' + str(config['port']), | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |             '-k', passwd, |  |  |             '-k', config['passwd'], | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					|  |  |             '-m', method |  |  |             '-m', method | 
			
		
	
		
		
			
				
					|  |  |         ] |  |  |         ] | 
			
		
	
		
		
			
				
					|  |  |     elif method == 'salsa20-ctr': # salsa20-ctr -> ss-python-legacy |  |  |     elif method == 'salsa20-ctr': # salsa20-ctr -> ss-python-legacy | 
			
		
	
		
		
			
				
					|  |  |         serverCommand = [ |  |  |         serverCommand = [ | 
			
		
	
		
		
			
				
					|  |  |             'ss-bootstrap-server', '--no-udp', |  |  |             'ss-bootstrap-server', '--no-udp', | 
			
		
	
		
		
			
				
					|  |  |             '--shadowsocks', 'ss-python-legacy-server', |  |  |             '--shadowsocks', 'ss-python-legacy-server', | 
			
		
	
		
		
			
				
					
					|  |  |             '-p', str(port), |  |  |             '-p', str(config['port']), | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |             '-k', passwd, |  |  |             '-k', config['passwd'], | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					|  |  |             '-m', method |  |  |             '-m', method | 
			
		
	
		
		
			
				
					|  |  |         ] |  |  |         ] | 
			
		
	
		
		
			
				
					|  |  |     else: # others -> ss-python |  |  |     else: # others -> ss-python | 
			
		
	
	
		
		
			
				
					|  | @ -118,8 +112,8 @@ def __ssServerConfig(method: str, plugin: str or None) -> list: | 
			
		
	
		
		
			
				
					|  |  |         serverCommand = [ |  |  |         serverCommand = [ | 
			
		
	
		
		
			
				
					|  |  |             'ss-bootstrap-server', '--no-udp', |  |  |             'ss-bootstrap-server', '--no-udp', | 
			
		
	
		
		
			
				
					|  |  |             '--shadowsocks', 'ss-python-server', |  |  |             '--shadowsocks', 'ss-python-server', | 
			
		
	
		
		
			
				
					
					|  |  |             '-p', str(port), |  |  |             '-p', str(config['port']), | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |             '-k', passwd, |  |  |             '-k', config['passwd'], | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					|  |  |             '-m', method |  |  |             '-m', method | 
			
		
	
		
		
			
				
					|  |  |         ] |  |  |         ] | 
			
		
	
		
		
			
				
					|  |  |         if method == 'idea-cfb' or method == 'seed-cfb': |  |  |         if method == 'idea-cfb' or method == 'seed-cfb': | 
			
		
	
	
		
		
			
				
					|  | @ -142,7 +136,7 @@ def __ssServerConfig(method: str, plugin: str or None) -> list: | 
			
		
	
		
		
			
				
					|  |  |         proxyInfo['port'] = rabbitPort |  |  |         proxyInfo['port'] = rabbitPort | 
			
		
	
		
		
			
				
					|  |  |         proxyInfo['plugin'] = { |  |  |         proxyInfo['plugin'] = { | 
			
		
	
		
		
			
				
					|  |  |             'type': 'rabbit-plugin', |  |  |             'type': 'rabbit-plugin', | 
			
		
	
		
		
			
				
					
					|  |  |             'param': 'serviceAddr=127.0.0.1:' + str(port) + ';password=' + passwd |  |  |             'param': 'serviceAddr=127.0.0.1:' + str(config['port']) + ';password=' + config['passwd'] | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |         } |  |  |         } | 
			
		
	
		
		
			
				
					|  |  |         return [{ |  |  |         return [{ | 
			
		
	
		
		
			
				
					|  |  |             'proxy': proxyInfo, |  |  |             'proxy': proxyInfo, | 
			
		
	
	
		
		
			
				
					|  | @ -157,7 +151,7 @@ def __ssServerConfig(method: str, plugin: str or None) -> list: | 
			
		
	
		
		
			
				
					|  |  |                 'startCommand': [ |  |  |                 'startCommand': [ | 
			
		
	
		
		
			
				
					|  |  |                     'rabbit', |  |  |                     'rabbit', | 
			
		
	
		
		
			
				
					|  |  |                     '-mode', 's', |  |  |                     '-mode', 's', | 
			
		
	
		
		
			
				
					
					|  |  |                     '-password', passwd, |  |  |                     '-password', config['passwd'], | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |                     '-rabbit-addr', ':' + str(rabbitPort) |  |  |                     '-rabbit-addr', ':' + str(rabbitPort) | 
			
		
	
		
		
			
				
					|  |  |                 ], |  |  |                 ], | 
			
		
	
		
		
			
				
					|  |  |                 'fileContent': None, |  |  |                 'fileContent': None, | 
			
		
	
	
		
		
			
				
					|  | @ -168,7 +162,7 @@ def __ssServerConfig(method: str, plugin: str or None) -> list: | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  |     # others plugin |  |  |     # others plugin | 
			
		
	
		
		
			
				
					|  |  |     result = [] |  |  |     result = [] | 
			
		
	
		
		
			
				
					
					|  |  |     pluginConfig = sip003.loadPluginConfig(plugin, defaultHost, defaultCert, defaultKey) # 载入插件配置 |  |  |     pluginConfig = sip003.loadPluginConfig(plugin, config['host'], config['cert'], config['key']) # 载入插件配置 | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |     serverBaseCommand = copy.deepcopy(serverCommand) |  |  |     serverBaseCommand = copy.deepcopy(serverCommand) | 
			
		
	
		
		
			
				
					|  |  |     for pluginOption in pluginConfig: |  |  |     for pluginOption in pluginConfig: | 
			
		
	
		
		
			
				
					|  |  |         serverCommand = copy.deepcopy(serverBaseCommand) |  |  |         serverCommand = copy.deepcopy(serverBaseCommand) | 
			
		
	
	
		
		
			
				
					|  | @ -190,11 +184,12 @@ def __ssServerConfig(method: str, plugin: str or None) -> list: | 
			
		
	
		
		
			
				
					|  |  |         })) |  |  |         })) | 
			
		
	
		
		
			
				
					|  |  |     return result |  |  |     return result | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  | def ssTest() -> list: |  |  | def ssTest(ssConfig: dict) -> list: | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |     result = [] |  |  |     result = [] | 
			
		
	
		
		
			
				
					
					|  |  |     for method in ssMethodList: |  |  |     for key, value in ssConfig.items(): # ssConfig -> config | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |  |  |  |         config[key] = value | 
			
		
	
		
		
			
				
					|  |  |  |  |  |     for method in ssMethodList: # all Shadowsocks methods | 
			
		
	
		
		
			
				
					|  |  |         result += __ssServerConfig(method, None) |  |  |         result += __ssServerConfig(method, None) | 
			
		
	
		
		
			
				
					
					|  |  |     for plugin in sip003PluginList: |  |  |     for plugin in sip003PluginList: # all SIP003 plugin | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |         result += __ssServerConfig('aes-256-ctr', plugin) |  |  |         result += __ssServerConfig('aes-256-ctr', plugin) | 
			
		
	
		
		
			
				
					|  |  |     # result += __ssServerConfig('aes-256-gcm', None) |  |  |  | 
			
		
	
		
		
			
				
					|  |  |     return result |  |  |     return result | 
			
		
	
	
		
		
			
				
					|  | 
 |