mirror of
https://github.com/domcyrus/rustnet.git
synced 2026-01-08 06:49:51 -06:00
adding interface name to TUI
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user