blob: 4a02d2cece5785e4ca661068c37c91a69d1f0de4 (
plain)
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
|
package dns
import (
"fmt"
_ "net"
"github.com/miekg/dns"
)
//go:generate go run ../generate_dns_types.go
type NamedZone interface {
ZoneName() string
}
func makeHeader(name string, zone NamedZone, t uint16, ttl int) dns.RR_Header {
return dns.RR_Header{
Name: fmt.Sprintf("%s.%s", name, zone.ZoneName()),
Rrtype: t,
Class: dns.ClassINET,
Ttl: uint32(ttl),
}
}
func toRRSet(z NamedZone, rr ...RR) []dns.RR {
o := []dns.RR{}
for _, v := range rr {
o = append(o, v.ToDNS(z))
}
return o
}
type RR interface {
ToDNS(NamedZone) dns.RR
FromDNS(rr dns.RR) error
MarshalJSON() ([]byte, error)
UnmarshalJSON(data []byte) error
}
|