commit - dc137f704dec33e5b5ab4cdb9548bb3b0d5bee3d
commit + 9ecb07389b456761ee8a4e23e62be9f58b030937
blob - dc38d3fcf077993bf8f3c91ae6db467d16f841ac
blob + 8d312f6bbbd2d99dd1be209a9f800edd887837f3
--- dns.go
+++ dns.go
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: