From e8b24e80dac121407dfa2844e44a0260062bbe7d Mon Sep 17 00:00:00 2001 From: Tom Thorogood Date: Fri, 4 Jan 2019 18:40:15 +1030 Subject: [PATCH] Move all reversed map creation into reverse.go (#889) --- dnssec.go | 6 ------ reverse.go | 9 +++++++++ types.go | 3 --- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/dnssec.go b/dnssec.go index 9b39d427..ea15c639 100644 --- a/dnssec.go +++ b/dnssec.go @@ -67,9 +67,6 @@ var AlgorithmToString = map[uint8]string{ PRIVATEOID: "PRIVATEOID", } -// StringToAlgorithm is the reverse of AlgorithmToString. -var StringToAlgorithm = reverseInt8(AlgorithmToString) - // AlgorithmToHash is a map of algorithm crypto hash IDs to crypto.Hash's. var AlgorithmToHash = map[uint8]crypto.Hash{ RSAMD5: crypto.MD5, // Deprecated in RFC 6725 @@ -102,9 +99,6 @@ var HashToString = map[uint8]string{ SHA512: "SHA512", } -// StringToHash is a map of names to hash IDs. -var StringToHash = reverseInt8(HashToString) - // DNSKEY flag values. const ( SEP = 1 diff --git a/reverse.go b/reverse.go index 1f0e2b2a..28151af8 100644 --- a/reverse.go +++ b/reverse.go @@ -17,6 +17,15 @@ func init() { StringToRcode["NOTIMPL"] = RcodeNotImplemented } +// StringToAlgorithm is the reverse of AlgorithmToString. +var StringToAlgorithm = reverseInt8(AlgorithmToString) + +// StringToHash is a map of names to hash IDs. +var StringToHash = reverseInt8(HashToString) + +// StringToCertType is the reverseof CertTypeToString. +var StringToCertType = reverseInt16(CertTypeToString) + // Reverse a map func reverseInt8(m map[uint8]string) map[string]uint8 { n := make(map[string]uint8, len(m)) diff --git a/types.go b/types.go index cdfd2eb8..c040c640 100644 --- a/types.go +++ b/types.go @@ -205,9 +205,6 @@ var CertTypeToString = map[uint16]string{ CertOID: "OID", } -// StringToCertType is the reverseof CertTypeToString. -var StringToCertType = reverseInt16(CertTypeToString) - //go:generate go run types_generate.go // Question holds a DNS question. There can be multiple questions in the