From c30966b52b2656c903fe4508d18d6f2d09877868 Mon Sep 17 00:00:00 2001 From: Dnomd343 Date: Fri, 4 Mar 2022 15:37:46 +0800 Subject: [PATCH] update: IPv6 local test --- ProxyTester/Shadowsocks.py | 12 +++++++++++- ProxyTester/TrojanGo.py | 5 +++++ Test.py | 4 ++-- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/ProxyTester/Shadowsocks.py b/ProxyTester/Shadowsocks.py index bc64f7a..54dcd03 100644 --- a/ProxyTester/Shadowsocks.py +++ b/ProxyTester/Shadowsocks.py @@ -85,9 +85,12 @@ def __ssServerConfig(method: str, plugin: str or None) -> list: } caption = 'Shadowsocks method ' + method if method in ['plain', 'none']: # plain / none -> ss-rust + serverAddr = testConfig['bind'] + if not testConfig['bind'].find(':') < 0: + serverAddr = '[' + testConfig['bind'] + ']' serverCommand = [ 'ss-rust-server', - '-s', testConfig['bind'] + ':' + str(testConfig['port']), + '-s', serverAddr + ':' + str(testConfig['port']), '-k', testConfig['passwd'], '-m', method ] @@ -165,6 +168,8 @@ def __ssServerConfig(method: str, plugin: str or None) -> list: # others plugin result = [] + if plugin == 'kcptun-client' and testConfig['bind'].find(':') >= 0: + serverCommand[serverCommand.index('-s') + 1] = '[' + testConfig['bind'] + ']' pluginConfig = sip003.loadPluginConfig( # 载入插件配置 plugin, testConfig['host'], testConfig['cert'], testConfig['key'] ) @@ -197,6 +202,11 @@ def test(config: dict) -> list: testList = [] for method in ssMethodList: # all Shadowsocks methods testList += __ssServerConfig(method, None) + + if config['bind'].find(':') >= 0: # ipv6 format error + sip003PluginList.remove('gq-client') + sip003PluginList.remove('rabbit-plugin') for plugin in sip003PluginList: # all SIP003 plugin testList += __ssServerConfig('aes-256-ctr', plugin) + return testList diff --git a/ProxyTester/TrojanGo.py b/ProxyTester/TrojanGo.py index 8985d8e..d2df37f 100644 --- a/ProxyTester/TrojanGo.py +++ b/ProxyTester/TrojanGo.py @@ -112,6 +112,8 @@ def loadTrojanGoPlugin(plugin: str) -> list: # other plugin pluginConfig = Plugin.loadPluginConfig(plugin, testConfig['host'], testConfig['cert'], testConfig['key']) # 载入插件配置 + if plugin == 'kcptun-client' and testConfig['bind'].find(':') >= 0: + trojanBaseConfig['server']['local_addr'] = '[' + trojanBaseConfig['server']['local_addr'] + ']' for pluginOption in pluginConfig: trojanConfig = copy.deepcopy(trojanBaseConfig) trojanConfig['caption'] = 'Trojan-Go plugin ' + plugin + ' (' + pluginOption['caption'] + ')' @@ -161,6 +163,9 @@ def test(config: dict) -> list: testList += loadTrojanGoConfig([loadTrojanGo(False, ssMethod)]) # basic test with shadowsocks testList += loadTrojanGoConfig([loadTrojanGo(True, ssMethod)]) + if config['bind'].find(':') >= 0: # ipv6 format error + sip003PluginList.remove('gq-client') + sip003PluginList.remove('rabbit-plugin') for plugin in sip003PluginList: # plugin test -> cause zombie process (imperfect trojan-go) testList += loadTrojanGoConfig(loadTrojanGoPlugin(plugin)) diff --git a/Test.py b/Test.py index 51052fd..379f3be 100644 --- a/Test.py +++ b/Test.py @@ -11,8 +11,8 @@ import Check as Checker import ProxyTester as Tester testConfig = { - 'bind': '0.0.0.0', - 'addr': '172.17.0.2', + 'bind': '::1', + 'addr': '::1', 'port': 12345, 'passwd': 'dnomd343', 'host': 'local.343.re',