()
| 202 | } |
| 203 | |
| 204 | func (*networkLib) CompileOptions() []cel.EnvOption { |
| 205 | return []cel.EnvOption{ |
| 206 | cel.Types( |
| 207 | IPType, |
| 208 | CIDRType, |
| 209 | ), |
| 210 | |
| 211 | cel.Function(cidrFunc, |
| 212 | // K8s Parity: Following the pattern, this is "string_to_cidr" |
| 213 | cel.Overload("string_to_cidr", []*cel.Type{cel.StringType}, CIDRType, |
| 214 | cel.UnaryBinding(netCIDRString)), |
| 215 | ), |
| 216 | cel.Function(cidrToString, |
| 217 | cel.Overload("cidr_to_string", []*cel.Type{CIDRType}, cel.StringType, |
| 218 | cel.UnaryBinding(netCIDRToString)), |
| 219 | ), |
| 220 | cel.Function(containsCIDRFunc, |
| 221 | cel.MemberOverload("cidr_contains_cidr", []*cel.Type{CIDRType, CIDRType}, cel.BoolType, |
| 222 | cel.BinaryBinding(netCIDRContainsCIDR)), |
| 223 | cel.MemberOverload("cidr_contains_cidr_string", []*cel.Type{CIDRType, cel.StringType}, cel.BoolType, |
| 224 | cel.BinaryBinding(netCIDRContainsCIDRString)), |
| 225 | ), |
| 226 | cel.Function(containsIPFunc, |
| 227 | cel.MemberOverload("cidr_contains_ip_ip", []*cel.Type{CIDRType, IPType}, cel.BoolType, |
| 228 | cel.BinaryBinding(netCIDRContainsIP)), |
| 229 | cel.MemberOverload("cidr_contains_ip_string", []*cel.Type{CIDRType, cel.StringType}, cel.BoolType, |
| 230 | cel.BinaryBinding(netCIDRContainsIPString)), |
| 231 | ), |
| 232 | cel.Function(familyFunc, |
| 233 | cel.MemberOverload("ip_family", []*cel.Type{IPType}, cel.IntType, |
| 234 | cel.UnaryBinding(netIPFamily)), |
| 235 | ), |
| 236 | cel.Function(ipFunc, |
| 237 | // K8s Parity: The global overload is named "string_to_ip" |
| 238 | cel.Overload("string_to_ip", []*cel.Type{cel.StringType}, IPType, |
| 239 | cel.UnaryBinding(netIPString)), |
| 240 | // K8s Parity: The member overload is named "cidr_ip" |
| 241 | cel.MemberOverload("cidr_ip", []*cel.Type{CIDRType}, IPType, |
| 242 | cel.UnaryBinding(netCIDRIP)), |
| 243 | ), |
| 244 | cel.Function(ipToString, |
| 245 | cel.Overload("ip_to_string", []*cel.Type{IPType}, cel.StringType, |
| 246 | cel.UnaryBinding(netIPToString)), |
| 247 | ), |
| 248 | cel.Function(isCanonicalFunc, |
| 249 | cel.Overload("ip_is_canonical", []*cel.Type{cel.StringType}, cel.BoolType, |
| 250 | cel.UnaryBinding(netIPIsCanonical)), |
| 251 | ), |
| 252 | cel.Function(isCIDRFunc, |
| 253 | cel.Overload("is_cidr", []*cel.Type{cel.StringType}, cel.BoolType, |
| 254 | cel.UnaryBinding(netIsCIDR)), |
| 255 | ), |
| 256 | cel.Function(isGlobalUnicastFunc, |
| 257 | cel.MemberOverload("ip_is_global_unicast", []*cel.Type{IPType}, cel.BoolType, |
| 258 | cel.UnaryBinding(netIPIsGlobalUnicast)), |
| 259 | ), |
| 260 | cel.Function(isIPFunc, |
| 261 | cel.Overload("is_ip", []*cel.Type{cel.StringType}, cel.BoolType, |
nothing calls this directly
no test coverage detected