mirror of
https://github.com/warp-tech/warpgate.git
synced 2025-09-05 06:04:23 +08:00
28 lines
691 B
Rust
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>;
|
|
}
|