1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
pub use async_ssh2_lite;
pub use bb8;

#[cfg(feature = "tokio")]
mod impl_tokio;
#[cfg(feature = "tokio")]
pub use impl_tokio::{AsyncSessionManagerWithTokioTcpStream, AsyncSftpManagerWithTokioTcpStream};

//
//
//
#[derive(Debug, Clone)]
pub enum AsyncSessionUserauthType {
    Password {
        password: String,
    },
    Agent,
    PubkeyFile {
        pubkey: Option<std::path::PathBuf>,
        privatekey: std::path::PathBuf,
        passphrase: Option<String>,
    },
}

//
//
//
#[derive(Debug)]
pub enum AsyncSessionManagerError {
    ConnectError(async_ssh2_lite::Error),
    HandshakeError(async_ssh2_lite::Error),
    UserauthError(async_ssh2_lite::Error),
    AssertAuthenticated,
    Unknown(String),
}
impl core::fmt::Display for AsyncSessionManagerError {
    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
        write!(f, "{self:?}")
    }
}
impl std::error::Error for AsyncSessionManagerError {}

//
//
//
#[derive(Debug)]
pub enum AsyncSftpManagerError {
    AsyncSessionManagerError(AsyncSessionManagerError),
    OpenError(async_ssh2_lite::Error),
}
impl core::fmt::Display for AsyncSftpManagerError {
    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
        write!(f, "{self:?}")
    }
}
impl std::error::Error for AsyncSftpManagerError {}