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