diff --git a/defaults.go b/defaults.go index 8ef64c00..2f19b87b 100644 --- a/defaults.go +++ b/defaults.go @@ -17,6 +17,7 @@ func (dns *Msg) SetReply(request *Msg) { // Create a question packet. func (dns *Msg) SetQuestion(z string, t uint16) { dns.MsgHdr.Id = Id() + dns.MsgHdr.RecursionDesired = true dns.Question = make([]Question, 1) dns.Question[0] = Question{z, t, ClassINET} } diff --git a/dns.go b/dns.go index 1152e774..58eba642 100644 --- a/dns.go +++ b/dns.go @@ -19,11 +19,20 @@ // In the DNS messages are exchanged. Use pattern for creating one: // // m := new(Msg) -// m.SetQuestion("miek.nl.", dns.TypeMX) -// // Set the desired options. -// m.MsgHdr.RecursionDesired = true +// m.SetQuestion("miek.nl.", TypeMX) // -// Basic use pattern for synchronize querying of the DNS: +// +// Or slightly more verbose and flexible +// +// m1 := new(Msg) +// m1.MsgHdr.Id = Id() +// m1.MsgHdr.RecursionDesired = false +// m1.Question = make([]Question, 1) +// m1.Question[0] = Question{"miek.nl", TypeDNSKEY, ClassINET} +// +// +// Basic use pattern for synchronize querying of the DNS using +// UDP as the protocol. // // c := dns.NewClient() // in := c.Exchange(m, "127.0.0.1:53")