summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Crute <mike@crute.us>2020-08-11 02:54:16 +0000
committerMike Crute <mike@crute.us>2020-08-11 02:54:46 +0000
commitd7fec42036b331a8966efcc85e59b8dafea725ae (patch)
tree4b1405863c0bf899c9092f30629cb42671ed1d32
parent3d4f798b4905173a59283404b680e03f1477207e (diff)
downloadgo_ddns_manager-d7fec42036b331a8966efcc85e59b8dafea725ae.tar.bz2
go_ddns_manager-d7fec42036b331a8966efcc85e59b8dafea725ae.tar.xz
go_ddns_manager-d7fec42036b331a8966efcc85e59b8dafea725ae.zip
Allow looking up zones in view
-rw-r--r--bind/config.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/bind/config.go b/bind/config.go
index 42b97cf..1d4a81a 100644
--- a/bind/config.go
+++ b/bind/config.go
@@ -33,6 +33,20 @@ func (c *BINDConfig) Views() []string {
33 return v 33 return v
34} 34}
35 35
36func (c *BINDConfig) ZonesInView(view string) []*Zone {
37 if _, ok := c.zones[view]; !ok {
38 return nil
39 }
40
41 out := []*Zone{}
42
43 for _, z := range c.zones[view] {
44 out = append(out, z)
45 }
46
47 return out
48}
49
36func (c *BINDConfig) Zone(view, name string) *Zone { 50func (c *BINDConfig) Zone(view, name string) *Zone {
37 if !strings.HasSuffix(name, ".") { 51 if !strings.HasSuffix(name, ".") {
38 name = fmt.Sprintf("%s.", name) 52 name = fmt.Sprintf("%s.", name)