#ip-address #networking #linux-networking #addresses #interface #events #list

no-std cotton-netif

Enumerating available network interfaces and their IP addresses

5 releases

0.0.5 Sep 27, 2024
0.0.4 Apr 24, 2023
0.0.3 Mar 29, 2023
0.0.2 Jan 22, 2023
0.0.1 Jan 22, 2023

#1621 in Network programming

24 downloads per month
Used in cotton-ssdp

CC0 license

70KB
2K SLoC

CI status codecov dependency status Crates.io Crates.io docs.rs License: CC0-1.0

cotton-netif

Part of the Cotton project.

Enumerating network interfaces and their IP addresses

The cotton-netif library crate encapsulates the obtaining of the host’s network interfaces and IP addresses. It supports both static/synchronous listing (i.e., a snapshot of the current list of network interfaces) using get_interfaces and dynamic/asynchronous listing (i.e., getting events as network interfaces and addresses come and go) using get_interfaces_async.

At present this crate only works on Linux (and maybe BSD) but the structure is such that adding compatibility with other platforms in future, shouldn’t require changes to any client code.

Library documentation is on docs.rs.

Dependencies

~0.2–8.5MB
~78K SLoC