mirror of
https://github.com/prometheus/prometheus.git
synced 2024-11-17 19:14:04 -08:00
2b02fcb0cb
Update vendor `github.com/miekg/dns` to `v1.0.4` release. * Add dependent vendor `golang.org/x/crypto/ed25519`. * Add dependent vendor `golang.org/x/crypto/ed25519/internal/edwards25519`. * Add dependent vendor `golang.org/x/net/bpf`. * Add dependent vendor `golang.org/x/net/internal/iana`. * Add dependent vendor `golang.org/x/net/internal/socket`. * Add dependent vendor `golang.org/x/net/ipv4`. * Add dependent vendor `golang.org/x/net/ipv6`.
39 lines
897 B
Go
39 lines
897 B
Go
package dns
|
|
|
|
// StringToType is the reverse of TypeToString, needed for string parsing.
|
|
var StringToType = reverseInt16(TypeToString)
|
|
|
|
// StringToClass is the reverse of ClassToString, needed for string parsing.
|
|
var StringToClass = reverseInt16(ClassToString)
|
|
|
|
// StringToOpcode is a map of opcodes to strings.
|
|
var StringToOpcode = reverseInt(OpcodeToString)
|
|
|
|
// StringToRcode is a map of rcodes to strings.
|
|
var StringToRcode = reverseInt(RcodeToString)
|
|
|
|
// Reverse a map
|
|
func reverseInt8(m map[uint8]string) map[string]uint8 {
|
|
n := make(map[string]uint8, len(m))
|
|
for u, s := range m {
|
|
n[s] = u
|
|
}
|
|
return n
|
|
}
|
|
|
|
func reverseInt16(m map[uint16]string) map[string]uint16 {
|
|
n := make(map[string]uint16, len(m))
|
|
for u, s := range m {
|
|
n[s] = u
|
|
}
|
|
return n
|
|
}
|
|
|
|
func reverseInt(m map[int]string) map[string]int {
|
|
n := make(map[string]int, len(m))
|
|
for u, s := range m {
|
|
n[s] = u
|
|
}
|
|
return n
|
|
}
|