-
Notifications
You must be signed in to change notification settings - Fork 180
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(iroh-net): Add helper fn to enable n0 discovery publishing and r…
…esolving (#2775) ## Description Add a helper fn to configure n0 default discovery without having to resort to having to combine a custom discovery service. ```rust 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 ```rust 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 - [x] Self-review. - [x] Documentation updates following the [style guide](https://rust-lang.github.io/rfcs/1574-more-api-documentation-conventions.html#appendix-a-full-conventions-text), if relevant. - [ ] Tests if relevant. - [x] All breaking changes documented. --------- Co-authored-by: Floris Bruynooghe <[email protected]>
- Loading branch information
Showing
1 changed file
with
116 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters