mirror of
https://github.com/markqvist/Reticulum.git
synced 2025-06-06 22:18:52 -04:00
Cleanup
This commit is contained in:
parent
c07e968218
commit
c83043b087
6 changed files with 6 additions and 6 deletions
|
@ -82,7 +82,6 @@ class AutoInterface(Interface):
|
||||||
return ifas
|
return ifas
|
||||||
|
|
||||||
def interface_name_to_index(self, ifname):
|
def interface_name_to_index(self, ifname):
|
||||||
|
|
||||||
# socket.if_nametoindex doesn't work with uuid interface names on windows, it wants the ethernet_0 style
|
# socket.if_nametoindex doesn't work with uuid interface names on windows, it wants the ethernet_0 style
|
||||||
# we will just get the index from netinfo instead as it seems to work
|
# we will just get the index from netinfo instead as it seems to work
|
||||||
if RNS.vendor.platformutils.is_windows():
|
if RNS.vendor.platformutils.is_windows():
|
||||||
|
@ -102,7 +101,7 @@ class AutoInterface(Interface):
|
||||||
ignored_interfaces = c.as_list("ignored_devices") if "ignored_devices" in c else None
|
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
|
configured_bitrate = c["configured_bitrate"] if "configured_bitrate" in c else None
|
||||||
|
|
||||||
from RNS.vendor import netinfo
|
from RNS.Interfaces import netinfo
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self.netinfo = netinfo
|
self.netinfo = netinfo
|
||||||
|
|
||||||
|
|
|
@ -55,7 +55,7 @@ class BackboneInterface(Interface):
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_address_for_if(name, bind_port, prefer_ipv6=False):
|
def get_address_for_if(name, bind_port, prefer_ipv6=False):
|
||||||
from RNS.vendor import netinfo
|
from RNS.Interfaces import netinfo
|
||||||
ifaddr = netinfo.ifaddresses(name)
|
ifaddr = netinfo.ifaddresses(name)
|
||||||
if len(ifaddr) < 1:
|
if len(ifaddr) < 1:
|
||||||
raise SystemError(f"No addresses available on specified kernel interface \"{name}\" for BackboneInterface to bind to")
|
raise SystemError(f"No addresses available on specified kernel interface \"{name}\" for BackboneInterface to bind to")
|
||||||
|
|
|
@ -445,7 +445,7 @@ class TCPServerInterface(Interface):
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_address_for_if(name, bind_port, prefer_ipv6=False):
|
def get_address_for_if(name, bind_port, prefer_ipv6=False):
|
||||||
from RNS.vendor import netinfo
|
from RNS.Interfaces import netinfo
|
||||||
ifaddr = netinfo.ifaddresses(name)
|
ifaddr = netinfo.ifaddresses(name)
|
||||||
if len(ifaddr) < 1:
|
if len(ifaddr) < 1:
|
||||||
raise SystemError(f"No addresses available on specified kernel interface \"{name}\" for TCPServerInterface to bind to")
|
raise SystemError(f"No addresses available on specified kernel interface \"{name}\" for TCPServerInterface to bind to")
|
||||||
|
|
|
@ -35,13 +35,13 @@ class UDPInterface(Interface):
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_address_for_if(name):
|
def get_address_for_if(name):
|
||||||
from RNS.vendor import netinfo
|
from RNS.Interfaces import netinfo
|
||||||
ifaddr = netinfo.ifaddresses(name)
|
ifaddr = netinfo.ifaddresses(name)
|
||||||
return ifaddr[netinfo.AF_INET][0]["addr"]
|
return ifaddr[netinfo.AF_INET][0]["addr"]
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_broadcast_for_if(name):
|
def get_broadcast_for_if(name):
|
||||||
from RNS.vendor import netinfo
|
from RNS.Interfaces import netinfo
|
||||||
ifaddr = netinfo.ifaddresses(name)
|
ifaddr = netinfo.ifaddresses(name)
|
||||||
return ifaddr[netinfo.AF_INET][0]["broadcast"]
|
return ifaddr[netinfo.AF_INET][0]["broadcast"]
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
import os
|
import os
|
||||||
import glob
|
import glob
|
||||||
import RNS.Interfaces.Android
|
import RNS.Interfaces.Android
|
||||||
|
import RNS.Interfaces.util.netinfo as netinfo
|
||||||
|
|
||||||
py_modules = glob.glob(os.path.dirname(__file__)+"/*.py")
|
py_modules = glob.glob(os.path.dirname(__file__)+"/*.py")
|
||||||
pyc_modules = glob.glob(os.path.dirname(__file__)+"/*.pyc")
|
pyc_modules = glob.glob(os.path.dirname(__file__)+"/*.pyc")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue