endhost-api-models 0.3.0

Connect RPC client library for reqwest based clients
Documentation
// Copyright 2025 Anapaya Systems
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//   http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//! Endhost API models library.

use scion_proto::{
    address::IsdAsn,
    path::{SegmentsError, segment::SegmentsPage},
};

use crate::underlays::Underlays;

pub mod underlays;

/// Underlay discovery trait.
pub trait UnderlayDiscovery: Send + Sync {
    /// List the underlays available to reach the given ISD-AS.
    fn list_underlays(&self, isd_as: IsdAsn) -> Underlays;
}

/// Path discovery trait.
#[async_trait::async_trait]
pub trait PathDiscovery: Send + Sync {
    /// List path segments between the given source and destination ISD-ASes.
    async fn list_segments(
        &self,
        src: IsdAsn,
        dst: IsdAsn,
        page_size: i32,
        page_token: String,
    ) -> Result<SegmentsPage, SegmentsError>;
}