Skip to content

Commit

Permalink
fix hysteria2 ipv6 port
Browse files Browse the repository at this point in the history
  • Loading branch information
Toperlock committed Jan 14, 2025
1 parent 6cab1d9 commit 16c8818
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions parsers/hysteria2.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,12 @@ def parse(data):
)
if server_info.path:
server_info = server_info._replace(netloc=server_info.netloc + server_info.path, path="")
port_match = re.search(r':(\d+)', server_info.netloc)
ports_match = re.search(r',(\d+-\d+)', server_info.netloc)
node = {
'tag': unquote(server_info.fragment) or tool.genName()+'_hysteria2',
'type': 'hysteria2',
'server': re.sub(r"\[|\]", "", server_info.netloc.split("@")[-1].rsplit(":", 1)[0]),
'server_port': int(port_match.group(1)),
'server_port': int(re.search(r'\d+', server_info.netloc.rsplit(":", 1)[-1].split(",")[0]).group()),
"password": netquery['auth'] if netquery.get('auth') else server_info.netloc.split("@")[0].rsplit(":", 1)[-1],
'up_mbps': int(re.search(r'\d+', netquery.get('upmbps', '10')).group()),
'down_mbps': int(re.search(r'\d+', netquery.get('downmbps', '100')).group()),
Expand Down

1 comment on commit 16c8818

@Toperlock
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.