Some documentation update

This commit is contained in:
Miek Gieben 2011-07-05 21:08:22 +02:00
parent 3582120233
commit 077c1ce596
3 changed files with 8 additions and 10 deletions

View File

@ -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[<zonename>]<base64 secret>
}
// Create a new client, with some default values filled in.
func NewClient() *Client {
c := new(Client)
c.Net = "udp"

7
dns.go
View File

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

View File

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