caddytls: Implement remote IP connection matcher (#4123)

* caddytls: Implement remote IP connection matcher

* Implement IP range negation

If both Ranges and NotRanges are specified, both must match.
This commit is contained in:
Matt Holt
2021-04-30 10:14:52 -06:00
committed by GitHub
parent ff6ca577ec
commit 956f01163d
3 changed files with 202 additions and 2 deletions

View File

@ -430,5 +430,13 @@ func (ctx Context) Storage() certmagic.Storage {
// Logger returns a logger that can be used by mod.
func (ctx Context) Logger(mod Module) *zap.Logger {
if ctx.cfg == nil {
// often the case in tests; just use a dev logger
l, err := zap.NewDevelopment()
if err != nil {
panic("config missing, unable to create dev logger: " + err.Error())
}
return l
}
return ctx.cfg.Logging.Logger(mod)
}