From 5df752fef73af149a1ff41cfb2dc18f9b3bbe9d5 Mon Sep 17 00:00:00 2001 From: Miek Gieben Date: Thu, 28 Jul 2011 23:39:31 +0200 Subject: [PATCH] Smaller tweaks --- dns.go | 2 +- zone.go | 22 +++++++++++++++++++++- zparse.go | 1 + 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/dns.go b/dns.go index 3fc76eed..118543b2 100644 --- a/dns.go +++ b/dns.go @@ -91,7 +91,7 @@ func (s RRset) Swap(i, j int) { s[i], s[j] = s[j], s[i] } func (s RRset) String() string { str := "" for _, r := range s { - str += r.String() + str += r.String() + "\n" } return str } diff --git a/zone.go b/zone.go index c4925b39..f6809089 100644 --- a/zone.go +++ b/zone.go @@ -65,6 +65,16 @@ func (z Zone) Len() int { return i } +func (z Zone) String() string { + s := "" + for _, im := range z { + for _, s1 := range im { + s += s1.RRs.String() + } + } + return s +} + // Add a new RR to the zone. First we need to find out if the // RR already lives inside it. func (z Zone) PushRR(r RR) { @@ -72,13 +82,23 @@ func (z Zone) PushRR(r RR) { if s == nil { s = NewZRRset() } - s.RRs.Push(r) + switch r.Header().Rrtype { + case TypeRRSIG: fallthrough + // If nsec/nsec3/rrsig comes first, tricky with allocation + // Need to always check all 4 item +// s.RRsigs.Push(r) + case TypeNSEC: fallthrough + case TypeNSEC3: fallthrough + default: + s.RRs.Push(r) + } z.Push(s) } // Push a new ZRRset to the zone func (z Zone) Push(s *ZRRset) { i := intval(s.RRs[0].Header().Class, s.RRs[0].Header().Rrtype) + // Need to check the type covered as the RRsigs (if any) if z[s.RRs[0].Header().Name] == nil { im := make(map[int]*ZRRset) // intmap im[i] = s diff --git a/zparse.go b/zparse.go index 241d8eb2..767cb798 100644 --- a/zparse.go +++ b/zparse.go @@ -13,6 +13,7 @@ import ( "strconv" ) +// REALLY make haste with the window reading const _IOBUF = MaxMsgSize // A Parser represents a DNS parser for a