adding interface name to TUI

This commit is contained in:
Marco Cadetg
2025-06-30 14:31:43 +02:00
parent 0eee869a2b
commit 2ebabdd438
3 changed files with 29 additions and 8 deletions

View File

@@ -132,7 +132,7 @@ fn find_best_device() -> Result<Device> {
}
/// Setup packet capture with the given configuration
pub fn setup_packet_capture(config: CaptureConfig) -> Result<Capture<Active>> {
pub fn setup_packet_capture(config: CaptureConfig) -> Result<(Capture<Active>, String)> {
// Find the capture device
let device = find_capture_device(&config.interface)?;
@@ -142,6 +142,8 @@ pub fn setup_packet_capture(config: CaptureConfig) -> Result<Capture<Active>> {
device.desc.as_deref().unwrap_or("no description")
);
let device_name = device.name.clone();
// Create capture handle
let mut cap = Capture::from_device(device)?
.promisc(config.promiscuous)
@@ -161,7 +163,7 @@ pub fn setup_packet_capture(config: CaptureConfig) -> Result<Capture<Active>> {
// Note: We're not setting non-blocking mode as we're using timeout instead
Ok(cap)
Ok((cap, device_name))
}
/// Find a capture device by name or return the default