4 releases (breaking)

Uses new Rust 2024

0.4.0 Feb 5, 2026
0.3.0 Jan 28, 2026
0.2.0 Nov 3, 2025
0.1.0 Oct 11, 2025

#15 in #scion

32 downloads per month
Used in 8 crates (3 directly)

Apache-2.0

740KB
14K SLoC

The SCION endhost API library.


lib.rs:

SCION Endhost API

Connect RPC API endpoint handlers and utilities to embed the endhost API into an existing axum::Router.

Basic Usage

use std::{net::SocketAddr, sync::Arc};

use endhost_api::routes::nest_endhost_api;
use endhost_api_models::{PathDiscovery, UnderlayDiscovery};
use tokio::net::TcpListener;

struct MyUnderlayService;
impl UnderlayDiscovery for MyUnderlayService {
    fn list_underlays(
        &self,
        request_as: scion_proto::address::IsdAsn,
    ) -> endhost_api_models::underlays::Underlays {
        todo!();
    }
}

struct MyPathService;
#[async_trait::async_trait]
impl PathDiscovery for MyPathService {
    async fn list_segments(
        &self,
        request_as: scion_proto::address::IsdAsn,
        dst: scion_proto::address::IsdAsn,
        page_size: i32,
        page_token: String,
    ) -> Result<scion_proto::path::segment::SegmentsPage, scion_proto::path::SegmentsError>
    {
        todo!();
    }
}

let base_router = axum::Router::<()>::new();
let router = nest_endhost_api(
    base_router,
    Arc::new(MyUnderlayService),
    Arc::new(MyPathService),
);

let listener = TcpListener::bind(SocketAddr::from(([127, 0, 0, 1], 0)))
    .await
    .unwrap();
axum::serve(listener, router.into_make_service())
    .await
    .unwrap();

Dependencies

~26MB
~383K SLoC