mirror of
https://github.com/markqvist/Reticulum.git
synced 2025-08-08 06:23:06 -04:00
Removed dependency on netifaces.
This commit is contained in:
parent
a3bee4baa9
commit
5e5d89cc92
9 changed files with 18 additions and 85 deletions
6
RNS/vendor/ifaddr/niwrapper.py
vendored
6
RNS/vendor/ifaddr/niwrapper.py
vendored
|
@ -1,5 +1,4 @@
|
|||
# netifaces compatibility layer
|
||||
|
||||
import ipaddress
|
||||
import ifaddr
|
||||
import socket
|
||||
|
||||
|
@ -22,7 +21,10 @@ def ifaddresses(ifname) -> dict:
|
|||
for ip in a.ips:
|
||||
t = {}
|
||||
if ip.is_IPv4:
|
||||
net = ipaddress.ip_network(str(ip.ip)+"/"+str(ip.network_prefix), strict=False)
|
||||
t["addr"] = ip.ip
|
||||
t["prefix"] = ip.network_prefix
|
||||
t["broadcast"] = str(net.broadcast_address)
|
||||
ipv4s.append(t)
|
||||
if ip.is_IPv6:
|
||||
t["addr"] = ip.ip[0]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue