From d7fec42036b331a8966efcc85e59b8dafea725ae Mon Sep 17 00:00:00 2001 From: Mike Crute Date: Tue, 11 Aug 2020 02:54:16 +0000 Subject: Allow looking up zones in view --- bind/config.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) 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 { return v } +func (c *BINDConfig) ZonesInView(view string) []*Zone { + if _, ok := c.zones[view]; !ok { + return nil + } + + out := []*Zone{} + + for _, z := range c.zones[view] { + out = append(out, z) + } + + return out +} + func (c *BINDConfig) Zone(view, name string) *Zone { if !strings.HasSuffix(name, ".") { name = fmt.Sprintf("%s.", name) -- cgit v1.2.3