diff options
author | 2022-04-13 00:39:48 +0800 | |
---|---|---|
committer | 2022-04-12 12:39:48 -0400 | |
commit | 0622a6c66c6c0c6659ece5e6e41ea218912b0ed2 (patch) | |
tree | c0532dbe57397cb6b40e70bc543b6aa3e7426117 /plugin/forward/setup.go | |
parent | e60c179194cc1ff85d24fe9b887d901aea74641d (diff) | |
download | coredns-0622a6c66c6c0c6659ece5e6e41ea218912b0ed2.tar.gz coredns-0622a6c66c6c0c6659ece5e6e41ea218912b0ed2.tar.zst coredns-0622a6c66c6c0c6659ece5e6e41ea218912b0ed2.zip |
plugin/forward: configurable domain support for healthcheck (#5281)
* plugin/forward: configurable domain support for healthcheck
Signed-off-by: hansedong <admin@yinxiaoluo.com>
Diffstat (limited to 'plugin/forward/setup.go')
-rw-r--r-- | plugin/forward/setup.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/plugin/forward/setup.go b/plugin/forward/setup.go index baf0512ba..af8141898 100644 --- a/plugin/forward/setup.go +++ b/plugin/forward/setup.go @@ -151,6 +151,7 @@ func parseStanza(c *caddy.Controller) (*Forward, error) { if f.opts.forceTCP && transports[i] != transport.TLS { f.proxies[i].health.SetTCPTransport() } + f.proxies[i].health.SetDomain(f.opts.hcDomain) } return f, nil @@ -187,11 +188,17 @@ 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 = "." for c.NextArg() { switch hcOpts := c.Val(); hcOpts { case "no_rec": f.opts.hcRecursionDesired = false + case "domain": + if !c.NextArg() { + return c.ArgErr() + } + f.opts.hcDomain = c.Val() default: return fmt.Errorf("health_check: unknown option %s", hcOpts) } |