Small updates to interface printing
This commit is contained in:
parent
adda5dd958
commit
4c4b3bc202
@ -1,7 +1,7 @@
|
|||||||
use std::{fs, io};
|
use std::{fs, io};
|
||||||
use std::net::IpAddr;
|
use std::net::IpAddr;
|
||||||
use std::path::Path;
|
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<()> {
|
fn print_single_interface<P: AsRef<Path>>(iface: Interface, port: &u16, path: P) -> io::Result<()> {
|
||||||
for entry in fs::read_dir(path)? {
|
for entry in fs::read_dir(path)? {
|
||||||
@ -11,7 +11,9 @@ fn print_single_interface<P: AsRef<Path>>(iface: Interface, port: &u16, path: P)
|
|||||||
|
|
||||||
let filename = entry_path.file_name().unwrap();
|
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(())
|
Ok(())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user