Vmess 转 Clash 节点:Python 代码实现
以下是一个简单的 Python 代码,可以将 Vmess 节点转换为 Clash 节点:
import json
# 输入 Vmess 节点信息
vmess = {
'v': '2',
'ps': 'example',
'add': 'example.com',
'port': '12345',
'id': 'example-id',
'aid': '64',
'net': 'tcp',
'type': 'none',
'host': '',
'path': '',
'tls': ''
}
# 转换为 Clash 节点格式
clash = {
'name': vmess['ps'],
'type': 'vmess',
'server': vmess['add'],
'port': int(vmess['port']),
'uuid': vmess['id'],
'alterId': int(vmess['aid']),
'cipher': 'auto',
'network': vmess['net'],
'tls': vmess['tls'],
'ws-path': vmess['path'],
'ws-headers': {
'Host': vmess['host']
}
}
# 输出 Clash 节点信息
print(json.dumps(clash))
你可以根据需要对代码进行修改和调整。
原文地址: https://www.cveoy.top/t/topic/lUCj 著作权归作者所有。请勿转载和采集!