Add the all important RKEY
This commit is contained in:
parent
3686d24ca7
commit
4737bfa319
1
msg.go
1
msg.go
|
@ -121,6 +121,7 @@ var Rr_str = map[uint16]string{
|
|||
TypeDHCID: "DHCID",
|
||||
TypeHIP: "HIP",
|
||||
TypeNINFO: "NINFO",
|
||||
TypeRKEY: "RKEY",
|
||||
TypeIPSECKEY: "IPSECKEY",
|
||||
TypeSSHFP: "SSHFP",
|
||||
TypeRRSIG: "RRSIG",
|
||||
|
|
31
types.go
31
types.go
|
@ -64,6 +64,7 @@ const (
|
|||
TypeTLSA uint16 = 52
|
||||
TypeHIP uint16 = 55
|
||||
TypeNINFO uint16 = 56
|
||||
TypeRKEY uint16 = 57
|
||||
TypeTALINK uint16 = 58
|
||||
TypeSPF uint16 = 99
|
||||
TypeNID uint16 = 104
|
||||
|
@ -1131,6 +1132,34 @@ func (rr *RR_DNSKEY) Copy() RR {
|
|||
return &RR_DNSKEY{*rr.Hdr.CopyHeader(), rr.Flags, rr.Protocol, rr.Algorithm, rr.PublicKey}
|
||||
}
|
||||
|
||||
type RR_RKEY struct {
|
||||
Hdr RR_Header
|
||||
Flags uint16
|
||||
Protocol uint8
|
||||
Algorithm uint8
|
||||
PublicKey string `dns:"base64"`
|
||||
}
|
||||
|
||||
func (rr *RR_RKEY) Header() *RR_Header {
|
||||
return &rr.Hdr
|
||||
}
|
||||
|
||||
func (rr *RR_RKEY) String() string {
|
||||
return rr.Hdr.String() + strconv.Itoa(int(rr.Flags)) +
|
||||
" " + strconv.Itoa(int(rr.Protocol)) +
|
||||
" " + strconv.Itoa(int(rr.Algorithm)) +
|
||||
" " + rr.PublicKey
|
||||
}
|
||||
|
||||
func (rr *RR_RKEY) Len() int {
|
||||
return rr.Hdr.Len() + 4 +
|
||||
base64.StdEncoding.DecodedLen(len(rr.PublicKey))
|
||||
}
|
||||
|
||||
func (rr *RR_RKEY) Copy() RR {
|
||||
return &RR_RKEY{*rr.Hdr.CopyHeader(), rr.Flags, rr.Protocol, rr.Algorithm, rr.PublicKey}
|
||||
}
|
||||
|
||||
type RR_NSEC3 struct {
|
||||
Hdr RR_Header
|
||||
Hash uint8
|
||||
|
@ -1597,6 +1626,8 @@ var rr_mk = map[uint16]func() RR{
|
|||
TypeX25: func() RR { return new(RR_X25) },
|
||||
TypeMR: func() RR { return new(RR_MR) },
|
||||
TypeMX: func() RR { return new(RR_MX) },
|
||||
TypeRKEY: func() RR { return new(RR_RKEY) },
|
||||
TypeNINFO: func() RR { return new(RR_NINFO) },
|
||||
TypeNS: func() RR { return new(RR_NS) },
|
||||
TypePTR: func() RR { return new(RR_PTR) },
|
||||
TypeSOA: func() RR { return new(RR_SOA) },
|
||||
|
|
43
zscan_rr.go
43
zscan_rr.go
|
@ -98,6 +98,8 @@ func setRR(h RR_Header, c chan lex, o, f string) (RR, *ParseError) {
|
|||
// newline. Thus there is no need to slurp the remainder, because there is none.
|
||||
case TypeDNSKEY:
|
||||
return setDNSKEY(h, c, f)
|
||||
case TypeRKEY:
|
||||
return setRKEY(h, c, f)
|
||||
case TypeRRSIG:
|
||||
return setRRSIG(h, c, o, f)
|
||||
case TypeNSEC:
|
||||
|
@ -1342,6 +1344,47 @@ func setDNSKEY(h RR_Header, c chan lex, f string) (RR, *ParseError) {
|
|||
return rr, nil
|
||||
}
|
||||
|
||||
func setRKEY(h RR_Header, c chan lex, f string) (RR, *ParseError) {
|
||||
rr := new(RR_RKEY)
|
||||
rr.Hdr = h
|
||||
|
||||
l := <-c
|
||||
if i, e := strconv.Atoi(l.token); e != nil {
|
||||
return nil, &ParseError{f, "bad RKEY Flags", l}
|
||||
} else {
|
||||
rr.Flags = uint16(i)
|
||||
}
|
||||
<-c // _BLANK
|
||||
l = <-c // _STRING
|
||||
if i, e := strconv.Atoi(l.token); e != nil {
|
||||
return nil, &ParseError{f, "bad RKEY Protocol", l}
|
||||
} else {
|
||||
rr.Protocol = uint8(i)
|
||||
}
|
||||
<-c // _BLANK
|
||||
l = <-c // _STRING
|
||||
if i, e := strconv.Atoi(l.token); e != nil {
|
||||
return nil, &ParseError{f, "bad RKEY Algorithm", l}
|
||||
} else {
|
||||
rr.Algorithm = uint8(i)
|
||||
}
|
||||
l = <-c
|
||||
var s string
|
||||
for l.value != _NEWLINE && l.value != _EOF {
|
||||
switch l.value {
|
||||
case _STRING:
|
||||
s += l.token
|
||||
case _BLANK:
|
||||
// Ok
|
||||
default:
|
||||
return nil, &ParseError{f, "bad RKEY PublicKey", l}
|
||||
}
|
||||
l = <-c
|
||||
}
|
||||
rr.PublicKey = s
|
||||
return rr, nil
|
||||
}
|
||||
|
||||
func setDS(h RR_Header, c chan lex, f string) (RR, *ParseError) {
|
||||
rr := new(RR_DS)
|
||||
rr.Hdr = h
|
||||
|
|
Loading…
Reference in New Issue