Merge pull request #601 from deavmi/patch-2
Allow binding to IPv6 (if present)
This commit is contained in:
commit
04925d8004
|
@ -414,6 +414,11 @@ class TCPServerInterface(Interface):
|
|||
def get_address_for_if(name):
|
||||
import RNS.vendor.ifaddr.niwrapper as netinfo
|
||||
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"]
|
||||
|
||||
@staticmethod
|
||||
|
|
Loading…
Reference in New Issue