grpc 1.31.1 → 1.35.0.pre1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of grpc might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/Makefile +719 -17819
- data/etc/roots.pem +257 -573
- data/include/grpc/compression.h +1 -1
- data/include/grpc/grpc.h +15 -7
- data/include/grpc/grpc_security.h +254 -186
- data/include/grpc/impl/codegen/README.md +22 -0
- data/include/grpc/impl/codegen/atm_windows.h +4 -0
- data/include/grpc/impl/codegen/byte_buffer.h +1 -1
- data/include/grpc/impl/codegen/grpc_types.h +10 -8
- data/include/grpc/impl/codegen/log.h +0 -2
- data/include/grpc/impl/codegen/port_platform.h +28 -56
- data/include/grpc/impl/codegen/sync_windows.h +4 -0
- data/include/grpc/slice_buffer.h +3 -3
- data/include/grpc/support/sync.h +3 -3
- data/include/grpc/support/time.h +7 -7
- data/src/core/ext/filters/client_channel/backend_metric.cc +2 -4
- data/src/core/ext/filters/client_channel/backup_poller.cc +3 -2
- data/src/core/ext/filters/client_channel/client_channel.cc +2831 -1540
- data/src/core/ext/filters/client_channel/client_channel.h +1 -5
- data/src/core/ext/filters/client_channel/client_channel_channelz.h +0 -3
- data/src/core/ext/filters/client_channel/client_channel_plugin.cc +1 -1
- data/src/core/ext/filters/client_channel/config_selector.cc +0 -4
- data/src/core/ext/filters/client_channel/config_selector.h +40 -8
- data/src/core/ext/filters/client_channel/dynamic_filters.cc +186 -0
- data/src/core/ext/filters/client_channel/dynamic_filters.h +99 -0
- data/src/core/ext/filters/client_channel/health/health_check_client.cc +16 -8
- data/src/core/ext/filters/client_channel/health/health_check_client.h +4 -4
- data/src/core/ext/filters/client_channel/http_connect_handshaker.cc +7 -9
- data/src/core/ext/filters/client_channel/http_proxy.cc +21 -20
- data/src/core/ext/filters/client_channel/lb_policy.cc +6 -2
- data/src/core/ext/filters/client_channel/lb_policy.h +8 -7
- data/src/core/ext/filters/client_channel/lb_policy/address_filtering.cc +48 -35
- data/src/core/ext/filters/client_channel/lb_policy/address_filtering.h +7 -5
- data/src/core/ext/filters/client_channel/lb_policy/child_policy_handler.cc +10 -7
- data/src/core/ext/filters/client_channel/lb_policy/child_policy_handler.h +1 -1
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +210 -192
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_balancer_addresses.cc +0 -13
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_balancer_addresses.h +0 -3
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc +1 -37
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.cc +3 -1
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc +3 -3
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h +1 -1
- data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +23 -17
- data/src/core/ext/filters/client_channel/lb_policy/priority/priority.cc +79 -30
- data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +10 -9
- data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +14 -34
- data/src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc +26 -15
- data/src/core/ext/filters/client_channel/lb_policy/xds/cds.cc +350 -130
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds.h +52 -24
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_channel_args.h +24 -0
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_impl.cc +812 -0
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_manager.cc +722 -0
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_resolver.cc +1262 -0
- data/src/core/ext/filters/client_channel/lb_policy_registry.cc +8 -1
- data/src/core/ext/filters/client_channel/resolver.cc +3 -1
- data/src/core/ext/filters/client_channel/resolver.h +4 -1
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc +9 -16
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h +1 -32
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc +3 -3
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc +457 -19
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h +5 -0
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_libuv.cc +1 -1
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_windows.cc +1 -1
- data/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc +7 -10
- data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc +4 -4
- data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h +1 -1
- data/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc +35 -28
- data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc +664 -63
- data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.h +28 -0
- data/src/core/ext/filters/client_channel/resolver_factory.h +6 -6
- data/src/core/ext/filters/client_channel/resolver_registry.cc +40 -39
- data/src/core/ext/filters/client_channel/resolver_registry.h +2 -2
- data/src/core/ext/filters/client_channel/resolver_result_parsing.cc +29 -74
- data/src/core/ext/filters/client_channel/resolver_result_parsing.h +12 -11
- data/src/core/ext/filters/client_channel/retry_throttle.cc +5 -3
- data/src/core/ext/filters/client_channel/retry_throttle.h +4 -2
- data/src/core/ext/filters/client_channel/server_address.cc +120 -7
- data/src/core/ext/filters/client_channel/server_address.h +44 -21
- data/src/core/ext/filters/client_channel/service_config.cc +18 -13
- data/src/core/ext/filters/client_channel/service_config.h +8 -5
- data/src/core/ext/filters/client_channel/service_config_call_data.h +19 -1
- data/src/core/ext/filters/client_channel/service_config_channel_arg_filter.cc +2 -2
- data/src/core/ext/filters/client_channel/service_config_parser.cc +8 -6
- data/src/core/ext/filters/client_channel/service_config_parser.h +8 -5
- data/src/core/ext/filters/client_channel/subchannel.cc +115 -87
- data/src/core/ext/filters/client_channel/subchannel.h +30 -24
- data/src/core/ext/filters/client_channel/subchannel_interface.h +41 -5
- data/src/core/ext/filters/client_channel/subchannel_pool_interface.h +6 -2
- data/src/core/ext/filters/deadline/deadline_filter.cc +87 -79
- data/src/core/ext/filters/deadline/deadline_filter.h +7 -11
- data/src/core/ext/filters/http/client/http_client_filter.cc +1 -1
- data/src/core/ext/filters/http/client_authority_filter.cc +6 -6
- data/src/core/ext/filters/http/http_filters_plugin.cc +6 -3
- data/src/core/ext/filters/http/server/http_server_filter.cc +3 -3
- data/src/core/ext/filters/max_age/max_age_filter.cc +3 -2
- data/src/core/ext/filters/message_size/message_size_filter.cc +3 -2
- data/src/core/ext/filters/message_size/message_size_filter.h +2 -1
- data/src/core/ext/filters/workarounds/workaround_utils.cc +1 -1
- data/src/core/ext/transport/chttp2/client/authority.cc +3 -3
- data/src/core/ext/transport/chttp2/client/chttp2_connector.cc +87 -31
- data/src/core/ext/transport/chttp2/client/chttp2_connector.h +19 -2
- data/src/core/ext/transport/chttp2/client/insecure/channel_create.cc +20 -8
- data/src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc +21 -10
- data/src/core/ext/transport/chttp2/client/secure/secure_channel_create.cc +34 -47
- data/src/core/ext/transport/chttp2/server/chttp2_server.cc +200 -100
- data/src/core/ext/transport/chttp2/server/chttp2_server.h +2 -1
- data/src/core/ext/transport/chttp2/server/insecure/server_chttp2.cc +2 -2
- data/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.cc +16 -9
- data/src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.cc +3 -2
- data/src/core/ext/transport/chttp2/transport/bin_decoder.cc +7 -7
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +267 -319
- data/src/core/ext/transport/chttp2/transport/flow_control.cc +11 -3
- data/src/core/ext/transport/chttp2/transport/flow_control.h +13 -3
- data/src/core/ext/transport/chttp2/transport/frame_goaway.cc +2 -1
- data/src/core/ext/transport/chttp2/transport/frame_settings.cc +2 -2
- data/src/core/ext/transport/chttp2/transport/frame_settings.h +2 -1
- data/src/core/ext/transport/chttp2/transport/frame_window_update.cc +6 -6
- data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +12 -8
- data/src/core/ext/transport/chttp2/transport/internal.h +10 -2
- data/src/core/ext/transport/chttp2/transport/parsing.cc +19 -31
- data/src/core/ext/transport/chttp2/transport/writing.cc +8 -8
- data/src/core/ext/transport/inproc/inproc_transport.cc +52 -18
- data/src/core/ext/upb-generated/envoy/annotations/deprecation.upb.h +1 -0
- data/src/core/ext/upb-generated/envoy/annotations/resource.upb.c +1 -1
- data/src/core/ext/upb-generated/envoy/annotations/resource.upb.h +7 -0
- data/src/core/ext/upb-generated/envoy/config/accesslog/v3/accesslog.upb.c +244 -0
- data/src/core/ext/upb-generated/envoy/config/accesslog/v3/accesslog.upb.h +865 -0
- data/src/core/ext/upb-generated/envoy/config/cluster/v3/circuit_breaker.upb.c +74 -0
- data/src/core/ext/upb-generated/envoy/config/cluster/v3/circuit_breaker.upb.h +253 -0
- data/src/core/ext/upb-generated/envoy/config/cluster/v3/cluster.upb.c +458 -0
- data/src/core/ext/upb-generated/envoy/config/cluster/v3/cluster.upb.h +1818 -0
- data/src/core/ext/upb-generated/envoy/config/cluster/v3/filter.upb.c +35 -0
- data/src/core/ext/upb-generated/envoy/config/cluster/v3/filter.upb.h +77 -0
- data/src/core/ext/upb-generated/envoy/config/cluster/v3/outlier_detection.upb.c +55 -0
- data/src/core/ext/upb-generated/envoy/config/cluster/v3/outlier_detection.upb.h +349 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/address.upb.c +124 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/address.upb.h +428 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/backoff.upb.c +35 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/backoff.upb.h +88 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/base.upb.c +310 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/base.upb.h +991 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/config_source.upb.c +103 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/config_source.upb.h +388 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/event_service_config.upb.c +34 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/event_service_config.upb.h +78 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/extension.upb.c +53 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/extension.upb.h +149 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/grpc_service.upb.c +241 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/grpc_service.upb.h +839 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/health_check.upb.c +170 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/health_check.upb.h +752 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/http_uri.upb.c +36 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/http_uri.upb.h +88 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/protocol.upb.c +176 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/protocol.upb.h +730 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/proxy_protocol.upb.c +28 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/proxy_protocol.upb.h +65 -0
- data/src/core/ext/upb-generated/envoy/{api/v2/core → config/core/v3}/socket_option.upb.c +8 -8
- data/src/core/ext/upb-generated/envoy/config/core/v3/socket_option.upb.h +95 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/substitution_format_string.upb.c +36 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/substitution_format_string.upb.h +92 -0
- data/src/core/ext/upb-generated/envoy/config/endpoint/v3/endpoint.upb.c +91 -0
- data/src/core/ext/upb-generated/envoy/config/endpoint/v3/endpoint.upb.h +243 -0
- data/src/core/ext/upb-generated/envoy/config/endpoint/v3/endpoint_components.upb.c +91 -0
- data/src/core/ext/upb-generated/envoy/config/endpoint/v3/endpoint_components.upb.h +305 -0
- data/src/core/ext/upb-generated/envoy/config/endpoint/v3/load_report.upb.c +112 -0
- data/src/core/ext/upb-generated/envoy/config/endpoint/v3/load_report.upb.h +367 -0
- data/src/core/ext/upb-generated/envoy/config/listener/v3/api_listener.upb.c +33 -0
- data/src/core/ext/upb-generated/envoy/config/listener/v3/api_listener.upb.h +73 -0
- data/src/core/ext/upb-generated/envoy/config/listener/v3/listener.upb.c +128 -0
- data/src/core/ext/upb-generated/envoy/config/listener/v3/listener.upb.h +512 -0
- data/src/core/ext/upb-generated/envoy/config/listener/v3/listener_components.upb.c +155 -0
- data/src/core/ext/upb-generated/envoy/config/listener/v3/listener_components.upb.h +591 -0
- data/src/core/ext/upb-generated/envoy/config/listener/v3/udp_listener_config.upb.c +41 -0
- data/src/core/ext/upb-generated/envoy/config/listener/v3/udp_listener_config.upb.h +107 -0
- data/src/core/ext/upb-generated/envoy/config/rbac/v3/rbac.upb.c +178 -0
- data/src/core/ext/upb-generated/envoy/config/rbac/v3/rbac.upb.h +662 -0
- data/src/core/ext/upb-generated/envoy/config/route/v3/route.upb.c +63 -0
- data/src/core/ext/upb-generated/envoy/config/route/v3/route.upb.h +220 -0
- data/src/core/ext/upb-generated/envoy/config/route/v3/route_components.upb.c +900 -0
- data/src/core/ext/upb-generated/envoy/config/route/v3/route_components.upb.h +3640 -0
- data/src/core/ext/upb-generated/envoy/config/route/v3/scoped_route.upb.c +60 -0
- data/src/core/ext/upb-generated/envoy/config/route/v3/scoped_route.upb.h +159 -0
- data/src/core/ext/upb-generated/envoy/config/trace/v3/http_tracer.upb.c +50 -0
- data/src/core/ext/upb-generated/envoy/config/trace/v3/http_tracer.upb.h +122 -0
- data/src/core/ext/upb-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb.c +364 -0
- data/src/core/ext/upb-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb.h +1475 -0
- data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/cert.upb.c +20 -0
- data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/cert.upb.h +35 -0
- data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/common.upb.c +110 -0
- data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/common.upb.h +426 -0
- data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/secret.upb.c +76 -0
- data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/secret.upb.h +236 -0
- data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/tls.upb.c +147 -0
- data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/tls.upb.h +621 -0
- data/src/core/ext/upb-generated/envoy/{api/v2 → service/cluster/v3}/cds.upb.c +6 -7
- data/src/core/ext/upb-generated/envoy/service/cluster/v3/cds.upb.h +56 -0
- data/src/core/ext/upb-generated/envoy/service/discovery/{v2 → v3}/ads.upb.c +6 -5
- data/src/core/ext/upb-generated/envoy/service/discovery/v3/ads.upb.h +56 -0
- data/src/core/ext/upb-generated/envoy/service/discovery/v3/discovery.upb.c +139 -0
- data/src/core/ext/upb-generated/envoy/service/discovery/v3/discovery.upb.h +487 -0
- data/src/core/ext/upb-generated/envoy/{api/v2 → service/endpoint/v3}/eds.upb.c +6 -7
- data/src/core/ext/upb-generated/envoy/service/endpoint/v3/eds.upb.h +56 -0
- data/src/core/ext/upb-generated/envoy/{api/v2 → service/listener/v3}/lds.upb.c +6 -7
- data/src/core/ext/upb-generated/envoy/service/listener/v3/lds.upb.h +56 -0
- data/src/core/ext/upb-generated/envoy/service/load_stats/v3/lrs.upb.c +55 -0
- data/src/core/ext/upb-generated/envoy/service/load_stats/v3/lrs.upb.h +151 -0
- data/src/core/ext/upb-generated/envoy/{api/v2 → service/route/v3}/rds.upb.c +6 -7
- data/src/core/ext/upb-generated/envoy/service/route/v3/rds.upb.h +56 -0
- data/src/core/ext/upb-generated/envoy/{api/v2 → service/route/v3}/srds.upb.c +6 -7
- data/src/core/ext/upb-generated/envoy/service/route/v3/srds.upb.h +56 -0
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/metadata.upb.c +47 -0
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/metadata.upb.h +128 -0
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/number.upb.c +35 -0
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/number.upb.h +84 -0
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/path.upb.c +34 -0
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/path.upb.h +78 -0
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/regex.upb.c +64 -0
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/regex.upb.h +166 -0
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/string.upb.c +54 -0
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/string.upb.h +146 -0
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/value.upb.c +63 -0
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/value.upb.h +207 -0
- data/src/core/ext/upb-generated/envoy/type/metadata/v3/metadata.upb.c +88 -0
- data/src/core/ext/upb-generated/envoy/type/metadata/v3/metadata.upb.h +301 -0
- data/src/core/ext/upb-generated/envoy/type/tracing/v3/custom_tag.upb.c +90 -0
- data/src/core/ext/upb-generated/envoy/type/tracing/v3/custom_tag.upb.h +283 -0
- data/src/core/ext/upb-generated/envoy/type/{http.upb.c → v3/http.upb.c} +2 -2
- data/src/core/ext/upb-generated/envoy/type/{http.upb.h → v3/http.upb.h} +9 -8
- data/src/core/ext/upb-generated/envoy/type/v3/percent.upb.c +40 -0
- data/src/core/ext/upb-generated/envoy/type/v3/percent.upb.h +99 -0
- data/src/core/ext/upb-generated/envoy/type/v3/range.upb.c +51 -0
- data/src/core/ext/upb-generated/envoy/type/v3/range.upb.h +130 -0
- data/src/core/ext/upb-generated/envoy/type/{semantic_version.upb.c → v3/semantic_version.upb.c} +7 -6
- data/src/core/ext/upb-generated/envoy/type/v3/semantic_version.upb.h +68 -0
- data/src/core/ext/upb-generated/google/api/annotations.upb.h +1 -0
- data/src/core/ext/upb-generated/google/api/expr/v1alpha1/checked.upb.c +242 -0
- data/src/core/ext/upb-generated/google/api/expr/v1alpha1/checked.upb.h +830 -0
- data/src/core/ext/upb-generated/google/api/expr/v1alpha1/syntax.upb.c +234 -0
- data/src/core/ext/upb-generated/google/api/expr/v1alpha1/syntax.upb.h +842 -0
- data/src/core/ext/upb-generated/google/api/http.upb.c +3 -3
- data/src/core/ext/upb-generated/google/api/http.upb.h +25 -6
- data/src/core/ext/upb-generated/google/protobuf/any.upb.c +1 -1
- data/src/core/ext/upb-generated/google/protobuf/any.upb.h +7 -0
- data/src/core/ext/upb-generated/google/protobuf/descriptor.upb.c +103 -103
- data/src/core/ext/upb-generated/google/protobuf/descriptor.upb.h +455 -292
- data/src/core/ext/upb-generated/google/protobuf/duration.upb.c +1 -1
- data/src/core/ext/upb-generated/google/protobuf/duration.upb.h +7 -0
- data/src/core/ext/upb-generated/google/protobuf/empty.upb.c +1 -1
- data/src/core/ext/upb-generated/google/protobuf/empty.upb.h +7 -0
- data/src/core/ext/upb-generated/google/protobuf/struct.upb.c +4 -4
- data/src/core/ext/upb-generated/google/protobuf/struct.upb.h +23 -4
- data/src/core/ext/upb-generated/google/protobuf/timestamp.upb.c +1 -1
- data/src/core/ext/upb-generated/google/protobuf/timestamp.upb.h +7 -0
- data/src/core/ext/upb-generated/google/protobuf/wrappers.upb.c +9 -9
- data/src/core/ext/upb-generated/google/protobuf/wrappers.upb.h +55 -0
- data/src/core/ext/upb-generated/google/rpc/status.upb.c +1 -1
- data/src/core/ext/upb-generated/google/rpc/status.upb.h +10 -3
- data/src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.c +4 -4
- data/src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.h +11 -3
- data/src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.c +41 -41
- data/src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.h +149 -76
- data/src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.c +5 -5
- data/src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.h +21 -6
- data/src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c +2 -2
- data/src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.h +13 -0
- data/src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c +17 -17
- data/src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.h +82 -25
- data/src/core/ext/upb-generated/udpa/annotations/migrate.upb.c +3 -3
- data/src/core/ext/upb-generated/udpa/annotations/migrate.upb.h +19 -0
- data/src/core/ext/upb-generated/udpa/annotations/security.upb.c +31 -0
- data/src/core/ext/upb-generated/udpa/annotations/security.upb.h +64 -0
- data/src/core/ext/upb-generated/udpa/annotations/sensitive.upb.h +1 -0
- data/src/core/ext/upb-generated/udpa/annotations/status.upb.c +2 -2
- data/src/core/ext/upb-generated/udpa/annotations/status.upb.h +9 -2
- data/src/core/ext/upb-generated/udpa/annotations/versioning.upb.c +27 -0
- data/src/core/ext/upb-generated/udpa/annotations/versioning.upb.h +60 -0
- data/src/core/ext/upb-generated/udpa/core/v1/authority.upb.c +28 -0
- data/src/core/ext/upb-generated/udpa/core/v1/authority.upb.h +60 -0
- data/src/core/ext/upb-generated/udpa/core/v1/collection_entry.upb.c +52 -0
- data/src/core/ext/upb-generated/udpa/core/v1/collection_entry.upb.h +143 -0
- data/src/core/ext/upb-generated/udpa/core/v1/context_params.upb.c +42 -0
- data/src/core/ext/upb-generated/udpa/core/v1/context_params.upb.h +84 -0
- data/src/core/ext/upb-generated/udpa/core/v1/resource.upb.c +36 -0
- data/src/core/ext/upb-generated/udpa/core/v1/resource.upb.h +94 -0
- data/src/core/ext/upb-generated/udpa/core/v1/resource_locator.upb.c +54 -0
- data/src/core/ext/upb-generated/udpa/core/v1/resource_locator.upb.h +173 -0
- data/src/core/ext/upb-generated/udpa/core/v1/resource_name.upb.c +36 -0
- data/src/core/ext/upb-generated/udpa/core/v1/resource_name.upb.h +92 -0
- data/src/core/ext/upb-generated/udpa/data/orca/v1/orca_load_report.upb.c +3 -3
- data/src/core/ext/upb-generated/udpa/data/orca/v1/orca_load_report.upb.h +7 -0
- data/src/core/ext/upb-generated/validate/validate.upb.c +68 -68
- data/src/core/ext/upb-generated/validate/validate.upb.h +296 -157
- data/src/core/ext/upbdefs-generated/envoy/annotations/deprecation.upbdefs.c +38 -0
- data/src/core/ext/upbdefs-generated/envoy/annotations/deprecation.upbdefs.h +30 -0
- data/src/core/ext/upbdefs-generated/envoy/annotations/resource.upbdefs.c +41 -0
- data/src/core/ext/upbdefs-generated/envoy/annotations/resource.upbdefs.h +35 -0
- data/src/core/ext/upbdefs-generated/envoy/config/accesslog/v3/accesslog.upbdefs.c +254 -0
- data/src/core/ext/upbdefs-generated/envoy/config/accesslog/v3/accesslog.upbdefs.h +105 -0
- data/src/core/ext/upbdefs-generated/envoy/config/cluster/v3/circuit_breaker.upbdefs.c +100 -0
- data/src/core/ext/upbdefs-generated/envoy/config/cluster/v3/circuit_breaker.upbdefs.h +45 -0
- data/src/core/ext/upbdefs-generated/envoy/config/cluster/v3/cluster.upbdefs.c +558 -0
- data/src/core/ext/upbdefs-generated/envoy/config/cluster/v3/cluster.upbdefs.h +145 -0
- data/src/core/ext/upbdefs-generated/envoy/config/cluster/v3/filter.upbdefs.c +53 -0
- data/src/core/ext/upbdefs-generated/envoy/config/cluster/v3/filter.upbdefs.h +35 -0
- data/src/core/ext/upbdefs-generated/envoy/config/cluster/v3/outlier_detection.upbdefs.c +133 -0
- data/src/core/ext/upbdefs-generated/envoy/config/cluster/v3/outlier_detection.upbdefs.h +35 -0
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/address.upbdefs.c +127 -0
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/address.upbdefs.h +65 -0
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/backoff.upbdefs.c +56 -0
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/backoff.upbdefs.h +35 -0
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/base.upbdefs.c +266 -0
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/base.upbdefs.h +125 -0
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/config_source.upbdefs.c +143 -0
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/config_source.upbdefs.h +55 -0
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/event_service_config.upbdefs.c +56 -0
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/event_service_config.upbdefs.h +35 -0
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/extension.upbdefs.c +66 -0
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/extension.upbdefs.h +40 -0
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/grpc_service.upbdefs.c +263 -0
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/grpc_service.upbdefs.h +100 -0
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/health_check.upbdefs.c +233 -0
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/health_check.upbdefs.h +70 -0
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/http_uri.upbdefs.c +56 -0
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/http_uri.upbdefs.h +35 -0
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/protocol.upbdefs.c +228 -0
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/protocol.upbdefs.h +80 -0
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/proxy_protocol.upbdefs.c +46 -0
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/proxy_protocol.upbdefs.h +35 -0
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/socket_option.upbdefs.c +59 -0
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/socket_option.upbdefs.h +35 -0
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/substitution_format_string.upbdefs.c +55 -0
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/substitution_format_string.upbdefs.h +35 -0
- data/src/core/ext/upbdefs-generated/envoy/config/endpoint/v3/endpoint.upbdefs.c +110 -0
- data/src/core/ext/upbdefs-generated/envoy/config/endpoint/v3/endpoint.upbdefs.h +50 -0
- data/src/core/ext/upbdefs-generated/envoy/config/endpoint/v3/endpoint_components.upbdefs.c +113 -0
- data/src/core/ext/upbdefs-generated/envoy/config/endpoint/v3/endpoint_components.upbdefs.h +50 -0
- data/src/core/ext/upbdefs-generated/envoy/config/endpoint/v3/load_report.upbdefs.c +146 -0
- data/src/core/ext/upbdefs-generated/envoy/config/endpoint/v3/load_report.upbdefs.h +55 -0
- data/src/core/ext/upbdefs-generated/envoy/config/listener/v3/api_listener.upbdefs.c +50 -0
- data/src/core/ext/upbdefs-generated/envoy/config/listener/v3/api_listener.upbdefs.h +35 -0
- data/src/core/ext/upbdefs-generated/envoy/config/listener/v3/listener.upbdefs.c +190 -0
- data/src/core/ext/upbdefs-generated/envoy/config/listener/v3/listener.upbdefs.h +55 -0
- data/src/core/ext/upbdefs-generated/envoy/config/listener/v3/listener_components.upbdefs.c +185 -0
- data/src/core/ext/upbdefs-generated/envoy/config/listener/v3/listener_components.upbdefs.h +65 -0
- data/src/core/ext/upbdefs-generated/envoy/config/listener/v3/udp_listener_config.upbdefs.c +62 -0
- data/src/core/ext/upbdefs-generated/envoy/config/listener/v3/udp_listener_config.upbdefs.h +40 -0
- data/src/core/ext/upbdefs-generated/envoy/config/route/v3/route.upbdefs.c +97 -0
- data/src/core/ext/upbdefs-generated/envoy/config/route/v3/route.upbdefs.h +40 -0
- data/src/core/ext/upbdefs-generated/envoy/config/route/v3/route_components.upbdefs.c +915 -0
- data/src/core/ext/upbdefs-generated/envoy/config/route/v3/route_components.upbdefs.h +280 -0
- data/src/core/ext/upbdefs-generated/envoy/config/route/v3/scoped_route.upbdefs.c +71 -0
- data/src/core/ext/upbdefs-generated/envoy/config/route/v3/scoped_route.upbdefs.h +45 -0
- data/src/core/ext/upbdefs-generated/envoy/config/trace/v3/http_tracer.upbdefs.c +64 -0
- data/src/core/ext/upbdefs-generated/envoy/config/trace/v3/http_tracer.upbdefs.h +40 -0
- data/src/core/ext/upbdefs-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upbdefs.c +511 -0
- data/src/core/ext/upbdefs-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upbdefs.h +115 -0
- data/src/core/ext/upbdefs-generated/envoy/extensions/transport_sockets/tls/v3/cert.upbdefs.c +48 -0
- data/src/core/ext/upbdefs-generated/envoy/extensions/transport_sockets/tls/v3/cert.upbdefs.h +30 -0
- data/src/core/ext/upbdefs-generated/envoy/extensions/transport_sockets/tls/v3/common.upbdefs.c +166 -0
- data/src/core/ext/upbdefs-generated/envoy/extensions/transport_sockets/tls/v3/common.upbdefs.h +55 -0
- data/src/core/ext/upbdefs-generated/envoy/extensions/transport_sockets/tls/v3/secret.upbdefs.c +105 -0
- data/src/core/ext/upbdefs-generated/envoy/extensions/transport_sockets/tls/v3/secret.upbdefs.h +45 -0
- data/src/core/ext/upbdefs-generated/envoy/extensions/transport_sockets/tls/v3/tls.upbdefs.c +249 -0
- data/src/core/ext/upbdefs-generated/envoy/extensions/transport_sockets/tls/v3/tls.upbdefs.h +60 -0
- data/src/core/ext/upbdefs-generated/envoy/service/cluster/v3/cds.upbdefs.c +72 -0
- data/src/core/ext/upbdefs-generated/envoy/service/cluster/v3/cds.upbdefs.h +35 -0
- data/src/core/ext/upbdefs-generated/envoy/service/discovery/v3/ads.upbdefs.c +60 -0
- data/src/core/ext/upbdefs-generated/envoy/service/discovery/v3/ads.upbdefs.h +35 -0
- data/src/core/ext/upbdefs-generated/envoy/service/discovery/v3/discovery.upbdefs.c +152 -0
- data/src/core/ext/upbdefs-generated/envoy/service/discovery/v3/discovery.upbdefs.h +60 -0
- data/src/core/ext/upbdefs-generated/envoy/service/endpoint/v3/eds.upbdefs.c +83 -0
- data/src/core/ext/upbdefs-generated/envoy/service/endpoint/v3/eds.upbdefs.h +35 -0
- data/src/core/ext/upbdefs-generated/envoy/service/listener/v3/lds.upbdefs.c +82 -0
- data/src/core/ext/upbdefs-generated/envoy/service/listener/v3/lds.upbdefs.h +35 -0
- data/src/core/ext/upbdefs-generated/envoy/service/load_stats/v3/lrs.upbdefs.c +83 -0
- data/src/core/ext/upbdefs-generated/envoy/service/load_stats/v3/lrs.upbdefs.h +40 -0
- data/src/core/ext/upbdefs-generated/envoy/service/route/v3/rds.upbdefs.c +86 -0
- data/src/core/ext/upbdefs-generated/envoy/service/route/v3/rds.upbdefs.h +35 -0
- data/src/core/ext/upbdefs-generated/envoy/service/route/v3/srds.upbdefs.c +74 -0
- data/src/core/ext/upbdefs-generated/envoy/service/route/v3/srds.upbdefs.h +35 -0
- data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/metadata.upbdefs.c +64 -0
- data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/metadata.upbdefs.h +40 -0
- data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/number.upbdefs.c +54 -0
- data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/number.upbdefs.h +35 -0
- data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/path.upbdefs.c +53 -0
- data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/path.upbdefs.h +35 -0
- data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/regex.upbdefs.c +73 -0
- data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/regex.upbdefs.h +45 -0
- data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/string.upbdefs.c +72 -0
- data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/string.upbdefs.h +40 -0
- data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/value.upbdefs.c +81 -0
- data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/value.upbdefs.h +45 -0
- data/src/core/ext/upbdefs-generated/envoy/type/metadata/v3/metadata.upbdefs.c +92 -0
- data/src/core/ext/upbdefs-generated/envoy/type/metadata/v3/metadata.upbdefs.h +65 -0
- data/src/core/ext/upbdefs-generated/envoy/type/tracing/v3/custom_tag.upbdefs.c +95 -0
- data/src/core/ext/upbdefs-generated/envoy/type/tracing/v3/custom_tag.upbdefs.h +55 -0
- data/src/core/ext/upbdefs-generated/envoy/type/v3/http.upbdefs.c +34 -0
- data/src/core/ext/{upb-generated/gogoproto/gogo.upb.h → upbdefs-generated/envoy/type/v3/http.upbdefs.h} +10 -9
- data/src/core/ext/upbdefs-generated/envoy/type/v3/percent.upbdefs.c +59 -0
- data/src/core/ext/upbdefs-generated/envoy/type/v3/percent.upbdefs.h +40 -0
- data/src/core/ext/upbdefs-generated/envoy/type/v3/range.upbdefs.c +54 -0
- data/src/core/ext/upbdefs-generated/envoy/type/v3/range.upbdefs.h +45 -0
- data/src/core/ext/upbdefs-generated/envoy/type/v3/semantic_version.upbdefs.c +47 -0
- data/src/core/ext/upbdefs-generated/envoy/type/v3/semantic_version.upbdefs.h +35 -0
- data/src/core/ext/upbdefs-generated/google/api/annotations.upbdefs.c +40 -0
- data/src/core/ext/upbdefs-generated/google/api/annotations.upbdefs.h +30 -0
- data/src/core/ext/upbdefs-generated/google/api/http.upbdefs.c +61 -0
- data/src/core/ext/upbdefs-generated/google/api/http.upbdefs.h +45 -0
- data/src/core/ext/upbdefs-generated/google/protobuf/any.upbdefs.c +38 -0
- data/src/core/ext/upbdefs-generated/google/protobuf/any.upbdefs.h +35 -0
- data/src/core/ext/upbdefs-generated/google/protobuf/descriptor.upbdefs.c +386 -0
- data/src/core/ext/upbdefs-generated/google/protobuf/descriptor.upbdefs.h +165 -0
- data/src/core/ext/upbdefs-generated/google/protobuf/duration.upbdefs.c +39 -0
- data/src/core/ext/upbdefs-generated/google/protobuf/duration.upbdefs.h +35 -0
- data/src/core/ext/upbdefs-generated/google/protobuf/empty.upbdefs.c +37 -0
- data/src/core/ext/upbdefs-generated/google/protobuf/empty.upbdefs.h +35 -0
- data/src/core/ext/upbdefs-generated/google/protobuf/struct.upbdefs.c +65 -0
- data/src/core/ext/upbdefs-generated/google/protobuf/struct.upbdefs.h +50 -0
- data/src/core/ext/upbdefs-generated/google/protobuf/timestamp.upbdefs.c +39 -0
- data/src/core/ext/upbdefs-generated/google/protobuf/timestamp.upbdefs.h +35 -0
- data/src/core/ext/upbdefs-generated/google/protobuf/wrappers.upbdefs.c +66 -0
- data/src/core/ext/upbdefs-generated/google/protobuf/wrappers.upbdefs.h +75 -0
- data/src/core/ext/upbdefs-generated/google/rpc/status.upbdefs.c +42 -0
- data/src/core/ext/upbdefs-generated/google/rpc/status.upbdefs.h +35 -0
- data/src/core/ext/upbdefs-generated/udpa/annotations/migrate.upbdefs.c +70 -0
- data/src/core/ext/upbdefs-generated/udpa/annotations/migrate.upbdefs.h +45 -0
- data/src/core/ext/upbdefs-generated/udpa/annotations/security.upbdefs.c +56 -0
- data/src/core/ext/upbdefs-generated/udpa/annotations/security.upbdefs.h +35 -0
- data/src/core/ext/upbdefs-generated/udpa/annotations/sensitive.upbdefs.c +33 -0
- data/src/core/ext/upbdefs-generated/udpa/annotations/sensitive.upbdefs.h +30 -0
- data/src/core/ext/upbdefs-generated/udpa/annotations/status.upbdefs.c +49 -0
- data/src/core/ext/upbdefs-generated/udpa/annotations/status.upbdefs.h +35 -0
- data/src/core/ext/upbdefs-generated/udpa/annotations/versioning.upbdefs.c +43 -0
- data/src/core/ext/upbdefs-generated/udpa/annotations/versioning.upbdefs.h +35 -0
- data/src/core/ext/upbdefs-generated/udpa/core/v1/authority.upbdefs.c +42 -0
- data/src/core/ext/upbdefs-generated/udpa/core/v1/authority.upbdefs.h +35 -0
- data/src/core/ext/upbdefs-generated/udpa/core/v1/collection_entry.upbdefs.c +62 -0
- data/src/core/ext/upbdefs-generated/udpa/core/v1/collection_entry.upbdefs.h +40 -0
- data/src/core/ext/upbdefs-generated/udpa/core/v1/context_params.upbdefs.c +45 -0
- data/src/core/ext/upbdefs-generated/udpa/core/v1/context_params.upbdefs.h +40 -0
- data/src/core/ext/upbdefs-generated/udpa/core/v1/resource.upbdefs.c +49 -0
- data/src/core/ext/upbdefs-generated/udpa/core/v1/resource.upbdefs.h +35 -0
- data/src/core/ext/upbdefs-generated/udpa/core/v1/resource_locator.upbdefs.c +68 -0
- data/src/core/ext/upbdefs-generated/udpa/core/v1/resource_locator.upbdefs.h +40 -0
- data/src/core/ext/upbdefs-generated/udpa/core/v1/resource_name.upbdefs.c +51 -0
- data/src/core/ext/upbdefs-generated/udpa/core/v1/resource_name.upbdefs.h +35 -0
- data/src/core/ext/upbdefs-generated/validate/validate.upbdefs.c +307 -0
- data/src/core/ext/upbdefs-generated/validate/validate.upbdefs.h +145 -0
- data/src/core/ext/xds/certificate_provider_factory.h +61 -0
- data/src/core/ext/xds/certificate_provider_registry.cc +103 -0
- data/src/core/ext/xds/certificate_provider_registry.h +57 -0
- data/src/core/ext/xds/certificate_provider_store.cc +87 -0
- data/src/core/ext/xds/certificate_provider_store.h +112 -0
- data/src/core/ext/xds/file_watcher_certificate_provider_factory.cc +144 -0
- data/src/core/ext/xds/file_watcher_certificate_provider_factory.h +69 -0
- data/src/core/ext/xds/xds_api.cc +2308 -0
- data/src/core/ext/xds/xds_api.h +469 -0
- data/src/core/ext/{filters/client_channel/xds → xds}/xds_bootstrap.cc +208 -19
- data/src/core/ext/{filters/client_channel/xds → xds}/xds_bootstrap.h +31 -11
- data/src/core/ext/xds/xds_certificate_provider.cc +299 -0
- data/src/core/ext/xds/xds_certificate_provider.h +112 -0
- data/src/core/ext/{filters/client_channel/xds → xds}/xds_channel_args.h +9 -6
- data/src/core/ext/{filters/client_channel/xds → xds}/xds_client.cc +656 -865
- data/src/core/ext/{filters/client_channel/xds → xds}/xds_client.h +126 -99
- data/src/core/ext/{filters/client_channel/xds → xds}/xds_client_stats.cc +61 -18
- data/src/core/ext/{filters/client_channel/xds → xds}/xds_client_stats.h +38 -10
- data/src/core/ext/xds/xds_server_config_fetcher.cc +131 -0
- data/src/core/lib/channel/channel_args.cc +9 -8
- data/src/core/lib/channel/channel_args.h +0 -1
- data/src/core/lib/channel/channel_trace.cc +4 -2
- data/src/core/lib/channel/channel_trace.h +1 -1
- data/src/core/lib/channel/channelz.cc +37 -74
- data/src/core/lib/channel/channelz.h +14 -23
- data/src/core/lib/channel/channelz_registry.cc +15 -12
- data/src/core/lib/channel/channelz_registry.h +3 -1
- data/src/core/lib/channel/handshaker.cc +2 -2
- data/src/core/lib/channel/handshaker.h +2 -2
- data/src/core/lib/compression/compression.cc +8 -4
- data/src/core/lib/compression/compression_args.cc +3 -2
- data/src/core/lib/compression/compression_internal.cc +10 -5
- data/src/core/lib/compression/compression_internal.h +2 -1
- data/src/core/lib/compression/stream_compression_identity.cc +1 -3
- data/src/core/lib/debug/stats.h +2 -2
- data/src/core/lib/debug/stats_data.cc +1 -0
- data/src/core/lib/debug/stats_data.h +13 -13
- data/src/core/lib/gpr/alloc.cc +3 -2
- data/src/core/lib/gpr/cpu_iphone.cc +10 -2
- data/src/core/lib/gpr/log.cc +53 -16
- data/src/core/lib/gpr/log_linux.cc +19 -3
- data/src/core/lib/gpr/log_posix.cc +15 -1
- data/src/core/lib/gpr/log_windows.cc +18 -4
- data/src/core/lib/gpr/murmur_hash.cc +1 -1
- data/src/core/lib/gpr/spinlock.h +10 -2
- data/src/core/lib/gpr/string.cc +23 -22
- data/src/core/lib/gpr/string.h +5 -6
- data/src/core/lib/gpr/sync.cc +4 -4
- data/src/core/lib/gpr/sync_posix.cc +2 -8
- data/src/core/lib/gpr/time.cc +12 -12
- data/src/core/lib/gpr/time_precise.cc +5 -2
- data/src/core/lib/gpr/time_precise.h +6 -2
- data/src/core/lib/gpr/tls.h +4 -0
- data/src/core/lib/gpr/tls_msvc.h +2 -0
- data/src/core/lib/gpr/tls_stdcpp.h +48 -0
- data/src/core/lib/gpr/useful.h +5 -4
- data/src/core/lib/gprpp/arena.h +3 -2
- data/src/core/lib/gprpp/dual_ref_counted.h +331 -0
- data/src/core/lib/gprpp/examine_stack.cc +43 -0
- data/src/core/lib/gprpp/examine_stack.h +46 -0
- data/src/core/lib/gprpp/fork.cc +2 -2
- data/src/core/lib/gprpp/manual_constructor.h +1 -1
- data/src/core/lib/gprpp/orphanable.h +4 -8
- data/src/core/lib/gprpp/ref_counted.h +91 -68
- data/src/core/lib/gprpp/ref_counted_ptr.h +166 -7
- data/src/core/lib/gprpp/stat.h +38 -0
- data/src/core/lib/gprpp/stat_posix.cc +49 -0
- data/src/core/lib/gprpp/stat_windows.cc +48 -0
- data/src/core/lib/gprpp/thd.h +2 -2
- data/src/core/lib/gprpp/thd_posix.cc +42 -37
- data/src/core/lib/gprpp/thd_windows.cc +3 -1
- data/src/core/lib/http/httpcli.cc +1 -1
- data/src/core/lib/http/httpcli.h +2 -3
- data/src/core/lib/http/httpcli_security_connector.cc +1 -1
- data/src/core/lib/http/parser.cc +47 -27
- data/src/core/lib/iomgr/call_combiner.cc +8 -5
- data/src/core/lib/iomgr/combiner.cc +2 -1
- data/src/core/lib/iomgr/endpoint.cc +5 -1
- data/src/core/lib/iomgr/endpoint.h +8 -4
- data/src/core/lib/iomgr/endpoint_cfstream.cc +36 -11
- data/src/core/lib/iomgr/error.cc +17 -12
- data/src/core/lib/iomgr/error_internal.h +1 -1
- data/src/core/lib/iomgr/ev_epoll1_linux.cc +20 -13
- data/src/core/lib/iomgr/ev_epollex_linux.cc +25 -17
- data/src/core/lib/iomgr/ev_poll_posix.cc +9 -7
- data/src/core/lib/iomgr/ev_posix.cc +0 -2
- data/src/core/lib/iomgr/exec_ctx.cc +1 -1
- data/src/core/lib/iomgr/exec_ctx.h +16 -12
- data/src/core/lib/iomgr/executor.cc +2 -1
- data/src/core/lib/iomgr/executor.h +1 -1
- data/src/core/lib/iomgr/executor/mpmcqueue.h +5 -5
- data/src/core/lib/iomgr/executor/threadpool.h +4 -4
- data/src/core/lib/iomgr/iomgr.cc +1 -11
- data/src/core/lib/iomgr/iomgr.h +0 -10
- data/src/core/lib/iomgr/load_file.h +1 -1
- data/src/core/lib/iomgr/lockfree_event.cc +19 -14
- data/src/core/lib/iomgr/lockfree_event.h +2 -2
- data/src/core/{ext/filters/client_channel → lib/iomgr}/parse_address.cc +128 -44
- data/src/core/lib/iomgr/parse_address.h +77 -0
- data/src/core/lib/iomgr/poller/eventmanager_libuv.cc +2 -1
- data/src/core/lib/iomgr/poller/eventmanager_libuv.h +1 -1
- data/src/core/lib/iomgr/pollset_set_custom.cc +1 -1
- data/src/core/lib/iomgr/python_util.h +4 -4
- data/src/core/lib/iomgr/resolve_address.cc +4 -4
- data/src/core/lib/iomgr/resolve_address_posix.cc +1 -5
- data/src/core/lib/iomgr/resource_quota.cc +4 -4
- data/src/core/lib/iomgr/sockaddr_utils.cc +12 -11
- data/src/core/lib/iomgr/sockaddr_utils.h +3 -2
- data/src/core/lib/iomgr/socket_factory_posix.cc +3 -2
- data/src/core/lib/iomgr/socket_mutator.cc +3 -2
- data/src/core/lib/iomgr/tcp_client.cc +3 -3
- data/src/core/lib/iomgr/tcp_client_custom.cc +7 -6
- data/src/core/lib/iomgr/tcp_custom.cc +53 -32
- data/src/core/lib/iomgr/tcp_posix.cc +43 -21
- data/src/core/lib/iomgr/tcp_server_custom.cc +28 -22
- data/src/core/lib/iomgr/tcp_windows.cc +26 -10
- data/src/core/lib/iomgr/timer_custom.cc +5 -5
- data/src/core/lib/iomgr/timer_generic.cc +3 -3
- data/src/core/lib/iomgr/timer_manager.cc +2 -2
- data/src/core/lib/iomgr/udp_server.cc +1 -2
- data/src/core/lib/iomgr/udp_server.h +1 -2
- data/src/core/lib/iomgr/unix_sockets_posix.cc +32 -21
- data/src/core/lib/iomgr/unix_sockets_posix.h +5 -0
- data/src/core/lib/iomgr/unix_sockets_posix_noop.cc +7 -0
- data/src/core/lib/iomgr/wakeup_fd_pipe.cc +2 -2
- data/src/core/lib/json/json.h +12 -2
- data/src/core/lib/json/json_reader.cc +8 -4
- data/src/core/lib/json/json_util.cc +58 -0
- data/src/core/lib/json/json_util.h +204 -0
- data/src/core/lib/json/json_writer.cc +2 -1
- data/src/core/lib/security/authorization/authorization_engine.cc +177 -0
- data/src/core/lib/security/authorization/authorization_engine.h +84 -0
- data/src/core/lib/security/authorization/evaluate_args.cc +148 -0
- data/src/core/lib/security/authorization/evaluate_args.h +59 -0
- data/src/core/lib/security/authorization/mock_cel/activation.h +57 -0
- data/src/core/lib/security/authorization/mock_cel/cel_expr_builder_factory.h +44 -0
- data/src/core/lib/security/authorization/mock_cel/cel_expression.h +69 -0
- data/src/core/lib/security/authorization/mock_cel/cel_value.h +97 -0
- data/src/core/lib/security/authorization/mock_cel/evaluator_core.h +67 -0
- data/src/core/lib/security/authorization/mock_cel/flat_expr_builder.h +57 -0
- data/src/core/lib/security/context/security_context.cc +4 -3
- data/src/core/lib/security/context/security_context.h +3 -1
- data/src/core/lib/security/credentials/alts/check_gcp_environment.cc +1 -1
- data/src/core/lib/security/credentials/credentials.cc +7 -7
- data/src/core/lib/security/credentials/credentials.h +3 -3
- data/src/core/lib/security/credentials/external/aws_external_account_credentials.cc +413 -0
- data/src/core/lib/security/credentials/external/aws_external_account_credentials.h +80 -0
- data/src/core/lib/security/credentials/external/aws_request_signer.cc +213 -0
- data/src/core/lib/security/credentials/external/aws_request_signer.h +72 -0
- data/src/core/lib/security/credentials/external/external_account_credentials.cc +497 -0
- data/src/core/lib/security/credentials/external/external_account_credentials.h +120 -0
- data/src/core/lib/security/credentials/external/file_external_account_credentials.cc +135 -0
- data/src/core/lib/security/credentials/external/file_external_account_credentials.h +48 -0
- data/src/core/lib/security/credentials/external/url_external_account_credentials.cc +213 -0
- data/src/core/lib/security/credentials/external/url_external_account_credentials.h +58 -0
- data/src/core/lib/security/credentials/fake/fake_credentials.cc +2 -1
- data/src/core/lib/security/credentials/google_default/google_default_credentials.cc +74 -50
- data/src/core/lib/security/credentials/insecure/insecure_credentials.cc +64 -0
- data/src/core/lib/security/credentials/jwt/json_token.cc +6 -3
- data/src/core/lib/security/credentials/jwt/jwt_credentials.h +4 -3
- data/src/core/lib/security/credentials/jwt/jwt_verifier.cc +8 -4
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc +39 -46
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.h +5 -4
- data/src/core/lib/security/credentials/plugin/plugin_credentials.cc +1 -1
- data/src/core/lib/security/credentials/ssl/ssl_credentials.cc +5 -5
- data/src/core/lib/security/credentials/ssl/ssl_credentials.h +1 -1
- data/src/core/lib/security/credentials/tls/grpc_tls_certificate_distributor.cc +346 -0
- data/src/core/lib/security/credentials/tls/grpc_tls_certificate_distributor.h +213 -0
- data/src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.cc +399 -0
- data/src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.h +138 -0
- data/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.cc +78 -150
- data/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.h +57 -187
- data/src/core/lib/security/credentials/tls/tls_credentials.cc +16 -12
- data/src/core/lib/security/credentials/tls/tls_credentials.h +2 -2
- data/src/core/lib/security/credentials/tls/tls_utils.cc +91 -0
- data/src/core/lib/security/credentials/tls/tls_utils.h +38 -0
- data/src/core/lib/security/credentials/xds/xds_credentials.cc +175 -0
- data/src/core/lib/security/credentials/xds/xds_credentials.h +69 -0
- data/src/core/lib/security/security_connector/alts/alts_security_connector.cc +1 -1
- data/src/core/lib/security/security_connector/fake/fake_security_connector.cc +10 -15
- data/src/core/lib/security/security_connector/insecure/insecure_security_connector.cc +121 -0
- data/src/core/lib/security/security_connector/insecure/insecure_security_connector.h +87 -0
- data/src/core/lib/security/security_connector/load_system_roots.h +4 -0
- data/src/core/lib/security/security_connector/load_system_roots_linux.h +2 -0
- data/src/core/lib/security/security_connector/local/local_security_connector.cc +3 -3
- data/src/core/lib/security/security_connector/security_connector.cc +4 -3
- data/src/core/lib/security/security_connector/security_connector.h +4 -2
- data/src/core/lib/security/security_connector/ssl/ssl_security_connector.cc +4 -4
- data/src/core/lib/security/security_connector/ssl_utils.cc +2 -2
- data/src/core/lib/security/security_connector/ssl_utils.h +19 -19
- data/src/core/lib/security/security_connector/tls/tls_security_connector.cc +342 -279
- data/src/core/lib/security/security_connector/tls/tls_security_connector.h +105 -61
- data/src/core/lib/security/transport/secure_endpoint.cc +9 -3
- data/src/core/lib/security/transport/security_handshaker.cc +3 -3
- data/src/core/lib/security/transport/server_auth_filter.cc +2 -1
- data/src/core/lib/security/util/json_util.h +1 -0
- data/src/core/lib/slice/slice.cc +7 -4
- data/src/core/lib/slice/slice_buffer.cc +2 -1
- data/src/core/lib/slice/slice_intern.cc +6 -7
- data/src/core/lib/slice/slice_internal.h +2 -2
- data/src/core/lib/surface/call.cc +53 -44
- data/src/core/lib/surface/call.h +2 -1
- data/src/core/lib/surface/call_details.cc +8 -8
- data/src/core/lib/surface/channel.cc +53 -61
- data/src/core/lib/surface/channel.h +21 -5
- data/src/core/lib/surface/channel_init.cc +1 -1
- data/src/core/lib/surface/completion_queue.cc +38 -294
- data/src/core/lib/surface/completion_queue.h +16 -24
- data/src/core/lib/surface/init.cc +32 -16
- data/src/core/lib/surface/lame_client.cc +20 -46
- data/src/core/lib/surface/lame_client.h +4 -0
- data/src/core/lib/surface/server.cc +1107 -1239
- data/src/core/lib/surface/server.h +394 -86
- data/src/core/lib/surface/validate_metadata.h +3 -0
- data/src/core/lib/surface/version.cc +2 -2
- data/src/core/lib/transport/authority_override.cc +40 -0
- data/src/core/lib/transport/authority_override.h +37 -0
- data/src/core/lib/transport/bdp_estimator.cc +1 -1
- data/src/core/lib/transport/bdp_estimator.h +2 -1
- data/src/core/lib/transport/byte_stream.h +3 -3
- data/src/core/lib/transport/connectivity_state.cc +18 -13
- data/src/core/lib/transport/connectivity_state.h +26 -12
- data/src/core/lib/transport/error_utils.cc +13 -0
- data/src/core/lib/transport/error_utils.h +7 -1
- data/src/core/lib/transport/metadata.cc +11 -1
- data/src/core/lib/transport/metadata.h +2 -2
- data/src/core/lib/transport/metadata_batch.h +4 -4
- data/src/core/lib/transport/static_metadata.cc +296 -277
- data/src/core/lib/transport/static_metadata.h +80 -73
- data/src/core/lib/transport/status_metadata.cc +4 -3
- data/src/core/lib/transport/timeout_encoding.cc +4 -4
- data/src/core/lib/transport/transport.cc +5 -3
- data/src/core/lib/transport/transport.h +15 -8
- data/src/core/lib/uri/uri_parser.cc +131 -247
- data/src/core/lib/uri/uri_parser.h +58 -20
- data/src/core/plugin_registry/grpc_plugin_registry.cc +41 -20
- data/src/core/tsi/alts/crypt/gsec.cc +5 -4
- data/src/core/tsi/alts/frame_protector/frame_handler.cc +8 -6
- data/src/core/tsi/alts/handshaker/alts_handshaker_client.cc +1 -1
- data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc +49 -26
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_iovec_record_protocol.cc +8 -6
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector.cc +4 -4
- data/src/core/tsi/fake_transport_security.cc +6 -3
- data/src/core/tsi/local_transport_security.cc +5 -1
- data/src/core/tsi/local_transport_security.h +6 -7
- data/src/core/tsi/ssl/session_cache/ssl_session.h +3 -0
- data/src/core/tsi/ssl/session_cache/ssl_session_boringssl.cc +1 -1
- data/src/core/tsi/ssl/session_cache/ssl_session_cache.h +4 -1
- data/src/core/tsi/ssl_transport_security.cc +81 -67
- data/src/core/tsi/ssl_transport_security.h +9 -6
- data/src/core/tsi/transport_security.cc +10 -8
- data/src/core/tsi/transport_security_interface.h +1 -1
- data/src/ruby/ext/grpc/extconf.rb +1 -1
- data/src/ruby/ext/grpc/rb_channel_credentials.c +9 -0
- data/src/ruby/ext/grpc/rb_event_thread.c +2 -0
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +38 -18
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +74 -44
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/src/ruby/pb/src/proto/grpc/testing/messages_pb.rb +28 -0
- data/src/ruby/pb/src/proto/grpc/testing/test_services_pb.rb +18 -0
- data/src/ruby/spec/channel_credentials_spec.rb +10 -0
- data/src/ruby/spec/generic/active_call_spec.rb +19 -8
- data/src/ruby/spec/pb/codegen/package_option_spec.rb +2 -6
- data/third_party/abseil-cpp/absl/algorithm/container.h +1764 -0
- data/third_party/abseil-cpp/absl/base/attributes.h +99 -38
- data/third_party/abseil-cpp/absl/base/call_once.h +1 -1
- data/third_party/abseil-cpp/absl/base/casts.h +9 -6
- data/third_party/abseil-cpp/absl/base/config.h +60 -17
- data/third_party/abseil-cpp/absl/base/dynamic_annotations.h +428 -335
- data/third_party/abseil-cpp/absl/base/internal/bits.h +17 -16
- data/third_party/abseil-cpp/absl/base/internal/direct_mmap.h +166 -0
- data/third_party/abseil-cpp/absl/base/internal/dynamic_annotations.h +398 -0
- data/third_party/abseil-cpp/absl/base/internal/exponential_biased.cc +93 -0
- data/third_party/abseil-cpp/absl/base/internal/exponential_biased.h +130 -0
- data/third_party/abseil-cpp/absl/base/internal/invoke.h +4 -4
- data/third_party/abseil-cpp/absl/base/internal/low_level_alloc.cc +620 -0
- data/third_party/abseil-cpp/absl/base/internal/low_level_alloc.h +126 -0
- data/third_party/abseil-cpp/absl/base/internal/low_level_scheduling.h +29 -1
- data/third_party/abseil-cpp/absl/base/internal/raw_logging.cc +2 -2
- data/third_party/abseil-cpp/absl/base/internal/raw_logging.h +7 -5
- data/third_party/abseil-cpp/absl/base/internal/spinlock.cc +25 -38
- data/third_party/abseil-cpp/absl/base/internal/spinlock.h +19 -25
- data/third_party/abseil-cpp/absl/base/internal/spinlock_linux.inc +8 -0
- data/third_party/abseil-cpp/absl/base/internal/sysinfo.cc +28 -5
- data/third_party/abseil-cpp/absl/base/internal/sysinfo.h +8 -0
- data/third_party/abseil-cpp/absl/base/internal/tsan_mutex_interface.h +3 -1
- data/third_party/abseil-cpp/absl/base/internal/unaligned_access.h +2 -2
- data/third_party/abseil-cpp/absl/base/internal/unscaledcycleclock.h +3 -3
- data/third_party/abseil-cpp/absl/base/macros.h +36 -109
- data/third_party/abseil-cpp/absl/base/optimization.h +61 -1
- data/third_party/abseil-cpp/absl/base/options.h +31 -4
- data/third_party/abseil-cpp/absl/base/policy_checks.h +1 -1
- data/third_party/abseil-cpp/absl/base/thread_annotations.h +94 -39
- data/third_party/abseil-cpp/absl/container/fixed_array.h +532 -0
- data/third_party/abseil-cpp/absl/container/flat_hash_map.h +606 -0
- data/third_party/abseil-cpp/absl/container/flat_hash_set.h +504 -0
- data/third_party/abseil-cpp/absl/container/inlined_vector.h +33 -36
- data/third_party/abseil-cpp/absl/container/internal/common.h +206 -0
- data/third_party/abseil-cpp/absl/container/internal/compressed_tuple.h +33 -8
- data/third_party/abseil-cpp/absl/container/internal/container_memory.h +460 -0
- data/third_party/abseil-cpp/absl/container/internal/hash_function_defaults.h +161 -0
- data/third_party/abseil-cpp/absl/container/internal/hash_policy_traits.h +208 -0
- data/third_party/abseil-cpp/absl/container/internal/hashtable_debug_hooks.h +85 -0
- data/third_party/abseil-cpp/absl/container/internal/hashtablez_sampler.cc +270 -0
- data/third_party/abseil-cpp/absl/container/internal/hashtablez_sampler.h +321 -0
- data/third_party/abseil-cpp/absl/container/internal/hashtablez_sampler_force_weak_definition.cc +30 -0
- data/third_party/abseil-cpp/absl/container/internal/have_sse.h +50 -0
- data/third_party/abseil-cpp/absl/container/internal/layout.h +743 -0
- data/third_party/abseil-cpp/absl/container/internal/raw_hash_map.h +197 -0
- data/third_party/abseil-cpp/absl/container/internal/raw_hash_set.cc +48 -0
- data/third_party/abseil-cpp/absl/container/internal/raw_hash_set.h +1903 -0
- data/third_party/abseil-cpp/absl/debugging/internal/address_is_readable.cc +139 -0
- data/third_party/abseil-cpp/absl/debugging/internal/address_is_readable.h +32 -0
- data/third_party/abseil-cpp/absl/debugging/internal/demangle.cc +1945 -0
- data/third_party/abseil-cpp/absl/debugging/internal/demangle.h +71 -0
- data/third_party/abseil-cpp/absl/debugging/internal/elf_mem_image.cc +382 -0
- data/third_party/abseil-cpp/absl/debugging/internal/elf_mem_image.h +134 -0
- data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_aarch64-inl.inc +196 -0
- data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_arm-inl.inc +134 -0
- data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_config.h +89 -0
- data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_generic-inl.inc +108 -0
- data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_powerpc-inl.inc +248 -0
- data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_unimplemented-inl.inc +24 -0
- data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_win32-inl.inc +93 -0
- data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_x86-inl.inc +346 -0
- data/third_party/abseil-cpp/absl/debugging/internal/symbolize.h +149 -0
- data/third_party/abseil-cpp/absl/debugging/internal/vdso_support.cc +173 -0
- data/third_party/abseil-cpp/absl/debugging/internal/vdso_support.h +158 -0
- data/third_party/abseil-cpp/absl/debugging/stacktrace.cc +140 -0
- data/third_party/abseil-cpp/absl/debugging/stacktrace.h +231 -0
- data/third_party/abseil-cpp/absl/debugging/symbolize.cc +36 -0
- data/third_party/abseil-cpp/absl/debugging/symbolize.h +99 -0
- data/third_party/abseil-cpp/absl/debugging/symbolize_darwin.inc +101 -0
- data/third_party/abseil-cpp/absl/debugging/symbolize_elf.inc +1560 -0
- data/third_party/abseil-cpp/absl/debugging/symbolize_unimplemented.inc +40 -0
- data/third_party/abseil-cpp/absl/debugging/symbolize_win32.inc +81 -0
- data/third_party/abseil-cpp/absl/functional/bind_front.h +184 -0
- data/third_party/abseil-cpp/absl/functional/function_ref.h +139 -0
- data/third_party/abseil-cpp/absl/functional/internal/front_binder.h +95 -0
- data/third_party/abseil-cpp/absl/functional/internal/function_ref.h +106 -0
- data/third_party/abseil-cpp/absl/hash/hash.h +325 -0
- data/third_party/abseil-cpp/absl/hash/internal/city.cc +346 -0
- data/third_party/abseil-cpp/absl/hash/internal/city.h +96 -0
- data/third_party/abseil-cpp/absl/hash/internal/hash.cc +55 -0
- data/third_party/abseil-cpp/absl/hash/internal/hash.h +996 -0
- data/third_party/abseil-cpp/absl/memory/memory.h +4 -0
- data/third_party/abseil-cpp/absl/meta/type_traits.h +2 -8
- data/third_party/abseil-cpp/absl/numeric/int128.cc +13 -27
- data/third_party/abseil-cpp/absl/numeric/int128.h +16 -15
- data/third_party/abseil-cpp/absl/status/internal/status_internal.h +51 -0
- data/third_party/abseil-cpp/absl/status/internal/statusor_internal.h +399 -0
- data/third_party/abseil-cpp/absl/status/status.cc +445 -0
- data/third_party/abseil-cpp/absl/status/status.h +817 -0
- data/third_party/abseil-cpp/absl/status/status_payload_printer.cc +38 -0
- data/third_party/abseil-cpp/absl/status/status_payload_printer.h +51 -0
- data/third_party/abseil-cpp/absl/status/statusor.cc +71 -0
- data/third_party/abseil-cpp/absl/status/statusor.h +760 -0
- data/third_party/abseil-cpp/absl/strings/charconv.cc +2 -2
- data/third_party/abseil-cpp/absl/strings/cord.cc +1998 -0
- data/third_party/abseil-cpp/absl/strings/cord.h +1276 -0
- data/third_party/abseil-cpp/absl/strings/escaping.cc +9 -9
- data/third_party/abseil-cpp/absl/strings/internal/char_map.h +1 -1
- data/third_party/abseil-cpp/absl/strings/internal/charconv_bigint.cc +1 -1
- data/third_party/abseil-cpp/absl/strings/internal/charconv_bigint.h +2 -2
- data/third_party/abseil-cpp/absl/strings/internal/charconv_parse.cc +2 -2
- data/third_party/abseil-cpp/absl/strings/internal/cord_internal.h +173 -0
- data/third_party/abseil-cpp/absl/strings/internal/str_format/arg.cc +222 -136
- data/third_party/abseil-cpp/absl/strings/internal/str_format/arg.h +136 -64
- data/third_party/abseil-cpp/absl/strings/internal/str_format/bind.cc +1 -1
- data/third_party/abseil-cpp/absl/strings/internal/str_format/bind.h +14 -21
- data/third_party/abseil-cpp/absl/strings/internal/str_format/checker.h +7 -14
- data/third_party/abseil-cpp/absl/strings/internal/str_format/extension.cc +31 -7
- data/third_party/abseil-cpp/absl/strings/internal/str_format/extension.h +147 -135
- data/third_party/abseil-cpp/absl/strings/internal/str_format/float_conversion.cc +999 -87
- data/third_party/abseil-cpp/absl/strings/internal/str_format/float_conversion.h +3 -3
- data/third_party/abseil-cpp/absl/strings/internal/str_format/output.h +4 -12
- data/third_party/abseil-cpp/absl/strings/internal/str_format/parser.cc +8 -6
- data/third_party/abseil-cpp/absl/strings/internal/str_format/parser.h +13 -11
- data/third_party/abseil-cpp/absl/strings/internal/str_split_internal.h +2 -2
- data/third_party/abseil-cpp/absl/strings/str_cat.cc +4 -4
- data/third_party/abseil-cpp/absl/strings/str_cat.h +1 -1
- data/third_party/abseil-cpp/absl/strings/str_format.h +289 -13
- data/third_party/abseil-cpp/absl/strings/str_split.cc +2 -2
- data/third_party/abseil-cpp/absl/strings/str_split.h +1 -0
- data/third_party/abseil-cpp/absl/strings/string_view.h +26 -19
- data/third_party/abseil-cpp/absl/strings/substitute.cc +5 -5
- data/third_party/abseil-cpp/absl/strings/substitute.h +32 -29
- data/third_party/abseil-cpp/absl/synchronization/barrier.cc +52 -0
- data/third_party/abseil-cpp/absl/synchronization/barrier.h +79 -0
- data/third_party/abseil-cpp/absl/synchronization/blocking_counter.cc +57 -0
- data/third_party/abseil-cpp/absl/synchronization/blocking_counter.h +99 -0
- data/third_party/abseil-cpp/absl/synchronization/internal/create_thread_identity.cc +140 -0
- data/third_party/abseil-cpp/absl/synchronization/internal/create_thread_identity.h +60 -0
- data/third_party/abseil-cpp/absl/synchronization/internal/graphcycles.cc +697 -0
- data/third_party/abseil-cpp/absl/synchronization/internal/graphcycles.h +141 -0
- data/third_party/abseil-cpp/absl/synchronization/internal/kernel_timeout.h +155 -0
- data/third_party/abseil-cpp/absl/synchronization/internal/mutex_nonprod.inc +249 -0
- data/third_party/abseil-cpp/absl/synchronization/internal/per_thread_sem.cc +106 -0
- data/third_party/abseil-cpp/absl/synchronization/internal/per_thread_sem.h +115 -0
- data/third_party/abseil-cpp/absl/synchronization/internal/waiter.cc +492 -0
- data/third_party/abseil-cpp/absl/synchronization/internal/waiter.h +159 -0
- data/third_party/abseil-cpp/absl/synchronization/mutex.cc +2739 -0
- data/third_party/abseil-cpp/absl/synchronization/mutex.h +1065 -0
- data/third_party/abseil-cpp/absl/synchronization/notification.cc +78 -0
- data/third_party/abseil-cpp/absl/synchronization/notification.h +123 -0
- data/third_party/abseil-cpp/absl/time/civil_time.cc +9 -9
- data/third_party/abseil-cpp/absl/time/clock.cc +3 -3
- data/third_party/abseil-cpp/absl/time/duration.cc +90 -59
- data/third_party/abseil-cpp/absl/time/format.cc +43 -36
- data/third_party/abseil-cpp/absl/time/internal/cctz/include/cctz/civil_time_detail.h +26 -16
- data/third_party/abseil-cpp/absl/time/internal/cctz/include/cctz/time_zone.h +4 -2
- data/third_party/abseil-cpp/absl/time/internal/cctz/include/cctz/zone_info_source.h +1 -1
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_format.cc +136 -29
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_impl.cc +13 -21
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_impl.h +1 -1
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_info.cc +136 -129
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_info.h +4 -5
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_libc.cc +8 -7
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/tzfile.h +6 -6
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/zone_info_source.cc +2 -1
- data/third_party/abseil-cpp/absl/time/time.h +15 -16
- data/third_party/abseil-cpp/absl/types/bad_variant_access.cc +64 -0
- data/third_party/abseil-cpp/absl/types/bad_variant_access.h +82 -0
- data/third_party/abseil-cpp/absl/types/internal/variant.h +1646 -0
- data/third_party/abseil-cpp/absl/types/optional.h +9 -9
- data/third_party/abseil-cpp/absl/types/span.h +49 -36
- data/third_party/abseil-cpp/absl/types/variant.h +861 -0
- data/third_party/abseil-cpp/absl/utility/utility.h +2 -2
- data/third_party/address_sorting/include/address_sorting/address_sorting.h +2 -0
- data/third_party/boringssl-with-bazel/err_data.c +479 -467
- data/third_party/boringssl-with-bazel/src/crypto/asn1/asn1_lib.c +0 -6
- data/third_party/boringssl-with-bazel/src/crypto/bio/bio.c +2 -0
- data/third_party/boringssl-with-bazel/src/crypto/dsa/dsa.c +9 -43
- data/third_party/boringssl-with-bazel/src/crypto/dsa/dsa_asn1.c +55 -4
- data/third_party/boringssl-with-bazel/src/crypto/dsa/internal.h +34 -0
- data/third_party/boringssl-with-bazel/src/crypto/evp/evp.c +4 -0
- data/third_party/boringssl-with-bazel/src/crypto/evp/evp_asn1.c +16 -0
- data/third_party/boringssl-with-bazel/src/crypto/evp/p_dsa_asn1.c +6 -2
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/cipher/e_aes.c +173 -35
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/digest/digest.c +2 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/internal.h +4 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/rsa.c +30 -10
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/rsa_impl.c +56 -22
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/self_check/self_check.c +8 -2
- data/third_party/boringssl-with-bazel/src/crypto/hpke/hpke.c +543 -0
- data/third_party/boringssl-with-bazel/src/crypto/hpke/internal.h +237 -0
- data/third_party/boringssl-with-bazel/src/crypto/trust_token/internal.h +118 -49
- data/third_party/boringssl-with-bazel/src/crypto/trust_token/pmbtoken.c +267 -95
- data/third_party/boringssl-with-bazel/src/crypto/trust_token/trust_token.c +210 -34
- data/third_party/boringssl-with-bazel/src/crypto/trust_token/voprf.c +766 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509/a_strex.c +3 -3
- data/third_party/boringssl-with-bazel/src/crypto/x509/algorithm.c +6 -4
- data/third_party/boringssl-with-bazel/src/crypto/x509/t_crl.c +3 -3
- data/third_party/boringssl-with-bazel/src/crypto/x509/t_x509.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_cmp.c +7 -2
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_ext.c +21 -18
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_obj.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_set.c +24 -3
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_trs.c +3 -3
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_txt.c +67 -67
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_v3.c +3 -3
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_vfy.c +29 -35
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509cset.c +13 -2
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509name.c +9 -8
- data/third_party/boringssl-with-bazel/src/crypto/x509/x_all.c +10 -10
- data/third_party/boringssl-with-bazel/src/crypto/x509/x_crl.c +2 -2
- data/third_party/boringssl-with-bazel/src/crypto/x509/x_name.c +28 -40
- data/third_party/boringssl-with-bazel/src/crypto/x509/x_sig.c +20 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509/x_x509.c +3 -1
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/ext_dat.h +1 -4
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/pcy_data.c +5 -3
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_alt.c +14 -14
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_conf.c +7 -3
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_genn.c +2 -2
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_info.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_prn.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_purp.c +55 -8
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_skey.c +1 -1
- data/third_party/boringssl-with-bazel/src/include/openssl/aead.h +24 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/arm_arch.h +54 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/asn1.h +0 -1
- data/third_party/boringssl-with-bazel/src/include/openssl/base.h +6 -3
- data/third_party/boringssl-with-bazel/src/include/openssl/bio.h +4 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/cipher.h +6 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/crypto.h +1 -1
- data/third_party/boringssl-with-bazel/src/include/openssl/des.h +6 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/dh.h +12 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/digest.h +9 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/evp.h +4 -1
- data/third_party/boringssl-with-bazel/src/include/openssl/opensslconf.h +3 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/pem.h +202 -134
- data/third_party/boringssl-with-bazel/src/include/openssl/ssl.h +103 -10
- data/third_party/boringssl-with-bazel/src/include/openssl/tls1.h +5 -2
- data/third_party/boringssl-with-bazel/src/include/openssl/trust_token.h +42 -14
- data/third_party/boringssl-with-bazel/src/include/openssl/x509.h +199 -78
- data/third_party/boringssl-with-bazel/src/include/openssl/x509v3.h +482 -432
- data/third_party/boringssl-with-bazel/src/ssl/bio_ssl.cc +18 -5
- data/third_party/boringssl-with-bazel/src/ssl/handoff.cc +35 -0
- data/third_party/boringssl-with-bazel/src/ssl/handshake.cc +18 -18
- data/third_party/boringssl-with-bazel/src/ssl/handshake_client.cc +2 -3
- data/third_party/boringssl-with-bazel/src/ssl/handshake_server.cc +1 -1
- data/third_party/boringssl-with-bazel/src/ssl/internal.h +49 -10
- data/third_party/boringssl-with-bazel/src/ssl/ssl_asn1.cc +42 -1
- data/third_party/boringssl-with-bazel/src/ssl/ssl_cert.cc +3 -6
- data/third_party/boringssl-with-bazel/src/ssl/ssl_cipher.cc +8 -9
- data/third_party/boringssl-with-bazel/src/ssl/ssl_lib.cc +77 -0
- data/third_party/boringssl-with-bazel/src/ssl/ssl_session.cc +11 -14
- data/third_party/boringssl-with-bazel/src/ssl/t1_lib.cc +250 -20
- data/third_party/boringssl-with-bazel/src/ssl/tls13_both.cc +1 -2
- data/third_party/boringssl-with-bazel/src/ssl/tls13_client.cc +57 -19
- data/third_party/boringssl-with-bazel/src/ssl/tls13_server.cc +140 -41
- data/third_party/boringssl-with-bazel/src/ssl/tls_record.cc +5 -3
- data/third_party/upb/third_party/wyhash/wyhash.h +145 -0
- data/third_party/upb/upb/decode.c +275 -145
- data/third_party/upb/upb/decode.h +20 -1
- data/third_party/upb/upb/decode.int.h +163 -0
- data/third_party/upb/upb/decode_fast.c +1040 -0
- data/third_party/upb/upb/decode_fast.h +126 -0
- data/third_party/upb/upb/def.c +2178 -0
- data/third_party/upb/upb/def.h +315 -0
- data/third_party/upb/upb/def.hpp +439 -0
- data/third_party/upb/upb/encode.c +229 -171
- data/third_party/upb/upb/encode.h +27 -2
- data/third_party/upb/upb/json_decode.c +1443 -0
- data/third_party/upb/upb/json_decode.h +23 -0
- data/third_party/upb/upb/json_encode.c +713 -0
- data/third_party/upb/upb/json_encode.h +36 -0
- data/third_party/upb/upb/msg.c +167 -88
- data/third_party/upb/upb/msg.h +175 -35
- data/third_party/upb/upb/port_def.inc +75 -62
- data/third_party/upb/upb/port_undef.inc +3 -7
- data/third_party/upb/upb/reflection.c +408 -0
- data/third_party/upb/upb/reflection.h +168 -0
- data/third_party/upb/upb/table.c +34 -208
- data/third_party/upb/upb/table.int.h +14 -14
- data/third_party/upb/upb/text_encode.c +421 -0
- data/third_party/upb/upb/text_encode.h +38 -0
- data/third_party/upb/upb/upb.c +33 -54
- data/third_party/upb/upb/upb.h +56 -1
- data/third_party/upb/upb/upb.hpp +6 -4
- data/third_party/upb/upb/upb.int.h +29 -0
- metadata +508 -172
- data/src/core/ext/filters/client_channel/lb_policy/xds/eds.cc +0 -938
- data/src/core/ext/filters/client_channel/lb_policy/xds/lrs.cc +0 -528
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_routing.cc +0 -1143
- data/src/core/ext/filters/client_channel/parse_address.h +0 -53
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.cc +0 -485
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_fallback.cc +0 -68
- data/src/core/ext/filters/client_channel/resolving_lb_policy.cc +0 -353
- data/src/core/ext/filters/client_channel/resolving_lb_policy.h +0 -142
- data/src/core/ext/filters/client_channel/xds/xds_api.cc +0 -2110
- data/src/core/ext/filters/client_channel/xds/xds_api.h +0 -345
- data/src/core/ext/filters/client_channel/xds/xds_channel.h +0 -46
- data/src/core/ext/filters/client_channel/xds/xds_channel_secure.cc +0 -106
- data/src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.c +0 -21
- data/src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.h +0 -34
- data/src/core/ext/upb-generated/envoy/api/v2/auth/common.upb.c +0 -114
- data/src/core/ext/upb-generated/envoy/api/v2/auth/common.upb.h +0 -429
- data/src/core/ext/upb-generated/envoy/api/v2/auth/secret.upb.c +0 -72
- data/src/core/ext/upb-generated/envoy/api/v2/auth/secret.upb.h +0 -198
- data/src/core/ext/upb-generated/envoy/api/v2/auth/tls.upb.c +0 -105
- data/src/core/ext/upb-generated/envoy/api/v2/auth/tls.upb.h +0 -388
- data/src/core/ext/upb-generated/envoy/api/v2/cds.upb.h +0 -52
- data/src/core/ext/upb-generated/envoy/api/v2/cluster.upb.c +0 -403
- data/src/core/ext/upb-generated/envoy/api/v2/cluster.upb.h +0 -1453
- data/src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.c +0 -74
- data/src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.h +0 -226
- data/src/core/ext/upb-generated/envoy/api/v2/cluster/filter.upb.c +0 -35
- data/src/core/ext/upb-generated/envoy/api/v2/cluster/filter.upb.h +0 -69
- data/src/core/ext/upb-generated/envoy/api/v2/cluster/outlier_detection.upb.c +0 -55
- data/src/core/ext/upb-generated/envoy/api/v2/cluster/outlier_detection.upb.h +0 -323
- data/src/core/ext/upb-generated/envoy/api/v2/core/address.upb.c +0 -112
- data/src/core/ext/upb-generated/envoy/api/v2/core/address.upb.h +0 -334
- data/src/core/ext/upb-generated/envoy/api/v2/core/backoff.upb.c +0 -35
- data/src/core/ext/upb-generated/envoy/api/v2/core/backoff.upb.h +0 -79
- data/src/core/ext/upb-generated/envoy/api/v2/core/base.upb.c +0 -313
- data/src/core/ext/upb-generated/envoy/api/v2/core/base.upb.h +0 -891
- data/src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.c +0 -96
- data/src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.h +0 -328
- data/src/core/ext/upb-generated/envoy/api/v2/core/event_service_config.upb.c +0 -34
- data/src/core/ext/upb-generated/envoy/api/v2/core/event_service_config.upb.h +0 -71
- data/src/core/ext/upb-generated/envoy/api/v2/core/grpc_service.upb.c +0 -197
- data/src/core/ext/upb-generated/envoy/api/v2/core/grpc_service.upb.h +0 -649
- data/src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.c +0 -172
- data/src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.h +0 -693
- data/src/core/ext/upb-generated/envoy/api/v2/core/http_uri.upb.c +0 -36
- data/src/core/ext/upb-generated/envoy/api/v2/core/http_uri.upb.h +0 -80
- data/src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.c +0 -152
- data/src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.h +0 -536
- data/src/core/ext/upb-generated/envoy/api/v2/core/socket_option.upb.h +0 -88
- data/src/core/ext/upb-generated/envoy/api/v2/discovery.upb.c +0 -129
- data/src/core/ext/upb-generated/envoy/api/v2/discovery.upb.h +0 -386
- data/src/core/ext/upb-generated/envoy/api/v2/eds.upb.h +0 -52
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint.upb.c +0 -92
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint.upb.h +0 -224
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint.upb.c +0 -18
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint.upb.h +0 -32
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint_components.upb.c +0 -91
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint_components.upb.h +0 -273
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint/load_report.upb.c +0 -112
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint/load_report.upb.h +0 -332
- data/src/core/ext/upb-generated/envoy/api/v2/lds.upb.h +0 -52
- data/src/core/ext/upb-generated/envoy/api/v2/listener.upb.c +0 -109
- data/src/core/ext/upb-generated/envoy/api/v2/listener.upb.h +0 -415
- data/src/core/ext/upb-generated/envoy/api/v2/listener/listener.upb.c +0 -18
- data/src/core/ext/upb-generated/envoy/api/v2/listener/listener.upb.h +0 -32
- data/src/core/ext/upb-generated/envoy/api/v2/listener/listener_components.upb.c +0 -145
- data/src/core/ext/upb-generated/envoy/api/v2/listener/listener_components.upb.h +0 -538
- data/src/core/ext/upb-generated/envoy/api/v2/listener/udp_listener_config.upb.c +0 -43
- data/src/core/ext/upb-generated/envoy/api/v2/listener/udp_listener_config.upb.h +0 -111
- data/src/core/ext/upb-generated/envoy/api/v2/rds.upb.h +0 -52
- data/src/core/ext/upb-generated/envoy/api/v2/route.upb.c +0 -63
- data/src/core/ext/upb-generated/envoy/api/v2/route.upb.h +0 -204
- data/src/core/ext/upb-generated/envoy/api/v2/route/route.upb.c +0 -18
- data/src/core/ext/upb-generated/envoy/api/v2/route/route.upb.h +0 -32
- data/src/core/ext/upb-generated/envoy/api/v2/route/route_components.upb.c +0 -815
- data/src/core/ext/upb-generated/envoy/api/v2/route/route_components.upb.h +0 -2984
- data/src/core/ext/upb-generated/envoy/api/v2/scoped_route.upb.c +0 -59
- data/src/core/ext/upb-generated/envoy/api/v2/scoped_route.upb.h +0 -135
- data/src/core/ext/upb-generated/envoy/api/v2/srds.upb.h +0 -52
- data/src/core/ext/upb-generated/envoy/config/filter/accesslog/v2/accesslog.upb.c +0 -228
- data/src/core/ext/upb-generated/envoy/config/filter/accesslog/v2/accesslog.upb.h +0 -732
- data/src/core/ext/upb-generated/envoy/config/filter/network/http_connection_manager/v2/http_connection_manager.upb.c +0 -316
- data/src/core/ext/upb-generated/envoy/config/filter/network/http_connection_manager/v2/http_connection_manager.upb.h +0 -1167
- data/src/core/ext/upb-generated/envoy/config/listener/v2/api_listener.upb.c +0 -33
- data/src/core/ext/upb-generated/envoy/config/listener/v2/api_listener.upb.h +0 -65
- data/src/core/ext/upb-generated/envoy/config/trace/v2/http_tracer.upb.c +0 -51
- data/src/core/ext/upb-generated/envoy/config/trace/v2/http_tracer.upb.h +0 -125
- data/src/core/ext/upb-generated/envoy/service/discovery/v2/ads.upb.h +0 -49
- data/src/core/ext/upb-generated/envoy/service/load_stats/v2/lrs.upb.c +0 -54
- data/src/core/ext/upb-generated/envoy/service/load_stats/v2/lrs.upb.h +0 -136
- data/src/core/ext/upb-generated/envoy/type/matcher/regex.upb.c +0 -63
- data/src/core/ext/upb-generated/envoy/type/matcher/regex.upb.h +0 -145
- data/src/core/ext/upb-generated/envoy/type/matcher/string.upb.c +0 -53
- data/src/core/ext/upb-generated/envoy/type/matcher/string.upb.h +0 -133
- data/src/core/ext/upb-generated/envoy/type/metadata/v2/metadata.upb.c +0 -88
- data/src/core/ext/upb-generated/envoy/type/metadata/v2/metadata.upb.h +0 -258
- data/src/core/ext/upb-generated/envoy/type/percent.upb.c +0 -39
- data/src/core/ext/upb-generated/envoy/type/percent.upb.h +0 -86
- data/src/core/ext/upb-generated/envoy/type/range.upb.c +0 -50
- data/src/core/ext/upb-generated/envoy/type/range.upb.h +0 -111
- data/src/core/ext/upb-generated/envoy/type/semantic_version.upb.h +0 -61
- data/src/core/ext/upb-generated/envoy/type/tracing/v2/custom_tag.upb.c +0 -89
- data/src/core/ext/upb-generated/envoy/type/tracing/v2/custom_tag.upb.h +0 -250
- data/src/core/ext/upb-generated/gogoproto/gogo.upb.c +0 -17
- data/src/core/lib/gprpp/map.h +0 -53
- data/src/core/lib/security/transport/target_authority_table.cc +0 -75
- data/src/core/lib/security/transport/target_authority_table.h +0 -40
- data/src/core/lib/slice/slice_hash_table.h +0 -199
- data/src/core/lib/slice/slice_weak_hash_table.h +0 -102
- data/third_party/abseil-cpp/absl/base/dynamic_annotations.cc +0 -129
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_pku.c +0 -110
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_sxnet.c +0 -274
- data/third_party/upb/upb/port.c +0 -26
@@ -0,0 +1,112 @@
|
|
1
|
+
//
|
2
|
+
//
|
3
|
+
// Copyright 2020 gRPC authors.
|
4
|
+
//
|
5
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
// you may not use this file except in compliance with the License.
|
7
|
+
// You may obtain a copy of the License at
|
8
|
+
//
|
9
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
//
|
11
|
+
// Unless required by applicable law or agreed to in writing, software
|
12
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
// See the License for the specific language governing permissions and
|
15
|
+
// limitations under the License.
|
16
|
+
//
|
17
|
+
//
|
18
|
+
|
19
|
+
#ifndef GRPC_CORE_EXT_XDS_CERTIFICATE_PROVIDER_STORE_H
|
20
|
+
#define GRPC_CORE_EXT_XDS_CERTIFICATE_PROVIDER_STORE_H
|
21
|
+
|
22
|
+
#include <grpc/support/port_platform.h>
|
23
|
+
|
24
|
+
#include <map>
|
25
|
+
|
26
|
+
#include "absl/strings/string_view.h"
|
27
|
+
|
28
|
+
#include "src/core/ext/xds/certificate_provider_factory.h"
|
29
|
+
#include "src/core/lib/gprpp/orphanable.h"
|
30
|
+
#include "src/core/lib/gprpp/ref_counted_ptr.h"
|
31
|
+
#include "src/core/lib/gprpp/sync.h"
|
32
|
+
#include "src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.h"
|
33
|
+
|
34
|
+
namespace grpc_core {
|
35
|
+
|
36
|
+
// Map for xDS based grpc_tls_certificate_provider instances.
|
37
|
+
class CertificateProviderStore
|
38
|
+
: public InternallyRefCounted<CertificateProviderStore> {
|
39
|
+
public:
|
40
|
+
struct PluginDefinition {
|
41
|
+
std::string plugin_name;
|
42
|
+
RefCountedPtr<CertificateProviderFactory::Config> config;
|
43
|
+
};
|
44
|
+
|
45
|
+
// Maps plugin instance (opaque) name to plugin defition.
|
46
|
+
typedef std::map<std::string, PluginDefinition> PluginDefinitionMap;
|
47
|
+
|
48
|
+
explicit CertificateProviderStore(PluginDefinitionMap plugin_config_map)
|
49
|
+
: plugin_config_map_(std::move(plugin_config_map)) {}
|
50
|
+
|
51
|
+
// If a certificate provider corresponding to the instance name \a key is
|
52
|
+
// found, a ref to the grpc_tls_certificate_provider is returned. If no
|
53
|
+
// provider is found for the key, a new provider is created from the plugin
|
54
|
+
// definition map.
|
55
|
+
// Returns nullptr on failure to get or create a new certificate provider.
|
56
|
+
RefCountedPtr<grpc_tls_certificate_provider> CreateOrGetCertificateProvider(
|
57
|
+
absl::string_view key);
|
58
|
+
|
59
|
+
void Orphan() override { Unref(); }
|
60
|
+
|
61
|
+
private:
|
62
|
+
// A thin wrapper around `grpc_tls_certificate_provider` which allows removing
|
63
|
+
// the entry from the CertificateProviderStore when the refcount reaches zero.
|
64
|
+
class CertificateProviderWrapper : public grpc_tls_certificate_provider {
|
65
|
+
public:
|
66
|
+
CertificateProviderWrapper(
|
67
|
+
RefCountedPtr<grpc_tls_certificate_provider> certificate_provider,
|
68
|
+
RefCountedPtr<CertificateProviderStore> store, absl::string_view key)
|
69
|
+
: certificate_provider_(std::move(certificate_provider)),
|
70
|
+
store_(std::move(store)),
|
71
|
+
key_(key) {}
|
72
|
+
|
73
|
+
~CertificateProviderWrapper() override {
|
74
|
+
store_->ReleaseCertificateProvider(key_, this);
|
75
|
+
}
|
76
|
+
|
77
|
+
grpc_core::RefCountedPtr<grpc_tls_certificate_distributor> distributor()
|
78
|
+
const override {
|
79
|
+
return certificate_provider_->distributor();
|
80
|
+
}
|
81
|
+
|
82
|
+
grpc_pollset_set* interested_parties() const override {
|
83
|
+
return certificate_provider_->interested_parties();
|
84
|
+
}
|
85
|
+
|
86
|
+
absl::string_view key() const { return key_; }
|
87
|
+
|
88
|
+
private:
|
89
|
+
RefCountedPtr<grpc_tls_certificate_provider> certificate_provider_;
|
90
|
+
RefCountedPtr<CertificateProviderStore> store_;
|
91
|
+
absl::string_view key_;
|
92
|
+
};
|
93
|
+
|
94
|
+
RefCountedPtr<CertificateProviderWrapper> CreateCertificateProviderLocked(
|
95
|
+
absl::string_view key);
|
96
|
+
|
97
|
+
// Releases a previously created certificate provider from the certificate
|
98
|
+
// provider map if the value matches \a wrapper.
|
99
|
+
void ReleaseCertificateProvider(absl::string_view key,
|
100
|
+
CertificateProviderWrapper* wrapper);
|
101
|
+
|
102
|
+
Mutex mu_;
|
103
|
+
// Map of plugin configurations
|
104
|
+
PluginDefinitionMap plugin_config_map_;
|
105
|
+
// Underlying map for the providers.
|
106
|
+
std::map<absl::string_view, CertificateProviderWrapper*>
|
107
|
+
certificate_providers_map_;
|
108
|
+
};
|
109
|
+
|
110
|
+
} // namespace grpc_core
|
111
|
+
|
112
|
+
#endif // GRPC_CORE_EXT_XDS_CERTIFICATE_PROVIDER_STORE_H
|
@@ -0,0 +1,144 @@
|
|
1
|
+
//
|
2
|
+
//
|
3
|
+
// Copyright 2020 gRPC authors.
|
4
|
+
//
|
5
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
// you may not use this file except in compliance with the License.
|
7
|
+
// You may obtain a copy of the License at
|
8
|
+
//
|
9
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
//
|
11
|
+
// Unless required by applicable law or agreed to in writing, software
|
12
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
// See the License for the specific language governing permissions and
|
15
|
+
// limitations under the License.
|
16
|
+
//
|
17
|
+
//
|
18
|
+
|
19
|
+
#include <grpc/support/port_platform.h>
|
20
|
+
|
21
|
+
#include "src/core/ext/xds/file_watcher_certificate_provider_factory.h"
|
22
|
+
|
23
|
+
#include "absl/strings/str_format.h"
|
24
|
+
#include "absl/strings/str_join.h"
|
25
|
+
|
26
|
+
#include "src/core/ext/xds/certificate_provider_registry.h"
|
27
|
+
#include "src/core/lib/json/json_util.h"
|
28
|
+
|
29
|
+
namespace grpc_core {
|
30
|
+
|
31
|
+
namespace {
|
32
|
+
|
33
|
+
const char* kFileWatcherPlugin = "file_watcher";
|
34
|
+
|
35
|
+
} // namespace
|
36
|
+
|
37
|
+
//
|
38
|
+
// FileWatcherCertificateProviderFactory::Config
|
39
|
+
//
|
40
|
+
|
41
|
+
const char* FileWatcherCertificateProviderFactory::Config::name() const {
|
42
|
+
return kFileWatcherPlugin;
|
43
|
+
}
|
44
|
+
|
45
|
+
std::string FileWatcherCertificateProviderFactory::Config::ToString() const {
|
46
|
+
std::vector<std::string> parts;
|
47
|
+
parts.push_back("{");
|
48
|
+
if (!identity_cert_file_.empty()) {
|
49
|
+
parts.push_back(
|
50
|
+
absl::StrFormat("certificate_file=\"%s\", ", identity_cert_file_));
|
51
|
+
}
|
52
|
+
if (!identity_cert_file_.empty()) {
|
53
|
+
parts.push_back(
|
54
|
+
absl::StrFormat("private_key_file=\"%s\", ", private_key_file_));
|
55
|
+
}
|
56
|
+
if (!identity_cert_file_.empty()) {
|
57
|
+
parts.push_back(
|
58
|
+
absl::StrFormat("ca_certificate_file=\"%s\", ", root_cert_file_));
|
59
|
+
}
|
60
|
+
parts.push_back(
|
61
|
+
absl::StrFormat("refresh_interval=%ldms}", refresh_interval_ms_));
|
62
|
+
return absl::StrJoin(parts, "");
|
63
|
+
}
|
64
|
+
|
65
|
+
RefCountedPtr<FileWatcherCertificateProviderFactory::Config>
|
66
|
+
FileWatcherCertificateProviderFactory::Config::Parse(const Json& config_json,
|
67
|
+
grpc_error** error) {
|
68
|
+
auto config = MakeRefCounted<FileWatcherCertificateProviderFactory::Config>();
|
69
|
+
if (config_json.type() != Json::Type::OBJECT) {
|
70
|
+
*error = GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
71
|
+
"error:config type should be OBJECT.");
|
72
|
+
return nullptr;
|
73
|
+
}
|
74
|
+
std::vector<grpc_error*> error_list;
|
75
|
+
ParseJsonObjectField(config_json.object_value(), "certificate_file",
|
76
|
+
&config->identity_cert_file_, &error_list, false);
|
77
|
+
ParseJsonObjectField(config_json.object_value(), "private_key_file",
|
78
|
+
&config->private_key_file_, &error_list, false);
|
79
|
+
if (config->identity_cert_file_.empty() !=
|
80
|
+
config->private_key_file_.empty()) {
|
81
|
+
error_list.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
82
|
+
"fields \"certificate_file\" and \"private_key_file\" must be both set "
|
83
|
+
"or both unset."));
|
84
|
+
}
|
85
|
+
ParseJsonObjectField(config_json.object_value(), "ca_certificate_file",
|
86
|
+
&config->root_cert_file_, &error_list, false);
|
87
|
+
if (config->identity_cert_file_.empty() && config->root_cert_file_.empty()) {
|
88
|
+
error_list.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
89
|
+
"At least one of \"certificate_file\" and \"ca_certificate_file\" must "
|
90
|
+
"be specified."));
|
91
|
+
}
|
92
|
+
if (!ParseJsonObjectFieldAsDuration(
|
93
|
+
config_json.object_value(), "refresh_interval",
|
94
|
+
&config->refresh_interval_ms_, &error_list, false)) {
|
95
|
+
config->refresh_interval_ms_ = 10 * 60 * 1000; // 10 minutes default
|
96
|
+
}
|
97
|
+
if (!error_list.empty()) {
|
98
|
+
*error = GRPC_ERROR_CREATE_FROM_VECTOR(
|
99
|
+
"Error parsing file watcher certificate provider config", &error_list);
|
100
|
+
return nullptr;
|
101
|
+
}
|
102
|
+
return config;
|
103
|
+
}
|
104
|
+
|
105
|
+
//
|
106
|
+
// FileWatcherCertificateProviderFactory
|
107
|
+
//
|
108
|
+
|
109
|
+
const char* FileWatcherCertificateProviderFactory::name() const {
|
110
|
+
return kFileWatcherPlugin;
|
111
|
+
}
|
112
|
+
|
113
|
+
RefCountedPtr<CertificateProviderFactory::Config>
|
114
|
+
FileWatcherCertificateProviderFactory::CreateCertificateProviderConfig(
|
115
|
+
const Json& config_json, grpc_error** error) {
|
116
|
+
return FileWatcherCertificateProviderFactory::Config::Parse(config_json,
|
117
|
+
error);
|
118
|
+
}
|
119
|
+
|
120
|
+
RefCountedPtr<grpc_tls_certificate_provider>
|
121
|
+
FileWatcherCertificateProviderFactory::CreateCertificateProvider(
|
122
|
+
RefCountedPtr<CertificateProviderFactory::Config> config) {
|
123
|
+
if (config->name() != name()) {
|
124
|
+
gpr_log(GPR_ERROR, "Wrong config type Actual:%s vs Expected:%s",
|
125
|
+
config->name(), name());
|
126
|
+
return nullptr;
|
127
|
+
}
|
128
|
+
auto* file_watcher_config =
|
129
|
+
static_cast<FileWatcherCertificateProviderFactory::Config*>(config.get());
|
130
|
+
return MakeRefCounted<FileWatcherCertificateProvider>(
|
131
|
+
file_watcher_config->private_key_file(),
|
132
|
+
file_watcher_config->identity_cert_file(),
|
133
|
+
file_watcher_config->root_cert_file(),
|
134
|
+
file_watcher_config->refresh_interval_ms() / GPR_MS_PER_SEC);
|
135
|
+
}
|
136
|
+
|
137
|
+
void FileWatcherCertificateProviderInit() {
|
138
|
+
CertificateProviderRegistry::RegisterCertificateProviderFactory(
|
139
|
+
absl::make_unique<FileWatcherCertificateProviderFactory>());
|
140
|
+
}
|
141
|
+
|
142
|
+
void FileWatcherCertificateProviderShutdown() {}
|
143
|
+
|
144
|
+
} // namespace grpc_core
|
@@ -0,0 +1,69 @@
|
|
1
|
+
//
|
2
|
+
//
|
3
|
+
// Copyright 2020 gRPC authors.
|
4
|
+
//
|
5
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
// you may not use this file except in compliance with the License.
|
7
|
+
// You may obtain a copy of the License at
|
8
|
+
//
|
9
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
//
|
11
|
+
// Unless required by applicable law or agreed to in writing, software
|
12
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
// See the License for the specific language governing permissions and
|
15
|
+
// limitations under the License.
|
16
|
+
//
|
17
|
+
//
|
18
|
+
|
19
|
+
#ifndef GRPC_CORE_EXT_XDS_FILE_WATCHER_CERTIFICATE_PROVIDER_FACTORY_H
|
20
|
+
#define GRPC_CORE_EXT_XDS_FILE_WATCHER_CERTIFICATE_PROVIDER_FACTORY_H
|
21
|
+
|
22
|
+
#include <grpc/support/port_platform.h>
|
23
|
+
|
24
|
+
#include "src/core/ext/xds/certificate_provider_factory.h"
|
25
|
+
|
26
|
+
namespace grpc_core {
|
27
|
+
|
28
|
+
class FileWatcherCertificateProviderFactory
|
29
|
+
: public CertificateProviderFactory {
|
30
|
+
public:
|
31
|
+
class Config : public CertificateProviderFactory::Config {
|
32
|
+
public:
|
33
|
+
static RefCountedPtr<Config> Parse(const Json& config_json,
|
34
|
+
grpc_error** error);
|
35
|
+
|
36
|
+
const char* name() const override;
|
37
|
+
|
38
|
+
std::string ToString() const override;
|
39
|
+
|
40
|
+
const std::string& identity_cert_file() const {
|
41
|
+
return identity_cert_file_;
|
42
|
+
}
|
43
|
+
|
44
|
+
const std::string& private_key_file() const { return private_key_file_; }
|
45
|
+
|
46
|
+
const std::string& root_cert_file() const { return root_cert_file_; }
|
47
|
+
|
48
|
+
grpc_millis refresh_interval_ms() const { return refresh_interval_ms_; }
|
49
|
+
|
50
|
+
private:
|
51
|
+
std::string identity_cert_file_;
|
52
|
+
std::string private_key_file_;
|
53
|
+
std::string root_cert_file_;
|
54
|
+
grpc_millis refresh_interval_ms_;
|
55
|
+
};
|
56
|
+
|
57
|
+
const char* name() const override;
|
58
|
+
|
59
|
+
RefCountedPtr<CertificateProviderFactory::Config>
|
60
|
+
CreateCertificateProviderConfig(const Json& config_json,
|
61
|
+
grpc_error** error) override;
|
62
|
+
|
63
|
+
RefCountedPtr<grpc_tls_certificate_provider> CreateCertificateProvider(
|
64
|
+
RefCountedPtr<CertificateProviderFactory::Config> config) override;
|
65
|
+
};
|
66
|
+
|
67
|
+
} // namespace grpc_core
|
68
|
+
|
69
|
+
#endif // GRPC_CORE_EXT_XDS_FILE_WATCHER_CERTIFICATE_PROVIDER_FACTORY_H
|
@@ -0,0 +1,2308 @@
|
|
1
|
+
/*
|
2
|
+
*
|
3
|
+
* Copyright 2018 gRPC authors.
|
4
|
+
*
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
* you may not use this file except in compliance with the License.
|
7
|
+
* You may obtain a copy of the License at
|
8
|
+
*
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
*
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
* See the License for the specific language governing permissions and
|
15
|
+
* limitations under the License.
|
16
|
+
*
|
17
|
+
*/
|
18
|
+
|
19
|
+
#include <grpc/support/port_platform.h>
|
20
|
+
|
21
|
+
#include <algorithm>
|
22
|
+
#include <cctype>
|
23
|
+
#include <cstdint>
|
24
|
+
#include <cstdlib>
|
25
|
+
#include <string>
|
26
|
+
|
27
|
+
#include "absl/strings/str_cat.h"
|
28
|
+
#include "absl/strings/str_format.h"
|
29
|
+
#include "absl/strings/str_join.h"
|
30
|
+
#include "absl/strings/str_split.h"
|
31
|
+
|
32
|
+
#include "upb/upb.hpp"
|
33
|
+
|
34
|
+
#include <grpc/impl/codegen/log.h>
|
35
|
+
#include <grpc/support/alloc.h>
|
36
|
+
#include <grpc/support/string_util.h>
|
37
|
+
|
38
|
+
#include "src/core/ext/xds/xds_api.h"
|
39
|
+
#include "src/core/lib/gpr/env.h"
|
40
|
+
#include "src/core/lib/gpr/string.h"
|
41
|
+
#include "src/core/lib/gpr/useful.h"
|
42
|
+
#include "src/core/lib/iomgr/error.h"
|
43
|
+
#include "src/core/lib/iomgr/sockaddr_utils.h"
|
44
|
+
#include "src/core/lib/slice/slice_utils.h"
|
45
|
+
|
46
|
+
#include "envoy/config/cluster/v3/circuit_breaker.upb.h"
|
47
|
+
#include "envoy/config/cluster/v3/cluster.upb.h"
|
48
|
+
#include "envoy/config/cluster/v3/cluster.upbdefs.h"
|
49
|
+
#include "envoy/config/core/v3/address.upb.h"
|
50
|
+
#include "envoy/config/core/v3/base.upb.h"
|
51
|
+
#include "envoy/config/core/v3/config_source.upb.h"
|
52
|
+
#include "envoy/config/core/v3/health_check.upb.h"
|
53
|
+
#include "envoy/config/core/v3/protocol.upb.h"
|
54
|
+
#include "envoy/config/endpoint/v3/endpoint.upb.h"
|
55
|
+
#include "envoy/config/endpoint/v3/endpoint.upbdefs.h"
|
56
|
+
#include "envoy/config/endpoint/v3/endpoint_components.upb.h"
|
57
|
+
#include "envoy/config/endpoint/v3/load_report.upb.h"
|
58
|
+
#include "envoy/config/listener/v3/api_listener.upb.h"
|
59
|
+
#include "envoy/config/listener/v3/listener.upb.h"
|
60
|
+
#include "envoy/config/route/v3/route.upb.h"
|
61
|
+
#include "envoy/config/route/v3/route.upbdefs.h"
|
62
|
+
#include "envoy/config/route/v3/route_components.upb.h"
|
63
|
+
#include "envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb.h"
|
64
|
+
#include "envoy/extensions/transport_sockets/tls/v3/common.upb.h"
|
65
|
+
#include "envoy/extensions/transport_sockets/tls/v3/tls.upb.h"
|
66
|
+
#include "envoy/service/cluster/v3/cds.upb.h"
|
67
|
+
#include "envoy/service/cluster/v3/cds.upbdefs.h"
|
68
|
+
#include "envoy/service/discovery/v3/discovery.upb.h"
|
69
|
+
#include "envoy/service/discovery/v3/discovery.upbdefs.h"
|
70
|
+
#include "envoy/service/endpoint/v3/eds.upb.h"
|
71
|
+
#include "envoy/service/endpoint/v3/eds.upbdefs.h"
|
72
|
+
#include "envoy/service/listener/v3/lds.upb.h"
|
73
|
+
#include "envoy/service/load_stats/v3/lrs.upb.h"
|
74
|
+
#include "envoy/service/load_stats/v3/lrs.upbdefs.h"
|
75
|
+
#include "envoy/service/route/v3/rds.upb.h"
|
76
|
+
#include "envoy/service/route/v3/rds.upbdefs.h"
|
77
|
+
#include "envoy/type/matcher/v3/regex.upb.h"
|
78
|
+
#include "envoy/type/matcher/v3/string.upb.h"
|
79
|
+
#include "envoy/type/v3/percent.upb.h"
|
80
|
+
#include "envoy/type/v3/range.upb.h"
|
81
|
+
#include "google/protobuf/any.upb.h"
|
82
|
+
#include "google/protobuf/duration.upb.h"
|
83
|
+
#include "google/protobuf/struct.upb.h"
|
84
|
+
#include "google/protobuf/wrappers.upb.h"
|
85
|
+
#include "google/rpc/status.upb.h"
|
86
|
+
#include "upb/text_encode.h"
|
87
|
+
#include "upb/upb.h"
|
88
|
+
|
89
|
+
namespace grpc_core {
|
90
|
+
|
91
|
+
// TODO (donnadionne): Check to see if timeout is enabled, this will be
|
92
|
+
// removed once timeout feature is fully integration-tested and enabled by
|
93
|
+
// default.
|
94
|
+
bool XdsTimeoutEnabled() {
|
95
|
+
char* value = gpr_getenv("GRPC_XDS_EXPERIMENTAL_ENABLE_TIMEOUT");
|
96
|
+
bool parsed_value;
|
97
|
+
bool parse_succeeded = gpr_parse_bool_value(value, &parsed_value);
|
98
|
+
gpr_free(value);
|
99
|
+
return parse_succeeded && parsed_value;
|
100
|
+
}
|
101
|
+
|
102
|
+
// TODO(yashykt): Check to see if xDS security is enabled. This will be
|
103
|
+
// removed once this feature is fully integration-tested and enabled by
|
104
|
+
// default.
|
105
|
+
bool XdsSecurityEnabled() {
|
106
|
+
char* value = gpr_getenv("GRPC_XDS_EXPERIMENTAL_SECURITY_SUPPORT");
|
107
|
+
bool parsed_value;
|
108
|
+
bool parse_succeeded = gpr_parse_bool_value(value, &parsed_value);
|
109
|
+
gpr_free(value);
|
110
|
+
return parse_succeeded && parsed_value;
|
111
|
+
}
|
112
|
+
|
113
|
+
//
|
114
|
+
// XdsApi::Route::Matchers::PathMatcher
|
115
|
+
//
|
116
|
+
|
117
|
+
XdsApi::Route::Matchers::PathMatcher::PathMatcher(const PathMatcher& other)
|
118
|
+
: type(other.type), case_sensitive(other.case_sensitive) {
|
119
|
+
if (type == PathMatcherType::REGEX) {
|
120
|
+
RE2::Options options;
|
121
|
+
options.set_case_sensitive(case_sensitive);
|
122
|
+
regex_matcher =
|
123
|
+
absl::make_unique<RE2>(other.regex_matcher->pattern(), options);
|
124
|
+
} else {
|
125
|
+
string_matcher = other.string_matcher;
|
126
|
+
}
|
127
|
+
}
|
128
|
+
|
129
|
+
XdsApi::Route::Matchers::PathMatcher& XdsApi::Route::Matchers::PathMatcher::
|
130
|
+
operator=(const PathMatcher& other) {
|
131
|
+
type = other.type;
|
132
|
+
case_sensitive = other.case_sensitive;
|
133
|
+
if (type == PathMatcherType::REGEX) {
|
134
|
+
RE2::Options options;
|
135
|
+
options.set_case_sensitive(case_sensitive);
|
136
|
+
regex_matcher =
|
137
|
+
absl::make_unique<RE2>(other.regex_matcher->pattern(), options);
|
138
|
+
} else {
|
139
|
+
string_matcher = other.string_matcher;
|
140
|
+
}
|
141
|
+
return *this;
|
142
|
+
}
|
143
|
+
|
144
|
+
bool XdsApi::Route::Matchers::PathMatcher::operator==(
|
145
|
+
const PathMatcher& other) const {
|
146
|
+
if (type != other.type) return false;
|
147
|
+
if (case_sensitive != other.case_sensitive) return false;
|
148
|
+
if (type == PathMatcherType::REGEX) {
|
149
|
+
// Should never be null.
|
150
|
+
if (regex_matcher == nullptr || other.regex_matcher == nullptr) {
|
151
|
+
return false;
|
152
|
+
}
|
153
|
+
return regex_matcher->pattern() == other.regex_matcher->pattern();
|
154
|
+
}
|
155
|
+
return string_matcher == other.string_matcher;
|
156
|
+
}
|
157
|
+
|
158
|
+
std::string XdsApi::Route::Matchers::PathMatcher::ToString() const {
|
159
|
+
std::string path_type_string;
|
160
|
+
switch (type) {
|
161
|
+
case PathMatcherType::PATH:
|
162
|
+
path_type_string = "path match";
|
163
|
+
break;
|
164
|
+
case PathMatcherType::PREFIX:
|
165
|
+
path_type_string = "prefix match";
|
166
|
+
break;
|
167
|
+
case PathMatcherType::REGEX:
|
168
|
+
path_type_string = "regex match";
|
169
|
+
break;
|
170
|
+
default:
|
171
|
+
break;
|
172
|
+
}
|
173
|
+
return absl::StrFormat("Path %s:%s%s", path_type_string,
|
174
|
+
type == PathMatcherType::REGEX
|
175
|
+
? regex_matcher->pattern()
|
176
|
+
: string_matcher,
|
177
|
+
case_sensitive ? "" : "[case_sensitive=false]");
|
178
|
+
}
|
179
|
+
|
180
|
+
//
|
181
|
+
// XdsApi::Route::Matchers::HeaderMatcher
|
182
|
+
//
|
183
|
+
|
184
|
+
XdsApi::Route::Matchers::HeaderMatcher::HeaderMatcher(
|
185
|
+
const HeaderMatcher& other)
|
186
|
+
: name(other.name), type(other.type), invert_match(other.invert_match) {
|
187
|
+
switch (type) {
|
188
|
+
case HeaderMatcherType::REGEX:
|
189
|
+
regex_match = absl::make_unique<RE2>(other.regex_match->pattern());
|
190
|
+
break;
|
191
|
+
case HeaderMatcherType::RANGE:
|
192
|
+
range_start = other.range_start;
|
193
|
+
range_end = other.range_end;
|
194
|
+
break;
|
195
|
+
case HeaderMatcherType::PRESENT:
|
196
|
+
present_match = other.present_match;
|
197
|
+
break;
|
198
|
+
default:
|
199
|
+
string_matcher = other.string_matcher;
|
200
|
+
}
|
201
|
+
}
|
202
|
+
|
203
|
+
XdsApi::Route::Matchers::HeaderMatcher& XdsApi::Route::Matchers::HeaderMatcher::
|
204
|
+
operator=(const HeaderMatcher& other) {
|
205
|
+
name = other.name;
|
206
|
+
type = other.type;
|
207
|
+
invert_match = other.invert_match;
|
208
|
+
switch (type) {
|
209
|
+
case HeaderMatcherType::REGEX:
|
210
|
+
regex_match = absl::make_unique<RE2>(other.regex_match->pattern());
|
211
|
+
break;
|
212
|
+
case HeaderMatcherType::RANGE:
|
213
|
+
range_start = other.range_start;
|
214
|
+
range_end = other.range_end;
|
215
|
+
break;
|
216
|
+
case HeaderMatcherType::PRESENT:
|
217
|
+
present_match = other.present_match;
|
218
|
+
break;
|
219
|
+
default:
|
220
|
+
string_matcher = other.string_matcher;
|
221
|
+
}
|
222
|
+
return *this;
|
223
|
+
}
|
224
|
+
|
225
|
+
bool XdsApi::Route::Matchers::HeaderMatcher::operator==(
|
226
|
+
const HeaderMatcher& other) const {
|
227
|
+
if (name != other.name) return false;
|
228
|
+
if (type != other.type) return false;
|
229
|
+
if (invert_match != other.invert_match) return false;
|
230
|
+
switch (type) {
|
231
|
+
case HeaderMatcherType::REGEX:
|
232
|
+
return regex_match->pattern() != other.regex_match->pattern();
|
233
|
+
case HeaderMatcherType::RANGE:
|
234
|
+
return range_start != other.range_start && range_end != other.range_end;
|
235
|
+
case HeaderMatcherType::PRESENT:
|
236
|
+
return present_match != other.present_match;
|
237
|
+
default:
|
238
|
+
return string_matcher != other.string_matcher;
|
239
|
+
}
|
240
|
+
}
|
241
|
+
|
242
|
+
std::string XdsApi::Route::Matchers::HeaderMatcher::ToString() const {
|
243
|
+
switch (type) {
|
244
|
+
case HeaderMatcherType::EXACT:
|
245
|
+
return absl::StrFormat("Header exact match:%s %s:%s",
|
246
|
+
invert_match ? " not" : "", name, string_matcher);
|
247
|
+
case HeaderMatcherType::REGEX:
|
248
|
+
return absl::StrFormat("Header regex match:%s %s:%s",
|
249
|
+
invert_match ? " not" : "", name,
|
250
|
+
regex_match->pattern());
|
251
|
+
case HeaderMatcherType::RANGE:
|
252
|
+
return absl::StrFormat("Header range match:%s %s:[%d, %d)",
|
253
|
+
invert_match ? " not" : "", name, range_start,
|
254
|
+
range_end);
|
255
|
+
case HeaderMatcherType::PRESENT:
|
256
|
+
return absl::StrFormat("Header present match:%s %s:%s",
|
257
|
+
invert_match ? " not" : "", name,
|
258
|
+
present_match ? "true" : "false");
|
259
|
+
case HeaderMatcherType::PREFIX:
|
260
|
+
return absl::StrFormat("Header prefix match:%s %s:%s",
|
261
|
+
invert_match ? " not" : "", name, string_matcher);
|
262
|
+
case HeaderMatcherType::SUFFIX:
|
263
|
+
return absl::StrFormat("Header suffix match:%s %s:%s",
|
264
|
+
invert_match ? " not" : "", name, string_matcher);
|
265
|
+
default:
|
266
|
+
return "";
|
267
|
+
}
|
268
|
+
}
|
269
|
+
|
270
|
+
//
|
271
|
+
// XdsApi::Route
|
272
|
+
//
|
273
|
+
|
274
|
+
std::string XdsApi::Route::Matchers::ToString() const {
|
275
|
+
std::vector<std::string> contents;
|
276
|
+
contents.push_back(path_matcher.ToString());
|
277
|
+
for (const HeaderMatcher& header_matcher : header_matchers) {
|
278
|
+
contents.push_back(header_matcher.ToString());
|
279
|
+
}
|
280
|
+
if (fraction_per_million.has_value()) {
|
281
|
+
contents.push_back(absl::StrFormat("Fraction Per Million %d",
|
282
|
+
fraction_per_million.value()));
|
283
|
+
}
|
284
|
+
return absl::StrJoin(contents, "\n");
|
285
|
+
}
|
286
|
+
|
287
|
+
std::string XdsApi::Route::ClusterWeight::ToString() const {
|
288
|
+
return absl::StrFormat("{cluster=%s, weight=%d}", name, weight);
|
289
|
+
}
|
290
|
+
|
291
|
+
std::string XdsApi::Route::ToString() const {
|
292
|
+
std::vector<std::string> contents;
|
293
|
+
contents.push_back(matchers.ToString());
|
294
|
+
if (!cluster_name.empty()) {
|
295
|
+
contents.push_back(absl::StrFormat("Cluster name: %s", cluster_name));
|
296
|
+
}
|
297
|
+
for (const ClusterWeight& cluster_weight : weighted_clusters) {
|
298
|
+
contents.push_back(cluster_weight.ToString());
|
299
|
+
}
|
300
|
+
if (max_stream_duration.has_value()) {
|
301
|
+
contents.push_back(max_stream_duration->ToString());
|
302
|
+
}
|
303
|
+
return absl::StrJoin(contents, "\n");
|
304
|
+
}
|
305
|
+
|
306
|
+
//
|
307
|
+
// XdsApi::RdsUpdate
|
308
|
+
//
|
309
|
+
|
310
|
+
std::string XdsApi::RdsUpdate::ToString() const {
|
311
|
+
std::vector<std::string> vhosts;
|
312
|
+
for (const VirtualHost& vhost : virtual_hosts) {
|
313
|
+
vhosts.push_back(
|
314
|
+
absl::StrCat("vhost={\n"
|
315
|
+
" domains=[",
|
316
|
+
absl::StrJoin(vhost.domains, ", "),
|
317
|
+
"]\n"
|
318
|
+
" routes=[\n"));
|
319
|
+
for (const XdsApi::Route& route : vhost.routes) {
|
320
|
+
vhosts.push_back(" {\n");
|
321
|
+
vhosts.push_back(route.ToString());
|
322
|
+
vhosts.push_back("\n }\n");
|
323
|
+
}
|
324
|
+
vhosts.push_back(" ]\n");
|
325
|
+
vhosts.push_back("]\n");
|
326
|
+
}
|
327
|
+
return absl::StrJoin(vhosts, "");
|
328
|
+
}
|
329
|
+
|
330
|
+
namespace {
|
331
|
+
|
332
|
+
// Better match type has smaller value.
|
333
|
+
enum MatchType {
|
334
|
+
EXACT_MATCH,
|
335
|
+
SUFFIX_MATCH,
|
336
|
+
PREFIX_MATCH,
|
337
|
+
UNIVERSE_MATCH,
|
338
|
+
INVALID_MATCH,
|
339
|
+
};
|
340
|
+
|
341
|
+
// Returns true if match succeeds.
|
342
|
+
bool DomainMatch(MatchType match_type, const std::string& domain_pattern_in,
|
343
|
+
const std::string& expected_host_name_in) {
|
344
|
+
// Normalize the args to lower-case. Domain matching is case-insensitive.
|
345
|
+
std::string domain_pattern = domain_pattern_in;
|
346
|
+
std::string expected_host_name = expected_host_name_in;
|
347
|
+
std::transform(domain_pattern.begin(), domain_pattern.end(),
|
348
|
+
domain_pattern.begin(),
|
349
|
+
[](unsigned char c) { return std::tolower(c); });
|
350
|
+
std::transform(expected_host_name.begin(), expected_host_name.end(),
|
351
|
+
expected_host_name.begin(),
|
352
|
+
[](unsigned char c) { return std::tolower(c); });
|
353
|
+
if (match_type == EXACT_MATCH) {
|
354
|
+
return domain_pattern == expected_host_name;
|
355
|
+
} else if (match_type == SUFFIX_MATCH) {
|
356
|
+
// Asterisk must match at least one char.
|
357
|
+
if (expected_host_name.size() < domain_pattern.size()) return false;
|
358
|
+
absl::string_view pattern_suffix(domain_pattern.c_str() + 1);
|
359
|
+
absl::string_view host_suffix(expected_host_name.c_str() +
|
360
|
+
expected_host_name.size() -
|
361
|
+
pattern_suffix.size());
|
362
|
+
return pattern_suffix == host_suffix;
|
363
|
+
} else if (match_type == PREFIX_MATCH) {
|
364
|
+
// Asterisk must match at least one char.
|
365
|
+
if (expected_host_name.size() < domain_pattern.size()) return false;
|
366
|
+
absl::string_view pattern_prefix(domain_pattern.c_str(),
|
367
|
+
domain_pattern.size() - 1);
|
368
|
+
absl::string_view host_prefix(expected_host_name.c_str(),
|
369
|
+
pattern_prefix.size());
|
370
|
+
return pattern_prefix == host_prefix;
|
371
|
+
} else {
|
372
|
+
return match_type == UNIVERSE_MATCH;
|
373
|
+
}
|
374
|
+
}
|
375
|
+
|
376
|
+
MatchType DomainPatternMatchType(const std::string& domain_pattern) {
|
377
|
+
if (domain_pattern.empty()) return INVALID_MATCH;
|
378
|
+
if (domain_pattern.find('*') == std::string::npos) return EXACT_MATCH;
|
379
|
+
if (domain_pattern == "*") return UNIVERSE_MATCH;
|
380
|
+
if (domain_pattern[0] == '*') return SUFFIX_MATCH;
|
381
|
+
if (domain_pattern[domain_pattern.size() - 1] == '*') return PREFIX_MATCH;
|
382
|
+
return INVALID_MATCH;
|
383
|
+
}
|
384
|
+
|
385
|
+
} // namespace
|
386
|
+
|
387
|
+
XdsApi::RdsUpdate::VirtualHost* XdsApi::RdsUpdate::FindVirtualHostForDomain(
|
388
|
+
const std::string& domain) {
|
389
|
+
// Find the best matched virtual host.
|
390
|
+
// The search order for 4 groups of domain patterns:
|
391
|
+
// 1. Exact match.
|
392
|
+
// 2. Suffix match (e.g., "*ABC").
|
393
|
+
// 3. Prefix match (e.g., "ABC*").
|
394
|
+
// 4. Universe match (i.e., "*").
|
395
|
+
// Within each group, longest match wins.
|
396
|
+
// If the same best matched domain pattern appears in multiple virtual hosts,
|
397
|
+
// the first matched virtual host wins.
|
398
|
+
VirtualHost* target_vhost = nullptr;
|
399
|
+
MatchType best_match_type = INVALID_MATCH;
|
400
|
+
size_t longest_match = 0;
|
401
|
+
// Check each domain pattern in each virtual host to determine the best
|
402
|
+
// matched virtual host.
|
403
|
+
for (VirtualHost& vhost : virtual_hosts) {
|
404
|
+
for (const std::string& domain_pattern : vhost.domains) {
|
405
|
+
// Check the match type first. Skip the pattern if it's not better than
|
406
|
+
// current match.
|
407
|
+
const MatchType match_type = DomainPatternMatchType(domain_pattern);
|
408
|
+
// This should be caught by RouteConfigParse().
|
409
|
+
GPR_ASSERT(match_type != INVALID_MATCH);
|
410
|
+
if (match_type > best_match_type) continue;
|
411
|
+
if (match_type == best_match_type &&
|
412
|
+
domain_pattern.size() <= longest_match) {
|
413
|
+
continue;
|
414
|
+
}
|
415
|
+
// Skip if match fails.
|
416
|
+
if (!DomainMatch(match_type, domain_pattern, domain)) continue;
|
417
|
+
// Choose this match.
|
418
|
+
target_vhost = &vhost;
|
419
|
+
best_match_type = match_type;
|
420
|
+
longest_match = domain_pattern.size();
|
421
|
+
if (best_match_type == EXACT_MATCH) break;
|
422
|
+
}
|
423
|
+
if (best_match_type == EXACT_MATCH) break;
|
424
|
+
}
|
425
|
+
return target_vhost;
|
426
|
+
}
|
427
|
+
|
428
|
+
//
|
429
|
+
// XdsApi::StringMatcher
|
430
|
+
//
|
431
|
+
|
432
|
+
XdsApi::StringMatcher::StringMatcher(StringMatcherType type,
|
433
|
+
const std::string& matcher,
|
434
|
+
bool ignore_case)
|
435
|
+
: type_(type), ignore_case_(ignore_case) {
|
436
|
+
if (type_ == StringMatcherType::SAFE_REGEX) {
|
437
|
+
regex_matcher_ = absl::make_unique<RE2>(matcher);
|
438
|
+
} else {
|
439
|
+
string_matcher_ = matcher;
|
440
|
+
}
|
441
|
+
}
|
442
|
+
|
443
|
+
XdsApi::StringMatcher::StringMatcher(const StringMatcher& other)
|
444
|
+
: type_(other.type_), ignore_case_(other.ignore_case_) {
|
445
|
+
switch (type_) {
|
446
|
+
case StringMatcherType::SAFE_REGEX:
|
447
|
+
regex_matcher_ = absl::make_unique<RE2>(other.regex_matcher_->pattern());
|
448
|
+
break;
|
449
|
+
default:
|
450
|
+
string_matcher_ = other.string_matcher_;
|
451
|
+
}
|
452
|
+
}
|
453
|
+
|
454
|
+
XdsApi::StringMatcher& XdsApi::StringMatcher::operator=(
|
455
|
+
const StringMatcher& other) {
|
456
|
+
type_ = other.type_;
|
457
|
+
switch (type_) {
|
458
|
+
case StringMatcherType::SAFE_REGEX:
|
459
|
+
regex_matcher_ = absl::make_unique<RE2>(other.regex_matcher_->pattern());
|
460
|
+
break;
|
461
|
+
default:
|
462
|
+
string_matcher_ = other.string_matcher_;
|
463
|
+
}
|
464
|
+
ignore_case_ = other.ignore_case_;
|
465
|
+
return *this;
|
466
|
+
}
|
467
|
+
|
468
|
+
bool XdsApi::StringMatcher::operator==(const StringMatcher& other) const {
|
469
|
+
if (type_ != other.type_ || ignore_case_ != other.ignore_case_) return false;
|
470
|
+
switch (type_) {
|
471
|
+
case StringMatcherType::SAFE_REGEX:
|
472
|
+
return regex_matcher_->pattern() == other.regex_matcher_->pattern();
|
473
|
+
default:
|
474
|
+
return string_matcher_ == other.string_matcher_;
|
475
|
+
}
|
476
|
+
}
|
477
|
+
|
478
|
+
bool XdsApi::StringMatcher::Match(absl::string_view value) const {
|
479
|
+
switch (type_) {
|
480
|
+
case XdsApi::StringMatcher::StringMatcherType::EXACT:
|
481
|
+
return ignore_case_ ? absl::EqualsIgnoreCase(value, string_matcher_)
|
482
|
+
: value == string_matcher_;
|
483
|
+
case XdsApi::StringMatcher::StringMatcherType::PREFIX:
|
484
|
+
return ignore_case_ ? absl::StartsWithIgnoreCase(value, string_matcher_)
|
485
|
+
: absl::StartsWith(value, string_matcher_);
|
486
|
+
case XdsApi::StringMatcher::StringMatcherType::SUFFIX:
|
487
|
+
return ignore_case_ ? absl::EndsWithIgnoreCase(value, string_matcher_)
|
488
|
+
: absl::EndsWith(value, string_matcher_);
|
489
|
+
case XdsApi::StringMatcher::StringMatcherType::CONTAINS:
|
490
|
+
return ignore_case_
|
491
|
+
? absl::StrContains(absl::AsciiStrToLower(value),
|
492
|
+
absl::AsciiStrToLower(string_matcher_))
|
493
|
+
: absl::StrContains(value, string_matcher_);
|
494
|
+
case XdsApi::StringMatcher::StringMatcherType::SAFE_REGEX:
|
495
|
+
// ignore_case_ is ignored for SAFE_REGEX
|
496
|
+
return RE2::FullMatch(std::string(value), *regex_matcher_);
|
497
|
+
default:
|
498
|
+
return false;
|
499
|
+
}
|
500
|
+
}
|
501
|
+
|
502
|
+
std::string XdsApi::StringMatcher::ToString() const {
|
503
|
+
switch (type_) {
|
504
|
+
case StringMatcherType::EXACT:
|
505
|
+
return absl::StrFormat("StringMatcher{exact=%s%s}", string_matcher_,
|
506
|
+
ignore_case_ ? ", ignore_case" : "");
|
507
|
+
case StringMatcherType::PREFIX:
|
508
|
+
return absl::StrFormat("StringMatcher{prefix=%s%s}", string_matcher_,
|
509
|
+
ignore_case_ ? ", ignore_case" : "");
|
510
|
+
case StringMatcherType::SUFFIX:
|
511
|
+
return absl::StrFormat("StringMatcher{suffix=%s%s}", string_matcher_,
|
512
|
+
ignore_case_ ? ", ignore_case" : "");
|
513
|
+
case StringMatcherType::CONTAINS:
|
514
|
+
return absl::StrFormat("StringMatcher{contains=%s%s}", string_matcher_,
|
515
|
+
ignore_case_ ? ", ignore_case" : "");
|
516
|
+
case StringMatcherType::SAFE_REGEX:
|
517
|
+
return absl::StrFormat("StringMatcher{safe_regex=%s}",
|
518
|
+
regex_matcher_->pattern());
|
519
|
+
default:
|
520
|
+
return "";
|
521
|
+
}
|
522
|
+
}
|
523
|
+
|
524
|
+
//
|
525
|
+
// XdsApi::CommonTlsContext::CertificateValidationContext
|
526
|
+
//
|
527
|
+
|
528
|
+
std::string XdsApi::CommonTlsContext::CertificateValidationContext::ToString()
|
529
|
+
const {
|
530
|
+
std::vector<std::string> contents;
|
531
|
+
for (const auto& match : match_subject_alt_names) {
|
532
|
+
contents.push_back(match.ToString());
|
533
|
+
}
|
534
|
+
return absl::StrFormat("{match_subject_alt_names=[%s]}",
|
535
|
+
absl::StrJoin(contents, ", "));
|
536
|
+
}
|
537
|
+
|
538
|
+
bool XdsApi::CommonTlsContext::CertificateValidationContext::Empty() const {
|
539
|
+
return match_subject_alt_names.empty();
|
540
|
+
}
|
541
|
+
|
542
|
+
//
|
543
|
+
// XdsApi::CommonTlsContext::CertificateValidationContext
|
544
|
+
//
|
545
|
+
|
546
|
+
std::string XdsApi::CommonTlsContext::CertificateProviderInstance::ToString()
|
547
|
+
const {
|
548
|
+
absl::InlinedVector<std::string, 2> contents;
|
549
|
+
if (!instance_name.empty()) {
|
550
|
+
contents.push_back(absl::StrFormat("instance_name=%s", instance_name));
|
551
|
+
}
|
552
|
+
if (!certificate_name.empty()) {
|
553
|
+
contents.push_back(
|
554
|
+
absl::StrFormat("certificate_name=%s", certificate_name));
|
555
|
+
}
|
556
|
+
return absl::StrCat("{", absl::StrJoin(contents, ", "), "}");
|
557
|
+
}
|
558
|
+
|
559
|
+
bool XdsApi::CommonTlsContext::CertificateProviderInstance::Empty() const {
|
560
|
+
return instance_name.empty() && certificate_name.empty();
|
561
|
+
}
|
562
|
+
|
563
|
+
//
|
564
|
+
// XdsApi::CommonTlsContext::CombinedCertificateValidationContext
|
565
|
+
//
|
566
|
+
|
567
|
+
std::string
|
568
|
+
XdsApi::CommonTlsContext::CombinedCertificateValidationContext::ToString()
|
569
|
+
const {
|
570
|
+
absl::InlinedVector<std::string, 2> contents;
|
571
|
+
if (!default_validation_context.Empty()) {
|
572
|
+
contents.push_back(absl::StrFormat("default_validation_context=%s",
|
573
|
+
default_validation_context.ToString()));
|
574
|
+
}
|
575
|
+
if (!validation_context_certificate_provider_instance.Empty()) {
|
576
|
+
contents.push_back(absl::StrFormat(
|
577
|
+
"validation_context_certificate_provider_instance=%s",
|
578
|
+
validation_context_certificate_provider_instance.ToString()));
|
579
|
+
}
|
580
|
+
return absl::StrCat("{", absl::StrJoin(contents, ", "), "}");
|
581
|
+
}
|
582
|
+
|
583
|
+
bool XdsApi::CommonTlsContext::CombinedCertificateValidationContext::Empty()
|
584
|
+
const {
|
585
|
+
return default_validation_context.Empty() &&
|
586
|
+
validation_context_certificate_provider_instance.Empty();
|
587
|
+
}
|
588
|
+
|
589
|
+
//
|
590
|
+
// XdsApi::CommonTlsContext
|
591
|
+
//
|
592
|
+
|
593
|
+
std::string XdsApi::CommonTlsContext::ToString() const {
|
594
|
+
absl::InlinedVector<std::string, 2> contents;
|
595
|
+
if (!tls_certificate_certificate_provider_instance.Empty()) {
|
596
|
+
contents.push_back(absl::StrFormat(
|
597
|
+
"tls_certificate_certificate_provider_instance=%s",
|
598
|
+
tls_certificate_certificate_provider_instance.ToString()));
|
599
|
+
}
|
600
|
+
if (!combined_validation_context.Empty()) {
|
601
|
+
contents.push_back(absl::StrFormat("combined_validation_context=%s",
|
602
|
+
combined_validation_context.ToString()));
|
603
|
+
}
|
604
|
+
return absl::StrCat("{", absl::StrJoin(contents, ", "), "}");
|
605
|
+
}
|
606
|
+
|
607
|
+
bool XdsApi::CommonTlsContext::Empty() const {
|
608
|
+
return tls_certificate_certificate_provider_instance.Empty() &&
|
609
|
+
combined_validation_context.Empty();
|
610
|
+
}
|
611
|
+
|
612
|
+
//
|
613
|
+
// XdsApi::CdsUpdate
|
614
|
+
//
|
615
|
+
|
616
|
+
std::string XdsApi::CdsUpdate::ToString() const {
|
617
|
+
absl::InlinedVector<std::string, 4> contents;
|
618
|
+
if (!eds_service_name.empty()) {
|
619
|
+
contents.push_back(
|
620
|
+
absl::StrFormat("eds_service_name=%s", eds_service_name));
|
621
|
+
}
|
622
|
+
if (!common_tls_context.Empty()) {
|
623
|
+
contents.push_back(absl::StrFormat("common_tls_context=%s",
|
624
|
+
common_tls_context.ToString()));
|
625
|
+
}
|
626
|
+
if (lrs_load_reporting_server_name.has_value()) {
|
627
|
+
contents.push_back(absl::StrFormat("lrs_load_reporting_server_name=%s",
|
628
|
+
lrs_load_reporting_server_name.value()));
|
629
|
+
}
|
630
|
+
contents.push_back(
|
631
|
+
absl::StrFormat("max_concurrent_requests=%d", max_concurrent_requests));
|
632
|
+
return absl::StrCat("{", absl::StrJoin(contents, ", "), "}");
|
633
|
+
}
|
634
|
+
|
635
|
+
//
|
636
|
+
// XdsApi::EdsUpdate
|
637
|
+
//
|
638
|
+
|
639
|
+
std::string XdsApi::EdsUpdate::Priority::Locality::ToString() const {
|
640
|
+
std::vector<std::string> endpoint_strings;
|
641
|
+
for (const ServerAddress& endpoint : endpoints) {
|
642
|
+
endpoint_strings.emplace_back(endpoint.ToString());
|
643
|
+
}
|
644
|
+
return absl::StrCat("{name=", name->AsHumanReadableString(),
|
645
|
+
", lb_weight=", lb_weight, ", endpoints=[",
|
646
|
+
absl::StrJoin(endpoint_strings, ", "), "]}");
|
647
|
+
}
|
648
|
+
|
649
|
+
bool XdsApi::EdsUpdate::Priority::operator==(const Priority& other) const {
|
650
|
+
if (localities.size() != other.localities.size()) return false;
|
651
|
+
auto it1 = localities.begin();
|
652
|
+
auto it2 = other.localities.begin();
|
653
|
+
while (it1 != localities.end()) {
|
654
|
+
if (*it1->first != *it2->first) return false;
|
655
|
+
if (it1->second != it2->second) return false;
|
656
|
+
++it1;
|
657
|
+
++it2;
|
658
|
+
}
|
659
|
+
return true;
|
660
|
+
}
|
661
|
+
|
662
|
+
std::string XdsApi::EdsUpdate::Priority::ToString() const {
|
663
|
+
std::vector<std::string> locality_strings;
|
664
|
+
for (const auto& p : localities) {
|
665
|
+
locality_strings.emplace_back(p.second.ToString());
|
666
|
+
}
|
667
|
+
return absl::StrCat("[", absl::StrJoin(locality_strings, ", "), "]");
|
668
|
+
}
|
669
|
+
|
670
|
+
bool XdsApi::EdsUpdate::DropConfig::ShouldDrop(
|
671
|
+
const std::string** category_name) const {
|
672
|
+
for (size_t i = 0; i < drop_category_list_.size(); ++i) {
|
673
|
+
const auto& drop_category = drop_category_list_[i];
|
674
|
+
// Generate a random number in [0, 1000000).
|
675
|
+
const uint32_t random = static_cast<uint32_t>(rand()) % 1000000;
|
676
|
+
if (random < drop_category.parts_per_million) {
|
677
|
+
*category_name = &drop_category.name;
|
678
|
+
return true;
|
679
|
+
}
|
680
|
+
}
|
681
|
+
return false;
|
682
|
+
}
|
683
|
+
|
684
|
+
std::string XdsApi::EdsUpdate::DropConfig::ToString() const {
|
685
|
+
std::vector<std::string> category_strings;
|
686
|
+
for (const DropCategory& category : drop_category_list_) {
|
687
|
+
category_strings.emplace_back(
|
688
|
+
absl::StrCat(category.name, "=", category.parts_per_million));
|
689
|
+
}
|
690
|
+
return absl::StrCat("{[", absl::StrJoin(category_strings, ", "),
|
691
|
+
"], drop_all=", drop_all_, "}");
|
692
|
+
}
|
693
|
+
|
694
|
+
std::string XdsApi::EdsUpdate::ToString() const {
|
695
|
+
std::vector<std::string> priority_strings;
|
696
|
+
for (size_t i = 0; i < priorities.size(); ++i) {
|
697
|
+
const Priority& priority = priorities[i];
|
698
|
+
priority_strings.emplace_back(
|
699
|
+
absl::StrCat("priority ", i, ": ", priority.ToString()));
|
700
|
+
}
|
701
|
+
return absl::StrCat("priorities=[", absl::StrJoin(priority_strings, ", "),
|
702
|
+
"], drop_config=", drop_config->ToString());
|
703
|
+
}
|
704
|
+
|
705
|
+
//
|
706
|
+
// XdsApi
|
707
|
+
//
|
708
|
+
|
709
|
+
const char* XdsApi::kLdsTypeUrl =
|
710
|
+
"type.googleapis.com/envoy.config.listener.v3.Listener";
|
711
|
+
const char* XdsApi::kRdsTypeUrl =
|
712
|
+
"type.googleapis.com/envoy.config.route.v3.RouteConfiguration";
|
713
|
+
const char* XdsApi::kCdsTypeUrl =
|
714
|
+
"type.googleapis.com/envoy.config.cluster.v3.Cluster";
|
715
|
+
const char* XdsApi::kEdsTypeUrl =
|
716
|
+
"type.googleapis.com/envoy.config.endpoint.v3.ClusterLoadAssignment";
|
717
|
+
|
718
|
+
namespace {
|
719
|
+
|
720
|
+
const char* kLdsV2TypeUrl = "type.googleapis.com/envoy.api.v2.Listener";
|
721
|
+
const char* kRdsV2TypeUrl =
|
722
|
+
"type.googleapis.com/envoy.api.v2.RouteConfiguration";
|
723
|
+
const char* kCdsV2TypeUrl = "type.googleapis.com/envoy.api.v2.Cluster";
|
724
|
+
const char* kEdsV2TypeUrl =
|
725
|
+
"type.googleapis.com/envoy.api.v2.ClusterLoadAssignment";
|
726
|
+
|
727
|
+
bool IsLds(absl::string_view type_url) {
|
728
|
+
return type_url == XdsApi::kLdsTypeUrl || type_url == kLdsV2TypeUrl;
|
729
|
+
}
|
730
|
+
|
731
|
+
bool IsRds(absl::string_view type_url) {
|
732
|
+
return type_url == XdsApi::kRdsTypeUrl || type_url == kRdsV2TypeUrl;
|
733
|
+
}
|
734
|
+
|
735
|
+
bool IsCds(absl::string_view type_url) {
|
736
|
+
return type_url == XdsApi::kCdsTypeUrl || type_url == kCdsV2TypeUrl;
|
737
|
+
}
|
738
|
+
|
739
|
+
bool IsEds(absl::string_view type_url) {
|
740
|
+
return type_url == XdsApi::kEdsTypeUrl || type_url == kEdsV2TypeUrl;
|
741
|
+
}
|
742
|
+
|
743
|
+
} // namespace
|
744
|
+
|
745
|
+
XdsApi::XdsApi(XdsClient* client, TraceFlag* tracer,
|
746
|
+
const XdsBootstrap::Node* node)
|
747
|
+
: client_(client),
|
748
|
+
tracer_(tracer),
|
749
|
+
node_(node),
|
750
|
+
build_version_(absl::StrCat("gRPC C-core ", GPR_PLATFORM_STRING, " ",
|
751
|
+
grpc_version_string())),
|
752
|
+
user_agent_name_(absl::StrCat("gRPC C-core ", GPR_PLATFORM_STRING)) {}
|
753
|
+
|
754
|
+
namespace {
|
755
|
+
|
756
|
+
// Works for both std::string and absl::string_view.
|
757
|
+
template <typename T>
|
758
|
+
inline upb_strview StdStringToUpbString(const T& str) {
|
759
|
+
return upb_strview_make(str.data(), str.size());
|
760
|
+
}
|
761
|
+
|
762
|
+
void PopulateMetadataValue(upb_arena* arena, google_protobuf_Value* value_pb,
|
763
|
+
const Json& value);
|
764
|
+
|
765
|
+
void PopulateListValue(upb_arena* arena, google_protobuf_ListValue* list_value,
|
766
|
+
const Json::Array& values) {
|
767
|
+
for (const auto& value : values) {
|
768
|
+
auto* value_pb = google_protobuf_ListValue_add_values(list_value, arena);
|
769
|
+
PopulateMetadataValue(arena, value_pb, value);
|
770
|
+
}
|
771
|
+
}
|
772
|
+
|
773
|
+
void PopulateMetadata(upb_arena* arena, google_protobuf_Struct* metadata_pb,
|
774
|
+
const Json::Object& metadata) {
|
775
|
+
for (const auto& p : metadata) {
|
776
|
+
google_protobuf_Value* value = google_protobuf_Value_new(arena);
|
777
|
+
PopulateMetadataValue(arena, value, p.second);
|
778
|
+
google_protobuf_Struct_fields_set(
|
779
|
+
metadata_pb, StdStringToUpbString(p.first), value, arena);
|
780
|
+
}
|
781
|
+
}
|
782
|
+
|
783
|
+
void PopulateMetadataValue(upb_arena* arena, google_protobuf_Value* value_pb,
|
784
|
+
const Json& value) {
|
785
|
+
switch (value.type()) {
|
786
|
+
case Json::Type::JSON_NULL:
|
787
|
+
google_protobuf_Value_set_null_value(value_pb, 0);
|
788
|
+
break;
|
789
|
+
case Json::Type::NUMBER:
|
790
|
+
google_protobuf_Value_set_number_value(
|
791
|
+
value_pb, strtod(value.string_value().c_str(), nullptr));
|
792
|
+
break;
|
793
|
+
case Json::Type::STRING:
|
794
|
+
google_protobuf_Value_set_string_value(
|
795
|
+
value_pb, StdStringToUpbString(value.string_value()));
|
796
|
+
break;
|
797
|
+
case Json::Type::JSON_TRUE:
|
798
|
+
google_protobuf_Value_set_bool_value(value_pb, true);
|
799
|
+
break;
|
800
|
+
case Json::Type::JSON_FALSE:
|
801
|
+
google_protobuf_Value_set_bool_value(value_pb, false);
|
802
|
+
break;
|
803
|
+
case Json::Type::OBJECT: {
|
804
|
+
google_protobuf_Struct* struct_value =
|
805
|
+
google_protobuf_Value_mutable_struct_value(value_pb, arena);
|
806
|
+
PopulateMetadata(arena, struct_value, value.object_value());
|
807
|
+
break;
|
808
|
+
}
|
809
|
+
case Json::Type::ARRAY: {
|
810
|
+
google_protobuf_ListValue* list_value =
|
811
|
+
google_protobuf_Value_mutable_list_value(value_pb, arena);
|
812
|
+
PopulateListValue(arena, list_value, value.array_value());
|
813
|
+
break;
|
814
|
+
}
|
815
|
+
}
|
816
|
+
}
|
817
|
+
|
818
|
+
// Helper functions to manually do protobuf string encoding, so that we
|
819
|
+
// can populate the node build_version field that was removed in v3.
|
820
|
+
std::string EncodeVarint(uint64_t val) {
|
821
|
+
std::string data;
|
822
|
+
do {
|
823
|
+
uint8_t byte = val & 0x7fU;
|
824
|
+
val >>= 7;
|
825
|
+
if (val) byte |= 0x80U;
|
826
|
+
data += byte;
|
827
|
+
} while (val);
|
828
|
+
return data;
|
829
|
+
}
|
830
|
+
std::string EncodeTag(uint32_t field_number, uint8_t wire_type) {
|
831
|
+
return EncodeVarint((field_number << 3) | wire_type);
|
832
|
+
}
|
833
|
+
std::string EncodeStringField(uint32_t field_number, const std::string& str) {
|
834
|
+
static const uint8_t kDelimitedWireType = 2;
|
835
|
+
return EncodeTag(field_number, kDelimitedWireType) +
|
836
|
+
EncodeVarint(str.size()) + str;
|
837
|
+
}
|
838
|
+
|
839
|
+
void PopulateBuildVersion(upb_arena* arena, envoy_config_core_v3_Node* node_msg,
|
840
|
+
const std::string& build_version) {
|
841
|
+
std::string encoded_build_version = EncodeStringField(5, build_version);
|
842
|
+
// TODO(roth): This should use upb_msg_addunknown(), but that API is
|
843
|
+
// broken in the current version of upb, so we're using the internal
|
844
|
+
// API for now. Change this once we upgrade to a version of upb that
|
845
|
+
// fixes this bug.
|
846
|
+
_upb_msg_addunknown(node_msg, encoded_build_version.data(),
|
847
|
+
encoded_build_version.size(), arena);
|
848
|
+
}
|
849
|
+
|
850
|
+
void PopulateNode(upb_arena* arena, const XdsBootstrap::Node* node, bool use_v3,
|
851
|
+
const std::string& build_version,
|
852
|
+
const std::string& user_agent_name,
|
853
|
+
envoy_config_core_v3_Node* node_msg) {
|
854
|
+
if (node != nullptr) {
|
855
|
+
if (!node->id.empty()) {
|
856
|
+
envoy_config_core_v3_Node_set_id(node_msg,
|
857
|
+
StdStringToUpbString(node->id));
|
858
|
+
}
|
859
|
+
if (!node->cluster.empty()) {
|
860
|
+
envoy_config_core_v3_Node_set_cluster(
|
861
|
+
node_msg, StdStringToUpbString(node->cluster));
|
862
|
+
}
|
863
|
+
if (!node->metadata.object_value().empty()) {
|
864
|
+
google_protobuf_Struct* metadata =
|
865
|
+
envoy_config_core_v3_Node_mutable_metadata(node_msg, arena);
|
866
|
+
PopulateMetadata(arena, metadata, node->metadata.object_value());
|
867
|
+
}
|
868
|
+
if (!node->locality_region.empty() || !node->locality_zone.empty() ||
|
869
|
+
!node->locality_subzone.empty()) {
|
870
|
+
envoy_config_core_v3_Locality* locality =
|
871
|
+
envoy_config_core_v3_Node_mutable_locality(node_msg, arena);
|
872
|
+
if (!node->locality_region.empty()) {
|
873
|
+
envoy_config_core_v3_Locality_set_region(
|
874
|
+
locality, StdStringToUpbString(node->locality_region));
|
875
|
+
}
|
876
|
+
if (!node->locality_zone.empty()) {
|
877
|
+
envoy_config_core_v3_Locality_set_zone(
|
878
|
+
locality, StdStringToUpbString(node->locality_zone));
|
879
|
+
}
|
880
|
+
if (!node->locality_subzone.empty()) {
|
881
|
+
envoy_config_core_v3_Locality_set_sub_zone(
|
882
|
+
locality, StdStringToUpbString(node->locality_subzone));
|
883
|
+
}
|
884
|
+
}
|
885
|
+
}
|
886
|
+
if (!use_v3) {
|
887
|
+
PopulateBuildVersion(arena, node_msg, build_version);
|
888
|
+
}
|
889
|
+
envoy_config_core_v3_Node_set_user_agent_name(
|
890
|
+
node_msg, StdStringToUpbString(user_agent_name));
|
891
|
+
envoy_config_core_v3_Node_set_user_agent_version(
|
892
|
+
node_msg, upb_strview_makez(grpc_version_string()));
|
893
|
+
envoy_config_core_v3_Node_add_client_features(
|
894
|
+
node_msg, upb_strview_makez("envoy.lb.does_not_support_overprovisioning"),
|
895
|
+
arena);
|
896
|
+
}
|
897
|
+
|
898
|
+
inline absl::string_view UpbStringToAbsl(const upb_strview& str) {
|
899
|
+
return absl::string_view(str.data, str.size);
|
900
|
+
}
|
901
|
+
|
902
|
+
inline std::string UpbStringToStdString(const upb_strview& str) {
|
903
|
+
return std::string(str.data, str.size);
|
904
|
+
}
|
905
|
+
|
906
|
+
void MaybeLogDiscoveryRequest(
|
907
|
+
XdsClient* client, TraceFlag* tracer, upb_symtab* symtab,
|
908
|
+
const envoy_service_discovery_v3_DiscoveryRequest* request) {
|
909
|
+
if (GRPC_TRACE_FLAG_ENABLED(*tracer) &&
|
910
|
+
gpr_should_log(GPR_LOG_SEVERITY_DEBUG)) {
|
911
|
+
const upb_msgdef* msg_type =
|
912
|
+
envoy_service_discovery_v3_DiscoveryRequest_getmsgdef(symtab);
|
913
|
+
char buf[10240];
|
914
|
+
upb_text_encode(request, msg_type, nullptr, 0, buf, sizeof(buf));
|
915
|
+
gpr_log(GPR_DEBUG, "[xds_client %p] constructed ADS request: %s", client,
|
916
|
+
buf);
|
917
|
+
}
|
918
|
+
}
|
919
|
+
|
920
|
+
grpc_slice SerializeDiscoveryRequest(
|
921
|
+
upb_arena* arena, envoy_service_discovery_v3_DiscoveryRequest* request) {
|
922
|
+
size_t output_length;
|
923
|
+
char* output = envoy_service_discovery_v3_DiscoveryRequest_serialize(
|
924
|
+
request, arena, &output_length);
|
925
|
+
return grpc_slice_from_copied_buffer(output, output_length);
|
926
|
+
}
|
927
|
+
|
928
|
+
absl::string_view TypeUrlExternalToInternal(bool use_v3,
|
929
|
+
const std::string& type_url) {
|
930
|
+
if (!use_v3) {
|
931
|
+
if (type_url == XdsApi::kLdsTypeUrl) {
|
932
|
+
return kLdsV2TypeUrl;
|
933
|
+
}
|
934
|
+
if (type_url == XdsApi::kRdsTypeUrl) {
|
935
|
+
return kRdsV2TypeUrl;
|
936
|
+
}
|
937
|
+
if (type_url == XdsApi::kCdsTypeUrl) {
|
938
|
+
return kCdsV2TypeUrl;
|
939
|
+
}
|
940
|
+
if (type_url == XdsApi::kEdsTypeUrl) {
|
941
|
+
return kEdsV2TypeUrl;
|
942
|
+
}
|
943
|
+
}
|
944
|
+
return type_url;
|
945
|
+
}
|
946
|
+
|
947
|
+
} // namespace
|
948
|
+
|
949
|
+
grpc_slice XdsApi::CreateAdsRequest(
|
950
|
+
const XdsBootstrap::XdsServer& server, const std::string& type_url,
|
951
|
+
const std::set<absl::string_view>& resource_names,
|
952
|
+
const std::string& version, const std::string& nonce, grpc_error* error,
|
953
|
+
bool populate_node) {
|
954
|
+
upb::Arena arena;
|
955
|
+
// Create a request.
|
956
|
+
envoy_service_discovery_v3_DiscoveryRequest* request =
|
957
|
+
envoy_service_discovery_v3_DiscoveryRequest_new(arena.ptr());
|
958
|
+
// Set type_url.
|
959
|
+
absl::string_view real_type_url =
|
960
|
+
TypeUrlExternalToInternal(server.ShouldUseV3(), type_url);
|
961
|
+
envoy_service_discovery_v3_DiscoveryRequest_set_type_url(
|
962
|
+
request, StdStringToUpbString(real_type_url));
|
963
|
+
// Set version_info.
|
964
|
+
if (!version.empty()) {
|
965
|
+
envoy_service_discovery_v3_DiscoveryRequest_set_version_info(
|
966
|
+
request, StdStringToUpbString(version));
|
967
|
+
}
|
968
|
+
// Set nonce.
|
969
|
+
if (!nonce.empty()) {
|
970
|
+
envoy_service_discovery_v3_DiscoveryRequest_set_response_nonce(
|
971
|
+
request, StdStringToUpbString(nonce));
|
972
|
+
}
|
973
|
+
// Set error_detail if it's a NACK.
|
974
|
+
if (error != GRPC_ERROR_NONE) {
|
975
|
+
google_rpc_Status* error_detail =
|
976
|
+
envoy_service_discovery_v3_DiscoveryRequest_mutable_error_detail(
|
977
|
+
request, arena.ptr());
|
978
|
+
// Hard-code INVALID_ARGUMENT as the status code.
|
979
|
+
// TODO(roth): If at some point we decide we care about this value,
|
980
|
+
// we could attach a status code to the individual errors where we
|
981
|
+
// generate them in the parsing code, and then use that here.
|
982
|
+
google_rpc_Status_set_code(error_detail, GRPC_STATUS_INVALID_ARGUMENT);
|
983
|
+
// Error description comes from the error that was passed in.
|
984
|
+
grpc_slice error_description_slice;
|
985
|
+
GPR_ASSERT(grpc_error_get_str(error, GRPC_ERROR_STR_DESCRIPTION,
|
986
|
+
&error_description_slice));
|
987
|
+
upb_strview error_description_strview =
|
988
|
+
StdStringToUpbString(StringViewFromSlice(error_description_slice));
|
989
|
+
google_rpc_Status_set_message(error_detail, error_description_strview);
|
990
|
+
GRPC_ERROR_UNREF(error);
|
991
|
+
}
|
992
|
+
// Populate node.
|
993
|
+
if (populate_node) {
|
994
|
+
envoy_config_core_v3_Node* node_msg =
|
995
|
+
envoy_service_discovery_v3_DiscoveryRequest_mutable_node(request,
|
996
|
+
arena.ptr());
|
997
|
+
PopulateNode(arena.ptr(), node_, server.ShouldUseV3(), build_version_,
|
998
|
+
user_agent_name_, node_msg);
|
999
|
+
}
|
1000
|
+
// Add resource_names.
|
1001
|
+
for (const auto& resource_name : resource_names) {
|
1002
|
+
envoy_service_discovery_v3_DiscoveryRequest_add_resource_names(
|
1003
|
+
request, StdStringToUpbString(resource_name), arena.ptr());
|
1004
|
+
}
|
1005
|
+
MaybeLogDiscoveryRequest(client_, tracer_, symtab_.ptr(), request);
|
1006
|
+
return SerializeDiscoveryRequest(arena.ptr(), request);
|
1007
|
+
}
|
1008
|
+
|
1009
|
+
namespace {
|
1010
|
+
|
1011
|
+
void MaybeLogDiscoveryResponse(
|
1012
|
+
XdsClient* client, TraceFlag* tracer, upb_symtab* symtab,
|
1013
|
+
const envoy_service_discovery_v3_DiscoveryResponse* response) {
|
1014
|
+
if (GRPC_TRACE_FLAG_ENABLED(*tracer) &&
|
1015
|
+
gpr_should_log(GPR_LOG_SEVERITY_DEBUG)) {
|
1016
|
+
const upb_msgdef* msg_type =
|
1017
|
+
envoy_service_discovery_v3_DiscoveryResponse_getmsgdef(symtab);
|
1018
|
+
char buf[10240];
|
1019
|
+
upb_text_encode(response, msg_type, nullptr, 0, buf, sizeof(buf));
|
1020
|
+
gpr_log(GPR_DEBUG, "[xds_client %p] received response: %s", client, buf);
|
1021
|
+
}
|
1022
|
+
}
|
1023
|
+
|
1024
|
+
void MaybeLogRouteConfiguration(
|
1025
|
+
XdsClient* client, TraceFlag* tracer, upb_symtab* symtab,
|
1026
|
+
const envoy_config_route_v3_RouteConfiguration* route_config) {
|
1027
|
+
if (GRPC_TRACE_FLAG_ENABLED(*tracer) &&
|
1028
|
+
gpr_should_log(GPR_LOG_SEVERITY_DEBUG)) {
|
1029
|
+
const upb_msgdef* msg_type =
|
1030
|
+
envoy_config_route_v3_RouteConfiguration_getmsgdef(symtab);
|
1031
|
+
char buf[10240];
|
1032
|
+
upb_text_encode(route_config, msg_type, nullptr, 0, buf, sizeof(buf));
|
1033
|
+
gpr_log(GPR_DEBUG, "[xds_client %p] RouteConfiguration: %s", client, buf);
|
1034
|
+
}
|
1035
|
+
}
|
1036
|
+
|
1037
|
+
void MaybeLogCluster(XdsClient* client, TraceFlag* tracer, upb_symtab* symtab,
|
1038
|
+
const envoy_config_cluster_v3_Cluster* cluster) {
|
1039
|
+
if (GRPC_TRACE_FLAG_ENABLED(*tracer) &&
|
1040
|
+
gpr_should_log(GPR_LOG_SEVERITY_DEBUG)) {
|
1041
|
+
const upb_msgdef* msg_type =
|
1042
|
+
envoy_config_cluster_v3_Cluster_getmsgdef(symtab);
|
1043
|
+
char buf[10240];
|
1044
|
+
upb_text_encode(cluster, msg_type, nullptr, 0, buf, sizeof(buf));
|
1045
|
+
gpr_log(GPR_DEBUG, "[xds_client %p] Cluster: %s", client, buf);
|
1046
|
+
}
|
1047
|
+
}
|
1048
|
+
|
1049
|
+
void MaybeLogClusterLoadAssignment(
|
1050
|
+
XdsClient* client, TraceFlag* tracer, upb_symtab* symtab,
|
1051
|
+
const envoy_config_endpoint_v3_ClusterLoadAssignment* cla) {
|
1052
|
+
if (GRPC_TRACE_FLAG_ENABLED(*tracer) &&
|
1053
|
+
gpr_should_log(GPR_LOG_SEVERITY_DEBUG)) {
|
1054
|
+
const upb_msgdef* msg_type =
|
1055
|
+
envoy_config_endpoint_v3_ClusterLoadAssignment_getmsgdef(symtab);
|
1056
|
+
char buf[10240];
|
1057
|
+
upb_text_encode(cla, msg_type, nullptr, 0, buf, sizeof(buf));
|
1058
|
+
gpr_log(GPR_DEBUG, "[xds_client %p] ClusterLoadAssignment: %s", client,
|
1059
|
+
buf);
|
1060
|
+
}
|
1061
|
+
}
|
1062
|
+
|
1063
|
+
grpc_error* RoutePathMatchParse(const envoy_config_route_v3_RouteMatch* match,
|
1064
|
+
XdsApi::Route* route, bool* ignore_route) {
|
1065
|
+
auto* case_sensitive = envoy_config_route_v3_RouteMatch_case_sensitive(match);
|
1066
|
+
if (case_sensitive != nullptr) {
|
1067
|
+
route->matchers.path_matcher.case_sensitive =
|
1068
|
+
google_protobuf_BoolValue_value(case_sensitive);
|
1069
|
+
}
|
1070
|
+
if (envoy_config_route_v3_RouteMatch_has_prefix(match)) {
|
1071
|
+
absl::string_view prefix =
|
1072
|
+
UpbStringToAbsl(envoy_config_route_v3_RouteMatch_prefix(match));
|
1073
|
+
// Empty prefix "" is accepted.
|
1074
|
+
if (!prefix.empty()) {
|
1075
|
+
// Prefix "/" is accepted.
|
1076
|
+
if (prefix[0] != '/') {
|
1077
|
+
// Prefix which does not start with a / will never match anything, so
|
1078
|
+
// ignore this route.
|
1079
|
+
*ignore_route = true;
|
1080
|
+
return GRPC_ERROR_NONE;
|
1081
|
+
}
|
1082
|
+
std::vector<absl::string_view> prefix_elements =
|
1083
|
+
absl::StrSplit(prefix.substr(1), absl::MaxSplits('/', 2));
|
1084
|
+
if (prefix_elements.size() > 2) {
|
1085
|
+
// Prefix cannot have more than 2 slashes.
|
1086
|
+
*ignore_route = true;
|
1087
|
+
return GRPC_ERROR_NONE;
|
1088
|
+
} else if (prefix_elements.size() == 2 && prefix_elements[0].empty()) {
|
1089
|
+
// Prefix contains empty string between the 2 slashes
|
1090
|
+
*ignore_route = true;
|
1091
|
+
return GRPC_ERROR_NONE;
|
1092
|
+
}
|
1093
|
+
}
|
1094
|
+
route->matchers.path_matcher.type =
|
1095
|
+
XdsApi::Route::Matchers::PathMatcher::PathMatcherType::PREFIX;
|
1096
|
+
route->matchers.path_matcher.string_matcher = std::string(prefix);
|
1097
|
+
} else if (envoy_config_route_v3_RouteMatch_has_path(match)) {
|
1098
|
+
absl::string_view path =
|
1099
|
+
UpbStringToAbsl(envoy_config_route_v3_RouteMatch_path(match));
|
1100
|
+
if (path.empty()) {
|
1101
|
+
// Path that is empty will never match anything, so ignore this route.
|
1102
|
+
*ignore_route = true;
|
1103
|
+
return GRPC_ERROR_NONE;
|
1104
|
+
}
|
1105
|
+
if (path[0] != '/') {
|
1106
|
+
// Path which does not start with a / will never match anything, so
|
1107
|
+
// ignore this route.
|
1108
|
+
*ignore_route = true;
|
1109
|
+
return GRPC_ERROR_NONE;
|
1110
|
+
}
|
1111
|
+
std::vector<absl::string_view> path_elements =
|
1112
|
+
absl::StrSplit(path.substr(1), absl::MaxSplits('/', 2));
|
1113
|
+
if (path_elements.size() != 2) {
|
1114
|
+
// Path not in the required format of /service/method will never match
|
1115
|
+
// anything, so ignore this route.
|
1116
|
+
*ignore_route = true;
|
1117
|
+
return GRPC_ERROR_NONE;
|
1118
|
+
} else if (path_elements[0].empty()) {
|
1119
|
+
// Path contains empty service name will never match anything, so ignore
|
1120
|
+
// this route.
|
1121
|
+
*ignore_route = true;
|
1122
|
+
return GRPC_ERROR_NONE;
|
1123
|
+
} else if (path_elements[1].empty()) {
|
1124
|
+
// Path contains empty method name will never match anything, so ignore
|
1125
|
+
// this route.
|
1126
|
+
*ignore_route = true;
|
1127
|
+
return GRPC_ERROR_NONE;
|
1128
|
+
}
|
1129
|
+
route->matchers.path_matcher.type =
|
1130
|
+
XdsApi::Route::Matchers::PathMatcher::PathMatcherType::PATH;
|
1131
|
+
route->matchers.path_matcher.string_matcher = std::string(path);
|
1132
|
+
} else if (envoy_config_route_v3_RouteMatch_has_safe_regex(match)) {
|
1133
|
+
const envoy_type_matcher_v3_RegexMatcher* regex_matcher =
|
1134
|
+
envoy_config_route_v3_RouteMatch_safe_regex(match);
|
1135
|
+
GPR_ASSERT(regex_matcher != nullptr);
|
1136
|
+
std::string matcher = UpbStringToStdString(
|
1137
|
+
envoy_type_matcher_v3_RegexMatcher_regex(regex_matcher));
|
1138
|
+
RE2::Options options;
|
1139
|
+
options.set_case_sensitive(route->matchers.path_matcher.case_sensitive);
|
1140
|
+
auto regex = absl::make_unique<RE2>(std::move(matcher), options);
|
1141
|
+
if (!regex->ok()) {
|
1142
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1143
|
+
"Invalid regex string specified in path matcher.");
|
1144
|
+
}
|
1145
|
+
route->matchers.path_matcher.type =
|
1146
|
+
XdsApi::Route::Matchers::PathMatcher::PathMatcherType::REGEX;
|
1147
|
+
route->matchers.path_matcher.regex_matcher = std::move(regex);
|
1148
|
+
} else {
|
1149
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1150
|
+
"Invalid route path specifier specified.");
|
1151
|
+
}
|
1152
|
+
return GRPC_ERROR_NONE;
|
1153
|
+
}
|
1154
|
+
|
1155
|
+
grpc_error* RouteHeaderMatchersParse(
|
1156
|
+
const envoy_config_route_v3_RouteMatch* match, XdsApi::Route* route) {
|
1157
|
+
size_t size;
|
1158
|
+
const envoy_config_route_v3_HeaderMatcher* const* headers =
|
1159
|
+
envoy_config_route_v3_RouteMatch_headers(match, &size);
|
1160
|
+
for (size_t i = 0; i < size; ++i) {
|
1161
|
+
const envoy_config_route_v3_HeaderMatcher* header = headers[i];
|
1162
|
+
XdsApi::Route::Matchers::HeaderMatcher header_matcher;
|
1163
|
+
header_matcher.name =
|
1164
|
+
UpbStringToStdString(envoy_config_route_v3_HeaderMatcher_name(header));
|
1165
|
+
if (envoy_config_route_v3_HeaderMatcher_has_exact_match(header)) {
|
1166
|
+
header_matcher.type =
|
1167
|
+
XdsApi::Route::Matchers::HeaderMatcher::HeaderMatcherType::EXACT;
|
1168
|
+
header_matcher.string_matcher = UpbStringToStdString(
|
1169
|
+
envoy_config_route_v3_HeaderMatcher_exact_match(header));
|
1170
|
+
} else if (envoy_config_route_v3_HeaderMatcher_has_safe_regex_match(
|
1171
|
+
header)) {
|
1172
|
+
const envoy_type_matcher_v3_RegexMatcher* regex_matcher =
|
1173
|
+
envoy_config_route_v3_HeaderMatcher_safe_regex_match(header);
|
1174
|
+
GPR_ASSERT(regex_matcher != nullptr);
|
1175
|
+
const std::string matcher = UpbStringToStdString(
|
1176
|
+
envoy_type_matcher_v3_RegexMatcher_regex(regex_matcher));
|
1177
|
+
std::unique_ptr<RE2> regex = absl::make_unique<RE2>(matcher);
|
1178
|
+
if (!regex->ok()) {
|
1179
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1180
|
+
"Invalid regex string specified in header matcher.");
|
1181
|
+
}
|
1182
|
+
header_matcher.type =
|
1183
|
+
XdsApi::Route::Matchers::HeaderMatcher::HeaderMatcherType::REGEX;
|
1184
|
+
header_matcher.regex_match = std::move(regex);
|
1185
|
+
} else if (envoy_config_route_v3_HeaderMatcher_has_range_match(header)) {
|
1186
|
+
header_matcher.type =
|
1187
|
+
XdsApi::Route::Matchers::HeaderMatcher::HeaderMatcherType::RANGE;
|
1188
|
+
const envoy_type_v3_Int64Range* range_matcher =
|
1189
|
+
envoy_config_route_v3_HeaderMatcher_range_match(header);
|
1190
|
+
header_matcher.range_start =
|
1191
|
+
envoy_type_v3_Int64Range_start(range_matcher);
|
1192
|
+
header_matcher.range_end = envoy_type_v3_Int64Range_end(range_matcher);
|
1193
|
+
if (header_matcher.range_end < header_matcher.range_start) {
|
1194
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1195
|
+
"Invalid range header matcher specifier specified: end "
|
1196
|
+
"cannot be smaller than start.");
|
1197
|
+
}
|
1198
|
+
} else if (envoy_config_route_v3_HeaderMatcher_has_present_match(header)) {
|
1199
|
+
header_matcher.type =
|
1200
|
+
XdsApi::Route::Matchers::HeaderMatcher::HeaderMatcherType::PRESENT;
|
1201
|
+
header_matcher.present_match =
|
1202
|
+
envoy_config_route_v3_HeaderMatcher_present_match(header);
|
1203
|
+
} else if (envoy_config_route_v3_HeaderMatcher_has_prefix_match(header)) {
|
1204
|
+
header_matcher.type =
|
1205
|
+
XdsApi::Route::Matchers::HeaderMatcher::HeaderMatcherType::PREFIX;
|
1206
|
+
header_matcher.string_matcher = UpbStringToStdString(
|
1207
|
+
envoy_config_route_v3_HeaderMatcher_prefix_match(header));
|
1208
|
+
} else if (envoy_config_route_v3_HeaderMatcher_has_suffix_match(header)) {
|
1209
|
+
header_matcher.type =
|
1210
|
+
XdsApi::Route::Matchers::HeaderMatcher::HeaderMatcherType::SUFFIX;
|
1211
|
+
header_matcher.string_matcher = UpbStringToStdString(
|
1212
|
+
envoy_config_route_v3_HeaderMatcher_suffix_match(header));
|
1213
|
+
} else {
|
1214
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1215
|
+
"Invalid route header matcher specified.");
|
1216
|
+
}
|
1217
|
+
header_matcher.invert_match =
|
1218
|
+
envoy_config_route_v3_HeaderMatcher_invert_match(header);
|
1219
|
+
route->matchers.header_matchers.emplace_back(std::move(header_matcher));
|
1220
|
+
}
|
1221
|
+
return GRPC_ERROR_NONE;
|
1222
|
+
}
|
1223
|
+
|
1224
|
+
grpc_error* RouteRuntimeFractionParse(
|
1225
|
+
const envoy_config_route_v3_RouteMatch* match, XdsApi::Route* route) {
|
1226
|
+
const envoy_config_core_v3_RuntimeFractionalPercent* runtime_fraction =
|
1227
|
+
envoy_config_route_v3_RouteMatch_runtime_fraction(match);
|
1228
|
+
if (runtime_fraction != nullptr) {
|
1229
|
+
const envoy_type_v3_FractionalPercent* fraction =
|
1230
|
+
envoy_config_core_v3_RuntimeFractionalPercent_default_value(
|
1231
|
+
runtime_fraction);
|
1232
|
+
if (fraction != nullptr) {
|
1233
|
+
uint32_t numerator = envoy_type_v3_FractionalPercent_numerator(fraction);
|
1234
|
+
const auto denominator =
|
1235
|
+
static_cast<envoy_type_v3_FractionalPercent_DenominatorType>(
|
1236
|
+
envoy_type_v3_FractionalPercent_denominator(fraction));
|
1237
|
+
// Normalize to million.
|
1238
|
+
switch (denominator) {
|
1239
|
+
case envoy_type_v3_FractionalPercent_HUNDRED:
|
1240
|
+
numerator *= 10000;
|
1241
|
+
break;
|
1242
|
+
case envoy_type_v3_FractionalPercent_TEN_THOUSAND:
|
1243
|
+
numerator *= 100;
|
1244
|
+
break;
|
1245
|
+
case envoy_type_v3_FractionalPercent_MILLION:
|
1246
|
+
break;
|
1247
|
+
default:
|
1248
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1249
|
+
"Unknown denominator type");
|
1250
|
+
}
|
1251
|
+
route->matchers.fraction_per_million = numerator;
|
1252
|
+
}
|
1253
|
+
}
|
1254
|
+
return GRPC_ERROR_NONE;
|
1255
|
+
}
|
1256
|
+
|
1257
|
+
grpc_error* RouteActionParse(const envoy_config_route_v3_Route* route_msg,
|
1258
|
+
XdsApi::Route* route, bool* ignore_route) {
|
1259
|
+
if (!envoy_config_route_v3_Route_has_route(route_msg)) {
|
1260
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1261
|
+
"No RouteAction found in route.");
|
1262
|
+
}
|
1263
|
+
const envoy_config_route_v3_RouteAction* route_action =
|
1264
|
+
envoy_config_route_v3_Route_route(route_msg);
|
1265
|
+
// Get the cluster or weighted_clusters in the RouteAction.
|
1266
|
+
if (envoy_config_route_v3_RouteAction_has_cluster(route_action)) {
|
1267
|
+
route->cluster_name = UpbStringToStdString(
|
1268
|
+
envoy_config_route_v3_RouteAction_cluster(route_action));
|
1269
|
+
if (route->cluster_name.empty()) {
|
1270
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1271
|
+
"RouteAction cluster contains empty cluster name.");
|
1272
|
+
}
|
1273
|
+
} else if (envoy_config_route_v3_RouteAction_has_weighted_clusters(
|
1274
|
+
route_action)) {
|
1275
|
+
const envoy_config_route_v3_WeightedCluster* weighted_cluster =
|
1276
|
+
envoy_config_route_v3_RouteAction_weighted_clusters(route_action);
|
1277
|
+
uint32_t total_weight = 100;
|
1278
|
+
const google_protobuf_UInt32Value* weight =
|
1279
|
+
envoy_config_route_v3_WeightedCluster_total_weight(weighted_cluster);
|
1280
|
+
if (weight != nullptr) {
|
1281
|
+
total_weight = google_protobuf_UInt32Value_value(weight);
|
1282
|
+
}
|
1283
|
+
size_t clusters_size;
|
1284
|
+
const envoy_config_route_v3_WeightedCluster_ClusterWeight* const* clusters =
|
1285
|
+
envoy_config_route_v3_WeightedCluster_clusters(weighted_cluster,
|
1286
|
+
&clusters_size);
|
1287
|
+
uint32_t sum_of_weights = 0;
|
1288
|
+
for (size_t j = 0; j < clusters_size; ++j) {
|
1289
|
+
const envoy_config_route_v3_WeightedCluster_ClusterWeight*
|
1290
|
+
cluster_weight = clusters[j];
|
1291
|
+
XdsApi::Route::ClusterWeight cluster;
|
1292
|
+
cluster.name = UpbStringToStdString(
|
1293
|
+
envoy_config_route_v3_WeightedCluster_ClusterWeight_name(
|
1294
|
+
cluster_weight));
|
1295
|
+
if (cluster.name.empty()) {
|
1296
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1297
|
+
"RouteAction weighted_cluster cluster contains empty cluster "
|
1298
|
+
"name.");
|
1299
|
+
}
|
1300
|
+
const google_protobuf_UInt32Value* weight =
|
1301
|
+
envoy_config_route_v3_WeightedCluster_ClusterWeight_weight(
|
1302
|
+
cluster_weight);
|
1303
|
+
if (weight == nullptr) {
|
1304
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1305
|
+
"RouteAction weighted_cluster cluster missing weight");
|
1306
|
+
}
|
1307
|
+
cluster.weight = google_protobuf_UInt32Value_value(weight);
|
1308
|
+
if (cluster.weight == 0) continue;
|
1309
|
+
sum_of_weights += cluster.weight;
|
1310
|
+
route->weighted_clusters.emplace_back(std::move(cluster));
|
1311
|
+
}
|
1312
|
+
if (total_weight != sum_of_weights) {
|
1313
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1314
|
+
"RouteAction weighted_cluster has incorrect total weight");
|
1315
|
+
}
|
1316
|
+
if (route->weighted_clusters.empty()) {
|
1317
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1318
|
+
"RouteAction weighted_cluster has no valid clusters specified.");
|
1319
|
+
}
|
1320
|
+
} else {
|
1321
|
+
// No cluster or weighted_clusters found in RouteAction, ignore this route.
|
1322
|
+
*ignore_route = true;
|
1323
|
+
}
|
1324
|
+
if (XdsTimeoutEnabled() && !*ignore_route) {
|
1325
|
+
const envoy_config_route_v3_RouteAction_MaxStreamDuration*
|
1326
|
+
max_stream_duration =
|
1327
|
+
envoy_config_route_v3_RouteAction_max_stream_duration(route_action);
|
1328
|
+
if (max_stream_duration != nullptr) {
|
1329
|
+
const google_protobuf_Duration* duration =
|
1330
|
+
envoy_config_route_v3_RouteAction_MaxStreamDuration_grpc_timeout_header_max(
|
1331
|
+
max_stream_duration);
|
1332
|
+
if (duration == nullptr) {
|
1333
|
+
duration =
|
1334
|
+
envoy_config_route_v3_RouteAction_MaxStreamDuration_max_stream_duration(
|
1335
|
+
max_stream_duration);
|
1336
|
+
}
|
1337
|
+
if (duration != nullptr) {
|
1338
|
+
XdsApi::Duration duration_in_route;
|
1339
|
+
duration_in_route.seconds = google_protobuf_Duration_seconds(duration);
|
1340
|
+
duration_in_route.nanos = google_protobuf_Duration_nanos(duration);
|
1341
|
+
route->max_stream_duration = duration_in_route;
|
1342
|
+
}
|
1343
|
+
}
|
1344
|
+
}
|
1345
|
+
return GRPC_ERROR_NONE;
|
1346
|
+
}
|
1347
|
+
|
1348
|
+
grpc_error* RouteConfigParse(
|
1349
|
+
XdsClient* client, TraceFlag* tracer, upb_symtab* symtab,
|
1350
|
+
const envoy_config_route_v3_RouteConfiguration* route_config,
|
1351
|
+
XdsApi::RdsUpdate* rds_update) {
|
1352
|
+
MaybeLogRouteConfiguration(client, tracer, symtab, route_config);
|
1353
|
+
// Get the virtual hosts.
|
1354
|
+
size_t size;
|
1355
|
+
const envoy_config_route_v3_VirtualHost* const* virtual_hosts =
|
1356
|
+
envoy_config_route_v3_RouteConfiguration_virtual_hosts(route_config,
|
1357
|
+
&size);
|
1358
|
+
for (size_t i = 0; i < size; ++i) {
|
1359
|
+
rds_update->virtual_hosts.emplace_back();
|
1360
|
+
XdsApi::RdsUpdate::VirtualHost& vhost = rds_update->virtual_hosts.back();
|
1361
|
+
// Parse domains.
|
1362
|
+
size_t domain_size;
|
1363
|
+
upb_strview const* domains = envoy_config_route_v3_VirtualHost_domains(
|
1364
|
+
virtual_hosts[i], &domain_size);
|
1365
|
+
for (size_t j = 0; j < domain_size; ++j) {
|
1366
|
+
std::string domain_pattern = UpbStringToStdString(domains[j]);
|
1367
|
+
const MatchType match_type = DomainPatternMatchType(domain_pattern);
|
1368
|
+
if (match_type == INVALID_MATCH) {
|
1369
|
+
return GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
1370
|
+
absl::StrCat("Invalid domain pattern \"", domain_pattern, "\".")
|
1371
|
+
.c_str());
|
1372
|
+
}
|
1373
|
+
vhost.domains.emplace_back(std::move(domain_pattern));
|
1374
|
+
}
|
1375
|
+
if (vhost.domains.empty()) {
|
1376
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING("VirtualHost has no domains");
|
1377
|
+
}
|
1378
|
+
// Parse routes.
|
1379
|
+
size_t num_routes;
|
1380
|
+
const envoy_config_route_v3_Route* const* routes =
|
1381
|
+
envoy_config_route_v3_VirtualHost_routes(virtual_hosts[i], &num_routes);
|
1382
|
+
if (num_routes < 1) {
|
1383
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1384
|
+
"No route found in the virtual host.");
|
1385
|
+
}
|
1386
|
+
// Loop over the whole list of routes
|
1387
|
+
for (size_t j = 0; j < num_routes; ++j) {
|
1388
|
+
const envoy_config_route_v3_RouteMatch* match =
|
1389
|
+
envoy_config_route_v3_Route_match(routes[j]);
|
1390
|
+
size_t query_parameters_size;
|
1391
|
+
static_cast<void>(envoy_config_route_v3_RouteMatch_query_parameters(
|
1392
|
+
match, &query_parameters_size));
|
1393
|
+
if (query_parameters_size > 0) {
|
1394
|
+
continue;
|
1395
|
+
}
|
1396
|
+
XdsApi::Route route;
|
1397
|
+
bool ignore_route = false;
|
1398
|
+
grpc_error* error = RoutePathMatchParse(match, &route, &ignore_route);
|
1399
|
+
if (error != GRPC_ERROR_NONE) return error;
|
1400
|
+
if (ignore_route) continue;
|
1401
|
+
error = RouteHeaderMatchersParse(match, &route);
|
1402
|
+
if (error != GRPC_ERROR_NONE) return error;
|
1403
|
+
error = RouteRuntimeFractionParse(match, &route);
|
1404
|
+
if (error != GRPC_ERROR_NONE) return error;
|
1405
|
+
error = RouteActionParse(routes[j], &route, &ignore_route);
|
1406
|
+
if (error != GRPC_ERROR_NONE) return error;
|
1407
|
+
if (ignore_route) continue;
|
1408
|
+
vhost.routes.emplace_back(std::move(route));
|
1409
|
+
}
|
1410
|
+
if (vhost.routes.empty()) {
|
1411
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING("No valid routes specified.");
|
1412
|
+
}
|
1413
|
+
}
|
1414
|
+
return GRPC_ERROR_NONE;
|
1415
|
+
}
|
1416
|
+
|
1417
|
+
grpc_error* LdsResponseParse(
|
1418
|
+
XdsClient* client, TraceFlag* tracer, upb_symtab* symtab,
|
1419
|
+
const envoy_service_discovery_v3_DiscoveryResponse* response,
|
1420
|
+
const std::set<absl::string_view>& expected_listener_names,
|
1421
|
+
XdsApi::LdsUpdateMap* lds_update_map, upb_arena* arena) {
|
1422
|
+
// Get the resources from the response.
|
1423
|
+
size_t size;
|
1424
|
+
const google_protobuf_Any* const* resources =
|
1425
|
+
envoy_service_discovery_v3_DiscoveryResponse_resources(response, &size);
|
1426
|
+
for (size_t i = 0; i < size; ++i) {
|
1427
|
+
// Check the type_url of the resource.
|
1428
|
+
absl::string_view type_url =
|
1429
|
+
UpbStringToAbsl(google_protobuf_Any_type_url(resources[i]));
|
1430
|
+
if (!IsLds(type_url)) {
|
1431
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING("Resource is not LDS.");
|
1432
|
+
}
|
1433
|
+
// Decode the listener.
|
1434
|
+
const upb_strview encoded_listener =
|
1435
|
+
google_protobuf_Any_value(resources[i]);
|
1436
|
+
const envoy_config_listener_v3_Listener* listener =
|
1437
|
+
envoy_config_listener_v3_Listener_parse(encoded_listener.data,
|
1438
|
+
encoded_listener.size, arena);
|
1439
|
+
if (listener == nullptr) {
|
1440
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING("Can't decode listener.");
|
1441
|
+
}
|
1442
|
+
// Check listener name. Ignore unexpected listeners.
|
1443
|
+
std::string listener_name =
|
1444
|
+
UpbStringToStdString(envoy_config_listener_v3_Listener_name(listener));
|
1445
|
+
if (expected_listener_names.find(listener_name) ==
|
1446
|
+
expected_listener_names.end()) {
|
1447
|
+
continue;
|
1448
|
+
}
|
1449
|
+
// Fail if listener name is duplicated.
|
1450
|
+
if (lds_update_map->find(listener_name) != lds_update_map->end()) {
|
1451
|
+
return GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
1452
|
+
absl::StrCat("duplicate listener name \"", listener_name, "\"")
|
1453
|
+
.c_str());
|
1454
|
+
}
|
1455
|
+
XdsApi::LdsUpdate& lds_update = (*lds_update_map)[listener_name];
|
1456
|
+
// Get api_listener and decode it to http_connection_manager.
|
1457
|
+
const envoy_config_listener_v3_ApiListener* api_listener =
|
1458
|
+
envoy_config_listener_v3_Listener_api_listener(listener);
|
1459
|
+
if (api_listener == nullptr) {
|
1460
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1461
|
+
"Listener has no ApiListener.");
|
1462
|
+
}
|
1463
|
+
const upb_strview encoded_api_listener = google_protobuf_Any_value(
|
1464
|
+
envoy_config_listener_v3_ApiListener_api_listener(api_listener));
|
1465
|
+
const envoy_extensions_filters_network_http_connection_manager_v3_HttpConnectionManager*
|
1466
|
+
http_connection_manager =
|
1467
|
+
envoy_extensions_filters_network_http_connection_manager_v3_HttpConnectionManager_parse(
|
1468
|
+
encoded_api_listener.data, encoded_api_listener.size, arena);
|
1469
|
+
if (http_connection_manager == nullptr) {
|
1470
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1471
|
+
"Could not parse HttpConnectionManager config from ApiListener");
|
1472
|
+
}
|
1473
|
+
if (XdsTimeoutEnabled()) {
|
1474
|
+
// Obtain max_stream_duration from Http Protocol Options.
|
1475
|
+
const envoy_config_core_v3_HttpProtocolOptions* options =
|
1476
|
+
envoy_extensions_filters_network_http_connection_manager_v3_HttpConnectionManager_common_http_protocol_options(
|
1477
|
+
http_connection_manager);
|
1478
|
+
if (options != nullptr) {
|
1479
|
+
const google_protobuf_Duration* duration =
|
1480
|
+
envoy_config_core_v3_HttpProtocolOptions_max_stream_duration(
|
1481
|
+
options);
|
1482
|
+
if (duration != nullptr) {
|
1483
|
+
lds_update.http_max_stream_duration.seconds =
|
1484
|
+
google_protobuf_Duration_seconds(duration);
|
1485
|
+
lds_update.http_max_stream_duration.nanos =
|
1486
|
+
google_protobuf_Duration_nanos(duration);
|
1487
|
+
}
|
1488
|
+
}
|
1489
|
+
}
|
1490
|
+
// Found inlined route_config. Parse it to find the cluster_name.
|
1491
|
+
if (envoy_extensions_filters_network_http_connection_manager_v3_HttpConnectionManager_has_route_config(
|
1492
|
+
http_connection_manager)) {
|
1493
|
+
const envoy_config_route_v3_RouteConfiguration* route_config =
|
1494
|
+
envoy_extensions_filters_network_http_connection_manager_v3_HttpConnectionManager_route_config(
|
1495
|
+
http_connection_manager);
|
1496
|
+
XdsApi::RdsUpdate rds_update;
|
1497
|
+
grpc_error* error =
|
1498
|
+
RouteConfigParse(client, tracer, symtab, route_config, &rds_update);
|
1499
|
+
if (error != GRPC_ERROR_NONE) return error;
|
1500
|
+
lds_update.rds_update = std::move(rds_update);
|
1501
|
+
continue;
|
1502
|
+
}
|
1503
|
+
// Validate that RDS must be used to get the route_config dynamically.
|
1504
|
+
if (!envoy_extensions_filters_network_http_connection_manager_v3_HttpConnectionManager_has_rds(
|
1505
|
+
http_connection_manager)) {
|
1506
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1507
|
+
"HttpConnectionManager neither has inlined route_config nor RDS.");
|
1508
|
+
}
|
1509
|
+
const envoy_extensions_filters_network_http_connection_manager_v3_Rds* rds =
|
1510
|
+
envoy_extensions_filters_network_http_connection_manager_v3_HttpConnectionManager_rds(
|
1511
|
+
http_connection_manager);
|
1512
|
+
// Check that the ConfigSource specifies ADS.
|
1513
|
+
const envoy_config_core_v3_ConfigSource* config_source =
|
1514
|
+
envoy_extensions_filters_network_http_connection_manager_v3_Rds_config_source(
|
1515
|
+
rds);
|
1516
|
+
if (config_source == nullptr) {
|
1517
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1518
|
+
"HttpConnectionManager missing config_source for RDS.");
|
1519
|
+
}
|
1520
|
+
if (!envoy_config_core_v3_ConfigSource_has_ads(config_source)) {
|
1521
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1522
|
+
"HttpConnectionManager ConfigSource for RDS does not specify ADS.");
|
1523
|
+
}
|
1524
|
+
// Get the route_config_name.
|
1525
|
+
lds_update.route_config_name = UpbStringToStdString(
|
1526
|
+
envoy_extensions_filters_network_http_connection_manager_v3_Rds_route_config_name(
|
1527
|
+
rds));
|
1528
|
+
}
|
1529
|
+
return GRPC_ERROR_NONE;
|
1530
|
+
}
|
1531
|
+
|
1532
|
+
grpc_error* RdsResponseParse(
|
1533
|
+
XdsClient* client, TraceFlag* tracer, upb_symtab* symtab,
|
1534
|
+
const envoy_service_discovery_v3_DiscoveryResponse* response,
|
1535
|
+
const std::set<absl::string_view>& expected_route_configuration_names,
|
1536
|
+
XdsApi::RdsUpdateMap* rds_update_map, upb_arena* arena) {
|
1537
|
+
// Get the resources from the response.
|
1538
|
+
size_t size;
|
1539
|
+
const google_protobuf_Any* const* resources =
|
1540
|
+
envoy_service_discovery_v3_DiscoveryResponse_resources(response, &size);
|
1541
|
+
for (size_t i = 0; i < size; ++i) {
|
1542
|
+
// Check the type_url of the resource.
|
1543
|
+
absl::string_view type_url =
|
1544
|
+
UpbStringToAbsl(google_protobuf_Any_type_url(resources[i]));
|
1545
|
+
if (!IsRds(type_url)) {
|
1546
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING("Resource is not RDS.");
|
1547
|
+
}
|
1548
|
+
// Decode the route_config.
|
1549
|
+
const upb_strview encoded_route_config =
|
1550
|
+
google_protobuf_Any_value(resources[i]);
|
1551
|
+
const envoy_config_route_v3_RouteConfiguration* route_config =
|
1552
|
+
envoy_config_route_v3_RouteConfiguration_parse(
|
1553
|
+
encoded_route_config.data, encoded_route_config.size, arena);
|
1554
|
+
if (route_config == nullptr) {
|
1555
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING("Can't decode route_config.");
|
1556
|
+
}
|
1557
|
+
// Check route_config_name. Ignore unexpected route_config.
|
1558
|
+
std::string route_config_name = UpbStringToStdString(
|
1559
|
+
envoy_config_route_v3_RouteConfiguration_name(route_config));
|
1560
|
+
if (expected_route_configuration_names.find(route_config_name) ==
|
1561
|
+
expected_route_configuration_names.end()) {
|
1562
|
+
continue;
|
1563
|
+
}
|
1564
|
+
// Fail if route config name is duplicated.
|
1565
|
+
if (rds_update_map->find(route_config_name) != rds_update_map->end()) {
|
1566
|
+
return GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
1567
|
+
absl::StrCat("duplicate route config name \"", route_config_name,
|
1568
|
+
"\"")
|
1569
|
+
.c_str());
|
1570
|
+
}
|
1571
|
+
// Parse the route_config.
|
1572
|
+
XdsApi::RdsUpdate& rds_update =
|
1573
|
+
(*rds_update_map)[std::move(route_config_name)];
|
1574
|
+
grpc_error* error =
|
1575
|
+
RouteConfigParse(client, tracer, symtab, route_config, &rds_update);
|
1576
|
+
if (error != GRPC_ERROR_NONE) return error;
|
1577
|
+
}
|
1578
|
+
return GRPC_ERROR_NONE;
|
1579
|
+
}
|
1580
|
+
|
1581
|
+
XdsApi::CommonTlsContext::CertificateProviderInstance
|
1582
|
+
CertificateProviderInstanceParse(
|
1583
|
+
const envoy_extensions_transport_sockets_tls_v3_CommonTlsContext_CertificateProviderInstance*
|
1584
|
+
certificate_provider_instance_proto) {
|
1585
|
+
return {
|
1586
|
+
UpbStringToStdString(
|
1587
|
+
envoy_extensions_transport_sockets_tls_v3_CommonTlsContext_CertificateProviderInstance_instance_name(
|
1588
|
+
certificate_provider_instance_proto)),
|
1589
|
+
UpbStringToStdString(
|
1590
|
+
envoy_extensions_transport_sockets_tls_v3_CommonTlsContext_CertificateProviderInstance_certificate_name(
|
1591
|
+
certificate_provider_instance_proto))};
|
1592
|
+
}
|
1593
|
+
|
1594
|
+
grpc_error* CommonTlsContextParse(
|
1595
|
+
const envoy_extensions_transport_sockets_tls_v3_CommonTlsContext*
|
1596
|
+
common_tls_context_proto,
|
1597
|
+
XdsApi::CommonTlsContext* common_tls_context) GRPC_MUST_USE_RESULT;
|
1598
|
+
grpc_error* CommonTlsContextParse(
|
1599
|
+
const envoy_extensions_transport_sockets_tls_v3_CommonTlsContext*
|
1600
|
+
common_tls_context_proto,
|
1601
|
+
XdsApi::CommonTlsContext* common_tls_context) {
|
1602
|
+
auto* combined_validation_context =
|
1603
|
+
envoy_extensions_transport_sockets_tls_v3_CommonTlsContext_combined_validation_context(
|
1604
|
+
common_tls_context_proto);
|
1605
|
+
if (combined_validation_context != nullptr) {
|
1606
|
+
auto* default_validation_context =
|
1607
|
+
envoy_extensions_transport_sockets_tls_v3_CommonTlsContext_CombinedCertificateValidationContext_default_validation_context(
|
1608
|
+
combined_validation_context);
|
1609
|
+
if (default_validation_context != nullptr) {
|
1610
|
+
size_t len = 0;
|
1611
|
+
auto* subject_alt_names_matchers =
|
1612
|
+
envoy_extensions_transport_sockets_tls_v3_CertificateValidationContext_match_subject_alt_names(
|
1613
|
+
default_validation_context, &len);
|
1614
|
+
for (size_t i = 0; i < len; ++i) {
|
1615
|
+
XdsApi::StringMatcher::StringMatcherType type;
|
1616
|
+
std::string matcher;
|
1617
|
+
if (envoy_type_matcher_v3_StringMatcher_has_exact(
|
1618
|
+
subject_alt_names_matchers[i])) {
|
1619
|
+
type = XdsApi::StringMatcher::StringMatcherType::EXACT;
|
1620
|
+
matcher =
|
1621
|
+
UpbStringToStdString(envoy_type_matcher_v3_StringMatcher_exact(
|
1622
|
+
subject_alt_names_matchers[i]));
|
1623
|
+
} else if (envoy_type_matcher_v3_StringMatcher_has_prefix(
|
1624
|
+
subject_alt_names_matchers[i])) {
|
1625
|
+
type = XdsApi::StringMatcher::StringMatcherType::PREFIX;
|
1626
|
+
matcher =
|
1627
|
+
UpbStringToStdString(envoy_type_matcher_v3_StringMatcher_prefix(
|
1628
|
+
subject_alt_names_matchers[i]));
|
1629
|
+
} else if (envoy_type_matcher_v3_StringMatcher_has_suffix(
|
1630
|
+
subject_alt_names_matchers[i])) {
|
1631
|
+
type = XdsApi::StringMatcher::StringMatcherType::SUFFIX;
|
1632
|
+
matcher =
|
1633
|
+
UpbStringToStdString(envoy_type_matcher_v3_StringMatcher_suffix(
|
1634
|
+
subject_alt_names_matchers[i]));
|
1635
|
+
} else if (envoy_type_matcher_v3_StringMatcher_has_contains(
|
1636
|
+
subject_alt_names_matchers[i])) {
|
1637
|
+
type = XdsApi::StringMatcher::StringMatcherType::CONTAINS;
|
1638
|
+
matcher =
|
1639
|
+
UpbStringToStdString(envoy_type_matcher_v3_StringMatcher_contains(
|
1640
|
+
subject_alt_names_matchers[i]));
|
1641
|
+
} else if (envoy_type_matcher_v3_StringMatcher_has_safe_regex(
|
1642
|
+
subject_alt_names_matchers[i])) {
|
1643
|
+
type = XdsApi::StringMatcher::StringMatcherType::SAFE_REGEX;
|
1644
|
+
auto* regex_matcher = envoy_type_matcher_v3_StringMatcher_safe_regex(
|
1645
|
+
subject_alt_names_matchers[i]);
|
1646
|
+
matcher = UpbStringToStdString(
|
1647
|
+
envoy_type_matcher_v3_RegexMatcher_regex(regex_matcher));
|
1648
|
+
} else {
|
1649
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1650
|
+
"Invalid StringMatcher specified");
|
1651
|
+
}
|
1652
|
+
bool ignore_case = envoy_type_matcher_v3_StringMatcher_ignore_case(
|
1653
|
+
subject_alt_names_matchers[i]);
|
1654
|
+
XdsApi::StringMatcher string_matcher(type, matcher, ignore_case);
|
1655
|
+
if (type == XdsApi::StringMatcher::StringMatcherType::SAFE_REGEX) {
|
1656
|
+
if (!string_matcher.regex_matcher()->ok()) {
|
1657
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1658
|
+
"Invalid regex string specified in string matcher.");
|
1659
|
+
}
|
1660
|
+
if (ignore_case) {
|
1661
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1662
|
+
"StringMatcher: ignore_case has no effect for SAFE_REGEX.");
|
1663
|
+
}
|
1664
|
+
}
|
1665
|
+
common_tls_context->combined_validation_context
|
1666
|
+
.default_validation_context.match_subject_alt_names.push_back(
|
1667
|
+
std::move(string_matcher));
|
1668
|
+
}
|
1669
|
+
}
|
1670
|
+
auto* validation_context_certificate_provider_instance =
|
1671
|
+
envoy_extensions_transport_sockets_tls_v3_CommonTlsContext_CombinedCertificateValidationContext_validation_context_certificate_provider_instance(
|
1672
|
+
combined_validation_context);
|
1673
|
+
if (validation_context_certificate_provider_instance != nullptr) {
|
1674
|
+
common_tls_context->combined_validation_context
|
1675
|
+
.validation_context_certificate_provider_instance =
|
1676
|
+
CertificateProviderInstanceParse(
|
1677
|
+
validation_context_certificate_provider_instance);
|
1678
|
+
}
|
1679
|
+
}
|
1680
|
+
auto* tls_certificate_certificate_provider_instance =
|
1681
|
+
envoy_extensions_transport_sockets_tls_v3_CommonTlsContext_tls_certificate_certificate_provider_instance(
|
1682
|
+
common_tls_context_proto);
|
1683
|
+
if (tls_certificate_certificate_provider_instance != nullptr) {
|
1684
|
+
common_tls_context->tls_certificate_certificate_provider_instance =
|
1685
|
+
CertificateProviderInstanceParse(
|
1686
|
+
tls_certificate_certificate_provider_instance);
|
1687
|
+
}
|
1688
|
+
return GRPC_ERROR_NONE;
|
1689
|
+
}
|
1690
|
+
|
1691
|
+
grpc_error* CdsResponseParse(
|
1692
|
+
XdsClient* client, TraceFlag* tracer, upb_symtab* symtab,
|
1693
|
+
const envoy_service_discovery_v3_DiscoveryResponse* response,
|
1694
|
+
const std::set<absl::string_view>& expected_cluster_names,
|
1695
|
+
XdsApi::CdsUpdateMap* cds_update_map, upb_arena* arena) {
|
1696
|
+
// Get the resources from the response.
|
1697
|
+
size_t size;
|
1698
|
+
const google_protobuf_Any* const* resources =
|
1699
|
+
envoy_service_discovery_v3_DiscoveryResponse_resources(response, &size);
|
1700
|
+
// Parse all the resources in the CDS response.
|
1701
|
+
for (size_t i = 0; i < size; ++i) {
|
1702
|
+
// Check the type_url of the resource.
|
1703
|
+
absl::string_view type_url =
|
1704
|
+
UpbStringToAbsl(google_protobuf_Any_type_url(resources[i]));
|
1705
|
+
if (!IsCds(type_url)) {
|
1706
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING("Resource is not CDS.");
|
1707
|
+
}
|
1708
|
+
// Decode the cluster.
|
1709
|
+
const upb_strview encoded_cluster = google_protobuf_Any_value(resources[i]);
|
1710
|
+
const envoy_config_cluster_v3_Cluster* cluster =
|
1711
|
+
envoy_config_cluster_v3_Cluster_parse(encoded_cluster.data,
|
1712
|
+
encoded_cluster.size, arena);
|
1713
|
+
if (cluster == nullptr) {
|
1714
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING("Can't decode cluster.");
|
1715
|
+
}
|
1716
|
+
MaybeLogCluster(client, tracer, symtab, cluster);
|
1717
|
+
// Ignore unexpected cluster names.
|
1718
|
+
std::string cluster_name =
|
1719
|
+
UpbStringToStdString(envoy_config_cluster_v3_Cluster_name(cluster));
|
1720
|
+
if (expected_cluster_names.find(cluster_name) ==
|
1721
|
+
expected_cluster_names.end()) {
|
1722
|
+
continue;
|
1723
|
+
}
|
1724
|
+
// Fail on duplicate resources.
|
1725
|
+
if (cds_update_map->find(cluster_name) != cds_update_map->end()) {
|
1726
|
+
return GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
1727
|
+
absl::StrCat("duplicate resource name \"", cluster_name, "\"")
|
1728
|
+
.c_str());
|
1729
|
+
}
|
1730
|
+
XdsApi::CdsUpdate& cds_update = (*cds_update_map)[std::move(cluster_name)];
|
1731
|
+
// Check the cluster_discovery_type.
|
1732
|
+
if (!envoy_config_cluster_v3_Cluster_has_type(cluster)) {
|
1733
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING("DiscoveryType not found.");
|
1734
|
+
}
|
1735
|
+
if (envoy_config_cluster_v3_Cluster_type(cluster) !=
|
1736
|
+
envoy_config_cluster_v3_Cluster_EDS) {
|
1737
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING("DiscoveryType is not EDS.");
|
1738
|
+
}
|
1739
|
+
// Check the EDS config source.
|
1740
|
+
const envoy_config_cluster_v3_Cluster_EdsClusterConfig* eds_cluster_config =
|
1741
|
+
envoy_config_cluster_v3_Cluster_eds_cluster_config(cluster);
|
1742
|
+
const envoy_config_core_v3_ConfigSource* eds_config =
|
1743
|
+
envoy_config_cluster_v3_Cluster_EdsClusterConfig_eds_config(
|
1744
|
+
eds_cluster_config);
|
1745
|
+
if (!envoy_config_core_v3_ConfigSource_has_ads(eds_config)) {
|
1746
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1747
|
+
"EDS ConfigSource is not ADS.");
|
1748
|
+
}
|
1749
|
+
// Record EDS service_name (if any).
|
1750
|
+
upb_strview service_name =
|
1751
|
+
envoy_config_cluster_v3_Cluster_EdsClusterConfig_service_name(
|
1752
|
+
eds_cluster_config);
|
1753
|
+
if (service_name.size != 0) {
|
1754
|
+
cds_update.eds_service_name = UpbStringToStdString(service_name);
|
1755
|
+
}
|
1756
|
+
// Check the LB policy.
|
1757
|
+
if (envoy_config_cluster_v3_Cluster_lb_policy(cluster) !=
|
1758
|
+
envoy_config_cluster_v3_Cluster_ROUND_ROBIN) {
|
1759
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1760
|
+
"LB policy is not ROUND_ROBIN.");
|
1761
|
+
}
|
1762
|
+
if (XdsSecurityEnabled()) {
|
1763
|
+
// Record Upstream tls context
|
1764
|
+
auto* transport_socket =
|
1765
|
+
envoy_config_cluster_v3_Cluster_transport_socket(cluster);
|
1766
|
+
if (transport_socket != nullptr) {
|
1767
|
+
absl::string_view name = UpbStringToAbsl(
|
1768
|
+
envoy_config_core_v3_TransportSocket_name(transport_socket));
|
1769
|
+
if (name == "envoy.transport_sockets.tls") {
|
1770
|
+
auto* typed_config =
|
1771
|
+
envoy_config_core_v3_TransportSocket_typed_config(
|
1772
|
+
transport_socket);
|
1773
|
+
if (typed_config != nullptr) {
|
1774
|
+
const upb_strview encoded_upstream_tls_context =
|
1775
|
+
google_protobuf_Any_value(typed_config);
|
1776
|
+
auto* upstream_tls_context =
|
1777
|
+
envoy_extensions_transport_sockets_tls_v3_UpstreamTlsContext_parse(
|
1778
|
+
encoded_upstream_tls_context.data,
|
1779
|
+
encoded_upstream_tls_context.size, arena);
|
1780
|
+
if (upstream_tls_context == nullptr) {
|
1781
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1782
|
+
"Can't decode upstream tls context.");
|
1783
|
+
}
|
1784
|
+
auto* common_tls_context =
|
1785
|
+
envoy_extensions_transport_sockets_tls_v3_UpstreamTlsContext_common_tls_context(
|
1786
|
+
upstream_tls_context);
|
1787
|
+
if (common_tls_context != nullptr) {
|
1788
|
+
grpc_error* error = CommonTlsContextParse(
|
1789
|
+
common_tls_context, &cds_update.common_tls_context);
|
1790
|
+
if (error != GRPC_ERROR_NONE) return error;
|
1791
|
+
}
|
1792
|
+
}
|
1793
|
+
if (cds_update.common_tls_context.combined_validation_context
|
1794
|
+
.validation_context_certificate_provider_instance
|
1795
|
+
.instance_name.empty()) {
|
1796
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1797
|
+
"TLS configuration provided but no "
|
1798
|
+
"validation_context_certificate_provider_instance found.");
|
1799
|
+
}
|
1800
|
+
}
|
1801
|
+
}
|
1802
|
+
}
|
1803
|
+
// Record LRS server name (if any).
|
1804
|
+
const envoy_config_core_v3_ConfigSource* lrs_server =
|
1805
|
+
envoy_config_cluster_v3_Cluster_lrs_server(cluster);
|
1806
|
+
if (lrs_server != nullptr) {
|
1807
|
+
if (!envoy_config_core_v3_ConfigSource_has_self(lrs_server)) {
|
1808
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1809
|
+
"LRS ConfigSource is not self.");
|
1810
|
+
}
|
1811
|
+
cds_update.lrs_load_reporting_server_name.emplace("");
|
1812
|
+
}
|
1813
|
+
// The Cluster resource encodes the circuit breaking parameters in a list of
|
1814
|
+
// Thresholds messages, where each message specifies the parameters for a
|
1815
|
+
// particular RoutingPriority. we will look only at the first entry in the
|
1816
|
+
// list for priority DEFAULT and default to 1024 if not found.
|
1817
|
+
if (envoy_config_cluster_v3_Cluster_has_circuit_breakers(cluster)) {
|
1818
|
+
const envoy_config_cluster_v3_CircuitBreakers* circuit_breakers =
|
1819
|
+
envoy_config_cluster_v3_Cluster_circuit_breakers(cluster);
|
1820
|
+
size_t num_thresholds;
|
1821
|
+
const envoy_config_cluster_v3_CircuitBreakers_Thresholds* const*
|
1822
|
+
thresholds = envoy_config_cluster_v3_CircuitBreakers_thresholds(
|
1823
|
+
circuit_breakers, &num_thresholds);
|
1824
|
+
for (size_t i = 0; i < num_thresholds; ++i) {
|
1825
|
+
const auto* threshold = thresholds[i];
|
1826
|
+
if (envoy_config_cluster_v3_CircuitBreakers_Thresholds_priority(
|
1827
|
+
threshold) == envoy_config_core_v3_DEFAULT) {
|
1828
|
+
const google_protobuf_UInt32Value* max_requests =
|
1829
|
+
envoy_config_cluster_v3_CircuitBreakers_Thresholds_max_requests(
|
1830
|
+
threshold);
|
1831
|
+
if (max_requests != nullptr) {
|
1832
|
+
cds_update.max_concurrent_requests =
|
1833
|
+
google_protobuf_UInt32Value_value(max_requests);
|
1834
|
+
}
|
1835
|
+
break;
|
1836
|
+
}
|
1837
|
+
}
|
1838
|
+
}
|
1839
|
+
}
|
1840
|
+
return GRPC_ERROR_NONE;
|
1841
|
+
}
|
1842
|
+
|
1843
|
+
grpc_error* ServerAddressParseAndAppend(
|
1844
|
+
const envoy_config_endpoint_v3_LbEndpoint* lb_endpoint,
|
1845
|
+
ServerAddressList* list) {
|
1846
|
+
// If health_status is not HEALTHY or UNKNOWN, skip this endpoint.
|
1847
|
+
const int32_t health_status =
|
1848
|
+
envoy_config_endpoint_v3_LbEndpoint_health_status(lb_endpoint);
|
1849
|
+
if (health_status != envoy_config_core_v3_UNKNOWN &&
|
1850
|
+
health_status != envoy_config_core_v3_HEALTHY) {
|
1851
|
+
return GRPC_ERROR_NONE;
|
1852
|
+
}
|
1853
|
+
// Find the ip:port.
|
1854
|
+
const envoy_config_endpoint_v3_Endpoint* endpoint =
|
1855
|
+
envoy_config_endpoint_v3_LbEndpoint_endpoint(lb_endpoint);
|
1856
|
+
const envoy_config_core_v3_Address* address =
|
1857
|
+
envoy_config_endpoint_v3_Endpoint_address(endpoint);
|
1858
|
+
const envoy_config_core_v3_SocketAddress* socket_address =
|
1859
|
+
envoy_config_core_v3_Address_socket_address(address);
|
1860
|
+
std::string address_str = UpbStringToStdString(
|
1861
|
+
envoy_config_core_v3_SocketAddress_address(socket_address));
|
1862
|
+
uint32_t port = envoy_config_core_v3_SocketAddress_port_value(socket_address);
|
1863
|
+
if (GPR_UNLIKELY(port >> 16) != 0) {
|
1864
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING("Invalid port.");
|
1865
|
+
}
|
1866
|
+
// Populate grpc_resolved_address.
|
1867
|
+
grpc_resolved_address addr;
|
1868
|
+
grpc_string_to_sockaddr(&addr, address_str.c_str(), port);
|
1869
|
+
// Append the address to the list.
|
1870
|
+
list->emplace_back(addr, nullptr);
|
1871
|
+
return GRPC_ERROR_NONE;
|
1872
|
+
}
|
1873
|
+
|
1874
|
+
grpc_error* LocalityParse(
|
1875
|
+
const envoy_config_endpoint_v3_LocalityLbEndpoints* locality_lb_endpoints,
|
1876
|
+
XdsApi::EdsUpdate::Priority::Locality* output_locality, size_t* priority) {
|
1877
|
+
// Parse LB weight.
|
1878
|
+
const google_protobuf_UInt32Value* lb_weight =
|
1879
|
+
envoy_config_endpoint_v3_LocalityLbEndpoints_load_balancing_weight(
|
1880
|
+
locality_lb_endpoints);
|
1881
|
+
// If LB weight is not specified, it means this locality is assigned no load.
|
1882
|
+
// TODO(juanlishen): When we support CDS to configure the inter-locality
|
1883
|
+
// policy, we should change the LB weight handling.
|
1884
|
+
output_locality->lb_weight =
|
1885
|
+
lb_weight != nullptr ? google_protobuf_UInt32Value_value(lb_weight) : 0;
|
1886
|
+
if (output_locality->lb_weight == 0) return GRPC_ERROR_NONE;
|
1887
|
+
// Parse locality name.
|
1888
|
+
const envoy_config_core_v3_Locality* locality =
|
1889
|
+
envoy_config_endpoint_v3_LocalityLbEndpoints_locality(
|
1890
|
+
locality_lb_endpoints);
|
1891
|
+
std::string region =
|
1892
|
+
UpbStringToStdString(envoy_config_core_v3_Locality_region(locality));
|
1893
|
+
std::string zone =
|
1894
|
+
UpbStringToStdString(envoy_config_core_v3_Locality_region(locality));
|
1895
|
+
std::string sub_zone =
|
1896
|
+
UpbStringToStdString(envoy_config_core_v3_Locality_sub_zone(locality));
|
1897
|
+
output_locality->name = MakeRefCounted<XdsLocalityName>(
|
1898
|
+
std::move(region), std::move(zone), std::move(sub_zone));
|
1899
|
+
// Parse the addresses.
|
1900
|
+
size_t size;
|
1901
|
+
const envoy_config_endpoint_v3_LbEndpoint* const* lb_endpoints =
|
1902
|
+
envoy_config_endpoint_v3_LocalityLbEndpoints_lb_endpoints(
|
1903
|
+
locality_lb_endpoints, &size);
|
1904
|
+
for (size_t i = 0; i < size; ++i) {
|
1905
|
+
grpc_error* error = ServerAddressParseAndAppend(
|
1906
|
+
lb_endpoints[i], &output_locality->endpoints);
|
1907
|
+
if (error != GRPC_ERROR_NONE) return error;
|
1908
|
+
}
|
1909
|
+
// Parse the priority.
|
1910
|
+
*priority = envoy_config_endpoint_v3_LocalityLbEndpoints_priority(
|
1911
|
+
locality_lb_endpoints);
|
1912
|
+
return GRPC_ERROR_NONE;
|
1913
|
+
}
|
1914
|
+
|
1915
|
+
grpc_error* DropParseAndAppend(
|
1916
|
+
const envoy_config_endpoint_v3_ClusterLoadAssignment_Policy_DropOverload*
|
1917
|
+
drop_overload,
|
1918
|
+
XdsApi::EdsUpdate::DropConfig* drop_config) {
|
1919
|
+
// Get the category.
|
1920
|
+
std::string category = UpbStringToStdString(
|
1921
|
+
envoy_config_endpoint_v3_ClusterLoadAssignment_Policy_DropOverload_category(
|
1922
|
+
drop_overload));
|
1923
|
+
if (category.empty()) {
|
1924
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING("Empty drop category name");
|
1925
|
+
}
|
1926
|
+
// Get the drop rate (per million).
|
1927
|
+
const envoy_type_v3_FractionalPercent* drop_percentage =
|
1928
|
+
envoy_config_endpoint_v3_ClusterLoadAssignment_Policy_DropOverload_drop_percentage(
|
1929
|
+
drop_overload);
|
1930
|
+
uint32_t numerator =
|
1931
|
+
envoy_type_v3_FractionalPercent_numerator(drop_percentage);
|
1932
|
+
const auto denominator =
|
1933
|
+
static_cast<envoy_type_v3_FractionalPercent_DenominatorType>(
|
1934
|
+
envoy_type_v3_FractionalPercent_denominator(drop_percentage));
|
1935
|
+
// Normalize to million.
|
1936
|
+
switch (denominator) {
|
1937
|
+
case envoy_type_v3_FractionalPercent_HUNDRED:
|
1938
|
+
numerator *= 10000;
|
1939
|
+
break;
|
1940
|
+
case envoy_type_v3_FractionalPercent_TEN_THOUSAND:
|
1941
|
+
numerator *= 100;
|
1942
|
+
break;
|
1943
|
+
case envoy_type_v3_FractionalPercent_MILLION:
|
1944
|
+
break;
|
1945
|
+
default:
|
1946
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING("Unknown denominator type");
|
1947
|
+
}
|
1948
|
+
// Cap numerator to 1000000.
|
1949
|
+
numerator = GPR_MIN(numerator, 1000000);
|
1950
|
+
drop_config->AddCategory(std::move(category), numerator);
|
1951
|
+
return GRPC_ERROR_NONE;
|
1952
|
+
}
|
1953
|
+
|
1954
|
+
grpc_error* EdsResponseParse(
|
1955
|
+
XdsClient* client, TraceFlag* tracer, upb_symtab* symtab,
|
1956
|
+
const envoy_service_discovery_v3_DiscoveryResponse* response,
|
1957
|
+
const std::set<absl::string_view>& expected_eds_service_names,
|
1958
|
+
XdsApi::EdsUpdateMap* eds_update_map, upb_arena* arena) {
|
1959
|
+
// Get the resources from the response.
|
1960
|
+
size_t size;
|
1961
|
+
const google_protobuf_Any* const* resources =
|
1962
|
+
envoy_service_discovery_v3_DiscoveryResponse_resources(response, &size);
|
1963
|
+
for (size_t i = 0; i < size; ++i) {
|
1964
|
+
// Check the type_url of the resource.
|
1965
|
+
absl::string_view type_url =
|
1966
|
+
UpbStringToAbsl(google_protobuf_Any_type_url(resources[i]));
|
1967
|
+
if (!IsEds(type_url)) {
|
1968
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING("Resource is not EDS.");
|
1969
|
+
}
|
1970
|
+
// Get the cluster_load_assignment.
|
1971
|
+
upb_strview encoded_cluster_load_assignment =
|
1972
|
+
google_protobuf_Any_value(resources[i]);
|
1973
|
+
envoy_config_endpoint_v3_ClusterLoadAssignment* cluster_load_assignment =
|
1974
|
+
envoy_config_endpoint_v3_ClusterLoadAssignment_parse(
|
1975
|
+
encoded_cluster_load_assignment.data,
|
1976
|
+
encoded_cluster_load_assignment.size, arena);
|
1977
|
+
if (cluster_load_assignment == nullptr) {
|
1978
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1979
|
+
"Can't parse cluster_load_assignment.");
|
1980
|
+
}
|
1981
|
+
MaybeLogClusterLoadAssignment(client, tracer, symtab,
|
1982
|
+
cluster_load_assignment);
|
1983
|
+
// Check the EDS service name. Ignore unexpected names.
|
1984
|
+
std::string eds_service_name = UpbStringToStdString(
|
1985
|
+
envoy_config_endpoint_v3_ClusterLoadAssignment_cluster_name(
|
1986
|
+
cluster_load_assignment));
|
1987
|
+
if (expected_eds_service_names.find(eds_service_name) ==
|
1988
|
+
expected_eds_service_names.end()) {
|
1989
|
+
continue;
|
1990
|
+
}
|
1991
|
+
// Fail on duplicate resources.
|
1992
|
+
if (eds_update_map->find(eds_service_name) != eds_update_map->end()) {
|
1993
|
+
return GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
1994
|
+
absl::StrCat("duplicate resource name \"", eds_service_name, "\"")
|
1995
|
+
.c_str());
|
1996
|
+
}
|
1997
|
+
XdsApi::EdsUpdate& eds_update =
|
1998
|
+
(*eds_update_map)[std::move(eds_service_name)];
|
1999
|
+
// Get the endpoints.
|
2000
|
+
size_t locality_size;
|
2001
|
+
const envoy_config_endpoint_v3_LocalityLbEndpoints* const* endpoints =
|
2002
|
+
envoy_config_endpoint_v3_ClusterLoadAssignment_endpoints(
|
2003
|
+
cluster_load_assignment, &locality_size);
|
2004
|
+
for (size_t j = 0; j < locality_size; ++j) {
|
2005
|
+
size_t priority;
|
2006
|
+
XdsApi::EdsUpdate::Priority::Locality locality;
|
2007
|
+
grpc_error* error = LocalityParse(endpoints[j], &locality, &priority);
|
2008
|
+
if (error != GRPC_ERROR_NONE) return error;
|
2009
|
+
// Filter out locality with weight 0.
|
2010
|
+
if (locality.lb_weight == 0) continue;
|
2011
|
+
// Make sure prorities is big enough. Note that they might not
|
2012
|
+
// arrive in priority order.
|
2013
|
+
while (eds_update.priorities.size() < priority + 1) {
|
2014
|
+
eds_update.priorities.emplace_back();
|
2015
|
+
}
|
2016
|
+
eds_update.priorities[priority].localities.emplace(locality.name.get(),
|
2017
|
+
std::move(locality));
|
2018
|
+
}
|
2019
|
+
for (const auto& priority : eds_update.priorities) {
|
2020
|
+
if (priority.localities.empty()) {
|
2021
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
2022
|
+
"EDS update includes sparse priority list");
|
2023
|
+
}
|
2024
|
+
}
|
2025
|
+
// Get the drop config.
|
2026
|
+
eds_update.drop_config = MakeRefCounted<XdsApi::EdsUpdate::DropConfig>();
|
2027
|
+
const envoy_config_endpoint_v3_ClusterLoadAssignment_Policy* policy =
|
2028
|
+
envoy_config_endpoint_v3_ClusterLoadAssignment_policy(
|
2029
|
+
cluster_load_assignment);
|
2030
|
+
if (policy != nullptr) {
|
2031
|
+
size_t drop_size;
|
2032
|
+
const envoy_config_endpoint_v3_ClusterLoadAssignment_Policy_DropOverload* const*
|
2033
|
+
drop_overload =
|
2034
|
+
envoy_config_endpoint_v3_ClusterLoadAssignment_Policy_drop_overloads(
|
2035
|
+
policy, &drop_size);
|
2036
|
+
for (size_t j = 0; j < drop_size; ++j) {
|
2037
|
+
grpc_error* error =
|
2038
|
+
DropParseAndAppend(drop_overload[j], eds_update.drop_config.get());
|
2039
|
+
if (error != GRPC_ERROR_NONE) return error;
|
2040
|
+
}
|
2041
|
+
}
|
2042
|
+
}
|
2043
|
+
return GRPC_ERROR_NONE;
|
2044
|
+
}
|
2045
|
+
|
2046
|
+
std::string TypeUrlInternalToExternal(absl::string_view type_url) {
|
2047
|
+
if (type_url == kLdsV2TypeUrl) {
|
2048
|
+
return XdsApi::kLdsTypeUrl;
|
2049
|
+
} else if (type_url == kRdsV2TypeUrl) {
|
2050
|
+
return XdsApi::kRdsTypeUrl;
|
2051
|
+
} else if (type_url == kCdsV2TypeUrl) {
|
2052
|
+
return XdsApi::kCdsTypeUrl;
|
2053
|
+
} else if (type_url == kEdsV2TypeUrl) {
|
2054
|
+
return XdsApi::kEdsTypeUrl;
|
2055
|
+
}
|
2056
|
+
return std::string(type_url);
|
2057
|
+
}
|
2058
|
+
|
2059
|
+
} // namespace
|
2060
|
+
|
2061
|
+
XdsApi::AdsParseResult XdsApi::ParseAdsResponse(
|
2062
|
+
const grpc_slice& encoded_response,
|
2063
|
+
const std::set<absl::string_view>& expected_listener_names,
|
2064
|
+
const std::set<absl::string_view>& expected_route_configuration_names,
|
2065
|
+
const std::set<absl::string_view>& expected_cluster_names,
|
2066
|
+
const std::set<absl::string_view>& expected_eds_service_names) {
|
2067
|
+
AdsParseResult result;
|
2068
|
+
upb::Arena arena;
|
2069
|
+
// Decode the response.
|
2070
|
+
const envoy_service_discovery_v3_DiscoveryResponse* response =
|
2071
|
+
envoy_service_discovery_v3_DiscoveryResponse_parse(
|
2072
|
+
reinterpret_cast<const char*>(GRPC_SLICE_START_PTR(encoded_response)),
|
2073
|
+
GRPC_SLICE_LENGTH(encoded_response), arena.ptr());
|
2074
|
+
// If decoding fails, output an empty type_url and return.
|
2075
|
+
if (response == nullptr) {
|
2076
|
+
result.parse_error =
|
2077
|
+
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Can't decode DiscoveryResponse.");
|
2078
|
+
return result;
|
2079
|
+
}
|
2080
|
+
MaybeLogDiscoveryResponse(client_, tracer_, symtab_.ptr(), response);
|
2081
|
+
// Record the type_url, the version_info, and the nonce of the response.
|
2082
|
+
result.type_url = TypeUrlInternalToExternal(UpbStringToAbsl(
|
2083
|
+
envoy_service_discovery_v3_DiscoveryResponse_type_url(response)));
|
2084
|
+
result.version = UpbStringToStdString(
|
2085
|
+
envoy_service_discovery_v3_DiscoveryResponse_version_info(response));
|
2086
|
+
result.nonce = UpbStringToStdString(
|
2087
|
+
envoy_service_discovery_v3_DiscoveryResponse_nonce(response));
|
2088
|
+
// Parse the response according to the resource type.
|
2089
|
+
if (IsLds(result.type_url)) {
|
2090
|
+
result.parse_error = LdsResponseParse(client_, tracer_, symtab_.ptr(),
|
2091
|
+
response, expected_listener_names,
|
2092
|
+
&result.lds_update_map, arena.ptr());
|
2093
|
+
} else if (IsRds(result.type_url)) {
|
2094
|
+
result.parse_error =
|
2095
|
+
RdsResponseParse(client_, tracer_, symtab_.ptr(), response,
|
2096
|
+
expected_route_configuration_names,
|
2097
|
+
&result.rds_update_map, arena.ptr());
|
2098
|
+
} else if (IsCds(result.type_url)) {
|
2099
|
+
result.parse_error = CdsResponseParse(client_, tracer_, symtab_.ptr(),
|
2100
|
+
response, expected_cluster_names,
|
2101
|
+
&result.cds_update_map, arena.ptr());
|
2102
|
+
} else if (IsEds(result.type_url)) {
|
2103
|
+
result.parse_error = EdsResponseParse(client_, tracer_, symtab_.ptr(),
|
2104
|
+
response, expected_eds_service_names,
|
2105
|
+
&result.eds_update_map, arena.ptr());
|
2106
|
+
}
|
2107
|
+
return result;
|
2108
|
+
}
|
2109
|
+
|
2110
|
+
namespace {
|
2111
|
+
|
2112
|
+
void MaybeLogLrsRequest(
|
2113
|
+
XdsClient* client, TraceFlag* tracer, upb_symtab* symtab,
|
2114
|
+
const envoy_service_load_stats_v3_LoadStatsRequest* request) {
|
2115
|
+
if (GRPC_TRACE_FLAG_ENABLED(*tracer) &&
|
2116
|
+
gpr_should_log(GPR_LOG_SEVERITY_DEBUG)) {
|
2117
|
+
const upb_msgdef* msg_type =
|
2118
|
+
envoy_service_load_stats_v3_LoadStatsRequest_getmsgdef(symtab);
|
2119
|
+
char buf[10240];
|
2120
|
+
upb_text_encode(request, msg_type, nullptr, 0, buf, sizeof(buf));
|
2121
|
+
gpr_log(GPR_DEBUG, "[xds_client %p] constructed LRS request: %s", client,
|
2122
|
+
buf);
|
2123
|
+
}
|
2124
|
+
}
|
2125
|
+
|
2126
|
+
grpc_slice SerializeLrsRequest(
|
2127
|
+
const envoy_service_load_stats_v3_LoadStatsRequest* request,
|
2128
|
+
upb_arena* arena) {
|
2129
|
+
size_t output_length;
|
2130
|
+
char* output = envoy_service_load_stats_v3_LoadStatsRequest_serialize(
|
2131
|
+
request, arena, &output_length);
|
2132
|
+
return grpc_slice_from_copied_buffer(output, output_length);
|
2133
|
+
}
|
2134
|
+
|
2135
|
+
} // namespace
|
2136
|
+
|
2137
|
+
grpc_slice XdsApi::CreateLrsInitialRequest(
|
2138
|
+
const XdsBootstrap::XdsServer& server) {
|
2139
|
+
upb::Arena arena;
|
2140
|
+
// Create a request.
|
2141
|
+
envoy_service_load_stats_v3_LoadStatsRequest* request =
|
2142
|
+
envoy_service_load_stats_v3_LoadStatsRequest_new(arena.ptr());
|
2143
|
+
// Populate node.
|
2144
|
+
envoy_config_core_v3_Node* node_msg =
|
2145
|
+
envoy_service_load_stats_v3_LoadStatsRequest_mutable_node(request,
|
2146
|
+
arena.ptr());
|
2147
|
+
PopulateNode(arena.ptr(), node_, server.ShouldUseV3(), build_version_,
|
2148
|
+
user_agent_name_, node_msg);
|
2149
|
+
envoy_config_core_v3_Node_add_client_features(
|
2150
|
+
node_msg, upb_strview_makez("envoy.lrs.supports_send_all_clusters"),
|
2151
|
+
arena.ptr());
|
2152
|
+
MaybeLogLrsRequest(client_, tracer_, symtab_.ptr(), request);
|
2153
|
+
return SerializeLrsRequest(request, arena.ptr());
|
2154
|
+
}
|
2155
|
+
|
2156
|
+
namespace {
|
2157
|
+
|
2158
|
+
void LocalityStatsPopulate(
|
2159
|
+
envoy_config_endpoint_v3_UpstreamLocalityStats* output,
|
2160
|
+
const XdsLocalityName& locality_name,
|
2161
|
+
const XdsClusterLocalityStats::Snapshot& snapshot, upb_arena* arena) {
|
2162
|
+
// Set locality.
|
2163
|
+
envoy_config_core_v3_Locality* locality =
|
2164
|
+
envoy_config_endpoint_v3_UpstreamLocalityStats_mutable_locality(output,
|
2165
|
+
arena);
|
2166
|
+
if (!locality_name.region().empty()) {
|
2167
|
+
envoy_config_core_v3_Locality_set_region(
|
2168
|
+
locality, StdStringToUpbString(locality_name.region()));
|
2169
|
+
}
|
2170
|
+
if (!locality_name.zone().empty()) {
|
2171
|
+
envoy_config_core_v3_Locality_set_zone(
|
2172
|
+
locality, StdStringToUpbString(locality_name.zone()));
|
2173
|
+
}
|
2174
|
+
if (!locality_name.sub_zone().empty()) {
|
2175
|
+
envoy_config_core_v3_Locality_set_sub_zone(
|
2176
|
+
locality, StdStringToUpbString(locality_name.sub_zone()));
|
2177
|
+
}
|
2178
|
+
// Set total counts.
|
2179
|
+
envoy_config_endpoint_v3_UpstreamLocalityStats_set_total_successful_requests(
|
2180
|
+
output, snapshot.total_successful_requests);
|
2181
|
+
envoy_config_endpoint_v3_UpstreamLocalityStats_set_total_requests_in_progress(
|
2182
|
+
output, snapshot.total_requests_in_progress);
|
2183
|
+
envoy_config_endpoint_v3_UpstreamLocalityStats_set_total_error_requests(
|
2184
|
+
output, snapshot.total_error_requests);
|
2185
|
+
envoy_config_endpoint_v3_UpstreamLocalityStats_set_total_issued_requests(
|
2186
|
+
output, snapshot.total_issued_requests);
|
2187
|
+
// Add backend metrics.
|
2188
|
+
for (const auto& p : snapshot.backend_metrics) {
|
2189
|
+
const std::string& metric_name = p.first;
|
2190
|
+
const XdsClusterLocalityStats::BackendMetric& metric_value = p.second;
|
2191
|
+
envoy_config_endpoint_v3_EndpointLoadMetricStats* load_metric =
|
2192
|
+
envoy_config_endpoint_v3_UpstreamLocalityStats_add_load_metric_stats(
|
2193
|
+
output, arena);
|
2194
|
+
envoy_config_endpoint_v3_EndpointLoadMetricStats_set_metric_name(
|
2195
|
+
load_metric, StdStringToUpbString(metric_name));
|
2196
|
+
envoy_config_endpoint_v3_EndpointLoadMetricStats_set_num_requests_finished_with_metric(
|
2197
|
+
load_metric, metric_value.num_requests_finished_with_metric);
|
2198
|
+
envoy_config_endpoint_v3_EndpointLoadMetricStats_set_total_metric_value(
|
2199
|
+
load_metric, metric_value.total_metric_value);
|
2200
|
+
}
|
2201
|
+
}
|
2202
|
+
|
2203
|
+
} // namespace
|
2204
|
+
|
2205
|
+
grpc_slice XdsApi::CreateLrsRequest(
|
2206
|
+
ClusterLoadReportMap cluster_load_report_map) {
|
2207
|
+
upb::Arena arena;
|
2208
|
+
// Create a request.
|
2209
|
+
envoy_service_load_stats_v3_LoadStatsRequest* request =
|
2210
|
+
envoy_service_load_stats_v3_LoadStatsRequest_new(arena.ptr());
|
2211
|
+
for (auto& p : cluster_load_report_map) {
|
2212
|
+
const std::string& cluster_name = p.first.first;
|
2213
|
+
const std::string& eds_service_name = p.first.second;
|
2214
|
+
const ClusterLoadReport& load_report = p.second;
|
2215
|
+
// Add cluster stats.
|
2216
|
+
envoy_config_endpoint_v3_ClusterStats* cluster_stats =
|
2217
|
+
envoy_service_load_stats_v3_LoadStatsRequest_add_cluster_stats(
|
2218
|
+
request, arena.ptr());
|
2219
|
+
// Set the cluster name.
|
2220
|
+
envoy_config_endpoint_v3_ClusterStats_set_cluster_name(
|
2221
|
+
cluster_stats, StdStringToUpbString(cluster_name));
|
2222
|
+
// Set EDS service name, if non-empty.
|
2223
|
+
if (!eds_service_name.empty()) {
|
2224
|
+
envoy_config_endpoint_v3_ClusterStats_set_cluster_service_name(
|
2225
|
+
cluster_stats, StdStringToUpbString(eds_service_name));
|
2226
|
+
}
|
2227
|
+
// Add locality stats.
|
2228
|
+
for (const auto& p : load_report.locality_stats) {
|
2229
|
+
const XdsLocalityName& locality_name = *p.first;
|
2230
|
+
const auto& snapshot = p.second;
|
2231
|
+
envoy_config_endpoint_v3_UpstreamLocalityStats* locality_stats =
|
2232
|
+
envoy_config_endpoint_v3_ClusterStats_add_upstream_locality_stats(
|
2233
|
+
cluster_stats, arena.ptr());
|
2234
|
+
LocalityStatsPopulate(locality_stats, locality_name, snapshot,
|
2235
|
+
arena.ptr());
|
2236
|
+
}
|
2237
|
+
// Add dropped requests.
|
2238
|
+
uint64_t total_dropped_requests = 0;
|
2239
|
+
for (const auto& p : load_report.dropped_requests.categorized_drops) {
|
2240
|
+
const std::string& category = p.first;
|
2241
|
+
const uint64_t count = p.second;
|
2242
|
+
envoy_config_endpoint_v3_ClusterStats_DroppedRequests* dropped_requests =
|
2243
|
+
envoy_config_endpoint_v3_ClusterStats_add_dropped_requests(
|
2244
|
+
cluster_stats, arena.ptr());
|
2245
|
+
envoy_config_endpoint_v3_ClusterStats_DroppedRequests_set_category(
|
2246
|
+
dropped_requests, StdStringToUpbString(category));
|
2247
|
+
envoy_config_endpoint_v3_ClusterStats_DroppedRequests_set_dropped_count(
|
2248
|
+
dropped_requests, count);
|
2249
|
+
total_dropped_requests += count;
|
2250
|
+
}
|
2251
|
+
total_dropped_requests += load_report.dropped_requests.uncategorized_drops;
|
2252
|
+
// Set total dropped requests.
|
2253
|
+
envoy_config_endpoint_v3_ClusterStats_set_total_dropped_requests(
|
2254
|
+
cluster_stats, total_dropped_requests);
|
2255
|
+
// Set real load report interval.
|
2256
|
+
gpr_timespec timespec =
|
2257
|
+
grpc_millis_to_timespec(load_report.load_report_interval, GPR_TIMESPAN);
|
2258
|
+
google_protobuf_Duration* load_report_interval =
|
2259
|
+
envoy_config_endpoint_v3_ClusterStats_mutable_load_report_interval(
|
2260
|
+
cluster_stats, arena.ptr());
|
2261
|
+
google_protobuf_Duration_set_seconds(load_report_interval, timespec.tv_sec);
|
2262
|
+
google_protobuf_Duration_set_nanos(load_report_interval, timespec.tv_nsec);
|
2263
|
+
}
|
2264
|
+
MaybeLogLrsRequest(client_, tracer_, symtab_.ptr(), request);
|
2265
|
+
return SerializeLrsRequest(request, arena.ptr());
|
2266
|
+
}
|
2267
|
+
|
2268
|
+
grpc_error* XdsApi::ParseLrsResponse(const grpc_slice& encoded_response,
|
2269
|
+
bool* send_all_clusters,
|
2270
|
+
std::set<std::string>* cluster_names,
|
2271
|
+
grpc_millis* load_reporting_interval) {
|
2272
|
+
upb::Arena arena;
|
2273
|
+
// Decode the response.
|
2274
|
+
const envoy_service_load_stats_v3_LoadStatsResponse* decoded_response =
|
2275
|
+
envoy_service_load_stats_v3_LoadStatsResponse_parse(
|
2276
|
+
reinterpret_cast<const char*>(GRPC_SLICE_START_PTR(encoded_response)),
|
2277
|
+
GRPC_SLICE_LENGTH(encoded_response), arena.ptr());
|
2278
|
+
// Parse the response.
|
2279
|
+
if (decoded_response == nullptr) {
|
2280
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING("Can't decode response.");
|
2281
|
+
}
|
2282
|
+
// Check send_all_clusters.
|
2283
|
+
if (envoy_service_load_stats_v3_LoadStatsResponse_send_all_clusters(
|
2284
|
+
decoded_response)) {
|
2285
|
+
*send_all_clusters = true;
|
2286
|
+
} else {
|
2287
|
+
// Store the cluster names.
|
2288
|
+
size_t size;
|
2289
|
+
const upb_strview* clusters =
|
2290
|
+
envoy_service_load_stats_v3_LoadStatsResponse_clusters(decoded_response,
|
2291
|
+
&size);
|
2292
|
+
for (size_t i = 0; i < size; ++i) {
|
2293
|
+
cluster_names->emplace(UpbStringToStdString(clusters[i]));
|
2294
|
+
}
|
2295
|
+
}
|
2296
|
+
// Get the load report interval.
|
2297
|
+
const google_protobuf_Duration* load_reporting_interval_duration =
|
2298
|
+
envoy_service_load_stats_v3_LoadStatsResponse_load_reporting_interval(
|
2299
|
+
decoded_response);
|
2300
|
+
gpr_timespec timespec{
|
2301
|
+
google_protobuf_Duration_seconds(load_reporting_interval_duration),
|
2302
|
+
google_protobuf_Duration_nanos(load_reporting_interval_duration),
|
2303
|
+
GPR_TIMESPAN};
|
2304
|
+
*load_reporting_interval = gpr_time_to_millis(timespec);
|
2305
|
+
return GRPC_ERROR_NONE;
|
2306
|
+
}
|
2307
|
+
|
2308
|
+
} // namespace grpc_core
|