netconfig_rs/sys/posix/
mod.rs1mod handle;
2mod ifacename;
3pub mod ifreq;
4
5use crate::Error;
6pub use ifacename::InterfaceName;
7
8use std::net;
9
10pub(crate) mod ioctls;
11
12pub(crate) fn dummy_socket() -> Result<net::UdpSocket, Error> {
13 Ok(net::UdpSocket::bind("0:0")?)
14}
15
16pub(crate) fn list_interfaces() -> Result<Vec<crate::Interface>, Error> {
17 Ok(nix::net::if_::if_nameindex()?
18 .iter()
19 .map(|a| unsafe { crate::Interface::from_index_unchecked(a.index()) })
20 .collect())
21}