grpc 1.28.0 → 1.36.0
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 +1692 -22343
- data/etc/roots.pem +257 -573
- data/include/grpc/compression.h +1 -1
- data/include/grpc/grpc.h +17 -9
- data/include/grpc/grpc_security.h +274 -180
- data/include/grpc/grpc_security_constants.h +4 -0
- 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 +32 -30
- data/include/grpc/impl/codegen/log.h +0 -2
- data/include/grpc/impl/codegen/port_platform.h +34 -90
- data/include/grpc/impl/codegen/sync_windows.h +4 -0
- data/include/grpc/module.modulemap +24 -39
- 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 +16 -12
- data/src/core/ext/filters/client_channel/backup_poller.cc +3 -2
- data/src/core/ext/filters/client_channel/client_channel.cc +3750 -2341
- data/src/core/ext/filters/client_channel/client_channel.h +1 -7
- data/src/core/ext/filters/client_channel/client_channel_channelz.h +0 -3
- data/src/core/ext/filters/client_channel/client_channel_plugin.cc +4 -3
- data/src/core/ext/filters/client_channel/config_selector.cc +58 -0
- data/src/core/ext/filters/client_channel/config_selector.h +125 -0
- 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/global_subchannel_pool.cc +24 -2
- data/src/core/ext/filters/client_channel/health/health_check_client.cc +25 -30
- data/src/core/ext/filters/client_channel/health/health_check_client.h +7 -7
- data/src/core/ext/filters/client_channel/http_connect_handshaker.cc +15 -16
- data/src/core/ext/filters/client_channel/http_proxy.cc +44 -34
- data/src/core/ext/filters/client_channel/lb_policy.cc +25 -20
- data/src/core/ext/filters/client_channel/lb_policy.h +50 -38
- data/src/core/ext/filters/client_channel/lb_policy/address_filtering.cc +96 -0
- data/src/core/ext/filters/client_channel/lb_policy/address_filtering.h +101 -0
- data/src/core/ext/filters/client_channel/lb_policy/child_policy_handler.cc +20 -11
- 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 +481 -510
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_balancer_addresses.cc +76 -0
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_balancer_addresses.h +37 -0
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.h +1 -2
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc +6 -41
- 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/grpclb_client_stats.h +3 -2
- 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 +24 -18
- data/src/core/ext/filters/client_channel/lb_policy/priority/priority.cc +922 -0
- data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +11 -10
- data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +18 -46
- data/src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc +744 -0
- data/src/core/ext/filters/client_channel/lb_policy/xds/cds.cc +520 -134
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds.h +53 -26
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_channel_args.h +29 -0
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_impl.cc +810 -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 +1384 -0
- data/src/core/ext/filters/client_channel/lb_policy_registry.cc +18 -8
- data/src/core/ext/filters/client_channel/local_subchannel_pool.h +2 -1
- data/src/core/ext/filters/client_channel/resolver.cc +6 -10
- data/src/core/ext/filters/client_channel/resolver.h +10 -20
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc +111 -110
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h +4 -34
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_libuv.cc +22 -24
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc +13 -11
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc +79 -122
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc +642 -180
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h +10 -3
- 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 +61 -61
- data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc +102 -108
- data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h +1 -5
- data/src/core/ext/filters/client_channel/resolver/google_c2p/google_c2p_resolver.cc +362 -0
- data/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc +38 -31
- data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc +625 -46
- data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.h +28 -0
- data/src/core/ext/filters/client_channel/resolver_factory.h +8 -8
- data/src/core/ext/filters/client_channel/resolver_registry.cc +55 -52
- data/src/core/ext/filters/client_channel/resolver_registry.h +10 -10
- data/src/core/ext/filters/client_channel/resolver_result_parsing.cc +47 -93
- data/src/core/ext/filters/client_channel/resolver_result_parsing.h +30 -26
- 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 +129 -13
- data/src/core/ext/filters/client_channel/server_address.h +80 -32
- data/src/core/ext/filters/client_channel/service_config.cc +114 -149
- data/src/core/ext/filters/client_channel/service_config.h +33 -100
- data/src/core/ext/filters/client_channel/service_config_call_data.h +86 -0
- data/src/core/ext/filters/client_channel/service_config_channel_arg_filter.cc +142 -0
- data/src/core/ext/filters/client_channel/service_config_parser.cc +89 -0
- data/src/core/ext/filters/client_channel/service_config_parser.h +92 -0
- data/src/core/ext/filters/client_channel/subchannel.cc +156 -98
- data/src/core/ext/filters/client_channel/subchannel.h +65 -35
- 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 +29 -34
- data/src/core/ext/filters/http/client_authority_filter.cc +10 -10
- data/src/core/ext/filters/http/http_filters_plugin.cc +34 -15
- data/src/core/ext/filters/http/message_compress/message_compress_filter.cc +258 -221
- data/src/core/ext/filters/http/message_compress/message_decompress_filter.cc +399 -0
- data/src/core/ext/filters/http/message_compress/message_decompress_filter.h +31 -0
- data/src/core/ext/filters/http/server/http_server_filter.cc +3 -3
- data/src/core/ext/filters/max_age/max_age_filter.cc +38 -34
- data/src/core/ext/filters/message_size/message_size_filter.cc +64 -90
- data/src/core/ext/filters/message_size/message_size_filter.h +12 -5
- 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 +505 -344
- data/src/core/ext/transport/chttp2/server/chttp2_server.h +16 -2
- data/src/core/ext/transport/chttp2/server/insecure/server_chttp2.cc +13 -3
- data/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.cc +19 -18
- data/src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.cc +65 -21
- data/src/core/ext/transport/chttp2/transport/bin_decoder.cc +7 -7
- data/src/core/ext/transport/chttp2/transport/bin_encoder.cc +4 -6
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +307 -343
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.h +1 -0
- data/src/core/ext/transport/chttp2/transport/flow_control.cc +36 -33
- data/src/core/ext/transport/chttp2/transport/flow_control.h +27 -19
- data/src/core/ext/transport/chttp2/transport/frame_data.cc +9 -12
- data/src/core/ext/transport/chttp2/transport/frame_goaway.cc +6 -7
- data/src/core/ext/transport/chttp2/transport/frame_goaway.h +2 -3
- data/src/core/ext/transport/chttp2/transport/frame_ping.cc +5 -6
- data/src/core/ext/transport/chttp2/transport/frame_ping.h +2 -3
- data/src/core/ext/transport/chttp2/transport/frame_rst_stream.cc +12 -13
- data/src/core/ext/transport/chttp2/transport/frame_rst_stream.h +2 -3
- data/src/core/ext/transport/chttp2/transport/frame_settings.cc +8 -9
- data/src/core/ext/transport/chttp2/transport/frame_settings.h +4 -4
- data/src/core/ext/transport/chttp2/transport/frame_window_update.cc +15 -18
- data/src/core/ext/transport/chttp2/transport/frame_window_update.h +2 -3
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.cc +29 -16
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.h +2 -3
- data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +37 -37
- data/src/core/ext/transport/chttp2/transport/hpack_parser.h +2 -3
- data/src/core/ext/transport/chttp2/transport/hpack_table.cc +13 -17
- data/src/core/ext/transport/chttp2/transport/hpack_table.h +2 -2
- data/src/core/ext/transport/chttp2/transport/http2_settings.h +4 -5
- data/src/core/ext/transport/chttp2/transport/huffsyms.h +2 -3
- data/src/core/ext/transport/chttp2/transport/internal.h +37 -23
- data/src/core/ext/transport/chttp2/transport/parsing.cc +52 -74
- data/src/core/ext/transport/chttp2/transport/stream_map.h +2 -3
- data/src/core/ext/transport/chttp2/transport/writing.cc +30 -28
- data/src/core/ext/transport/inproc/inproc_transport.cc +106 -33
- data/src/core/ext/upb-generated/envoy/annotations/deprecation.upb.h +1 -1
- data/src/core/ext/upb-generated/envoy/annotations/resource.upb.c +1 -1
- data/src/core/ext/upb-generated/envoy/annotations/resource.upb.h +10 -4
- data/src/core/ext/upb-generated/envoy/config/accesslog/v3/accesslog.upb.c +243 -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 +453 -0
- data/src/core/ext/upb-generated/envoy/config/cluster/v3/cluster.upb.h +1801 -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 +56 -0
- data/src/core/ext/upb-generated/envoy/config/cluster/v3/outlier_detection.upb.h +364 -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 +334 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/base.upb.h +1066 -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 +767 -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 +27 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/proxy_protocol.upb.h +65 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/socket_option.upb.c +34 -0
- 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 +42 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/substitution_format_string.upb.h +126 -0
- data/src/core/ext/upb-generated/envoy/config/endpoint/v3/endpoint.upb.c +90 -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 +130 -0
- data/src/core/ext/upb-generated/envoy/config/listener/v3/listener.upb.h +557 -0
- data/src/core/ext/upb-generated/envoy/config/listener/v3/listener_components.upb.c +159 -0
- data/src/core/ext/upb-generated/envoy/config/listener/v3/listener_components.upb.h +623 -0
- data/src/core/ext/upb-generated/envoy/config/listener/v3/udp_listener_config.upb.c +40 -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 +65 -0
- data/src/core/ext/upb-generated/envoy/config/route/v3/route.upb.h +237 -0
- data/src/core/ext/upb-generated/envoy/config/route/v3/route_components.upb.c +926 -0
- data/src/core/ext/upb-generated/envoy/config/route/v3/route_components.upb.h +3746 -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 +49 -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/clusters/aggregate/v3/cluster.upb.c +29 -0
- data/src/core/ext/upb-generated/envoy/extensions/clusters/aggregate/v3/cluster.upb.h +67 -0
- data/src/core/ext/upb-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb.c +361 -0
- data/src/core/ext/upb-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb.h +1484 -0
- data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/cert.upb.c +19 -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 +113 -0
- data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/common.upb.h +458 -0
- data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/secret.upb.c +73 -0
- data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/secret.upb.h +219 -0
- data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/tls.upb.c +146 -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/rds.upb.c → service/cluster/v3/cds.upb.c} +7 -9
- data/src/core/ext/upb-generated/envoy/service/cluster/v3/cds.upb.h +56 -0
- data/src/core/ext/upb-generated/envoy/service/discovery/v3/ads.upb.c +25 -0
- 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 +146 -0
- data/src/core/ext/upb-generated/envoy/service/discovery/v3/discovery.upb.h +499 -0
- data/src/core/ext/upb-generated/envoy/service/endpoint/v3/eds.upb.c +27 -0
- data/src/core/ext/upb-generated/envoy/service/endpoint/v3/eds.upb.h +56 -0
- data/src/core/ext/upb-generated/envoy/service/listener/v3/lds.upb.c +27 -0
- 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 +54 -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/srds.upb.c → service/route/v3/rds.upb.c} +7 -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/cds.upb.c → service/route/v3/srds.upb.c} +7 -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 +53 -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} +3 -2
- data/src/core/ext/upb-generated/envoy/type/{http.upb.h → v3/http.upb.h} +9 -9
- 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/v3/semantic_version.upb.c +30 -0
- 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 -1
- 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 +251 -0
- data/src/core/ext/upb-generated/google/api/expr/v1alpha1/syntax.upb.h +871 -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 +52 -32
- data/src/core/ext/upb-generated/google/protobuf/any.upb.c +1 -1
- data/src/core/ext/upb-generated/google/protobuf/any.upb.h +12 -6
- data/src/core/ext/upb-generated/google/protobuf/descriptor.upb.c +107 -106
- data/src/core/ext/upb-generated/google/protobuf/descriptor.upb.h +691 -496
- data/src/core/ext/upb-generated/google/protobuf/duration.upb.c +1 -1
- data/src/core/ext/upb-generated/google/protobuf/duration.upb.h +12 -6
- data/src/core/ext/upb-generated/google/protobuf/empty.upb.c +1 -1
- data/src/core/ext/upb-generated/google/protobuf/empty.upb.h +8 -2
- data/src/core/ext/upb-generated/google/protobuf/struct.upb.c +5 -5
- data/src/core/ext/upb-generated/google/protobuf/struct.upb.h +55 -57
- data/src/core/ext/upb-generated/google/protobuf/timestamp.upb.c +1 -1
- data/src/core/ext/upb-generated/google/protobuf/timestamp.upb.h +12 -6
- data/src/core/ext/upb-generated/google/protobuf/wrappers.upb.c +9 -9
- data/src/core/ext/upb-generated/google/protobuf/wrappers.upb.h +82 -28
- data/src/core/ext/upb-generated/google/rpc/status.upb.c +1 -1
- data/src/core/ext/upb-generated/google/rpc/status.upb.h +17 -10
- data/src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.c +5 -5
- data/src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.h +40 -45
- data/src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.c +43 -43
- data/src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.h +236 -184
- 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 +29 -13
- 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 +19 -7
- 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 +122 -62
- data/src/core/ext/upb-generated/udpa/annotations/migrate.upb.c +3 -3
- data/src/core/ext/upb-generated/udpa/annotations/migrate.upb.h +30 -12
- 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 -1
- data/src/core/ext/upb-generated/udpa/annotations/status.upb.c +28 -0
- data/src/core/ext/upb-generated/udpa/annotations/status.upb.h +71 -0
- 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/data/orca/v1/orca_load_report.upb.c +9 -9
- data/src/core/ext/upb-generated/udpa/data/orca/v1/orca_load_report.upb.h +48 -68
- data/src/core/ext/upb-generated/validate/validate.upb.c +71 -70
- data/src/core/ext/upb-generated/validate/validate.upb.h +732 -586
- data/src/core/ext/upb-generated/xds/core/v3/authority.upb.c +28 -0
- data/src/core/ext/upb-generated/xds/core/v3/authority.upb.h +60 -0
- data/src/core/ext/upb-generated/xds/core/v3/collection_entry.upb.c +52 -0
- data/src/core/ext/upb-generated/xds/core/v3/collection_entry.upb.h +143 -0
- data/src/core/ext/upb-generated/xds/core/v3/context_params.upb.c +42 -0
- data/src/core/ext/upb-generated/xds/core/v3/context_params.upb.h +84 -0
- data/src/core/ext/upb-generated/xds/core/v3/resource.upb.c +36 -0
- data/src/core/ext/upb-generated/xds/core/v3/resource.upb.h +94 -0
- data/src/core/ext/upb-generated/xds/core/v3/resource_locator.upb.c +54 -0
- data/src/core/ext/upb-generated/xds/core/v3/resource_locator.upb.h +166 -0
- data/src/core/ext/upb-generated/xds/core/v3/resource_name.upb.c +36 -0
- data/src/core/ext/upb-generated/xds/core/v3/resource_name.upb.h +85 -0
- 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 +251 -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 +543 -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 +136 -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 +272 -0
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/base.upbdefs.h +135 -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 +43 -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 +68 -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 +107 -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 +195 -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 +193 -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 +59 -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 +101 -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 +938 -0
- data/src/core/ext/upbdefs-generated/envoy/config/route/v3/route_components.upbdefs.h +285 -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 +61 -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/clusters/aggregate/v3/cluster.upbdefs.c +51 -0
- data/src/core/ext/upbdefs-generated/envoy/extensions/clusters/aggregate/v3/cluster.upbdefs.h +35 -0
- data/src/core/ext/upbdefs-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upbdefs.c +504 -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 +44 -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 +170 -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 +97 -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 +246 -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 +142 -0
- data/src/core/ext/upbdefs-generated/envoy/service/discovery/v3/discovery.upbdefs.h +65 -0
- data/src/core/ext/upbdefs-generated/envoy/service/endpoint/v3/eds.upbdefs.c +73 -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 +72 -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 +80 -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 +80 -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 +69 -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 -10
- 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 +39 -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 +40 -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 +40 -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/validate/validate.upbdefs.c +310 -0
- data/src/core/ext/upbdefs-generated/validate/validate.upbdefs.h +145 -0
- data/src/core/ext/upbdefs-generated/xds/core/v3/authority.upbdefs.c +42 -0
- data/src/core/ext/upbdefs-generated/xds/core/v3/authority.upbdefs.h +35 -0
- data/src/core/ext/upbdefs-generated/xds/core/v3/collection_entry.upbdefs.c +62 -0
- data/src/core/ext/upbdefs-generated/xds/core/v3/collection_entry.upbdefs.h +40 -0
- data/src/core/ext/upbdefs-generated/xds/core/v3/context_params.upbdefs.c +45 -0
- data/src/core/ext/upbdefs-generated/xds/core/v3/context_params.upbdefs.h +40 -0
- data/src/core/ext/upbdefs-generated/xds/core/v3/resource.upbdefs.c +49 -0
- data/src/core/ext/upbdefs-generated/xds/core/v3/resource.upbdefs.h +35 -0
- data/src/core/ext/upbdefs-generated/xds/core/v3/resource_locator.upbdefs.c +67 -0
- data/src/core/ext/upbdefs-generated/xds/core/v3/resource_locator.upbdefs.h +40 -0
- data/src/core/ext/upbdefs-generated/xds/core/v3/resource_name.upbdefs.c +50 -0
- data/src/core/ext/upbdefs-generated/xds/core/v3/resource_name.upbdefs.h +35 -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 +2479 -0
- data/src/core/ext/xds/xds_api.h +431 -0
- data/src/core/ext/xds/xds_bootstrap.cc +539 -0
- data/src/core/ext/xds/xds_bootstrap.h +116 -0
- data/src/core/ext/xds/xds_certificate_provider.cc +405 -0
- data/src/core/ext/xds/xds_certificate_provider.h +151 -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 +839 -774
- data/src/core/ext/xds/xds_client.h +339 -0
- data/src/core/ext/xds/xds_client_stats.cc +159 -0
- data/src/core/ext/{filters/client_channel/xds → xds}/xds_client_stats.h +78 -38
- data/src/core/ext/xds/xds_server_config_fetcher.cc +267 -0
- data/src/core/lib/channel/channel_args.cc +24 -22
- data/src/core/lib/channel/channel_args.h +3 -2
- data/src/core/lib/channel/channel_stack.h +20 -13
- data/src/core/lib/channel/channel_trace.cc +6 -8
- data/src/core/lib/channel/channel_trace.h +1 -1
- data/src/core/lib/channel/channelz.cc +46 -94
- data/src/core/lib/channel/channelz.h +17 -25
- data/src/core/lib/channel/channelz_registry.cc +20 -15
- data/src/core/lib/channel/channelz_registry.h +3 -1
- data/src/core/lib/channel/connected_channel.cc +7 -5
- data/src/core/lib/channel/context.h +1 -1
- data/src/core/lib/channel/handshaker.cc +15 -20
- data/src/core/lib/channel/handshaker.h +7 -5
- data/src/core/lib/channel/handshaker_registry.cc +5 -17
- data/src/core/lib/channel/status_util.cc +2 -3
- 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/message_compress.cc +5 -1
- data/src/core/lib/compression/stream_compression_identity.cc +1 -3
- data/src/core/lib/debug/stats.cc +21 -27
- data/src/core/lib/debug/stats.h +5 -3
- 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 +59 -17
- data/src/core/lib/gpr/log_linux.cc +23 -9
- data/src/core/lib/gpr/log_posix.cc +19 -7
- 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 +12 -5
- data/src/core/lib/gpr/string.cc +33 -55
- data/src/core/lib/gpr/string.h +9 -24
- data/src/core/lib/gpr/sync.cc +4 -4
- data/src/core/lib/gpr/sync_abseil.cc +2 -0
- data/src/core/lib/gpr/sync_posix.cc +2 -8
- data/src/core/lib/gpr/time.cc +16 -12
- data/src/core/lib/gpr/time_posix.cc +1 -1
- 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/atomic.h +6 -6
- 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 +3 -3
- data/src/core/lib/gprpp/global_config_env.cc +8 -6
- data/src/core/lib/gprpp/host_port.cc +29 -35
- data/src/core/lib/gprpp/host_port.h +14 -17
- data/src/core/lib/gprpp/manual_constructor.h +1 -1
- data/src/core/lib/gprpp/mpscq.cc +2 -2
- 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 +171 -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/sync.h +129 -40
- 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/gprpp/time_util.cc +77 -0
- data/src/core/lib/gprpp/time_util.h +42 -0
- data/src/core/lib/http/format_request.cc +46 -65
- data/src/core/lib/http/httpcli.cc +16 -14
- data/src/core/lib/http/httpcli.h +4 -6
- data/src/core/lib/http/httpcli_security_connector.cc +13 -13
- data/src/core/lib/http/parser.cc +47 -27
- data/src/core/lib/http/parser.h +2 -3
- data/src/core/lib/iomgr/buffer_list.h +22 -21
- data/src/core/lib/iomgr/call_combiner.cc +8 -5
- data/src/core/lib/iomgr/call_combiner.h +3 -2
- data/src/core/lib/iomgr/cfstream_handle.cc +4 -2
- data/src/core/lib/iomgr/closure.h +2 -3
- data/src/core/lib/iomgr/combiner.cc +2 -1
- data/src/core/lib/iomgr/dualstack_socket_posix.cc +47 -0
- 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 +38 -14
- data/src/core/lib/iomgr/endpoint_pair.h +2 -3
- data/src/core/lib/iomgr/endpoint_pair_posix.cc +10 -10
- data/src/core/lib/iomgr/error.cc +23 -21
- data/src/core/lib/iomgr/error.h +0 -1
- data/src/core/lib/iomgr/error_cfstream.cc +9 -8
- data/src/core/lib/iomgr/error_internal.h +1 -1
- data/src/core/lib/iomgr/ev_apple.cc +359 -0
- data/src/core/lib/iomgr/ev_apple.h +43 -0
- data/src/core/lib/iomgr/ev_epoll1_linux.cc +43 -40
- data/src/core/lib/iomgr/ev_epollex_linux.cc +46 -45
- data/src/core/lib/iomgr/ev_poll_posix.cc +18 -15
- data/src/core/lib/iomgr/ev_posix.cc +2 -3
- data/src/core/lib/iomgr/exec_ctx.cc +1 -1
- data/src/core/lib/iomgr/exec_ctx.h +26 -10
- 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 -1
- data/src/core/lib/iomgr/iomgr_posix.cc +0 -1
- data/src/core/lib/iomgr/iomgr_posix_cfstream.cc +84 -21
- data/src/core/lib/iomgr/is_epollexclusive_available.cc +14 -0
- 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/lib/iomgr/parse_address.cc +322 -0
- 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 +11 -11
- data/src/core/lib/{gprpp/optional.h → iomgr/pollset_uv.h} +11 -12
- data/src/core/lib/iomgr/port.h +2 -21
- data/src/core/lib/iomgr/python_util.h +46 -0
- data/src/core/lib/iomgr/resolve_address.cc +4 -4
- data/src/core/lib/iomgr/resolve_address.h +4 -6
- data/src/core/lib/iomgr/resolve_address_custom.cc +42 -57
- data/src/core/lib/iomgr/resolve_address_custom.h +4 -2
- data/src/core/lib/iomgr/resolve_address_posix.cc +11 -16
- data/src/core/lib/iomgr/resolve_address_windows.cc +16 -25
- data/src/core/lib/iomgr/resource_quota.cc +38 -37
- data/src/core/lib/iomgr/sockaddr_utils.cc +41 -44
- data/src/core/lib/iomgr/sockaddr_utils.h +13 -17
- data/src/core/lib/iomgr/socket_factory_posix.cc +3 -2
- data/src/core/lib/iomgr/socket_factory_posix.h +2 -3
- data/src/core/lib/iomgr/socket_mutator.cc +3 -2
- data/src/core/lib/iomgr/socket_mutator.h +2 -3
- data/src/core/lib/iomgr/socket_utils_common_posix.cc +103 -81
- data/src/core/lib/iomgr/socket_utils_posix.h +3 -0
- data/src/core/lib/iomgr/socket_windows.cc +4 -5
- data/src/core/lib/iomgr/tcp_client.cc +3 -3
- data/src/core/lib/iomgr/tcp_client_cfstream.cc +14 -18
- data/src/core/lib/iomgr/tcp_client_custom.cc +13 -15
- data/src/core/lib/iomgr/tcp_client_posix.cc +31 -37
- data/src/core/lib/iomgr/tcp_client_windows.cc +10 -11
- data/src/core/lib/iomgr/tcp_custom.cc +56 -36
- data/src/core/lib/iomgr/tcp_custom.h +1 -1
- data/src/core/lib/iomgr/tcp_posix.cc +47 -25
- data/src/core/lib/iomgr/tcp_server.cc +3 -4
- data/src/core/lib/iomgr/tcp_server.h +7 -5
- data/src/core/lib/iomgr/tcp_server_custom.cc +39 -45
- data/src/core/lib/iomgr/tcp_server_posix.cc +38 -44
- data/src/core/lib/iomgr/tcp_server_utils_posix.h +3 -4
- data/src/core/lib/iomgr/tcp_server_utils_posix_common.cc +7 -8
- data/src/core/lib/iomgr/tcp_server_utils_posix_ifaddrs.cc +10 -18
- data/src/core/lib/iomgr/tcp_server_windows.cc +16 -16
- data/src/core/lib/iomgr/tcp_uv.cc +3 -2
- data/src/core/lib/iomgr/tcp_windows.cc +26 -10
- data/src/core/lib/iomgr/time_averaged_stats.h +2 -3
- data/src/core/lib/iomgr/timer_custom.cc +5 -5
- data/src/core/lib/iomgr/timer_generic.cc +18 -18
- data/src/core/lib/{gprpp/inlined_vector.h → iomgr/timer_generic.h} +19 -17
- data/src/core/lib/iomgr/timer_heap.h +2 -3
- data/src/core/lib/iomgr/timer_manager.cc +2 -2
- data/src/core/lib/iomgr/udp_server.cc +33 -38
- data/src/core/lib/iomgr/udp_server.h +6 -4
- data/src/core/lib/iomgr/unix_sockets_posix.cc +36 -30
- data/src/core/lib/iomgr/unix_sockets_posix.h +8 -1
- data/src/core/lib/iomgr/unix_sockets_posix_noop.cc +12 -2
- data/src/core/lib/iomgr/wakeup_fd_pipe.cc +2 -2
- data/src/core/lib/json/json.h +15 -4
- data/src/core/lib/json/json_reader.cc +33 -30
- 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 +15 -13
- 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/matchers.cc +339 -0
- data/src/core/lib/security/authorization/matchers.h +158 -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 +99 -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/alts_credentials.cc +2 -1
- data/src/core/lib/security/credentials/alts/alts_credentials.h +1 -1
- data/src/core/lib/security/credentials/alts/check_gcp_environment.cc +1 -1
- data/src/core/lib/security/credentials/composite/composite_credentials.cc +12 -0
- data/src/core/lib/security/credentials/composite/composite_credentials.h +6 -3
- data/src/core/lib/security/credentials/credentials.cc +7 -91
- data/src/core/lib/security/credentials/credentials.h +18 -66
- 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 +3 -2
- data/src/core/lib/security/credentials/fake/fake_credentials.h +4 -0
- data/src/core/lib/security/credentials/google_default/credentials_generic.cc +8 -6
- data/src/core/lib/security/credentials/google_default/google_default_credentials.cc +90 -67
- data/src/core/lib/security/credentials/iam/iam_credentials.cc +8 -6
- data/src/core/lib/security/credentials/iam/iam_credentials.h +4 -0
- data/src/core/lib/security/credentials/insecure/insecure_credentials.cc +64 -0
- data/src/core/lib/security/credentials/jwt/json_token.cc +4 -4
- data/src/core/lib/security/credentials/jwt/json_token.h +2 -5
- data/src/core/lib/security/credentials/jwt/jwt_credentials.cc +7 -4
- data/src/core/lib/security/credentials/jwt/jwt_credentials.h +13 -0
- data/src/core/lib/security/credentials/jwt/jwt_verifier.cc +13 -19
- data/src/core/lib/security/credentials/jwt/jwt_verifier.h +2 -3
- data/src/core/lib/security/credentials/local/local_credentials.cc +2 -1
- data/src/core/lib/security/credentials/local/local_credentials.h +1 -1
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc +109 -97
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.h +14 -7
- data/src/core/lib/security/credentials/plugin/plugin_credentials.cc +20 -7
- data/src/core/lib/security/credentials/plugin/plugin_credentials.h +2 -0
- data/src/core/lib/security/credentials/ssl/ssl_credentials.cc +27 -6
- data/src/core/lib/security/credentials/ssl/ssl_credentials.h +12 -2
- 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 -140
- data/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.h +74 -167
- data/src/core/lib/security/credentials/tls/tls_credentials.cc +18 -13
- data/src/core/lib/security/credentials/tls/tls_credentials.h +3 -3
- 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 +244 -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 +22 -7
- data/src/core/lib/security/security_connector/fake/fake_security_connector.cc +27 -32
- 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.cc +3 -2
- 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 +4 -4
- data/src/core/lib/security/security_connector/security_connector.cc +6 -3
- data/src/core/lib/security/security_connector/security_connector.h +6 -4
- data/src/core/lib/security/security_connector/ssl/ssl_security_connector.cc +42 -40
- data/src/core/lib/security/security_connector/ssl/ssl_security_connector.h +8 -5
- data/src/core/lib/security/security_connector/ssl_utils.cc +94 -23
- data/src/core/lib/security/security_connector/ssl_utils.h +37 -31
- data/src/core/lib/security/security_connector/tls/tls_security_connector.cc +388 -284
- data/src/core/lib/security/security_connector/tls/tls_security_connector.h +108 -42
- data/src/core/lib/security/transport/auth_filters.h +0 -5
- data/src/core/lib/security/transport/client_auth_filter.cc +11 -11
- data/src/core/lib/security/transport/secure_endpoint.cc +9 -3
- data/src/core/lib/security/transport/security_handshaker.cc +4 -6
- data/src/core/lib/security/transport/server_auth_filter.cc +2 -1
- data/src/core/lib/security/util/json_util.cc +12 -13
- data/src/core/lib/security/util/json_util.h +1 -0
- data/src/core/lib/slice/slice.cc +45 -5
- data/src/core/lib/slice/slice_buffer.cc +2 -1
- data/src/core/lib/slice/slice_intern.cc +9 -11
- data/src/core/lib/slice/slice_internal.h +17 -2
- data/src/core/lib/slice/slice_utils.h +9 -0
- data/src/core/lib/surface/byte_buffer_reader.cc +2 -47
- data/src/core/lib/surface/call.cc +95 -88
- data/src/core/lib/surface/call.h +2 -1
- data/src/core/lib/surface/call_details.cc +8 -8
- data/src/core/lib/surface/call_log_batch.cc +50 -58
- data/src/core/lib/surface/channel.cc +86 -72
- data/src/core/lib/surface/channel.h +54 -7
- data/src/core/lib/surface/channel_init.cc +1 -1
- data/src/core/lib/surface/channel_ping.cc +2 -3
- data/src/core/lib/surface/completion_queue.cc +63 -62
- data/src/core/lib/surface/completion_queue.h +16 -16
- data/src/core/lib/surface/event_string.cc +18 -25
- data/src/core/lib/surface/event_string.h +3 -1
- data/src/core/lib/surface/init.cc +45 -29
- data/src/core/lib/surface/init_secure.cc +1 -4
- 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 +1311 -1309
- data/src/core/lib/surface/server.h +410 -45
- 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 +10 -5
- data/src/core/lib/transport/connectivity_state.cc +23 -17
- data/src/core/lib/transport/connectivity_state.h +31 -15
- 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 +19 -5
- data/src/core/lib/transport/metadata.h +2 -2
- data/src/core/lib/transport/metadata_batch.h +6 -7
- data/src/core/lib/transport/static_metadata.cc +296 -277
- data/src/core/lib/transport/static_metadata.h +81 -74
- data/src/core/lib/transport/status_conversion.cc +6 -14
- 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 +7 -6
- data/src/core/lib/transport/transport.h +24 -10
- data/src/core/lib/transport/transport_op_string.cc +61 -102
- data/src/core/lib/uri/uri_parser.cc +135 -258
- data/src/core/lib/uri/uri_parser.h +60 -23
- data/src/core/plugin_registry/grpc_plugin_registry.cc +59 -12
- data/src/core/tsi/alts/crypt/aes_gcm.cc +0 -2
- 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 +48 -34
- data/src/core/tsi/alts/handshaker/alts_handshaker_client.h +8 -4
- data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc +98 -48
- data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.h +9 -1
- data/src/core/tsi/alts/handshaker/transport_security_common_api.cc +2 -0
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_record_protocol_common.h +2 -3
- 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 +17 -19
- 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 +0 -2
- data/src/core/tsi/ssl/session_cache/ssl_session_boringssl.cc +1 -1
- data/src/core/tsi/ssl/session_cache/ssl_session_cache.cc +0 -2
- data/src/core/tsi/ssl/session_cache/ssl_session_cache.h +3 -4
- data/src/core/tsi/ssl_transport_security.cc +226 -105
- data/src/core/tsi/ssl_transport_security.h +28 -16
- data/src/core/tsi/ssl_types.h +0 -2
- data/src/core/tsi/transport_security.cc +10 -8
- data/src/core/tsi/transport_security.h +6 -9
- data/src/core/tsi/transport_security_grpc.h +2 -3
- data/src/core/tsi/transport_security_interface.h +9 -4
- data/src/ruby/bin/math_services_pb.rb +4 -4
- data/src/ruby/ext/grpc/extconf.rb +6 -3
- data/src/ruby/ext/grpc/rb_call.c +12 -3
- data/src/ruby/ext/grpc/rb_call.h +4 -0
- data/src/ruby/ext/grpc/rb_call_credentials.c +57 -12
- 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 +42 -18
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +80 -44
- data/src/ruby/lib/grpc/errors.rb +103 -42
- data/src/ruby/lib/grpc/generic/active_call.rb +2 -3
- data/src/ruby/lib/grpc/generic/client_stub.rb +1 -1
- data/src/ruby/lib/grpc/generic/interceptors.rb +5 -5
- data/src/ruby/lib/grpc/generic/rpc_server.rb +9 -10
- data/src/ruby/lib/grpc/generic/service.rb +5 -4
- data/src/ruby/lib/grpc/structs.rb +1 -1
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/src/ruby/pb/generate_proto_ruby.sh +5 -3
- data/src/ruby/pb/grpc/health/v1/health_services_pb.rb +2 -2
- data/src/ruby/pb/src/proto/grpc/testing/messages_pb.rb +51 -0
- data/src/ruby/pb/src/proto/grpc/testing/test_services_pb.rb +61 -11
- data/src/ruby/spec/channel_credentials_spec.rb +10 -0
- data/src/ruby/spec/debug_message_spec.rb +134 -0
- data/src/ruby/spec/generic/active_call_spec.rb +19 -8
- data/src/ruby/spec/generic/service_spec.rb +2 -0
- data/src/ruby/spec/pb/codegen/grpc/testing/package_options_import2.proto +23 -0
- data/src/ruby/spec/pb/codegen/grpc/testing/package_options_ruby_style.proto +7 -0
- data/src/ruby/spec/pb/codegen/grpc/testing/same_package_service_name.proto +27 -0
- data/src/ruby/spec/pb/codegen/grpc/testing/same_ruby_package_service_name.proto +29 -0
- data/src/ruby/spec/pb/codegen/package_option_spec.rb +29 -7
- data/src/ruby/spec/support/services.rb +10 -4
- data/src/ruby/spec/testdata/ca.pem +18 -13
- data/src/ruby/spec/testdata/client.key +26 -14
- data/src/ruby/spec/testdata/client.pem +18 -12
- data/src/ruby/spec/testdata/server1.key +26 -14
- data/src/ruby/spec/testdata/server1.pem +20 -14
- data/src/ruby/spec/user_agent_spec.rb +74 -0
- 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 +698 -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 +175 -0
- data/third_party/abseil-cpp/absl/time/civil_time.h +538 -0
- data/third_party/abseil-cpp/absl/time/clock.cc +569 -0
- data/third_party/abseil-cpp/absl/time/clock.h +74 -0
- data/third_party/abseil-cpp/absl/time/duration.cc +953 -0
- data/third_party/abseil-cpp/absl/time/format.cc +160 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/include/cctz/civil_time.h +332 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/include/cctz/civil_time_detail.h +632 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/include/cctz/time_zone.h +386 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/include/cctz/zone_info_source.h +102 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/civil_time_detail.cc +94 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_fixed.cc +140 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_fixed.h +52 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_format.cc +1029 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_if.cc +45 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_if.h +76 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_impl.cc +113 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_impl.h +93 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_info.cc +965 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_info.h +137 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_libc.cc +309 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_libc.h +55 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_lookup.cc +187 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_posix.cc +159 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_posix.h +132 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/tzfile.h +122 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/zone_info_source.cc +116 -0
- data/third_party/abseil-cpp/absl/time/internal/get_current_time_chrono.inc +31 -0
- data/third_party/abseil-cpp/absl/time/internal/get_current_time_posix.inc +24 -0
- data/third_party/abseil-cpp/absl/time/time.cc +499 -0
- data/third_party/abseil-cpp/absl/time/time.h +1583 -0
- 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 +759 -707
- data/third_party/boringssl-with-bazel/src/crypto/asn1/a_bitstr.c +6 -6
- data/third_party/boringssl-with-bazel/src/crypto/asn1/a_enum.c +5 -5
- data/third_party/boringssl-with-bazel/src/crypto/asn1/a_int.c +6 -6
- data/third_party/boringssl-with-bazel/src/crypto/asn1/a_object.c +6 -13
- data/third_party/boringssl-with-bazel/src/crypto/asn1/a_octet.c +3 -3
- data/third_party/boringssl-with-bazel/src/crypto/asn1/a_time.c +2 -2
- data/third_party/boringssl-with-bazel/src/crypto/asn1/a_type.c +5 -3
- data/third_party/boringssl-with-bazel/src/crypto/asn1/a_utctm.c +2 -2
- data/third_party/boringssl-with-bazel/src/crypto/asn1/asn1_lib.c +15 -20
- data/third_party/boringssl-with-bazel/src/crypto/asn1/asn1_locl.h +30 -0
- data/third_party/boringssl-with-bazel/src/crypto/asn1/asn_pack.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/asn1/f_enum.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/asn1/f_int.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/asn1/f_string.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/asn1/tasn_dec.c +28 -79
- data/third_party/boringssl-with-bazel/src/crypto/asn1/tasn_enc.c +39 -85
- data/third_party/boringssl-with-bazel/src/crypto/asn1/tasn_fre.c +5 -16
- data/third_party/boringssl-with-bazel/src/crypto/asn1/tasn_new.c +10 -61
- data/third_party/boringssl-with-bazel/src/crypto/asn1/tasn_typ.c +0 -2
- data/third_party/boringssl-with-bazel/src/crypto/asn1/tasn_utl.c +2 -2
- data/third_party/boringssl-with-bazel/src/crypto/bio/bio.c +2 -0
- data/third_party/boringssl-with-bazel/src/crypto/bio/socket_helper.c +4 -0
- data/third_party/boringssl-with-bazel/src/crypto/blake2/blake2.c +158 -0
- data/third_party/boringssl-with-bazel/src/crypto/bn_extra/bn_asn1.c +3 -10
- data/third_party/boringssl-with-bazel/src/crypto/bytestring/ber.c +8 -9
- data/third_party/boringssl-with-bazel/src/crypto/bytestring/cbs.c +60 -45
- data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/derive_key.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/e_chacha20poly1305.c +6 -81
- data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/internal.h +87 -0
- data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/tls_cbc.c +1 -0
- data/third_party/boringssl-with-bazel/src/crypto/cpu-aarch64-win.c +41 -0
- data/third_party/boringssl-with-bazel/src/crypto/cpu-arm-linux.c +7 -5
- data/third_party/boringssl-with-bazel/src/crypto/cpu-intel.c +13 -4
- data/third_party/boringssl-with-bazel/src/crypto/crypto.c +11 -0
- data/third_party/boringssl-with-bazel/src/{third_party/fiat → crypto/curve25519}/curve25519.c +18 -26
- data/third_party/boringssl-with-bazel/src/{third_party/fiat → crypto/curve25519}/curve25519_tables.h +13 -21
- data/third_party/boringssl-with-bazel/src/{third_party/fiat → crypto/curve25519}/internal.h +14 -22
- data/third_party/boringssl-with-bazel/src/crypto/curve25519/spake25519.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/{dh → dh_extra}/dh_asn1.c +0 -0
- data/third_party/boringssl-with-bazel/src/crypto/{dh → dh_extra}/params.c +179 -0
- data/third_party/boringssl-with-bazel/src/crypto/digest_extra/digest_extra.c +25 -0
- data/third_party/boringssl-with-bazel/src/crypto/dsa/dsa.c +19 -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/ec_extra/ec_asn1.c +2 -17
- data/third_party/boringssl-with-bazel/src/crypto/ec_extra/hash_to_curve.c +385 -0
- data/third_party/boringssl-with-bazel/src/crypto/ec_extra/internal.h +56 -0
- data/third_party/boringssl-with-bazel/src/crypto/ecdh_extra/ecdh_extra.c +2 -2
- data/third_party/boringssl-with-bazel/src/crypto/err/err.c +33 -32
- 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 +159 -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/aes/aes_nohw.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/aes/mode_wrappers.c +17 -1
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bcm.c +5 -2
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/bn.c +13 -20
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/div.c +2 -3
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/exponentiation.c +3 -3
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/internal.h +34 -13
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/montgomery.c +8 -8
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/mul.c +30 -154
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/cipher/e_aes.c +173 -35
- data/third_party/boringssl-with-bazel/src/crypto/{dh → fipsmodule/dh}/check.c +0 -0
- data/third_party/boringssl-with-bazel/src/crypto/{dh → fipsmodule/dh}/dh.c +149 -211
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/digest/digest.c +2 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/digest/digests.c +16 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/ec.c +301 -117
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/ec_key.c +22 -28
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/ec_montgomery.c +96 -55
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/felem.c +25 -7
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/internal.h +434 -161
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/oct.c +63 -71
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p224-64.c +18 -25
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p256-x86_64-table.h +9481 -9485
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p256-x86_64.c +104 -122
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p256.c +740 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p256_table.h +297 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/scalar.c +90 -11
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/simple.c +125 -148
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/simple_mul.c +189 -3
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/util.c +3 -3
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/wnaf.c +61 -18
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ecdh/ecdh.c +2 -2
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ecdsa/ecdsa.c +20 -5
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/fork_detect.c +137 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/fork_detect.h +49 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/getrandom_fillin.h +64 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/internal.h +69 -5
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/rand.c +155 -50
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/urandom.c +24 -121
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/blinding.c +4 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/internal.h +5 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/rsa.c +73 -40
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/rsa_impl.c +122 -55
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/self_check/self_check.c +217 -2
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/sha/sha512.c +44 -35
- data/third_party/boringssl-with-bazel/src/crypto/hpke/hpke.c +532 -0
- data/third_party/boringssl-with-bazel/src/crypto/hpke/internal.h +246 -0
- data/third_party/boringssl-with-bazel/src/crypto/mem.c +47 -16
- data/third_party/boringssl-with-bazel/src/crypto/obj/obj_dat.h +15 -1
- data/third_party/boringssl-with-bazel/src/crypto/pkcs8/internal.h +7 -0
- data/third_party/boringssl-with-bazel/src/crypto/pkcs8/pkcs8_x509.c +36 -5
- data/third_party/boringssl-with-bazel/src/crypto/poly1305/poly1305.c +10 -7
- data/third_party/boringssl-with-bazel/src/crypto/poly1305/poly1305_arm.c +13 -11
- data/third_party/boringssl-with-bazel/src/crypto/poly1305/poly1305_vec.c +4 -0
- data/third_party/boringssl-with-bazel/src/crypto/rand_extra/deterministic.c +6 -10
- data/third_party/boringssl-with-bazel/src/crypto/rand_extra/passive.c +34 -0
- data/third_party/boringssl-with-bazel/src/crypto/rand_extra/rand_extra.c +4 -0
- data/third_party/boringssl-with-bazel/src/crypto/rand_extra/windows.c +16 -0
- data/third_party/boringssl-with-bazel/src/crypto/stack/stack.c +7 -13
- data/third_party/boringssl-with-bazel/src/crypto/thread_pthread.c +4 -0
- data/third_party/boringssl-with-bazel/src/crypto/thread_win.c +4 -0
- data/third_party/boringssl-with-bazel/src/crypto/trust_token/internal.h +318 -0
- data/third_party/boringssl-with-bazel/src/crypto/trust_token/pmbtoken.c +1399 -0
- data/third_party/boringssl-with-bazel/src/crypto/trust_token/trust_token.c +858 -0
- 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 +7 -7
- data/third_party/boringssl-with-bazel/src/crypto/x509/algorithm.c +10 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509/asn1_gen.c +4 -4
- data/third_party/boringssl-with-bazel/src/crypto/x509/rsa_pss.c +5 -1
- 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.c +0 -67
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_cmp.c +21 -9
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_ext.c +27 -21
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_obj.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_r2x.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_req.c +10 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_set.c +89 -11
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_trs.c +7 -4
- 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 +4 -4
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_vfy.c +62 -44
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509cset.c +67 -25
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509name.c +13 -11
- 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 +38 -17
- data/third_party/boringssl-with-bazel/src/crypto/x509/x_name.c +28 -40
- data/third_party/boringssl-with-bazel/src/crypto/x509/x_pkey.c +2 -2
- data/third_party/boringssl-with-bazel/src/crypto/x509/x_pubkey.c +0 -154
- 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 +66 -9
- data/third_party/boringssl-with-bazel/src/crypto/x509/x_x509a.c +2 -2
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/ext_dat.h +1 -4
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/internal.h +5 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/pcy_data.c +5 -3
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_akey.c +3 -3
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_alt.c +25 -24
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_bitst.c +3 -3
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_conf.c +32 -28
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_cpols.c +2 -2
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_enum.c +2 -1
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_genn.c +42 -22
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_ia5.c +3 -4
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_info.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_lib.c +25 -36
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_prn.c +2 -2
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_purp.c +126 -40
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_skey.c +7 -7
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_utl.c +6 -6
- data/third_party/boringssl-with-bazel/src/include/openssl/aead.h +24 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/aes.h +16 -4
- 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 +662 -556
- data/third_party/boringssl-with-bazel/src/include/openssl/asn1t.h +0 -167
- data/third_party/boringssl-with-bazel/src/include/openssl/base.h +19 -7
- data/third_party/boringssl-with-bazel/src/include/openssl/bio.h +4 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/blake2.h +62 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/bytestring.h +22 -7
- data/third_party/boringssl-with-bazel/src/include/openssl/cipher.h +21 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/crypto.h +10 -5
- data/third_party/boringssl-with-bazel/src/include/openssl/des.h +6 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/dh.h +82 -20
- data/third_party/boringssl-with-bazel/src/include/openssl/digest.h +11 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/dsa.h +16 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/ec.h +15 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/ecdsa.h +6 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/err.h +2 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/evp.h +85 -3
- data/third_party/boringssl-with-bazel/src/include/openssl/nid.h +5 -0
- 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/rand.h +6 -17
- data/third_party/boringssl-with-bazel/src/include/openssl/rsa.h +31 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/sha.h +26 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/span.h +2 -1
- data/third_party/boringssl-with-bazel/src/include/openssl/ssl.h +335 -112
- data/third_party/boringssl-with-bazel/src/include/openssl/tls1.h +33 -10
- data/third_party/boringssl-with-bazel/src/include/openssl/trust_token.h +310 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/x509.h +1141 -755
- data/third_party/boringssl-with-bazel/src/include/openssl/x509_vfy.h +1 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/x509v3.h +593 -440
- data/third_party/boringssl-with-bazel/src/ssl/bio_ssl.cc +18 -5
- data/third_party/boringssl-with-bazel/src/ssl/d1_both.cc +0 -4
- data/third_party/boringssl-with-bazel/src/ssl/d1_lib.cc +3 -3
- data/third_party/boringssl-with-bazel/src/ssl/dtls_method.cc +13 -4
- data/third_party/boringssl-with-bazel/src/ssl/handoff.cc +181 -57
- data/third_party/boringssl-with-bazel/src/ssl/handshake.cc +45 -26
- data/third_party/boringssl-with-bazel/src/ssl/handshake_client.cc +43 -45
- data/third_party/boringssl-with-bazel/src/ssl/handshake_server.cc +32 -10
- data/third_party/boringssl-with-bazel/src/ssl/internal.h +160 -80
- data/third_party/boringssl-with-bazel/src/ssl/s3_both.cc +10 -10
- data/third_party/boringssl-with-bazel/src/ssl/s3_lib.cc +2 -3
- data/third_party/boringssl-with-bazel/src/ssl/s3_pkt.cc +21 -21
- data/third_party/boringssl-with-bazel/src/ssl/ssl_asn1.cc +77 -8
- data/third_party/boringssl-with-bazel/src/ssl/ssl_cert.cc +7 -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 +131 -15
- data/third_party/boringssl-with-bazel/src/ssl/ssl_privkey.cc +13 -2
- data/third_party/boringssl-with-bazel/src/ssl/ssl_session.cc +50 -15
- data/third_party/boringssl-with-bazel/src/ssl/ssl_stat.cc +6 -0
- data/third_party/boringssl-with-bazel/src/ssl/ssl_transcript.cc +2 -2
- data/third_party/boringssl-with-bazel/src/ssl/ssl_versions.cc +5 -5
- data/third_party/boringssl-with-bazel/src/ssl/t1_enc.cc +53 -30
- data/third_party/boringssl-with-bazel/src/ssl/t1_lib.cc +611 -89
- data/third_party/boringssl-with-bazel/src/ssl/tls13_both.cc +2 -3
- data/third_party/boringssl-with-bazel/src/ssl/tls13_client.cc +187 -68
- data/third_party/boringssl-with-bazel/src/ssl/tls13_enc.cc +71 -90
- data/third_party/boringssl-with-bazel/src/ssl/tls13_server.cc +247 -73
- data/third_party/boringssl-with-bazel/src/ssl/tls_method.cc +63 -25
- data/third_party/boringssl-with-bazel/src/ssl/tls_record.cc +5 -3
- data/third_party/boringssl-with-bazel/src/third_party/fiat/curve25519_32.h +245 -175
- data/third_party/boringssl-with-bazel/src/third_party/fiat/curve25519_64.h +135 -75
- data/third_party/boringssl-with-bazel/src/third_party/fiat/p256_32.h +1593 -1672
- data/third_party/boringssl-with-bazel/src/third_party/fiat/p256_64.h +512 -503
- data/third_party/re2/re2/bitmap256.h +117 -0
- data/third_party/re2/re2/bitstate.cc +385 -0
- data/third_party/re2/re2/compile.cc +1279 -0
- data/third_party/re2/re2/dfa.cc +2130 -0
- data/third_party/re2/re2/filtered_re2.cc +121 -0
- data/third_party/re2/re2/filtered_re2.h +109 -0
- data/third_party/re2/re2/mimics_pcre.cc +197 -0
- data/third_party/re2/re2/nfa.cc +713 -0
- data/third_party/re2/re2/onepass.cc +623 -0
- data/third_party/re2/re2/parse.cc +2464 -0
- data/third_party/re2/re2/perl_groups.cc +119 -0
- data/third_party/re2/re2/pod_array.h +55 -0
- data/third_party/re2/re2/prefilter.cc +710 -0
- data/third_party/re2/re2/prefilter.h +108 -0
- data/third_party/re2/re2/prefilter_tree.cc +407 -0
- data/third_party/re2/re2/prefilter_tree.h +139 -0
- data/third_party/re2/re2/prog.cc +988 -0
- data/third_party/re2/re2/prog.h +436 -0
- data/third_party/re2/re2/re2.cc +1362 -0
- data/third_party/re2/re2/re2.h +1002 -0
- data/third_party/re2/re2/regexp.cc +980 -0
- data/third_party/re2/re2/regexp.h +659 -0
- data/third_party/re2/re2/set.cc +154 -0
- data/third_party/re2/re2/set.h +80 -0
- data/third_party/re2/re2/simplify.cc +657 -0
- data/third_party/re2/re2/sparse_array.h +392 -0
- data/third_party/re2/re2/sparse_set.h +264 -0
- data/third_party/re2/re2/stringpiece.cc +65 -0
- data/third_party/re2/re2/stringpiece.h +210 -0
- data/third_party/re2/re2/tostring.cc +351 -0
- data/third_party/re2/re2/unicode_casefold.cc +582 -0
- data/third_party/re2/re2/unicode_casefold.h +78 -0
- data/third_party/re2/re2/unicode_groups.cc +6269 -0
- data/third_party/re2/re2/unicode_groups.h +67 -0
- data/third_party/re2/re2/walker-inl.h +246 -0
- data/third_party/re2/util/benchmark.h +156 -0
- data/third_party/re2/util/flags.h +26 -0
- data/third_party/re2/util/logging.h +109 -0
- data/third_party/re2/util/malloc_counter.h +19 -0
- data/third_party/re2/util/mix.h +41 -0
- data/third_party/re2/util/mutex.h +148 -0
- data/third_party/re2/util/pcre.cc +1025 -0
- data/third_party/re2/util/pcre.h +681 -0
- data/third_party/re2/util/rune.cc +260 -0
- data/third_party/re2/util/strutil.cc +149 -0
- data/third_party/re2/util/strutil.h +21 -0
- data/third_party/re2/util/test.h +50 -0
- data/third_party/re2/util/utf.h +44 -0
- data/third_party/re2/util/util.h +42 -0
- data/third_party/upb/third_party/wyhash/wyhash.h +145 -0
- data/third_party/upb/upb/decode.c +604 -511
- 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 +311 -211
- 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 +215 -70
- data/third_party/upb/upb/msg.h +558 -14
- data/third_party/upb/upb/port_def.inc +105 -63
- data/third_party/upb/upb/port_undef.inc +10 -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 +73 -269
- data/third_party/upb/upb/table.int.h +25 -57
- 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 +138 -135
- data/third_party/upb/upb/upb.h +119 -146
- data/third_party/upb/upb/upb.hpp +88 -0
- data/third_party/upb/upb/upb.int.h +29 -0
- metadata +646 -164
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds.cc +0 -1754
- data/src/core/ext/filters/client_channel/parse_address.cc +0 -237
- 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 -484
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_fallback.cc +0 -65
- data/src/core/ext/filters/client_channel/resolving_lb_policy.cc +0 -359
- data/src/core/ext/filters/client_channel/resolving_lb_policy.h +0 -122
- data/src/core/ext/filters/client_channel/xds/xds_api.cc +0 -1779
- data/src/core/ext/filters/client_channel/xds/xds_api.h +0 -280
- data/src/core/ext/filters/client_channel/xds/xds_bootstrap.cc +0 -347
- data/src/core/ext/filters/client_channel/xds/xds_bootstrap.h +0 -87
- 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 -104
- data/src/core/ext/filters/client_channel/xds/xds_client.h +0 -274
- data/src/core/ext/filters/client_channel/xds/xds_client_stats.cc +0 -116
- data/src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.c +0 -246
- data/src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.h +0 -905
- data/src/core/ext/upb-generated/envoy/api/v2/cds.upb.h +0 -53
- data/src/core/ext/upb-generated/envoy/api/v2/cluster.upb.c +0 -390
- data/src/core/ext/upb-generated/envoy/api/v2/cluster.upb.h +0 -1411
- data/src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.c +0 -73
- data/src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.h +0 -218
- data/src/core/ext/upb-generated/envoy/api/v2/cluster/filter.upb.c +0 -34
- 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 -54
- data/src/core/ext/upb-generated/envoy/api/v2/cluster/outlier_detection.upb.h +0 -305
- data/src/core/ext/upb-generated/envoy/api/v2/core/address.upb.c +0 -111
- data/src/core/ext/upb-generated/envoy/api/v2/core/address.upb.h +0 -328
- data/src/core/ext/upb-generated/envoy/api/v2/core/base.upb.c +0 -292
- data/src/core/ext/upb-generated/envoy/api/v2/core/base.upb.h +0 -847
- data/src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.c +0 -95
- data/src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.h +0 -322
- data/src/core/ext/upb-generated/envoy/api/v2/core/grpc_service.upb.c +0 -196
- data/src/core/ext/upb-generated/envoy/api/v2/core/grpc_service.upb.h +0 -642
- data/src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.c +0 -168
- data/src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.h +0 -658
- data/src/core/ext/upb-generated/envoy/api/v2/core/http_uri.upb.c +0 -35
- 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 -132
- data/src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.h +0 -436
- data/src/core/ext/upb-generated/envoy/api/v2/discovery.upb.c +0 -128
- data/src/core/ext/upb-generated/envoy/api/v2/discovery.upb.h +0 -392
- data/src/core/ext/upb-generated/envoy/api/v2/eds.upb.c +0 -30
- data/src/core/ext/upb-generated/envoy/api/v2/eds.upb.h +0 -53
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint.upb.c +0 -91
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint.upb.h +0 -240
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint.upb.c +0 -17
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint.upb.h +0 -33
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint_components.upb.c +0 -88
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint_components.upb.h +0 -258
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint/load_report.upb.c +0 -111
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint/load_report.upb.h +0 -324
- data/src/core/ext/upb-generated/envoy/api/v2/lds.upb.c +0 -30
- data/src/core/ext/upb-generated/envoy/api/v2/lds.upb.h +0 -53
- data/src/core/ext/upb-generated/envoy/api/v2/listener.upb.c +0 -104
- data/src/core/ext/upb-generated/envoy/api/v2/listener.upb.h +0 -383
- data/src/core/ext/upb-generated/envoy/api/v2/listener/listener.upb.c +0 -17
- data/src/core/ext/upb-generated/envoy/api/v2/listener/listener.upb.h +0 -33
- data/src/core/ext/upb-generated/envoy/api/v2/listener/listener_components.upb.c +0 -144
- data/src/core/ext/upb-generated/envoy/api/v2/listener/listener_components.upb.h +0 -527
- data/src/core/ext/upb-generated/envoy/api/v2/listener/udp_listener_config.upb.c +0 -42
- data/src/core/ext/upb-generated/envoy/api/v2/listener/udp_listener_config.upb.h +0 -112
- data/src/core/ext/upb-generated/envoy/api/v2/rds.upb.h +0 -53
- data/src/core/ext/upb-generated/envoy/api/v2/route.upb.c +0 -62
- data/src/core/ext/upb-generated/envoy/api/v2/route.upb.h +0 -199
- data/src/core/ext/upb-generated/envoy/api/v2/route/route.upb.c +0 -17
- data/src/core/ext/upb-generated/envoy/api/v2/route/route.upb.h +0 -33
- data/src/core/ext/upb-generated/envoy/api/v2/route/route_components.upb.c +0 -793
- data/src/core/ext/upb-generated/envoy/api/v2/route/route_components.upb.h +0 -2936
- data/src/core/ext/upb-generated/envoy/api/v2/scoped_route.upb.c +0 -58
- data/src/core/ext/upb-generated/envoy/api/v2/scoped_route.upb.h +0 -134
- data/src/core/ext/upb-generated/envoy/api/v2/srds.upb.h +0 -53
- data/src/core/ext/upb-generated/envoy/config/filter/accesslog/v2/accesslog.upb.c +0 -227
- data/src/core/ext/upb-generated/envoy/config/filter/accesslog/v2/accesslog.upb.h +0 -725
- data/src/core/ext/upb-generated/envoy/config/filter/network/http_connection_manager/v2/http_connection_manager.upb.c +0 -296
- data/src/core/ext/upb-generated/envoy/config/filter/network/http_connection_manager/v2/http_connection_manager.upb.h +0 -1072
- data/src/core/ext/upb-generated/envoy/config/listener/v2/api_listener.upb.c +0 -32
- data/src/core/ext/upb-generated/envoy/config/listener/v2/api_listener.upb.h +0 -65
- data/src/core/ext/upb-generated/envoy/service/discovery/v2/ads.upb.c +0 -23
- data/src/core/ext/upb-generated/envoy/service/discovery/v2/ads.upb.h +0 -50
- data/src/core/ext/upb-generated/envoy/service/load_stats/v2/lrs.upb.c +0 -52
- data/src/core/ext/upb-generated/envoy/service/load_stats/v2/lrs.upb.h +0 -130
- data/src/core/ext/upb-generated/envoy/type/matcher/regex.upb.c +0 -47
- data/src/core/ext/upb-generated/envoy/type/matcher/regex.upb.h +0 -108
- data/src/core/ext/upb-generated/envoy/type/matcher/string.upb.c +0 -52
- 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 -87
- 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 -38
- data/src/core/ext/upb-generated/envoy/type/percent.upb.h +0 -87
- data/src/core/ext/upb-generated/envoy/type/range.upb.c +0 -49
- data/src/core/ext/upb-generated/envoy/type/range.upb.h +0 -112
- data/src/core/ext/upb-generated/envoy/type/semantic_version.upb.c +0 -28
- data/src/core/ext/upb-generated/envoy/type/semantic_version.upb.h +0 -62
- data/src/core/ext/upb-generated/envoy/type/tracing/v2/custom_tag.upb.c +0 -88
- data/src/core/ext/upb-generated/envoy/type/tracing/v2/custom_tag.upb.h +0 -249
- data/src/core/ext/upb-generated/gogoproto/gogo.upb.c +0 -17
- data/src/core/lib/gprpp/map.h +0 -59
- data/src/core/lib/gprpp/string_view.h +0 -60
- data/src/core/lib/iomgr/iomgr_posix.h +0 -26
- 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/src/core/tsi/grpc_shadow_boringssl.h +0 -3311
- 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/boringssl-with-bazel/src/third_party/fiat/p256.c +0 -1063
- data/third_party/upb/upb/generated_util.h +0 -105
- data/third_party/upb/upb/port.c +0 -26
@@ -0,0 +1,87 @@
|
|
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/certificate_provider_store.h"
|
22
|
+
|
23
|
+
#include "src/core/ext/xds/certificate_provider_registry.h"
|
24
|
+
|
25
|
+
namespace grpc_core {
|
26
|
+
|
27
|
+
// If a certificate provider is created, the CertificateProviderStore
|
28
|
+
// maintains a raw pointer to the created CertificateProviderWrapper so that
|
29
|
+
// future calls to `CreateOrGetCertificateProvider()` with the same key result
|
30
|
+
// in returning a ref to this created certificate provider. This entry is
|
31
|
+
// deleted when the refcount to this provider reaches zero.
|
32
|
+
RefCountedPtr<grpc_tls_certificate_provider>
|
33
|
+
CertificateProviderStore::CreateOrGetCertificateProvider(
|
34
|
+
absl::string_view key) {
|
35
|
+
RefCountedPtr<CertificateProviderWrapper> result;
|
36
|
+
MutexLock lock(&mu_);
|
37
|
+
auto it = certificate_providers_map_.find(key);
|
38
|
+
if (it == certificate_providers_map_.end()) {
|
39
|
+
result = CreateCertificateProviderLocked(key);
|
40
|
+
if (result != nullptr) {
|
41
|
+
certificate_providers_map_.insert({result->key(), result.get()});
|
42
|
+
}
|
43
|
+
} else {
|
44
|
+
result = it->second->RefIfNonZero();
|
45
|
+
if (result == nullptr) {
|
46
|
+
result = CreateCertificateProviderLocked(key);
|
47
|
+
it->second = result.get();
|
48
|
+
}
|
49
|
+
}
|
50
|
+
return result;
|
51
|
+
}
|
52
|
+
|
53
|
+
RefCountedPtr<CertificateProviderStore::CertificateProviderWrapper>
|
54
|
+
CertificateProviderStore::CreateCertificateProviderLocked(
|
55
|
+
absl::string_view key) {
|
56
|
+
auto plugin_config_it = plugin_config_map_.find(std::string(key));
|
57
|
+
if (plugin_config_it == plugin_config_map_.end()) {
|
58
|
+
return nullptr;
|
59
|
+
}
|
60
|
+
CertificateProviderFactory* factory =
|
61
|
+
CertificateProviderRegistry::LookupCertificateProviderFactory(
|
62
|
+
plugin_config_it->second.plugin_name);
|
63
|
+
if (factory == nullptr) {
|
64
|
+
// This should never happen since an entry is only inserted in the
|
65
|
+
// plugin_config_map_ if the corresponding factory was found when parsing
|
66
|
+
// the xDS bootstrap file.
|
67
|
+
gpr_log(GPR_ERROR, "Certificate provider factory %s not found",
|
68
|
+
plugin_config_it->second.plugin_name.c_str());
|
69
|
+
return nullptr;
|
70
|
+
}
|
71
|
+
return MakeRefCounted<CertificateProviderWrapper>(
|
72
|
+
factory->CreateCertificateProvider(plugin_config_it->second.config),
|
73
|
+
Ref(), plugin_config_it->first);
|
74
|
+
}
|
75
|
+
|
76
|
+
void CertificateProviderStore::ReleaseCertificateProvider(
|
77
|
+
absl::string_view key, CertificateProviderWrapper* wrapper) {
|
78
|
+
MutexLock lock(&mu_);
|
79
|
+
auto it = certificate_providers_map_.find(key);
|
80
|
+
if (it != certificate_providers_map_.end()) {
|
81
|
+
if (it->second == wrapper) {
|
82
|
+
certificate_providers_map_.erase(it);
|
83
|
+
}
|
84
|
+
}
|
85
|
+
}
|
86
|
+
|
87
|
+
} // namespace grpc_core
|
@@ -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,2479 @@
|
|
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/gprpp/host_port.h"
|
43
|
+
#include "src/core/lib/iomgr/error.h"
|
44
|
+
#include "src/core/lib/iomgr/sockaddr_utils.h"
|
45
|
+
#include "src/core/lib/slice/slice_utils.h"
|
46
|
+
|
47
|
+
#include "envoy/config/cluster/v3/circuit_breaker.upb.h"
|
48
|
+
#include "envoy/config/cluster/v3/cluster.upb.h"
|
49
|
+
#include "envoy/config/cluster/v3/cluster.upbdefs.h"
|
50
|
+
#include "envoy/config/core/v3/address.upb.h"
|
51
|
+
#include "envoy/config/core/v3/base.upb.h"
|
52
|
+
#include "envoy/config/core/v3/config_source.upb.h"
|
53
|
+
#include "envoy/config/core/v3/health_check.upb.h"
|
54
|
+
#include "envoy/config/core/v3/protocol.upb.h"
|
55
|
+
#include "envoy/config/endpoint/v3/endpoint.upb.h"
|
56
|
+
#include "envoy/config/endpoint/v3/endpoint.upbdefs.h"
|
57
|
+
#include "envoy/config/endpoint/v3/endpoint_components.upb.h"
|
58
|
+
#include "envoy/config/endpoint/v3/load_report.upb.h"
|
59
|
+
#include "envoy/config/listener/v3/api_listener.upb.h"
|
60
|
+
#include "envoy/config/listener/v3/listener.upb.h"
|
61
|
+
#include "envoy/config/listener/v3/listener_components.upb.h"
|
62
|
+
#include "envoy/config/route/v3/route.upb.h"
|
63
|
+
#include "envoy/config/route/v3/route.upbdefs.h"
|
64
|
+
#include "envoy/config/route/v3/route_components.upb.h"
|
65
|
+
#include "envoy/extensions/clusters/aggregate/v3/cluster.upb.h"
|
66
|
+
#include "envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb.h"
|
67
|
+
#include "envoy/extensions/transport_sockets/tls/v3/common.upb.h"
|
68
|
+
#include "envoy/extensions/transport_sockets/tls/v3/tls.upb.h"
|
69
|
+
#include "envoy/service/cluster/v3/cds.upb.h"
|
70
|
+
#include "envoy/service/cluster/v3/cds.upbdefs.h"
|
71
|
+
#include "envoy/service/discovery/v3/discovery.upb.h"
|
72
|
+
#include "envoy/service/discovery/v3/discovery.upbdefs.h"
|
73
|
+
#include "envoy/service/endpoint/v3/eds.upb.h"
|
74
|
+
#include "envoy/service/endpoint/v3/eds.upbdefs.h"
|
75
|
+
#include "envoy/service/listener/v3/lds.upb.h"
|
76
|
+
#include "envoy/service/load_stats/v3/lrs.upb.h"
|
77
|
+
#include "envoy/service/load_stats/v3/lrs.upbdefs.h"
|
78
|
+
#include "envoy/service/route/v3/rds.upb.h"
|
79
|
+
#include "envoy/service/route/v3/rds.upbdefs.h"
|
80
|
+
#include "envoy/type/matcher/v3/regex.upb.h"
|
81
|
+
#include "envoy/type/matcher/v3/string.upb.h"
|
82
|
+
#include "envoy/type/v3/percent.upb.h"
|
83
|
+
#include "envoy/type/v3/range.upb.h"
|
84
|
+
#include "google/protobuf/any.upb.h"
|
85
|
+
#include "google/protobuf/duration.upb.h"
|
86
|
+
#include "google/protobuf/struct.upb.h"
|
87
|
+
#include "google/protobuf/wrappers.upb.h"
|
88
|
+
#include "google/rpc/status.upb.h"
|
89
|
+
#include "upb/text_encode.h"
|
90
|
+
#include "upb/upb.h"
|
91
|
+
|
92
|
+
namespace grpc_core {
|
93
|
+
|
94
|
+
// TODO(donnadionne): Check to see if timeout is enabled, this will be
|
95
|
+
// removed once timeout feature is fully integration-tested and enabled by
|
96
|
+
// default.
|
97
|
+
bool XdsTimeoutEnabled() {
|
98
|
+
char* value = gpr_getenv("GRPC_XDS_EXPERIMENTAL_ENABLE_TIMEOUT");
|
99
|
+
bool parsed_value;
|
100
|
+
bool parse_succeeded = gpr_parse_bool_value(value, &parsed_value);
|
101
|
+
gpr_free(value);
|
102
|
+
return parse_succeeded && parsed_value;
|
103
|
+
}
|
104
|
+
|
105
|
+
// TODO(donnadionne): Check to see if cluster types aggregate_cluster and
|
106
|
+
// logical_dns are enabled, this will be
|
107
|
+
// removed once the cluster types are fully integration-tested and enabled by
|
108
|
+
// default.
|
109
|
+
bool XdsAggregateAndLogicalDnsClusterEnabled() {
|
110
|
+
char* value = gpr_getenv(
|
111
|
+
"GRPC_XDS_EXPERIMENTAL_ENABLE_AGGREGATE_AND_LOGICAL_DNS_CLUSTER");
|
112
|
+
bool parsed_value;
|
113
|
+
bool parse_succeeded = gpr_parse_bool_value(value, &parsed_value);
|
114
|
+
gpr_free(value);
|
115
|
+
return parse_succeeded && parsed_value;
|
116
|
+
}
|
117
|
+
|
118
|
+
// TODO(donnadionne): Check to see if ring hash policy is enabled, this will be
|
119
|
+
// removed once ring hash policy is fully integration-tested and enabled by
|
120
|
+
// default.
|
121
|
+
bool XdsRingHashEnabled() {
|
122
|
+
char* value = gpr_getenv("GRPC_XDS_EXPERIMENTAL_ENABLE_RING_HASH");
|
123
|
+
bool parsed_value;
|
124
|
+
bool parse_succeeded = gpr_parse_bool_value(value, &parsed_value);
|
125
|
+
gpr_free(value);
|
126
|
+
return parse_succeeded && parsed_value;
|
127
|
+
}
|
128
|
+
|
129
|
+
// TODO(yashykt): Check to see if xDS security is enabled. This will be
|
130
|
+
// removed once this feature is fully integration-tested and enabled by
|
131
|
+
// default.
|
132
|
+
bool XdsSecurityEnabled() {
|
133
|
+
char* value = gpr_getenv("GRPC_XDS_EXPERIMENTAL_SECURITY_SUPPORT");
|
134
|
+
bool parsed_value;
|
135
|
+
bool parse_succeeded = gpr_parse_bool_value(value, &parsed_value);
|
136
|
+
gpr_free(value);
|
137
|
+
return parse_succeeded && parsed_value;
|
138
|
+
}
|
139
|
+
|
140
|
+
//
|
141
|
+
// XdsApi::Route
|
142
|
+
//
|
143
|
+
|
144
|
+
std::string XdsApi::Route::Matchers::ToString() const {
|
145
|
+
std::vector<std::string> contents;
|
146
|
+
contents.push_back(
|
147
|
+
absl::StrFormat("PathMatcher{%s}", path_matcher.ToString()));
|
148
|
+
for (const HeaderMatcher& header_matcher : header_matchers) {
|
149
|
+
contents.push_back(header_matcher.ToString());
|
150
|
+
}
|
151
|
+
if (fraction_per_million.has_value()) {
|
152
|
+
contents.push_back(absl::StrFormat("Fraction Per Million %d",
|
153
|
+
fraction_per_million.value()));
|
154
|
+
}
|
155
|
+
return absl::StrJoin(contents, "\n");
|
156
|
+
}
|
157
|
+
|
158
|
+
std::string XdsApi::Route::ClusterWeight::ToString() const {
|
159
|
+
return absl::StrFormat("{cluster=%s, weight=%d}", name, weight);
|
160
|
+
}
|
161
|
+
|
162
|
+
std::string XdsApi::Route::ToString() const {
|
163
|
+
std::vector<std::string> contents;
|
164
|
+
contents.push_back(matchers.ToString());
|
165
|
+
if (!cluster_name.empty()) {
|
166
|
+
contents.push_back(absl::StrFormat("Cluster name: %s", cluster_name));
|
167
|
+
}
|
168
|
+
for (const ClusterWeight& cluster_weight : weighted_clusters) {
|
169
|
+
contents.push_back(cluster_weight.ToString());
|
170
|
+
}
|
171
|
+
if (max_stream_duration.has_value()) {
|
172
|
+
contents.push_back(max_stream_duration->ToString());
|
173
|
+
}
|
174
|
+
return absl::StrJoin(contents, "\n");
|
175
|
+
}
|
176
|
+
|
177
|
+
//
|
178
|
+
// XdsApi::RdsUpdate
|
179
|
+
//
|
180
|
+
|
181
|
+
std::string XdsApi::RdsUpdate::ToString() const {
|
182
|
+
std::vector<std::string> vhosts;
|
183
|
+
for (const VirtualHost& vhost : virtual_hosts) {
|
184
|
+
vhosts.push_back(
|
185
|
+
absl::StrCat("vhost={\n"
|
186
|
+
" domains=[",
|
187
|
+
absl::StrJoin(vhost.domains, ", "),
|
188
|
+
"]\n"
|
189
|
+
" routes=[\n"));
|
190
|
+
for (const XdsApi::Route& route : vhost.routes) {
|
191
|
+
vhosts.push_back(" {\n");
|
192
|
+
vhosts.push_back(route.ToString());
|
193
|
+
vhosts.push_back("\n }\n");
|
194
|
+
}
|
195
|
+
vhosts.push_back(" ]\n");
|
196
|
+
vhosts.push_back("]\n");
|
197
|
+
}
|
198
|
+
return absl::StrJoin(vhosts, "");
|
199
|
+
}
|
200
|
+
|
201
|
+
namespace {
|
202
|
+
|
203
|
+
// Better match type has smaller value.
|
204
|
+
enum MatchType {
|
205
|
+
EXACT_MATCH,
|
206
|
+
SUFFIX_MATCH,
|
207
|
+
PREFIX_MATCH,
|
208
|
+
UNIVERSE_MATCH,
|
209
|
+
INVALID_MATCH,
|
210
|
+
};
|
211
|
+
|
212
|
+
// Returns true if match succeeds.
|
213
|
+
bool DomainMatch(MatchType match_type, const std::string& domain_pattern_in,
|
214
|
+
const std::string& expected_host_name_in) {
|
215
|
+
// Normalize the args to lower-case. Domain matching is case-insensitive.
|
216
|
+
std::string domain_pattern = domain_pattern_in;
|
217
|
+
std::string expected_host_name = expected_host_name_in;
|
218
|
+
std::transform(domain_pattern.begin(), domain_pattern.end(),
|
219
|
+
domain_pattern.begin(),
|
220
|
+
[](unsigned char c) { return std::tolower(c); });
|
221
|
+
std::transform(expected_host_name.begin(), expected_host_name.end(),
|
222
|
+
expected_host_name.begin(),
|
223
|
+
[](unsigned char c) { return std::tolower(c); });
|
224
|
+
if (match_type == EXACT_MATCH) {
|
225
|
+
return domain_pattern == expected_host_name;
|
226
|
+
} else if (match_type == SUFFIX_MATCH) {
|
227
|
+
// Asterisk must match at least one char.
|
228
|
+
if (expected_host_name.size() < domain_pattern.size()) return false;
|
229
|
+
absl::string_view pattern_suffix(domain_pattern.c_str() + 1);
|
230
|
+
absl::string_view host_suffix(expected_host_name.c_str() +
|
231
|
+
expected_host_name.size() -
|
232
|
+
pattern_suffix.size());
|
233
|
+
return pattern_suffix == host_suffix;
|
234
|
+
} else if (match_type == PREFIX_MATCH) {
|
235
|
+
// Asterisk must match at least one char.
|
236
|
+
if (expected_host_name.size() < domain_pattern.size()) return false;
|
237
|
+
absl::string_view pattern_prefix(domain_pattern.c_str(),
|
238
|
+
domain_pattern.size() - 1);
|
239
|
+
absl::string_view host_prefix(expected_host_name.c_str(),
|
240
|
+
pattern_prefix.size());
|
241
|
+
return pattern_prefix == host_prefix;
|
242
|
+
} else {
|
243
|
+
return match_type == UNIVERSE_MATCH;
|
244
|
+
}
|
245
|
+
}
|
246
|
+
|
247
|
+
MatchType DomainPatternMatchType(const std::string& domain_pattern) {
|
248
|
+
if (domain_pattern.empty()) return INVALID_MATCH;
|
249
|
+
if (domain_pattern.find('*') == std::string::npos) return EXACT_MATCH;
|
250
|
+
if (domain_pattern == "*") return UNIVERSE_MATCH;
|
251
|
+
if (domain_pattern[0] == '*') return SUFFIX_MATCH;
|
252
|
+
if (domain_pattern[domain_pattern.size() - 1] == '*') return PREFIX_MATCH;
|
253
|
+
return INVALID_MATCH;
|
254
|
+
}
|
255
|
+
|
256
|
+
} // namespace
|
257
|
+
|
258
|
+
XdsApi::RdsUpdate::VirtualHost* XdsApi::RdsUpdate::FindVirtualHostForDomain(
|
259
|
+
const std::string& domain) {
|
260
|
+
// Find the best matched virtual host.
|
261
|
+
// The search order for 4 groups of domain patterns:
|
262
|
+
// 1. Exact match.
|
263
|
+
// 2. Suffix match (e.g., "*ABC").
|
264
|
+
// 3. Prefix match (e.g., "ABC*").
|
265
|
+
// 4. Universe match (i.e., "*").
|
266
|
+
// Within each group, longest match wins.
|
267
|
+
// If the same best matched domain pattern appears in multiple virtual hosts,
|
268
|
+
// the first matched virtual host wins.
|
269
|
+
VirtualHost* target_vhost = nullptr;
|
270
|
+
MatchType best_match_type = INVALID_MATCH;
|
271
|
+
size_t longest_match = 0;
|
272
|
+
// Check each domain pattern in each virtual host to determine the best
|
273
|
+
// matched virtual host.
|
274
|
+
for (VirtualHost& vhost : virtual_hosts) {
|
275
|
+
for (const std::string& domain_pattern : vhost.domains) {
|
276
|
+
// Check the match type first. Skip the pattern if it's not better than
|
277
|
+
// current match.
|
278
|
+
const MatchType match_type = DomainPatternMatchType(domain_pattern);
|
279
|
+
// This should be caught by RouteConfigParse().
|
280
|
+
GPR_ASSERT(match_type != INVALID_MATCH);
|
281
|
+
if (match_type > best_match_type) continue;
|
282
|
+
if (match_type == best_match_type &&
|
283
|
+
domain_pattern.size() <= longest_match) {
|
284
|
+
continue;
|
285
|
+
}
|
286
|
+
// Skip if match fails.
|
287
|
+
if (!DomainMatch(match_type, domain_pattern, domain)) continue;
|
288
|
+
// Choose this match.
|
289
|
+
target_vhost = &vhost;
|
290
|
+
best_match_type = match_type;
|
291
|
+
longest_match = domain_pattern.size();
|
292
|
+
if (best_match_type == EXACT_MATCH) break;
|
293
|
+
}
|
294
|
+
if (best_match_type == EXACT_MATCH) break;
|
295
|
+
}
|
296
|
+
return target_vhost;
|
297
|
+
}
|
298
|
+
|
299
|
+
//
|
300
|
+
// XdsApi::CommonTlsContext::CertificateValidationContext
|
301
|
+
//
|
302
|
+
|
303
|
+
std::string XdsApi::CommonTlsContext::CertificateValidationContext::ToString()
|
304
|
+
const {
|
305
|
+
std::vector<std::string> contents;
|
306
|
+
for (const auto& match : match_subject_alt_names) {
|
307
|
+
contents.push_back(match.ToString());
|
308
|
+
}
|
309
|
+
return absl::StrFormat("{match_subject_alt_names=[%s]}",
|
310
|
+
absl::StrJoin(contents, ", "));
|
311
|
+
}
|
312
|
+
|
313
|
+
bool XdsApi::CommonTlsContext::CertificateValidationContext::Empty() const {
|
314
|
+
return match_subject_alt_names.empty();
|
315
|
+
}
|
316
|
+
|
317
|
+
//
|
318
|
+
// XdsApi::CommonTlsContext::CertificateValidationContext
|
319
|
+
//
|
320
|
+
|
321
|
+
std::string XdsApi::CommonTlsContext::CertificateProviderInstance::ToString()
|
322
|
+
const {
|
323
|
+
absl::InlinedVector<std::string, 2> contents;
|
324
|
+
if (!instance_name.empty()) {
|
325
|
+
contents.push_back(absl::StrFormat("instance_name=%s", instance_name));
|
326
|
+
}
|
327
|
+
if (!certificate_name.empty()) {
|
328
|
+
contents.push_back(
|
329
|
+
absl::StrFormat("certificate_name=%s", certificate_name));
|
330
|
+
}
|
331
|
+
return absl::StrCat("{", absl::StrJoin(contents, ", "), "}");
|
332
|
+
}
|
333
|
+
|
334
|
+
bool XdsApi::CommonTlsContext::CertificateProviderInstance::Empty() const {
|
335
|
+
return instance_name.empty() && certificate_name.empty();
|
336
|
+
}
|
337
|
+
|
338
|
+
//
|
339
|
+
// XdsApi::CommonTlsContext::CombinedCertificateValidationContext
|
340
|
+
//
|
341
|
+
|
342
|
+
std::string
|
343
|
+
XdsApi::CommonTlsContext::CombinedCertificateValidationContext::ToString()
|
344
|
+
const {
|
345
|
+
absl::InlinedVector<std::string, 2> contents;
|
346
|
+
if (!default_validation_context.Empty()) {
|
347
|
+
contents.push_back(absl::StrFormat("default_validation_context=%s",
|
348
|
+
default_validation_context.ToString()));
|
349
|
+
}
|
350
|
+
if (!validation_context_certificate_provider_instance.Empty()) {
|
351
|
+
contents.push_back(absl::StrFormat(
|
352
|
+
"validation_context_certificate_provider_instance=%s",
|
353
|
+
validation_context_certificate_provider_instance.ToString()));
|
354
|
+
}
|
355
|
+
return absl::StrCat("{", absl::StrJoin(contents, ", "), "}");
|
356
|
+
}
|
357
|
+
|
358
|
+
bool XdsApi::CommonTlsContext::CombinedCertificateValidationContext::Empty()
|
359
|
+
const {
|
360
|
+
return default_validation_context.Empty() &&
|
361
|
+
validation_context_certificate_provider_instance.Empty();
|
362
|
+
}
|
363
|
+
|
364
|
+
//
|
365
|
+
// XdsApi::CommonTlsContext
|
366
|
+
//
|
367
|
+
|
368
|
+
std::string XdsApi::CommonTlsContext::ToString() const {
|
369
|
+
absl::InlinedVector<std::string, 2> contents;
|
370
|
+
if (!tls_certificate_certificate_provider_instance.Empty()) {
|
371
|
+
contents.push_back(absl::StrFormat(
|
372
|
+
"tls_certificate_certificate_provider_instance=%s",
|
373
|
+
tls_certificate_certificate_provider_instance.ToString()));
|
374
|
+
}
|
375
|
+
if (!combined_validation_context.Empty()) {
|
376
|
+
contents.push_back(absl::StrFormat("combined_validation_context=%s",
|
377
|
+
combined_validation_context.ToString()));
|
378
|
+
}
|
379
|
+
return absl::StrCat("{", absl::StrJoin(contents, ", "), "}");
|
380
|
+
}
|
381
|
+
|
382
|
+
bool XdsApi::CommonTlsContext::Empty() const {
|
383
|
+
return tls_certificate_certificate_provider_instance.Empty() &&
|
384
|
+
combined_validation_context.Empty();
|
385
|
+
}
|
386
|
+
|
387
|
+
//
|
388
|
+
// XdsApi::DownstreamTlsContext
|
389
|
+
//
|
390
|
+
|
391
|
+
std::string XdsApi::DownstreamTlsContext::ToString() const {
|
392
|
+
return absl::StrFormat("common_tls_context=%s, require_client_certificate=%s",
|
393
|
+
common_tls_context.ToString(),
|
394
|
+
require_client_certificate ? "true" : "false");
|
395
|
+
}
|
396
|
+
|
397
|
+
bool XdsApi::DownstreamTlsContext::Empty() const {
|
398
|
+
return common_tls_context.Empty();
|
399
|
+
}
|
400
|
+
|
401
|
+
//
|
402
|
+
// XdsApi::LdsUpdate
|
403
|
+
//
|
404
|
+
|
405
|
+
std::string XdsApi::LdsUpdate::ToString() const {
|
406
|
+
absl::InlinedVector<std::string, 3> contents;
|
407
|
+
if (type == ListenerType::kTcpListener) {
|
408
|
+
if (!downstream_tls_context.Empty()) {
|
409
|
+
contents.push_back(absl::StrFormat("downstream_tls_context=%s",
|
410
|
+
downstream_tls_context.ToString()));
|
411
|
+
}
|
412
|
+
} else if (type == ListenerType::kHttpApiListener) {
|
413
|
+
contents.push_back(absl::StrFormat(
|
414
|
+
"route_config_name=%s",
|
415
|
+
!route_config_name.empty() ? route_config_name.c_str() : "<inlined>"));
|
416
|
+
contents.push_back(absl::StrFormat("http_max_stream_duration=%s",
|
417
|
+
http_max_stream_duration.ToString()));
|
418
|
+
if (rds_update.has_value()) {
|
419
|
+
contents.push_back(
|
420
|
+
absl::StrFormat("rds_update=%s", rds_update->ToString()));
|
421
|
+
}
|
422
|
+
}
|
423
|
+
return absl::StrCat("{", absl::StrJoin(contents, ", "), "}");
|
424
|
+
}
|
425
|
+
|
426
|
+
//
|
427
|
+
// XdsApi::CdsUpdate
|
428
|
+
//
|
429
|
+
|
430
|
+
std::string XdsApi::CdsUpdate::ToString() const {
|
431
|
+
absl::InlinedVector<std::string, 4> contents;
|
432
|
+
if (!eds_service_name.empty()) {
|
433
|
+
contents.push_back(
|
434
|
+
absl::StrFormat("eds_service_name=%s", eds_service_name));
|
435
|
+
}
|
436
|
+
if (!common_tls_context.Empty()) {
|
437
|
+
contents.push_back(absl::StrFormat("common_tls_context=%s",
|
438
|
+
common_tls_context.ToString()));
|
439
|
+
}
|
440
|
+
if (lrs_load_reporting_server_name.has_value()) {
|
441
|
+
contents.push_back(absl::StrFormat("lrs_load_reporting_server_name=%s",
|
442
|
+
lrs_load_reporting_server_name.value()));
|
443
|
+
}
|
444
|
+
contents.push_back(
|
445
|
+
absl::StrFormat("max_concurrent_requests=%d", max_concurrent_requests));
|
446
|
+
return absl::StrCat("{", absl::StrJoin(contents, ", "), "}");
|
447
|
+
}
|
448
|
+
|
449
|
+
//
|
450
|
+
// XdsApi::EdsUpdate
|
451
|
+
//
|
452
|
+
|
453
|
+
std::string XdsApi::EdsUpdate::Priority::Locality::ToString() const {
|
454
|
+
std::vector<std::string> endpoint_strings;
|
455
|
+
for (const ServerAddress& endpoint : endpoints) {
|
456
|
+
endpoint_strings.emplace_back(endpoint.ToString());
|
457
|
+
}
|
458
|
+
return absl::StrCat("{name=", name->AsHumanReadableString(),
|
459
|
+
", lb_weight=", lb_weight, ", endpoints=[",
|
460
|
+
absl::StrJoin(endpoint_strings, ", "), "]}");
|
461
|
+
}
|
462
|
+
|
463
|
+
bool XdsApi::EdsUpdate::Priority::operator==(const Priority& other) const {
|
464
|
+
if (localities.size() != other.localities.size()) return false;
|
465
|
+
auto it1 = localities.begin();
|
466
|
+
auto it2 = other.localities.begin();
|
467
|
+
while (it1 != localities.end()) {
|
468
|
+
if (*it1->first != *it2->first) return false;
|
469
|
+
if (it1->second != it2->second) return false;
|
470
|
+
++it1;
|
471
|
+
++it2;
|
472
|
+
}
|
473
|
+
return true;
|
474
|
+
}
|
475
|
+
|
476
|
+
std::string XdsApi::EdsUpdate::Priority::ToString() const {
|
477
|
+
std::vector<std::string> locality_strings;
|
478
|
+
for (const auto& p : localities) {
|
479
|
+
locality_strings.emplace_back(p.second.ToString());
|
480
|
+
}
|
481
|
+
return absl::StrCat("[", absl::StrJoin(locality_strings, ", "), "]");
|
482
|
+
}
|
483
|
+
|
484
|
+
bool XdsApi::EdsUpdate::DropConfig::ShouldDrop(
|
485
|
+
const std::string** category_name) const {
|
486
|
+
for (size_t i = 0; i < drop_category_list_.size(); ++i) {
|
487
|
+
const auto& drop_category = drop_category_list_[i];
|
488
|
+
// Generate a random number in [0, 1000000).
|
489
|
+
const uint32_t random = static_cast<uint32_t>(rand()) % 1000000;
|
490
|
+
if (random < drop_category.parts_per_million) {
|
491
|
+
*category_name = &drop_category.name;
|
492
|
+
return true;
|
493
|
+
}
|
494
|
+
}
|
495
|
+
return false;
|
496
|
+
}
|
497
|
+
|
498
|
+
std::string XdsApi::EdsUpdate::DropConfig::ToString() const {
|
499
|
+
std::vector<std::string> category_strings;
|
500
|
+
for (const DropCategory& category : drop_category_list_) {
|
501
|
+
category_strings.emplace_back(
|
502
|
+
absl::StrCat(category.name, "=", category.parts_per_million));
|
503
|
+
}
|
504
|
+
return absl::StrCat("{[", absl::StrJoin(category_strings, ", "),
|
505
|
+
"], drop_all=", drop_all_, "}");
|
506
|
+
}
|
507
|
+
|
508
|
+
std::string XdsApi::EdsUpdate::ToString() const {
|
509
|
+
std::vector<std::string> priority_strings;
|
510
|
+
for (size_t i = 0; i < priorities.size(); ++i) {
|
511
|
+
const Priority& priority = priorities[i];
|
512
|
+
priority_strings.emplace_back(
|
513
|
+
absl::StrCat("priority ", i, ": ", priority.ToString()));
|
514
|
+
}
|
515
|
+
return absl::StrCat("priorities=[", absl::StrJoin(priority_strings, ", "),
|
516
|
+
"], drop_config=", drop_config->ToString());
|
517
|
+
}
|
518
|
+
|
519
|
+
//
|
520
|
+
// XdsApi
|
521
|
+
//
|
522
|
+
|
523
|
+
const char* XdsApi::kLdsTypeUrl =
|
524
|
+
"type.googleapis.com/envoy.config.listener.v3.Listener";
|
525
|
+
const char* XdsApi::kRdsTypeUrl =
|
526
|
+
"type.googleapis.com/envoy.config.route.v3.RouteConfiguration";
|
527
|
+
const char* XdsApi::kCdsTypeUrl =
|
528
|
+
"type.googleapis.com/envoy.config.cluster.v3.Cluster";
|
529
|
+
const char* XdsApi::kEdsTypeUrl =
|
530
|
+
"type.googleapis.com/envoy.config.endpoint.v3.ClusterLoadAssignment";
|
531
|
+
|
532
|
+
namespace {
|
533
|
+
|
534
|
+
const char* kLdsV2TypeUrl = "type.googleapis.com/envoy.api.v2.Listener";
|
535
|
+
const char* kRdsV2TypeUrl =
|
536
|
+
"type.googleapis.com/envoy.api.v2.RouteConfiguration";
|
537
|
+
const char* kCdsV2TypeUrl = "type.googleapis.com/envoy.api.v2.Cluster";
|
538
|
+
const char* kEdsV2TypeUrl =
|
539
|
+
"type.googleapis.com/envoy.api.v2.ClusterLoadAssignment";
|
540
|
+
|
541
|
+
bool IsLds(absl::string_view type_url) {
|
542
|
+
return type_url == XdsApi::kLdsTypeUrl || type_url == kLdsV2TypeUrl;
|
543
|
+
}
|
544
|
+
|
545
|
+
bool IsRds(absl::string_view type_url) {
|
546
|
+
return type_url == XdsApi::kRdsTypeUrl || type_url == kRdsV2TypeUrl;
|
547
|
+
}
|
548
|
+
|
549
|
+
bool IsCds(absl::string_view type_url) {
|
550
|
+
return type_url == XdsApi::kCdsTypeUrl || type_url == kCdsV2TypeUrl;
|
551
|
+
}
|
552
|
+
|
553
|
+
bool IsEds(absl::string_view type_url) {
|
554
|
+
return type_url == XdsApi::kEdsTypeUrl || type_url == kEdsV2TypeUrl;
|
555
|
+
}
|
556
|
+
|
557
|
+
} // namespace
|
558
|
+
|
559
|
+
XdsApi::XdsApi(XdsClient* client, TraceFlag* tracer,
|
560
|
+
const XdsBootstrap::Node* node)
|
561
|
+
: client_(client),
|
562
|
+
tracer_(tracer),
|
563
|
+
node_(node),
|
564
|
+
build_version_(absl::StrCat("gRPC C-core ", GPR_PLATFORM_STRING, " ",
|
565
|
+
grpc_version_string())),
|
566
|
+
user_agent_name_(absl::StrCat("gRPC C-core ", GPR_PLATFORM_STRING)) {}
|
567
|
+
|
568
|
+
namespace {
|
569
|
+
|
570
|
+
// Works for both std::string and absl::string_view.
|
571
|
+
template <typename T>
|
572
|
+
inline upb_strview StdStringToUpbString(const T& str) {
|
573
|
+
return upb_strview_make(str.data(), str.size());
|
574
|
+
}
|
575
|
+
|
576
|
+
void PopulateMetadataValue(upb_arena* arena, google_protobuf_Value* value_pb,
|
577
|
+
const Json& value);
|
578
|
+
|
579
|
+
void PopulateListValue(upb_arena* arena, google_protobuf_ListValue* list_value,
|
580
|
+
const Json::Array& values) {
|
581
|
+
for (const auto& value : values) {
|
582
|
+
auto* value_pb = google_protobuf_ListValue_add_values(list_value, arena);
|
583
|
+
PopulateMetadataValue(arena, value_pb, value);
|
584
|
+
}
|
585
|
+
}
|
586
|
+
|
587
|
+
void PopulateMetadata(upb_arena* arena, google_protobuf_Struct* metadata_pb,
|
588
|
+
const Json::Object& metadata) {
|
589
|
+
for (const auto& p : metadata) {
|
590
|
+
google_protobuf_Value* value = google_protobuf_Value_new(arena);
|
591
|
+
PopulateMetadataValue(arena, value, p.second);
|
592
|
+
google_protobuf_Struct_fields_set(
|
593
|
+
metadata_pb, StdStringToUpbString(p.first), value, arena);
|
594
|
+
}
|
595
|
+
}
|
596
|
+
|
597
|
+
void PopulateMetadataValue(upb_arena* arena, google_protobuf_Value* value_pb,
|
598
|
+
const Json& value) {
|
599
|
+
switch (value.type()) {
|
600
|
+
case Json::Type::JSON_NULL:
|
601
|
+
google_protobuf_Value_set_null_value(value_pb, 0);
|
602
|
+
break;
|
603
|
+
case Json::Type::NUMBER:
|
604
|
+
google_protobuf_Value_set_number_value(
|
605
|
+
value_pb, strtod(value.string_value().c_str(), nullptr));
|
606
|
+
break;
|
607
|
+
case Json::Type::STRING:
|
608
|
+
google_protobuf_Value_set_string_value(
|
609
|
+
value_pb, StdStringToUpbString(value.string_value()));
|
610
|
+
break;
|
611
|
+
case Json::Type::JSON_TRUE:
|
612
|
+
google_protobuf_Value_set_bool_value(value_pb, true);
|
613
|
+
break;
|
614
|
+
case Json::Type::JSON_FALSE:
|
615
|
+
google_protobuf_Value_set_bool_value(value_pb, false);
|
616
|
+
break;
|
617
|
+
case Json::Type::OBJECT: {
|
618
|
+
google_protobuf_Struct* struct_value =
|
619
|
+
google_protobuf_Value_mutable_struct_value(value_pb, arena);
|
620
|
+
PopulateMetadata(arena, struct_value, value.object_value());
|
621
|
+
break;
|
622
|
+
}
|
623
|
+
case Json::Type::ARRAY: {
|
624
|
+
google_protobuf_ListValue* list_value =
|
625
|
+
google_protobuf_Value_mutable_list_value(value_pb, arena);
|
626
|
+
PopulateListValue(arena, list_value, value.array_value());
|
627
|
+
break;
|
628
|
+
}
|
629
|
+
}
|
630
|
+
}
|
631
|
+
|
632
|
+
// Helper functions to manually do protobuf string encoding, so that we
|
633
|
+
// can populate the node build_version field that was removed in v3.
|
634
|
+
std::string EncodeVarint(uint64_t val) {
|
635
|
+
std::string data;
|
636
|
+
do {
|
637
|
+
uint8_t byte = val & 0x7fU;
|
638
|
+
val >>= 7;
|
639
|
+
if (val) byte |= 0x80U;
|
640
|
+
data += byte;
|
641
|
+
} while (val);
|
642
|
+
return data;
|
643
|
+
}
|
644
|
+
std::string EncodeTag(uint32_t field_number, uint8_t wire_type) {
|
645
|
+
return EncodeVarint((field_number << 3) | wire_type);
|
646
|
+
}
|
647
|
+
std::string EncodeStringField(uint32_t field_number, const std::string& str) {
|
648
|
+
static const uint8_t kDelimitedWireType = 2;
|
649
|
+
return EncodeTag(field_number, kDelimitedWireType) +
|
650
|
+
EncodeVarint(str.size()) + str;
|
651
|
+
}
|
652
|
+
|
653
|
+
void PopulateBuildVersion(upb_arena* arena, envoy_config_core_v3_Node* node_msg,
|
654
|
+
const std::string& build_version) {
|
655
|
+
std::string encoded_build_version = EncodeStringField(5, build_version);
|
656
|
+
// TODO(roth): This should use upb_msg_addunknown(), but that API is
|
657
|
+
// broken in the current version of upb, so we're using the internal
|
658
|
+
// API for now. Change this once we upgrade to a version of upb that
|
659
|
+
// fixes this bug.
|
660
|
+
_upb_msg_addunknown(node_msg, encoded_build_version.data(),
|
661
|
+
encoded_build_version.size(), arena);
|
662
|
+
}
|
663
|
+
|
664
|
+
void PopulateNode(upb_arena* arena, const XdsBootstrap::Node* node, bool use_v3,
|
665
|
+
const std::string& build_version,
|
666
|
+
const std::string& user_agent_name,
|
667
|
+
envoy_config_core_v3_Node* node_msg) {
|
668
|
+
if (node != nullptr) {
|
669
|
+
if (!node->id.empty()) {
|
670
|
+
envoy_config_core_v3_Node_set_id(node_msg,
|
671
|
+
StdStringToUpbString(node->id));
|
672
|
+
}
|
673
|
+
if (!node->cluster.empty()) {
|
674
|
+
envoy_config_core_v3_Node_set_cluster(
|
675
|
+
node_msg, StdStringToUpbString(node->cluster));
|
676
|
+
}
|
677
|
+
if (!node->metadata.object_value().empty()) {
|
678
|
+
google_protobuf_Struct* metadata =
|
679
|
+
envoy_config_core_v3_Node_mutable_metadata(node_msg, arena);
|
680
|
+
PopulateMetadata(arena, metadata, node->metadata.object_value());
|
681
|
+
}
|
682
|
+
if (!node->locality_region.empty() || !node->locality_zone.empty() ||
|
683
|
+
!node->locality_subzone.empty()) {
|
684
|
+
envoy_config_core_v3_Locality* locality =
|
685
|
+
envoy_config_core_v3_Node_mutable_locality(node_msg, arena);
|
686
|
+
if (!node->locality_region.empty()) {
|
687
|
+
envoy_config_core_v3_Locality_set_region(
|
688
|
+
locality, StdStringToUpbString(node->locality_region));
|
689
|
+
}
|
690
|
+
if (!node->locality_zone.empty()) {
|
691
|
+
envoy_config_core_v3_Locality_set_zone(
|
692
|
+
locality, StdStringToUpbString(node->locality_zone));
|
693
|
+
}
|
694
|
+
if (!node->locality_subzone.empty()) {
|
695
|
+
envoy_config_core_v3_Locality_set_sub_zone(
|
696
|
+
locality, StdStringToUpbString(node->locality_subzone));
|
697
|
+
}
|
698
|
+
}
|
699
|
+
}
|
700
|
+
if (!use_v3) {
|
701
|
+
PopulateBuildVersion(arena, node_msg, build_version);
|
702
|
+
}
|
703
|
+
envoy_config_core_v3_Node_set_user_agent_name(
|
704
|
+
node_msg, StdStringToUpbString(user_agent_name));
|
705
|
+
envoy_config_core_v3_Node_set_user_agent_version(
|
706
|
+
node_msg, upb_strview_makez(grpc_version_string()));
|
707
|
+
envoy_config_core_v3_Node_add_client_features(
|
708
|
+
node_msg, upb_strview_makez("envoy.lb.does_not_support_overprovisioning"),
|
709
|
+
arena);
|
710
|
+
}
|
711
|
+
|
712
|
+
inline absl::string_view UpbStringToAbsl(const upb_strview& str) {
|
713
|
+
return absl::string_view(str.data, str.size);
|
714
|
+
}
|
715
|
+
|
716
|
+
inline std::string UpbStringToStdString(const upb_strview& str) {
|
717
|
+
return std::string(str.data, str.size);
|
718
|
+
}
|
719
|
+
|
720
|
+
void MaybeLogDiscoveryRequest(
|
721
|
+
XdsClient* client, TraceFlag* tracer, upb_symtab* symtab,
|
722
|
+
const envoy_service_discovery_v3_DiscoveryRequest* request) {
|
723
|
+
if (GRPC_TRACE_FLAG_ENABLED(*tracer) &&
|
724
|
+
gpr_should_log(GPR_LOG_SEVERITY_DEBUG)) {
|
725
|
+
const upb_msgdef* msg_type =
|
726
|
+
envoy_service_discovery_v3_DiscoveryRequest_getmsgdef(symtab);
|
727
|
+
char buf[10240];
|
728
|
+
upb_text_encode(request, msg_type, nullptr, 0, buf, sizeof(buf));
|
729
|
+
gpr_log(GPR_DEBUG, "[xds_client %p] constructed ADS request: %s", client,
|
730
|
+
buf);
|
731
|
+
}
|
732
|
+
}
|
733
|
+
|
734
|
+
grpc_slice SerializeDiscoveryRequest(
|
735
|
+
upb_arena* arena, envoy_service_discovery_v3_DiscoveryRequest* request) {
|
736
|
+
size_t output_length;
|
737
|
+
char* output = envoy_service_discovery_v3_DiscoveryRequest_serialize(
|
738
|
+
request, arena, &output_length);
|
739
|
+
return grpc_slice_from_copied_buffer(output, output_length);
|
740
|
+
}
|
741
|
+
|
742
|
+
absl::string_view TypeUrlExternalToInternal(bool use_v3,
|
743
|
+
const std::string& type_url) {
|
744
|
+
if (!use_v3) {
|
745
|
+
if (type_url == XdsApi::kLdsTypeUrl) {
|
746
|
+
return kLdsV2TypeUrl;
|
747
|
+
}
|
748
|
+
if (type_url == XdsApi::kRdsTypeUrl) {
|
749
|
+
return kRdsV2TypeUrl;
|
750
|
+
}
|
751
|
+
if (type_url == XdsApi::kCdsTypeUrl) {
|
752
|
+
return kCdsV2TypeUrl;
|
753
|
+
}
|
754
|
+
if (type_url == XdsApi::kEdsTypeUrl) {
|
755
|
+
return kEdsV2TypeUrl;
|
756
|
+
}
|
757
|
+
}
|
758
|
+
return type_url;
|
759
|
+
}
|
760
|
+
|
761
|
+
} // namespace
|
762
|
+
|
763
|
+
grpc_slice XdsApi::CreateAdsRequest(
|
764
|
+
const XdsBootstrap::XdsServer& server, const std::string& type_url,
|
765
|
+
const std::set<absl::string_view>& resource_names,
|
766
|
+
const std::string& version, const std::string& nonce, grpc_error* error,
|
767
|
+
bool populate_node) {
|
768
|
+
upb::Arena arena;
|
769
|
+
// Create a request.
|
770
|
+
envoy_service_discovery_v3_DiscoveryRequest* request =
|
771
|
+
envoy_service_discovery_v3_DiscoveryRequest_new(arena.ptr());
|
772
|
+
// Set type_url.
|
773
|
+
absl::string_view real_type_url =
|
774
|
+
TypeUrlExternalToInternal(server.ShouldUseV3(), type_url);
|
775
|
+
envoy_service_discovery_v3_DiscoveryRequest_set_type_url(
|
776
|
+
request, StdStringToUpbString(real_type_url));
|
777
|
+
// Set version_info.
|
778
|
+
if (!version.empty()) {
|
779
|
+
envoy_service_discovery_v3_DiscoveryRequest_set_version_info(
|
780
|
+
request, StdStringToUpbString(version));
|
781
|
+
}
|
782
|
+
// Set nonce.
|
783
|
+
if (!nonce.empty()) {
|
784
|
+
envoy_service_discovery_v3_DiscoveryRequest_set_response_nonce(
|
785
|
+
request, StdStringToUpbString(nonce));
|
786
|
+
}
|
787
|
+
// Set error_detail if it's a NACK.
|
788
|
+
if (error != GRPC_ERROR_NONE) {
|
789
|
+
google_rpc_Status* error_detail =
|
790
|
+
envoy_service_discovery_v3_DiscoveryRequest_mutable_error_detail(
|
791
|
+
request, arena.ptr());
|
792
|
+
// Hard-code INVALID_ARGUMENT as the status code.
|
793
|
+
// TODO(roth): If at some point we decide we care about this value,
|
794
|
+
// we could attach a status code to the individual errors where we
|
795
|
+
// generate them in the parsing code, and then use that here.
|
796
|
+
google_rpc_Status_set_code(error_detail, GRPC_STATUS_INVALID_ARGUMENT);
|
797
|
+
// Error description comes from the error that was passed in.
|
798
|
+
upb_strview error_description =
|
799
|
+
StdStringToUpbString(absl::string_view(grpc_error_string(error)));
|
800
|
+
google_rpc_Status_set_message(error_detail, error_description);
|
801
|
+
GRPC_ERROR_UNREF(error);
|
802
|
+
}
|
803
|
+
// Populate node.
|
804
|
+
if (populate_node) {
|
805
|
+
envoy_config_core_v3_Node* node_msg =
|
806
|
+
envoy_service_discovery_v3_DiscoveryRequest_mutable_node(request,
|
807
|
+
arena.ptr());
|
808
|
+
PopulateNode(arena.ptr(), node_, server.ShouldUseV3(), build_version_,
|
809
|
+
user_agent_name_, node_msg);
|
810
|
+
}
|
811
|
+
// Add resource_names.
|
812
|
+
for (const auto& resource_name : resource_names) {
|
813
|
+
envoy_service_discovery_v3_DiscoveryRequest_add_resource_names(
|
814
|
+
request, StdStringToUpbString(resource_name), arena.ptr());
|
815
|
+
}
|
816
|
+
MaybeLogDiscoveryRequest(client_, tracer_, symtab_.ptr(), request);
|
817
|
+
return SerializeDiscoveryRequest(arena.ptr(), request);
|
818
|
+
}
|
819
|
+
|
820
|
+
namespace {
|
821
|
+
|
822
|
+
void MaybeLogDiscoveryResponse(
|
823
|
+
XdsClient* client, TraceFlag* tracer, upb_symtab* symtab,
|
824
|
+
const envoy_service_discovery_v3_DiscoveryResponse* response) {
|
825
|
+
if (GRPC_TRACE_FLAG_ENABLED(*tracer) &&
|
826
|
+
gpr_should_log(GPR_LOG_SEVERITY_DEBUG)) {
|
827
|
+
const upb_msgdef* msg_type =
|
828
|
+
envoy_service_discovery_v3_DiscoveryResponse_getmsgdef(symtab);
|
829
|
+
char buf[10240];
|
830
|
+
upb_text_encode(response, msg_type, nullptr, 0, buf, sizeof(buf));
|
831
|
+
gpr_log(GPR_DEBUG, "[xds_client %p] received response: %s", client, buf);
|
832
|
+
}
|
833
|
+
}
|
834
|
+
|
835
|
+
void MaybeLogRouteConfiguration(
|
836
|
+
XdsClient* client, TraceFlag* tracer, upb_symtab* symtab,
|
837
|
+
const envoy_config_route_v3_RouteConfiguration* route_config) {
|
838
|
+
if (GRPC_TRACE_FLAG_ENABLED(*tracer) &&
|
839
|
+
gpr_should_log(GPR_LOG_SEVERITY_DEBUG)) {
|
840
|
+
const upb_msgdef* msg_type =
|
841
|
+
envoy_config_route_v3_RouteConfiguration_getmsgdef(symtab);
|
842
|
+
char buf[10240];
|
843
|
+
upb_text_encode(route_config, msg_type, nullptr, 0, buf, sizeof(buf));
|
844
|
+
gpr_log(GPR_DEBUG, "[xds_client %p] RouteConfiguration: %s", client, buf);
|
845
|
+
}
|
846
|
+
}
|
847
|
+
|
848
|
+
void MaybeLogCluster(XdsClient* client, TraceFlag* tracer, upb_symtab* symtab,
|
849
|
+
const envoy_config_cluster_v3_Cluster* cluster) {
|
850
|
+
if (GRPC_TRACE_FLAG_ENABLED(*tracer) &&
|
851
|
+
gpr_should_log(GPR_LOG_SEVERITY_DEBUG)) {
|
852
|
+
const upb_msgdef* msg_type =
|
853
|
+
envoy_config_cluster_v3_Cluster_getmsgdef(symtab);
|
854
|
+
char buf[10240];
|
855
|
+
upb_text_encode(cluster, msg_type, nullptr, 0, buf, sizeof(buf));
|
856
|
+
gpr_log(GPR_DEBUG, "[xds_client %p] Cluster: %s", client, buf);
|
857
|
+
}
|
858
|
+
}
|
859
|
+
|
860
|
+
void MaybeLogClusterLoadAssignment(
|
861
|
+
XdsClient* client, TraceFlag* tracer, upb_symtab* symtab,
|
862
|
+
const envoy_config_endpoint_v3_ClusterLoadAssignment* cla) {
|
863
|
+
if (GRPC_TRACE_FLAG_ENABLED(*tracer) &&
|
864
|
+
gpr_should_log(GPR_LOG_SEVERITY_DEBUG)) {
|
865
|
+
const upb_msgdef* msg_type =
|
866
|
+
envoy_config_endpoint_v3_ClusterLoadAssignment_getmsgdef(symtab);
|
867
|
+
char buf[10240];
|
868
|
+
upb_text_encode(cla, msg_type, nullptr, 0, buf, sizeof(buf));
|
869
|
+
gpr_log(GPR_DEBUG, "[xds_client %p] ClusterLoadAssignment: %s", client,
|
870
|
+
buf);
|
871
|
+
}
|
872
|
+
}
|
873
|
+
|
874
|
+
grpc_error* RoutePathMatchParse(const envoy_config_route_v3_RouteMatch* match,
|
875
|
+
XdsApi::Route* route, bool* ignore_route) {
|
876
|
+
auto* case_sensitive_ptr =
|
877
|
+
envoy_config_route_v3_RouteMatch_case_sensitive(match);
|
878
|
+
bool case_sensitive = true;
|
879
|
+
if (case_sensitive_ptr != nullptr) {
|
880
|
+
case_sensitive = google_protobuf_BoolValue_value(case_sensitive_ptr);
|
881
|
+
}
|
882
|
+
StringMatcher::Type type;
|
883
|
+
std::string match_string;
|
884
|
+
if (envoy_config_route_v3_RouteMatch_has_prefix(match)) {
|
885
|
+
absl::string_view prefix =
|
886
|
+
UpbStringToAbsl(envoy_config_route_v3_RouteMatch_prefix(match));
|
887
|
+
// Empty prefix "" is accepted.
|
888
|
+
if (!prefix.empty()) {
|
889
|
+
// Prefix "/" is accepted.
|
890
|
+
if (prefix[0] != '/') {
|
891
|
+
// Prefix which does not start with a / will never match anything, so
|
892
|
+
// ignore this route.
|
893
|
+
*ignore_route = true;
|
894
|
+
return GRPC_ERROR_NONE;
|
895
|
+
}
|
896
|
+
std::vector<absl::string_view> prefix_elements =
|
897
|
+
absl::StrSplit(prefix.substr(1), absl::MaxSplits('/', 2));
|
898
|
+
if (prefix_elements.size() > 2) {
|
899
|
+
// Prefix cannot have more than 2 slashes.
|
900
|
+
*ignore_route = true;
|
901
|
+
return GRPC_ERROR_NONE;
|
902
|
+
} else if (prefix_elements.size() == 2 && prefix_elements[0].empty()) {
|
903
|
+
// Prefix contains empty string between the 2 slashes
|
904
|
+
*ignore_route = true;
|
905
|
+
return GRPC_ERROR_NONE;
|
906
|
+
}
|
907
|
+
}
|
908
|
+
type = StringMatcher::Type::PREFIX;
|
909
|
+
match_string = std::string(prefix);
|
910
|
+
} else if (envoy_config_route_v3_RouteMatch_has_path(match)) {
|
911
|
+
absl::string_view path =
|
912
|
+
UpbStringToAbsl(envoy_config_route_v3_RouteMatch_path(match));
|
913
|
+
if (path.empty()) {
|
914
|
+
// Path that is empty will never match anything, so ignore this route.
|
915
|
+
*ignore_route = true;
|
916
|
+
return GRPC_ERROR_NONE;
|
917
|
+
}
|
918
|
+
if (path[0] != '/') {
|
919
|
+
// Path which does not start with a / will never match anything, so
|
920
|
+
// ignore this route.
|
921
|
+
*ignore_route = true;
|
922
|
+
return GRPC_ERROR_NONE;
|
923
|
+
}
|
924
|
+
std::vector<absl::string_view> path_elements =
|
925
|
+
absl::StrSplit(path.substr(1), absl::MaxSplits('/', 2));
|
926
|
+
if (path_elements.size() != 2) {
|
927
|
+
// Path not in the required format of /service/method will never match
|
928
|
+
// anything, so ignore this route.
|
929
|
+
*ignore_route = true;
|
930
|
+
return GRPC_ERROR_NONE;
|
931
|
+
} else if (path_elements[0].empty()) {
|
932
|
+
// Path contains empty service name will never match anything, so ignore
|
933
|
+
// this route.
|
934
|
+
*ignore_route = true;
|
935
|
+
return GRPC_ERROR_NONE;
|
936
|
+
} else if (path_elements[1].empty()) {
|
937
|
+
// Path contains empty method name will never match anything, so ignore
|
938
|
+
// this route.
|
939
|
+
*ignore_route = true;
|
940
|
+
return GRPC_ERROR_NONE;
|
941
|
+
}
|
942
|
+
type = StringMatcher::Type::EXACT;
|
943
|
+
match_string = std::string(path);
|
944
|
+
} else if (envoy_config_route_v3_RouteMatch_has_safe_regex(match)) {
|
945
|
+
const envoy_type_matcher_v3_RegexMatcher* regex_matcher =
|
946
|
+
envoy_config_route_v3_RouteMatch_safe_regex(match);
|
947
|
+
GPR_ASSERT(regex_matcher != nullptr);
|
948
|
+
type = StringMatcher::Type::SAFE_REGEX;
|
949
|
+
match_string = UpbStringToStdString(
|
950
|
+
envoy_type_matcher_v3_RegexMatcher_regex(regex_matcher));
|
951
|
+
} else {
|
952
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
953
|
+
"Invalid route path specifier specified.");
|
954
|
+
}
|
955
|
+
absl::StatusOr<StringMatcher> string_matcher =
|
956
|
+
StringMatcher::Create(type, match_string, case_sensitive);
|
957
|
+
if (!string_matcher.ok()) {
|
958
|
+
return GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
959
|
+
absl::StrCat("path matcher: ", string_matcher.status().message())
|
960
|
+
.c_str());
|
961
|
+
;
|
962
|
+
}
|
963
|
+
route->matchers.path_matcher = std::move(string_matcher.value());
|
964
|
+
return GRPC_ERROR_NONE;
|
965
|
+
}
|
966
|
+
|
967
|
+
grpc_error* RouteHeaderMatchersParse(
|
968
|
+
const envoy_config_route_v3_RouteMatch* match, XdsApi::Route* route) {
|
969
|
+
size_t size;
|
970
|
+
const envoy_config_route_v3_HeaderMatcher* const* headers =
|
971
|
+
envoy_config_route_v3_RouteMatch_headers(match, &size);
|
972
|
+
for (size_t i = 0; i < size; ++i) {
|
973
|
+
const envoy_config_route_v3_HeaderMatcher* header = headers[i];
|
974
|
+
const std::string name =
|
975
|
+
UpbStringToStdString(envoy_config_route_v3_HeaderMatcher_name(header));
|
976
|
+
HeaderMatcher::Type type;
|
977
|
+
std::string match_string;
|
978
|
+
int64_t range_start = 0;
|
979
|
+
int64_t range_end = 0;
|
980
|
+
bool present_match = false;
|
981
|
+
if (envoy_config_route_v3_HeaderMatcher_has_exact_match(header)) {
|
982
|
+
type = HeaderMatcher::Type::EXACT;
|
983
|
+
match_string = UpbStringToStdString(
|
984
|
+
envoy_config_route_v3_HeaderMatcher_exact_match(header));
|
985
|
+
} else if (envoy_config_route_v3_HeaderMatcher_has_safe_regex_match(
|
986
|
+
header)) {
|
987
|
+
const envoy_type_matcher_v3_RegexMatcher* regex_matcher =
|
988
|
+
envoy_config_route_v3_HeaderMatcher_safe_regex_match(header);
|
989
|
+
GPR_ASSERT(regex_matcher != nullptr);
|
990
|
+
type = HeaderMatcher::Type::SAFE_REGEX;
|
991
|
+
match_string = UpbStringToStdString(
|
992
|
+
envoy_type_matcher_v3_RegexMatcher_regex(regex_matcher));
|
993
|
+
} else if (envoy_config_route_v3_HeaderMatcher_has_range_match(header)) {
|
994
|
+
type = HeaderMatcher::Type::RANGE;
|
995
|
+
const envoy_type_v3_Int64Range* range_matcher =
|
996
|
+
envoy_config_route_v3_HeaderMatcher_range_match(header);
|
997
|
+
range_start = envoy_type_v3_Int64Range_start(range_matcher);
|
998
|
+
range_end = envoy_type_v3_Int64Range_end(range_matcher);
|
999
|
+
} else if (envoy_config_route_v3_HeaderMatcher_has_present_match(header)) {
|
1000
|
+
type = HeaderMatcher::Type::PRESENT;
|
1001
|
+
present_match = envoy_config_route_v3_HeaderMatcher_present_match(header);
|
1002
|
+
} else if (envoy_config_route_v3_HeaderMatcher_has_prefix_match(header)) {
|
1003
|
+
type = HeaderMatcher::Type::PREFIX;
|
1004
|
+
match_string = UpbStringToStdString(
|
1005
|
+
envoy_config_route_v3_HeaderMatcher_prefix_match(header));
|
1006
|
+
} else if (envoy_config_route_v3_HeaderMatcher_has_suffix_match(header)) {
|
1007
|
+
type = HeaderMatcher::Type::SUFFIX;
|
1008
|
+
match_string = UpbStringToStdString(
|
1009
|
+
envoy_config_route_v3_HeaderMatcher_suffix_match(header));
|
1010
|
+
} else if (envoy_config_route_v3_HeaderMatcher_has_contains_match(header)) {
|
1011
|
+
type = HeaderMatcher::Type::CONTAINS;
|
1012
|
+
match_string = UpbStringToStdString(
|
1013
|
+
envoy_config_route_v3_HeaderMatcher_contains_match(header));
|
1014
|
+
} else {
|
1015
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1016
|
+
"Invalid route header matcher specified.");
|
1017
|
+
}
|
1018
|
+
bool invert_match =
|
1019
|
+
envoy_config_route_v3_HeaderMatcher_invert_match(header);
|
1020
|
+
absl::StatusOr<HeaderMatcher> header_matcher =
|
1021
|
+
HeaderMatcher::Create(name, type, match_string, range_start, range_end,
|
1022
|
+
present_match, invert_match);
|
1023
|
+
if (!header_matcher.ok()) {
|
1024
|
+
return GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
1025
|
+
absl::StrCat("header matcher: ", header_matcher.status().message())
|
1026
|
+
.c_str());
|
1027
|
+
}
|
1028
|
+
route->matchers.header_matchers.emplace_back(
|
1029
|
+
std::move(header_matcher.value()));
|
1030
|
+
}
|
1031
|
+
return GRPC_ERROR_NONE;
|
1032
|
+
}
|
1033
|
+
|
1034
|
+
grpc_error* RouteRuntimeFractionParse(
|
1035
|
+
const envoy_config_route_v3_RouteMatch* match, XdsApi::Route* route) {
|
1036
|
+
const envoy_config_core_v3_RuntimeFractionalPercent* runtime_fraction =
|
1037
|
+
envoy_config_route_v3_RouteMatch_runtime_fraction(match);
|
1038
|
+
if (runtime_fraction != nullptr) {
|
1039
|
+
const envoy_type_v3_FractionalPercent* fraction =
|
1040
|
+
envoy_config_core_v3_RuntimeFractionalPercent_default_value(
|
1041
|
+
runtime_fraction);
|
1042
|
+
if (fraction != nullptr) {
|
1043
|
+
uint32_t numerator = envoy_type_v3_FractionalPercent_numerator(fraction);
|
1044
|
+
const auto denominator =
|
1045
|
+
static_cast<envoy_type_v3_FractionalPercent_DenominatorType>(
|
1046
|
+
envoy_type_v3_FractionalPercent_denominator(fraction));
|
1047
|
+
// Normalize to million.
|
1048
|
+
switch (denominator) {
|
1049
|
+
case envoy_type_v3_FractionalPercent_HUNDRED:
|
1050
|
+
numerator *= 10000;
|
1051
|
+
break;
|
1052
|
+
case envoy_type_v3_FractionalPercent_TEN_THOUSAND:
|
1053
|
+
numerator *= 100;
|
1054
|
+
break;
|
1055
|
+
case envoy_type_v3_FractionalPercent_MILLION:
|
1056
|
+
break;
|
1057
|
+
default:
|
1058
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1059
|
+
"Unknown denominator type");
|
1060
|
+
}
|
1061
|
+
route->matchers.fraction_per_million = numerator;
|
1062
|
+
}
|
1063
|
+
}
|
1064
|
+
return GRPC_ERROR_NONE;
|
1065
|
+
}
|
1066
|
+
|
1067
|
+
grpc_error* RouteActionParse(const envoy_config_route_v3_Route* route_msg,
|
1068
|
+
XdsApi::Route* route, bool* ignore_route) {
|
1069
|
+
if (!envoy_config_route_v3_Route_has_route(route_msg)) {
|
1070
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1071
|
+
"No RouteAction found in route.");
|
1072
|
+
}
|
1073
|
+
const envoy_config_route_v3_RouteAction* route_action =
|
1074
|
+
envoy_config_route_v3_Route_route(route_msg);
|
1075
|
+
// Get the cluster or weighted_clusters in the RouteAction.
|
1076
|
+
if (envoy_config_route_v3_RouteAction_has_cluster(route_action)) {
|
1077
|
+
route->cluster_name = UpbStringToStdString(
|
1078
|
+
envoy_config_route_v3_RouteAction_cluster(route_action));
|
1079
|
+
if (route->cluster_name.empty()) {
|
1080
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1081
|
+
"RouteAction cluster contains empty cluster name.");
|
1082
|
+
}
|
1083
|
+
} else if (envoy_config_route_v3_RouteAction_has_weighted_clusters(
|
1084
|
+
route_action)) {
|
1085
|
+
const envoy_config_route_v3_WeightedCluster* weighted_cluster =
|
1086
|
+
envoy_config_route_v3_RouteAction_weighted_clusters(route_action);
|
1087
|
+
uint32_t total_weight = 100;
|
1088
|
+
const google_protobuf_UInt32Value* weight =
|
1089
|
+
envoy_config_route_v3_WeightedCluster_total_weight(weighted_cluster);
|
1090
|
+
if (weight != nullptr) {
|
1091
|
+
total_weight = google_protobuf_UInt32Value_value(weight);
|
1092
|
+
}
|
1093
|
+
size_t clusters_size;
|
1094
|
+
const envoy_config_route_v3_WeightedCluster_ClusterWeight* const* clusters =
|
1095
|
+
envoy_config_route_v3_WeightedCluster_clusters(weighted_cluster,
|
1096
|
+
&clusters_size);
|
1097
|
+
uint32_t sum_of_weights = 0;
|
1098
|
+
for (size_t j = 0; j < clusters_size; ++j) {
|
1099
|
+
const envoy_config_route_v3_WeightedCluster_ClusterWeight*
|
1100
|
+
cluster_weight = clusters[j];
|
1101
|
+
XdsApi::Route::ClusterWeight cluster;
|
1102
|
+
cluster.name = UpbStringToStdString(
|
1103
|
+
envoy_config_route_v3_WeightedCluster_ClusterWeight_name(
|
1104
|
+
cluster_weight));
|
1105
|
+
if (cluster.name.empty()) {
|
1106
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1107
|
+
"RouteAction weighted_cluster cluster contains empty cluster "
|
1108
|
+
"name.");
|
1109
|
+
}
|
1110
|
+
const google_protobuf_UInt32Value* weight =
|
1111
|
+
envoy_config_route_v3_WeightedCluster_ClusterWeight_weight(
|
1112
|
+
cluster_weight);
|
1113
|
+
if (weight == nullptr) {
|
1114
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1115
|
+
"RouteAction weighted_cluster cluster missing weight");
|
1116
|
+
}
|
1117
|
+
cluster.weight = google_protobuf_UInt32Value_value(weight);
|
1118
|
+
if (cluster.weight == 0) continue;
|
1119
|
+
sum_of_weights += cluster.weight;
|
1120
|
+
route->weighted_clusters.emplace_back(std::move(cluster));
|
1121
|
+
}
|
1122
|
+
if (total_weight != sum_of_weights) {
|
1123
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1124
|
+
"RouteAction weighted_cluster has incorrect total weight");
|
1125
|
+
}
|
1126
|
+
if (route->weighted_clusters.empty()) {
|
1127
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1128
|
+
"RouteAction weighted_cluster has no valid clusters specified.");
|
1129
|
+
}
|
1130
|
+
} else {
|
1131
|
+
// No cluster or weighted_clusters found in RouteAction, ignore this route.
|
1132
|
+
*ignore_route = true;
|
1133
|
+
}
|
1134
|
+
if (XdsTimeoutEnabled() && !*ignore_route) {
|
1135
|
+
const envoy_config_route_v3_RouteAction_MaxStreamDuration*
|
1136
|
+
max_stream_duration =
|
1137
|
+
envoy_config_route_v3_RouteAction_max_stream_duration(route_action);
|
1138
|
+
if (max_stream_duration != nullptr) {
|
1139
|
+
const google_protobuf_Duration* duration =
|
1140
|
+
envoy_config_route_v3_RouteAction_MaxStreamDuration_grpc_timeout_header_max(
|
1141
|
+
max_stream_duration);
|
1142
|
+
if (duration == nullptr) {
|
1143
|
+
duration =
|
1144
|
+
envoy_config_route_v3_RouteAction_MaxStreamDuration_max_stream_duration(
|
1145
|
+
max_stream_duration);
|
1146
|
+
}
|
1147
|
+
if (duration != nullptr) {
|
1148
|
+
XdsApi::Duration duration_in_route;
|
1149
|
+
duration_in_route.seconds = google_protobuf_Duration_seconds(duration);
|
1150
|
+
duration_in_route.nanos = google_protobuf_Duration_nanos(duration);
|
1151
|
+
route->max_stream_duration = duration_in_route;
|
1152
|
+
}
|
1153
|
+
}
|
1154
|
+
}
|
1155
|
+
return GRPC_ERROR_NONE;
|
1156
|
+
}
|
1157
|
+
|
1158
|
+
grpc_error* RouteConfigParse(
|
1159
|
+
XdsClient* client, TraceFlag* tracer, upb_symtab* symtab,
|
1160
|
+
const envoy_config_route_v3_RouteConfiguration* route_config,
|
1161
|
+
XdsApi::RdsUpdate* rds_update) {
|
1162
|
+
MaybeLogRouteConfiguration(client, tracer, symtab, route_config);
|
1163
|
+
// Get the virtual hosts.
|
1164
|
+
size_t size;
|
1165
|
+
const envoy_config_route_v3_VirtualHost* const* virtual_hosts =
|
1166
|
+
envoy_config_route_v3_RouteConfiguration_virtual_hosts(route_config,
|
1167
|
+
&size);
|
1168
|
+
for (size_t i = 0; i < size; ++i) {
|
1169
|
+
rds_update->virtual_hosts.emplace_back();
|
1170
|
+
XdsApi::RdsUpdate::VirtualHost& vhost = rds_update->virtual_hosts.back();
|
1171
|
+
// Parse domains.
|
1172
|
+
size_t domain_size;
|
1173
|
+
upb_strview const* domains = envoy_config_route_v3_VirtualHost_domains(
|
1174
|
+
virtual_hosts[i], &domain_size);
|
1175
|
+
for (size_t j = 0; j < domain_size; ++j) {
|
1176
|
+
std::string domain_pattern = UpbStringToStdString(domains[j]);
|
1177
|
+
const MatchType match_type = DomainPatternMatchType(domain_pattern);
|
1178
|
+
if (match_type == INVALID_MATCH) {
|
1179
|
+
return GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
1180
|
+
absl::StrCat("Invalid domain pattern \"", domain_pattern, "\".")
|
1181
|
+
.c_str());
|
1182
|
+
}
|
1183
|
+
vhost.domains.emplace_back(std::move(domain_pattern));
|
1184
|
+
}
|
1185
|
+
if (vhost.domains.empty()) {
|
1186
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING("VirtualHost has no domains");
|
1187
|
+
}
|
1188
|
+
// Parse routes.
|
1189
|
+
size_t num_routes;
|
1190
|
+
const envoy_config_route_v3_Route* const* routes =
|
1191
|
+
envoy_config_route_v3_VirtualHost_routes(virtual_hosts[i], &num_routes);
|
1192
|
+
if (num_routes < 1) {
|
1193
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1194
|
+
"No route found in the virtual host.");
|
1195
|
+
}
|
1196
|
+
// Loop over the whole list of routes
|
1197
|
+
for (size_t j = 0; j < num_routes; ++j) {
|
1198
|
+
const envoy_config_route_v3_RouteMatch* match =
|
1199
|
+
envoy_config_route_v3_Route_match(routes[j]);
|
1200
|
+
size_t query_parameters_size;
|
1201
|
+
static_cast<void>(envoy_config_route_v3_RouteMatch_query_parameters(
|
1202
|
+
match, &query_parameters_size));
|
1203
|
+
if (query_parameters_size > 0) {
|
1204
|
+
continue;
|
1205
|
+
}
|
1206
|
+
XdsApi::Route route;
|
1207
|
+
bool ignore_route = false;
|
1208
|
+
grpc_error* error = RoutePathMatchParse(match, &route, &ignore_route);
|
1209
|
+
if (error != GRPC_ERROR_NONE) return error;
|
1210
|
+
if (ignore_route) continue;
|
1211
|
+
error = RouteHeaderMatchersParse(match, &route);
|
1212
|
+
if (error != GRPC_ERROR_NONE) return error;
|
1213
|
+
error = RouteRuntimeFractionParse(match, &route);
|
1214
|
+
if (error != GRPC_ERROR_NONE) return error;
|
1215
|
+
error = RouteActionParse(routes[j], &route, &ignore_route);
|
1216
|
+
if (error != GRPC_ERROR_NONE) return error;
|
1217
|
+
if (ignore_route) continue;
|
1218
|
+
vhost.routes.emplace_back(std::move(route));
|
1219
|
+
}
|
1220
|
+
if (vhost.routes.empty()) {
|
1221
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING("No valid routes specified.");
|
1222
|
+
}
|
1223
|
+
}
|
1224
|
+
return GRPC_ERROR_NONE;
|
1225
|
+
}
|
1226
|
+
|
1227
|
+
XdsApi::CommonTlsContext::CertificateProviderInstance
|
1228
|
+
CertificateProviderInstanceParse(
|
1229
|
+
const envoy_extensions_transport_sockets_tls_v3_CommonTlsContext_CertificateProviderInstance*
|
1230
|
+
certificate_provider_instance_proto) {
|
1231
|
+
return {
|
1232
|
+
UpbStringToStdString(
|
1233
|
+
envoy_extensions_transport_sockets_tls_v3_CommonTlsContext_CertificateProviderInstance_instance_name(
|
1234
|
+
certificate_provider_instance_proto)),
|
1235
|
+
UpbStringToStdString(
|
1236
|
+
envoy_extensions_transport_sockets_tls_v3_CommonTlsContext_CertificateProviderInstance_certificate_name(
|
1237
|
+
certificate_provider_instance_proto))};
|
1238
|
+
}
|
1239
|
+
|
1240
|
+
grpc_error* CommonTlsContextParse(
|
1241
|
+
const envoy_extensions_transport_sockets_tls_v3_CommonTlsContext*
|
1242
|
+
common_tls_context_proto,
|
1243
|
+
XdsApi::CommonTlsContext* common_tls_context) GRPC_MUST_USE_RESULT;
|
1244
|
+
grpc_error* CommonTlsContextParse(
|
1245
|
+
const envoy_extensions_transport_sockets_tls_v3_CommonTlsContext*
|
1246
|
+
common_tls_context_proto,
|
1247
|
+
XdsApi::CommonTlsContext* common_tls_context) {
|
1248
|
+
auto* combined_validation_context =
|
1249
|
+
envoy_extensions_transport_sockets_tls_v3_CommonTlsContext_combined_validation_context(
|
1250
|
+
common_tls_context_proto);
|
1251
|
+
if (combined_validation_context != nullptr) {
|
1252
|
+
auto* default_validation_context =
|
1253
|
+
envoy_extensions_transport_sockets_tls_v3_CommonTlsContext_CombinedCertificateValidationContext_default_validation_context(
|
1254
|
+
combined_validation_context);
|
1255
|
+
if (default_validation_context != nullptr) {
|
1256
|
+
size_t len = 0;
|
1257
|
+
auto* subject_alt_names_matchers =
|
1258
|
+
envoy_extensions_transport_sockets_tls_v3_CertificateValidationContext_match_subject_alt_names(
|
1259
|
+
default_validation_context, &len);
|
1260
|
+
for (size_t i = 0; i < len; ++i) {
|
1261
|
+
StringMatcher::Type type;
|
1262
|
+
std::string matcher;
|
1263
|
+
if (envoy_type_matcher_v3_StringMatcher_has_exact(
|
1264
|
+
subject_alt_names_matchers[i])) {
|
1265
|
+
type = StringMatcher::Type::EXACT;
|
1266
|
+
matcher =
|
1267
|
+
UpbStringToStdString(envoy_type_matcher_v3_StringMatcher_exact(
|
1268
|
+
subject_alt_names_matchers[i]));
|
1269
|
+
} else if (envoy_type_matcher_v3_StringMatcher_has_prefix(
|
1270
|
+
subject_alt_names_matchers[i])) {
|
1271
|
+
type = StringMatcher::Type::PREFIX;
|
1272
|
+
matcher =
|
1273
|
+
UpbStringToStdString(envoy_type_matcher_v3_StringMatcher_prefix(
|
1274
|
+
subject_alt_names_matchers[i]));
|
1275
|
+
} else if (envoy_type_matcher_v3_StringMatcher_has_suffix(
|
1276
|
+
subject_alt_names_matchers[i])) {
|
1277
|
+
type = StringMatcher::Type::SUFFIX;
|
1278
|
+
matcher =
|
1279
|
+
UpbStringToStdString(envoy_type_matcher_v3_StringMatcher_suffix(
|
1280
|
+
subject_alt_names_matchers[i]));
|
1281
|
+
} else if (envoy_type_matcher_v3_StringMatcher_has_contains(
|
1282
|
+
subject_alt_names_matchers[i])) {
|
1283
|
+
type = StringMatcher::Type::CONTAINS;
|
1284
|
+
matcher =
|
1285
|
+
UpbStringToStdString(envoy_type_matcher_v3_StringMatcher_contains(
|
1286
|
+
subject_alt_names_matchers[i]));
|
1287
|
+
} else if (envoy_type_matcher_v3_StringMatcher_has_safe_regex(
|
1288
|
+
subject_alt_names_matchers[i])) {
|
1289
|
+
type = StringMatcher::Type::SAFE_REGEX;
|
1290
|
+
auto* regex_matcher = envoy_type_matcher_v3_StringMatcher_safe_regex(
|
1291
|
+
subject_alt_names_matchers[i]);
|
1292
|
+
matcher = UpbStringToStdString(
|
1293
|
+
envoy_type_matcher_v3_RegexMatcher_regex(regex_matcher));
|
1294
|
+
} else {
|
1295
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1296
|
+
"Invalid StringMatcher specified");
|
1297
|
+
}
|
1298
|
+
bool ignore_case = envoy_type_matcher_v3_StringMatcher_ignore_case(
|
1299
|
+
subject_alt_names_matchers[i]);
|
1300
|
+
absl::StatusOr<StringMatcher> string_matcher =
|
1301
|
+
StringMatcher::Create(type, matcher,
|
1302
|
+
/*case_sensitive=*/!ignore_case);
|
1303
|
+
if (!string_matcher.ok()) {
|
1304
|
+
return GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
1305
|
+
absl::StrCat("string matcher: ",
|
1306
|
+
string_matcher.status().message())
|
1307
|
+
.c_str());
|
1308
|
+
}
|
1309
|
+
if (type == StringMatcher::Type::SAFE_REGEX && ignore_case) {
|
1310
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1311
|
+
"StringMatcher: ignore_case has no effect for SAFE_REGEX.");
|
1312
|
+
}
|
1313
|
+
common_tls_context->combined_validation_context
|
1314
|
+
.default_validation_context.match_subject_alt_names.push_back(
|
1315
|
+
std::move(string_matcher.value()));
|
1316
|
+
}
|
1317
|
+
}
|
1318
|
+
auto* validation_context_certificate_provider_instance =
|
1319
|
+
envoy_extensions_transport_sockets_tls_v3_CommonTlsContext_CombinedCertificateValidationContext_validation_context_certificate_provider_instance(
|
1320
|
+
combined_validation_context);
|
1321
|
+
if (validation_context_certificate_provider_instance != nullptr) {
|
1322
|
+
common_tls_context->combined_validation_context
|
1323
|
+
.validation_context_certificate_provider_instance =
|
1324
|
+
CertificateProviderInstanceParse(
|
1325
|
+
validation_context_certificate_provider_instance);
|
1326
|
+
}
|
1327
|
+
}
|
1328
|
+
auto* tls_certificate_certificate_provider_instance =
|
1329
|
+
envoy_extensions_transport_sockets_tls_v3_CommonTlsContext_tls_certificate_certificate_provider_instance(
|
1330
|
+
common_tls_context_proto);
|
1331
|
+
if (tls_certificate_certificate_provider_instance != nullptr) {
|
1332
|
+
common_tls_context->tls_certificate_certificate_provider_instance =
|
1333
|
+
CertificateProviderInstanceParse(
|
1334
|
+
tls_certificate_certificate_provider_instance);
|
1335
|
+
}
|
1336
|
+
return GRPC_ERROR_NONE;
|
1337
|
+
}
|
1338
|
+
|
1339
|
+
grpc_error* LdsResponseParseClient(
|
1340
|
+
XdsClient* client, TraceFlag* tracer, upb_symtab* symtab, upb_arena* arena,
|
1341
|
+
const envoy_config_listener_v3_ApiListener* api_listener,
|
1342
|
+
XdsApi::LdsUpdate* lds_update) {
|
1343
|
+
lds_update->type = XdsApi::LdsUpdate::ListenerType::kHttpApiListener;
|
1344
|
+
const upb_strview encoded_api_listener = google_protobuf_Any_value(
|
1345
|
+
envoy_config_listener_v3_ApiListener_api_listener(api_listener));
|
1346
|
+
const envoy_extensions_filters_network_http_connection_manager_v3_HttpConnectionManager*
|
1347
|
+
http_connection_manager =
|
1348
|
+
envoy_extensions_filters_network_http_connection_manager_v3_HttpConnectionManager_parse(
|
1349
|
+
encoded_api_listener.data, encoded_api_listener.size, arena);
|
1350
|
+
if (http_connection_manager == nullptr) {
|
1351
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1352
|
+
"Could not parse HttpConnectionManager config from ApiListener");
|
1353
|
+
}
|
1354
|
+
if (XdsTimeoutEnabled()) {
|
1355
|
+
// Obtain max_stream_duration from Http Protocol Options.
|
1356
|
+
const envoy_config_core_v3_HttpProtocolOptions* options =
|
1357
|
+
envoy_extensions_filters_network_http_connection_manager_v3_HttpConnectionManager_common_http_protocol_options(
|
1358
|
+
http_connection_manager);
|
1359
|
+
if (options != nullptr) {
|
1360
|
+
const google_protobuf_Duration* duration =
|
1361
|
+
envoy_config_core_v3_HttpProtocolOptions_max_stream_duration(options);
|
1362
|
+
if (duration != nullptr) {
|
1363
|
+
lds_update->http_max_stream_duration.seconds =
|
1364
|
+
google_protobuf_Duration_seconds(duration);
|
1365
|
+
lds_update->http_max_stream_duration.nanos =
|
1366
|
+
google_protobuf_Duration_nanos(duration);
|
1367
|
+
}
|
1368
|
+
}
|
1369
|
+
}
|
1370
|
+
// Found inlined route_config. Parse it to find the cluster_name.
|
1371
|
+
if (envoy_extensions_filters_network_http_connection_manager_v3_HttpConnectionManager_has_route_config(
|
1372
|
+
http_connection_manager)) {
|
1373
|
+
const envoy_config_route_v3_RouteConfiguration* route_config =
|
1374
|
+
envoy_extensions_filters_network_http_connection_manager_v3_HttpConnectionManager_route_config(
|
1375
|
+
http_connection_manager);
|
1376
|
+
XdsApi::RdsUpdate rds_update;
|
1377
|
+
grpc_error* error =
|
1378
|
+
RouteConfigParse(client, tracer, symtab, route_config, &rds_update);
|
1379
|
+
if (error != GRPC_ERROR_NONE) return error;
|
1380
|
+
lds_update->rds_update = std::move(rds_update);
|
1381
|
+
return GRPC_ERROR_NONE;
|
1382
|
+
}
|
1383
|
+
// Validate that RDS must be used to get the route_config dynamically.
|
1384
|
+
if (!envoy_extensions_filters_network_http_connection_manager_v3_HttpConnectionManager_has_rds(
|
1385
|
+
http_connection_manager)) {
|
1386
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1387
|
+
"HttpConnectionManager neither has inlined route_config nor RDS.");
|
1388
|
+
}
|
1389
|
+
const envoy_extensions_filters_network_http_connection_manager_v3_Rds* rds =
|
1390
|
+
envoy_extensions_filters_network_http_connection_manager_v3_HttpConnectionManager_rds(
|
1391
|
+
http_connection_manager);
|
1392
|
+
// Check that the ConfigSource specifies ADS.
|
1393
|
+
const envoy_config_core_v3_ConfigSource* config_source =
|
1394
|
+
envoy_extensions_filters_network_http_connection_manager_v3_Rds_config_source(
|
1395
|
+
rds);
|
1396
|
+
if (config_source == nullptr) {
|
1397
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1398
|
+
"HttpConnectionManager missing config_source for RDS.");
|
1399
|
+
}
|
1400
|
+
if (!envoy_config_core_v3_ConfigSource_has_ads(config_source)) {
|
1401
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1402
|
+
"HttpConnectionManager ConfigSource for RDS does not specify ADS.");
|
1403
|
+
}
|
1404
|
+
// Get the route_config_name.
|
1405
|
+
lds_update->route_config_name = UpbStringToStdString(
|
1406
|
+
envoy_extensions_filters_network_http_connection_manager_v3_Rds_route_config_name(
|
1407
|
+
rds));
|
1408
|
+
return GRPC_ERROR_NONE;
|
1409
|
+
}
|
1410
|
+
|
1411
|
+
grpc_error* LdsResponseParseServer(
|
1412
|
+
upb_arena* arena, const envoy_config_listener_v3_Listener* listener,
|
1413
|
+
const std::string& /*listener_name*/,
|
1414
|
+
const envoy_config_core_v3_Address* /*address*/,
|
1415
|
+
XdsApi::LdsUpdate* lds_update) {
|
1416
|
+
lds_update->type = XdsApi::LdsUpdate::ListenerType::kTcpListener;
|
1417
|
+
// TODO(yashykt): Support filter chain match.
|
1418
|
+
// Right now, we are supporting and expecting only one entry in filter_chains.
|
1419
|
+
size_t size = 0;
|
1420
|
+
auto* filter_chains =
|
1421
|
+
envoy_config_listener_v3_Listener_filter_chains(listener, &size);
|
1422
|
+
if (size != 1) {
|
1423
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1424
|
+
"Only one filter_chain supported.");
|
1425
|
+
}
|
1426
|
+
// Get the DownstreamTlsContext from the match
|
1427
|
+
if (XdsSecurityEnabled()) {
|
1428
|
+
auto* transport_socket =
|
1429
|
+
envoy_config_listener_v3_FilterChain_transport_socket(filter_chains[0]);
|
1430
|
+
if (transport_socket != nullptr) {
|
1431
|
+
absl::string_view name = UpbStringToAbsl(
|
1432
|
+
envoy_config_core_v3_TransportSocket_name(transport_socket));
|
1433
|
+
if (name == "envoy.transport_sockets.tls") {
|
1434
|
+
auto* typed_config =
|
1435
|
+
envoy_config_core_v3_TransportSocket_typed_config(transport_socket);
|
1436
|
+
if (typed_config != nullptr) {
|
1437
|
+
const upb_strview encoded_downstream_tls_context =
|
1438
|
+
google_protobuf_Any_value(typed_config);
|
1439
|
+
auto* downstream_tls_context =
|
1440
|
+
envoy_extensions_transport_sockets_tls_v3_DownstreamTlsContext_parse(
|
1441
|
+
encoded_downstream_tls_context.data,
|
1442
|
+
encoded_downstream_tls_context.size, arena);
|
1443
|
+
if (downstream_tls_context == nullptr) {
|
1444
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1445
|
+
"Can't decode downstream tls context.");
|
1446
|
+
}
|
1447
|
+
auto* common_tls_context =
|
1448
|
+
envoy_extensions_transport_sockets_tls_v3_DownstreamTlsContext_common_tls_context(
|
1449
|
+
downstream_tls_context);
|
1450
|
+
if (common_tls_context != nullptr) {
|
1451
|
+
grpc_error* error = CommonTlsContextParse(
|
1452
|
+
common_tls_context,
|
1453
|
+
&lds_update->downstream_tls_context.common_tls_context);
|
1454
|
+
if (error != GRPC_ERROR_NONE) return error;
|
1455
|
+
}
|
1456
|
+
auto* require_client_certificate =
|
1457
|
+
envoy_extensions_transport_sockets_tls_v3_DownstreamTlsContext_require_client_certificate(
|
1458
|
+
downstream_tls_context);
|
1459
|
+
if (require_client_certificate != nullptr) {
|
1460
|
+
lds_update->downstream_tls_context.require_client_certificate =
|
1461
|
+
google_protobuf_BoolValue_value(require_client_certificate);
|
1462
|
+
}
|
1463
|
+
}
|
1464
|
+
if (lds_update->downstream_tls_context.common_tls_context
|
1465
|
+
.tls_certificate_certificate_provider_instance.instance_name
|
1466
|
+
.empty()) {
|
1467
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1468
|
+
"TLS configuration provided but no "
|
1469
|
+
"tls_certificate_certificate_provider_instance found.");
|
1470
|
+
}
|
1471
|
+
}
|
1472
|
+
}
|
1473
|
+
}
|
1474
|
+
return GRPC_ERROR_NONE;
|
1475
|
+
}
|
1476
|
+
|
1477
|
+
grpc_error* LdsResponseParse(
|
1478
|
+
XdsClient* client, TraceFlag* tracer, upb_symtab* symtab,
|
1479
|
+
const envoy_service_discovery_v3_DiscoveryResponse* response,
|
1480
|
+
const std::set<absl::string_view>& expected_listener_names,
|
1481
|
+
XdsApi::LdsUpdateMap* lds_update_map,
|
1482
|
+
std::set<std::string>* resource_names_failed, upb_arena* arena) {
|
1483
|
+
std::vector<grpc_error*> errors;
|
1484
|
+
// Get the resources from the response.
|
1485
|
+
size_t size;
|
1486
|
+
const google_protobuf_Any* const* resources =
|
1487
|
+
envoy_service_discovery_v3_DiscoveryResponse_resources(response, &size);
|
1488
|
+
for (size_t i = 0; i < size; ++i) {
|
1489
|
+
// Check the type_url of the resource.
|
1490
|
+
absl::string_view type_url =
|
1491
|
+
UpbStringToAbsl(google_protobuf_Any_type_url(resources[i]));
|
1492
|
+
if (!IsLds(type_url)) {
|
1493
|
+
errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
1494
|
+
absl::StrCat("resource index ", i, ": Resource is not LDS.")
|
1495
|
+
.c_str()));
|
1496
|
+
continue;
|
1497
|
+
}
|
1498
|
+
// Decode the listener.
|
1499
|
+
const upb_strview encoded_listener =
|
1500
|
+
google_protobuf_Any_value(resources[i]);
|
1501
|
+
const envoy_config_listener_v3_Listener* listener =
|
1502
|
+
envoy_config_listener_v3_Listener_parse(encoded_listener.data,
|
1503
|
+
encoded_listener.size, arena);
|
1504
|
+
if (listener == nullptr) {
|
1505
|
+
errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
1506
|
+
absl::StrCat("resource index ", i, ": Can't decode listener.")
|
1507
|
+
.c_str()));
|
1508
|
+
continue;
|
1509
|
+
}
|
1510
|
+
// Check listener name. Ignore unexpected listeners.
|
1511
|
+
std::string listener_name =
|
1512
|
+
UpbStringToStdString(envoy_config_listener_v3_Listener_name(listener));
|
1513
|
+
if (expected_listener_names.find(listener_name) ==
|
1514
|
+
expected_listener_names.end()) {
|
1515
|
+
continue;
|
1516
|
+
}
|
1517
|
+
// Fail if listener name is duplicated.
|
1518
|
+
if (lds_update_map->find(listener_name) != lds_update_map->end()) {
|
1519
|
+
errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
1520
|
+
absl::StrCat("duplicate listener name \"", listener_name, "\"")
|
1521
|
+
.c_str()));
|
1522
|
+
resource_names_failed->insert(listener_name);
|
1523
|
+
continue;
|
1524
|
+
}
|
1525
|
+
XdsApi::LdsUpdate& lds_update = (*lds_update_map)[listener_name];
|
1526
|
+
// Check whether it's a client or server listener.
|
1527
|
+
const envoy_config_listener_v3_ApiListener* api_listener =
|
1528
|
+
envoy_config_listener_v3_Listener_api_listener(listener);
|
1529
|
+
const envoy_config_core_v3_Address* address =
|
1530
|
+
envoy_config_listener_v3_Listener_address(listener);
|
1531
|
+
if (api_listener != nullptr && address != nullptr) {
|
1532
|
+
errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
1533
|
+
absl::StrCat(listener_name,
|
1534
|
+
": Listener has both address and ApiListener")
|
1535
|
+
.c_str()));
|
1536
|
+
resource_names_failed->insert(listener_name);
|
1537
|
+
continue;
|
1538
|
+
}
|
1539
|
+
if (api_listener == nullptr && address == nullptr) {
|
1540
|
+
errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
1541
|
+
absl::StrCat(listener_name,
|
1542
|
+
": Listener has neither address nor ApiListener")
|
1543
|
+
.c_str()));
|
1544
|
+
resource_names_failed->insert(listener_name);
|
1545
|
+
continue;
|
1546
|
+
}
|
1547
|
+
grpc_error* error = GRPC_ERROR_NONE;
|
1548
|
+
if (api_listener != nullptr) {
|
1549
|
+
error = LdsResponseParseClient(client, tracer, symtab, arena,
|
1550
|
+
api_listener, &lds_update);
|
1551
|
+
} else {
|
1552
|
+
error = LdsResponseParseServer(arena, listener, listener_name, address,
|
1553
|
+
&lds_update);
|
1554
|
+
}
|
1555
|
+
if (error != GRPC_ERROR_NONE) {
|
1556
|
+
errors.push_back(grpc_error_add_child(
|
1557
|
+
GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
1558
|
+
absl::StrCat(listener_name, ": validation error").c_str()),
|
1559
|
+
error));
|
1560
|
+
resource_names_failed->insert(listener_name);
|
1561
|
+
}
|
1562
|
+
}
|
1563
|
+
return GRPC_ERROR_CREATE_FROM_VECTOR("errors parsing LDS response", &errors);
|
1564
|
+
}
|
1565
|
+
|
1566
|
+
grpc_error* RdsResponseParse(
|
1567
|
+
XdsClient* client, TraceFlag* tracer, upb_symtab* symtab,
|
1568
|
+
const envoy_service_discovery_v3_DiscoveryResponse* response,
|
1569
|
+
const std::set<absl::string_view>& expected_route_configuration_names,
|
1570
|
+
XdsApi::RdsUpdateMap* rds_update_map,
|
1571
|
+
std::set<std::string>* resource_names_failed, upb_arena* arena) {
|
1572
|
+
std::vector<grpc_error*> errors;
|
1573
|
+
// Get the resources from the response.
|
1574
|
+
size_t size;
|
1575
|
+
const google_protobuf_Any* const* resources =
|
1576
|
+
envoy_service_discovery_v3_DiscoveryResponse_resources(response, &size);
|
1577
|
+
for (size_t i = 0; i < size; ++i) {
|
1578
|
+
// Check the type_url of the resource.
|
1579
|
+
absl::string_view type_url =
|
1580
|
+
UpbStringToAbsl(google_protobuf_Any_type_url(resources[i]));
|
1581
|
+
if (!IsRds(type_url)) {
|
1582
|
+
errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
1583
|
+
absl::StrCat("resource index ", i, ": Resource is not RDS.")
|
1584
|
+
.c_str()));
|
1585
|
+
continue;
|
1586
|
+
}
|
1587
|
+
// Decode the route_config.
|
1588
|
+
const upb_strview encoded_route_config =
|
1589
|
+
google_protobuf_Any_value(resources[i]);
|
1590
|
+
const envoy_config_route_v3_RouteConfiguration* route_config =
|
1591
|
+
envoy_config_route_v3_RouteConfiguration_parse(
|
1592
|
+
encoded_route_config.data, encoded_route_config.size, arena);
|
1593
|
+
if (route_config == nullptr) {
|
1594
|
+
errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
1595
|
+
absl::StrCat("resource index ", i, ": Can't decode route_config.")
|
1596
|
+
.c_str()));
|
1597
|
+
continue;
|
1598
|
+
}
|
1599
|
+
// Check route_config_name. Ignore unexpected route_config.
|
1600
|
+
std::string route_config_name = UpbStringToStdString(
|
1601
|
+
envoy_config_route_v3_RouteConfiguration_name(route_config));
|
1602
|
+
if (expected_route_configuration_names.find(route_config_name) ==
|
1603
|
+
expected_route_configuration_names.end()) {
|
1604
|
+
continue;
|
1605
|
+
}
|
1606
|
+
// Fail if route config name is duplicated.
|
1607
|
+
if (rds_update_map->find(route_config_name) != rds_update_map->end()) {
|
1608
|
+
errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
1609
|
+
absl::StrCat("duplicate route config name \"", route_config_name,
|
1610
|
+
"\"")
|
1611
|
+
.c_str()));
|
1612
|
+
resource_names_failed->insert(route_config_name);
|
1613
|
+
continue;
|
1614
|
+
}
|
1615
|
+
// Parse the route_config.
|
1616
|
+
XdsApi::RdsUpdate& rds_update = (*rds_update_map)[route_config_name];
|
1617
|
+
grpc_error* error =
|
1618
|
+
RouteConfigParse(client, tracer, symtab, route_config, &rds_update);
|
1619
|
+
if (error != GRPC_ERROR_NONE) {
|
1620
|
+
errors.push_back(grpc_error_add_child(
|
1621
|
+
GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
1622
|
+
absl::StrCat(route_config_name, ": validation error").c_str()),
|
1623
|
+
error));
|
1624
|
+
resource_names_failed->insert(route_config_name);
|
1625
|
+
}
|
1626
|
+
}
|
1627
|
+
return GRPC_ERROR_CREATE_FROM_VECTOR("errors parsing RDS response", &errors);
|
1628
|
+
}
|
1629
|
+
|
1630
|
+
grpc_error* CdsResponseParse(
|
1631
|
+
XdsClient* client, TraceFlag* tracer, upb_symtab* symtab,
|
1632
|
+
const envoy_service_discovery_v3_DiscoveryResponse* response,
|
1633
|
+
const std::set<absl::string_view>& expected_cluster_names,
|
1634
|
+
XdsApi::CdsUpdateMap* cds_update_map,
|
1635
|
+
std::set<std::string>* resource_names_failed, upb_arena* arena) {
|
1636
|
+
std::vector<grpc_error*> errors;
|
1637
|
+
// Get the resources from the response.
|
1638
|
+
size_t size;
|
1639
|
+
const google_protobuf_Any* const* resources =
|
1640
|
+
envoy_service_discovery_v3_DiscoveryResponse_resources(response, &size);
|
1641
|
+
// Parse all the resources in the CDS response.
|
1642
|
+
for (size_t i = 0; i < size; ++i) {
|
1643
|
+
// Check the type_url of the resource.
|
1644
|
+
absl::string_view type_url =
|
1645
|
+
UpbStringToAbsl(google_protobuf_Any_type_url(resources[i]));
|
1646
|
+
if (!IsCds(type_url)) {
|
1647
|
+
errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
1648
|
+
absl::StrCat("resource index ", i, ": Resource is not CDS.")
|
1649
|
+
.c_str()));
|
1650
|
+
continue;
|
1651
|
+
}
|
1652
|
+
// Decode the cluster.
|
1653
|
+
const upb_strview encoded_cluster = google_protobuf_Any_value(resources[i]);
|
1654
|
+
const envoy_config_cluster_v3_Cluster* cluster =
|
1655
|
+
envoy_config_cluster_v3_Cluster_parse(encoded_cluster.data,
|
1656
|
+
encoded_cluster.size, arena);
|
1657
|
+
if (cluster == nullptr) {
|
1658
|
+
errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
1659
|
+
absl::StrCat("resource index ", i, ": Can't decode cluster.")
|
1660
|
+
.c_str()));
|
1661
|
+
continue;
|
1662
|
+
}
|
1663
|
+
MaybeLogCluster(client, tracer, symtab, cluster);
|
1664
|
+
// Ignore unexpected cluster names.
|
1665
|
+
std::string cluster_name =
|
1666
|
+
UpbStringToStdString(envoy_config_cluster_v3_Cluster_name(cluster));
|
1667
|
+
if (expected_cluster_names.find(cluster_name) ==
|
1668
|
+
expected_cluster_names.end()) {
|
1669
|
+
continue;
|
1670
|
+
}
|
1671
|
+
// Fail on duplicate resources.
|
1672
|
+
if (cds_update_map->find(cluster_name) != cds_update_map->end()) {
|
1673
|
+
errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
1674
|
+
absl::StrCat("duplicate resource name \"", cluster_name, "\"")
|
1675
|
+
.c_str()));
|
1676
|
+
resource_names_failed->insert(cluster_name);
|
1677
|
+
continue;
|
1678
|
+
}
|
1679
|
+
XdsApi::CdsUpdate& cds_update = (*cds_update_map)[cluster_name];
|
1680
|
+
// Check the cluster_discovery_type.
|
1681
|
+
if (!envoy_config_cluster_v3_Cluster_has_type(cluster) &&
|
1682
|
+
!envoy_config_cluster_v3_Cluster_has_cluster_type(cluster)) {
|
1683
|
+
errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
1684
|
+
absl::StrCat(cluster_name, ": DiscoveryType not found.").c_str()));
|
1685
|
+
resource_names_failed->insert(cluster_name);
|
1686
|
+
continue;
|
1687
|
+
}
|
1688
|
+
if (envoy_config_cluster_v3_Cluster_type(cluster) ==
|
1689
|
+
envoy_config_cluster_v3_Cluster_EDS) {
|
1690
|
+
cds_update.cluster_type = XdsApi::CdsUpdate::ClusterType::EDS;
|
1691
|
+
// Check the EDS config source.
|
1692
|
+
const envoy_config_cluster_v3_Cluster_EdsClusterConfig*
|
1693
|
+
eds_cluster_config =
|
1694
|
+
envoy_config_cluster_v3_Cluster_eds_cluster_config(cluster);
|
1695
|
+
const envoy_config_core_v3_ConfigSource* eds_config =
|
1696
|
+
envoy_config_cluster_v3_Cluster_EdsClusterConfig_eds_config(
|
1697
|
+
eds_cluster_config);
|
1698
|
+
if (!envoy_config_core_v3_ConfigSource_has_ads(eds_config)) {
|
1699
|
+
errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
1700
|
+
absl::StrCat(cluster_name, ": EDS ConfigSource is not ADS.")
|
1701
|
+
.c_str()));
|
1702
|
+
resource_names_failed->insert(cluster_name);
|
1703
|
+
continue;
|
1704
|
+
}
|
1705
|
+
// Record EDS service_name (if any).
|
1706
|
+
upb_strview service_name =
|
1707
|
+
envoy_config_cluster_v3_Cluster_EdsClusterConfig_service_name(
|
1708
|
+
eds_cluster_config);
|
1709
|
+
if (service_name.size != 0) {
|
1710
|
+
cds_update.eds_service_name = UpbStringToStdString(service_name);
|
1711
|
+
}
|
1712
|
+
} else if (!XdsAggregateAndLogicalDnsClusterEnabled()) {
|
1713
|
+
errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
1714
|
+
absl::StrCat(cluster_name, ": DiscoveryType is not valid.").c_str()));
|
1715
|
+
resource_names_failed->insert(cluster_name);
|
1716
|
+
continue;
|
1717
|
+
} else if (envoy_config_cluster_v3_Cluster_type(cluster) ==
|
1718
|
+
envoy_config_cluster_v3_Cluster_LOGICAL_DNS) {
|
1719
|
+
cds_update.cluster_type = XdsApi::CdsUpdate::ClusterType::LOGICAL_DNS;
|
1720
|
+
} else {
|
1721
|
+
if (envoy_config_cluster_v3_Cluster_has_cluster_type(cluster)) {
|
1722
|
+
const envoy_config_cluster_v3_Cluster_CustomClusterType*
|
1723
|
+
custom_cluster_type =
|
1724
|
+
envoy_config_cluster_v3_Cluster_cluster_type(cluster);
|
1725
|
+
upb_strview type_name =
|
1726
|
+
envoy_config_cluster_v3_Cluster_CustomClusterType_name(
|
1727
|
+
custom_cluster_type);
|
1728
|
+
if (UpbStringToAbsl(type_name) == "envoy.clusters.aggregate") {
|
1729
|
+
cds_update.cluster_type = XdsApi::CdsUpdate::ClusterType::AGGREGATE;
|
1730
|
+
// Retrieve aggregate clusters.
|
1731
|
+
const google_protobuf_Any* typed_config =
|
1732
|
+
envoy_config_cluster_v3_Cluster_CustomClusterType_typed_config(
|
1733
|
+
custom_cluster_type);
|
1734
|
+
const upb_strview aggregate_cluster_config_upb_strview =
|
1735
|
+
google_protobuf_Any_value(typed_config);
|
1736
|
+
const envoy_extensions_clusters_aggregate_v3_ClusterConfig*
|
1737
|
+
aggregate_cluster_config =
|
1738
|
+
envoy_extensions_clusters_aggregate_v3_ClusterConfig_parse(
|
1739
|
+
aggregate_cluster_config_upb_strview.data,
|
1740
|
+
aggregate_cluster_config_upb_strview.size, arena);
|
1741
|
+
if (aggregate_cluster_config == nullptr) {
|
1742
|
+
errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
1743
|
+
absl::StrCat(cluster_name, ": Can't parse aggregate cluster.")
|
1744
|
+
.c_str()));
|
1745
|
+
resource_names_failed->insert(cluster_name);
|
1746
|
+
continue;
|
1747
|
+
}
|
1748
|
+
size_t size;
|
1749
|
+
const upb_strview* clusters =
|
1750
|
+
envoy_extensions_clusters_aggregate_v3_ClusterConfig_clusters(
|
1751
|
+
aggregate_cluster_config, &size);
|
1752
|
+
for (size_t i = 0; i < size; ++i) {
|
1753
|
+
const upb_strview cluster = clusters[i];
|
1754
|
+
cds_update.prioritized_cluster_names.emplace_back(
|
1755
|
+
UpbStringToStdString(cluster));
|
1756
|
+
}
|
1757
|
+
} else {
|
1758
|
+
errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
1759
|
+
absl::StrCat(cluster_name, ": DiscoveryType is not valid.")
|
1760
|
+
.c_str()));
|
1761
|
+
resource_names_failed->insert(cluster_name);
|
1762
|
+
continue;
|
1763
|
+
}
|
1764
|
+
} else {
|
1765
|
+
errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
1766
|
+
absl::StrCat(cluster_name, ": DiscoveryType is not valid.")
|
1767
|
+
.c_str()));
|
1768
|
+
resource_names_failed->insert(cluster_name);
|
1769
|
+
continue;
|
1770
|
+
}
|
1771
|
+
}
|
1772
|
+
// Check the LB policy.
|
1773
|
+
if (envoy_config_cluster_v3_Cluster_lb_policy(cluster) ==
|
1774
|
+
envoy_config_cluster_v3_Cluster_ROUND_ROBIN) {
|
1775
|
+
cds_update.lb_policy = "ROUND_ROBIN";
|
1776
|
+
} else if (XdsRingHashEnabled() &&
|
1777
|
+
envoy_config_cluster_v3_Cluster_lb_policy(cluster) ==
|
1778
|
+
envoy_config_cluster_v3_Cluster_RING_HASH) {
|
1779
|
+
cds_update.lb_policy = "RING_HASH";
|
1780
|
+
// Record ring hash lb config
|
1781
|
+
auto* ring_hash_config =
|
1782
|
+
envoy_config_cluster_v3_Cluster_ring_hash_lb_config(cluster);
|
1783
|
+
if (ring_hash_config == nullptr) {
|
1784
|
+
errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
1785
|
+
absl::StrCat(cluster_name,
|
1786
|
+
": ring hash lb config required but not present.")
|
1787
|
+
.c_str()));
|
1788
|
+
resource_names_failed->insert(cluster_name);
|
1789
|
+
continue;
|
1790
|
+
}
|
1791
|
+
const google_protobuf_UInt64Value* max_ring_size =
|
1792
|
+
envoy_config_cluster_v3_Cluster_RingHashLbConfig_maximum_ring_size(
|
1793
|
+
ring_hash_config);
|
1794
|
+
if (max_ring_size != nullptr) {
|
1795
|
+
cds_update.max_ring_size =
|
1796
|
+
google_protobuf_UInt64Value_value(max_ring_size);
|
1797
|
+
if (cds_update.max_ring_size > 8388608 ||
|
1798
|
+
cds_update.max_ring_size == 0) {
|
1799
|
+
errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
1800
|
+
absl::StrCat(
|
1801
|
+
cluster_name,
|
1802
|
+
": max_ring_size is not in the range of 1 to 8388608.")
|
1803
|
+
.c_str()));
|
1804
|
+
resource_names_failed->insert(cluster_name);
|
1805
|
+
continue;
|
1806
|
+
}
|
1807
|
+
}
|
1808
|
+
const google_protobuf_UInt64Value* min_ring_size =
|
1809
|
+
envoy_config_cluster_v3_Cluster_RingHashLbConfig_minimum_ring_size(
|
1810
|
+
ring_hash_config);
|
1811
|
+
if (min_ring_size != nullptr) {
|
1812
|
+
cds_update.min_ring_size =
|
1813
|
+
google_protobuf_UInt64Value_value(min_ring_size);
|
1814
|
+
if (cds_update.min_ring_size > 8388608 ||
|
1815
|
+
cds_update.min_ring_size == 0) {
|
1816
|
+
errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
1817
|
+
absl::StrCat(
|
1818
|
+
cluster_name,
|
1819
|
+
": min_ring_size is not in the range of 1 to 8388608.")
|
1820
|
+
.c_str()));
|
1821
|
+
resource_names_failed->insert(cluster_name);
|
1822
|
+
continue;
|
1823
|
+
}
|
1824
|
+
if (cds_update.min_ring_size > cds_update.max_ring_size) {
|
1825
|
+
errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
1826
|
+
absl::StrCat(
|
1827
|
+
cluster_name,
|
1828
|
+
": min_ring_size cannot be greater than max_ring_size.")
|
1829
|
+
.c_str()));
|
1830
|
+
resource_names_failed->insert(cluster_name);
|
1831
|
+
continue;
|
1832
|
+
}
|
1833
|
+
}
|
1834
|
+
if (envoy_config_cluster_v3_Cluster_RingHashLbConfig_hash_function(
|
1835
|
+
ring_hash_config) ==
|
1836
|
+
envoy_config_cluster_v3_Cluster_RingHashLbConfig_XX_HASH) {
|
1837
|
+
cds_update.hash_function = XdsApi::CdsUpdate::HashFunction::XX_HASH;
|
1838
|
+
} else if (
|
1839
|
+
envoy_config_cluster_v3_Cluster_RingHashLbConfig_hash_function(
|
1840
|
+
ring_hash_config) ==
|
1841
|
+
envoy_config_cluster_v3_Cluster_RingHashLbConfig_MURMUR_HASH_2) {
|
1842
|
+
cds_update.hash_function =
|
1843
|
+
XdsApi::CdsUpdate::HashFunction::MURMUR_HASH_2;
|
1844
|
+
} else {
|
1845
|
+
errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
1846
|
+
absl::StrCat(cluster_name,
|
1847
|
+
": ring hash lb config has invalid hash function.")
|
1848
|
+
.c_str()));
|
1849
|
+
resource_names_failed->insert(cluster_name);
|
1850
|
+
continue;
|
1851
|
+
}
|
1852
|
+
} else {
|
1853
|
+
errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
1854
|
+
absl::StrCat(cluster_name, ": LB policy is not supported.").c_str()));
|
1855
|
+
resource_names_failed->insert(cluster_name);
|
1856
|
+
continue;
|
1857
|
+
}
|
1858
|
+
if (XdsSecurityEnabled()) {
|
1859
|
+
// Record Upstream tls context
|
1860
|
+
auto* transport_socket =
|
1861
|
+
envoy_config_cluster_v3_Cluster_transport_socket(cluster);
|
1862
|
+
if (transport_socket != nullptr) {
|
1863
|
+
absl::string_view name = UpbStringToAbsl(
|
1864
|
+
envoy_config_core_v3_TransportSocket_name(transport_socket));
|
1865
|
+
if (name == "envoy.transport_sockets.tls") {
|
1866
|
+
auto* typed_config =
|
1867
|
+
envoy_config_core_v3_TransportSocket_typed_config(
|
1868
|
+
transport_socket);
|
1869
|
+
if (typed_config != nullptr) {
|
1870
|
+
const upb_strview encoded_upstream_tls_context =
|
1871
|
+
google_protobuf_Any_value(typed_config);
|
1872
|
+
auto* upstream_tls_context =
|
1873
|
+
envoy_extensions_transport_sockets_tls_v3_UpstreamTlsContext_parse(
|
1874
|
+
encoded_upstream_tls_context.data,
|
1875
|
+
encoded_upstream_tls_context.size, arena);
|
1876
|
+
if (upstream_tls_context == nullptr) {
|
1877
|
+
errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
1878
|
+
absl::StrCat(cluster_name,
|
1879
|
+
": Can't decode upstream tls context.")
|
1880
|
+
.c_str()));
|
1881
|
+
resource_names_failed->insert(cluster_name);
|
1882
|
+
continue;
|
1883
|
+
}
|
1884
|
+
auto* common_tls_context =
|
1885
|
+
envoy_extensions_transport_sockets_tls_v3_UpstreamTlsContext_common_tls_context(
|
1886
|
+
upstream_tls_context);
|
1887
|
+
if (common_tls_context != nullptr) {
|
1888
|
+
grpc_error* error = CommonTlsContextParse(
|
1889
|
+
common_tls_context, &cds_update.common_tls_context);
|
1890
|
+
if (error != GRPC_ERROR_NONE) {
|
1891
|
+
errors.push_back(grpc_error_add_child(
|
1892
|
+
GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
1893
|
+
absl::StrCat(cluster_name, ": error in TLS context")
|
1894
|
+
.c_str()),
|
1895
|
+
error));
|
1896
|
+
resource_names_failed->insert(cluster_name);
|
1897
|
+
continue;
|
1898
|
+
}
|
1899
|
+
}
|
1900
|
+
}
|
1901
|
+
if (cds_update.common_tls_context.combined_validation_context
|
1902
|
+
.validation_context_certificate_provider_instance
|
1903
|
+
.instance_name.empty()) {
|
1904
|
+
errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
1905
|
+
absl::StrCat(cluster_name,
|
1906
|
+
"TLS configuration provided but no "
|
1907
|
+
"validation_context_certificate_provider_instance "
|
1908
|
+
"found.")
|
1909
|
+
.c_str()));
|
1910
|
+
resource_names_failed->insert(cluster_name);
|
1911
|
+
continue;
|
1912
|
+
}
|
1913
|
+
}
|
1914
|
+
}
|
1915
|
+
}
|
1916
|
+
// Record LRS server name (if any).
|
1917
|
+
const envoy_config_core_v3_ConfigSource* lrs_server =
|
1918
|
+
envoy_config_cluster_v3_Cluster_lrs_server(cluster);
|
1919
|
+
if (lrs_server != nullptr) {
|
1920
|
+
if (!envoy_config_core_v3_ConfigSource_has_self(lrs_server)) {
|
1921
|
+
errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
1922
|
+
absl::StrCat(cluster_name, ": LRS ConfigSource is not self.")
|
1923
|
+
.c_str()));
|
1924
|
+
resource_names_failed->insert(cluster_name);
|
1925
|
+
continue;
|
1926
|
+
}
|
1927
|
+
cds_update.lrs_load_reporting_server_name.emplace("");
|
1928
|
+
}
|
1929
|
+
// The Cluster resource encodes the circuit breaking parameters in a list of
|
1930
|
+
// Thresholds messages, where each message specifies the parameters for a
|
1931
|
+
// particular RoutingPriority. we will look only at the first entry in the
|
1932
|
+
// list for priority DEFAULT and default to 1024 if not found.
|
1933
|
+
if (envoy_config_cluster_v3_Cluster_has_circuit_breakers(cluster)) {
|
1934
|
+
const envoy_config_cluster_v3_CircuitBreakers* circuit_breakers =
|
1935
|
+
envoy_config_cluster_v3_Cluster_circuit_breakers(cluster);
|
1936
|
+
size_t num_thresholds;
|
1937
|
+
const envoy_config_cluster_v3_CircuitBreakers_Thresholds* const*
|
1938
|
+
thresholds = envoy_config_cluster_v3_CircuitBreakers_thresholds(
|
1939
|
+
circuit_breakers, &num_thresholds);
|
1940
|
+
for (size_t i = 0; i < num_thresholds; ++i) {
|
1941
|
+
const auto* threshold = thresholds[i];
|
1942
|
+
if (envoy_config_cluster_v3_CircuitBreakers_Thresholds_priority(
|
1943
|
+
threshold) == envoy_config_core_v3_DEFAULT) {
|
1944
|
+
const google_protobuf_UInt32Value* max_requests =
|
1945
|
+
envoy_config_cluster_v3_CircuitBreakers_Thresholds_max_requests(
|
1946
|
+
threshold);
|
1947
|
+
if (max_requests != nullptr) {
|
1948
|
+
cds_update.max_concurrent_requests =
|
1949
|
+
google_protobuf_UInt32Value_value(max_requests);
|
1950
|
+
}
|
1951
|
+
break;
|
1952
|
+
}
|
1953
|
+
}
|
1954
|
+
}
|
1955
|
+
}
|
1956
|
+
return GRPC_ERROR_CREATE_FROM_VECTOR("errors parsing CDS response", &errors);
|
1957
|
+
}
|
1958
|
+
|
1959
|
+
grpc_error* ServerAddressParseAndAppend(
|
1960
|
+
const envoy_config_endpoint_v3_LbEndpoint* lb_endpoint,
|
1961
|
+
ServerAddressList* list) {
|
1962
|
+
// If health_status is not HEALTHY or UNKNOWN, skip this endpoint.
|
1963
|
+
const int32_t health_status =
|
1964
|
+
envoy_config_endpoint_v3_LbEndpoint_health_status(lb_endpoint);
|
1965
|
+
if (health_status != envoy_config_core_v3_UNKNOWN &&
|
1966
|
+
health_status != envoy_config_core_v3_HEALTHY) {
|
1967
|
+
return GRPC_ERROR_NONE;
|
1968
|
+
}
|
1969
|
+
// Find the ip:port.
|
1970
|
+
const envoy_config_endpoint_v3_Endpoint* endpoint =
|
1971
|
+
envoy_config_endpoint_v3_LbEndpoint_endpoint(lb_endpoint);
|
1972
|
+
const envoy_config_core_v3_Address* address =
|
1973
|
+
envoy_config_endpoint_v3_Endpoint_address(endpoint);
|
1974
|
+
const envoy_config_core_v3_SocketAddress* socket_address =
|
1975
|
+
envoy_config_core_v3_Address_socket_address(address);
|
1976
|
+
std::string address_str = UpbStringToStdString(
|
1977
|
+
envoy_config_core_v3_SocketAddress_address(socket_address));
|
1978
|
+
uint32_t port = envoy_config_core_v3_SocketAddress_port_value(socket_address);
|
1979
|
+
if (GPR_UNLIKELY(port >> 16) != 0) {
|
1980
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING("Invalid port.");
|
1981
|
+
}
|
1982
|
+
// Populate grpc_resolved_address.
|
1983
|
+
grpc_resolved_address addr;
|
1984
|
+
grpc_string_to_sockaddr(&addr, address_str.c_str(), port);
|
1985
|
+
// Append the address to the list.
|
1986
|
+
list->emplace_back(addr, nullptr);
|
1987
|
+
return GRPC_ERROR_NONE;
|
1988
|
+
}
|
1989
|
+
|
1990
|
+
grpc_error* LocalityParse(
|
1991
|
+
const envoy_config_endpoint_v3_LocalityLbEndpoints* locality_lb_endpoints,
|
1992
|
+
XdsApi::EdsUpdate::Priority::Locality* output_locality, size_t* priority) {
|
1993
|
+
// Parse LB weight.
|
1994
|
+
const google_protobuf_UInt32Value* lb_weight =
|
1995
|
+
envoy_config_endpoint_v3_LocalityLbEndpoints_load_balancing_weight(
|
1996
|
+
locality_lb_endpoints);
|
1997
|
+
// If LB weight is not specified, it means this locality is assigned no load.
|
1998
|
+
// TODO(juanlishen): When we support CDS to configure the inter-locality
|
1999
|
+
// policy, we should change the LB weight handling.
|
2000
|
+
output_locality->lb_weight =
|
2001
|
+
lb_weight != nullptr ? google_protobuf_UInt32Value_value(lb_weight) : 0;
|
2002
|
+
if (output_locality->lb_weight == 0) return GRPC_ERROR_NONE;
|
2003
|
+
// Parse locality name.
|
2004
|
+
const envoy_config_core_v3_Locality* locality =
|
2005
|
+
envoy_config_endpoint_v3_LocalityLbEndpoints_locality(
|
2006
|
+
locality_lb_endpoints);
|
2007
|
+
std::string region =
|
2008
|
+
UpbStringToStdString(envoy_config_core_v3_Locality_region(locality));
|
2009
|
+
std::string zone =
|
2010
|
+
UpbStringToStdString(envoy_config_core_v3_Locality_region(locality));
|
2011
|
+
std::string sub_zone =
|
2012
|
+
UpbStringToStdString(envoy_config_core_v3_Locality_sub_zone(locality));
|
2013
|
+
output_locality->name = MakeRefCounted<XdsLocalityName>(
|
2014
|
+
std::move(region), std::move(zone), std::move(sub_zone));
|
2015
|
+
// Parse the addresses.
|
2016
|
+
size_t size;
|
2017
|
+
const envoy_config_endpoint_v3_LbEndpoint* const* lb_endpoints =
|
2018
|
+
envoy_config_endpoint_v3_LocalityLbEndpoints_lb_endpoints(
|
2019
|
+
locality_lb_endpoints, &size);
|
2020
|
+
for (size_t i = 0; i < size; ++i) {
|
2021
|
+
grpc_error* error = ServerAddressParseAndAppend(
|
2022
|
+
lb_endpoints[i], &output_locality->endpoints);
|
2023
|
+
if (error != GRPC_ERROR_NONE) return error;
|
2024
|
+
}
|
2025
|
+
// Parse the priority.
|
2026
|
+
*priority = envoy_config_endpoint_v3_LocalityLbEndpoints_priority(
|
2027
|
+
locality_lb_endpoints);
|
2028
|
+
return GRPC_ERROR_NONE;
|
2029
|
+
}
|
2030
|
+
|
2031
|
+
grpc_error* DropParseAndAppend(
|
2032
|
+
const envoy_config_endpoint_v3_ClusterLoadAssignment_Policy_DropOverload*
|
2033
|
+
drop_overload,
|
2034
|
+
XdsApi::EdsUpdate::DropConfig* drop_config) {
|
2035
|
+
// Get the category.
|
2036
|
+
std::string category = UpbStringToStdString(
|
2037
|
+
envoy_config_endpoint_v3_ClusterLoadAssignment_Policy_DropOverload_category(
|
2038
|
+
drop_overload));
|
2039
|
+
if (category.empty()) {
|
2040
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING("Empty drop category name");
|
2041
|
+
}
|
2042
|
+
// Get the drop rate (per million).
|
2043
|
+
const envoy_type_v3_FractionalPercent* drop_percentage =
|
2044
|
+
envoy_config_endpoint_v3_ClusterLoadAssignment_Policy_DropOverload_drop_percentage(
|
2045
|
+
drop_overload);
|
2046
|
+
uint32_t numerator =
|
2047
|
+
envoy_type_v3_FractionalPercent_numerator(drop_percentage);
|
2048
|
+
const auto denominator =
|
2049
|
+
static_cast<envoy_type_v3_FractionalPercent_DenominatorType>(
|
2050
|
+
envoy_type_v3_FractionalPercent_denominator(drop_percentage));
|
2051
|
+
// Normalize to million.
|
2052
|
+
switch (denominator) {
|
2053
|
+
case envoy_type_v3_FractionalPercent_HUNDRED:
|
2054
|
+
numerator *= 10000;
|
2055
|
+
break;
|
2056
|
+
case envoy_type_v3_FractionalPercent_TEN_THOUSAND:
|
2057
|
+
numerator *= 100;
|
2058
|
+
break;
|
2059
|
+
case envoy_type_v3_FractionalPercent_MILLION:
|
2060
|
+
break;
|
2061
|
+
default:
|
2062
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING("Unknown denominator type");
|
2063
|
+
}
|
2064
|
+
// Cap numerator to 1000000.
|
2065
|
+
numerator = GPR_MIN(numerator, 1000000);
|
2066
|
+
drop_config->AddCategory(std::move(category), numerator);
|
2067
|
+
return GRPC_ERROR_NONE;
|
2068
|
+
}
|
2069
|
+
|
2070
|
+
grpc_error* EdsResponseParse(
|
2071
|
+
XdsClient* client, TraceFlag* tracer, upb_symtab* symtab,
|
2072
|
+
const envoy_service_discovery_v3_DiscoveryResponse* response,
|
2073
|
+
const std::set<absl::string_view>& expected_eds_service_names,
|
2074
|
+
XdsApi::EdsUpdateMap* eds_update_map,
|
2075
|
+
std::set<std::string>* resource_names_failed, upb_arena* arena) {
|
2076
|
+
std::vector<grpc_error*> errors;
|
2077
|
+
// Get the resources from the response.
|
2078
|
+
size_t size;
|
2079
|
+
const google_protobuf_Any* const* resources =
|
2080
|
+
envoy_service_discovery_v3_DiscoveryResponse_resources(response, &size);
|
2081
|
+
for (size_t i = 0; i < size; ++i) {
|
2082
|
+
// Check the type_url of the resource.
|
2083
|
+
absl::string_view type_url =
|
2084
|
+
UpbStringToAbsl(google_protobuf_Any_type_url(resources[i]));
|
2085
|
+
if (!IsEds(type_url)) {
|
2086
|
+
errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
2087
|
+
absl::StrCat("resource index ", i, ": Resource is not EDS.")
|
2088
|
+
.c_str()));
|
2089
|
+
continue;
|
2090
|
+
}
|
2091
|
+
// Get the cluster_load_assignment.
|
2092
|
+
upb_strview encoded_cluster_load_assignment =
|
2093
|
+
google_protobuf_Any_value(resources[i]);
|
2094
|
+
envoy_config_endpoint_v3_ClusterLoadAssignment* cluster_load_assignment =
|
2095
|
+
envoy_config_endpoint_v3_ClusterLoadAssignment_parse(
|
2096
|
+
encoded_cluster_load_assignment.data,
|
2097
|
+
encoded_cluster_load_assignment.size, arena);
|
2098
|
+
if (cluster_load_assignment == nullptr) {
|
2099
|
+
errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
2100
|
+
absl::StrCat("resource index ", i,
|
2101
|
+
": Can't parse cluster_load_assignment.")
|
2102
|
+
.c_str()));
|
2103
|
+
continue;
|
2104
|
+
}
|
2105
|
+
MaybeLogClusterLoadAssignment(client, tracer, symtab,
|
2106
|
+
cluster_load_assignment);
|
2107
|
+
// Check the EDS service name. Ignore unexpected names.
|
2108
|
+
std::string eds_service_name = UpbStringToStdString(
|
2109
|
+
envoy_config_endpoint_v3_ClusterLoadAssignment_cluster_name(
|
2110
|
+
cluster_load_assignment));
|
2111
|
+
if (expected_eds_service_names.find(eds_service_name) ==
|
2112
|
+
expected_eds_service_names.end()) {
|
2113
|
+
continue;
|
2114
|
+
}
|
2115
|
+
// Fail on duplicate resources.
|
2116
|
+
if (eds_update_map->find(eds_service_name) != eds_update_map->end()) {
|
2117
|
+
errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
2118
|
+
absl::StrCat("duplicate resource name \"", eds_service_name, "\"")
|
2119
|
+
.c_str()));
|
2120
|
+
resource_names_failed->insert(eds_service_name);
|
2121
|
+
continue;
|
2122
|
+
}
|
2123
|
+
XdsApi::EdsUpdate& eds_update = (*eds_update_map)[eds_service_name];
|
2124
|
+
// Get the endpoints.
|
2125
|
+
size_t locality_size;
|
2126
|
+
const envoy_config_endpoint_v3_LocalityLbEndpoints* const* endpoints =
|
2127
|
+
envoy_config_endpoint_v3_ClusterLoadAssignment_endpoints(
|
2128
|
+
cluster_load_assignment, &locality_size);
|
2129
|
+
grpc_error* error = GRPC_ERROR_NONE;
|
2130
|
+
for (size_t j = 0; j < locality_size; ++j) {
|
2131
|
+
size_t priority;
|
2132
|
+
XdsApi::EdsUpdate::Priority::Locality locality;
|
2133
|
+
error = LocalityParse(endpoints[j], &locality, &priority);
|
2134
|
+
if (error != GRPC_ERROR_NONE) break;
|
2135
|
+
// Filter out locality with weight 0.
|
2136
|
+
if (locality.lb_weight == 0) continue;
|
2137
|
+
// Make sure prorities is big enough. Note that they might not
|
2138
|
+
// arrive in priority order.
|
2139
|
+
while (eds_update.priorities.size() < priority + 1) {
|
2140
|
+
eds_update.priorities.emplace_back();
|
2141
|
+
}
|
2142
|
+
eds_update.priorities[priority].localities.emplace(locality.name.get(),
|
2143
|
+
std::move(locality));
|
2144
|
+
}
|
2145
|
+
if (error != GRPC_ERROR_NONE) {
|
2146
|
+
errors.push_back(grpc_error_add_child(
|
2147
|
+
GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
2148
|
+
absl::StrCat(eds_service_name, ": locality validation error")
|
2149
|
+
.c_str()),
|
2150
|
+
error));
|
2151
|
+
resource_names_failed->insert(eds_service_name);
|
2152
|
+
continue;
|
2153
|
+
}
|
2154
|
+
for (const auto& priority : eds_update.priorities) {
|
2155
|
+
if (priority.localities.empty()) {
|
2156
|
+
errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
2157
|
+
absl::StrCat(eds_service_name, ": sparse priority list").c_str()));
|
2158
|
+
resource_names_failed->insert(eds_service_name);
|
2159
|
+
continue;
|
2160
|
+
}
|
2161
|
+
}
|
2162
|
+
// Get the drop config.
|
2163
|
+
eds_update.drop_config = MakeRefCounted<XdsApi::EdsUpdate::DropConfig>();
|
2164
|
+
const envoy_config_endpoint_v3_ClusterLoadAssignment_Policy* policy =
|
2165
|
+
envoy_config_endpoint_v3_ClusterLoadAssignment_policy(
|
2166
|
+
cluster_load_assignment);
|
2167
|
+
if (policy != nullptr) {
|
2168
|
+
size_t drop_size;
|
2169
|
+
const envoy_config_endpoint_v3_ClusterLoadAssignment_Policy_DropOverload* const*
|
2170
|
+
drop_overload =
|
2171
|
+
envoy_config_endpoint_v3_ClusterLoadAssignment_Policy_drop_overloads(
|
2172
|
+
policy, &drop_size);
|
2173
|
+
for (size_t j = 0; j < drop_size; ++j) {
|
2174
|
+
error =
|
2175
|
+
DropParseAndAppend(drop_overload[j], eds_update.drop_config.get());
|
2176
|
+
if (error != GRPC_ERROR_NONE) break;
|
2177
|
+
}
|
2178
|
+
if (error != GRPC_ERROR_NONE) {
|
2179
|
+
errors.push_back(grpc_error_add_child(
|
2180
|
+
GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
2181
|
+
absl::StrCat(eds_service_name, ": drop config validation error")
|
2182
|
+
.c_str()),
|
2183
|
+
error));
|
2184
|
+
resource_names_failed->insert(eds_service_name);
|
2185
|
+
continue;
|
2186
|
+
}
|
2187
|
+
}
|
2188
|
+
}
|
2189
|
+
return GRPC_ERROR_CREATE_FROM_VECTOR("errors parsing EDS response", &errors);
|
2190
|
+
}
|
2191
|
+
|
2192
|
+
std::string TypeUrlInternalToExternal(absl::string_view type_url) {
|
2193
|
+
if (type_url == kLdsV2TypeUrl) {
|
2194
|
+
return XdsApi::kLdsTypeUrl;
|
2195
|
+
} else if (type_url == kRdsV2TypeUrl) {
|
2196
|
+
return XdsApi::kRdsTypeUrl;
|
2197
|
+
} else if (type_url == kCdsV2TypeUrl) {
|
2198
|
+
return XdsApi::kCdsTypeUrl;
|
2199
|
+
} else if (type_url == kEdsV2TypeUrl) {
|
2200
|
+
return XdsApi::kEdsTypeUrl;
|
2201
|
+
}
|
2202
|
+
return std::string(type_url);
|
2203
|
+
}
|
2204
|
+
|
2205
|
+
template <typename UpdateMap>
|
2206
|
+
void MoveUpdatesToFailedSet(UpdateMap* update_map,
|
2207
|
+
std::set<std::string>* resource_names_failed) {
|
2208
|
+
for (const auto& p : *update_map) {
|
2209
|
+
resource_names_failed->insert(p.first);
|
2210
|
+
}
|
2211
|
+
update_map->clear();
|
2212
|
+
}
|
2213
|
+
|
2214
|
+
} // namespace
|
2215
|
+
|
2216
|
+
XdsApi::AdsParseResult XdsApi::ParseAdsResponse(
|
2217
|
+
const grpc_slice& encoded_response,
|
2218
|
+
const std::set<absl::string_view>& expected_listener_names,
|
2219
|
+
const std::set<absl::string_view>& expected_route_configuration_names,
|
2220
|
+
const std::set<absl::string_view>& expected_cluster_names,
|
2221
|
+
const std::set<absl::string_view>& expected_eds_service_names) {
|
2222
|
+
AdsParseResult result;
|
2223
|
+
upb::Arena arena;
|
2224
|
+
// Decode the response.
|
2225
|
+
const envoy_service_discovery_v3_DiscoveryResponse* response =
|
2226
|
+
envoy_service_discovery_v3_DiscoveryResponse_parse(
|
2227
|
+
reinterpret_cast<const char*>(GRPC_SLICE_START_PTR(encoded_response)),
|
2228
|
+
GRPC_SLICE_LENGTH(encoded_response), arena.ptr());
|
2229
|
+
// If decoding fails, output an empty type_url and return.
|
2230
|
+
if (response == nullptr) {
|
2231
|
+
result.parse_error =
|
2232
|
+
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Can't decode DiscoveryResponse.");
|
2233
|
+
return result;
|
2234
|
+
}
|
2235
|
+
MaybeLogDiscoveryResponse(client_, tracer_, symtab_.ptr(), response);
|
2236
|
+
// Record the type_url, the version_info, and the nonce of the response.
|
2237
|
+
result.type_url = TypeUrlInternalToExternal(UpbStringToAbsl(
|
2238
|
+
envoy_service_discovery_v3_DiscoveryResponse_type_url(response)));
|
2239
|
+
result.version = UpbStringToStdString(
|
2240
|
+
envoy_service_discovery_v3_DiscoveryResponse_version_info(response));
|
2241
|
+
result.nonce = UpbStringToStdString(
|
2242
|
+
envoy_service_discovery_v3_DiscoveryResponse_nonce(response));
|
2243
|
+
// Parse the response according to the resource type.
|
2244
|
+
if (IsLds(result.type_url)) {
|
2245
|
+
result.parse_error = LdsResponseParse(
|
2246
|
+
client_, tracer_, symtab_.ptr(), response, expected_listener_names,
|
2247
|
+
&result.lds_update_map, &result.resource_names_failed, arena.ptr());
|
2248
|
+
if (result.parse_error != GRPC_ERROR_NONE) {
|
2249
|
+
MoveUpdatesToFailedSet(&result.lds_update_map,
|
2250
|
+
&result.resource_names_failed);
|
2251
|
+
}
|
2252
|
+
} else if (IsRds(result.type_url)) {
|
2253
|
+
result.parse_error = RdsResponseParse(
|
2254
|
+
client_, tracer_, symtab_.ptr(), response,
|
2255
|
+
expected_route_configuration_names, &result.rds_update_map,
|
2256
|
+
&result.resource_names_failed, arena.ptr());
|
2257
|
+
if (result.parse_error != GRPC_ERROR_NONE) {
|
2258
|
+
MoveUpdatesToFailedSet(&result.rds_update_map,
|
2259
|
+
&result.resource_names_failed);
|
2260
|
+
}
|
2261
|
+
} else if (IsCds(result.type_url)) {
|
2262
|
+
result.parse_error = CdsResponseParse(
|
2263
|
+
client_, tracer_, symtab_.ptr(), response, expected_cluster_names,
|
2264
|
+
&result.cds_update_map, &result.resource_names_failed, arena.ptr());
|
2265
|
+
if (result.parse_error != GRPC_ERROR_NONE) {
|
2266
|
+
MoveUpdatesToFailedSet(&result.cds_update_map,
|
2267
|
+
&result.resource_names_failed);
|
2268
|
+
}
|
2269
|
+
} else if (IsEds(result.type_url)) {
|
2270
|
+
result.parse_error = EdsResponseParse(
|
2271
|
+
client_, tracer_, symtab_.ptr(), response, expected_eds_service_names,
|
2272
|
+
&result.eds_update_map, &result.resource_names_failed, arena.ptr());
|
2273
|
+
if (result.parse_error != GRPC_ERROR_NONE) {
|
2274
|
+
MoveUpdatesToFailedSet(&result.eds_update_map,
|
2275
|
+
&result.resource_names_failed);
|
2276
|
+
}
|
2277
|
+
}
|
2278
|
+
return result;
|
2279
|
+
}
|
2280
|
+
|
2281
|
+
namespace {
|
2282
|
+
|
2283
|
+
void MaybeLogLrsRequest(
|
2284
|
+
XdsClient* client, TraceFlag* tracer, upb_symtab* symtab,
|
2285
|
+
const envoy_service_load_stats_v3_LoadStatsRequest* request) {
|
2286
|
+
if (GRPC_TRACE_FLAG_ENABLED(*tracer) &&
|
2287
|
+
gpr_should_log(GPR_LOG_SEVERITY_DEBUG)) {
|
2288
|
+
const upb_msgdef* msg_type =
|
2289
|
+
envoy_service_load_stats_v3_LoadStatsRequest_getmsgdef(symtab);
|
2290
|
+
char buf[10240];
|
2291
|
+
upb_text_encode(request, msg_type, nullptr, 0, buf, sizeof(buf));
|
2292
|
+
gpr_log(GPR_DEBUG, "[xds_client %p] constructed LRS request: %s", client,
|
2293
|
+
buf);
|
2294
|
+
}
|
2295
|
+
}
|
2296
|
+
|
2297
|
+
grpc_slice SerializeLrsRequest(
|
2298
|
+
const envoy_service_load_stats_v3_LoadStatsRequest* request,
|
2299
|
+
upb_arena* arena) {
|
2300
|
+
size_t output_length;
|
2301
|
+
char* output = envoy_service_load_stats_v3_LoadStatsRequest_serialize(
|
2302
|
+
request, arena, &output_length);
|
2303
|
+
return grpc_slice_from_copied_buffer(output, output_length);
|
2304
|
+
}
|
2305
|
+
|
2306
|
+
} // namespace
|
2307
|
+
|
2308
|
+
grpc_slice XdsApi::CreateLrsInitialRequest(
|
2309
|
+
const XdsBootstrap::XdsServer& server) {
|
2310
|
+
upb::Arena arena;
|
2311
|
+
// Create a request.
|
2312
|
+
envoy_service_load_stats_v3_LoadStatsRequest* request =
|
2313
|
+
envoy_service_load_stats_v3_LoadStatsRequest_new(arena.ptr());
|
2314
|
+
// Populate node.
|
2315
|
+
envoy_config_core_v3_Node* node_msg =
|
2316
|
+
envoy_service_load_stats_v3_LoadStatsRequest_mutable_node(request,
|
2317
|
+
arena.ptr());
|
2318
|
+
PopulateNode(arena.ptr(), node_, server.ShouldUseV3(), build_version_,
|
2319
|
+
user_agent_name_, node_msg);
|
2320
|
+
envoy_config_core_v3_Node_add_client_features(
|
2321
|
+
node_msg, upb_strview_makez("envoy.lrs.supports_send_all_clusters"),
|
2322
|
+
arena.ptr());
|
2323
|
+
MaybeLogLrsRequest(client_, tracer_, symtab_.ptr(), request);
|
2324
|
+
return SerializeLrsRequest(request, arena.ptr());
|
2325
|
+
}
|
2326
|
+
|
2327
|
+
namespace {
|
2328
|
+
|
2329
|
+
void LocalityStatsPopulate(
|
2330
|
+
envoy_config_endpoint_v3_UpstreamLocalityStats* output,
|
2331
|
+
const XdsLocalityName& locality_name,
|
2332
|
+
const XdsClusterLocalityStats::Snapshot& snapshot, upb_arena* arena) {
|
2333
|
+
// Set locality.
|
2334
|
+
envoy_config_core_v3_Locality* locality =
|
2335
|
+
envoy_config_endpoint_v3_UpstreamLocalityStats_mutable_locality(output,
|
2336
|
+
arena);
|
2337
|
+
if (!locality_name.region().empty()) {
|
2338
|
+
envoy_config_core_v3_Locality_set_region(
|
2339
|
+
locality, StdStringToUpbString(locality_name.region()));
|
2340
|
+
}
|
2341
|
+
if (!locality_name.zone().empty()) {
|
2342
|
+
envoy_config_core_v3_Locality_set_zone(
|
2343
|
+
locality, StdStringToUpbString(locality_name.zone()));
|
2344
|
+
}
|
2345
|
+
if (!locality_name.sub_zone().empty()) {
|
2346
|
+
envoy_config_core_v3_Locality_set_sub_zone(
|
2347
|
+
locality, StdStringToUpbString(locality_name.sub_zone()));
|
2348
|
+
}
|
2349
|
+
// Set total counts.
|
2350
|
+
envoy_config_endpoint_v3_UpstreamLocalityStats_set_total_successful_requests(
|
2351
|
+
output, snapshot.total_successful_requests);
|
2352
|
+
envoy_config_endpoint_v3_UpstreamLocalityStats_set_total_requests_in_progress(
|
2353
|
+
output, snapshot.total_requests_in_progress);
|
2354
|
+
envoy_config_endpoint_v3_UpstreamLocalityStats_set_total_error_requests(
|
2355
|
+
output, snapshot.total_error_requests);
|
2356
|
+
envoy_config_endpoint_v3_UpstreamLocalityStats_set_total_issued_requests(
|
2357
|
+
output, snapshot.total_issued_requests);
|
2358
|
+
// Add backend metrics.
|
2359
|
+
for (const auto& p : snapshot.backend_metrics) {
|
2360
|
+
const std::string& metric_name = p.first;
|
2361
|
+
const XdsClusterLocalityStats::BackendMetric& metric_value = p.second;
|
2362
|
+
envoy_config_endpoint_v3_EndpointLoadMetricStats* load_metric =
|
2363
|
+
envoy_config_endpoint_v3_UpstreamLocalityStats_add_load_metric_stats(
|
2364
|
+
output, arena);
|
2365
|
+
envoy_config_endpoint_v3_EndpointLoadMetricStats_set_metric_name(
|
2366
|
+
load_metric, StdStringToUpbString(metric_name));
|
2367
|
+
envoy_config_endpoint_v3_EndpointLoadMetricStats_set_num_requests_finished_with_metric(
|
2368
|
+
load_metric, metric_value.num_requests_finished_with_metric);
|
2369
|
+
envoy_config_endpoint_v3_EndpointLoadMetricStats_set_total_metric_value(
|
2370
|
+
load_metric, metric_value.total_metric_value);
|
2371
|
+
}
|
2372
|
+
}
|
2373
|
+
|
2374
|
+
} // namespace
|
2375
|
+
|
2376
|
+
grpc_slice XdsApi::CreateLrsRequest(
|
2377
|
+
ClusterLoadReportMap cluster_load_report_map) {
|
2378
|
+
upb::Arena arena;
|
2379
|
+
// Create a request.
|
2380
|
+
envoy_service_load_stats_v3_LoadStatsRequest* request =
|
2381
|
+
envoy_service_load_stats_v3_LoadStatsRequest_new(arena.ptr());
|
2382
|
+
for (auto& p : cluster_load_report_map) {
|
2383
|
+
const std::string& cluster_name = p.first.first;
|
2384
|
+
const std::string& eds_service_name = p.first.second;
|
2385
|
+
const ClusterLoadReport& load_report = p.second;
|
2386
|
+
// Add cluster stats.
|
2387
|
+
envoy_config_endpoint_v3_ClusterStats* cluster_stats =
|
2388
|
+
envoy_service_load_stats_v3_LoadStatsRequest_add_cluster_stats(
|
2389
|
+
request, arena.ptr());
|
2390
|
+
// Set the cluster name.
|
2391
|
+
envoy_config_endpoint_v3_ClusterStats_set_cluster_name(
|
2392
|
+
cluster_stats, StdStringToUpbString(cluster_name));
|
2393
|
+
// Set EDS service name, if non-empty.
|
2394
|
+
if (!eds_service_name.empty()) {
|
2395
|
+
envoy_config_endpoint_v3_ClusterStats_set_cluster_service_name(
|
2396
|
+
cluster_stats, StdStringToUpbString(eds_service_name));
|
2397
|
+
}
|
2398
|
+
// Add locality stats.
|
2399
|
+
for (const auto& p : load_report.locality_stats) {
|
2400
|
+
const XdsLocalityName& locality_name = *p.first;
|
2401
|
+
const auto& snapshot = p.second;
|
2402
|
+
envoy_config_endpoint_v3_UpstreamLocalityStats* locality_stats =
|
2403
|
+
envoy_config_endpoint_v3_ClusterStats_add_upstream_locality_stats(
|
2404
|
+
cluster_stats, arena.ptr());
|
2405
|
+
LocalityStatsPopulate(locality_stats, locality_name, snapshot,
|
2406
|
+
arena.ptr());
|
2407
|
+
}
|
2408
|
+
// Add dropped requests.
|
2409
|
+
uint64_t total_dropped_requests = 0;
|
2410
|
+
for (const auto& p : load_report.dropped_requests.categorized_drops) {
|
2411
|
+
const std::string& category = p.first;
|
2412
|
+
const uint64_t count = p.second;
|
2413
|
+
envoy_config_endpoint_v3_ClusterStats_DroppedRequests* dropped_requests =
|
2414
|
+
envoy_config_endpoint_v3_ClusterStats_add_dropped_requests(
|
2415
|
+
cluster_stats, arena.ptr());
|
2416
|
+
envoy_config_endpoint_v3_ClusterStats_DroppedRequests_set_category(
|
2417
|
+
dropped_requests, StdStringToUpbString(category));
|
2418
|
+
envoy_config_endpoint_v3_ClusterStats_DroppedRequests_set_dropped_count(
|
2419
|
+
dropped_requests, count);
|
2420
|
+
total_dropped_requests += count;
|
2421
|
+
}
|
2422
|
+
total_dropped_requests += load_report.dropped_requests.uncategorized_drops;
|
2423
|
+
// Set total dropped requests.
|
2424
|
+
envoy_config_endpoint_v3_ClusterStats_set_total_dropped_requests(
|
2425
|
+
cluster_stats, total_dropped_requests);
|
2426
|
+
// Set real load report interval.
|
2427
|
+
gpr_timespec timespec =
|
2428
|
+
grpc_millis_to_timespec(load_report.load_report_interval, GPR_TIMESPAN);
|
2429
|
+
google_protobuf_Duration* load_report_interval =
|
2430
|
+
envoy_config_endpoint_v3_ClusterStats_mutable_load_report_interval(
|
2431
|
+
cluster_stats, arena.ptr());
|
2432
|
+
google_protobuf_Duration_set_seconds(load_report_interval, timespec.tv_sec);
|
2433
|
+
google_protobuf_Duration_set_nanos(load_report_interval, timespec.tv_nsec);
|
2434
|
+
}
|
2435
|
+
MaybeLogLrsRequest(client_, tracer_, symtab_.ptr(), request);
|
2436
|
+
return SerializeLrsRequest(request, arena.ptr());
|
2437
|
+
}
|
2438
|
+
|
2439
|
+
grpc_error* XdsApi::ParseLrsResponse(const grpc_slice& encoded_response,
|
2440
|
+
bool* send_all_clusters,
|
2441
|
+
std::set<std::string>* cluster_names,
|
2442
|
+
grpc_millis* load_reporting_interval) {
|
2443
|
+
upb::Arena arena;
|
2444
|
+
// Decode the response.
|
2445
|
+
const envoy_service_load_stats_v3_LoadStatsResponse* decoded_response =
|
2446
|
+
envoy_service_load_stats_v3_LoadStatsResponse_parse(
|
2447
|
+
reinterpret_cast<const char*>(GRPC_SLICE_START_PTR(encoded_response)),
|
2448
|
+
GRPC_SLICE_LENGTH(encoded_response), arena.ptr());
|
2449
|
+
// Parse the response.
|
2450
|
+
if (decoded_response == nullptr) {
|
2451
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING("Can't decode response.");
|
2452
|
+
}
|
2453
|
+
// Check send_all_clusters.
|
2454
|
+
if (envoy_service_load_stats_v3_LoadStatsResponse_send_all_clusters(
|
2455
|
+
decoded_response)) {
|
2456
|
+
*send_all_clusters = true;
|
2457
|
+
} else {
|
2458
|
+
// Store the cluster names.
|
2459
|
+
size_t size;
|
2460
|
+
const upb_strview* clusters =
|
2461
|
+
envoy_service_load_stats_v3_LoadStatsResponse_clusters(decoded_response,
|
2462
|
+
&size);
|
2463
|
+
for (size_t i = 0; i < size; ++i) {
|
2464
|
+
cluster_names->emplace(UpbStringToStdString(clusters[i]));
|
2465
|
+
}
|
2466
|
+
}
|
2467
|
+
// Get the load report interval.
|
2468
|
+
const google_protobuf_Duration* load_reporting_interval_duration =
|
2469
|
+
envoy_service_load_stats_v3_LoadStatsResponse_load_reporting_interval(
|
2470
|
+
decoded_response);
|
2471
|
+
gpr_timespec timespec{
|
2472
|
+
google_protobuf_Duration_seconds(load_reporting_interval_duration),
|
2473
|
+
google_protobuf_Duration_nanos(load_reporting_interval_duration),
|
2474
|
+
GPR_TIMESPAN};
|
2475
|
+
*load_reporting_interval = gpr_time_to_millis(timespec);
|
2476
|
+
return GRPC_ERROR_NONE;
|
2477
|
+
}
|
2478
|
+
|
2479
|
+
} // namespace grpc_core
|