From 983ccc790956b710bc7d1903ab9e00d1cfc9cf3d Mon Sep 17 00:00:00 2001 From: Miek Gieben Date: Mon, 21 Feb 2011 18:23:39 +0100 Subject: [PATCH] IPv6 works ago. Updated the tests --- TODO | 16 +++++----------- parse_test.go | 24 ++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 11 deletions(-) diff --git a/TODO b/TODO index 965b3c0d..318367f4 100644 --- a/TODO +++ b/TODO @@ -1,28 +1,22 @@ Todo: * wildcards, in sig gen, sig checking * Private key file parsing use io.Reader (or the like) - NewReader, NewWriter? -* Test impl of nameserver, with a small zone, 1 KSK and online signing * Tsig generation for replies (request MAC) +* nsupdate +* escaped dots in names \. Longer term: * Parsing from strings, going with goyacc and own lexer * Multi line output? * NSEC and nsec3 closest encloser helper functions * pack/Unpack smaller. EDNS 'n stuff can be folded in +* Test impl of nameserver, with a small zone, 1 KSK and online signing Issues: -* escaped dots in names \. * quoted quotes in txt records -* Check the network order, it works now, but this is on Intel +* Check the network order, it works now, but this is on Intel?? * Make the testsuite work with public DNS servers -* shortened ipv6 addresses are not parsed correctly (maybe net issue) -* Convenience functions? Not sure if I want them?? - - NXDomain pkt - - FormErr pkt - - for new(RR*) - - nsupdate Funkensturm: -* use exp/eval - to inteprete the config file?? -* TCP how to handle stuff like AXFR +* TCP: how to handle stuff like AXFR * use package log diff --git a/parse_test.go b/parse_test.go index 633b090c..3299e5f6 100644 --- a/parse_test.go +++ b/parse_test.go @@ -2,6 +2,7 @@ package dns import ( "fmt" + "net" "testing" "crypto/rsa" ) @@ -112,3 +113,26 @@ Activate: 20110109154937` sig.Sign(p, []RR{soa}) fmt.Printf("%v\n%v\n%v\n", k, soa, sig) } + +func TestA(t *testing.T) { + a := new(RR_A) + a.Hdr = RR_Header{"miek.nl.", TypeA, ClassINET, 14400, 0} + a.A = net.ParseIP("192.168.1.1") + str := a.String() + if str != "miek.nl.\t14400\tIN\tA\t192.168.1.1" { + t.Log(str) + t.Fail() + } +} + +func TestQuadA(t *testing.T) { + a := new(RR_AAAA) + a.Hdr = RR_Header{"miek.nl.", TypeAAAA, ClassINET, 14400, 0} + a.AAAA = net.ParseIP("::1") + str := a.String() + if str != "miek.nl.\t14400\tIN\tAAAA\t::1" { + t.Log(str) + t.Fail() + } + +}