codive-relay 0.1.0

Relay server for secure tunneling
Documentation
//! HTTP routes for the relay server

mod agent;
mod proxy;

use axum::Router;
use std::sync::Arc;

use crate::state::RelayState;

pub use agent::agent_ws_handler;
pub use proxy::proxy_handler;

/// Create all routes for the relay server
pub fn routes() -> Router<Arc<RelayState>> {
    Router::new()
        .route("/health", axum::routing::get(health))
        .route("/agent", axum::routing::get(agent::agent_ws_handler))
        // Proxy routes will catch all other requests and route by subdomain
        .fallback(proxy::proxy_handler)
}

/// Health check endpoint
async fn health() -> &'static str {
    "OK"
}