Add the OPENPGPKEY RR.

This commit is contained in:
Miek Gieben 2014-08-14 09:18:08 +01:00
parent 7eb49f3e37
commit 4d3dac9c36
4 changed files with 47 additions and 27 deletions

1
msg.go
View File

@ -136,6 +136,7 @@ var TypeToString = map[uint16]string{
TypeNSEC: "NSEC",
TypeNULL: "NULL",
TypeOPT: "OPT",
TypeOPENPGPKEY: "OPENPGPKEY",
TypePTR: "PTR",
TypeRKEY: "RKEY",
TypeRP: "RP",

View File

@ -529,18 +529,22 @@ func TestParseFailure(t *testing.T) {
}
func TestZoneParsing(t *testing.T) {
f, err := os.Open("test.db")
f, err := os.Open("parse_test.db")
if err != nil {
return
}
defer f.Close()
start := time.Now().UnixNano()
to := ParseZone(f, "", "test.db")
to := ParseZone(f, "", "parse_test.db")
var i int
for x := range to {
x = x
//t.Logf("%s\n", x.RR)
i++
if x.Error != nil {
t.Logf("%s\n", x.Error)
t.Fail()
continue
}
t.Logf("%s\n", x.RR)
}
delta := time.Now().UnixNano() - start
t.Logf("%d RRs parsed in %.2f s (%.2f RR/s)", i, float32(delta)/1e9, float32(i)/(float32(delta)/1e9))

View File

@ -80,6 +80,7 @@ const (
TypeRKEY uint16 = 57
TypeTALINK uint16 = 58
TypeCDS uint16 = 59
TypeOPENPGPKEY uint16 = 61
TypeSPF uint16 = 99
TypeUINFO uint16 = 100
TypeUID uint16 = 101
@ -1621,27 +1622,27 @@ var rr_mk = map[uint16]func() RR{
TypeNSEC3: func() RR { return new(NSEC3) },
TypeNSEC3PARAM: func() RR { return new(NSEC3PARAM) },
TypeNSEC: func() RR { return new(NSEC) },
// TypeOPENPGPKEY: func() RR { return new(OPENPGPKEY) },
TypeOPT: func() RR { return new(OPT) },
TypePTR: func() RR { return new(PTR) },
TypeRKEY: func() RR { return new(RKEY) },
TypeRP: func() RR { return new(RP) },
TypePX: func() RR { return new(PX) },
TypeRRSIG: func() RR { return new(RRSIG) },
TypeRT: func() RR { return new(RT) },
TypeSOA: func() RR { return new(SOA) },
TypeSPF: func() RR { return new(SPF) },
TypeSRV: func() RR { return new(SRV) },
TypeSSHFP: func() RR { return new(SSHFP) },
TypeTA: func() RR { return new(TA) },
TypeTALINK: func() RR { return new(TALINK) },
TypeTKEY: func() RR { return new(TKEY) },
TypeTLSA: func() RR { return new(TLSA) },
TypeTSIG: func() RR { return new(TSIG) },
TypeTXT: func() RR { return new(TXT) },
TypeUID: func() RR { return new(UID) },
TypeUINFO: func() RR { return new(UINFO) },
TypeURI: func() RR { return new(URI) },
TypeWKS: func() RR { return new(WKS) },
TypeX25: func() RR { return new(X25) },
TypeOPENPGPKEY: func() RR { return new(OPENPGPKEY) },
TypeOPT: func() RR { return new(OPT) },
TypePTR: func() RR { return new(PTR) },
TypeRKEY: func() RR { return new(RKEY) },
TypeRP: func() RR { return new(RP) },
TypePX: func() RR { return new(PX) },
TypeRRSIG: func() RR { return new(RRSIG) },
TypeRT: func() RR { return new(RT) },
TypeSOA: func() RR { return new(SOA) },
TypeSPF: func() RR { return new(SPF) },
TypeSRV: func() RR { return new(SRV) },
TypeSSHFP: func() RR { return new(SSHFP) },
TypeTA: func() RR { return new(TA) },
TypeTALINK: func() RR { return new(TALINK) },
TypeTKEY: func() RR { return new(TKEY) },
TypeTLSA: func() RR { return new(TLSA) },
TypeTSIG: func() RR { return new(TSIG) },
TypeTXT: func() RR { return new(TXT) },
TypeUID: func() RR { return new(UID) },
TypeUINFO: func() RR { return new(UINFO) },
TypeURI: func() RR { return new(URI) },
TypeWKS: func() RR { return new(WKS) },
TypeX25: func() RR { return new(X25) },
}

View File

@ -180,6 +180,8 @@ func setRR(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) {
return setUINFO(h, c, f)
case TypeCERT:
return setCERT(h, c, f)
case TypeOPENPGPKEY:
return setOPENPGPKEY(h, c, f)
default:
// RFC3957 RR (Unknown RR handling)
return setRFC3597(h, c, f)
@ -1127,6 +1129,18 @@ func setCERT(h RR_Header, c chan lex, f string) (RR, *ParseError, string) {
return rr, nil, c1
}
func setOPENPGPKEY(h RR_Header, c chan lex, f string) (RR, *ParseError, string) {
rr := new(OPENPGPKEY)
rr.Hdr = h
s, e, c1 := endingToString(c, "bad OPENPGPKEY PublicKey", f)
if e != nil {
return nil, e, c1
}
rr.PublicKey = s
return rr, nil, c1
}
func setRRSIG(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) {
rr := new(RRSIG)
rr.Hdr = h