MCPcopy
hub / github.com/caddyserver/caddy / Provision

Method Provision

modules/caddytls/matchers.go:455–467  ·  view source on GitHub ↗

Provision parses m's IP ranges, either from IP or CIDR expressions.

(ctx caddy.Context)

Source from the content-addressed store, hash-verified

453
454// Provision parses m's IP ranges, either from IP or CIDR expressions.
455func (m *MatchLocalIP) Provision(ctx caddy.Context) error {
456 repl := caddy.NewReplacer()
457 m.logger = ctx.Logger()
458 for _, str := range m.Ranges {
459 rs := repl.ReplaceAll(str, "")
460 cidrs, err := m.parseIPRange(rs)
461 if err != nil {
462 return err
463 }
464 m.cidrs = append(m.cidrs, cidrs...)
465 }
466 return nil
467}
468
469// Match matches hello based on the connection's remote IP.
470func (m MatchLocalIP) Match(hello *tls.ClientHelloInfo) bool {

Callers 1

TestLocalIPMatcherFunction · 0.95

Calls 3

ReplaceAllMethod · 0.95
parseIPRangeMethod · 0.95
LoggerMethod · 0.45

Tested by 1

TestLocalIPMatcherFunction · 0.76