dns

DNS client and server implementations using the Go project's dnsmessage package
Log | Files | Refs | README | LICENSE

commit 9ecb07389b456761ee8a4e23e62be9f58b030937
parent dc137f704dec33e5b5ab4cdb9548bb3b0d5bee3d
Author: Oliver Lowe <o@olowe.co>
Date:   Sat, 18 Dec 2021 14:37:40 +1100

doc: tutorial with the even simpler Ask function

that is the simplest operation, not Exchange (anymore)!

Diffstat:
Mdns.go | 14++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/dns.go b/dns.go @@ -6,16 +6,14 @@ TCP (including TLS). The package deliberately does not implement all features of the DNS specifications. Notably EDNS and DNSSEC are unsupported. -The most basic operation is creating a DNS message, sending it to a -DNS server, then handling the reply using Exchange: +The most basic operation is creating a question, asking the DNS server +the question, then handling the response using Ask: - qmsg := dnsmessage.Message{ - Header: dnsmessage.Header{ID: 1}, - Questions: []dnsmessage.Question{ - // ... - }, + q := dnsmessage.Question{ + Name: dnsmessage.MustNewName("www.example.com."), + Type: dnsmessage.TypeAAAA, } - rmsg, err := dns.Exchange(qmsg, "192.0.2.1:domain") + resp, err := dns.Ask(q, "192.0.2.1:domain") // ... Queries to a recursive resolver via DNS over TLS (DoT) can be made with ExchangeTLS: