mirror of
https://github.com/Johnshall/Shadowrocket-ADBlock-Rules-Forever.git
synced 2025-12-18 15:54:50 +08:00
Add ability to process IPV6 CIDR (#132)
* Support IPV6 CIDR * Remove duplicate domain from GFWList and update Telegram CIDR * Support DOMAIN-SUFFIX rules
This commit is contained in:
@@ -96,7 +96,10 @@ for row in rule:
|
||||
row = row.lstrip('.*')
|
||||
|
||||
# 清除后缀
|
||||
row = row.rstrip('/^*')
|
||||
row = row.rstrip('/*')
|
||||
if row[-1] == '^':
|
||||
row = '.'+row
|
||||
row = row.rstrip('^')
|
||||
row = re.sub(r':\d{2,5}$', '', row) # 清除端口
|
||||
|
||||
# 不能含有的字符
|
||||
@@ -109,7 +112,7 @@ for row in rule:
|
||||
continue
|
||||
|
||||
# 只匹配域名或 IP
|
||||
if re.match(r'^([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,9}$', row) or re.match(r'^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$', row):
|
||||
if re.match(r'^\.?[a-zA-Z0-9][-a-zA-Z0-9]{0,62}(\.[a-zA-Z0-9][-a-zA-Z0-9]{0,62})*\.[a-zA-Z0-9][-a-zA-Z0-9]{1,}$', row) or re.match(r'^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$', row):
|
||||
domains.append(row)
|
||||
|
||||
print('done.')
|
||||
|
||||
Reference in New Issue
Block a user