From 15fbb52452f0d38e116372fbd77cf94d5fc7ddef Mon Sep 17 00:00:00 2001 From: BROBIRD <7692707+BROBIRD@users.noreply.github.com> Date: Tue, 2 Jun 2026 01:33:35 +0800 Subject: [PATCH] fix some bugs --- scripts/gfwlist_parser.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/scripts/gfwlist_parser.py b/scripts/gfwlist_parser.py index 3f343d0..5133269 100644 --- a/scripts/gfwlist_parser.py +++ b/scripts/gfwlist_parser.py @@ -16,9 +16,13 @@ def is_ip(s): if all(0 <= int(p) <= 255 for p in parts): return True if ':' in s: - valid_chars = set('0123456789abcdefABCDEF:') - if all(c in valid_chars for c in s): + ipv6_pattern = r'^([0-9a-fA-F]{0,4}:){1,7}[0-9a-fA-F]{0,4}$|^(::)$|^::1$' + if re.match(ipv6_pattern, s): return True + if s.startswith('::ffff:'): + ipv4_in_v6_pattern = r'^::ffff:(\d{1,3}\.){3}\d{1,3}$' + if re.match(ipv4_in_v6_pattern, s): + return True return False return False