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
|
@@ -54,7 +54,6 @@
|
|
|
54
54
|
#include "src/core/util/json/json_writer.h"
|
|
55
55
|
#include "src/core/util/match.h"
|
|
56
56
|
#include "src/core/util/matchers.h"
|
|
57
|
-
#include "src/core/util/ref_counted_ptr.h"
|
|
58
57
|
#include "src/core/util/time.h"
|
|
59
58
|
#include "src/core/util/upb_utils.h"
|
|
60
59
|
#include "src/core/xds/grpc/xds_cluster_specifier_plugin.h"
|
|
@@ -71,8 +70,6 @@
|
|
|
71
70
|
#include "absl/status/status.h"
|
|
72
71
|
#include "absl/status/statusor.h"
|
|
73
72
|
#include "absl/strings/str_cat.h"
|
|
74
|
-
#include "absl/strings/str_format.h"
|
|
75
|
-
#include "absl/strings/str_join.h"
|
|
76
73
|
#include "absl/strings/str_split.h"
|
|
77
74
|
#include "absl/strings/string_view.h"
|
|
78
75
|
|
|
@@ -245,73 +242,8 @@ void RouteHeaderMatchersParse(const XdsResourceType::DecodeContext& context,
|
|
|
245
242
|
absl::StrCat(".headers[", i, "]"));
|
|
246
243
|
const envoy_config_route_v3_HeaderMatcher* header = headers[i];
|
|
247
244
|
GRPC_CHECK_NE(header, nullptr);
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
const bool invert_match =
|
|
251
|
-
envoy_config_route_v3_HeaderMatcher_invert_match(header);
|
|
252
|
-
if (envoy_config_route_v3_HeaderMatcher_has_string_match(header)) {
|
|
253
|
-
ValidationErrors::ScopedField field(errors, ".string_match");
|
|
254
|
-
auto string_matcher = StringMatcherParse(
|
|
255
|
-
context, envoy_config_route_v3_HeaderMatcher_string_match(header),
|
|
256
|
-
errors);
|
|
257
|
-
route->matchers.header_matchers.emplace_back(
|
|
258
|
-
HeaderMatcher::CreateFromStringMatcher(
|
|
259
|
-
name, std::move(string_matcher), invert_match));
|
|
260
|
-
continue;
|
|
261
|
-
}
|
|
262
|
-
HeaderMatcher::Type type;
|
|
263
|
-
std::string match_string;
|
|
264
|
-
int64_t range_start = 0;
|
|
265
|
-
int64_t range_end = 0;
|
|
266
|
-
bool present_match = false;
|
|
267
|
-
bool case_sensitive = true;
|
|
268
|
-
if (envoy_config_route_v3_HeaderMatcher_has_exact_match(header)) {
|
|
269
|
-
type = HeaderMatcher::Type::kExact;
|
|
270
|
-
match_string = UpbStringToStdString(
|
|
271
|
-
envoy_config_route_v3_HeaderMatcher_exact_match(header));
|
|
272
|
-
} else if (envoy_config_route_v3_HeaderMatcher_has_prefix_match(header)) {
|
|
273
|
-
type = HeaderMatcher::Type::kPrefix;
|
|
274
|
-
match_string = UpbStringToStdString(
|
|
275
|
-
envoy_config_route_v3_HeaderMatcher_prefix_match(header));
|
|
276
|
-
} else if (envoy_config_route_v3_HeaderMatcher_has_suffix_match(header)) {
|
|
277
|
-
type = HeaderMatcher::Type::kSuffix;
|
|
278
|
-
match_string = UpbStringToStdString(
|
|
279
|
-
envoy_config_route_v3_HeaderMatcher_suffix_match(header));
|
|
280
|
-
} else if (envoy_config_route_v3_HeaderMatcher_has_contains_match(header)) {
|
|
281
|
-
type = HeaderMatcher::Type::kContains;
|
|
282
|
-
match_string = UpbStringToStdString(
|
|
283
|
-
envoy_config_route_v3_HeaderMatcher_contains_match(header));
|
|
284
|
-
} else if (envoy_config_route_v3_HeaderMatcher_has_safe_regex_match(
|
|
285
|
-
header)) {
|
|
286
|
-
const envoy_type_matcher_v3_RegexMatcher* regex_matcher =
|
|
287
|
-
envoy_config_route_v3_HeaderMatcher_safe_regex_match(header);
|
|
288
|
-
GRPC_CHECK_NE(regex_matcher, nullptr);
|
|
289
|
-
type = HeaderMatcher::Type::kSafeRegex;
|
|
290
|
-
match_string = UpbStringToStdString(
|
|
291
|
-
envoy_type_matcher_v3_RegexMatcher_regex(regex_matcher));
|
|
292
|
-
} else if (envoy_config_route_v3_HeaderMatcher_has_range_match(header)) {
|
|
293
|
-
type = HeaderMatcher::Type::kRange;
|
|
294
|
-
const envoy_type_v3_Int64Range* range_matcher =
|
|
295
|
-
envoy_config_route_v3_HeaderMatcher_range_match(header);
|
|
296
|
-
GRPC_CHECK_NE(range_matcher, nullptr);
|
|
297
|
-
range_start = envoy_type_v3_Int64Range_start(range_matcher);
|
|
298
|
-
range_end = envoy_type_v3_Int64Range_end(range_matcher);
|
|
299
|
-
} else if (envoy_config_route_v3_HeaderMatcher_has_present_match(header)) {
|
|
300
|
-
type = HeaderMatcher::Type::kPresent;
|
|
301
|
-
present_match = envoy_config_route_v3_HeaderMatcher_present_match(header);
|
|
302
|
-
} else {
|
|
303
|
-
errors->AddError("invalid header matcher");
|
|
304
|
-
continue;
|
|
305
|
-
}
|
|
306
|
-
absl::StatusOr<HeaderMatcher> header_matcher =
|
|
307
|
-
HeaderMatcher::Create(name, type, match_string, range_start, range_end,
|
|
308
|
-
present_match, invert_match, case_sensitive);
|
|
309
|
-
if (!header_matcher.ok()) {
|
|
310
|
-
errors->AddError(absl::StrCat("cannot create header matcher: ",
|
|
311
|
-
header_matcher.status().message()));
|
|
312
|
-
} else {
|
|
313
|
-
route->matchers.header_matchers.emplace_back(std::move(*header_matcher));
|
|
314
|
-
}
|
|
245
|
+
route->matchers.header_matchers.emplace_back(
|
|
246
|
+
ParseXdsHeaderMatcher(context, header, errors));
|
|
315
247
|
}
|
|
316
248
|
}
|
|
317
249
|
|
|
@@ -369,6 +301,7 @@ XdsRouteConfigResource::TypedPerFilterConfig ParseTypedPerFilterConfig(
|
|
|
369
301
|
auto* extension_to_use = &*extension;
|
|
370
302
|
std::optional<XdsExtension> nested_extension;
|
|
371
303
|
bool is_optional = false;
|
|
304
|
+
bool disabled = false;
|
|
372
305
|
if (extension->type == "envoy.config.route.v3.FilterConfig") {
|
|
373
306
|
absl::string_view* serialized_config =
|
|
374
307
|
std::get_if<absl::string_view>(&extension->value);
|
|
@@ -382,9 +315,10 @@ XdsRouteConfigResource::TypedPerFilterConfig ParseTypedPerFilterConfig(
|
|
|
382
315
|
errors->AddError("could not parse FilterConfig");
|
|
383
316
|
continue;
|
|
384
317
|
}
|
|
318
|
+
disabled = envoy_config_route_v3_FilterConfig_disabled(filter_config);
|
|
319
|
+
any = envoy_config_route_v3_FilterConfig_config(filter_config);
|
|
385
320
|
is_optional =
|
|
386
321
|
envoy_config_route_v3_FilterConfig_is_optional(filter_config);
|
|
387
|
-
any = envoy_config_route_v3_FilterConfig_config(filter_config);
|
|
388
322
|
extension->validation_fields.emplace_back(errors, ".config");
|
|
389
323
|
nested_extension = ExtractXdsExtension(context, any, errors);
|
|
390
324
|
if (!nested_extension.has_value()) continue;
|
|
@@ -393,22 +327,22 @@ XdsRouteConfigResource::TypedPerFilterConfig ParseTypedPerFilterConfig(
|
|
|
393
327
|
const auto& http_filter_registry =
|
|
394
328
|
DownCast<const GrpcXdsBootstrap&>(context.client->bootstrap())
|
|
395
329
|
.http_filter_registry();
|
|
396
|
-
const
|
|
330
|
+
const XdsHttpFilterFactory* factory =
|
|
397
331
|
http_filter_registry.GetFilterForOverrideType(extension_to_use->type);
|
|
398
|
-
if (
|
|
332
|
+
if (factory == nullptr) {
|
|
399
333
|
if (!is_optional) errors->AddError("unsupported filter type");
|
|
400
334
|
continue;
|
|
401
335
|
}
|
|
402
336
|
auto& entry = typed_per_filter_config[std::string(key)];
|
|
403
|
-
entry.config_proto_type =
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
337
|
+
entry.config_proto_type = factory->OverrideConfigProtoName();
|
|
338
|
+
entry.disabled = disabled;
|
|
339
|
+
std::optional<Json> filter_config = factory->GenerateFilterConfigOverride(
|
|
340
|
+
key, context, *extension_to_use, errors);
|
|
407
341
|
if (filter_config.has_value()) {
|
|
408
342
|
entry.config = std::move(*filter_config);
|
|
409
343
|
}
|
|
410
|
-
entry.filter_config =
|
|
411
|
-
key, context, *extension_to_use, errors);
|
|
344
|
+
entry.filter_config =
|
|
345
|
+
factory->ParseOverrideConfig(key, context, *extension_to_use, errors);
|
|
412
346
|
}
|
|
413
347
|
return typed_per_filter_config;
|
|
414
348
|
}
|
|
@@ -29,13 +29,10 @@
|
|
|
29
29
|
|
|
30
30
|
#include "envoy/config/route/v3/route.upb.h"
|
|
31
31
|
#include "envoy/config/route/v3/route.upbdefs.h"
|
|
32
|
-
#include "re2/re2.h"
|
|
33
32
|
#include "src/core/call/status_util.h"
|
|
34
33
|
#include "src/core/util/down_cast.h"
|
|
35
|
-
#include "src/core/util/time.h"
|
|
36
34
|
#include "src/core/util/validation_errors.h"
|
|
37
35
|
#include "src/core/xds/grpc/xds_bootstrap_grpc.h"
|
|
38
|
-
#include "src/core/xds/grpc/xds_cluster_specifier_plugin.h"
|
|
39
36
|
#include "src/core/xds/grpc/xds_http_filter.h"
|
|
40
37
|
#include "src/core/xds/grpc/xds_route_config.h"
|
|
41
38
|
#include "src/core/xds/xds_client/xds_client.h"
|
|
@@ -18,7 +18,6 @@
|
|
|
18
18
|
|
|
19
19
|
#include "src/core/xds/grpc/xds_routing.h"
|
|
20
20
|
|
|
21
|
-
#include <grpc/support/port_platform.h>
|
|
22
21
|
#include <stdint.h>
|
|
23
22
|
#include <stdlib.h>
|
|
24
23
|
|
|
@@ -30,6 +29,8 @@
|
|
|
30
29
|
#include "src/core/util/grpc_check.h"
|
|
31
30
|
#include "src/core/util/matchers.h"
|
|
32
31
|
#include "src/core/xds/grpc/xds_http_filter.h"
|
|
32
|
+
#include "absl/functional/any_invocable.h"
|
|
33
|
+
#include "absl/functional/function_ref.h"
|
|
33
34
|
#include "absl/status/status.h"
|
|
34
35
|
#include "absl/status/statusor.h"
|
|
35
36
|
#include "absl/strings/match.h"
|
|
@@ -194,23 +195,22 @@ XdsRouting::RouteConfigFilterChainBuilder::RouteConfigFilterChainBuilder(
|
|
|
194
195
|
const std::vector<XdsListenerResource::HttpConnectionManager::HttpFilter>&
|
|
195
196
|
hcm_filter_configs,
|
|
196
197
|
const XdsHttpFilterRegistry& http_filter_registry,
|
|
197
|
-
|
|
198
|
-
absl::AnyInvocable<void(FilterChainBuilder&)> add_last_filter,
|
|
198
|
+
XdsFilterChainBuilder& builder, XdsTransportFactory& transport_factory,
|
|
199
199
|
Blackboard& blackboard)
|
|
200
200
|
: hcm_filter_configs_(hcm_filter_configs),
|
|
201
201
|
builder_(builder),
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
202
|
+
blackboard_(blackboard),
|
|
203
|
+
transport_factory_(transport_factory) {
|
|
204
|
+
factories_.reserve(hcm_filter_configs.size());
|
|
205
205
|
for (const auto& http_filter : hcm_filter_configs) {
|
|
206
206
|
// Find filter. This is guaranteed to succeed, because it's checked
|
|
207
207
|
// at config validation time.
|
|
208
|
-
const
|
|
208
|
+
const XdsHttpFilterFactory* factory =
|
|
209
209
|
http_filter_registry.GetFilterForTopLevelType(
|
|
210
210
|
http_filter.config_proto_type);
|
|
211
|
-
GRPC_CHECK_NE(
|
|
211
|
+
GRPC_CHECK_NE(factory, nullptr);
|
|
212
212
|
// Add filter to list.
|
|
213
|
-
|
|
213
|
+
factories_.push_back(factory);
|
|
214
214
|
}
|
|
215
215
|
}
|
|
216
216
|
|
|
@@ -218,20 +218,21 @@ absl::StatusOr<RefCountedPtr<const FilterChain>>
|
|
|
218
218
|
XdsRouting::RouteConfigFilterChainBuilder::GetDefaultFilterChain() {
|
|
219
219
|
if (default_filter_chain_.ok() && *default_filter_chain_ == nullptr) {
|
|
220
220
|
GRPC_TRACE_LOG(xds_resolver, INFO) << "Building default filter chain:";
|
|
221
|
-
for (size_t i = 0; i <
|
|
222
|
-
auto*
|
|
221
|
+
for (size_t i = 0; i < factories_.size(); ++i) {
|
|
222
|
+
auto* factory = factories_[i];
|
|
223
223
|
const auto& filter_config = hcm_filter_configs_[i];
|
|
224
|
+
if (filter_config.disabled) continue;
|
|
224
225
|
RefCountedPtr<const FilterConfig> config;
|
|
225
226
|
if (filter_config.filter_config != nullptr) {
|
|
226
|
-
config =
|
|
227
|
-
|
|
227
|
+
config =
|
|
228
|
+
factory->MergeConfigs(filter_config.filter_config, nullptr, nullptr,
|
|
229
|
+
nullptr, transport_factory_, blackboard_);
|
|
228
230
|
}
|
|
229
231
|
GRPC_TRACE_LOG(xds_resolver, INFO)
|
|
230
232
|
<< " Adding filter=" << filter_config.name
|
|
231
233
|
<< " config=" << (config == nullptr ? "<null>" : config->ToString());
|
|
232
|
-
|
|
234
|
+
builder_.AddFilter(factory, std::move(config));
|
|
233
235
|
}
|
|
234
|
-
if (add_last_filter_ != nullptr) add_last_filter_(builder_);
|
|
235
236
|
default_filter_chain_ = builder_.Build();
|
|
236
237
|
GRPC_TRACE_LOG(xds_resolver, INFO)
|
|
237
238
|
<< "Filter chain creation status: " << default_filter_chain_.status();
|
|
@@ -242,17 +243,55 @@ XdsRouting::RouteConfigFilterChainBuilder::GetDefaultFilterChain() {
|
|
|
242
243
|
namespace {
|
|
243
244
|
|
|
244
245
|
RefCountedPtr<const FilterConfig> GetOverrideConfig(
|
|
245
|
-
const
|
|
246
|
+
const XdsHttpFilterFactory* factory,
|
|
246
247
|
const XdsRouteConfigResource::TypedPerFilterConfig& typed_per_filter_config,
|
|
247
248
|
const std::string& name) {
|
|
248
249
|
auto it = typed_per_filter_config.find(name);
|
|
249
250
|
if (it == typed_per_filter_config.end()) return nullptr;
|
|
250
|
-
if (it->second.config_proto_type !=
|
|
251
|
+
if (it->second.config_proto_type != factory->OverrideConfigProtoName()) {
|
|
251
252
|
return nullptr;
|
|
252
253
|
}
|
|
253
254
|
return it->second.filter_config;
|
|
254
255
|
}
|
|
255
256
|
|
|
257
|
+
// Returns true if the filter is disabled.
|
|
258
|
+
// The resolution order for the disabled flag is:
|
|
259
|
+
// 1. ClusterWeight override (most specific)
|
|
260
|
+
// 2. Route override
|
|
261
|
+
// 3. VirtualHost override
|
|
262
|
+
// 4. HCM config (least specific, default)
|
|
263
|
+
bool IsFilterDisabled(
|
|
264
|
+
const XdsHttpFilterFactory* factory,
|
|
265
|
+
const XdsListenerResource::HttpConnectionManager::HttpFilter&
|
|
266
|
+
hcm_filter_config,
|
|
267
|
+
const XdsRouteConfigResource::TypedPerFilterConfig*
|
|
268
|
+
vhost_typed_per_filter_config,
|
|
269
|
+
const XdsRouteConfigResource::TypedPerFilterConfig*
|
|
270
|
+
route_typed_per_filter_config,
|
|
271
|
+
const XdsRouteConfigResource::TypedPerFilterConfig*
|
|
272
|
+
cluster_weight_typed_per_filter_config) {
|
|
273
|
+
if (cluster_weight_typed_per_filter_config != nullptr) {
|
|
274
|
+
auto it =
|
|
275
|
+
cluster_weight_typed_per_filter_config->find(hcm_filter_config.name);
|
|
276
|
+
if (it != cluster_weight_typed_per_filter_config->end()) {
|
|
277
|
+
return it->second.disabled;
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
if (route_typed_per_filter_config != nullptr) {
|
|
281
|
+
auto it = route_typed_per_filter_config->find(hcm_filter_config.name);
|
|
282
|
+
if (it != route_typed_per_filter_config->end()) {
|
|
283
|
+
return it->second.disabled;
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
if (vhost_typed_per_filter_config != nullptr) {
|
|
287
|
+
auto it = vhost_typed_per_filter_config->find(hcm_filter_config.name);
|
|
288
|
+
if (it != vhost_typed_per_filter_config->end()) {
|
|
289
|
+
return it->second.disabled;
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
return hcm_filter_config.disabled;
|
|
293
|
+
}
|
|
294
|
+
|
|
256
295
|
} // namespace
|
|
257
296
|
|
|
258
297
|
absl::StatusOr<RefCountedPtr<const FilterChain>>
|
|
@@ -264,24 +303,26 @@ XdsRouting::RouteConfigFilterChainBuilder::VirtualHostFilterChainBuilder::
|
|
|
264
303
|
return route_config_builder_.GetDefaultFilterChain();
|
|
265
304
|
}
|
|
266
305
|
GRPC_TRACE_LOG(xds_resolver, INFO) << "Building virtual host filter chain:";
|
|
267
|
-
for (size_t i = 0; i < route_config_builder_.
|
|
268
|
-
auto*
|
|
306
|
+
for (size_t i = 0; i < route_config_builder_.factories_.size(); ++i) {
|
|
307
|
+
auto* factory = route_config_builder_.factories_[i];
|
|
269
308
|
const auto& filter_config = route_config_builder_.hcm_filter_configs_[i];
|
|
309
|
+
if (IsFilterDisabled(factory, filter_config,
|
|
310
|
+
&vhost_.typed_per_filter_config, nullptr, nullptr)) {
|
|
311
|
+
continue;
|
|
312
|
+
}
|
|
270
313
|
RefCountedPtr<const FilterConfig> config;
|
|
271
314
|
if (filter_config.filter_config != nullptr) {
|
|
272
315
|
auto vhost_override_config = GetOverrideConfig(
|
|
273
|
-
|
|
274
|
-
config =
|
|
316
|
+
factory, vhost_.typed_per_filter_config, filter_config.name);
|
|
317
|
+
config = factory->MergeConfigs(
|
|
275
318
|
filter_config.filter_config, std::move(vhost_override_config),
|
|
276
|
-
nullptr, nullptr, route_config_builder_.
|
|
319
|
+
nullptr, nullptr, route_config_builder_.transport_factory_,
|
|
320
|
+
route_config_builder_.blackboard_);
|
|
277
321
|
}
|
|
278
322
|
GRPC_TRACE_LOG(xds_resolver, INFO)
|
|
279
323
|
<< " Adding filter=" << filter_config.name
|
|
280
324
|
<< " config=" << (config == nullptr ? "<null>" : config->ToString());
|
|
281
|
-
|
|
282
|
-
}
|
|
283
|
-
if (route_config_builder_.add_last_filter_ != nullptr) {
|
|
284
|
-
route_config_builder_.add_last_filter_(route_config_builder_.builder_);
|
|
325
|
+
route_config_builder_.builder_.AddFilter(factory, std::move(config));
|
|
285
326
|
}
|
|
286
327
|
vhost_filter_chain_ = route_config_builder_.builder_.Build();
|
|
287
328
|
GRPC_TRACE_LOG(xds_resolver, INFO)
|
|
@@ -298,27 +339,30 @@ XdsRouting::RouteConfigFilterChainBuilder::VirtualHostFilterChainBuilder::
|
|
|
298
339
|
// If there are no per-route overrides, use the vhost filter chain.
|
|
299
340
|
if (route.typed_per_filter_config.empty()) return GetVirtualHostFilterChain();
|
|
300
341
|
// Otherwise, build a new filter chain for the route.
|
|
301
|
-
for (size_t i = 0; i < route_config_builder_.
|
|
302
|
-
auto*
|
|
342
|
+
for (size_t i = 0; i < route_config_builder_.factories_.size(); ++i) {
|
|
343
|
+
auto* factory = route_config_builder_.factories_[i];
|
|
303
344
|
const auto& filter_config = route_config_builder_.hcm_filter_configs_[i];
|
|
345
|
+
if (IsFilterDisabled(factory, filter_config,
|
|
346
|
+
&vhost_.typed_per_filter_config,
|
|
347
|
+
&route.typed_per_filter_config, nullptr)) {
|
|
348
|
+
continue;
|
|
349
|
+
}
|
|
304
350
|
RefCountedPtr<const FilterConfig> config;
|
|
305
351
|
if (filter_config.filter_config != nullptr) {
|
|
306
352
|
auto vhost_override_config = GetOverrideConfig(
|
|
307
|
-
|
|
353
|
+
factory, vhost_.typed_per_filter_config, filter_config.name);
|
|
308
354
|
auto route_override_config = GetOverrideConfig(
|
|
309
|
-
|
|
310
|
-
config =
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
355
|
+
factory, route.typed_per_filter_config, filter_config.name);
|
|
356
|
+
config = factory->MergeConfigs(filter_config.filter_config,
|
|
357
|
+
std::move(vhost_override_config),
|
|
358
|
+
std::move(route_override_config), nullptr,
|
|
359
|
+
route_config_builder_.transport_factory_,
|
|
360
|
+
route_config_builder_.blackboard_);
|
|
314
361
|
}
|
|
315
362
|
GRPC_TRACE_LOG(xds_resolver, INFO)
|
|
316
363
|
<< " Adding filter=" << filter_config.name
|
|
317
364
|
<< " config=" << (config == nullptr ? "<null>" : config->ToString());
|
|
318
|
-
|
|
319
|
-
}
|
|
320
|
-
if (route_config_builder_.add_last_filter_ != nullptr) {
|
|
321
|
-
route_config_builder_.add_last_filter_(route_config_builder_.builder_);
|
|
365
|
+
route_config_builder_.builder_.AddFilter(factory, std::move(config));
|
|
322
366
|
}
|
|
323
367
|
absl::StatusOr<RefCountedPtr<const FilterChain>> route_filter_chain =
|
|
324
368
|
route_config_builder_.builder_.Build();
|
|
@@ -350,32 +394,35 @@ XdsRouting::RouteConfigFilterChainBuilder::VirtualHostFilterChainBuilder::
|
|
|
350
394
|
}
|
|
351
395
|
// Otherwise, build a new filter chain for the ClusterWeight.
|
|
352
396
|
auto& route_config_builder = vhost_builder_.route_config_builder_;
|
|
353
|
-
for (size_t i = 0; i < route_config_builder.
|
|
354
|
-
auto*
|
|
397
|
+
for (size_t i = 0; i < route_config_builder.factories_.size(); ++i) {
|
|
398
|
+
auto* factory = route_config_builder.factories_[i];
|
|
355
399
|
const auto& filter_config = route_config_builder.hcm_filter_configs_[i];
|
|
400
|
+
if (IsFilterDisabled(factory, filter_config,
|
|
401
|
+
&vhost_builder_.vhost_.typed_per_filter_config,
|
|
402
|
+
&route_.typed_per_filter_config,
|
|
403
|
+
&cluster_weight.typed_per_filter_config)) {
|
|
404
|
+
continue;
|
|
405
|
+
}
|
|
356
406
|
RefCountedPtr<const FilterConfig> config;
|
|
357
407
|
if (filter_config.filter_config != nullptr) {
|
|
358
408
|
auto vhost_override_config = GetOverrideConfig(
|
|
359
|
-
|
|
409
|
+
factory, vhost_builder_.vhost_.typed_per_filter_config,
|
|
360
410
|
filter_config.name);
|
|
361
411
|
auto route_override_config = GetOverrideConfig(
|
|
362
|
-
|
|
363
|
-
auto cluster_weight_override_config =
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
412
|
+
factory, route_.typed_per_filter_config, filter_config.name);
|
|
413
|
+
auto cluster_weight_override_config = GetOverrideConfig(
|
|
414
|
+
factory, cluster_weight.typed_per_filter_config, filter_config.name);
|
|
415
|
+
config = factory->MergeConfigs(filter_config.filter_config,
|
|
416
|
+
std::move(vhost_override_config),
|
|
417
|
+
std::move(route_override_config),
|
|
418
|
+
std::move(cluster_weight_override_config),
|
|
419
|
+
route_config_builder.transport_factory_,
|
|
420
|
+
route_config_builder.blackboard_);
|
|
371
421
|
}
|
|
372
422
|
GRPC_TRACE_LOG(xds_resolver, INFO)
|
|
373
423
|
<< " Adding filter=" << filter_config.name
|
|
374
424
|
<< " config=" << (config == nullptr ? "<null>" : config->ToString());
|
|
375
|
-
|
|
376
|
-
}
|
|
377
|
-
if (route_config_builder.add_last_filter_ != nullptr) {
|
|
378
|
-
route_config_builder.add_last_filter_(route_config_builder.builder_);
|
|
425
|
+
route_config_builder.builder_.AddFilter(factory, std::move(config));
|
|
379
426
|
}
|
|
380
427
|
auto filter_chain = route_config_builder.builder_.Build();
|
|
381
428
|
GRPC_TRACE_LOG(xds_resolver, INFO)
|
|
@@ -412,28 +459,28 @@ GeneratePerHTTPFilterConfigs(
|
|
|
412
459
|
const std::vector<XdsListenerResource::HttpConnectionManager::HttpFilter>&
|
|
413
460
|
http_filters,
|
|
414
461
|
const ChannelArgs& args,
|
|
415
|
-
absl::FunctionRef<
|
|
416
|
-
|
|
417
|
-
|
|
462
|
+
absl::FunctionRef<
|
|
463
|
+
absl::StatusOr<XdsHttpFilterFactory::ServiceConfigJsonEntry>(
|
|
464
|
+
const XdsHttpFilterFactory&,
|
|
465
|
+
const XdsListenerResource::HttpConnectionManager::HttpFilter&)>
|
|
418
466
|
generate_service_config) {
|
|
419
467
|
XdsRouting::GeneratePerHttpFilterConfigsResult result;
|
|
420
468
|
result.args = args;
|
|
421
469
|
for (const auto& http_filter : http_filters) {
|
|
422
470
|
// Find filter. This is guaranteed to succeed, because it's checked
|
|
423
471
|
// at config validation time in the listener parsing code.
|
|
424
|
-
const
|
|
472
|
+
const XdsHttpFilterFactory* factory =
|
|
425
473
|
http_filter_registry.GetFilterForTopLevelType(
|
|
426
474
|
http_filter.config_proto_type);
|
|
427
|
-
GRPC_CHECK_NE(
|
|
475
|
+
GRPC_CHECK_NE(factory, nullptr);
|
|
428
476
|
// If there is not actually any C-core filter associated with this
|
|
429
477
|
// xDS filter, then it won't need any config, so skip it.
|
|
430
|
-
if (
|
|
478
|
+
if (factory->channel_filter() == nullptr) continue;
|
|
431
479
|
// Allow filter to add channel args that may affect service config
|
|
432
480
|
// parsing.
|
|
433
|
-
result.args =
|
|
481
|
+
result.args = factory->ModifyChannelArgs(result.args);
|
|
434
482
|
// Generate service config for filter.
|
|
435
|
-
auto service_config_field =
|
|
436
|
-
generate_service_config(*filter_impl, http_filter);
|
|
483
|
+
auto service_config_field = generate_service_config(*factory, http_filter);
|
|
437
484
|
if (!service_config_field.ok()) {
|
|
438
485
|
return absl::FailedPreconditionError(absl::StrCat(
|
|
439
486
|
"failed to generate service config for HTTP filter ",
|
|
@@ -460,7 +507,7 @@ XdsRouting::GeneratePerHTTPFilterConfigsForMethodConfig(
|
|
|
460
507
|
const ChannelArgs& args) {
|
|
461
508
|
return GeneratePerHTTPFilterConfigs(
|
|
462
509
|
http_filter_registry, http_filters, args,
|
|
463
|
-
[&](const
|
|
510
|
+
[&](const XdsHttpFilterFactory& factory,
|
|
464
511
|
const XdsListenerResource::HttpConnectionManager::HttpFilter&
|
|
465
512
|
http_filter) {
|
|
466
513
|
// Find override config, if any.
|
|
@@ -470,12 +517,12 @@ XdsRouting::GeneratePerHTTPFilterConfigsForMethodConfig(
|
|
|
470
517
|
const Json* config_override = nullptr;
|
|
471
518
|
if (filter_config_override != nullptr &&
|
|
472
519
|
filter_config_override->config_proto_type ==
|
|
473
|
-
|
|
520
|
+
factory.OverrideConfigProtoName()) {
|
|
474
521
|
config_override = &filter_config_override->config;
|
|
475
522
|
}
|
|
476
523
|
// Generate service config for filter.
|
|
477
|
-
return
|
|
478
|
-
|
|
524
|
+
return factory.GenerateMethodConfig(http_filter.config,
|
|
525
|
+
config_override);
|
|
479
526
|
});
|
|
480
527
|
}
|
|
481
528
|
|
|
@@ -487,10 +534,10 @@ XdsRouting::GeneratePerHTTPFilterConfigsForServiceConfig(
|
|
|
487
534
|
const ChannelArgs& args) {
|
|
488
535
|
return GeneratePerHTTPFilterConfigs(
|
|
489
536
|
http_filter_registry, http_filters, args,
|
|
490
|
-
[&](const
|
|
537
|
+
[&](const XdsHttpFilterFactory& factory,
|
|
491
538
|
const XdsListenerResource::HttpConnectionManager::HttpFilter&
|
|
492
539
|
http_filter) {
|
|
493
|
-
return
|
|
540
|
+
return factory.GenerateServiceConfig(http_filter.config);
|
|
494
541
|
});
|
|
495
542
|
}
|
|
496
543
|
|
|
@@ -19,7 +19,6 @@
|
|
|
19
19
|
#ifndef GRPC_SRC_CORE_XDS_GRPC_XDS_ROUTING_H
|
|
20
20
|
#define GRPC_SRC_CORE_XDS_GRPC_XDS_ROUTING_H
|
|
21
21
|
|
|
22
|
-
#include <grpc/support/port_platform.h>
|
|
23
22
|
#include <stddef.h>
|
|
24
23
|
|
|
25
24
|
#include <map>
|
|
@@ -32,6 +31,7 @@
|
|
|
32
31
|
#include "src/core/xds/grpc/xds_http_filter_registry.h"
|
|
33
32
|
#include "src/core/xds/grpc/xds_listener.h"
|
|
34
33
|
#include "src/core/xds/grpc/xds_route_config.h"
|
|
34
|
+
#include "absl/functional/any_invocable.h"
|
|
35
35
|
#include "absl/status/statusor.h"
|
|
36
36
|
#include "absl/strings/string_view.h"
|
|
37
37
|
|
|
@@ -90,6 +90,18 @@ class XdsRouting final {
|
|
|
90
90
|
// can be used on both the client and server side.
|
|
91
91
|
class RouteConfigFilterChainBuilder {
|
|
92
92
|
public:
|
|
93
|
+
// A slightly different interface than the normal FilterChainBuilder
|
|
94
|
+
// that passes in the XdsHttpFilterFactory.
|
|
95
|
+
class XdsFilterChainBuilder {
|
|
96
|
+
public:
|
|
97
|
+
virtual ~XdsFilterChainBuilder() = default;
|
|
98
|
+
|
|
99
|
+
virtual void AddFilter(const XdsHttpFilterFactory* factory,
|
|
100
|
+
RefCountedPtr<const FilterConfig> config) = 0;
|
|
101
|
+
|
|
102
|
+
virtual absl::StatusOr<RefCountedPtr<FilterChain>> Build() = 0;
|
|
103
|
+
};
|
|
104
|
+
|
|
93
105
|
// Builds filter chains for each route within a VirtualHost.
|
|
94
106
|
class VirtualHostFilterChainBuilder {
|
|
95
107
|
public:
|
|
@@ -158,8 +170,7 @@ class XdsRouting final {
|
|
|
158
170
|
XdsListenerResource::HttpConnectionManager::HttpFilter>&
|
|
159
171
|
hcm_filter_configs,
|
|
160
172
|
const XdsHttpFilterRegistry& http_filter_registry,
|
|
161
|
-
|
|
162
|
-
absl::AnyInvocable<void(FilterChainBuilder&)> add_last_filter,
|
|
173
|
+
XdsFilterChainBuilder& builder, XdsTransportFactory& transport_factory,
|
|
163
174
|
Blackboard& blackboard);
|
|
164
175
|
|
|
165
176
|
// Returns a filter chain builder for a given virtual host.
|
|
@@ -173,12 +184,12 @@ class XdsRouting final {
|
|
|
173
184
|
|
|
174
185
|
const std::vector<XdsListenerResource::HttpConnectionManager::HttpFilter>&
|
|
175
186
|
hcm_filter_configs_;
|
|
176
|
-
|
|
177
|
-
absl::AnyInvocable<void(FilterChainBuilder&)> add_last_filter_;
|
|
187
|
+
XdsFilterChainBuilder& builder_;
|
|
178
188
|
Blackboard& blackboard_;
|
|
189
|
+
XdsTransportFactory& transport_factory_;
|
|
179
190
|
|
|
180
191
|
// Same size as hcm_filter_configs_.
|
|
181
|
-
std::vector<const
|
|
192
|
+
std::vector<const XdsHttpFilterFactory*> factories_;
|
|
182
193
|
|
|
183
194
|
// Cached default filter chain, to be used for any route that does
|
|
184
195
|
// not have any filter config overrides.
|
|
@@ -186,12 +197,13 @@ class XdsRouting final {
|
|
|
186
197
|
nullptr;
|
|
187
198
|
};
|
|
188
199
|
|
|
200
|
+
// TODO(roth): Remove this struct and the following two methods when
|
|
201
|
+
// removing the xds_server_filter_chain_per_route experiment.
|
|
189
202
|
struct GeneratePerHttpFilterConfigsResult {
|
|
190
203
|
// Map of service config field name to list of elements for that field.
|
|
191
204
|
std::map<std::string, std::vector<std::string>> per_filter_configs;
|
|
192
205
|
ChannelArgs args;
|
|
193
206
|
};
|
|
194
|
-
|
|
195
207
|
// Generates per-HTTP filter configs for a method config.
|
|
196
208
|
static absl::StatusOr<GeneratePerHttpFilterConfigsResult>
|
|
197
209
|
GeneratePerHTTPFilterConfigsForMethodConfig(
|
|
@@ -203,7 +215,6 @@ class XdsRouting final {
|
|
|
203
215
|
const XdsRouteConfigResource::Route::RouteAction::ClusterWeight*
|
|
204
216
|
cluster_weight,
|
|
205
217
|
const ChannelArgs& args);
|
|
206
|
-
|
|
207
218
|
// Generates per-HTTP filter configs for the top-level service config.
|
|
208
219
|
static absl::StatusOr<GeneratePerHttpFilterConfigsResult>
|
|
209
220
|
GeneratePerHTTPFilterConfigsForServiceConfig(
|