aboutsummaryrefslogtreecommitdiff
path: root/plugin/metrics/vars/monitor.go
blob: 17ca7cf63e50d9e190bec030e5b3b15bf1323fac (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package vars

import (
	"github.com/miekg/dns"
)

var monitorType = map[uint16]struct{}{
	dns.TypeAAAA:   {},
	dns.TypeA:      {},
	dns.TypeCNAME:  {},
	dns.TypeDNSKEY: {},
	dns.TypeDS:     {},
	dns.TypeMX:     {},
	dns.TypeNSEC3:  {},
	dns.TypeNSEC:   {},
	dns.TypeNS:     {},
	dns.TypePTR:    {},
	dns.TypeRRSIG:  {},
	dns.TypeSOA:    {},
	dns.TypeSRV:    {},
	dns.TypeTXT:    {},
	// Meta Qtypes
	dns.TypeIXFR: {},
	dns.TypeAXFR: {},
	dns.TypeANY:  {},
}

// qTypeString returns the RR type based on monitorType. It returns the text representation
// of thosAe types. RR types not in that list will have "other" returned.
func qTypeString(qtype uint16) string {
	if _, known := monitorType[qtype]; known {
		return dns.Type(qtype).String()
	}
	return "other"
}