summaryrefslogtreecommitdiff
path: root/bind
diff options
context:
space:
mode:
Diffstat (limited to 'bind')
-rw-r--r--bind/config.go15
-rw-r--r--bind/util.go17
2 files changed, 32 insertions, 0 deletions
diff --git a/bind/config.go b/bind/config.go
index 42b97cf..9d630f1 100644
--- a/bind/config.go
+++ b/bind/config.go
@@ -33,6 +33,21 @@ func (c *BINDConfig) Views() []string {
33 return v 33 return v
34} 34}
35 35
36func (c *BINDConfig) ZonesInView(view string) []*Zone {
37 out := []*Zone{}
38
39 zm, ok := c.zones[view]
40 if !ok {
41 return out
42 }
43
44 for _, z := range zm {
45 out = append(out, z)
46 }
47
48 return out
49}
50
36func (c *BINDConfig) Zone(view, name string) *Zone { 51func (c *BINDConfig) Zone(view, name string) *Zone {
37 if !strings.HasSuffix(name, ".") { 52 if !strings.HasSuffix(name, ".") {
38 name = fmt.Sprintf("%s.", name) 53 name = fmt.Sprintf("%s.", name)
diff --git a/bind/util.go b/bind/util.go
new file mode 100644
index 0000000..cc0ef23
--- /dev/null
+++ b/bind/util.go
@@ -0,0 +1,17 @@
1package bind
2
3import (
4 "strings"
5)
6
7func DeCanonicalize(z string) string {
8 return strings.TrimRight(z, ".")
9}
10
11func Canonicalize(z string) string {
12 if !strings.HasSuffix(z, ".") {
13 return z + "."
14 } else {
15 return z
16 }
17}