#![warn(missing_docs)]
#![allow(dead_code, reason = "scaffolding for modules under active development")]
#![expect(
clippy::must_use_candidate,
reason = "service methods are call-and-forget; callers rarely use return"
)]
#![expect(
clippy::doc_markdown,
reason = "SSH-specific terms like ed25519 trigger false positives"
)]
pub use toride_ssh_core::*;
pub use toride_ssh_config as config;
pub use toride_ssh_key as key;
#[cfg(feature = "agent")]
pub use toride_ssh_agent as agent;
#[cfg(feature = "authorized-keys")]
pub use toride_ssh_authorized_keys as authorized_keys;
#[cfg(feature = "certificate")]
pub use toride_ssh_certificate as certificate;
#[cfg(feature = "doctor")]
pub use toride_ssh_doctor as doctor;
#[cfg(feature = "forward")]
pub use toride_ssh_forward as forward;
#[cfg(feature = "known-hosts")]
pub use toride_ssh_known_hosts as known_hosts;
use std::sync::Arc;
#[derive(Clone)]
pub struct SshManager {
paths: SshPaths,
runner: Arc<dyn CliRunner>,
}
impl Default for SshManager {
fn default() -> Self {
Self {
paths: SshPaths::default(),
runner: Arc::new(DefaultCliRunner),
}
}
}
impl SshManager {
pub fn new() -> Result<Self> {
let paths = SshPaths::new()?;
Ok(Self {
paths,
runner: Arc::new(DefaultCliRunner),
})
}
pub fn with_cli_runner(runner: Arc<dyn CliRunner>) -> Result<Self> {
let paths = SshPaths::new()?;
Ok(Self { paths, runner })
}
pub fn keys(&self) -> key::KeyService<'_> {
key::KeyService::new(&self.paths, &*self.runner)
}
pub fn config(&self) -> config::ConfigService<'_> {
config::ConfigService::new(&self.paths)
}
#[cfg(feature = "agent")]
pub fn agent(&self) -> agent::AgentService<'_> {
agent::AgentService::new(&self.paths, &*self.runner)
}
#[cfg(feature = "authorized-keys")]
pub fn authorized_keys(&self) -> authorized_keys::AuthorizedKeysService<'_> {
authorized_keys::AuthorizedKeysService::new(&self.paths)
}
#[cfg(feature = "doctor")]
pub fn doctor(&self) -> doctor::DoctorService<'_> {
doctor::DoctorService::new(&self.paths, &*self.runner)
}
#[cfg(feature = "known-hosts")]
pub fn known_hosts(&self) -> known_hosts::KnownHostsService<'_> {
known_hosts::KnownHostsService::new(&self.paths, &*self.runner)
}
#[cfg(feature = "certificate")]
pub fn certificate(&self) -> certificate::CertificateService {
certificate::CertificateService::new()
}
#[cfg(feature = "forward")]
pub fn forward(&self) -> forward::ForwardService<'_> {
forward::ForwardService::new(&self.paths)
}
}