plugin/tls: manage certificates with ACME DNS-01 (#8310)

* plugin/tls: add automatic ACME certificates

Signed-off-by: houyuwushang <liuluoqianqiu@outlook.com>

* chore: add houyuwushang to CODEOWNERS

Signed-off-by: houyuwushang <liuluoqianqiu@outlook.com>

* chore: regenerate maintainer owners

Signed-off-by: houyuwushang <liuluoqianqiu@outlook.com>

---------

Signed-off-by: houyuwushang <liuluoqianqiu@outlook.com>
This commit is contained in:
houyuwushang
2026-07-30 10:24:22 +08:00
committed by GitHub
parent 03260d5b67
commit 546fac83ea
13 changed files with 1369 additions and 73 deletions

View File

@@ -171,3 +171,22 @@ func GetConfig(c *caddy.Controller) *Config {
ctx.saveConfig(key, &Config{ListenHosts: []string{""}})
return GetConfig(c)
}
// AddPluginToAllServerBlocks adds m once to every server block in c's
// instance. It is intended for directives that must handle traffic on a
// listener other than the one where the directive is configured.
func AddPluginToAllServerBlocks(c *caddy.Controller, m plugin.Plugin) {
ctx := c.Context().(*dnsContext)
seen := make(map[*Config]struct{})
for _, cfg := range ctx.configs {
first := cfg.firstConfigInBlock
if first == nil {
first = cfg
}
if _, ok := seen[first]; ok {
continue
}
seen[first] = struct{}{}
first.AddPlugin(m)
}
}