X-Git-Url: https://code.octet-stream.net/netwatcher/blobdiff_plain/db2bad72106542d4e785e6ed277e73ac8a11c9bc..4abfa61b20e567fdd69ac3ca47a9c218971a30ff:/src/list_unix.rs diff --git a/src/list_unix.rs b/src/list_unix.rs index a6b2bd3..45ffc63 100644 --- a/src/list_unix.rs +++ b/src/list_unix.rs @@ -1,11 +1,9 @@ use std::fmt::Write; use std::{collections::HashMap, net::IpAddr}; -use block2::Block; -use nix::libc::c_long; use nix::{ifaddrs::getifaddrs, net::if_::if_nametoindex}; -use crate::{Error, IfIndex, Interface}; +use crate::{Error, Interface, List}; struct CandidateInterface { name: String, @@ -14,7 +12,7 @@ struct CandidateInterface { ips: Vec, } -pub(crate) fn list_interfaces() -> Result, Error> { +pub(crate) fn list_interfaces() -> Result { let addrs = getifaddrs().map_err(|_| Error::Internal)?; let mut candidates = HashMap::new(); @@ -59,7 +57,7 @@ pub(crate) fn list_interfaces() -> Result, Error> { }) }) .collect(); - Ok(ifs) + Ok(List(ifs)) } fn format_mac(bytes: &[u8]) -> Result {