From 4c4b3bc20224c856b3437ebe1eae263afa0953fa Mon Sep 17 00:00:00 2001 From: Random936 Date: Sun, 22 Dec 2024 18:47:53 -0800 Subject: [PATCH] Small updates to interface printing --- src/print_dir.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/print_dir.rs b/src/print_dir.rs index d315d44..1219bcc 100644 --- a/src/print_dir.rs +++ b/src/print_dir.rs @@ -1,7 +1,7 @@ use std::{fs, io}; use std::net::IpAddr; use std::path::Path; -use if_addrs::{Interface, get_if_addrs}; +use if_addrs::{get_if_addrs, IfAddr, Interface}; fn print_single_interface>(iface: Interface, port: &u16, path: P) -> io::Result<()> { for entry in fs::read_dir(path)? { @@ -11,7 +11,9 @@ fn print_single_interface>(iface: Interface, port: &u16, path: P) let filename = entry_path.file_name().unwrap(); - println!("http://{}:{}/{}", iface.ip(), port, filename.to_str().unwrap()); + if let IfAddr::V4(_) = iface.addr { + println!("http://{}:{}/{}", iface.ip(), port, filename.to_str().unwrap()); + } } Ok(())