diff options
Diffstat (limited to 'plugin/forward/setup.go')
-rw-r--r-- | plugin/forward/setup.go | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/plugin/forward/setup.go b/plugin/forward/setup.go index 7ca24df4d..6de0c870f 100644 --- a/plugin/forward/setup.go +++ b/plugin/forward/setup.go @@ -12,6 +12,7 @@ import ( "github.com/coredns/coredns/plugin" "github.com/coredns/coredns/plugin/dnstap" "github.com/coredns/coredns/plugin/pkg/parse" + "github.com/coredns/coredns/plugin/pkg/proxy" pkgtls "github.com/coredns/coredns/plugin/pkg/tls" "github.com/coredns/coredns/plugin/pkg/transport" @@ -67,7 +68,7 @@ func setup(c *caddy.Controller) error { // OnStartup starts a goroutines for all proxies. func (f *Forward) OnStartup() (err error) { for _, p := range f.proxies { - p.start(f.hcInterval) + p.Start(f.hcInterval) } return nil } @@ -75,7 +76,7 @@ func (f *Forward) OnStartup() (err error) { // OnShutdown stops all configured proxies. func (f *Forward) OnShutdown() error { for _, p := range f.proxies { - p.stop() + p.Stop() } return nil } @@ -127,7 +128,7 @@ func parseStanza(c *caddy.Controller) (*Forward, error) { if !allowedTrans[trans] { return f, fmt.Errorf("'%s' is not supported as a destination protocol in forward: %s", trans, host) } - p := NewProxy(h, trans) + p := proxy.NewProxy(h, trans) f.proxies = append(f.proxies, p) transports[i] = trans } @@ -152,12 +153,12 @@ func parseStanza(c *caddy.Controller) (*Forward, error) { f.proxies[i].SetTLSConfig(f.tlsConfig) } f.proxies[i].SetExpire(f.expire) - f.proxies[i].health.SetRecursionDesired(f.opts.hcRecursionDesired) + f.proxies[i].GetHealthchecker().SetRecursionDesired(f.opts.HCRecursionDesired) // when TLS is used, checks are set to tcp-tls - if f.opts.forceTCP && transports[i] != transport.TLS { - f.proxies[i].health.SetTCPTransport() + if f.opts.ForceTCP && transports[i] != transport.TLS { + f.proxies[i].GetHealthchecker().SetTCPTransport() } - f.proxies[i].health.SetDomain(f.opts.hcDomain) + f.proxies[i].GetHealthchecker().SetDomain(f.opts.HCDomain) } return f, nil @@ -194,12 +195,12 @@ func parseBlock(c *caddy.Controller, f *Forward) error { return fmt.Errorf("health_check can't be negative: %d", dur) } f.hcInterval = dur - f.opts.hcDomain = "." + f.opts.HCDomain = "." for c.NextArg() { switch hcOpts := c.Val(); hcOpts { case "no_rec": - f.opts.hcRecursionDesired = false + f.opts.HCRecursionDesired = false case "domain": if !c.NextArg() { return c.ArgErr() @@ -208,7 +209,7 @@ func parseBlock(c *caddy.Controller, f *Forward) error { if _, ok := dns.IsDomainName(hcDomain); !ok { return fmt.Errorf("health_check: invalid domain name %s", hcDomain) } - f.opts.hcDomain = plugin.Name(hcDomain).Normalize() + f.opts.HCDomain = plugin.Name(hcDomain).Normalize() default: return fmt.Errorf("health_check: unknown option %s", hcOpts) } @@ -218,12 +219,12 @@ func parseBlock(c *caddy.Controller, f *Forward) error { if c.NextArg() { return c.ArgErr() } - f.opts.forceTCP = true + f.opts.ForceTCP = true case "prefer_udp": if c.NextArg() { return c.ArgErr() } - f.opts.preferUDP = true + f.opts.PreferUDP = true case "tls": args := c.RemainingArgs() if len(args) > 3 { |