Skip to main content

Crate iroh_services

Crate iroh_services 

Source
Expand description

iroh-services is the client side of interacting with iroh-services. iroh-services gives visibility into a running iroh network by pushing metrics aggregations from iroh endpoints into a central hub for monitoring.

Typical setup looks something like this:

use iroh::{Endpoint, endpoint::presets};
use iroh_services::Client;

#[tokio::main]
async fn main() -> anyhow::Result<()> {
    let endpoint = Endpoint::bind(presets::N0).await?;

    // needs IROH_SERVICES_API_SECRET set to an environment variable
    // client will now push endpoint metrics to iroh-services.
    let client = Client::builder(&endpoint)
        .api_secret_from_env()?
        .build()
        .await?;

    // we can also ping the service just to confirm everything is working
    client.ping().await?;

    Ok(())
}

Re-exports§

pub use self::api_secret::API_SECRET_ENV_VAR_NAME;
pub use self::api_secret::ApiSecret;
pub use self::net_diagnostics::DiagnosticsReport;
pub use self::net_diagnostics::checks::run_diagnostics;
pub use anyhow;

Modules§

api_secret
caps
net_diagnostics
Network diagnostics for iroh-powered applications.

Structs§

ApiToken
An opaque capability token issued by iroh-services.
Client
Client is the main handle for interacting with iroh-services. It communicates with iroh-services entirely through an iroh endpoint, and is configured through a builder. Client requires either an Ssh Key or ApiSecret
ClientBuilder
ClientBuilder provides configures and builds a iroh-services client, typically created with Client::builder
ClientHost
Protocol handler for cloud-to-endpoint connections.
IrohServicesPreset
An iroh endpoint preset configured for iroh-services. Build one with preset or IrohServicesPreset::builder, then pass it to [iroh::Endpoint::builder].
Pong
A response to Client::ping.
PresetBuilder
Fluent builder for IrohServicesPreset. Construct one through preset or IrohServicesPreset::builder.
Registry
A registry for [MetricsGroup].

Enums§

BuildError
Error
RemoteError
An error returned by the remote iroh-services endpoint.
ValidateAttributesError
Error returned when an attributes map fails validation.
ValidateNameError
Error returned when an endpoint name fails validation.

Constants§

ALPN
The main ALPN for connecting from the client to the cloud node.
CLIENT_HOST_ALPN
The ALPN for cloud-to-endpoint network diagnostics connections.
IROH_SERVICES_VERSION
Version of this crate.

Statics§

IROH_VERSION
Version of iroh this crate was built against.

Functions§

preset
Start a new IrohServicesPreset builder seeded with iroh-services defaults: the n0 production relay map and no explicit secret key (the endpoint will generate one at bind time).