使用数据库来查ASN信息 优化内存

This commit is contained in:
Jing Ling
2020-08-21 03:15:23 +08:00
parent 3e035da2a6
commit 3970d07030
4 changed files with 31 additions and 61 deletions
+3 -1
View File
@@ -685,11 +685,13 @@ def is_subname(name):
def ip_to_int(ip):
if isinstance(ip, int):
return ip
try:
ipv4 = IPv4Address(ip)
except Exception as e:
logger.log('ERROR', e.args)
return None
return 0
return int(ipv4)