Skip to main content

Module preset

Module preset 

Source
Expand description

An [iroh::endpoint] preset tailored for use with iroh-services.

IrohServicesPreset starts from the n0 stock preset (production crypto provider + n0 DNS-based address lookup) and overlays the bits that iroh-services callers usually want to configure together: the relay map the endpoint should use, an optional explicit [SecretKey], and an optional ApiSecret that downstream code can retrieve to wire up a crate::Client.

§Example

use iroh::Endpoint;

async fn run() -> anyhow::Result<()> {
    let preset = iroh_services::preset()
        .relays(["https://us-east1.project_username.iroh.link"])?
        .api_secret_from_env()?
        .build()?;
    let endpoint = Endpoint::builder(preset).bind().await?;
    Ok(())
}

Structs§

IrohServicesPreset
An iroh endpoint preset configured for iroh-services. Build one with preset or IrohServicesPreset::builder, then pass it to [iroh::Endpoint::builder].
PresetBuilder
Fluent builder for IrohServicesPreset. Construct one through preset or IrohServicesPreset::builder.

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).