ssh_utils_lib/ssh/
ssh_session.rs1use anyhow::Result;
2use russh_keys::key;
3use tokio::net::ToSocketAddrs;
4
5#[async_trait::async_trait]
6pub trait SshSession {
7 async fn connect<A: ToSocketAddrs + Send>(
8 user: impl Into<String> + Send,
9 auth: impl Into<AuthMethod> + Send,
10 addrs: A,
11 ) -> Result<Self>
12 where
13 Self: Sized;
14
15 async fn call(&mut self, command: &str) -> Result<u32>;
16 async fn close(&mut self) -> Result<()>;
17}
18
19pub enum AuthMethod {
20 Password(String),
21 Key(key::KeyPair),
22}