(anyProto *anypb.Any)
| 88 | type proxyAddressConvertor struct{} |
| 89 | |
| 90 | func (proxyAddressConvertor) convert(anyProto *anypb.Any) (any, error) { |
| 91 | addressProto := &v3corepb.Address{} |
| 92 | if err := anyProto.UnmarshalTo(addressProto); err != nil { |
| 93 | return nil, fmt.Errorf("failed to unmarshal resource from Any proto: %v", err) |
| 94 | } |
| 95 | socketaddress := addressProto.GetSocketAddress() |
| 96 | if socketaddress == nil { |
| 97 | return nil, fmt.Errorf("no socket_address field in metadata") |
| 98 | } |
| 99 | if _, err := netip.ParseAddr(socketaddress.GetAddress()); err != nil { |
| 100 | return nil, fmt.Errorf("address field is not a valid IPv4 or IPv6 address: %q", socketaddress.GetAddress()) |
| 101 | } |
| 102 | portvalue := socketaddress.GetPortValue() |
| 103 | if portvalue == 0 { |
| 104 | return nil, fmt.Errorf("port value not set in socket_address") |
| 105 | } |
| 106 | return ProxyAddressMetadataValue{Address: parseAddress(socketaddress)}, nil |
| 107 | } |
| 108 | |
| 109 | // AudienceMetadataValue holds the audience parsed from the |
| 110 | // envoy.extensions.filters.http.gcp_authn.v3.Audience proto message, as |
nothing calls this directly
no test coverage detected