Update doc and set recursion = true in SetQuestion

This commit is contained in:
Miek Gieben 2011-07-04 21:28:30 +02:00
parent dd2b4e5b35
commit 5de08ff3dc
2 changed files with 14 additions and 4 deletions

View File

@ -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}
}

17
dns.go
View File

@ -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")