grpc 1.83.1 → 1.84.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Makefile +21 -17
- data/include/grpc/credentials.h +10 -0
- data/include/grpc/grpc_security_constants.h +2 -0
- data/include/grpc/impl/channel_arg_names.h +9 -0
- data/src/core/call/call_filters.h +4 -2
- data/src/core/call/client_call.cc +20 -8
- data/src/core/call/client_call.h +4 -0
- data/src/core/call/interception_chain.cc +2 -0
- data/src/core/call/interception_chain.h +14 -1
- data/src/core/call/metadata.cc +1 -3
- data/src/core/call/metadata_batch.h +13 -5
- data/src/core/call/server_call.cc +31 -14
- data/src/core/call/server_call.h +4 -0
- data/src/core/channelz/text_encode.cc +9 -4
- data/src/core/channelz/v2tov1/convert.cc +2 -2
- data/src/core/client_channel/backup_poller.cc +1 -2
- data/src/core/client_channel/client_channel.cc +6 -33
- data/src/core/client_channel/client_channel_filter.cc +22 -55
- data/src/core/client_channel/client_channel_filter.h +2 -2
- data/src/core/client_channel/client_channel_service_config.cc +3 -19
- data/src/core/client_channel/direct_channel.cc +7 -1
- data/src/core/client_channel/direct_channel.h +2 -2
- data/src/core/client_channel/load_balanced_call_destination.cc +5 -3
- data/src/core/client_channel/retry_filter_legacy_call_data.cc +5 -12
- data/src/core/client_channel/subchannel.cc +310 -1058
- data/src/core/client_channel/subchannel.h +44 -329
- data/src/core/client_channel/subchannel_metrics.cc +48 -0
- data/src/core/client_channel/subchannel_metrics.h +60 -0
- data/src/core/credentials/call/external/file_external_account_credentials.cc +1 -1
- data/src/core/credentials/call/external/url_external_account_credentials.cc +2 -3
- data/src/core/credentials/call/gcp_service_account_identity/gcp_service_account_identity_credentials.cc +8 -24
- data/src/core/credentials/call/gcp_service_account_identity/gcp_service_account_identity_credentials.h +3 -6
- data/src/core/credentials/call/gdch_service_account/gdch_service_account_credentials.cc +525 -0
- data/src/core/credentials/call/gdch_service_account/gdch_service_account_credentials.h +138 -0
- data/src/core/credentials/call/json_util.h +1 -0
- data/src/core/credentials/call/jwt/json_token.cc +10 -2
- data/src/core/credentials/call/jwt/jwt_verifier.cc +15 -1
- data/src/core/credentials/call/jwt_token_file/jwt_token_file_call_credentials.cc +1 -1
- data/src/core/credentials/call/oauth2/oauth2_credentials.cc +42 -79
- data/src/core/credentials/call/oauth2/oauth2_credentials.h +2 -5
- data/src/core/credentials/call/token_fetcher/token_fetcher_credentials.cc +52 -31
- data/src/core/credentials/call/token_fetcher/token_fetcher_credentials.h +21 -8
- data/src/core/credentials/transport/google_default/google_default_credentials.cc +3 -4
- data/src/core/credentials/transport/ssl/ssl_credentials.cc +59 -72
- data/src/core/credentials/transport/ssl/ssl_credentials.h +9 -8
- data/src/core/credentials/transport/ssl/ssl_security_connector.cc +12 -6
- data/src/core/credentials/transport/ssl/ssl_security_connector.h +4 -4
- data/src/core/credentials/transport/tls/grpc_tls_certificate_distributor.cc +29 -18
- data/src/core/credentials/transport/tls/grpc_tls_certificate_distributor.h +9 -6
- data/src/core/credentials/transport/tls/grpc_tls_certificate_provider.cc +45 -56
- data/src/core/credentials/transport/tls/grpc_tls_certificate_provider.h +5 -4
- data/src/core/credentials/transport/tls/grpc_tls_certificate_selector.h +26 -0
- data/src/core/credentials/transport/tls/grpc_tls_crl_provider.cc +1 -1
- data/src/core/credentials/transport/tls/load_system_roots.h +2 -6
- data/src/core/credentials/transport/tls/load_system_roots_fallback.cc +2 -4
- data/src/core/credentials/transport/tls/load_system_roots_supported.cc +13 -15
- data/src/core/credentials/transport/tls/load_system_roots_supported.h +3 -2
- data/src/core/credentials/transport/tls/load_system_roots_windows.cc +5 -8
- data/src/core/credentials/transport/tls/spiffe_utils.cc +1 -1
- data/src/core/credentials/transport/tls/ssl_utils.cc +39 -28
- data/src/core/credentials/transport/tls/ssl_utils.h +12 -49
- data/src/core/credentials/transport/tls/tls_security_connector.cc +48 -33
- data/src/core/credentials/transport/tls/tls_security_connector.h +31 -10
- data/src/core/ext/filters/channel_idle/legacy_channel_idle_filter.cc +15 -11
- data/src/core/ext/filters/http/http_filters_plugin.cc +20 -9
- data/src/core/ext/filters/rbac/rbac_filter.cc +43 -21
- data/src/core/ext/filters/rbac/rbac_filter.h +21 -3
- data/src/core/ext/filters/rbac/rbac_service_config_parser.cc +2 -2
- data/src/core/ext/transport/chttp2/client/chttp2_connector.cc +1 -1
- data/src/core/ext/transport/chttp2/server/chttp2_server.cc +6 -20
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +32 -67
- data/src/core/ext/transport/chttp2/transport/flow_control.cc +2 -0
- data/src/core/ext/transport/chttp2/transport/flow_control.h +78 -4
- data/src/core/ext/transport/chttp2/transport/frame.h +2 -0
- data/src/core/ext/transport/chttp2/transport/frame_data.cc +3 -4
- data/src/core/ext/transport/chttp2/transport/goaway.h +7 -0
- data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +5 -3
- data/src/core/ext/transport/chttp2/transport/hpack_parser.h +3 -1
- data/src/core/ext/transport/chttp2/transport/http2_client_transport.cc +141 -130
- data/src/core/ext/transport/chttp2/transport/http2_client_transport.h +22 -22
- data/src/core/ext/transport/chttp2/transport/http2_server_transport.cc +402 -269
- data/src/core/ext/transport/chttp2/transport/http2_server_transport.h +80 -49
- data/src/core/ext/transport/chttp2/transport/http2_settings_promises.h +1 -2
- data/src/core/ext/transport/chttp2/transport/http2_status.h +38 -37
- data/src/core/ext/transport/chttp2/transport/http2_transport.cc +178 -5
- data/src/core/ext/transport/chttp2/transport/http2_transport.h +345 -5
- data/src/core/ext/transport/chttp2/transport/parsing.cc +5 -5
- data/src/core/ext/transport/chttp2/transport/ping_promise.cc +3 -2
- data/src/core/ext/transport/chttp2/transport/ping_promise.h +25 -5
- data/src/core/ext/transport/chttp2/transport/ping_rate_policy.cc +3 -4
- data/src/core/ext/transport/chttp2/transport/read_context.h +30 -3
- data/src/core/ext/transport/chttp2/transport/stream.h +65 -23
- data/src/core/ext/transport/chttp2/transport/writing.cc +0 -3
- data/src/core/ext/transport/inproc/inproc_transport.cc +1 -5
- data/src/core/ext/transport/inproc/legacy_inproc_transport.cc +4 -17
- data/src/core/ext/upb-gen/envoy/extensions/filters/http/ext_proc/v3/ext_proc.upb.h +1912 -0
- data/src/core/ext/upb-gen/envoy/extensions/filters/http/ext_proc/v3/ext_proc.upb_minitable.c +300 -0
- data/src/core/ext/upb-gen/envoy/extensions/filters/http/ext_proc/v3/ext_proc.upb_minitable.h +37 -0
- data/src/core/ext/upb-gen/envoy/extensions/filters/http/ext_proc/v3/processing_mode.upb.h +187 -0
- data/src/core/ext/upb-gen/envoy/extensions/filters/http/ext_proc/v3/processing_mode.upb_minitable.c +64 -0
- data/src/core/ext/upb-gen/envoy/extensions/filters/http/ext_proc/v3/processing_mode.upb_minitable.h +31 -0
- data/src/core/ext/upb-gen/envoy/service/ext_proc/v3/external_processor.upb.h +2362 -0
- data/src/core/ext/upb-gen/envoy/service/ext_proc/v3/external_processor.upb_minitable.c +556 -0
- data/src/core/ext/upb-gen/envoy/service/ext_proc/v3/external_processor.upb_minitable.h +47 -0
- data/src/core/ext/upb-gen/{src/proto/grpc/channelz → grpc/channelz/v1}/channelz.upb.h +5 -5
- data/src/core/ext/upb-gen/{src/proto/grpc/channelz → grpc/channelz/v1}/channelz.upb_minitable.c +3 -3
- data/src/core/ext/upb-gen/{src/proto/grpc/channelz → grpc/channelz/v1}/channelz.upb_minitable.h +5 -5
- data/src/core/ext/upbdefs-gen/envoy/extensions/filters/http/ext_proc/v3/ext_proc.upbdefs.c +453 -0
- data/src/core/ext/upbdefs-gen/envoy/extensions/filters/http/ext_proc/v3/ext_proc.upbdefs.h +67 -0
- data/src/core/ext/upbdefs-gen/envoy/extensions/filters/http/ext_proc/v3/processing_mode.upbdefs.c +142 -0
- data/src/core/ext/upbdefs-gen/envoy/extensions/filters/http/ext_proc/v3/processing_mode.upbdefs.h +37 -0
- data/src/core/ext/upbdefs-gen/grpc/channelz/v1/channelz.upbdefs.c +715 -0
- data/src/core/ext/upbdefs-gen/{src/proto/grpc/channelz → grpc/channelz/v1}/channelz.upbdefs.h +44 -44
- data/src/core/filter/auth/server_auth_filter.cc +2 -3
- data/src/core/filter/composite/composite_filter.cc +45 -33
- data/src/core/filter/composite/composite_filter.h +5 -4
- data/src/core/filter/ext_proc/ext_proc_filter.cc +224 -0
- data/src/core/filter/ext_proc/ext_proc_filter.h +155 -0
- data/src/core/filter/ext_proc/ext_proc_messages.cc +701 -0
- data/src/core/filter/ext_proc/ext_proc_messages.h +297 -0
- data/src/core/filter/filter_args.h +13 -2
- data/src/core/handshaker/http_connect/http_proxy_mapper.cc +30 -3
- data/src/core/handshaker/security/security_handshaker.cc +9 -6
- data/src/core/lib/channel/channel_stack.cc +3 -0
- data/src/core/lib/channel/channel_stack.h +2 -0
- data/src/core/lib/channel/channel_stack_builder_impl.cc +1 -2
- data/src/core/lib/channel/promise_based_filter.cc +132 -20
- data/src/core/lib/channel/promise_based_filter.h +42 -12
- data/src/core/lib/compression/compression_internal.cc +4 -5
- data/src/core/lib/debug/trace_flags.cc +8 -0
- data/src/core/lib/debug/trace_flags.h +3 -0
- data/src/core/lib/event_engine/ares_resolver.cc +54 -50
- data/src/core/lib/event_engine/ares_resolver.h +3 -2
- data/src/core/lib/event_engine/posix_engine/ev_epoll1_linux.cc +3 -3
- data/src/core/lib/event_engine/posix_engine/ev_poll_posix.cc +4 -10
- data/src/core/lib/event_engine/posix_engine/posix_endpoint.cc +74 -33
- data/src/core/lib/event_engine/posix_engine/posix_endpoint.h +4 -4
- data/src/core/lib/event_engine/posix_engine/posix_engine.cc +6 -2
- data/src/core/lib/event_engine/posix_engine/tcp_socket_utils.cc +3 -0
- data/src/core/lib/event_engine/posix_engine/tcp_socket_utils.h +3 -0
- data/src/core/lib/event_engine/windows/windows_endpoint.cc +1 -3
- data/src/core/lib/experiments/experiments.cc +60 -96
- data/src/core/lib/experiments/experiments.h +34 -50
- data/src/core/lib/iomgr/cfstream_handle.cc +2 -6
- data/src/core/lib/iomgr/endpoint_cfstream.cc +3 -10
- data/src/core/lib/iomgr/error.cc +2 -6
- data/src/core/lib/iomgr/error_cfstream.cc +1 -1
- data/src/core/lib/iomgr/ev_poll_posix.cc +5 -9
- data/src/core/lib/iomgr/event_engine_shims/closure.cc +1 -1
- data/src/core/lib/iomgr/event_engine_shims/endpoint.cc +1 -2
- data/src/core/lib/iomgr/event_engine_shims/tcp_client.cc +1 -2
- data/src/core/lib/iomgr/iomgr_posix.cc +0 -4
- data/src/core/lib/iomgr/iomgr_posix_cfstream.cc +0 -4
- data/src/core/lib/iomgr/iomgr_windows.cc +0 -4
- data/src/core/lib/iomgr/socket_factory_posix.h +1 -1
- data/src/core/lib/iomgr/socket_utils_posix.cc +3 -0
- data/src/core/lib/iomgr/socket_utils_posix.h +3 -0
- data/src/core/lib/iomgr/systemd_utils.cc +0 -1
- data/src/core/lib/iomgr/tcp_client.h +1 -1
- data/src/core/lib/iomgr/tcp_posix.cc +23 -15
- data/src/core/lib/iomgr/tcp_server.h +1 -1
- data/src/core/lib/iomgr/tcp_server_posix.cc +2 -3
- data/src/core/lib/iomgr/tcp_server_utils_posix.h +0 -1
- data/src/core/lib/iomgr/tcp_server_windows.cc +0 -1
- data/src/core/lib/iomgr/tcp_windows.cc +5 -10
- data/src/core/lib/iomgr/unix_sockets_posix.cc +2 -4
- data/src/core/lib/iomgr/unix_sockets_posix.h +3 -1
- data/src/core/lib/iomgr/vsock.h +3 -1
- data/src/core/lib/resource_quota/memory_quota.cc +1 -1
- data/src/core/lib/security/authorization/rbac_policy.cc +139 -56
- data/src/core/lib/security/authorization/rbac_policy.h +21 -3
- data/src/core/lib/surface/call.cc +3 -9
- data/src/core/lib/surface/call_utils.h +113 -0
- data/src/core/lib/surface/channel_create.cc +1 -1
- data/src/core/lib/surface/channel_create.h +0 -2
- data/src/core/lib/surface/channel_init.cc +77 -38
- data/src/core/lib/surface/channel_init.h +30 -16
- data/src/core/lib/surface/filter_stack_call.cc +5 -10
- data/src/core/lib/surface/init.cc +13 -27
- data/src/core/lib/surface/version.cc +1 -1
- data/src/core/lib/transport/error_utils.cc +0 -27
- data/src/core/lib/transport/error_utils.h +0 -16
- data/src/core/lib/transport/transport.h +7 -5
- data/src/core/load_balancing/pick_first/pick_first.cc +2 -0
- data/src/core/load_balancing/rls/rls.cc +28 -11
- data/src/core/load_balancing/weighted_round_robin/weighted_round_robin.cc +33 -42
- data/src/core/load_balancing/weighted_round_robin/weighted_round_robin.h +0 -2
- data/src/core/load_balancing/xds/cds.cc +3 -1
- data/src/core/load_balancing/xds/xds_cluster_impl.cc +0 -1
- data/src/core/mitigation_engine/mitigation.h +14 -5
- data/src/core/mitigation_engine/mitigation_engine.h +7 -3
- data/src/core/mitigation_engine/mitigation_provider.h +2 -1
- data/src/core/plugin_registry/grpc_plugin_registry.cc +39 -8
- data/src/core/resolver/dns/{event_engine/event_engine_client_channel_resolver.cc → dns_resolver.cc} +42 -41
- data/src/core/resolver/dns/{event_engine/event_engine_client_channel_resolver.h → dns_resolver.h} +8 -5
- data/src/core/resolver/dns/{event_engine/service_config_helper.cc → service_config_helper.cc} +1 -1
- data/src/core/resolver/dns/{event_engine/service_config_helper.h → service_config_helper.h} +3 -3
- data/src/core/resolver/endpoint_addresses.h +3 -0
- data/src/core/resolver/google_c2p/google_c2p_resolver.cc +2 -1
- data/src/core/resolver/xds/xds_resolver.cc +35 -9
- data/src/core/server/server.cc +2 -6
- data/src/core/server/server_config_selector.h +18 -3
- data/src/core/server/server_config_selector_filter.cc +178 -91
- data/src/core/server/server_config_selector_filter.h +58 -3
- data/src/core/server/xds_server_config_fetcher.cc +196 -129
- data/src/core/server/xds_server_config_fetcher.h +49 -0
- data/src/core/server/xds_server_config_fetcher_legacy.cc +41 -37
- data/src/core/telemetry/histogram.h +94 -14
- data/src/core/telemetry/instrument.cc +179 -74
- data/src/core/telemetry/instrument.h +78 -30
- data/src/core/telemetry/metrics.h +5 -0
- data/src/core/{resolver/dns/dns_resolver_plugin.h → telemetry/telemetry_label.h} +12 -8
- data/src/core/tsi/alts/crypt/aes_gcm.cc +10 -13
- data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc +2 -2
- data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.h +3 -1
- data/src/core/tsi/ssl_telemetry_utils.cc +216 -259
- data/src/core/tsi/ssl_telemetry_utils.h +12 -2
- data/src/core/tsi/ssl_transport_security.cc +238 -80
- data/src/core/tsi/ssl_transport_security.h +63 -33
- data/src/core/tsi/tls_telemetry.cc +31 -0
- data/src/core/tsi/tls_telemetry.h +47 -0
- data/src/core/tsi/transport_security.cc +2 -2
- data/src/core/tsi/transport_security.h +1 -1
- data/src/core/tsi/transport_security_interface.h +1 -1
- data/src/core/{resolver/dns/native/dns_resolver.h → util/address_sorting_init.cc} +21 -8
- data/src/core/{resolver/dns/c_ares/grpc_ares_wrapper_posix.cc → util/address_sorting_init.h} +7 -8
- data/src/core/util/http_client/httpcli.cc +16 -53
- data/src/core/util/http_client/httpcli.h +0 -7
- data/src/core/util/http_client/httpcli_security_connector.cc +13 -8
- data/src/core/util/linux/cpu.cc +1 -1
- data/src/core/util/load_file.cc +3 -9
- data/src/core/util/load_file.h +3 -4
- data/src/core/util/matchers.h +8 -0
- data/src/core/util/posix/cpu.cc +1 -1
- data/src/core/util/status_helper.cc +0 -20
- data/src/core/util/status_helper.h +3 -14
- data/src/core/xds/grpc/xds_audit_logger_registry.cc +51 -31
- data/src/core/xds/grpc/xds_audit_logger_registry.h +17 -3
- data/src/core/xds/grpc/xds_bootstrap_grpc.cc +2 -10
- data/src/core/xds/grpc/xds_bootstrap_grpc.h +8 -6
- data/src/core/xds/grpc/xds_bootstrap_grpc_builder.cc +488 -0
- data/src/core/xds/grpc/xds_bootstrap_grpc_builder.h +97 -0
- data/src/core/xds/grpc/xds_certificate_provider.cc +7 -7
- data/src/core/xds/grpc/xds_client_grpc.cc +4 -8
- data/src/core/xds/grpc/xds_client_grpc.h +0 -4
- data/src/core/xds/grpc/xds_cluster.h +1 -0
- data/src/core/xds/grpc/xds_cluster_parser.cc +1 -5
- data/src/core/xds/grpc/xds_cluster_parser.h +0 -2
- data/src/core/xds/grpc/xds_cluster_specifier_plugin.cc +0 -2
- data/src/core/xds/grpc/xds_cluster_specifier_plugin.h +0 -2
- data/src/core/xds/grpc/xds_common_types.cc +0 -91
- data/src/core/xds/grpc/xds_common_types.h +1 -47
- data/src/core/xds/grpc/xds_common_types_parser.cc +84 -378
- data/src/core/xds/grpc/xds_common_types_parser.h +9 -11
- data/src/core/xds/grpc/xds_endpoint_parser.cc +0 -2
- data/src/core/xds/grpc/xds_grpc_service_parser.cc +177 -0
- data/src/core/{resolver/dns/c_ares/dns_resolver_ares.h → xds/grpc/xds_grpc_service_parser.h} +14 -9
- data/src/core/xds/grpc/xds_http_composite_filter.cc +26 -21
- data/src/core/xds/grpc/xds_http_composite_filter.h +4 -3
- data/src/core/xds/grpc/xds_http_ext_proc_filter.cc +418 -0
- data/src/core/xds/grpc/xds_http_ext_proc_filter.h +89 -0
- data/src/core/xds/grpc/xds_http_fault_filter.cc +9 -12
- data/src/core/xds/grpc/xds_http_fault_filter.h +1 -4
- data/src/core/xds/grpc/xds_http_filter.cc +2 -1
- data/src/core/xds/grpc/xds_http_filter.h +6 -5
- data/src/core/xds/grpc/xds_http_filter_registry.cc +10 -127
- data/src/core/xds/grpc/xds_http_filter_registry.h +7 -59
- data/src/core/xds/grpc/xds_http_gcp_authn_filter.cc +13 -14
- data/src/core/xds/grpc/xds_http_gcp_authn_filter.h +3 -2
- data/src/core/xds/grpc/xds_http_rbac_filter.cc +403 -25
- data/src/core/xds/grpc/xds_http_rbac_filter.h +1 -3
- data/src/core/xds/grpc/xds_http_stateful_session_filter.cc +8 -13
- data/src/core/xds/grpc/xds_http_stateful_session_filter.h +1 -4
- data/src/core/xds/grpc/xds_lb_policy_registry.cc +0 -292
- data/src/core/xds/grpc/xds_lb_policy_registry.h +7 -3
- data/src/core/xds/grpc/xds_listener.cc +2 -0
- data/src/core/xds/grpc/xds_listener.h +5 -0
- data/src/core/xds/grpc/xds_listener_parser.cc +16 -11
- data/src/core/xds/grpc/xds_matcher_parse.h +3 -1
- data/src/core/xds/grpc/xds_metadata_parser.cc +6 -1
- data/src/core/xds/grpc/xds_metadata_parser.h +2 -0
- data/src/core/xds/grpc/xds_route_config.cc +2 -0
- data/src/core/xds/grpc/xds_route_config.h +3 -1
- data/src/core/xds/grpc/xds_route_config_parser.cc +13 -79
- data/src/core/xds/grpc/xds_route_config_parser.h +0 -3
- data/src/core/xds/grpc/xds_routing.cc +116 -69
- data/src/core/xds/grpc/xds_routing.h +19 -8
- data/src/core/xds/grpc/xds_tls_context.cc +117 -0
- data/src/core/xds/grpc/xds_tls_context.h +76 -0
- data/src/core/xds/grpc/xds_tls_context_parser.cc +275 -0
- data/src/core/xds/grpc/xds_tls_context_parser.h +35 -0
- data/src/core/xds/grpc/xds_transport_grpc.cc +41 -38
- data/src/core/xds/grpc/xds_transport_grpc.h +4 -2
- data/src/ruby/ext/grpc/rb_call.c +26 -15
- data/src/ruby/ext/grpc/rb_completion_queue.c +6 -5
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +2 -0
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +3 -0
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/src/ruby/pb/test/client.rb +5 -4
- data/src/ruby/spec/call_spec.rb +14 -0
- data/src/ruby/spec/generic/server_interceptors_spec.rb +3 -6
- metadata +50 -35
- data/src/core/ext/upbdefs-gen/src/proto/grpc/channelz/channelz.upbdefs.c +0 -716
- data/src/core/lib/iomgr/resolve_address.cc +0 -59
- data/src/core/lib/iomgr/resolve_address.h +0 -125
- data/src/core/lib/iomgr/resolve_address_impl.h +0 -58
- data/src/core/lib/iomgr/resolve_address_posix.cc +0 -184
- data/src/core/lib/iomgr/resolve_address_posix.h +0 -78
- data/src/core/lib/iomgr/resolve_address_windows.cc +0 -169
- data/src/core/lib/iomgr/resolve_address_windows.h +0 -76
- data/src/core/resolver/dns/c_ares/dns_resolver_ares.cc +0 -781
- data/src/core/resolver/dns/c_ares/grpc_ares_ev_driver.h +0 -93
- data/src/core/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc +0 -203
- data/src/core/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc +0 -838
- data/src/core/resolver/dns/c_ares/grpc_ares_wrapper.cc +0 -1237
- data/src/core/resolver/dns/c_ares/grpc_ares_wrapper.h +0 -130
- data/src/core/resolver/dns/c_ares/grpc_ares_wrapper_windows.cc +0 -35
- data/src/core/resolver/dns/dns_resolver_plugin.cc +0 -64
- data/src/core/resolver/dns/native/dns_resolver.cc +0 -173
- data/src/core/util/json/json_util.cc +0 -101
- data/src/core/util/json/json_util.h +0 -163
|
@@ -16,12 +16,8 @@
|
|
|
16
16
|
|
|
17
17
|
#include "src/core/xds/grpc/xds_common_types_parser.h"
|
|
18
18
|
|
|
19
|
-
#include <grpc/support/json.h>
|
|
20
|
-
#include <stddef.h>
|
|
21
|
-
#include <stdint.h>
|
|
22
|
-
|
|
23
19
|
#include <algorithm>
|
|
24
|
-
#include <
|
|
20
|
+
#include <memory>
|
|
25
21
|
#include <optional>
|
|
26
22
|
#include <string>
|
|
27
23
|
#include <utility>
|
|
@@ -29,9 +25,8 @@
|
|
|
29
25
|
#include "envoy/config/common/mutation_rules/v3/mutation_rules.upb.h"
|
|
30
26
|
#include "envoy/config/core/v3/address.upb.h"
|
|
31
27
|
#include "envoy/config/core/v3/base.upb.h"
|
|
32
|
-
#include "envoy/extensions/transport_sockets/tls/v3/common.upb.h"
|
|
33
|
-
#include "envoy/extensions/transport_sockets/tls/v3/tls.upb.h"
|
|
34
28
|
#include "envoy/type/matcher/v3/regex.upb.h"
|
|
29
|
+
#include "envoy/type/v3/range.upb.h"
|
|
35
30
|
#include "google/protobuf/any.upb.h"
|
|
36
31
|
#include "google/protobuf/struct.upb.h"
|
|
37
32
|
#include "google/protobuf/struct.upbdefs.h"
|
|
@@ -43,7 +38,6 @@
|
|
|
43
38
|
#include "src/core/util/json/json_reader.h"
|
|
44
39
|
#include "src/core/util/upb_utils.h"
|
|
45
40
|
#include "src/core/util/validation_errors.h"
|
|
46
|
-
#include "src/core/xds/grpc/xds_bootstrap_grpc.h"
|
|
47
41
|
#include "src/core/xds/grpc/xds_common_types.h"
|
|
48
42
|
#include "src/core/xds/xds_client/xds_client.h"
|
|
49
43
|
#include "upb/base/status.hpp"
|
|
@@ -56,8 +50,6 @@
|
|
|
56
50
|
#include "absl/strings/escaping.h"
|
|
57
51
|
#include "absl/strings/match.h"
|
|
58
52
|
#include "absl/strings/str_cat.h"
|
|
59
|
-
#include "absl/strings/str_format.h"
|
|
60
|
-
#include "absl/strings/str_join.h"
|
|
61
53
|
#include "absl/strings/string_view.h"
|
|
62
54
|
|
|
63
55
|
namespace grpc_core {
|
|
@@ -276,248 +268,98 @@ StringMatcher StringMatcherParse(
|
|
|
276
268
|
return StringMatcherParseInternal(proto_accessor, errors);
|
|
277
269
|
}
|
|
278
270
|
|
|
279
|
-
|
|
280
|
-
// CommonTlsContextParse()
|
|
281
|
-
//
|
|
282
|
-
|
|
283
|
-
namespace {
|
|
284
|
-
|
|
285
|
-
// CertificateProviderInstance is deprecated but we are still supporting it for
|
|
286
|
-
// backward compatibility reasons. Note that we still parse the data into the
|
|
287
|
-
// same CertificateProviderPluginInstance struct since the fields are the same.
|
|
288
|
-
// TODO(yashykt): Remove this once we stop supporting the old way of fetching
|
|
289
|
-
// certificate provider instances.
|
|
290
|
-
CommonTlsContext::CertificateProviderPluginInstance
|
|
291
|
-
CertificateProviderInstanceParse(
|
|
271
|
+
std::vector<StringMatcher> XdsListStringMatcherParse(
|
|
292
272
|
const XdsResourceType::DecodeContext& context,
|
|
293
|
-
const
|
|
294
|
-
certificate_provider_instance_proto,
|
|
273
|
+
const envoy_type_matcher_v3_ListStringMatcher* list_matcher,
|
|
295
274
|
ValidationErrors* errors) {
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
ValidationErrors::ScopedField field(errors, ".instance_name");
|
|
305
|
-
errors->AddError(
|
|
306
|
-
absl::StrCat("unrecognized certificate provider instance name: ",
|
|
307
|
-
cert_provider.instance_name));
|
|
308
|
-
}
|
|
309
|
-
cert_provider.certificate_name = UpbStringToStdString(
|
|
310
|
-
envoy_extensions_transport_sockets_tls_v3_CommonTlsContext_CertificateProviderInstance_certificate_name(
|
|
311
|
-
certificate_provider_instance_proto));
|
|
312
|
-
return cert_provider;
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
CommonTlsContext::CertificateProviderPluginInstance
|
|
316
|
-
CertificateProviderPluginInstanceParse(
|
|
317
|
-
const XdsResourceType::DecodeContext& context,
|
|
318
|
-
const envoy_extensions_transport_sockets_tls_v3_CertificateProviderPluginInstance*
|
|
319
|
-
certificate_provider_plugin_instance_proto,
|
|
320
|
-
ValidationErrors* errors) {
|
|
321
|
-
CommonTlsContext::CertificateProviderPluginInstance cert_provider;
|
|
322
|
-
cert_provider.instance_name = UpbStringToStdString(
|
|
323
|
-
envoy_extensions_transport_sockets_tls_v3_CertificateProviderPluginInstance_instance_name(
|
|
324
|
-
certificate_provider_plugin_instance_proto));
|
|
325
|
-
const auto& bootstrap =
|
|
326
|
-
DownCast<const GrpcXdsBootstrap&>(context.client->bootstrap());
|
|
327
|
-
if (bootstrap.certificate_providers().find(cert_provider.instance_name) ==
|
|
328
|
-
bootstrap.certificate_providers().end()) {
|
|
329
|
-
ValidationErrors::ScopedField field(errors, ".instance_name");
|
|
330
|
-
errors->AddError(
|
|
331
|
-
absl::StrCat("unrecognized certificate provider instance name: ",
|
|
332
|
-
cert_provider.instance_name));
|
|
333
|
-
}
|
|
334
|
-
cert_provider.certificate_name = UpbStringToStdString(
|
|
335
|
-
envoy_extensions_transport_sockets_tls_v3_CertificateProviderPluginInstance_certificate_name(
|
|
336
|
-
certificate_provider_plugin_instance_proto));
|
|
337
|
-
return cert_provider;
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
CommonTlsContext::CertificateValidationContext
|
|
341
|
-
CertificateValidationContextParse(
|
|
342
|
-
const XdsResourceType::DecodeContext& context,
|
|
343
|
-
const envoy_extensions_transport_sockets_tls_v3_CertificateValidationContext*
|
|
344
|
-
certificate_validation_context_proto,
|
|
345
|
-
ValidationErrors* errors) {
|
|
346
|
-
CommonTlsContext::CertificateValidationContext certificate_validation_context;
|
|
347
|
-
size_t len = 0;
|
|
348
|
-
auto* subject_alt_names_matchers =
|
|
349
|
-
envoy_extensions_transport_sockets_tls_v3_CertificateValidationContext_match_subject_alt_names(
|
|
350
|
-
certificate_validation_context_proto, &len);
|
|
351
|
-
for (size_t i = 0; i < len; ++i) {
|
|
352
|
-
ValidationErrors::ScopedField field(
|
|
353
|
-
errors, absl::StrCat(".match_subject_alt_names[", i, "]"));
|
|
354
|
-
auto string_matcher =
|
|
355
|
-
StringMatcherParse(context, subject_alt_names_matchers[i], errors);
|
|
356
|
-
certificate_validation_context.match_subject_alt_names.push_back(
|
|
357
|
-
std::move(string_matcher));
|
|
358
|
-
}
|
|
359
|
-
auto* ca_certificate_provider_instance =
|
|
360
|
-
envoy_extensions_transport_sockets_tls_v3_CertificateValidationContext_ca_certificate_provider_instance(
|
|
361
|
-
certificate_validation_context_proto);
|
|
362
|
-
if (ca_certificate_provider_instance != nullptr) {
|
|
275
|
+
if (list_matcher == nullptr) return {};
|
|
276
|
+
std::vector<StringMatcher> matchers;
|
|
277
|
+
size_t patterns_size = 0;
|
|
278
|
+
const envoy_type_matcher_v3_StringMatcher* const* patterns =
|
|
279
|
+
envoy_type_matcher_v3_ListStringMatcher_patterns(list_matcher,
|
|
280
|
+
&patterns_size);
|
|
281
|
+
matchers.reserve(patterns_size);
|
|
282
|
+
for (size_t i = 0; i < patterns_size; ++i) {
|
|
363
283
|
ValidationErrors::ScopedField field(errors,
|
|
364
|
-
".
|
|
365
|
-
|
|
366
|
-
CertificateProviderPluginInstanceParse(
|
|
367
|
-
context, ca_certificate_provider_instance, errors);
|
|
368
|
-
} else {
|
|
369
|
-
auto* system_root_certs =
|
|
370
|
-
envoy_extensions_transport_sockets_tls_v3_CertificateValidationContext_system_root_certs(
|
|
371
|
-
certificate_validation_context_proto);
|
|
372
|
-
if (system_root_certs != nullptr) {
|
|
373
|
-
certificate_validation_context.ca_certs =
|
|
374
|
-
CommonTlsContext::CertificateValidationContext::SystemRootCerts();
|
|
375
|
-
}
|
|
376
|
-
}
|
|
377
|
-
if (envoy_extensions_transport_sockets_tls_v3_CertificateValidationContext_verify_certificate_spki(
|
|
378
|
-
certificate_validation_context_proto, nullptr) != nullptr) {
|
|
379
|
-
ValidationErrors::ScopedField field(errors, ".verify_certificate_spki");
|
|
380
|
-
errors->AddError("feature unsupported");
|
|
381
|
-
}
|
|
382
|
-
if (envoy_extensions_transport_sockets_tls_v3_CertificateValidationContext_verify_certificate_hash(
|
|
383
|
-
certificate_validation_context_proto, nullptr) != nullptr) {
|
|
384
|
-
ValidationErrors::ScopedField field(errors, ".verify_certificate_hash");
|
|
385
|
-
errors->AddError("feature unsupported");
|
|
386
|
-
}
|
|
387
|
-
if (ParseBoolValue(
|
|
388
|
-
envoy_extensions_transport_sockets_tls_v3_CertificateValidationContext_require_signed_certificate_timestamp(
|
|
389
|
-
certificate_validation_context_proto))) {
|
|
390
|
-
ValidationErrors::ScopedField field(
|
|
391
|
-
errors, ".require_signed_certificate_timestamp");
|
|
392
|
-
errors->AddError("feature unsupported");
|
|
393
|
-
}
|
|
394
|
-
if (envoy_extensions_transport_sockets_tls_v3_CertificateValidationContext_has_crl(
|
|
395
|
-
certificate_validation_context_proto)) {
|
|
396
|
-
ValidationErrors::ScopedField field(errors, ".crl");
|
|
397
|
-
errors->AddError("feature unsupported");
|
|
284
|
+
absl::StrCat(".patterns[", i, "]"));
|
|
285
|
+
matchers.push_back(StringMatcherParse(context, patterns[i], errors));
|
|
398
286
|
}
|
|
399
|
-
|
|
400
|
-
certificate_validation_context_proto)) {
|
|
401
|
-
ValidationErrors::ScopedField field(errors, ".custom_validator_config");
|
|
402
|
-
errors->AddError("feature unsupported");
|
|
403
|
-
}
|
|
404
|
-
return certificate_validation_context;
|
|
287
|
+
return matchers;
|
|
405
288
|
}
|
|
406
289
|
|
|
407
|
-
|
|
290
|
+
//
|
|
291
|
+
// ParseXdsHeaderMatcher()
|
|
292
|
+
//
|
|
408
293
|
|
|
409
|
-
|
|
294
|
+
HeaderMatcher ParseXdsHeaderMatcher(
|
|
410
295
|
const XdsResourceType::DecodeContext& context,
|
|
411
|
-
const
|
|
412
|
-
common_tls_context_proto,
|
|
296
|
+
const envoy_config_route_v3_HeaderMatcher* matcher,
|
|
413
297
|
ValidationErrors* errors) {
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
} else if (
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
ValidationErrors::ScopedField field(
|
|
467
|
-
errors, ".validation_context_sds_secret_config");
|
|
468
|
-
errors->AddError("feature unsupported");
|
|
469
|
-
}
|
|
470
|
-
auto* tls_certificate_provider_instance =
|
|
471
|
-
envoy_extensions_transport_sockets_tls_v3_CommonTlsContext_tls_certificate_provider_instance(
|
|
472
|
-
common_tls_context_proto);
|
|
473
|
-
if (tls_certificate_provider_instance != nullptr) {
|
|
474
|
-
ValidationErrors::ScopedField field(errors,
|
|
475
|
-
".tls_certificate_provider_instance");
|
|
476
|
-
common_tls_context.tls_certificate_provider_instance =
|
|
477
|
-
CertificateProviderPluginInstanceParse(
|
|
478
|
-
context, tls_certificate_provider_instance, errors);
|
|
298
|
+
absl::string_view name =
|
|
299
|
+
UpbStringToAbsl(envoy_config_route_v3_HeaderMatcher_name(matcher));
|
|
300
|
+
const bool invert_match =
|
|
301
|
+
envoy_config_route_v3_HeaderMatcher_invert_match(matcher);
|
|
302
|
+
if (envoy_config_route_v3_HeaderMatcher_has_string_match(matcher)) {
|
|
303
|
+
ValidationErrors::ScopedField field(errors, ".string_match");
|
|
304
|
+
auto string_matcher = StringMatcherParse(
|
|
305
|
+
context, envoy_config_route_v3_HeaderMatcher_string_match(matcher),
|
|
306
|
+
errors);
|
|
307
|
+
return HeaderMatcher::CreateFromStringMatcher(
|
|
308
|
+
name, std::move(string_matcher), invert_match);
|
|
309
|
+
}
|
|
310
|
+
HeaderMatcher::Type type;
|
|
311
|
+
absl::string_view match_string;
|
|
312
|
+
int64_t range_start = 0;
|
|
313
|
+
int64_t range_end = 0;
|
|
314
|
+
bool present_match = false;
|
|
315
|
+
bool case_sensitive = true;
|
|
316
|
+
if (envoy_config_route_v3_HeaderMatcher_has_exact_match(matcher)) {
|
|
317
|
+
type = HeaderMatcher::Type::kExact;
|
|
318
|
+
match_string = UpbStringToAbsl(
|
|
319
|
+
envoy_config_route_v3_HeaderMatcher_exact_match(matcher));
|
|
320
|
+
} else if (envoy_config_route_v3_HeaderMatcher_has_prefix_match(matcher)) {
|
|
321
|
+
type = HeaderMatcher::Type::kPrefix;
|
|
322
|
+
match_string = UpbStringToAbsl(
|
|
323
|
+
envoy_config_route_v3_HeaderMatcher_prefix_match(matcher));
|
|
324
|
+
} else if (envoy_config_route_v3_HeaderMatcher_has_suffix_match(matcher)) {
|
|
325
|
+
type = HeaderMatcher::Type::kSuffix;
|
|
326
|
+
match_string = UpbStringToAbsl(
|
|
327
|
+
envoy_config_route_v3_HeaderMatcher_suffix_match(matcher));
|
|
328
|
+
} else if (envoy_config_route_v3_HeaderMatcher_has_contains_match(matcher)) {
|
|
329
|
+
type = HeaderMatcher::Type::kContains;
|
|
330
|
+
match_string = UpbStringToAbsl(
|
|
331
|
+
envoy_config_route_v3_HeaderMatcher_contains_match(matcher));
|
|
332
|
+
} else if (envoy_config_route_v3_HeaderMatcher_has_safe_regex_match(
|
|
333
|
+
matcher)) {
|
|
334
|
+
const envoy_type_matcher_v3_RegexMatcher* regex_matcher =
|
|
335
|
+
envoy_config_route_v3_HeaderMatcher_safe_regex_match(matcher);
|
|
336
|
+
GRPC_CHECK_NE(regex_matcher, nullptr);
|
|
337
|
+
type = HeaderMatcher::Type::kSafeRegex;
|
|
338
|
+
match_string = UpbStringToAbsl(
|
|
339
|
+
envoy_type_matcher_v3_RegexMatcher_regex(regex_matcher));
|
|
340
|
+
} else if (envoy_config_route_v3_HeaderMatcher_has_range_match(matcher)) {
|
|
341
|
+
type = HeaderMatcher::Type::kRange;
|
|
342
|
+
const envoy_type_v3_Int64Range* range_matcher =
|
|
343
|
+
envoy_config_route_v3_HeaderMatcher_range_match(matcher);
|
|
344
|
+
GRPC_CHECK_NE(range_matcher, nullptr);
|
|
345
|
+
range_start = envoy_type_v3_Int64Range_start(range_matcher);
|
|
346
|
+
range_end = envoy_type_v3_Int64Range_end(range_matcher);
|
|
347
|
+
} else if (envoy_config_route_v3_HeaderMatcher_has_present_match(matcher)) {
|
|
348
|
+
type = HeaderMatcher::Type::kPresent;
|
|
349
|
+
present_match = envoy_config_route_v3_HeaderMatcher_present_match(matcher);
|
|
479
350
|
} else {
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
context, tls_certificate_certificate_provider_instance, errors);
|
|
493
|
-
} else {
|
|
494
|
-
size_t size;
|
|
495
|
-
envoy_extensions_transport_sockets_tls_v3_CommonTlsContext_tls_certificates(
|
|
496
|
-
common_tls_context_proto, &size);
|
|
497
|
-
if (size != 0) {
|
|
498
|
-
ValidationErrors::ScopedField field(errors, ".tls_certificates");
|
|
499
|
-
errors->AddError("feature unsupported");
|
|
500
|
-
}
|
|
501
|
-
envoy_extensions_transport_sockets_tls_v3_CommonTlsContext_tls_certificate_sds_secret_configs(
|
|
502
|
-
common_tls_context_proto, &size);
|
|
503
|
-
if (size != 0) {
|
|
504
|
-
ValidationErrors::ScopedField field(
|
|
505
|
-
errors, ".tls_certificate_sds_secret_configs");
|
|
506
|
-
errors->AddError("feature unsupported");
|
|
507
|
-
}
|
|
508
|
-
}
|
|
509
|
-
}
|
|
510
|
-
if (envoy_extensions_transport_sockets_tls_v3_CommonTlsContext_has_tls_params(
|
|
511
|
-
common_tls_context_proto)) {
|
|
512
|
-
ValidationErrors::ScopedField field(errors, ".tls_params");
|
|
513
|
-
errors->AddError("feature unsupported");
|
|
514
|
-
}
|
|
515
|
-
if (envoy_extensions_transport_sockets_tls_v3_CommonTlsContext_has_custom_handshaker(
|
|
516
|
-
common_tls_context_proto)) {
|
|
517
|
-
ValidationErrors::ScopedField field(errors, ".custom_handshaker");
|
|
518
|
-
errors->AddError("feature unsupported");
|
|
519
|
-
}
|
|
520
|
-
return common_tls_context;
|
|
351
|
+
errors->AddError("invalid header matcher");
|
|
352
|
+
return HeaderMatcher();
|
|
353
|
+
}
|
|
354
|
+
absl::StatusOr<HeaderMatcher> header_matcher =
|
|
355
|
+
HeaderMatcher::Create(name, type, match_string, range_start, range_end,
|
|
356
|
+
present_match, invert_match, case_sensitive);
|
|
357
|
+
if (!header_matcher.ok()) {
|
|
358
|
+
errors->AddError(absl::StrCat("cannot create header matcher: ",
|
|
359
|
+
header_matcher.status().message()));
|
|
360
|
+
return HeaderMatcher();
|
|
361
|
+
}
|
|
362
|
+
return std::move(*header_matcher);
|
|
521
363
|
}
|
|
522
364
|
|
|
523
365
|
//
|
|
@@ -685,142 +527,6 @@ std::pair<std::string, std::string> ParseXdsHeader(
|
|
|
685
527
|
return {std::string(key), value.has_value() ? std::move(*value) : ""};
|
|
686
528
|
}
|
|
687
529
|
|
|
688
|
-
//
|
|
689
|
-
// ParseXdsGrpcService()
|
|
690
|
-
//
|
|
691
|
-
|
|
692
|
-
GrpcXdsServerTarget ParseXdsGrpcService(
|
|
693
|
-
const XdsResourceType::DecodeContext& context,
|
|
694
|
-
const envoy_config_core_v3_GrpcService* grpc_service,
|
|
695
|
-
ValidationErrors* errors) {
|
|
696
|
-
if (grpc_service == nullptr) {
|
|
697
|
-
errors->AddError("field not set");
|
|
698
|
-
return GrpcXdsServerTarget(/*server_uri=*/"",
|
|
699
|
-
/*channel_creds_config=*/nullptr,
|
|
700
|
-
/*call_creds_configs=*/{});
|
|
701
|
-
}
|
|
702
|
-
// timeout
|
|
703
|
-
Duration timeout = Duration::Zero();
|
|
704
|
-
if (auto* timeout_proto =
|
|
705
|
-
envoy_config_core_v3_GrpcService_timeout(grpc_service);
|
|
706
|
-
timeout_proto != nullptr) {
|
|
707
|
-
ValidationErrors::ScopedField field(errors, ".timeout");
|
|
708
|
-
timeout = ParseDuration(timeout_proto, errors);
|
|
709
|
-
if (timeout <= Duration::Zero()) {
|
|
710
|
-
errors->AddError("duration must be positive");
|
|
711
|
-
}
|
|
712
|
-
}
|
|
713
|
-
// initial_metadata
|
|
714
|
-
std::vector<std::pair<std::string, std::string>> initial_metadata;
|
|
715
|
-
size_t initial_metadata_size;
|
|
716
|
-
auto* initial_metadata_proto =
|
|
717
|
-
envoy_config_core_v3_GrpcService_initial_metadata(grpc_service,
|
|
718
|
-
&initial_metadata_size);
|
|
719
|
-
for (size_t i = 0; i < initial_metadata_size; ++i) {
|
|
720
|
-
ValidationErrors::ScopedField field(
|
|
721
|
-
errors, absl::StrCat(".initial_metadata[", i, "]"));
|
|
722
|
-
initial_metadata.push_back(
|
|
723
|
-
ParseXdsHeader(initial_metadata_proto[i], errors));
|
|
724
|
-
}
|
|
725
|
-
// google_grpc
|
|
726
|
-
ValidationErrors::ScopedField field(errors, ".google_grpc");
|
|
727
|
-
auto* google_grpc =
|
|
728
|
-
envoy_config_core_v3_GrpcService_google_grpc(grpc_service);
|
|
729
|
-
if (google_grpc == nullptr) {
|
|
730
|
-
errors->AddError("field not set");
|
|
731
|
-
return GrpcXdsServerTarget(/*server_uri=*/"",
|
|
732
|
-
/*channel_creds_config=*/nullptr,
|
|
733
|
-
/*call_creds_configs=*/{});
|
|
734
|
-
}
|
|
735
|
-
// target_uri
|
|
736
|
-
std::string target_uri = UpbStringToStdString(
|
|
737
|
-
envoy_config_core_v3_GrpcService_GoogleGrpc_target_uri(google_grpc));
|
|
738
|
-
if (!CoreConfiguration::Get().resolver_registry().IsValidTarget(target_uri)) {
|
|
739
|
-
ValidationErrors::ScopedField field(errors, ".target_uri");
|
|
740
|
-
errors->AddError("invalid target URI");
|
|
741
|
-
}
|
|
742
|
-
// credentials
|
|
743
|
-
RefCountedPtr<const ChannelCredsConfig> channel_creds_config;
|
|
744
|
-
std::vector<RefCountedPtr<const CallCredsConfig>> call_creds_configs;
|
|
745
|
-
if (DownCast<const GrpcXdsServer&>(context.server).TrustedXdsServer()) {
|
|
746
|
-
// Trusted xDS server. Use credentials from the GoogleGrpc proto.
|
|
747
|
-
// First, look at channel creds.
|
|
748
|
-
{
|
|
749
|
-
ValidationErrors::ScopedField field(errors,
|
|
750
|
-
".channel_credentials_plugin");
|
|
751
|
-
size_t size;
|
|
752
|
-
const auto* const* channel_creds_plugin =
|
|
753
|
-
envoy_config_core_v3_GrpcService_GoogleGrpc_channel_credentials_plugin(
|
|
754
|
-
google_grpc, &size);
|
|
755
|
-
if (size == 0) {
|
|
756
|
-
errors->AddError("field not set");
|
|
757
|
-
} else {
|
|
758
|
-
const auto& registry =
|
|
759
|
-
CoreConfiguration::Get().channel_creds_registry();
|
|
760
|
-
const auto& certificate_providers =
|
|
761
|
-
DownCast<const GrpcXdsBootstrap&>(context.client->bootstrap())
|
|
762
|
-
.certificate_providers();
|
|
763
|
-
for (size_t i = 0; i < size; ++i) {
|
|
764
|
-
ValidationErrors::ScopedField field(errors,
|
|
765
|
-
absl::StrCat("[", i, "]"));
|
|
766
|
-
absl::string_view type = UpbStringToAbsl(
|
|
767
|
-
google_protobuf_Any_type_url(channel_creds_plugin[i]));
|
|
768
|
-
if (!StripTypePrefix(type, errors)) continue;
|
|
769
|
-
if (!registry.IsProtoSupported(type)) continue;
|
|
770
|
-
ValidationErrors::ScopedField field2(errors, ".value");
|
|
771
|
-
absl::string_view serialized_config = UpbStringToAbsl(
|
|
772
|
-
google_protobuf_Any_value(channel_creds_plugin[i]));
|
|
773
|
-
channel_creds_config = registry.ParseProto(
|
|
774
|
-
type, serialized_config, certificate_providers, errors);
|
|
775
|
-
break;
|
|
776
|
-
}
|
|
777
|
-
if (channel_creds_config == nullptr) {
|
|
778
|
-
errors->AddError("no supported channel credentials type found");
|
|
779
|
-
}
|
|
780
|
-
}
|
|
781
|
-
}
|
|
782
|
-
// Now look at call creds.
|
|
783
|
-
{
|
|
784
|
-
ValidationErrors::ScopedField field(errors, ".call_credentials_plugin");
|
|
785
|
-
size_t size;
|
|
786
|
-
const auto* const* call_creds_plugin =
|
|
787
|
-
envoy_config_core_v3_GrpcService_GoogleGrpc_call_credentials_plugin(
|
|
788
|
-
google_grpc, &size);
|
|
789
|
-
const auto& registry = CoreConfiguration::Get().call_creds_registry();
|
|
790
|
-
for (size_t i = 0; i < size; ++i) {
|
|
791
|
-
ValidationErrors::ScopedField field(errors, absl::StrCat("[", i, "]"));
|
|
792
|
-
absl::string_view type =
|
|
793
|
-
UpbStringToAbsl(google_protobuf_Any_type_url(call_creds_plugin[i]));
|
|
794
|
-
if (!StripTypePrefix(type, errors)) continue;
|
|
795
|
-
if (!registry.IsProtoSupported(type)) continue;
|
|
796
|
-
ValidationErrors::ScopedField field2(errors, ".value");
|
|
797
|
-
absl::string_view serialized_config =
|
|
798
|
-
UpbStringToAbsl(google_protobuf_Any_value(call_creds_plugin[i]));
|
|
799
|
-
call_creds_configs.push_back(
|
|
800
|
-
registry.ParseProto(type, serialized_config, errors));
|
|
801
|
-
}
|
|
802
|
-
}
|
|
803
|
-
} else {
|
|
804
|
-
// Not a trusted xDS server. Do lookup in bootstrap.
|
|
805
|
-
const auto& bootstrap =
|
|
806
|
-
DownCast<const GrpcXdsBootstrap&>(context.client->bootstrap());
|
|
807
|
-
auto& allowed_grpc_services = bootstrap.allowed_grpc_services();
|
|
808
|
-
auto it = allowed_grpc_services.find(target_uri);
|
|
809
|
-
if (it == allowed_grpc_services.end()) {
|
|
810
|
-
ValidationErrors::ScopedField field(errors, ".target_uri");
|
|
811
|
-
errors->AddError(
|
|
812
|
-
"service not present in \"allowed_grpc_services\" "
|
|
813
|
-
"in bootstrap config");
|
|
814
|
-
} else {
|
|
815
|
-
channel_creds_config = it->second.channel_creds_config;
|
|
816
|
-
call_creds_configs = it->second.call_creds_configs;
|
|
817
|
-
}
|
|
818
|
-
}
|
|
819
|
-
return GrpcXdsServerTarget(target_uri, std::move(channel_creds_config),
|
|
820
|
-
std::move(call_creds_configs),
|
|
821
|
-
std::move(initial_metadata), timeout);
|
|
822
|
-
}
|
|
823
|
-
|
|
824
530
|
//
|
|
825
531
|
// ParseHeaderMutationRules()
|
|
826
532
|
//
|
|
@@ -22,8 +22,7 @@
|
|
|
22
22
|
|
|
23
23
|
#include "envoy/config/common/mutation_rules/v3/mutation_rules.upb.h"
|
|
24
24
|
#include "envoy/config/core/v3/base.upb.h"
|
|
25
|
-
#include "envoy/config/
|
|
26
|
-
#include "envoy/extensions/transport_sockets/tls/v3/tls.upb.h"
|
|
25
|
+
#include "envoy/config/route/v3/route_components.upb.h"
|
|
27
26
|
#include "envoy/type/matcher/v3/string.upb.h"
|
|
28
27
|
#include "envoy/type/v3/percent.upb.h"
|
|
29
28
|
#include "google/protobuf/any.upb.h"
|
|
@@ -31,11 +30,11 @@
|
|
|
31
30
|
#include "google/protobuf/struct.upb.h"
|
|
32
31
|
#include "google/protobuf/wrappers.upb.h"
|
|
33
32
|
#include "src/core/lib/iomgr/resolved_address.h"
|
|
33
|
+
#include "src/core/util/json/json.h"
|
|
34
34
|
#include "src/core/util/matchers.h"
|
|
35
35
|
#include "src/core/util/time.h"
|
|
36
36
|
#include "src/core/util/validation_errors.h"
|
|
37
37
|
#include "src/core/xds/grpc/xds_common_types.h"
|
|
38
|
-
#include "src/core/xds/grpc/xds_server_grpc.h"
|
|
39
38
|
#include "src/core/xds/xds_client/xds_resource_type.h"
|
|
40
39
|
#include "xds/type/matcher/v3/string.upb.h"
|
|
41
40
|
|
|
@@ -78,10 +77,14 @@ StringMatcher StringMatcherParse(
|
|
|
78
77
|
const xds_type_matcher_v3_StringMatcher* matcher_proto,
|
|
79
78
|
ValidationErrors* errors);
|
|
80
79
|
|
|
81
|
-
|
|
80
|
+
std::vector<StringMatcher> XdsListStringMatcherParse(
|
|
82
81
|
const XdsResourceType::DecodeContext& context,
|
|
83
|
-
const
|
|
84
|
-
|
|
82
|
+
const envoy_type_matcher_v3_ListStringMatcher* list_matcher,
|
|
83
|
+
ValidationErrors* errors);
|
|
84
|
+
|
|
85
|
+
HeaderMatcher ParseXdsHeaderMatcher(
|
|
86
|
+
const XdsResourceType::DecodeContext& context,
|
|
87
|
+
const envoy_config_route_v3_HeaderMatcher* matcher,
|
|
85
88
|
ValidationErrors* errors);
|
|
86
89
|
|
|
87
90
|
absl::StatusOr<Json> ParseProtobufStructToJson(
|
|
@@ -92,11 +95,6 @@ std::optional<XdsExtension> ExtractXdsExtension(
|
|
|
92
95
|
const XdsResourceType::DecodeContext& context,
|
|
93
96
|
const google_protobuf_Any* any, ValidationErrors* errors);
|
|
94
97
|
|
|
95
|
-
GrpcXdsServerTarget ParseXdsGrpcService(
|
|
96
|
-
const XdsResourceType::DecodeContext& context,
|
|
97
|
-
const envoy_config_core_v3_GrpcService* grpc_service,
|
|
98
|
-
ValidationErrors* errors);
|
|
99
|
-
|
|
100
98
|
HeaderMutationRules ParseHeaderMutationRules(
|
|
101
99
|
const envoy_config_common_mutation_rules_v3_HeaderMutationRules*
|
|
102
100
|
header_mutation_rules,
|
|
@@ -16,7 +16,6 @@
|
|
|
16
16
|
|
|
17
17
|
#include "src/core/xds/grpc/xds_endpoint_parser.h"
|
|
18
18
|
|
|
19
|
-
#include <grpc/support/port_platform.h>
|
|
20
19
|
#include <stdlib.h>
|
|
21
20
|
#include <string.h>
|
|
22
21
|
|
|
@@ -47,7 +46,6 @@
|
|
|
47
46
|
#include "src/core/util/json/json_object_loader.h"
|
|
48
47
|
#include "src/core/util/upb_utils.h"
|
|
49
48
|
#include "src/core/util/validation_errors.h"
|
|
50
|
-
#include "src/core/xds/grpc/xds_cluster_parser.h"
|
|
51
49
|
#include "src/core/xds/grpc/xds_common_types_parser.h"
|
|
52
50
|
#include "src/core/xds/grpc/xds_health_status.h"
|
|
53
51
|
#include "src/core/xds/grpc/xds_metadata_parser.h"
|