Skip to main content

ssh_commander_core/tools/
mod.rs

1//! Network/dev tools surface — features that ride on top of an existing
2//! SSH connection without requiring a separate protocol implementation.
3//!
4//! Submodules:
5//! - `git`     — git deploy-state for a repo on a remote host
6//! - `dns`     — multi-perspective DNS resolution across all connected hosts
7//! - `ports`   — listening-port inventory via `ss` / `netstat`
8//! - `tcpdump` — streaming packet capture via `tcpdump -lnn`, lines emitted
9//!   to the event bus for real-time UI display
10//!
11//! All tools share `ToolsError` so the FFI surface can present a single error
12//! type to callers regardless of which sub-feature failed.
13
14pub mod dns;
15pub mod git;
16pub mod ports;
17pub mod tcpdump;
18
19use thiserror::Error;
20
21#[derive(Debug, Error)]
22pub enum ToolsError {
23    #[error("connection not found: {0}")]
24    ConnectionNotFound(String),
25
26    #[error("connection is not SSH: {0}")]
27    NotSshConnection(String),
28
29    #[error("remote command failed (exit {exit:?}): {message}")]
30    RemoteCommand { exit: Option<i32>, message: String },
31
32    #[error("ssh exec failed: {0}")]
33    SshExec(String),
34
35    #[error("parse error: {0}")]
36    Parse(String),
37
38    #[error("capture not found: {0}")]
39    CaptureNotFound(u64),
40
41    #[error("io: {0}")]
42    Io(#[from] std::io::Error),
43}
44
45pub use dns::{DnsAnswer, DnsQuery, dns_resolve_local, dns_resolve_remote};
46pub use git::{GitStatus, git_status};
47pub use ports::{ListeningPort, listening_ports};
48pub use tcpdump::{TcpdumpEvent, TcpdumpRegistry};