#interface #ifaddrs #networking #getifaddrs #mtu #network-interface

getifs

Get network interfaces information (including MTU) in a fast way (say bye to libc::getifaddrs)

1 unstable release

new 0.1.0 Jan 12, 2025

#2 in #ifaddrs

MIT/Apache

76KB
2K SLoC

Get Interfaces

Get network interfaces information (including MTU) in a fast way (say bye to libc::getifaddrs).

github LoC Build codecov

docs.rs crates.io crates.io license

Installation

[dependencies]
getifs = "0.1"

Details

OS Approach
Linux socket(AF_NETLINK, SOCK_RAW | SOCK_CLOEXEC, NETLINK_ROUTE)
BSD-based Uses of sysctl to retrieve network interfaces
Windows GetAdaptersAddresses

Why a new network interfaces crate?

Because all of current network interfaces crates do not support fetching MTU, and almost all of them are using libc::getifaddrs. This crate tries to avoid unneeded allocation and use more underlying method to achieve the same functionalities.

License

getifs is under the terms of both the MIT license and the Apache License (Version 2.0).

See LICENSE-APACHE, LICENSE-MIT for details.

Copyright (c) 2025 Al Liu.

Dependencies

~2–12MB
~161K SLoC