From d1e5b182a7e69439a50aae093d3df1e1d48a298c Mon Sep 17 00:00:00 2001 From: Miek Gieben Date: Thu, 23 Dec 2010 17:10:06 +0100 Subject: [PATCH] remove some debugging code --- README | 9 +++++++-- TODO | 4 ++++ msg.go | 21 +++++++++------------ resolverEdns_test.go | 4 ++-- 4 files changed, 22 insertions(+), 16 deletions(-) diff --git a/README b/README index 98e8c2ca..4a3c14b3 100644 --- a/README +++ b/README @@ -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 diff --git a/TODO b/TODO index 9e82ae00..36c6b0f0 100644 --- a/TODO +++ b/TODO @@ -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" -> +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) diff --git a/msg.go b/msg.go index 819fa094..352e292b 100644 --- a/msg.go +++ b/msg.go @@ -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 } diff --git a/resolverEdns_test.go b/resolverEdns_test.go index 09ae7c21..5c41263b 100644 --- a/resolverEdns_test.go +++ b/resolverEdns_test.go @@ -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)