Browse Source

update: compatible decoder

master
dnomd343 2 years ago
parent
commit
6f8d2ce939
  1. 4
      ProxyDecoder/Brook.py
  2. 4
      ProxyDecoder/Shadowsocks.py
  3. 10
      ProxyDecoder/ShadowsocksR.py
  4. 4
      ProxyDecoder/Trojan.py
  5. 4
      ProxyDecoder/TrojanGo.py
  6. 4
      ProxyDecoder/VLESS.py
  7. 4
      ProxyDecoder/VMess.py
  8. 2
      ProxyDecoder/__init__.py
  9. 2
      ProxyDecoder/decoder.py

4
ProxyDecoder/Brook.py

@ -81,6 +81,6 @@ def decode(url: str) -> dict:
if url.split('://')[0] != 'brook':
raise Exception('Unexpected scheme')
return {
**{'type': 'brook'},
**__brookDecode(url)
'type': 'brook',
'info': __brookDecode(url),
}

4
ProxyDecoder/Shadowsocks.py

@ -137,6 +137,6 @@ def decode(url: str, compatible: bool = False) -> dict or None:
if compatible and 'remark' in ssInfo: # 向后兼容部分客户端
ssInfo['remark'] = ssInfo['remark'].replace('+', ' ')
return {
**{'type': 'ss'},
**ssInfo
'type': 'ss',
'info': ssInfo,
}

10
ProxyDecoder/ShadowsocksR.py

@ -44,7 +44,13 @@ def __ssrDecode(url: str) -> dict: # SSR分享链接解码
def decode(url: str) -> dict:
if url.split('://')[0] != 'ssr':
raise Exception('Unexpected scheme')
ssrObject = __ssrDecode(url)
group = ''
if 'group' in ssrObject:
group = ssrObject['group']
ssrObject.pop('group')
return {
**{'type': 'ssr'},
**__ssrDecode(url)
'type': 'ssr',
'group': group,
'info': ssrObject,
}

4
ProxyDecoder/Trojan.py

@ -129,6 +129,6 @@ def decode(url: str) -> dict:
if url.split('://')[0] != 'trojan':
raise Exception('Unexpected scheme')
return {
**{'type': 'trojan'},
**__trojanDecode(url)
'type': 'trojan',
'info': __trojanDecode(url),
}

4
ProxyDecoder/TrojanGo.py

@ -77,6 +77,6 @@ def decode(url: str) -> dict:
if url.split('://')[0] != 'trojan-go':
raise Exception('Unexpected scheme')
return {
**{'type': 'trojan-go'},
**__trojanGoDecode(url)
'type': 'trojan-go',
'info': __trojanGoDecode(url),
}

4
ProxyDecoder/VLESS.py

@ -127,6 +127,6 @@ def decode(url: str) -> dict:
if url.split('://')[0] != 'vless':
raise Exception('Unexpected scheme')
return {
**{'type': 'vless'},
**__vlessDecode(url)
'type': 'vless',
'info': __vlessDecode(url),
}

4
ProxyDecoder/VMess.py

@ -222,6 +222,6 @@ def decode(url: str) -> dict:
except:
raise Exception('Url could not be parsed')
return {
**{'type': 'vmess'},
**vmessInfo
'type': 'vmess',
'info': vmessInfo,
}

2
ProxyDecoder/__init__.py

@ -1,6 +1,8 @@
#!/usr/bin/python
# -*- coding:utf-8 -*-
# TODO: this module will refactor in the future
from ProxyDecoder.decoder import *
__all__ = ['decode']

2
ProxyDecoder/decoder.py

@ -20,7 +20,7 @@ def decode(url: str) -> dict or None:
链接有效:
return {
'type': ...,
...
'info': {...},
}
"""
try:

Loading…
Cancel
Save