Move all reversed map creation into reverse.go (#889)
This commit is contained in:
parent
5b818eed53
commit
e8b24e80da
|
@ -67,9 +67,6 @@ var AlgorithmToString = map[uint8]string{
|
||||||
PRIVATEOID: "PRIVATEOID",
|
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.
|
// AlgorithmToHash is a map of algorithm crypto hash IDs to crypto.Hash's.
|
||||||
var AlgorithmToHash = map[uint8]crypto.Hash{
|
var AlgorithmToHash = map[uint8]crypto.Hash{
|
||||||
RSAMD5: crypto.MD5, // Deprecated in RFC 6725
|
RSAMD5: crypto.MD5, // Deprecated in RFC 6725
|
||||||
|
@ -102,9 +99,6 @@ var HashToString = map[uint8]string{
|
||||||
SHA512: "SHA512",
|
SHA512: "SHA512",
|
||||||
}
|
}
|
||||||
|
|
||||||
// StringToHash is a map of names to hash IDs.
|
|
||||||
var StringToHash = reverseInt8(HashToString)
|
|
||||||
|
|
||||||
// DNSKEY flag values.
|
// DNSKEY flag values.
|
||||||
const (
|
const (
|
||||||
SEP = 1
|
SEP = 1
|
||||||
|
|
|
@ -17,6 +17,15 @@ func init() {
|
||||||
StringToRcode["NOTIMPL"] = RcodeNotImplemented
|
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
|
// Reverse a map
|
||||||
func reverseInt8(m map[uint8]string) map[string]uint8 {
|
func reverseInt8(m map[uint8]string) map[string]uint8 {
|
||||||
n := make(map[string]uint8, len(m))
|
n := make(map[string]uint8, len(m))
|
||||||
|
|
3
types.go
3
types.go
|
@ -205,9 +205,6 @@ var CertTypeToString = map[uint16]string{
|
||||||
CertOID: "OID",
|
CertOID: "OID",
|
||||||
}
|
}
|
||||||
|
|
||||||
// StringToCertType is the reverseof CertTypeToString.
|
|
||||||
var StringToCertType = reverseInt16(CertTypeToString)
|
|
||||||
|
|
||||||
//go:generate go run types_generate.go
|
//go:generate go run types_generate.go
|
||||||
|
|
||||||
// Question holds a DNS question. There can be multiple questions in the
|
// Question holds a DNS question. There can be multiple questions in the
|
||||||
|
|
Loading…
Reference in New Issue