Update doc and set recursion = true in SetQuestion
This commit is contained in:
parent
dd2b4e5b35
commit
5de08ff3dc
|
@ -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
17
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")
|
||||
|
|
Loading…
Reference in New Issue