plugin/hosts: make unsupported type fallthrough opt-in (#8282)

This commit is contained in:
houyuwushang
2026-07-20 10:59:12 +08:00
committed by GitHub
parent 201d86a098
commit 98bdb44f4d
6 changed files with 154 additions and 22 deletions

View File

@@ -112,6 +112,11 @@ func hostsParse(c *caddy.Controller) (Hosts, error) {
switch c.Val() {
case "fallthrough":
h.Fall.SetZonesFromArgs(c.RemainingArgs())
case "fallthrough_unsupported":
if len(c.RemainingArgs()) != 0 {
return h, c.ArgErr()
}
h.fallthroughUnsupported = true
case "no_reverse":
h.options.autoReverse = false
case "ttl":
@@ -150,6 +155,9 @@ func hostsParse(c *caddy.Controller) (Hosts, error) {
}
}
}
if h.fallthroughUnsupported && len(h.Fall.Zones) == 0 {
return h, c.Err("fallthrough_unsupported requires fallthrough")
}
h.initInline(inline)