proxy-pilot 0.7.0

Core-agnostic proxy health monitor, automatic failover daemon, and multi-channel alerting tool for Linux servers.
Documentation
pub mod xray;

use std::collections::HashMap;

use async_trait::async_trait;

use crate::error::Result;

/// A temporary, isolated proxy instance exposing one local proxy URL per outbound tag
/// so all profiles can be probed concurrently without restarting the live service.
#[async_trait]
pub trait BenchmarkSession: Send + Sync {
    /// Map of `outbound_tag -> local proxy URL` (e.g. `socks5h://127.0.0.1:24501`).
    fn endpoints(&self) -> &HashMap<String, String>;
    /// Gracefully stop the temporary proxy instance and remove temporary files.
    async fn shutdown(self: Box<Self>) -> Result<()>;
}

/// Abstraction over a proxy runtime core (e.g. Xray, sing-box).
#[async_trait]
pub trait ProxyCore: Send + Sync {
    fn name(&self) -> &'static str;
    async fn is_installed(&self) -> bool;
    async fn install(&self) -> Result<()>;
    async fn active_profile(&self) -> Result<Option<String>>;
    async fn switch_profile(&self, outbound_tag: &str) -> Result<()>;
    async fn reload(&self) -> Result<()>;

    /// Optionally start an isolated, non-disruptive benchmark session exposing
    /// a dedicated local proxy endpoint for each requested outbound tag.
    /// Returning `Ok(None)` falls back to sequential switch+reload benchmarking.
    async fn start_benchmark_session(
        &self,
        _outbound_tags: &[String],
    ) -> Result<Option<Box<dyn BenchmarkSession>>> {
        Ok(None)
    }
}