-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Retire netifaces
#1123
Comments
I asked for volunteers (thanks everyone who submitted results!) to test a pure-
So far, I believe [Click me!] Workaround and reference implementation to find IPv4 addresses.
set([i[4][0] for i in socket.getaddrinfo(socket.gethostname(), None) + socket.getaddrinfo(None, 0) if i[4][0].find(".") != -1])
set(sum([[v[0]['addr'] for v in netifaces.ifaddresses(itf).values() if v[0]['addr'].find(".") != -1] for itf in netifaces.interfaces()], [])) |
From the |
The other two ways that |
In #1127, I described the performance issue caused by calls to |
@qstokkink What is your opinion about the ifaddr pure-python library? Can it replace netifaces in ipv8? |
@kozlovsky I don't hate it but I don't love it either. It's pretty close to what I'm working on myself. However, my concerns are three-fold:
For the record, I still don't hate |
Currently, we use
netifaces
to retrieve the network interfaces of a machine. We use this to determine the LAN address in theEndpoint
class.There are three reasons to remove
netifaces
from our code base:netifaces
does not install easily for Python 3.11 on Windows systems.netifaces
is old and messy (also, its removal has been planned since 2016, in the second-oldest PR that is still open on Dispersy).netifaces
repository has been without a maintainer since 2021.There is one reason not to remove
netifaces
:netifaces
does not work as well.We should look into making our workaround more robust so we can retire
netifaces
. As this code is a decade old (back when we were using Python 2.4 and Python 2.5), we should also investigate using new features in the standard Python library that provide the same functionality.Historical context: in the past (16 years ago!), Tribler would recognize its WAN addresses by running commands with
os.popen
😃 . This is whatnetifaces
originally replaced. Trivia: we also hadupnp
back then.The text was updated successfully, but these errors were encountered: