Skip to content

Commit

Permalink
temporarily print link type infos of all the adapters
Browse files Browse the repository at this point in the history
  • Loading branch information
GyulyVGC committed Dec 31, 2023
1 parent e1e388a commit e853a40
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,31 @@ pub const SNIFFNET_LOWERCASE: &str = "sniffnet";
///
/// It initializes shared variables and loads configuration parameters
pub fn main() -> iced::Result {

for device in pcap::Device::list().expect("device lookup failed") {
println!("Found device! {:?}", device.name);

let Ok(cap) = pcap::Capture::from_device(device) else {
println!(" Error creating capture");
continue;
};
let Ok(cap) = cap.immediate_mode(true).open() else {
println!(" Error opening capture");
continue;
};

{
let l = cap.get_datalink();
println!(" Main data link: {:?} {:?} {:?}", l, l.get_name(), l.get_description())
}

if let Ok(links) = cap.list_datalinks() {
for l in links {
println!(" {:?} {:?} {:?}", l, l.get_name(), l.get_description());
}
}
}

parse_cli_args();

let configs1 = Arc::new(Mutex::new(Configs::load()));
Expand Down

0 comments on commit e853a40

Please sign in to comment.