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

Function matchIPByCidrZones

modules/caddyhttp/ip_matchers.go:340–352  ·  view source on GitHub ↗
(clientIP netip.Addr, zoneID string, cidrs []*netip.Prefix, zones []string)

Source from the content-addressed store, hash-verified

338}
339
340func matchIPByCidrZones(clientIP netip.Addr, zoneID string, cidrs []*netip.Prefix, zones []string) (bool, bool) {
341 zoneFilter := true
342 for i, ipRange := range cidrs {
343 if ipRange.Contains(clientIP) {
344 // Check if there are zone filters assigned and if they match.
345 if zones[i] == "" || zoneID == zones[i] {
346 return true, false
347 }
348 zoneFilter = false
349 }
350 }
351 return false, zoneFilter
352}
353
354// Interface guards
355var (

Callers 2

MatchWithErrorMethod · 0.85
MatchWithErrorMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected