From 8e4b0b3b16287655bd7e94730a21629243883786 Mon Sep 17 00:00:00 2001 From: Mark Qvist Date: Fri, 11 Apr 2025 12:22:58 +0200 Subject: [PATCH] Use internal netinfo implementation --- RNS/Interfaces/AutoInterface.py | 4 ++-- RNS/Interfaces/BackboneInterface.py | 2 +- RNS/Interfaces/TCPInterface.py | 2 +- RNS/Interfaces/UDPInterface.py | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/RNS/Interfaces/AutoInterface.py b/RNS/Interfaces/AutoInterface.py index 7f62172..6e146a0 100644 --- a/RNS/Interfaces/AutoInterface.py +++ b/RNS/Interfaces/AutoInterface.py @@ -102,9 +102,9 @@ class AutoInterface(Interface): ignored_interfaces = c.as_list("ignored_devices") if "ignored_devices" in c else None configured_bitrate = c["configured_bitrate"] if "configured_bitrate" in c else None - from RNS.vendor.ifaddr import niwrapper + from RNS.vendor import netinfo super().__init__() - self.netinfo = niwrapper + self.netinfo = netinfo self.HW_MTU = AutoInterface.HW_MTU self.IN = True diff --git a/RNS/Interfaces/BackboneInterface.py b/RNS/Interfaces/BackboneInterface.py index 0984b86..133ee33 100644 --- a/RNS/Interfaces/BackboneInterface.py +++ b/RNS/Interfaces/BackboneInterface.py @@ -55,7 +55,7 @@ class BackboneInterface(Interface): @staticmethod def get_address_for_if(name, bind_port, prefer_ipv6=False): - import RNS.vendor.ifaddr.niwrapper as netinfo + from RNS.vendor import netinfo ifaddr = netinfo.ifaddresses(name) if len(ifaddr) < 1: raise SystemError(f"No addresses available on specified kernel interface \"{name}\" for BackboneInterface to bind to") diff --git a/RNS/Interfaces/TCPInterface.py b/RNS/Interfaces/TCPInterface.py index 01ad461..1fe9df7 100644 --- a/RNS/Interfaces/TCPInterface.py +++ b/RNS/Interfaces/TCPInterface.py @@ -445,7 +445,7 @@ class TCPServerInterface(Interface): @staticmethod def get_address_for_if(name, bind_port, prefer_ipv6=False): - import RNS.vendor.ifaddr.niwrapper as netinfo + from RNS.vendor import netinfo ifaddr = netinfo.ifaddresses(name) if len(ifaddr) < 1: raise SystemError(f"No addresses available on specified kernel interface \"{name}\" for TCPServerInterface to bind to") diff --git a/RNS/Interfaces/UDPInterface.py b/RNS/Interfaces/UDPInterface.py index 9908055..4b78f07 100644 --- a/RNS/Interfaces/UDPInterface.py +++ b/RNS/Interfaces/UDPInterface.py @@ -35,13 +35,13 @@ class UDPInterface(Interface): @staticmethod def get_address_for_if(name): - import RNS.vendor.ifaddr.niwrapper as netinfo + from RNS.vendor import netinfo ifaddr = netinfo.ifaddresses(name) return ifaddr[netinfo.AF_INET][0]["addr"] @staticmethod def get_broadcast_for_if(name): - import RNS.vendor.ifaddr.niwrapper as netinfo + from RNS.vendor import netinfo ifaddr = netinfo.ifaddresses(name) return ifaddr[netinfo.AF_INET][0]["broadcast"]