From e33fd8f5802775a64f1ac3ca9e0c5ec6aafbbf68 Mon Sep 17 00:00:00 2001 From: Ruediger Klaehn Date: Wed, 2 Oct 2024 15:41:30 +0300 Subject: [PATCH 01/12] Add helper fn to enable n0 discovery publishing and resolving --- iroh-net/src/endpoint.rs | 40 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 36 insertions(+), 4 deletions(-) diff --git a/iroh-net/src/endpoint.rs b/iroh-net/src/endpoint.rs index 4607fefefa..d279c05e68 100644 --- a/iroh-net/src/endpoint.rs +++ b/iroh-net/src/endpoint.rs @@ -27,7 +27,9 @@ use tokio_util::sync::{CancellationToken, WaitForCancellationFuture}; use tracing::{debug, instrument, trace, warn}; use url::Url; -use crate::discovery::{Discovery, DiscoveryTask}; +use crate::discovery::dns::DnsDiscovery; +use crate::discovery::pkarr::PkarrPublisher; +use crate::discovery::{ConcurrentDiscovery, Discovery, DiscoveryTask}; use crate::dns::{default_resolver, DnsResolver}; use crate::key::{PublicKey, SecretKey}; use crate::magicsock::{self, Handle, QuicMappedAddr}; @@ -62,6 +64,14 @@ const DISCOVERY_WAIT_PERIOD: Duration = Duration::from_millis(500); #[cfg_attr(iroh_docsrs, doc(cfg(not(any(test, feature = "test-utils")))))] const ENV_FORCE_STAGING_RELAYS: &str = "IROH_FORCE_STAGING_RELAYS"; +#[derive(Debug, Default)] +enum DiscoveryConfig { + #[default] + Disabled, + N0, + Custom(Box), +} + /// Builder for [`Endpoint`]. /// /// By default the endpoint will generate a new random [`SecretKey`], which will result in a @@ -75,7 +85,7 @@ pub struct Builder { alpn_protocols: Vec>, transport_config: Option, keylog: bool, - discovery: Option>, + discovery: DiscoveryConfig, proxy_url: Option, /// List of known nodes. See [`Builder::known_nodes`]. node_map: Option>, @@ -125,6 +135,19 @@ impl Builder { let dns_resolver = self .dns_resolver .unwrap_or_else(|| default_resolver().clone()); + let discovery = match self.discovery { + DiscoveryConfig::Disabled => None, + DiscoveryConfig::N0 => { + let discovery = ConcurrentDiscovery::from_services(vec![ + // Enable DNS discovery by default + Box::new(DnsDiscovery::n0_dns()), + // Enable pkarr publishing by default + Box::new(PkarrPublisher::n0_dns(secret_key.clone())), + ]); + Some(Box::new(discovery) as Box) + } + DiscoveryConfig::Custom(discovery) => Some(discovery), + }; let msock_opts = magicsock::Options { addr_v4: self.addr_v4, @@ -132,7 +155,7 @@ impl Builder { secret_key, relay_map, node_map: self.node_map, - discovery: self.discovery, + discovery, proxy_url: self.proxy_url, dns_resolver, #[cfg(any(test, feature = "test-utils"))] @@ -209,6 +232,15 @@ impl Builder { self } + /// Configure the endpoint to use the default n0 discovery service. + /// + /// The default discovery service publishes to and resolves from the + /// n0.computer dns server `iroh.link`. + pub fn discovery_n0(mut self) -> Self { + self.discovery = DiscoveryConfig::N0; + self + } + /// Optionally sets a discovery mechanism for this endpoint. /// /// If you want to combine multiple discovery services, you can pass a @@ -219,7 +251,7 @@ impl Builder { /// /// See the documentation of the [`Discovery`] trait for details. pub fn discovery(mut self, discovery: Box) -> Self { - self.discovery = Some(discovery); + self.discovery = DiscoveryConfig::Custom(discovery); self } From c52ef560c9d526369b10d127d03a2582534602b2 Mon Sep 17 00:00:00 2001 From: Ruediger Klaehn Date: Wed, 2 Oct 2024 16:45:13 +0300 Subject: [PATCH 02/12] Add clear_discovery and add_discovery_fn --- iroh-net/src/endpoint.rs | 65 +++++++++++++++++++++++++--------------- 1 file changed, 41 insertions(+), 24 deletions(-) diff --git a/iroh-net/src/endpoint.rs b/iroh-net/src/endpoint.rs index d279c05e68..46a2816088 100644 --- a/iroh-net/src/endpoint.rs +++ b/iroh-net/src/endpoint.rs @@ -64,14 +64,6 @@ const DISCOVERY_WAIT_PERIOD: Duration = Duration::from_millis(500); #[cfg_attr(iroh_docsrs, doc(cfg(not(any(test, feature = "test-utils")))))] const ENV_FORCE_STAGING_RELAYS: &str = "IROH_FORCE_STAGING_RELAYS"; -#[derive(Debug, Default)] -enum DiscoveryConfig { - #[default] - Disabled, - N0, - Custom(Box), -} - /// Builder for [`Endpoint`]. /// /// By default the endpoint will generate a new random [`SecretKey`], which will result in a @@ -85,7 +77,8 @@ pub struct Builder { alpn_protocols: Vec>, transport_config: Option, keylog: bool, - discovery: DiscoveryConfig, + #[debug(skip)] + discovery: Vec Box + Send + 'static>>, proxy_url: Option, /// List of known nodes. See [`Builder::known_nodes`]. node_map: Option>, @@ -135,20 +128,16 @@ impl Builder { let dns_resolver = self .dns_resolver .unwrap_or_else(|| default_resolver().clone()); - let discovery = match self.discovery { - DiscoveryConfig::Disabled => None, - DiscoveryConfig::N0 => { - let discovery = ConcurrentDiscovery::from_services(vec![ - // Enable DNS discovery by default - Box::new(DnsDiscovery::n0_dns()), - // Enable pkarr publishing by default - Box::new(PkarrPublisher::n0_dns(secret_key.clone())), - ]); - Some(Box::new(discovery) as Box) - } - DiscoveryConfig::Custom(discovery) => Some(discovery), + let discovery = self + .discovery + .into_iter() + .map(|f| f(&secret_key)) + .collect::>(); + let discovery: Option> = match discovery.len() { + 0 => None, + 1 => Some(discovery.into_iter().next().unwrap()), + _ => Some(Box::new(ConcurrentDiscovery::from_services(discovery))), }; - let msock_opts = magicsock::Options { addr_v4: self.addr_v4, addr_v6: self.addr_v6, @@ -237,7 +226,17 @@ impl Builder { /// The default discovery service publishes to and resolves from the /// n0.computer dns server `iroh.link`. pub fn discovery_n0(mut self) -> Self { - self.discovery = DiscoveryConfig::N0; + self.discovery.push(Box::new(|secret_key| { + Box::new(PkarrPublisher::n0_dns(secret_key.clone())) + })); + self.discovery + .push(Box::new(|_| Box::new(DnsDiscovery::n0_dns()))); + self + } + + /// Remove all discovery services. + pub fn clear_discovery(mut self) -> Self { + self.discovery.clear(); self } @@ -251,7 +250,25 @@ impl Builder { /// /// See the documentation of the [`Discovery`] trait for details. pub fn discovery(mut self, discovery: Box) -> Self { - self.discovery = DiscoveryConfig::Custom(discovery); + self.discovery.clear(); + self.discovery.push(Box::new(move |_| discovery)); + self + } + + /// Adds a discovery mechanism for this endpoint. + /// + /// If you have multiple discovery services, they will be combined using a + /// [`crate::discovery::ConcurrentDiscovery`]. + /// + /// If no discovery service is set, connecting to a node without providing its + /// direct addresses or relay URLs will fail. + /// + /// See the documentation of the [`Discovery`] trait for details. + pub fn add_discovery( + mut self, + discovery: Box Box + Send + 'static>, + ) -> Self { + self.discovery.push(discovery); self } From 6ce9d6cca3f2c38e669b7db11d610f4160d26873 Mon Sep 17 00:00:00 2001 From: Ruediger Klaehn Date: Wed, 2 Oct 2024 17:03:08 +0300 Subject: [PATCH 03/12] try to fix semver issue --- iroh-net/src/endpoint.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/iroh-net/src/endpoint.rs b/iroh-net/src/endpoint.rs index 46a2816088..f28b86e516 100644 --- a/iroh-net/src/endpoint.rs +++ b/iroh-net/src/endpoint.rs @@ -78,7 +78,7 @@ pub struct Builder { transport_config: Option, keylog: bool, #[debug(skip)] - discovery: Vec Box + Send + 'static>>, + discovery: Vec Box + Send + Sync + 'static>>, proxy_url: Option, /// List of known nodes. See [`Builder::known_nodes`]. node_map: Option>, @@ -266,7 +266,7 @@ impl Builder { /// See the documentation of the [`Discovery`] trait for details. pub fn add_discovery( mut self, - discovery: Box Box + Send + 'static>, + discovery: Box Box + Send + Sync + 'static>, ) -> Self { self.discovery.push(discovery); self From feda38ca445756ab6d0bfbf7049d7f6a69f74833 Mon Sep 17 00:00:00 2001 From: Ruediger Klaehn Date: Wed, 2 Oct 2024 17:36:59 +0300 Subject: [PATCH 04/12] Add the two non-default-enabled discovery mechanisms discovery_local_network discovery_dht --- iroh-net/src/endpoint.rs | 64 +++++++++++++++++++++++++++++----------- 1 file changed, 47 insertions(+), 17 deletions(-) diff --git a/iroh-net/src/endpoint.rs b/iroh-net/src/endpoint.rs index f28b86e516..4c3bd078d1 100644 --- a/iroh-net/src/endpoint.rs +++ b/iroh-net/src/endpoint.rs @@ -28,6 +28,7 @@ use tracing::{debug, instrument, trace, warn}; use url::Url; use crate::discovery::dns::DnsDiscovery; +use crate::discovery::pkarr::dht::DhtDiscovery; use crate::discovery::pkarr::PkarrPublisher; use crate::discovery::{ConcurrentDiscovery, Discovery, DiscoveryTask}; use crate::dns::{default_resolver, DnsResolver}; @@ -78,7 +79,8 @@ pub struct Builder { transport_config: Option, keylog: bool, #[debug(skip)] - discovery: Vec Box + Send + Sync + 'static>>, + discovery: + Vec Option> + Send + Sync + 'static>>, proxy_url: Option, /// List of known nodes. See [`Builder::known_nodes`]. node_map: Option>, @@ -131,7 +133,7 @@ impl Builder { let discovery = self .discovery .into_iter() - .map(|f| f(&secret_key)) + .filter_map(|f| f(&secret_key)) .collect::>(); let discovery: Option> = match discovery.len() { 0 => None, @@ -221,19 +223,6 @@ impl Builder { self } - /// Configure the endpoint to use the default n0 discovery service. - /// - /// The default discovery service publishes to and resolves from the - /// n0.computer dns server `iroh.link`. - pub fn discovery_n0(mut self) -> Self { - self.discovery.push(Box::new(|secret_key| { - Box::new(PkarrPublisher::n0_dns(secret_key.clone())) - })); - self.discovery - .push(Box::new(|_| Box::new(DnsDiscovery::n0_dns()))); - self - } - /// Remove all discovery services. pub fn clear_discovery(mut self) -> Self { self.discovery.clear(); @@ -251,7 +240,7 @@ impl Builder { /// See the documentation of the [`Discovery`] trait for details. pub fn discovery(mut self, discovery: Box) -> Self { self.discovery.clear(); - self.discovery.push(Box::new(move |_| discovery)); + self.discovery.push(Box::new(move |_| Some(discovery))); self } @@ -266,12 +255,53 @@ impl Builder { /// See the documentation of the [`Discovery`] trait for details. pub fn add_discovery( mut self, - discovery: Box Box + Send + Sync + 'static>, + discovery: Box< + dyn FnOnce(&SecretKey) -> Option> + Send + Sync + 'static, + >, ) -> Self { self.discovery.push(discovery); self } + /// Configure the endpoint to use the default n0 discovery service. + /// + /// The default discovery service publishes to and resolves from the + /// n0.computer dns server `iroh.link`. + pub fn discovery_n0(mut self) -> Self { + self.discovery.push(Box::new(|secret_key| { + Some(Box::new(PkarrPublisher::n0_dns(secret_key.clone()))) + })); + self.discovery + .push(Box::new(|_| Some(Box::new(DnsDiscovery::n0_dns())))); + self + } + + #[cfg(feature = "discovery-pkarr-dht")] + /// Configure the endpoint to use the mainline DHT with default settings. + pub fn discovery_dht(mut self) -> Self { + self.discovery.push(Box::new(|secret_key| { + Some(Box::new( + DhtDiscovery::builder() + .secret_key(secret_key.clone()) + .build() + .unwrap(), + )) + })); + self + } + + #[cfg(feature = "discovery-local-network")] + /// Configure the endpoint to use local network discovery. + pub fn discovery_local_network(mut self) -> Self { + use crate::discovery::local_swarm_discovery::LocalSwarmDiscovery; + self.discovery.push(Box::new(|secret_key| { + LocalSwarmDiscovery::new(secret_key.public()) + .map(|x| Box::new(x) as _) + .ok() + })); + self + } + /// Optionally set a list of known nodes. pub fn known_nodes(mut self, nodes: Vec) -> Self { self.node_map = Some(nodes); From b09c11b9a2c4b3f05ffb79b84a00b37e954ca73c Mon Sep 17 00:00:00 2001 From: Ruediger Klaehn Date: Wed, 2 Oct 2024 17:39:37 +0300 Subject: [PATCH 05/12] Fix type complexity warnings --- iroh-net/src/endpoint.rs | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/iroh-net/src/endpoint.rs b/iroh-net/src/endpoint.rs index 4c3bd078d1..e31a166d25 100644 --- a/iroh-net/src/endpoint.rs +++ b/iroh-net/src/endpoint.rs @@ -28,7 +28,6 @@ use tracing::{debug, instrument, trace, warn}; use url::Url; use crate::discovery::dns::DnsDiscovery; -use crate::discovery::pkarr::dht::DhtDiscovery; use crate::discovery::pkarr::PkarrPublisher; use crate::discovery::{ConcurrentDiscovery, Discovery, DiscoveryTask}; use crate::dns::{default_resolver, DnsResolver}; @@ -65,6 +64,8 @@ const DISCOVERY_WAIT_PERIOD: Duration = Duration::from_millis(500); #[cfg_attr(iroh_docsrs, doc(cfg(not(any(test, feature = "test-utils")))))] const ENV_FORCE_STAGING_RELAYS: &str = "IROH_FORCE_STAGING_RELAYS"; +type DiscoveryBuilder = Box Option> + Send + Sync>; + /// Builder for [`Endpoint`]. /// /// By default the endpoint will generate a new random [`SecretKey`], which will result in a @@ -79,8 +80,7 @@ pub struct Builder { transport_config: Option, keylog: bool, #[debug(skip)] - discovery: - Vec Option> + Send + Sync + 'static>>, + discovery: Vec, proxy_url: Option, /// List of known nodes. See [`Builder::known_nodes`]. node_map: Option>, @@ -253,12 +253,13 @@ impl Builder { /// direct addresses or relay URLs will fail. /// /// See the documentation of the [`Discovery`] trait for details. - pub fn add_discovery( - mut self, - discovery: Box< - dyn FnOnce(&SecretKey) -> Option> + Send + Sync + 'static, - >, - ) -> Self { + pub fn add_discovery(mut self, discovery: F) -> Self + where + F: FnOnce(&SecretKey) -> Option + Send + Sync + 'static, + D: Discovery + 'static, + { + let discovery: DiscoveryBuilder = + Box::new(move |secret_key| discovery(secret_key).map(|x| Box::new(x) as _)); self.discovery.push(discovery); self } @@ -279,6 +280,7 @@ impl Builder { #[cfg(feature = "discovery-pkarr-dht")] /// Configure the endpoint to use the mainline DHT with default settings. pub fn discovery_dht(mut self) -> Self { + use crate::discovery::pkarr::dht::DhtDiscovery; self.discovery.push(Box::new(|secret_key| { Some(Box::new( DhtDiscovery::builder() From 89c15365ca819e3a22d264d248520d07e855d3f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=BCdiger=20Klaehn?= Date: Thu, 17 Oct 2024 11:03:35 +0300 Subject: [PATCH 06/12] PR review - Refine docs for remove_discovery Co-authored-by: Floris Bruynooghe --- iroh-net/src/endpoint.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iroh-net/src/endpoint.rs b/iroh-net/src/endpoint.rs index 4b0ee1f4d6..daad382389 100644 --- a/iroh-net/src/endpoint.rs +++ b/iroh-net/src/endpoint.rs @@ -223,7 +223,7 @@ impl Builder { self } - /// Remove all discovery services. + /// Removes all discovery services from the builder. pub fn clear_discovery(mut self) -> Self { self.discovery.clear(); self From 00799872b6873f699147c21ba5482503f3c35296 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=BCdiger=20Klaehn?= Date: Thu, 17 Oct 2024 11:04:02 +0300 Subject: [PATCH 07/12] PR review - typo Co-authored-by: Floris Bruynooghe --- iroh-net/src/endpoint.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iroh-net/src/endpoint.rs b/iroh-net/src/endpoint.rs index daad382389..c47d638bda 100644 --- a/iroh-net/src/endpoint.rs +++ b/iroh-net/src/endpoint.rs @@ -246,7 +246,7 @@ impl Builder { /// Adds a discovery mechanism for this endpoint. /// - /// If you have multiple discovery services, they will be combined using a + /// If you have multiple discovery services, they will be combined using /// [`crate::discovery::ConcurrentDiscovery`]. /// /// If no discovery service is set, connecting to a node without providing its From 952b3c40e1377945d3c89757e83973e41b946dae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=BCdiger=20Klaehn?= Date: Thu, 17 Oct 2024 11:05:12 +0300 Subject: [PATCH 08/12] PR review - refine docs for n0_dns Co-authored-by: Floris Bruynooghe --- iroh-net/src/endpoint.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iroh-net/src/endpoint.rs b/iroh-net/src/endpoint.rs index c47d638bda..f786c50df2 100644 --- a/iroh-net/src/endpoint.rs +++ b/iroh-net/src/endpoint.rs @@ -264,7 +264,7 @@ impl Builder { self } - /// Configure the endpoint to use the default n0 discovery service. + /// Configures the endpoint to use the default n0 DNS discovery service. /// /// The default discovery service publishes to and resolves from the /// n0.computer dns server `iroh.link`. From 66bb118e28d4487082b51147ab2e99bc65c59da0 Mon Sep 17 00:00:00 2001 From: Ruediger Klaehn Date: Thu, 17 Oct 2024 11:25:53 +0300 Subject: [PATCH 09/12] PR review - refine docs for discovery options in builder --- iroh-net/src/endpoint.rs | 34 +++++++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/iroh-net/src/endpoint.rs b/iroh-net/src/endpoint.rs index f786c50df2..30bc8d7237 100644 --- a/iroh-net/src/endpoint.rs +++ b/iroh-net/src/endpoint.rs @@ -231,7 +231,8 @@ impl Builder { /// Optionally sets a discovery mechanism for this endpoint. /// - /// If you want to combine multiple discovery services, you can pass a + /// If you want to combine multiple discovery services, you can use + /// [`Builder::add_discovery`] instead. This will internally create a /// [`crate::discovery::ConcurrentDiscovery`]. /// /// If no discovery service is set, connecting to a node without providing its @@ -244,14 +245,19 @@ impl Builder { self } - /// Adds a discovery mechanism for this endpoint. + /// Adds a discovery mechanism for this endpoint. The function `discovery` + /// will be called on endpoint creation with the configured secret key of + /// the endpoint. Discovery services that need to publish information need + /// to use this secret key to sign the information. /// - /// If you have multiple discovery services, they will be combined using + /// If you add multiple discovery services, they will be combined using a /// [`crate::discovery::ConcurrentDiscovery`]. /// /// If no discovery service is set, connecting to a node without providing its /// direct addresses or relay URLs will fail. /// + /// To clear all discovery services, use [`Builder::clear_discovery`]. + /// /// See the documentation of the [`Discovery`] trait for details. pub fn add_discovery(mut self, discovery: F) -> Self where @@ -268,6 +274,14 @@ impl Builder { /// /// The default discovery service publishes to and resolves from the /// n0.computer dns server `iroh.link`. + /// + /// This is equivalent to adding both a [`crate::discovery::pkarr::PkarrPublisher`] + /// and a [`crate::discovery::dns::DnsDiscovery`], both configured to use the + /// n0.computer dns server. + /// + /// This will by default use [`crate::discovery::pkarr::N0_DNS_PKARR_RELAY_PROD`]. + /// When in tests, or when the `test-utils` feature is enabled, this will use the + /// [`crate::discovery::pkarr::N0_DNS_PKARR_RELAY_STAGING`]. pub fn discovery_n0(mut self) -> Self { self.discovery.push(Box::new(|secret_key| { Some(Box::new(PkarrPublisher::n0_dns(secret_key.clone()))) @@ -278,7 +292,12 @@ impl Builder { } #[cfg(feature = "discovery-pkarr-dht")] - /// Configure the endpoint to use the mainline DHT with default settings. + /// Configure the endpoint to also use the mainline DHT with default settings. + /// + /// This is equivalent to adding a [`crate::discovery::pkarr::dht::DhtDiscovery`] + /// with default settings. Note that DhtDiscovery has various more advanced + /// configuration options. If you need any of those, you should manually + /// create a DhtDiscovery and add it with [`Builder::add_discovery`]. pub fn discovery_dht(mut self) -> Self { use crate::discovery::pkarr::dht::DhtDiscovery; self.discovery.push(Box::new(|secret_key| { @@ -293,7 +312,12 @@ impl Builder { } #[cfg(feature = "discovery-local-network")] - /// Configure the endpoint to use local network discovery. + /// Configures the endpoint to also use local network discovery. + /// + /// This is equivalent to adding a [`crate::discovery::local_swarm_discovery::LocalSwarmDiscovery`] + /// with default settings. Note that LocalSwarmDiscovery has various more advanced + /// configuration options. If you need any of those, you should manually + /// create a LocalSwarmDiscovery and add it with [`Builder::add_discovery`]. pub fn discovery_local_network(mut self) -> Self { use crate::discovery::local_swarm_discovery::LocalSwarmDiscovery; self.discovery.push(Box::new(|secret_key| { From 7af0c91f9e643cbf239aba17888f2070f3e56436 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=BCdiger=20Klaehn?= Date: Thu, 17 Oct 2024 21:04:52 +0300 Subject: [PATCH 10/12] PR review - fmt Co-authored-by: Floris Bruynooghe --- iroh-net/src/endpoint.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/iroh-net/src/endpoint.rs b/iroh-net/src/endpoint.rs index 30bc8d7237..95ed5f8bb3 100644 --- a/iroh-net/src/endpoint.rs +++ b/iroh-net/src/endpoint.rs @@ -245,7 +245,9 @@ impl Builder { self } - /// Adds a discovery mechanism for this endpoint. The function `discovery` + /// Adds a discovery mechanism for this endpoint. + /// + /// The function `discovery` /// will be called on endpoint creation with the configured secret key of /// the endpoint. Discovery services that need to publish information need /// to use this secret key to sign the information. From 0a02e73286661d3104430b4bf20273b57097eaf4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=BCdiger=20Klaehn?= Date: Thu, 17 Oct 2024 21:05:24 +0300 Subject: [PATCH 11/12] PR review, shorten links Co-authored-by: Floris Bruynooghe --- iroh-net/src/endpoint.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/iroh-net/src/endpoint.rs b/iroh-net/src/endpoint.rs index 95ed5f8bb3..0c33acec01 100644 --- a/iroh-net/src/endpoint.rs +++ b/iroh-net/src/endpoint.rs @@ -281,9 +281,12 @@ impl Builder { /// and a [`crate::discovery::dns::DnsDiscovery`], both configured to use the /// n0.computer dns server. /// - /// This will by default use [`crate::discovery::pkarr::N0_DNS_PKARR_RELAY_PROD`]. + /// This will by default use [`N0_DNS_PKARR_RELAY_PROD`]. /// When in tests, or when the `test-utils` feature is enabled, this will use the - /// [`crate::discovery::pkarr::N0_DNS_PKARR_RELAY_STAGING`]. + /// [`N0_DNS_PKARR_RELAY_STAGING`]. + /// + /// [`N0_DNS_PKARR_RELAY_PROD`]: crate::discovery::pkarr::N0_DNS_PKARR_RELAY_PROD + /// [`N0_DNS_PKARR_RELAY_STAGING`]: crate::discovery::pkarr::N0_DNS_PKARR_RELAY_STAGING pub fn discovery_n0(mut self) -> Self { self.discovery.push(Box::new(|secret_key| { Some(Box::new(PkarrPublisher::n0_dns(secret_key.clone()))) From 817901e529233ce8be405f9728a0cf6eb4b2b033 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=BCdiger=20Klaehn?= Date: Thu, 17 Oct 2024 21:05:35 +0300 Subject: [PATCH 12/12] PR review Co-authored-by: Floris Bruynooghe --- iroh-net/src/endpoint.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iroh-net/src/endpoint.rs b/iroh-net/src/endpoint.rs index 0c33acec01..fd09c9ab1a 100644 --- a/iroh-net/src/endpoint.rs +++ b/iroh-net/src/endpoint.rs @@ -297,7 +297,7 @@ impl Builder { } #[cfg(feature = "discovery-pkarr-dht")] - /// Configure the endpoint to also use the mainline DHT with default settings. + /// Configures the endpoint to also use the mainline DHT with default settings. /// /// This is equivalent to adding a [`crate::discovery::pkarr::dht::DhtDiscovery`] /// with default settings. Note that DhtDiscovery has various more advanced