Browse Source

fix: ipv6 on sip003 plugin

master
Dnomd343 2 years ago
parent
commit
e38e27c5f8
  1. 6
      Dockerfile
  2. 15
      ProxyTester/Shadowsocks.py
  3. 11
      ProxyTester/TrojanGo.py

6
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 && \

15
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)

11
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))

Loading…
Cancel
Save