diff --git a/dns.go b/dns.go index 44a37766..45fdba12 100644 --- a/dns.go +++ b/dns.go @@ -3,15 +3,19 @@ // license that can be found in the LICENSE file. // Extended and bugfixes by Miek Gieben. -// Package dns implements a full featured interface to the DNS. +// Package dns implements a full featured interface to the Domain Name System. // The package allows complete control over what is send out to the DNS. // // Resource records are native types. They are not stored in wire format. // Basic usage pattern for creating a new resource record: // -// r := new(RR_TXT) -// r.Hdr = RR_Header{Name: "a.miek.nl", Rrtype: TypeTXT, Class: ClassINET, Ttl: 3600} -// r.TXT = "This is the content of the TXT record" +// r := new(RR_TXT) +// r.Hdr = RR_Header{Name: "a.miek.nl", Rrtype: TypeTXT, Class: ClassINET, Ttl: 3600} +// r.TXT = "This is the content of the TXT record" +// +// Or directly from a string: +// +// mx := NewRR("miek.nl IN MX 10 mx.miek.nl.") // // The package dns supports (async) querying/replying, incoming/outgoing Axfr/Ixfr, // TSIG, EDNS0, dynamic updates, notifies and DNSSEC validation/signing. @@ -21,8 +25,7 @@ // m := new(Msg) // m.SetQuestion("miek.nl.", TypeMX) // -// -// Or slightly more verbose and flexible: +// Or slightly more verbose, but more flexible: // // m1 := new(Msg) // m1.MsgHdr.Id = Id() @@ -30,8 +33,10 @@ // m1.Question = make([]Question, 1) // m1.Question[0] = Question{"miek.nl", TypeDNSKEY, ClassINET} // -// -// Basic use pattern for synchronous querying of the DNS +// After creating a message it can be send. +// Basic use pattern for synchronous querying the DNS, here +// sending the message 'm' to the server 127.0.0.1 on port 53 and +// waiting for the reply. // // c := dns.NewClient() // // c.Net = "tcp" // If you want to use TCP diff --git a/dnssec.go b/dnssec.go index 0604c3a9..0d31997c 100644 --- a/dnssec.go +++ b/dnssec.go @@ -34,7 +34,7 @@ const ( ECDSAP384SHA384 = 14 ) -// DNSSEC hashing codes. +// DNSSEC hashing algorithm codes. const ( _ = iota SHA1 // RFC 4034 @@ -43,7 +43,7 @@ const ( SHA384 // Experimental ) -// DNSKEY flags values. +// DNSKEY flag values. const ( KSK = 1 ZSK = 1 << 8 diff --git a/msg.go b/msg.go index 3761329d..2df04c7b 100644 --- a/msg.go +++ b/msg.go @@ -118,8 +118,8 @@ var Rr_str = map[uint16]string{ } // Reverse, needed for string parsing. -var Str_rr = reverse(Rr_str) -var Str_class = reverse(Class_str) +var str_rr = reverse(Rr_str) +var str_class = reverse(Class_str) // Map of strings for each CLASS wire type. var Class_str = map[uint16]string{ diff --git a/types.go b/types.go index a1c685ba..fa22e7f9 100644 --- a/types.go +++ b/types.go @@ -183,7 +183,6 @@ func (rr *RR_HINFO) String() string { return rr.Hdr.String() + rr.Cpu + " " + rr.Os } - type RR_MB struct { Hdr RR_Header Mb string "domain-name" diff --git a/types.rl b/types.rl index 8bee36f5..c5ae9cb5 100644 --- a/types.rl +++ b/types.rl @@ -138,7 +138,7 @@ // Fill the Type Bit Map for i := 1; i < len(rdf); i++ { // Check if its there in the map TODO - rr.TypeBitMap[i-1] = Str_rr[rdf[i]] + rr.TypeBitMap[i-1] = str_rr[rdf[i]] } z.Push(rr) } @@ -159,7 +159,7 @@ // Fill the Type Bit Map for i := 6; i < len(rdf); i++ { // Check if its there in the map TODO - rr.TypeBitMap[i-6] = Str_rr[rdf[i]] + rr.TypeBitMap[i-6] = str_rr[rdf[i]] } z.Push(rr) } diff --git a/zone.go b/zone.go index 8baaa9ba..9c7a4f4c 100644 --- a/zone.go +++ b/zone.go @@ -2,30 +2,33 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// Implements a concept of zones. In its most basic form -// a list of RRs. package dns import ( "container/vector" ) +// Zone implements the concept of RFC 1035 master zone files. type Zone struct { v vector.Vector } +// Add a new RR to the zone. func (z *Zone) Push(r RR) { z.v.Push(r) } +// Remove a RR from the zone. func (z *Zone) Pop() RR { return z.v.Pop().(RR) } +// Return the RR at index i of zone. func (z *Zone) At(i int) RR { return z.v.At(i).(RR) } +// The number of RRs in zone. func (z *Zone) Len() int { return z.v.Len() } diff --git a/zparse.go b/zparse.go index a863a07a..f7014a0c 100644 --- a/zparse.go +++ b/zparse.go @@ -256,7 +256,7 @@ tr121: // Fill the Type Bit Map for i := 1; i < len(rdf); i++ { // Check if its there in the map TODO - rr.TypeBitMap[i-1] = Str_rr[rdf[i]] + rr.TypeBitMap[i-1] = str_rr[rdf[i]] } z.Push(rr) } @@ -281,7 +281,7 @@ tr127: // Fill the Type Bit Map for i := 6; i < len(rdf); i++ { // Check if its there in the map TODO - rr.TypeBitMap[i-6] = Str_rr[rdf[i]] + rr.TypeBitMap[i-6] = str_rr[rdf[i]] } z.Push(rr) } @@ -726,7 +726,7 @@ tr184: goto st22 tr51: // line 97 "zparse.rl" - { hdr.Class = Str_class[data[mark:p]] } + { hdr.Class = str_class[data[mark:p]] } goto st22 st22: p++ @@ -2037,7 +2037,7 @@ case 127: goto st0 tr181: // line 97 "zparse.rl" - { hdr.Class = Str_class[data[mark:p]] } + { hdr.Class = str_class[data[mark:p]] } goto st128 st128: p++ diff --git a/zparse.rl b/zparse.rl index e9ff32b5..fcfb841c 100644 --- a/zparse.rl +++ b/zparse.rl @@ -94,7 +94,7 @@ func (zp *Parser) Zone() (z *Zone, err os.Error) { %%{ action mark { mark = p } action setQname { hdr.Name = data[mark:p] } - action setQclass { hdr.Class = Str_class[data[mark:p]] } + action setQclass { hdr.Class = str_class[data[mark:p]] } action defTtl { /* ... */ } action setTtl { ttl := atoi(data[mark:p]); hdr.Ttl = uint32(ttl) } action lineCount { lines++ }