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

9
README
View File

@ -5,10 +5,15 @@ to send it.
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
* NSD
* Net::DNS

4
TODO
View File

@ -1,6 +1,10 @@
EDNS -- finish EDNS0 support
DNSSEC - validation and the remaining records, DS (encoding), NSEC and NSEC3
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
fix os.Erros usage (extend or whatever)

21
msg.go
View File

@ -98,10 +98,10 @@ func packDomainName(s string, msg []byte, off int) (off1 int, ok bool) {
begin = i + 1
}
}
// Root label is special
if s == "." {
return off,true
}
// Root label is special
if s == "." {
return off, true
}
msg[off] = 0
off++
return off, true
@ -204,9 +204,7 @@ func packStructValue(val *reflect.StructValue, msg []byte, off int) (off1 int, o
msg[off+3] = byte(len(data))
off += 4
copy(msg[off:off+len(data)], []byte(data))
off += len(data) // +1??
println("data", data)
println("off", off)
off += len(data) // +1?? MG TODO
}
case "A":
if fv.Len() > net.IPv4len || off+fv.Len() > len(msg) {
@ -225,9 +223,9 @@ func packStructValue(val *reflect.StructValue, msg []byte, off int) (off1 int, o
msg[off] = byte(fv.Elem(j).(*reflect.UintValue).Get())
off++
}
case "NSEC3":
case "NSEC":
// handle type bit maps
case "NSEC3":
case "NSEC":
// handle type bit maps
}
case *reflect.StructValue:
off, ok = packStructValue(fv, msg, off)
@ -552,8 +550,7 @@ type Msg struct {
Question []Question
Answer []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.MsgHdr.Recursion_desired = true //only set this bit
m.Question = make([]Question, 1)
m.Extra = make([]RR, 1)
m.Ns = make([]RR, 1)
// Add EDNS rr
edns := new(RR_OPT)
@ -32,7 +32,7 @@ func TestResolverEdns(t *testing.T) {
// ask something
m.Question[0] = Question{"miek.nl", TypeSOA, ClassINET}
m.Extra[0] = edns
m.Ns[0] = edns
fmt.Printf("Sending: %v\n", m)