Added better handling on Windows of interfaces that are non-adoptable for AutoInterface

This commit is contained in:
Mark Qvist 2024-05-17 23:54:48 +02:00
parent 4b07e30b9d
commit 444ae0206b
2 changed files with 87 additions and 63 deletions

View file

@ -18,6 +18,18 @@ def interface_names_to_indexes() -> dict:
results[adapter.name] = adapter.index
return results
def interface_name_to_nice_name(ifname) -> str:
try:
adapters = RNS.vendor.ifaddr.get_adapters(include_unconfigured=True)
for adapter in adapters:
if adapter.name == ifname:
if hasattr(adapter, "nice_name"):
return adapter.nice_name
except:
return None
return None
def ifaddresses(ifname) -> dict:
adapters = RNS.vendor.ifaddr.get_adapters(include_unconfigured=True)
ifa = {}