INNER CODE UNIT · Rust
find_capture_device
domcyrus/rustnet · crates/rustnet-capture/src/lib.rs:399
fn find_capture_device(interface_name: &Option<String>) -> Result<Device> {
match interface_name {
Some(name) => {
log::info!("Looking for interface: {}", name);
if name == "any" {
#[cfg(not(target_os = "linux"))]
{
return Err(anyhow!(
"The 'any' interface is only supported on Linux.\n\
On your platform, please specify a specific interface with -i <interface>.\n\
Run without -i to auto-detect the default interface."
));
}
#[cfg(target_os = "linux")]
{
log::info!("Using 'any' pseudo-interface to capture on all interfaces");