From c9cbde21991ac43e8dd001479f84e84d7e029b97 Mon Sep 17 00:00:00 2001 From: Roman Hergenreder Date: Sun, 23 May 2021 00:16:16 +0200 Subject: [PATCH] getAddress --- util.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/util.py b/util.py index 1663475..93b01de 100755 --- a/util.py +++ b/util.py @@ -18,8 +18,9 @@ def getAddress(interface="tun0"): interface = interfaces[0] addresses = ni.ifaddresses(interface) - address = addresses[ni.AF_INET][0]["addr"] - return address + addresses = [addresses[ni.AF_INET][i]["addr"] for i in range(len(addresses[ni.AF_INET]))] + addresses = [addr for addr in addresses if not str(addr).startswith("127")] + return addresses[0] def openServer(address, ports=None): listenPort = None