Implement CAA

This commit is contained in:
Miek Gieben 2013-04-30 15:04:07 +02:00
parent cb4c191bd3
commit 9d9f5e0b95
2 changed files with 47 additions and 1 deletions

View File

@ -14,3 +14,18 @@
* Speed, we can always go faster. A simple reflect server now hits 45/50K qps
* go test; only works correct on my machine
* privatekey.Precompute() when signing?
## RR not implemented
These are deprecated, or rarely used (or just a bitch to implement).
NSAP
NSAP-PTR
PX
GPOS
NIMLOC
ATMA
A6
KEY
SIG
(maybe more)

View File

@ -491,7 +491,7 @@ type TXT struct {
}
func (rr *TXT) Header() *RR_Header { return &rr.Hdr }
func (rr *TXT) copy() RR { return &TXT{*rr.Hdr.copyHeader(), rr.Txt} }
func (rr *TXT) copy() RR { return &TXT{*rr.Hdr.copyHeader(), rr.Txt} } // this doesn't really copy Txt does it? (TODO?(mg))
func (rr *TXT) String() string {
s := rr.Hdr.String()
@ -1408,6 +1408,36 @@ func (rr *EUI64) len() int {
return rr.Hdr.len() + 8
}
type CAA struct {
Hdr RR_Header
Flag uint8
Tag string
Value []string `dns:"txt"`
}
func (rr *CAA) Header() *RR_Header { return &rr.Hdr }
func (rr *CAA) copy() RR { return &CAA{*rr.Hdr.copyHeader(), rr.Flag, rr.Tag, rr.Value} }
func (rr *CAA) String() string {
s := rr.Hdr.String() + strconv.FormatInt(int64(rr.Flag), 10) + " " + rr.Tag
for i, s1 := range rr.Value {
if i > 0 {
s += " " + strconv.QuoteToASCII(s1)
} else {
s += strconv.QuoteToASCII(s1)
}
}
return s
}
func (rr *CAA) len() int {
l := rr.Hdr.len() + 1 + len(rr.Tag)
for _, t := range rr.Value {
l += len(t)
}
return l
}
// TimeToString translates the RRSIG's incep. and expir. times to the
// string representation used when printing the record.
// It takes serial arithmetic (RFC 1982) into account.
@ -1530,4 +1560,5 @@ var rr_mk = map[uint16]func() RR{
TypeLP: func() RR { return new(LP) },
TypeEUI48: func() RR { return new(EUI48) },
TypeEUI64: func() RR { return new(EUI64) },
TypeCAA: func() RR { return new(CAA) },
}