Skip to main content

Module client

Module client 

Source
Expand description

§Endhost API client

An EndhostApiClient provides the application with the information necessary to send and receive SCION-packets in the routing domain that is associated with the endhost API.

The implementation CrpcEndhostApiClient is a concrete implementation following the current specification of the endhost-API.

§Example Usage

use std::{net::SocketAddr, str::FromStr};

use endhost_api_client::client::{CrpcEndhostApiClient, EndhostApiClient};
use scion_proto::address::IsdAsn;

pub async fn get_all_udp_sockaddrs() -> anyhow::Result<Vec<SocketAddr>> {
    let crpc_client =
        CrpcEndhostApiClient::new(&url::Url::parse("http://10.0.0.1:48080/").unwrap())?;

    let res = crpc_client
        .list_underlays(IsdAsn::from_str("1-ff00:0:110").unwrap())
        .await?
        .udp_underlay
        .iter()
        .map(|router| router.internal_interface)
        .collect();

    Ok(res)
}

Structs§

CrpcEndhostApiClient
Connect RPC endhost API client.

Traits§

EndhostApiClient
Endhost API client trait.