Documentation and make the random better

This commit is contained in:
Miek Gieben 2011-12-16 19:28:35 +01:00
parent 9aa41a5de3
commit de3f0f3903
3 changed files with 9 additions and 7 deletions

View File

@ -63,10 +63,12 @@ func newQueryChan() chan *Request { return make(chan *Request) }
// Default channels to use for the resolver
var (
DefaultReplyChan = newQueryChanSlice() // DefaultReplyChan is the channel on which the replies are
// DefaultReplyChan is the channel on which the replies are
// coming back. Is it a channel of *Exchange, so that the original
// question is included with the answer.
DefaultQueryChan = newQueryChan() // DefaultQueryChan is the channel were you can send the questions to.
DefaultReplyChan = newQueryChanSlice()
// DefaultQueryChan is the channel were you can send the questions to.
DefaultQueryChan = newQueryChan()
)
// The HandlerQueryFunc type is an adapter to allow the use of

6
dns.go
View File

@ -27,10 +27,10 @@
// m := new(Msg)
// m.SetQuestion("miek.nl.", TypeMX)
//
// The message m is now a messages with the Question section set to ask
// The message m is now a message with the question section set to ask
// the MX records for the miek.nl. zone.
//
// This is slightly more verbose, but more flexible:
// The following is slightly more verbose, but more flexible:
//
// m1 := new(Msg)
// m1.MsgHdr.Id = Id()
@ -47,7 +47,7 @@
// // c.Net = "tcp" // If you want to use TCP
// in := c.Exchange(m, "127.0.0.1:53")
//
// An asynchronous query ... TODO(mg)
// An asynchronous query is also possible. The Basic use pattern is: TODO(mg)
package dns
import (

4
msg.go
View File

@ -1079,8 +1079,8 @@ func (dns *Msg) String() string {
return s
}
// Return a 16 bits random number to be used as a
// Id return a 16 bits random number to be used as a
// message id. The random provided should be good enough.
func Id() uint16 {
return uint16(rand.Int()) ^ uint16(time.Now().UnixNano())
return uint16(rand.Int()) ^ uint16(time.Now().Nanosecond())
}