more documentation

This commit is contained in:
Miek Gieben 2012-12-02 10:14:53 +01:00
parent 862e4c7419
commit d758825590
6 changed files with 14 additions and 13 deletions

View File

@ -35,7 +35,7 @@ type Client struct {
}
// Exchange performs an synchronous query. It sends the message m to the address
// contained in a and waits for an reply. Basic use pattern with a *Client:
// contained in a and waits for an reply. Basic use pattern with a *dns.Client:
//
// c := new(dns.Client)
// in, rtt, err := c.Exchange(message, "127.0.0.1:53")

View File

@ -155,8 +155,8 @@ func (dns *Msg) IsEdns0() *RR_OPT {
// IsDomainName checks if s is a valid domainname, it returns
// the number of labels, total length and true, when a domain name is valid.
// When false is returned the labelcount and length are not defined.
// TODO(mg): checks for \DDD
func IsDomainName(s string) (uint8, uint8, bool) { // copied from net package.
// TODO(mg): check for \DDD
// See RFC 1035, RFC 3696.
l := len(s)
if l == 0 || l > 255 {

5
msg.go
View File

@ -1058,7 +1058,8 @@ func packBase32(s []byte) ([]byte, error) {
return buf, nil
}
// Resource record packer.
// Resource record packer, pack rr into msg[off:]. See PackDomainName for documentation
// about the compression.
func PackRR(rr RR, msg []byte, off int, compression map[string]int, compress bool) (off1 int, err error) {
if rr == nil {
return len(msg), &Error{Err: "nil rr"}
@ -1072,7 +1073,7 @@ func PackRR(rr RR, msg []byte, off int, compression map[string]int, compress boo
return off1, nil
}
// Resource record unpacker.
// Resource record unpacker, unpack msg[off:] into an RR.
func UnpackRR(msg []byte, off int) (rr RR, off1 int, err error) {
// unpack just the header, to find the rr type and length
var h RR_Header

View File

@ -17,7 +17,7 @@ type saltWireFmt struct {
Salt string `dns:"size-hex"`
}
// HashName hashes a string (label) according to RFC5155. It returns the hashed string.
// HashName hashes a string (label) according to RFC 5155. It returns the hashed string.
func HashName(label string, ha uint8, iter uint16, salt string) string {
saltwire := new(saltWireFmt)
saltwire.Salt = salt

View File

@ -91,11 +91,11 @@ func HandleFailed(w ResponseWriter, r *Msg) {
// AuthorHandler returns a HandlerFunc that returns the authors
// of Go DNS for 'authors.bind' or 'authors.server' queries in the
// CHAOS Class. Note with
// CHAOS Class. Note with:
//
// HandleFunc("authors.bind.", HandleAuthors)
//
// The handler is registered for all DNS classes, thereby potentially
// the handler is registered for all DNS classes, thereby potentially
// hijacking the authors.bind. zone in the IN class. If you need the
// authors.bind zone to exist in the IN class, you need to register
// some other handler, check the class in there and then call HandleAuthors.
@ -123,11 +123,11 @@ func HandleAuthors(w ResponseWriter, r *Msg) {
// VersionHandler returns a HandlerFunc that returns the version
// of Go DNS for 'version.bind' or 'version.server' queries in the
// CHAOS Class. Note with
// CHAOS Class. Note with:
//
// HandleFunc("version.bind.", HandleVersion)
//
// The handler is registered for all DNS classes, thereby potentially
// the handler is registered for all DNS classes, thereby potentially
// hijacking the version.bind. zone in the IN class. If you need the
// version.bind zone to exist in the IN class, you need to register
// some other handler, check the class in there and then call HandleVersion.
@ -156,7 +156,7 @@ func failedHandler() Handler { return HandlerFunc(HandleFailed) }
func versionHandler() Handler { return HandlerFunc(HandleVersion) }
// Start a server on addresss and network speficied. Invoke handler
// for any incoming queries.
// for incoming queries.
func ListenAndServe(addr string, network string, handler Handler) error {
server := &Server{Addr: addr, Net: network, Handler: handler}
return server.ListenAndServe()

6
xfr.go
View File

@ -1,12 +1,12 @@
package dns
// Envelope is used when doing [IA]xfr with a remote server.
// Envelope is used when doing [IA]XFR with a remote server.
type Envelope struct {
RR []RR // The set of RRs in the answer section of the AXFR reply message.
Error error // If something went wrong, this contains the error.
}
// TransferIn performs a [AI]xfr request (depends on the message's Qtype). It returns
// TransferIn performs a [AI]XFR request (depends on the message's Qtype). It returns
// a channel of *Envelope on which the replies from the server are sent. At the end of
// the transfer the channel is closed.
// The messages are TSIG checked if
@ -141,7 +141,7 @@ func checkXfrSOA(in *Msg, first bool) bool {
return false
}
// TransferOut performs an outgoing [AI]xfr depending on the request message. The
// TransferOut performs an outgoing [AI]XFR depending on the request message. The
// caller is responsible for sending the correct sequence of RR sets through
// the channel c. For reasons of symmetry Envelope is re-used.
// Errors are signaled via the error pointer, when an error occurs the function