pub struct DnsDiscovery { /* private fields */ }
Expand description
DNS node discovery
When asked to resolve a NodeId
, this service performs a lookup in the Domain Name System (DNS).
It uses the Endpoint
’s DNS resolver to query for TXT
records under the domain
_iroh.<z32-node-id>.<origin-domain>
:
_iroh
: is the record name<z32-node-id>
is theNodeId
encoded in [z-base-32
] format<origin-domain>
is the node origin domain as set inDnsDiscovery::new
.
Each TXT record returned from the query is expected to contain a string in the format <name>=<value>
.
If a TXT record contains multiple character strings, they are concatenated first.
The supported attributes are:
relay=<url>
: The URL of the home relay server of the node
The DNS resolver defaults to using the nameservers configured on the host system, but can be changed
with crate::endpoint::Builder::dns_resolver
.
Implementations§
Source§impl DnsDiscovery
impl DnsDiscovery
Sourcepub fn n0_dns() -> Self
pub fn n0_dns() -> Self
Creates a new DNS discovery using the iroh.link
domain.
This uses the N0_DNS_NODE_ORIGIN_PROD
domain.
§Usage during tests
For testing it is possible to use the N0_DNS_NODE_ORIGIN_STAGING
domain
with DnsDiscovery::new
. This would then use a hosted staging discovery
service for testing purposes.