warpgate/warpgate-common/src/protocols/mod.rs
2022-07-15 20:27:33 +02:00

28 lines
691 B
Rust

mod handle;
use std::net::SocketAddr;
use anyhow::Result;
use async_trait::async_trait;
pub use handle::{SessionHandle, WarpgateServerHandle};
use crate::Target;
#[derive(Debug, thiserror::Error)]
pub enum TargetTestError {
#[error("unreachable")]
Unreachable,
#[error("authentication failed")]
AuthenticationError,
#[error("connection error")]
ConnectionError(String),
#[error("misconfigured")]
Misconfigured(String),
#[error("I/O")]
Io(#[from] std::io::Error),
}
#[async_trait]
pub trait ProtocolServer {
async fn run(self, address: SocketAddr) -> Result<()>;
async fn test_target(self, target: Target) -> Result<(), TargetTestError>;
}