use std::future::Future;
use tokio::sync::mpsc::UnboundedSender;
#[derive(Debug, Clone, PartialEq, Eq, thiserror::Error)]
pub enum TransportError {
#[error("connection lost: {0}")]
ConnectionLost(String),
#[error("could not connect: {0}")]
Connect(String),
}
pub trait Transport: Send + Sync + 'static {
fn run(
&self,
script: &str,
output: UnboundedSender<String>,
) -> impl Future<Output = Result<i32, TransportError>> + Send;
fn reconnect(&self) -> impl Future<Output = Result<(), TransportError>> + Send;
}
#[cfg(unix)]
mod ssh;
#[cfg(unix)]
pub use ssh::SshTransport;