Skip to content

Commit

Permalink
Update vmess.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Toperlock authored Nov 19, 2023
1 parent e01b7c8 commit 4fb0653
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions parsers/vmess.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand All @@ -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':
Expand Down

0 comments on commit 4fb0653

Please sign in to comment.