pub struct Ops { /* private fields */ }Expand description
High-level operations used by CLI/TUI/GUI/MCP to keep behavior consistent.
Implementations§
Source§impl Ops
impl Ops
pub async fn resolve_host_ip(&self, host: &str) -> Result<IpAddr>
pub async fn ping_host_summary( &self, host: &str, count: u32, ) -> Result<PingSummary>
pub async fn trace_route( &self, host: &str, max_hops: u32, resolve: bool, ) -> Result<TraceResult>
pub async fn trace_route_with_progress( &self, host: &str, max_hops: u32, resolve: bool, progress: Option<Sender<String>>, ) -> Result<TraceResult>
pub async fn reverse_lookup(&self, ip: &str) -> Result<Option<String>>
pub async fn dns_lookup( &self, host: &str, record: Option<String>, ) -> Result<Vec<DnsRecord>>
Source§impl Ops
impl Ops
pub fn list_interfaces(&self) -> Vec<InterfaceInfo>
Sourcepub async fn get_arp_table(&self) -> Result<Vec<ArpEntry>>
pub async fn get_arp_table(&self) -> Result<Vec<ArpEntry>>
Read the local ARP/neighbour table.
Async, and it moves the read to a blocking thread, because on Windows
and macOS this shells out to arp and waits on the child process.
Every other method on Ops is async, so a sync one here invited
exactly the bug it produced: three separate callers — the MCP tool
dispatcher, the Tauri command, and DiscoverEngine — all invoked it
straight from an async context and parked a runtime worker on
waitpid for the life of the subprocess.
The MCP case was the sharp one. Its handlers are capped at 16
concurrent, and the read loop is itself a task on the same pool, so
sixteen get_arp_table calls could stall every worker — including
the one reading stdin. No further request would even be parsed, and
a cancellation could not get through.
Source§impl Ops
impl Ops
pub fn pcap_check_support(&self) -> Result<Vec<String>>
pub fn capture_pcap( &self, interface: String, filter: Option<String>, duration: Option<u64>, output_file: Option<String>, max_packets: Option<usize>, ) -> Result<PcapResult>
pub fn parse_pcap_file( &self, input_file: String, max_packets: Option<usize>, ) -> Result<PcapParseResult>
Sourcepub async fn capture_pcap_async(
&self,
interface: String,
filter: Option<String>,
duration: Option<u64>,
output_file: Option<String>,
max_packets: Option<usize>,
) -> Result<PcapResult>
pub async fn capture_pcap_async( &self, interface: String, filter: Option<String>, duration: Option<u64>, output_file: Option<String>, max_packets: Option<usize>, ) -> Result<PcapResult>
Async-friendly PCAP capture wrapper.
PCAP capture is inherently blocking (libpcap read loop + file I/O). This runs it in a dedicated blocking thread so async runtimes (CLI/Tauri/MCP) remain responsive.
pub async fn capture_pcap_async_with_cancel( &self, interface: String, filter: Option<String>, duration: Option<u64>, output_file: Option<String>, max_packets: Option<usize>, cancel: Option<PcapCancelToken>, ) -> Result<PcapResult>
Source§impl Ops
impl Ops
pub async fn discover_ipv4( &self, subnet: Option<String>, resolve: bool, ) -> Result<(String, Vec<Host>)>
pub async fn discover_ipv4_with_progress( &self, subnet: Option<String>, resolve: bool, progress: Option<Arc<dyn Fn(DiscoverProgress) + Send + Sync>>, ) -> Result<(String, Vec<Host>)>
pub async fn scan_ports( &self, host: &str, ports: Option<Vec<u16>>, ) -> Result<(IpAddr, Vec<PortResult>)>
pub async fn scan_ports_with_progress( &self, host: &str, ports: Option<Vec<u16>>, progress: Option<Arc<dyn Fn(PortScanProgress) + Send + Sync>>, ) -> Result<(IpAddr, Vec<PortResult>)>
Sourcepub async fn scan_udp_ports_with_progress(
&self,
host: &str,
ports: Option<Vec<u16>>,
progress: Option<Arc<dyn Fn(PortScanProgress) + Send + Sync>>,
) -> Result<(IpAddr, Vec<PortResult>)>
pub async fn scan_udp_ports_with_progress( &self, host: &str, ports: Option<Vec<u16>>, progress: Option<Arc<dyn Fn(PortScanProgress) + Send + Sync>>, ) -> Result<(IpAddr, Vec<PortResult>)>
Probe ports on host over UDP, or crate::DEFAULT_UDP_PORTS when
none are given. See scan/udp.rs for what each status means.
pub async fn scan_udp_ports( &self, host: &str, ports: Option<Vec<u16>>, ) -> Result<(IpAddr, Vec<PortResult>)>
pub async fn inspect_host( &self, host: String, ports: Option<Vec<u16>>, ) -> Result<InspectResult>
pub async fn sweep_ipv4( &self, subnet: Option<String>, ports: Option<Vec<u16>>, resolve_hostnames: bool, ) -> Result<(String, Vec<SweepEntry>)>
pub async fn sweep_ipv4_with_progress( &self, subnet: Option<String>, ports: Option<Vec<u16>>, resolve_hostnames: bool, progress: Option<Arc<dyn Fn(SweepProgress) + Send + Sync>>, ) -> Result<(String, Vec<SweepEntry>)>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Ops
impl RefUnwindSafe for Ops
impl Send for Ops
impl Sync for Ops
impl Unpin for Ops
impl UnsafeUnpin for Ops
impl UnwindSafe for Ops
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more