Skip to main content

client_endpoint

Function client_endpoint 

Source
pub async fn client_endpoint(
    relays: &[RelayUrl],
    discovery: &ResolvedDiscovery,
) -> Result<Endpoint>
Expand description

Build a one-shot client Endpoint that can resolve a target node by its iroh NodeId. With no [network.discovery] config we use presets::N0 (the n0-hosted pkarr/DNS lookup the node defaults to); with operator discovery configured we compose only the resolution legs onto presets::Minimal.

Relay selection is an independent leg, mirroring the node’s build_endpoint: a configured relay list (--relay-url/network.relay_urls, #935) becomes a RelayMode::Custom map; with no custom relays we keep presets::N0’s n0 default relay map, and on presets::Minimal (operator discovery) we restore RelayMode::Default — dropping the n0 discovery leg must not also disable relays, or a NodeId-only dial of a NAT’d node could not connect.

Note: the pkarr publisher leg the node wires (network.discovery.pkarr_url) is intentionally omitted — a one-shot client resolves peers, it never publishes its own ephemeral address record. Resolution for an operator namespace goes through its dns_origin, which resolve_config already requires whenever pkarr_url is set. Upgrade path: add a pkarr resolver leg here if a deployment ever resolves via pkarr without a DNS bridge.