X-Git-Url: https://code.octet-stream.net/netwatcher/blobdiff_plain/244781f32194c2498ef0e3b8225a9ff9791624af..7cbddf0b21f7cf98b46c66a430eb8221f3622d55:/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 {