diff --git a/TODO.markdown b/TODO.markdown index cf257c46..0dd30274 100644 --- a/TODO.markdown +++ b/TODO.markdown @@ -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) diff --git a/types.go b/types.go index 7a5a56db..915f6218 100644 --- a/types.go +++ b/types.go @@ -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) }, }