This commit is contained in:
Tristan B. Velloza Kildaire 2024-11-03 15:55:08 +00:00 committed by GitHub
commit fb1f7fa161
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -412,6 +412,11 @@ class TCPServerInterface(Interface):
def get_address_for_if(name): def get_address_for_if(name):
import RNS.vendor.ifaddr.niwrapper as netinfo import RNS.vendor.ifaddr.niwrapper as netinfo
ifaddr = netinfo.ifaddresses(name) ifaddr = netinfo.ifaddresses(name)
# IPv6 preference (if present)
if(netinfo.AF_INET6 in ifaddr):
return ifaddr[netinfo.AF_INET6][0]["addr"]
return ifaddr[netinfo.AF_INET][0]["addr"] return ifaddr[netinfo.AF_INET][0]["addr"]
@staticmethod @staticmethod