netconfig-rs 0.1.6

Crate for managing network interfaces and IP addresses in a cross-platform way
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use windows::Win32::Networking::WinSock::AF_UNSPEC;

use crate::sys::mib_table::MibTable;
use crate::{Error, Interface};
pub use handle::InterfaceExt;

mod handle;
pub(crate) mod mib_table;

pub(crate) fn list_interfaces() -> Result<Vec<Interface>, Error> {
    MibTable::GetIpInterfaceTable(&AF_UNSPEC)?
        .as_slice()
        .iter()
        .map(|row| Interface::try_from_index(row.InterfaceIndex))
        .collect()
}