remove some debugging code

This commit is contained in:
Miek Gieben 2010-12-23 17:10:06 +01:00
parent 04a18e9937
commit d1e5b182a7
4 changed files with 22 additions and 16 deletions

7
README
View File

@ -5,10 +5,15 @@ to send it.
The library is asynchronise (thanks to Go) from the get go. The library is asynchronise (thanks to Go) from the get go.
Implemented RFCS Implemented RFCS:
* RFC2671, EDNS * RFC2671, EDNS
* RFC1034/1035
* RFC4033/4034/4035 (todo: validation)
* RFC5155 (NSEC)
Loosly based upon:
* ldns * ldns
* NSD * NSD
* Net::DNS * Net::DNS

4
TODO
View File

@ -1,6 +1,10 @@
EDNS -- finish EDNS0 support EDNS -- finish EDNS0 support
DNSSEC - validation and the remaining records, DS (encoding), NSEC and NSEC3 DNSSEC - validation and the remaining records, DS (encoding), NSEC and NSEC3
unknown RRs - if I ever get around to make it unknown RRs - if I ever get around to make it
convience functions
parsing from strings
"miek.nl IN A 192.168.1.2" -> <correct Go type>
in msg.go, clean out the code and put it in helper functions
quotes in quotes in txt records quotes in quotes in txt records
fix os.Erros usage (extend or whatever) fix os.Erros usage (extend or whatever)

7
msg.go
View File

@ -100,7 +100,7 @@ func packDomainName(s string, msg []byte, off int) (off1 int, ok bool) {
} }
// Root label is special // Root label is special
if s == "." { if s == "." {
return off,true return off, true
} }
msg[off] = 0 msg[off] = 0
off++ off++
@ -204,9 +204,7 @@ func packStructValue(val *reflect.StructValue, msg []byte, off int) (off1 int, o
msg[off+3] = byte(len(data)) msg[off+3] = byte(len(data))
off += 4 off += 4
copy(msg[off:off+len(data)], []byte(data)) copy(msg[off:off+len(data)], []byte(data))
off += len(data) // +1?? off += len(data) // +1?? MG TODO
println("data", data)
println("off", off)
} }
case "A": case "A":
if fv.Len() > net.IPv4len || off+fv.Len() > len(msg) { if fv.Len() > net.IPv4len || off+fv.Len() > len(msg) {
@ -552,7 +550,6 @@ type Msg struct {
Question []Question Question []Question
Answer []RR Answer []RR
Ns []RR Ns []RR
// EDNS0 has to be put in this section
Extra []RR Extra []RR
} }

View File

@ -17,7 +17,7 @@ func TestResolverEdns(t *testing.T) {
m := new(Msg) m := new(Msg)
m.MsgHdr.Recursion_desired = true //only set this bit m.MsgHdr.Recursion_desired = true //only set this bit
m.Question = make([]Question, 1) m.Question = make([]Question, 1)
m.Extra = make([]RR, 1) m.Ns = make([]RR, 1)
// Add EDNS rr // Add EDNS rr
edns := new(RR_OPT) edns := new(RR_OPT)
@ -32,7 +32,7 @@ func TestResolverEdns(t *testing.T) {
// ask something // ask something
m.Question[0] = Question{"miek.nl", TypeSOA, ClassINET} m.Question[0] = Question{"miek.nl", TypeSOA, ClassINET}
m.Extra[0] = edns m.Ns[0] = edns
fmt.Printf("Sending: %v\n", m) fmt.Printf("Sending: %v\n", m)