INNER CODE UNIT · Rust

Some

domcyrus/rustnet · crates/rustnet-capture/src/lib.rs:422

            if let Some(device) = devices.iter().find(|d| d.name == *name) {
                return Ok(device.clone());
            }

            let name_lower = name.to_lowercase();
            if let Some(device) = devices.iter().find(|d| d.name.to_lowercase() == name_lower) {
                return Ok(device.clone());
            }

            // Windows: pcap device names are `\Device\NPF_{GUID}`, which
            // nobody types. Resolve a friendly alias ("Ethernet", "Wi-Fi")
            // to its adapter GUID and retry against the NPF name.
            #[cfg(windows)]
            if let Some(npf_name) = windows_alias_to_npf_name(name) {
                let npf_lower = npf_name.to_lowercase();
                if let Some(device) = devices.iter().find(|d| d.name.to_lowercase() == npf_lower) {
                    log::info!("Resolved interface alias '{}' to '{}'", name, device.name);
                    return Ok(device.clone());

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…