Make rr_mk public and call it TypeToRR

This commit is contained in:
Miek Gieben 2014-09-15 18:53:50 +01:00
parent 3d8aa78c0a
commit bcb640ccaf
3 changed files with 5 additions and 5 deletions

View File

@ -437,7 +437,7 @@ func TestToRFC3597(t *testing.T) {
func TestNoRdataPack(t *testing.T) {
data := make([]byte, 1024)
for typ, fn := range rr_mk {
for typ, fn := range TypeToRR {
if typ == TypeCAA {
continue // TODO(miek): known omission
}
@ -454,7 +454,7 @@ func TestNoRdataPack(t *testing.T) {
// TODO(miek): fix dns buffer too small errors this throws
func TestNoRdataUnpack(t *testing.T) {
data := make([]byte, 1024)
for typ, fn := range rr_mk {
for typ, fn := range TypeToRR {
if typ == TypeSOA || typ == TypeTSIG || typ == TypeWKS {
// SOA, TSIG will not be seen (like this) in dyn. updates?
// WKS is an bug, but...deprecated record.

2
msg.go
View File

@ -1329,7 +1329,7 @@ func UnpackRR(msg []byte, off int) (rr RR, off1 int, err error) {
}
end := off + int(h.Rdlength)
// make an rr of that type and re-unpack.
mk, known := rr_mk[h.Rrtype]
mk, known := TypeToRR[h.Rrtype]
if !known {
rr = new(RFC3597)
} else {

View File

@ -1575,8 +1575,8 @@ func copyIP(ip net.IP) net.IP {
return p
}
// Map of constructors for each RR wire type.
var rr_mk = map[uint16]func() RR{
// Map of constructors for each RR type.
var TypeToRR = map[uint16]func() RR{
TypeA: func() RR { return new(A) },
TypeAAAA: func() RR { return new(AAAA) },
TypeAFSDB: func() RR { return new(AFSDB) },