feat: 优化启动日志

This commit is contained in:
martsforever
2026-03-28 21:49:33 +08:00
parent 927230848e
commit 232df139f8
4 changed files with 74 additions and 2 deletions
+19
View File
@@ -0,0 +1,19 @@
import socket
import psutil
def get_local_ips():
ips = []
try:
for interface, addrs in psutil.net_if_addrs().items():
for addr in addrs:
if addr.family == socket.AF_INET and addr.address != '127.0.0.1':
ips.append(addr.address)
# 对获取到的 IP 地址列表进行排序
ips.sort()
except Exception as e:
print(f"获取 IP 地址时出错:{e}")
return ips
print(get_local_ips())