Skip to content

iroh: self-hosted discovery (replace n0 DNS/pkarr) + validate-time relay URL checks #818

Description

@thiras

Context

Follow-up to #795 (scope 2). PR #817 landed scope 1 — multi-relay config + a reachability-gated endpoint swap (RelayMode::Custom). That swaps only the relay leg; the endpoint still builds on presets::N0, which keeps the n0-hosted DNS/pkarr address-lookup leg (PkarrPublisher::n0_dns() / DnsAddressLookup::n0_dns()). So an "isolated" network still depends on n0 infrastructure for NodeId→address discovery.

This issue tracks the remaining work for full n0 independence.

Scope

1. Self-hosted discovery (primary)

Replace the n0 DNS/pkarr leg with operator-configurable discovery. Decision captured during #795/#817 planning: support both mechanisms, operator-selectable by which config keys are present:

  • Custom pkarr + DNS URLs — new config keys wiring PkarrPublisher::builder(url) (publish) and DnsAddressLookup::builder(origin_domain) (resolve). Operators run their own pkarr relay + DNS. Closest to n0's model; supports dynamic addresses.
  • Static peer map (MemoryLookup) — NodeId→address mappings (relay URL + IPs per peer) supplied directly in config. Fully offline/isolated, no discovery infra to run; addresses must be known ahead of time.

iroh 0.98.2 supports all of this by composing on presets::Minimal + .address_lookup(..) instead of presets::N0. The node's wiring layer (not the leaf crates) should select the provider — see appendix-poc-production-seams.md.

Implementation notes:

  • Switching off presets::N0 means re-supplying the crypto provider and the relay/discovery legs explicitly. Confirm the exact builder surface against the pinned iroh version before coding.
  • A short ADR note (or appendix update) is warranted once the discovery provider becomes operator-configurable.

2. Validate-time relay URL checks (small, from #817 review)

Currently a malformed network.relay_urls entry is only rejected at node bring-up (parse_relay_urls in crates/node/src/runtime/mod.rs), which already names the offending entry. decdn config validate reports such a config as valid. Add a lightweight URL parse check at config-resolution/validate time (e.g. url::Url in crates/common, no iroh dep needed) so config validate fails fast and names the bad entry — matching how S3 endpoint/bucket fields are validated. Note this makes resolve_network (or a validation pass) fallible.

Out of scope

References

Activity

  1. added
    kind:feature
    rust
    on Jun 5, 2026
  2. github-actions commented on Jun 5, 2026

    @github-actions

    🎯 Triage report

    Scope 2 of the iroh n0-independence initiative (#795), spawned after PR #817 landed multi-relay support. The two tasks are well-bounded: (1) replace presets::N0's DNS/pkarr discovery leg with an operator-selectable backend (custom pkarr+DNS URLs or static MemoryLookup), and (2) a small, additive fix to make decdn config validate catch malformed relay URLs at parse time rather than at daemon start. Both tasks have named files, specific iroh APIs, and clear success criteria.

    📊 Assessment

    Dimension Value Reasoning
    Type Feature Follow-up feature adding operator control over discovery infrastructure
    Labels unchanged enhancement, technical, rust, prod-blocking are all accurate; no additions needed
    Coding agent Suitable Two discrete, well-specified tasks with named files, APIs, and success criteria. Scope 2 (URL checks) is trivially self-contained; scope 1 has a noted prerequisite (confirm iroh 0.98.2 builder surface) that is normal API-reading diligence

    🔗 Similar issues

    💡 Notes and suggestions

    Scope 1 — self-hosted discovery

    Files to touch:

    • crates/common/src/config/types.rs + resolved.rs — new config fields for pkarr URL, DNS origin domain, and static peer map entries
    • crates/node/src/runtime/mod.rs — build_endpoint: switch from presets::N0 to presets::Minimal + .address_lookup(..) when custom discovery config is present

    Implementation checklist:

    • Confirm presets::Minimal builder surface in the pinned iroh 0.98.2 — specifically what must be re-supplied (crypto provider, relay driver) when not using presets::N0
    • Add config keys: network.discovery.pkarr_url + network.discovery.dns_origin (for custom pkarr+DNS) and network.discovery.peers map (NodeId → {relay_url, addrs}) for static MemoryLookup
    • In build_endpoint, detect which config keys are present and compose the appropriate AddressLookup impl; fall back to presets::N0 if none are set (back-compat)
    • Re-supply the crypto provider and relay legs explicitly when dropping out of presets::N0
    • Add a short appendix update or inline note to adr/appendix-poc-production-seams.md documenting the discovery-provider seam

    Watch out for: presets::N0 may wire the relay driver AND the pkarr publisher in one call — switching to presets::Minimal means both legs must be configured explicitly, not just the lookup side.

    Scope 2 — validate-time relay URL checks

    This is a clean, isolated fix with a clear analogue in the S3 field validation.

    • In crates/common/src/config/resolved.rs (or a dedicated validation pass), call url::Url::parse() on each entry in network.relay_urls
    • Return a descriptive error naming the offending entry (match the S3 error format for consistency)
    • Make resolve_network (or the validation path) fallible — update callers accordingly
    • Add a test: decdn config validate with a deliberately malformed URL should exit non-zero and print the bad entry

    Priority order: Scope 2 is small and independent — good candidate to land first or in a separate PR to unblock operator tooling quickly.

    Generated by Agentic Triage for issue #818 · sonnet46 680.8K · ◷

    Add this agentic workflows to your repo

    To install this agentic workflow, run

    gh aw add githubnext/agentics/workflows/issue-triage.md@94ec5db57374c5b04a4b8eef8b4413f9af44d63f
    
  3. thiras commented on Jun 5, 2026

    @thiras
    ContributorAuthor

    Carried over from #795 before it closes (via PR #817). One loose "also consider" item from #795 isn't yet captured in this issue's scope and would otherwise be orphaned when #817 merges and closes #795:

    • Gossip endpoint relay config. crates/gossip/src/service.rs builds on presets::Minimal (no relay, no discovery). Decide whether the gossip endpoint should share the same operator-configurable relay/discovery config as the node endpoint, or stay relay-less by design.

    (The other #795 straggler — pinning an official iroh-relay container image for the contracts/local rig — is already noted under this issue's Out of scope.)

  4. self-assigned this
    on Jun 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

kind:featurerust

Fields

Priority

None yet

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions