-
Notifications
You must be signed in to change notification settings - Fork 0
/
database.go
53 lines (46 loc) · 1.48 KB
/
database.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
47
48
49
50
51
52
53
// The CoolDNS Project. The simple dynamic dns server and update service.
// Copyright (C) 2014 The CoolDNS Authors
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.package main
package cooldns
import (
"fmt"
"net"
)
type MxEntry struct {
ip string
priority int
}
type Entry struct {
Hostname string
Ip6s []net.IP
Ip4s []net.IP
Offline bool
Txts []string
Mxs []MxEntry
Cname string
}
func (e *Entry) String() string {
return fmt.Sprintf("%s\n\tIpv6: %v\n\tIpv4: %v\n\tOffline: %v\n\tTxt: %v\n\tMxs: %v\n\tCname: %s",
e.Hostname, e.Ip6s, e.Ip4s, e.Offline, e.Txts, e.Mxs, e.Cname)
}
// Specifies the four methods that are needed from a DB
// All methods shall be callable from sevferal goroutines at a time.
type CoolDB interface {
GetEntry(string) *Entry
SaveEntry(*Entry) error
GetAuth(string) *Auth
SaveAuth(*Auth) error
Close() error
}