pub struct SshManager { /* private fields */ }Expand description
Entry point for all SSH management operations.
SshManager is cheaply Clone-able and safe to share
across async tasks. Each subsystem is accessed via a dedicated
accessor method (e.g. keys(), config()).
§Examples
use toride_ssh::SshManager;
let mgr = SshManager::new()?;
let keys = mgr.keys().list().await?;
println!("Found {} keys", keys.len());Implementations§
Source§impl SshManager
impl SshManager
Sourcepub fn new() -> Result<Self>
pub fn new() -> Result<Self>
Create a new manager resolving ~/.ssh from the user’s home directory.
Uses DefaultCliRunner for all CLI operations. For tests, prefer
with_cli_runner with a MockCliRunner.
§Errors
Returns Error::HomeNotFound if the user’s home directory cannot
be resolved.
Sourcepub fn with_cli_runner(runner: Arc<dyn CliRunner>) -> Result<Self>
pub fn with_cli_runner(runner: Arc<dyn CliRunner>) -> Result<Self>
Create a manager with a custom CliRunner.
This is the primary injection point for tests: pass a
MockCliRunner to control command execution without spawning
real SSH processes.
§Errors
Returns Error::HomeNotFound if the user’s home directory cannot
be resolved.
§Examples
use std::sync::Arc;
use toride_ssh::{SshManager, MockCliRunner};
let mock = Arc::new(MockCliRunner::new());
mock.set_tool_exists("ssh-keygen", true);
let mgr = SshManager::with_cli_runner(mock)?;Sourcepub fn keys(&self) -> KeyService<'_>
pub fn keys(&self) -> KeyService<'_>
Key management operations.
Sourcepub fn config(&self) -> ConfigService<'_>
pub fn config(&self) -> ConfigService<'_>
SSH config operations.
Sourcepub fn agent(&self) -> AgentService<'_>
pub fn agent(&self) -> AgentService<'_>
SSH agent operations.
authorized_keys management (listing, adding, removing keys).
Sourcepub fn doctor(&self) -> DoctorService<'_>
pub fn doctor(&self) -> DoctorService<'_>
Diagnostic checks.
Sourcepub fn known_hosts(&self) -> KnownHostsService<'_>
pub fn known_hosts(&self) -> KnownHostsService<'_>
Known hosts management (listing, scanning, adding, removing).
Sourcepub fn forward(&self) -> ForwardService<'_>
pub fn forward(&self) -> ForwardService<'_>
Port forwarding management via ControlMaster.
Trait Implementations§
Source§impl Clone for SshManager
impl Clone for SshManager
Source§impl Default for SshManager
impl Default for SshManager
Source§fn default() -> Self
fn default() -> Self
Return a best-effort manager using DefaultCliRunner.
Falls back to ~/.ssh if the home directory is unavailable.