Define NSEC3 and NSEC and NSEC3PARAM RRs

Those come with new rdata-types that still needs to be impl.
This commit is contained in:
Miek Gieben 2010-12-23 16:37:54 +01:00
parent fc8da9eec2
commit 04a18e9937
3 changed files with 34 additions and 8 deletions

3
msg.go
View File

@ -225,6 +225,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 *reflect.StructValue:
off, ok = packStructValue(fv, msg, off)

View File

@ -25,7 +25,7 @@ func main() {
m.MsgHdr.Recursion_desired = true //only set this bit
m.Question = make([]dns.Question, 1)
m.Question[0] = dns.Question{"forfunsec.org", dns.TypeRRSIG, dns.ClassINET}
m.Question[0] = dns.Question{"pa1ton.nl", dns.TypeDS, dns.ClassINET}
ch <- dns.DnsMsg{m, nil}
// wait for an reply

View File

@ -89,6 +89,8 @@ const (
_CD = 1 << 4 // checking disabled
)
// Why not use the official cryptstuff here too???
// or at least map them
const (
// DNSSEC algorithms
AlgRSAMD5 = 1
@ -101,6 +103,11 @@ const (
AlgECCGOST = 12
)
const (
HashSHA1 = 1 //?
HashSHA256 = 2 //?
)
// DNS queries.
type Question struct {
Name string "domain-name" // "domain-name" specifies encoding; see packers below
@ -134,8 +141,9 @@ func (h *RR_Header) Header() *RR_Header {
func (h *RR_Header) String() string {
var s string
if h.Rrtype == TypeOPT {
if h.Rrtype == TypeOPT {
s = ";"
// and maybe other things
}
if len(h.Name) == 0 {
@ -403,7 +411,9 @@ func (rr *RR_RRSIG) String() string {
}
type RR_NSEC struct {
Hdr RR_Header
Hdr RR_Header
NextDomain string "domain-name"
TypeBitMap []byte "NSEC"
}
func (rr *RR_NSEC) Header() *RR_Header {
@ -411,7 +421,7 @@ func (rr *RR_NSEC) Header() *RR_Header {
}
func (rr *RR_NSEC) String() string {
return "BLAH"
return rr.Hdr.String() + "NSEC BLAH"
}
type RR_DS struct {
@ -455,7 +465,15 @@ func (rr *RR_DNSKEY) String() string {
}
type RR_NSEC3 struct {
Hdr RR_Header
Hdr RR_Header
Hash uint8
Flags uint8
Iterations uint16
SaltLength uint8
Salt string "hex"
HashLength uint8
NextDomain string "domain-name"
TypeBitMap []byte "NSEC3"
}
func (rr *RR_NSEC3) Header() *RR_Header {
@ -463,11 +481,16 @@ func (rr *RR_NSEC3) Header() *RR_Header {
}
func (rr *RR_NSEC3) String() string {
return "BLAH"
return rr.Hdr.String() + "BLAH"
}
type RR_NSEC3PARAM struct {
Hdr RR_Header
Hdr RR_Header
Hash uint8
Flags uint8
Iterations uint16
SaltLength uint8
Salt string "hex"
}
func (rr *RR_NSEC3PARAM) Header() *RR_Header {
@ -475,7 +498,7 @@ func (rr *RR_NSEC3PARAM) Header() *RR_Header {
}
func (rr *RR_NSEC3PARAM) String() string {
return "BLAH"
return rr.Hdr.String() + "BLAH"
}
// Map of constructors for each RR wire type.