1use std::fmt::Debug;
2
3use async_trait::async_trait;
4use bytes::Bytes;
5
6use crate::Error;
7
8#[cfg(feature = "ssh")]
9mod ssh;
10#[cfg(feature = "ssh")]
11pub use self::ssh::{Password, Ssh};
12
13#[cfg(feature = "tls")]
14mod tls;
15#[cfg(feature = "tls")]
16pub use self::tls::Tls;
17
18#[cfg(feature = "junos")]
19mod junos_local;
20#[cfg(feature = "junos")]
21pub use self::junos_local::JunosLocal;
22
23pub trait Transport: Send {
24 type SendHandle: SendHandle;
25 type RecvHandle: RecvHandle;
26
27 fn split(self) -> (Self::SendHandle, Self::RecvHandle);
28}
29
30#[async_trait]
31pub trait SendHandle: Debug + Send {
32 async fn send(&mut self, data: Bytes) -> Result<(), Error>;
33}
34
35#[async_trait]
36pub trait RecvHandle: Debug + Send {
37 async fn recv(&mut self) -> Result<Bytes, Error>;
38}