diff options
author | Mike Crute <mike@crute.us> | 2020-08-11 02:54:16 +0000 |
---|---|---|
committer | Mike Crute <mike@crute.us> | 2020-08-11 02:54:46 +0000 |
commit | d7fec42036b331a8966efcc85e59b8dafea725ae (patch) | |
tree | 4b1405863c0bf899c9092f30629cb42671ed1d32 | |
parent | 3d4f798b4905173a59283404b680e03f1477207e (diff) | |
download | go_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.go | 14 |
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 | ||
36 | func (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 | |||
36 | func (c *BINDConfig) Zone(view, name string) *Zone { | 50 | func (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) |