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
|
@@ -0,0 +1,418 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 gRPC authors.
|
|
3
|
+
//
|
|
4
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
// you may not use this file except in compliance with the License.
|
|
6
|
+
// You may obtain a copy of the License at
|
|
7
|
+
//
|
|
8
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
//
|
|
10
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
// See the License for the specific language governing permissions and
|
|
14
|
+
// limitations under the License.
|
|
15
|
+
//
|
|
16
|
+
|
|
17
|
+
#include "src/core/xds/grpc/xds_http_ext_proc_filter.h"
|
|
18
|
+
|
|
19
|
+
#include <cstddef>
|
|
20
|
+
#include <memory>
|
|
21
|
+
#include <optional>
|
|
22
|
+
#include <string>
|
|
23
|
+
#include <utility>
|
|
24
|
+
#include <vector>
|
|
25
|
+
|
|
26
|
+
#include "envoy/extensions/filters/http/ext_proc/v3/ext_proc.upb.h"
|
|
27
|
+
#include "envoy/extensions/filters/http/ext_proc/v3/ext_proc.upbdefs.h"
|
|
28
|
+
#include "envoy/extensions/filters/http/ext_proc/v3/processing_mode.upb.h"
|
|
29
|
+
#include "envoy/extensions/filters/http/ext_proc/v3/processing_mode.upbdefs.h"
|
|
30
|
+
#include "re2/re2.h"
|
|
31
|
+
#include "src/core/filter/ext_proc/ext_proc_filter.h"
|
|
32
|
+
#include "src/core/filter/filter_args.h"
|
|
33
|
+
#include "src/core/util/down_cast.h"
|
|
34
|
+
#include "src/core/util/grpc_check.h"
|
|
35
|
+
#include "src/core/util/ref_counted_ptr.h"
|
|
36
|
+
#include "src/core/util/validation_errors.h"
|
|
37
|
+
#include "src/core/xds/grpc/xds_common_types.h"
|
|
38
|
+
#include "src/core/xds/grpc/xds_common_types_parser.h"
|
|
39
|
+
#include "src/core/xds/grpc/xds_grpc_service_parser.h"
|
|
40
|
+
#include "src/core/xds/grpc/xds_server_grpc.h"
|
|
41
|
+
#include "src/core/xds/xds_client/xds_resource_type.h"
|
|
42
|
+
#include "absl/strings/str_cat.h"
|
|
43
|
+
#include "absl/strings/string_view.h"
|
|
44
|
+
|
|
45
|
+
namespace grpc_core {
|
|
46
|
+
|
|
47
|
+
absl::string_view XdsHttpExtProcFilterFactory::ConfigProtoName() const {
|
|
48
|
+
return "envoy.extensions.filters.http.ext_proc.v3.ExternalProcessor";
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
absl::string_view XdsHttpExtProcFilterFactory::OverrideConfigProtoName() const {
|
|
52
|
+
return "envoy.extensions.filters.http.ext_proc.v3.ExtProcPerRoute";
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
void XdsHttpExtProcFilterFactory::PopulateSymtab(upb_DefPool* symtab) const {
|
|
56
|
+
envoy_extensions_filters_http_ext_proc_v3_ExternalProcessor_getmsgdef(symtab);
|
|
57
|
+
envoy_extensions_filters_http_ext_proc_v3_ExtProcPerRoute_getmsgdef(symtab);
|
|
58
|
+
envoy_extensions_filters_http_ext_proc_v3_ProcessingMode_getmsgdef(symtab);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
void XdsHttpExtProcFilterFactory::AddFilter(
|
|
62
|
+
FilterChainBuilder& builder,
|
|
63
|
+
RefCountedPtr<const FilterConfig> config) const {
|
|
64
|
+
builder.AddFilter<ExtProcFilter>(std::move(config));
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const grpc_channel_filter* XdsHttpExtProcFilterFactory::channel_filter() const {
|
|
68
|
+
return &ExtProcFilter::kFilterVtable;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
namespace {
|
|
72
|
+
|
|
73
|
+
bool ParseHeaderProcessingMode(int32_t value, ValidationErrors* errors) {
|
|
74
|
+
switch (value) {
|
|
75
|
+
case envoy_extensions_filters_http_ext_proc_v3_ProcessingMode_SEND:
|
|
76
|
+
return true;
|
|
77
|
+
case envoy_extensions_filters_http_ext_proc_v3_ProcessingMode_SKIP:
|
|
78
|
+
return false;
|
|
79
|
+
default:
|
|
80
|
+
errors->AddError(
|
|
81
|
+
absl::StrCat("unsupported header processing mode value: ", value));
|
|
82
|
+
return false;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
bool ParseBodyProcessingMode(int32_t value, ValidationErrors* errors) {
|
|
87
|
+
switch (value) {
|
|
88
|
+
case envoy_extensions_filters_http_ext_proc_v3_ProcessingMode_GRPC:
|
|
89
|
+
return true;
|
|
90
|
+
default:
|
|
91
|
+
errors->AddError(
|
|
92
|
+
absl::StrCat("unsupported body processing mode value: ", value));
|
|
93
|
+
[[fallthrough]];
|
|
94
|
+
case envoy_extensions_filters_http_ext_proc_v3_ProcessingMode_NONE:
|
|
95
|
+
return false;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
ExtProcFilter::ProcessingMode ParseProcessingMode(
|
|
100
|
+
const envoy_extensions_filters_http_ext_proc_v3_ProcessingMode* proto,
|
|
101
|
+
ValidationErrors* errors) {
|
|
102
|
+
ExtProcFilter::ProcessingMode processing_mode;
|
|
103
|
+
if (proto == nullptr) {
|
|
104
|
+
errors->AddError("field not set");
|
|
105
|
+
return processing_mode;
|
|
106
|
+
}
|
|
107
|
+
{
|
|
108
|
+
ValidationErrors::ScopedField field(errors, ".request_header_mode");
|
|
109
|
+
processing_mode.send_request_headers = ParseHeaderProcessingMode(
|
|
110
|
+
envoy_extensions_filters_http_ext_proc_v3_ProcessingMode_request_header_mode(
|
|
111
|
+
proto),
|
|
112
|
+
errors);
|
|
113
|
+
}
|
|
114
|
+
{
|
|
115
|
+
ValidationErrors::ScopedField field(errors, ".response_header_mode");
|
|
116
|
+
processing_mode.send_response_headers = ParseHeaderProcessingMode(
|
|
117
|
+
envoy_extensions_filters_http_ext_proc_v3_ProcessingMode_response_header_mode(
|
|
118
|
+
proto),
|
|
119
|
+
errors);
|
|
120
|
+
}
|
|
121
|
+
{
|
|
122
|
+
ValidationErrors::ScopedField field(errors, ".response_trailer_mode");
|
|
123
|
+
processing_mode.send_response_trailers = ParseHeaderProcessingMode(
|
|
124
|
+
envoy_extensions_filters_http_ext_proc_v3_ProcessingMode_response_trailer_mode(
|
|
125
|
+
proto),
|
|
126
|
+
errors);
|
|
127
|
+
}
|
|
128
|
+
{
|
|
129
|
+
ValidationErrors::ScopedField field(errors, ".request_body_mode");
|
|
130
|
+
processing_mode.send_request_body = ParseBodyProcessingMode(
|
|
131
|
+
envoy_extensions_filters_http_ext_proc_v3_ProcessingMode_request_body_mode(
|
|
132
|
+
proto),
|
|
133
|
+
errors);
|
|
134
|
+
}
|
|
135
|
+
{
|
|
136
|
+
ValidationErrors::ScopedField field(errors, ".response_body_mode");
|
|
137
|
+
processing_mode.send_response_body = ParseBodyProcessingMode(
|
|
138
|
+
envoy_extensions_filters_http_ext_proc_v3_ProcessingMode_response_body_mode(
|
|
139
|
+
proto),
|
|
140
|
+
errors);
|
|
141
|
+
}
|
|
142
|
+
if (processing_mode.send_response_body &&
|
|
143
|
+
!processing_mode.send_response_trailers) {
|
|
144
|
+
ValidationErrors::ScopedField field(errors, ".response_trailer_mode");
|
|
145
|
+
errors->AddError(
|
|
146
|
+
"must be set to SEND if response_body_mode is set to GRPC");
|
|
147
|
+
}
|
|
148
|
+
return processing_mode;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
} // namespace
|
|
152
|
+
|
|
153
|
+
RefCountedPtr<const FilterConfig>
|
|
154
|
+
XdsHttpExtProcFilterFactory::ParseTopLevelConfig(
|
|
155
|
+
absl::string_view /*instance_name*/,
|
|
156
|
+
const XdsResourceType::DecodeContext& context,
|
|
157
|
+
const XdsExtension& extension, ValidationErrors* errors) const {
|
|
158
|
+
const absl::string_view* serialized_filter_config =
|
|
159
|
+
std::get_if<absl::string_view>(&extension.value);
|
|
160
|
+
if (serialized_filter_config == nullptr) {
|
|
161
|
+
errors->AddError("could not parse ext_proc filter config");
|
|
162
|
+
return nullptr;
|
|
163
|
+
}
|
|
164
|
+
auto* ext_proc =
|
|
165
|
+
envoy_extensions_filters_http_ext_proc_v3_ExternalProcessor_parse(
|
|
166
|
+
serialized_filter_config->data(), serialized_filter_config->size(),
|
|
167
|
+
context.arena);
|
|
168
|
+
if (ext_proc == nullptr) {
|
|
169
|
+
errors->AddError("could not parse ext_proc filter config");
|
|
170
|
+
return nullptr;
|
|
171
|
+
}
|
|
172
|
+
auto config = MakeRefCounted<ExtProcFilter::Config>();
|
|
173
|
+
// grpc_service
|
|
174
|
+
{
|
|
175
|
+
ValidationErrors::ScopedField field(errors, ".grpc_service");
|
|
176
|
+
config->channel_info = ParseXdsGrpcService(
|
|
177
|
+
context,
|
|
178
|
+
envoy_extensions_filters_http_ext_proc_v3_ExternalProcessor_grpc_service(
|
|
179
|
+
ext_proc),
|
|
180
|
+
errors);
|
|
181
|
+
}
|
|
182
|
+
// failure_mode_allow
|
|
183
|
+
config->failure_mode_allow =
|
|
184
|
+
envoy_extensions_filters_http_ext_proc_v3_ExternalProcessor_failure_mode_allow(
|
|
185
|
+
ext_proc);
|
|
186
|
+
// processing_mode
|
|
187
|
+
{
|
|
188
|
+
ValidationErrors::ScopedField field(errors, ".processing_mode");
|
|
189
|
+
config->processing_mode = ParseProcessingMode(
|
|
190
|
+
envoy_extensions_filters_http_ext_proc_v3_ExternalProcessor_processing_mode(
|
|
191
|
+
ext_proc),
|
|
192
|
+
errors);
|
|
193
|
+
}
|
|
194
|
+
size_t size;
|
|
195
|
+
// TODO(rishesh): Validate that request_attributes and response_attributes are
|
|
196
|
+
// actually valid.
|
|
197
|
+
// request_attributes
|
|
198
|
+
const auto* request_attributes =
|
|
199
|
+
envoy_extensions_filters_http_ext_proc_v3_ExternalProcessor_request_attributes(
|
|
200
|
+
ext_proc, &size);
|
|
201
|
+
for (size_t i = 0; i < size; ++i) {
|
|
202
|
+
config->request_attributes.push_back(
|
|
203
|
+
UpbStringToStdString(request_attributes[i]));
|
|
204
|
+
}
|
|
205
|
+
// response_attributes
|
|
206
|
+
const auto* response_attributes =
|
|
207
|
+
envoy_extensions_filters_http_ext_proc_v3_ExternalProcessor_response_attributes(
|
|
208
|
+
ext_proc, &size);
|
|
209
|
+
for (size_t i = 0; i < size; ++i) {
|
|
210
|
+
config->response_attributes.push_back(
|
|
211
|
+
UpbStringToStdString(response_attributes[i]));
|
|
212
|
+
}
|
|
213
|
+
// mutation_rules
|
|
214
|
+
if (const auto* mutation_rules =
|
|
215
|
+
envoy_extensions_filters_http_ext_proc_v3_ExternalProcessor_mutation_rules(
|
|
216
|
+
ext_proc);
|
|
217
|
+
mutation_rules != nullptr) {
|
|
218
|
+
ValidationErrors::ScopedField field(errors, ".mutation_rules");
|
|
219
|
+
config->mutation_rules = ParseHeaderMutationRules(mutation_rules, errors);
|
|
220
|
+
}
|
|
221
|
+
// forwarding_rules
|
|
222
|
+
if (const auto* forwarding_rules =
|
|
223
|
+
envoy_extensions_filters_http_ext_proc_v3_ExternalProcessor_forward_rules(
|
|
224
|
+
ext_proc);
|
|
225
|
+
forwarding_rules != nullptr) {
|
|
226
|
+
const auto* allowed_headers =
|
|
227
|
+
envoy_extensions_filters_http_ext_proc_v3_HeaderForwardingRules_allowed_headers(
|
|
228
|
+
forwarding_rules);
|
|
229
|
+
if (allowed_headers != nullptr) {
|
|
230
|
+
ValidationErrors::ScopedField field(errors,
|
|
231
|
+
".forwarding_rules.allowed_headers");
|
|
232
|
+
config->forwarding_allowed_headers =
|
|
233
|
+
XdsListStringMatcherParse(context, allowed_headers, errors);
|
|
234
|
+
}
|
|
235
|
+
const auto* disallowed_headers =
|
|
236
|
+
envoy_extensions_filters_http_ext_proc_v3_HeaderForwardingRules_disallowed_headers(
|
|
237
|
+
forwarding_rules);
|
|
238
|
+
if (disallowed_headers != nullptr) {
|
|
239
|
+
ValidationErrors::ScopedField field(
|
|
240
|
+
errors, ".forwarding_rules.disallowed_headers");
|
|
241
|
+
config->forwarding_disallowed_headers =
|
|
242
|
+
XdsListStringMatcherParse(context, disallowed_headers, errors);
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
// disable_immediate_response
|
|
246
|
+
config->disable_immediate_response =
|
|
247
|
+
envoy_extensions_filters_http_ext_proc_v3_ExternalProcessor_disable_immediate_response(
|
|
248
|
+
ext_proc);
|
|
249
|
+
// observability_mode
|
|
250
|
+
config->observability_mode =
|
|
251
|
+
envoy_extensions_filters_http_ext_proc_v3_ExternalProcessor_observability_mode(
|
|
252
|
+
ext_proc);
|
|
253
|
+
// deferred_close_timeout
|
|
254
|
+
const auto* deferred_close_timeout =
|
|
255
|
+
envoy_extensions_filters_http_ext_proc_v3_ExternalProcessor_deferred_close_timeout(
|
|
256
|
+
ext_proc);
|
|
257
|
+
if (deferred_close_timeout == nullptr) {
|
|
258
|
+
config->deferred_close_timeout = Duration::Seconds(5);
|
|
259
|
+
} else {
|
|
260
|
+
ValidationErrors::ScopedField field(errors, ".deferred_close_timeout");
|
|
261
|
+
config->deferred_close_timeout =
|
|
262
|
+
ParseDuration(deferred_close_timeout, errors);
|
|
263
|
+
if (config->deferred_close_timeout <= Duration::Zero()) {
|
|
264
|
+
errors->AddError("duration must be positive");
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
return config;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
RefCountedPtr<const FilterConfig>
|
|
271
|
+
XdsHttpExtProcFilterFactory::ParseOverrideConfig(
|
|
272
|
+
absl::string_view /*instance_name*/,
|
|
273
|
+
const XdsResourceType::DecodeContext& context,
|
|
274
|
+
const XdsExtension& extension, ValidationErrors* errors) const {
|
|
275
|
+
const absl::string_view* serialized_filter_config =
|
|
276
|
+
std::get_if<absl::string_view>(&extension.value);
|
|
277
|
+
if (serialized_filter_config == nullptr) {
|
|
278
|
+
errors->AddError("could not parse ext_proc filter override config");
|
|
279
|
+
return nullptr;
|
|
280
|
+
}
|
|
281
|
+
auto* ext_proc_per_route =
|
|
282
|
+
envoy_extensions_filters_http_ext_proc_v3_ExtProcPerRoute_parse(
|
|
283
|
+
serialized_filter_config->data(), serialized_filter_config->size(),
|
|
284
|
+
context.arena);
|
|
285
|
+
if (ext_proc_per_route == nullptr) {
|
|
286
|
+
errors->AddError("could not parse ext_proc filter override config");
|
|
287
|
+
return nullptr;
|
|
288
|
+
}
|
|
289
|
+
auto config = MakeRefCounted<ExtProcFilter::Config>();
|
|
290
|
+
auto* overrides =
|
|
291
|
+
envoy_extensions_filters_http_ext_proc_v3_ExtProcPerRoute_overrides(
|
|
292
|
+
ext_proc_per_route);
|
|
293
|
+
if (overrides == nullptr) return nullptr;
|
|
294
|
+
ValidationErrors::ScopedField field(errors, ".overrides");
|
|
295
|
+
// processing_mode
|
|
296
|
+
if (auto* processing_mode =
|
|
297
|
+
envoy_extensions_filters_http_ext_proc_v3_ExtProcOverrides_processing_mode(
|
|
298
|
+
overrides);
|
|
299
|
+
processing_mode != nullptr) {
|
|
300
|
+
ValidationErrors::ScopedField field(errors, ".processing_mode");
|
|
301
|
+
config->processing_mode = ParseProcessingMode(processing_mode, errors);
|
|
302
|
+
}
|
|
303
|
+
// grpc_service
|
|
304
|
+
if (auto* grpc_service =
|
|
305
|
+
envoy_extensions_filters_http_ext_proc_v3_ExtProcOverrides_grpc_service(
|
|
306
|
+
overrides);
|
|
307
|
+
grpc_service != nullptr) {
|
|
308
|
+
ValidationErrors::ScopedField field(errors, ".grpc_service");
|
|
309
|
+
config->channel_info = ParseXdsGrpcService(context, grpc_service, errors);
|
|
310
|
+
}
|
|
311
|
+
// TODO(rishesh): Validate that request_attributes and response_attributes are
|
|
312
|
+
// actually valid.
|
|
313
|
+
// request_attributes
|
|
314
|
+
size_t size;
|
|
315
|
+
const auto* request_attributes =
|
|
316
|
+
envoy_extensions_filters_http_ext_proc_v3_ExtProcOverrides_request_attributes(
|
|
317
|
+
overrides, &size);
|
|
318
|
+
for (size_t i = 0; i < size; ++i) {
|
|
319
|
+
config->request_attributes.push_back(
|
|
320
|
+
UpbStringToStdString(request_attributes[i]));
|
|
321
|
+
}
|
|
322
|
+
// response_attributes
|
|
323
|
+
const auto* response_attributes =
|
|
324
|
+
envoy_extensions_filters_http_ext_proc_v3_ExtProcOverrides_response_attributes(
|
|
325
|
+
overrides, &size);
|
|
326
|
+
for (size_t i = 0; i < size; ++i) {
|
|
327
|
+
config->response_attributes.push_back(
|
|
328
|
+
UpbStringToStdString(response_attributes[i]));
|
|
329
|
+
}
|
|
330
|
+
// failure_mode_allow
|
|
331
|
+
if (auto* failure_mode_allow =
|
|
332
|
+
envoy_extensions_filters_http_ext_proc_v3_ExtProcOverrides_failure_mode_allow(
|
|
333
|
+
overrides);
|
|
334
|
+
failure_mode_allow != nullptr) {
|
|
335
|
+
config->failure_mode_allow = ParseBoolValue(failure_mode_allow);
|
|
336
|
+
}
|
|
337
|
+
return config;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
RefCountedPtr<const FilterConfig> XdsHttpExtProcFilterFactory::MergeConfigs(
|
|
341
|
+
RefCountedPtr<const FilterConfig> top_level_config,
|
|
342
|
+
RefCountedPtr<const FilterConfig> virtual_host_override_config,
|
|
343
|
+
RefCountedPtr<const FilterConfig> route_override_config,
|
|
344
|
+
RefCountedPtr<const FilterConfig> cluster_weight_override_config,
|
|
345
|
+
XdsTransportFactory& transport_factory, Blackboard& blackboard) const {
|
|
346
|
+
// Find the most specific override config.
|
|
347
|
+
const FilterConfig* override_config = nullptr;
|
|
348
|
+
if (cluster_weight_override_config != nullptr) {
|
|
349
|
+
override_config = cluster_weight_override_config.get();
|
|
350
|
+
} else if (route_override_config != nullptr) {
|
|
351
|
+
override_config = route_override_config.get();
|
|
352
|
+
} else if (virtual_host_override_config != nullptr) {
|
|
353
|
+
override_config = virtual_host_override_config.get();
|
|
354
|
+
}
|
|
355
|
+
const auto& top_config =
|
|
356
|
+
DownCast<const ExtProcFilter::Config&>(*top_level_config);
|
|
357
|
+
auto config = MakeRefCounted<ExtProcFilter::Config>();
|
|
358
|
+
config->channel_info = top_config.channel_info;
|
|
359
|
+
config->failure_mode_allow = top_config.failure_mode_allow;
|
|
360
|
+
config->processing_mode = top_config.processing_mode;
|
|
361
|
+
config->request_attributes = top_config.request_attributes;
|
|
362
|
+
config->response_attributes = top_config.response_attributes;
|
|
363
|
+
if (top_config.mutation_rules.has_value()) {
|
|
364
|
+
HeaderMutationRules rules;
|
|
365
|
+
rules.disallow_all = top_config.mutation_rules->disallow_all;
|
|
366
|
+
rules.disallow_is_error = top_config.mutation_rules->disallow_is_error;
|
|
367
|
+
if (top_config.mutation_rules->allow_expression != nullptr) {
|
|
368
|
+
rules.allow_expression = std::make_unique<RE2>(
|
|
369
|
+
top_config.mutation_rules->allow_expression->pattern());
|
|
370
|
+
}
|
|
371
|
+
if (top_config.mutation_rules->disallow_expression != nullptr) {
|
|
372
|
+
rules.disallow_expression = std::make_unique<RE2>(
|
|
373
|
+
top_config.mutation_rules->disallow_expression->pattern());
|
|
374
|
+
}
|
|
375
|
+
config->mutation_rules = std::move(rules);
|
|
376
|
+
}
|
|
377
|
+
config->forwarding_allowed_headers = top_config.forwarding_allowed_headers;
|
|
378
|
+
config->forwarding_disallowed_headers =
|
|
379
|
+
top_config.forwarding_disallowed_headers;
|
|
380
|
+
config->disable_immediate_response = top_config.disable_immediate_response;
|
|
381
|
+
config->observability_mode = top_config.observability_mode;
|
|
382
|
+
config->deferred_close_timeout = top_config.deferred_close_timeout;
|
|
383
|
+
if (override_config != nullptr) {
|
|
384
|
+
GRPC_CHECK_EQ(override_config->type(), ExtProcFilter::Config::Type());
|
|
385
|
+
const auto& o = DownCast<const ExtProcFilter::Config&>(*override_config);
|
|
386
|
+
if (o.processing_mode.has_value()) {
|
|
387
|
+
config->processing_mode = o.processing_mode;
|
|
388
|
+
}
|
|
389
|
+
if (std::holds_alternative<GrpcXdsServerTarget>(o.channel_info)) {
|
|
390
|
+
config->channel_info = o.channel_info;
|
|
391
|
+
}
|
|
392
|
+
if (!o.request_attributes.empty()) {
|
|
393
|
+
config->request_attributes = o.request_attributes;
|
|
394
|
+
}
|
|
395
|
+
if (!o.response_attributes.empty()) {
|
|
396
|
+
config->response_attributes = o.response_attributes;
|
|
397
|
+
}
|
|
398
|
+
if (o.failure_mode_allow.has_value()) {
|
|
399
|
+
config->failure_mode_allow = o.failure_mode_allow;
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
// Blackboard handling
|
|
403
|
+
if (const auto* target =
|
|
404
|
+
std::get_if<GrpcXdsServerTarget>(&config->channel_info);
|
|
405
|
+
target != nullptr) {
|
|
406
|
+
std::string key = target->Key();
|
|
407
|
+
config->channel_info =
|
|
408
|
+
blackboard.GetOrSet<ExtProcFilter::ExtProcChannel>(key, [&]() {
|
|
409
|
+
std::shared_ptr<const XdsBootstrap::XdsServerTarget> target_shared =
|
|
410
|
+
std::make_shared<GrpcXdsServerTarget>(*target);
|
|
411
|
+
return MakeRefCounted<ExtProcFilter::ExtProcChannel>(
|
|
412
|
+
std::move(target_shared), transport_factory.Ref());
|
|
413
|
+
});
|
|
414
|
+
}
|
|
415
|
+
return config;
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
} // namespace grpc_core
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 gRPC authors.
|
|
3
|
+
//
|
|
4
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
// you may not use this file except in compliance with the License.
|
|
6
|
+
// You may obtain a copy of the License at
|
|
7
|
+
//
|
|
8
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
//
|
|
10
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
// See the License for the specific language governing permissions and
|
|
14
|
+
// limitations under the License.
|
|
15
|
+
//
|
|
16
|
+
|
|
17
|
+
#ifndef GRPC_SRC_CORE_XDS_GRPC_XDS_HTTP_EXT_PROC_FILTER_H
|
|
18
|
+
#define GRPC_SRC_CORE_XDS_GRPC_XDS_HTTP_EXT_PROC_FILTER_H
|
|
19
|
+
|
|
20
|
+
#include <optional>
|
|
21
|
+
|
|
22
|
+
#include "src/core/filter/filter_args.h"
|
|
23
|
+
#include "src/core/lib/channel/channel_fwd.h"
|
|
24
|
+
#include "src/core/util/validation_errors.h"
|
|
25
|
+
#include "src/core/xds/grpc/xds_common_types.h"
|
|
26
|
+
#include "src/core/xds/grpc/xds_http_filter.h"
|
|
27
|
+
#include "src/core/xds/xds_client/xds_resource_type.h"
|
|
28
|
+
#include "src/core/xds/xds_client/xds_transport.h"
|
|
29
|
+
#include "upb/reflection/def.h"
|
|
30
|
+
#include "absl/status/statusor.h"
|
|
31
|
+
#include "absl/strings/string_view.h"
|
|
32
|
+
|
|
33
|
+
namespace grpc_core {
|
|
34
|
+
|
|
35
|
+
class XdsHttpExtProcFilterFactory final : public XdsHttpFilterFactory {
|
|
36
|
+
public:
|
|
37
|
+
absl::string_view ConfigProtoName() const override;
|
|
38
|
+
absl::string_view OverrideConfigProtoName() const override;
|
|
39
|
+
void PopulateSymtab(upb_DefPool* symtab) const override;
|
|
40
|
+
std::optional<Json> GenerateFilterConfig(
|
|
41
|
+
absl::string_view /*instance_name*/,
|
|
42
|
+
const XdsResourceType::DecodeContext& /*context*/,
|
|
43
|
+
const XdsExtension& /*extension*/,
|
|
44
|
+
ValidationErrors* /*errors*/) const override {
|
|
45
|
+
return std::nullopt;
|
|
46
|
+
}
|
|
47
|
+
std::optional<Json> GenerateFilterConfigOverride(
|
|
48
|
+
absl::string_view /*instance_name*/,
|
|
49
|
+
const XdsResourceType::DecodeContext& /*context*/,
|
|
50
|
+
const XdsExtension& /*extension*/,
|
|
51
|
+
ValidationErrors* /*errors*/) const override {
|
|
52
|
+
return std::nullopt;
|
|
53
|
+
}
|
|
54
|
+
const grpc_channel_filter* channel_filter() const override;
|
|
55
|
+
absl::StatusOr<ServiceConfigJsonEntry> GenerateMethodConfig(
|
|
56
|
+
const Json& /*hcm_filter_config*/,
|
|
57
|
+
const Json* /*filter_config_override*/) const override {
|
|
58
|
+
return absl::UnimplementedError(
|
|
59
|
+
"old-style filter config APIs not supported");
|
|
60
|
+
}
|
|
61
|
+
absl::StatusOr<ServiceConfigJsonEntry> GenerateServiceConfig(
|
|
62
|
+
const Json& /*hcm_filter_config*/) const override {
|
|
63
|
+
return absl::UnimplementedError(
|
|
64
|
+
"old-style filter config APIs not supported");
|
|
65
|
+
}
|
|
66
|
+
void AddFilter(FilterChainBuilder& builder,
|
|
67
|
+
RefCountedPtr<const FilterConfig> config) const override;
|
|
68
|
+
RefCountedPtr<const FilterConfig> ParseTopLevelConfig(
|
|
69
|
+
absl::string_view instance_name,
|
|
70
|
+
const XdsResourceType::DecodeContext& context,
|
|
71
|
+
const XdsExtension& extension, ValidationErrors* errors) const override;
|
|
72
|
+
RefCountedPtr<const FilterConfig> ParseOverrideConfig(
|
|
73
|
+
absl::string_view instance_name,
|
|
74
|
+
const XdsResourceType::DecodeContext& context,
|
|
75
|
+
const XdsExtension& extension, ValidationErrors* errors) const override;
|
|
76
|
+
RefCountedPtr<const FilterConfig> MergeConfigs(
|
|
77
|
+
RefCountedPtr<const FilterConfig> top_level_config,
|
|
78
|
+
RefCountedPtr<const FilterConfig> virtual_host_override_config,
|
|
79
|
+
RefCountedPtr<const FilterConfig> route_override_config,
|
|
80
|
+
RefCountedPtr<const FilterConfig> cluster_weight_override_config,
|
|
81
|
+
XdsTransportFactory& transport_factory,
|
|
82
|
+
Blackboard& blackboard) const override;
|
|
83
|
+
bool IsSupportedOnClients() const override { return true; }
|
|
84
|
+
bool IsSupportedOnServers() const override { return false; }
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
} // namespace grpc_core
|
|
88
|
+
|
|
89
|
+
#endif // GRPC_SRC_CORE_XDS_GRPC_XDS_HTTP_EXT_PROC_FILTER_H
|
|
@@ -17,8 +17,6 @@
|
|
|
17
17
|
#include "src/core/xds/grpc/xds_http_fault_filter.h"
|
|
18
18
|
|
|
19
19
|
#include <grpc/status.h>
|
|
20
|
-
#include <grpc/support/json.h>
|
|
21
|
-
#include <grpc/support/port_platform.h>
|
|
22
20
|
#include <stdint.h>
|
|
23
21
|
|
|
24
22
|
#include <string>
|
|
@@ -32,10 +30,7 @@
|
|
|
32
30
|
#include "google/protobuf/wrappers.upb.h"
|
|
33
31
|
#include "src/core/call/status_util.h"
|
|
34
32
|
#include "src/core/ext/filters/fault_injection/fault_injection_filter.h"
|
|
35
|
-
#include "src/core/lib/channel/channel_args.h"
|
|
36
33
|
#include "src/core/lib/transport/status_conversion.h"
|
|
37
|
-
#include "src/core/util/json/json.h"
|
|
38
|
-
#include "src/core/util/json/json_writer.h"
|
|
39
34
|
#include "src/core/util/time.h"
|
|
40
35
|
#include "src/core/util/validation_errors.h"
|
|
41
36
|
#include "src/core/xds/grpc/xds_common_types.h"
|
|
@@ -70,29 +65,30 @@ uint32_t GetDenominator(const envoy_type_v3_FractionalPercent* fraction) {
|
|
|
70
65
|
|
|
71
66
|
} // namespace
|
|
72
67
|
|
|
73
|
-
absl::string_view
|
|
68
|
+
absl::string_view XdsHttpFaultFilterFactory::ConfigProtoName() const {
|
|
74
69
|
return "envoy.extensions.filters.http.fault.v3.HTTPFault";
|
|
75
70
|
}
|
|
76
71
|
|
|
77
|
-
absl::string_view
|
|
72
|
+
absl::string_view XdsHttpFaultFilterFactory::OverrideConfigProtoName() const {
|
|
78
73
|
return "envoy.extensions.filters.http.fault.v3.HTTPFault";
|
|
79
74
|
}
|
|
80
75
|
|
|
81
|
-
void
|
|
76
|
+
void XdsHttpFaultFilterFactory::PopulateSymtab(upb_DefPool* symtab) const {
|
|
82
77
|
envoy_extensions_filters_http_fault_v3_HTTPFault_getmsgdef(symtab);
|
|
83
78
|
}
|
|
84
79
|
|
|
85
|
-
const grpc_channel_filter*
|
|
80
|
+
const grpc_channel_filter* XdsHttpFaultFilterFactory::channel_filter() const {
|
|
86
81
|
return &FaultInjectionFilter::kFilterVtable;
|
|
87
82
|
}
|
|
88
83
|
|
|
89
|
-
void
|
|
84
|
+
void XdsHttpFaultFilterFactory::AddFilter(
|
|
90
85
|
FilterChainBuilder& builder,
|
|
91
86
|
RefCountedPtr<const FilterConfig> config) const {
|
|
92
87
|
builder.AddFilter<FaultInjectionFilter>(std::move(config));
|
|
93
88
|
}
|
|
94
89
|
|
|
95
|
-
RefCountedPtr<const FilterConfig>
|
|
90
|
+
RefCountedPtr<const FilterConfig>
|
|
91
|
+
XdsHttpFaultFilterFactory::ParseTopLevelConfig(
|
|
96
92
|
absl::string_view /*instance_name*/,
|
|
97
93
|
const XdsResourceType::DecodeContext& context,
|
|
98
94
|
const XdsExtension& extension, ValidationErrors* errors) const {
|
|
@@ -190,7 +186,8 @@ RefCountedPtr<const FilterConfig> XdsHttpFaultFilter::ParseTopLevelConfig(
|
|
|
190
186
|
return config;
|
|
191
187
|
}
|
|
192
188
|
|
|
193
|
-
RefCountedPtr<const FilterConfig>
|
|
189
|
+
RefCountedPtr<const FilterConfig>
|
|
190
|
+
XdsHttpFaultFilterFactory::ParseOverrideConfig(
|
|
194
191
|
absl::string_view instance_name,
|
|
195
192
|
const XdsResourceType::DecodeContext& context,
|
|
196
193
|
const XdsExtension& extension, ValidationErrors* errors) const {
|
|
@@ -17,11 +17,8 @@
|
|
|
17
17
|
#ifndef GRPC_SRC_CORE_XDS_GRPC_XDS_HTTP_FAULT_FILTER_H
|
|
18
18
|
#define GRPC_SRC_CORE_XDS_GRPC_XDS_HTTP_FAULT_FILTER_H
|
|
19
19
|
|
|
20
|
-
#include <grpc/support/port_platform.h>
|
|
21
|
-
|
|
22
20
|
#include <optional>
|
|
23
21
|
|
|
24
|
-
#include "src/core/lib/channel/channel_args.h"
|
|
25
22
|
#include "src/core/lib/channel/channel_fwd.h"
|
|
26
23
|
#include "src/core/util/validation_errors.h"
|
|
27
24
|
#include "src/core/xds/grpc/xds_common_types.h"
|
|
@@ -33,7 +30,7 @@
|
|
|
33
30
|
|
|
34
31
|
namespace grpc_core {
|
|
35
32
|
|
|
36
|
-
class
|
|
33
|
+
class XdsHttpFaultFilterFactory final : public XdsHttpFilterFactory {
|
|
37
34
|
public:
|
|
38
35
|
absl::string_view ConfigProtoName() const override;
|
|
39
36
|
absl::string_view OverrideConfigProtoName() const override;
|
|
@@ -18,11 +18,12 @@
|
|
|
18
18
|
|
|
19
19
|
namespace grpc_core {
|
|
20
20
|
|
|
21
|
-
RefCountedPtr<const FilterConfig>
|
|
21
|
+
RefCountedPtr<const FilterConfig> XdsHttpFilterFactory::MergeConfigs(
|
|
22
22
|
RefCountedPtr<const FilterConfig> top_level_config,
|
|
23
23
|
RefCountedPtr<const FilterConfig> virtual_host_override_config,
|
|
24
24
|
RefCountedPtr<const FilterConfig> route_override_config,
|
|
25
25
|
RefCountedPtr<const FilterConfig> cluster_weight_override_config,
|
|
26
|
+
XdsTransportFactory& /*transport_factory*/,
|
|
26
27
|
Blackboard& /*blackboard*/) const {
|
|
27
28
|
if (cluster_weight_override_config != nullptr) {
|
|
28
29
|
return cluster_weight_override_config;
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
#include "src/core/xds/grpc/blackboard.h"
|
|
30
30
|
#include "src/core/xds/grpc/xds_common_types.h"
|
|
31
31
|
#include "src/core/xds/xds_client/xds_resource_type.h"
|
|
32
|
+
#include "src/core/xds/xds_client/xds_transport.h"
|
|
32
33
|
#include "upb/reflection/def.h"
|
|
33
34
|
#include "absl/status/statusor.h"
|
|
34
35
|
#include "absl/strings/str_cat.h"
|
|
@@ -36,9 +37,9 @@
|
|
|
36
37
|
|
|
37
38
|
namespace grpc_core {
|
|
38
39
|
|
|
39
|
-
class
|
|
40
|
+
class XdsHttpFilterFactory {
|
|
40
41
|
public:
|
|
41
|
-
virtual ~
|
|
42
|
+
virtual ~XdsHttpFilterFactory() = default;
|
|
42
43
|
|
|
43
44
|
// Returns the top-level filter config proto message name.
|
|
44
45
|
virtual absl::string_view ConfigProtoName() const = 0;
|
|
@@ -75,7 +76,7 @@ class XdsHttpFilterImpl {
|
|
|
75
76
|
RefCountedPtr<const FilterConfig> virtual_host_override_config,
|
|
76
77
|
RefCountedPtr<const FilterConfig> route_override_config,
|
|
77
78
|
RefCountedPtr<const FilterConfig> cluster_weight_override_config,
|
|
78
|
-
Blackboard& blackboard) const;
|
|
79
|
+
XdsTransportFactory& transport_factory, Blackboard& blackboard) const;
|
|
79
80
|
|
|
80
81
|
// Returns true if the filter is supported on clients; false otherwise
|
|
81
82
|
virtual bool IsSupportedOnClients() const = 0;
|
|
@@ -91,8 +92,8 @@ class XdsHttpFilterImpl {
|
|
|
91
92
|
// ALL INTERFACES BELOW ARE DEPRECATED
|
|
92
93
|
//
|
|
93
94
|
/////////////////////////////////////////////////////////////////////////////
|
|
94
|
-
// TODO(roth): Remove these
|
|
95
|
-
//
|
|
95
|
+
// TODO(roth): Remove these when removing the
|
|
96
|
+
// xds_server_filter_chain_per_route experiment.
|
|
96
97
|
|
|
97
98
|
// Service config data for the filter, returned by GenerateServiceConfig().
|
|
98
99
|
struct ServiceConfigJsonEntry {
|