mirror of
https://github.com/shmilylty/OneForAll.git
synced 2026-08-26 12:57:50 +08:00
修复非IP报错
This commit is contained in:
+5
-1
@@ -40,7 +40,11 @@ def check_header_key(header):
|
|||||||
def check_cdn_cidr(content):
|
def check_cdn_cidr(content):
|
||||||
ips = set(content.split(','))
|
ips = set(content.split(','))
|
||||||
for ip in ips:
|
for ip in ips:
|
||||||
ip = ipaddress.ip_address(ip)
|
try:
|
||||||
|
ip = ipaddress.ip_address(ip)
|
||||||
|
except Exception as e:
|
||||||
|
logger.log('DEBUG', e.args)
|
||||||
|
return False
|
||||||
for cidr in cdn_ip_cidr:
|
for cidr in cdn_ip_cidr:
|
||||||
if ip in ipaddress.ip_network(cidr):
|
if ip in ipaddress.ip_network(cidr):
|
||||||
return True
|
return True
|
||||||
|
|||||||
Reference in New Issue
Block a user