diff --git a/client.go b/client.go index f84d46bc..a6b40052 100644 --- a/client.go +++ b/client.go @@ -59,7 +59,7 @@ var DefaultQueryMux = NewQueryMux() func newQueryChanSlice() chan []*Msg { return make(chan []*Msg) } func newQueryChan() chan *Request { return make(chan *Request) } -// Default channel to use for the resolver +// Default channels to use for the resolver var DefaultReplyChan = newQueryChanSlice() var DefaultQueryChan = newQueryChan() @@ -126,6 +126,7 @@ type Client struct { TsigSecret map[string]string // secret(s) for Tsig map[] } +// Create a new client, with some default values filled in. func NewClient() *Client { c := new(Client) c.Net = "udp" diff --git a/dns.go b/dns.go index 6fc97e90..be5dd4bd 100644 --- a/dns.go +++ b/dns.go @@ -22,7 +22,7 @@ // m.SetQuestion("miek.nl.", TypeMX) // // -// Or slightly more verbose and flexible +// Or slightly more verbose and flexible: // // m1 := new(Msg) // m1.MsgHdr.Id = Id() @@ -31,7 +31,7 @@ // m1.Question[0] = Question{"miek.nl", TypeDNSKEY, ClassINET} // // -// Basic use pattern for synchronize querying of the DNS +// Basic use pattern for synchronous querying of the DNS // // c := dns.NewClient() // // c.Net = "tcp" // If you want to use TCP @@ -48,7 +48,7 @@ const ( Year68 = 2 << (32 - 1) // For RFC1982 (Serial Arithmetic) calculations in 32 bits. DefaultMsgSize = 4096 // A standard default for larger than 512 packets. MaxMsgSize = 65536 // Largest possible DNS packet. - DefaultTTL = 3600 // Default Ttl. + DefaultTTL = 3600 // Default TTL. ) // Error represents a DNS error @@ -66,7 +66,6 @@ func (e *Error) String() string { return e.Error } - type RR interface { Header() *RR_Header String() string diff --git a/server.go b/server.go index 1dc29f9f..a116b424 100644 --- a/server.go +++ b/server.go @@ -21,10 +21,9 @@ type Handler interface { // A ResponseWriter interface is used by an DNS handler to // construct an DNS response. type ResponseWriter interface { - // RemoteAddr returns the net.Addr of the client that sent the current request + // RemoteAddr returns the net.Addr of the client that sent the current request. RemoteAddr() net.Addr - - // Write a reply back + // Write a reply back to the client. Write([]byte) (int, os.Error) } @@ -62,13 +61,12 @@ var DefaultServeMux = NewServeMux() // Handler object that calls f. type HandlerFunc func(ResponseWriter, *Msg) -// ServerDNS calls f(w, reg) +// ServerDNS calls f(w, r) func (f HandlerFunc) ServeDNS(w ResponseWriter, r *Msg) { f(w, r) } // Helper handlers - func Refused(w ResponseWriter, r *Msg) { m := new(Msg) m.SetReply(r)