aboutsummaryrefslogtreecommitdiff
path: root/nameserver.go
blob: ff5da5f51b219b597146f8b9d49715c398bb4d4c (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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
package inwx

// A NSType is either Master or Slave.
type NSType string

const (
	Master NSType = "MASTER"
	Slave         = "SLAVE"
)

// SlaveInfo is information about a slave nameserver.
type SlaveInfo struct {
	Hostname string `json:"name"`
	Addr     string `json:"ip"`
}

// A RecordType specifies the type of a DNS record.
type RecordType string

const (
	A          = "A"
	AAAA       = "AAAA"
	AFSDB      = "AFSDB"
	ALIAS      = "ALIAS"
	CAA        = "CAA"
	Cert       = "CERT"
	CNAME      = "CNAME"
	HINFO      = "HINFO"
	KEY        = "KEY"
	LOC        = "LOC"
	MX         = "MX"
	NAPTR      = "NAPTR"
	NS         = "NS"
	OpenPGPKey = "OPENPGPKEY"
	PTR        = "PTR"
	RP         = "RP"
	SMIMEA     = "SMIMEA"
	SOA        = "SOA"
	SRV        = "SRV"
	SSHFP      = "SSHFP"
	TLSA       = "TLSA"
	TXT        = "TXT"
	URI        = "URI"
	URL        = "URL"
)

// A URLRdrType specifies which method of HTTP redirection to use.
type URLRdrType string

const (
	Permanent URLRdrType = "HEADER301"
	Temporary            = "HEADER302"
	Frame                = "FRAME"
)

// A RecordInfo contains DNS as well as INWX specific record information.
type RecordInfo struct {
	Name                string     `json:"name,omitempty"`
	Type                RecordType `json:"type,omitempty"`
	Content             string     `json:"content,omitempty"`
	TTL                 int        `json:"ttl,omitempty"`
	Priority            int        `json:"prio,omitempty"`
	URLRedirectType     URLRdrType `json:"urlRedirectType,omitempty"`
	URLRedirectTitle    string     `json:"urlRedirectTitle,omitempty"`
	URLRedirectDesc     string     `json:"urlRedirectDescription,omitempty"`
	URLRedirectKeywords string     `json:"urlRedirectKeywords,omitempty"`
	URLRedirectFavIcon  string     `json:"urlRedirectFavIcon,omitempty"`
	URLAppend           bool       `json:"urlAppend,omitempty"`
}

// A NSRecord consists of an ID and RecordInfo.
type NSRecord struct {
	ID int `json:"id"`
	RecordInfo
}