Skip to main content

preset

Function preset 

Source
pub fn preset() -> PresetBuilder
Expand description

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

The built preset applies [iroh::endpoint::presets::N0] and then overlays its relay map, so leaving PresetBuilder::relays unset gives you plain N0 plus a project access token for the public relays:

let preset = iroh_services::preset().api_secret_from_env()?.build()?;
let endpoint = iroh::Endpoint::bind(preset.clone()).await?;
// reuses the preset's api secret, no need to pass it twice
let client = preset.client_builder(&endpoint).build().await?;