U 改进获取主机扩展信息兼容性

pull/509/head
vapao 2022-06-20 16:40:49 +08:00
parent ac7d78240c
commit 365d484007
1 changed files with 2 additions and 0 deletions

View File

@ -202,6 +202,8 @@ def fetch_host_extend(ssh):
code, out = ssh.exec_command_raw('hostname -I')
if code == 0:
for ip in out.strip().split():
if len(ip) > 15: # ignore ipv6
continue
if ipaddress.ip_address(ip).is_global:
if len(public_ip_address) < 10:
public_ip_address.add(ip)