Skip to main content

proxy_pilot/probe/
mod.rs

1pub mod http;
2
3use std::time::Duration;
4
5use async_trait::async_trait;
6
7use crate::config::ProbeTarget;
8use crate::error::Result;
9
10#[derive(Debug, Clone, PartialEq, Eq)]
11pub enum ProbeOutcome {
12    Healthy { status: u16, latency: Duration },
13    GeoBlocked { status: u16 },
14    Unreachable { reason: String },
15}
16
17impl ProbeOutcome {
18    pub fn is_healthy(&self) -> bool {
19        matches!(self, Self::Healthy { .. })
20    }
21}
22
23/// Abstraction over health-check probes executed through a proxy endpoint.
24#[async_trait]
25pub trait HealthProbe: Send + Sync {
26    async fn check(&self, target: &ProbeTarget) -> Result<ProbeOutcome>;
27}