From 16c8818a5193a5695cea102441f1e58543313110 Mon Sep 17 00:00:00 2001 From: Toperlock <861705708@qq.com> Date: Tue, 14 Jan 2025 11:23:43 +0800 Subject: [PATCH] fix hysteria2 ipv6 port --- parsers/hysteria2.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/parsers/hysteria2.py b/parsers/hysteria2.py index 45284ecd3..170a9ba69 100644 --- a/parsers/hysteria2.py +++ b/parsers/hysteria2.py @@ -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()),