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

Function parseIPAddr

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

Source from the content-addressed store, hash-verified

492}
493
494func parseIPAddr(raw string) (netip.Addr, error) {
495 addr, err := netip.ParseAddr(raw)
496 if err != nil {
497 return netip.Addr{}, fmt.Errorf("IP Address %q parse error during conversion from string: %v", raw, err)
498 }
499 if addr.Zone() != "" {
500 return netip.Addr{}, fmt.Errorf("IP address %q with zone value is not allowed", raw)
501 }
502 if addr.Is4In6() {
503 return netip.Addr{}, fmt.Errorf("IPv4-mapped IPv6 address %q is not allowed", raw)
504 }
505 return addr, nil
506}
507
508// IP represents an IP address type.
509type IP struct {

Callers 5

netCIDRContainsIPStringFunction · 0.85
netIPIsCanonicalFunction · 0.85
netIPStringFunction · 0.85
netIsIPFunction · 0.85
checkIPFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected