From f082cd36ca67c07cc1f3c09ea84c8c6cc9aceb54 Mon Sep 17 00:00:00 2001 From: Miek Gieben Date: Mon, 21 Feb 2011 15:19:52 +0100 Subject: [PATCH] unknown dns as type --- Makefile | 3 ++- TODO | 1 + rfc3597.go | 13 +++++++++++++ types.go | 17 ++++++++++++++++- 4 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 rfc3597.go diff --git a/Makefile b/Makefile index 9a6f5692..7b7dd344 100644 --- a/Makefile +++ b/Makefile @@ -18,7 +18,8 @@ GOFILES=\ nsec3.go\ resolver.go\ config.go\ - server.go + rfc3597.go\ + server.go \ # y.go\ include $(GOROOT)/src/Make.pkg diff --git a/TODO b/TODO index b478d984..71fe5f2f 100644 --- a/TODO +++ b/TODO @@ -6,6 +6,7 @@ Todo: * Test impl of nameserver, with a small zone, 1 KSK and online signing * NSEC and nsec3 closest encloser helper functions * Tsig generation for replies (request MAC) +* unknown records * pack/Unpack smaller. EDNS 'n stuff can be folded in Longer term: diff --git a/rfc3597.go b/rfc3597.go new file mode 100644 index 00000000..c072f39a --- /dev/null +++ b/rfc3597.go @@ -0,0 +1,13 @@ +package dns + +// Unknown Resource Records + +import "strconv" + +func unknownClass(class int) string { + return "CLASS" + strconv.Itoa(class) +} + +func unknownType(t int) string { + return "TYPE" + strconv.Itoa(t) +} diff --git a/types.go b/types.go index af4f8a3f..6f469b93 100644 --- a/types.go +++ b/types.go @@ -533,7 +533,6 @@ func (rr *RR_TA) String() string { " " + strings.ToUpper(rr.Digest) } - type RR_TALINK struct { Hdr RR_Header PreviousName string "domain" @@ -673,6 +672,22 @@ func (rr *RR_TKEY) String() string { return "" } +// Unknown RR representation +type RR_RFC3597 struct { + Hdr RR_Header + Rdata string "hex" +} + +func (rr *RR_RFC3597) Header() *RR_Header { + return &rr.Hdr +} + +func (rr *RR_RFC3597) String() string { + s := rr.Hdr.String() + s += "\\# " + strconv.Itoa(len(rr.Rdata)/2) + " " + rr.Rdata + return s +} + // Translate the RRSIG's incep. and expir. time to the correct date. // Taking into account serial arithmetic (RFC 1982) func timeToDate(t uint32) string {