From 31d1a50fdb1d6f106d4cc4fe9c795cf629d59a33 Mon Sep 17 00:00:00 2001 From: Marten Seemann Date: Wed, 21 Jul 2021 20:47:55 +0200 Subject: [PATCH] dnsaddr might return multiple multiaddrs, add example --- addressing/README.md | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/addressing/README.md b/addressing/README.md index b38f33a..b123a10 100644 --- a/addressing/README.md +++ b/addressing/README.md @@ -246,8 +246,20 @@ A libp2p-specific DNS-backed format, `/dnsaddr` resolves addresses from a `TXT` record associated with the `_dnsaddr` subdomain of a given domain. For example, resolving `/dnsaddr/libp2p.io` will perform a `TXT` lookup for -`_dnsaddr.libp2p.io`. If the result contains an entry of the form -`dnsaddr=`, the embedded multiaddr will be parsed and used. +`_dnsaddr.libp2p.io`. If the result contains entries of the form +`dnsaddr=`, the embedded multiaddrs will be parsed and used. + +For example, asking the DNS server for the TXT records of one of the bootstrap +nodes, `ams-2.bootstrap.libp2p.io`, returns the following records: +``` +> dig +short _dnsaddr.ams-2.bootstrap.libp2p.io txt +"dnsaddr=/dns4/ams-2.bootstrap.libp2p.io/tcp/443/wss/p2p/QmbLHAnMoJPWSCR5Zhtx6BHJX9KiKNN6tpvbUcqanj75Nb" +"dnsaddr=/ip6/2604:1380:2000:7a00::1/tcp/4001/p2p/QmbLHAnMoJPWSCR5Zhtx6BHJX9KiKNN6tpvbUcqanj75Nb" +"dnsaddr=/ip4/147.75.83.83/tcp/4001/p2p/QmbLHAnMoJPWSCR5Zhtx6BHJX9KiKNN6tpvbUcqanj75Nb" +"dnsaddr=/ip6/2604:1380:2000:7a00::1/udp/4001/quic/p2p/QmbLHAnMoJPWSCR5Zhtx6BHJX9KiKNN6tpvbUcqanj75Nb" +"dnsaddr=/ip4/147.75.83.83/udp/4001/quic/p2p/QmbLHAnMoJPWSCR5Zhtx6BHJX9KiKNN6tpvbUcqanj75Nb" +"dnsaddr=/dns6/ams-2.bootstrap.libp2p.io/tcp/443/wss/p2p/QmbLHAnMoJPWSCR5Zhtx6BHJX9KiKNN6tpvbUcqanj75Nb" +``` The `dnsaddr` lookup serves a similar purpose to a standard A-record DNS lookup, however there are differences that can be important for some use cases. The most