getAddress
This commit is contained in:
parent
612de4e8f9
commit
c9cbde2199
5
util.py
5
util.py
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user