mirror of https://github.com/dnomd343/ProxyC
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
1.1 KiB
44 lines
1.1 KiB
#!/usr/bin/python
|
|
# -*- coding:utf-8 -*-
|
|
|
|
from ProxyDecoder import Shadowsocks
|
|
from ProxyDecoder import ShadowsocksR
|
|
from ProxyDecoder import VMess
|
|
from ProxyDecoder import VLESS
|
|
from ProxyDecoder import Trojan
|
|
from ProxyDecoder import TrojanGo
|
|
from ProxyDecoder import Brook
|
|
|
|
|
|
def decode(url: str) -> dict or None:
|
|
"""
|
|
代理分享链接解码
|
|
|
|
链接无效:
|
|
return None
|
|
|
|
链接有效:
|
|
return {
|
|
'type': ...,
|
|
'info': {...},
|
|
}
|
|
"""
|
|
try:
|
|
scheme = url.split('://', maxsplit = 1)[0]
|
|
if scheme == 'ss':
|
|
return Shadowsocks.decode(url, compatible = True)
|
|
elif scheme == 'ssr':
|
|
return ShadowsocksR.decode(url)
|
|
elif scheme == 'vmess':
|
|
return VMess.decode(url)
|
|
elif scheme == 'vless':
|
|
return VLESS.decode(url)
|
|
elif scheme == 'trojan':
|
|
return Trojan.decode(url)
|
|
elif scheme == 'trojan-go':
|
|
return TrojanGo.decode(url)
|
|
elif scheme == 'brook':
|
|
return Brook.decode(url)
|
|
except:
|
|
pass
|
|
return None
|
|
|