-
Notifications
You must be signed in to change notification settings - Fork 2
/
type.go
46 lines (35 loc) · 877 Bytes
/
type.go
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
36
37
38
39
40
41
42
43
44
45
46
package newdns
import "github.com/miekg/dns"
// Type denotes the DNS record type.
type Type uint16
const (
// A records return IPV4 addresses.
A = Type(dns.TypeA)
// AAAA records return IPV6 addresses.
AAAA = Type(dns.TypeAAAA)
// CNAME records return other DNS names.
CNAME = Type(dns.TypeCNAME)
// MX records return mails servers with their priorities. The target mail
// servers must itself be returned with an A or AAAA record.
MX = Type(dns.TypeMX)
// TXT records return arbitrary text data.
TXT = Type(dns.TypeTXT)
// NS records delegate names to other name servers.
NS = Type(dns.TypeNS)
)
func (t Type) supported() bool {
switch t {
case A, AAAA, CNAME, MX, TXT, NS:
return true
default:
return false
}
}
func typeInList(list []Type, needle Type) bool {
for _, t := range list {
if t == needle {
return true
}
}
return false
}