ConvertToNative converts the IP value to a native Go type.
(typeDesc reflect.Type)
| 512 | |
| 513 | // ConvertToNative converts the IP value to a native Go type. |
| 514 | func (i IP) ConvertToNative(typeDesc reflect.Type) (any, error) { |
| 515 | if typeDesc == reflect.TypeFor[netip.Addr]() { |
| 516 | return i.Addr, nil |
| 517 | } |
| 518 | if typeDesc.Kind() == reflect.String { |
| 519 | return i.Addr.String(), nil |
| 520 | } |
| 521 | return nil, fmt.Errorf("unsupported type conversion to '%v'", typeDesc) |
| 522 | } |
| 523 | |
| 524 | // ConvertToType converts the IP value to a CEL type. |
| 525 | func (i IP) ConvertToType(typeValue ref.Type) ref.Val { |