MCPcopy Create free account
hub / github.com/cel-expr/cel-go / parseCIDR

Function parseCIDR

ext/network.go:453–465  ·  view source on GitHub ↗
(raw string)

Source from the content-addressed store, hash-verified

451}
452
453func parseCIDR(raw string) (netip.Prefix, error) {
454 prefix, err := netip.ParsePrefix(raw)
455 if err != nil {
456 return netip.Prefix{}, fmt.Errorf("CIDR %q parse error during conversion from string: %v", raw, err)
457 }
458 if prefix.Addr().Zone() != "" {
459 return netip.Prefix{}, fmt.Errorf("CIDR %q with zone value is not allowed", raw)
460 }
461 if prefix.Addr().Is4In6() {
462 return netip.Prefix{}, fmt.Errorf("IPv4-mapped IPv6 address %q is not allowed", raw)
463 }
464 return prefix, nil
465}
466
467func parseIPAddr(raw string) (netip.Addr, error) {
468 addr, err := netip.ParseAddr(raw)

Callers 4

netCIDRStringFunction · 0.85
netIsCIDRFunction · 0.85
checkCIDRFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected