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

Open
wants to merge 11 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-17T09:39:43Z

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: 510ae77

@rklaehn rklaehn force-pushed the discovery-builder-shortcuts branch from efbac73 to b09c11b Compare October 2, 2024 15:18
Copy link
Contributor

@flub flub left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like a nice improvement! Even if the exactly locations of things may change before 1.0. Any reason this is still in draft?

iroh-net/src/endpoint.rs Outdated Show resolved Hide resolved
iroh-net/src/endpoint.rs Show resolved Hide resolved
iroh-net/src/endpoint.rs Outdated Show resolved Hide resolved
iroh-net/src/endpoint.rs Show resolved Hide resolved
iroh-net/src/endpoint.rs Show resolved Hide resolved
iroh-net/src/endpoint.rs Outdated Show resolved Hide resolved
iroh-net/src/endpoint.rs Show resolved Hide resolved
iroh-net/src/endpoint.rs Outdated Show resolved Hide resolved
iroh-net/src/endpoint.rs Outdated Show resolved Hide resolved
@rklaehn
Copy link
Contributor Author

rklaehn commented Oct 17, 2024

Looks like a nice improvement! Even if the exactly locations of things may change before 1.0. Any reason this is still in draft?

I don't think it is due to code quality, just that we had a long discussion what we want to do about discovery.

@rklaehn rklaehn marked this pull request as ready for review October 17, 2024 08:01
@rklaehn rklaehn requested a review from flub October 17, 2024 09:42
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.

2 participants