Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(iroh-net): Add helper fn to enable n0 discovery publishing and resolving #2775

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

rklaehn
Copy link
Contributor

@rklaehn rklaehn commented Oct 2, 2024

Description

Add a helper fn to configure n0 default discovery without having to resort to having to combine a custom discovery service.

let secret_key = SecretKey::generate();
let discovery = ConcurrentDiscovery::from_services(vec![
    Box::new(PkarrPublisher::n0_dns(secret_key.clone())),
    Box::new(DnsDiscovery::n0_dns()),
    Box::new(LocalSwarmDiscovery::new(secret_key.public())?),
]);
let ep = iroh_net::Endpoint::builder()
    .secret_key(secret_key)
    .discovery(Box::new(discovery))
    .alpns(vec![EXAMPLE_ALPN.to_vec()])
    .bind()
     .await

becomes

let ep = iroh_net::Endpoint::builder()
    .discovery_n0() // still have to do this to enable discovery!
    .alpns(vec![EXAMPLE_ALPN.to_vec()])
    .bind()
     .await

Breaking Changes

None

Notes & open questions

Should this be on or off by default?
Does anybody hate the name?
Should we also add fns for "just publish" or "just resolve" that I frequently need?

Change checklist

  • Self-review.
  • Documentation updates following the style guide, if relevant.
  • Tests if relevant.
  • All breaking changes documented.

Copy link

github-actions bot commented Oct 2, 2024

Documentation for this PR has been generated and is available at: https://n0-computer.github.io/iroh/pr/2775/docs/iroh/

Last updated: 2024-10-02T15:20:02Z

Copy link

github-actions bot commented Oct 2, 2024

Netsim report & logs for this PR have been generated and is available at: LOGS
This report will remain available for 3 days.

Last updated for commit: e846ec6

@rklaehn rklaehn force-pushed the discovery-builder-shortcuts branch from efbac73 to b09c11b Compare October 2, 2024 15:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🏗 In progress
Development

Successfully merging this pull request may close these issues.

1 participant