diff --git a/setup.go b/setup.go index ee057ae..8e35436 100644 --- a/setup.go +++ b/setup.go @@ -40,6 +40,7 @@ func setup(c *caddy.Controller) error { fmt.Errorf("error constructing wgctrl client: %v", err)) } + c.OnFinalShutdown(client.Close) // Add the Plugin to CoreDNS, so Servers can use it in their plugin chain. dnsserver.GetConfig(c).AddPlugin(func(next plugin.Handler) plugin.Handler {