getAddress

This commit is contained in:
Roman Hergenreder 2021-05-23 00:16:16 +02:00
parent 612de4e8f9
commit c9cbde2199

@ -18,8 +18,9 @@ def getAddress(interface="tun0"):
interface = interfaces[0] interface = interfaces[0]
addresses = ni.ifaddresses(interface) addresses = ni.ifaddresses(interface)
address = addresses[ni.AF_INET][0]["addr"] addresses = [addresses[ni.AF_INET][i]["addr"] for i in range(len(addresses[ni.AF_INET]))]
return address addresses = [addr for addr in addresses if not str(addr).startswith("127")]
return addresses[0]
def openServer(address, ports=None): def openServer(address, ports=None):
listenPort = None listenPort = None