From e38e27c5f8266b9d94cd39b7e6ea147c501667fa Mon Sep 17 00:00:00 2001 From: Dnomd343 Date: Sat, 5 Mar 2022 12:01:02 +0800 Subject: [PATCH] fix: ipv6 on sip003 plugin --- Dockerfile | 6 +++--- ProxyTester/Shadowsocks.py | 15 ++++++--------- ProxyTester/TrojanGo.py | 11 ++++------- 3 files changed, 13 insertions(+), 19 deletions(-) diff --git a/Dockerfile b/Dockerfile index 960c337..07b7ab5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -42,12 +42,12 @@ git clone https://github.com/shadowsocks/simple-obfs.git && \ git clone https://github.com/IrineSistiana/simple-tls.git && \ git clone https://github.com/shadowsocks/v2ray-plugin.git && \ git clone https://github.com/teddysun/xray-plugin.git && \ -git clone https://github.com/shadowsocks/kcptun.git && \ +git clone https://github.com/dnomd343/kcptun.git && \ git clone https://github.com/maskedeken/gost-plugin.git && \ git clone https://github.com/cbeuw/Cloak.git && \ -git clone https://github.com/cbeuw/GoQuiet.git && \ +git clone https://github.com/dnomd343/GoQuiet.git && \ git clone https://github.com/IrineSistiana/mos-tls-tunnel.git && \ -git clone https://github.com/ihciah/rabbit-plugin.git && \ +git clone https://github.com/dnomd343/rabbit-plugin.git && \ git clone https://github.com/ihciah/rabbit-tcp.git && \ git clone https://github.com/shadowsocks/qtun.git && \ git clone https://github.com/Qv2ray/gun.git && \ diff --git a/ProxyTester/Shadowsocks.py b/ProxyTester/Shadowsocks.py index 54dcd03..a791d0d 100644 --- a/ProxyTester/Shadowsocks.py +++ b/ProxyTester/Shadowsocks.py @@ -86,8 +86,8 @@ 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'] + ']' + if not serverAddr.find(':') < 0: + serverAddr = '[' + serverAddr + ']' serverCommand = [ 'ss-rust-server', '-s', serverAddr + ':' + str(testConfig['port']), @@ -139,10 +139,13 @@ def __ssServerConfig(method: str, plugin: str or None) -> list: }] if plugin == 'rabbit-plugin': # rabbit-tcp + serverAddr = testConfig['bind'] + if not serverAddr.find(':') < 0: # IPv6 + serverAddr = '[' + serverAddr + ']' proxyInfo['port'] = rabbitPort proxyInfo['plugin'] = { 'type': 'rabbit-plugin', - 'param': 'serviceAddr=127.0.0.1:' + str(testConfig['port']) + ';password=' + testConfig['passwd'] + 'param': 'serviceAddr=' + serverAddr + ':' + str(testConfig['port']) + ';password=' + testConfig['passwd'] } return [{ 'proxy': proxyInfo, @@ -168,8 +171,6 @@ 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'] ) @@ -202,10 +203,6 @@ 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) diff --git a/ProxyTester/TrojanGo.py b/ProxyTester/TrojanGo.py index d2df37f..2e7354e 100644 --- a/ProxyTester/TrojanGo.py +++ b/ProxyTester/TrojanGo.py @@ -90,11 +90,14 @@ def loadTrojanGoPlugin(plugin: str) -> list: trojanBaseConfig = loadTrojanGo(False, None) if plugin == 'rabbit-plugin': # rabbit-tcp + serverAddr = testConfig['bind'] + if not serverAddr.find(':') < 0: # IPv6 + serverAddr = '[' + serverAddr + ']' trojanBaseConfig['caption'] = 'Trojan-Go rabbit-plugin (basic mode)' trojanBaseConfig['client']['port'] = rabbitPort trojanBaseConfig['client']['plugin'] = { 'type': 'rabbit-plugin', - 'param': 'serviceAddr=127.0.0.1:' + str(testConfig['port']) + ';password=' + testConfig['passwd'] + 'param': 'serviceAddr=' + serverAddr + ':' + str(testConfig['port']) + ';password=' + testConfig['passwd'] } trojanBaseConfig['server']['transport_plugin'] = { 'enabled': True, @@ -112,8 +115,6 @@ 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'] + ')' @@ -162,10 +163,6 @@ def test(config: dict) -> list: for ssMethod in trojanGoMethod: 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))