lmrc_ssh/lib.rs
1//! # SSH Manager
2//!
3//! A comprehensive Rust library for executing SSH commands programmatically.
4//!
5//! ## Features
6//!
7//! - Simple and intuitive API for SSH connections
8//! - Execute remote commands with ease
9//! - Flexible authentication (password, public key)
10//! - Comprehensive error handling
11//! - Well-documented with examples
12//!
13//! ## Quick Start
14//!
15//! ```rust,no_run
16//! use lmrc_ssh::{SshClient, AuthMethod};
17//!
18//! # fn main() -> Result<(), lmrc_ssh::Error> {
19//! // Connect with password authentication
20//! let mut client = SshClient::new("example.com", 22)?
21//! .with_auth(AuthMethod::Password {
22//! username: "user".to_string(),
23//! password: "pass".to_string(),
24//! })
25//! .connect()?;
26//!
27//! // Execute a command
28//! let output = client.execute("ls -la")?;
29//! println!("Output: {}", output.stdout);
30//! # Ok(())
31//! # }
32//! ```
33//!
34//! ## Examples
35//!
36//! ### Password Authentication
37//!
38//! ```rust,no_run
39//! use lmrc_ssh::{SshClient, AuthMethod};
40//!
41//! # fn main() -> Result<(), lmrc_ssh::Error> {
42//! let mut client = SshClient::new("192.168.1.100", 22)?
43//! .with_auth(AuthMethod::Password {
44//! username: "admin".to_string(),
45//! password: "secret".to_string(),
46//! })
47//! .connect()?;
48//!
49//! let result = client.execute("whoami")?;
50//! println!("Current user: {}", result.stdout);
51//! # Ok(())
52//! # }
53//! ```
54//!
55//! ### Public Key Authentication
56//!
57//! ```rust,no_run
58//! use lmrc_ssh::{SshClient, AuthMethod};
59//!
60//! # fn main() -> Result<(), lmrc_ssh::Error> {
61//! let mut client = SshClient::new("example.com", 22)?
62//! .with_auth(AuthMethod::PublicKey {
63//! username: "user".to_string(),
64//! private_key_path: "/home/user/.ssh/id_rsa".to_string(),
65//! passphrase: None,
66//! })
67//! .connect()?;
68//!
69//! let result = client.execute("hostname")?;
70//! println!("Hostname: {}", result.stdout);
71//! # Ok(())
72//! # }
73//! ```
74
75mod client;
76mod error;
77mod output;
78
79pub use client::{AuthMethod, SshClient};
80pub use error::{Error, Result};
81pub use output::CommandOutput;