From 4fb065306d7e940b0440206bf7ee9b007d0c8790 Mon Sep 17 00:00:00 2001 From: Dorae <86833913+Toperlock@users.noreply.github.com> Date: Sun, 19 Nov 2023 17:33:42 +0800 Subject: [PATCH] Update vmess.py --- parsers/vmess.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/parsers/vmess.py b/parsers/vmess.py index d3045a54f..2636bcc0b 100644 --- a/parsers/vmess.py +++ b/parsers/vmess.py @@ -69,7 +69,7 @@ def parse(data): node['tls']={ 'enabled': True, 'insecure': True, - 'server_name': item.get('host', '') + 'server_name': item.get('host', '') if item.get("net") != 'h2' else '' } if item.get('sni'): node['tls']['server_name'] = item['sni'] @@ -78,23 +78,26 @@ def parse(data): 'fingerprint': item.get('fp', '') } if item.get("net"): - if item['net'] == 'hs': + if item['net'] in ['h2', 'http']: node['transport'] = { 'type':'http' } if item.get('host'): - node['transport']['host'] = item['host'].split(',')[0] + node['transport']['host'] = item['host'] if item.get('path'): - node['transport']['path'] = item['path'].rsplit("?")[0] + if type(item.get('path')) == 'str': + node['transport']['path'] = item['path'].rsplit("?")[0] + else: + node['transport']['path'] = item['path'][0] if item['net'] == 'ws': node['transport'] = { 'type':'ws', - 'path':item.get('path', '').rsplit("?")[0], + 'path':str(item.get('path', '')).rsplit("?")[0], 'headers': { 'Host': item.get('host', '') } } - if '?ed=' in item.get('path', ''): + if '?ed=' in str(item.get('path', '')): node['transport']['early_data_header_name'] = 'Sec-WebSocket-Protocol' node['transport']['max_early_data'] = int(item.get('path').rsplit("?ed=")[1]) if item['net'] == 'quic':