Small updates to interface printing
This commit is contained in:
parent
adda5dd958
commit
4c4b3bc202
@ -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<P: AsRef<Path>>(iface: Interface, port: &u16, path: P) -> io::Result<()> {
|
||||
for entry in fs::read_dir(path)? {
|
||||
@ -11,8 +11,10 @@ fn print_single_interface<P: AsRef<Path>>(iface: Interface, port: &u16, path: P)
|
||||
|
||||
let filename = entry_path.file_name().unwrap();
|
||||
|
||||
if let IfAddr::V4(_) = iface.addr {
|
||||
println!("http://{}:{}/{}", iface.ip(), port, filename.to_str().unwrap());
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user