From d0a33464117edef491a2d98b21a64d76f5346fb3 Mon Sep 17 00:00:00 2001 From: Paul Banks Date: Wed, 3 Oct 2018 19:18:55 +0100 Subject: [PATCH] xDS Server Implementation (#4731) * Vendor updates for gRPC and xDS server * xDS server implementation for serving Envoy as a Connect proxy * Address initial review comments * consistent envoy package aliases; typos fixed; override TLS and authz for custom listeners * Moar Typos * Moar typos --- agent/connect/uri.go | 11 + agent/connect/uri_test.go | 9 +- agent/xds/clusters.go | 79 + agent/xds/endpoints.go | 58 + agent/xds/listeners.go | 286 + agent/xds/response.go | 54 + agent/xds/routes.go | 19 + agent/xds/server.go | 429 + agent/xds/server_test.go | 975 + agent/xds/testing.go | 180 + agent/xds/xds.go | 10 + .../envoyproxy/go-control-plane/LICENSE | 201 + .../envoy/api/v2/auth/cert.pb.go | 4792 +++++ .../envoy/api/v2/auth/cert.pb.validate.go | 831 + .../go-control-plane/envoy/api/v2/cds.pb.go | 6131 +++++++ .../envoy/api/v2/cds.pb.validate.go | 1025 ++ .../api/v2/cluster/circuit_breaker.pb.go | 833 + .../v2/cluster/circuit_breaker.pb.validate.go | 176 + .../api/v2/cluster/outlier_detection.pb.go | 1020 ++ .../cluster/outlier_detection.pb.validate.go | 213 + .../envoy/api/v2/core/address.pb.go | 2382 +++ .../envoy/api/v2/core/address.pb.validate.go | 447 + .../envoy/api/v2/core/base.pb.go | 3516 ++++ .../envoy/api/v2/core/base.pb.validate.go | 571 + .../envoy/api/v2/core/config_source.pb.go | 1377 ++ .../api/v2/core/config_source.pb.validate.go | 244 + .../envoy/api/v2/core/grpc_service.pb.go | 4117 +++++ .../api/v2/core/grpc_service.pb.validate.go | 746 + .../envoy/api/v2/core/health_check.pb.go | 3602 ++++ .../api/v2/core/health_check.pb.validate.go | 643 + .../envoy/api/v2/core/http_uri.pb.go | 557 + .../envoy/api/v2/core/http_uri.pb.validate.go | 109 + .../envoy/api/v2/core/protocol.pb.go | 1519 ++ .../envoy/api/v2/core/protocol.pb.validate.go | 324 + .../envoy/api/v2/discovery.pb.go | 2490 +++ .../envoy/api/v2/discovery.pb.validate.go | 352 + .../go-control-plane/envoy/api/v2/eds.pb.go | 1232 ++ .../envoy/api/v2/eds.pb.validate.go | 238 + .../envoy/api/v2/endpoint/endpoint.pb.go | 1442 ++ .../api/v2/endpoint/endpoint.pb.validate.go | 304 + .../envoy/api/v2/endpoint/load_report.pb.go | 1866 ++ .../v2/endpoint/load_report.pb.validate.go | 396 + .../go-control-plane/envoy/api/v2/lds.pb.go | 1560 ++ .../envoy/api/v2/lds.pb.validate.go | 264 + .../envoy/api/v2/listener/listener.pb.go | 2284 +++ .../api/v2/listener/listener.pb.validate.go | 425 + .../go-control-plane/envoy/api/v2/rds.pb.go | 1019 ++ .../envoy/api/v2/rds.pb.validate.go | 134 + .../envoy/api/v2/route/route.pb.go | 14955 ++++++++++++++++ .../envoy/api/v2/route/route.pb.validate.go | 2470 +++ .../filter/accesslog/v2/accesslog.pb.go | 3322 ++++ .../accesslog/v2/accesslog.pb.validate.go | 836 + .../network/ext_authz/v2/ext_authz.pb.go | 453 + .../ext_authz/v2/ext_authz.pb.validate.go | 95 + .../v2/http_connection_manager.pb.go | 3598 ++++ .../v2/http_connection_manager.pb.validate.go | 660 + .../network/tcp_proxy/v2/tcp_proxy.pb.go | 1448 ++ .../tcp_proxy/v2/tcp_proxy.pb.validate.go | 313 + .../auth/v2alpha/attribute_context.pb.go | 2034 +++ .../v2alpha/attribute_context.pb.validate.go | 292 + .../service/auth/v2alpha/external_auth.pb.go | 1339 ++ .../auth/v2alpha/external_auth.pb.validate.go | 300 + .../envoy/service/discovery/v2/ads.pb.go | 472 + .../service/discovery/v2/ads.pb.validate.go | 76 + .../envoy/service/discovery/v2/hds.pb.go | 2406 +++ .../service/discovery/v2/hds.pb.validate.go | 528 + .../envoy/service/discovery/v2/sds.pb.go | 440 + .../service/discovery/v2/sds.pb.validate.go | 76 + .../envoy/type/http_status.pb.go | 567 + .../envoy/type/http_status.pb.validate.go | 83 + .../go-control-plane/envoy/type/percent.pb.go | 624 + .../envoy/type/percent.pb.validate.go | 134 + .../go-control-plane/envoy/type/range.pb.go | 607 + .../envoy/type/range.pb.validate.go | 126 + .../go-control-plane/pkg/cache/cache.go | 70 + .../go-control-plane/pkg/cache/resource.go | 112 + .../go-control-plane/pkg/cache/simple.go | 309 + .../go-control-plane/pkg/cache/snapshot.go | 140 + .../go-control-plane/pkg/cache/status.go | 92 + .../go-control-plane/pkg/log/log.go | 25 + .../go-control-plane/pkg/server/gateway.go | 95 + .../go-control-plane/pkg/server/server.go | 377 + .../go-control-plane/pkg/util/struct.go | 60 + .../go-control-plane/pkg/util/wellknown.go | 107 + vendor/github.com/gogo/googleapis/LICENSE | 203 + .../googleapis/google/api/annotations.pb.go | 56 + .../googleapis/google/api/annotations.proto} | 29 +- .../gogo/googleapis/google/api/http.pb.go | 2338 +++ .../gogo/googleapis/google/api/http.proto | 318 + .../gogo/googleapis/google/rpc/code.pb.go | 254 + .../gogo/googleapis/google/rpc/code.proto | 186 + .../googleapis/google/rpc/error_details.pb.go | 4659 +++++ .../googleapis/google/rpc/error_details.proto | 200 + .../gogo/googleapis/google/rpc/status.pb.go | 726 + .../gogo/googleapis/google/rpc/status.proto | 92 + vendor/github.com/gogo/protobuf/LICENSE | 35 + .../gogo/protobuf/gogoproto/Makefile | 37 + .../github.com/gogo/protobuf/gogoproto/doc.go | 169 + .../gogo/protobuf/gogoproto/gogo.pb.go | 862 + .../gogo/protobuf/gogoproto/gogo.pb.golden | 45 + .../gogo/protobuf/gogoproto/gogo.proto | 142 + .../gogo/protobuf/gogoproto/helper.go | 366 + .../github.com/gogo/protobuf/jsonpb/jsonpb.go | 1392 ++ .../github.com/gogo/protobuf/proto/Makefile | 43 + .../github.com/gogo/protobuf/proto/clone.go | 258 + .../gogo/protobuf/proto/custom_gogo.go | 39 + .../github.com/gogo/protobuf/proto/decode.go | 428 + .../github.com/gogo/protobuf/proto/discard.go | 350 + .../gogo/protobuf/proto/duration.go | 100 + .../gogo/protobuf/proto/duration_gogo.go | 49 + .../github.com/gogo/protobuf/proto/encode.go | 218 + .../gogo/protobuf/proto/encode_gogo.go | 33 + .../github.com/gogo/protobuf/proto/equal.go | 300 + .../gogo/protobuf/proto/extensions.go | 604 + .../gogo/protobuf/proto/extensions_gogo.go | 368 + vendor/github.com/gogo/protobuf/proto/lib.go | 929 + .../gogo/protobuf/proto/lib_gogo.go | 50 + .../gogo/protobuf/proto/message_set.go | 314 + .../gogo/protobuf/proto/pointer_reflect.go | 357 + .../protobuf/proto/pointer_reflect_gogo.go | 59 + .../gogo/protobuf/proto/pointer_unsafe.go | 308 + .../protobuf/proto/pointer_unsafe_gogo.go | 56 + .../gogo/protobuf/proto/properties.go | 600 + .../gogo/protobuf/proto/properties_gogo.go | 36 + .../gogo/protobuf/proto/skip_gogo.go | 119 + .../gogo/protobuf/proto/table_marshal.go | 2803 +++ .../gogo/protobuf/proto/table_marshal_gogo.go | 388 + .../gogo/protobuf/proto/table_merge.go | 657 + .../gogo/protobuf/proto/table_unmarshal.go | 2058 +++ .../protobuf/proto/table_unmarshal_gogo.go | 385 + vendor/github.com/gogo/protobuf/proto/text.go | 928 + .../gogo/protobuf/proto/text_gogo.go | 57 + .../gogo/protobuf/proto/text_parser.go | 998 ++ .../gogo/protobuf/proto/timestamp.go | 113 + .../gogo/protobuf/proto/timestamp_gogo.go | 49 + .../protoc-gen-gogo/descriptor/Makefile | 36 + .../protoc-gen-gogo/descriptor/descriptor.go | 118 + .../descriptor/descriptor.pb.go | 2806 +++ .../descriptor/descriptor_gostring.gen.go | 744 + .../protoc-gen-gogo/descriptor/helper.go | 390 + .../gogo/protobuf/sortkeys/sortkeys.go | 101 + vendor/github.com/gogo/protobuf/types/any.go | 140 + .../github.com/gogo/protobuf/types/any.pb.go | 703 + .../github.com/gogo/protobuf/types/api.pb.go | 2067 +++ vendor/github.com/gogo/protobuf/types/doc.go | 35 + .../gogo/protobuf/types/duration.go | 100 + .../gogo/protobuf/types/duration.pb.go | 537 + .../gogo/protobuf/types/duration_gogo.go | 100 + .../gogo/protobuf/types/empty.pb.go | 480 + .../gogo/protobuf/types/field_mask.pb.go | 769 + .../gogo/protobuf/types/protosize.go | 34 + .../gogo/protobuf/types/source_context.pb.go | 538 + .../gogo/protobuf/types/struct.pb.go | 1986 ++ .../gogo/protobuf/types/timestamp.go | 132 + .../gogo/protobuf/types/timestamp.pb.go | 555 + .../gogo/protobuf/types/timestamp_gogo.go | 94 + .../github.com/gogo/protobuf/types/type.pb.go | 3243 ++++ .../gogo/protobuf/types/wrappers.pb.go | 2668 +++ vendor/github.com/golang/protobuf/LICENSE | 3 - .../protoc-gen-go/descriptor/descriptor.pb.go | 2863 +++ .../protoc-gen-go/descriptor/descriptor.proto | 872 + .../lyft/protoc-gen-validate/LICENSE | 202 + .../lyft/protoc-gen-validate/validate/BUILD | 48 + .../protoc-gen-validate/validate/validate.h | 87 + .../validate/validate.pb.go | 3154 ++++ .../validate/validate.proto | 762 + vendor/google.golang.org/grpc/CONTRIBUTING.md | 4 + vendor/google.golang.org/grpc/LICENSE | 230 +- vendor/google.golang.org/grpc/Makefile | 59 +- vendor/google.golang.org/grpc/PATENTS | 22 - vendor/google.golang.org/grpc/README.md | 3 +- vendor/google.golang.org/grpc/backoff.go | 66 +- vendor/google.golang.org/grpc/balancer.go | 38 +- .../grpc/balancer/balancer.go | 61 +- .../grpc/balancer/base/balancer.go | 1 - .../grpc/balancer_conn_wrappers.go | 2 +- .../grpc/balancer_v1_wrapper.go | 59 +- vendor/google.golang.org/grpc/call.go | 320 +- vendor/google.golang.org/grpc/clientconn.go | 1260 +- vendor/google.golang.org/grpc/codec.go | 98 +- vendor/google.golang.org/grpc/codes/codes.go | 36 +- .../grpc/credentials/credentials.go | 77 +- .../{credentials_util_pre_go17.go => go16.go} | 0 .../{credentials_util_go17.go => go17.go} | 3 +- .../{credentials_util_go18.go => go18.go} | 8 + .../grpc/credentials/go19.go | 35 + vendor/google.golang.org/grpc/dialoptions.go | 453 + .../grpc/encoding/encoding.go | 99 +- .../grpc/encoding/proto/proto.go | 110 + vendor/google.golang.org/grpc/go.mod | 21 + vendor/google.golang.org/grpc/go.sum | 34 + vendor/google.golang.org/grpc/go16.go | 41 +- vendor/google.golang.org/grpc/go17.go | 41 +- vendor/google.golang.org/grpc/grpclb.go | 342 - .../grpclb/grpc_lb_v1/messages/messages.pb.go | 615 - .../grpclb/grpc_lb_v1/messages/messages.proto | 155 - .../google.golang.org/grpc/grpclb_picker.go | 159 - .../grpc/grpclb_remote_balancer.go | 254 - vendor/google.golang.org/grpc/grpclb_util.go | 90 - .../google.golang.org/grpc/grpclog/grpclog.go | 3 + .../google.golang.org/grpc/grpclog/logger.go | 2 + .../grpc/health/grpc_health_v1/health.pb.go | 239 +- .../google.golang.org/grpc/health/health.go | 7 +- .../grpc/health/regenerate.sh | 33 + vendor/google.golang.org/grpc/install_gae.sh | 6 + vendor/google.golang.org/grpc/interceptor.go | 4 +- .../grpc/internal/backoff/backoff.go | 78 + .../grpc/internal/channelz/funcs.go | 662 + .../grpc/internal/channelz/types.go | 702 + .../grpc/internal/channelz/types_linux.go | 53 + .../grpc/internal/channelz/types_nonlinux.go | 38 + .../grpc/internal/channelz/util_linux_go19.go | 39 + .../channelz/util_nonlinux_pre_go19.go | 26 + .../grpc/internal/envconfig/envconfig.go | 35 + .../grpc/internal/grpcrand/grpcrand.go | 56 + .../grpc/internal/internal.go | 17 +- .../{ => internal}/transport/bdp_estimator.go | 0 .../grpc/internal/transport/controlbuf.go | 852 + .../grpc/internal/transport/defaults.go | 49 + .../grpc/internal/transport/flowcontrol.go | 218 + .../grpc/{ => internal}/transport/go16.go | 11 +- .../grpc/{ => internal}/transport/go17.go | 11 +- .../transport/handler_server.go | 100 +- .../{ => internal}/transport/http2_client.go | 1246 +- .../{ => internal}/transport/http2_server.go | 887 +- .../{ => internal}/transport/http_util.go | 242 +- .../grpc/{ => internal}/transport/log.go | 6 - .../{ => internal}/transport/transport.go | 399 +- .../grpc/metadata/metadata.go | 89 +- .../grpc/naming/dns_resolver.go | 6 +- .../google.golang.org/grpc/naming/naming.go | 12 +- .../google.golang.org/grpc/picker_wrapper.go | 43 +- vendor/google.golang.org/grpc/pickfirst.go | 1 + .../grpc/resolver/dns/dns_resolver.go | 96 +- .../grpc/resolver/resolver.go | 39 +- .../grpc/resolver_conn_wrapper.go | 68 +- vendor/google.golang.org/grpc/rpc_util.go | 496 +- vendor/google.golang.org/grpc/server.go | 379 +- .../google.golang.org/grpc/service_config.go | 148 +- vendor/google.golang.org/grpc/stats/stats.go | 2 + vendor/google.golang.org/grpc/status/go16.go | 42 + vendor/google.golang.org/grpc/status/go17.go | 44 + .../google.golang.org/grpc/status/status.go | 26 +- vendor/google.golang.org/grpc/stream.go | 1015 +- .../grpc/transport/control.go | 334 - vendor/google.golang.org/grpc/version.go | 22 + vendor/google.golang.org/grpc/vet.sh | 110 +- vendor/vendor.json | 85 +- 248 files changed, 151993 insertions(+), 5544 deletions(-) create mode 100644 agent/xds/clusters.go create mode 100644 agent/xds/endpoints.go create mode 100644 agent/xds/listeners.go create mode 100644 agent/xds/response.go create mode 100644 agent/xds/routes.go create mode 100644 agent/xds/server.go create mode 100644 agent/xds/server_test.go create mode 100644 agent/xds/testing.go create mode 100644 agent/xds/xds.go create mode 100644 vendor/github.com/envoyproxy/go-control-plane/LICENSE create mode 100644 vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/auth/cert.pb.go create mode 100644 vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/auth/cert.pb.validate.go create mode 100644 vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/cds.pb.go create mode 100644 vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/cds.pb.validate.go create mode 100644 vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/cluster/circuit_breaker.pb.go create mode 100644 vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/cluster/circuit_breaker.pb.validate.go create mode 100644 vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/cluster/outlier_detection.pb.go create mode 100644 vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/cluster/outlier_detection.pb.validate.go create mode 100644 vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/core/address.pb.go create mode 100644 vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/core/address.pb.validate.go create mode 100644 vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/core/base.pb.go create mode 100644 vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/core/base.pb.validate.go create mode 100644 vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/core/config_source.pb.go create mode 100644 vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/core/config_source.pb.validate.go create mode 100644 vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/core/grpc_service.pb.go create mode 100644 vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/core/grpc_service.pb.validate.go create mode 100644 vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/core/health_check.pb.go create mode 100644 vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/core/health_check.pb.validate.go create mode 100644 vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/core/http_uri.pb.go create mode 100644 vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/core/http_uri.pb.validate.go create mode 100644 vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/core/protocol.pb.go create mode 100644 vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/core/protocol.pb.validate.go create mode 100644 vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/discovery.pb.go create mode 100644 vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/discovery.pb.validate.go create mode 100644 vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/eds.pb.go create mode 100644 vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/eds.pb.validate.go create mode 100644 vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/endpoint/endpoint.pb.go create mode 100644 vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/endpoint/endpoint.pb.validate.go create mode 100644 vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/endpoint/load_report.pb.go create mode 100644 vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/endpoint/load_report.pb.validate.go create mode 100644 vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/lds.pb.go create mode 100644 vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/lds.pb.validate.go create mode 100644 vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/listener/listener.pb.go create mode 100644 vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/listener/listener.pb.validate.go create mode 100644 vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/rds.pb.go create mode 100644 vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/rds.pb.validate.go create mode 100644 vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/route/route.pb.go create mode 100644 vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/route/route.pb.validate.go create mode 100644 vendor/github.com/envoyproxy/go-control-plane/envoy/config/filter/accesslog/v2/accesslog.pb.go create mode 100644 vendor/github.com/envoyproxy/go-control-plane/envoy/config/filter/accesslog/v2/accesslog.pb.validate.go create mode 100644 vendor/github.com/envoyproxy/go-control-plane/envoy/config/filter/network/ext_authz/v2/ext_authz.pb.go create mode 100644 vendor/github.com/envoyproxy/go-control-plane/envoy/config/filter/network/ext_authz/v2/ext_authz.pb.validate.go create mode 100644 vendor/github.com/envoyproxy/go-control-plane/envoy/config/filter/network/http_connection_manager/v2/http_connection_manager.pb.go create mode 100644 vendor/github.com/envoyproxy/go-control-plane/envoy/config/filter/network/http_connection_manager/v2/http_connection_manager.pb.validate.go create mode 100644 vendor/github.com/envoyproxy/go-control-plane/envoy/config/filter/network/tcp_proxy/v2/tcp_proxy.pb.go create mode 100644 vendor/github.com/envoyproxy/go-control-plane/envoy/config/filter/network/tcp_proxy/v2/tcp_proxy.pb.validate.go create mode 100644 vendor/github.com/envoyproxy/go-control-plane/envoy/service/auth/v2alpha/attribute_context.pb.go create mode 100644 vendor/github.com/envoyproxy/go-control-plane/envoy/service/auth/v2alpha/attribute_context.pb.validate.go create mode 100644 vendor/github.com/envoyproxy/go-control-plane/envoy/service/auth/v2alpha/external_auth.pb.go create mode 100644 vendor/github.com/envoyproxy/go-control-plane/envoy/service/auth/v2alpha/external_auth.pb.validate.go create mode 100644 vendor/github.com/envoyproxy/go-control-plane/envoy/service/discovery/v2/ads.pb.go create mode 100644 vendor/github.com/envoyproxy/go-control-plane/envoy/service/discovery/v2/ads.pb.validate.go create mode 100644 vendor/github.com/envoyproxy/go-control-plane/envoy/service/discovery/v2/hds.pb.go create mode 100644 vendor/github.com/envoyproxy/go-control-plane/envoy/service/discovery/v2/hds.pb.validate.go create mode 100644 vendor/github.com/envoyproxy/go-control-plane/envoy/service/discovery/v2/sds.pb.go create mode 100644 vendor/github.com/envoyproxy/go-control-plane/envoy/service/discovery/v2/sds.pb.validate.go create mode 100644 vendor/github.com/envoyproxy/go-control-plane/envoy/type/http_status.pb.go create mode 100644 vendor/github.com/envoyproxy/go-control-plane/envoy/type/http_status.pb.validate.go create mode 100644 vendor/github.com/envoyproxy/go-control-plane/envoy/type/percent.pb.go create mode 100644 vendor/github.com/envoyproxy/go-control-plane/envoy/type/percent.pb.validate.go create mode 100644 vendor/github.com/envoyproxy/go-control-plane/envoy/type/range.pb.go create mode 100644 vendor/github.com/envoyproxy/go-control-plane/envoy/type/range.pb.validate.go create mode 100644 vendor/github.com/envoyproxy/go-control-plane/pkg/cache/cache.go create mode 100644 vendor/github.com/envoyproxy/go-control-plane/pkg/cache/resource.go create mode 100644 vendor/github.com/envoyproxy/go-control-plane/pkg/cache/simple.go create mode 100644 vendor/github.com/envoyproxy/go-control-plane/pkg/cache/snapshot.go create mode 100644 vendor/github.com/envoyproxy/go-control-plane/pkg/cache/status.go create mode 100644 vendor/github.com/envoyproxy/go-control-plane/pkg/log/log.go create mode 100644 vendor/github.com/envoyproxy/go-control-plane/pkg/server/gateway.go create mode 100644 vendor/github.com/envoyproxy/go-control-plane/pkg/server/server.go create mode 100644 vendor/github.com/envoyproxy/go-control-plane/pkg/util/struct.go create mode 100644 vendor/github.com/envoyproxy/go-control-plane/pkg/util/wellknown.go create mode 100644 vendor/github.com/gogo/googleapis/LICENSE create mode 100644 vendor/github.com/gogo/googleapis/google/api/annotations.pb.go rename vendor/{google.golang.org/grpc/health/grpc_health_v1/health.proto => github.com/gogo/googleapis/google/api/annotations.proto} (59%) create mode 100644 vendor/github.com/gogo/googleapis/google/api/http.pb.go create mode 100644 vendor/github.com/gogo/googleapis/google/api/http.proto create mode 100644 vendor/github.com/gogo/googleapis/google/rpc/code.pb.go create mode 100644 vendor/github.com/gogo/googleapis/google/rpc/code.proto create mode 100644 vendor/github.com/gogo/googleapis/google/rpc/error_details.pb.go create mode 100644 vendor/github.com/gogo/googleapis/google/rpc/error_details.proto create mode 100644 vendor/github.com/gogo/googleapis/google/rpc/status.pb.go create mode 100644 vendor/github.com/gogo/googleapis/google/rpc/status.proto create mode 100644 vendor/github.com/gogo/protobuf/LICENSE create mode 100644 vendor/github.com/gogo/protobuf/gogoproto/Makefile create mode 100644 vendor/github.com/gogo/protobuf/gogoproto/doc.go create mode 100644 vendor/github.com/gogo/protobuf/gogoproto/gogo.pb.go create mode 100644 vendor/github.com/gogo/protobuf/gogoproto/gogo.pb.golden create mode 100644 vendor/github.com/gogo/protobuf/gogoproto/gogo.proto create mode 100644 vendor/github.com/gogo/protobuf/gogoproto/helper.go create mode 100644 vendor/github.com/gogo/protobuf/jsonpb/jsonpb.go create mode 100644 vendor/github.com/gogo/protobuf/proto/Makefile create mode 100644 vendor/github.com/gogo/protobuf/proto/clone.go create mode 100644 vendor/github.com/gogo/protobuf/proto/custom_gogo.go create mode 100644 vendor/github.com/gogo/protobuf/proto/decode.go create mode 100644 vendor/github.com/gogo/protobuf/proto/discard.go create mode 100644 vendor/github.com/gogo/protobuf/proto/duration.go create mode 100644 vendor/github.com/gogo/protobuf/proto/duration_gogo.go create mode 100644 vendor/github.com/gogo/protobuf/proto/encode.go create mode 100644 vendor/github.com/gogo/protobuf/proto/encode_gogo.go create mode 100644 vendor/github.com/gogo/protobuf/proto/equal.go create mode 100644 vendor/github.com/gogo/protobuf/proto/extensions.go create mode 100644 vendor/github.com/gogo/protobuf/proto/extensions_gogo.go create mode 100644 vendor/github.com/gogo/protobuf/proto/lib.go create mode 100644 vendor/github.com/gogo/protobuf/proto/lib_gogo.go create mode 100644 vendor/github.com/gogo/protobuf/proto/message_set.go create mode 100644 vendor/github.com/gogo/protobuf/proto/pointer_reflect.go create mode 100644 vendor/github.com/gogo/protobuf/proto/pointer_reflect_gogo.go create mode 100644 vendor/github.com/gogo/protobuf/proto/pointer_unsafe.go create mode 100644 vendor/github.com/gogo/protobuf/proto/pointer_unsafe_gogo.go create mode 100644 vendor/github.com/gogo/protobuf/proto/properties.go create mode 100644 vendor/github.com/gogo/protobuf/proto/properties_gogo.go create mode 100644 vendor/github.com/gogo/protobuf/proto/skip_gogo.go create mode 100644 vendor/github.com/gogo/protobuf/proto/table_marshal.go create mode 100644 vendor/github.com/gogo/protobuf/proto/table_marshal_gogo.go create mode 100644 vendor/github.com/gogo/protobuf/proto/table_merge.go create mode 100644 vendor/github.com/gogo/protobuf/proto/table_unmarshal.go create mode 100644 vendor/github.com/gogo/protobuf/proto/table_unmarshal_gogo.go create mode 100644 vendor/github.com/gogo/protobuf/proto/text.go create mode 100644 vendor/github.com/gogo/protobuf/proto/text_gogo.go create mode 100644 vendor/github.com/gogo/protobuf/proto/text_parser.go create mode 100644 vendor/github.com/gogo/protobuf/proto/timestamp.go create mode 100644 vendor/github.com/gogo/protobuf/proto/timestamp_gogo.go create mode 100644 vendor/github.com/gogo/protobuf/protoc-gen-gogo/descriptor/Makefile create mode 100644 vendor/github.com/gogo/protobuf/protoc-gen-gogo/descriptor/descriptor.go create mode 100644 vendor/github.com/gogo/protobuf/protoc-gen-gogo/descriptor/descriptor.pb.go create mode 100644 vendor/github.com/gogo/protobuf/protoc-gen-gogo/descriptor/descriptor_gostring.gen.go create mode 100644 vendor/github.com/gogo/protobuf/protoc-gen-gogo/descriptor/helper.go create mode 100644 vendor/github.com/gogo/protobuf/sortkeys/sortkeys.go create mode 100644 vendor/github.com/gogo/protobuf/types/any.go create mode 100644 vendor/github.com/gogo/protobuf/types/any.pb.go create mode 100644 vendor/github.com/gogo/protobuf/types/api.pb.go create mode 100644 vendor/github.com/gogo/protobuf/types/doc.go create mode 100644 vendor/github.com/gogo/protobuf/types/duration.go create mode 100644 vendor/github.com/gogo/protobuf/types/duration.pb.go create mode 100644 vendor/github.com/gogo/protobuf/types/duration_gogo.go create mode 100644 vendor/github.com/gogo/protobuf/types/empty.pb.go create mode 100644 vendor/github.com/gogo/protobuf/types/field_mask.pb.go create mode 100644 vendor/github.com/gogo/protobuf/types/protosize.go create mode 100644 vendor/github.com/gogo/protobuf/types/source_context.pb.go create mode 100644 vendor/github.com/gogo/protobuf/types/struct.pb.go create mode 100644 vendor/github.com/gogo/protobuf/types/timestamp.go create mode 100644 vendor/github.com/gogo/protobuf/types/timestamp.pb.go create mode 100644 vendor/github.com/gogo/protobuf/types/timestamp_gogo.go create mode 100644 vendor/github.com/gogo/protobuf/types/type.pb.go create mode 100644 vendor/github.com/gogo/protobuf/types/wrappers.pb.go create mode 100644 vendor/github.com/golang/protobuf/protoc-gen-go/descriptor/descriptor.pb.go create mode 100644 vendor/github.com/golang/protobuf/protoc-gen-go/descriptor/descriptor.proto create mode 100644 vendor/github.com/lyft/protoc-gen-validate/LICENSE create mode 100644 vendor/github.com/lyft/protoc-gen-validate/validate/BUILD create mode 100644 vendor/github.com/lyft/protoc-gen-validate/validate/validate.h create mode 100644 vendor/github.com/lyft/protoc-gen-validate/validate/validate.pb.go create mode 100644 vendor/github.com/lyft/protoc-gen-validate/validate/validate.proto delete mode 100644 vendor/google.golang.org/grpc/PATENTS rename vendor/google.golang.org/grpc/credentials/{credentials_util_pre_go17.go => go16.go} (100%) rename vendor/google.golang.org/grpc/credentials/{credentials_util_go17.go => go17.go} (98%) rename vendor/google.golang.org/grpc/credentials/{credentials_util_go18.go => go18.go} (65%) create mode 100644 vendor/google.golang.org/grpc/credentials/go19.go create mode 100644 vendor/google.golang.org/grpc/dialoptions.go create mode 100644 vendor/google.golang.org/grpc/encoding/proto/proto.go create mode 100644 vendor/google.golang.org/grpc/go.mod create mode 100644 vendor/google.golang.org/grpc/go.sum delete mode 100644 vendor/google.golang.org/grpc/grpclb.go delete mode 100644 vendor/google.golang.org/grpc/grpclb/grpc_lb_v1/messages/messages.pb.go delete mode 100644 vendor/google.golang.org/grpc/grpclb/grpc_lb_v1/messages/messages.proto delete mode 100644 vendor/google.golang.org/grpc/grpclb_picker.go delete mode 100644 vendor/google.golang.org/grpc/grpclb_remote_balancer.go delete mode 100644 vendor/google.golang.org/grpc/grpclb_util.go create mode 100755 vendor/google.golang.org/grpc/health/regenerate.sh create mode 100755 vendor/google.golang.org/grpc/install_gae.sh create mode 100644 vendor/google.golang.org/grpc/internal/backoff/backoff.go create mode 100644 vendor/google.golang.org/grpc/internal/channelz/funcs.go create mode 100644 vendor/google.golang.org/grpc/internal/channelz/types.go create mode 100644 vendor/google.golang.org/grpc/internal/channelz/types_linux.go create mode 100644 vendor/google.golang.org/grpc/internal/channelz/types_nonlinux.go create mode 100644 vendor/google.golang.org/grpc/internal/channelz/util_linux_go19.go create mode 100644 vendor/google.golang.org/grpc/internal/channelz/util_nonlinux_pre_go19.go create mode 100644 vendor/google.golang.org/grpc/internal/envconfig/envconfig.go create mode 100644 vendor/google.golang.org/grpc/internal/grpcrand/grpcrand.go rename vendor/google.golang.org/grpc/{ => internal}/transport/bdp_estimator.go (100%) create mode 100644 vendor/google.golang.org/grpc/internal/transport/controlbuf.go create mode 100644 vendor/google.golang.org/grpc/internal/transport/defaults.go create mode 100644 vendor/google.golang.org/grpc/internal/transport/flowcontrol.go rename vendor/google.golang.org/grpc/{ => internal}/transport/go16.go (77%) rename vendor/google.golang.org/grpc/{ => internal}/transport/go17.go (78%) rename vendor/google.golang.org/grpc/{ => internal}/transport/handler_server.go (81%) rename vendor/google.golang.org/grpc/{ => internal}/transport/http2_client.go (55%) rename vendor/google.golang.org/grpc/{ => internal}/transport/http2_server.go (63%) rename vendor/google.golang.org/grpc/{ => internal}/transport/http_util.go (62%) rename vendor/google.golang.org/grpc/{ => internal}/transport/log.go (90%) rename vendor/google.golang.org/grpc/{ => internal}/transport/transport.go (68%) create mode 100644 vendor/google.golang.org/grpc/status/go16.go create mode 100644 vendor/google.golang.org/grpc/status/go17.go delete mode 100644 vendor/google.golang.org/grpc/transport/control.go create mode 100644 vendor/google.golang.org/grpc/version.go diff --git a/agent/connect/uri.go b/agent/connect/uri.go index 48bfd3686ab9..ec5868abb352 100644 --- a/agent/connect/uri.go +++ b/agent/connect/uri.go @@ -33,6 +33,17 @@ var ( `^/ns/([^/]+)/dc/([^/]+)/svc/([^/]+)$`) ) +// ParseCertURIFromString attempts to parse a string representation of a +// certificate URI as a convenince helper around ParseCertURI. +func ParseCertURIFromString(input string) (CertURI, error) { + // Parse the certificate URI from the string + uriRaw, err := url.Parse(input) + if err != nil { + return nil, err + } + return ParseCertURI(uriRaw) +} + // ParseCertURI parses a the URI value from a TLS certificate. func ParseCertURI(input *url.URL) (CertURI, error) { if input.Scheme != "spiffe" { diff --git a/agent/connect/uri_test.go b/agent/connect/uri_test.go index 2f28c940dd66..86b5140c4ee4 100644 --- a/agent/connect/uri_test.go +++ b/agent/connect/uri_test.go @@ -1,7 +1,6 @@ package connect import ( - "net/url" "testing" "github.com/stretchr/testify/assert" @@ -57,17 +56,13 @@ var testCertURICases = []struct { }, } -func TestParseCertURI(t *testing.T) { +func TestParseCertURIFromString(t *testing.T) { for _, tc := range testCertURICases { t.Run(tc.Name, func(t *testing.T) { assert := assert.New(t) - // Parse the URI, should always be valid - uri, err := url.Parse(tc.URI) - assert.Nil(err) - // Parse the ID and check the error/return value - actual, err := ParseCertURI(uri) + actual, err := ParseCertURIFromString(tc.URI) if err != nil { t.Logf("parse error: %s", err.Error()) } diff --git a/agent/xds/clusters.go b/agent/xds/clusters.go new file mode 100644 index 000000000000..b763d960c19e --- /dev/null +++ b/agent/xds/clusters.go @@ -0,0 +1,79 @@ +package xds + +import ( + "errors" + "time" + + envoy "github.com/envoyproxy/go-control-plane/envoy/api/v2" + envoyauth "github.com/envoyproxy/go-control-plane/envoy/api/v2/auth" + envoycore "github.com/envoyproxy/go-control-plane/envoy/api/v2/core" + "github.com/gogo/protobuf/proto" + + "github.com/hashicorp/consul/agent/proxycfg" +) + +// clustersFromSnapshot returns the xDS API representation of the "clusters" +// (upstreams) in the snapshot. +func clustersFromSnapshot(cfgSnap *proxycfg.ConfigSnapshot, token string) ([]proto.Message, error) { + if cfgSnap == nil { + return nil, errors.New("nil config given") + } + // Include the "app" cluster for the public listener + clusters := make([]proto.Message, len(cfgSnap.Proxy.Upstreams)+1) + + clusters[0] = makeAppCluster(cfgSnap) + + for idx, upstream := range cfgSnap.Proxy.Upstreams { + clusters[idx+1] = makeUpstreamCluster(upstream.Identifier(), cfgSnap) + } + + return clusters, nil +} + +func makeAppCluster(cfgSnap *proxycfg.ConfigSnapshot) *envoy.Cluster { + addr := cfgSnap.Proxy.LocalServiceAddress + if addr == "" { + addr = "127.0.0.1" + } + return &envoy.Cluster{ + Name: LocalAppClusterName, + // TODO(banks): make this configurable from the proxy config + ConnectTimeout: 5 * time.Second, + Type: envoy.Cluster_STATIC, + // API v2 docs say hosts is deprecated and should use LoadAssignment as + // below.. but it doesn't work for tcp_proxy target for some reason. + Hosts: []*envoycore.Address{makeAddressPtr(addr, cfgSnap.Proxy.LocalServicePort)}, + // LoadAssignment: &envoy.ClusterLoadAssignment{ + // ClusterName: LocalAppClusterName, + // Endpoints: []endpoint.LocalityLbEndpoints{ + // { + // LbEndpoints: []endpoint.LbEndpoint{ + // makeEndpoint(LocalAppClusterName, + // addr, + // cfgSnap.Proxy.LocalServicePort), + // }, + // }, + // }, + // }, + } +} + +func makeUpstreamCluster(name string, cfgSnap *proxycfg.ConfigSnapshot) *envoy.Cluster { + return &envoy.Cluster{ + Name: name, + // TODO(banks): make this configurable from the upstream config + ConnectTimeout: 5 * time.Second, + Type: envoy.Cluster_EDS, + EdsClusterConfig: &envoy.Cluster_EdsClusterConfig{ + EdsConfig: &envoycore.ConfigSource{ + ConfigSourceSpecifier: &envoycore.ConfigSource_Ads{ + Ads: &envoycore.AggregatedConfigSource{}, + }, + }, + }, + // Enable TLS upstream with the configured client certificate. + TlsContext: &envoyauth.UpstreamTlsContext{ + CommonTlsContext: makeCommonTLSContext(cfgSnap), + }, + } +} diff --git a/agent/xds/endpoints.go b/agent/xds/endpoints.go new file mode 100644 index 000000000000..59d9e236396e --- /dev/null +++ b/agent/xds/endpoints.go @@ -0,0 +1,58 @@ +package xds + +import ( + "errors" + + envoy "github.com/envoyproxy/go-control-plane/envoy/api/v2" + envoyendpoint "github.com/envoyproxy/go-control-plane/envoy/api/v2/endpoint" + "github.com/gogo/protobuf/proto" + + "github.com/hashicorp/consul/agent/proxycfg" + "github.com/hashicorp/consul/agent/structs" +) + +// endpointsFromSnapshot returns the xDS API representation of the "endpoints" +// (upstream instances) in the snapshot. +func endpointsFromSnapshot(cfgSnap *proxycfg.ConfigSnapshot, token string) ([]proto.Message, error) { + if cfgSnap == nil { + return nil, errors.New("nil config given") + } + resources := make([]proto.Message, 0, len(cfgSnap.UpstreamEndpoints)) + for id, endpoints := range cfgSnap.UpstreamEndpoints { + if len(endpoints) < 1 { + continue + } + la := makeLoadAssignment(id, endpoints) + resources = append(resources, la) + } + return resources, nil +} + +func makeEndpoint(clusterName, host string, port int) envoyendpoint.LbEndpoint { + return envoyendpoint.LbEndpoint{ + Endpoint: &envoyendpoint.Endpoint{ + Address: makeAddressPtr(host, port), + }, + } +} + +func makeLoadAssignment(clusterName string, endpoints structs.CheckServiceNodes) *envoy.ClusterLoadAssignment { + es := make([]envoyendpoint.LbEndpoint, 0, len(endpoints)) + for _, ep := range endpoints { + addr := ep.Service.Address + if addr == "" { + addr = ep.Node.Address + } + es = append(es, envoyendpoint.LbEndpoint{ + Endpoint: &envoyendpoint.Endpoint{ + Address: makeAddressPtr(addr, ep.Service.Port), + }, + }) + } + return &envoy.ClusterLoadAssignment{ + ClusterName: clusterName, + Endpoints: []envoyendpoint.LocalityLbEndpoints{{ + LbEndpoints: es, + }}, + } +} diff --git a/agent/xds/listeners.go b/agent/xds/listeners.go new file mode 100644 index 000000000000..057ee2a7bddc --- /dev/null +++ b/agent/xds/listeners.go @@ -0,0 +1,286 @@ +package xds + +import ( + "encoding/json" + "errors" + "fmt" + + envoy "github.com/envoyproxy/go-control-plane/envoy/api/v2" + envoyauth "github.com/envoyproxy/go-control-plane/envoy/api/v2/auth" + envoycore "github.com/envoyproxy/go-control-plane/envoy/api/v2/core" + envoylistener "github.com/envoyproxy/go-control-plane/envoy/api/v2/listener" + extauthz "github.com/envoyproxy/go-control-plane/envoy/config/filter/network/ext_authz/v2" + envoytcp "github.com/envoyproxy/go-control-plane/envoy/config/filter/network/tcp_proxy/v2" + "github.com/envoyproxy/go-control-plane/pkg/util" + "github.com/gogo/protobuf/jsonpb" + "github.com/gogo/protobuf/proto" + "github.com/gogo/protobuf/types" + + "github.com/hashicorp/consul/agent/proxycfg" + "github.com/hashicorp/consul/agent/structs" +) + +// listenersFromSnapshot returns the xDS API representation of the "listeners" +// in the snapshot. +func listenersFromSnapshot(cfgSnap *proxycfg.ConfigSnapshot, token string) ([]proto.Message, error) { + if cfgSnap == nil { + return nil, errors.New("nil config given") + } + + // One listener for each upstream plus the public one + resources := make([]proto.Message, len(cfgSnap.Proxy.Upstreams)+1) + + // Configure public listener + var err error + resources[0], err = makePublicListener(cfgSnap, token) + if err != nil { + return nil, err + } + for i, u := range cfgSnap.Proxy.Upstreams { + resources[i+1], err = makeUpstreamListener(&u) + if err != nil { + return nil, err + } + } + return resources, nil +} + +// makeListener returns a listener with name and bind details set. Filters must +// be added before it's useful. +// +// Note on names: Envoy listeners attempt graceful transitions of connections +// when their config changes but that means they can't have their bind address +// or port changed in a running instance. Since our users might choose to change +// a bind address or port for the public or upstream listeners, we need to +// encode those into the unique name for the listener such that if the user +// changes them, we actually create a whole new listener on the new address and +// port. Envoy should take care of closing the old one once it sees it's no +// longer in the config. +func makeListener(name, addr string, port int) *envoy.Listener { + return &envoy.Listener{ + Name: fmt.Sprintf("%s:%s:%d", name, addr, port), + Address: makeAddress(addr, port), + } +} + +// makeListenerFromUserConfig returns the listener config decoded from an +// arbitrary proto3 json format string or an error if it's invalid. +// +// For now we only support embedding in JSON strings because of the hcl parsing +// pain (see config.go comment above call to patchSliceOfMaps). Until we +// refactor config parser a _lot_ user's opaque config that contains arrays will +// be mangled. We could actually fix that up in mapstructure which knows the +// type of the target so could resolve the slices to singletons unambiguously +// and it would work for us here... but we still have the problem that the +// config would render incorrectly in general in our HTTP API responses so we +// really need to fix it "properly". +// +// When we do that we can support just nesting the config directly into the +// JSON/hcl naturally but this is a stop-gap that gets us an escape hatch +// immediately. It's also probably not a bad thing to support long-term since +// any config generated by other systems will likely be in canonical protobuf +// from rather than our slight variant in JSON/hcl. +func makeListenerFromUserConfig(configJSON string) (*envoy.Listener, error) { + // Figure out if there is an @type field. We don't require is since we know + // this will be a listener but unmarshalling into types.Any fails if it's not + // there and unmarshalling into listener directly fails if it is... + var jsonFields map[string]*json.RawMessage + if err := json.Unmarshal([]byte(configJSON), &jsonFields); err != nil { + return nil, err + } + + var l envoy.Listener + + if _, ok := jsonFields["@type"]; ok { + // Type field is present so decode it as a types.Any + var any types.Any + err := jsonpb.UnmarshalString(configJSON, &any) + if err != nil { + return nil, err + } + // And then unmarshal the listener again... + err = proto.Unmarshal(any.Value, &l) + if err != nil { + return nil, err + } + return &l, err + } + + // No @type so try decoding as a straight listener. + err := jsonpb.UnmarshalString(configJSON, &l) + return &l, err +} + +// Ensure that the first filter in each filter chain of a public listener is the +// authz filter to prevent unauthorised access and that every filter chain uses +// our TLS certs. We might allow users to work around this later if there is a +// good use case but this is actually a feature for now as it allows them to +// specify custom listener params in config but still get our certs delivered +// dynamically and intentions enforced without coming up with some complicated +// templating/merging solution. +func injectConnectFilters(cfgSnap *proxycfg.ConfigSnapshot, token string, listener *envoy.Listener) error { + authFilter, err := makeExtAuthFilter(token) + if err != nil { + return err + } + for idx := range listener.FilterChains { + // Insert our authz filter before any others + listener.FilterChains[idx].Filters = + append([]envoylistener.Filter{authFilter}, listener.FilterChains[idx].Filters...) + + // Force our TLS for all filter chains on a public listener + listener.FilterChains[idx].TlsContext = &envoyauth.DownstreamTlsContext{ + CommonTlsContext: makeCommonTLSContext(cfgSnap), + RequireClientCertificate: &types.BoolValue{Value: true}, + } + } + return nil +} + +func makePublicListener(cfgSnap *proxycfg.ConfigSnapshot, token string) (proto.Message, error) { + var l *envoy.Listener + var err error + + if listenerJSONRaw, ok := cfgSnap.Proxy.Config["envoy_public_listener_json"]; ok { + if listenerJSON, ok := listenerJSONRaw.(string); ok { + l, err = makeListenerFromUserConfig(listenerJSON) + if err != nil { + return l, err + } + } + } + + if l == nil { + // No user config, use default listener + addr := cfgSnap.Address + if addr == "" { + addr = "0.0.0.0" + } + l = makeListener(PublicListenerName, addr, cfgSnap.Port) + tcpProxy, err := makeTCPProxyFilter("public_listener", LocalAppClusterName) + if err != nil { + return l, err + } + // Setup TCP proxy for now. We inject TLS and authz below for both default + // and custom config cases. + l.FilterChains = []envoylistener.FilterChain{ + { + Filters: []envoylistener.Filter{ + tcpProxy, + }, + }, + } + } + + err = injectConnectFilters(cfgSnap, token, l) + return l, err +} + +func makeUpstreamListener(u *structs.Upstream) (proto.Message, error) { + if listenerJSONRaw, ok := u.Config["envoy_listener_json"]; ok { + if listenerJSON, ok := listenerJSONRaw.(string); ok { + return makeListenerFromUserConfig(listenerJSON) + } + } + addr := u.LocalBindAddress + if addr == "" { + addr = "127.0.0.1" + } + l := makeListener(u.Identifier(), addr, u.LocalBindPort) + tcpProxy, err := makeTCPProxyFilter(u.Identifier(), u.Identifier()) + if err != nil { + return l, err + } + l.FilterChains = []envoylistener.FilterChain{ + { + Filters: []envoylistener.Filter{ + tcpProxy, + }, + }, + } + return l, nil +} + +func makeTCPProxyFilter(name, cluster string) (envoylistener.Filter, error) { + cfg := &envoytcp.TcpProxy{ + StatPrefix: name, + Cluster: cluster, + } + return makeFilter("envoy.tcp_proxy", cfg) +} + +func makeExtAuthFilter(token string) (envoylistener.Filter, error) { + cfg := &extauthz.ExtAuthz{ + StatPrefix: "connect_authz", + GrpcService: &envoycore.GrpcService{ + // Attach token header so we can authorize the callbacks. Technically + // authorize is not really protected data but we locked down the HTTP + // implementation to need service:write and since we have the token that + // has that it's pretty reasonable to set it up here. + InitialMetadata: []*envoycore.HeaderValue{ + &envoycore.HeaderValue{ + Key: "x-consul-token", + Value: token, + }, + }, + TargetSpecifier: &envoycore.GrpcService_EnvoyGrpc_{ + EnvoyGrpc: &envoycore.GrpcService_EnvoyGrpc{ + ClusterName: LocalAgentClusterName, + }, + }, + }, + FailureModeAllow: false, + } + return makeFilter("envoy.ext_authz", cfg) +} + +func makeFilter(name string, cfg proto.Message) (envoylistener.Filter, error) { + // Ridiculous dance to make that pbstruct into types.Struct by... encoding it + // as JSON and decoding again!! + cfgStruct, err := util.MessageToStruct(cfg) + if err != nil { + return envoylistener.Filter{}, err + } + + return envoylistener.Filter{ + Name: name, + Config: cfgStruct, + }, nil +} + +func makeCommonTLSContext(cfgSnap *proxycfg.ConfigSnapshot) *envoyauth.CommonTlsContext { + // Concatenate all the root PEMs into one. + // TODO(banks): verify this actually works with Envoy (docs are not clear). + rootPEMS := "" + for _, root := range cfgSnap.Roots.Roots { + rootPEMS += root.RootCert + } + + return &envoyauth.CommonTlsContext{ + TlsParams: &envoyauth.TlsParameters{}, + TlsCertificates: []*envoyauth.TlsCertificate{ + &envoyauth.TlsCertificate{ + CertificateChain: &envoycore.DataSource{ + Specifier: &envoycore.DataSource_InlineString{ + InlineString: cfgSnap.Leaf.CertPEM, + }, + }, + PrivateKey: &envoycore.DataSource{ + Specifier: &envoycore.DataSource_InlineString{ + InlineString: cfgSnap.Leaf.PrivateKeyPEM, + }, + }, + }, + }, + ValidationContextType: &envoyauth.CommonTlsContext_ValidationContext{ + ValidationContext: &envoyauth.CertificateValidationContext{ + // TODO(banks): later for L7 support we may need to configure ALPN here. + TrustedCa: &envoycore.DataSource{ + Specifier: &envoycore.DataSource_InlineString{ + InlineString: rootPEMS, + }, + }, + }, + }, + } +} diff --git a/agent/xds/response.go b/agent/xds/response.go new file mode 100644 index 000000000000..4ff1412b4421 --- /dev/null +++ b/agent/xds/response.go @@ -0,0 +1,54 @@ +package xds + +import ( + envoy "github.com/envoyproxy/go-control-plane/envoy/api/v2" + envoycore "github.com/envoyproxy/go-control-plane/envoy/api/v2/core" + "github.com/gogo/protobuf/proto" + "github.com/gogo/protobuf/types" +) + +func createResponse(typeURL string, version, nonce string, resources []proto.Message) (*envoy.DiscoveryResponse, error) { + anys := make([]types.Any, len(resources)) + for i, r := range resources { + if r == nil { + continue + } + if any, ok := r.(*types.Any); ok { + anys[i] = *any + continue + } + data, err := proto.Marshal(r) + if err != nil { + return nil, err + } + anys[i] = types.Any{ + TypeUrl: typeURL, + Value: data, + } + } + resp := &envoy.DiscoveryResponse{ + VersionInfo: version, + Resources: anys, + TypeUrl: typeURL, + Nonce: nonce, + } + return resp, nil +} + +func makeAddress(ip string, port int) envoycore.Address { + return envoycore.Address{ + Address: &envoycore.Address_SocketAddress{ + SocketAddress: &envoycore.SocketAddress{ + Address: ip, + PortSpecifier: &envoycore.SocketAddress_PortValue{ + PortValue: uint32(port), + }, + }, + }, + } +} + +func makeAddressPtr(ip string, port int) *envoycore.Address { + a := makeAddress(ip, port) + return &a +} diff --git a/agent/xds/routes.go b/agent/xds/routes.go new file mode 100644 index 000000000000..0d904e741a03 --- /dev/null +++ b/agent/xds/routes.go @@ -0,0 +1,19 @@ +package xds + +import ( + "errors" + + "github.com/gogo/protobuf/proto" + + "github.com/hashicorp/consul/agent/proxycfg" +) + +// routesFromSnapshot returns the xDS API representation of the "routes" +// in the snapshot. +func routesFromSnapshot(cfgSnap *proxycfg.ConfigSnapshot, token string) ([]proto.Message, error) { + if cfgSnap == nil { + return nil, errors.New("nil config given") + } + // We don't support routes yet but probably will later + return nil, nil +} diff --git a/agent/xds/server.go b/agent/xds/server.go new file mode 100644 index 000000000000..1d0a7edf64e6 --- /dev/null +++ b/agent/xds/server.go @@ -0,0 +1,429 @@ +package xds + +import ( + "context" + "errors" + "fmt" + "log" + "sync/atomic" + + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/credentials" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/status" + + envoy "github.com/envoyproxy/go-control-plane/envoy/api/v2" + envoyauthz "github.com/envoyproxy/go-control-plane/envoy/service/auth/v2alpha" + envoydisco "github.com/envoyproxy/go-control-plane/envoy/service/discovery/v2" + "github.com/gogo/googleapis/google/rpc" + "github.com/gogo/protobuf/proto" + "github.com/hashicorp/consul/acl" + "github.com/hashicorp/consul/agent/cache" + "github.com/hashicorp/consul/agent/connect" + "github.com/hashicorp/consul/agent/proxycfg" + "github.com/hashicorp/consul/agent/structs" +) + +// ADSStream is a shorter way of referring to this thing... +type ADSStream = envoydisco.AggregatedDiscoveryService_StreamAggregatedResourcesServer + +const ( + // Resource types in xDS v2. These are copied from + // envoyproxy/go-control-plane/pkg/cache/resource.go since we don't need any of + // the rest of that package. + typePrefix = "type.googleapis.com/envoy.api.v2." + + // EndpointType is the TypeURL for Endpoint discovery responses. + EndpointType = typePrefix + "ClusterLoadAssignment" + + // ClusterType is the TypeURL for Cluster discovery responses. + ClusterType = typePrefix + "Cluster" + + // RouteType is the TypeURL for Route discovery responses. + RouteType = typePrefix + "RouteConfiguration" + + // ListenerType is the TypeURL for Listener discovery responses. + ListenerType = typePrefix + "Listener" + + // PublicListenerName is the name we give the public listener in Envoy config. + PublicListenerName = "public_listener" + + // LocalAppClusterName is the name we give the local application "cluster" in + // Envoy config. + LocalAppClusterName = "local_app" + + // LocalAgentClusterName is the name we give the local agent "cluster" in + // Envoy config. + LocalAgentClusterName = "local_agent" +) + +// ACLResolverFunc is a shim to resolve ACLs. Since ACL enforcement is so far +// entirely agent-local and all uses private methods this allows a simple shim +// to be written in the agent package to allow resolving without tightly +// coupling this to the agent. +type ACLResolverFunc func(id string) (acl.ACL, error) + +// ConnectAuthz is the interface the agent needs to expose to be able to re-use +// the authorization logic between both APIs. +type ConnectAuthz interface { + // ConnectAuthorize is implemented by Agent.ConnectAuthorize + ConnectAuthorize(token string, req *structs.ConnectAuthorizeRequest) (authz bool, reason string, m *cache.ResultMeta, err error) +} + +// ConfigManager is the interface xds.Server requires to consume proxy config +// updates. It's satisfied normally by the agent's proxycfg.Manager, but allows +// easier testing without several layers of mocked cache, local state and +// proxycfg.Manager. +type ConfigManager interface { + Watch(proxyID string) (<-chan *proxycfg.ConfigSnapshot, func()) +} + +// Server represents a gRPC server that can handle both XDS and ext_authz +// requests from Envoy. All of it's public members must be set before the gRPC +// server is started. +// +// A full description of the XDS protocol can be found at +// https://github.com/envoyproxy/data-plane-api/blob/master/XDS_PROTOCOL.md +type Server struct { + Logger *log.Logger + CfgMgr ConfigManager + Authz ConnectAuthz + ResolveToken ACLResolverFunc +} + +// StreamAggregatedResources implements +// envoydisco.AggregatedDiscoveryServiceServer. This is the ADS endpoint which is +// the only xDS API we directly support for now. +func (s *Server) StreamAggregatedResources(stream ADSStream) error { + // a channel for receiving incoming requests + reqCh := make(chan *envoy.DiscoveryRequest) + reqStop := int32(0) + go func() { + for { + req, err := stream.Recv() + if atomic.LoadInt32(&reqStop) != 0 { + return + } + if err != nil { + close(reqCh) + return + } + reqCh <- req + } + }() + + err := s.process(stream, reqCh) + if err != nil { + s.Logger.Printf("[DEBUG] Error handling ADS stream: %s", err) + } + + // prevents writing to a closed channel if send failed on blocked recv + atomic.StoreInt32(&reqStop, 1) + + return err +} + +const ( + stateInit int = iota + statePendingAuth + stateRunning +) + +func (s *Server) process(stream ADSStream, reqCh <-chan *envoy.DiscoveryRequest) error { + // xDS requires a unique nonce to correlate response/request pairs + var nonce uint64 + + // xDS works with versions of configs. Internally we don't have a consistent + // version. We could just hash the config since versions don't have to be + // ordered as far as I can tell, but it's cheaper just to increment a counter + // every time we observe a new config since the upstream proxycfg package only + // delivers updates when there are actual changes. + var configVersion uint64 + + // Loop state + var cfgSnap *proxycfg.ConfigSnapshot + var req *envoy.DiscoveryRequest + var ok bool + var stateCh <-chan *proxycfg.ConfigSnapshot + var watchCancel func() + var proxyID string + + // need to run a small state machine to get through initial authentication. + var state = stateInit + + // Configure handlers for each type of request + handlers := map[string]*xDSType{ + EndpointType: &xDSType{ + typeURL: EndpointType, + resources: endpointsFromSnapshot, + stream: stream, + }, + ClusterType: &xDSType{ + typeURL: ClusterType, + resources: clustersFromSnapshot, + stream: stream, + }, + RouteType: &xDSType{ + typeURL: RouteType, + resources: routesFromSnapshot, + stream: stream, + }, + ListenerType: &xDSType{ + typeURL: ListenerType, + resources: listenersFromSnapshot, + stream: stream, + }, + } + + for { + select { + case req, ok = <-reqCh: + if !ok { + // reqCh is closed when stream.Recv errors which is how we detect client + // going away. AFAICT the stream.Context() is only cancelled once the + // RPC method returns which it can't until we return from this one so + // there's no point in blocking on that. + return nil + } + if req.TypeUrl == "" { + return status.Errorf(codes.InvalidArgument, "type URL is required for ADS") + } + if handler, ok := handlers[req.TypeUrl]; ok { + handler.Recv(req) + } + case cfgSnap = <-stateCh: + // We got a new config, update the version counter + configVersion++ + } + + // Trigger state machine + switch state { + case stateInit: + if req == nil { + // This can't happen (tm) since stateCh is nil until after the first req + // is received but lets not panic about it. + continue + } + // Start authentication process, we need the proxyID + proxyID = req.Node.Id + + // Start watching config for that proxy + stateCh, watchCancel = s.CfgMgr.Watch(proxyID) + // Note that in this case we _intend_ the defer to only be triggered when + // this whole process method ends (i.e. when streaming RPC aborts) not at + // the end of the current loop iteration. We have to do it in the loop + // here since we can't start watching until we get to this state in the + // state machine. + defer watchCancel() + + // Now wait for the config so we can check ACL + state = statePendingAuth + case statePendingAuth: + if cfgSnap == nil { + // Nothing we can do until we get the initial config + continue + } + // Got config, try to authenticate + token := tokenFromStream(stream) + rule, err := s.ResolveToken(token) + if err != nil { + return err + } + if rule != nil && !rule.ServiceWrite(cfgSnap.Proxy.DestinationServiceName, nil) { + return status.Errorf(codes.PermissionDenied, "permission denied") + } + // Authed OK! + state = stateRunning + + // Lets actually process the config we just got or we'll mis responding + fallthrough + case stateRunning: + // See if any handlers need to have the current (possibly new) config + // sent. Note the order here is actually significant so we can't just + // range the map which has no determined order. It's important because: + // + // 1. Envoy needs to see a consistent snapshot to avoid potentially + // dropping traffic due to inconsistencies. This is the + // main win of ADS after all - we get to control this order. + // 2. Non-determinsic order of complex protobuf responses which are + // compared for non-exact JSON equivalence makes the tests uber-messy + // to handle + for _, typeURL := range []string{ClusterType, EndpointType, RouteType, ListenerType} { + handler := handlers[typeURL] + if err := handler.SendIfNew(cfgSnap, configVersion, &nonce); err != nil { + return err + } + } + } + } +} + +type xDSType struct { + typeURL string + stream ADSStream + req *envoy.DiscoveryRequest + lastNonce string + // lastVersion is the version that was last sent to the proxy. It is needed + // because we don't want to send the same version more than once. + // req.VersionInfo may be an older version than the most recent once sent in + // two cases: 1) if the ACK wasn't received yet and `req` still points to the + // previous request we already responded to and 2) if the proxy rejected the + // last version we sent with a Nack then req.VersionInfo will be the older + // version it's hanging on to. + lastVersion uint64 + resources func(cfgSnap *proxycfg.ConfigSnapshot, token string) ([]proto.Message, error) +} + +func (t *xDSType) Recv(req *envoy.DiscoveryRequest) { + if t.lastNonce == "" || t.lastNonce == req.GetResponseNonce() { + t.req = req + } +} + +func (t *xDSType) SendIfNew(cfgSnap *proxycfg.ConfigSnapshot, version uint64, nonce *uint64) error { + if t.req == nil { + return nil + } + if t.lastVersion >= version { + // Already sent this version + return nil + } + resources, err := t.resources(cfgSnap, tokenFromStream(t.stream)) + if err != nil { + return err + } + if resources == nil || len(resources) == 0 { + // Nothing to send yet + return nil + } + + // Note we only increment nonce when we actually send - not important for + // correctness but makes tests much simpler when we skip a type like Routes + // with nothing to send. + *nonce++ + nonceStr := fmt.Sprintf("%08x", *nonce) + versionStr := fmt.Sprintf("%08x", version) + + resp, err := createResponse(t.typeURL, versionStr, nonceStr, resources) + if err != nil { + return err + } + + err = t.stream.Send(resp) + if err != nil { + return err + } + t.lastVersion = version + t.lastNonce = nonceStr + return nil +} + +func tokenFromStream(stream ADSStream) string { + return tokenFromContext(stream.Context()) +} + +func tokenFromContext(ctx context.Context) string { + md, ok := metadata.FromIncomingContext(ctx) + if !ok { + return "" + } + toks, ok := md["x-consul-token"] + if ok && len(toks) > 0 { + return toks[0] + } + return "" +} + +// IncrementalAggregatedResources implements envoydisco.AggregatedDiscoveryServiceServer +func (s *Server) IncrementalAggregatedResources(_ envoydisco.AggregatedDiscoveryService_IncrementalAggregatedResourcesServer) error { + return errors.New("not implemented") +} + +func deniedResponse(reason string) (*envoyauthz.CheckResponse, error) { + return &envoyauthz.CheckResponse{ + Status: &rpc.Status{ + Code: int32(rpc.PERMISSION_DENIED), + Message: "Denied: " + reason, + }, + }, nil +} + +// Check implements envoyauthz.AuthorizationServer. +func (s *Server) Check(ctx context.Context, r *envoyauthz.CheckRequest) (*envoyauthz.CheckResponse, error) { + // Sanity checks + if r.Attributes == nil || r.Attributes.Source == nil || r.Attributes.Destination == nil { + return nil, status.Error(codes.InvalidArgument, "source and destination attributes are required") + } + if r.Attributes.Source.Principal == "" || r.Attributes.Destination.Principal == "" { + return nil, status.Error(codes.InvalidArgument, "source and destination Principal are required") + } + + // Parse destination to know the target service + dest, err := connect.ParseCertURIFromString(r.Attributes.Destination.Principal) + if err != nil { + // Treat this as an auth error since Envoy has sent something it considers + // valid, it's just not an identity we trust. + return deniedResponse("Destination Principal is not a valid Connect identitiy") + } + + destID, ok := dest.(*connect.SpiffeIDService) + if !ok { + return deniedResponse("Destination Principal is not a valid Service identitiy") + } + + // For now we don't validate the trust domain of the _destination_ at all - + // the HTTP Authorize endpoint just accepts a target _service_ and it's + // implicit that the request is for the correct cluster. We might want to + // reconsider this later but plumbing in additional machinery to check the + // clusterID here is not really necessary for now unless Envoys are badly + // configured. Our threat model _requires_ correctly configured and well + // behaved proxies given that they have ACLs to fetch certs and so can do + // whatever they want including not authorizing traffic at all or routing it + // do a different service than they auth'd against. + + // Create an authz request + req := &structs.ConnectAuthorizeRequest{ + Target: destID.Service, + ClientCertURI: r.Attributes.Source.Principal, + // TODO(banks): need Envoy to support sending cert serial/hash to enforce + // revocation later. + } + token := tokenFromContext(ctx) + authed, reason, _, err := s.Authz.ConnectAuthorize(token, req) + if err != nil { + if err == acl.ErrPermissionDenied { + return nil, status.Error(codes.PermissionDenied, err.Error()) + } + return nil, status.Error(codes.Internal, err.Error()) + } + if !authed { + return deniedResponse(reason) + } + + return &envoyauthz.CheckResponse{ + Status: &rpc.Status{ + Code: int32(rpc.OK), + Message: "ALLOWED: " + reason, + }, + }, nil +} + +// GRPCServer returns a server instance that can handle XDS and ext_authz +// requests. +func (s *Server) GRPCServer(certFile, keyFile string) (*grpc.Server, error) { + opts := []grpc.ServerOption{ + grpc.MaxConcurrentStreams(2048), + } + if certFile != "" && keyFile != "" { + creds, err := credentials.NewServerTLSFromFile(certFile, keyFile) + if err != nil { + return nil, err + } + opts = append(opts, grpc.Creds(creds)) + } + srv := grpc.NewServer(opts...) + envoydisco.RegisterAggregatedDiscoveryServiceServer(srv, s) + envoyauthz.RegisterAuthorizationServer(srv, s) + return srv, nil +} diff --git a/agent/xds/server_test.go b/agent/xds/server_test.go new file mode 100644 index 000000000000..afec10a62da2 --- /dev/null +++ b/agent/xds/server_test.go @@ -0,0 +1,975 @@ +package xds + +import ( + "bytes" + "context" + "errors" + "fmt" + "log" + "os" + "strings" + "sync" + "testing" + "text/template" + "time" + + envoy "github.com/envoyproxy/go-control-plane/envoy/api/v2" + "github.com/gogo/protobuf/jsonpb" + "github.com/stretchr/testify/require" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/status" + + "github.com/hashicorp/consul/acl" + "github.com/hashicorp/consul/agent/cache" + "github.com/hashicorp/consul/agent/proxycfg" + "github.com/hashicorp/consul/agent/structs" +) + +// testManager is a mock of proxycfg.Manager that's simpler to control for +// testing. It also implements ConnectAuthz to allow control over authorization. +type testManager struct { + sync.Mutex + chans map[string]chan *proxycfg.ConfigSnapshot + cancels chan string + authz map[string]connectAuthzResult +} + +type connectAuthzResult struct { + authz bool + reason string + m *cache.ResultMeta + err error +} + +func newTestManager(t *testing.T) *testManager { + return &testManager{ + chans: map[string]chan *proxycfg.ConfigSnapshot{}, + cancels: make(chan string, 10), + authz: make(map[string]connectAuthzResult), + } +} + +// RegisterProxy simulates a proxy registration +func (m *testManager) RegisterProxy(t *testing.T, proxyID string) { + m.Lock() + defer m.Unlock() + m.chans[proxyID] = make(chan *proxycfg.ConfigSnapshot, 1) +} + +// Deliver simulates a proxy registration +func (m *testManager) DeliverConfig(t *testing.T, proxyID string, cfg *proxycfg.ConfigSnapshot) { + t.Helper() + m.Lock() + defer m.Unlock() + select { + case m.chans[proxyID] <- cfg: + case <-time.After(10 * time.Millisecond): + t.Fatalf("took too long to deliver config") + } +} + +// Watch implements ConfigManager +func (m *testManager) Watch(proxyID string) (<-chan *proxycfg.ConfigSnapshot, func()) { + m.Lock() + defer m.Unlock() + // ch might be nil but then it will just block forever + return m.chans[proxyID], func() { + m.cancels <- proxyID + } +} + +// AssertWatchCancelled checks that the most recent call to a Watch cancel func +// was from the specified proxyID and that one is made in a short time. This +// probably won't work if you are running multiple Watches in parallel on +// multiple proxyIDS due to timing/ordering issues but I dont think we need to +// do that. +func (m *testManager) AssertWatchCancelled(t *testing.T, proxyID string) { + t.Helper() + select { + case got := <-m.cancels: + require.Equal(t, proxyID, got) + case <-time.After(50 * time.Millisecond): + t.Fatalf("timed out waiting for Watch cancel for %s", proxyID) + } +} + +// ConnectAuthorize implements ConnectAuthz +func (m *testManager) ConnectAuthorize(token string, req *structs.ConnectAuthorizeRequest) (authz bool, reason string, meta *cache.ResultMeta, err error) { + m.Lock() + defer m.Unlock() + if res, ok := m.authz[token]; ok { + return res.authz, res.reason, res.m, res.err + } + // Default allow but with reason that won't match by accident in a test case + return true, "OK: allowed by default test implementation", nil, nil +} + +func TestServer_StreamAggregatedResources_BasicProtocol(t *testing.T) { + logger := log.New(os.Stderr, "", log.LstdFlags) + mgr := newTestManager(t) + aclResolve := func(id string) (acl.ACL, error) { + // Allow all + return acl.RootACL("manage"), nil + } + envoy := NewTestEnvoy(t, "web-sidecar-proxy", "") + defer envoy.Close() + + s := Server{logger, mgr, mgr, aclResolve} + + go func() { + err := s.StreamAggregatedResources(envoy.stream) + require.NoError(t, err) + }() + + // Register the proxy to create state needed to Watch() on + mgr.RegisterProxy(t, "web-sidecar-proxy") + + // Send initial cluster discover + envoy.SendReq(t, ClusterType, 0, 0) + + // Check no response sent yet + assertChanBlocked(t, envoy.stream.sendCh) + + // Deliver a new snapshot + snap := proxycfg.TestConfigSnapshot(t) + mgr.DeliverConfig(t, "web-sidecar-proxy", snap) + + assertResponseSent(t, envoy.stream.sendCh, expectClustersJSON(t, snap, "", 1, 1)) + + // Envoy then tries to discover endpoints for those clusters. Technically it + // includes the cluster names in the ResourceNames field but we ignore that + // completely for now so not bothering to simulate that. + envoy.SendReq(t, EndpointType, 0, 0) + + // It also (in parallel) issues the next cluster request (which acts as an ACK + // of the version we sent) + envoy.SendReq(t, ClusterType, 1, 1) + + // We should get a response immediately since the config is already present in + // the server for endpoints. Note that this should not be racy if the server + // is behaving well since the Cluster send above should be blocked until we + // deliver a new config version. + assertResponseSent(t, envoy.stream.sendCh, expectEndpointsJSON(t, snap, "", 1, 2)) + + // And no other response yet + assertChanBlocked(t, envoy.stream.sendCh) + + // Envoy now sends listener request along with next endpoint one + envoy.SendReq(t, ListenerType, 0, 0) + envoy.SendReq(t, EndpointType, 1, 2) + + // And should get a response immediately. + assertResponseSent(t, envoy.stream.sendCh, expectListenerJSON(t, snap, "", 1, 3)) + + // Now send Route request along with next listner one + envoy.SendReq(t, RouteType, 0, 0) + envoy.SendReq(t, ListenerType, 1, 3) + + // We don't serve routes yet so this shoould block with no response + assertChanBlocked(t, envoy.stream.sendCh) + + // WOOP! Envoy now has full connect config. Lets verify that if we update it, + // all the responses get resent with the new version. We don't actually want + // to change everything because that's tedious - our implementation will + // actually resend all blocked types on the new "version" anyway since it + // doesn't know _what_ changed. We could do something trivial but let's + // simulate a leaf cert expiring and being rotated. + snap.Leaf = proxycfg.TestLeafForCA(t, snap.Roots.Roots[0]) + mgr.DeliverConfig(t, "web-sidecar-proxy", snap) + + // All 3 response that have something to return should return with new version + // note that the ordering is not determinisic in general. Trying to make this + // test order-agnostic though is a massive pain since we are comparing + // non-identical JSON strings (so can simply sort by anything) and because we + // don't know the order the nonces will be assigned. For now we rely and + // require our implementation to always deliver updates in a specific order + // which is reasonable anyway to ensure consistency of the config Envoy sees. + assertResponseSent(t, envoy.stream.sendCh, expectClustersJSON(t, snap, "", 2, 4)) + assertResponseSent(t, envoy.stream.sendCh, expectEndpointsJSON(t, snap, "", 2, 5)) + assertResponseSent(t, envoy.stream.sendCh, expectListenerJSON(t, snap, "", 2, 6)) + + // Let's pretent that Envoy doesn't like that new listener config. It will ACK + // all the others (same version) but NACK the listener. This is the most + // subtle part of xDS and the server implementation so I'll elaborate. A full + // description of the protocol can be found at + // https://github.com/envoyproxy/data-plane-api/blob/master/XDS_PROTOCOL.md. + // Envoy delays making a followup reqeest for a type until after it has + // processed and applied the last response. The next request then will include + // the nonce in the last response which acknowledges _recieving_ and handling + // that response. It also includes the currently applied version. If all is + // good and it successfully applies the config, then the version in the next + // response will be the same version just sent. This is considered to be an + // ACK of that version for that type. If envoy fails to apply the config for + // some reason, it will still acknowledge that it received it (still return + // the responses nonce), but will show the previous version it's still using. + // This is considered a NACK. It's impotant that the server pay attention to + // the _nonce_ and not the version when deciding what to send otherwise a bad + // version that can't be applied in Envoy will cause a busy loop. + // + // In this case we are simulating that Envoy failed to apply the Listener + // response but did apply the other types so all get the new nonces, but + // listener stays on v1. + envoy.SendReq(t, ClusterType, 2, 4) + envoy.SendReq(t, EndpointType, 2, 5) + envoy.SendReq(t, ListenerType, 1, 6) // v1 is a NACK + + // Even though we nacked, we should still NOT get then v2 listeners + // redelivered since nothing has changed. + assertChanBlocked(t, envoy.stream.sendCh) + + // Change config again and make sure it's delivered to everyone! + snap.Leaf = proxycfg.TestLeafForCA(t, snap.Roots.Roots[0]) + mgr.DeliverConfig(t, "web-sidecar-proxy", snap) + + assertResponseSent(t, envoy.stream.sendCh, expectClustersJSON(t, snap, "", 3, 7)) + assertResponseSent(t, envoy.stream.sendCh, expectEndpointsJSON(t, snap, "", 3, 8)) + assertResponseSent(t, envoy.stream.sendCh, expectListenerJSON(t, snap, "", 3, 9)) +} + +func expectListenerJSONResources(t *testing.T, snap *proxycfg.ConfigSnapshot, token string, v, n uint64) map[string]string { + tokenVal := "" + if token != "" { + tokenVal = fmt.Sprintf(",\n"+`"value": "%s"`, token) + } + return map[string]string{ + "public_listener": `{ + "@type": "type.googleapis.com/envoy.api.v2.Listener", + "name": "public_listener:0.0.0.0:9999", + "address": { + "socketAddress": { + "address": "0.0.0.0", + "portValue": 9999 + } + }, + "filterChains": [ + { + "tlsContext": ` + expectedPublicTLSContextJSON(t, snap) + `, + "filters": [ + { + "name": "envoy.ext_authz", + "config": { + "grpc_service": { + "envoy_grpc": { + "cluster_name": "local_agent" + }, + "initial_metadata": [ + { + "key": "x-consul-token" + ` + tokenVal + ` + } + ] + }, + "stat_prefix": "connect_authz" + } + }, + { + "name": "envoy.tcp_proxy", + "config": { + "cluster": "local_app", + "stat_prefix": "public_listener" + } + } + ] + } + ] + }`, + "service:db": `{ + "@type": "type.googleapis.com/envoy.api.v2.Listener", + "name": "service:db:127.0.0.1:9191", + "address": { + "socketAddress": { + "address": "127.0.0.1", + "portValue": 9191 + } + }, + "filterChains": [ + { + "filters": [ + { + "name": "envoy.tcp_proxy", + "config": { + "cluster": "service:db", + "stat_prefix": "service:db" + } + } + ] + } + ] + }`, + "prepared_query:geo-cache": `{ + "@type": "type.googleapis.com/envoy.api.v2.Listener", + "name": "prepared_query:geo-cache:127.10.10.10:8181", + "address": { + "socketAddress": { + "address": "127.10.10.10", + "portValue": 8181 + } + }, + "filterChains": [ + { + "filters": [ + { + "name": "envoy.tcp_proxy", + "config": { + "cluster": "prepared_query:geo-cache", + "stat_prefix": "prepared_query:geo-cache" + } + } + ] + } + ] + }`, + } +} + +func expectListenerJSONFromResources(t *testing.T, snap *proxycfg.ConfigSnapshot, token string, v, n uint64, resourcesJSON map[string]string) string { + resJSON := "" + // Sort resources into specific order because that matters in JSONEq + // comparison later. + keyOrder := []string{"public_listener"} + for _, u := range snap.Proxy.Upstreams { + keyOrder = append(keyOrder, u.Identifier()) + } + for _, k := range keyOrder { + j, ok := resourcesJSON[k] + if !ok { + continue + } + if resJSON != "" { + resJSON += ",\n" + } + resJSON += j + } + return `{ + "versionInfo": "` + hexString(v) + `", + "resources": [` + resJSON + `], + "typeUrl": "type.googleapis.com/envoy.api.v2.Listener", + "nonce": "` + hexString(n) + `" + }` +} + +func expectListenerJSON(t *testing.T, snap *proxycfg.ConfigSnapshot, token string, v, n uint64) string { + return expectListenerJSONFromResources(t, snap, token, v, n, + expectListenerJSONResources(t, snap, token, v, n)) +} + +func expectEndpointsJSON(t *testing.T, snap *proxycfg.ConfigSnapshot, token string, v, n uint64) string { + return `{ + "versionInfo": "` + hexString(v) + `", + "resources": [ + { + "@type": "type.googleapis.com/envoy.api.v2.ClusterLoadAssignment", + "clusterName": "service:db", + "endpoints": [ + { + "lbEndpoints": [ + { + "endpoint": { + "address": { + "socketAddress": { + "address": "10.10.1.1", + "portValue": 0 + } + } + } + }, + { + "endpoint": { + "address": { + "socketAddress": { + "address": "10.10.1.2", + "portValue": 0 + } + } + } + } + ] + } + ] + } + ], + "typeUrl": "type.googleapis.com/envoy.api.v2.ClusterLoadAssignment", + "nonce": "` + hexString(n) + `" + }` +} + +func expectClustersJSON(t *testing.T, snap *proxycfg.ConfigSnapshot, token string, v, n uint64) string { + return `{ + "versionInfo": "` + hexString(v) + `", + "resources": [ + { + "@type": "type.googleapis.com/envoy.api.v2.Cluster", + "name": "local_app", + "connectTimeout": "5s", + "hosts": [ + { + "socketAddress": { + "address": "127.0.0.1", + "portValue": 8080 + } + } + ] + }, + { + "@type": "type.googleapis.com/envoy.api.v2.Cluster", + "name": "service:db", + "type": "EDS", + "edsClusterConfig": { + "edsConfig": { + "ads": { + + } + } + }, + "connectTimeout": "5s", + "tlsContext": ` + expectedUpstreamTLSContextJSON(t, snap) + ` + }, + { + "@type": "type.googleapis.com/envoy.api.v2.Cluster", + "name": "prepared_query:geo-cache", + "type": "EDS", + "edsClusterConfig": { + "edsConfig": { + "ads": { + + } + } + }, + "connectTimeout": "5s", + "tlsContext": ` + expectedUpstreamTLSContextJSON(t, snap) + ` + } + ], + "typeUrl": "type.googleapis.com/envoy.api.v2.Cluster", + "nonce": "` + hexString(n) + `" + } + ` +} + +func expectedUpstreamTLSContextJSON(t *testing.T, snap *proxycfg.ConfigSnapshot) string { + return expectedTLSContextJSON(t, snap, false) +} + +func expectedPublicTLSContextJSON(t *testing.T, snap *proxycfg.ConfigSnapshot) string { + return expectedTLSContextJSON(t, snap, true) +} + +func expectedTLSContextJSON(t *testing.T, snap *proxycfg.ConfigSnapshot, requireClientCert bool) string { + // Assume just one root for now, can get fancier later if needed. + caPEM := snap.Roots.Roots[0].RootCert + reqClient := "" + if requireClientCert { + reqClient = `, + "requireClientCertificate": true` + } + return `{ + "commonTlsContext": { + "tlsParams": {}, + "tlsCertificates": [ + { + "certificateChain": { + "inlineString": "` + strings.Replace(snap.Leaf.CertPEM, "\n", "\\n", -1) + `" + }, + "privateKey": { + "inlineString": "` + strings.Replace(snap.Leaf.PrivateKeyPEM, "\n", "\\n", -1) + `" + } + } + ], + "validationContext": { + "trustedCa": { + "inlineString": "` + strings.Replace(caPEM, "\n", "\\n", -1) + `" + } + } + } + ` + reqClient + ` + }` +} + +func assertChanBlocked(t *testing.T, ch chan *envoy.DiscoveryResponse) { + t.Helper() + select { + case r := <-ch: + t.Fatalf("chan should block but recieved: %v", r) + case <-time.After(10 * time.Millisecond): + return + } +} + +func assertResponseSent(t *testing.T, ch chan *envoy.DiscoveryResponse, wantJSON string) { + t.Helper() + select { + case r := <-ch: + assertResponse(t, r, wantJSON) + case <-time.After(50 * time.Millisecond): + t.Fatalf("no response recieved after 50ms") + } +} + +// assertResponse is a helper to test a envoy.DiscoveryResponse matches the +// JSON representaion we expect. We use JSON because the responses use protobuf +// Any type which includes binary protobuf encoding and would make creating +// expected structs require the same code that is under test! +func assertResponse(t *testing.T, r *envoy.DiscoveryResponse, wantJSON string) { + t.Helper() + m := jsonpb.Marshaler{ + Indent: " ", + } + gotJSON, err := m.MarshalToString(r) + require.NoError(t, err) + require.JSONEqf(t, wantJSON, gotJSON, "got:\n%s", gotJSON) +} + +func TestServer_StreamAggregatedResources_ACLEnforcment(t *testing.T) { + + tests := []struct { + name string + defaultDeny bool + acl string + token string + wantDenied bool + }{ + // Note that although we've stubbed actual ACL checks in the testManager + // ConnectAuthorize mock, by asserting against specifc reason strings here + // even in the happy case which can't match the default one returned by the + // mock we are implicitly validating that the implementation used the + // correct token from the context. + { + name: "no ACLs configured", + defaultDeny: false, + wantDenied: false, + }, + { + name: "default deny, no token", + defaultDeny: true, + wantDenied: true, + }, + { + name: "default deny, service:write token", + defaultDeny: true, + acl: `service "web" { policy = "write" }`, + token: "service-write-on-web", + wantDenied: false, + }, + { + name: "default deny, service:read token", + defaultDeny: true, + acl: `service "web" { policy = "read" }`, + token: "service-write-on-web", + wantDenied: true, + }, + { + name: "default deny, service:write token on different service", + defaultDeny: true, + acl: `service "not-web" { policy = "write" }`, + token: "service-write-on-not-web", + wantDenied: true, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + logger := log.New(os.Stderr, "", log.LstdFlags) + mgr := newTestManager(t) + aclResolve := func(id string) (acl.ACL, error) { + if !tt.defaultDeny { + // Allow all + return acl.RootACL("allow"), nil + } + if tt.acl == "" { + // No token and defaultDeny is denied + return acl.RootACL("deny"), nil + } + // Ensure the correct token was passed + require.Equal(t, tt.token, id) + // Parse the ACL and enforce it + policy, err := acl.Parse(tt.acl, nil) + require.NoError(t, err) + return acl.New(acl.RootACL("deny"), policy, nil) + } + envoy := NewTestEnvoy(t, "web-sidecar-proxy", tt.token) + defer envoy.Close() + + s := Server{logger, mgr, mgr, aclResolve} + + errCh := make(chan error, 1) + go func() { + errCh <- s.StreamAggregatedResources(envoy.stream) + }() + + // Register the proxy to create state needed to Watch() on + mgr.RegisterProxy(t, "web-sidecar-proxy") + + // Deliver a new snapshot + snap := proxycfg.TestConfigSnapshot(t) + mgr.DeliverConfig(t, "web-sidecar-proxy", snap) + + // Send initial listener discover, in real life Envoy always sends cluster + // first but it doesn't really matter and listener has a response that + // includes the token in the ext authz filter so lets us test more stuff. + envoy.SendReq(t, ListenerType, 0, 0) + + if !tt.wantDenied { + assertResponseSent(t, envoy.stream.sendCh, expectListenerJSON(t, snap, tt.token, 1, 1)) + // Close the client stream since all is well. We _don't_ do this in the + // expected error case because we want to verify the error closes the + // stream from server side. + envoy.Close() + } + + select { + case err := <-errCh: + if tt.wantDenied { + require.Error(t, err) + require.Contains(t, err.Error(), "permission denied") + mgr.AssertWatchCancelled(t, "web-sidecar-proxy") + } else { + require.NoError(t, err) + } + case <-time.After(50 * time.Millisecond): + t.Fatalf("timed out waiting for handler to finish") + } + }) + } +} + +// This tests the ext_authz service method that implements connect authz. +func TestServer_Check(t *testing.T) { + + tests := []struct { + name string + source string + dest string + sourcePrincipal string + destPrincipal string + authzResult connectAuthzResult + wantErr bool + wantErrCode codes.Code + wantDenied bool + wantReason string + }{ + { + name: "auth allowed", + source: "web", + dest: "db", + authzResult: connectAuthzResult{true, "default allow", nil, nil}, + wantDenied: false, + wantReason: "default allow", + }, + { + name: "auth denied", + source: "web", + dest: "db", + authzResult: connectAuthzResult{false, "default deny", nil, nil}, + wantDenied: true, + wantReason: "default deny", + }, + { + name: "no source", + sourcePrincipal: "", + dest: "db", + // Should never make it to authz call. + wantErr: true, + wantErrCode: codes.InvalidArgument, + }, + { + name: "no dest", + source: "web", + dest: "", + // Should never make it to authz call. + wantErr: true, + wantErrCode: codes.InvalidArgument, + }, + { + name: "dest invalid format", + source: "web", + destPrincipal: "not-a-spiffe-id", + // Should never make it to authz call. + wantDenied: true, + wantReason: "Destination Principal is not a valid Connect identitiy", + }, + { + name: "dest not a service URI", + source: "web", + destPrincipal: "spiffe://trust-domain.consul", + // Should never make it to authz call. + wantDenied: true, + wantReason: "Destination Principal is not a valid Service identitiy", + }, + { + name: "ACL not got permission for authz call", + source: "web", + dest: "db", + authzResult: connectAuthzResult{false, "", nil, acl.ErrPermissionDenied}, + wantErr: true, + wantErrCode: codes.PermissionDenied, + }, + { + name: "Random error running authz", + source: "web", + dest: "db", + authzResult: connectAuthzResult{false, "", nil, errors.New("gremlin attack")}, + wantErr: true, + wantErrCode: codes.Internal, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + token := "my-real-acl-token" + logger := log.New(os.Stderr, "", log.LstdFlags) + mgr := newTestManager(t) + + // Setup expected auth result against that token no lock as no other + // goroutine is touching this yet. + mgr.authz[token] = tt.authzResult + + aclResolve := func(id string) (acl.ACL, error) { + return nil, nil + } + envoy := NewTestEnvoy(t, "web-sidecar-proxy", token) + defer envoy.Close() + + s := Server{logger, mgr, mgr, aclResolve} + + // Create a context with the correct token + ctx := metadata.NewIncomingContext(context.Background(), + metadata.Pairs("x-consul-token", token)) + + r := TestCheckRequest(t, tt.source, tt.dest) + // If sourcePrincipal is set override, or if source is also not set + // explicitly override to empty. + if tt.sourcePrincipal != "" || tt.source == "" { + r.Attributes.Source.Principal = tt.sourcePrincipal + } + if tt.destPrincipal != "" || tt.dest == "" { + r.Attributes.Destination.Principal = tt.destPrincipal + } + resp, err := s.Check(ctx, r) + // Denied is not an error + if tt.wantErr { + require.Error(t, err) + grpcStatus := status.Convert(err) + require.Equal(t, tt.wantErrCode, grpcStatus.Code()) + require.Nil(t, resp) + return + } + require.NoError(t, err) + if tt.wantDenied { + require.Equal(t, int32(codes.PermissionDenied), resp.Status.Code) + } else { + require.Equal(t, int32(codes.OK), resp.Status.Code) + } + require.Contains(t, resp.Status.Message, tt.wantReason) + }) + } +} + +func TestServer_ConfigOverrides(t *testing.T) { + + tests := []struct { + name string + setup func(snap *proxycfg.ConfigSnapshot) string + }{ + { + name: "sanity check no custom", + setup: func(snap *proxycfg.ConfigSnapshot) string { + // Default snap and expectation + return expectListenerJSON(t, snap, "my-token", 1, 1) + }, + }, + { + name: "custom public_listener no type", + setup: func(snap *proxycfg.ConfigSnapshot) string { + snap.Proxy.Config["envoy_public_listener_json"] = + customListenerJSON(t, customListenerJSONOptions{ + Name: "custom-public-listen", + IncludeType: false, + }) + resources := expectListenerJSONResources(t, snap, "my-token", 1, 1) + + // Replace the public listener with the custom one WITH type since + // that's how it comes out the other end, and with TLS and authz + // overridden. + resources["public_listener"] = customListenerJSON(t, customListenerJSONOptions{ + Name: "custom-public-listen", + // We should add type, TLS and authz + IncludeType: true, + OverrideAuthz: true, + TLSContext: expectedPublicTLSContextJSON(t, snap), + }) + return expectListenerJSONFromResources(t, snap, "my-token", 1, 1, resources) + }, + }, + { + name: "custom public_listener with type", + setup: func(snap *proxycfg.ConfigSnapshot) string { + snap.Proxy.Config["envoy_public_listener_json"] = + customListenerJSON(t, customListenerJSONOptions{ + Name: "custom-public-listen", + IncludeType: true, + }) + resources := expectListenerJSONResources(t, snap, "my-token", 1, 1) + + // Replace the public listener with the custom one WITH type since + // that's how it comes out the other end, and with TLS and authz + // overridden. + resources["public_listener"] = customListenerJSON(t, customListenerJSONOptions{ + Name: "custom-public-listen", + // We should add type, TLS and authz + IncludeType: true, + OverrideAuthz: true, + TLSContext: expectedPublicTLSContextJSON(t, snap), + }) + return expectListenerJSONFromResources(t, snap, "my-token", 1, 1, resources) + }, + }, + { + name: "custom public_listener with TLS should be overridden", + setup: func(snap *proxycfg.ConfigSnapshot) string { + snap.Proxy.Config["envoy_public_listener_json"] = + customListenerJSON(t, customListenerJSONOptions{ + Name: "custom-public-listen", + IncludeType: true, + TLSContext: `{"requireClientCertificate": false}`, + }) + resources := expectListenerJSONResources(t, snap, "my-token", 1, 1) + + // Replace the public listener with the custom one WITH type since + // that's how it comes out the other end, and with TLS and authz + // overridden. + resources["public_listener"] = customListenerJSON(t, customListenerJSONOptions{ + Name: "custom-public-listen", + // We should add type, TLS and authz + IncludeType: true, + OverrideAuthz: true, + TLSContext: expectedPublicTLSContextJSON(t, snap), + }) + return expectListenerJSONFromResources(t, snap, "my-token", 1, 1, resources) + }, + }, + { + name: "custom upstream no type", + setup: func(snap *proxycfg.ConfigSnapshot) string { + snap.Proxy.Upstreams[0].Config["envoy_listener_json"] = + customListenerJSON(t, customListenerJSONOptions{ + Name: "custom-upstream", + IncludeType: false, + }) + resources := expectListenerJSONResources(t, snap, "my-token", 1, 1) + + // Replace an upstream listener with the custom one WITH type since + // that's how it comes out the other end. Note we do override TLS + resources["service:db"] = + customListenerJSON(t, customListenerJSONOptions{ + Name: "custom-upstream", + // We should add type + IncludeType: true, + }) + return expectListenerJSONFromResources(t, snap, "my-token", 1, 1, resources) + }, + }, + { + name: "custom upstream with type", + setup: func(snap *proxycfg.ConfigSnapshot) string { + snap.Proxy.Upstreams[0].Config["envoy_listener_json"] = + customListenerJSON(t, customListenerJSONOptions{ + Name: "custom-upstream", + IncludeType: true, + }) + resources := expectListenerJSONResources(t, snap, "my-token", 1, 1) + + // Replace an upstream listener with the custom one WITH type since + // that's how it comes out the other end. + resources["service:db"] = + customListenerJSON(t, customListenerJSONOptions{ + Name: "custom-upstream", + // We should add type + IncludeType: true, + }) + return expectListenerJSONFromResources(t, snap, "my-token", 1, 1, resources) + }, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + require := require.New(t) + + // Sanity check default with no overrides first + snap := proxycfg.TestConfigSnapshot(t) + expect := tt.setup(snap) + + listeners, err := listenersFromSnapshot(snap, "my-token") + require.NoError(err) + r, err := createResponse(ListenerType, "00000001", "00000001", listeners) + require.NoError(err) + + assertResponse(t, r, expect) + }) + } +} + +type customListenerJSONOptions struct { + Name string + IncludeType bool + OverrideAuthz bool + TLSContext string +} + +const customListenerJSONTpl = `{ + {{ if .IncludeType -}} + "@type": "type.googleapis.com/envoy.api.v2.Listener", + {{- end }} + "name": "{{ .Name }}", + "address": { + "socketAddress": { + "address": "11.11.11.11", + "portValue": 11111 + } + }, + "filterChains": [ + { + {{ if .TLSContext -}} + "tlsContext": {{ .TLSContext }}, + {{- end }} + "filters": [ + {{ if .OverrideAuthz -}} + { + "name": "envoy.ext_authz", + "config": { + "grpc_service": { + "envoy_grpc": { + "cluster_name": "local_agent" + }, + "initial_metadata": [ + { + "key": "x-consul-token", + "value": "my-token" + } + ] + }, + "stat_prefix": "connect_authz" + } + }, + {{- end }} + { + "name": "envoy.tcp_proxy", + "config": { + "cluster": "random-cluster", + "stat_prefix": "foo-stats" + } + } + ] + } + ] +}` + +var customListenerJSONTemplate = template.Must(template.New("").Parse(customListenerJSONTpl)) + +func customListenerJSON(t *testing.T, opts customListenerJSONOptions) string { + t.Helper() + var buf bytes.Buffer + err := customListenerJSONTemplate.Execute(&buf, opts) + require.NoError(t, err) + return buf.String() +} diff --git a/agent/xds/testing.go b/agent/xds/testing.go new file mode 100644 index 000000000000..59af25b4dab9 --- /dev/null +++ b/agent/xds/testing.go @@ -0,0 +1,180 @@ +package xds + +import ( + "context" + "fmt" + "io" + "sync" + "time" + + envoy "github.com/envoyproxy/go-control-plane/envoy/api/v2" + envoycore "github.com/envoyproxy/go-control-plane/envoy/api/v2/core" + envoyauth "github.com/envoyproxy/go-control-plane/envoy/service/auth/v2alpha" + "github.com/mitchellh/go-testing-interface" + "google.golang.org/grpc/metadata" + + "github.com/hashicorp/consul/agent/connect" +) + +// TestADSStream mocks +// discovery.AggregatedDiscoveryService_StreamAggregatedResourcesServer to allow +// testing ADS handler. +type TestADSStream struct { + ctx context.Context + sendCh chan *envoy.DiscoveryResponse + recvCh chan *envoy.DiscoveryRequest +} + +// NewTestADSStream makes a new TestADSStream +func NewTestADSStream(t testing.T, ctx context.Context) *TestADSStream { + return &TestADSStream{ + ctx: ctx, + sendCh: make(chan *envoy.DiscoveryResponse, 1), + recvCh: make(chan *envoy.DiscoveryRequest, 1), + } +} + +// Send implements ADSStream +func (s *TestADSStream) Send(r *envoy.DiscoveryResponse) error { + s.sendCh <- r + return nil +} + +// Recv implements ADSStream +func (s *TestADSStream) Recv() (*envoy.DiscoveryRequest, error) { + r := <-s.recvCh + if r == nil { + return nil, io.EOF + } + return r, nil +} + +// SetHeader implements ADSStream +func (s *TestADSStream) SetHeader(metadata.MD) error { + return nil +} + +// SendHeader implements ADSStream +func (s *TestADSStream) SendHeader(metadata.MD) error { + return nil +} + +// SetTrailer implements ADSStream +func (s *TestADSStream) SetTrailer(metadata.MD) { +} + +// Context implements ADSStream +func (s *TestADSStream) Context() context.Context { + return s.ctx +} + +// SendMsg implements ADSStream +func (s *TestADSStream) SendMsg(m interface{}) error { + return nil +} + +// RecvMsg implements ADSStream +func (s *TestADSStream) RecvMsg(m interface{}) error { + return nil +} + +type configState struct { + lastNonce, lastVersion, acceptedVersion string +} + +// TestEnvoy is a helper to simulate Envoy ADS requests. +type TestEnvoy struct { + sync.Mutex + stream *TestADSStream + proxyID string + token string + state map[string]configState + ctx context.Context + cancel func() +} + +// NewTestEnvoy creates a TestEnvoy instance. +func NewTestEnvoy(t testing.T, proxyID, token string) *TestEnvoy { + ctx, cancel := context.WithCancel(context.Background()) + // If a token is given, attach it to the context in the same way gRPC attaches + // metadata in calls and stream contexts. + if token != "" { + ctx = metadata.NewIncomingContext(ctx, + metadata.Pairs("x-consul-token", token)) + } + return &TestEnvoy{ + stream: NewTestADSStream(t, ctx), + state: make(map[string]configState), + ctx: ctx, + cancel: cancel, + proxyID: proxyID, + token: token, + } +} + +func hexString(v uint64) string { + if v == 0 { + return "" + } + return fmt.Sprintf("%08x", v) +} + +// SendReq sends a request from the test server. +func (e *TestEnvoy) SendReq(t testing.T, typeURL string, version, nonce uint64) { + e.Lock() + defer e.Unlock() + + req := &envoy.DiscoveryRequest{ + VersionInfo: hexString(version), + Node: &envoycore.Node{ + Id: e.proxyID, + Cluster: e.proxyID, + }, + ResponseNonce: hexString(nonce), + TypeUrl: typeURL, + } + select { + case e.stream.recvCh <- req: + case <-time.After(50 * time.Millisecond): + t.Fatalf("send to stream blocked for too long") + } +} + +// Close closes the client and cancels it's request context. +func (e *TestEnvoy) Close() error { + e.Lock() + defer e.Unlock() + + // unblock the recv chan to simulate recv error when client disconnects + if e.stream != nil && e.stream.recvCh != nil { + close(e.stream.recvCh) + e.stream.recvCh = nil + } + if e.cancel != nil { + e.cancel() + } + return nil +} + +// TestCheckRequest creates an envoyauth.CheckRequest with the source and +// destination service names. +func TestCheckRequest(t testing.T, source, dest string) *envoyauth.CheckRequest { + return &envoyauth.CheckRequest{ + Attributes: &envoyauth.AttributeContext{ + Source: makeAttributeContextPeer(t, source), + Destination: makeAttributeContextPeer(t, dest), + }, + } +} + +func makeAttributeContextPeer(t testing.T, svc string) *envoyauth.AttributeContext_Peer { + spiffeID := connect.TestSpiffeIDService(t, svc) + return &envoyauth.AttributeContext_Peer{ + // We don't care about IP for now might later though + Address: makeAddressPtr("10.0.0.1", 1234), + // Note we don't set Service since that is an advisory only mechanism in + // Envoy triggered by self-declared headers. We rely on the actual TLS Peer + // identity. + Principal: spiffeID.URI().String(), + } +} diff --git a/agent/xds/xds.go b/agent/xds/xds.go new file mode 100644 index 000000000000..8a6be8632733 --- /dev/null +++ b/agent/xds/xds.go @@ -0,0 +1,10 @@ +// Package xds provides an impementation of a gRPC service that exports Envoy's +// xDS API for config discovery. Specifically we support the Aggregated +// Discovery Service (ADS) only as we control all config. +// +// A full description of the XDS protocol can be found at +// https://github.com/envoyproxy/data-plane-api/blob/master/XDS_PROTOCOL.md +// +// xds.Server also support ext_authz network filter API to authorize incoming +// connections to Envoy. +package xds diff --git a/vendor/github.com/envoyproxy/go-control-plane/LICENSE b/vendor/github.com/envoyproxy/go-control-plane/LICENSE new file mode 100644 index 000000000000..8dada3edaf50 --- /dev/null +++ b/vendor/github.com/envoyproxy/go-control-plane/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/auth/cert.pb.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/auth/cert.pb.go new file mode 100644 index 000000000000..7a342a17e7f3 --- /dev/null +++ b/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/auth/cert.pb.go @@ -0,0 +1,4792 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: envoy/api/v2/auth/cert.proto + +package auth + +import proto "github.com/gogo/protobuf/proto" +import fmt "fmt" +import math "math" +import core "github.com/envoyproxy/go-control-plane/envoy/api/v2/core" +import _ "github.com/gogo/protobuf/gogoproto" +import types "github.com/gogo/protobuf/types" +import _ "github.com/lyft/protoc-gen-validate/validate" + +import bytes "bytes" + +import io "io" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package + +type TlsParameters_TlsProtocol int32 + +const ( + // Envoy will choose the optimal TLS version. + TlsParameters_TLS_AUTO TlsParameters_TlsProtocol = 0 + // TLS 1.0 + TlsParameters_TLSv1_0 TlsParameters_TlsProtocol = 1 + // TLS 1.1 + TlsParameters_TLSv1_1 TlsParameters_TlsProtocol = 2 + // TLS 1.2 + TlsParameters_TLSv1_2 TlsParameters_TlsProtocol = 3 + // TLS 1.3 + TlsParameters_TLSv1_3 TlsParameters_TlsProtocol = 4 +) + +var TlsParameters_TlsProtocol_name = map[int32]string{ + 0: "TLS_AUTO", + 1: "TLSv1_0", + 2: "TLSv1_1", + 3: "TLSv1_2", + 4: "TLSv1_3", +} +var TlsParameters_TlsProtocol_value = map[string]int32{ + "TLS_AUTO": 0, + "TLSv1_0": 1, + "TLSv1_1": 2, + "TLSv1_2": 3, + "TLSv1_3": 4, +} + +func (x TlsParameters_TlsProtocol) String() string { + return proto.EnumName(TlsParameters_TlsProtocol_name, int32(x)) +} +func (TlsParameters_TlsProtocol) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_cert_d136c0593daa7c3c, []int{0, 0} +} + +type TlsParameters struct { + // Minimum TLS protocol version. + TlsMinimumProtocolVersion TlsParameters_TlsProtocol `protobuf:"varint,1,opt,name=tls_minimum_protocol_version,json=tlsMinimumProtocolVersion,proto3,enum=envoy.api.v2.auth.TlsParameters_TlsProtocol" json:"tls_minimum_protocol_version,omitempty"` + // Maximum TLS protocol version. + TlsMaximumProtocolVersion TlsParameters_TlsProtocol `protobuf:"varint,2,opt,name=tls_maximum_protocol_version,json=tlsMaximumProtocolVersion,proto3,enum=envoy.api.v2.auth.TlsParameters_TlsProtocol" json:"tls_maximum_protocol_version,omitempty"` + // If specified, the TLS listener will only support the specified `cipher list + // `_. + // If not specified, the default list: + // + // .. code-block:: none + // + // [ECDHE-ECDSA-AES128-GCM-SHA256|ECDHE-ECDSA-CHACHA20-POLY1305] + // [ECDHE-RSA-AES128-GCM-SHA256|ECDHE-RSA-CHACHA20-POLY1305] + // ECDHE-ECDSA-AES128-SHA + // ECDHE-RSA-AES128-SHA + // AES128-GCM-SHA256 + // AES128-SHA + // ECDHE-ECDSA-AES256-GCM-SHA384 + // ECDHE-RSA-AES256-GCM-SHA384 + // ECDHE-ECDSA-AES256-SHA + // ECDHE-RSA-AES256-SHA + // AES256-GCM-SHA384 + // AES256-SHA + // + // will be used. + CipherSuites []string `protobuf:"bytes,3,rep,name=cipher_suites,json=cipherSuites" json:"cipher_suites,omitempty"` + // If specified, the TLS connection will only support the specified ECDH + // curves. If not specified, the default curves (X25519, P-256) will be used. + EcdhCurves []string `protobuf:"bytes,4,rep,name=ecdh_curves,json=ecdhCurves" json:"ecdh_curves,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *TlsParameters) Reset() { *m = TlsParameters{} } +func (m *TlsParameters) String() string { return proto.CompactTextString(m) } +func (*TlsParameters) ProtoMessage() {} +func (*TlsParameters) Descriptor() ([]byte, []int) { + return fileDescriptor_cert_d136c0593daa7c3c, []int{0} +} +func (m *TlsParameters) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *TlsParameters) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_TlsParameters.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *TlsParameters) XXX_Merge(src proto.Message) { + xxx_messageInfo_TlsParameters.Merge(dst, src) +} +func (m *TlsParameters) XXX_Size() int { + return m.Size() +} +func (m *TlsParameters) XXX_DiscardUnknown() { + xxx_messageInfo_TlsParameters.DiscardUnknown(m) +} + +var xxx_messageInfo_TlsParameters proto.InternalMessageInfo + +func (m *TlsParameters) GetTlsMinimumProtocolVersion() TlsParameters_TlsProtocol { + if m != nil { + return m.TlsMinimumProtocolVersion + } + return TlsParameters_TLS_AUTO +} + +func (m *TlsParameters) GetTlsMaximumProtocolVersion() TlsParameters_TlsProtocol { + if m != nil { + return m.TlsMaximumProtocolVersion + } + return TlsParameters_TLS_AUTO +} + +func (m *TlsParameters) GetCipherSuites() []string { + if m != nil { + return m.CipherSuites + } + return nil +} + +func (m *TlsParameters) GetEcdhCurves() []string { + if m != nil { + return m.EcdhCurves + } + return nil +} + +type TlsCertificate struct { + // The TLS certificate chain. + CertificateChain *core.DataSource `protobuf:"bytes,1,opt,name=certificate_chain,json=certificateChain" json:"certificate_chain,omitempty"` + // The TLS private key. + PrivateKey *core.DataSource `protobuf:"bytes,2,opt,name=private_key,json=privateKey" json:"private_key,omitempty"` + // [#not-implemented-hide:] + Password *core.DataSource `protobuf:"bytes,3,opt,name=password" json:"password,omitempty"` + // [#not-implemented-hide:] + OcspStaple *core.DataSource `protobuf:"bytes,4,opt,name=ocsp_staple,json=ocspStaple" json:"ocsp_staple,omitempty"` + // [#not-implemented-hide:] + SignedCertificateTimestamp []*core.DataSource `protobuf:"bytes,5,rep,name=signed_certificate_timestamp,json=signedCertificateTimestamp" json:"signed_certificate_timestamp,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *TlsCertificate) Reset() { *m = TlsCertificate{} } +func (m *TlsCertificate) String() string { return proto.CompactTextString(m) } +func (*TlsCertificate) ProtoMessage() {} +func (*TlsCertificate) Descriptor() ([]byte, []int) { + return fileDescriptor_cert_d136c0593daa7c3c, []int{1} +} +func (m *TlsCertificate) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *TlsCertificate) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_TlsCertificate.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *TlsCertificate) XXX_Merge(src proto.Message) { + xxx_messageInfo_TlsCertificate.Merge(dst, src) +} +func (m *TlsCertificate) XXX_Size() int { + return m.Size() +} +func (m *TlsCertificate) XXX_DiscardUnknown() { + xxx_messageInfo_TlsCertificate.DiscardUnknown(m) +} + +var xxx_messageInfo_TlsCertificate proto.InternalMessageInfo + +func (m *TlsCertificate) GetCertificateChain() *core.DataSource { + if m != nil { + return m.CertificateChain + } + return nil +} + +func (m *TlsCertificate) GetPrivateKey() *core.DataSource { + if m != nil { + return m.PrivateKey + } + return nil +} + +func (m *TlsCertificate) GetPassword() *core.DataSource { + if m != nil { + return m.Password + } + return nil +} + +func (m *TlsCertificate) GetOcspStaple() *core.DataSource { + if m != nil { + return m.OcspStaple + } + return nil +} + +func (m *TlsCertificate) GetSignedCertificateTimestamp() []*core.DataSource { + if m != nil { + return m.SignedCertificateTimestamp + } + return nil +} + +type TlsSessionTicketKeys struct { + // Keys for encrypting and decrypting TLS session tickets. The + // first key in the array contains the key to encrypt all new sessions created by this context. + // All keys are candidates for decrypting received tickets. This allows for easy rotation of keys + // by, for example, putting the new key first, and the previous key second. + // + // If :ref:`session_ticket_keys ` + // is not specified, the TLS library will still support resuming sessions via tickets, but it will + // use an internally-generated and managed key, so sessions cannot be resumed across hot restarts + // or on different hosts. + // + // Each key must contain exactly 80 bytes of cryptographically-secure random data. For + // example, the output of ``openssl rand 80``. + // + // .. attention:: + // + // Using this feature has serious security considerations and risks. Improper handling of keys + // may result in loss of secrecy in connections, even if ciphers supporting perfect forward + // secrecy are used. See https://www.imperialviolet.org/2013/06/27/botchingpfs.html for some + // discussion. To minimize the risk, you must: + // + // * Keep the session ticket keys at least as secure as your TLS certificate private keys + // * Rotate session ticket keys at least daily, and preferably hourly + // * Always generate keys using a cryptographically-secure random data source + Keys []*core.DataSource `protobuf:"bytes,1,rep,name=keys" json:"keys,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *TlsSessionTicketKeys) Reset() { *m = TlsSessionTicketKeys{} } +func (m *TlsSessionTicketKeys) String() string { return proto.CompactTextString(m) } +func (*TlsSessionTicketKeys) ProtoMessage() {} +func (*TlsSessionTicketKeys) Descriptor() ([]byte, []int) { + return fileDescriptor_cert_d136c0593daa7c3c, []int{2} +} +func (m *TlsSessionTicketKeys) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *TlsSessionTicketKeys) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_TlsSessionTicketKeys.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *TlsSessionTicketKeys) XXX_Merge(src proto.Message) { + xxx_messageInfo_TlsSessionTicketKeys.Merge(dst, src) +} +func (m *TlsSessionTicketKeys) XXX_Size() int { + return m.Size() +} +func (m *TlsSessionTicketKeys) XXX_DiscardUnknown() { + xxx_messageInfo_TlsSessionTicketKeys.DiscardUnknown(m) +} + +var xxx_messageInfo_TlsSessionTicketKeys proto.InternalMessageInfo + +func (m *TlsSessionTicketKeys) GetKeys() []*core.DataSource { + if m != nil { + return m.Keys + } + return nil +} + +type CertificateValidationContext struct { + // TLS certificate data containing certificate authority certificates to use in verifying + // a presented peer certificate (e.g. server certificate for clusters or client certificate + // for listeners). If not specified and a peer certificate is presented it will not be + // verified. By default, a client certificate is optional, unless one of the additional + // options (:ref:`require_client_certificate + // `, + // :ref:`verify_certificate_spki + // `, + // :ref:`verify_certificate_hash + // `, or + // :ref:`verify_subject_alt_name + // `) is also + // specified. + // + // See :ref:`the TLS overview ` for a list of common + // system CA locations. + TrustedCa *core.DataSource `protobuf:"bytes,1,opt,name=trusted_ca,json=trustedCa" json:"trusted_ca,omitempty"` + // An optional list of base64-encoded SHA-256 hashes. If specified, Envoy will verify that the + // SHA-256 of the DER-encoded Subject Public Key Information (SPKI) of the presented certificate + // matches one of the specified values. + // + // A base64-encoded SHA-256 of the Subject Public Key Information (SPKI) of the certificate + // can be generated with the following command: + // + // .. code-block:: bash + // + // $ openssl x509 -in path/to/client.crt -noout -pubkey \ + // | openssl pkey -pubin -outform DER \ + // | openssl dgst -sha256 -binary \ + // | openssl enc -base64 + // NvqYIYSbgK2vCJpQhObf77vv+bQWtc5ek5RIOwPiC9A= + // + // This is the format used in HTTP Public Key Pinning. + // + // When both: + // :ref:`verify_certificate_hash + // ` and + // :ref:`verify_certificate_spki + // ` are specified, + // a hash matching value from either of the lists will result in the certificate being accepted. + // + // .. attention:: + // + // This option is preferred over :ref:`verify_certificate_hash + // `, + // because SPKI is tied to a private key, so it doesn't change when the certificate + // is renewed using the same private key. + VerifyCertificateSpki []string `protobuf:"bytes,3,rep,name=verify_certificate_spki,json=verifyCertificateSpki" json:"verify_certificate_spki,omitempty"` + // An optional list of hex-encoded SHA-256 hashes. If specified, Envoy will verify that + // the SHA-256 of the DER-encoded presented certificate matches one of the specified values. + // + // A hex-encoded SHA-256 of the certificate can be generated with the following command: + // + // .. code-block:: bash + // + // $ openssl x509 -in path/to/client.crt -outform DER | openssl dgst -sha256 | cut -d" " -f2 + // df6ff72fe9116521268f6f2dd4966f51df479883fe7037b39f75916ac3049d1a + // + // A long hex-encoded and colon-separated SHA-256 (a.k.a. "fingerprint") of the certificate + // can be generated with the following command: + // + // .. code-block:: bash + // + // $ openssl x509 -in path/to/client.crt -noout -fingerprint -sha256 | cut -d"=" -f2 + // DF:6F:F7:2F:E9:11:65:21:26:8F:6F:2D:D4:96:6F:51:DF:47:98:83:FE:70:37:B3:9F:75:91:6A:C3:04:9D:1A + // + // Both of those formats are acceptable. + // + // When both: + // :ref:`verify_certificate_hash + // ` and + // :ref:`verify_certificate_spki + // ` are specified, + // a hash matching value from either of the lists will result in the certificate being accepted. + VerifyCertificateHash []string `protobuf:"bytes,2,rep,name=verify_certificate_hash,json=verifyCertificateHash" json:"verify_certificate_hash,omitempty"` + // An optional list of Subject Alternative Names. If specified, Envoy will verify that the + // Subject Alternative Name of the presented certificate matches one of the specified values. + // + // .. attention:: + // + // Subject Alternative Names are easily spoofable and verifying only them is insecure, + // therefore this option must be used together with :ref:`trusted_ca + // `. + VerifySubjectAltName []string `protobuf:"bytes,4,rep,name=verify_subject_alt_name,json=verifySubjectAltName" json:"verify_subject_alt_name,omitempty"` + // [#not-implemented-hide:] Must present a signed time-stamped OCSP response. + RequireOcspStaple *types.BoolValue `protobuf:"bytes,5,opt,name=require_ocsp_staple,json=requireOcspStaple" json:"require_ocsp_staple,omitempty"` + // [#not-implemented-hide:] Must present signed certificate time-stamp. + RequireSignedCertificateTimestamp *types.BoolValue `protobuf:"bytes,6,opt,name=require_signed_certificate_timestamp,json=requireSignedCertificateTimestamp" json:"require_signed_certificate_timestamp,omitempty"` + // An optional `certificate revocation list + // `_ + // (in PEM format). If specified, Envoy will verify that the presented peer + // certificate has not been revoked by this CRL. If this DataSource contains + // multiple CRLs, all of them will be used. + Crl *core.DataSource `protobuf:"bytes,7,opt,name=crl" json:"crl,omitempty"` + // If specified, Envoy will not reject expired certificates. + AllowExpiredCertificate bool `protobuf:"varint,8,opt,name=allow_expired_certificate,json=allowExpiredCertificate,proto3" json:"allow_expired_certificate,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *CertificateValidationContext) Reset() { *m = CertificateValidationContext{} } +func (m *CertificateValidationContext) String() string { return proto.CompactTextString(m) } +func (*CertificateValidationContext) ProtoMessage() {} +func (*CertificateValidationContext) Descriptor() ([]byte, []int) { + return fileDescriptor_cert_d136c0593daa7c3c, []int{3} +} +func (m *CertificateValidationContext) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *CertificateValidationContext) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_CertificateValidationContext.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *CertificateValidationContext) XXX_Merge(src proto.Message) { + xxx_messageInfo_CertificateValidationContext.Merge(dst, src) +} +func (m *CertificateValidationContext) XXX_Size() int { + return m.Size() +} +func (m *CertificateValidationContext) XXX_DiscardUnknown() { + xxx_messageInfo_CertificateValidationContext.DiscardUnknown(m) +} + +var xxx_messageInfo_CertificateValidationContext proto.InternalMessageInfo + +func (m *CertificateValidationContext) GetTrustedCa() *core.DataSource { + if m != nil { + return m.TrustedCa + } + return nil +} + +func (m *CertificateValidationContext) GetVerifyCertificateSpki() []string { + if m != nil { + return m.VerifyCertificateSpki + } + return nil +} + +func (m *CertificateValidationContext) GetVerifyCertificateHash() []string { + if m != nil { + return m.VerifyCertificateHash + } + return nil +} + +func (m *CertificateValidationContext) GetVerifySubjectAltName() []string { + if m != nil { + return m.VerifySubjectAltName + } + return nil +} + +func (m *CertificateValidationContext) GetRequireOcspStaple() *types.BoolValue { + if m != nil { + return m.RequireOcspStaple + } + return nil +} + +func (m *CertificateValidationContext) GetRequireSignedCertificateTimestamp() *types.BoolValue { + if m != nil { + return m.RequireSignedCertificateTimestamp + } + return nil +} + +func (m *CertificateValidationContext) GetCrl() *core.DataSource { + if m != nil { + return m.Crl + } + return nil +} + +func (m *CertificateValidationContext) GetAllowExpiredCertificate() bool { + if m != nil { + return m.AllowExpiredCertificate + } + return false +} + +// TLS context shared by both client and server TLS contexts. +type CommonTlsContext struct { + // TLS protocol versions, cipher suites etc. + TlsParams *TlsParameters `protobuf:"bytes,1,opt,name=tls_params,json=tlsParams" json:"tls_params,omitempty"` + // Multiple TLS certificates can be associated with the same context. + // E.g. to allow both RSA and ECDSA certificates, two TLS certificates can be configured. + // + // .. attention:: + // + // Although this is a list, currently only a single certificate is supported. This will be + // relaxed in the future. + TlsCertificates []*TlsCertificate `protobuf:"bytes,2,rep,name=tls_certificates,json=tlsCertificates" json:"tls_certificates,omitempty"` + // Configs for fetching TLS certificates via SDS API. + TlsCertificateSdsSecretConfigs []*SdsSecretConfig `protobuf:"bytes,6,rep,name=tls_certificate_sds_secret_configs,json=tlsCertificateSdsSecretConfigs" json:"tls_certificate_sds_secret_configs,omitempty"` + // Types that are valid to be assigned to ValidationContextType: + // *CommonTlsContext_ValidationContext + // *CommonTlsContext_ValidationContextSdsSecretConfig + ValidationContextType isCommonTlsContext_ValidationContextType `protobuf_oneof:"validation_context_type"` + // Supplies the list of ALPN protocols that the listener should expose. In + // practice this is likely to be set to one of two values (see the + // :ref:`codec_type ` parameter in the HTTP connection + // manager for more information): + // + // * "h2,http/1.1" If the listener is going to support both HTTP/2 and HTTP/1.1. + // * "http/1.1" If the listener is only going to support HTTP/1.1. + // + // There is no default for this parameter. If empty, Envoy will not expose ALPN. + AlpnProtocols []string `protobuf:"bytes,4,rep,name=alpn_protocols,json=alpnProtocols" json:"alpn_protocols,omitempty"` + // [#not-implemented-hide:] + DeprecatedV1 *CommonTlsContext_DeprecatedV1 `protobuf:"bytes,5,opt,name=deprecated_v1,json=deprecatedV1" json:"deprecated_v1,omitempty"` // Deprecated: Do not use. + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *CommonTlsContext) Reset() { *m = CommonTlsContext{} } +func (m *CommonTlsContext) String() string { return proto.CompactTextString(m) } +func (*CommonTlsContext) ProtoMessage() {} +func (*CommonTlsContext) Descriptor() ([]byte, []int) { + return fileDescriptor_cert_d136c0593daa7c3c, []int{4} +} +func (m *CommonTlsContext) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *CommonTlsContext) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_CommonTlsContext.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *CommonTlsContext) XXX_Merge(src proto.Message) { + xxx_messageInfo_CommonTlsContext.Merge(dst, src) +} +func (m *CommonTlsContext) XXX_Size() int { + return m.Size() +} +func (m *CommonTlsContext) XXX_DiscardUnknown() { + xxx_messageInfo_CommonTlsContext.DiscardUnknown(m) +} + +var xxx_messageInfo_CommonTlsContext proto.InternalMessageInfo + +type isCommonTlsContext_ValidationContextType interface { + isCommonTlsContext_ValidationContextType() + Equal(interface{}) bool + MarshalTo([]byte) (int, error) + Size() int +} + +type CommonTlsContext_ValidationContext struct { + ValidationContext *CertificateValidationContext `protobuf:"bytes,3,opt,name=validation_context,json=validationContext,oneof"` +} +type CommonTlsContext_ValidationContextSdsSecretConfig struct { + ValidationContextSdsSecretConfig *SdsSecretConfig `protobuf:"bytes,7,opt,name=validation_context_sds_secret_config,json=validationContextSdsSecretConfig,oneof"` +} + +func (*CommonTlsContext_ValidationContext) isCommonTlsContext_ValidationContextType() {} +func (*CommonTlsContext_ValidationContextSdsSecretConfig) isCommonTlsContext_ValidationContextType() {} + +func (m *CommonTlsContext) GetValidationContextType() isCommonTlsContext_ValidationContextType { + if m != nil { + return m.ValidationContextType + } + return nil +} + +func (m *CommonTlsContext) GetTlsParams() *TlsParameters { + if m != nil { + return m.TlsParams + } + return nil +} + +func (m *CommonTlsContext) GetTlsCertificates() []*TlsCertificate { + if m != nil { + return m.TlsCertificates + } + return nil +} + +func (m *CommonTlsContext) GetTlsCertificateSdsSecretConfigs() []*SdsSecretConfig { + if m != nil { + return m.TlsCertificateSdsSecretConfigs + } + return nil +} + +func (m *CommonTlsContext) GetValidationContext() *CertificateValidationContext { + if x, ok := m.GetValidationContextType().(*CommonTlsContext_ValidationContext); ok { + return x.ValidationContext + } + return nil +} + +func (m *CommonTlsContext) GetValidationContextSdsSecretConfig() *SdsSecretConfig { + if x, ok := m.GetValidationContextType().(*CommonTlsContext_ValidationContextSdsSecretConfig); ok { + return x.ValidationContextSdsSecretConfig + } + return nil +} + +func (m *CommonTlsContext) GetAlpnProtocols() []string { + if m != nil { + return m.AlpnProtocols + } + return nil +} + +// Deprecated: Do not use. +func (m *CommonTlsContext) GetDeprecatedV1() *CommonTlsContext_DeprecatedV1 { + if m != nil { + return m.DeprecatedV1 + } + return nil +} + +// XXX_OneofFuncs is for the internal use of the proto package. +func (*CommonTlsContext) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { + return _CommonTlsContext_OneofMarshaler, _CommonTlsContext_OneofUnmarshaler, _CommonTlsContext_OneofSizer, []interface{}{ + (*CommonTlsContext_ValidationContext)(nil), + (*CommonTlsContext_ValidationContextSdsSecretConfig)(nil), + } +} + +func _CommonTlsContext_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { + m := msg.(*CommonTlsContext) + // validation_context_type + switch x := m.ValidationContextType.(type) { + case *CommonTlsContext_ValidationContext: + _ = b.EncodeVarint(3<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.ValidationContext); err != nil { + return err + } + case *CommonTlsContext_ValidationContextSdsSecretConfig: + _ = b.EncodeVarint(7<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.ValidationContextSdsSecretConfig); err != nil { + return err + } + case nil: + default: + return fmt.Errorf("CommonTlsContext.ValidationContextType has unexpected type %T", x) + } + return nil +} + +func _CommonTlsContext_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { + m := msg.(*CommonTlsContext) + switch tag { + case 3: // validation_context_type.validation_context + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(CertificateValidationContext) + err := b.DecodeMessage(msg) + m.ValidationContextType = &CommonTlsContext_ValidationContext{msg} + return true, err + case 7: // validation_context_type.validation_context_sds_secret_config + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(SdsSecretConfig) + err := b.DecodeMessage(msg) + m.ValidationContextType = &CommonTlsContext_ValidationContextSdsSecretConfig{msg} + return true, err + default: + return false, nil + } +} + +func _CommonTlsContext_OneofSizer(msg proto.Message) (n int) { + m := msg.(*CommonTlsContext) + // validation_context_type + switch x := m.ValidationContextType.(type) { + case *CommonTlsContext_ValidationContext: + s := proto.Size(x.ValidationContext) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case *CommonTlsContext_ValidationContextSdsSecretConfig: + s := proto.Size(x.ValidationContextSdsSecretConfig) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case nil: + default: + panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) + } + return n +} + +// These fields are deprecated and only are used during the interim v1 -> v2 +// transition period for internal purposes. They should not be used outside of +// the Envoy binary. [#not-implemented-hide:] +type CommonTlsContext_DeprecatedV1 struct { + AltAlpnProtocols string `protobuf:"bytes,1,opt,name=alt_alpn_protocols,json=altAlpnProtocols,proto3" json:"alt_alpn_protocols,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *CommonTlsContext_DeprecatedV1) Reset() { *m = CommonTlsContext_DeprecatedV1{} } +func (m *CommonTlsContext_DeprecatedV1) String() string { return proto.CompactTextString(m) } +func (*CommonTlsContext_DeprecatedV1) ProtoMessage() {} +func (*CommonTlsContext_DeprecatedV1) Descriptor() ([]byte, []int) { + return fileDescriptor_cert_d136c0593daa7c3c, []int{4, 0} +} +func (m *CommonTlsContext_DeprecatedV1) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *CommonTlsContext_DeprecatedV1) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_CommonTlsContext_DeprecatedV1.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *CommonTlsContext_DeprecatedV1) XXX_Merge(src proto.Message) { + xxx_messageInfo_CommonTlsContext_DeprecatedV1.Merge(dst, src) +} +func (m *CommonTlsContext_DeprecatedV1) XXX_Size() int { + return m.Size() +} +func (m *CommonTlsContext_DeprecatedV1) XXX_DiscardUnknown() { + xxx_messageInfo_CommonTlsContext_DeprecatedV1.DiscardUnknown(m) +} + +var xxx_messageInfo_CommonTlsContext_DeprecatedV1 proto.InternalMessageInfo + +func (m *CommonTlsContext_DeprecatedV1) GetAltAlpnProtocols() string { + if m != nil { + return m.AltAlpnProtocols + } + return "" +} + +type UpstreamTlsContext struct { + // Common TLS context settings. + CommonTlsContext *CommonTlsContext `protobuf:"bytes,1,opt,name=common_tls_context,json=commonTlsContext" json:"common_tls_context,omitempty"` + // SNI string to use when creating TLS backend connections. + Sni string `protobuf:"bytes,2,opt,name=sni,proto3" json:"sni,omitempty"` + // If true, server-initiated TLS renegotiation will be allowed. + // + // .. attention:: + // + // TLS renegotiation is considered insecure and shouldn't be used unless absolutely necessary. + AllowRenegotiation bool `protobuf:"varint,3,opt,name=allow_renegotiation,json=allowRenegotiation,proto3" json:"allow_renegotiation,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *UpstreamTlsContext) Reset() { *m = UpstreamTlsContext{} } +func (m *UpstreamTlsContext) String() string { return proto.CompactTextString(m) } +func (*UpstreamTlsContext) ProtoMessage() {} +func (*UpstreamTlsContext) Descriptor() ([]byte, []int) { + return fileDescriptor_cert_d136c0593daa7c3c, []int{5} +} +func (m *UpstreamTlsContext) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *UpstreamTlsContext) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_UpstreamTlsContext.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *UpstreamTlsContext) XXX_Merge(src proto.Message) { + xxx_messageInfo_UpstreamTlsContext.Merge(dst, src) +} +func (m *UpstreamTlsContext) XXX_Size() int { + return m.Size() +} +func (m *UpstreamTlsContext) XXX_DiscardUnknown() { + xxx_messageInfo_UpstreamTlsContext.DiscardUnknown(m) +} + +var xxx_messageInfo_UpstreamTlsContext proto.InternalMessageInfo + +func (m *UpstreamTlsContext) GetCommonTlsContext() *CommonTlsContext { + if m != nil { + return m.CommonTlsContext + } + return nil +} + +func (m *UpstreamTlsContext) GetSni() string { + if m != nil { + return m.Sni + } + return "" +} + +func (m *UpstreamTlsContext) GetAllowRenegotiation() bool { + if m != nil { + return m.AllowRenegotiation + } + return false +} + +type DownstreamTlsContext struct { + // Common TLS context settings. + CommonTlsContext *CommonTlsContext `protobuf:"bytes,1,opt,name=common_tls_context,json=commonTlsContext" json:"common_tls_context,omitempty"` + // If specified, Envoy will reject connections without a valid client + // certificate. + RequireClientCertificate *types.BoolValue `protobuf:"bytes,2,opt,name=require_client_certificate,json=requireClientCertificate" json:"require_client_certificate,omitempty"` + // If specified, Envoy will reject connections without a valid and matching SNI. + // [#not-implemented-hide:] + RequireSni *types.BoolValue `protobuf:"bytes,3,opt,name=require_sni,json=requireSni" json:"require_sni,omitempty"` + // Types that are valid to be assigned to SessionTicketKeysType: + // *DownstreamTlsContext_SessionTicketKeys + // *DownstreamTlsContext_SessionTicketKeysSdsSecretConfig + SessionTicketKeysType isDownstreamTlsContext_SessionTicketKeysType `protobuf_oneof:"session_ticket_keys_type"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *DownstreamTlsContext) Reset() { *m = DownstreamTlsContext{} } +func (m *DownstreamTlsContext) String() string { return proto.CompactTextString(m) } +func (*DownstreamTlsContext) ProtoMessage() {} +func (*DownstreamTlsContext) Descriptor() ([]byte, []int) { + return fileDescriptor_cert_d136c0593daa7c3c, []int{6} +} +func (m *DownstreamTlsContext) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DownstreamTlsContext) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_DownstreamTlsContext.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *DownstreamTlsContext) XXX_Merge(src proto.Message) { + xxx_messageInfo_DownstreamTlsContext.Merge(dst, src) +} +func (m *DownstreamTlsContext) XXX_Size() int { + return m.Size() +} +func (m *DownstreamTlsContext) XXX_DiscardUnknown() { + xxx_messageInfo_DownstreamTlsContext.DiscardUnknown(m) +} + +var xxx_messageInfo_DownstreamTlsContext proto.InternalMessageInfo + +type isDownstreamTlsContext_SessionTicketKeysType interface { + isDownstreamTlsContext_SessionTicketKeysType() + Equal(interface{}) bool + MarshalTo([]byte) (int, error) + Size() int +} + +type DownstreamTlsContext_SessionTicketKeys struct { + SessionTicketKeys *TlsSessionTicketKeys `protobuf:"bytes,4,opt,name=session_ticket_keys,json=sessionTicketKeys,oneof"` +} +type DownstreamTlsContext_SessionTicketKeysSdsSecretConfig struct { + SessionTicketKeysSdsSecretConfig *SdsSecretConfig `protobuf:"bytes,5,opt,name=session_ticket_keys_sds_secret_config,json=sessionTicketKeysSdsSecretConfig,oneof"` +} + +func (*DownstreamTlsContext_SessionTicketKeys) isDownstreamTlsContext_SessionTicketKeysType() {} +func (*DownstreamTlsContext_SessionTicketKeysSdsSecretConfig) isDownstreamTlsContext_SessionTicketKeysType() { +} + +func (m *DownstreamTlsContext) GetSessionTicketKeysType() isDownstreamTlsContext_SessionTicketKeysType { + if m != nil { + return m.SessionTicketKeysType + } + return nil +} + +func (m *DownstreamTlsContext) GetCommonTlsContext() *CommonTlsContext { + if m != nil { + return m.CommonTlsContext + } + return nil +} + +func (m *DownstreamTlsContext) GetRequireClientCertificate() *types.BoolValue { + if m != nil { + return m.RequireClientCertificate + } + return nil +} + +func (m *DownstreamTlsContext) GetRequireSni() *types.BoolValue { + if m != nil { + return m.RequireSni + } + return nil +} + +func (m *DownstreamTlsContext) GetSessionTicketKeys() *TlsSessionTicketKeys { + if x, ok := m.GetSessionTicketKeysType().(*DownstreamTlsContext_SessionTicketKeys); ok { + return x.SessionTicketKeys + } + return nil +} + +func (m *DownstreamTlsContext) GetSessionTicketKeysSdsSecretConfig() *SdsSecretConfig { + if x, ok := m.GetSessionTicketKeysType().(*DownstreamTlsContext_SessionTicketKeysSdsSecretConfig); ok { + return x.SessionTicketKeysSdsSecretConfig + } + return nil +} + +// XXX_OneofFuncs is for the internal use of the proto package. +func (*DownstreamTlsContext) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { + return _DownstreamTlsContext_OneofMarshaler, _DownstreamTlsContext_OneofUnmarshaler, _DownstreamTlsContext_OneofSizer, []interface{}{ + (*DownstreamTlsContext_SessionTicketKeys)(nil), + (*DownstreamTlsContext_SessionTicketKeysSdsSecretConfig)(nil), + } +} + +func _DownstreamTlsContext_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { + m := msg.(*DownstreamTlsContext) + // session_ticket_keys_type + switch x := m.SessionTicketKeysType.(type) { + case *DownstreamTlsContext_SessionTicketKeys: + _ = b.EncodeVarint(4<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.SessionTicketKeys); err != nil { + return err + } + case *DownstreamTlsContext_SessionTicketKeysSdsSecretConfig: + _ = b.EncodeVarint(5<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.SessionTicketKeysSdsSecretConfig); err != nil { + return err + } + case nil: + default: + return fmt.Errorf("DownstreamTlsContext.SessionTicketKeysType has unexpected type %T", x) + } + return nil +} + +func _DownstreamTlsContext_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { + m := msg.(*DownstreamTlsContext) + switch tag { + case 4: // session_ticket_keys_type.session_ticket_keys + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(TlsSessionTicketKeys) + err := b.DecodeMessage(msg) + m.SessionTicketKeysType = &DownstreamTlsContext_SessionTicketKeys{msg} + return true, err + case 5: // session_ticket_keys_type.session_ticket_keys_sds_secret_config + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(SdsSecretConfig) + err := b.DecodeMessage(msg) + m.SessionTicketKeysType = &DownstreamTlsContext_SessionTicketKeysSdsSecretConfig{msg} + return true, err + default: + return false, nil + } +} + +func _DownstreamTlsContext_OneofSizer(msg proto.Message) (n int) { + m := msg.(*DownstreamTlsContext) + // session_ticket_keys_type + switch x := m.SessionTicketKeysType.(type) { + case *DownstreamTlsContext_SessionTicketKeys: + s := proto.Size(x.SessionTicketKeys) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case *DownstreamTlsContext_SessionTicketKeysSdsSecretConfig: + s := proto.Size(x.SessionTicketKeysSdsSecretConfig) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case nil: + default: + panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) + } + return n +} + +// [#proto-status: experimental] +type SdsSecretConfig struct { + // Name (FQDN, UUID, SPKI, SHA256, etc.) by which the secret can be uniquely referred to. + // When both name and config are specified, then secret can be fetched and/or reloaded via SDS. + // When only name is specified, then secret will be loaded from static resources [V2-API-DIFF]. + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + SdsConfig *core.ConfigSource `protobuf:"bytes,2,opt,name=sds_config,json=sdsConfig" json:"sds_config,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SdsSecretConfig) Reset() { *m = SdsSecretConfig{} } +func (m *SdsSecretConfig) String() string { return proto.CompactTextString(m) } +func (*SdsSecretConfig) ProtoMessage() {} +func (*SdsSecretConfig) Descriptor() ([]byte, []int) { + return fileDescriptor_cert_d136c0593daa7c3c, []int{7} +} +func (m *SdsSecretConfig) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *SdsSecretConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_SdsSecretConfig.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *SdsSecretConfig) XXX_Merge(src proto.Message) { + xxx_messageInfo_SdsSecretConfig.Merge(dst, src) +} +func (m *SdsSecretConfig) XXX_Size() int { + return m.Size() +} +func (m *SdsSecretConfig) XXX_DiscardUnknown() { + xxx_messageInfo_SdsSecretConfig.DiscardUnknown(m) +} + +var xxx_messageInfo_SdsSecretConfig proto.InternalMessageInfo + +func (m *SdsSecretConfig) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *SdsSecretConfig) GetSdsConfig() *core.ConfigSource { + if m != nil { + return m.SdsConfig + } + return nil +} + +// [#proto-status: experimental] +type Secret struct { + // Name (FQDN, UUID, SPKI, SHA256, etc.) by which the secret can be uniquely referred to. + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // Types that are valid to be assigned to Type: + // *Secret_TlsCertificate + // *Secret_SessionTicketKeys + // *Secret_ValidationContext + Type isSecret_Type `protobuf_oneof:"type"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Secret) Reset() { *m = Secret{} } +func (m *Secret) String() string { return proto.CompactTextString(m) } +func (*Secret) ProtoMessage() {} +func (*Secret) Descriptor() ([]byte, []int) { + return fileDescriptor_cert_d136c0593daa7c3c, []int{8} +} +func (m *Secret) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Secret) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Secret.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *Secret) XXX_Merge(src proto.Message) { + xxx_messageInfo_Secret.Merge(dst, src) +} +func (m *Secret) XXX_Size() int { + return m.Size() +} +func (m *Secret) XXX_DiscardUnknown() { + xxx_messageInfo_Secret.DiscardUnknown(m) +} + +var xxx_messageInfo_Secret proto.InternalMessageInfo + +type isSecret_Type interface { + isSecret_Type() + Equal(interface{}) bool + MarshalTo([]byte) (int, error) + Size() int +} + +type Secret_TlsCertificate struct { + TlsCertificate *TlsCertificate `protobuf:"bytes,2,opt,name=tls_certificate,json=tlsCertificate,oneof"` +} +type Secret_SessionTicketKeys struct { + SessionTicketKeys *TlsSessionTicketKeys `protobuf:"bytes,3,opt,name=session_ticket_keys,json=sessionTicketKeys,oneof"` +} +type Secret_ValidationContext struct { + ValidationContext *CertificateValidationContext `protobuf:"bytes,4,opt,name=validation_context,json=validationContext,oneof"` +} + +func (*Secret_TlsCertificate) isSecret_Type() {} +func (*Secret_SessionTicketKeys) isSecret_Type() {} +func (*Secret_ValidationContext) isSecret_Type() {} + +func (m *Secret) GetType() isSecret_Type { + if m != nil { + return m.Type + } + return nil +} + +func (m *Secret) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *Secret) GetTlsCertificate() *TlsCertificate { + if x, ok := m.GetType().(*Secret_TlsCertificate); ok { + return x.TlsCertificate + } + return nil +} + +func (m *Secret) GetSessionTicketKeys() *TlsSessionTicketKeys { + if x, ok := m.GetType().(*Secret_SessionTicketKeys); ok { + return x.SessionTicketKeys + } + return nil +} + +func (m *Secret) GetValidationContext() *CertificateValidationContext { + if x, ok := m.GetType().(*Secret_ValidationContext); ok { + return x.ValidationContext + } + return nil +} + +// XXX_OneofFuncs is for the internal use of the proto package. +func (*Secret) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { + return _Secret_OneofMarshaler, _Secret_OneofUnmarshaler, _Secret_OneofSizer, []interface{}{ + (*Secret_TlsCertificate)(nil), + (*Secret_SessionTicketKeys)(nil), + (*Secret_ValidationContext)(nil), + } +} + +func _Secret_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { + m := msg.(*Secret) + // type + switch x := m.Type.(type) { + case *Secret_TlsCertificate: + _ = b.EncodeVarint(2<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.TlsCertificate); err != nil { + return err + } + case *Secret_SessionTicketKeys: + _ = b.EncodeVarint(3<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.SessionTicketKeys); err != nil { + return err + } + case *Secret_ValidationContext: + _ = b.EncodeVarint(4<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.ValidationContext); err != nil { + return err + } + case nil: + default: + return fmt.Errorf("Secret.Type has unexpected type %T", x) + } + return nil +} + +func _Secret_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { + m := msg.(*Secret) + switch tag { + case 2: // type.tls_certificate + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(TlsCertificate) + err := b.DecodeMessage(msg) + m.Type = &Secret_TlsCertificate{msg} + return true, err + case 3: // type.session_ticket_keys + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(TlsSessionTicketKeys) + err := b.DecodeMessage(msg) + m.Type = &Secret_SessionTicketKeys{msg} + return true, err + case 4: // type.validation_context + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(CertificateValidationContext) + err := b.DecodeMessage(msg) + m.Type = &Secret_ValidationContext{msg} + return true, err + default: + return false, nil + } +} + +func _Secret_OneofSizer(msg proto.Message) (n int) { + m := msg.(*Secret) + // type + switch x := m.Type.(type) { + case *Secret_TlsCertificate: + s := proto.Size(x.TlsCertificate) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case *Secret_SessionTicketKeys: + s := proto.Size(x.SessionTicketKeys) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case *Secret_ValidationContext: + s := proto.Size(x.ValidationContext) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case nil: + default: + panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) + } + return n +} + +func init() { + proto.RegisterType((*TlsParameters)(nil), "envoy.api.v2.auth.TlsParameters") + proto.RegisterType((*TlsCertificate)(nil), "envoy.api.v2.auth.TlsCertificate") + proto.RegisterType((*TlsSessionTicketKeys)(nil), "envoy.api.v2.auth.TlsSessionTicketKeys") + proto.RegisterType((*CertificateValidationContext)(nil), "envoy.api.v2.auth.CertificateValidationContext") + proto.RegisterType((*CommonTlsContext)(nil), "envoy.api.v2.auth.CommonTlsContext") + proto.RegisterType((*CommonTlsContext_DeprecatedV1)(nil), "envoy.api.v2.auth.CommonTlsContext.DeprecatedV1") + proto.RegisterType((*UpstreamTlsContext)(nil), "envoy.api.v2.auth.UpstreamTlsContext") + proto.RegisterType((*DownstreamTlsContext)(nil), "envoy.api.v2.auth.DownstreamTlsContext") + proto.RegisterType((*SdsSecretConfig)(nil), "envoy.api.v2.auth.SdsSecretConfig") + proto.RegisterType((*Secret)(nil), "envoy.api.v2.auth.Secret") + proto.RegisterEnum("envoy.api.v2.auth.TlsParameters_TlsProtocol", TlsParameters_TlsProtocol_name, TlsParameters_TlsProtocol_value) +} +func (this *TlsParameters) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*TlsParameters) + if !ok { + that2, ok := that.(TlsParameters) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.TlsMinimumProtocolVersion != that1.TlsMinimumProtocolVersion { + return false + } + if this.TlsMaximumProtocolVersion != that1.TlsMaximumProtocolVersion { + return false + } + if len(this.CipherSuites) != len(that1.CipherSuites) { + return false + } + for i := range this.CipherSuites { + if this.CipherSuites[i] != that1.CipherSuites[i] { + return false + } + } + if len(this.EcdhCurves) != len(that1.EcdhCurves) { + return false + } + for i := range this.EcdhCurves { + if this.EcdhCurves[i] != that1.EcdhCurves[i] { + return false + } + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *TlsCertificate) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*TlsCertificate) + if !ok { + that2, ok := that.(TlsCertificate) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.CertificateChain.Equal(that1.CertificateChain) { + return false + } + if !this.PrivateKey.Equal(that1.PrivateKey) { + return false + } + if !this.Password.Equal(that1.Password) { + return false + } + if !this.OcspStaple.Equal(that1.OcspStaple) { + return false + } + if len(this.SignedCertificateTimestamp) != len(that1.SignedCertificateTimestamp) { + return false + } + for i := range this.SignedCertificateTimestamp { + if !this.SignedCertificateTimestamp[i].Equal(that1.SignedCertificateTimestamp[i]) { + return false + } + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *TlsSessionTicketKeys) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*TlsSessionTicketKeys) + if !ok { + that2, ok := that.(TlsSessionTicketKeys) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if len(this.Keys) != len(that1.Keys) { + return false + } + for i := range this.Keys { + if !this.Keys[i].Equal(that1.Keys[i]) { + return false + } + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *CertificateValidationContext) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*CertificateValidationContext) + if !ok { + that2, ok := that.(CertificateValidationContext) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.TrustedCa.Equal(that1.TrustedCa) { + return false + } + if len(this.VerifyCertificateSpki) != len(that1.VerifyCertificateSpki) { + return false + } + for i := range this.VerifyCertificateSpki { + if this.VerifyCertificateSpki[i] != that1.VerifyCertificateSpki[i] { + return false + } + } + if len(this.VerifyCertificateHash) != len(that1.VerifyCertificateHash) { + return false + } + for i := range this.VerifyCertificateHash { + if this.VerifyCertificateHash[i] != that1.VerifyCertificateHash[i] { + return false + } + } + if len(this.VerifySubjectAltName) != len(that1.VerifySubjectAltName) { + return false + } + for i := range this.VerifySubjectAltName { + if this.VerifySubjectAltName[i] != that1.VerifySubjectAltName[i] { + return false + } + } + if !this.RequireOcspStaple.Equal(that1.RequireOcspStaple) { + return false + } + if !this.RequireSignedCertificateTimestamp.Equal(that1.RequireSignedCertificateTimestamp) { + return false + } + if !this.Crl.Equal(that1.Crl) { + return false + } + if this.AllowExpiredCertificate != that1.AllowExpiredCertificate { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *CommonTlsContext) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*CommonTlsContext) + if !ok { + that2, ok := that.(CommonTlsContext) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.TlsParams.Equal(that1.TlsParams) { + return false + } + if len(this.TlsCertificates) != len(that1.TlsCertificates) { + return false + } + for i := range this.TlsCertificates { + if !this.TlsCertificates[i].Equal(that1.TlsCertificates[i]) { + return false + } + } + if len(this.TlsCertificateSdsSecretConfigs) != len(that1.TlsCertificateSdsSecretConfigs) { + return false + } + for i := range this.TlsCertificateSdsSecretConfigs { + if !this.TlsCertificateSdsSecretConfigs[i].Equal(that1.TlsCertificateSdsSecretConfigs[i]) { + return false + } + } + if that1.ValidationContextType == nil { + if this.ValidationContextType != nil { + return false + } + } else if this.ValidationContextType == nil { + return false + } else if !this.ValidationContextType.Equal(that1.ValidationContextType) { + return false + } + if len(this.AlpnProtocols) != len(that1.AlpnProtocols) { + return false + } + for i := range this.AlpnProtocols { + if this.AlpnProtocols[i] != that1.AlpnProtocols[i] { + return false + } + } + if !this.DeprecatedV1.Equal(that1.DeprecatedV1) { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *CommonTlsContext_ValidationContext) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*CommonTlsContext_ValidationContext) + if !ok { + that2, ok := that.(CommonTlsContext_ValidationContext) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.ValidationContext.Equal(that1.ValidationContext) { + return false + } + return true +} +func (this *CommonTlsContext_ValidationContextSdsSecretConfig) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*CommonTlsContext_ValidationContextSdsSecretConfig) + if !ok { + that2, ok := that.(CommonTlsContext_ValidationContextSdsSecretConfig) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.ValidationContextSdsSecretConfig.Equal(that1.ValidationContextSdsSecretConfig) { + return false + } + return true +} +func (this *CommonTlsContext_DeprecatedV1) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*CommonTlsContext_DeprecatedV1) + if !ok { + that2, ok := that.(CommonTlsContext_DeprecatedV1) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.AltAlpnProtocols != that1.AltAlpnProtocols { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *UpstreamTlsContext) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*UpstreamTlsContext) + if !ok { + that2, ok := that.(UpstreamTlsContext) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.CommonTlsContext.Equal(that1.CommonTlsContext) { + return false + } + if this.Sni != that1.Sni { + return false + } + if this.AllowRenegotiation != that1.AllowRenegotiation { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *DownstreamTlsContext) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*DownstreamTlsContext) + if !ok { + that2, ok := that.(DownstreamTlsContext) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.CommonTlsContext.Equal(that1.CommonTlsContext) { + return false + } + if !this.RequireClientCertificate.Equal(that1.RequireClientCertificate) { + return false + } + if !this.RequireSni.Equal(that1.RequireSni) { + return false + } + if that1.SessionTicketKeysType == nil { + if this.SessionTicketKeysType != nil { + return false + } + } else if this.SessionTicketKeysType == nil { + return false + } else if !this.SessionTicketKeysType.Equal(that1.SessionTicketKeysType) { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *DownstreamTlsContext_SessionTicketKeys) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*DownstreamTlsContext_SessionTicketKeys) + if !ok { + that2, ok := that.(DownstreamTlsContext_SessionTicketKeys) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.SessionTicketKeys.Equal(that1.SessionTicketKeys) { + return false + } + return true +} +func (this *DownstreamTlsContext_SessionTicketKeysSdsSecretConfig) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*DownstreamTlsContext_SessionTicketKeysSdsSecretConfig) + if !ok { + that2, ok := that.(DownstreamTlsContext_SessionTicketKeysSdsSecretConfig) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.SessionTicketKeysSdsSecretConfig.Equal(that1.SessionTicketKeysSdsSecretConfig) { + return false + } + return true +} +func (this *SdsSecretConfig) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*SdsSecretConfig) + if !ok { + that2, ok := that.(SdsSecretConfig) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Name != that1.Name { + return false + } + if !this.SdsConfig.Equal(that1.SdsConfig) { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *Secret) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Secret) + if !ok { + that2, ok := that.(Secret) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Name != that1.Name { + return false + } + if that1.Type == nil { + if this.Type != nil { + return false + } + } else if this.Type == nil { + return false + } else if !this.Type.Equal(that1.Type) { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *Secret_TlsCertificate) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Secret_TlsCertificate) + if !ok { + that2, ok := that.(Secret_TlsCertificate) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.TlsCertificate.Equal(that1.TlsCertificate) { + return false + } + return true +} +func (this *Secret_SessionTicketKeys) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Secret_SessionTicketKeys) + if !ok { + that2, ok := that.(Secret_SessionTicketKeys) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.SessionTicketKeys.Equal(that1.SessionTicketKeys) { + return false + } + return true +} +func (this *Secret_ValidationContext) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Secret_ValidationContext) + if !ok { + that2, ok := that.(Secret_ValidationContext) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.ValidationContext.Equal(that1.ValidationContext) { + return false + } + return true +} +func (m *TlsParameters) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *TlsParameters) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.TlsMinimumProtocolVersion != 0 { + dAtA[i] = 0x8 + i++ + i = encodeVarintCert(dAtA, i, uint64(m.TlsMinimumProtocolVersion)) + } + if m.TlsMaximumProtocolVersion != 0 { + dAtA[i] = 0x10 + i++ + i = encodeVarintCert(dAtA, i, uint64(m.TlsMaximumProtocolVersion)) + } + if len(m.CipherSuites) > 0 { + for _, s := range m.CipherSuites { + dAtA[i] = 0x1a + i++ + l = len(s) + for l >= 1<<7 { + dAtA[i] = uint8(uint64(l)&0x7f | 0x80) + l >>= 7 + i++ + } + dAtA[i] = uint8(l) + i++ + i += copy(dAtA[i:], s) + } + } + if len(m.EcdhCurves) > 0 { + for _, s := range m.EcdhCurves { + dAtA[i] = 0x22 + i++ + l = len(s) + for l >= 1<<7 { + dAtA[i] = uint8(uint64(l)&0x7f | 0x80) + l >>= 7 + i++ + } + dAtA[i] = uint8(l) + i++ + i += copy(dAtA[i:], s) + } + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *TlsCertificate) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *TlsCertificate) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.CertificateChain != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintCert(dAtA, i, uint64(m.CertificateChain.Size())) + n1, err := m.CertificateChain.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n1 + } + if m.PrivateKey != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintCert(dAtA, i, uint64(m.PrivateKey.Size())) + n2, err := m.PrivateKey.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n2 + } + if m.Password != nil { + dAtA[i] = 0x1a + i++ + i = encodeVarintCert(dAtA, i, uint64(m.Password.Size())) + n3, err := m.Password.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n3 + } + if m.OcspStaple != nil { + dAtA[i] = 0x22 + i++ + i = encodeVarintCert(dAtA, i, uint64(m.OcspStaple.Size())) + n4, err := m.OcspStaple.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n4 + } + if len(m.SignedCertificateTimestamp) > 0 { + for _, msg := range m.SignedCertificateTimestamp { + dAtA[i] = 0x2a + i++ + i = encodeVarintCert(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *TlsSessionTicketKeys) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *TlsSessionTicketKeys) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Keys) > 0 { + for _, msg := range m.Keys { + dAtA[i] = 0xa + i++ + i = encodeVarintCert(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *CertificateValidationContext) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *CertificateValidationContext) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.TrustedCa != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintCert(dAtA, i, uint64(m.TrustedCa.Size())) + n5, err := m.TrustedCa.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n5 + } + if len(m.VerifyCertificateHash) > 0 { + for _, s := range m.VerifyCertificateHash { + dAtA[i] = 0x12 + i++ + l = len(s) + for l >= 1<<7 { + dAtA[i] = uint8(uint64(l)&0x7f | 0x80) + l >>= 7 + i++ + } + dAtA[i] = uint8(l) + i++ + i += copy(dAtA[i:], s) + } + } + if len(m.VerifyCertificateSpki) > 0 { + for _, s := range m.VerifyCertificateSpki { + dAtA[i] = 0x1a + i++ + l = len(s) + for l >= 1<<7 { + dAtA[i] = uint8(uint64(l)&0x7f | 0x80) + l >>= 7 + i++ + } + dAtA[i] = uint8(l) + i++ + i += copy(dAtA[i:], s) + } + } + if len(m.VerifySubjectAltName) > 0 { + for _, s := range m.VerifySubjectAltName { + dAtA[i] = 0x22 + i++ + l = len(s) + for l >= 1<<7 { + dAtA[i] = uint8(uint64(l)&0x7f | 0x80) + l >>= 7 + i++ + } + dAtA[i] = uint8(l) + i++ + i += copy(dAtA[i:], s) + } + } + if m.RequireOcspStaple != nil { + dAtA[i] = 0x2a + i++ + i = encodeVarintCert(dAtA, i, uint64(m.RequireOcspStaple.Size())) + n6, err := m.RequireOcspStaple.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n6 + } + if m.RequireSignedCertificateTimestamp != nil { + dAtA[i] = 0x32 + i++ + i = encodeVarintCert(dAtA, i, uint64(m.RequireSignedCertificateTimestamp.Size())) + n7, err := m.RequireSignedCertificateTimestamp.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n7 + } + if m.Crl != nil { + dAtA[i] = 0x3a + i++ + i = encodeVarintCert(dAtA, i, uint64(m.Crl.Size())) + n8, err := m.Crl.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n8 + } + if m.AllowExpiredCertificate { + dAtA[i] = 0x40 + i++ + if m.AllowExpiredCertificate { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i++ + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *CommonTlsContext) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *CommonTlsContext) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.TlsParams != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintCert(dAtA, i, uint64(m.TlsParams.Size())) + n9, err := m.TlsParams.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n9 + } + if len(m.TlsCertificates) > 0 { + for _, msg := range m.TlsCertificates { + dAtA[i] = 0x12 + i++ + i = encodeVarintCert(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if m.ValidationContextType != nil { + nn10, err := m.ValidationContextType.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += nn10 + } + if len(m.AlpnProtocols) > 0 { + for _, s := range m.AlpnProtocols { + dAtA[i] = 0x22 + i++ + l = len(s) + for l >= 1<<7 { + dAtA[i] = uint8(uint64(l)&0x7f | 0x80) + l >>= 7 + i++ + } + dAtA[i] = uint8(l) + i++ + i += copy(dAtA[i:], s) + } + } + if m.DeprecatedV1 != nil { + dAtA[i] = 0x2a + i++ + i = encodeVarintCert(dAtA, i, uint64(m.DeprecatedV1.Size())) + n11, err := m.DeprecatedV1.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n11 + } + if len(m.TlsCertificateSdsSecretConfigs) > 0 { + for _, msg := range m.TlsCertificateSdsSecretConfigs { + dAtA[i] = 0x32 + i++ + i = encodeVarintCert(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *CommonTlsContext_ValidationContext) MarshalTo(dAtA []byte) (int, error) { + i := 0 + if m.ValidationContext != nil { + dAtA[i] = 0x1a + i++ + i = encodeVarintCert(dAtA, i, uint64(m.ValidationContext.Size())) + n12, err := m.ValidationContext.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n12 + } + return i, nil +} +func (m *CommonTlsContext_ValidationContextSdsSecretConfig) MarshalTo(dAtA []byte) (int, error) { + i := 0 + if m.ValidationContextSdsSecretConfig != nil { + dAtA[i] = 0x3a + i++ + i = encodeVarintCert(dAtA, i, uint64(m.ValidationContextSdsSecretConfig.Size())) + n13, err := m.ValidationContextSdsSecretConfig.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n13 + } + return i, nil +} +func (m *CommonTlsContext_DeprecatedV1) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *CommonTlsContext_DeprecatedV1) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.AltAlpnProtocols) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintCert(dAtA, i, uint64(len(m.AltAlpnProtocols))) + i += copy(dAtA[i:], m.AltAlpnProtocols) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *UpstreamTlsContext) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *UpstreamTlsContext) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.CommonTlsContext != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintCert(dAtA, i, uint64(m.CommonTlsContext.Size())) + n14, err := m.CommonTlsContext.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n14 + } + if len(m.Sni) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintCert(dAtA, i, uint64(len(m.Sni))) + i += copy(dAtA[i:], m.Sni) + } + if m.AllowRenegotiation { + dAtA[i] = 0x18 + i++ + if m.AllowRenegotiation { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i++ + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *DownstreamTlsContext) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *DownstreamTlsContext) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.CommonTlsContext != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintCert(dAtA, i, uint64(m.CommonTlsContext.Size())) + n15, err := m.CommonTlsContext.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n15 + } + if m.RequireClientCertificate != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintCert(dAtA, i, uint64(m.RequireClientCertificate.Size())) + n16, err := m.RequireClientCertificate.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n16 + } + if m.RequireSni != nil { + dAtA[i] = 0x1a + i++ + i = encodeVarintCert(dAtA, i, uint64(m.RequireSni.Size())) + n17, err := m.RequireSni.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n17 + } + if m.SessionTicketKeysType != nil { + nn18, err := m.SessionTicketKeysType.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += nn18 + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *DownstreamTlsContext_SessionTicketKeys) MarshalTo(dAtA []byte) (int, error) { + i := 0 + if m.SessionTicketKeys != nil { + dAtA[i] = 0x22 + i++ + i = encodeVarintCert(dAtA, i, uint64(m.SessionTicketKeys.Size())) + n19, err := m.SessionTicketKeys.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n19 + } + return i, nil +} +func (m *DownstreamTlsContext_SessionTicketKeysSdsSecretConfig) MarshalTo(dAtA []byte) (int, error) { + i := 0 + if m.SessionTicketKeysSdsSecretConfig != nil { + dAtA[i] = 0x2a + i++ + i = encodeVarintCert(dAtA, i, uint64(m.SessionTicketKeysSdsSecretConfig.Size())) + n20, err := m.SessionTicketKeysSdsSecretConfig.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n20 + } + return i, nil +} +func (m *SdsSecretConfig) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *SdsSecretConfig) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Name) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintCert(dAtA, i, uint64(len(m.Name))) + i += copy(dAtA[i:], m.Name) + } + if m.SdsConfig != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintCert(dAtA, i, uint64(m.SdsConfig.Size())) + n21, err := m.SdsConfig.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n21 + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *Secret) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Secret) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Name) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintCert(dAtA, i, uint64(len(m.Name))) + i += copy(dAtA[i:], m.Name) + } + if m.Type != nil { + nn22, err := m.Type.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += nn22 + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *Secret_TlsCertificate) MarshalTo(dAtA []byte) (int, error) { + i := 0 + if m.TlsCertificate != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintCert(dAtA, i, uint64(m.TlsCertificate.Size())) + n23, err := m.TlsCertificate.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n23 + } + return i, nil +} +func (m *Secret_SessionTicketKeys) MarshalTo(dAtA []byte) (int, error) { + i := 0 + if m.SessionTicketKeys != nil { + dAtA[i] = 0x1a + i++ + i = encodeVarintCert(dAtA, i, uint64(m.SessionTicketKeys.Size())) + n24, err := m.SessionTicketKeys.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n24 + } + return i, nil +} +func (m *Secret_ValidationContext) MarshalTo(dAtA []byte) (int, error) { + i := 0 + if m.ValidationContext != nil { + dAtA[i] = 0x22 + i++ + i = encodeVarintCert(dAtA, i, uint64(m.ValidationContext.Size())) + n25, err := m.ValidationContext.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n25 + } + return i, nil +} +func encodeVarintCert(dAtA []byte, offset int, v uint64) int { + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return offset + 1 +} +func (m *TlsParameters) Size() (n int) { + var l int + _ = l + if m.TlsMinimumProtocolVersion != 0 { + n += 1 + sovCert(uint64(m.TlsMinimumProtocolVersion)) + } + if m.TlsMaximumProtocolVersion != 0 { + n += 1 + sovCert(uint64(m.TlsMaximumProtocolVersion)) + } + if len(m.CipherSuites) > 0 { + for _, s := range m.CipherSuites { + l = len(s) + n += 1 + l + sovCert(uint64(l)) + } + } + if len(m.EcdhCurves) > 0 { + for _, s := range m.EcdhCurves { + l = len(s) + n += 1 + l + sovCert(uint64(l)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *TlsCertificate) Size() (n int) { + var l int + _ = l + if m.CertificateChain != nil { + l = m.CertificateChain.Size() + n += 1 + l + sovCert(uint64(l)) + } + if m.PrivateKey != nil { + l = m.PrivateKey.Size() + n += 1 + l + sovCert(uint64(l)) + } + if m.Password != nil { + l = m.Password.Size() + n += 1 + l + sovCert(uint64(l)) + } + if m.OcspStaple != nil { + l = m.OcspStaple.Size() + n += 1 + l + sovCert(uint64(l)) + } + if len(m.SignedCertificateTimestamp) > 0 { + for _, e := range m.SignedCertificateTimestamp { + l = e.Size() + n += 1 + l + sovCert(uint64(l)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *TlsSessionTicketKeys) Size() (n int) { + var l int + _ = l + if len(m.Keys) > 0 { + for _, e := range m.Keys { + l = e.Size() + n += 1 + l + sovCert(uint64(l)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *CertificateValidationContext) Size() (n int) { + var l int + _ = l + if m.TrustedCa != nil { + l = m.TrustedCa.Size() + n += 1 + l + sovCert(uint64(l)) + } + if len(m.VerifyCertificateHash) > 0 { + for _, s := range m.VerifyCertificateHash { + l = len(s) + n += 1 + l + sovCert(uint64(l)) + } + } + if len(m.VerifyCertificateSpki) > 0 { + for _, s := range m.VerifyCertificateSpki { + l = len(s) + n += 1 + l + sovCert(uint64(l)) + } + } + if len(m.VerifySubjectAltName) > 0 { + for _, s := range m.VerifySubjectAltName { + l = len(s) + n += 1 + l + sovCert(uint64(l)) + } + } + if m.RequireOcspStaple != nil { + l = m.RequireOcspStaple.Size() + n += 1 + l + sovCert(uint64(l)) + } + if m.RequireSignedCertificateTimestamp != nil { + l = m.RequireSignedCertificateTimestamp.Size() + n += 1 + l + sovCert(uint64(l)) + } + if m.Crl != nil { + l = m.Crl.Size() + n += 1 + l + sovCert(uint64(l)) + } + if m.AllowExpiredCertificate { + n += 2 + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *CommonTlsContext) Size() (n int) { + var l int + _ = l + if m.TlsParams != nil { + l = m.TlsParams.Size() + n += 1 + l + sovCert(uint64(l)) + } + if len(m.TlsCertificates) > 0 { + for _, e := range m.TlsCertificates { + l = e.Size() + n += 1 + l + sovCert(uint64(l)) + } + } + if m.ValidationContextType != nil { + n += m.ValidationContextType.Size() + } + if len(m.AlpnProtocols) > 0 { + for _, s := range m.AlpnProtocols { + l = len(s) + n += 1 + l + sovCert(uint64(l)) + } + } + if m.DeprecatedV1 != nil { + l = m.DeprecatedV1.Size() + n += 1 + l + sovCert(uint64(l)) + } + if len(m.TlsCertificateSdsSecretConfigs) > 0 { + for _, e := range m.TlsCertificateSdsSecretConfigs { + l = e.Size() + n += 1 + l + sovCert(uint64(l)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *CommonTlsContext_ValidationContext) Size() (n int) { + var l int + _ = l + if m.ValidationContext != nil { + l = m.ValidationContext.Size() + n += 1 + l + sovCert(uint64(l)) + } + return n +} +func (m *CommonTlsContext_ValidationContextSdsSecretConfig) Size() (n int) { + var l int + _ = l + if m.ValidationContextSdsSecretConfig != nil { + l = m.ValidationContextSdsSecretConfig.Size() + n += 1 + l + sovCert(uint64(l)) + } + return n +} +func (m *CommonTlsContext_DeprecatedV1) Size() (n int) { + var l int + _ = l + l = len(m.AltAlpnProtocols) + if l > 0 { + n += 1 + l + sovCert(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *UpstreamTlsContext) Size() (n int) { + var l int + _ = l + if m.CommonTlsContext != nil { + l = m.CommonTlsContext.Size() + n += 1 + l + sovCert(uint64(l)) + } + l = len(m.Sni) + if l > 0 { + n += 1 + l + sovCert(uint64(l)) + } + if m.AllowRenegotiation { + n += 2 + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *DownstreamTlsContext) Size() (n int) { + var l int + _ = l + if m.CommonTlsContext != nil { + l = m.CommonTlsContext.Size() + n += 1 + l + sovCert(uint64(l)) + } + if m.RequireClientCertificate != nil { + l = m.RequireClientCertificate.Size() + n += 1 + l + sovCert(uint64(l)) + } + if m.RequireSni != nil { + l = m.RequireSni.Size() + n += 1 + l + sovCert(uint64(l)) + } + if m.SessionTicketKeysType != nil { + n += m.SessionTicketKeysType.Size() + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *DownstreamTlsContext_SessionTicketKeys) Size() (n int) { + var l int + _ = l + if m.SessionTicketKeys != nil { + l = m.SessionTicketKeys.Size() + n += 1 + l + sovCert(uint64(l)) + } + return n +} +func (m *DownstreamTlsContext_SessionTicketKeysSdsSecretConfig) Size() (n int) { + var l int + _ = l + if m.SessionTicketKeysSdsSecretConfig != nil { + l = m.SessionTicketKeysSdsSecretConfig.Size() + n += 1 + l + sovCert(uint64(l)) + } + return n +} +func (m *SdsSecretConfig) Size() (n int) { + var l int + _ = l + l = len(m.Name) + if l > 0 { + n += 1 + l + sovCert(uint64(l)) + } + if m.SdsConfig != nil { + l = m.SdsConfig.Size() + n += 1 + l + sovCert(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *Secret) Size() (n int) { + var l int + _ = l + l = len(m.Name) + if l > 0 { + n += 1 + l + sovCert(uint64(l)) + } + if m.Type != nil { + n += m.Type.Size() + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *Secret_TlsCertificate) Size() (n int) { + var l int + _ = l + if m.TlsCertificate != nil { + l = m.TlsCertificate.Size() + n += 1 + l + sovCert(uint64(l)) + } + return n +} +func (m *Secret_SessionTicketKeys) Size() (n int) { + var l int + _ = l + if m.SessionTicketKeys != nil { + l = m.SessionTicketKeys.Size() + n += 1 + l + sovCert(uint64(l)) + } + return n +} +func (m *Secret_ValidationContext) Size() (n int) { + var l int + _ = l + if m.ValidationContext != nil { + l = m.ValidationContext.Size() + n += 1 + l + sovCert(uint64(l)) + } + return n +} + +func sovCert(x uint64) (n int) { + for { + n++ + x >>= 7 + if x == 0 { + break + } + } + return n +} +func sozCert(x uint64) (n int) { + return sovCert(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *TlsParameters) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCert + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: TlsParameters: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TlsParameters: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TlsMinimumProtocolVersion", wireType) + } + m.TlsMinimumProtocolVersion = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCert + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TlsMinimumProtocolVersion |= (TlsParameters_TlsProtocol(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TlsMaximumProtocolVersion", wireType) + } + m.TlsMaximumProtocolVersion = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCert + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TlsMaximumProtocolVersion |= (TlsParameters_TlsProtocol(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CipherSuites", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCert + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthCert + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.CipherSuites = append(m.CipherSuites, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field EcdhCurves", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCert + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthCert + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.EcdhCurves = append(m.EcdhCurves, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipCert(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthCert + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *TlsCertificate) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCert + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: TlsCertificate: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TlsCertificate: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CertificateChain", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCert + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCert + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.CertificateChain == nil { + m.CertificateChain = &core.DataSource{} + } + if err := m.CertificateChain.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PrivateKey", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCert + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCert + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.PrivateKey == nil { + m.PrivateKey = &core.DataSource{} + } + if err := m.PrivateKey.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Password", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCert + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCert + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Password == nil { + m.Password = &core.DataSource{} + } + if err := m.Password.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OcspStaple", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCert + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCert + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.OcspStaple == nil { + m.OcspStaple = &core.DataSource{} + } + if err := m.OcspStaple.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SignedCertificateTimestamp", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCert + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCert + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SignedCertificateTimestamp = append(m.SignedCertificateTimestamp, &core.DataSource{}) + if err := m.SignedCertificateTimestamp[len(m.SignedCertificateTimestamp)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipCert(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthCert + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *TlsSessionTicketKeys) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCert + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: TlsSessionTicketKeys: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TlsSessionTicketKeys: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Keys", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCert + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCert + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Keys = append(m.Keys, &core.DataSource{}) + if err := m.Keys[len(m.Keys)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipCert(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthCert + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CertificateValidationContext) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCert + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: CertificateValidationContext: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CertificateValidationContext: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TrustedCa", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCert + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCert + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.TrustedCa == nil { + m.TrustedCa = &core.DataSource{} + } + if err := m.TrustedCa.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field VerifyCertificateHash", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCert + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthCert + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.VerifyCertificateHash = append(m.VerifyCertificateHash, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field VerifyCertificateSpki", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCert + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthCert + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.VerifyCertificateSpki = append(m.VerifyCertificateSpki, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field VerifySubjectAltName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCert + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthCert + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.VerifySubjectAltName = append(m.VerifySubjectAltName, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequireOcspStaple", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCert + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCert + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.RequireOcspStaple == nil { + m.RequireOcspStaple = &types.BoolValue{} + } + if err := m.RequireOcspStaple.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequireSignedCertificateTimestamp", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCert + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCert + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.RequireSignedCertificateTimestamp == nil { + m.RequireSignedCertificateTimestamp = &types.BoolValue{} + } + if err := m.RequireSignedCertificateTimestamp.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Crl", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCert + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCert + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Crl == nil { + m.Crl = &core.DataSource{} + } + if err := m.Crl.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 8: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field AllowExpiredCertificate", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCert + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.AllowExpiredCertificate = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skipCert(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthCert + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CommonTlsContext) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCert + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: CommonTlsContext: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CommonTlsContext: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TlsParams", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCert + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCert + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.TlsParams == nil { + m.TlsParams = &TlsParameters{} + } + if err := m.TlsParams.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TlsCertificates", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCert + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCert + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TlsCertificates = append(m.TlsCertificates, &TlsCertificate{}) + if err := m.TlsCertificates[len(m.TlsCertificates)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidationContext", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCert + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCert + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &CertificateValidationContext{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.ValidationContextType = &CommonTlsContext_ValidationContext{v} + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AlpnProtocols", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCert + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthCert + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.AlpnProtocols = append(m.AlpnProtocols, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DeprecatedV1", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCert + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCert + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.DeprecatedV1 == nil { + m.DeprecatedV1 = &CommonTlsContext_DeprecatedV1{} + } + if err := m.DeprecatedV1.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TlsCertificateSdsSecretConfigs", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCert + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCert + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TlsCertificateSdsSecretConfigs = append(m.TlsCertificateSdsSecretConfigs, &SdsSecretConfig{}) + if err := m.TlsCertificateSdsSecretConfigs[len(m.TlsCertificateSdsSecretConfigs)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidationContextSdsSecretConfig", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCert + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCert + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &SdsSecretConfig{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.ValidationContextType = &CommonTlsContext_ValidationContextSdsSecretConfig{v} + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipCert(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthCert + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CommonTlsContext_DeprecatedV1) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCert + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DeprecatedV1: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DeprecatedV1: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AltAlpnProtocols", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCert + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthCert + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.AltAlpnProtocols = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipCert(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthCert + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *UpstreamTlsContext) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCert + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: UpstreamTlsContext: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: UpstreamTlsContext: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommonTlsContext", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCert + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCert + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.CommonTlsContext == nil { + m.CommonTlsContext = &CommonTlsContext{} + } + if err := m.CommonTlsContext.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sni", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCert + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthCert + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Sni = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field AllowRenegotiation", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCert + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.AllowRenegotiation = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skipCert(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthCert + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DownstreamTlsContext) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCert + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DownstreamTlsContext: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DownstreamTlsContext: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommonTlsContext", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCert + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCert + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.CommonTlsContext == nil { + m.CommonTlsContext = &CommonTlsContext{} + } + if err := m.CommonTlsContext.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequireClientCertificate", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCert + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCert + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.RequireClientCertificate == nil { + m.RequireClientCertificate = &types.BoolValue{} + } + if err := m.RequireClientCertificate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequireSni", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCert + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCert + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.RequireSni == nil { + m.RequireSni = &types.BoolValue{} + } + if err := m.RequireSni.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SessionTicketKeys", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCert + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCert + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &TlsSessionTicketKeys{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.SessionTicketKeysType = &DownstreamTlsContext_SessionTicketKeys{v} + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SessionTicketKeysSdsSecretConfig", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCert + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCert + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &SdsSecretConfig{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.SessionTicketKeysType = &DownstreamTlsContext_SessionTicketKeysSdsSecretConfig{v} + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipCert(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthCert + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *SdsSecretConfig) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCert + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: SdsSecretConfig: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SdsSecretConfig: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCert + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthCert + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SdsConfig", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCert + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCert + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.SdsConfig == nil { + m.SdsConfig = &core.ConfigSource{} + } + if err := m.SdsConfig.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipCert(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthCert + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Secret) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCert + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Secret: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Secret: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCert + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthCert + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TlsCertificate", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCert + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCert + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &TlsCertificate{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Type = &Secret_TlsCertificate{v} + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SessionTicketKeys", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCert + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCert + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &TlsSessionTicketKeys{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Type = &Secret_SessionTicketKeys{v} + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidationContext", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCert + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCert + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &CertificateValidationContext{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Type = &Secret_ValidationContext{v} + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipCert(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthCert + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipCert(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowCert + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowCert + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + return iNdEx, nil + case 1: + iNdEx += 8 + return iNdEx, nil + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowCert + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + iNdEx += length + if length < 0 { + return 0, ErrInvalidLengthCert + } + return iNdEx, nil + case 3: + for { + var innerWire uint64 + var start int = iNdEx + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowCert + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + innerWire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + innerWireType := int(innerWire & 0x7) + if innerWireType == 4 { + break + } + next, err := skipCert(dAtA[start:]) + if err != nil { + return 0, err + } + iNdEx = start + next + } + return iNdEx, nil + case 4: + return iNdEx, nil + case 5: + iNdEx += 4 + return iNdEx, nil + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + } + panic("unreachable") +} + +var ( + ErrInvalidLengthCert = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowCert = fmt.Errorf("proto: integer overflow") +) + +func init() { proto.RegisterFile("envoy/api/v2/auth/cert.proto", fileDescriptor_cert_d136c0593daa7c3c) } + +var fileDescriptor_cert_d136c0593daa7c3c = []byte{ + // 1252 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x56, 0x31, 0x73, 0x1b, 0x45, + 0x14, 0xf6, 0x49, 0xb2, 0x23, 0x3f, 0xd9, 0xce, 0x79, 0x63, 0xf0, 0x45, 0x63, 0x1c, 0x45, 0x49, + 0x06, 0x17, 0x1e, 0x29, 0x76, 0x86, 0x02, 0x08, 0x81, 0x48, 0x61, 0xc6, 0x43, 0x02, 0x81, 0x93, + 0xe2, 0x49, 0x68, 0x96, 0xf5, 0x69, 0x2d, 0x2d, 0x3e, 0xdd, 0x1d, 0xbb, 0xab, 0x73, 0xd4, 0xf2, + 0x13, 0x52, 0xf3, 0x03, 0xe8, 0xe8, 0x28, 0xa8, 0x28, 0x69, 0x98, 0xc9, 0x4f, 0x60, 0xdc, 0xd1, + 0x50, 0xd3, 0xc1, 0xec, 0xee, 0x49, 0x3e, 0x49, 0x97, 0x58, 0xcc, 0x64, 0xe8, 0x6e, 0xf7, 0xbd, + 0xf7, 0xbd, 0xa7, 0xb7, 0xdf, 0xfb, 0x9e, 0x60, 0x8b, 0x06, 0x71, 0x38, 0xac, 0x93, 0x88, 0xd5, + 0xe3, 0xfd, 0x3a, 0x19, 0xc8, 0x5e, 0xdd, 0xa3, 0x5c, 0xd6, 0x22, 0x1e, 0xca, 0x10, 0xad, 0x6b, + 0x6b, 0x8d, 0x44, 0xac, 0x16, 0xef, 0xd7, 0x94, 0xb5, 0x3c, 0x19, 0xe0, 0x85, 0x9c, 0xd6, 0x8f, + 0x88, 0xa0, 0x26, 0xa0, 0x7c, 0x6b, 0xd6, 0xea, 0x85, 0xc1, 0x31, 0xeb, 0x62, 0x11, 0x0e, 0xb8, + 0x37, 0x72, 0xdb, 0xee, 0x86, 0x61, 0xd7, 0xa7, 0x75, 0x7d, 0x3a, 0x1a, 0x1c, 0xd7, 0x4f, 0x39, + 0x89, 0x22, 0xca, 0x45, 0x62, 0xdf, 0x8c, 0x89, 0xcf, 0x3a, 0x44, 0xd2, 0xfa, 0xe8, 0x23, 0x31, + 0x6c, 0x74, 0xc3, 0x6e, 0xa8, 0x3f, 0xeb, 0xea, 0xcb, 0xdc, 0x56, 0x7f, 0xc8, 0xc3, 0x6a, 0xdb, + 0x17, 0x5f, 0x12, 0x4e, 0xfa, 0x54, 0x52, 0x2e, 0xd0, 0x10, 0xb6, 0xa4, 0x2f, 0x70, 0x9f, 0x05, + 0xac, 0x3f, 0xe8, 0x63, 0xed, 0xe6, 0x85, 0x3e, 0x8e, 0x29, 0x17, 0x2c, 0x0c, 0x1c, 0xab, 0x62, + 0xed, 0xac, 0xed, 0xef, 0xd6, 0x66, 0x7e, 0x5f, 0x6d, 0x02, 0x47, 0x9f, 0x92, 0xd8, 0x06, 0xfc, + 0xf2, 0xe7, 0xaf, 0xf9, 0xc5, 0xef, 0xad, 0x9c, 0x6d, 0xb9, 0x57, 0xa5, 0x2f, 0x3e, 0x37, 0xe0, + 0x23, 0xfb, 0xa1, 0x81, 0x1e, 0xa7, 0x26, 0xcf, 0xb3, 0x53, 0xe7, 0xde, 0x44, 0x6a, 0x03, 0x3e, + 0x9d, 0xfa, 0x06, 0xac, 0x7a, 0x2c, 0xea, 0x51, 0x8e, 0xc5, 0x80, 0x49, 0x2a, 0x9c, 0x7c, 0x25, + 0xbf, 0xb3, 0xec, 0xae, 0x98, 0xcb, 0x96, 0xbe, 0x43, 0xd7, 0xa0, 0x44, 0xbd, 0x4e, 0x0f, 0x7b, + 0x03, 0x1e, 0x53, 0xe1, 0x14, 0xb4, 0x0b, 0xa8, 0xab, 0xa6, 0xbe, 0xa9, 0x3e, 0x86, 0x52, 0x2a, + 0x37, 0x5a, 0x81, 0x62, 0xfb, 0x51, 0x0b, 0xdf, 0x7f, 0xd2, 0x7e, 0x6c, 0x2f, 0xa0, 0x12, 0x5c, + 0x6a, 0x3f, 0x6a, 0xc5, 0x7b, 0xf8, 0xb6, 0x6d, 0x9d, 0x1f, 0xf6, 0xec, 0xdc, 0xf9, 0x61, 0xdf, + 0xce, 0x9f, 0x1f, 0xee, 0xd8, 0x85, 0xea, 0xdf, 0x39, 0x58, 0x6b, 0xfb, 0xa2, 0x49, 0xb9, 0x64, + 0xc7, 0xcc, 0x23, 0x92, 0xa2, 0xcf, 0x60, 0xdd, 0x3b, 0x3f, 0x62, 0xaf, 0x47, 0x98, 0x79, 0x94, + 0xd2, 0xfe, 0x3b, 0x93, 0x9d, 0x51, 0x1c, 0xaa, 0x3d, 0x20, 0x92, 0xb4, 0x34, 0x81, 0x5c, 0x3b, + 0x15, 0xd7, 0x54, 0x61, 0xe8, 0x1e, 0x94, 0x22, 0xce, 0x62, 0x85, 0x73, 0x42, 0x87, 0xba, 0xbf, + 0x17, 0xa2, 0x40, 0x12, 0xf1, 0x90, 0x0e, 0xd1, 0xfb, 0x50, 0x8c, 0x88, 0x10, 0xa7, 0x21, 0xef, + 0x38, 0xf9, 0x79, 0x82, 0xc7, 0xee, 0x2a, 0x75, 0xe8, 0x89, 0x08, 0x0b, 0x49, 0x22, 0x9f, 0x3a, + 0x85, 0xb9, 0x52, 0xab, 0x88, 0x96, 0x0e, 0x40, 0x18, 0xb6, 0x04, 0xeb, 0x06, 0xb4, 0x83, 0xd3, + 0xdd, 0x90, 0xac, 0x4f, 0x85, 0x24, 0xfd, 0xc8, 0x59, 0xac, 0xe4, 0x2f, 0x06, 0x2c, 0x1b, 0x88, + 0x54, 0x7b, 0xdb, 0x23, 0x80, 0xea, 0x13, 0xd8, 0x68, 0xfb, 0xa2, 0x45, 0x85, 0xe2, 0x47, 0x9b, + 0x79, 0x27, 0x54, 0x3e, 0xa4, 0x43, 0x81, 0x3e, 0x82, 0xc2, 0x09, 0x1d, 0x0a, 0xc7, 0x9a, 0x23, + 0x41, 0xc2, 0xbe, 0x17, 0x56, 0xae, 0x68, 0xb9, 0x3a, 0xac, 0xfa, 0x7b, 0x01, 0xb6, 0x52, 0xf9, + 0x0e, 0xcd, 0x90, 0xb2, 0x30, 0x68, 0x86, 0x81, 0xa4, 0xcf, 0x25, 0xba, 0x0b, 0x20, 0xf9, 0x40, + 0x48, 0xf5, 0xcb, 0xc8, 0x7c, 0x0f, 0xbb, 0x9c, 0x04, 0x34, 0x09, 0x3a, 0x80, 0xcd, 0x98, 0x72, + 0x76, 0x3c, 0x9c, 0x68, 0x4b, 0x8f, 0x88, 0x9e, 0x93, 0x53, 0x74, 0x6d, 0xd8, 0xaa, 0xa2, 0xd2, + 0x0b, 0xab, 0x58, 0x5d, 0xe2, 0x85, 0xca, 0x27, 0x3b, 0xd8, 0x7d, 0xcb, 0x04, 0xa4, 0x8a, 0x3a, + 0x20, 0xa2, 0xf7, 0x0a, 0x24, 0x11, 0x9d, 0x30, 0x33, 0x1b, 0x53, 0x48, 0xbb, 0x3b, 0xbb, 0x19, + 0x48, 0xad, 0xe8, 0x84, 0xa1, 0xf7, 0xc6, 0x48, 0x62, 0x70, 0xf4, 0x2d, 0xf5, 0x24, 0x26, 0xbe, + 0xc4, 0x01, 0xe9, 0xd3, 0x64, 0x84, 0x36, 0x8c, 0xb9, 0x65, 0xac, 0xf7, 0x7d, 0xf9, 0x05, 0xe9, + 0x2b, 0xa2, 0x5f, 0xe1, 0xf4, 0xbb, 0x01, 0xe3, 0x14, 0xa7, 0x99, 0xb2, 0xa8, 0x3b, 0x52, 0xae, + 0x19, 0x1d, 0xac, 0x8d, 0x74, 0xb0, 0xd6, 0x08, 0x43, 0xff, 0x90, 0xf8, 0x03, 0xea, 0xae, 0x27, + 0x61, 0x8f, 0xcf, 0xd9, 0x72, 0x02, 0x37, 0x47, 0x58, 0xaf, 0x65, 0xcd, 0xd2, 0x85, 0xe0, 0xd7, + 0x13, 0x9c, 0xd6, 0x2b, 0x99, 0x83, 0xea, 0x90, 0xf7, 0xb8, 0xef, 0x5c, 0x9a, 0xe7, 0xe9, 0x94, + 0x27, 0xfa, 0x00, 0xae, 0x12, 0xdf, 0x0f, 0x4f, 0x31, 0x7d, 0x1e, 0x31, 0x3e, 0x59, 0x9c, 0x53, + 0xac, 0x58, 0x3b, 0x45, 0x77, 0x53, 0x3b, 0x7c, 0x6a, 0xec, 0xa9, 0xac, 0xd5, 0x97, 0x8b, 0x60, + 0x37, 0xc3, 0x7e, 0x3f, 0x0c, 0x94, 0x4e, 0x24, 0x1c, 0xfa, 0x18, 0x40, 0x09, 0x69, 0xa4, 0x24, + 0x51, 0x24, 0x1c, 0xaa, 0x5c, 0x24, 0x9b, 0xee, 0xb2, 0x4c, 0x8e, 0x02, 0x3d, 0x05, 0x5b, 0x01, + 0xa4, 0xea, 0x10, 0x9a, 0x3f, 0xa5, 0xfd, 0xeb, 0xd9, 0x30, 0xa9, 0x92, 0xce, 0x49, 0x6f, 0x5b, + 0xee, 0x65, 0x39, 0x61, 0x13, 0xe8, 0x1b, 0x40, 0xf1, 0x98, 0xf3, 0xd8, 0x33, 0x05, 0x27, 0xe2, + 0x51, 0xcf, 0xc0, 0x7e, 0xdd, 0xac, 0x1c, 0x2c, 0xb8, 0xeb, 0xf1, 0xcc, 0x00, 0xdd, 0x82, 0x35, + 0xe2, 0x47, 0xc1, 0x78, 0x7d, 0x8c, 0x84, 0x7a, 0x55, 0xdd, 0x8e, 0xb4, 0x59, 0xa0, 0x67, 0xb0, + 0xda, 0xa1, 0x11, 0xa7, 0x0a, 0xb9, 0x83, 0xe3, 0xbd, 0x84, 0x58, 0xb7, 0xb3, 0x6a, 0x98, 0xea, + 0x6f, 0xed, 0xc1, 0x38, 0xf0, 0x70, 0xaf, 0x91, 0x73, 0x2c, 0x77, 0xa5, 0x93, 0xba, 0x41, 0x01, + 0x54, 0xa7, 0xba, 0x87, 0x45, 0x47, 0x60, 0x41, 0x3d, 0x4e, 0x25, 0x36, 0x5b, 0x5d, 0x38, 0x4b, + 0xba, 0x9f, 0xd5, 0x8c, 0x7c, 0xad, 0x8e, 0x68, 0x69, 0xdf, 0xa6, 0x76, 0x75, 0xb7, 0x27, 0x9b, + 0x38, 0x65, 0x16, 0x48, 0xc2, 0xcd, 0xd9, 0x9e, 0xce, 0xa6, 0x4c, 0x18, 0x39, 0x47, 0xc6, 0x83, + 0x05, 0xb7, 0x32, 0xd3, 0xd8, 0x29, 0x9f, 0xf2, 0x5d, 0x58, 0x49, 0xf7, 0x01, 0xed, 0x02, 0x52, + 0x73, 0x3d, 0xd5, 0x7b, 0x45, 0xbe, 0x65, 0xd7, 0x26, 0xbe, 0xbc, 0x9f, 0x6e, 0x7f, 0xe3, 0x2a, + 0x6c, 0x66, 0xd4, 0x2c, 0x87, 0x11, 0xad, 0xfe, 0x6c, 0x01, 0x7a, 0x12, 0x09, 0xc9, 0x29, 0xe9, + 0xa7, 0x48, 0xfd, 0x15, 0x20, 0x4f, 0x3f, 0x04, 0xd6, 0xcd, 0x4d, 0x98, 0x63, 0xc8, 0x7d, 0x63, + 0x8e, 0x57, 0x73, 0x6d, 0x6f, 0x7a, 0x4e, 0xb6, 0x20, 0x2f, 0x02, 0xa6, 0xf7, 0xde, 0x72, 0x42, + 0x5b, 0x9e, 0xdf, 0xf9, 0xc7, 0x72, 0xd5, 0x35, 0xaa, 0xc3, 0x15, 0x33, 0x96, 0x9c, 0x06, 0xb4, + 0x1b, 0x4a, 0xa6, 0x6b, 0xd5, 0x5c, 0x2d, 0xba, 0x48, 0x9b, 0xdc, 0xb4, 0xa5, 0xfa, 0x57, 0x1e, + 0x36, 0x1e, 0x84, 0xa7, 0xc1, 0xff, 0x51, 0xfa, 0x53, 0x28, 0x8f, 0x14, 0xcd, 0xf3, 0x19, 0x0d, + 0xe4, 0x84, 0x68, 0xe4, 0x2e, 0xd4, 0x31, 0x27, 0x89, 0x6e, 0xea, 0xe0, 0xf4, 0x1f, 0x8c, 0x0f, + 0xa1, 0x34, 0xd6, 0xca, 0x80, 0x25, 0xa3, 0xf9, 0x3a, 0x28, 0x18, 0x49, 0x62, 0xc0, 0xd0, 0x33, + 0xb8, 0x22, 0xcc, 0xca, 0xc4, 0x52, 0xef, 0x4c, 0xac, 0x97, 0xa5, 0x59, 0xef, 0xef, 0x66, 0x6b, + 0xc7, 0xcc, 0x8e, 0x55, 0x73, 0x2d, 0x66, 0x16, 0xef, 0x00, 0x6e, 0x65, 0x40, 0x67, 0xd0, 0x7c, + 0xf1, 0xbf, 0xd0, 0x7c, 0x26, 0xcf, 0x94, 0x4f, 0xa3, 0x0c, 0x4e, 0x56, 0x5a, 0xcd, 0x54, 0x0a, + 0x97, 0xa7, 0xdc, 0x11, 0x82, 0x82, 0xde, 0x6c, 0x86, 0xf7, 0xfa, 0x1b, 0xdd, 0x03, 0x50, 0x55, + 0x26, 0xe5, 0x99, 0xb7, 0xb9, 0x96, 0xb1, 0x17, 0x0c, 0xc4, 0x68, 0xa9, 0x8b, 0x8e, 0x30, 0x17, + 0xd5, 0x9f, 0x72, 0xb0, 0x64, 0x92, 0x64, 0xc2, 0x3f, 0x82, 0xcb, 0x53, 0x72, 0x93, 0xe4, 0xb8, + 0x58, 0xab, 0x0f, 0x16, 0xdc, 0xb5, 0x49, 0x71, 0x79, 0xd5, 0x0b, 0xe6, 0xdf, 0xc0, 0x0b, 0x66, + 0x6b, 0x7f, 0xe1, 0xcd, 0x69, 0x7f, 0x63, 0x09, 0x0a, 0xea, 0x61, 0x1a, 0x6f, 0xff, 0x78, 0xb6, + 0x6d, 0xfd, 0x76, 0xb6, 0x6d, 0xbd, 0x3c, 0xdb, 0xb6, 0xfe, 0x38, 0xdb, 0xb6, 0xbe, 0x2e, 0x28, + 0xc4, 0xa3, 0x25, 0x4d, 0xdf, 0x3b, 0xff, 0x06, 0x00, 0x00, 0xff, 0xff, 0xab, 0x88, 0xc4, 0x71, + 0xbc, 0x0d, 0x00, 0x00, +} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/auth/cert.pb.validate.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/auth/cert.pb.validate.go new file mode 100644 index 000000000000..46d97775e905 --- /dev/null +++ b/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/auth/cert.pb.validate.go @@ -0,0 +1,831 @@ +// Code generated by protoc-gen-validate +// source: envoy/api/v2/auth/cert.proto +// DO NOT EDIT!!! + +package auth + +import ( + "bytes" + "errors" + "fmt" + "net" + "net/mail" + "net/url" + "regexp" + "strings" + "time" + "unicode/utf8" + + "github.com/gogo/protobuf/types" +) + +// ensure the imports are used +var ( + _ = bytes.MinRead + _ = errors.New("") + _ = fmt.Print + _ = utf8.UTFMax + _ = (*regexp.Regexp)(nil) + _ = (*strings.Reader)(nil) + _ = net.IPv4len + _ = time.Duration(0) + _ = (*url.URL)(nil) + _ = (*mail.Address)(nil) + _ = types.DynamicAny{} +) + +// Validate checks the field values on TlsParameters with the rules defined in +// the proto definition for this message. If any rules are violated, an error +// is returned. +func (m *TlsParameters) Validate() error { + if m == nil { + return nil + } + + if _, ok := TlsParameters_TlsProtocol_name[int32(m.GetTlsMinimumProtocolVersion())]; !ok { + return TlsParametersValidationError{ + Field: "TlsMinimumProtocolVersion", + Reason: "value must be one of the defined enum values", + } + } + + if _, ok := TlsParameters_TlsProtocol_name[int32(m.GetTlsMaximumProtocolVersion())]; !ok { + return TlsParametersValidationError{ + Field: "TlsMaximumProtocolVersion", + Reason: "value must be one of the defined enum values", + } + } + + return nil +} + +// TlsParametersValidationError is the validation error returned by +// TlsParameters.Validate if the designated constraints aren't met. +type TlsParametersValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e TlsParametersValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sTlsParameters.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = TlsParametersValidationError{} + +// Validate checks the field values on TlsCertificate with the rules defined in +// the proto definition for this message. If any rules are violated, an error +// is returned. +func (m *TlsCertificate) Validate() error { + if m == nil { + return nil + } + + if v, ok := interface{}(m.GetCertificateChain()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return TlsCertificateValidationError{ + Field: "CertificateChain", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + if v, ok := interface{}(m.GetPrivateKey()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return TlsCertificateValidationError{ + Field: "PrivateKey", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + if v, ok := interface{}(m.GetPassword()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return TlsCertificateValidationError{ + Field: "Password", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + if v, ok := interface{}(m.GetOcspStaple()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return TlsCertificateValidationError{ + Field: "OcspStaple", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + for idx, item := range m.GetSignedCertificateTimestamp() { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return TlsCertificateValidationError{ + Field: fmt.Sprintf("SignedCertificateTimestamp[%v]", idx), + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + } + + return nil +} + +// TlsCertificateValidationError is the validation error returned by +// TlsCertificate.Validate if the designated constraints aren't met. +type TlsCertificateValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e TlsCertificateValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sTlsCertificate.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = TlsCertificateValidationError{} + +// Validate checks the field values on TlsSessionTicketKeys with the rules +// defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *TlsSessionTicketKeys) Validate() error { + if m == nil { + return nil + } + + if len(m.GetKeys()) < 1 { + return TlsSessionTicketKeysValidationError{ + Field: "Keys", + Reason: "value must contain at least 1 item(s)", + } + } + + for idx, item := range m.GetKeys() { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return TlsSessionTicketKeysValidationError{ + Field: fmt.Sprintf("Keys[%v]", idx), + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + } + + return nil +} + +// TlsSessionTicketKeysValidationError is the validation error returned by +// TlsSessionTicketKeys.Validate if the designated constraints aren't met. +type TlsSessionTicketKeysValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e TlsSessionTicketKeysValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sTlsSessionTicketKeys.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = TlsSessionTicketKeysValidationError{} + +// Validate checks the field values on CertificateValidationContext with the +// rules defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *CertificateValidationContext) Validate() error { + if m == nil { + return nil + } + + if v, ok := interface{}(m.GetTrustedCa()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return CertificateValidationContextValidationError{ + Field: "TrustedCa", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + for idx, item := range m.GetVerifyCertificateSpki() { + _, _ = idx, item + + if len(item) != 44 { + return CertificateValidationContextValidationError{ + Field: fmt.Sprintf("VerifyCertificateSpki[%v]", idx), + Reason: "value length must be 44 bytes", + } + } + + } + + for idx, item := range m.GetVerifyCertificateHash() { + _, _ = idx, item + + if l := len(item); l < 64 || l > 95 { + return CertificateValidationContextValidationError{ + Field: fmt.Sprintf("VerifyCertificateHash[%v]", idx), + Reason: "value length must be between 64 and 95 bytes, inclusive", + } + } + + } + + if v, ok := interface{}(m.GetRequireOcspStaple()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return CertificateValidationContextValidationError{ + Field: "RequireOcspStaple", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + if v, ok := interface{}(m.GetRequireSignedCertificateTimestamp()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return CertificateValidationContextValidationError{ + Field: "RequireSignedCertificateTimestamp", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + if v, ok := interface{}(m.GetCrl()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return CertificateValidationContextValidationError{ + Field: "Crl", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + // no validation rules for AllowExpiredCertificate + + return nil +} + +// CertificateValidationContextValidationError is the validation error returned +// by CertificateValidationContext.Validate if the designated constraints +// aren't met. +type CertificateValidationContextValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e CertificateValidationContextValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sCertificateValidationContext.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = CertificateValidationContextValidationError{} + +// Validate checks the field values on CommonTlsContext with the rules defined +// in the proto definition for this message. If any rules are violated, an +// error is returned. +func (m *CommonTlsContext) Validate() error { + if m == nil { + return nil + } + + if v, ok := interface{}(m.GetTlsParams()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return CommonTlsContextValidationError{ + Field: "TlsParams", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + if len(m.GetTlsCertificates()) > 1 { + return CommonTlsContextValidationError{ + Field: "TlsCertificates", + Reason: "value must contain no more than 1 item(s)", + } + } + + for idx, item := range m.GetTlsCertificates() { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return CommonTlsContextValidationError{ + Field: fmt.Sprintf("TlsCertificates[%v]", idx), + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + } + + for idx, item := range m.GetTlsCertificateSdsSecretConfigs() { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return CommonTlsContextValidationError{ + Field: fmt.Sprintf("TlsCertificateSdsSecretConfigs[%v]", idx), + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + } + + if v, ok := interface{}(m.GetDeprecatedV1()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return CommonTlsContextValidationError{ + Field: "DeprecatedV1", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + switch m.ValidationContextType.(type) { + + case *CommonTlsContext_ValidationContext: + + if v, ok := interface{}(m.GetValidationContext()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return CommonTlsContextValidationError{ + Field: "ValidationContext", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + case *CommonTlsContext_ValidationContextSdsSecretConfig: + + if v, ok := interface{}(m.GetValidationContextSdsSecretConfig()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return CommonTlsContextValidationError{ + Field: "ValidationContextSdsSecretConfig", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + } + + return nil +} + +// CommonTlsContextValidationError is the validation error returned by +// CommonTlsContext.Validate if the designated constraints aren't met. +type CommonTlsContextValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e CommonTlsContextValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sCommonTlsContext.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = CommonTlsContextValidationError{} + +// Validate checks the field values on UpstreamTlsContext with the rules +// defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *UpstreamTlsContext) Validate() error { + if m == nil { + return nil + } + + if v, ok := interface{}(m.GetCommonTlsContext()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return UpstreamTlsContextValidationError{ + Field: "CommonTlsContext", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + if len(m.GetSni()) > 255 { + return UpstreamTlsContextValidationError{ + Field: "Sni", + Reason: "value length must be at most 255 bytes", + } + } + + // no validation rules for AllowRenegotiation + + return nil +} + +// UpstreamTlsContextValidationError is the validation error returned by +// UpstreamTlsContext.Validate if the designated constraints aren't met. +type UpstreamTlsContextValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e UpstreamTlsContextValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sUpstreamTlsContext.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = UpstreamTlsContextValidationError{} + +// Validate checks the field values on DownstreamTlsContext with the rules +// defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *DownstreamTlsContext) Validate() error { + if m == nil { + return nil + } + + if v, ok := interface{}(m.GetCommonTlsContext()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return DownstreamTlsContextValidationError{ + Field: "CommonTlsContext", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + if v, ok := interface{}(m.GetRequireClientCertificate()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return DownstreamTlsContextValidationError{ + Field: "RequireClientCertificate", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + if v, ok := interface{}(m.GetRequireSni()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return DownstreamTlsContextValidationError{ + Field: "RequireSni", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + switch m.SessionTicketKeysType.(type) { + + case *DownstreamTlsContext_SessionTicketKeys: + + if v, ok := interface{}(m.GetSessionTicketKeys()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return DownstreamTlsContextValidationError{ + Field: "SessionTicketKeys", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + case *DownstreamTlsContext_SessionTicketKeysSdsSecretConfig: + + if v, ok := interface{}(m.GetSessionTicketKeysSdsSecretConfig()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return DownstreamTlsContextValidationError{ + Field: "SessionTicketKeysSdsSecretConfig", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + } + + return nil +} + +// DownstreamTlsContextValidationError is the validation error returned by +// DownstreamTlsContext.Validate if the designated constraints aren't met. +type DownstreamTlsContextValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e DownstreamTlsContextValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sDownstreamTlsContext.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = DownstreamTlsContextValidationError{} + +// Validate checks the field values on SdsSecretConfig with the rules defined +// in the proto definition for this message. If any rules are violated, an +// error is returned. +func (m *SdsSecretConfig) Validate() error { + if m == nil { + return nil + } + + // no validation rules for Name + + if v, ok := interface{}(m.GetSdsConfig()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return SdsSecretConfigValidationError{ + Field: "SdsConfig", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + return nil +} + +// SdsSecretConfigValidationError is the validation error returned by +// SdsSecretConfig.Validate if the designated constraints aren't met. +type SdsSecretConfigValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e SdsSecretConfigValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sSdsSecretConfig.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = SdsSecretConfigValidationError{} + +// Validate checks the field values on Secret with the rules defined in the +// proto definition for this message. If any rules are violated, an error is returned. +func (m *Secret) Validate() error { + if m == nil { + return nil + } + + // no validation rules for Name + + switch m.Type.(type) { + + case *Secret_TlsCertificate: + + if v, ok := interface{}(m.GetTlsCertificate()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return SecretValidationError{ + Field: "TlsCertificate", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + case *Secret_SessionTicketKeys: + + if v, ok := interface{}(m.GetSessionTicketKeys()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return SecretValidationError{ + Field: "SessionTicketKeys", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + case *Secret_ValidationContext: + + if v, ok := interface{}(m.GetValidationContext()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return SecretValidationError{ + Field: "ValidationContext", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + } + + return nil +} + +// SecretValidationError is the validation error returned by Secret.Validate if +// the designated constraints aren't met. +type SecretValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e SecretValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sSecret.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = SecretValidationError{} + +// Validate checks the field values on CommonTlsContext_DeprecatedV1 with the +// rules defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *CommonTlsContext_DeprecatedV1) Validate() error { + if m == nil { + return nil + } + + // no validation rules for AltAlpnProtocols + + return nil +} + +// CommonTlsContext_DeprecatedV1ValidationError is the validation error +// returned by CommonTlsContext_DeprecatedV1.Validate if the designated +// constraints aren't met. +type CommonTlsContext_DeprecatedV1ValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e CommonTlsContext_DeprecatedV1ValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sCommonTlsContext_DeprecatedV1.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = CommonTlsContext_DeprecatedV1ValidationError{} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/cds.pb.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/cds.pb.go new file mode 100644 index 000000000000..a7f235be8527 --- /dev/null +++ b/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/cds.pb.go @@ -0,0 +1,6131 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: envoy/api/v2/cds.proto + +package v2 + +import proto "github.com/gogo/protobuf/proto" +import fmt "fmt" +import math "math" +import auth "github.com/envoyproxy/go-control-plane/envoy/api/v2/auth" +import cluster "github.com/envoyproxy/go-control-plane/envoy/api/v2/cluster" +import core "github.com/envoyproxy/go-control-plane/envoy/api/v2/core" +import _type "github.com/envoyproxy/go-control-plane/envoy/type" +import _ "github.com/gogo/googleapis/google/api" +import _ "github.com/gogo/protobuf/gogoproto" +import types "github.com/gogo/protobuf/types" +import _ "github.com/lyft/protoc-gen-validate/validate" + +import time "time" + +import bytes "bytes" + +import context "golang.org/x/net/context" +import grpc "google.golang.org/grpc" + +import github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" + +import io "io" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf +var _ = time.Kitchen + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package + +// Refer to :ref:`service discovery type ` +// for an explanation on each type. +type Cluster_DiscoveryType int32 + +const ( + // Refer to the :ref:`static discovery type` + // for an explanation. + Cluster_STATIC Cluster_DiscoveryType = 0 + // Refer to the :ref:`strict DNS discovery + // type` + // for an explanation. + Cluster_STRICT_DNS Cluster_DiscoveryType = 1 + // Refer to the :ref:`logical DNS discovery + // type` + // for an explanation. + Cluster_LOGICAL_DNS Cluster_DiscoveryType = 2 + // Refer to the :ref:`service discovery type` + // for an explanation. + Cluster_EDS Cluster_DiscoveryType = 3 + // Refer to the :ref:`original destination discovery + // type` + // for an explanation. + Cluster_ORIGINAL_DST Cluster_DiscoveryType = 4 +) + +var Cluster_DiscoveryType_name = map[int32]string{ + 0: "STATIC", + 1: "STRICT_DNS", + 2: "LOGICAL_DNS", + 3: "EDS", + 4: "ORIGINAL_DST", +} +var Cluster_DiscoveryType_value = map[string]int32{ + "STATIC": 0, + "STRICT_DNS": 1, + "LOGICAL_DNS": 2, + "EDS": 3, + "ORIGINAL_DST": 4, +} + +func (x Cluster_DiscoveryType) String() string { + return proto.EnumName(Cluster_DiscoveryType_name, int32(x)) +} +func (Cluster_DiscoveryType) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_cds_c9aad078b729c273, []int{0, 0} +} + +// Refer to :ref:`load balancer type ` architecture +// overview section for information on each type. +type Cluster_LbPolicy int32 + +const ( + // Refer to the :ref:`round robin load balancing + // policy` + // for an explanation. + Cluster_ROUND_ROBIN Cluster_LbPolicy = 0 + // Refer to the :ref:`least request load balancing + // policy` + // for an explanation. + Cluster_LEAST_REQUEST Cluster_LbPolicy = 1 + // Refer to the :ref:`ring hash load balancing + // policy` + // for an explanation. + Cluster_RING_HASH Cluster_LbPolicy = 2 + // Refer to the :ref:`random load balancing + // policy` + // for an explanation. + Cluster_RANDOM Cluster_LbPolicy = 3 + // Refer to the :ref:`original destination load balancing + // policy` + // for an explanation. + Cluster_ORIGINAL_DST_LB Cluster_LbPolicy = 4 + // Refer to the :ref:`Maglev load balancing policy` + // for an explanation. + Cluster_MAGLEV Cluster_LbPolicy = 5 +) + +var Cluster_LbPolicy_name = map[int32]string{ + 0: "ROUND_ROBIN", + 1: "LEAST_REQUEST", + 2: "RING_HASH", + 3: "RANDOM", + 4: "ORIGINAL_DST_LB", + 5: "MAGLEV", +} +var Cluster_LbPolicy_value = map[string]int32{ + "ROUND_ROBIN": 0, + "LEAST_REQUEST": 1, + "RING_HASH": 2, + "RANDOM": 3, + "ORIGINAL_DST_LB": 4, + "MAGLEV": 5, +} + +func (x Cluster_LbPolicy) String() string { + return proto.EnumName(Cluster_LbPolicy_name, int32(x)) +} +func (Cluster_LbPolicy) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_cds_c9aad078b729c273, []int{0, 1} +} + +// When V4_ONLY is selected, the DNS resolver will only perform a lookup for +// addresses in the IPv4 family. If V6_ONLY is selected, the DNS resolver will +// only perform a lookup for addresses in the IPv6 family. If AUTO is +// specified, the DNS resolver will first perform a lookup for addresses in +// the IPv6 family and fallback to a lookup for addresses in the IPv4 family. +// For cluster types other than +// :ref:`STRICT_DNS` and +// :ref:`LOGICAL_DNS`, +// this setting is +// ignored. +type Cluster_DnsLookupFamily int32 + +const ( + Cluster_AUTO Cluster_DnsLookupFamily = 0 + Cluster_V4_ONLY Cluster_DnsLookupFamily = 1 + Cluster_V6_ONLY Cluster_DnsLookupFamily = 2 +) + +var Cluster_DnsLookupFamily_name = map[int32]string{ + 0: "AUTO", + 1: "V4_ONLY", + 2: "V6_ONLY", +} +var Cluster_DnsLookupFamily_value = map[string]int32{ + "AUTO": 0, + "V4_ONLY": 1, + "V6_ONLY": 2, +} + +func (x Cluster_DnsLookupFamily) String() string { + return proto.EnumName(Cluster_DnsLookupFamily_name, int32(x)) +} +func (Cluster_DnsLookupFamily) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_cds_c9aad078b729c273, []int{0, 2} +} + +type Cluster_ClusterProtocolSelection int32 + +const ( + // Cluster can only operate on one of the possible upstream protocols (HTTP1.1, HTTP2). + // If :ref:`http2_protocol_options ` are + // present, HTTP2 will be used, otherwise HTTP1.1 will be used. + Cluster_USE_CONFIGURED_PROTOCOL Cluster_ClusterProtocolSelection = 0 + // Use HTTP1.1 or HTTP2, depending on which one is used on the downstream connection. + Cluster_USE_DOWNSTREAM_PROTOCOL Cluster_ClusterProtocolSelection = 1 +) + +var Cluster_ClusterProtocolSelection_name = map[int32]string{ + 0: "USE_CONFIGURED_PROTOCOL", + 1: "USE_DOWNSTREAM_PROTOCOL", +} +var Cluster_ClusterProtocolSelection_value = map[string]int32{ + "USE_CONFIGURED_PROTOCOL": 0, + "USE_DOWNSTREAM_PROTOCOL": 1, +} + +func (x Cluster_ClusterProtocolSelection) String() string { + return proto.EnumName(Cluster_ClusterProtocolSelection_name, int32(x)) +} +func (Cluster_ClusterProtocolSelection) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_cds_c9aad078b729c273, []int{0, 3} +} + +// If NO_FALLBACK is selected, a result +// equivalent to no healthy hosts is reported. If ANY_ENDPOINT is selected, +// any cluster endpoint may be returned (subject to policy, health checks, +// etc). If DEFAULT_SUBSET is selected, load balancing is performed over the +// endpoints matching the values from the default_subset field. +type Cluster_LbSubsetConfig_LbSubsetFallbackPolicy int32 + +const ( + Cluster_LbSubsetConfig_NO_FALLBACK Cluster_LbSubsetConfig_LbSubsetFallbackPolicy = 0 + Cluster_LbSubsetConfig_ANY_ENDPOINT Cluster_LbSubsetConfig_LbSubsetFallbackPolicy = 1 + Cluster_LbSubsetConfig_DEFAULT_SUBSET Cluster_LbSubsetConfig_LbSubsetFallbackPolicy = 2 +) + +var Cluster_LbSubsetConfig_LbSubsetFallbackPolicy_name = map[int32]string{ + 0: "NO_FALLBACK", + 1: "ANY_ENDPOINT", + 2: "DEFAULT_SUBSET", +} +var Cluster_LbSubsetConfig_LbSubsetFallbackPolicy_value = map[string]int32{ + "NO_FALLBACK": 0, + "ANY_ENDPOINT": 1, + "DEFAULT_SUBSET": 2, +} + +func (x Cluster_LbSubsetConfig_LbSubsetFallbackPolicy) String() string { + return proto.EnumName(Cluster_LbSubsetConfig_LbSubsetFallbackPolicy_name, int32(x)) +} +func (Cluster_LbSubsetConfig_LbSubsetFallbackPolicy) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_cds_c9aad078b729c273, []int{0, 2, 0} +} + +// Configuration for a single upstream cluster. +// [#comment:next free field: 36] +type Cluster struct { + // Supplies the name of the cluster which must be unique across all clusters. + // The cluster name is used when emitting + // :ref:`statistics ` if :ref:`alt_stat_name + // ` is not provided. + // Any ``:`` in the cluster name will be converted to ``_`` when emitting statistics. + // By default, the maximum length of a cluster name is limited to 60 + // characters. This limit can be increased by setting the + // :option:`--max-obj-name-len` command line argument to the desired value. + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // An optional alternative to the cluster name to be used while emitting stats. + // Any ``:`` in the name will be converted to ``_`` when emitting statistics. This should not be + // confused with :ref:`Router Filter Header + // `. + AltStatName string `protobuf:"bytes,28,opt,name=alt_stat_name,json=altStatName,proto3" json:"alt_stat_name,omitempty"` + // The :ref:`service discovery type ` + // to use for resolving the cluster. + Type Cluster_DiscoveryType `protobuf:"varint,2,opt,name=type,proto3,enum=envoy.api.v2.Cluster_DiscoveryType" json:"type,omitempty"` + // Configuration to use for EDS updates for the Cluster. + EdsClusterConfig *Cluster_EdsClusterConfig `protobuf:"bytes,3,opt,name=eds_cluster_config,json=edsClusterConfig" json:"eds_cluster_config,omitempty"` + // The timeout for new network connections to hosts in the cluster. + ConnectTimeout time.Duration `protobuf:"bytes,4,opt,name=connect_timeout,json=connectTimeout,stdduration" json:"connect_timeout"` + // Soft limit on size of the cluster’s connections read and write buffers. If + // unspecified, an implementation defined default is applied (1MiB). + PerConnectionBufferLimitBytes *types.UInt32Value `protobuf:"bytes,5,opt,name=per_connection_buffer_limit_bytes,json=perConnectionBufferLimitBytes" json:"per_connection_buffer_limit_bytes,omitempty"` + // The :ref:`load balancer type ` to use + // when picking a host in the cluster. + LbPolicy Cluster_LbPolicy `protobuf:"varint,6,opt,name=lb_policy,json=lbPolicy,proto3,enum=envoy.api.v2.Cluster_LbPolicy" json:"lb_policy,omitempty"` + // If the service discovery type is + // :ref:`STATIC`, + // :ref:`STRICT_DNS` + // or :ref:`LOGICAL_DNS`, + // then hosts is required. + // + // .. attention:: + // + // **This field is deprecated**. Set the + // :ref:`load_assignment` field instead. + // + Hosts []*core.Address `protobuf:"bytes,7,rep,name=hosts" json:"hosts,omitempty"` // Deprecated: Do not use. + // Setting this is required for specifying members of + // :ref:`STATIC`, + // :ref:`STRICT_DNS` + // or :ref:`LOGICAL_DNS` clusters. + // This field supersedes :ref:`hosts` field. + // [#comment:TODO(dio): Deprecate the hosts field and add it to DEPRECATED.md + // once load_assignment is implemented.] + // + // .. attention:: + // + // Setting this allows non-EDS cluster types to contain embedded EDS equivalent + // :ref:`endpoint assignments`. + // Setting this overrides :ref:`hosts` values. + // + LoadAssignment *ClusterLoadAssignment `protobuf:"bytes,33,opt,name=load_assignment,json=loadAssignment" json:"load_assignment,omitempty"` + // Optional :ref:`active health checking ` + // configuration for the cluster. If no + // configuration is specified no health checking will be done and all cluster + // members will be considered healthy at all times. + HealthChecks []*core.HealthCheck `protobuf:"bytes,8,rep,name=health_checks,json=healthChecks" json:"health_checks,omitempty"` + // Optional maximum requests for a single upstream connection. This parameter + // is respected by both the HTTP/1.1 and HTTP/2 connection pool + // implementations. If not specified, there is no limit. Setting this + // parameter to 1 will effectively disable keep alive. + MaxRequestsPerConnection *types.UInt32Value `protobuf:"bytes,9,opt,name=max_requests_per_connection,json=maxRequestsPerConnection" json:"max_requests_per_connection,omitempty"` + // Optional :ref:`circuit breaking ` for the cluster. + CircuitBreakers *cluster.CircuitBreakers `protobuf:"bytes,10,opt,name=circuit_breakers,json=circuitBreakers" json:"circuit_breakers,omitempty"` + // The TLS configuration for connections to the upstream cluster. If no TLS + // configuration is specified, TLS will not be used for new connections. + // + // .. attention:: + // + // Server certificate verification is not enabled by default. Configure + // :ref:`trusted_ca` to enable + // verification. + TlsContext *auth.UpstreamTlsContext `protobuf:"bytes,11,opt,name=tls_context,json=tlsContext" json:"tls_context,omitempty"` + // Additional options when handling HTTP requests. These options will be applicable to both + // HTTP1 and HTTP2 requests. + CommonHttpProtocolOptions *core.HttpProtocolOptions `protobuf:"bytes,29,opt,name=common_http_protocol_options,json=commonHttpProtocolOptions" json:"common_http_protocol_options,omitempty"` + // Additional options when handling HTTP1 requests. + HttpProtocolOptions *core.Http1ProtocolOptions `protobuf:"bytes,13,opt,name=http_protocol_options,json=httpProtocolOptions" json:"http_protocol_options,omitempty"` + // Even if default HTTP2 protocol options are desired, this field must be + // set so that Envoy will assume that the upstream supports HTTP/2 when + // making new HTTP connection pool connections. Currently, Envoy only + // supports prior knowledge for upstream connections. Even if TLS is used + // with ALPN, `http2_protocol_options` must be specified. As an aside this allows HTTP/2 + // connections to happen over plain text. + Http2ProtocolOptions *core.Http2ProtocolOptions `protobuf:"bytes,14,opt,name=http2_protocol_options,json=http2ProtocolOptions" json:"http2_protocol_options,omitempty"` + // The extension_protocol_options field is used to provide extension-specific protocol options + // for upstream connections. The key should match the extension filter name, such as + // "envoy.filters.network.thrift_proxy". See the extension's documentation for details on + // specific options. + ExtensionProtocolOptions map[string]*types.Struct `protobuf:"bytes,35,rep,name=extension_protocol_options,json=extensionProtocolOptions" json:"extension_protocol_options,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value"` + // If the DNS refresh rate is specified and the cluster type is either + // :ref:`STRICT_DNS`, + // or :ref:`LOGICAL_DNS`, + // this value is used as the cluster’s DNS refresh + // rate. If this setting is not specified, the value defaults to 5000. For + // cluster types other than + // :ref:`STRICT_DNS` + // and :ref:`LOGICAL_DNS` + // this setting is ignored. + DnsRefreshRate *time.Duration `protobuf:"bytes,16,opt,name=dns_refresh_rate,json=dnsRefreshRate,stdduration" json:"dns_refresh_rate,omitempty"` + // The DNS IP address resolution policy. If this setting is not specified, the + // value defaults to + // :ref:`AUTO`. + DnsLookupFamily Cluster_DnsLookupFamily `protobuf:"varint,17,opt,name=dns_lookup_family,json=dnsLookupFamily,proto3,enum=envoy.api.v2.Cluster_DnsLookupFamily" json:"dns_lookup_family,omitempty"` + // If DNS resolvers are specified and the cluster type is either + // :ref:`STRICT_DNS`, + // or :ref:`LOGICAL_DNS`, + // this value is used to specify the cluster’s dns resolvers. + // If this setting is not specified, the value defaults to the default + // resolver, which uses /etc/resolv.conf for configuration. For cluster types + // other than + // :ref:`STRICT_DNS` + // and :ref:`LOGICAL_DNS` + // this setting is ignored. + DnsResolvers []*core.Address `protobuf:"bytes,18,rep,name=dns_resolvers,json=dnsResolvers" json:"dns_resolvers,omitempty"` + // If specified, outlier detection will be enabled for this upstream cluster. + // Each of the configuration values can be overridden via + // :ref:`runtime values `. + OutlierDetection *cluster.OutlierDetection `protobuf:"bytes,19,opt,name=outlier_detection,json=outlierDetection" json:"outlier_detection,omitempty"` + // The interval for removing stale hosts from a cluster type + // :ref:`ORIGINAL_DST`. + // Hosts are considered stale if they have not been used + // as upstream destinations during this interval. New hosts are added + // to original destination clusters on demand as new connections are + // redirected to Envoy, causing the number of hosts in the cluster to + // grow over time. Hosts that are not stale (they are actively used as + // destinations) are kept in the cluster, which allows connections to + // them remain open, saving the latency that would otherwise be spent + // on opening new connections. If this setting is not specified, the + // value defaults to 5000ms. For cluster types other than + // :ref:`ORIGINAL_DST` + // this setting is ignored. + CleanupInterval *time.Duration `protobuf:"bytes,20,opt,name=cleanup_interval,json=cleanupInterval,stdduration" json:"cleanup_interval,omitempty"` + // Optional configuration used to bind newly established upstream connections. + // This overrides any bind_config specified in the bootstrap proto. + // If the address and port are empty, no bind will be performed. + UpstreamBindConfig *core.BindConfig `protobuf:"bytes,21,opt,name=upstream_bind_config,json=upstreamBindConfig" json:"upstream_bind_config,omitempty"` + // Configuration for load balancing subsetting. + LbSubsetConfig *Cluster_LbSubsetConfig `protobuf:"bytes,22,opt,name=lb_subset_config,json=lbSubsetConfig" json:"lb_subset_config,omitempty"` + // Optional configuration for the load balancing algorithm selected by + // LbPolicy. Currently only + // :ref:`RING_HASH` + // has additional configuration options. + // Specifying ring_hash_lb_config without setting the LbPolicy to + // :ref:`RING_HASH` + // will generate an error at runtime. + // + // Types that are valid to be assigned to LbConfig: + // *Cluster_RingHashLbConfig_ + // *Cluster_OriginalDstLbConfig_ + LbConfig isCluster_LbConfig `protobuf_oneof:"lb_config"` + // Common configuration for all load balancer implementations. + CommonLbConfig *Cluster_CommonLbConfig `protobuf:"bytes,27,opt,name=common_lb_config,json=commonLbConfig" json:"common_lb_config,omitempty"` + // Optional custom transport socket implementation to use for upstream connections. + TransportSocket *core.TransportSocket `protobuf:"bytes,24,opt,name=transport_socket,json=transportSocket" json:"transport_socket,omitempty"` + // The Metadata field can be used to provide additional information about the + // cluster. It can be used for stats, logging, and varying filter behavior. + // Fields should use reverse DNS notation to denote which entity within Envoy + // will need the information. For instance, if the metadata is intended for + // the Router filter, the filter name should be specified as *envoy.router*. + Metadata *core.Metadata `protobuf:"bytes,25,opt,name=metadata" json:"metadata,omitempty"` + // Determines how Envoy selects the protocol used to speak to upstream hosts. + ProtocolSelection Cluster_ClusterProtocolSelection `protobuf:"varint,26,opt,name=protocol_selection,json=protocolSelection,proto3,enum=envoy.api.v2.Cluster_ClusterProtocolSelection" json:"protocol_selection,omitempty"` + // Optional options for upstream connections. + UpstreamConnectionOptions *UpstreamConnectionOptions `protobuf:"bytes,30,opt,name=upstream_connection_options,json=upstreamConnectionOptions" json:"upstream_connection_options,omitempty"` + // If an upstream host becomes unhealthy (as determined by the configured health checks + // or outlier detection), immediately close all connections to the failed host. + // + // .. note:: + // + // This is currently only supported for connections created by tcp_proxy. + // + // .. note:: + // + // The current implementation of this feature closes all connections immediately when + // the unhealthy status is detected. If there are a large number of connections open + // to an upstream host that becomes unhealthy, Envoy may spend a substantial amount of + // time exclusively closing these connections, and not processing any other traffic. + CloseConnectionsOnHostHealthFailure bool `protobuf:"varint,31,opt,name=close_connections_on_host_health_failure,json=closeConnectionsOnHostHealthFailure,proto3" json:"close_connections_on_host_health_failure,omitempty"` + // If this cluster uses EDS or STRICT_DNS to configure its hosts, immediately drain + // connections from any hosts that are removed from service discovery. + // + // This only affects behavior for hosts that are being actively health checked. + // If this flag is not set to true, Envoy will wait until the hosts fail active health + // checking before removing it from the cluster. + DrainConnectionsOnHostRemoval bool `protobuf:"varint,32,opt,name=drain_connections_on_host_removal,json=drainConnectionsOnHostRemoval,proto3" json:"drain_connections_on_host_removal,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Cluster) Reset() { *m = Cluster{} } +func (m *Cluster) String() string { return proto.CompactTextString(m) } +func (*Cluster) ProtoMessage() {} +func (*Cluster) Descriptor() ([]byte, []int) { + return fileDescriptor_cds_c9aad078b729c273, []int{0} +} +func (m *Cluster) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Cluster) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Cluster.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *Cluster) XXX_Merge(src proto.Message) { + xxx_messageInfo_Cluster.Merge(dst, src) +} +func (m *Cluster) XXX_Size() int { + return m.Size() +} +func (m *Cluster) XXX_DiscardUnknown() { + xxx_messageInfo_Cluster.DiscardUnknown(m) +} + +var xxx_messageInfo_Cluster proto.InternalMessageInfo + +type isCluster_LbConfig interface { + isCluster_LbConfig() + Equal(interface{}) bool + MarshalTo([]byte) (int, error) + Size() int +} + +type Cluster_RingHashLbConfig_ struct { + RingHashLbConfig *Cluster_RingHashLbConfig `protobuf:"bytes,23,opt,name=ring_hash_lb_config,json=ringHashLbConfig,oneof"` +} +type Cluster_OriginalDstLbConfig_ struct { + OriginalDstLbConfig *Cluster_OriginalDstLbConfig `protobuf:"bytes,34,opt,name=original_dst_lb_config,json=originalDstLbConfig,oneof"` +} + +func (*Cluster_RingHashLbConfig_) isCluster_LbConfig() {} +func (*Cluster_OriginalDstLbConfig_) isCluster_LbConfig() {} + +func (m *Cluster) GetLbConfig() isCluster_LbConfig { + if m != nil { + return m.LbConfig + } + return nil +} + +func (m *Cluster) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *Cluster) GetAltStatName() string { + if m != nil { + return m.AltStatName + } + return "" +} + +func (m *Cluster) GetType() Cluster_DiscoveryType { + if m != nil { + return m.Type + } + return Cluster_STATIC +} + +func (m *Cluster) GetEdsClusterConfig() *Cluster_EdsClusterConfig { + if m != nil { + return m.EdsClusterConfig + } + return nil +} + +func (m *Cluster) GetConnectTimeout() time.Duration { + if m != nil { + return m.ConnectTimeout + } + return 0 +} + +func (m *Cluster) GetPerConnectionBufferLimitBytes() *types.UInt32Value { + if m != nil { + return m.PerConnectionBufferLimitBytes + } + return nil +} + +func (m *Cluster) GetLbPolicy() Cluster_LbPolicy { + if m != nil { + return m.LbPolicy + } + return Cluster_ROUND_ROBIN +} + +// Deprecated: Do not use. +func (m *Cluster) GetHosts() []*core.Address { + if m != nil { + return m.Hosts + } + return nil +} + +func (m *Cluster) GetLoadAssignment() *ClusterLoadAssignment { + if m != nil { + return m.LoadAssignment + } + return nil +} + +func (m *Cluster) GetHealthChecks() []*core.HealthCheck { + if m != nil { + return m.HealthChecks + } + return nil +} + +func (m *Cluster) GetMaxRequestsPerConnection() *types.UInt32Value { + if m != nil { + return m.MaxRequestsPerConnection + } + return nil +} + +func (m *Cluster) GetCircuitBreakers() *cluster.CircuitBreakers { + if m != nil { + return m.CircuitBreakers + } + return nil +} + +func (m *Cluster) GetTlsContext() *auth.UpstreamTlsContext { + if m != nil { + return m.TlsContext + } + return nil +} + +func (m *Cluster) GetCommonHttpProtocolOptions() *core.HttpProtocolOptions { + if m != nil { + return m.CommonHttpProtocolOptions + } + return nil +} + +func (m *Cluster) GetHttpProtocolOptions() *core.Http1ProtocolOptions { + if m != nil { + return m.HttpProtocolOptions + } + return nil +} + +func (m *Cluster) GetHttp2ProtocolOptions() *core.Http2ProtocolOptions { + if m != nil { + return m.Http2ProtocolOptions + } + return nil +} + +func (m *Cluster) GetExtensionProtocolOptions() map[string]*types.Struct { + if m != nil { + return m.ExtensionProtocolOptions + } + return nil +} + +func (m *Cluster) GetDnsRefreshRate() *time.Duration { + if m != nil { + return m.DnsRefreshRate + } + return nil +} + +func (m *Cluster) GetDnsLookupFamily() Cluster_DnsLookupFamily { + if m != nil { + return m.DnsLookupFamily + } + return Cluster_AUTO +} + +func (m *Cluster) GetDnsResolvers() []*core.Address { + if m != nil { + return m.DnsResolvers + } + return nil +} + +func (m *Cluster) GetOutlierDetection() *cluster.OutlierDetection { + if m != nil { + return m.OutlierDetection + } + return nil +} + +func (m *Cluster) GetCleanupInterval() *time.Duration { + if m != nil { + return m.CleanupInterval + } + return nil +} + +func (m *Cluster) GetUpstreamBindConfig() *core.BindConfig { + if m != nil { + return m.UpstreamBindConfig + } + return nil +} + +func (m *Cluster) GetLbSubsetConfig() *Cluster_LbSubsetConfig { + if m != nil { + return m.LbSubsetConfig + } + return nil +} + +func (m *Cluster) GetRingHashLbConfig() *Cluster_RingHashLbConfig { + if x, ok := m.GetLbConfig().(*Cluster_RingHashLbConfig_); ok { + return x.RingHashLbConfig + } + return nil +} + +func (m *Cluster) GetOriginalDstLbConfig() *Cluster_OriginalDstLbConfig { + if x, ok := m.GetLbConfig().(*Cluster_OriginalDstLbConfig_); ok { + return x.OriginalDstLbConfig + } + return nil +} + +func (m *Cluster) GetCommonLbConfig() *Cluster_CommonLbConfig { + if m != nil { + return m.CommonLbConfig + } + return nil +} + +func (m *Cluster) GetTransportSocket() *core.TransportSocket { + if m != nil { + return m.TransportSocket + } + return nil +} + +func (m *Cluster) GetMetadata() *core.Metadata { + if m != nil { + return m.Metadata + } + return nil +} + +func (m *Cluster) GetProtocolSelection() Cluster_ClusterProtocolSelection { + if m != nil { + return m.ProtocolSelection + } + return Cluster_USE_CONFIGURED_PROTOCOL +} + +func (m *Cluster) GetUpstreamConnectionOptions() *UpstreamConnectionOptions { + if m != nil { + return m.UpstreamConnectionOptions + } + return nil +} + +func (m *Cluster) GetCloseConnectionsOnHostHealthFailure() bool { + if m != nil { + return m.CloseConnectionsOnHostHealthFailure + } + return false +} + +func (m *Cluster) GetDrainConnectionsOnHostRemoval() bool { + if m != nil { + return m.DrainConnectionsOnHostRemoval + } + return false +} + +// XXX_OneofFuncs is for the internal use of the proto package. +func (*Cluster) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { + return _Cluster_OneofMarshaler, _Cluster_OneofUnmarshaler, _Cluster_OneofSizer, []interface{}{ + (*Cluster_RingHashLbConfig_)(nil), + (*Cluster_OriginalDstLbConfig_)(nil), + } +} + +func _Cluster_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { + m := msg.(*Cluster) + // lb_config + switch x := m.LbConfig.(type) { + case *Cluster_RingHashLbConfig_: + _ = b.EncodeVarint(23<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.RingHashLbConfig); err != nil { + return err + } + case *Cluster_OriginalDstLbConfig_: + _ = b.EncodeVarint(34<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.OriginalDstLbConfig); err != nil { + return err + } + case nil: + default: + return fmt.Errorf("Cluster.LbConfig has unexpected type %T", x) + } + return nil +} + +func _Cluster_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { + m := msg.(*Cluster) + switch tag { + case 23: // lb_config.ring_hash_lb_config + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(Cluster_RingHashLbConfig) + err := b.DecodeMessage(msg) + m.LbConfig = &Cluster_RingHashLbConfig_{msg} + return true, err + case 34: // lb_config.original_dst_lb_config + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(Cluster_OriginalDstLbConfig) + err := b.DecodeMessage(msg) + m.LbConfig = &Cluster_OriginalDstLbConfig_{msg} + return true, err + default: + return false, nil + } +} + +func _Cluster_OneofSizer(msg proto.Message) (n int) { + m := msg.(*Cluster) + // lb_config + switch x := m.LbConfig.(type) { + case *Cluster_RingHashLbConfig_: + s := proto.Size(x.RingHashLbConfig) + n += 2 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case *Cluster_OriginalDstLbConfig_: + s := proto.Size(x.OriginalDstLbConfig) + n += 2 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case nil: + default: + panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) + } + return n +} + +// Only valid when discovery type is EDS. +type Cluster_EdsClusterConfig struct { + // Configuration for the source of EDS updates for this Cluster. + EdsConfig *core.ConfigSource `protobuf:"bytes,1,opt,name=eds_config,json=edsConfig" json:"eds_config,omitempty"` + // Optional alternative to cluster name to present to EDS. This does not + // have the same restrictions as cluster name, i.e. it may be arbitrary + // length. + ServiceName string `protobuf:"bytes,2,opt,name=service_name,json=serviceName,proto3" json:"service_name,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Cluster_EdsClusterConfig) Reset() { *m = Cluster_EdsClusterConfig{} } +func (m *Cluster_EdsClusterConfig) String() string { return proto.CompactTextString(m) } +func (*Cluster_EdsClusterConfig) ProtoMessage() {} +func (*Cluster_EdsClusterConfig) Descriptor() ([]byte, []int) { + return fileDescriptor_cds_c9aad078b729c273, []int{0, 0} +} +func (m *Cluster_EdsClusterConfig) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Cluster_EdsClusterConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Cluster_EdsClusterConfig.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *Cluster_EdsClusterConfig) XXX_Merge(src proto.Message) { + xxx_messageInfo_Cluster_EdsClusterConfig.Merge(dst, src) +} +func (m *Cluster_EdsClusterConfig) XXX_Size() int { + return m.Size() +} +func (m *Cluster_EdsClusterConfig) XXX_DiscardUnknown() { + xxx_messageInfo_Cluster_EdsClusterConfig.DiscardUnknown(m) +} + +var xxx_messageInfo_Cluster_EdsClusterConfig proto.InternalMessageInfo + +func (m *Cluster_EdsClusterConfig) GetEdsConfig() *core.ConfigSource { + if m != nil { + return m.EdsConfig + } + return nil +} + +func (m *Cluster_EdsClusterConfig) GetServiceName() string { + if m != nil { + return m.ServiceName + } + return "" +} + +// Optionally divide the endpoints in this cluster into subsets defined by +// endpoint metadata and selected by route and weighted cluster metadata. +type Cluster_LbSubsetConfig struct { + // The behavior used when no endpoint subset matches the selected route's + // metadata. The value defaults to + // :ref:`NO_FALLBACK`. + FallbackPolicy Cluster_LbSubsetConfig_LbSubsetFallbackPolicy `protobuf:"varint,1,opt,name=fallback_policy,json=fallbackPolicy,proto3,enum=envoy.api.v2.Cluster_LbSubsetConfig_LbSubsetFallbackPolicy" json:"fallback_policy,omitempty"` + // Specifies the default subset of endpoints used during fallback if + // fallback_policy is + // :ref:`DEFAULT_SUBSET`. + // Each field in default_subset is + // compared to the matching LbEndpoint.Metadata under the *envoy.lb* + // namespace. It is valid for no hosts to match, in which case the behavior + // is the same as a fallback_policy of + // :ref:`NO_FALLBACK`. + DefaultSubset *types.Struct `protobuf:"bytes,2,opt,name=default_subset,json=defaultSubset" json:"default_subset,omitempty"` + // For each entry, LbEndpoint.Metadata's + // *envoy.lb* namespace is traversed and a subset is created for each unique + // combination of key and value. For example: + // + // .. code-block:: json + // + // { "subset_selectors": [ + // { "keys": [ "version" ] }, + // { "keys": [ "stage", "hardware_type" ] } + // ]} + // + // A subset is matched when the metadata from the selected route and + // weighted cluster contains the same keys and values as the subset's + // metadata. The same host may appear in multiple subsets. + SubsetSelectors []*Cluster_LbSubsetConfig_LbSubsetSelector `protobuf:"bytes,3,rep,name=subset_selectors,json=subsetSelectors" json:"subset_selectors,omitempty"` + // If true, routing to subsets will take into account the localities and locality weights of the + // endpoints when making the routing decision. + // + // There are some potential pitfalls associated with enabling this feature, as the resulting + // traffic split after applying both a subset match and locality weights might be undesirable. + // + // Consider for example a situation in which you have 50/50 split across two localities X/Y + // which have 100 hosts each without subsetting. If the subset LB results in X having only 1 + // host selected but Y having 100, then a lot more load is being dumped on the single host in X + // than originally anticipated in the load balancing assignment delivered via EDS. + LocalityWeightAware bool `protobuf:"varint,4,opt,name=locality_weight_aware,json=localityWeightAware,proto3" json:"locality_weight_aware,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Cluster_LbSubsetConfig) Reset() { *m = Cluster_LbSubsetConfig{} } +func (m *Cluster_LbSubsetConfig) String() string { return proto.CompactTextString(m) } +func (*Cluster_LbSubsetConfig) ProtoMessage() {} +func (*Cluster_LbSubsetConfig) Descriptor() ([]byte, []int) { + return fileDescriptor_cds_c9aad078b729c273, []int{0, 2} +} +func (m *Cluster_LbSubsetConfig) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Cluster_LbSubsetConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Cluster_LbSubsetConfig.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *Cluster_LbSubsetConfig) XXX_Merge(src proto.Message) { + xxx_messageInfo_Cluster_LbSubsetConfig.Merge(dst, src) +} +func (m *Cluster_LbSubsetConfig) XXX_Size() int { + return m.Size() +} +func (m *Cluster_LbSubsetConfig) XXX_DiscardUnknown() { + xxx_messageInfo_Cluster_LbSubsetConfig.DiscardUnknown(m) +} + +var xxx_messageInfo_Cluster_LbSubsetConfig proto.InternalMessageInfo + +func (m *Cluster_LbSubsetConfig) GetFallbackPolicy() Cluster_LbSubsetConfig_LbSubsetFallbackPolicy { + if m != nil { + return m.FallbackPolicy + } + return Cluster_LbSubsetConfig_NO_FALLBACK +} + +func (m *Cluster_LbSubsetConfig) GetDefaultSubset() *types.Struct { + if m != nil { + return m.DefaultSubset + } + return nil +} + +func (m *Cluster_LbSubsetConfig) GetSubsetSelectors() []*Cluster_LbSubsetConfig_LbSubsetSelector { + if m != nil { + return m.SubsetSelectors + } + return nil +} + +func (m *Cluster_LbSubsetConfig) GetLocalityWeightAware() bool { + if m != nil { + return m.LocalityWeightAware + } + return false +} + +// Specifications for subsets. +type Cluster_LbSubsetConfig_LbSubsetSelector struct { + // List of keys to match with the weighted cluster metadata. + Keys []string `protobuf:"bytes,1,rep,name=keys" json:"keys,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Cluster_LbSubsetConfig_LbSubsetSelector) Reset() { + *m = Cluster_LbSubsetConfig_LbSubsetSelector{} +} +func (m *Cluster_LbSubsetConfig_LbSubsetSelector) String() string { return proto.CompactTextString(m) } +func (*Cluster_LbSubsetConfig_LbSubsetSelector) ProtoMessage() {} +func (*Cluster_LbSubsetConfig_LbSubsetSelector) Descriptor() ([]byte, []int) { + return fileDescriptor_cds_c9aad078b729c273, []int{0, 2, 0} +} +func (m *Cluster_LbSubsetConfig_LbSubsetSelector) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Cluster_LbSubsetConfig_LbSubsetSelector) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Cluster_LbSubsetConfig_LbSubsetSelector.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *Cluster_LbSubsetConfig_LbSubsetSelector) XXX_Merge(src proto.Message) { + xxx_messageInfo_Cluster_LbSubsetConfig_LbSubsetSelector.Merge(dst, src) +} +func (m *Cluster_LbSubsetConfig_LbSubsetSelector) XXX_Size() int { + return m.Size() +} +func (m *Cluster_LbSubsetConfig_LbSubsetSelector) XXX_DiscardUnknown() { + xxx_messageInfo_Cluster_LbSubsetConfig_LbSubsetSelector.DiscardUnknown(m) +} + +var xxx_messageInfo_Cluster_LbSubsetConfig_LbSubsetSelector proto.InternalMessageInfo + +func (m *Cluster_LbSubsetConfig_LbSubsetSelector) GetKeys() []string { + if m != nil { + return m.Keys + } + return nil +} + +// Specific configuration for the :ref:`RingHash` +// load balancing policy. +type Cluster_RingHashLbConfig struct { + // Minimum hash ring size, i.e. total virtual nodes. A larger size + // will provide better request distribution since each host in the + // cluster will have more virtual nodes. Defaults to 1024. In the case + // that total number of hosts is greater than the minimum, each host will + // be allocated a single virtual node. This field is limited to 8M to bound + // resource use. + MinimumRingSize *types.UInt64Value `protobuf:"bytes,1,opt,name=minimum_ring_size,json=minimumRingSize" json:"minimum_ring_size,omitempty"` + // Deprecated settings from v1 config. + // [#not-implemented-hide:] Hide from docs. + DeprecatedV1 *Cluster_RingHashLbConfig_DeprecatedV1 `protobuf:"bytes,2,opt,name=deprecated_v1,json=deprecatedV1" json:"deprecated_v1,omitempty"` // Deprecated: Do not use. + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Cluster_RingHashLbConfig) Reset() { *m = Cluster_RingHashLbConfig{} } +func (m *Cluster_RingHashLbConfig) String() string { return proto.CompactTextString(m) } +func (*Cluster_RingHashLbConfig) ProtoMessage() {} +func (*Cluster_RingHashLbConfig) Descriptor() ([]byte, []int) { + return fileDescriptor_cds_c9aad078b729c273, []int{0, 3} +} +func (m *Cluster_RingHashLbConfig) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Cluster_RingHashLbConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Cluster_RingHashLbConfig.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *Cluster_RingHashLbConfig) XXX_Merge(src proto.Message) { + xxx_messageInfo_Cluster_RingHashLbConfig.Merge(dst, src) +} +func (m *Cluster_RingHashLbConfig) XXX_Size() int { + return m.Size() +} +func (m *Cluster_RingHashLbConfig) XXX_DiscardUnknown() { + xxx_messageInfo_Cluster_RingHashLbConfig.DiscardUnknown(m) +} + +var xxx_messageInfo_Cluster_RingHashLbConfig proto.InternalMessageInfo + +func (m *Cluster_RingHashLbConfig) GetMinimumRingSize() *types.UInt64Value { + if m != nil { + return m.MinimumRingSize + } + return nil +} + +// Deprecated: Do not use. +func (m *Cluster_RingHashLbConfig) GetDeprecatedV1() *Cluster_RingHashLbConfig_DeprecatedV1 { + if m != nil { + return m.DeprecatedV1 + } + return nil +} + +// [#not-implemented-hide:] Hide from docs. +type Cluster_RingHashLbConfig_DeprecatedV1 struct { + // Defaults to true, meaning that std::hash is used to hash hosts onto + // the ketama ring. std::hash can vary by platform. For this reason, + // Envoy will eventually use `xxHash `_ + // by default. This field exists for + // migration purposes and will eventually be deprecated. Set it to false + // to use `xxHash `_ now. + UseStdHash *types.BoolValue `protobuf:"bytes,1,opt,name=use_std_hash,json=useStdHash" json:"use_std_hash,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Cluster_RingHashLbConfig_DeprecatedV1) Reset() { *m = Cluster_RingHashLbConfig_DeprecatedV1{} } +func (m *Cluster_RingHashLbConfig_DeprecatedV1) String() string { return proto.CompactTextString(m) } +func (*Cluster_RingHashLbConfig_DeprecatedV1) ProtoMessage() {} +func (*Cluster_RingHashLbConfig_DeprecatedV1) Descriptor() ([]byte, []int) { + return fileDescriptor_cds_c9aad078b729c273, []int{0, 3, 0} +} +func (m *Cluster_RingHashLbConfig_DeprecatedV1) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Cluster_RingHashLbConfig_DeprecatedV1) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Cluster_RingHashLbConfig_DeprecatedV1.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *Cluster_RingHashLbConfig_DeprecatedV1) XXX_Merge(src proto.Message) { + xxx_messageInfo_Cluster_RingHashLbConfig_DeprecatedV1.Merge(dst, src) +} +func (m *Cluster_RingHashLbConfig_DeprecatedV1) XXX_Size() int { + return m.Size() +} +func (m *Cluster_RingHashLbConfig_DeprecatedV1) XXX_DiscardUnknown() { + xxx_messageInfo_Cluster_RingHashLbConfig_DeprecatedV1.DiscardUnknown(m) +} + +var xxx_messageInfo_Cluster_RingHashLbConfig_DeprecatedV1 proto.InternalMessageInfo + +func (m *Cluster_RingHashLbConfig_DeprecatedV1) GetUseStdHash() *types.BoolValue { + if m != nil { + return m.UseStdHash + } + return nil +} + +// Specific configuration for the +// :ref:`Original Destination ` +// load balancing policy. +type Cluster_OriginalDstLbConfig struct { + // When true, :ref:`x-envoy-orignal-dst-host + // ` can be used to override destination + // address. + // + // .. attention:: + // + // This header isn't sanitized by default, so enabling this feature allows HTTP clients to + // route traffic to arbitrary hosts and/or ports, which may have serious security + // consequences. + UseHttpHeader bool `protobuf:"varint,1,opt,name=use_http_header,json=useHttpHeader,proto3" json:"use_http_header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Cluster_OriginalDstLbConfig) Reset() { *m = Cluster_OriginalDstLbConfig{} } +func (m *Cluster_OriginalDstLbConfig) String() string { return proto.CompactTextString(m) } +func (*Cluster_OriginalDstLbConfig) ProtoMessage() {} +func (*Cluster_OriginalDstLbConfig) Descriptor() ([]byte, []int) { + return fileDescriptor_cds_c9aad078b729c273, []int{0, 4} +} +func (m *Cluster_OriginalDstLbConfig) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Cluster_OriginalDstLbConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Cluster_OriginalDstLbConfig.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *Cluster_OriginalDstLbConfig) XXX_Merge(src proto.Message) { + xxx_messageInfo_Cluster_OriginalDstLbConfig.Merge(dst, src) +} +func (m *Cluster_OriginalDstLbConfig) XXX_Size() int { + return m.Size() +} +func (m *Cluster_OriginalDstLbConfig) XXX_DiscardUnknown() { + xxx_messageInfo_Cluster_OriginalDstLbConfig.DiscardUnknown(m) +} + +var xxx_messageInfo_Cluster_OriginalDstLbConfig proto.InternalMessageInfo + +func (m *Cluster_OriginalDstLbConfig) GetUseHttpHeader() bool { + if m != nil { + return m.UseHttpHeader + } + return false +} + +// Common configuration for all load balancer implementations. +type Cluster_CommonLbConfig struct { + // Configures the :ref:`healthy panic threshold `. + // If not specified, the default is 50%. + // + // .. note:: + // The specified percent will be truncated to the nearest 1%. + HealthyPanicThreshold *_type.Percent `protobuf:"bytes,1,opt,name=healthy_panic_threshold,json=healthyPanicThreshold" json:"healthy_panic_threshold,omitempty"` + // Types that are valid to be assigned to LocalityConfigSpecifier: + // *Cluster_CommonLbConfig_ZoneAwareLbConfig_ + // *Cluster_CommonLbConfig_LocalityWeightedLbConfig_ + LocalityConfigSpecifier isCluster_CommonLbConfig_LocalityConfigSpecifier `protobuf_oneof:"locality_config_specifier"` + // If set, all health check/weight/metadata updates that happen within this duration will be + // merged and delivered in one shot when the duration expires. The start of the duration is when + // the first update happens. This is useful for big clusters, with potentially noisy deploys + // that might trigger excessive CPU usage due to a constant stream of healthcheck state changes + // or metadata updates. By default, this is not configured and updates apply immediately. Also, + // the first set of updates to be seen apply immediately as well (e.g.: a new cluster). + // + // Note: merging does not apply to cluster membership changes (e.g.: adds/removes); this is + // because merging those updates isn't currently safe. See + // https://github.com/envoyproxy/envoy/pull/3941. + UpdateMergeWindow *types.Duration `protobuf:"bytes,4,opt,name=update_merge_window,json=updateMergeWindow" json:"update_merge_window,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Cluster_CommonLbConfig) Reset() { *m = Cluster_CommonLbConfig{} } +func (m *Cluster_CommonLbConfig) String() string { return proto.CompactTextString(m) } +func (*Cluster_CommonLbConfig) ProtoMessage() {} +func (*Cluster_CommonLbConfig) Descriptor() ([]byte, []int) { + return fileDescriptor_cds_c9aad078b729c273, []int{0, 5} +} +func (m *Cluster_CommonLbConfig) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Cluster_CommonLbConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Cluster_CommonLbConfig.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *Cluster_CommonLbConfig) XXX_Merge(src proto.Message) { + xxx_messageInfo_Cluster_CommonLbConfig.Merge(dst, src) +} +func (m *Cluster_CommonLbConfig) XXX_Size() int { + return m.Size() +} +func (m *Cluster_CommonLbConfig) XXX_DiscardUnknown() { + xxx_messageInfo_Cluster_CommonLbConfig.DiscardUnknown(m) +} + +var xxx_messageInfo_Cluster_CommonLbConfig proto.InternalMessageInfo + +type isCluster_CommonLbConfig_LocalityConfigSpecifier interface { + isCluster_CommonLbConfig_LocalityConfigSpecifier() + Equal(interface{}) bool + MarshalTo([]byte) (int, error) + Size() int +} + +type Cluster_CommonLbConfig_ZoneAwareLbConfig_ struct { + ZoneAwareLbConfig *Cluster_CommonLbConfig_ZoneAwareLbConfig `protobuf:"bytes,2,opt,name=zone_aware_lb_config,json=zoneAwareLbConfig,oneof"` +} +type Cluster_CommonLbConfig_LocalityWeightedLbConfig_ struct { + LocalityWeightedLbConfig *Cluster_CommonLbConfig_LocalityWeightedLbConfig `protobuf:"bytes,3,opt,name=locality_weighted_lb_config,json=localityWeightedLbConfig,oneof"` +} + +func (*Cluster_CommonLbConfig_ZoneAwareLbConfig_) isCluster_CommonLbConfig_LocalityConfigSpecifier() {} +func (*Cluster_CommonLbConfig_LocalityWeightedLbConfig_) isCluster_CommonLbConfig_LocalityConfigSpecifier() { +} + +func (m *Cluster_CommonLbConfig) GetLocalityConfigSpecifier() isCluster_CommonLbConfig_LocalityConfigSpecifier { + if m != nil { + return m.LocalityConfigSpecifier + } + return nil +} + +func (m *Cluster_CommonLbConfig) GetHealthyPanicThreshold() *_type.Percent { + if m != nil { + return m.HealthyPanicThreshold + } + return nil +} + +func (m *Cluster_CommonLbConfig) GetZoneAwareLbConfig() *Cluster_CommonLbConfig_ZoneAwareLbConfig { + if x, ok := m.GetLocalityConfigSpecifier().(*Cluster_CommonLbConfig_ZoneAwareLbConfig_); ok { + return x.ZoneAwareLbConfig + } + return nil +} + +func (m *Cluster_CommonLbConfig) GetLocalityWeightedLbConfig() *Cluster_CommonLbConfig_LocalityWeightedLbConfig { + if x, ok := m.GetLocalityConfigSpecifier().(*Cluster_CommonLbConfig_LocalityWeightedLbConfig_); ok { + return x.LocalityWeightedLbConfig + } + return nil +} + +func (m *Cluster_CommonLbConfig) GetUpdateMergeWindow() *types.Duration { + if m != nil { + return m.UpdateMergeWindow + } + return nil +} + +// XXX_OneofFuncs is for the internal use of the proto package. +func (*Cluster_CommonLbConfig) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { + return _Cluster_CommonLbConfig_OneofMarshaler, _Cluster_CommonLbConfig_OneofUnmarshaler, _Cluster_CommonLbConfig_OneofSizer, []interface{}{ + (*Cluster_CommonLbConfig_ZoneAwareLbConfig_)(nil), + (*Cluster_CommonLbConfig_LocalityWeightedLbConfig_)(nil), + } +} + +func _Cluster_CommonLbConfig_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { + m := msg.(*Cluster_CommonLbConfig) + // locality_config_specifier + switch x := m.LocalityConfigSpecifier.(type) { + case *Cluster_CommonLbConfig_ZoneAwareLbConfig_: + _ = b.EncodeVarint(2<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.ZoneAwareLbConfig); err != nil { + return err + } + case *Cluster_CommonLbConfig_LocalityWeightedLbConfig_: + _ = b.EncodeVarint(3<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.LocalityWeightedLbConfig); err != nil { + return err + } + case nil: + default: + return fmt.Errorf("Cluster_CommonLbConfig.LocalityConfigSpecifier has unexpected type %T", x) + } + return nil +} + +func _Cluster_CommonLbConfig_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { + m := msg.(*Cluster_CommonLbConfig) + switch tag { + case 2: // locality_config_specifier.zone_aware_lb_config + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(Cluster_CommonLbConfig_ZoneAwareLbConfig) + err := b.DecodeMessage(msg) + m.LocalityConfigSpecifier = &Cluster_CommonLbConfig_ZoneAwareLbConfig_{msg} + return true, err + case 3: // locality_config_specifier.locality_weighted_lb_config + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(Cluster_CommonLbConfig_LocalityWeightedLbConfig) + err := b.DecodeMessage(msg) + m.LocalityConfigSpecifier = &Cluster_CommonLbConfig_LocalityWeightedLbConfig_{msg} + return true, err + default: + return false, nil + } +} + +func _Cluster_CommonLbConfig_OneofSizer(msg proto.Message) (n int) { + m := msg.(*Cluster_CommonLbConfig) + // locality_config_specifier + switch x := m.LocalityConfigSpecifier.(type) { + case *Cluster_CommonLbConfig_ZoneAwareLbConfig_: + s := proto.Size(x.ZoneAwareLbConfig) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case *Cluster_CommonLbConfig_LocalityWeightedLbConfig_: + s := proto.Size(x.LocalityWeightedLbConfig) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case nil: + default: + panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) + } + return n +} + +// Configuration for :ref:`zone aware routing +// `. +type Cluster_CommonLbConfig_ZoneAwareLbConfig struct { + // Configures percentage of requests that will be considered for zone aware routing + // if zone aware routing is configured. If not specified, the default is 100%. + // * :ref:`runtime values `. + // * :ref:`Zone aware routing support `. + RoutingEnabled *_type.Percent `protobuf:"bytes,1,opt,name=routing_enabled,json=routingEnabled" json:"routing_enabled,omitempty"` + // Configures minimum upstream cluster size required for zone aware routing + // If upstream cluster size is less than specified, zone aware routing is not performed + // even if zone aware routing is configured. If not specified, the default is 6. + // * :ref:`runtime values `. + // * :ref:`Zone aware routing support `. + MinClusterSize *types.UInt64Value `protobuf:"bytes,2,opt,name=min_cluster_size,json=minClusterSize" json:"min_cluster_size,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Cluster_CommonLbConfig_ZoneAwareLbConfig) Reset() { + *m = Cluster_CommonLbConfig_ZoneAwareLbConfig{} +} +func (m *Cluster_CommonLbConfig_ZoneAwareLbConfig) String() string { return proto.CompactTextString(m) } +func (*Cluster_CommonLbConfig_ZoneAwareLbConfig) ProtoMessage() {} +func (*Cluster_CommonLbConfig_ZoneAwareLbConfig) Descriptor() ([]byte, []int) { + return fileDescriptor_cds_c9aad078b729c273, []int{0, 5, 0} +} +func (m *Cluster_CommonLbConfig_ZoneAwareLbConfig) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Cluster_CommonLbConfig_ZoneAwareLbConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Cluster_CommonLbConfig_ZoneAwareLbConfig.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *Cluster_CommonLbConfig_ZoneAwareLbConfig) XXX_Merge(src proto.Message) { + xxx_messageInfo_Cluster_CommonLbConfig_ZoneAwareLbConfig.Merge(dst, src) +} +func (m *Cluster_CommonLbConfig_ZoneAwareLbConfig) XXX_Size() int { + return m.Size() +} +func (m *Cluster_CommonLbConfig_ZoneAwareLbConfig) XXX_DiscardUnknown() { + xxx_messageInfo_Cluster_CommonLbConfig_ZoneAwareLbConfig.DiscardUnknown(m) +} + +var xxx_messageInfo_Cluster_CommonLbConfig_ZoneAwareLbConfig proto.InternalMessageInfo + +func (m *Cluster_CommonLbConfig_ZoneAwareLbConfig) GetRoutingEnabled() *_type.Percent { + if m != nil { + return m.RoutingEnabled + } + return nil +} + +func (m *Cluster_CommonLbConfig_ZoneAwareLbConfig) GetMinClusterSize() *types.UInt64Value { + if m != nil { + return m.MinClusterSize + } + return nil +} + +// Configuration for :ref:`locality weighted load balancing +// ` +type Cluster_CommonLbConfig_LocalityWeightedLbConfig struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Cluster_CommonLbConfig_LocalityWeightedLbConfig) Reset() { + *m = Cluster_CommonLbConfig_LocalityWeightedLbConfig{} +} +func (m *Cluster_CommonLbConfig_LocalityWeightedLbConfig) String() string { + return proto.CompactTextString(m) +} +func (*Cluster_CommonLbConfig_LocalityWeightedLbConfig) ProtoMessage() {} +func (*Cluster_CommonLbConfig_LocalityWeightedLbConfig) Descriptor() ([]byte, []int) { + return fileDescriptor_cds_c9aad078b729c273, []int{0, 5, 1} +} +func (m *Cluster_CommonLbConfig_LocalityWeightedLbConfig) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Cluster_CommonLbConfig_LocalityWeightedLbConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Cluster_CommonLbConfig_LocalityWeightedLbConfig.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *Cluster_CommonLbConfig_LocalityWeightedLbConfig) XXX_Merge(src proto.Message) { + xxx_messageInfo_Cluster_CommonLbConfig_LocalityWeightedLbConfig.Merge(dst, src) +} +func (m *Cluster_CommonLbConfig_LocalityWeightedLbConfig) XXX_Size() int { + return m.Size() +} +func (m *Cluster_CommonLbConfig_LocalityWeightedLbConfig) XXX_DiscardUnknown() { + xxx_messageInfo_Cluster_CommonLbConfig_LocalityWeightedLbConfig.DiscardUnknown(m) +} + +var xxx_messageInfo_Cluster_CommonLbConfig_LocalityWeightedLbConfig proto.InternalMessageInfo + +// An extensible structure containing the address Envoy should bind to when +// establishing upstream connections. +type UpstreamBindConfig struct { + // The address Envoy should bind to when establishing upstream connections. + SourceAddress *core.Address `protobuf:"bytes,1,opt,name=source_address,json=sourceAddress" json:"source_address,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *UpstreamBindConfig) Reset() { *m = UpstreamBindConfig{} } +func (m *UpstreamBindConfig) String() string { return proto.CompactTextString(m) } +func (*UpstreamBindConfig) ProtoMessage() {} +func (*UpstreamBindConfig) Descriptor() ([]byte, []int) { + return fileDescriptor_cds_c9aad078b729c273, []int{1} +} +func (m *UpstreamBindConfig) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *UpstreamBindConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_UpstreamBindConfig.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *UpstreamBindConfig) XXX_Merge(src proto.Message) { + xxx_messageInfo_UpstreamBindConfig.Merge(dst, src) +} +func (m *UpstreamBindConfig) XXX_Size() int { + return m.Size() +} +func (m *UpstreamBindConfig) XXX_DiscardUnknown() { + xxx_messageInfo_UpstreamBindConfig.DiscardUnknown(m) +} + +var xxx_messageInfo_UpstreamBindConfig proto.InternalMessageInfo + +func (m *UpstreamBindConfig) GetSourceAddress() *core.Address { + if m != nil { + return m.SourceAddress + } + return nil +} + +type UpstreamConnectionOptions struct { + // If set then set SO_KEEPALIVE on the socket to enable TCP Keepalives. + TcpKeepalive *core.TcpKeepalive `protobuf:"bytes,1,opt,name=tcp_keepalive,json=tcpKeepalive" json:"tcp_keepalive,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *UpstreamConnectionOptions) Reset() { *m = UpstreamConnectionOptions{} } +func (m *UpstreamConnectionOptions) String() string { return proto.CompactTextString(m) } +func (*UpstreamConnectionOptions) ProtoMessage() {} +func (*UpstreamConnectionOptions) Descriptor() ([]byte, []int) { + return fileDescriptor_cds_c9aad078b729c273, []int{2} +} +func (m *UpstreamConnectionOptions) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *UpstreamConnectionOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_UpstreamConnectionOptions.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *UpstreamConnectionOptions) XXX_Merge(src proto.Message) { + xxx_messageInfo_UpstreamConnectionOptions.Merge(dst, src) +} +func (m *UpstreamConnectionOptions) XXX_Size() int { + return m.Size() +} +func (m *UpstreamConnectionOptions) XXX_DiscardUnknown() { + xxx_messageInfo_UpstreamConnectionOptions.DiscardUnknown(m) +} + +var xxx_messageInfo_UpstreamConnectionOptions proto.InternalMessageInfo + +func (m *UpstreamConnectionOptions) GetTcpKeepalive() *core.TcpKeepalive { + if m != nil { + return m.TcpKeepalive + } + return nil +} + +func init() { + proto.RegisterType((*Cluster)(nil), "envoy.api.v2.Cluster") + proto.RegisterMapType((map[string]*types.Struct)(nil), "envoy.api.v2.Cluster.ExtensionProtocolOptionsEntry") + proto.RegisterType((*Cluster_EdsClusterConfig)(nil), "envoy.api.v2.Cluster.EdsClusterConfig") + proto.RegisterType((*Cluster_LbSubsetConfig)(nil), "envoy.api.v2.Cluster.LbSubsetConfig") + proto.RegisterType((*Cluster_LbSubsetConfig_LbSubsetSelector)(nil), "envoy.api.v2.Cluster.LbSubsetConfig.LbSubsetSelector") + proto.RegisterType((*Cluster_RingHashLbConfig)(nil), "envoy.api.v2.Cluster.RingHashLbConfig") + proto.RegisterType((*Cluster_RingHashLbConfig_DeprecatedV1)(nil), "envoy.api.v2.Cluster.RingHashLbConfig.DeprecatedV1") + proto.RegisterType((*Cluster_OriginalDstLbConfig)(nil), "envoy.api.v2.Cluster.OriginalDstLbConfig") + proto.RegisterType((*Cluster_CommonLbConfig)(nil), "envoy.api.v2.Cluster.CommonLbConfig") + proto.RegisterType((*Cluster_CommonLbConfig_ZoneAwareLbConfig)(nil), "envoy.api.v2.Cluster.CommonLbConfig.ZoneAwareLbConfig") + proto.RegisterType((*Cluster_CommonLbConfig_LocalityWeightedLbConfig)(nil), "envoy.api.v2.Cluster.CommonLbConfig.LocalityWeightedLbConfig") + proto.RegisterType((*UpstreamBindConfig)(nil), "envoy.api.v2.UpstreamBindConfig") + proto.RegisterType((*UpstreamConnectionOptions)(nil), "envoy.api.v2.UpstreamConnectionOptions") + proto.RegisterEnum("envoy.api.v2.Cluster_DiscoveryType", Cluster_DiscoveryType_name, Cluster_DiscoveryType_value) + proto.RegisterEnum("envoy.api.v2.Cluster_LbPolicy", Cluster_LbPolicy_name, Cluster_LbPolicy_value) + proto.RegisterEnum("envoy.api.v2.Cluster_DnsLookupFamily", Cluster_DnsLookupFamily_name, Cluster_DnsLookupFamily_value) + proto.RegisterEnum("envoy.api.v2.Cluster_ClusterProtocolSelection", Cluster_ClusterProtocolSelection_name, Cluster_ClusterProtocolSelection_value) + proto.RegisterEnum("envoy.api.v2.Cluster_LbSubsetConfig_LbSubsetFallbackPolicy", Cluster_LbSubsetConfig_LbSubsetFallbackPolicy_name, Cluster_LbSubsetConfig_LbSubsetFallbackPolicy_value) +} +func (this *Cluster) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Cluster) + if !ok { + that2, ok := that.(Cluster) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Name != that1.Name { + return false + } + if this.AltStatName != that1.AltStatName { + return false + } + if this.Type != that1.Type { + return false + } + if !this.EdsClusterConfig.Equal(that1.EdsClusterConfig) { + return false + } + if this.ConnectTimeout != that1.ConnectTimeout { + return false + } + if !this.PerConnectionBufferLimitBytes.Equal(that1.PerConnectionBufferLimitBytes) { + return false + } + if this.LbPolicy != that1.LbPolicy { + return false + } + if len(this.Hosts) != len(that1.Hosts) { + return false + } + for i := range this.Hosts { + if !this.Hosts[i].Equal(that1.Hosts[i]) { + return false + } + } + if !this.LoadAssignment.Equal(that1.LoadAssignment) { + return false + } + if len(this.HealthChecks) != len(that1.HealthChecks) { + return false + } + for i := range this.HealthChecks { + if !this.HealthChecks[i].Equal(that1.HealthChecks[i]) { + return false + } + } + if !this.MaxRequestsPerConnection.Equal(that1.MaxRequestsPerConnection) { + return false + } + if !this.CircuitBreakers.Equal(that1.CircuitBreakers) { + return false + } + if !this.TlsContext.Equal(that1.TlsContext) { + return false + } + if !this.CommonHttpProtocolOptions.Equal(that1.CommonHttpProtocolOptions) { + return false + } + if !this.HttpProtocolOptions.Equal(that1.HttpProtocolOptions) { + return false + } + if !this.Http2ProtocolOptions.Equal(that1.Http2ProtocolOptions) { + return false + } + if len(this.ExtensionProtocolOptions) != len(that1.ExtensionProtocolOptions) { + return false + } + for i := range this.ExtensionProtocolOptions { + if !this.ExtensionProtocolOptions[i].Equal(that1.ExtensionProtocolOptions[i]) { + return false + } + } + if this.DnsRefreshRate != nil && that1.DnsRefreshRate != nil { + if *this.DnsRefreshRate != *that1.DnsRefreshRate { + return false + } + } else if this.DnsRefreshRate != nil { + return false + } else if that1.DnsRefreshRate != nil { + return false + } + if this.DnsLookupFamily != that1.DnsLookupFamily { + return false + } + if len(this.DnsResolvers) != len(that1.DnsResolvers) { + return false + } + for i := range this.DnsResolvers { + if !this.DnsResolvers[i].Equal(that1.DnsResolvers[i]) { + return false + } + } + if !this.OutlierDetection.Equal(that1.OutlierDetection) { + return false + } + if this.CleanupInterval != nil && that1.CleanupInterval != nil { + if *this.CleanupInterval != *that1.CleanupInterval { + return false + } + } else if this.CleanupInterval != nil { + return false + } else if that1.CleanupInterval != nil { + return false + } + if !this.UpstreamBindConfig.Equal(that1.UpstreamBindConfig) { + return false + } + if !this.LbSubsetConfig.Equal(that1.LbSubsetConfig) { + return false + } + if that1.LbConfig == nil { + if this.LbConfig != nil { + return false + } + } else if this.LbConfig == nil { + return false + } else if !this.LbConfig.Equal(that1.LbConfig) { + return false + } + if !this.CommonLbConfig.Equal(that1.CommonLbConfig) { + return false + } + if !this.TransportSocket.Equal(that1.TransportSocket) { + return false + } + if !this.Metadata.Equal(that1.Metadata) { + return false + } + if this.ProtocolSelection != that1.ProtocolSelection { + return false + } + if !this.UpstreamConnectionOptions.Equal(that1.UpstreamConnectionOptions) { + return false + } + if this.CloseConnectionsOnHostHealthFailure != that1.CloseConnectionsOnHostHealthFailure { + return false + } + if this.DrainConnectionsOnHostRemoval != that1.DrainConnectionsOnHostRemoval { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *Cluster_RingHashLbConfig_) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Cluster_RingHashLbConfig_) + if !ok { + that2, ok := that.(Cluster_RingHashLbConfig_) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.RingHashLbConfig.Equal(that1.RingHashLbConfig) { + return false + } + return true +} +func (this *Cluster_OriginalDstLbConfig_) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Cluster_OriginalDstLbConfig_) + if !ok { + that2, ok := that.(Cluster_OriginalDstLbConfig_) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.OriginalDstLbConfig.Equal(that1.OriginalDstLbConfig) { + return false + } + return true +} +func (this *Cluster_EdsClusterConfig) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Cluster_EdsClusterConfig) + if !ok { + that2, ok := that.(Cluster_EdsClusterConfig) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.EdsConfig.Equal(that1.EdsConfig) { + return false + } + if this.ServiceName != that1.ServiceName { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *Cluster_LbSubsetConfig) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Cluster_LbSubsetConfig) + if !ok { + that2, ok := that.(Cluster_LbSubsetConfig) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.FallbackPolicy != that1.FallbackPolicy { + return false + } + if !this.DefaultSubset.Equal(that1.DefaultSubset) { + return false + } + if len(this.SubsetSelectors) != len(that1.SubsetSelectors) { + return false + } + for i := range this.SubsetSelectors { + if !this.SubsetSelectors[i].Equal(that1.SubsetSelectors[i]) { + return false + } + } + if this.LocalityWeightAware != that1.LocalityWeightAware { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *Cluster_LbSubsetConfig_LbSubsetSelector) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Cluster_LbSubsetConfig_LbSubsetSelector) + if !ok { + that2, ok := that.(Cluster_LbSubsetConfig_LbSubsetSelector) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if len(this.Keys) != len(that1.Keys) { + return false + } + for i := range this.Keys { + if this.Keys[i] != that1.Keys[i] { + return false + } + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *Cluster_RingHashLbConfig) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Cluster_RingHashLbConfig) + if !ok { + that2, ok := that.(Cluster_RingHashLbConfig) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.MinimumRingSize.Equal(that1.MinimumRingSize) { + return false + } + if !this.DeprecatedV1.Equal(that1.DeprecatedV1) { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *Cluster_RingHashLbConfig_DeprecatedV1) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Cluster_RingHashLbConfig_DeprecatedV1) + if !ok { + that2, ok := that.(Cluster_RingHashLbConfig_DeprecatedV1) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.UseStdHash.Equal(that1.UseStdHash) { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *Cluster_OriginalDstLbConfig) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Cluster_OriginalDstLbConfig) + if !ok { + that2, ok := that.(Cluster_OriginalDstLbConfig) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.UseHttpHeader != that1.UseHttpHeader { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *Cluster_CommonLbConfig) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Cluster_CommonLbConfig) + if !ok { + that2, ok := that.(Cluster_CommonLbConfig) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.HealthyPanicThreshold.Equal(that1.HealthyPanicThreshold) { + return false + } + if that1.LocalityConfigSpecifier == nil { + if this.LocalityConfigSpecifier != nil { + return false + } + } else if this.LocalityConfigSpecifier == nil { + return false + } else if !this.LocalityConfigSpecifier.Equal(that1.LocalityConfigSpecifier) { + return false + } + if !this.UpdateMergeWindow.Equal(that1.UpdateMergeWindow) { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *Cluster_CommonLbConfig_ZoneAwareLbConfig_) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Cluster_CommonLbConfig_ZoneAwareLbConfig_) + if !ok { + that2, ok := that.(Cluster_CommonLbConfig_ZoneAwareLbConfig_) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.ZoneAwareLbConfig.Equal(that1.ZoneAwareLbConfig) { + return false + } + return true +} +func (this *Cluster_CommonLbConfig_LocalityWeightedLbConfig_) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Cluster_CommonLbConfig_LocalityWeightedLbConfig_) + if !ok { + that2, ok := that.(Cluster_CommonLbConfig_LocalityWeightedLbConfig_) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.LocalityWeightedLbConfig.Equal(that1.LocalityWeightedLbConfig) { + return false + } + return true +} +func (this *Cluster_CommonLbConfig_ZoneAwareLbConfig) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Cluster_CommonLbConfig_ZoneAwareLbConfig) + if !ok { + that2, ok := that.(Cluster_CommonLbConfig_ZoneAwareLbConfig) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.RoutingEnabled.Equal(that1.RoutingEnabled) { + return false + } + if !this.MinClusterSize.Equal(that1.MinClusterSize) { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *Cluster_CommonLbConfig_LocalityWeightedLbConfig) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Cluster_CommonLbConfig_LocalityWeightedLbConfig) + if !ok { + that2, ok := that.(Cluster_CommonLbConfig_LocalityWeightedLbConfig) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *UpstreamBindConfig) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*UpstreamBindConfig) + if !ok { + that2, ok := that.(UpstreamBindConfig) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.SourceAddress.Equal(that1.SourceAddress) { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *UpstreamConnectionOptions) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*UpstreamConnectionOptions) + if !ok { + that2, ok := that.(UpstreamConnectionOptions) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.TcpKeepalive.Equal(that1.TcpKeepalive) { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// Client API for ClusterDiscoveryService service + +type ClusterDiscoveryServiceClient interface { + StreamClusters(ctx context.Context, opts ...grpc.CallOption) (ClusterDiscoveryService_StreamClustersClient, error) + IncrementalClusters(ctx context.Context, opts ...grpc.CallOption) (ClusterDiscoveryService_IncrementalClustersClient, error) + FetchClusters(ctx context.Context, in *DiscoveryRequest, opts ...grpc.CallOption) (*DiscoveryResponse, error) +} + +type clusterDiscoveryServiceClient struct { + cc *grpc.ClientConn +} + +func NewClusterDiscoveryServiceClient(cc *grpc.ClientConn) ClusterDiscoveryServiceClient { + return &clusterDiscoveryServiceClient{cc} +} + +func (c *clusterDiscoveryServiceClient) StreamClusters(ctx context.Context, opts ...grpc.CallOption) (ClusterDiscoveryService_StreamClustersClient, error) { + stream, err := c.cc.NewStream(ctx, &_ClusterDiscoveryService_serviceDesc.Streams[0], "/envoy.api.v2.ClusterDiscoveryService/StreamClusters", opts...) + if err != nil { + return nil, err + } + x := &clusterDiscoveryServiceStreamClustersClient{stream} + return x, nil +} + +type ClusterDiscoveryService_StreamClustersClient interface { + Send(*DiscoveryRequest) error + Recv() (*DiscoveryResponse, error) + grpc.ClientStream +} + +type clusterDiscoveryServiceStreamClustersClient struct { + grpc.ClientStream +} + +func (x *clusterDiscoveryServiceStreamClustersClient) Send(m *DiscoveryRequest) error { + return x.ClientStream.SendMsg(m) +} + +func (x *clusterDiscoveryServiceStreamClustersClient) Recv() (*DiscoveryResponse, error) { + m := new(DiscoveryResponse) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *clusterDiscoveryServiceClient) IncrementalClusters(ctx context.Context, opts ...grpc.CallOption) (ClusterDiscoveryService_IncrementalClustersClient, error) { + stream, err := c.cc.NewStream(ctx, &_ClusterDiscoveryService_serviceDesc.Streams[1], "/envoy.api.v2.ClusterDiscoveryService/IncrementalClusters", opts...) + if err != nil { + return nil, err + } + x := &clusterDiscoveryServiceIncrementalClustersClient{stream} + return x, nil +} + +type ClusterDiscoveryService_IncrementalClustersClient interface { + Send(*IncrementalDiscoveryRequest) error + Recv() (*IncrementalDiscoveryResponse, error) + grpc.ClientStream +} + +type clusterDiscoveryServiceIncrementalClustersClient struct { + grpc.ClientStream +} + +func (x *clusterDiscoveryServiceIncrementalClustersClient) Send(m *IncrementalDiscoveryRequest) error { + return x.ClientStream.SendMsg(m) +} + +func (x *clusterDiscoveryServiceIncrementalClustersClient) Recv() (*IncrementalDiscoveryResponse, error) { + m := new(IncrementalDiscoveryResponse) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *clusterDiscoveryServiceClient) FetchClusters(ctx context.Context, in *DiscoveryRequest, opts ...grpc.CallOption) (*DiscoveryResponse, error) { + out := new(DiscoveryResponse) + err := c.cc.Invoke(ctx, "/envoy.api.v2.ClusterDiscoveryService/FetchClusters", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// Server API for ClusterDiscoveryService service + +type ClusterDiscoveryServiceServer interface { + StreamClusters(ClusterDiscoveryService_StreamClustersServer) error + IncrementalClusters(ClusterDiscoveryService_IncrementalClustersServer) error + FetchClusters(context.Context, *DiscoveryRequest) (*DiscoveryResponse, error) +} + +func RegisterClusterDiscoveryServiceServer(s *grpc.Server, srv ClusterDiscoveryServiceServer) { + s.RegisterService(&_ClusterDiscoveryService_serviceDesc, srv) +} + +func _ClusterDiscoveryService_StreamClusters_Handler(srv interface{}, stream grpc.ServerStream) error { + return srv.(ClusterDiscoveryServiceServer).StreamClusters(&clusterDiscoveryServiceStreamClustersServer{stream}) +} + +type ClusterDiscoveryService_StreamClustersServer interface { + Send(*DiscoveryResponse) error + Recv() (*DiscoveryRequest, error) + grpc.ServerStream +} + +type clusterDiscoveryServiceStreamClustersServer struct { + grpc.ServerStream +} + +func (x *clusterDiscoveryServiceStreamClustersServer) Send(m *DiscoveryResponse) error { + return x.ServerStream.SendMsg(m) +} + +func (x *clusterDiscoveryServiceStreamClustersServer) Recv() (*DiscoveryRequest, error) { + m := new(DiscoveryRequest) + if err := x.ServerStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func _ClusterDiscoveryService_IncrementalClusters_Handler(srv interface{}, stream grpc.ServerStream) error { + return srv.(ClusterDiscoveryServiceServer).IncrementalClusters(&clusterDiscoveryServiceIncrementalClustersServer{stream}) +} + +type ClusterDiscoveryService_IncrementalClustersServer interface { + Send(*IncrementalDiscoveryResponse) error + Recv() (*IncrementalDiscoveryRequest, error) + grpc.ServerStream +} + +type clusterDiscoveryServiceIncrementalClustersServer struct { + grpc.ServerStream +} + +func (x *clusterDiscoveryServiceIncrementalClustersServer) Send(m *IncrementalDiscoveryResponse) error { + return x.ServerStream.SendMsg(m) +} + +func (x *clusterDiscoveryServiceIncrementalClustersServer) Recv() (*IncrementalDiscoveryRequest, error) { + m := new(IncrementalDiscoveryRequest) + if err := x.ServerStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func _ClusterDiscoveryService_FetchClusters_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DiscoveryRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ClusterDiscoveryServiceServer).FetchClusters(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/envoy.api.v2.ClusterDiscoveryService/FetchClusters", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ClusterDiscoveryServiceServer).FetchClusters(ctx, req.(*DiscoveryRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _ClusterDiscoveryService_serviceDesc = grpc.ServiceDesc{ + ServiceName: "envoy.api.v2.ClusterDiscoveryService", + HandlerType: (*ClusterDiscoveryServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "FetchClusters", + Handler: _ClusterDiscoveryService_FetchClusters_Handler, + }, + }, + Streams: []grpc.StreamDesc{ + { + StreamName: "StreamClusters", + Handler: _ClusterDiscoveryService_StreamClusters_Handler, + ServerStreams: true, + ClientStreams: true, + }, + { + StreamName: "IncrementalClusters", + Handler: _ClusterDiscoveryService_IncrementalClusters_Handler, + ServerStreams: true, + ClientStreams: true, + }, + }, + Metadata: "envoy/api/v2/cds.proto", +} + +func (m *Cluster) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Cluster) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Name) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintCds(dAtA, i, uint64(len(m.Name))) + i += copy(dAtA[i:], m.Name) + } + if m.Type != 0 { + dAtA[i] = 0x10 + i++ + i = encodeVarintCds(dAtA, i, uint64(m.Type)) + } + if m.EdsClusterConfig != nil { + dAtA[i] = 0x1a + i++ + i = encodeVarintCds(dAtA, i, uint64(m.EdsClusterConfig.Size())) + n1, err := m.EdsClusterConfig.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n1 + } + dAtA[i] = 0x22 + i++ + i = encodeVarintCds(dAtA, i, uint64(github_com_gogo_protobuf_types.SizeOfStdDuration(m.ConnectTimeout))) + n2, err := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.ConnectTimeout, dAtA[i:]) + if err != nil { + return 0, err + } + i += n2 + if m.PerConnectionBufferLimitBytes != nil { + dAtA[i] = 0x2a + i++ + i = encodeVarintCds(dAtA, i, uint64(m.PerConnectionBufferLimitBytes.Size())) + n3, err := m.PerConnectionBufferLimitBytes.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n3 + } + if m.LbPolicy != 0 { + dAtA[i] = 0x30 + i++ + i = encodeVarintCds(dAtA, i, uint64(m.LbPolicy)) + } + if len(m.Hosts) > 0 { + for _, msg := range m.Hosts { + dAtA[i] = 0x3a + i++ + i = encodeVarintCds(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if len(m.HealthChecks) > 0 { + for _, msg := range m.HealthChecks { + dAtA[i] = 0x42 + i++ + i = encodeVarintCds(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if m.MaxRequestsPerConnection != nil { + dAtA[i] = 0x4a + i++ + i = encodeVarintCds(dAtA, i, uint64(m.MaxRequestsPerConnection.Size())) + n4, err := m.MaxRequestsPerConnection.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n4 + } + if m.CircuitBreakers != nil { + dAtA[i] = 0x52 + i++ + i = encodeVarintCds(dAtA, i, uint64(m.CircuitBreakers.Size())) + n5, err := m.CircuitBreakers.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n5 + } + if m.TlsContext != nil { + dAtA[i] = 0x5a + i++ + i = encodeVarintCds(dAtA, i, uint64(m.TlsContext.Size())) + n6, err := m.TlsContext.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n6 + } + if m.HttpProtocolOptions != nil { + dAtA[i] = 0x6a + i++ + i = encodeVarintCds(dAtA, i, uint64(m.HttpProtocolOptions.Size())) + n7, err := m.HttpProtocolOptions.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n7 + } + if m.Http2ProtocolOptions != nil { + dAtA[i] = 0x72 + i++ + i = encodeVarintCds(dAtA, i, uint64(m.Http2ProtocolOptions.Size())) + n8, err := m.Http2ProtocolOptions.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n8 + } + if m.DnsRefreshRate != nil { + dAtA[i] = 0x82 + i++ + dAtA[i] = 0x1 + i++ + i = encodeVarintCds(dAtA, i, uint64(github_com_gogo_protobuf_types.SizeOfStdDuration(*m.DnsRefreshRate))) + n9, err := github_com_gogo_protobuf_types.StdDurationMarshalTo(*m.DnsRefreshRate, dAtA[i:]) + if err != nil { + return 0, err + } + i += n9 + } + if m.DnsLookupFamily != 0 { + dAtA[i] = 0x88 + i++ + dAtA[i] = 0x1 + i++ + i = encodeVarintCds(dAtA, i, uint64(m.DnsLookupFamily)) + } + if len(m.DnsResolvers) > 0 { + for _, msg := range m.DnsResolvers { + dAtA[i] = 0x92 + i++ + dAtA[i] = 0x1 + i++ + i = encodeVarintCds(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if m.OutlierDetection != nil { + dAtA[i] = 0x9a + i++ + dAtA[i] = 0x1 + i++ + i = encodeVarintCds(dAtA, i, uint64(m.OutlierDetection.Size())) + n10, err := m.OutlierDetection.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n10 + } + if m.CleanupInterval != nil { + dAtA[i] = 0xa2 + i++ + dAtA[i] = 0x1 + i++ + i = encodeVarintCds(dAtA, i, uint64(github_com_gogo_protobuf_types.SizeOfStdDuration(*m.CleanupInterval))) + n11, err := github_com_gogo_protobuf_types.StdDurationMarshalTo(*m.CleanupInterval, dAtA[i:]) + if err != nil { + return 0, err + } + i += n11 + } + if m.UpstreamBindConfig != nil { + dAtA[i] = 0xaa + i++ + dAtA[i] = 0x1 + i++ + i = encodeVarintCds(dAtA, i, uint64(m.UpstreamBindConfig.Size())) + n12, err := m.UpstreamBindConfig.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n12 + } + if m.LbSubsetConfig != nil { + dAtA[i] = 0xb2 + i++ + dAtA[i] = 0x1 + i++ + i = encodeVarintCds(dAtA, i, uint64(m.LbSubsetConfig.Size())) + n13, err := m.LbSubsetConfig.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n13 + } + if m.LbConfig != nil { + nn14, err := m.LbConfig.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += nn14 + } + if m.TransportSocket != nil { + dAtA[i] = 0xc2 + i++ + dAtA[i] = 0x1 + i++ + i = encodeVarintCds(dAtA, i, uint64(m.TransportSocket.Size())) + n15, err := m.TransportSocket.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n15 + } + if m.Metadata != nil { + dAtA[i] = 0xca + i++ + dAtA[i] = 0x1 + i++ + i = encodeVarintCds(dAtA, i, uint64(m.Metadata.Size())) + n16, err := m.Metadata.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n16 + } + if m.ProtocolSelection != 0 { + dAtA[i] = 0xd0 + i++ + dAtA[i] = 0x1 + i++ + i = encodeVarintCds(dAtA, i, uint64(m.ProtocolSelection)) + } + if m.CommonLbConfig != nil { + dAtA[i] = 0xda + i++ + dAtA[i] = 0x1 + i++ + i = encodeVarintCds(dAtA, i, uint64(m.CommonLbConfig.Size())) + n17, err := m.CommonLbConfig.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n17 + } + if len(m.AltStatName) > 0 { + dAtA[i] = 0xe2 + i++ + dAtA[i] = 0x1 + i++ + i = encodeVarintCds(dAtA, i, uint64(len(m.AltStatName))) + i += copy(dAtA[i:], m.AltStatName) + } + if m.CommonHttpProtocolOptions != nil { + dAtA[i] = 0xea + i++ + dAtA[i] = 0x1 + i++ + i = encodeVarintCds(dAtA, i, uint64(m.CommonHttpProtocolOptions.Size())) + n18, err := m.CommonHttpProtocolOptions.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n18 + } + if m.UpstreamConnectionOptions != nil { + dAtA[i] = 0xf2 + i++ + dAtA[i] = 0x1 + i++ + i = encodeVarintCds(dAtA, i, uint64(m.UpstreamConnectionOptions.Size())) + n19, err := m.UpstreamConnectionOptions.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n19 + } + if m.CloseConnectionsOnHostHealthFailure { + dAtA[i] = 0xf8 + i++ + dAtA[i] = 0x1 + i++ + if m.CloseConnectionsOnHostHealthFailure { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i++ + } + if m.DrainConnectionsOnHostRemoval { + dAtA[i] = 0x80 + i++ + dAtA[i] = 0x2 + i++ + if m.DrainConnectionsOnHostRemoval { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i++ + } + if m.LoadAssignment != nil { + dAtA[i] = 0x8a + i++ + dAtA[i] = 0x2 + i++ + i = encodeVarintCds(dAtA, i, uint64(m.LoadAssignment.Size())) + n20, err := m.LoadAssignment.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n20 + } + if len(m.ExtensionProtocolOptions) > 0 { + for k, _ := range m.ExtensionProtocolOptions { + dAtA[i] = 0x9a + i++ + dAtA[i] = 0x2 + i++ + v := m.ExtensionProtocolOptions[k] + msgSize := 0 + if v != nil { + msgSize = v.Size() + msgSize += 1 + sovCds(uint64(msgSize)) + } + mapSize := 1 + len(k) + sovCds(uint64(len(k))) + msgSize + i = encodeVarintCds(dAtA, i, uint64(mapSize)) + dAtA[i] = 0xa + i++ + i = encodeVarintCds(dAtA, i, uint64(len(k))) + i += copy(dAtA[i:], k) + if v != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintCds(dAtA, i, uint64(v.Size())) + n21, err := v.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n21 + } + } + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *Cluster_RingHashLbConfig_) MarshalTo(dAtA []byte) (int, error) { + i := 0 + if m.RingHashLbConfig != nil { + dAtA[i] = 0xba + i++ + dAtA[i] = 0x1 + i++ + i = encodeVarintCds(dAtA, i, uint64(m.RingHashLbConfig.Size())) + n22, err := m.RingHashLbConfig.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n22 + } + return i, nil +} +func (m *Cluster_OriginalDstLbConfig_) MarshalTo(dAtA []byte) (int, error) { + i := 0 + if m.OriginalDstLbConfig != nil { + dAtA[i] = 0x92 + i++ + dAtA[i] = 0x2 + i++ + i = encodeVarintCds(dAtA, i, uint64(m.OriginalDstLbConfig.Size())) + n23, err := m.OriginalDstLbConfig.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n23 + } + return i, nil +} +func (m *Cluster_EdsClusterConfig) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Cluster_EdsClusterConfig) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.EdsConfig != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintCds(dAtA, i, uint64(m.EdsConfig.Size())) + n24, err := m.EdsConfig.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n24 + } + if len(m.ServiceName) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintCds(dAtA, i, uint64(len(m.ServiceName))) + i += copy(dAtA[i:], m.ServiceName) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *Cluster_LbSubsetConfig) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Cluster_LbSubsetConfig) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.FallbackPolicy != 0 { + dAtA[i] = 0x8 + i++ + i = encodeVarintCds(dAtA, i, uint64(m.FallbackPolicy)) + } + if m.DefaultSubset != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintCds(dAtA, i, uint64(m.DefaultSubset.Size())) + n25, err := m.DefaultSubset.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n25 + } + if len(m.SubsetSelectors) > 0 { + for _, msg := range m.SubsetSelectors { + dAtA[i] = 0x1a + i++ + i = encodeVarintCds(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if m.LocalityWeightAware { + dAtA[i] = 0x20 + i++ + if m.LocalityWeightAware { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i++ + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *Cluster_LbSubsetConfig_LbSubsetSelector) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Cluster_LbSubsetConfig_LbSubsetSelector) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Keys) > 0 { + for _, s := range m.Keys { + dAtA[i] = 0xa + i++ + l = len(s) + for l >= 1<<7 { + dAtA[i] = uint8(uint64(l)&0x7f | 0x80) + l >>= 7 + i++ + } + dAtA[i] = uint8(l) + i++ + i += copy(dAtA[i:], s) + } + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *Cluster_RingHashLbConfig) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Cluster_RingHashLbConfig) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.MinimumRingSize != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintCds(dAtA, i, uint64(m.MinimumRingSize.Size())) + n26, err := m.MinimumRingSize.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n26 + } + if m.DeprecatedV1 != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintCds(dAtA, i, uint64(m.DeprecatedV1.Size())) + n27, err := m.DeprecatedV1.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n27 + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *Cluster_RingHashLbConfig_DeprecatedV1) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Cluster_RingHashLbConfig_DeprecatedV1) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.UseStdHash != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintCds(dAtA, i, uint64(m.UseStdHash.Size())) + n28, err := m.UseStdHash.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n28 + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *Cluster_OriginalDstLbConfig) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Cluster_OriginalDstLbConfig) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.UseHttpHeader { + dAtA[i] = 0x8 + i++ + if m.UseHttpHeader { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i++ + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *Cluster_CommonLbConfig) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Cluster_CommonLbConfig) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.HealthyPanicThreshold != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintCds(dAtA, i, uint64(m.HealthyPanicThreshold.Size())) + n29, err := m.HealthyPanicThreshold.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n29 + } + if m.LocalityConfigSpecifier != nil { + nn30, err := m.LocalityConfigSpecifier.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += nn30 + } + if m.UpdateMergeWindow != nil { + dAtA[i] = 0x22 + i++ + i = encodeVarintCds(dAtA, i, uint64(m.UpdateMergeWindow.Size())) + n31, err := m.UpdateMergeWindow.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n31 + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *Cluster_CommonLbConfig_ZoneAwareLbConfig_) MarshalTo(dAtA []byte) (int, error) { + i := 0 + if m.ZoneAwareLbConfig != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintCds(dAtA, i, uint64(m.ZoneAwareLbConfig.Size())) + n32, err := m.ZoneAwareLbConfig.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n32 + } + return i, nil +} +func (m *Cluster_CommonLbConfig_LocalityWeightedLbConfig_) MarshalTo(dAtA []byte) (int, error) { + i := 0 + if m.LocalityWeightedLbConfig != nil { + dAtA[i] = 0x1a + i++ + i = encodeVarintCds(dAtA, i, uint64(m.LocalityWeightedLbConfig.Size())) + n33, err := m.LocalityWeightedLbConfig.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n33 + } + return i, nil +} +func (m *Cluster_CommonLbConfig_ZoneAwareLbConfig) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Cluster_CommonLbConfig_ZoneAwareLbConfig) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.RoutingEnabled != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintCds(dAtA, i, uint64(m.RoutingEnabled.Size())) + n34, err := m.RoutingEnabled.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n34 + } + if m.MinClusterSize != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintCds(dAtA, i, uint64(m.MinClusterSize.Size())) + n35, err := m.MinClusterSize.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n35 + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *Cluster_CommonLbConfig_LocalityWeightedLbConfig) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Cluster_CommonLbConfig_LocalityWeightedLbConfig) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *UpstreamBindConfig) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *UpstreamBindConfig) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.SourceAddress != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintCds(dAtA, i, uint64(m.SourceAddress.Size())) + n36, err := m.SourceAddress.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n36 + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *UpstreamConnectionOptions) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *UpstreamConnectionOptions) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.TcpKeepalive != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintCds(dAtA, i, uint64(m.TcpKeepalive.Size())) + n37, err := m.TcpKeepalive.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n37 + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func encodeVarintCds(dAtA []byte, offset int, v uint64) int { + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return offset + 1 +} +func (m *Cluster) Size() (n int) { + var l int + _ = l + l = len(m.Name) + if l > 0 { + n += 1 + l + sovCds(uint64(l)) + } + if m.Type != 0 { + n += 1 + sovCds(uint64(m.Type)) + } + if m.EdsClusterConfig != nil { + l = m.EdsClusterConfig.Size() + n += 1 + l + sovCds(uint64(l)) + } + l = github_com_gogo_protobuf_types.SizeOfStdDuration(m.ConnectTimeout) + n += 1 + l + sovCds(uint64(l)) + if m.PerConnectionBufferLimitBytes != nil { + l = m.PerConnectionBufferLimitBytes.Size() + n += 1 + l + sovCds(uint64(l)) + } + if m.LbPolicy != 0 { + n += 1 + sovCds(uint64(m.LbPolicy)) + } + if len(m.Hosts) > 0 { + for _, e := range m.Hosts { + l = e.Size() + n += 1 + l + sovCds(uint64(l)) + } + } + if len(m.HealthChecks) > 0 { + for _, e := range m.HealthChecks { + l = e.Size() + n += 1 + l + sovCds(uint64(l)) + } + } + if m.MaxRequestsPerConnection != nil { + l = m.MaxRequestsPerConnection.Size() + n += 1 + l + sovCds(uint64(l)) + } + if m.CircuitBreakers != nil { + l = m.CircuitBreakers.Size() + n += 1 + l + sovCds(uint64(l)) + } + if m.TlsContext != nil { + l = m.TlsContext.Size() + n += 1 + l + sovCds(uint64(l)) + } + if m.HttpProtocolOptions != nil { + l = m.HttpProtocolOptions.Size() + n += 1 + l + sovCds(uint64(l)) + } + if m.Http2ProtocolOptions != nil { + l = m.Http2ProtocolOptions.Size() + n += 1 + l + sovCds(uint64(l)) + } + if m.DnsRefreshRate != nil { + l = github_com_gogo_protobuf_types.SizeOfStdDuration(*m.DnsRefreshRate) + n += 2 + l + sovCds(uint64(l)) + } + if m.DnsLookupFamily != 0 { + n += 2 + sovCds(uint64(m.DnsLookupFamily)) + } + if len(m.DnsResolvers) > 0 { + for _, e := range m.DnsResolvers { + l = e.Size() + n += 2 + l + sovCds(uint64(l)) + } + } + if m.OutlierDetection != nil { + l = m.OutlierDetection.Size() + n += 2 + l + sovCds(uint64(l)) + } + if m.CleanupInterval != nil { + l = github_com_gogo_protobuf_types.SizeOfStdDuration(*m.CleanupInterval) + n += 2 + l + sovCds(uint64(l)) + } + if m.UpstreamBindConfig != nil { + l = m.UpstreamBindConfig.Size() + n += 2 + l + sovCds(uint64(l)) + } + if m.LbSubsetConfig != nil { + l = m.LbSubsetConfig.Size() + n += 2 + l + sovCds(uint64(l)) + } + if m.LbConfig != nil { + n += m.LbConfig.Size() + } + if m.TransportSocket != nil { + l = m.TransportSocket.Size() + n += 2 + l + sovCds(uint64(l)) + } + if m.Metadata != nil { + l = m.Metadata.Size() + n += 2 + l + sovCds(uint64(l)) + } + if m.ProtocolSelection != 0 { + n += 2 + sovCds(uint64(m.ProtocolSelection)) + } + if m.CommonLbConfig != nil { + l = m.CommonLbConfig.Size() + n += 2 + l + sovCds(uint64(l)) + } + l = len(m.AltStatName) + if l > 0 { + n += 2 + l + sovCds(uint64(l)) + } + if m.CommonHttpProtocolOptions != nil { + l = m.CommonHttpProtocolOptions.Size() + n += 2 + l + sovCds(uint64(l)) + } + if m.UpstreamConnectionOptions != nil { + l = m.UpstreamConnectionOptions.Size() + n += 2 + l + sovCds(uint64(l)) + } + if m.CloseConnectionsOnHostHealthFailure { + n += 3 + } + if m.DrainConnectionsOnHostRemoval { + n += 3 + } + if m.LoadAssignment != nil { + l = m.LoadAssignment.Size() + n += 2 + l + sovCds(uint64(l)) + } + if len(m.ExtensionProtocolOptions) > 0 { + for k, v := range m.ExtensionProtocolOptions { + _ = k + _ = v + l = 0 + if v != nil { + l = v.Size() + l += 1 + sovCds(uint64(l)) + } + mapEntrySize := 1 + len(k) + sovCds(uint64(len(k))) + l + n += mapEntrySize + 2 + sovCds(uint64(mapEntrySize)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *Cluster_RingHashLbConfig_) Size() (n int) { + var l int + _ = l + if m.RingHashLbConfig != nil { + l = m.RingHashLbConfig.Size() + n += 2 + l + sovCds(uint64(l)) + } + return n +} +func (m *Cluster_OriginalDstLbConfig_) Size() (n int) { + var l int + _ = l + if m.OriginalDstLbConfig != nil { + l = m.OriginalDstLbConfig.Size() + n += 2 + l + sovCds(uint64(l)) + } + return n +} +func (m *Cluster_EdsClusterConfig) Size() (n int) { + var l int + _ = l + if m.EdsConfig != nil { + l = m.EdsConfig.Size() + n += 1 + l + sovCds(uint64(l)) + } + l = len(m.ServiceName) + if l > 0 { + n += 1 + l + sovCds(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *Cluster_LbSubsetConfig) Size() (n int) { + var l int + _ = l + if m.FallbackPolicy != 0 { + n += 1 + sovCds(uint64(m.FallbackPolicy)) + } + if m.DefaultSubset != nil { + l = m.DefaultSubset.Size() + n += 1 + l + sovCds(uint64(l)) + } + if len(m.SubsetSelectors) > 0 { + for _, e := range m.SubsetSelectors { + l = e.Size() + n += 1 + l + sovCds(uint64(l)) + } + } + if m.LocalityWeightAware { + n += 2 + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *Cluster_LbSubsetConfig_LbSubsetSelector) Size() (n int) { + var l int + _ = l + if len(m.Keys) > 0 { + for _, s := range m.Keys { + l = len(s) + n += 1 + l + sovCds(uint64(l)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *Cluster_RingHashLbConfig) Size() (n int) { + var l int + _ = l + if m.MinimumRingSize != nil { + l = m.MinimumRingSize.Size() + n += 1 + l + sovCds(uint64(l)) + } + if m.DeprecatedV1 != nil { + l = m.DeprecatedV1.Size() + n += 1 + l + sovCds(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *Cluster_RingHashLbConfig_DeprecatedV1) Size() (n int) { + var l int + _ = l + if m.UseStdHash != nil { + l = m.UseStdHash.Size() + n += 1 + l + sovCds(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *Cluster_OriginalDstLbConfig) Size() (n int) { + var l int + _ = l + if m.UseHttpHeader { + n += 2 + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *Cluster_CommonLbConfig) Size() (n int) { + var l int + _ = l + if m.HealthyPanicThreshold != nil { + l = m.HealthyPanicThreshold.Size() + n += 1 + l + sovCds(uint64(l)) + } + if m.LocalityConfigSpecifier != nil { + n += m.LocalityConfigSpecifier.Size() + } + if m.UpdateMergeWindow != nil { + l = m.UpdateMergeWindow.Size() + n += 1 + l + sovCds(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *Cluster_CommonLbConfig_ZoneAwareLbConfig_) Size() (n int) { + var l int + _ = l + if m.ZoneAwareLbConfig != nil { + l = m.ZoneAwareLbConfig.Size() + n += 1 + l + sovCds(uint64(l)) + } + return n +} +func (m *Cluster_CommonLbConfig_LocalityWeightedLbConfig_) Size() (n int) { + var l int + _ = l + if m.LocalityWeightedLbConfig != nil { + l = m.LocalityWeightedLbConfig.Size() + n += 1 + l + sovCds(uint64(l)) + } + return n +} +func (m *Cluster_CommonLbConfig_ZoneAwareLbConfig) Size() (n int) { + var l int + _ = l + if m.RoutingEnabled != nil { + l = m.RoutingEnabled.Size() + n += 1 + l + sovCds(uint64(l)) + } + if m.MinClusterSize != nil { + l = m.MinClusterSize.Size() + n += 1 + l + sovCds(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *Cluster_CommonLbConfig_LocalityWeightedLbConfig) Size() (n int) { + var l int + _ = l + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *UpstreamBindConfig) Size() (n int) { + var l int + _ = l + if m.SourceAddress != nil { + l = m.SourceAddress.Size() + n += 1 + l + sovCds(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *UpstreamConnectionOptions) Size() (n int) { + var l int + _ = l + if m.TcpKeepalive != nil { + l = m.TcpKeepalive.Size() + n += 1 + l + sovCds(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func sovCds(x uint64) (n int) { + for { + n++ + x >>= 7 + if x == 0 { + break + } + } + return n +} +func sozCds(x uint64) (n int) { + return sovCds(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Cluster) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Cluster: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Cluster: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthCds + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) + } + m.Type = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Type |= (Cluster_DiscoveryType(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field EdsClusterConfig", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCds + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.EdsClusterConfig == nil { + m.EdsClusterConfig = &Cluster_EdsClusterConfig{} + } + if err := m.EdsClusterConfig.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ConnectTimeout", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCds + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_types.StdDurationUnmarshal(&m.ConnectTimeout, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PerConnectionBufferLimitBytes", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCds + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.PerConnectionBufferLimitBytes == nil { + m.PerConnectionBufferLimitBytes = &types.UInt32Value{} + } + if err := m.PerConnectionBufferLimitBytes.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field LbPolicy", wireType) + } + m.LbPolicy = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.LbPolicy |= (Cluster_LbPolicy(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Hosts", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCds + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Hosts = append(m.Hosts, &core.Address{}) + if err := m.Hosts[len(m.Hosts)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field HealthChecks", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCds + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.HealthChecks = append(m.HealthChecks, &core.HealthCheck{}) + if err := m.HealthChecks[len(m.HealthChecks)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxRequestsPerConnection", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCds + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.MaxRequestsPerConnection == nil { + m.MaxRequestsPerConnection = &types.UInt32Value{} + } + if err := m.MaxRequestsPerConnection.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 10: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CircuitBreakers", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCds + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.CircuitBreakers == nil { + m.CircuitBreakers = &cluster.CircuitBreakers{} + } + if err := m.CircuitBreakers.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 11: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TlsContext", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCds + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.TlsContext == nil { + m.TlsContext = &auth.UpstreamTlsContext{} + } + if err := m.TlsContext.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 13: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field HttpProtocolOptions", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCds + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.HttpProtocolOptions == nil { + m.HttpProtocolOptions = &core.Http1ProtocolOptions{} + } + if err := m.HttpProtocolOptions.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 14: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Http2ProtocolOptions", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCds + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Http2ProtocolOptions == nil { + m.Http2ProtocolOptions = &core.Http2ProtocolOptions{} + } + if err := m.Http2ProtocolOptions.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 16: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DnsRefreshRate", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCds + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.DnsRefreshRate == nil { + m.DnsRefreshRate = new(time.Duration) + } + if err := github_com_gogo_protobuf_types.StdDurationUnmarshal(m.DnsRefreshRate, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 17: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field DnsLookupFamily", wireType) + } + m.DnsLookupFamily = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.DnsLookupFamily |= (Cluster_DnsLookupFamily(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 18: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DnsResolvers", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCds + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DnsResolvers = append(m.DnsResolvers, &core.Address{}) + if err := m.DnsResolvers[len(m.DnsResolvers)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 19: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OutlierDetection", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCds + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.OutlierDetection == nil { + m.OutlierDetection = &cluster.OutlierDetection{} + } + if err := m.OutlierDetection.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 20: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CleanupInterval", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCds + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.CleanupInterval == nil { + m.CleanupInterval = new(time.Duration) + } + if err := github_com_gogo_protobuf_types.StdDurationUnmarshal(m.CleanupInterval, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 21: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field UpstreamBindConfig", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCds + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.UpstreamBindConfig == nil { + m.UpstreamBindConfig = &core.BindConfig{} + } + if err := m.UpstreamBindConfig.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 22: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LbSubsetConfig", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCds + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.LbSubsetConfig == nil { + m.LbSubsetConfig = &Cluster_LbSubsetConfig{} + } + if err := m.LbSubsetConfig.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 23: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RingHashLbConfig", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCds + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &Cluster_RingHashLbConfig{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.LbConfig = &Cluster_RingHashLbConfig_{v} + iNdEx = postIndex + case 24: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TransportSocket", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCds + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.TransportSocket == nil { + m.TransportSocket = &core.TransportSocket{} + } + if err := m.TransportSocket.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 25: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Metadata", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCds + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Metadata == nil { + m.Metadata = &core.Metadata{} + } + if err := m.Metadata.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 26: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ProtocolSelection", wireType) + } + m.ProtocolSelection = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ProtocolSelection |= (Cluster_ClusterProtocolSelection(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 27: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommonLbConfig", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCds + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.CommonLbConfig == nil { + m.CommonLbConfig = &Cluster_CommonLbConfig{} + } + if err := m.CommonLbConfig.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 28: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AltStatName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthCds + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.AltStatName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 29: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommonHttpProtocolOptions", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCds + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.CommonHttpProtocolOptions == nil { + m.CommonHttpProtocolOptions = &core.HttpProtocolOptions{} + } + if err := m.CommonHttpProtocolOptions.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 30: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field UpstreamConnectionOptions", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCds + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.UpstreamConnectionOptions == nil { + m.UpstreamConnectionOptions = &UpstreamConnectionOptions{} + } + if err := m.UpstreamConnectionOptions.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 31: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field CloseConnectionsOnHostHealthFailure", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.CloseConnectionsOnHostHealthFailure = bool(v != 0) + case 32: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field DrainConnectionsOnHostRemoval", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.DrainConnectionsOnHostRemoval = bool(v != 0) + case 33: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LoadAssignment", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCds + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.LoadAssignment == nil { + m.LoadAssignment = &ClusterLoadAssignment{} + } + if err := m.LoadAssignment.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 34: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OriginalDstLbConfig", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCds + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &Cluster_OriginalDstLbConfig{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.LbConfig = &Cluster_OriginalDstLbConfig_{v} + iNdEx = postIndex + case 35: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ExtensionProtocolOptions", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCds + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.ExtensionProtocolOptions == nil { + m.ExtensionProtocolOptions = make(map[string]*types.Struct) + } + var mapkey string + var mapvalue *types.Struct + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + var stringLenmapkey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapkey |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return ErrInvalidLengthCds + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey > l { + return io.ErrUnexpectedEOF + } + mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) + iNdEx = postStringIndexmapkey + } else if fieldNum == 2 { + var mapmsglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + mapmsglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if mapmsglen < 0 { + return ErrInvalidLengthCds + } + postmsgIndex := iNdEx + mapmsglen + if mapmsglen < 0 { + return ErrInvalidLengthCds + } + if postmsgIndex > l { + return io.ErrUnexpectedEOF + } + mapvalue = &types.Struct{} + if err := mapvalue.Unmarshal(dAtA[iNdEx:postmsgIndex]); err != nil { + return err + } + iNdEx = postmsgIndex + } else { + iNdEx = entryPreIndex + skippy, err := skipCds(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthCds + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.ExtensionProtocolOptions[mapkey] = mapvalue + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipCds(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthCds + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Cluster_EdsClusterConfig) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: EdsClusterConfig: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EdsClusterConfig: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field EdsConfig", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCds + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.EdsConfig == nil { + m.EdsConfig = &core.ConfigSource{} + } + if err := m.EdsConfig.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ServiceName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthCds + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ServiceName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipCds(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthCds + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Cluster_LbSubsetConfig) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: LbSubsetConfig: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: LbSubsetConfig: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field FallbackPolicy", wireType) + } + m.FallbackPolicy = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.FallbackPolicy |= (Cluster_LbSubsetConfig_LbSubsetFallbackPolicy(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DefaultSubset", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCds + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.DefaultSubset == nil { + m.DefaultSubset = &types.Struct{} + } + if err := m.DefaultSubset.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SubsetSelectors", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCds + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SubsetSelectors = append(m.SubsetSelectors, &Cluster_LbSubsetConfig_LbSubsetSelector{}) + if err := m.SubsetSelectors[len(m.SubsetSelectors)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field LocalityWeightAware", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.LocalityWeightAware = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skipCds(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthCds + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Cluster_LbSubsetConfig_LbSubsetSelector) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: LbSubsetSelector: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: LbSubsetSelector: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Keys", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthCds + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Keys = append(m.Keys, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipCds(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthCds + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Cluster_RingHashLbConfig) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: RingHashLbConfig: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RingHashLbConfig: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MinimumRingSize", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCds + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.MinimumRingSize == nil { + m.MinimumRingSize = &types.UInt64Value{} + } + if err := m.MinimumRingSize.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DeprecatedV1", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCds + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.DeprecatedV1 == nil { + m.DeprecatedV1 = &Cluster_RingHashLbConfig_DeprecatedV1{} + } + if err := m.DeprecatedV1.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipCds(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthCds + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Cluster_RingHashLbConfig_DeprecatedV1) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DeprecatedV1: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DeprecatedV1: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field UseStdHash", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCds + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.UseStdHash == nil { + m.UseStdHash = &types.BoolValue{} + } + if err := m.UseStdHash.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipCds(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthCds + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Cluster_OriginalDstLbConfig) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: OriginalDstLbConfig: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: OriginalDstLbConfig: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field UseHttpHeader", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.UseHttpHeader = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skipCds(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthCds + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Cluster_CommonLbConfig) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: CommonLbConfig: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CommonLbConfig: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field HealthyPanicThreshold", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCds + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.HealthyPanicThreshold == nil { + m.HealthyPanicThreshold = &_type.Percent{} + } + if err := m.HealthyPanicThreshold.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ZoneAwareLbConfig", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCds + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &Cluster_CommonLbConfig_ZoneAwareLbConfig{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.LocalityConfigSpecifier = &Cluster_CommonLbConfig_ZoneAwareLbConfig_{v} + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LocalityWeightedLbConfig", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCds + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &Cluster_CommonLbConfig_LocalityWeightedLbConfig{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.LocalityConfigSpecifier = &Cluster_CommonLbConfig_LocalityWeightedLbConfig_{v} + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field UpdateMergeWindow", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCds + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.UpdateMergeWindow == nil { + m.UpdateMergeWindow = &types.Duration{} + } + if err := m.UpdateMergeWindow.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipCds(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthCds + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Cluster_CommonLbConfig_ZoneAwareLbConfig) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ZoneAwareLbConfig: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ZoneAwareLbConfig: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RoutingEnabled", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCds + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.RoutingEnabled == nil { + m.RoutingEnabled = &_type.Percent{} + } + if err := m.RoutingEnabled.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MinClusterSize", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCds + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.MinClusterSize == nil { + m.MinClusterSize = &types.UInt64Value{} + } + if err := m.MinClusterSize.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipCds(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthCds + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Cluster_CommonLbConfig_LocalityWeightedLbConfig) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: LocalityWeightedLbConfig: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: LocalityWeightedLbConfig: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipCds(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthCds + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *UpstreamBindConfig) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: UpstreamBindConfig: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: UpstreamBindConfig: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SourceAddress", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCds + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.SourceAddress == nil { + m.SourceAddress = &core.Address{} + } + if err := m.SourceAddress.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipCds(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthCds + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *UpstreamConnectionOptions) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: UpstreamConnectionOptions: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: UpstreamConnectionOptions: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TcpKeepalive", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCds + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.TcpKeepalive == nil { + m.TcpKeepalive = &core.TcpKeepalive{} + } + if err := m.TcpKeepalive.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipCds(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthCds + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipCds(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowCds + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowCds + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + return iNdEx, nil + case 1: + iNdEx += 8 + return iNdEx, nil + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowCds + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + iNdEx += length + if length < 0 { + return 0, ErrInvalidLengthCds + } + return iNdEx, nil + case 3: + for { + var innerWire uint64 + var start int = iNdEx + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowCds + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + innerWire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + innerWireType := int(innerWire & 0x7) + if innerWireType == 4 { + break + } + next, err := skipCds(dAtA[start:]) + if err != nil { + return 0, err + } + iNdEx = start + next + } + return iNdEx, nil + case 4: + return iNdEx, nil + case 5: + iNdEx += 4 + return iNdEx, nil + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + } + panic("unreachable") +} + +var ( + ErrInvalidLengthCds = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowCds = fmt.Errorf("proto: integer overflow") +) + +func init() { proto.RegisterFile("envoy/api/v2/cds.proto", fileDescriptor_cds_c9aad078b729c273) } + +var fileDescriptor_cds_c9aad078b729c273 = []byte{ + // 2344 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x58, 0xcd, 0x6f, 0x1b, 0xc7, + 0x15, 0xd7, 0x52, 0x72, 0x2c, 0x3d, 0x89, 0xe4, 0x6a, 0xe4, 0x8f, 0x35, 0x65, 0xcb, 0x32, 0xf3, + 0x51, 0xd5, 0x68, 0xa9, 0x46, 0x4e, 0xd2, 0x22, 0x4d, 0x52, 0xf0, 0x4b, 0x16, 0x13, 0x9a, 0x54, + 0x77, 0x29, 0x0b, 0x69, 0x1a, 0x4c, 0x86, 0xbb, 0x23, 0x72, 0xab, 0xe5, 0xee, 0x66, 0x67, 0x56, + 0xb6, 0x7c, 0x28, 0x82, 0x9c, 0x7a, 0x2f, 0x50, 0xb4, 0xff, 0x41, 0xd1, 0x3f, 0xa1, 0xa7, 0x1e, + 0x73, 0x6c, 0xd1, 0x63, 0x81, 0xb6, 0x30, 0x72, 0x68, 0xff, 0x8b, 0x62, 0x66, 0x67, 0x69, 0x7e, + 0xac, 0x6c, 0x05, 0xe8, 0x89, 0x9c, 0xf7, 0x7e, 0xef, 0x37, 0x33, 0x6f, 0xdf, 0x7b, 0xf3, 0x66, + 0xe0, 0x06, 0xf5, 0xcf, 0x82, 0xf3, 0x5d, 0x12, 0xba, 0xbb, 0x67, 0x7b, 0xbb, 0xb6, 0xc3, 0x2a, + 0x61, 0x14, 0xf0, 0x00, 0xad, 0x49, 0x79, 0x85, 0x84, 0x6e, 0xe5, 0x6c, 0xaf, 0x74, 0x77, 0x1a, + 0x15, 0x44, 0x74, 0x97, 0x38, 0x4e, 0x44, 0x99, 0x82, 0x97, 0x6e, 0x4f, 0x01, 0x48, 0xcc, 0x87, + 0xbb, 0x36, 0x8d, 0x78, 0xa6, 0x56, 0x9a, 0xf7, 0x09, 0xa3, 0x4a, 0xfb, 0xe6, 0xbc, 0xd6, 0x0e, + 0xfc, 0x13, 0x77, 0x80, 0x59, 0x10, 0x47, 0x36, 0xcd, 0x24, 0x71, 0x5c, 0x66, 0x07, 0x67, 0x34, + 0x3a, 0x57, 0xda, 0x37, 0xe6, 0x49, 0x86, 0x94, 0x78, 0x7c, 0x88, 0xed, 0x21, 0xb5, 0x4f, 0x15, + 0x6a, 0x7b, 0x1e, 0x25, 0x15, 0x76, 0xe0, 0x29, 0xc4, 0xfd, 0x69, 0x84, 0x17, 0x33, 0x4e, 0xa3, + 0x5d, 0xdb, 0x8d, 0xec, 0xd8, 0xe5, 0xb8, 0x1f, 0x51, 0x72, 0x4a, 0x23, 0x85, 0xfd, 0x41, 0x26, + 0x36, 0x88, 0xb9, 0xe7, 0xd2, 0x08, 0x3b, 0x94, 0x53, 0x9b, 0xbb, 0x81, 0xaf, 0xd0, 0xd3, 0x9e, + 0xa6, 0xa9, 0xa7, 0x4b, 0x46, 0x22, 0xe7, 0xe7, 0x21, 0xdd, 0x0d, 0x69, 0x64, 0x53, 0x7f, 0xec, + 0xb6, 0x41, 0x10, 0x0c, 0x3c, 0x2a, 0x4d, 0x88, 0xef, 0x07, 0x9c, 0x08, 0xba, 0xd4, 0x6e, 0x4b, + 0x69, 0xe5, 0xa8, 0x1f, 0x9f, 0xec, 0x3a, 0x71, 0x44, 0x26, 0xe6, 0xbb, 0x3d, 0xab, 0x67, 0x3c, + 0x8a, 0x6d, 0x7e, 0x91, 0xf5, 0x93, 0x88, 0x84, 0x21, 0x8d, 0x52, 0xf6, 0x9b, 0x67, 0xc4, 0x73, + 0x1d, 0xc2, 0xe9, 0x6e, 0xfa, 0x47, 0x29, 0xae, 0x0d, 0x82, 0x41, 0x20, 0xff, 0xee, 0x8a, 0x7f, + 0x89, 0xb4, 0xfc, 0xed, 0x1b, 0x70, 0xb5, 0x9e, 0x38, 0x00, 0xdd, 0x81, 0x25, 0x9f, 0x8c, 0xa8, + 0xa1, 0x6d, 0x6b, 0x3b, 0x2b, 0xb5, 0x95, 0x3f, 0xff, 0xf7, 0x2f, 0x8b, 0x4b, 0x51, 0x6e, 0x5b, + 0x33, 0xa5, 0x18, 0xd5, 0x61, 0x49, 0xec, 0xd5, 0xc8, 0x6d, 0x6b, 0x3b, 0x85, 0xbd, 0xd7, 0x2b, + 0x93, 0x81, 0x56, 0x51, 0x1c, 0x95, 0x46, 0xfa, 0x79, 0x7b, 0xe7, 0x21, 0xad, 0x81, 0xe0, 0xb8, + 0xf2, 0xb5, 0x96, 0xd3, 0x35, 0x53, 0x1a, 0xa3, 0x1e, 0x20, 0xea, 0x30, 0xac, 0x7c, 0x8e, 0x93, + 0x78, 0x31, 0x16, 0xb7, 0xb5, 0x9d, 0xd5, 0xbd, 0xb7, 0xb2, 0x29, 0x9b, 0x0e, 0x53, 0x7f, 0xeb, + 0x12, 0x6d, 0xea, 0x74, 0x46, 0x82, 0x1e, 0x43, 0xd1, 0x0e, 0x7c, 0x9f, 0xda, 0x1c, 0x73, 0x77, + 0x44, 0x83, 0x98, 0x1b, 0x4b, 0x92, 0xf2, 0x56, 0x25, 0x71, 0x57, 0x25, 0x75, 0x57, 0xa5, 0xa1, + 0x9c, 0x5d, 0x43, 0xdf, 0xfc, 0xf3, 0xee, 0xc2, 0xef, 0xff, 0x75, 0x57, 0x93, 0x6b, 0xfc, 0x93, + 0x96, 0xbb, 0xbf, 0x60, 0x16, 0x14, 0x4b, 0x2f, 0x21, 0x41, 0x27, 0x70, 0x2f, 0x4c, 0x56, 0xe9, + 0x27, 0x21, 0x81, 0xfb, 0xf1, 0xc9, 0x09, 0x8d, 0xb0, 0xe7, 0x8e, 0x44, 0x54, 0x9d, 0x73, 0xca, + 0x8c, 0x2b, 0x72, 0xa6, 0xdb, 0x73, 0x33, 0x1d, 0xb5, 0x7c, 0xfe, 0x60, 0xef, 0x31, 0xf1, 0x62, + 0x6a, 0xde, 0x09, 0xe5, 0x5a, 0x15, 0x4b, 0x4d, 0x92, 0xb4, 0x05, 0x47, 0x4d, 0x50, 0xa0, 0x87, + 0xb0, 0xe2, 0xf5, 0x71, 0x18, 0x78, 0xae, 0x7d, 0x6e, 0xbc, 0x26, 0xfd, 0xbb, 0x95, 0xed, 0x8c, + 0x76, 0xff, 0x50, 0xa2, 0xa6, 0x5c, 0xbb, 0xec, 0x29, 0x29, 0x7a, 0x07, 0xae, 0x0c, 0x03, 0xc6, + 0x99, 0x71, 0x75, 0x7b, 0x71, 0x67, 0x75, 0xaf, 0x34, 0x4d, 0x22, 0xf2, 0xa6, 0x52, 0x4d, 0xf2, + 0xbf, 0x96, 0x33, 0x34, 0x33, 0x01, 0xa3, 0x3a, 0xe4, 0x27, 0x73, 0x8e, 0x19, 0xcb, 0xd2, 0x7a, + 0x2b, 0xc3, 0xfa, 0x40, 0xe2, 0xea, 0x02, 0x66, 0xae, 0x0d, 0x5f, 0x0c, 0x18, 0xfa, 0x0c, 0x36, + 0x47, 0xe4, 0x29, 0x8e, 0xe8, 0x97, 0x31, 0x65, 0x9c, 0xe1, 0x69, 0xc7, 0x19, 0x2b, 0x97, 0xf0, + 0x92, 0x31, 0x22, 0x4f, 0x4d, 0x65, 0x7f, 0x38, 0xe9, 0x30, 0x74, 0x08, 0xfa, 0x4c, 0x2a, 0x33, + 0x03, 0x24, 0xe3, 0x9b, 0x33, 0x8b, 0x54, 0x7e, 0xaa, 0x27, 0xe8, 0x9a, 0x02, 0x9b, 0x45, 0x7b, + 0x5a, 0x80, 0xf6, 0x61, 0x95, 0x7b, 0x4c, 0xac, 0x90, 0xd3, 0xa7, 0xdc, 0x58, 0xcd, 0x22, 0x13, + 0xe5, 0xb0, 0x72, 0x14, 0x32, 0x1e, 0x51, 0x32, 0xea, 0x79, 0xac, 0x9e, 0x80, 0x4d, 0xe0, 0xe3, + 0xff, 0xe8, 0x33, 0xb8, 0x3e, 0xe4, 0x3c, 0xc4, 0x69, 0x39, 0xc2, 0x41, 0x28, 0x93, 0xdd, 0xc8, + 0x4b, 0xc6, 0xef, 0x65, 0xf9, 0x90, 0xf3, 0xf0, 0xed, 0x43, 0x85, 0xef, 0x26, 0x70, 0x73, 0x43, + 0xb0, 0xcc, 0x08, 0xd1, 0xe7, 0x70, 0x43, 0x88, 0xf7, 0xe6, 0xd9, 0x0b, 0x2f, 0x65, 0xdf, 0x9b, + 0x65, 0xbf, 0x36, 0xcc, 0x90, 0x22, 0x0b, 0x74, 0xc7, 0x67, 0x38, 0xa2, 0x27, 0x11, 0x65, 0x43, + 0x1c, 0x11, 0x4e, 0x0d, 0xfd, 0x55, 0x79, 0x53, 0x98, 0xcd, 0x19, 0xc7, 0x67, 0x66, 0xc2, 0x60, + 0x12, 0x4e, 0xd1, 0xe7, 0xb0, 0x2e, 0x48, 0xbd, 0x20, 0x38, 0x8d, 0x43, 0x7c, 0x42, 0x46, 0xae, + 0x77, 0x6e, 0xac, 0xcb, 0x98, 0x7e, 0xf3, 0x82, 0x9a, 0xe1, 0xb3, 0xb6, 0x44, 0xef, 0x4b, 0xf0, + 0x54, 0x68, 0x17, 0x9d, 0x69, 0x25, 0xfa, 0x19, 0xe4, 0x93, 0x35, 0xb3, 0xc0, 0x3b, 0x13, 0x61, + 0x80, 0x5e, 0x15, 0xe9, 0xe6, 0x9a, 0x5c, 0xa1, 0xc2, 0x23, 0x0b, 0xd6, 0xe7, 0x2a, 0xbd, 0xb1, + 0x91, 0x55, 0x80, 0xd2, 0x58, 0xea, 0x26, 0xf0, 0x46, 0x8a, 0x36, 0xf5, 0x60, 0x46, 0x82, 0x7a, + 0xa0, 0xdb, 0x1e, 0x25, 0x7e, 0x1c, 0x62, 0xd7, 0xe7, 0x34, 0x3a, 0x23, 0x9e, 0x71, 0xed, 0xbb, + 0x7a, 0xb2, 0xa8, 0x28, 0x5a, 0x8a, 0x01, 0x75, 0xe1, 0x5a, 0xac, 0xa2, 0x0f, 0xf7, 0x5d, 0xdf, + 0x49, 0xcb, 0xe5, 0x75, 0xc9, 0x7c, 0x27, 0x63, 0xcb, 0x35, 0xd7, 0x77, 0x54, 0x95, 0x44, 0xa9, + 0xe9, 0x0b, 0x19, 0xea, 0x80, 0xee, 0xf5, 0x31, 0x8b, 0xfb, 0x8c, 0xf2, 0x94, 0xec, 0x86, 0x24, + 0x7b, 0xe3, 0xa2, 0x72, 0x63, 0x49, 0xb0, 0xe2, 0x2c, 0x78, 0x53, 0x63, 0x74, 0x0c, 0x1b, 0x91, + 0xeb, 0x0f, 0xf0, 0x90, 0xb0, 0x21, 0xf6, 0xfa, 0x29, 0xe5, 0xcd, 0x97, 0x95, 0x73, 0xd3, 0xf5, + 0x07, 0x07, 0x84, 0x0d, 0xdb, 0xfd, 0x84, 0xe4, 0x60, 0xc1, 0xd4, 0xa3, 0x19, 0x19, 0x7a, 0x04, + 0x3a, 0x8f, 0x88, 0xcf, 0xc2, 0x20, 0xe2, 0x98, 0x05, 0xf6, 0x29, 0xe5, 0x86, 0x21, 0x59, 0xcb, + 0x19, 0xbb, 0xee, 0xa5, 0x50, 0x4b, 0x22, 0xcd, 0x22, 0x9f, 0x16, 0xa0, 0x1f, 0xc3, 0xf2, 0x88, + 0x72, 0xe2, 0x10, 0x4e, 0x8c, 0x5b, 0x92, 0x66, 0x33, 0x83, 0xe6, 0x91, 0x82, 0x98, 0x63, 0x30, + 0xfa, 0x1c, 0xd0, 0x38, 0xf5, 0x18, 0xf5, 0x54, 0xb4, 0x94, 0x64, 0x34, 0x57, 0xb2, 0xf7, 0xa7, + 0x7e, 0xd3, 0x5c, 0xb3, 0x52, 0x2b, 0x73, 0x3d, 0x9c, 0x15, 0x89, 0xef, 0x61, 0x07, 0xa3, 0x51, + 0xe0, 0x4f, 0x38, 0x6f, 0xf3, 0x65, 0xdf, 0xa3, 0x2e, 0xd1, 0xa9, 0x9b, 0xc4, 0x79, 0x35, 0x39, + 0x46, 0x65, 0xc8, 0x13, 0x8f, 0x63, 0xc6, 0x09, 0xc7, 0xf2, 0x28, 0xbf, 0x2d, 0x8e, 0x72, 0x73, + 0x95, 0x78, 0xdc, 0xe2, 0x84, 0x77, 0xc4, 0x31, 0x3e, 0x80, 0xdb, 0x6a, 0xce, 0xec, 0xba, 0x75, + 0x27, 0x33, 0x15, 0xd2, 0xca, 0x32, 0x5b, 0x58, 0x6e, 0x25, 0x5c, 0x19, 0x2a, 0x34, 0x80, 0xcd, + 0x71, 0xf4, 0x4e, 0x9c, 0xa0, 0xe9, 0x3c, 0x5b, 0x59, 0x15, 0x2c, 0x2d, 0xb6, 0x2f, 0x4a, 0xff, + 0x78, 0xa2, 0xf8, 0x22, 0x15, 0x3a, 0x82, 0x1d, 0xdb, 0x0b, 0x18, 0x9d, 0x98, 0x85, 0x61, 0xb1, + 0xbf, 0x80, 0x71, 0xac, 0x0e, 0xb6, 0x13, 0xe2, 0x7a, 0x71, 0x44, 0x8d, 0xbb, 0xdb, 0xda, 0xce, + 0xb2, 0xf9, 0xba, 0xc4, 0xbf, 0x60, 0x62, 0x5d, 0xff, 0x20, 0x60, 0x3c, 0x39, 0xdc, 0xf6, 0x13, + 0x28, 0x3a, 0x80, 0x7b, 0x4e, 0x44, 0x5c, 0x3f, 0x93, 0x36, 0xa2, 0xa3, 0x40, 0x24, 0xf9, 0xb6, + 0xe4, 0xbb, 0x23, 0x81, 0x73, 0x7c, 0x66, 0x02, 0x42, 0x6d, 0x28, 0x7a, 0x01, 0x71, 0x30, 0x61, + 0xcc, 0x1d, 0xf8, 0x23, 0xea, 0x73, 0xe3, 0x9e, 0xdc, 0x7d, 0x76, 0x13, 0xd5, 0x0e, 0x88, 0x53, + 0x1d, 0x43, 0xcd, 0x82, 0x37, 0x35, 0x46, 0x5f, 0xc0, 0x8d, 0x20, 0x72, 0x07, 0xae, 0x4f, 0x3c, + 0xec, 0x30, 0x3e, 0x11, 0x3a, 0x65, 0x49, 0xfa, 0xfd, 0xec, 0xd0, 0xe9, 0x2a, 0x9b, 0x06, 0xe3, + 0x13, 0xa9, 0xb7, 0x11, 0xcc, 0x8b, 0xd1, 0x97, 0x50, 0xa2, 0x4f, 0x39, 0xf5, 0x99, 0xf8, 0x5e, + 0x73, 0x01, 0xf2, 0xba, 0x2c, 0xb8, 0x0f, 0x2e, 0x68, 0xd6, 0x52, 0xbb, 0x99, 0x68, 0x68, 0xfa, + 0x3c, 0x3a, 0x37, 0x0d, 0x7a, 0x81, 0xba, 0x14, 0x83, 0x3e, 0xdb, 0xe7, 0xa1, 0x8f, 0x00, 0x64, + 0xaf, 0x98, 0x6c, 0x4e, 0x93, 0x9b, 0xbb, 0x9b, 0x11, 0x97, 0x09, 0xdc, 0x92, 0x77, 0x0e, 0x73, + 0x45, 0x34, 0x87, 0x89, 0xfd, 0x3d, 0x58, 0x63, 0x34, 0x3a, 0x73, 0x6d, 0x9a, 0x24, 0x43, 0x2e, + 0x49, 0x06, 0x25, 0x13, 0xc9, 0x50, 0x72, 0xe0, 0xce, 0x4b, 0x57, 0x8c, 0x74, 0x58, 0x3c, 0xa5, + 0xe7, 0x49, 0x4b, 0x6c, 0x8a, 0xbf, 0xe8, 0x87, 0x70, 0xe5, 0x4c, 0x74, 0x2b, 0x92, 0x6e, 0x75, + 0xef, 0xe6, 0x5c, 0x7d, 0xb7, 0x64, 0xbb, 0x6e, 0x26, 0xa8, 0xf7, 0x73, 0x3f, 0xd1, 0x4a, 0x7f, + 0x5b, 0x84, 0xc2, 0x74, 0x25, 0x45, 0x21, 0x14, 0x4f, 0x88, 0xe7, 0xf5, 0x89, 0x7d, 0x9a, 0xf6, + 0x7d, 0x9a, 0xac, 0x2a, 0x3f, 0xbd, 0x4c, 0x21, 0x1e, 0x0f, 0xf7, 0x15, 0x47, 0x46, 0x53, 0x58, + 0x38, 0x99, 0xd2, 0xa1, 0x8f, 0xa0, 0xe0, 0xd0, 0x13, 0x12, 0x8b, 0xfa, 0x20, 0x6d, 0x5f, 0xb5, + 0x81, 0xbc, 0x82, 0x27, 0x33, 0xa1, 0x2f, 0x40, 0x57, 0x07, 0x47, 0x52, 0x08, 0x83, 0x88, 0x19, + 0x8b, 0x32, 0x14, 0xde, 0xfd, 0x4e, 0x4b, 0xb6, 0x94, 0xb5, 0x59, 0x64, 0x53, 0x63, 0x86, 0xf6, + 0xe0, 0xba, 0x17, 0xd8, 0xc4, 0x73, 0xf9, 0x39, 0x7e, 0x42, 0xdd, 0xc1, 0x90, 0x63, 0xf2, 0x84, + 0x44, 0x54, 0xf6, 0xf2, 0xcb, 0xe6, 0x46, 0xaa, 0x3c, 0x96, 0xba, 0xaa, 0x50, 0x95, 0xde, 0x02, + 0x7d, 0x96, 0x18, 0x21, 0x58, 0x3a, 0xa5, 0xe7, 0xcc, 0xd0, 0xb6, 0x17, 0x77, 0x56, 0x4c, 0xf9, + 0xbf, 0xdc, 0x85, 0x1b, 0xd9, 0x3e, 0x43, 0x45, 0x58, 0xed, 0x74, 0xf1, 0x7e, 0xb5, 0xdd, 0xae, + 0x55, 0xeb, 0x9f, 0xe8, 0x0b, 0x48, 0x87, 0xb5, 0x6a, 0xe7, 0x53, 0xdc, 0xec, 0x34, 0x0e, 0xbb, + 0xad, 0x4e, 0x4f, 0xd7, 0x10, 0x82, 0x42, 0xa3, 0xb9, 0x5f, 0x3d, 0x6a, 0xf7, 0xb0, 0x75, 0x54, + 0xb3, 0x9a, 0x3d, 0x3d, 0x57, 0xfa, 0x5d, 0x0e, 0xf4, 0xd9, 0xa3, 0x0c, 0x3d, 0x86, 0xf5, 0x91, + 0xeb, 0xbb, 0xa3, 0x78, 0x84, 0xe5, 0xb9, 0xc8, 0xdc, 0x67, 0x54, 0x05, 0x6e, 0x76, 0xe7, 0xfb, + 0xde, 0x3b, 0xb2, 0xf3, 0xad, 0xad, 0x89, 0x0f, 0x77, 0x75, 0xef, 0x8a, 0xf1, 0xd5, 0x57, 0x5f, + 0x2d, 0x99, 0x45, 0x45, 0x22, 0xf8, 0x2d, 0xf7, 0x19, 0x45, 0xbf, 0x84, 0xbc, 0x43, 0xc3, 0x88, + 0xda, 0x84, 0x53, 0x07, 0x9f, 0xbd, 0xad, 0x3e, 0xdd, 0x83, 0xcb, 0x9d, 0xb0, 0x95, 0xc6, 0xd8, + 0xf6, 0xf1, 0xdb, 0xb2, 0xef, 0x5f, 0x73, 0x26, 0x24, 0xa5, 0x36, 0xac, 0x4d, 0x22, 0xd0, 0x07, + 0xb0, 0x16, 0x33, 0x8a, 0x19, 0x77, 0xe4, 0xc1, 0xae, 0x36, 0x50, 0x9a, 0xdb, 0x40, 0x2d, 0x08, + 0xbc, 0xa4, 0x71, 0x87, 0x98, 0x51, 0x8b, 0x3b, 0x62, 0xd2, 0xd2, 0x87, 0xb0, 0x91, 0x51, 0x6a, + 0xd0, 0x5b, 0x50, 0x14, 0xa4, 0xf2, 0xcc, 0x19, 0x52, 0xe2, 0xd0, 0x48, 0xf2, 0x2e, 0x9b, 0xf9, + 0x98, 0x51, 0x71, 0x7c, 0x1c, 0x48, 0x61, 0xe9, 0x3f, 0x4b, 0x50, 0x98, 0x3e, 0xe5, 0xd0, 0x27, + 0x70, 0x33, 0xa9, 0xe2, 0xe7, 0x38, 0x24, 0xbe, 0x6b, 0x63, 0x3e, 0x14, 0xdd, 0x66, 0xe0, 0x39, + 0x6a, 0x69, 0x1b, 0xca, 0x0f, 0xe2, 0x86, 0x59, 0x39, 0x4c, 0xae, 0xe2, 0xe6, 0x75, 0x65, 0x73, + 0x28, 0x4c, 0x7a, 0xa9, 0x05, 0x72, 0xe1, 0xda, 0xb3, 0xc0, 0xa7, 0x49, 0x64, 0x4d, 0xd4, 0xce, + 0xc4, 0xa3, 0xef, 0x5d, 0xe6, 0xd8, 0xad, 0xfc, 0x22, 0xf0, 0xa9, 0x0c, 0xbf, 0x89, 0x42, 0xba, + 0xfe, 0x6c, 0x56, 0x88, 0x7e, 0x0d, 0x9b, 0x33, 0xf1, 0x4c, 0x9d, 0x89, 0x19, 0x93, 0x4b, 0xef, + 0x87, 0x97, 0x9a, 0xb1, 0x3d, 0x15, 0xfa, 0xd4, 0x99, 0x98, 0xd8, 0xf0, 0x2e, 0xd0, 0xa1, 0x16, + 0x6c, 0xc4, 0xa1, 0x43, 0x38, 0xc5, 0x23, 0x1a, 0x0d, 0x28, 0x7e, 0xe2, 0xfa, 0x4e, 0xf0, 0xe4, + 0x95, 0x37, 0x63, 0x73, 0x3d, 0xb1, 0x7a, 0x24, 0x8c, 0x8e, 0xa5, 0x4d, 0xe9, 0x0f, 0x1a, 0xac, + 0xcf, 0xed, 0x1a, 0x7d, 0x00, 0xc5, 0x28, 0x88, 0xb9, 0x88, 0x74, 0xea, 0x93, 0xbe, 0x47, 0x5f, + 0xfa, 0x41, 0x0a, 0x0a, 0xdb, 0x4c, 0xa0, 0x68, 0x1f, 0xf4, 0x91, 0x38, 0x5d, 0xd5, 0x53, 0x80, + 0xcc, 0x95, 0xdc, 0xab, 0x73, 0xc5, 0x2c, 0x8c, 0x5c, 0x5f, 0xb9, 0x49, 0x24, 0x47, 0xa9, 0x04, + 0xc6, 0x45, 0xee, 0xa9, 0x6d, 0xc2, 0xad, 0xf1, 0x27, 0x48, 0xdf, 0xa6, 0x42, 0x6a, 0xbb, 0x27, + 0x2e, 0x8d, 0xca, 0xc7, 0x90, 0x9f, 0x7a, 0xae, 0x40, 0x00, 0xaf, 0x59, 0xbd, 0x6a, 0xaf, 0x55, + 0xd7, 0x17, 0x50, 0x01, 0xc0, 0xea, 0x99, 0xad, 0x7a, 0x0f, 0x37, 0x3a, 0x96, 0xae, 0x89, 0x32, + 0xd1, 0xee, 0x3e, 0x6c, 0xd5, 0xab, 0x6d, 0x29, 0xc8, 0xa1, 0xab, 0xb0, 0xd8, 0x6c, 0x58, 0xfa, + 0xa2, 0xa8, 0x17, 0x5d, 0xb3, 0xf5, 0xb0, 0xd5, 0x11, 0x2a, 0xab, 0xa7, 0x2f, 0x95, 0x7f, 0x05, + 0xcb, 0xe9, 0x3d, 0x5d, 0xd8, 0x99, 0xdd, 0xa3, 0x4e, 0x03, 0x9b, 0xdd, 0x5a, 0xab, 0xa3, 0x2f, + 0xa0, 0x75, 0xc8, 0xb7, 0x9b, 0x55, 0xab, 0x87, 0xcd, 0xe6, 0xcf, 0x8f, 0x9a, 0x96, 0xa8, 0x2f, + 0x79, 0x58, 0x31, 0x5b, 0x9d, 0x87, 0xf8, 0xa0, 0x6a, 0x1d, 0xe8, 0x39, 0xb1, 0x0c, 0xb3, 0xda, + 0x69, 0x74, 0x1f, 0xe9, 0x8b, 0x68, 0x03, 0x8a, 0x93, 0xe4, 0xb8, 0x5d, 0xd3, 0x97, 0x04, 0xe0, + 0x51, 0xf5, 0x61, 0xbb, 0xf9, 0x58, 0xbf, 0x52, 0x7e, 0x17, 0x8a, 0x33, 0xf7, 0x27, 0xb4, 0x0c, + 0x4b, 0xd5, 0xa3, 0x5e, 0x57, 0x5f, 0x40, 0xab, 0x70, 0xf5, 0xf1, 0x3b, 0xb8, 0xdb, 0x69, 0x7f, + 0xaa, 0x6b, 0x72, 0xf0, 0x5e, 0x32, 0xc8, 0x95, 0x7b, 0x60, 0x5c, 0xd4, 0xa8, 0xa2, 0x4d, 0xb8, + 0x79, 0x64, 0x35, 0x71, 0xbd, 0xdb, 0xd9, 0x6f, 0x3d, 0x3c, 0x32, 0x9b, 0x0d, 0x7c, 0x68, 0x76, + 0x7b, 0xdd, 0x7a, 0xb7, 0xad, 0x2f, 0xa4, 0xca, 0x46, 0xf7, 0xb8, 0x63, 0xf5, 0xcc, 0x66, 0xf5, + 0xd1, 0x0b, 0xa5, 0x56, 0x5b, 0x95, 0xef, 0x18, 0x89, 0xa3, 0x3f, 0x5e, 0x5a, 0x5e, 0xd3, 0xf3, + 0x1f, 0x2f, 0x2d, 0x17, 0x75, 0xbd, 0x7c, 0x0c, 0xe8, 0x68, 0xfe, 0x3a, 0x52, 0x85, 0x42, 0xf2, + 0x52, 0x88, 0xd5, 0xa3, 0xe4, 0xb8, 0xd4, 0x5c, 0x7c, 0x99, 0xcb, 0x27, 0x16, 0x6a, 0x58, 0x26, + 0x70, 0xeb, 0xc2, 0x9e, 0x11, 0x35, 0x20, 0xcf, 0xed, 0x10, 0x9f, 0x52, 0x1a, 0x12, 0xcf, 0x3d, + 0xa3, 0x2f, 0xe9, 0x21, 0x7a, 0x76, 0xf8, 0x49, 0x0a, 0x33, 0xd7, 0xf8, 0xc4, 0x68, 0xef, 0x1f, + 0x39, 0xb8, 0xa9, 0x7c, 0x35, 0x0e, 0x17, 0x2b, 0xe9, 0x21, 0xd0, 0x31, 0x14, 0xac, 0x64, 0xf2, + 0x04, 0xc0, 0xd0, 0xcc, 0xa3, 0xc9, 0xd8, 0x42, 0xbd, 0x6b, 0x94, 0xee, 0x5e, 0xa8, 0x67, 0x61, + 0xe0, 0x33, 0x5a, 0x5e, 0xd8, 0xd1, 0x7e, 0xa4, 0xa1, 0x08, 0x36, 0x5a, 0xbe, 0x1d, 0x51, 0xd1, + 0xf1, 0x11, 0x6f, 0xcc, 0x3e, 0xd3, 0xdb, 0x4d, 0x40, 0xe6, 0x26, 0xba, 0x7f, 0x19, 0xe8, 0xd4, + 0x9c, 0x0c, 0xf2, 0xfb, 0x94, 0xdb, 0xc3, 0xff, 0xdf, 0x5e, 0xee, 0x7d, 0xfd, 0xf7, 0x6f, 0x7f, + 0x9b, 0xdb, 0x2c, 0xdf, 0x98, 0x7a, 0xf9, 0x7d, 0x5f, 0xa5, 0x3c, 0x7b, 0x5f, 0xbb, 0x5f, 0xdb, + 0xf8, 0xe3, 0xf3, 0x2d, 0xed, 0x9b, 0xe7, 0x5b, 0xda, 0x5f, 0x9f, 0x6f, 0x69, 0xff, 0x7e, 0xbe, + 0xa5, 0xfd, 0x46, 0xd3, 0xfa, 0xaf, 0xc9, 0xc4, 0x7f, 0xf0, 0xbf, 0x00, 0x00, 0x00, 0xff, 0xff, + 0x1a, 0x9e, 0x33, 0x67, 0xe5, 0x16, 0x00, 0x00, +} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/cds.pb.validate.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/cds.pb.validate.go new file mode 100644 index 000000000000..46688895ed62 --- /dev/null +++ b/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/cds.pb.validate.go @@ -0,0 +1,1025 @@ +// Code generated by protoc-gen-validate +// source: envoy/api/v2/cds.proto +// DO NOT EDIT!!! + +package v2 + +import ( + "bytes" + "errors" + "fmt" + "net" + "net/mail" + "net/url" + "regexp" + "strings" + "time" + "unicode/utf8" + + "github.com/gogo/protobuf/types" +) + +// ensure the imports are used +var ( + _ = bytes.MinRead + _ = errors.New("") + _ = fmt.Print + _ = utf8.UTFMax + _ = (*regexp.Regexp)(nil) + _ = (*strings.Reader)(nil) + _ = net.IPv4len + _ = time.Duration(0) + _ = (*url.URL)(nil) + _ = (*mail.Address)(nil) + _ = types.DynamicAny{} +) + +// Validate checks the field values on Cluster with the rules defined in the +// proto definition for this message. If any rules are violated, an error is returned. +func (m *Cluster) Validate() error { + if m == nil { + return nil + } + + if len(m.GetName()) < 1 { + return ClusterValidationError{ + Field: "Name", + Reason: "value length must be at least 1 bytes", + } + } + + // no validation rules for AltStatName + + if _, ok := Cluster_DiscoveryType_name[int32(m.GetType())]; !ok { + return ClusterValidationError{ + Field: "Type", + Reason: "value must be one of the defined enum values", + } + } + + if v, ok := interface{}(m.GetEdsClusterConfig()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return ClusterValidationError{ + Field: "EdsClusterConfig", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + if true { + dur := m.GetConnectTimeout() + + gt := time.Duration(0*time.Second + 0*time.Nanosecond) + + if dur <= gt { + return ClusterValidationError{ + Field: "ConnectTimeout", + Reason: "value must be greater than 0s", + } + } + + } + + if v, ok := interface{}(m.GetPerConnectionBufferLimitBytes()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return ClusterValidationError{ + Field: "PerConnectionBufferLimitBytes", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + if _, ok := Cluster_LbPolicy_name[int32(m.GetLbPolicy())]; !ok { + return ClusterValidationError{ + Field: "LbPolicy", + Reason: "value must be one of the defined enum values", + } + } + + for idx, item := range m.GetHosts() { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return ClusterValidationError{ + Field: fmt.Sprintf("Hosts[%v]", idx), + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + } + + if v, ok := interface{}(m.GetLoadAssignment()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return ClusterValidationError{ + Field: "LoadAssignment", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + for idx, item := range m.GetHealthChecks() { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return ClusterValidationError{ + Field: fmt.Sprintf("HealthChecks[%v]", idx), + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + } + + if v, ok := interface{}(m.GetMaxRequestsPerConnection()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return ClusterValidationError{ + Field: "MaxRequestsPerConnection", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + if v, ok := interface{}(m.GetCircuitBreakers()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return ClusterValidationError{ + Field: "CircuitBreakers", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + if v, ok := interface{}(m.GetTlsContext()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return ClusterValidationError{ + Field: "TlsContext", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + if v, ok := interface{}(m.GetCommonHttpProtocolOptions()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return ClusterValidationError{ + Field: "CommonHttpProtocolOptions", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + if v, ok := interface{}(m.GetHttpProtocolOptions()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return ClusterValidationError{ + Field: "HttpProtocolOptions", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + if v, ok := interface{}(m.GetHttp2ProtocolOptions()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return ClusterValidationError{ + Field: "Http2ProtocolOptions", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + // no validation rules for ExtensionProtocolOptions + + if d := m.GetDnsRefreshRate(); d != nil { + dur := *d + + gt := time.Duration(0*time.Second + 0*time.Nanosecond) + + if dur <= gt { + return ClusterValidationError{ + Field: "DnsRefreshRate", + Reason: "value must be greater than 0s", + } + } + + } + + if _, ok := Cluster_DnsLookupFamily_name[int32(m.GetDnsLookupFamily())]; !ok { + return ClusterValidationError{ + Field: "DnsLookupFamily", + Reason: "value must be one of the defined enum values", + } + } + + for idx, item := range m.GetDnsResolvers() { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return ClusterValidationError{ + Field: fmt.Sprintf("DnsResolvers[%v]", idx), + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + } + + if v, ok := interface{}(m.GetOutlierDetection()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return ClusterValidationError{ + Field: "OutlierDetection", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + if d := m.GetCleanupInterval(); d != nil { + dur := *d + + gt := time.Duration(0*time.Second + 0*time.Nanosecond) + + if dur <= gt { + return ClusterValidationError{ + Field: "CleanupInterval", + Reason: "value must be greater than 0s", + } + } + + } + + if v, ok := interface{}(m.GetUpstreamBindConfig()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return ClusterValidationError{ + Field: "UpstreamBindConfig", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + if v, ok := interface{}(m.GetLbSubsetConfig()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return ClusterValidationError{ + Field: "LbSubsetConfig", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + if v, ok := interface{}(m.GetCommonLbConfig()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return ClusterValidationError{ + Field: "CommonLbConfig", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + if v, ok := interface{}(m.GetTransportSocket()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return ClusterValidationError{ + Field: "TransportSocket", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + if v, ok := interface{}(m.GetMetadata()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return ClusterValidationError{ + Field: "Metadata", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + // no validation rules for ProtocolSelection + + if v, ok := interface{}(m.GetUpstreamConnectionOptions()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return ClusterValidationError{ + Field: "UpstreamConnectionOptions", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + // no validation rules for CloseConnectionsOnHostHealthFailure + + // no validation rules for DrainConnectionsOnHostRemoval + + switch m.LbConfig.(type) { + + case *Cluster_RingHashLbConfig_: + + if v, ok := interface{}(m.GetRingHashLbConfig()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return ClusterValidationError{ + Field: "RingHashLbConfig", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + case *Cluster_OriginalDstLbConfig_: + + if v, ok := interface{}(m.GetOriginalDstLbConfig()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return ClusterValidationError{ + Field: "OriginalDstLbConfig", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + } + + return nil +} + +// ClusterValidationError is the validation error returned by Cluster.Validate +// if the designated constraints aren't met. +type ClusterValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e ClusterValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sCluster.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = ClusterValidationError{} + +// Validate checks the field values on UpstreamBindConfig with the rules +// defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *UpstreamBindConfig) Validate() error { + if m == nil { + return nil + } + + if v, ok := interface{}(m.GetSourceAddress()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return UpstreamBindConfigValidationError{ + Field: "SourceAddress", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + return nil +} + +// UpstreamBindConfigValidationError is the validation error returned by +// UpstreamBindConfig.Validate if the designated constraints aren't met. +type UpstreamBindConfigValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e UpstreamBindConfigValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sUpstreamBindConfig.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = UpstreamBindConfigValidationError{} + +// Validate checks the field values on UpstreamConnectionOptions with the rules +// defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *UpstreamConnectionOptions) Validate() error { + if m == nil { + return nil + } + + if v, ok := interface{}(m.GetTcpKeepalive()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return UpstreamConnectionOptionsValidationError{ + Field: "TcpKeepalive", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + return nil +} + +// UpstreamConnectionOptionsValidationError is the validation error returned by +// UpstreamConnectionOptions.Validate if the designated constraints aren't met. +type UpstreamConnectionOptionsValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e UpstreamConnectionOptionsValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sUpstreamConnectionOptions.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = UpstreamConnectionOptionsValidationError{} + +// Validate checks the field values on Cluster_EdsClusterConfig with the rules +// defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *Cluster_EdsClusterConfig) Validate() error { + if m == nil { + return nil + } + + if v, ok := interface{}(m.GetEdsConfig()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return Cluster_EdsClusterConfigValidationError{ + Field: "EdsConfig", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + // no validation rules for ServiceName + + return nil +} + +// Cluster_EdsClusterConfigValidationError is the validation error returned by +// Cluster_EdsClusterConfig.Validate if the designated constraints aren't met. +type Cluster_EdsClusterConfigValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e Cluster_EdsClusterConfigValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sCluster_EdsClusterConfig.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = Cluster_EdsClusterConfigValidationError{} + +// Validate checks the field values on Cluster_LbSubsetConfig with the rules +// defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *Cluster_LbSubsetConfig) Validate() error { + if m == nil { + return nil + } + + if _, ok := Cluster_LbSubsetConfig_LbSubsetFallbackPolicy_name[int32(m.GetFallbackPolicy())]; !ok { + return Cluster_LbSubsetConfigValidationError{ + Field: "FallbackPolicy", + Reason: "value must be one of the defined enum values", + } + } + + if v, ok := interface{}(m.GetDefaultSubset()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return Cluster_LbSubsetConfigValidationError{ + Field: "DefaultSubset", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + for idx, item := range m.GetSubsetSelectors() { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return Cluster_LbSubsetConfigValidationError{ + Field: fmt.Sprintf("SubsetSelectors[%v]", idx), + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + } + + // no validation rules for LocalityWeightAware + + return nil +} + +// Cluster_LbSubsetConfigValidationError is the validation error returned by +// Cluster_LbSubsetConfig.Validate if the designated constraints aren't met. +type Cluster_LbSubsetConfigValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e Cluster_LbSubsetConfigValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sCluster_LbSubsetConfig.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = Cluster_LbSubsetConfigValidationError{} + +// Validate checks the field values on Cluster_RingHashLbConfig with the rules +// defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *Cluster_RingHashLbConfig) Validate() error { + if m == nil { + return nil + } + + if wrapper := m.GetMinimumRingSize(); wrapper != nil { + + if wrapper.GetValue() > 8388608 { + return Cluster_RingHashLbConfigValidationError{ + Field: "MinimumRingSize", + Reason: "value must be less than or equal to 8388608", + } + } + + } + + if v, ok := interface{}(m.GetDeprecatedV1()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return Cluster_RingHashLbConfigValidationError{ + Field: "DeprecatedV1", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + return nil +} + +// Cluster_RingHashLbConfigValidationError is the validation error returned by +// Cluster_RingHashLbConfig.Validate if the designated constraints aren't met. +type Cluster_RingHashLbConfigValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e Cluster_RingHashLbConfigValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sCluster_RingHashLbConfig.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = Cluster_RingHashLbConfigValidationError{} + +// Validate checks the field values on Cluster_OriginalDstLbConfig with the +// rules defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *Cluster_OriginalDstLbConfig) Validate() error { + if m == nil { + return nil + } + + // no validation rules for UseHttpHeader + + return nil +} + +// Cluster_OriginalDstLbConfigValidationError is the validation error returned +// by Cluster_OriginalDstLbConfig.Validate if the designated constraints +// aren't met. +type Cluster_OriginalDstLbConfigValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e Cluster_OriginalDstLbConfigValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sCluster_OriginalDstLbConfig.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = Cluster_OriginalDstLbConfigValidationError{} + +// Validate checks the field values on Cluster_CommonLbConfig with the rules +// defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *Cluster_CommonLbConfig) Validate() error { + if m == nil { + return nil + } + + if v, ok := interface{}(m.GetHealthyPanicThreshold()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return Cluster_CommonLbConfigValidationError{ + Field: "HealthyPanicThreshold", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + if v, ok := interface{}(m.GetUpdateMergeWindow()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return Cluster_CommonLbConfigValidationError{ + Field: "UpdateMergeWindow", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + switch m.LocalityConfigSpecifier.(type) { + + case *Cluster_CommonLbConfig_ZoneAwareLbConfig_: + + if v, ok := interface{}(m.GetZoneAwareLbConfig()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return Cluster_CommonLbConfigValidationError{ + Field: "ZoneAwareLbConfig", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + case *Cluster_CommonLbConfig_LocalityWeightedLbConfig_: + + if v, ok := interface{}(m.GetLocalityWeightedLbConfig()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return Cluster_CommonLbConfigValidationError{ + Field: "LocalityWeightedLbConfig", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + } + + return nil +} + +// Cluster_CommonLbConfigValidationError is the validation error returned by +// Cluster_CommonLbConfig.Validate if the designated constraints aren't met. +type Cluster_CommonLbConfigValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e Cluster_CommonLbConfigValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sCluster_CommonLbConfig.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = Cluster_CommonLbConfigValidationError{} + +// Validate checks the field values on Cluster_LbSubsetConfig_LbSubsetSelector +// with the rules defined in the proto definition for this message. If any +// rules are violated, an error is returned. +func (m *Cluster_LbSubsetConfig_LbSubsetSelector) Validate() error { + if m == nil { + return nil + } + + return nil +} + +// Cluster_LbSubsetConfig_LbSubsetSelectorValidationError is the validation +// error returned by Cluster_LbSubsetConfig_LbSubsetSelector.Validate if the +// designated constraints aren't met. +type Cluster_LbSubsetConfig_LbSubsetSelectorValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e Cluster_LbSubsetConfig_LbSubsetSelectorValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sCluster_LbSubsetConfig_LbSubsetSelector.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = Cluster_LbSubsetConfig_LbSubsetSelectorValidationError{} + +// Validate checks the field values on Cluster_RingHashLbConfig_DeprecatedV1 +// with the rules defined in the proto definition for this message. If any +// rules are violated, an error is returned. +func (m *Cluster_RingHashLbConfig_DeprecatedV1) Validate() error { + if m == nil { + return nil + } + + if v, ok := interface{}(m.GetUseStdHash()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return Cluster_RingHashLbConfig_DeprecatedV1ValidationError{ + Field: "UseStdHash", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + return nil +} + +// Cluster_RingHashLbConfig_DeprecatedV1ValidationError is the validation error +// returned by Cluster_RingHashLbConfig_DeprecatedV1.Validate if the +// designated constraints aren't met. +type Cluster_RingHashLbConfig_DeprecatedV1ValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e Cluster_RingHashLbConfig_DeprecatedV1ValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sCluster_RingHashLbConfig_DeprecatedV1.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = Cluster_RingHashLbConfig_DeprecatedV1ValidationError{} + +// Validate checks the field values on Cluster_CommonLbConfig_ZoneAwareLbConfig +// with the rules defined in the proto definition for this message. If any +// rules are violated, an error is returned. +func (m *Cluster_CommonLbConfig_ZoneAwareLbConfig) Validate() error { + if m == nil { + return nil + } + + if v, ok := interface{}(m.GetRoutingEnabled()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return Cluster_CommonLbConfig_ZoneAwareLbConfigValidationError{ + Field: "RoutingEnabled", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + if v, ok := interface{}(m.GetMinClusterSize()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return Cluster_CommonLbConfig_ZoneAwareLbConfigValidationError{ + Field: "MinClusterSize", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + return nil +} + +// Cluster_CommonLbConfig_ZoneAwareLbConfigValidationError is the validation +// error returned by Cluster_CommonLbConfig_ZoneAwareLbConfig.Validate if the +// designated constraints aren't met. +type Cluster_CommonLbConfig_ZoneAwareLbConfigValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e Cluster_CommonLbConfig_ZoneAwareLbConfigValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sCluster_CommonLbConfig_ZoneAwareLbConfig.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = Cluster_CommonLbConfig_ZoneAwareLbConfigValidationError{} + +// Validate checks the field values on +// Cluster_CommonLbConfig_LocalityWeightedLbConfig with the rules defined in +// the proto definition for this message. If any rules are violated, an error +// is returned. +func (m *Cluster_CommonLbConfig_LocalityWeightedLbConfig) Validate() error { + if m == nil { + return nil + } + + return nil +} + +// Cluster_CommonLbConfig_LocalityWeightedLbConfigValidationError is the +// validation error returned by +// Cluster_CommonLbConfig_LocalityWeightedLbConfig.Validate if the designated +// constraints aren't met. +type Cluster_CommonLbConfig_LocalityWeightedLbConfigValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e Cluster_CommonLbConfig_LocalityWeightedLbConfigValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sCluster_CommonLbConfig_LocalityWeightedLbConfig.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = Cluster_CommonLbConfig_LocalityWeightedLbConfigValidationError{} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/cluster/circuit_breaker.pb.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/cluster/circuit_breaker.pb.go new file mode 100644 index 000000000000..81c1d16166bb --- /dev/null +++ b/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/cluster/circuit_breaker.pb.go @@ -0,0 +1,833 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: envoy/api/v2/cluster/circuit_breaker.proto + +package cluster + +import proto "github.com/gogo/protobuf/proto" +import fmt "fmt" +import math "math" +import core "github.com/envoyproxy/go-control-plane/envoy/api/v2/core" +import _ "github.com/gogo/protobuf/gogoproto" +import types "github.com/gogo/protobuf/types" + +import bytes "bytes" + +import io "io" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package + +// :ref:`Circuit breaking` settings can be +// specified individually for each defined priority. +type CircuitBreakers struct { + // If multiple :ref:`Thresholds` + // are defined with the same :ref:`RoutingPriority`, + // the first one in the list is used. If no Thresholds is defined for a given + // :ref:`RoutingPriority`, the default values + // are used. + Thresholds []*CircuitBreakers_Thresholds `protobuf:"bytes,1,rep,name=thresholds" json:"thresholds,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *CircuitBreakers) Reset() { *m = CircuitBreakers{} } +func (m *CircuitBreakers) String() string { return proto.CompactTextString(m) } +func (*CircuitBreakers) ProtoMessage() {} +func (*CircuitBreakers) Descriptor() ([]byte, []int) { + return fileDescriptor_circuit_breaker_f0d66cc80ef03e29, []int{0} +} +func (m *CircuitBreakers) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *CircuitBreakers) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_CircuitBreakers.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *CircuitBreakers) XXX_Merge(src proto.Message) { + xxx_messageInfo_CircuitBreakers.Merge(dst, src) +} +func (m *CircuitBreakers) XXX_Size() int { + return m.Size() +} +func (m *CircuitBreakers) XXX_DiscardUnknown() { + xxx_messageInfo_CircuitBreakers.DiscardUnknown(m) +} + +var xxx_messageInfo_CircuitBreakers proto.InternalMessageInfo + +func (m *CircuitBreakers) GetThresholds() []*CircuitBreakers_Thresholds { + if m != nil { + return m.Thresholds + } + return nil +} + +// A Thresholds defines CircuitBreaker settings for a +// :ref:`RoutingPriority`. +type CircuitBreakers_Thresholds struct { + // The :ref:`RoutingPriority` + // the specified CircuitBreaker settings apply to. + // [#comment:TODO(htuch): add (validate.rules).enum.defined_only = true once + // https://github.com/lyft/protoc-gen-validate/issues/42 is resolved.] + Priority core.RoutingPriority `protobuf:"varint,1,opt,name=priority,proto3,enum=envoy.api.v2.core.RoutingPriority" json:"priority,omitempty"` + // The maximum number of connections that Envoy will make to the upstream + // cluster. If not specified, the default is 1024. + MaxConnections *types.UInt32Value `protobuf:"bytes,2,opt,name=max_connections,json=maxConnections" json:"max_connections,omitempty"` + // The maximum number of pending requests that Envoy will allow to the + // upstream cluster. If not specified, the default is 1024. + MaxPendingRequests *types.UInt32Value `protobuf:"bytes,3,opt,name=max_pending_requests,json=maxPendingRequests" json:"max_pending_requests,omitempty"` + // The maximum number of parallel requests that Envoy will make to the + // upstream cluster. If not specified, the default is 1024. + MaxRequests *types.UInt32Value `protobuf:"bytes,4,opt,name=max_requests,json=maxRequests" json:"max_requests,omitempty"` + // The maximum number of parallel retries that Envoy will allow to the + // upstream cluster. If not specified, the default is 3. + MaxRetries *types.UInt32Value `protobuf:"bytes,5,opt,name=max_retries,json=maxRetries" json:"max_retries,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *CircuitBreakers_Thresholds) Reset() { *m = CircuitBreakers_Thresholds{} } +func (m *CircuitBreakers_Thresholds) String() string { return proto.CompactTextString(m) } +func (*CircuitBreakers_Thresholds) ProtoMessage() {} +func (*CircuitBreakers_Thresholds) Descriptor() ([]byte, []int) { + return fileDescriptor_circuit_breaker_f0d66cc80ef03e29, []int{0, 0} +} +func (m *CircuitBreakers_Thresholds) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *CircuitBreakers_Thresholds) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_CircuitBreakers_Thresholds.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *CircuitBreakers_Thresholds) XXX_Merge(src proto.Message) { + xxx_messageInfo_CircuitBreakers_Thresholds.Merge(dst, src) +} +func (m *CircuitBreakers_Thresholds) XXX_Size() int { + return m.Size() +} +func (m *CircuitBreakers_Thresholds) XXX_DiscardUnknown() { + xxx_messageInfo_CircuitBreakers_Thresholds.DiscardUnknown(m) +} + +var xxx_messageInfo_CircuitBreakers_Thresholds proto.InternalMessageInfo + +func (m *CircuitBreakers_Thresholds) GetPriority() core.RoutingPriority { + if m != nil { + return m.Priority + } + return core.RoutingPriority_DEFAULT +} + +func (m *CircuitBreakers_Thresholds) GetMaxConnections() *types.UInt32Value { + if m != nil { + return m.MaxConnections + } + return nil +} + +func (m *CircuitBreakers_Thresholds) GetMaxPendingRequests() *types.UInt32Value { + if m != nil { + return m.MaxPendingRequests + } + return nil +} + +func (m *CircuitBreakers_Thresholds) GetMaxRequests() *types.UInt32Value { + if m != nil { + return m.MaxRequests + } + return nil +} + +func (m *CircuitBreakers_Thresholds) GetMaxRetries() *types.UInt32Value { + if m != nil { + return m.MaxRetries + } + return nil +} + +func init() { + proto.RegisterType((*CircuitBreakers)(nil), "envoy.api.v2.cluster.CircuitBreakers") + proto.RegisterType((*CircuitBreakers_Thresholds)(nil), "envoy.api.v2.cluster.CircuitBreakers.Thresholds") +} +func (this *CircuitBreakers) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*CircuitBreakers) + if !ok { + that2, ok := that.(CircuitBreakers) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if len(this.Thresholds) != len(that1.Thresholds) { + return false + } + for i := range this.Thresholds { + if !this.Thresholds[i].Equal(that1.Thresholds[i]) { + return false + } + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *CircuitBreakers_Thresholds) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*CircuitBreakers_Thresholds) + if !ok { + that2, ok := that.(CircuitBreakers_Thresholds) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Priority != that1.Priority { + return false + } + if !this.MaxConnections.Equal(that1.MaxConnections) { + return false + } + if !this.MaxPendingRequests.Equal(that1.MaxPendingRequests) { + return false + } + if !this.MaxRequests.Equal(that1.MaxRequests) { + return false + } + if !this.MaxRetries.Equal(that1.MaxRetries) { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (m *CircuitBreakers) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *CircuitBreakers) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Thresholds) > 0 { + for _, msg := range m.Thresholds { + dAtA[i] = 0xa + i++ + i = encodeVarintCircuitBreaker(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *CircuitBreakers_Thresholds) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *CircuitBreakers_Thresholds) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Priority != 0 { + dAtA[i] = 0x8 + i++ + i = encodeVarintCircuitBreaker(dAtA, i, uint64(m.Priority)) + } + if m.MaxConnections != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintCircuitBreaker(dAtA, i, uint64(m.MaxConnections.Size())) + n1, err := m.MaxConnections.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n1 + } + if m.MaxPendingRequests != nil { + dAtA[i] = 0x1a + i++ + i = encodeVarintCircuitBreaker(dAtA, i, uint64(m.MaxPendingRequests.Size())) + n2, err := m.MaxPendingRequests.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n2 + } + if m.MaxRequests != nil { + dAtA[i] = 0x22 + i++ + i = encodeVarintCircuitBreaker(dAtA, i, uint64(m.MaxRequests.Size())) + n3, err := m.MaxRequests.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n3 + } + if m.MaxRetries != nil { + dAtA[i] = 0x2a + i++ + i = encodeVarintCircuitBreaker(dAtA, i, uint64(m.MaxRetries.Size())) + n4, err := m.MaxRetries.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n4 + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func encodeVarintCircuitBreaker(dAtA []byte, offset int, v uint64) int { + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return offset + 1 +} +func (m *CircuitBreakers) Size() (n int) { + var l int + _ = l + if len(m.Thresholds) > 0 { + for _, e := range m.Thresholds { + l = e.Size() + n += 1 + l + sovCircuitBreaker(uint64(l)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *CircuitBreakers_Thresholds) Size() (n int) { + var l int + _ = l + if m.Priority != 0 { + n += 1 + sovCircuitBreaker(uint64(m.Priority)) + } + if m.MaxConnections != nil { + l = m.MaxConnections.Size() + n += 1 + l + sovCircuitBreaker(uint64(l)) + } + if m.MaxPendingRequests != nil { + l = m.MaxPendingRequests.Size() + n += 1 + l + sovCircuitBreaker(uint64(l)) + } + if m.MaxRequests != nil { + l = m.MaxRequests.Size() + n += 1 + l + sovCircuitBreaker(uint64(l)) + } + if m.MaxRetries != nil { + l = m.MaxRetries.Size() + n += 1 + l + sovCircuitBreaker(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func sovCircuitBreaker(x uint64) (n int) { + for { + n++ + x >>= 7 + if x == 0 { + break + } + } + return n +} +func sozCircuitBreaker(x uint64) (n int) { + return sovCircuitBreaker(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *CircuitBreakers) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCircuitBreaker + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: CircuitBreakers: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CircuitBreakers: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Thresholds", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCircuitBreaker + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCircuitBreaker + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Thresholds = append(m.Thresholds, &CircuitBreakers_Thresholds{}) + if err := m.Thresholds[len(m.Thresholds)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipCircuitBreaker(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthCircuitBreaker + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CircuitBreakers_Thresholds) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCircuitBreaker + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Thresholds: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Thresholds: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Priority", wireType) + } + m.Priority = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCircuitBreaker + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Priority |= (core.RoutingPriority(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxConnections", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCircuitBreaker + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCircuitBreaker + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.MaxConnections == nil { + m.MaxConnections = &types.UInt32Value{} + } + if err := m.MaxConnections.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxPendingRequests", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCircuitBreaker + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCircuitBreaker + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.MaxPendingRequests == nil { + m.MaxPendingRequests = &types.UInt32Value{} + } + if err := m.MaxPendingRequests.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxRequests", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCircuitBreaker + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCircuitBreaker + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.MaxRequests == nil { + m.MaxRequests = &types.UInt32Value{} + } + if err := m.MaxRequests.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxRetries", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCircuitBreaker + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCircuitBreaker + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.MaxRetries == nil { + m.MaxRetries = &types.UInt32Value{} + } + if err := m.MaxRetries.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipCircuitBreaker(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthCircuitBreaker + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipCircuitBreaker(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowCircuitBreaker + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowCircuitBreaker + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + return iNdEx, nil + case 1: + iNdEx += 8 + return iNdEx, nil + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowCircuitBreaker + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + iNdEx += length + if length < 0 { + return 0, ErrInvalidLengthCircuitBreaker + } + return iNdEx, nil + case 3: + for { + var innerWire uint64 + var start int = iNdEx + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowCircuitBreaker + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + innerWire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + innerWireType := int(innerWire & 0x7) + if innerWireType == 4 { + break + } + next, err := skipCircuitBreaker(dAtA[start:]) + if err != nil { + return 0, err + } + iNdEx = start + next + } + return iNdEx, nil + case 4: + return iNdEx, nil + case 5: + iNdEx += 4 + return iNdEx, nil + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + } + panic("unreachable") +} + +var ( + ErrInvalidLengthCircuitBreaker = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowCircuitBreaker = fmt.Errorf("proto: integer overflow") +) + +func init() { + proto.RegisterFile("envoy/api/v2/cluster/circuit_breaker.proto", fileDescriptor_circuit_breaker_f0d66cc80ef03e29) +} + +var fileDescriptor_circuit_breaker_f0d66cc80ef03e29 = []byte{ + // 381 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x91, 0xcf, 0xaa, 0xd3, 0x40, + 0x14, 0x87, 0x99, 0xd6, 0x7f, 0x4c, 0xe4, 0x5e, 0x08, 0x45, 0x42, 0xb9, 0x84, 0x72, 0x57, 0xc5, + 0xc5, 0x8c, 0xcc, 0x5d, 0xab, 0xd8, 0xd2, 0x85, 0x9b, 0x52, 0xa2, 0x76, 0xe1, 0xa6, 0x4c, 0xd2, + 0x63, 0x3a, 0x98, 0xcc, 0x8c, 0x33, 0x93, 0x9a, 0xbe, 0x91, 0xf8, 0x24, 0xba, 0xf3, 0x11, 0x24, + 0xbe, 0x88, 0x34, 0x13, 0x53, 0x2d, 0x2e, 0xba, 0x3b, 0x73, 0xce, 0xef, 0xfb, 0x38, 0x9c, 0xc1, + 0x4f, 0x41, 0xee, 0xd5, 0x81, 0x72, 0x2d, 0xe8, 0x9e, 0xd1, 0xac, 0xa8, 0xac, 0x03, 0x43, 0x33, + 0x61, 0xb2, 0x4a, 0xb8, 0x4d, 0x6a, 0x80, 0x7f, 0x04, 0x43, 0xb4, 0x51, 0x4e, 0x85, 0xa3, 0x36, + 0x4b, 0xb8, 0x16, 0x64, 0xcf, 0x48, 0x97, 0x1d, 0xdf, 0xfc, 0x6b, 0x50, 0x06, 0x68, 0xca, 0x2d, + 0x78, 0x66, 0x1c, 0xe7, 0x4a, 0xe5, 0x05, 0xd0, 0xf6, 0x95, 0x56, 0x1f, 0xe8, 0x67, 0xc3, 0xb5, + 0x06, 0x63, 0xbb, 0xf9, 0x28, 0x57, 0xb9, 0x6a, 0x4b, 0x7a, 0xac, 0x7c, 0xf7, 0xf6, 0xfb, 0x10, + 0x5f, 0xcf, 0xfd, 0x0e, 0x33, 0xbf, 0x82, 0x0d, 0x57, 0x18, 0xbb, 0x9d, 0x01, 0xbb, 0x53, 0xc5, + 0xd6, 0x46, 0x68, 0x32, 0x9c, 0x06, 0xec, 0x19, 0xf9, 0xdf, 0x4a, 0xe4, 0x0c, 0x25, 0x6f, 0x7b, + 0x2e, 0xf9, 0xcb, 0x31, 0xfe, 0x35, 0xc0, 0xf8, 0x34, 0x0a, 0x5f, 0xe0, 0x47, 0xda, 0x08, 0x65, + 0x84, 0x3b, 0x44, 0x68, 0x82, 0xa6, 0x57, 0xec, 0xf6, 0x4c, 0xaf, 0x0c, 0x90, 0x44, 0x55, 0x4e, + 0xc8, 0x7c, 0xd5, 0x25, 0x93, 0x9e, 0x09, 0x17, 0xf8, 0xba, 0xe4, 0xf5, 0x26, 0x53, 0x52, 0x42, + 0xe6, 0x84, 0x92, 0x36, 0x1a, 0x4c, 0xd0, 0x34, 0x60, 0x37, 0xc4, 0x1f, 0x81, 0xfc, 0x39, 0x02, + 0x79, 0xf7, 0x5a, 0xba, 0x3b, 0xb6, 0xe6, 0x45, 0x05, 0xc9, 0x55, 0xc9, 0xeb, 0xf9, 0x89, 0x09, + 0x97, 0x78, 0x74, 0xd4, 0x68, 0x90, 0x5b, 0x21, 0xf3, 0x8d, 0x81, 0x4f, 0x15, 0x58, 0x67, 0xa3, + 0xe1, 0x05, 0xae, 0xb0, 0xe4, 0xf5, 0xca, 0x83, 0x49, 0xc7, 0x85, 0x2f, 0xf1, 0xe3, 0xa3, 0xaf, + 0xf7, 0xdc, 0xbb, 0xc0, 0x13, 0x94, 0xbc, 0xee, 0x05, 0xcf, 0x71, 0xe0, 0x05, 0xce, 0x08, 0xb0, + 0xd1, 0xfd, 0x0b, 0x78, 0xdc, 0xf2, 0x6d, 0x7e, 0xc6, 0xbe, 0x34, 0x31, 0xfa, 0xd6, 0xc4, 0xe8, + 0x47, 0x13, 0xa3, 0x9f, 0x4d, 0x8c, 0xde, 0x3f, 0xec, 0xfe, 0xe9, 0xeb, 0xe0, 0xc9, 0xa2, 0xbd, + 0xef, 0x2b, 0x2d, 0xc8, 0x9a, 0x91, 0xb9, 0x6f, 0x2f, 0xdf, 0xa4, 0x0f, 0x5a, 0xeb, 0xdd, 0xef, + 0x00, 0x00, 0x00, 0xff, 0xff, 0x44, 0x76, 0x3e, 0xd5, 0x9e, 0x02, 0x00, 0x00, +} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/cluster/circuit_breaker.pb.validate.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/cluster/circuit_breaker.pb.validate.go new file mode 100644 index 000000000000..20b3ac1394e8 --- /dev/null +++ b/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/cluster/circuit_breaker.pb.validate.go @@ -0,0 +1,176 @@ +// Code generated by protoc-gen-validate +// source: envoy/api/v2/cluster/circuit_breaker.proto +// DO NOT EDIT!!! + +package cluster + +import ( + "bytes" + "errors" + "fmt" + "net" + "net/mail" + "net/url" + "regexp" + "strings" + "time" + "unicode/utf8" + + "github.com/gogo/protobuf/types" +) + +// ensure the imports are used +var ( + _ = bytes.MinRead + _ = errors.New("") + _ = fmt.Print + _ = utf8.UTFMax + _ = (*regexp.Regexp)(nil) + _ = (*strings.Reader)(nil) + _ = net.IPv4len + _ = time.Duration(0) + _ = (*url.URL)(nil) + _ = (*mail.Address)(nil) + _ = types.DynamicAny{} +) + +// Validate checks the field values on CircuitBreakers with the rules defined +// in the proto definition for this message. If any rules are violated, an +// error is returned. +func (m *CircuitBreakers) Validate() error { + if m == nil { + return nil + } + + for idx, item := range m.GetThresholds() { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return CircuitBreakersValidationError{ + Field: fmt.Sprintf("Thresholds[%v]", idx), + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + } + + return nil +} + +// CircuitBreakersValidationError is the validation error returned by +// CircuitBreakers.Validate if the designated constraints aren't met. +type CircuitBreakersValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e CircuitBreakersValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sCircuitBreakers.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = CircuitBreakersValidationError{} + +// Validate checks the field values on CircuitBreakers_Thresholds with the +// rules defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *CircuitBreakers_Thresholds) Validate() error { + if m == nil { + return nil + } + + // no validation rules for Priority + + if v, ok := interface{}(m.GetMaxConnections()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return CircuitBreakers_ThresholdsValidationError{ + Field: "MaxConnections", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + if v, ok := interface{}(m.GetMaxPendingRequests()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return CircuitBreakers_ThresholdsValidationError{ + Field: "MaxPendingRequests", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + if v, ok := interface{}(m.GetMaxRequests()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return CircuitBreakers_ThresholdsValidationError{ + Field: "MaxRequests", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + if v, ok := interface{}(m.GetMaxRetries()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return CircuitBreakers_ThresholdsValidationError{ + Field: "MaxRetries", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + return nil +} + +// CircuitBreakers_ThresholdsValidationError is the validation error returned +// by CircuitBreakers_Thresholds.Validate if the designated constraints aren't met. +type CircuitBreakers_ThresholdsValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e CircuitBreakers_ThresholdsValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sCircuitBreakers_Thresholds.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = CircuitBreakers_ThresholdsValidationError{} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/cluster/outlier_detection.pb.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/cluster/outlier_detection.pb.go new file mode 100644 index 000000000000..f1e30cf1590c --- /dev/null +++ b/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/cluster/outlier_detection.pb.go @@ -0,0 +1,1020 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: envoy/api/v2/cluster/outlier_detection.proto + +package cluster + +import proto "github.com/gogo/protobuf/proto" +import fmt "fmt" +import math "math" +import _ "github.com/gogo/protobuf/gogoproto" +import types "github.com/gogo/protobuf/types" +import _ "github.com/lyft/protoc-gen-validate/validate" + +import bytes "bytes" + +import io "io" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package + +// See the :ref:`architecture overview ` for +// more information on outlier detection. +type OutlierDetection struct { + // The number of consecutive 5xx responses before a consecutive 5xx ejection + // occurs. Defaults to 5. + Consecutive_5Xx *types.UInt32Value `protobuf:"bytes,1,opt,name=consecutive_5xx,json=consecutive5xx" json:"consecutive_5xx,omitempty"` + // The time interval between ejection analysis sweeps. This can result in + // both new ejections as well as hosts being returned to service. Defaults + // to 10000ms or 10s. + Interval *types.Duration `protobuf:"bytes,2,opt,name=interval" json:"interval,omitempty"` + // The base time that a host is ejected for. The real time is equal to the + // base time multiplied by the number of times the host has been ejected. + // Defaults to 30000ms or 30s. + BaseEjectionTime *types.Duration `protobuf:"bytes,3,opt,name=base_ejection_time,json=baseEjectionTime" json:"base_ejection_time,omitempty"` + // The maximum % of an upstream cluster that can be ejected due to outlier + // detection. Defaults to 10% but will eject at least one host regardless of the value. + MaxEjectionPercent *types.UInt32Value `protobuf:"bytes,4,opt,name=max_ejection_percent,json=maxEjectionPercent" json:"max_ejection_percent,omitempty"` + // The % chance that a host will be actually ejected when an outlier status + // is detected through consecutive 5xx. This setting can be used to disable + // ejection or to ramp it up slowly. Defaults to 100. + EnforcingConsecutive_5Xx *types.UInt32Value `protobuf:"bytes,5,opt,name=enforcing_consecutive_5xx,json=enforcingConsecutive5xx" json:"enforcing_consecutive_5xx,omitempty"` + // The % chance that a host will be actually ejected when an outlier status + // is detected through success rate statistics. This setting can be used to + // disable ejection or to ramp it up slowly. Defaults to 100. + EnforcingSuccessRate *types.UInt32Value `protobuf:"bytes,6,opt,name=enforcing_success_rate,json=enforcingSuccessRate" json:"enforcing_success_rate,omitempty"` + // The number of hosts in a cluster that must have enough request volume to + // detect success rate outliers. If the number of hosts is less than this + // setting, outlier detection via success rate statistics is not performed + // for any host in the cluster. Defaults to 5. + SuccessRateMinimumHosts *types.UInt32Value `protobuf:"bytes,7,opt,name=success_rate_minimum_hosts,json=successRateMinimumHosts" json:"success_rate_minimum_hosts,omitempty"` + // The minimum number of total requests that must be collected in one + // interval (as defined by the interval duration above) to include this host + // in success rate based outlier detection. If the volume is lower than this + // setting, outlier detection via success rate statistics is not performed + // for that host. Defaults to 100. + SuccessRateRequestVolume *types.UInt32Value `protobuf:"bytes,8,opt,name=success_rate_request_volume,json=successRateRequestVolume" json:"success_rate_request_volume,omitempty"` + // This factor is used to determine the ejection threshold for success rate + // outlier ejection. The ejection threshold is the difference between the + // mean success rate, and the product of this factor and the standard + // deviation of the mean success rate: mean - (stdev * + // success_rate_stdev_factor). This factor is divided by a thousand to get a + // double. That is, if the desired factor is 1.9, the runtime value should + // be 1900. Defaults to 1900. + SuccessRateStdevFactor *types.UInt32Value `protobuf:"bytes,9,opt,name=success_rate_stdev_factor,json=successRateStdevFactor" json:"success_rate_stdev_factor,omitempty"` + // The number of consecutive gateway failures (502, 503, 504 status or + // connection errors that are mapped to one of those status codes) before a + // consecutive gateway failure ejection occurs. Defaults to 5. + ConsecutiveGatewayFailure *types.UInt32Value `protobuf:"bytes,10,opt,name=consecutive_gateway_failure,json=consecutiveGatewayFailure" json:"consecutive_gateway_failure,omitempty"` + // The % chance that a host will be actually ejected when an outlier status + // is detected through consecutive gateway failures. This setting can be + // used to disable ejection or to ramp it up slowly. Defaults to 0. + EnforcingConsecutiveGatewayFailure *types.UInt32Value `protobuf:"bytes,11,opt,name=enforcing_consecutive_gateway_failure,json=enforcingConsecutiveGatewayFailure" json:"enforcing_consecutive_gateway_failure,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *OutlierDetection) Reset() { *m = OutlierDetection{} } +func (m *OutlierDetection) String() string { return proto.CompactTextString(m) } +func (*OutlierDetection) ProtoMessage() {} +func (*OutlierDetection) Descriptor() ([]byte, []int) { + return fileDescriptor_outlier_detection_ca1bd929cef49cfa, []int{0} +} +func (m *OutlierDetection) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *OutlierDetection) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_OutlierDetection.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *OutlierDetection) XXX_Merge(src proto.Message) { + xxx_messageInfo_OutlierDetection.Merge(dst, src) +} +func (m *OutlierDetection) XXX_Size() int { + return m.Size() +} +func (m *OutlierDetection) XXX_DiscardUnknown() { + xxx_messageInfo_OutlierDetection.DiscardUnknown(m) +} + +var xxx_messageInfo_OutlierDetection proto.InternalMessageInfo + +func (m *OutlierDetection) GetConsecutive_5Xx() *types.UInt32Value { + if m != nil { + return m.Consecutive_5Xx + } + return nil +} + +func (m *OutlierDetection) GetInterval() *types.Duration { + if m != nil { + return m.Interval + } + return nil +} + +func (m *OutlierDetection) GetBaseEjectionTime() *types.Duration { + if m != nil { + return m.BaseEjectionTime + } + return nil +} + +func (m *OutlierDetection) GetMaxEjectionPercent() *types.UInt32Value { + if m != nil { + return m.MaxEjectionPercent + } + return nil +} + +func (m *OutlierDetection) GetEnforcingConsecutive_5Xx() *types.UInt32Value { + if m != nil { + return m.EnforcingConsecutive_5Xx + } + return nil +} + +func (m *OutlierDetection) GetEnforcingSuccessRate() *types.UInt32Value { + if m != nil { + return m.EnforcingSuccessRate + } + return nil +} + +func (m *OutlierDetection) GetSuccessRateMinimumHosts() *types.UInt32Value { + if m != nil { + return m.SuccessRateMinimumHosts + } + return nil +} + +func (m *OutlierDetection) GetSuccessRateRequestVolume() *types.UInt32Value { + if m != nil { + return m.SuccessRateRequestVolume + } + return nil +} + +func (m *OutlierDetection) GetSuccessRateStdevFactor() *types.UInt32Value { + if m != nil { + return m.SuccessRateStdevFactor + } + return nil +} + +func (m *OutlierDetection) GetConsecutiveGatewayFailure() *types.UInt32Value { + if m != nil { + return m.ConsecutiveGatewayFailure + } + return nil +} + +func (m *OutlierDetection) GetEnforcingConsecutiveGatewayFailure() *types.UInt32Value { + if m != nil { + return m.EnforcingConsecutiveGatewayFailure + } + return nil +} + +func init() { + proto.RegisterType((*OutlierDetection)(nil), "envoy.api.v2.cluster.OutlierDetection") +} +func (this *OutlierDetection) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*OutlierDetection) + if !ok { + that2, ok := that.(OutlierDetection) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.Consecutive_5Xx.Equal(that1.Consecutive_5Xx) { + return false + } + if !this.Interval.Equal(that1.Interval) { + return false + } + if !this.BaseEjectionTime.Equal(that1.BaseEjectionTime) { + return false + } + if !this.MaxEjectionPercent.Equal(that1.MaxEjectionPercent) { + return false + } + if !this.EnforcingConsecutive_5Xx.Equal(that1.EnforcingConsecutive_5Xx) { + return false + } + if !this.EnforcingSuccessRate.Equal(that1.EnforcingSuccessRate) { + return false + } + if !this.SuccessRateMinimumHosts.Equal(that1.SuccessRateMinimumHosts) { + return false + } + if !this.SuccessRateRequestVolume.Equal(that1.SuccessRateRequestVolume) { + return false + } + if !this.SuccessRateStdevFactor.Equal(that1.SuccessRateStdevFactor) { + return false + } + if !this.ConsecutiveGatewayFailure.Equal(that1.ConsecutiveGatewayFailure) { + return false + } + if !this.EnforcingConsecutiveGatewayFailure.Equal(that1.EnforcingConsecutiveGatewayFailure) { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (m *OutlierDetection) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *OutlierDetection) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Consecutive_5Xx != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintOutlierDetection(dAtA, i, uint64(m.Consecutive_5Xx.Size())) + n1, err := m.Consecutive_5Xx.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n1 + } + if m.Interval != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintOutlierDetection(dAtA, i, uint64(m.Interval.Size())) + n2, err := m.Interval.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n2 + } + if m.BaseEjectionTime != nil { + dAtA[i] = 0x1a + i++ + i = encodeVarintOutlierDetection(dAtA, i, uint64(m.BaseEjectionTime.Size())) + n3, err := m.BaseEjectionTime.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n3 + } + if m.MaxEjectionPercent != nil { + dAtA[i] = 0x22 + i++ + i = encodeVarintOutlierDetection(dAtA, i, uint64(m.MaxEjectionPercent.Size())) + n4, err := m.MaxEjectionPercent.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n4 + } + if m.EnforcingConsecutive_5Xx != nil { + dAtA[i] = 0x2a + i++ + i = encodeVarintOutlierDetection(dAtA, i, uint64(m.EnforcingConsecutive_5Xx.Size())) + n5, err := m.EnforcingConsecutive_5Xx.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n5 + } + if m.EnforcingSuccessRate != nil { + dAtA[i] = 0x32 + i++ + i = encodeVarintOutlierDetection(dAtA, i, uint64(m.EnforcingSuccessRate.Size())) + n6, err := m.EnforcingSuccessRate.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n6 + } + if m.SuccessRateMinimumHosts != nil { + dAtA[i] = 0x3a + i++ + i = encodeVarintOutlierDetection(dAtA, i, uint64(m.SuccessRateMinimumHosts.Size())) + n7, err := m.SuccessRateMinimumHosts.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n7 + } + if m.SuccessRateRequestVolume != nil { + dAtA[i] = 0x42 + i++ + i = encodeVarintOutlierDetection(dAtA, i, uint64(m.SuccessRateRequestVolume.Size())) + n8, err := m.SuccessRateRequestVolume.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n8 + } + if m.SuccessRateStdevFactor != nil { + dAtA[i] = 0x4a + i++ + i = encodeVarintOutlierDetection(dAtA, i, uint64(m.SuccessRateStdevFactor.Size())) + n9, err := m.SuccessRateStdevFactor.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n9 + } + if m.ConsecutiveGatewayFailure != nil { + dAtA[i] = 0x52 + i++ + i = encodeVarintOutlierDetection(dAtA, i, uint64(m.ConsecutiveGatewayFailure.Size())) + n10, err := m.ConsecutiveGatewayFailure.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n10 + } + if m.EnforcingConsecutiveGatewayFailure != nil { + dAtA[i] = 0x5a + i++ + i = encodeVarintOutlierDetection(dAtA, i, uint64(m.EnforcingConsecutiveGatewayFailure.Size())) + n11, err := m.EnforcingConsecutiveGatewayFailure.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n11 + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func encodeVarintOutlierDetection(dAtA []byte, offset int, v uint64) int { + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return offset + 1 +} +func (m *OutlierDetection) Size() (n int) { + var l int + _ = l + if m.Consecutive_5Xx != nil { + l = m.Consecutive_5Xx.Size() + n += 1 + l + sovOutlierDetection(uint64(l)) + } + if m.Interval != nil { + l = m.Interval.Size() + n += 1 + l + sovOutlierDetection(uint64(l)) + } + if m.BaseEjectionTime != nil { + l = m.BaseEjectionTime.Size() + n += 1 + l + sovOutlierDetection(uint64(l)) + } + if m.MaxEjectionPercent != nil { + l = m.MaxEjectionPercent.Size() + n += 1 + l + sovOutlierDetection(uint64(l)) + } + if m.EnforcingConsecutive_5Xx != nil { + l = m.EnforcingConsecutive_5Xx.Size() + n += 1 + l + sovOutlierDetection(uint64(l)) + } + if m.EnforcingSuccessRate != nil { + l = m.EnforcingSuccessRate.Size() + n += 1 + l + sovOutlierDetection(uint64(l)) + } + if m.SuccessRateMinimumHosts != nil { + l = m.SuccessRateMinimumHosts.Size() + n += 1 + l + sovOutlierDetection(uint64(l)) + } + if m.SuccessRateRequestVolume != nil { + l = m.SuccessRateRequestVolume.Size() + n += 1 + l + sovOutlierDetection(uint64(l)) + } + if m.SuccessRateStdevFactor != nil { + l = m.SuccessRateStdevFactor.Size() + n += 1 + l + sovOutlierDetection(uint64(l)) + } + if m.ConsecutiveGatewayFailure != nil { + l = m.ConsecutiveGatewayFailure.Size() + n += 1 + l + sovOutlierDetection(uint64(l)) + } + if m.EnforcingConsecutiveGatewayFailure != nil { + l = m.EnforcingConsecutiveGatewayFailure.Size() + n += 1 + l + sovOutlierDetection(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func sovOutlierDetection(x uint64) (n int) { + for { + n++ + x >>= 7 + if x == 0 { + break + } + } + return n +} +func sozOutlierDetection(x uint64) (n int) { + return sovOutlierDetection(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *OutlierDetection) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOutlierDetection + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: OutlierDetection: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: OutlierDetection: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Consecutive_5Xx", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOutlierDetection + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthOutlierDetection + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Consecutive_5Xx == nil { + m.Consecutive_5Xx = &types.UInt32Value{} + } + if err := m.Consecutive_5Xx.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Interval", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOutlierDetection + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthOutlierDetection + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Interval == nil { + m.Interval = &types.Duration{} + } + if err := m.Interval.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BaseEjectionTime", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOutlierDetection + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthOutlierDetection + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.BaseEjectionTime == nil { + m.BaseEjectionTime = &types.Duration{} + } + if err := m.BaseEjectionTime.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxEjectionPercent", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOutlierDetection + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthOutlierDetection + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.MaxEjectionPercent == nil { + m.MaxEjectionPercent = &types.UInt32Value{} + } + if err := m.MaxEjectionPercent.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field EnforcingConsecutive_5Xx", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOutlierDetection + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthOutlierDetection + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.EnforcingConsecutive_5Xx == nil { + m.EnforcingConsecutive_5Xx = &types.UInt32Value{} + } + if err := m.EnforcingConsecutive_5Xx.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field EnforcingSuccessRate", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOutlierDetection + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthOutlierDetection + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.EnforcingSuccessRate == nil { + m.EnforcingSuccessRate = &types.UInt32Value{} + } + if err := m.EnforcingSuccessRate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SuccessRateMinimumHosts", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOutlierDetection + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthOutlierDetection + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.SuccessRateMinimumHosts == nil { + m.SuccessRateMinimumHosts = &types.UInt32Value{} + } + if err := m.SuccessRateMinimumHosts.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SuccessRateRequestVolume", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOutlierDetection + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthOutlierDetection + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.SuccessRateRequestVolume == nil { + m.SuccessRateRequestVolume = &types.UInt32Value{} + } + if err := m.SuccessRateRequestVolume.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SuccessRateStdevFactor", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOutlierDetection + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthOutlierDetection + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.SuccessRateStdevFactor == nil { + m.SuccessRateStdevFactor = &types.UInt32Value{} + } + if err := m.SuccessRateStdevFactor.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 10: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ConsecutiveGatewayFailure", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOutlierDetection + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthOutlierDetection + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.ConsecutiveGatewayFailure == nil { + m.ConsecutiveGatewayFailure = &types.UInt32Value{} + } + if err := m.ConsecutiveGatewayFailure.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 11: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field EnforcingConsecutiveGatewayFailure", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOutlierDetection + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthOutlierDetection + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.EnforcingConsecutiveGatewayFailure == nil { + m.EnforcingConsecutiveGatewayFailure = &types.UInt32Value{} + } + if err := m.EnforcingConsecutiveGatewayFailure.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipOutlierDetection(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthOutlierDetection + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipOutlierDetection(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowOutlierDetection + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowOutlierDetection + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + return iNdEx, nil + case 1: + iNdEx += 8 + return iNdEx, nil + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowOutlierDetection + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + iNdEx += length + if length < 0 { + return 0, ErrInvalidLengthOutlierDetection + } + return iNdEx, nil + case 3: + for { + var innerWire uint64 + var start int = iNdEx + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowOutlierDetection + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + innerWire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + innerWireType := int(innerWire & 0x7) + if innerWireType == 4 { + break + } + next, err := skipOutlierDetection(dAtA[start:]) + if err != nil { + return 0, err + } + iNdEx = start + next + } + return iNdEx, nil + case 4: + return iNdEx, nil + case 5: + iNdEx += 4 + return iNdEx, nil + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + } + panic("unreachable") +} + +var ( + ErrInvalidLengthOutlierDetection = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowOutlierDetection = fmt.Errorf("proto: integer overflow") +) + +func init() { + proto.RegisterFile("envoy/api/v2/cluster/outlier_detection.proto", fileDescriptor_outlier_detection_ca1bd929cef49cfa) +} + +var fileDescriptor_outlier_detection_ca1bd929cef49cfa = []byte{ + // 537 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x94, 0xcb, 0x6e, 0xd3, 0x4c, + 0x14, 0xc7, 0x3f, 0xa7, 0xf7, 0xa9, 0xf4, 0x51, 0x8d, 0xa2, 0x66, 0xd2, 0xa2, 0x08, 0x55, 0x42, + 0x82, 0x0a, 0xd9, 0x52, 0xaa, 0x3e, 0x40, 0xd3, 0xa6, 0xc0, 0x82, 0x8b, 0x12, 0x08, 0x42, 0x80, + 0x46, 0x13, 0xe7, 0xc4, 0x0c, 0xb2, 0x3d, 0x66, 0x2e, 0xae, 0xcb, 0x13, 0xa1, 0x3e, 0x02, 0x2b, + 0x96, 0x2c, 0x79, 0x04, 0x94, 0x1d, 0xcf, 0xc0, 0x06, 0xd9, 0x93, 0x8b, 0xd3, 0x56, 0x22, 0xd9, + 0x8d, 0x3c, 0xf3, 0xfb, 0xfd, 0x8f, 0xcf, 0x1c, 0x0d, 0x7a, 0x04, 0x71, 0x2a, 0x2e, 0x3d, 0x96, + 0x70, 0x2f, 0x6d, 0x7a, 0x7e, 0x68, 0x94, 0x06, 0xe9, 0x09, 0xa3, 0x43, 0x0e, 0x92, 0x0e, 0x40, + 0x83, 0xaf, 0xb9, 0x88, 0xdd, 0x44, 0x0a, 0x2d, 0x70, 0xb5, 0x38, 0xed, 0xb2, 0x84, 0xbb, 0x69, + 0xd3, 0x1d, 0x9f, 0xde, 0x6b, 0x04, 0x42, 0x04, 0x21, 0x78, 0xc5, 0x99, 0xbe, 0x19, 0x7a, 0x03, + 0x23, 0xd9, 0x8c, 0xba, 0xb9, 0x7f, 0x21, 0x59, 0x92, 0x80, 0x54, 0xe3, 0xfd, 0x5a, 0xca, 0x42, + 0x3e, 0x60, 0x1a, 0xbc, 0xc9, 0x62, 0xbc, 0x51, 0x0d, 0x44, 0x20, 0x8a, 0xa5, 0x97, 0xaf, 0xec, + 0xd7, 0x83, 0x3f, 0x1b, 0x68, 0xe7, 0x85, 0x2d, 0xf0, 0x6c, 0x52, 0x1f, 0x6e, 0xa3, 0x3b, 0xbe, + 0x88, 0x15, 0xf8, 0x46, 0xf3, 0x14, 0xe8, 0x71, 0x96, 0x11, 0xe7, 0x9e, 0xf3, 0x60, 0xbb, 0x79, + 0xd7, 0xb5, 0xe9, 0xee, 0x24, 0xdd, 0x7d, 0xfd, 0x34, 0xd6, 0x47, 0xcd, 0x1e, 0x0b, 0x0d, 0x74, + 0xfe, 0x2f, 0x41, 0xc7, 0x59, 0x86, 0x4f, 0xd0, 0x26, 0x8f, 0x35, 0xc8, 0x94, 0x85, 0xa4, 0x52, + 0xf0, 0xf5, 0x1b, 0xfc, 0xd9, 0xf8, 0xef, 0x5a, 0xe8, 0xdb, 0xef, 0xef, 0x2b, 0x6b, 0x57, 0x4e, + 0xe5, 0xf0, 0xbf, 0xce, 0x14, 0xc3, 0x5d, 0x84, 0xfb, 0x4c, 0x01, 0x85, 0x4f, 0xb6, 0x34, 0xaa, + 0x79, 0x04, 0x64, 0x65, 0x19, 0xd9, 0x4e, 0x2e, 0x68, 0x8f, 0xf9, 0x57, 0x3c, 0x02, 0xfc, 0x16, + 0x55, 0x23, 0x96, 0xcd, 0x9c, 0x09, 0x48, 0x1f, 0x62, 0x4d, 0x56, 0xff, 0xfd, 0x8f, 0xad, 0xad, + 0xdc, 0xbc, 0x7a, 0x58, 0x21, 0x83, 0x0e, 0x8e, 0x58, 0x36, 0xf1, 0xbe, 0xb4, 0x0a, 0xec, 0xa3, + 0x3a, 0xc4, 0x43, 0x21, 0x7d, 0x1e, 0x07, 0xf4, 0x7a, 0x0f, 0xd7, 0x96, 0xf3, 0xd7, 0xa6, 0xa6, + 0xd3, 0xf9, 0xbe, 0x7e, 0x40, 0xbb, 0xb3, 0x10, 0x65, 0x7c, 0x1f, 0x94, 0xa2, 0x92, 0x69, 0x20, + 0xeb, 0xcb, 0x25, 0x54, 0xa7, 0x9a, 0xae, 0xb5, 0x74, 0x98, 0xce, 0xdb, 0xb3, 0x57, 0x96, 0xd2, + 0x88, 0xc7, 0x3c, 0x32, 0x11, 0xfd, 0x28, 0x94, 0x56, 0x64, 0x63, 0x81, 0x41, 0xa8, 0xa9, 0x99, + 0xee, 0x99, 0xa5, 0x9f, 0xe4, 0x30, 0x7e, 0x87, 0xf6, 0xe7, 0xd4, 0x12, 0x3e, 0x1b, 0x50, 0x9a, + 0xa6, 0x22, 0x34, 0x11, 0x90, 0xcd, 0x05, 0xdc, 0xa4, 0xe4, 0xee, 0x58, 0xbc, 0x57, 0xd0, 0xf8, + 0x0d, 0xaa, 0xcf, 0xc9, 0x95, 0x1e, 0x40, 0x4a, 0x87, 0xcc, 0xd7, 0x42, 0x92, 0xad, 0x05, 0xd4, + 0xbb, 0x25, 0x75, 0x37, 0x87, 0xcf, 0x0b, 0x16, 0xbf, 0x47, 0xfb, 0xe5, 0xab, 0x0c, 0x98, 0x86, + 0x0b, 0x76, 0x49, 0x87, 0x8c, 0x87, 0x46, 0x02, 0x41, 0x0b, 0xa8, 0xeb, 0x25, 0xc1, 0x63, 0xcb, + 0x9f, 0x5b, 0x1c, 0x7f, 0x41, 0xf7, 0x6f, 0x1f, 0x99, 0xeb, 0x39, 0xdb, 0xcb, 0x5d, 0xee, 0xc1, + 0x6d, 0xe3, 0x33, 0x9f, 0xdd, 0x7a, 0xf8, 0x75, 0xd4, 0x70, 0x7e, 0x8c, 0x1a, 0xce, 0xcf, 0x51, + 0xc3, 0xf9, 0x35, 0x6a, 0x38, 0x57, 0x95, 0xdd, 0x76, 0xf1, 0x2a, 0x9d, 0x24, 0xdc, 0xed, 0x35, + 0xdd, 0x53, 0xfb, 0x2a, 0x3d, 0xef, 0xf6, 0xd7, 0x8b, 0xbc, 0xa3, 0xbf, 0x01, 0x00, 0x00, 0xff, + 0xff, 0xd4, 0x46, 0xcd, 0x39, 0xe4, 0x04, 0x00, 0x00, +} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/cluster/outlier_detection.pb.validate.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/cluster/outlier_detection.pb.validate.go new file mode 100644 index 000000000000..5e9c820eb2ba --- /dev/null +++ b/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/cluster/outlier_detection.pb.validate.go @@ -0,0 +1,213 @@ +// Code generated by protoc-gen-validate +// source: envoy/api/v2/cluster/outlier_detection.proto +// DO NOT EDIT!!! + +package cluster + +import ( + "bytes" + "errors" + "fmt" + "net" + "net/mail" + "net/url" + "regexp" + "strings" + "time" + "unicode/utf8" + + "github.com/gogo/protobuf/types" +) + +// ensure the imports are used +var ( + _ = bytes.MinRead + _ = errors.New("") + _ = fmt.Print + _ = utf8.UTFMax + _ = (*regexp.Regexp)(nil) + _ = (*strings.Reader)(nil) + _ = net.IPv4len + _ = time.Duration(0) + _ = (*url.URL)(nil) + _ = (*mail.Address)(nil) + _ = types.DynamicAny{} +) + +// Validate checks the field values on OutlierDetection with the rules defined +// in the proto definition for this message. If any rules are violated, an +// error is returned. +func (m *OutlierDetection) Validate() error { + if m == nil { + return nil + } + + if v, ok := interface{}(m.GetConsecutive_5Xx()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return OutlierDetectionValidationError{ + Field: "Consecutive_5Xx", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + if d := m.GetInterval(); d != nil { + dur, err := types.DurationFromProto(d) + if err != nil { + return OutlierDetectionValidationError{ + Field: "Interval", + Reason: "value is not a valid duration", + Cause: err, + } + } + + gt := time.Duration(0*time.Second + 0*time.Nanosecond) + + if dur <= gt { + return OutlierDetectionValidationError{ + Field: "Interval", + Reason: "value must be greater than 0s", + } + } + + } + + if d := m.GetBaseEjectionTime(); d != nil { + dur, err := types.DurationFromProto(d) + if err != nil { + return OutlierDetectionValidationError{ + Field: "BaseEjectionTime", + Reason: "value is not a valid duration", + Cause: err, + } + } + + gt := time.Duration(0*time.Second + 0*time.Nanosecond) + + if dur <= gt { + return OutlierDetectionValidationError{ + Field: "BaseEjectionTime", + Reason: "value must be greater than 0s", + } + } + + } + + if wrapper := m.GetMaxEjectionPercent(); wrapper != nil { + + if wrapper.GetValue() > 100 { + return OutlierDetectionValidationError{ + Field: "MaxEjectionPercent", + Reason: "value must be less than or equal to 100", + } + } + + } + + if wrapper := m.GetEnforcingConsecutive_5Xx(); wrapper != nil { + + if wrapper.GetValue() > 100 { + return OutlierDetectionValidationError{ + Field: "EnforcingConsecutive_5Xx", + Reason: "value must be less than or equal to 100", + } + } + + } + + if wrapper := m.GetEnforcingSuccessRate(); wrapper != nil { + + if wrapper.GetValue() > 100 { + return OutlierDetectionValidationError{ + Field: "EnforcingSuccessRate", + Reason: "value must be less than or equal to 100", + } + } + + } + + if v, ok := interface{}(m.GetSuccessRateMinimumHosts()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return OutlierDetectionValidationError{ + Field: "SuccessRateMinimumHosts", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + if v, ok := interface{}(m.GetSuccessRateRequestVolume()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return OutlierDetectionValidationError{ + Field: "SuccessRateRequestVolume", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + if v, ok := interface{}(m.GetSuccessRateStdevFactor()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return OutlierDetectionValidationError{ + Field: "SuccessRateStdevFactor", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + if v, ok := interface{}(m.GetConsecutiveGatewayFailure()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return OutlierDetectionValidationError{ + Field: "ConsecutiveGatewayFailure", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + if wrapper := m.GetEnforcingConsecutiveGatewayFailure(); wrapper != nil { + + if wrapper.GetValue() > 100 { + return OutlierDetectionValidationError{ + Field: "EnforcingConsecutiveGatewayFailure", + Reason: "value must be less than or equal to 100", + } + } + + } + + return nil +} + +// OutlierDetectionValidationError is the validation error returned by +// OutlierDetection.Validate if the designated constraints aren't met. +type OutlierDetectionValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e OutlierDetectionValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sOutlierDetection.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = OutlierDetectionValidationError{} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/core/address.pb.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/core/address.pb.go new file mode 100644 index 000000000000..abc8a58bfa5d --- /dev/null +++ b/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/core/address.pb.go @@ -0,0 +1,2382 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: envoy/api/v2/core/address.proto + +package core + +import proto "github.com/gogo/protobuf/proto" +import fmt "fmt" +import math "math" +import _ "github.com/gogo/protobuf/gogoproto" +import types "github.com/gogo/protobuf/types" +import _ "github.com/lyft/protoc-gen-validate/validate" + +import bytes "bytes" + +import io "io" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package + +type SocketAddress_Protocol int32 + +const ( + TCP SocketAddress_Protocol = 0 + // [#not-implemented-hide:] + UDP SocketAddress_Protocol = 1 +) + +var SocketAddress_Protocol_name = map[int32]string{ + 0: "TCP", + 1: "UDP", +} +var SocketAddress_Protocol_value = map[string]int32{ + "TCP": 0, + "UDP": 1, +} + +func (x SocketAddress_Protocol) String() string { + return proto.EnumName(SocketAddress_Protocol_name, int32(x)) +} +func (SocketAddress_Protocol) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_address_fe46815faabcb098, []int{1, 0} +} + +type Pipe struct { + // Unix Domain Socket path. On Linux, paths starting with '@' will use the + // abstract namespace. The starting '@' is replaced by a null byte by Envoy. + // Paths starting with '@' will result in an error in environments other than + // Linux. + Path string `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Pipe) Reset() { *m = Pipe{} } +func (m *Pipe) String() string { return proto.CompactTextString(m) } +func (*Pipe) ProtoMessage() {} +func (*Pipe) Descriptor() ([]byte, []int) { + return fileDescriptor_address_fe46815faabcb098, []int{0} +} +func (m *Pipe) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Pipe) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Pipe.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *Pipe) XXX_Merge(src proto.Message) { + xxx_messageInfo_Pipe.Merge(dst, src) +} +func (m *Pipe) XXX_Size() int { + return m.Size() +} +func (m *Pipe) XXX_DiscardUnknown() { + xxx_messageInfo_Pipe.DiscardUnknown(m) +} + +var xxx_messageInfo_Pipe proto.InternalMessageInfo + +func (m *Pipe) GetPath() string { + if m != nil { + return m.Path + } + return "" +} + +type SocketAddress struct { + Protocol SocketAddress_Protocol `protobuf:"varint,1,opt,name=protocol,proto3,enum=envoy.api.v2.core.SocketAddress_Protocol" json:"protocol,omitempty"` + // The address for this socket. :ref:`Listeners ` will bind + // to the address. An empty address is not allowed. Specify ``0.0.0.0`` or ``::`` + // to bind to any address. [#comment:TODO(zuercher) reinstate when implemented: + // It is possible to distinguish a Listener address via the prefix/suffix matching + // in :ref:`FilterChainMatch `.] When used + // within an upstream :ref:`BindConfig `, the address + // controls the source address of outbound connections. For :ref:`clusters + // `, the cluster type determines whether the + // address must be an IP (*STATIC* or *EDS* clusters) or a hostname resolved by DNS + // (*STRICT_DNS* or *LOGICAL_DNS* clusters). Address resolution can be customized + // via :ref:`resolver_name `. + Address string `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty"` + // Types that are valid to be assigned to PortSpecifier: + // *SocketAddress_PortValue + // *SocketAddress_NamedPort + PortSpecifier isSocketAddress_PortSpecifier `protobuf_oneof:"port_specifier"` + // The name of the resolver. This must have been registered with Envoy. If this is + // empty, a context dependent default applies. If address is a hostname this + // should be set for resolution other than DNS. If the address is a concrete + // IP address, no resolution will occur. + ResolverName string `protobuf:"bytes,5,opt,name=resolver_name,json=resolverName,proto3" json:"resolver_name,omitempty"` + // When binding to an IPv6 address above, this enables `IPv4 compatibity + // `_. Binding to ``::`` will + // allow both IPv4 and IPv6 connections, with peer IPv4 addresses mapped into + // IPv6 space as ``::FFFF:``. + Ipv4Compat bool `protobuf:"varint,6,opt,name=ipv4_compat,json=ipv4Compat,proto3" json:"ipv4_compat,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SocketAddress) Reset() { *m = SocketAddress{} } +func (m *SocketAddress) String() string { return proto.CompactTextString(m) } +func (*SocketAddress) ProtoMessage() {} +func (*SocketAddress) Descriptor() ([]byte, []int) { + return fileDescriptor_address_fe46815faabcb098, []int{1} +} +func (m *SocketAddress) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *SocketAddress) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_SocketAddress.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *SocketAddress) XXX_Merge(src proto.Message) { + xxx_messageInfo_SocketAddress.Merge(dst, src) +} +func (m *SocketAddress) XXX_Size() int { + return m.Size() +} +func (m *SocketAddress) XXX_DiscardUnknown() { + xxx_messageInfo_SocketAddress.DiscardUnknown(m) +} + +var xxx_messageInfo_SocketAddress proto.InternalMessageInfo + +type isSocketAddress_PortSpecifier interface { + isSocketAddress_PortSpecifier() + Equal(interface{}) bool + MarshalTo([]byte) (int, error) + Size() int +} + +type SocketAddress_PortValue struct { + PortValue uint32 `protobuf:"varint,3,opt,name=port_value,json=portValue,proto3,oneof"` +} +type SocketAddress_NamedPort struct { + NamedPort string `protobuf:"bytes,4,opt,name=named_port,json=namedPort,proto3,oneof"` +} + +func (*SocketAddress_PortValue) isSocketAddress_PortSpecifier() {} +func (*SocketAddress_NamedPort) isSocketAddress_PortSpecifier() {} + +func (m *SocketAddress) GetPortSpecifier() isSocketAddress_PortSpecifier { + if m != nil { + return m.PortSpecifier + } + return nil +} + +func (m *SocketAddress) GetProtocol() SocketAddress_Protocol { + if m != nil { + return m.Protocol + } + return TCP +} + +func (m *SocketAddress) GetAddress() string { + if m != nil { + return m.Address + } + return "" +} + +func (m *SocketAddress) GetPortValue() uint32 { + if x, ok := m.GetPortSpecifier().(*SocketAddress_PortValue); ok { + return x.PortValue + } + return 0 +} + +func (m *SocketAddress) GetNamedPort() string { + if x, ok := m.GetPortSpecifier().(*SocketAddress_NamedPort); ok { + return x.NamedPort + } + return "" +} + +func (m *SocketAddress) GetResolverName() string { + if m != nil { + return m.ResolverName + } + return "" +} + +func (m *SocketAddress) GetIpv4Compat() bool { + if m != nil { + return m.Ipv4Compat + } + return false +} + +// XXX_OneofFuncs is for the internal use of the proto package. +func (*SocketAddress) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { + return _SocketAddress_OneofMarshaler, _SocketAddress_OneofUnmarshaler, _SocketAddress_OneofSizer, []interface{}{ + (*SocketAddress_PortValue)(nil), + (*SocketAddress_NamedPort)(nil), + } +} + +func _SocketAddress_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { + m := msg.(*SocketAddress) + // port_specifier + switch x := m.PortSpecifier.(type) { + case *SocketAddress_PortValue: + _ = b.EncodeVarint(3<<3 | proto.WireVarint) + _ = b.EncodeVarint(uint64(x.PortValue)) + case *SocketAddress_NamedPort: + _ = b.EncodeVarint(4<<3 | proto.WireBytes) + _ = b.EncodeStringBytes(x.NamedPort) + case nil: + default: + return fmt.Errorf("SocketAddress.PortSpecifier has unexpected type %T", x) + } + return nil +} + +func _SocketAddress_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { + m := msg.(*SocketAddress) + switch tag { + case 3: // port_specifier.port_value + if wire != proto.WireVarint { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeVarint() + m.PortSpecifier = &SocketAddress_PortValue{uint32(x)} + return true, err + case 4: // port_specifier.named_port + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeStringBytes() + m.PortSpecifier = &SocketAddress_NamedPort{x} + return true, err + default: + return false, nil + } +} + +func _SocketAddress_OneofSizer(msg proto.Message) (n int) { + m := msg.(*SocketAddress) + // port_specifier + switch x := m.PortSpecifier.(type) { + case *SocketAddress_PortValue: + n += 1 // tag and wire + n += proto.SizeVarint(uint64(x.PortValue)) + case *SocketAddress_NamedPort: + n += 1 // tag and wire + n += proto.SizeVarint(uint64(len(x.NamedPort))) + n += len(x.NamedPort) + case nil: + default: + panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) + } + return n +} + +type TcpKeepalive struct { + // Maximum number of keepalive probes to send without response before deciding + // the connection is dead. Default is to use the OS level configuration (unless + // overridden, Linux defaults to 9.) + KeepaliveProbes *types.UInt32Value `protobuf:"bytes,1,opt,name=keepalive_probes,json=keepaliveProbes" json:"keepalive_probes,omitempty"` + // The number of seconds a connection needs to be idle before keep-alive probes + // start being sent. Default is to use the OS level configuration (unless + // overridden, Linux defaults to 7200s (ie 2 hours.) + KeepaliveTime *types.UInt32Value `protobuf:"bytes,2,opt,name=keepalive_time,json=keepaliveTime" json:"keepalive_time,omitempty"` + // The number of seconds between keep-alive probes. Default is to use the OS + // level configuration (unless overridden, Linux defaults to 75s.) + KeepaliveInterval *types.UInt32Value `protobuf:"bytes,3,opt,name=keepalive_interval,json=keepaliveInterval" json:"keepalive_interval,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *TcpKeepalive) Reset() { *m = TcpKeepalive{} } +func (m *TcpKeepalive) String() string { return proto.CompactTextString(m) } +func (*TcpKeepalive) ProtoMessage() {} +func (*TcpKeepalive) Descriptor() ([]byte, []int) { + return fileDescriptor_address_fe46815faabcb098, []int{2} +} +func (m *TcpKeepalive) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *TcpKeepalive) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_TcpKeepalive.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *TcpKeepalive) XXX_Merge(src proto.Message) { + xxx_messageInfo_TcpKeepalive.Merge(dst, src) +} +func (m *TcpKeepalive) XXX_Size() int { + return m.Size() +} +func (m *TcpKeepalive) XXX_DiscardUnknown() { + xxx_messageInfo_TcpKeepalive.DiscardUnknown(m) +} + +var xxx_messageInfo_TcpKeepalive proto.InternalMessageInfo + +func (m *TcpKeepalive) GetKeepaliveProbes() *types.UInt32Value { + if m != nil { + return m.KeepaliveProbes + } + return nil +} + +func (m *TcpKeepalive) GetKeepaliveTime() *types.UInt32Value { + if m != nil { + return m.KeepaliveTime + } + return nil +} + +func (m *TcpKeepalive) GetKeepaliveInterval() *types.UInt32Value { + if m != nil { + return m.KeepaliveInterval + } + return nil +} + +type BindConfig struct { + // The address to bind to when creating a socket. + SourceAddress SocketAddress `protobuf:"bytes,1,opt,name=source_address,json=sourceAddress" json:"source_address"` + // Whether to set the *IP_FREEBIND* option when creating the socket. When this + // flag is set to true, allows the :ref:`source_address + // ` to be an IP address + // that is not configured on the system running Envoy. When this flag is set + // to false, the option *IP_FREEBIND* is disabled on the socket. When this + // flag is not set (default), the socket is not modified, i.e. the option is + // neither enabled nor disabled. + Freebind *types.BoolValue `protobuf:"bytes,2,opt,name=freebind" json:"freebind,omitempty"` + // Additional socket options that may not be present in Envoy source code or + // precompiled binaries. + SocketOptions []*SocketOption `protobuf:"bytes,3,rep,name=socket_options,json=socketOptions" json:"socket_options,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *BindConfig) Reset() { *m = BindConfig{} } +func (m *BindConfig) String() string { return proto.CompactTextString(m) } +func (*BindConfig) ProtoMessage() {} +func (*BindConfig) Descriptor() ([]byte, []int) { + return fileDescriptor_address_fe46815faabcb098, []int{3} +} +func (m *BindConfig) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *BindConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_BindConfig.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *BindConfig) XXX_Merge(src proto.Message) { + xxx_messageInfo_BindConfig.Merge(dst, src) +} +func (m *BindConfig) XXX_Size() int { + return m.Size() +} +func (m *BindConfig) XXX_DiscardUnknown() { + xxx_messageInfo_BindConfig.DiscardUnknown(m) +} + +var xxx_messageInfo_BindConfig proto.InternalMessageInfo + +func (m *BindConfig) GetSourceAddress() SocketAddress { + if m != nil { + return m.SourceAddress + } + return SocketAddress{} +} + +func (m *BindConfig) GetFreebind() *types.BoolValue { + if m != nil { + return m.Freebind + } + return nil +} + +func (m *BindConfig) GetSocketOptions() []*SocketOption { + if m != nil { + return m.SocketOptions + } + return nil +} + +// Addresses specify either a logical or physical address and port, which are +// used to tell Envoy where to bind/listen, connect to upstream and find +// management servers. +type Address struct { + // Types that are valid to be assigned to Address: + // *Address_SocketAddress + // *Address_Pipe + Address isAddress_Address `protobuf_oneof:"address"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Address) Reset() { *m = Address{} } +func (m *Address) String() string { return proto.CompactTextString(m) } +func (*Address) ProtoMessage() {} +func (*Address) Descriptor() ([]byte, []int) { + return fileDescriptor_address_fe46815faabcb098, []int{4} +} +func (m *Address) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Address) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Address.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *Address) XXX_Merge(src proto.Message) { + xxx_messageInfo_Address.Merge(dst, src) +} +func (m *Address) XXX_Size() int { + return m.Size() +} +func (m *Address) XXX_DiscardUnknown() { + xxx_messageInfo_Address.DiscardUnknown(m) +} + +var xxx_messageInfo_Address proto.InternalMessageInfo + +type isAddress_Address interface { + isAddress_Address() + Equal(interface{}) bool + MarshalTo([]byte) (int, error) + Size() int +} + +type Address_SocketAddress struct { + SocketAddress *SocketAddress `protobuf:"bytes,1,opt,name=socket_address,json=socketAddress,oneof"` +} +type Address_Pipe struct { + Pipe *Pipe `protobuf:"bytes,2,opt,name=pipe,oneof"` +} + +func (*Address_SocketAddress) isAddress_Address() {} +func (*Address_Pipe) isAddress_Address() {} + +func (m *Address) GetAddress() isAddress_Address { + if m != nil { + return m.Address + } + return nil +} + +func (m *Address) GetSocketAddress() *SocketAddress { + if x, ok := m.GetAddress().(*Address_SocketAddress); ok { + return x.SocketAddress + } + return nil +} + +func (m *Address) GetPipe() *Pipe { + if x, ok := m.GetAddress().(*Address_Pipe); ok { + return x.Pipe + } + return nil +} + +// XXX_OneofFuncs is for the internal use of the proto package. +func (*Address) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { + return _Address_OneofMarshaler, _Address_OneofUnmarshaler, _Address_OneofSizer, []interface{}{ + (*Address_SocketAddress)(nil), + (*Address_Pipe)(nil), + } +} + +func _Address_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { + m := msg.(*Address) + // address + switch x := m.Address.(type) { + case *Address_SocketAddress: + _ = b.EncodeVarint(1<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.SocketAddress); err != nil { + return err + } + case *Address_Pipe: + _ = b.EncodeVarint(2<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.Pipe); err != nil { + return err + } + case nil: + default: + return fmt.Errorf("Address.Address has unexpected type %T", x) + } + return nil +} + +func _Address_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { + m := msg.(*Address) + switch tag { + case 1: // address.socket_address + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(SocketAddress) + err := b.DecodeMessage(msg) + m.Address = &Address_SocketAddress{msg} + return true, err + case 2: // address.pipe + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(Pipe) + err := b.DecodeMessage(msg) + m.Address = &Address_Pipe{msg} + return true, err + default: + return false, nil + } +} + +func _Address_OneofSizer(msg proto.Message) (n int) { + m := msg.(*Address) + // address + switch x := m.Address.(type) { + case *Address_SocketAddress: + s := proto.Size(x.SocketAddress) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case *Address_Pipe: + s := proto.Size(x.Pipe) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case nil: + default: + panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) + } + return n +} + +// CidrRange specifies an IP Address and a prefix length to construct +// the subnet mask for a `CIDR `_ range. +type CidrRange struct { + // IPv4 or IPv6 address, e.g. ``192.0.0.0`` or ``2001:db8::``. + AddressPrefix string `protobuf:"bytes,1,opt,name=address_prefix,json=addressPrefix,proto3" json:"address_prefix,omitempty"` + // Length of prefix, e.g. 0, 32. + PrefixLen *types.UInt32Value `protobuf:"bytes,2,opt,name=prefix_len,json=prefixLen" json:"prefix_len,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *CidrRange) Reset() { *m = CidrRange{} } +func (m *CidrRange) String() string { return proto.CompactTextString(m) } +func (*CidrRange) ProtoMessage() {} +func (*CidrRange) Descriptor() ([]byte, []int) { + return fileDescriptor_address_fe46815faabcb098, []int{5} +} +func (m *CidrRange) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *CidrRange) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_CidrRange.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *CidrRange) XXX_Merge(src proto.Message) { + xxx_messageInfo_CidrRange.Merge(dst, src) +} +func (m *CidrRange) XXX_Size() int { + return m.Size() +} +func (m *CidrRange) XXX_DiscardUnknown() { + xxx_messageInfo_CidrRange.DiscardUnknown(m) +} + +var xxx_messageInfo_CidrRange proto.InternalMessageInfo + +func (m *CidrRange) GetAddressPrefix() string { + if m != nil { + return m.AddressPrefix + } + return "" +} + +func (m *CidrRange) GetPrefixLen() *types.UInt32Value { + if m != nil { + return m.PrefixLen + } + return nil +} + +func init() { + proto.RegisterType((*Pipe)(nil), "envoy.api.v2.core.Pipe") + proto.RegisterType((*SocketAddress)(nil), "envoy.api.v2.core.SocketAddress") + proto.RegisterType((*TcpKeepalive)(nil), "envoy.api.v2.core.TcpKeepalive") + proto.RegisterType((*BindConfig)(nil), "envoy.api.v2.core.BindConfig") + proto.RegisterType((*Address)(nil), "envoy.api.v2.core.Address") + proto.RegisterType((*CidrRange)(nil), "envoy.api.v2.core.CidrRange") + proto.RegisterEnum("envoy.api.v2.core.SocketAddress_Protocol", SocketAddress_Protocol_name, SocketAddress_Protocol_value) +} +func (this *Pipe) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Pipe) + if !ok { + that2, ok := that.(Pipe) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Path != that1.Path { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *SocketAddress) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*SocketAddress) + if !ok { + that2, ok := that.(SocketAddress) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Protocol != that1.Protocol { + return false + } + if this.Address != that1.Address { + return false + } + if that1.PortSpecifier == nil { + if this.PortSpecifier != nil { + return false + } + } else if this.PortSpecifier == nil { + return false + } else if !this.PortSpecifier.Equal(that1.PortSpecifier) { + return false + } + if this.ResolverName != that1.ResolverName { + return false + } + if this.Ipv4Compat != that1.Ipv4Compat { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *SocketAddress_PortValue) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*SocketAddress_PortValue) + if !ok { + that2, ok := that.(SocketAddress_PortValue) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.PortValue != that1.PortValue { + return false + } + return true +} +func (this *SocketAddress_NamedPort) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*SocketAddress_NamedPort) + if !ok { + that2, ok := that.(SocketAddress_NamedPort) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.NamedPort != that1.NamedPort { + return false + } + return true +} +func (this *TcpKeepalive) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*TcpKeepalive) + if !ok { + that2, ok := that.(TcpKeepalive) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.KeepaliveProbes.Equal(that1.KeepaliveProbes) { + return false + } + if !this.KeepaliveTime.Equal(that1.KeepaliveTime) { + return false + } + if !this.KeepaliveInterval.Equal(that1.KeepaliveInterval) { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *BindConfig) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*BindConfig) + if !ok { + that2, ok := that.(BindConfig) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.SourceAddress.Equal(&that1.SourceAddress) { + return false + } + if !this.Freebind.Equal(that1.Freebind) { + return false + } + if len(this.SocketOptions) != len(that1.SocketOptions) { + return false + } + for i := range this.SocketOptions { + if !this.SocketOptions[i].Equal(that1.SocketOptions[i]) { + return false + } + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *Address) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Address) + if !ok { + that2, ok := that.(Address) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if that1.Address == nil { + if this.Address != nil { + return false + } + } else if this.Address == nil { + return false + } else if !this.Address.Equal(that1.Address) { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *Address_SocketAddress) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Address_SocketAddress) + if !ok { + that2, ok := that.(Address_SocketAddress) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.SocketAddress.Equal(that1.SocketAddress) { + return false + } + return true +} +func (this *Address_Pipe) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Address_Pipe) + if !ok { + that2, ok := that.(Address_Pipe) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.Pipe.Equal(that1.Pipe) { + return false + } + return true +} +func (this *CidrRange) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*CidrRange) + if !ok { + that2, ok := that.(CidrRange) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.AddressPrefix != that1.AddressPrefix { + return false + } + if !this.PrefixLen.Equal(that1.PrefixLen) { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (m *Pipe) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Pipe) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Path) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintAddress(dAtA, i, uint64(len(m.Path))) + i += copy(dAtA[i:], m.Path) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *SocketAddress) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *SocketAddress) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Protocol != 0 { + dAtA[i] = 0x8 + i++ + i = encodeVarintAddress(dAtA, i, uint64(m.Protocol)) + } + if len(m.Address) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintAddress(dAtA, i, uint64(len(m.Address))) + i += copy(dAtA[i:], m.Address) + } + if m.PortSpecifier != nil { + nn1, err := m.PortSpecifier.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += nn1 + } + if len(m.ResolverName) > 0 { + dAtA[i] = 0x2a + i++ + i = encodeVarintAddress(dAtA, i, uint64(len(m.ResolverName))) + i += copy(dAtA[i:], m.ResolverName) + } + if m.Ipv4Compat { + dAtA[i] = 0x30 + i++ + if m.Ipv4Compat { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i++ + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *SocketAddress_PortValue) MarshalTo(dAtA []byte) (int, error) { + i := 0 + dAtA[i] = 0x18 + i++ + i = encodeVarintAddress(dAtA, i, uint64(m.PortValue)) + return i, nil +} +func (m *SocketAddress_NamedPort) MarshalTo(dAtA []byte) (int, error) { + i := 0 + dAtA[i] = 0x22 + i++ + i = encodeVarintAddress(dAtA, i, uint64(len(m.NamedPort))) + i += copy(dAtA[i:], m.NamedPort) + return i, nil +} +func (m *TcpKeepalive) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *TcpKeepalive) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.KeepaliveProbes != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintAddress(dAtA, i, uint64(m.KeepaliveProbes.Size())) + n2, err := m.KeepaliveProbes.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n2 + } + if m.KeepaliveTime != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintAddress(dAtA, i, uint64(m.KeepaliveTime.Size())) + n3, err := m.KeepaliveTime.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n3 + } + if m.KeepaliveInterval != nil { + dAtA[i] = 0x1a + i++ + i = encodeVarintAddress(dAtA, i, uint64(m.KeepaliveInterval.Size())) + n4, err := m.KeepaliveInterval.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n4 + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *BindConfig) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *BindConfig) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + dAtA[i] = 0xa + i++ + i = encodeVarintAddress(dAtA, i, uint64(m.SourceAddress.Size())) + n5, err := m.SourceAddress.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n5 + if m.Freebind != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintAddress(dAtA, i, uint64(m.Freebind.Size())) + n6, err := m.Freebind.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n6 + } + if len(m.SocketOptions) > 0 { + for _, msg := range m.SocketOptions { + dAtA[i] = 0x1a + i++ + i = encodeVarintAddress(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *Address) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Address) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Address != nil { + nn7, err := m.Address.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += nn7 + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *Address_SocketAddress) MarshalTo(dAtA []byte) (int, error) { + i := 0 + if m.SocketAddress != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintAddress(dAtA, i, uint64(m.SocketAddress.Size())) + n8, err := m.SocketAddress.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n8 + } + return i, nil +} +func (m *Address_Pipe) MarshalTo(dAtA []byte) (int, error) { + i := 0 + if m.Pipe != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintAddress(dAtA, i, uint64(m.Pipe.Size())) + n9, err := m.Pipe.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n9 + } + return i, nil +} +func (m *CidrRange) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *CidrRange) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.AddressPrefix) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintAddress(dAtA, i, uint64(len(m.AddressPrefix))) + i += copy(dAtA[i:], m.AddressPrefix) + } + if m.PrefixLen != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintAddress(dAtA, i, uint64(m.PrefixLen.Size())) + n10, err := m.PrefixLen.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n10 + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func encodeVarintAddress(dAtA []byte, offset int, v uint64) int { + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return offset + 1 +} +func (m *Pipe) Size() (n int) { + var l int + _ = l + l = len(m.Path) + if l > 0 { + n += 1 + l + sovAddress(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *SocketAddress) Size() (n int) { + var l int + _ = l + if m.Protocol != 0 { + n += 1 + sovAddress(uint64(m.Protocol)) + } + l = len(m.Address) + if l > 0 { + n += 1 + l + sovAddress(uint64(l)) + } + if m.PortSpecifier != nil { + n += m.PortSpecifier.Size() + } + l = len(m.ResolverName) + if l > 0 { + n += 1 + l + sovAddress(uint64(l)) + } + if m.Ipv4Compat { + n += 2 + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *SocketAddress_PortValue) Size() (n int) { + var l int + _ = l + n += 1 + sovAddress(uint64(m.PortValue)) + return n +} +func (m *SocketAddress_NamedPort) Size() (n int) { + var l int + _ = l + l = len(m.NamedPort) + n += 1 + l + sovAddress(uint64(l)) + return n +} +func (m *TcpKeepalive) Size() (n int) { + var l int + _ = l + if m.KeepaliveProbes != nil { + l = m.KeepaliveProbes.Size() + n += 1 + l + sovAddress(uint64(l)) + } + if m.KeepaliveTime != nil { + l = m.KeepaliveTime.Size() + n += 1 + l + sovAddress(uint64(l)) + } + if m.KeepaliveInterval != nil { + l = m.KeepaliveInterval.Size() + n += 1 + l + sovAddress(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *BindConfig) Size() (n int) { + var l int + _ = l + l = m.SourceAddress.Size() + n += 1 + l + sovAddress(uint64(l)) + if m.Freebind != nil { + l = m.Freebind.Size() + n += 1 + l + sovAddress(uint64(l)) + } + if len(m.SocketOptions) > 0 { + for _, e := range m.SocketOptions { + l = e.Size() + n += 1 + l + sovAddress(uint64(l)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *Address) Size() (n int) { + var l int + _ = l + if m.Address != nil { + n += m.Address.Size() + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *Address_SocketAddress) Size() (n int) { + var l int + _ = l + if m.SocketAddress != nil { + l = m.SocketAddress.Size() + n += 1 + l + sovAddress(uint64(l)) + } + return n +} +func (m *Address_Pipe) Size() (n int) { + var l int + _ = l + if m.Pipe != nil { + l = m.Pipe.Size() + n += 1 + l + sovAddress(uint64(l)) + } + return n +} +func (m *CidrRange) Size() (n int) { + var l int + _ = l + l = len(m.AddressPrefix) + if l > 0 { + n += 1 + l + sovAddress(uint64(l)) + } + if m.PrefixLen != nil { + l = m.PrefixLen.Size() + n += 1 + l + sovAddress(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func sovAddress(x uint64) (n int) { + for { + n++ + x >>= 7 + if x == 0 { + break + } + } + return n +} +func sozAddress(x uint64) (n int) { + return sovAddress(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Pipe) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAddress + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Pipe: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Pipe: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Path", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAddress + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthAddress + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Path = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipAddress(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthAddress + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *SocketAddress) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAddress + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: SocketAddress: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SocketAddress: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Protocol", wireType) + } + m.Protocol = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAddress + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Protocol |= (SocketAddress_Protocol(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAddress + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthAddress + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field PortValue", wireType) + } + var v uint32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAddress + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (uint32(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.PortSpecifier = &SocketAddress_PortValue{v} + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NamedPort", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAddress + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthAddress + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PortSpecifier = &SocketAddress_NamedPort{string(dAtA[iNdEx:postIndex])} + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ResolverName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAddress + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthAddress + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ResolverName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Ipv4Compat", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAddress + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.Ipv4Compat = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skipAddress(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthAddress + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *TcpKeepalive) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAddress + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: TcpKeepalive: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TcpKeepalive: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field KeepaliveProbes", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAddress + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthAddress + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.KeepaliveProbes == nil { + m.KeepaliveProbes = &types.UInt32Value{} + } + if err := m.KeepaliveProbes.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field KeepaliveTime", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAddress + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthAddress + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.KeepaliveTime == nil { + m.KeepaliveTime = &types.UInt32Value{} + } + if err := m.KeepaliveTime.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field KeepaliveInterval", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAddress + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthAddress + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.KeepaliveInterval == nil { + m.KeepaliveInterval = &types.UInt32Value{} + } + if err := m.KeepaliveInterval.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipAddress(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthAddress + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *BindConfig) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAddress + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: BindConfig: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: BindConfig: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SourceAddress", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAddress + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthAddress + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.SourceAddress.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Freebind", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAddress + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthAddress + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Freebind == nil { + m.Freebind = &types.BoolValue{} + } + if err := m.Freebind.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SocketOptions", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAddress + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthAddress + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SocketOptions = append(m.SocketOptions, &SocketOption{}) + if err := m.SocketOptions[len(m.SocketOptions)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipAddress(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthAddress + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Address) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAddress + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Address: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Address: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SocketAddress", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAddress + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthAddress + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &SocketAddress{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Address = &Address_SocketAddress{v} + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pipe", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAddress + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthAddress + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &Pipe{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Address = &Address_Pipe{v} + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipAddress(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthAddress + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CidrRange) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAddress + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: CidrRange: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CidrRange: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AddressPrefix", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAddress + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthAddress + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.AddressPrefix = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PrefixLen", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAddress + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthAddress + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.PrefixLen == nil { + m.PrefixLen = &types.UInt32Value{} + } + if err := m.PrefixLen.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipAddress(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthAddress + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipAddress(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowAddress + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowAddress + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + return iNdEx, nil + case 1: + iNdEx += 8 + return iNdEx, nil + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowAddress + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + iNdEx += length + if length < 0 { + return 0, ErrInvalidLengthAddress + } + return iNdEx, nil + case 3: + for { + var innerWire uint64 + var start int = iNdEx + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowAddress + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + innerWire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + innerWireType := int(innerWire & 0x7) + if innerWireType == 4 { + break + } + next, err := skipAddress(dAtA[start:]) + if err != nil { + return 0, err + } + iNdEx = start + next + } + return iNdEx, nil + case 4: + return iNdEx, nil + case 5: + iNdEx += 4 + return iNdEx, nil + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + } + panic("unreachable") +} + +var ( + ErrInvalidLengthAddress = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowAddress = fmt.Errorf("proto: integer overflow") +) + +func init() { + proto.RegisterFile("envoy/api/v2/core/address.proto", fileDescriptor_address_fe46815faabcb098) +} + +var fileDescriptor_address_fe46815faabcb098 = []byte{ + // 691 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x53, 0xc1, 0x6e, 0x13, 0x3b, + 0x14, 0x8d, 0x33, 0x69, 0x9b, 0xdc, 0x34, 0x79, 0xa9, 0xf5, 0xa4, 0x8e, 0xa2, 0xbe, 0x24, 0x4a, + 0xf5, 0xa4, 0x50, 0xc1, 0x0c, 0x4a, 0x11, 0x7b, 0x26, 0x88, 0xb6, 0x2a, 0x82, 0x30, 0xb4, 0xb0, + 0x1c, 0x39, 0x89, 0x13, 0xac, 0x4e, 0xc6, 0x96, 0x67, 0x3a, 0xc0, 0x0e, 0xb1, 0x40, 0x88, 0x3d, + 0x5f, 0xc0, 0x86, 0x4f, 0x40, 0xac, 0xba, 0xec, 0x92, 0x2d, 0x1b, 0x84, 0x22, 0xb1, 0xe8, 0x57, + 0x14, 0xd9, 0x33, 0x93, 0x0a, 0x02, 0x2a, 0xec, 0xec, 0x73, 0xcf, 0x39, 0x3e, 0xd7, 0xbe, 0x86, + 0x26, 0x0d, 0x62, 0xfe, 0xdc, 0x26, 0x82, 0xd9, 0x71, 0xd7, 0x1e, 0x72, 0x49, 0x6d, 0x32, 0x1a, + 0x49, 0x1a, 0x86, 0x96, 0x90, 0x3c, 0xe2, 0x78, 0x4d, 0x13, 0x2c, 0x22, 0x98, 0x15, 0x77, 0x2d, + 0x45, 0xa8, 0x6f, 0x2c, 0x6a, 0x06, 0x24, 0xa4, 0x89, 0xa0, 0xde, 0x98, 0x70, 0x3e, 0xf1, 0xa9, + 0xad, 0x77, 0x83, 0xe3, 0xb1, 0xfd, 0x54, 0x12, 0x21, 0xa8, 0x4c, 0x0d, 0xeb, 0xeb, 0x31, 0xf1, + 0xd9, 0x88, 0x44, 0xd4, 0xce, 0x16, 0x69, 0xe1, 0xdf, 0x09, 0x9f, 0x70, 0xbd, 0xb4, 0xd5, 0x2a, + 0x41, 0xdb, 0xff, 0x43, 0xa1, 0xcf, 0x04, 0xc5, 0xff, 0x41, 0x41, 0x90, 0xe8, 0x89, 0x89, 0x5a, + 0xa8, 0x53, 0x72, 0x4a, 0x1f, 0xcf, 0x4e, 0x8c, 0x82, 0xcc, 0xb7, 0x90, 0xab, 0xe1, 0xf6, 0xe7, + 0x3c, 0x54, 0x1e, 0xf2, 0xe1, 0x11, 0x8d, 0x6e, 0x25, 0xf1, 0xf1, 0x03, 0x28, 0x6a, 0x87, 0x21, + 0xf7, 0xb5, 0xa8, 0xda, 0xbd, 0x62, 0x2d, 0xf4, 0x62, 0xfd, 0xa0, 0xb1, 0xfa, 0xa9, 0xc0, 0x01, + 0xe5, 0xbf, 0xf4, 0x12, 0xe5, 0x6b, 0xc8, 0x9d, 0xdb, 0xe0, 0x4d, 0x58, 0x49, 0x2f, 0xc7, 0xcc, + 0xff, 0x1c, 0x23, 0xab, 0xe0, 0xab, 0x00, 0x82, 0xcb, 0xc8, 0x8b, 0x89, 0x7f, 0x4c, 0x4d, 0xa3, + 0x85, 0x3a, 0x15, 0xa7, 0xac, 0x78, 0xcb, 0x5b, 0x05, 0xf3, 0xfc, 0xdc, 0xd8, 0xcd, 0xb9, 0x25, + 0x45, 0x78, 0xa4, 0xea, 0xb8, 0x09, 0x10, 0x90, 0x29, 0x1d, 0x79, 0x0a, 0x32, 0x0b, 0xca, 0x55, + 0x11, 0x34, 0xd6, 0xe7, 0x32, 0xc2, 0x9b, 0x50, 0x91, 0x34, 0xe4, 0x7e, 0x4c, 0xa5, 0xa7, 0x50, + 0x73, 0x49, 0x71, 0xdc, 0xd5, 0x0c, 0xbc, 0x47, 0xa6, 0xca, 0xa5, 0xcc, 0x44, 0x7c, 0xc3, 0x1b, + 0xf2, 0xa9, 0x20, 0x91, 0xb9, 0xdc, 0x42, 0x9d, 0xa2, 0x0b, 0x0a, 0xea, 0x69, 0xa4, 0xdd, 0x86, + 0x62, 0xd6, 0x1b, 0x5e, 0x01, 0xe3, 0xa0, 0xd7, 0xaf, 0xe5, 0xd4, 0xe2, 0xf0, 0x76, 0xbf, 0x86, + 0xea, 0x85, 0xd7, 0xef, 0x1a, 0x39, 0x67, 0x1d, 0xaa, 0x3a, 0x78, 0x28, 0xe8, 0x90, 0x8d, 0x19, + 0x95, 0x78, 0xe9, 0xc3, 0xd9, 0x89, 0x81, 0xda, 0x67, 0x08, 0x56, 0x0f, 0x86, 0x62, 0x9f, 0x52, + 0x41, 0x7c, 0x16, 0x53, 0xbc, 0x03, 0xb5, 0xa3, 0x6c, 0xe3, 0x09, 0xc9, 0x07, 0x34, 0xd4, 0x57, + 0x5c, 0xee, 0x6e, 0x58, 0xc9, 0xeb, 0x5b, 0xd9, 0xeb, 0x5b, 0x87, 0x7b, 0x41, 0xb4, 0xdd, 0xd5, + 0xcd, 0xba, 0xff, 0xcc, 0x55, 0x7d, 0x2d, 0xc2, 0x3d, 0xa8, 0x5e, 0x18, 0x45, 0x6c, 0x4a, 0xf5, + 0xbd, 0x5e, 0x66, 0x53, 0x99, 0x6b, 0x0e, 0xd8, 0x94, 0xe2, 0x7d, 0xc0, 0x17, 0x26, 0x2c, 0x88, + 0xa8, 0x8c, 0x89, 0xaf, 0x2f, 0xfe, 0x32, 0xa3, 0xb5, 0xb9, 0x6e, 0x2f, 0x95, 0xb5, 0xbf, 0x21, + 0x00, 0x87, 0x05, 0xa3, 0x1e, 0x0f, 0xc6, 0x6c, 0x82, 0x1f, 0x43, 0x35, 0xe4, 0xc7, 0x72, 0x48, + 0xbd, 0xec, 0xe1, 0x93, 0x3e, 0x5b, 0x97, 0x8d, 0x92, 0x53, 0x3d, 0xfd, 0xd2, 0xcc, 0xe9, 0x29, + 0x7a, 0xa3, 0xa7, 0xa8, 0x92, 0xf8, 0x64, 0xd3, 0x79, 0x13, 0x8a, 0x63, 0x49, 0xe9, 0x80, 0x05, + 0xa3, 0xb4, 0xe7, 0xfa, 0x42, 0x54, 0x87, 0x73, 0x3f, 0x09, 0x3a, 0xe7, 0xe2, 0x3b, 0x2a, 0x90, + 0x3a, 0xc7, 0xe3, 0x22, 0x62, 0x3c, 0x08, 0x4d, 0xa3, 0x65, 0x74, 0xca, 0xdd, 0xe6, 0x6f, 0x03, + 0xdd, 0xd7, 0x3c, 0x75, 0xfe, 0xc5, 0x2e, 0x6c, 0xbf, 0x45, 0xb0, 0x92, 0x65, 0xd9, 0x9b, 0x7b, + 0xfe, 0x65, 0x93, 0xbb, 0xb9, 0xcc, 0x36, 0xb3, 0xba, 0x06, 0x05, 0xc1, 0x44, 0xf6, 0x8c, 0xeb, + 0xbf, 0x30, 0x50, 0x9f, 0x79, 0x37, 0xe7, 0x6a, 0x9a, 0x53, 0x9b, 0x7f, 0xa8, 0x6c, 0xd6, 0x5e, + 0x21, 0x28, 0xf5, 0xd8, 0x48, 0xba, 0x24, 0x98, 0x50, 0x7c, 0x1d, 0xaa, 0x69, 0xdd, 0x13, 0x92, + 0x8e, 0xd9, 0xb3, 0xc5, 0xef, 0x5f, 0x49, 0x09, 0x7d, 0x5d, 0xc7, 0x3b, 0x00, 0x09, 0xd3, 0xf3, + 0x69, 0xf0, 0x27, 0xd3, 0x94, 0x7e, 0xf5, 0x2d, 0xc3, 0x7c, 0x81, 0xdc, 0x52, 0xa2, 0xbd, 0x4b, + 0x03, 0xa7, 0xf6, 0x7e, 0xd6, 0x40, 0xa7, 0xb3, 0x06, 0xfa, 0x34, 0x6b, 0xa0, 0xaf, 0xb3, 0x06, + 0x1a, 0x2c, 0x6b, 0xf9, 0xf6, 0xf7, 0x00, 0x00, 0x00, 0xff, 0xff, 0x27, 0x78, 0x14, 0x9e, 0x33, + 0x05, 0x00, 0x00, +} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/core/address.pb.validate.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/core/address.pb.validate.go new file mode 100644 index 000000000000..975d15bbf302 --- /dev/null +++ b/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/core/address.pb.validate.go @@ -0,0 +1,447 @@ +// Code generated by protoc-gen-validate +// source: envoy/api/v2/core/address.proto +// DO NOT EDIT!!! + +package core + +import ( + "bytes" + "errors" + "fmt" + "net" + "net/mail" + "net/url" + "regexp" + "strings" + "time" + "unicode/utf8" + + "github.com/gogo/protobuf/types" +) + +// ensure the imports are used +var ( + _ = bytes.MinRead + _ = errors.New("") + _ = fmt.Print + _ = utf8.UTFMax + _ = (*regexp.Regexp)(nil) + _ = (*strings.Reader)(nil) + _ = net.IPv4len + _ = time.Duration(0) + _ = (*url.URL)(nil) + _ = (*mail.Address)(nil) + _ = types.DynamicAny{} +) + +// Validate checks the field values on Pipe with the rules defined in the proto +// definition for this message. If any rules are violated, an error is returned. +func (m *Pipe) Validate() error { + if m == nil { + return nil + } + + if len(m.GetPath()) < 1 { + return PipeValidationError{ + Field: "Path", + Reason: "value length must be at least 1 bytes", + } + } + + return nil +} + +// PipeValidationError is the validation error returned by Pipe.Validate if the +// designated constraints aren't met. +type PipeValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e PipeValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sPipe.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = PipeValidationError{} + +// Validate checks the field values on SocketAddress with the rules defined in +// the proto definition for this message. If any rules are violated, an error +// is returned. +func (m *SocketAddress) Validate() error { + if m == nil { + return nil + } + + if _, ok := SocketAddress_Protocol_name[int32(m.GetProtocol())]; !ok { + return SocketAddressValidationError{ + Field: "Protocol", + Reason: "value must be one of the defined enum values", + } + } + + if len(m.GetAddress()) < 1 { + return SocketAddressValidationError{ + Field: "Address", + Reason: "value length must be at least 1 bytes", + } + } + + // no validation rules for ResolverName + + // no validation rules for Ipv4Compat + + switch m.PortSpecifier.(type) { + + case *SocketAddress_PortValue: + + if m.GetPortValue() > 65535 { + return SocketAddressValidationError{ + Field: "PortValue", + Reason: "value must be less than or equal to 65535", + } + } + + case *SocketAddress_NamedPort: + // no validation rules for NamedPort + + default: + return SocketAddressValidationError{ + Field: "PortSpecifier", + Reason: "value is required", + } + + } + + return nil +} + +// SocketAddressValidationError is the validation error returned by +// SocketAddress.Validate if the designated constraints aren't met. +type SocketAddressValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e SocketAddressValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sSocketAddress.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = SocketAddressValidationError{} + +// Validate checks the field values on TcpKeepalive with the rules defined in +// the proto definition for this message. If any rules are violated, an error +// is returned. +func (m *TcpKeepalive) Validate() error { + if m == nil { + return nil + } + + if v, ok := interface{}(m.GetKeepaliveProbes()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return TcpKeepaliveValidationError{ + Field: "KeepaliveProbes", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + if v, ok := interface{}(m.GetKeepaliveTime()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return TcpKeepaliveValidationError{ + Field: "KeepaliveTime", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + if v, ok := interface{}(m.GetKeepaliveInterval()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return TcpKeepaliveValidationError{ + Field: "KeepaliveInterval", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + return nil +} + +// TcpKeepaliveValidationError is the validation error returned by +// TcpKeepalive.Validate if the designated constraints aren't met. +type TcpKeepaliveValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e TcpKeepaliveValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sTcpKeepalive.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = TcpKeepaliveValidationError{} + +// Validate checks the field values on BindConfig with the rules defined in the +// proto definition for this message. If any rules are violated, an error is returned. +func (m *BindConfig) Validate() error { + if m == nil { + return nil + } + + if v, ok := interface{}(m.GetSourceAddress()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return BindConfigValidationError{ + Field: "SourceAddress", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + if v, ok := interface{}(m.GetFreebind()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return BindConfigValidationError{ + Field: "Freebind", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + for idx, item := range m.GetSocketOptions() { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return BindConfigValidationError{ + Field: fmt.Sprintf("SocketOptions[%v]", idx), + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + } + + return nil +} + +// BindConfigValidationError is the validation error returned by +// BindConfig.Validate if the designated constraints aren't met. +type BindConfigValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e BindConfigValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sBindConfig.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = BindConfigValidationError{} + +// Validate checks the field values on Address with the rules defined in the +// proto definition for this message. If any rules are violated, an error is returned. +func (m *Address) Validate() error { + if m == nil { + return nil + } + + switch m.Address.(type) { + + case *Address_SocketAddress: + + if v, ok := interface{}(m.GetSocketAddress()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return AddressValidationError{ + Field: "SocketAddress", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + case *Address_Pipe: + + if v, ok := interface{}(m.GetPipe()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return AddressValidationError{ + Field: "Pipe", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + default: + return AddressValidationError{ + Field: "Address", + Reason: "value is required", + } + + } + + return nil +} + +// AddressValidationError is the validation error returned by Address.Validate +// if the designated constraints aren't met. +type AddressValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e AddressValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sAddress.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = AddressValidationError{} + +// Validate checks the field values on CidrRange with the rules defined in the +// proto definition for this message. If any rules are violated, an error is returned. +func (m *CidrRange) Validate() error { + if m == nil { + return nil + } + + if len(m.GetAddressPrefix()) < 1 { + return CidrRangeValidationError{ + Field: "AddressPrefix", + Reason: "value length must be at least 1 bytes", + } + } + + if wrapper := m.GetPrefixLen(); wrapper != nil { + + if wrapper.GetValue() > 128 { + return CidrRangeValidationError{ + Field: "PrefixLen", + Reason: "value must be less than or equal to 128", + } + } + + } + + return nil +} + +// CidrRangeValidationError is the validation error returned by +// CidrRange.Validate if the designated constraints aren't met. +type CidrRangeValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e CidrRangeValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sCidrRange.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = CidrRangeValidationError{} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/core/base.pb.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/core/base.pb.go new file mode 100644 index 000000000000..c3fadcc6ba45 --- /dev/null +++ b/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/core/base.pb.go @@ -0,0 +1,3516 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: envoy/api/v2/core/base.proto + +package core + +import proto "github.com/gogo/protobuf/proto" +import fmt "fmt" +import math "math" +import _ "github.com/gogo/protobuf/gogoproto" +import types "github.com/gogo/protobuf/types" +import _ "github.com/lyft/protoc-gen-validate/validate" + +import bytes "bytes" + +import io "io" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package + +// Envoy supports :ref:`upstream priority routing +// ` both at the route and the virtual +// cluster level. The current priority implementation uses different connection +// pool and circuit breaking settings for each priority level. This means that +// even for HTTP/2 requests, two physical connections will be used to an +// upstream host. In the future Envoy will likely support true HTTP/2 priority +// over a single upstream connection. +type RoutingPriority int32 + +const ( + RoutingPriority_DEFAULT RoutingPriority = 0 + RoutingPriority_HIGH RoutingPriority = 1 +) + +var RoutingPriority_name = map[int32]string{ + 0: "DEFAULT", + 1: "HIGH", +} +var RoutingPriority_value = map[string]int32{ + "DEFAULT": 0, + "HIGH": 1, +} + +func (x RoutingPriority) String() string { + return proto.EnumName(RoutingPriority_name, int32(x)) +} +func (RoutingPriority) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_base_0126f5109e43fb63, []int{0} +} + +// HTTP request method. +type RequestMethod int32 + +const ( + METHOD_UNSPECIFIED RequestMethod = 0 + GET RequestMethod = 1 + HEAD RequestMethod = 2 + POST RequestMethod = 3 + PUT RequestMethod = 4 + DELETE RequestMethod = 5 + CONNECT RequestMethod = 6 + OPTIONS RequestMethod = 7 + TRACE RequestMethod = 8 +) + +var RequestMethod_name = map[int32]string{ + 0: "METHOD_UNSPECIFIED", + 1: "GET", + 2: "HEAD", + 3: "POST", + 4: "PUT", + 5: "DELETE", + 6: "CONNECT", + 7: "OPTIONS", + 8: "TRACE", +} +var RequestMethod_value = map[string]int32{ + "METHOD_UNSPECIFIED": 0, + "GET": 1, + "HEAD": 2, + "POST": 3, + "PUT": 4, + "DELETE": 5, + "CONNECT": 6, + "OPTIONS": 7, + "TRACE": 8, +} + +func (x RequestMethod) String() string { + return proto.EnumName(RequestMethod_name, int32(x)) +} +func (RequestMethod) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_base_0126f5109e43fb63, []int{1} +} + +type SocketOption_SocketState int32 + +const ( + // Socket options are applied after socket creation but before binding the socket to a port + STATE_PREBIND SocketOption_SocketState = 0 + // Socket options are applied after binding the socket to a port but before calling listen() + STATE_BOUND SocketOption_SocketState = 1 + // Socket options are applied after calling listen() + STATE_LISTENING SocketOption_SocketState = 2 +) + +var SocketOption_SocketState_name = map[int32]string{ + 0: "STATE_PREBIND", + 1: "STATE_BOUND", + 2: "STATE_LISTENING", +} +var SocketOption_SocketState_value = map[string]int32{ + "STATE_PREBIND": 0, + "STATE_BOUND": 1, + "STATE_LISTENING": 2, +} + +func (x SocketOption_SocketState) String() string { + return proto.EnumName(SocketOption_SocketState_name, int32(x)) +} +func (SocketOption_SocketState) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_base_0126f5109e43fb63, []int{8, 0} +} + +// Identifies location of where either Envoy runs or where upstream hosts run. +type Locality struct { + // Region this :ref:`zone ` belongs to. + Region string `protobuf:"bytes,1,opt,name=region,proto3" json:"region,omitempty"` + // Defines the local service zone where Envoy is running. Though optional, it + // should be set if discovery service routing is used and the discovery + // service exposes :ref:`zone data `, + // either in this message or via :option:`--service-zone`. The meaning of zone + // is context dependent, e.g. `Availability Zone (AZ) + // `_ + // on AWS, `Zone `_ on + // GCP, etc. + Zone string `protobuf:"bytes,2,opt,name=zone,proto3" json:"zone,omitempty"` + // When used for locality of upstream hosts, this field further splits zone + // into smaller chunks of sub-zones so they can be load balanced + // independently. + SubZone string `protobuf:"bytes,3,opt,name=sub_zone,json=subZone,proto3" json:"sub_zone,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Locality) Reset() { *m = Locality{} } +func (m *Locality) String() string { return proto.CompactTextString(m) } +func (*Locality) ProtoMessage() {} +func (*Locality) Descriptor() ([]byte, []int) { + return fileDescriptor_base_0126f5109e43fb63, []int{0} +} +func (m *Locality) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Locality) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Locality.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *Locality) XXX_Merge(src proto.Message) { + xxx_messageInfo_Locality.Merge(dst, src) +} +func (m *Locality) XXX_Size() int { + return m.Size() +} +func (m *Locality) XXX_DiscardUnknown() { + xxx_messageInfo_Locality.DiscardUnknown(m) +} + +var xxx_messageInfo_Locality proto.InternalMessageInfo + +func (m *Locality) GetRegion() string { + if m != nil { + return m.Region + } + return "" +} + +func (m *Locality) GetZone() string { + if m != nil { + return m.Zone + } + return "" +} + +func (m *Locality) GetSubZone() string { + if m != nil { + return m.SubZone + } + return "" +} + +// Identifies a specific Envoy instance. The node identifier is presented to the +// management server, which may use this identifier to distinguish per Envoy +// configuration for serving. +type Node struct { + // An opaque node identifier for the Envoy node. This also provides the local + // service node name. It should be set if any of the following features are + // used: :ref:`statsd `, :ref:`CDS + // `, and :ref:`HTTP tracing + // `, either in this message or via + // :option:`--service-node`. + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + // Defines the local service cluster name where Envoy is running. Though + // optional, it should be set if any of the following features are used: + // :ref:`statsd `, :ref:`health check cluster + // verification `, + // :ref:`runtime override directory `, + // :ref:`user agent addition `, + // :ref:`HTTP global rate limiting `, + // :ref:`CDS `, and :ref:`HTTP tracing + // `, either in this message or via + // :option:`--service-cluster`. + Cluster string `protobuf:"bytes,2,opt,name=cluster,proto3" json:"cluster,omitempty"` + // Opaque metadata extending the node identifier. Envoy will pass this + // directly to the management server. + Metadata *types.Struct `protobuf:"bytes,3,opt,name=metadata" json:"metadata,omitempty"` + // Locality specifying where the Envoy instance is running. + Locality *Locality `protobuf:"bytes,4,opt,name=locality" json:"locality,omitempty"` + // This is motivated by informing a management server during canary which + // version of Envoy is being tested in a heterogeneous fleet. This will be set + // by Envoy in management server RPCs. + BuildVersion string `protobuf:"bytes,5,opt,name=build_version,json=buildVersion,proto3" json:"build_version,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Node) Reset() { *m = Node{} } +func (m *Node) String() string { return proto.CompactTextString(m) } +func (*Node) ProtoMessage() {} +func (*Node) Descriptor() ([]byte, []int) { + return fileDescriptor_base_0126f5109e43fb63, []int{1} +} +func (m *Node) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Node) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Node.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *Node) XXX_Merge(src proto.Message) { + xxx_messageInfo_Node.Merge(dst, src) +} +func (m *Node) XXX_Size() int { + return m.Size() +} +func (m *Node) XXX_DiscardUnknown() { + xxx_messageInfo_Node.DiscardUnknown(m) +} + +var xxx_messageInfo_Node proto.InternalMessageInfo + +func (m *Node) GetId() string { + if m != nil { + return m.Id + } + return "" +} + +func (m *Node) GetCluster() string { + if m != nil { + return m.Cluster + } + return "" +} + +func (m *Node) GetMetadata() *types.Struct { + if m != nil { + return m.Metadata + } + return nil +} + +func (m *Node) GetLocality() *Locality { + if m != nil { + return m.Locality + } + return nil +} + +func (m *Node) GetBuildVersion() string { + if m != nil { + return m.BuildVersion + } + return "" +} + +// Metadata provides additional inputs to filters based on matched listeners, +// filter chains, routes and endpoints. It is structured as a map from filter +// name (in reverse DNS format) to metadata specific to the filter. Metadata +// key-values for a filter are merged as connection and request handling occurs, +// with later values for the same key overriding earlier values. +// +// An example use of metadata is providing additional values to +// http_connection_manager in the envoy.http_connection_manager.access_log +// namespace. +// +// For load balancing, Metadata provides a means to subset cluster endpoints. +// Endpoints have a Metadata object associated and routes contain a Metadata +// object to match against. There are some well defined metadata used today for +// this purpose: +// +// * ``{"envoy.lb": {"canary": }}`` This indicates the canary status of an +// endpoint and is also used during header processing +// (x-envoy-upstream-canary) and for stats purposes. +type Metadata struct { + // Key is the reverse DNS filter name, e.g. com.acme.widget. The envoy.* + // namespace is reserved for Envoy's built-in filters. + FilterMetadata map[string]*types.Struct `protobuf:"bytes,1,rep,name=filter_metadata,json=filterMetadata" json:"filter_metadata,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Metadata) Reset() { *m = Metadata{} } +func (m *Metadata) String() string { return proto.CompactTextString(m) } +func (*Metadata) ProtoMessage() {} +func (*Metadata) Descriptor() ([]byte, []int) { + return fileDescriptor_base_0126f5109e43fb63, []int{2} +} +func (m *Metadata) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Metadata) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Metadata.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *Metadata) XXX_Merge(src proto.Message) { + xxx_messageInfo_Metadata.Merge(dst, src) +} +func (m *Metadata) XXX_Size() int { + return m.Size() +} +func (m *Metadata) XXX_DiscardUnknown() { + xxx_messageInfo_Metadata.DiscardUnknown(m) +} + +var xxx_messageInfo_Metadata proto.InternalMessageInfo + +func (m *Metadata) GetFilterMetadata() map[string]*types.Struct { + if m != nil { + return m.FilterMetadata + } + return nil +} + +// Runtime derived uint32 with a default when not specified. +type RuntimeUInt32 struct { + // Default value if runtime value is not available. + DefaultValue uint32 `protobuf:"varint,2,opt,name=default_value,json=defaultValue,proto3" json:"default_value,omitempty"` + // Runtime key to get value for comparison. This value is used if defined. + RuntimeKey string `protobuf:"bytes,3,opt,name=runtime_key,json=runtimeKey,proto3" json:"runtime_key,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *RuntimeUInt32) Reset() { *m = RuntimeUInt32{} } +func (m *RuntimeUInt32) String() string { return proto.CompactTextString(m) } +func (*RuntimeUInt32) ProtoMessage() {} +func (*RuntimeUInt32) Descriptor() ([]byte, []int) { + return fileDescriptor_base_0126f5109e43fb63, []int{3} +} +func (m *RuntimeUInt32) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RuntimeUInt32) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_RuntimeUInt32.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *RuntimeUInt32) XXX_Merge(src proto.Message) { + xxx_messageInfo_RuntimeUInt32.Merge(dst, src) +} +func (m *RuntimeUInt32) XXX_Size() int { + return m.Size() +} +func (m *RuntimeUInt32) XXX_DiscardUnknown() { + xxx_messageInfo_RuntimeUInt32.DiscardUnknown(m) +} + +var xxx_messageInfo_RuntimeUInt32 proto.InternalMessageInfo + +func (m *RuntimeUInt32) GetDefaultValue() uint32 { + if m != nil { + return m.DefaultValue + } + return 0 +} + +func (m *RuntimeUInt32) GetRuntimeKey() string { + if m != nil { + return m.RuntimeKey + } + return "" +} + +// Header name/value pair. +type HeaderValue struct { + // Header name. + Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + // Header value. + // + // The same :ref:`format specifier ` as used for + // :ref:`HTTP access logging ` applies here, however + // unknown header values are replaced with the empty string instead of `-`. + Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *HeaderValue) Reset() { *m = HeaderValue{} } +func (m *HeaderValue) String() string { return proto.CompactTextString(m) } +func (*HeaderValue) ProtoMessage() {} +func (*HeaderValue) Descriptor() ([]byte, []int) { + return fileDescriptor_base_0126f5109e43fb63, []int{4} +} +func (m *HeaderValue) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *HeaderValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_HeaderValue.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *HeaderValue) XXX_Merge(src proto.Message) { + xxx_messageInfo_HeaderValue.Merge(dst, src) +} +func (m *HeaderValue) XXX_Size() int { + return m.Size() +} +func (m *HeaderValue) XXX_DiscardUnknown() { + xxx_messageInfo_HeaderValue.DiscardUnknown(m) +} + +var xxx_messageInfo_HeaderValue proto.InternalMessageInfo + +func (m *HeaderValue) GetKey() string { + if m != nil { + return m.Key + } + return "" +} + +func (m *HeaderValue) GetValue() string { + if m != nil { + return m.Value + } + return "" +} + +// Header name/value pair plus option to control append behavior. +type HeaderValueOption struct { + // Header name/value pair that this option applies to. + Header *HeaderValue `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"` + // Should the value be appended? If true (default), the value is appended to + // existing values. + Append *types.BoolValue `protobuf:"bytes,2,opt,name=append" json:"append,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *HeaderValueOption) Reset() { *m = HeaderValueOption{} } +func (m *HeaderValueOption) String() string { return proto.CompactTextString(m) } +func (*HeaderValueOption) ProtoMessage() {} +func (*HeaderValueOption) Descriptor() ([]byte, []int) { + return fileDescriptor_base_0126f5109e43fb63, []int{5} +} +func (m *HeaderValueOption) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *HeaderValueOption) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_HeaderValueOption.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *HeaderValueOption) XXX_Merge(src proto.Message) { + xxx_messageInfo_HeaderValueOption.Merge(dst, src) +} +func (m *HeaderValueOption) XXX_Size() int { + return m.Size() +} +func (m *HeaderValueOption) XXX_DiscardUnknown() { + xxx_messageInfo_HeaderValueOption.DiscardUnknown(m) +} + +var xxx_messageInfo_HeaderValueOption proto.InternalMessageInfo + +func (m *HeaderValueOption) GetHeader() *HeaderValue { + if m != nil { + return m.Header + } + return nil +} + +func (m *HeaderValueOption) GetAppend() *types.BoolValue { + if m != nil { + return m.Append + } + return nil +} + +// Data source consisting of either a file or an inline value. +type DataSource struct { + // Types that are valid to be assigned to Specifier: + // *DataSource_Filename + // *DataSource_InlineBytes + // *DataSource_InlineString + Specifier isDataSource_Specifier `protobuf_oneof:"specifier"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *DataSource) Reset() { *m = DataSource{} } +func (m *DataSource) String() string { return proto.CompactTextString(m) } +func (*DataSource) ProtoMessage() {} +func (*DataSource) Descriptor() ([]byte, []int) { + return fileDescriptor_base_0126f5109e43fb63, []int{6} +} +func (m *DataSource) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DataSource) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_DataSource.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *DataSource) XXX_Merge(src proto.Message) { + xxx_messageInfo_DataSource.Merge(dst, src) +} +func (m *DataSource) XXX_Size() int { + return m.Size() +} +func (m *DataSource) XXX_DiscardUnknown() { + xxx_messageInfo_DataSource.DiscardUnknown(m) +} + +var xxx_messageInfo_DataSource proto.InternalMessageInfo + +type isDataSource_Specifier interface { + isDataSource_Specifier() + Equal(interface{}) bool + MarshalTo([]byte) (int, error) + Size() int +} + +type DataSource_Filename struct { + Filename string `protobuf:"bytes,1,opt,name=filename,proto3,oneof"` +} +type DataSource_InlineBytes struct { + InlineBytes []byte `protobuf:"bytes,2,opt,name=inline_bytes,json=inlineBytes,proto3,oneof"` +} +type DataSource_InlineString struct { + InlineString string `protobuf:"bytes,3,opt,name=inline_string,json=inlineString,proto3,oneof"` +} + +func (*DataSource_Filename) isDataSource_Specifier() {} +func (*DataSource_InlineBytes) isDataSource_Specifier() {} +func (*DataSource_InlineString) isDataSource_Specifier() {} + +func (m *DataSource) GetSpecifier() isDataSource_Specifier { + if m != nil { + return m.Specifier + } + return nil +} + +func (m *DataSource) GetFilename() string { + if x, ok := m.GetSpecifier().(*DataSource_Filename); ok { + return x.Filename + } + return "" +} + +func (m *DataSource) GetInlineBytes() []byte { + if x, ok := m.GetSpecifier().(*DataSource_InlineBytes); ok { + return x.InlineBytes + } + return nil +} + +func (m *DataSource) GetInlineString() string { + if x, ok := m.GetSpecifier().(*DataSource_InlineString); ok { + return x.InlineString + } + return "" +} + +// XXX_OneofFuncs is for the internal use of the proto package. +func (*DataSource) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { + return _DataSource_OneofMarshaler, _DataSource_OneofUnmarshaler, _DataSource_OneofSizer, []interface{}{ + (*DataSource_Filename)(nil), + (*DataSource_InlineBytes)(nil), + (*DataSource_InlineString)(nil), + } +} + +func _DataSource_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { + m := msg.(*DataSource) + // specifier + switch x := m.Specifier.(type) { + case *DataSource_Filename: + _ = b.EncodeVarint(1<<3 | proto.WireBytes) + _ = b.EncodeStringBytes(x.Filename) + case *DataSource_InlineBytes: + _ = b.EncodeVarint(2<<3 | proto.WireBytes) + _ = b.EncodeRawBytes(x.InlineBytes) + case *DataSource_InlineString: + _ = b.EncodeVarint(3<<3 | proto.WireBytes) + _ = b.EncodeStringBytes(x.InlineString) + case nil: + default: + return fmt.Errorf("DataSource.Specifier has unexpected type %T", x) + } + return nil +} + +func _DataSource_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { + m := msg.(*DataSource) + switch tag { + case 1: // specifier.filename + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeStringBytes() + m.Specifier = &DataSource_Filename{x} + return true, err + case 2: // specifier.inline_bytes + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeRawBytes(true) + m.Specifier = &DataSource_InlineBytes{x} + return true, err + case 3: // specifier.inline_string + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeStringBytes() + m.Specifier = &DataSource_InlineString{x} + return true, err + default: + return false, nil + } +} + +func _DataSource_OneofSizer(msg proto.Message) (n int) { + m := msg.(*DataSource) + // specifier + switch x := m.Specifier.(type) { + case *DataSource_Filename: + n += 1 // tag and wire + n += proto.SizeVarint(uint64(len(x.Filename))) + n += len(x.Filename) + case *DataSource_InlineBytes: + n += 1 // tag and wire + n += proto.SizeVarint(uint64(len(x.InlineBytes))) + n += len(x.InlineBytes) + case *DataSource_InlineString: + n += 1 // tag and wire + n += proto.SizeVarint(uint64(len(x.InlineString))) + n += len(x.InlineString) + case nil: + default: + panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) + } + return n +} + +// Configuration for transport socket in :ref:`listeners ` and +// :ref:`clusters `. If the configuration is +// empty, a default transport socket implementation and configuration will be +// chosen based on the platform and existence of tls_context. +type TransportSocket struct { + // The name of the transport socket to instantiate. The name must match a supported transport + // socket implementation. + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // Implementation specific configuration which depends on the implementation being instantiated. + // See the supported transport socket implementations for further documentation. + Config *types.Struct `protobuf:"bytes,2,opt,name=config" json:"config,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *TransportSocket) Reset() { *m = TransportSocket{} } +func (m *TransportSocket) String() string { return proto.CompactTextString(m) } +func (*TransportSocket) ProtoMessage() {} +func (*TransportSocket) Descriptor() ([]byte, []int) { + return fileDescriptor_base_0126f5109e43fb63, []int{7} +} +func (m *TransportSocket) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *TransportSocket) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_TransportSocket.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *TransportSocket) XXX_Merge(src proto.Message) { + xxx_messageInfo_TransportSocket.Merge(dst, src) +} +func (m *TransportSocket) XXX_Size() int { + return m.Size() +} +func (m *TransportSocket) XXX_DiscardUnknown() { + xxx_messageInfo_TransportSocket.DiscardUnknown(m) +} + +var xxx_messageInfo_TransportSocket proto.InternalMessageInfo + +func (m *TransportSocket) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *TransportSocket) GetConfig() *types.Struct { + if m != nil { + return m.Config + } + return nil +} + +// Generic socket option message. This would be used to set socket options that +// might not exist in upstream kernels or precompiled Envoy binaries. +type SocketOption struct { + // An optional name to give this socket option for debugging, etc. + // Uniqueness is not required and no special meaning is assumed. + Description string `protobuf:"bytes,1,opt,name=description,proto3" json:"description,omitempty"` + // Corresponding to the level value passed to setsockopt, such as IPPROTO_TCP + Level int64 `protobuf:"varint,2,opt,name=level,proto3" json:"level,omitempty"` + // The numeric name as passed to setsockopt + Name int64 `protobuf:"varint,3,opt,name=name,proto3" json:"name,omitempty"` + // Types that are valid to be assigned to Value: + // *SocketOption_IntValue + // *SocketOption_BufValue + Value isSocketOption_Value `protobuf_oneof:"value"` + // The state in which the option will be applied. When used in BindConfig + // STATE_PREBIND is currently the only valid value. + State SocketOption_SocketState `protobuf:"varint,6,opt,name=state,proto3,enum=envoy.api.v2.core.SocketOption_SocketState" json:"state,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SocketOption) Reset() { *m = SocketOption{} } +func (m *SocketOption) String() string { return proto.CompactTextString(m) } +func (*SocketOption) ProtoMessage() {} +func (*SocketOption) Descriptor() ([]byte, []int) { + return fileDescriptor_base_0126f5109e43fb63, []int{8} +} +func (m *SocketOption) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *SocketOption) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_SocketOption.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *SocketOption) XXX_Merge(src proto.Message) { + xxx_messageInfo_SocketOption.Merge(dst, src) +} +func (m *SocketOption) XXX_Size() int { + return m.Size() +} +func (m *SocketOption) XXX_DiscardUnknown() { + xxx_messageInfo_SocketOption.DiscardUnknown(m) +} + +var xxx_messageInfo_SocketOption proto.InternalMessageInfo + +type isSocketOption_Value interface { + isSocketOption_Value() + Equal(interface{}) bool + MarshalTo([]byte) (int, error) + Size() int +} + +type SocketOption_IntValue struct { + IntValue int64 `protobuf:"varint,4,opt,name=int_value,json=intValue,proto3,oneof"` +} +type SocketOption_BufValue struct { + BufValue []byte `protobuf:"bytes,5,opt,name=buf_value,json=bufValue,proto3,oneof"` +} + +func (*SocketOption_IntValue) isSocketOption_Value() {} +func (*SocketOption_BufValue) isSocketOption_Value() {} + +func (m *SocketOption) GetValue() isSocketOption_Value { + if m != nil { + return m.Value + } + return nil +} + +func (m *SocketOption) GetDescription() string { + if m != nil { + return m.Description + } + return "" +} + +func (m *SocketOption) GetLevel() int64 { + if m != nil { + return m.Level + } + return 0 +} + +func (m *SocketOption) GetName() int64 { + if m != nil { + return m.Name + } + return 0 +} + +func (m *SocketOption) GetIntValue() int64 { + if x, ok := m.GetValue().(*SocketOption_IntValue); ok { + return x.IntValue + } + return 0 +} + +func (m *SocketOption) GetBufValue() []byte { + if x, ok := m.GetValue().(*SocketOption_BufValue); ok { + return x.BufValue + } + return nil +} + +func (m *SocketOption) GetState() SocketOption_SocketState { + if m != nil { + return m.State + } + return STATE_PREBIND +} + +// XXX_OneofFuncs is for the internal use of the proto package. +func (*SocketOption) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { + return _SocketOption_OneofMarshaler, _SocketOption_OneofUnmarshaler, _SocketOption_OneofSizer, []interface{}{ + (*SocketOption_IntValue)(nil), + (*SocketOption_BufValue)(nil), + } +} + +func _SocketOption_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { + m := msg.(*SocketOption) + // value + switch x := m.Value.(type) { + case *SocketOption_IntValue: + _ = b.EncodeVarint(4<<3 | proto.WireVarint) + _ = b.EncodeVarint(uint64(x.IntValue)) + case *SocketOption_BufValue: + _ = b.EncodeVarint(5<<3 | proto.WireBytes) + _ = b.EncodeRawBytes(x.BufValue) + case nil: + default: + return fmt.Errorf("SocketOption.Value has unexpected type %T", x) + } + return nil +} + +func _SocketOption_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { + m := msg.(*SocketOption) + switch tag { + case 4: // value.int_value + if wire != proto.WireVarint { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeVarint() + m.Value = &SocketOption_IntValue{int64(x)} + return true, err + case 5: // value.buf_value + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeRawBytes(true) + m.Value = &SocketOption_BufValue{x} + return true, err + default: + return false, nil + } +} + +func _SocketOption_OneofSizer(msg proto.Message) (n int) { + m := msg.(*SocketOption) + // value + switch x := m.Value.(type) { + case *SocketOption_IntValue: + n += 1 // tag and wire + n += proto.SizeVarint(uint64(x.IntValue)) + case *SocketOption_BufValue: + n += 1 // tag and wire + n += proto.SizeVarint(uint64(len(x.BufValue))) + n += len(x.BufValue) + case nil: + default: + panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) + } + return n +} + +func init() { + proto.RegisterType((*Locality)(nil), "envoy.api.v2.core.Locality") + proto.RegisterType((*Node)(nil), "envoy.api.v2.core.Node") + proto.RegisterType((*Metadata)(nil), "envoy.api.v2.core.Metadata") + proto.RegisterMapType((map[string]*types.Struct)(nil), "envoy.api.v2.core.Metadata.FilterMetadataEntry") + proto.RegisterType((*RuntimeUInt32)(nil), "envoy.api.v2.core.RuntimeUInt32") + proto.RegisterType((*HeaderValue)(nil), "envoy.api.v2.core.HeaderValue") + proto.RegisterType((*HeaderValueOption)(nil), "envoy.api.v2.core.HeaderValueOption") + proto.RegisterType((*DataSource)(nil), "envoy.api.v2.core.DataSource") + proto.RegisterType((*TransportSocket)(nil), "envoy.api.v2.core.TransportSocket") + proto.RegisterType((*SocketOption)(nil), "envoy.api.v2.core.SocketOption") + proto.RegisterEnum("envoy.api.v2.core.RoutingPriority", RoutingPriority_name, RoutingPriority_value) + proto.RegisterEnum("envoy.api.v2.core.RequestMethod", RequestMethod_name, RequestMethod_value) + proto.RegisterEnum("envoy.api.v2.core.SocketOption_SocketState", SocketOption_SocketState_name, SocketOption_SocketState_value) +} +func (this *Locality) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Locality) + if !ok { + that2, ok := that.(Locality) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Region != that1.Region { + return false + } + if this.Zone != that1.Zone { + return false + } + if this.SubZone != that1.SubZone { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *Node) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Node) + if !ok { + that2, ok := that.(Node) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Id != that1.Id { + return false + } + if this.Cluster != that1.Cluster { + return false + } + if !this.Metadata.Equal(that1.Metadata) { + return false + } + if !this.Locality.Equal(that1.Locality) { + return false + } + if this.BuildVersion != that1.BuildVersion { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *Metadata) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Metadata) + if !ok { + that2, ok := that.(Metadata) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if len(this.FilterMetadata) != len(that1.FilterMetadata) { + return false + } + for i := range this.FilterMetadata { + if !this.FilterMetadata[i].Equal(that1.FilterMetadata[i]) { + return false + } + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *RuntimeUInt32) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*RuntimeUInt32) + if !ok { + that2, ok := that.(RuntimeUInt32) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.DefaultValue != that1.DefaultValue { + return false + } + if this.RuntimeKey != that1.RuntimeKey { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *HeaderValue) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*HeaderValue) + if !ok { + that2, ok := that.(HeaderValue) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Key != that1.Key { + return false + } + if this.Value != that1.Value { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *HeaderValueOption) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*HeaderValueOption) + if !ok { + that2, ok := that.(HeaderValueOption) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.Header.Equal(that1.Header) { + return false + } + if !this.Append.Equal(that1.Append) { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *DataSource) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*DataSource) + if !ok { + that2, ok := that.(DataSource) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if that1.Specifier == nil { + if this.Specifier != nil { + return false + } + } else if this.Specifier == nil { + return false + } else if !this.Specifier.Equal(that1.Specifier) { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *DataSource_Filename) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*DataSource_Filename) + if !ok { + that2, ok := that.(DataSource_Filename) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Filename != that1.Filename { + return false + } + return true +} +func (this *DataSource_InlineBytes) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*DataSource_InlineBytes) + if !ok { + that2, ok := that.(DataSource_InlineBytes) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !bytes.Equal(this.InlineBytes, that1.InlineBytes) { + return false + } + return true +} +func (this *DataSource_InlineString) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*DataSource_InlineString) + if !ok { + that2, ok := that.(DataSource_InlineString) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.InlineString != that1.InlineString { + return false + } + return true +} +func (this *TransportSocket) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*TransportSocket) + if !ok { + that2, ok := that.(TransportSocket) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Name != that1.Name { + return false + } + if !this.Config.Equal(that1.Config) { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *SocketOption) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*SocketOption) + if !ok { + that2, ok := that.(SocketOption) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Description != that1.Description { + return false + } + if this.Level != that1.Level { + return false + } + if this.Name != that1.Name { + return false + } + if that1.Value == nil { + if this.Value != nil { + return false + } + } else if this.Value == nil { + return false + } else if !this.Value.Equal(that1.Value) { + return false + } + if this.State != that1.State { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *SocketOption_IntValue) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*SocketOption_IntValue) + if !ok { + that2, ok := that.(SocketOption_IntValue) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.IntValue != that1.IntValue { + return false + } + return true +} +func (this *SocketOption_BufValue) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*SocketOption_BufValue) + if !ok { + that2, ok := that.(SocketOption_BufValue) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !bytes.Equal(this.BufValue, that1.BufValue) { + return false + } + return true +} +func (m *Locality) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Locality) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Region) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintBase(dAtA, i, uint64(len(m.Region))) + i += copy(dAtA[i:], m.Region) + } + if len(m.Zone) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintBase(dAtA, i, uint64(len(m.Zone))) + i += copy(dAtA[i:], m.Zone) + } + if len(m.SubZone) > 0 { + dAtA[i] = 0x1a + i++ + i = encodeVarintBase(dAtA, i, uint64(len(m.SubZone))) + i += copy(dAtA[i:], m.SubZone) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *Node) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Node) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Id) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintBase(dAtA, i, uint64(len(m.Id))) + i += copy(dAtA[i:], m.Id) + } + if len(m.Cluster) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintBase(dAtA, i, uint64(len(m.Cluster))) + i += copy(dAtA[i:], m.Cluster) + } + if m.Metadata != nil { + dAtA[i] = 0x1a + i++ + i = encodeVarintBase(dAtA, i, uint64(m.Metadata.Size())) + n1, err := m.Metadata.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n1 + } + if m.Locality != nil { + dAtA[i] = 0x22 + i++ + i = encodeVarintBase(dAtA, i, uint64(m.Locality.Size())) + n2, err := m.Locality.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n2 + } + if len(m.BuildVersion) > 0 { + dAtA[i] = 0x2a + i++ + i = encodeVarintBase(dAtA, i, uint64(len(m.BuildVersion))) + i += copy(dAtA[i:], m.BuildVersion) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *Metadata) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Metadata) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.FilterMetadata) > 0 { + for k, _ := range m.FilterMetadata { + dAtA[i] = 0xa + i++ + v := m.FilterMetadata[k] + msgSize := 0 + if v != nil { + msgSize = v.Size() + msgSize += 1 + sovBase(uint64(msgSize)) + } + mapSize := 1 + len(k) + sovBase(uint64(len(k))) + msgSize + i = encodeVarintBase(dAtA, i, uint64(mapSize)) + dAtA[i] = 0xa + i++ + i = encodeVarintBase(dAtA, i, uint64(len(k))) + i += copy(dAtA[i:], k) + if v != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintBase(dAtA, i, uint64(v.Size())) + n3, err := v.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n3 + } + } + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *RuntimeUInt32) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *RuntimeUInt32) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.DefaultValue != 0 { + dAtA[i] = 0x10 + i++ + i = encodeVarintBase(dAtA, i, uint64(m.DefaultValue)) + } + if len(m.RuntimeKey) > 0 { + dAtA[i] = 0x1a + i++ + i = encodeVarintBase(dAtA, i, uint64(len(m.RuntimeKey))) + i += copy(dAtA[i:], m.RuntimeKey) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *HeaderValue) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *HeaderValue) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Key) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintBase(dAtA, i, uint64(len(m.Key))) + i += copy(dAtA[i:], m.Key) + } + if len(m.Value) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintBase(dAtA, i, uint64(len(m.Value))) + i += copy(dAtA[i:], m.Value) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *HeaderValueOption) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *HeaderValueOption) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Header != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintBase(dAtA, i, uint64(m.Header.Size())) + n4, err := m.Header.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n4 + } + if m.Append != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintBase(dAtA, i, uint64(m.Append.Size())) + n5, err := m.Append.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n5 + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *DataSource) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *DataSource) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Specifier != nil { + nn6, err := m.Specifier.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += nn6 + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *DataSource_Filename) MarshalTo(dAtA []byte) (int, error) { + i := 0 + dAtA[i] = 0xa + i++ + i = encodeVarintBase(dAtA, i, uint64(len(m.Filename))) + i += copy(dAtA[i:], m.Filename) + return i, nil +} +func (m *DataSource_InlineBytes) MarshalTo(dAtA []byte) (int, error) { + i := 0 + if m.InlineBytes != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintBase(dAtA, i, uint64(len(m.InlineBytes))) + i += copy(dAtA[i:], m.InlineBytes) + } + return i, nil +} +func (m *DataSource_InlineString) MarshalTo(dAtA []byte) (int, error) { + i := 0 + dAtA[i] = 0x1a + i++ + i = encodeVarintBase(dAtA, i, uint64(len(m.InlineString))) + i += copy(dAtA[i:], m.InlineString) + return i, nil +} +func (m *TransportSocket) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *TransportSocket) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Name) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintBase(dAtA, i, uint64(len(m.Name))) + i += copy(dAtA[i:], m.Name) + } + if m.Config != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintBase(dAtA, i, uint64(m.Config.Size())) + n7, err := m.Config.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n7 + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *SocketOption) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *SocketOption) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Description) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintBase(dAtA, i, uint64(len(m.Description))) + i += copy(dAtA[i:], m.Description) + } + if m.Level != 0 { + dAtA[i] = 0x10 + i++ + i = encodeVarintBase(dAtA, i, uint64(m.Level)) + } + if m.Name != 0 { + dAtA[i] = 0x18 + i++ + i = encodeVarintBase(dAtA, i, uint64(m.Name)) + } + if m.Value != nil { + nn8, err := m.Value.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += nn8 + } + if m.State != 0 { + dAtA[i] = 0x30 + i++ + i = encodeVarintBase(dAtA, i, uint64(m.State)) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *SocketOption_IntValue) MarshalTo(dAtA []byte) (int, error) { + i := 0 + dAtA[i] = 0x20 + i++ + i = encodeVarintBase(dAtA, i, uint64(m.IntValue)) + return i, nil +} +func (m *SocketOption_BufValue) MarshalTo(dAtA []byte) (int, error) { + i := 0 + if m.BufValue != nil { + dAtA[i] = 0x2a + i++ + i = encodeVarintBase(dAtA, i, uint64(len(m.BufValue))) + i += copy(dAtA[i:], m.BufValue) + } + return i, nil +} +func encodeVarintBase(dAtA []byte, offset int, v uint64) int { + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return offset + 1 +} +func (m *Locality) Size() (n int) { + var l int + _ = l + l = len(m.Region) + if l > 0 { + n += 1 + l + sovBase(uint64(l)) + } + l = len(m.Zone) + if l > 0 { + n += 1 + l + sovBase(uint64(l)) + } + l = len(m.SubZone) + if l > 0 { + n += 1 + l + sovBase(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *Node) Size() (n int) { + var l int + _ = l + l = len(m.Id) + if l > 0 { + n += 1 + l + sovBase(uint64(l)) + } + l = len(m.Cluster) + if l > 0 { + n += 1 + l + sovBase(uint64(l)) + } + if m.Metadata != nil { + l = m.Metadata.Size() + n += 1 + l + sovBase(uint64(l)) + } + if m.Locality != nil { + l = m.Locality.Size() + n += 1 + l + sovBase(uint64(l)) + } + l = len(m.BuildVersion) + if l > 0 { + n += 1 + l + sovBase(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *Metadata) Size() (n int) { + var l int + _ = l + if len(m.FilterMetadata) > 0 { + for k, v := range m.FilterMetadata { + _ = k + _ = v + l = 0 + if v != nil { + l = v.Size() + l += 1 + sovBase(uint64(l)) + } + mapEntrySize := 1 + len(k) + sovBase(uint64(len(k))) + l + n += mapEntrySize + 1 + sovBase(uint64(mapEntrySize)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *RuntimeUInt32) Size() (n int) { + var l int + _ = l + if m.DefaultValue != 0 { + n += 1 + sovBase(uint64(m.DefaultValue)) + } + l = len(m.RuntimeKey) + if l > 0 { + n += 1 + l + sovBase(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *HeaderValue) Size() (n int) { + var l int + _ = l + l = len(m.Key) + if l > 0 { + n += 1 + l + sovBase(uint64(l)) + } + l = len(m.Value) + if l > 0 { + n += 1 + l + sovBase(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *HeaderValueOption) Size() (n int) { + var l int + _ = l + if m.Header != nil { + l = m.Header.Size() + n += 1 + l + sovBase(uint64(l)) + } + if m.Append != nil { + l = m.Append.Size() + n += 1 + l + sovBase(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *DataSource) Size() (n int) { + var l int + _ = l + if m.Specifier != nil { + n += m.Specifier.Size() + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *DataSource_Filename) Size() (n int) { + var l int + _ = l + l = len(m.Filename) + n += 1 + l + sovBase(uint64(l)) + return n +} +func (m *DataSource_InlineBytes) Size() (n int) { + var l int + _ = l + if m.InlineBytes != nil { + l = len(m.InlineBytes) + n += 1 + l + sovBase(uint64(l)) + } + return n +} +func (m *DataSource_InlineString) Size() (n int) { + var l int + _ = l + l = len(m.InlineString) + n += 1 + l + sovBase(uint64(l)) + return n +} +func (m *TransportSocket) Size() (n int) { + var l int + _ = l + l = len(m.Name) + if l > 0 { + n += 1 + l + sovBase(uint64(l)) + } + if m.Config != nil { + l = m.Config.Size() + n += 1 + l + sovBase(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *SocketOption) Size() (n int) { + var l int + _ = l + l = len(m.Description) + if l > 0 { + n += 1 + l + sovBase(uint64(l)) + } + if m.Level != 0 { + n += 1 + sovBase(uint64(m.Level)) + } + if m.Name != 0 { + n += 1 + sovBase(uint64(m.Name)) + } + if m.Value != nil { + n += m.Value.Size() + } + if m.State != 0 { + n += 1 + sovBase(uint64(m.State)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *SocketOption_IntValue) Size() (n int) { + var l int + _ = l + n += 1 + sovBase(uint64(m.IntValue)) + return n +} +func (m *SocketOption_BufValue) Size() (n int) { + var l int + _ = l + if m.BufValue != nil { + l = len(m.BufValue) + n += 1 + l + sovBase(uint64(l)) + } + return n +} + +func sovBase(x uint64) (n int) { + for { + n++ + x >>= 7 + if x == 0 { + break + } + } + return n +} +func sozBase(x uint64) (n int) { + return sovBase(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Locality) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBase + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Locality: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Locality: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Region", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBase + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthBase + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Region = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Zone", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBase + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthBase + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Zone = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SubZone", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBase + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthBase + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SubZone = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipBase(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthBase + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Node) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBase + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Node: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Node: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBase + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthBase + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Id = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Cluster", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBase + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthBase + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Cluster = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Metadata", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBase + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthBase + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Metadata == nil { + m.Metadata = &types.Struct{} + } + if err := m.Metadata.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Locality", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBase + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthBase + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Locality == nil { + m.Locality = &Locality{} + } + if err := m.Locality.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BuildVersion", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBase + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthBase + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BuildVersion = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipBase(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthBase + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Metadata) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBase + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Metadata: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Metadata: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FilterMetadata", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBase + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthBase + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.FilterMetadata == nil { + m.FilterMetadata = make(map[string]*types.Struct) + } + var mapkey string + var mapvalue *types.Struct + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBase + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + var stringLenmapkey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBase + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapkey |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return ErrInvalidLengthBase + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey > l { + return io.ErrUnexpectedEOF + } + mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) + iNdEx = postStringIndexmapkey + } else if fieldNum == 2 { + var mapmsglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBase + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + mapmsglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if mapmsglen < 0 { + return ErrInvalidLengthBase + } + postmsgIndex := iNdEx + mapmsglen + if mapmsglen < 0 { + return ErrInvalidLengthBase + } + if postmsgIndex > l { + return io.ErrUnexpectedEOF + } + mapvalue = &types.Struct{} + if err := mapvalue.Unmarshal(dAtA[iNdEx:postmsgIndex]); err != nil { + return err + } + iNdEx = postmsgIndex + } else { + iNdEx = entryPreIndex + skippy, err := skipBase(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthBase + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.FilterMetadata[mapkey] = mapvalue + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipBase(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthBase + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *RuntimeUInt32) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBase + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: RuntimeUInt32: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RuntimeUInt32: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field DefaultValue", wireType) + } + m.DefaultValue = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBase + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.DefaultValue |= (uint32(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RuntimeKey", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBase + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthBase + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RuntimeKey = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipBase(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthBase + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *HeaderValue) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBase + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: HeaderValue: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: HeaderValue: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBase + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthBase + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Key = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBase + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthBase + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Value = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipBase(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthBase + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *HeaderValueOption) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBase + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: HeaderValueOption: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: HeaderValueOption: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBase + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthBase + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Header == nil { + m.Header = &HeaderValue{} + } + if err := m.Header.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Append", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBase + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthBase + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Append == nil { + m.Append = &types.BoolValue{} + } + if err := m.Append.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipBase(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthBase + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DataSource) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBase + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DataSource: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DataSource: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Filename", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBase + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthBase + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Specifier = &DataSource_Filename{string(dAtA[iNdEx:postIndex])} + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field InlineBytes", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBase + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthBase + } + postIndex := iNdEx + byteLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := make([]byte, postIndex-iNdEx) + copy(v, dAtA[iNdEx:postIndex]) + m.Specifier = &DataSource_InlineBytes{v} + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field InlineString", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBase + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthBase + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Specifier = &DataSource_InlineString{string(dAtA[iNdEx:postIndex])} + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipBase(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthBase + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *TransportSocket) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBase + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: TransportSocket: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TransportSocket: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBase + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthBase + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Config", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBase + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthBase + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Config == nil { + m.Config = &types.Struct{} + } + if err := m.Config.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipBase(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthBase + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *SocketOption) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBase + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: SocketOption: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SocketOption: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBase + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthBase + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Description = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Level", wireType) + } + m.Level = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBase + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Level |= (int64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + m.Name = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBase + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Name |= (int64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field IntValue", wireType) + } + var v int64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBase + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (int64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.Value = &SocketOption_IntValue{v} + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BufValue", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBase + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthBase + } + postIndex := iNdEx + byteLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := make([]byte, postIndex-iNdEx) + copy(v, dAtA[iNdEx:postIndex]) + m.Value = &SocketOption_BufValue{v} + iNdEx = postIndex + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field State", wireType) + } + m.State = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBase + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.State |= (SocketOption_SocketState(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipBase(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthBase + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipBase(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowBase + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowBase + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + return iNdEx, nil + case 1: + iNdEx += 8 + return iNdEx, nil + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowBase + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + iNdEx += length + if length < 0 { + return 0, ErrInvalidLengthBase + } + return iNdEx, nil + case 3: + for { + var innerWire uint64 + var start int = iNdEx + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowBase + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + innerWire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + innerWireType := int(innerWire & 0x7) + if innerWireType == 4 { + break + } + next, err := skipBase(dAtA[start:]) + if err != nil { + return 0, err + } + iNdEx = start + next + } + return iNdEx, nil + case 4: + return iNdEx, nil + case 5: + iNdEx += 4 + return iNdEx, nil + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + } + panic("unreachable") +} + +var ( + ErrInvalidLengthBase = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowBase = fmt.Errorf("proto: integer overflow") +) + +func init() { proto.RegisterFile("envoy/api/v2/core/base.proto", fileDescriptor_base_0126f5109e43fb63) } + +var fileDescriptor_base_0126f5109e43fb63 = []byte{ + // 974 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x54, 0x4f, 0x6f, 0xe3, 0xc4, + 0x1b, 0xee, 0xe4, 0x5f, 0x93, 0x37, 0x49, 0xeb, 0xce, 0x56, 0xdd, 0xfe, 0xba, 0xdb, 0xa8, 0xca, + 0xef, 0x40, 0x55, 0x84, 0x8d, 0xd2, 0x03, 0x88, 0x13, 0x75, 0xe3, 0x36, 0x11, 0x6d, 0x12, 0x6c, + 0x77, 0x41, 0xbd, 0x04, 0x27, 0x9e, 0x64, 0x47, 0xeb, 0x7a, 0xc2, 0x78, 0x1c, 0x94, 0x3d, 0x22, + 0x0e, 0x08, 0x3e, 0x06, 0x17, 0x24, 0xbe, 0x00, 0xe2, 0x54, 0x89, 0x0b, 0x37, 0xf8, 0x08, 0xa8, + 0xb7, 0xfd, 0x16, 0x68, 0xc6, 0x93, 0x6e, 0xa0, 0x15, 0xdc, 0xde, 0xf7, 0x79, 0x9f, 0xe7, 0xfd, + 0x37, 0xaf, 0x0d, 0xcf, 0x49, 0x3c, 0x67, 0x0b, 0x2b, 0x98, 0x51, 0x6b, 0xde, 0xb2, 0xc6, 0x8c, + 0x13, 0x6b, 0x14, 0x24, 0xc4, 0x9c, 0x71, 0x26, 0x18, 0xde, 0x52, 0x51, 0x33, 0x98, 0x51, 0x73, + 0xde, 0x32, 0x65, 0x74, 0xef, 0xf9, 0x94, 0xb1, 0x69, 0x44, 0x2c, 0x45, 0x18, 0xa5, 0x13, 0x2b, + 0x11, 0x3c, 0x1d, 0x8b, 0x4c, 0xb0, 0xd7, 0xf8, 0x67, 0xf4, 0x2b, 0x1e, 0xcc, 0x66, 0x84, 0x27, + 0x3a, 0xfe, 0x74, 0x1e, 0x44, 0x34, 0x0c, 0x04, 0xb1, 0x96, 0x86, 0x0e, 0x6c, 0x4f, 0xd9, 0x94, + 0x29, 0xd3, 0x92, 0x56, 0x86, 0x36, 0x3f, 0x85, 0xf2, 0x05, 0x1b, 0x07, 0x11, 0x15, 0x0b, 0xbc, + 0x03, 0x25, 0x4e, 0xa6, 0x94, 0xc5, 0xbb, 0xe8, 0x00, 0x1d, 0x56, 0x5c, 0xed, 0x61, 0x0c, 0x85, + 0xd7, 0x2c, 0x26, 0xbb, 0x39, 0x85, 0x2a, 0x1b, 0xff, 0x0f, 0xca, 0x49, 0x3a, 0x1a, 0x2a, 0x3c, + 0xaf, 0xf0, 0xf5, 0x24, 0x1d, 0x5d, 0xb3, 0x98, 0x34, 0x7f, 0x45, 0x50, 0xe8, 0xb1, 0x90, 0xe0, + 0x0d, 0xc8, 0xd1, 0x50, 0xe7, 0xca, 0xd1, 0x10, 0xef, 0xc2, 0xfa, 0x38, 0x4a, 0x13, 0x41, 0xb8, + 0x4e, 0xb5, 0x74, 0xf1, 0x31, 0x94, 0x6f, 0x88, 0x08, 0xc2, 0x40, 0x04, 0x2a, 0x5b, 0xb5, 0xf5, + 0xd4, 0xcc, 0xe6, 0x34, 0x97, 0x73, 0x9a, 0x9e, 0xda, 0x82, 0x7b, 0x4f, 0xc4, 0x1f, 0x40, 0x39, + 0xd2, 0xad, 0xef, 0x16, 0x94, 0xe8, 0x99, 0xf9, 0x60, 0x9b, 0xe6, 0x72, 0x3a, 0xf7, 0x9e, 0x8c, + 0xff, 0x0f, 0xf5, 0x51, 0x4a, 0xa3, 0x70, 0x38, 0x27, 0x3c, 0x91, 0xe3, 0x16, 0x55, 0x37, 0x35, + 0x05, 0xbe, 0xc8, 0xb0, 0xe6, 0x2d, 0x82, 0xf2, 0xe5, 0xb2, 0xd4, 0xe7, 0xb0, 0x39, 0xa1, 0x91, + 0x20, 0x7c, 0x78, 0xdf, 0x26, 0x3a, 0xc8, 0x1f, 0x56, 0x5b, 0xd6, 0x23, 0x15, 0x97, 0x2a, 0xf3, + 0x4c, 0x49, 0x96, 0xae, 0x13, 0x0b, 0xbe, 0x70, 0x37, 0x26, 0x7f, 0x03, 0xf7, 0xae, 0xe1, 0xc9, + 0x23, 0x34, 0x6c, 0x40, 0xfe, 0x15, 0x59, 0xe8, 0xdd, 0x49, 0x13, 0xbf, 0x07, 0xc5, 0x79, 0x10, + 0xa5, 0xd9, 0x2b, 0xfc, 0xcb, 0x7e, 0x32, 0xd6, 0x47, 0xb9, 0x0f, 0x51, 0xf3, 0x0b, 0xa8, 0xbb, + 0x69, 0x2c, 0xe8, 0x0d, 0xb9, 0xea, 0xc6, 0xe2, 0xb8, 0x25, 0x07, 0x0f, 0xc9, 0x24, 0x48, 0x23, + 0x31, 0x7c, 0x9b, 0xab, 0xee, 0xd6, 0x34, 0xf8, 0x42, 0x62, 0xf8, 0x08, 0xaa, 0x3c, 0x53, 0x0d, + 0x65, 0x0b, 0xea, 0x71, 0xed, 0xca, 0x2f, 0x6f, 0x6e, 0xf3, 0x05, 0x9e, 0x3b, 0x40, 0x2e, 0xe8, + 0xe8, 0x27, 0x64, 0xd1, 0xfc, 0x18, 0xaa, 0x1d, 0x12, 0x84, 0x84, 0x67, 0xd2, 0x67, 0x2b, 0x5d, + 0xaf, 0x4a, 0xd4, 0x00, 0xdb, 0xab, 0x03, 0x54, 0x74, 0x9f, 0xcd, 0xef, 0x11, 0x6c, 0xad, 0xa4, + 0xe8, 0xcf, 0x84, 0xbc, 0x38, 0x1b, 0x4a, 0x2f, 0x15, 0xa8, 0x72, 0x55, 0x5b, 0x8d, 0x47, 0xd6, + 0xbc, 0xa2, 0xb2, 0x41, 0xd6, 0x2a, 0x7e, 0x87, 0x72, 0x06, 0x72, 0xb5, 0x12, 0xb7, 0xa0, 0x24, + 0x3f, 0x8c, 0x38, 0xd4, 0x1b, 0xdb, 0x7b, 0xb0, 0x31, 0x9b, 0xb1, 0x48, 0xe9, 0x5d, 0xcd, 0x6c, + 0xfe, 0x84, 0x00, 0xda, 0x81, 0x08, 0x3c, 0x96, 0xf2, 0x31, 0xc1, 0xef, 0x40, 0x79, 0x42, 0x23, + 0x12, 0x07, 0x37, 0xe4, 0xc1, 0x50, 0x9d, 0x35, 0xf7, 0x3e, 0x88, 0x4d, 0xa8, 0xd1, 0x38, 0xa2, + 0x31, 0x19, 0x8e, 0x16, 0x82, 0x24, 0xaa, 0x62, 0x4d, 0x93, 0x5f, 0xe7, 0x0c, 0x49, 0xae, 0x66, + 0x04, 0x5b, 0xc6, 0xf1, 0xfb, 0x50, 0xd7, 0xfc, 0x44, 0x70, 0x1a, 0x4f, 0x1f, 0x6c, 0xb9, 0xb3, + 0xe6, 0xea, 0x8c, 0x9e, 0x22, 0xd8, 0x18, 0x2a, 0xc9, 0x8c, 0x8c, 0xe9, 0x84, 0x12, 0x8e, 0x8b, + 0x3f, 0xbf, 0xb9, 0xcd, 0xa3, 0x66, 0x00, 0x9b, 0x3e, 0x0f, 0xe2, 0x64, 0xc6, 0xb8, 0xf0, 0xd8, + 0xf8, 0x15, 0x11, 0x78, 0x1f, 0x0a, 0x8f, 0x76, 0xeb, 0x2a, 0x18, 0x5b, 0x50, 0x1a, 0xb3, 0x78, + 0x42, 0xa7, 0xff, 0x75, 0x45, 0x9a, 0xd6, 0xfc, 0x3d, 0x07, 0xb5, 0x2c, 0xb5, 0x7e, 0x99, 0x03, + 0xa8, 0x86, 0x24, 0x19, 0x73, 0xaa, 0x5c, 0x7d, 0xa0, 0xab, 0x90, 0x7c, 0xe7, 0x88, 0xcc, 0x49, + 0xa4, 0x4a, 0xe4, 0xdd, 0xcc, 0x91, 0xff, 0x10, 0xd5, 0x58, 0x5e, 0x81, 0x59, 0x37, 0xfb, 0x50, + 0xa1, 0xf1, 0xf2, 0x14, 0xe5, 0x17, 0x9c, 0x97, 0x4b, 0xa5, 0xb1, 0x3e, 0xc4, 0x7d, 0xa8, 0x8c, + 0xd2, 0x89, 0x0e, 0xcb, 0x4f, 0xb4, 0x26, 0xc3, 0xa3, 0x74, 0x92, 0x85, 0x3f, 0x83, 0x62, 0x22, + 0x02, 0x41, 0x76, 0x4b, 0x07, 0xe8, 0x70, 0xa3, 0xf5, 0xee, 0x23, 0x27, 0xb2, 0xda, 0xb9, 0x76, + 0x3c, 0x29, 0xb1, 0xb7, 0xdf, 0xde, 0x8b, 0xb2, 0xbe, 0x56, 0x97, 0x93, 0xe5, 0x6b, 0x5e, 0x40, + 0x75, 0x85, 0x8b, 0xb7, 0xa0, 0xee, 0xf9, 0x27, 0xbe, 0x33, 0x1c, 0xb8, 0x8e, 0xdd, 0xed, 0xb5, + 0x8d, 0x35, 0xbc, 0x09, 0xd5, 0x0c, 0xb2, 0xfb, 0x57, 0xbd, 0xb6, 0x81, 0xf0, 0x13, 0xd8, 0xcc, + 0x80, 0x8b, 0xae, 0xe7, 0x3b, 0xbd, 0x6e, 0xef, 0xdc, 0xc8, 0xed, 0x15, 0xbe, 0xfd, 0xa1, 0xb1, + 0x66, 0x6f, 0xe8, 0xb3, 0xd7, 0x8f, 0x76, 0x74, 0x08, 0x9b, 0x2e, 0x4b, 0x05, 0x8d, 0xa7, 0x03, + 0x4e, 0x19, 0x97, 0xff, 0xa3, 0x2a, 0xac, 0xb7, 0x9d, 0xb3, 0x93, 0xab, 0x0b, 0xdf, 0x58, 0xc3, + 0x65, 0x28, 0x74, 0xba, 0xe7, 0x1d, 0x03, 0x1d, 0x7d, 0x83, 0xa0, 0xee, 0x92, 0x2f, 0x53, 0x92, + 0x88, 0x4b, 0x22, 0x5e, 0xb2, 0x10, 0xef, 0x00, 0xbe, 0x74, 0xfc, 0x4e, 0xbf, 0x3d, 0xbc, 0xea, + 0x79, 0x03, 0xe7, 0xb4, 0x7b, 0xd6, 0x75, 0x64, 0x3f, 0xeb, 0x90, 0x3f, 0x77, 0x7c, 0x03, 0x29, + 0xb1, 0x73, 0xd2, 0x36, 0x72, 0xd2, 0x1a, 0xf4, 0x3d, 0xdf, 0xc8, 0xcb, 0xe0, 0xe0, 0xca, 0x37, + 0x0a, 0x18, 0xa0, 0xd4, 0x76, 0x2e, 0x1c, 0xdf, 0x31, 0x8a, 0xb2, 0xe4, 0x69, 0xbf, 0xd7, 0x73, + 0x4e, 0x7d, 0xa3, 0x24, 0x9d, 0xfe, 0xc0, 0xef, 0xf6, 0x7b, 0x9e, 0xb1, 0x8e, 0x2b, 0x50, 0xf4, + 0xdd, 0x93, 0x53, 0xc7, 0x28, 0xeb, 0x01, 0x76, 0x7e, 0xbc, 0x6b, 0xa0, 0xdf, 0xee, 0x1a, 0xe8, + 0x8f, 0xbb, 0x06, 0xfa, 0xf3, 0xae, 0x81, 0xae, 0x0b, 0x72, 0xb9, 0xa3, 0x92, 0xba, 0x99, 0xe3, + 0xbf, 0x02, 0x00, 0x00, 0xff, 0xff, 0xa0, 0x2e, 0x4d, 0x11, 0xe0, 0x06, 0x00, 0x00, +} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/core/base.pb.validate.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/core/base.pb.validate.go new file mode 100644 index 000000000000..62f583ec43d3 --- /dev/null +++ b/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/core/base.pb.validate.go @@ -0,0 +1,571 @@ +// Code generated by protoc-gen-validate +// source: envoy/api/v2/core/base.proto +// DO NOT EDIT!!! + +package core + +import ( + "bytes" + "errors" + "fmt" + "net" + "net/mail" + "net/url" + "regexp" + "strings" + "time" + "unicode/utf8" + + "github.com/gogo/protobuf/types" +) + +// ensure the imports are used +var ( + _ = bytes.MinRead + _ = errors.New("") + _ = fmt.Print + _ = utf8.UTFMax + _ = (*regexp.Regexp)(nil) + _ = (*strings.Reader)(nil) + _ = net.IPv4len + _ = time.Duration(0) + _ = (*url.URL)(nil) + _ = (*mail.Address)(nil) + _ = types.DynamicAny{} +) + +// Validate checks the field values on Locality with the rules defined in the +// proto definition for this message. If any rules are violated, an error is returned. +func (m *Locality) Validate() error { + if m == nil { + return nil + } + + // no validation rules for Region + + // no validation rules for Zone + + // no validation rules for SubZone + + return nil +} + +// LocalityValidationError is the validation error returned by +// Locality.Validate if the designated constraints aren't met. +type LocalityValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e LocalityValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sLocality.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = LocalityValidationError{} + +// Validate checks the field values on Node with the rules defined in the proto +// definition for this message. If any rules are violated, an error is returned. +func (m *Node) Validate() error { + if m == nil { + return nil + } + + // no validation rules for Id + + // no validation rules for Cluster + + if v, ok := interface{}(m.GetMetadata()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return NodeValidationError{ + Field: "Metadata", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + if v, ok := interface{}(m.GetLocality()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return NodeValidationError{ + Field: "Locality", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + // no validation rules for BuildVersion + + return nil +} + +// NodeValidationError is the validation error returned by Node.Validate if the +// designated constraints aren't met. +type NodeValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e NodeValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sNode.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = NodeValidationError{} + +// Validate checks the field values on Metadata with the rules defined in the +// proto definition for this message. If any rules are violated, an error is returned. +func (m *Metadata) Validate() error { + if m == nil { + return nil + } + + // no validation rules for FilterMetadata + + return nil +} + +// MetadataValidationError is the validation error returned by +// Metadata.Validate if the designated constraints aren't met. +type MetadataValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e MetadataValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sMetadata.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = MetadataValidationError{} + +// Validate checks the field values on RuntimeUInt32 with the rules defined in +// the proto definition for this message. If any rules are violated, an error +// is returned. +func (m *RuntimeUInt32) Validate() error { + if m == nil { + return nil + } + + // no validation rules for DefaultValue + + if len(m.GetRuntimeKey()) < 1 { + return RuntimeUInt32ValidationError{ + Field: "RuntimeKey", + Reason: "value length must be at least 1 bytes", + } + } + + return nil +} + +// RuntimeUInt32ValidationError is the validation error returned by +// RuntimeUInt32.Validate if the designated constraints aren't met. +type RuntimeUInt32ValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e RuntimeUInt32ValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sRuntimeUInt32.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = RuntimeUInt32ValidationError{} + +// Validate checks the field values on HeaderValue with the rules defined in +// the proto definition for this message. If any rules are violated, an error +// is returned. +func (m *HeaderValue) Validate() error { + if m == nil { + return nil + } + + if len(m.GetKey()) < 1 { + return HeaderValueValidationError{ + Field: "Key", + Reason: "value length must be at least 1 bytes", + } + } + + // no validation rules for Value + + return nil +} + +// HeaderValueValidationError is the validation error returned by +// HeaderValue.Validate if the designated constraints aren't met. +type HeaderValueValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e HeaderValueValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sHeaderValue.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = HeaderValueValidationError{} + +// Validate checks the field values on HeaderValueOption with the rules defined +// in the proto definition for this message. If any rules are violated, an +// error is returned. +func (m *HeaderValueOption) Validate() error { + if m == nil { + return nil + } + + if m.GetHeader() == nil { + return HeaderValueOptionValidationError{ + Field: "Header", + Reason: "value is required", + } + } + + if v, ok := interface{}(m.GetHeader()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return HeaderValueOptionValidationError{ + Field: "Header", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + if v, ok := interface{}(m.GetAppend()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return HeaderValueOptionValidationError{ + Field: "Append", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + return nil +} + +// HeaderValueOptionValidationError is the validation error returned by +// HeaderValueOption.Validate if the designated constraints aren't met. +type HeaderValueOptionValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e HeaderValueOptionValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sHeaderValueOption.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = HeaderValueOptionValidationError{} + +// Validate checks the field values on DataSource with the rules defined in the +// proto definition for this message. If any rules are violated, an error is returned. +func (m *DataSource) Validate() error { + if m == nil { + return nil + } + + switch m.Specifier.(type) { + + case *DataSource_Filename: + + if len(m.GetFilename()) < 1 { + return DataSourceValidationError{ + Field: "Filename", + Reason: "value length must be at least 1 bytes", + } + } + + case *DataSource_InlineBytes: + + if len(m.GetInlineBytes()) < 1 { + return DataSourceValidationError{ + Field: "InlineBytes", + Reason: "value length must be at least 1 bytes", + } + } + + case *DataSource_InlineString: + + if len(m.GetInlineString()) < 1 { + return DataSourceValidationError{ + Field: "InlineString", + Reason: "value length must be at least 1 bytes", + } + } + + default: + return DataSourceValidationError{ + Field: "Specifier", + Reason: "value is required", + } + + } + + return nil +} + +// DataSourceValidationError is the validation error returned by +// DataSource.Validate if the designated constraints aren't met. +type DataSourceValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e DataSourceValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sDataSource.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = DataSourceValidationError{} + +// Validate checks the field values on TransportSocket with the rules defined +// in the proto definition for this message. If any rules are violated, an +// error is returned. +func (m *TransportSocket) Validate() error { + if m == nil { + return nil + } + + if len(m.GetName()) < 1 { + return TransportSocketValidationError{ + Field: "Name", + Reason: "value length must be at least 1 bytes", + } + } + + if v, ok := interface{}(m.GetConfig()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return TransportSocketValidationError{ + Field: "Config", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + return nil +} + +// TransportSocketValidationError is the validation error returned by +// TransportSocket.Validate if the designated constraints aren't met. +type TransportSocketValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e TransportSocketValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sTransportSocket.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = TransportSocketValidationError{} + +// Validate checks the field values on SocketOption with the rules defined in +// the proto definition for this message. If any rules are violated, an error +// is returned. +func (m *SocketOption) Validate() error { + if m == nil { + return nil + } + + // no validation rules for Description + + // no validation rules for Level + + // no validation rules for Name + + if _, ok := SocketOption_SocketState_name[int32(m.GetState())]; !ok { + return SocketOptionValidationError{ + Field: "State", + Reason: "value must be one of the defined enum values", + } + } + + switch m.Value.(type) { + + case *SocketOption_IntValue: + // no validation rules for IntValue + + case *SocketOption_BufValue: + // no validation rules for BufValue + + default: + return SocketOptionValidationError{ + Field: "Value", + Reason: "value is required", + } + + } + + return nil +} + +// SocketOptionValidationError is the validation error returned by +// SocketOption.Validate if the designated constraints aren't met. +type SocketOptionValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e SocketOptionValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sSocketOption.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = SocketOptionValidationError{} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/core/config_source.pb.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/core/config_source.pb.go new file mode 100644 index 000000000000..eaaadd4d62cd --- /dev/null +++ b/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/core/config_source.pb.go @@ -0,0 +1,1377 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: envoy/api/v2/core/config_source.proto + +package core + +import proto "github.com/gogo/protobuf/proto" +import fmt "fmt" +import math "math" +import _ "github.com/gogo/protobuf/gogoproto" +import _ "github.com/gogo/protobuf/types" +import _ "github.com/lyft/protoc-gen-validate/validate" + +import time "time" + +import bytes "bytes" + +import github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" + +import io "io" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf +var _ = time.Kitchen + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package + +// APIs may be fetched via either REST or gRPC. +type ApiConfigSource_ApiType int32 + +const ( + // REST-JSON legacy corresponds to the v1 API. + ApiConfigSource_REST_LEGACY ApiConfigSource_ApiType = 0 + // REST-JSON v2 API. The `canonical JSON encoding + // `_ for + // the v2 protos is used. + ApiConfigSource_REST ApiConfigSource_ApiType = 1 + // gRPC v2 API. + ApiConfigSource_GRPC ApiConfigSource_ApiType = 2 +) + +var ApiConfigSource_ApiType_name = map[int32]string{ + 0: "REST_LEGACY", + 1: "REST", + 2: "GRPC", +} +var ApiConfigSource_ApiType_value = map[string]int32{ + "REST_LEGACY": 0, + "REST": 1, + "GRPC": 2, +} + +func (x ApiConfigSource_ApiType) String() string { + return proto.EnumName(ApiConfigSource_ApiType_name, int32(x)) +} +func (ApiConfigSource_ApiType) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_config_source_4202aa29cecf9037, []int{0, 0} +} + +// API configuration source. This identifies the API type and cluster that Envoy +// will use to fetch an xDS API. +type ApiConfigSource struct { + ApiType ApiConfigSource_ApiType `protobuf:"varint,1,opt,name=api_type,json=apiType,proto3,enum=envoy.api.v2.core.ApiConfigSource_ApiType" json:"api_type,omitempty"` + // Cluster names should be used only with REST_LEGACY/REST. If > 1 + // cluster is defined, clusters will be cycled through if any kind of failure + // occurs. + // + // .. note:: + // + // The cluster with name ``cluster_name`` must be statically defined and its + // type must not be ``EDS``. + ClusterNames []string `protobuf:"bytes,2,rep,name=cluster_names,json=clusterNames" json:"cluster_names,omitempty"` + // Multiple gRPC services be provided for GRPC. If > 1 cluster is defined, + // services will be cycled through if any kind of failure occurs. + GrpcServices []*GrpcService `protobuf:"bytes,4,rep,name=grpc_services,json=grpcServices" json:"grpc_services,omitempty"` + // For REST APIs, the delay between successive polls. + RefreshDelay *time.Duration `protobuf:"bytes,3,opt,name=refresh_delay,json=refreshDelay,stdduration" json:"refresh_delay,omitempty"` + // For REST APIs, the request timeout. If not set, a default value of 1s will be used. + RequestTimeout *time.Duration `protobuf:"bytes,5,opt,name=request_timeout,json=requestTimeout,stdduration" json:"request_timeout,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ApiConfigSource) Reset() { *m = ApiConfigSource{} } +func (m *ApiConfigSource) String() string { return proto.CompactTextString(m) } +func (*ApiConfigSource) ProtoMessage() {} +func (*ApiConfigSource) Descriptor() ([]byte, []int) { + return fileDescriptor_config_source_4202aa29cecf9037, []int{0} +} +func (m *ApiConfigSource) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ApiConfigSource) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ApiConfigSource.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *ApiConfigSource) XXX_Merge(src proto.Message) { + xxx_messageInfo_ApiConfigSource.Merge(dst, src) +} +func (m *ApiConfigSource) XXX_Size() int { + return m.Size() +} +func (m *ApiConfigSource) XXX_DiscardUnknown() { + xxx_messageInfo_ApiConfigSource.DiscardUnknown(m) +} + +var xxx_messageInfo_ApiConfigSource proto.InternalMessageInfo + +func (m *ApiConfigSource) GetApiType() ApiConfigSource_ApiType { + if m != nil { + return m.ApiType + } + return ApiConfigSource_REST_LEGACY +} + +func (m *ApiConfigSource) GetClusterNames() []string { + if m != nil { + return m.ClusterNames + } + return nil +} + +func (m *ApiConfigSource) GetGrpcServices() []*GrpcService { + if m != nil { + return m.GrpcServices + } + return nil +} + +func (m *ApiConfigSource) GetRefreshDelay() *time.Duration { + if m != nil { + return m.RefreshDelay + } + return nil +} + +func (m *ApiConfigSource) GetRequestTimeout() *time.Duration { + if m != nil { + return m.RequestTimeout + } + return nil +} + +// Aggregated Discovery Service (ADS) options. This is currently empty, but when +// set in :ref:`ConfigSource ` can be used to +// specify that ADS is to be used. +type AggregatedConfigSource struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *AggregatedConfigSource) Reset() { *m = AggregatedConfigSource{} } +func (m *AggregatedConfigSource) String() string { return proto.CompactTextString(m) } +func (*AggregatedConfigSource) ProtoMessage() {} +func (*AggregatedConfigSource) Descriptor() ([]byte, []int) { + return fileDescriptor_config_source_4202aa29cecf9037, []int{1} +} +func (m *AggregatedConfigSource) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AggregatedConfigSource) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AggregatedConfigSource.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *AggregatedConfigSource) XXX_Merge(src proto.Message) { + xxx_messageInfo_AggregatedConfigSource.Merge(dst, src) +} +func (m *AggregatedConfigSource) XXX_Size() int { + return m.Size() +} +func (m *AggregatedConfigSource) XXX_DiscardUnknown() { + xxx_messageInfo_AggregatedConfigSource.DiscardUnknown(m) +} + +var xxx_messageInfo_AggregatedConfigSource proto.InternalMessageInfo + +// Configuration for :ref:`listeners `, :ref:`clusters +// `, :ref:`routes +// `, :ref:`endpoints +// ` etc. may either be sourced from the +// filesystem or from an xDS API source. Filesystem configs are watched with +// inotify for updates. +type ConfigSource struct { + // Types that are valid to be assigned to ConfigSourceSpecifier: + // *ConfigSource_Path + // *ConfigSource_ApiConfigSource + // *ConfigSource_Ads + ConfigSourceSpecifier isConfigSource_ConfigSourceSpecifier `protobuf_oneof:"config_source_specifier"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ConfigSource) Reset() { *m = ConfigSource{} } +func (m *ConfigSource) String() string { return proto.CompactTextString(m) } +func (*ConfigSource) ProtoMessage() {} +func (*ConfigSource) Descriptor() ([]byte, []int) { + return fileDescriptor_config_source_4202aa29cecf9037, []int{2} +} +func (m *ConfigSource) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ConfigSource) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ConfigSource.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *ConfigSource) XXX_Merge(src proto.Message) { + xxx_messageInfo_ConfigSource.Merge(dst, src) +} +func (m *ConfigSource) XXX_Size() int { + return m.Size() +} +func (m *ConfigSource) XXX_DiscardUnknown() { + xxx_messageInfo_ConfigSource.DiscardUnknown(m) +} + +var xxx_messageInfo_ConfigSource proto.InternalMessageInfo + +type isConfigSource_ConfigSourceSpecifier interface { + isConfigSource_ConfigSourceSpecifier() + Equal(interface{}) bool + MarshalTo([]byte) (int, error) + Size() int +} + +type ConfigSource_Path struct { + Path string `protobuf:"bytes,1,opt,name=path,proto3,oneof"` +} +type ConfigSource_ApiConfigSource struct { + ApiConfigSource *ApiConfigSource `protobuf:"bytes,2,opt,name=api_config_source,json=apiConfigSource,oneof"` +} +type ConfigSource_Ads struct { + Ads *AggregatedConfigSource `protobuf:"bytes,3,opt,name=ads,oneof"` +} + +func (*ConfigSource_Path) isConfigSource_ConfigSourceSpecifier() {} +func (*ConfigSource_ApiConfigSource) isConfigSource_ConfigSourceSpecifier() {} +func (*ConfigSource_Ads) isConfigSource_ConfigSourceSpecifier() {} + +func (m *ConfigSource) GetConfigSourceSpecifier() isConfigSource_ConfigSourceSpecifier { + if m != nil { + return m.ConfigSourceSpecifier + } + return nil +} + +func (m *ConfigSource) GetPath() string { + if x, ok := m.GetConfigSourceSpecifier().(*ConfigSource_Path); ok { + return x.Path + } + return "" +} + +func (m *ConfigSource) GetApiConfigSource() *ApiConfigSource { + if x, ok := m.GetConfigSourceSpecifier().(*ConfigSource_ApiConfigSource); ok { + return x.ApiConfigSource + } + return nil +} + +func (m *ConfigSource) GetAds() *AggregatedConfigSource { + if x, ok := m.GetConfigSourceSpecifier().(*ConfigSource_Ads); ok { + return x.Ads + } + return nil +} + +// XXX_OneofFuncs is for the internal use of the proto package. +func (*ConfigSource) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { + return _ConfigSource_OneofMarshaler, _ConfigSource_OneofUnmarshaler, _ConfigSource_OneofSizer, []interface{}{ + (*ConfigSource_Path)(nil), + (*ConfigSource_ApiConfigSource)(nil), + (*ConfigSource_Ads)(nil), + } +} + +func _ConfigSource_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { + m := msg.(*ConfigSource) + // config_source_specifier + switch x := m.ConfigSourceSpecifier.(type) { + case *ConfigSource_Path: + _ = b.EncodeVarint(1<<3 | proto.WireBytes) + _ = b.EncodeStringBytes(x.Path) + case *ConfigSource_ApiConfigSource: + _ = b.EncodeVarint(2<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.ApiConfigSource); err != nil { + return err + } + case *ConfigSource_Ads: + _ = b.EncodeVarint(3<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.Ads); err != nil { + return err + } + case nil: + default: + return fmt.Errorf("ConfigSource.ConfigSourceSpecifier has unexpected type %T", x) + } + return nil +} + +func _ConfigSource_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { + m := msg.(*ConfigSource) + switch tag { + case 1: // config_source_specifier.path + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeStringBytes() + m.ConfigSourceSpecifier = &ConfigSource_Path{x} + return true, err + case 2: // config_source_specifier.api_config_source + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(ApiConfigSource) + err := b.DecodeMessage(msg) + m.ConfigSourceSpecifier = &ConfigSource_ApiConfigSource{msg} + return true, err + case 3: // config_source_specifier.ads + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(AggregatedConfigSource) + err := b.DecodeMessage(msg) + m.ConfigSourceSpecifier = &ConfigSource_Ads{msg} + return true, err + default: + return false, nil + } +} + +func _ConfigSource_OneofSizer(msg proto.Message) (n int) { + m := msg.(*ConfigSource) + // config_source_specifier + switch x := m.ConfigSourceSpecifier.(type) { + case *ConfigSource_Path: + n += 1 // tag and wire + n += proto.SizeVarint(uint64(len(x.Path))) + n += len(x.Path) + case *ConfigSource_ApiConfigSource: + s := proto.Size(x.ApiConfigSource) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case *ConfigSource_Ads: + s := proto.Size(x.Ads) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case nil: + default: + panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) + } + return n +} + +func init() { + proto.RegisterType((*ApiConfigSource)(nil), "envoy.api.v2.core.ApiConfigSource") + proto.RegisterType((*AggregatedConfigSource)(nil), "envoy.api.v2.core.AggregatedConfigSource") + proto.RegisterType((*ConfigSource)(nil), "envoy.api.v2.core.ConfigSource") + proto.RegisterEnum("envoy.api.v2.core.ApiConfigSource_ApiType", ApiConfigSource_ApiType_name, ApiConfigSource_ApiType_value) +} +func (this *ApiConfigSource) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*ApiConfigSource) + if !ok { + that2, ok := that.(ApiConfigSource) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.ApiType != that1.ApiType { + return false + } + if len(this.ClusterNames) != len(that1.ClusterNames) { + return false + } + for i := range this.ClusterNames { + if this.ClusterNames[i] != that1.ClusterNames[i] { + return false + } + } + if len(this.GrpcServices) != len(that1.GrpcServices) { + return false + } + for i := range this.GrpcServices { + if !this.GrpcServices[i].Equal(that1.GrpcServices[i]) { + return false + } + } + if this.RefreshDelay != nil && that1.RefreshDelay != nil { + if *this.RefreshDelay != *that1.RefreshDelay { + return false + } + } else if this.RefreshDelay != nil { + return false + } else if that1.RefreshDelay != nil { + return false + } + if this.RequestTimeout != nil && that1.RequestTimeout != nil { + if *this.RequestTimeout != *that1.RequestTimeout { + return false + } + } else if this.RequestTimeout != nil { + return false + } else if that1.RequestTimeout != nil { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *AggregatedConfigSource) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*AggregatedConfigSource) + if !ok { + that2, ok := that.(AggregatedConfigSource) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *ConfigSource) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*ConfigSource) + if !ok { + that2, ok := that.(ConfigSource) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if that1.ConfigSourceSpecifier == nil { + if this.ConfigSourceSpecifier != nil { + return false + } + } else if this.ConfigSourceSpecifier == nil { + return false + } else if !this.ConfigSourceSpecifier.Equal(that1.ConfigSourceSpecifier) { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *ConfigSource_Path) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*ConfigSource_Path) + if !ok { + that2, ok := that.(ConfigSource_Path) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Path != that1.Path { + return false + } + return true +} +func (this *ConfigSource_ApiConfigSource) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*ConfigSource_ApiConfigSource) + if !ok { + that2, ok := that.(ConfigSource_ApiConfigSource) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.ApiConfigSource.Equal(that1.ApiConfigSource) { + return false + } + return true +} +func (this *ConfigSource_Ads) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*ConfigSource_Ads) + if !ok { + that2, ok := that.(ConfigSource_Ads) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.Ads.Equal(that1.Ads) { + return false + } + return true +} +func (m *ApiConfigSource) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ApiConfigSource) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.ApiType != 0 { + dAtA[i] = 0x8 + i++ + i = encodeVarintConfigSource(dAtA, i, uint64(m.ApiType)) + } + if len(m.ClusterNames) > 0 { + for _, s := range m.ClusterNames { + dAtA[i] = 0x12 + i++ + l = len(s) + for l >= 1<<7 { + dAtA[i] = uint8(uint64(l)&0x7f | 0x80) + l >>= 7 + i++ + } + dAtA[i] = uint8(l) + i++ + i += copy(dAtA[i:], s) + } + } + if m.RefreshDelay != nil { + dAtA[i] = 0x1a + i++ + i = encodeVarintConfigSource(dAtA, i, uint64(github_com_gogo_protobuf_types.SizeOfStdDuration(*m.RefreshDelay))) + n1, err := github_com_gogo_protobuf_types.StdDurationMarshalTo(*m.RefreshDelay, dAtA[i:]) + if err != nil { + return 0, err + } + i += n1 + } + if len(m.GrpcServices) > 0 { + for _, msg := range m.GrpcServices { + dAtA[i] = 0x22 + i++ + i = encodeVarintConfigSource(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if m.RequestTimeout != nil { + dAtA[i] = 0x2a + i++ + i = encodeVarintConfigSource(dAtA, i, uint64(github_com_gogo_protobuf_types.SizeOfStdDuration(*m.RequestTimeout))) + n2, err := github_com_gogo_protobuf_types.StdDurationMarshalTo(*m.RequestTimeout, dAtA[i:]) + if err != nil { + return 0, err + } + i += n2 + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *AggregatedConfigSource) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *AggregatedConfigSource) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *ConfigSource) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ConfigSource) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.ConfigSourceSpecifier != nil { + nn3, err := m.ConfigSourceSpecifier.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += nn3 + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *ConfigSource_Path) MarshalTo(dAtA []byte) (int, error) { + i := 0 + dAtA[i] = 0xa + i++ + i = encodeVarintConfigSource(dAtA, i, uint64(len(m.Path))) + i += copy(dAtA[i:], m.Path) + return i, nil +} +func (m *ConfigSource_ApiConfigSource) MarshalTo(dAtA []byte) (int, error) { + i := 0 + if m.ApiConfigSource != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintConfigSource(dAtA, i, uint64(m.ApiConfigSource.Size())) + n4, err := m.ApiConfigSource.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n4 + } + return i, nil +} +func (m *ConfigSource_Ads) MarshalTo(dAtA []byte) (int, error) { + i := 0 + if m.Ads != nil { + dAtA[i] = 0x1a + i++ + i = encodeVarintConfigSource(dAtA, i, uint64(m.Ads.Size())) + n5, err := m.Ads.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n5 + } + return i, nil +} +func encodeVarintConfigSource(dAtA []byte, offset int, v uint64) int { + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return offset + 1 +} +func (m *ApiConfigSource) Size() (n int) { + var l int + _ = l + if m.ApiType != 0 { + n += 1 + sovConfigSource(uint64(m.ApiType)) + } + if len(m.ClusterNames) > 0 { + for _, s := range m.ClusterNames { + l = len(s) + n += 1 + l + sovConfigSource(uint64(l)) + } + } + if m.RefreshDelay != nil { + l = github_com_gogo_protobuf_types.SizeOfStdDuration(*m.RefreshDelay) + n += 1 + l + sovConfigSource(uint64(l)) + } + if len(m.GrpcServices) > 0 { + for _, e := range m.GrpcServices { + l = e.Size() + n += 1 + l + sovConfigSource(uint64(l)) + } + } + if m.RequestTimeout != nil { + l = github_com_gogo_protobuf_types.SizeOfStdDuration(*m.RequestTimeout) + n += 1 + l + sovConfigSource(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *AggregatedConfigSource) Size() (n int) { + var l int + _ = l + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *ConfigSource) Size() (n int) { + var l int + _ = l + if m.ConfigSourceSpecifier != nil { + n += m.ConfigSourceSpecifier.Size() + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *ConfigSource_Path) Size() (n int) { + var l int + _ = l + l = len(m.Path) + n += 1 + l + sovConfigSource(uint64(l)) + return n +} +func (m *ConfigSource_ApiConfigSource) Size() (n int) { + var l int + _ = l + if m.ApiConfigSource != nil { + l = m.ApiConfigSource.Size() + n += 1 + l + sovConfigSource(uint64(l)) + } + return n +} +func (m *ConfigSource_Ads) Size() (n int) { + var l int + _ = l + if m.Ads != nil { + l = m.Ads.Size() + n += 1 + l + sovConfigSource(uint64(l)) + } + return n +} + +func sovConfigSource(x uint64) (n int) { + for { + n++ + x >>= 7 + if x == 0 { + break + } + } + return n +} +func sozConfigSource(x uint64) (n int) { + return sovConfigSource(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *ApiConfigSource) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowConfigSource + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ApiConfigSource: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ApiConfigSource: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ApiType", wireType) + } + m.ApiType = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowConfigSource + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ApiType |= (ApiConfigSource_ApiType(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ClusterNames", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowConfigSource + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthConfigSource + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ClusterNames = append(m.ClusterNames, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RefreshDelay", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowConfigSource + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthConfigSource + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.RefreshDelay == nil { + m.RefreshDelay = new(time.Duration) + } + if err := github_com_gogo_protobuf_types.StdDurationUnmarshal(m.RefreshDelay, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field GrpcServices", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowConfigSource + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthConfigSource + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.GrpcServices = append(m.GrpcServices, &GrpcService{}) + if err := m.GrpcServices[len(m.GrpcServices)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestTimeout", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowConfigSource + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthConfigSource + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.RequestTimeout == nil { + m.RequestTimeout = new(time.Duration) + } + if err := github_com_gogo_protobuf_types.StdDurationUnmarshal(m.RequestTimeout, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipConfigSource(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthConfigSource + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *AggregatedConfigSource) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowConfigSource + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: AggregatedConfigSource: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: AggregatedConfigSource: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipConfigSource(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthConfigSource + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ConfigSource) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowConfigSource + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ConfigSource: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ConfigSource: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Path", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowConfigSource + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthConfigSource + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ConfigSourceSpecifier = &ConfigSource_Path{string(dAtA[iNdEx:postIndex])} + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ApiConfigSource", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowConfigSource + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthConfigSource + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &ApiConfigSource{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.ConfigSourceSpecifier = &ConfigSource_ApiConfigSource{v} + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Ads", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowConfigSource + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthConfigSource + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &AggregatedConfigSource{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.ConfigSourceSpecifier = &ConfigSource_Ads{v} + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipConfigSource(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthConfigSource + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipConfigSource(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowConfigSource + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowConfigSource + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + return iNdEx, nil + case 1: + iNdEx += 8 + return iNdEx, nil + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowConfigSource + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + iNdEx += length + if length < 0 { + return 0, ErrInvalidLengthConfigSource + } + return iNdEx, nil + case 3: + for { + var innerWire uint64 + var start int = iNdEx + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowConfigSource + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + innerWire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + innerWireType := int(innerWire & 0x7) + if innerWireType == 4 { + break + } + next, err := skipConfigSource(dAtA[start:]) + if err != nil { + return 0, err + } + iNdEx = start + next + } + return iNdEx, nil + case 4: + return iNdEx, nil + case 5: + iNdEx += 4 + return iNdEx, nil + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + } + panic("unreachable") +} + +var ( + ErrInvalidLengthConfigSource = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowConfigSource = fmt.Errorf("proto: integer overflow") +) + +func init() { + proto.RegisterFile("envoy/api/v2/core/config_source.proto", fileDescriptor_config_source_4202aa29cecf9037) +} + +var fileDescriptor_config_source_4202aa29cecf9037 = []byte{ + // 508 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x52, 0xbd, 0x6e, 0x1a, 0x4d, + 0x14, 0x65, 0x58, 0xf8, 0xc0, 0x03, 0x98, 0xf5, 0xca, 0xfa, 0xbc, 0x71, 0xb1, 0x41, 0x24, 0x91, + 0x88, 0x8b, 0x5d, 0x89, 0xd4, 0x29, 0xf8, 0xb1, 0xa0, 0x88, 0x22, 0x67, 0xa1, 0x49, 0xb5, 0x1a, + 0x2f, 0x97, 0xf1, 0x48, 0x98, 0x99, 0xcc, 0xcc, 0x22, 0xd1, 0xe6, 0x29, 0xa2, 0x3c, 0x41, 0x94, + 0x27, 0x88, 0x52, 0xb9, 0x4c, 0x99, 0x2e, 0x65, 0x22, 0x3a, 0xbf, 0x45, 0x34, 0xbb, 0x8b, 0x62, + 0x6c, 0x24, 0x77, 0xf7, 0x9e, 0xb9, 0xe7, 0xea, 0x9c, 0x7b, 0x06, 0xbf, 0x80, 0xe5, 0x8a, 0xaf, + 0x03, 0x22, 0x58, 0xb0, 0xea, 0x06, 0x31, 0x97, 0x10, 0xc4, 0x7c, 0x39, 0x67, 0x34, 0x52, 0x3c, + 0x91, 0x31, 0xf8, 0x42, 0x72, 0xcd, 0x9d, 0xa3, 0x74, 0xcc, 0x27, 0x82, 0xf9, 0xab, 0xae, 0x6f, + 0xc6, 0x4e, 0x9f, 0x3f, 0x64, 0x52, 0x29, 0xe2, 0x48, 0x81, 0x5c, 0xb1, 0x2d, 0xf1, 0xd4, 0xa3, + 0x9c, 0xd3, 0x05, 0x04, 0x69, 0x77, 0x99, 0xcc, 0x83, 0x59, 0x22, 0x89, 0x66, 0x7c, 0x99, 0xbf, + 0x9f, 0xac, 0xc8, 0x82, 0xcd, 0x88, 0x86, 0x60, 0x5b, 0xe4, 0x0f, 0xc7, 0x94, 0x53, 0x9e, 0x96, + 0x81, 0xa9, 0x32, 0xb4, 0xfd, 0xd9, 0xc2, 0xcd, 0x9e, 0x60, 0x83, 0x54, 0xe2, 0x24, 0x55, 0xe8, + 0xbc, 0xc3, 0x55, 0x22, 0x58, 0xa4, 0xd7, 0x02, 0x5c, 0xd4, 0x42, 0x9d, 0xc3, 0xee, 0x99, 0xff, + 0x40, 0xae, 0x7f, 0x8f, 0x65, 0xfa, 0xe9, 0x5a, 0x40, 0x1f, 0x7f, 0xbf, 0xbd, 0xb1, 0xca, 0x1f, + 0x51, 0xd1, 0x46, 0x61, 0x85, 0x64, 0xa0, 0xf3, 0x0c, 0x37, 0xe2, 0x45, 0xa2, 0x34, 0xc8, 0x68, + 0x49, 0xae, 0x41, 0xb9, 0xc5, 0x96, 0xd5, 0x39, 0x08, 0xeb, 0x39, 0xf8, 0xd6, 0x60, 0xce, 0x10, + 0x37, 0x24, 0xcc, 0x25, 0xa8, 0xab, 0x68, 0x06, 0x0b, 0xb2, 0x76, 0xad, 0x16, 0xea, 0xd4, 0xba, + 0x4f, 0xfc, 0xcc, 0xb2, 0xbf, 0xb5, 0xec, 0x0f, 0x73, 0xcb, 0xfd, 0xd2, 0xa7, 0xdf, 0x4f, 0x51, + 0x58, 0xcf, 0x59, 0x43, 0x43, 0x72, 0x06, 0xb8, 0x71, 0xf7, 0x6c, 0xca, 0x2d, 0xb5, 0xac, 0x4e, + 0xad, 0xeb, 0xed, 0xb1, 0x30, 0x92, 0x22, 0x9e, 0x64, 0x63, 0x61, 0x9d, 0xfe, 0x6b, 0x94, 0x33, + 0xc5, 0x4d, 0x09, 0x1f, 0x12, 0x50, 0x3a, 0xd2, 0xec, 0x1a, 0x78, 0xa2, 0xdd, 0xf2, 0x63, 0x62, + 0x6c, 0x23, 0xc6, 0x98, 0xaf, 0x7c, 0x45, 0xa5, 0xb3, 0x62, 0xb5, 0x10, 0x1e, 0xe6, 0x3b, 0xa6, + 0xd9, 0x8a, 0xb6, 0x8f, 0x2b, 0xf9, 0x95, 0x9c, 0x26, 0xae, 0x85, 0xe7, 0x93, 0x69, 0xf4, 0xe6, + 0x7c, 0xd4, 0x1b, 0xbc, 0xb7, 0x0b, 0x4e, 0x15, 0x97, 0x0c, 0x60, 0x23, 0x53, 0x8d, 0xc2, 0x8b, + 0x81, 0x5d, 0x6c, 0xbb, 0xf8, 0xff, 0x1e, 0xa5, 0x12, 0x28, 0xd1, 0x30, 0xbb, 0x7b, 0xec, 0xf6, + 0x2f, 0x84, 0xeb, 0x3b, 0x99, 0x1d, 0xe3, 0x92, 0x20, 0xfa, 0x2a, 0xcd, 0xeb, 0x60, 0x5c, 0x08, + 0xd3, 0xce, 0xb9, 0xc0, 0x47, 0x26, 0xc9, 0x9d, 0x0f, 0xe8, 0x16, 0x53, 0x23, 0xed, 0xc7, 0x23, + 0x1d, 0x17, 0xc2, 0x26, 0xb9, 0xf7, 0x37, 0x5e, 0x63, 0x8b, 0xcc, 0x54, 0x9e, 0xcc, 0xcb, 0x7d, + 0x3b, 0xf6, 0x0a, 0x1e, 0x17, 0x42, 0xc3, 0xeb, 0xb7, 0xf0, 0xc9, 0x8e, 0x98, 0x48, 0x09, 0x88, + 0xd9, 0x9c, 0x81, 0x74, 0xca, 0xdf, 0x6e, 0x6f, 0x2c, 0xd4, 0xb7, 0xbf, 0x6c, 0x3c, 0xf4, 0x63, + 0xe3, 0xa1, 0x9f, 0x1b, 0x0f, 0xfd, 0xd9, 0x78, 0xe8, 0xf2, 0xbf, 0xf4, 0xd4, 0xaf, 0xfe, 0x06, + 0x00, 0x00, 0xff, 0xff, 0xab, 0x0b, 0x66, 0x7e, 0x5a, 0x03, 0x00, 0x00, +} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/core/config_source.pb.validate.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/core/config_source.pb.validate.go new file mode 100644 index 000000000000..8d11fa326fc2 --- /dev/null +++ b/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/core/config_source.pb.validate.go @@ -0,0 +1,244 @@ +// Code generated by protoc-gen-validate +// source: envoy/api/v2/core/config_source.proto +// DO NOT EDIT!!! + +package core + +import ( + "bytes" + "errors" + "fmt" + "net" + "net/mail" + "net/url" + "regexp" + "strings" + "time" + "unicode/utf8" + + "github.com/gogo/protobuf/types" +) + +// ensure the imports are used +var ( + _ = bytes.MinRead + _ = errors.New("") + _ = fmt.Print + _ = utf8.UTFMax + _ = (*regexp.Regexp)(nil) + _ = (*strings.Reader)(nil) + _ = net.IPv4len + _ = time.Duration(0) + _ = (*url.URL)(nil) + _ = (*mail.Address)(nil) + _ = types.DynamicAny{} +) + +// Validate checks the field values on ApiConfigSource with the rules defined +// in the proto definition for this message. If any rules are violated, an +// error is returned. +func (m *ApiConfigSource) Validate() error { + if m == nil { + return nil + } + + if _, ok := ApiConfigSource_ApiType_name[int32(m.GetApiType())]; !ok { + return ApiConfigSourceValidationError{ + Field: "ApiType", + Reason: "value must be one of the defined enum values", + } + } + + for idx, item := range m.GetGrpcServices() { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return ApiConfigSourceValidationError{ + Field: fmt.Sprintf("GrpcServices[%v]", idx), + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + } + + if v, ok := interface{}(m.GetRefreshDelay()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return ApiConfigSourceValidationError{ + Field: "RefreshDelay", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + if d := m.GetRequestTimeout(); d != nil { + dur := *d + + gt := time.Duration(0*time.Second + 0*time.Nanosecond) + + if dur <= gt { + return ApiConfigSourceValidationError{ + Field: "RequestTimeout", + Reason: "value must be greater than 0s", + } + } + + } + + return nil +} + +// ApiConfigSourceValidationError is the validation error returned by +// ApiConfigSource.Validate if the designated constraints aren't met. +type ApiConfigSourceValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e ApiConfigSourceValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sApiConfigSource.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = ApiConfigSourceValidationError{} + +// Validate checks the field values on AggregatedConfigSource with the rules +// defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *AggregatedConfigSource) Validate() error { + if m == nil { + return nil + } + + return nil +} + +// AggregatedConfigSourceValidationError is the validation error returned by +// AggregatedConfigSource.Validate if the designated constraints aren't met. +type AggregatedConfigSourceValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e AggregatedConfigSourceValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sAggregatedConfigSource.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = AggregatedConfigSourceValidationError{} + +// Validate checks the field values on ConfigSource with the rules defined in +// the proto definition for this message. If any rules are violated, an error +// is returned. +func (m *ConfigSource) Validate() error { + if m == nil { + return nil + } + + switch m.ConfigSourceSpecifier.(type) { + + case *ConfigSource_Path: + // no validation rules for Path + + case *ConfigSource_ApiConfigSource: + + if v, ok := interface{}(m.GetApiConfigSource()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return ConfigSourceValidationError{ + Field: "ApiConfigSource", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + case *ConfigSource_Ads: + + if v, ok := interface{}(m.GetAds()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return ConfigSourceValidationError{ + Field: "Ads", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + default: + return ConfigSourceValidationError{ + Field: "ConfigSourceSpecifier", + Reason: "value is required", + } + + } + + return nil +} + +// ConfigSourceValidationError is the validation error returned by +// ConfigSource.Validate if the designated constraints aren't met. +type ConfigSourceValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e ConfigSourceValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sConfigSource.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = ConfigSourceValidationError{} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/core/grpc_service.pb.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/core/grpc_service.pb.go new file mode 100644 index 000000000000..5d318bb5bc82 --- /dev/null +++ b/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/core/grpc_service.pb.go @@ -0,0 +1,4117 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: envoy/api/v2/core/grpc_service.proto + +package core + +import proto "github.com/gogo/protobuf/proto" +import fmt "fmt" +import math "math" +import _ "github.com/gogo/protobuf/gogoproto" +import types "github.com/gogo/protobuf/types" +import _ "github.com/lyft/protoc-gen-validate/validate" + +import bytes "bytes" + +import io "io" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package + +// gRPC service configuration. This is used by :ref:`ApiConfigSource +// ` and filter configurations. +type GrpcService struct { + // Types that are valid to be assigned to TargetSpecifier: + // *GrpcService_EnvoyGrpc_ + // *GrpcService_GoogleGrpc_ + TargetSpecifier isGrpcService_TargetSpecifier `protobuf_oneof:"target_specifier"` + // The timeout for the gRPC request. This is the timeout for a specific + // request. + Timeout *types.Duration `protobuf:"bytes,3,opt,name=timeout" json:"timeout,omitempty"` + // Additional metadata to include in streams initiated to the GrpcService. + // This can be used for scenarios in which additional ad hoc authorization + // headers (e.g. `x-foo-bar: baz-key`) are to be injected. + InitialMetadata []*HeaderValue `protobuf:"bytes,5,rep,name=initial_metadata,json=initialMetadata" json:"initial_metadata,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GrpcService) Reset() { *m = GrpcService{} } +func (m *GrpcService) String() string { return proto.CompactTextString(m) } +func (*GrpcService) ProtoMessage() {} +func (*GrpcService) Descriptor() ([]byte, []int) { + return fileDescriptor_grpc_service_2df2b8908a2b5284, []int{0} +} +func (m *GrpcService) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GrpcService) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GrpcService.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *GrpcService) XXX_Merge(src proto.Message) { + xxx_messageInfo_GrpcService.Merge(dst, src) +} +func (m *GrpcService) XXX_Size() int { + return m.Size() +} +func (m *GrpcService) XXX_DiscardUnknown() { + xxx_messageInfo_GrpcService.DiscardUnknown(m) +} + +var xxx_messageInfo_GrpcService proto.InternalMessageInfo + +type isGrpcService_TargetSpecifier interface { + isGrpcService_TargetSpecifier() + Equal(interface{}) bool + MarshalTo([]byte) (int, error) + Size() int +} + +type GrpcService_EnvoyGrpc_ struct { + EnvoyGrpc *GrpcService_EnvoyGrpc `protobuf:"bytes,1,opt,name=envoy_grpc,json=envoyGrpc,oneof"` +} +type GrpcService_GoogleGrpc_ struct { + GoogleGrpc *GrpcService_GoogleGrpc `protobuf:"bytes,2,opt,name=google_grpc,json=googleGrpc,oneof"` +} + +func (*GrpcService_EnvoyGrpc_) isGrpcService_TargetSpecifier() {} +func (*GrpcService_GoogleGrpc_) isGrpcService_TargetSpecifier() {} + +func (m *GrpcService) GetTargetSpecifier() isGrpcService_TargetSpecifier { + if m != nil { + return m.TargetSpecifier + } + return nil +} + +func (m *GrpcService) GetEnvoyGrpc() *GrpcService_EnvoyGrpc { + if x, ok := m.GetTargetSpecifier().(*GrpcService_EnvoyGrpc_); ok { + return x.EnvoyGrpc + } + return nil +} + +func (m *GrpcService) GetGoogleGrpc() *GrpcService_GoogleGrpc { + if x, ok := m.GetTargetSpecifier().(*GrpcService_GoogleGrpc_); ok { + return x.GoogleGrpc + } + return nil +} + +func (m *GrpcService) GetTimeout() *types.Duration { + if m != nil { + return m.Timeout + } + return nil +} + +func (m *GrpcService) GetInitialMetadata() []*HeaderValue { + if m != nil { + return m.InitialMetadata + } + return nil +} + +// XXX_OneofFuncs is for the internal use of the proto package. +func (*GrpcService) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { + return _GrpcService_OneofMarshaler, _GrpcService_OneofUnmarshaler, _GrpcService_OneofSizer, []interface{}{ + (*GrpcService_EnvoyGrpc_)(nil), + (*GrpcService_GoogleGrpc_)(nil), + } +} + +func _GrpcService_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { + m := msg.(*GrpcService) + // target_specifier + switch x := m.TargetSpecifier.(type) { + case *GrpcService_EnvoyGrpc_: + _ = b.EncodeVarint(1<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.EnvoyGrpc); err != nil { + return err + } + case *GrpcService_GoogleGrpc_: + _ = b.EncodeVarint(2<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.GoogleGrpc); err != nil { + return err + } + case nil: + default: + return fmt.Errorf("GrpcService.TargetSpecifier has unexpected type %T", x) + } + return nil +} + +func _GrpcService_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { + m := msg.(*GrpcService) + switch tag { + case 1: // target_specifier.envoy_grpc + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(GrpcService_EnvoyGrpc) + err := b.DecodeMessage(msg) + m.TargetSpecifier = &GrpcService_EnvoyGrpc_{msg} + return true, err + case 2: // target_specifier.google_grpc + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(GrpcService_GoogleGrpc) + err := b.DecodeMessage(msg) + m.TargetSpecifier = &GrpcService_GoogleGrpc_{msg} + return true, err + default: + return false, nil + } +} + +func _GrpcService_OneofSizer(msg proto.Message) (n int) { + m := msg.(*GrpcService) + // target_specifier + switch x := m.TargetSpecifier.(type) { + case *GrpcService_EnvoyGrpc_: + s := proto.Size(x.EnvoyGrpc) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case *GrpcService_GoogleGrpc_: + s := proto.Size(x.GoogleGrpc) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case nil: + default: + panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) + } + return n +} + +type GrpcService_EnvoyGrpc struct { + // The name of the upstream gRPC cluster. SSL credentials will be supplied + // in the :ref:`Cluster ` :ref:`tls_context + // `. + ClusterName string `protobuf:"bytes,1,opt,name=cluster_name,json=clusterName,proto3" json:"cluster_name,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GrpcService_EnvoyGrpc) Reset() { *m = GrpcService_EnvoyGrpc{} } +func (m *GrpcService_EnvoyGrpc) String() string { return proto.CompactTextString(m) } +func (*GrpcService_EnvoyGrpc) ProtoMessage() {} +func (*GrpcService_EnvoyGrpc) Descriptor() ([]byte, []int) { + return fileDescriptor_grpc_service_2df2b8908a2b5284, []int{0, 0} +} +func (m *GrpcService_EnvoyGrpc) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GrpcService_EnvoyGrpc) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GrpcService_EnvoyGrpc.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *GrpcService_EnvoyGrpc) XXX_Merge(src proto.Message) { + xxx_messageInfo_GrpcService_EnvoyGrpc.Merge(dst, src) +} +func (m *GrpcService_EnvoyGrpc) XXX_Size() int { + return m.Size() +} +func (m *GrpcService_EnvoyGrpc) XXX_DiscardUnknown() { + xxx_messageInfo_GrpcService_EnvoyGrpc.DiscardUnknown(m) +} + +var xxx_messageInfo_GrpcService_EnvoyGrpc proto.InternalMessageInfo + +func (m *GrpcService_EnvoyGrpc) GetClusterName() string { + if m != nil { + return m.ClusterName + } + return "" +} + +// [#proto-status: draft] +type GrpcService_GoogleGrpc struct { + // The target URI when using the `Google C++ gRPC client + // `_. SSL credentials will be supplied in + // :ref:`channel_credentials `. + TargetUri string `protobuf:"bytes,1,opt,name=target_uri,json=targetUri,proto3" json:"target_uri,omitempty"` + ChannelCredentials *GrpcService_GoogleGrpc_ChannelCredentials `protobuf:"bytes,2,opt,name=channel_credentials,json=channelCredentials" json:"channel_credentials,omitempty"` + // A set of call credentials that can be composed with `channel credentials + // `_. + CallCredentials []*GrpcService_GoogleGrpc_CallCredentials `protobuf:"bytes,3,rep,name=call_credentials,json=callCredentials" json:"call_credentials,omitempty"` + // The human readable prefix to use when emitting statistics for the gRPC + // service. + // + // .. csv-table:: + // :header: Name, Type, Description + // :widths: 1, 1, 2 + // + // streams_total, Counter, Total number of streams opened + // streams_closed_, Counter, Total streams closed with + StatPrefix string `protobuf:"bytes,4,opt,name=stat_prefix,json=statPrefix,proto3" json:"stat_prefix,omitempty"` + // The name of the Google gRPC credentials factory to use. This must have been registered with + // Envoy. If this is empty, a default credentials factory will be used that sets up channel + // credentials based on other configuration parameters. + CredentialsFactoryName string `protobuf:"bytes,5,opt,name=credentials_factory_name,json=credentialsFactoryName,proto3" json:"credentials_factory_name,omitempty"` + // Additional configuration for site-specific customizations of the Google + // gRPC library. + Config *types.Struct `protobuf:"bytes,6,opt,name=config" json:"config,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GrpcService_GoogleGrpc) Reset() { *m = GrpcService_GoogleGrpc{} } +func (m *GrpcService_GoogleGrpc) String() string { return proto.CompactTextString(m) } +func (*GrpcService_GoogleGrpc) ProtoMessage() {} +func (*GrpcService_GoogleGrpc) Descriptor() ([]byte, []int) { + return fileDescriptor_grpc_service_2df2b8908a2b5284, []int{0, 1} +} +func (m *GrpcService_GoogleGrpc) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GrpcService_GoogleGrpc) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GrpcService_GoogleGrpc.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *GrpcService_GoogleGrpc) XXX_Merge(src proto.Message) { + xxx_messageInfo_GrpcService_GoogleGrpc.Merge(dst, src) +} +func (m *GrpcService_GoogleGrpc) XXX_Size() int { + return m.Size() +} +func (m *GrpcService_GoogleGrpc) XXX_DiscardUnknown() { + xxx_messageInfo_GrpcService_GoogleGrpc.DiscardUnknown(m) +} + +var xxx_messageInfo_GrpcService_GoogleGrpc proto.InternalMessageInfo + +func (m *GrpcService_GoogleGrpc) GetTargetUri() string { + if m != nil { + return m.TargetUri + } + return "" +} + +func (m *GrpcService_GoogleGrpc) GetChannelCredentials() *GrpcService_GoogleGrpc_ChannelCredentials { + if m != nil { + return m.ChannelCredentials + } + return nil +} + +func (m *GrpcService_GoogleGrpc) GetCallCredentials() []*GrpcService_GoogleGrpc_CallCredentials { + if m != nil { + return m.CallCredentials + } + return nil +} + +func (m *GrpcService_GoogleGrpc) GetStatPrefix() string { + if m != nil { + return m.StatPrefix + } + return "" +} + +func (m *GrpcService_GoogleGrpc) GetCredentialsFactoryName() string { + if m != nil { + return m.CredentialsFactoryName + } + return "" +} + +func (m *GrpcService_GoogleGrpc) GetConfig() *types.Struct { + if m != nil { + return m.Config + } + return nil +} + +// See https://grpc.io/grpc/cpp/structgrpc_1_1_ssl_credentials_options.html. +type GrpcService_GoogleGrpc_SslCredentials struct { + // PEM encoded server root certificates. + RootCerts *DataSource `protobuf:"bytes,1,opt,name=root_certs,json=rootCerts" json:"root_certs,omitempty"` + // PEM encoded client private key. + PrivateKey *DataSource `protobuf:"bytes,2,opt,name=private_key,json=privateKey" json:"private_key,omitempty"` + // PEM encoded client certificate chain. + CertChain *DataSource `protobuf:"bytes,3,opt,name=cert_chain,json=certChain" json:"cert_chain,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GrpcService_GoogleGrpc_SslCredentials) Reset() { *m = GrpcService_GoogleGrpc_SslCredentials{} } +func (m *GrpcService_GoogleGrpc_SslCredentials) String() string { return proto.CompactTextString(m) } +func (*GrpcService_GoogleGrpc_SslCredentials) ProtoMessage() {} +func (*GrpcService_GoogleGrpc_SslCredentials) Descriptor() ([]byte, []int) { + return fileDescriptor_grpc_service_2df2b8908a2b5284, []int{0, 1, 0} +} +func (m *GrpcService_GoogleGrpc_SslCredentials) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GrpcService_GoogleGrpc_SslCredentials) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GrpcService_GoogleGrpc_SslCredentials.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *GrpcService_GoogleGrpc_SslCredentials) XXX_Merge(src proto.Message) { + xxx_messageInfo_GrpcService_GoogleGrpc_SslCredentials.Merge(dst, src) +} +func (m *GrpcService_GoogleGrpc_SslCredentials) XXX_Size() int { + return m.Size() +} +func (m *GrpcService_GoogleGrpc_SslCredentials) XXX_DiscardUnknown() { + xxx_messageInfo_GrpcService_GoogleGrpc_SslCredentials.DiscardUnknown(m) +} + +var xxx_messageInfo_GrpcService_GoogleGrpc_SslCredentials proto.InternalMessageInfo + +func (m *GrpcService_GoogleGrpc_SslCredentials) GetRootCerts() *DataSource { + if m != nil { + return m.RootCerts + } + return nil +} + +func (m *GrpcService_GoogleGrpc_SslCredentials) GetPrivateKey() *DataSource { + if m != nil { + return m.PrivateKey + } + return nil +} + +func (m *GrpcService_GoogleGrpc_SslCredentials) GetCertChain() *DataSource { + if m != nil { + return m.CertChain + } + return nil +} + +// Local channel credentials. Only UDS is supported for now. +// See https://github.com/grpc/grpc/pull/15909. +type GrpcService_GoogleGrpc_GoogleLocalCredentials struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GrpcService_GoogleGrpc_GoogleLocalCredentials) Reset() { + *m = GrpcService_GoogleGrpc_GoogleLocalCredentials{} +} +func (m *GrpcService_GoogleGrpc_GoogleLocalCredentials) String() string { + return proto.CompactTextString(m) +} +func (*GrpcService_GoogleGrpc_GoogleLocalCredentials) ProtoMessage() {} +func (*GrpcService_GoogleGrpc_GoogleLocalCredentials) Descriptor() ([]byte, []int) { + return fileDescriptor_grpc_service_2df2b8908a2b5284, []int{0, 1, 1} +} +func (m *GrpcService_GoogleGrpc_GoogleLocalCredentials) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GrpcService_GoogleGrpc_GoogleLocalCredentials) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GrpcService_GoogleGrpc_GoogleLocalCredentials.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *GrpcService_GoogleGrpc_GoogleLocalCredentials) XXX_Merge(src proto.Message) { + xxx_messageInfo_GrpcService_GoogleGrpc_GoogleLocalCredentials.Merge(dst, src) +} +func (m *GrpcService_GoogleGrpc_GoogleLocalCredentials) XXX_Size() int { + return m.Size() +} +func (m *GrpcService_GoogleGrpc_GoogleLocalCredentials) XXX_DiscardUnknown() { + xxx_messageInfo_GrpcService_GoogleGrpc_GoogleLocalCredentials.DiscardUnknown(m) +} + +var xxx_messageInfo_GrpcService_GoogleGrpc_GoogleLocalCredentials proto.InternalMessageInfo + +// See https://grpc.io/docs/guides/auth.html#credential-types to understand Channel and Call +// credential types. +type GrpcService_GoogleGrpc_ChannelCredentials struct { + // Types that are valid to be assigned to CredentialSpecifier: + // *GrpcService_GoogleGrpc_ChannelCredentials_SslCredentials + // *GrpcService_GoogleGrpc_ChannelCredentials_GoogleDefault + // *GrpcService_GoogleGrpc_ChannelCredentials_LocalCredentials + CredentialSpecifier isGrpcService_GoogleGrpc_ChannelCredentials_CredentialSpecifier `protobuf_oneof:"credential_specifier"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GrpcService_GoogleGrpc_ChannelCredentials) Reset() { + *m = GrpcService_GoogleGrpc_ChannelCredentials{} +} +func (m *GrpcService_GoogleGrpc_ChannelCredentials) String() string { return proto.CompactTextString(m) } +func (*GrpcService_GoogleGrpc_ChannelCredentials) ProtoMessage() {} +func (*GrpcService_GoogleGrpc_ChannelCredentials) Descriptor() ([]byte, []int) { + return fileDescriptor_grpc_service_2df2b8908a2b5284, []int{0, 1, 2} +} +func (m *GrpcService_GoogleGrpc_ChannelCredentials) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GrpcService_GoogleGrpc_ChannelCredentials) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GrpcService_GoogleGrpc_ChannelCredentials.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *GrpcService_GoogleGrpc_ChannelCredentials) XXX_Merge(src proto.Message) { + xxx_messageInfo_GrpcService_GoogleGrpc_ChannelCredentials.Merge(dst, src) +} +func (m *GrpcService_GoogleGrpc_ChannelCredentials) XXX_Size() int { + return m.Size() +} +func (m *GrpcService_GoogleGrpc_ChannelCredentials) XXX_DiscardUnknown() { + xxx_messageInfo_GrpcService_GoogleGrpc_ChannelCredentials.DiscardUnknown(m) +} + +var xxx_messageInfo_GrpcService_GoogleGrpc_ChannelCredentials proto.InternalMessageInfo + +type isGrpcService_GoogleGrpc_ChannelCredentials_CredentialSpecifier interface { + isGrpcService_GoogleGrpc_ChannelCredentials_CredentialSpecifier() + Equal(interface{}) bool + MarshalTo([]byte) (int, error) + Size() int +} + +type GrpcService_GoogleGrpc_ChannelCredentials_SslCredentials struct { + SslCredentials *GrpcService_GoogleGrpc_SslCredentials `protobuf:"bytes,1,opt,name=ssl_credentials,json=sslCredentials,oneof"` +} +type GrpcService_GoogleGrpc_ChannelCredentials_GoogleDefault struct { + GoogleDefault *types.Empty `protobuf:"bytes,2,opt,name=google_default,json=googleDefault,oneof"` +} +type GrpcService_GoogleGrpc_ChannelCredentials_LocalCredentials struct { + LocalCredentials *GrpcService_GoogleGrpc_GoogleLocalCredentials `protobuf:"bytes,3,opt,name=local_credentials,json=localCredentials,oneof"` +} + +func (*GrpcService_GoogleGrpc_ChannelCredentials_SslCredentials) isGrpcService_GoogleGrpc_ChannelCredentials_CredentialSpecifier() { +} +func (*GrpcService_GoogleGrpc_ChannelCredentials_GoogleDefault) isGrpcService_GoogleGrpc_ChannelCredentials_CredentialSpecifier() { +} +func (*GrpcService_GoogleGrpc_ChannelCredentials_LocalCredentials) isGrpcService_GoogleGrpc_ChannelCredentials_CredentialSpecifier() { +} + +func (m *GrpcService_GoogleGrpc_ChannelCredentials) GetCredentialSpecifier() isGrpcService_GoogleGrpc_ChannelCredentials_CredentialSpecifier { + if m != nil { + return m.CredentialSpecifier + } + return nil +} + +func (m *GrpcService_GoogleGrpc_ChannelCredentials) GetSslCredentials() *GrpcService_GoogleGrpc_SslCredentials { + if x, ok := m.GetCredentialSpecifier().(*GrpcService_GoogleGrpc_ChannelCredentials_SslCredentials); ok { + return x.SslCredentials + } + return nil +} + +func (m *GrpcService_GoogleGrpc_ChannelCredentials) GetGoogleDefault() *types.Empty { + if x, ok := m.GetCredentialSpecifier().(*GrpcService_GoogleGrpc_ChannelCredentials_GoogleDefault); ok { + return x.GoogleDefault + } + return nil +} + +func (m *GrpcService_GoogleGrpc_ChannelCredentials) GetLocalCredentials() *GrpcService_GoogleGrpc_GoogleLocalCredentials { + if x, ok := m.GetCredentialSpecifier().(*GrpcService_GoogleGrpc_ChannelCredentials_LocalCredentials); ok { + return x.LocalCredentials + } + return nil +} + +// XXX_OneofFuncs is for the internal use of the proto package. +func (*GrpcService_GoogleGrpc_ChannelCredentials) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { + return _GrpcService_GoogleGrpc_ChannelCredentials_OneofMarshaler, _GrpcService_GoogleGrpc_ChannelCredentials_OneofUnmarshaler, _GrpcService_GoogleGrpc_ChannelCredentials_OneofSizer, []interface{}{ + (*GrpcService_GoogleGrpc_ChannelCredentials_SslCredentials)(nil), + (*GrpcService_GoogleGrpc_ChannelCredentials_GoogleDefault)(nil), + (*GrpcService_GoogleGrpc_ChannelCredentials_LocalCredentials)(nil), + } +} + +func _GrpcService_GoogleGrpc_ChannelCredentials_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { + m := msg.(*GrpcService_GoogleGrpc_ChannelCredentials) + // credential_specifier + switch x := m.CredentialSpecifier.(type) { + case *GrpcService_GoogleGrpc_ChannelCredentials_SslCredentials: + _ = b.EncodeVarint(1<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.SslCredentials); err != nil { + return err + } + case *GrpcService_GoogleGrpc_ChannelCredentials_GoogleDefault: + _ = b.EncodeVarint(2<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.GoogleDefault); err != nil { + return err + } + case *GrpcService_GoogleGrpc_ChannelCredentials_LocalCredentials: + _ = b.EncodeVarint(3<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.LocalCredentials); err != nil { + return err + } + case nil: + default: + return fmt.Errorf("GrpcService_GoogleGrpc_ChannelCredentials.CredentialSpecifier has unexpected type %T", x) + } + return nil +} + +func _GrpcService_GoogleGrpc_ChannelCredentials_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { + m := msg.(*GrpcService_GoogleGrpc_ChannelCredentials) + switch tag { + case 1: // credential_specifier.ssl_credentials + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(GrpcService_GoogleGrpc_SslCredentials) + err := b.DecodeMessage(msg) + m.CredentialSpecifier = &GrpcService_GoogleGrpc_ChannelCredentials_SslCredentials{msg} + return true, err + case 2: // credential_specifier.google_default + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(types.Empty) + err := b.DecodeMessage(msg) + m.CredentialSpecifier = &GrpcService_GoogleGrpc_ChannelCredentials_GoogleDefault{msg} + return true, err + case 3: // credential_specifier.local_credentials + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(GrpcService_GoogleGrpc_GoogleLocalCredentials) + err := b.DecodeMessage(msg) + m.CredentialSpecifier = &GrpcService_GoogleGrpc_ChannelCredentials_LocalCredentials{msg} + return true, err + default: + return false, nil + } +} + +func _GrpcService_GoogleGrpc_ChannelCredentials_OneofSizer(msg proto.Message) (n int) { + m := msg.(*GrpcService_GoogleGrpc_ChannelCredentials) + // credential_specifier + switch x := m.CredentialSpecifier.(type) { + case *GrpcService_GoogleGrpc_ChannelCredentials_SslCredentials: + s := proto.Size(x.SslCredentials) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case *GrpcService_GoogleGrpc_ChannelCredentials_GoogleDefault: + s := proto.Size(x.GoogleDefault) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case *GrpcService_GoogleGrpc_ChannelCredentials_LocalCredentials: + s := proto.Size(x.LocalCredentials) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case nil: + default: + panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) + } + return n +} + +type GrpcService_GoogleGrpc_CallCredentials struct { + // Types that are valid to be assigned to CredentialSpecifier: + // *GrpcService_GoogleGrpc_CallCredentials_AccessToken + // *GrpcService_GoogleGrpc_CallCredentials_GoogleComputeEngine + // *GrpcService_GoogleGrpc_CallCredentials_GoogleRefreshToken + // *GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJwtAccess + // *GrpcService_GoogleGrpc_CallCredentials_GoogleIam + // *GrpcService_GoogleGrpc_CallCredentials_FromPlugin + CredentialSpecifier isGrpcService_GoogleGrpc_CallCredentials_CredentialSpecifier `protobuf_oneof:"credential_specifier"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GrpcService_GoogleGrpc_CallCredentials) Reset() { + *m = GrpcService_GoogleGrpc_CallCredentials{} +} +func (m *GrpcService_GoogleGrpc_CallCredentials) String() string { return proto.CompactTextString(m) } +func (*GrpcService_GoogleGrpc_CallCredentials) ProtoMessage() {} +func (*GrpcService_GoogleGrpc_CallCredentials) Descriptor() ([]byte, []int) { + return fileDescriptor_grpc_service_2df2b8908a2b5284, []int{0, 1, 3} +} +func (m *GrpcService_GoogleGrpc_CallCredentials) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GrpcService_GoogleGrpc_CallCredentials) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GrpcService_GoogleGrpc_CallCredentials.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *GrpcService_GoogleGrpc_CallCredentials) XXX_Merge(src proto.Message) { + xxx_messageInfo_GrpcService_GoogleGrpc_CallCredentials.Merge(dst, src) +} +func (m *GrpcService_GoogleGrpc_CallCredentials) XXX_Size() int { + return m.Size() +} +func (m *GrpcService_GoogleGrpc_CallCredentials) XXX_DiscardUnknown() { + xxx_messageInfo_GrpcService_GoogleGrpc_CallCredentials.DiscardUnknown(m) +} + +var xxx_messageInfo_GrpcService_GoogleGrpc_CallCredentials proto.InternalMessageInfo + +type isGrpcService_GoogleGrpc_CallCredentials_CredentialSpecifier interface { + isGrpcService_GoogleGrpc_CallCredentials_CredentialSpecifier() + Equal(interface{}) bool + MarshalTo([]byte) (int, error) + Size() int +} + +type GrpcService_GoogleGrpc_CallCredentials_AccessToken struct { + AccessToken string `protobuf:"bytes,1,opt,name=access_token,json=accessToken,proto3,oneof"` +} +type GrpcService_GoogleGrpc_CallCredentials_GoogleComputeEngine struct { + GoogleComputeEngine *types.Empty `protobuf:"bytes,2,opt,name=google_compute_engine,json=googleComputeEngine,oneof"` +} +type GrpcService_GoogleGrpc_CallCredentials_GoogleRefreshToken struct { + GoogleRefreshToken string `protobuf:"bytes,3,opt,name=google_refresh_token,json=googleRefreshToken,proto3,oneof"` +} +type GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJwtAccess struct { + ServiceAccountJwtAccess *GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentials `protobuf:"bytes,4,opt,name=service_account_jwt_access,json=serviceAccountJwtAccess,oneof"` +} +type GrpcService_GoogleGrpc_CallCredentials_GoogleIam struct { + GoogleIam *GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentials `protobuf:"bytes,5,opt,name=google_iam,json=googleIam,oneof"` +} +type GrpcService_GoogleGrpc_CallCredentials_FromPlugin struct { + FromPlugin *GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin `protobuf:"bytes,6,opt,name=from_plugin,json=fromPlugin,oneof"` +} + +func (*GrpcService_GoogleGrpc_CallCredentials_AccessToken) isGrpcService_GoogleGrpc_CallCredentials_CredentialSpecifier() { +} +func (*GrpcService_GoogleGrpc_CallCredentials_GoogleComputeEngine) isGrpcService_GoogleGrpc_CallCredentials_CredentialSpecifier() { +} +func (*GrpcService_GoogleGrpc_CallCredentials_GoogleRefreshToken) isGrpcService_GoogleGrpc_CallCredentials_CredentialSpecifier() { +} +func (*GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJwtAccess) isGrpcService_GoogleGrpc_CallCredentials_CredentialSpecifier() { +} +func (*GrpcService_GoogleGrpc_CallCredentials_GoogleIam) isGrpcService_GoogleGrpc_CallCredentials_CredentialSpecifier() { +} +func (*GrpcService_GoogleGrpc_CallCredentials_FromPlugin) isGrpcService_GoogleGrpc_CallCredentials_CredentialSpecifier() { +} + +func (m *GrpcService_GoogleGrpc_CallCredentials) GetCredentialSpecifier() isGrpcService_GoogleGrpc_CallCredentials_CredentialSpecifier { + if m != nil { + return m.CredentialSpecifier + } + return nil +} + +func (m *GrpcService_GoogleGrpc_CallCredentials) GetAccessToken() string { + if x, ok := m.GetCredentialSpecifier().(*GrpcService_GoogleGrpc_CallCredentials_AccessToken); ok { + return x.AccessToken + } + return "" +} + +func (m *GrpcService_GoogleGrpc_CallCredentials) GetGoogleComputeEngine() *types.Empty { + if x, ok := m.GetCredentialSpecifier().(*GrpcService_GoogleGrpc_CallCredentials_GoogleComputeEngine); ok { + return x.GoogleComputeEngine + } + return nil +} + +func (m *GrpcService_GoogleGrpc_CallCredentials) GetGoogleRefreshToken() string { + if x, ok := m.GetCredentialSpecifier().(*GrpcService_GoogleGrpc_CallCredentials_GoogleRefreshToken); ok { + return x.GoogleRefreshToken + } + return "" +} + +func (m *GrpcService_GoogleGrpc_CallCredentials) GetServiceAccountJwtAccess() *GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentials { + if x, ok := m.GetCredentialSpecifier().(*GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJwtAccess); ok { + return x.ServiceAccountJwtAccess + } + return nil +} + +func (m *GrpcService_GoogleGrpc_CallCredentials) GetGoogleIam() *GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentials { + if x, ok := m.GetCredentialSpecifier().(*GrpcService_GoogleGrpc_CallCredentials_GoogleIam); ok { + return x.GoogleIam + } + return nil +} + +func (m *GrpcService_GoogleGrpc_CallCredentials) GetFromPlugin() *GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin { + if x, ok := m.GetCredentialSpecifier().(*GrpcService_GoogleGrpc_CallCredentials_FromPlugin); ok { + return x.FromPlugin + } + return nil +} + +// XXX_OneofFuncs is for the internal use of the proto package. +func (*GrpcService_GoogleGrpc_CallCredentials) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { + return _GrpcService_GoogleGrpc_CallCredentials_OneofMarshaler, _GrpcService_GoogleGrpc_CallCredentials_OneofUnmarshaler, _GrpcService_GoogleGrpc_CallCredentials_OneofSizer, []interface{}{ + (*GrpcService_GoogleGrpc_CallCredentials_AccessToken)(nil), + (*GrpcService_GoogleGrpc_CallCredentials_GoogleComputeEngine)(nil), + (*GrpcService_GoogleGrpc_CallCredentials_GoogleRefreshToken)(nil), + (*GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJwtAccess)(nil), + (*GrpcService_GoogleGrpc_CallCredentials_GoogleIam)(nil), + (*GrpcService_GoogleGrpc_CallCredentials_FromPlugin)(nil), + } +} + +func _GrpcService_GoogleGrpc_CallCredentials_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { + m := msg.(*GrpcService_GoogleGrpc_CallCredentials) + // credential_specifier + switch x := m.CredentialSpecifier.(type) { + case *GrpcService_GoogleGrpc_CallCredentials_AccessToken: + _ = b.EncodeVarint(1<<3 | proto.WireBytes) + _ = b.EncodeStringBytes(x.AccessToken) + case *GrpcService_GoogleGrpc_CallCredentials_GoogleComputeEngine: + _ = b.EncodeVarint(2<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.GoogleComputeEngine); err != nil { + return err + } + case *GrpcService_GoogleGrpc_CallCredentials_GoogleRefreshToken: + _ = b.EncodeVarint(3<<3 | proto.WireBytes) + _ = b.EncodeStringBytes(x.GoogleRefreshToken) + case *GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJwtAccess: + _ = b.EncodeVarint(4<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.ServiceAccountJwtAccess); err != nil { + return err + } + case *GrpcService_GoogleGrpc_CallCredentials_GoogleIam: + _ = b.EncodeVarint(5<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.GoogleIam); err != nil { + return err + } + case *GrpcService_GoogleGrpc_CallCredentials_FromPlugin: + _ = b.EncodeVarint(6<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.FromPlugin); err != nil { + return err + } + case nil: + default: + return fmt.Errorf("GrpcService_GoogleGrpc_CallCredentials.CredentialSpecifier has unexpected type %T", x) + } + return nil +} + +func _GrpcService_GoogleGrpc_CallCredentials_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { + m := msg.(*GrpcService_GoogleGrpc_CallCredentials) + switch tag { + case 1: // credential_specifier.access_token + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeStringBytes() + m.CredentialSpecifier = &GrpcService_GoogleGrpc_CallCredentials_AccessToken{x} + return true, err + case 2: // credential_specifier.google_compute_engine + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(types.Empty) + err := b.DecodeMessage(msg) + m.CredentialSpecifier = &GrpcService_GoogleGrpc_CallCredentials_GoogleComputeEngine{msg} + return true, err + case 3: // credential_specifier.google_refresh_token + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeStringBytes() + m.CredentialSpecifier = &GrpcService_GoogleGrpc_CallCredentials_GoogleRefreshToken{x} + return true, err + case 4: // credential_specifier.service_account_jwt_access + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentials) + err := b.DecodeMessage(msg) + m.CredentialSpecifier = &GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJwtAccess{msg} + return true, err + case 5: // credential_specifier.google_iam + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentials) + err := b.DecodeMessage(msg) + m.CredentialSpecifier = &GrpcService_GoogleGrpc_CallCredentials_GoogleIam{msg} + return true, err + case 6: // credential_specifier.from_plugin + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin) + err := b.DecodeMessage(msg) + m.CredentialSpecifier = &GrpcService_GoogleGrpc_CallCredentials_FromPlugin{msg} + return true, err + default: + return false, nil + } +} + +func _GrpcService_GoogleGrpc_CallCredentials_OneofSizer(msg proto.Message) (n int) { + m := msg.(*GrpcService_GoogleGrpc_CallCredentials) + // credential_specifier + switch x := m.CredentialSpecifier.(type) { + case *GrpcService_GoogleGrpc_CallCredentials_AccessToken: + n += 1 // tag and wire + n += proto.SizeVarint(uint64(len(x.AccessToken))) + n += len(x.AccessToken) + case *GrpcService_GoogleGrpc_CallCredentials_GoogleComputeEngine: + s := proto.Size(x.GoogleComputeEngine) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case *GrpcService_GoogleGrpc_CallCredentials_GoogleRefreshToken: + n += 1 // tag and wire + n += proto.SizeVarint(uint64(len(x.GoogleRefreshToken))) + n += len(x.GoogleRefreshToken) + case *GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJwtAccess: + s := proto.Size(x.ServiceAccountJwtAccess) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case *GrpcService_GoogleGrpc_CallCredentials_GoogleIam: + s := proto.Size(x.GoogleIam) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case *GrpcService_GoogleGrpc_CallCredentials_FromPlugin: + s := proto.Size(x.FromPlugin) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case nil: + default: + panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) + } + return n +} + +type GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentials struct { + JsonKey string `protobuf:"bytes,1,opt,name=json_key,json=jsonKey,proto3" json:"json_key,omitempty"` + TokenLifetimeSeconds uint64 `protobuf:"varint,2,opt,name=token_lifetime_seconds,json=tokenLifetimeSeconds,proto3" json:"token_lifetime_seconds,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentials) Reset() { + *m = GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentials{} +} +func (m *GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentials) String() string { + return proto.CompactTextString(m) +} +func (*GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentials) ProtoMessage() {} +func (*GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentials) Descriptor() ([]byte, []int) { + return fileDescriptor_grpc_service_2df2b8908a2b5284, []int{0, 1, 3, 0} +} +func (m *GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentials) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentials) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentials.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentials) XXX_Merge(src proto.Message) { + xxx_messageInfo_GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentials.Merge(dst, src) +} +func (m *GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentials) XXX_Size() int { + return m.Size() +} +func (m *GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentials) XXX_DiscardUnknown() { + xxx_messageInfo_GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentials.DiscardUnknown(m) +} + +var xxx_messageInfo_GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentials proto.InternalMessageInfo + +func (m *GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentials) GetJsonKey() string { + if m != nil { + return m.JsonKey + } + return "" +} + +func (m *GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentials) GetTokenLifetimeSeconds() uint64 { + if m != nil { + return m.TokenLifetimeSeconds + } + return 0 +} + +type GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentials struct { + AuthorizationToken string `protobuf:"bytes,1,opt,name=authorization_token,json=authorizationToken,proto3" json:"authorization_token,omitempty"` + AuthoritySelector string `protobuf:"bytes,2,opt,name=authority_selector,json=authoritySelector,proto3" json:"authority_selector,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentials) Reset() { + *m = GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentials{} +} +func (m *GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentials) String() string { + return proto.CompactTextString(m) +} +func (*GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentials) ProtoMessage() {} +func (*GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentials) Descriptor() ([]byte, []int) { + return fileDescriptor_grpc_service_2df2b8908a2b5284, []int{0, 1, 3, 1} +} +func (m *GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentials) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentials) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentials.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentials) XXX_Merge(src proto.Message) { + xxx_messageInfo_GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentials.Merge(dst, src) +} +func (m *GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentials) XXX_Size() int { + return m.Size() +} +func (m *GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentials) XXX_DiscardUnknown() { + xxx_messageInfo_GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentials.DiscardUnknown(m) +} + +var xxx_messageInfo_GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentials proto.InternalMessageInfo + +func (m *GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentials) GetAuthorizationToken() string { + if m != nil { + return m.AuthorizationToken + } + return "" +} + +func (m *GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentials) GetAuthoritySelector() string { + if m != nil { + return m.AuthoritySelector + } + return "" +} + +type GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin struct { + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Config *types.Struct `protobuf:"bytes,2,opt,name=config" json:"config,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin) Reset() { + *m = GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin{} +} +func (m *GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin) String() string { + return proto.CompactTextString(m) +} +func (*GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin) ProtoMessage() {} +func (*GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin) Descriptor() ([]byte, []int) { + return fileDescriptor_grpc_service_2df2b8908a2b5284, []int{0, 1, 3, 2} +} +func (m *GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin) XXX_Merge(src proto.Message) { + xxx_messageInfo_GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin.Merge(dst, src) +} +func (m *GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin) XXX_Size() int { + return m.Size() +} +func (m *GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin) XXX_DiscardUnknown() { + xxx_messageInfo_GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin.DiscardUnknown(m) +} + +var xxx_messageInfo_GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin proto.InternalMessageInfo + +func (m *GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin) GetConfig() *types.Struct { + if m != nil { + return m.Config + } + return nil +} + +func init() { + proto.RegisterType((*GrpcService)(nil), "envoy.api.v2.core.GrpcService") + proto.RegisterType((*GrpcService_EnvoyGrpc)(nil), "envoy.api.v2.core.GrpcService.EnvoyGrpc") + proto.RegisterType((*GrpcService_GoogleGrpc)(nil), "envoy.api.v2.core.GrpcService.GoogleGrpc") + proto.RegisterType((*GrpcService_GoogleGrpc_SslCredentials)(nil), "envoy.api.v2.core.GrpcService.GoogleGrpc.SslCredentials") + proto.RegisterType((*GrpcService_GoogleGrpc_GoogleLocalCredentials)(nil), "envoy.api.v2.core.GrpcService.GoogleGrpc.GoogleLocalCredentials") + proto.RegisterType((*GrpcService_GoogleGrpc_ChannelCredentials)(nil), "envoy.api.v2.core.GrpcService.GoogleGrpc.ChannelCredentials") + proto.RegisterType((*GrpcService_GoogleGrpc_CallCredentials)(nil), "envoy.api.v2.core.GrpcService.GoogleGrpc.CallCredentials") + proto.RegisterType((*GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentials)(nil), "envoy.api.v2.core.GrpcService.GoogleGrpc.CallCredentials.ServiceAccountJWTAccessCredentials") + proto.RegisterType((*GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentials)(nil), "envoy.api.v2.core.GrpcService.GoogleGrpc.CallCredentials.GoogleIAMCredentials") + proto.RegisterType((*GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin)(nil), "envoy.api.v2.core.GrpcService.GoogleGrpc.CallCredentials.MetadataCredentialsFromPlugin") +} +func (this *GrpcService) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*GrpcService) + if !ok { + that2, ok := that.(GrpcService) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if that1.TargetSpecifier == nil { + if this.TargetSpecifier != nil { + return false + } + } else if this.TargetSpecifier == nil { + return false + } else if !this.TargetSpecifier.Equal(that1.TargetSpecifier) { + return false + } + if !this.Timeout.Equal(that1.Timeout) { + return false + } + if len(this.InitialMetadata) != len(that1.InitialMetadata) { + return false + } + for i := range this.InitialMetadata { + if !this.InitialMetadata[i].Equal(that1.InitialMetadata[i]) { + return false + } + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *GrpcService_EnvoyGrpc_) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*GrpcService_EnvoyGrpc_) + if !ok { + that2, ok := that.(GrpcService_EnvoyGrpc_) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.EnvoyGrpc.Equal(that1.EnvoyGrpc) { + return false + } + return true +} +func (this *GrpcService_GoogleGrpc_) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*GrpcService_GoogleGrpc_) + if !ok { + that2, ok := that.(GrpcService_GoogleGrpc_) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.GoogleGrpc.Equal(that1.GoogleGrpc) { + return false + } + return true +} +func (this *GrpcService_EnvoyGrpc) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*GrpcService_EnvoyGrpc) + if !ok { + that2, ok := that.(GrpcService_EnvoyGrpc) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.ClusterName != that1.ClusterName { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *GrpcService_GoogleGrpc) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*GrpcService_GoogleGrpc) + if !ok { + that2, ok := that.(GrpcService_GoogleGrpc) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.TargetUri != that1.TargetUri { + return false + } + if !this.ChannelCredentials.Equal(that1.ChannelCredentials) { + return false + } + if len(this.CallCredentials) != len(that1.CallCredentials) { + return false + } + for i := range this.CallCredentials { + if !this.CallCredentials[i].Equal(that1.CallCredentials[i]) { + return false + } + } + if this.StatPrefix != that1.StatPrefix { + return false + } + if this.CredentialsFactoryName != that1.CredentialsFactoryName { + return false + } + if !this.Config.Equal(that1.Config) { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *GrpcService_GoogleGrpc_SslCredentials) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*GrpcService_GoogleGrpc_SslCredentials) + if !ok { + that2, ok := that.(GrpcService_GoogleGrpc_SslCredentials) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.RootCerts.Equal(that1.RootCerts) { + return false + } + if !this.PrivateKey.Equal(that1.PrivateKey) { + return false + } + if !this.CertChain.Equal(that1.CertChain) { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *GrpcService_GoogleGrpc_GoogleLocalCredentials) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*GrpcService_GoogleGrpc_GoogleLocalCredentials) + if !ok { + that2, ok := that.(GrpcService_GoogleGrpc_GoogleLocalCredentials) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *GrpcService_GoogleGrpc_ChannelCredentials) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*GrpcService_GoogleGrpc_ChannelCredentials) + if !ok { + that2, ok := that.(GrpcService_GoogleGrpc_ChannelCredentials) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if that1.CredentialSpecifier == nil { + if this.CredentialSpecifier != nil { + return false + } + } else if this.CredentialSpecifier == nil { + return false + } else if !this.CredentialSpecifier.Equal(that1.CredentialSpecifier) { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *GrpcService_GoogleGrpc_ChannelCredentials_SslCredentials) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*GrpcService_GoogleGrpc_ChannelCredentials_SslCredentials) + if !ok { + that2, ok := that.(GrpcService_GoogleGrpc_ChannelCredentials_SslCredentials) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.SslCredentials.Equal(that1.SslCredentials) { + return false + } + return true +} +func (this *GrpcService_GoogleGrpc_ChannelCredentials_GoogleDefault) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*GrpcService_GoogleGrpc_ChannelCredentials_GoogleDefault) + if !ok { + that2, ok := that.(GrpcService_GoogleGrpc_ChannelCredentials_GoogleDefault) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.GoogleDefault.Equal(that1.GoogleDefault) { + return false + } + return true +} +func (this *GrpcService_GoogleGrpc_ChannelCredentials_LocalCredentials) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*GrpcService_GoogleGrpc_ChannelCredentials_LocalCredentials) + if !ok { + that2, ok := that.(GrpcService_GoogleGrpc_ChannelCredentials_LocalCredentials) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.LocalCredentials.Equal(that1.LocalCredentials) { + return false + } + return true +} +func (this *GrpcService_GoogleGrpc_CallCredentials) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*GrpcService_GoogleGrpc_CallCredentials) + if !ok { + that2, ok := that.(GrpcService_GoogleGrpc_CallCredentials) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if that1.CredentialSpecifier == nil { + if this.CredentialSpecifier != nil { + return false + } + } else if this.CredentialSpecifier == nil { + return false + } else if !this.CredentialSpecifier.Equal(that1.CredentialSpecifier) { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *GrpcService_GoogleGrpc_CallCredentials_AccessToken) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*GrpcService_GoogleGrpc_CallCredentials_AccessToken) + if !ok { + that2, ok := that.(GrpcService_GoogleGrpc_CallCredentials_AccessToken) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.AccessToken != that1.AccessToken { + return false + } + return true +} +func (this *GrpcService_GoogleGrpc_CallCredentials_GoogleComputeEngine) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*GrpcService_GoogleGrpc_CallCredentials_GoogleComputeEngine) + if !ok { + that2, ok := that.(GrpcService_GoogleGrpc_CallCredentials_GoogleComputeEngine) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.GoogleComputeEngine.Equal(that1.GoogleComputeEngine) { + return false + } + return true +} +func (this *GrpcService_GoogleGrpc_CallCredentials_GoogleRefreshToken) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*GrpcService_GoogleGrpc_CallCredentials_GoogleRefreshToken) + if !ok { + that2, ok := that.(GrpcService_GoogleGrpc_CallCredentials_GoogleRefreshToken) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.GoogleRefreshToken != that1.GoogleRefreshToken { + return false + } + return true +} +func (this *GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJwtAccess) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJwtAccess) + if !ok { + that2, ok := that.(GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJwtAccess) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.ServiceAccountJwtAccess.Equal(that1.ServiceAccountJwtAccess) { + return false + } + return true +} +func (this *GrpcService_GoogleGrpc_CallCredentials_GoogleIam) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*GrpcService_GoogleGrpc_CallCredentials_GoogleIam) + if !ok { + that2, ok := that.(GrpcService_GoogleGrpc_CallCredentials_GoogleIam) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.GoogleIam.Equal(that1.GoogleIam) { + return false + } + return true +} +func (this *GrpcService_GoogleGrpc_CallCredentials_FromPlugin) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*GrpcService_GoogleGrpc_CallCredentials_FromPlugin) + if !ok { + that2, ok := that.(GrpcService_GoogleGrpc_CallCredentials_FromPlugin) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.FromPlugin.Equal(that1.FromPlugin) { + return false + } + return true +} +func (this *GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentials) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentials) + if !ok { + that2, ok := that.(GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentials) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.JsonKey != that1.JsonKey { + return false + } + if this.TokenLifetimeSeconds != that1.TokenLifetimeSeconds { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentials) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentials) + if !ok { + that2, ok := that.(GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentials) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.AuthorizationToken != that1.AuthorizationToken { + return false + } + if this.AuthoritySelector != that1.AuthoritySelector { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin) + if !ok { + that2, ok := that.(GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Name != that1.Name { + return false + } + if !this.Config.Equal(that1.Config) { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (m *GrpcService) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GrpcService) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.TargetSpecifier != nil { + nn1, err := m.TargetSpecifier.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += nn1 + } + if m.Timeout != nil { + dAtA[i] = 0x1a + i++ + i = encodeVarintGrpcService(dAtA, i, uint64(m.Timeout.Size())) + n2, err := m.Timeout.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n2 + } + if len(m.InitialMetadata) > 0 { + for _, msg := range m.InitialMetadata { + dAtA[i] = 0x2a + i++ + i = encodeVarintGrpcService(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *GrpcService_EnvoyGrpc_) MarshalTo(dAtA []byte) (int, error) { + i := 0 + if m.EnvoyGrpc != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintGrpcService(dAtA, i, uint64(m.EnvoyGrpc.Size())) + n3, err := m.EnvoyGrpc.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n3 + } + return i, nil +} +func (m *GrpcService_GoogleGrpc_) MarshalTo(dAtA []byte) (int, error) { + i := 0 + if m.GoogleGrpc != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintGrpcService(dAtA, i, uint64(m.GoogleGrpc.Size())) + n4, err := m.GoogleGrpc.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n4 + } + return i, nil +} +func (m *GrpcService_EnvoyGrpc) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GrpcService_EnvoyGrpc) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.ClusterName) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintGrpcService(dAtA, i, uint64(len(m.ClusterName))) + i += copy(dAtA[i:], m.ClusterName) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *GrpcService_GoogleGrpc) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GrpcService_GoogleGrpc) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.TargetUri) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintGrpcService(dAtA, i, uint64(len(m.TargetUri))) + i += copy(dAtA[i:], m.TargetUri) + } + if m.ChannelCredentials != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintGrpcService(dAtA, i, uint64(m.ChannelCredentials.Size())) + n5, err := m.ChannelCredentials.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n5 + } + if len(m.CallCredentials) > 0 { + for _, msg := range m.CallCredentials { + dAtA[i] = 0x1a + i++ + i = encodeVarintGrpcService(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if len(m.StatPrefix) > 0 { + dAtA[i] = 0x22 + i++ + i = encodeVarintGrpcService(dAtA, i, uint64(len(m.StatPrefix))) + i += copy(dAtA[i:], m.StatPrefix) + } + if len(m.CredentialsFactoryName) > 0 { + dAtA[i] = 0x2a + i++ + i = encodeVarintGrpcService(dAtA, i, uint64(len(m.CredentialsFactoryName))) + i += copy(dAtA[i:], m.CredentialsFactoryName) + } + if m.Config != nil { + dAtA[i] = 0x32 + i++ + i = encodeVarintGrpcService(dAtA, i, uint64(m.Config.Size())) + n6, err := m.Config.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n6 + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *GrpcService_GoogleGrpc_SslCredentials) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GrpcService_GoogleGrpc_SslCredentials) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.RootCerts != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintGrpcService(dAtA, i, uint64(m.RootCerts.Size())) + n7, err := m.RootCerts.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n7 + } + if m.PrivateKey != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintGrpcService(dAtA, i, uint64(m.PrivateKey.Size())) + n8, err := m.PrivateKey.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n8 + } + if m.CertChain != nil { + dAtA[i] = 0x1a + i++ + i = encodeVarintGrpcService(dAtA, i, uint64(m.CertChain.Size())) + n9, err := m.CertChain.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n9 + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *GrpcService_GoogleGrpc_GoogleLocalCredentials) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GrpcService_GoogleGrpc_GoogleLocalCredentials) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *GrpcService_GoogleGrpc_ChannelCredentials) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GrpcService_GoogleGrpc_ChannelCredentials) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.CredentialSpecifier != nil { + nn10, err := m.CredentialSpecifier.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += nn10 + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *GrpcService_GoogleGrpc_ChannelCredentials_SslCredentials) MarshalTo(dAtA []byte) (int, error) { + i := 0 + if m.SslCredentials != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintGrpcService(dAtA, i, uint64(m.SslCredentials.Size())) + n11, err := m.SslCredentials.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n11 + } + return i, nil +} +func (m *GrpcService_GoogleGrpc_ChannelCredentials_GoogleDefault) MarshalTo(dAtA []byte) (int, error) { + i := 0 + if m.GoogleDefault != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintGrpcService(dAtA, i, uint64(m.GoogleDefault.Size())) + n12, err := m.GoogleDefault.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n12 + } + return i, nil +} +func (m *GrpcService_GoogleGrpc_ChannelCredentials_LocalCredentials) MarshalTo(dAtA []byte) (int, error) { + i := 0 + if m.LocalCredentials != nil { + dAtA[i] = 0x1a + i++ + i = encodeVarintGrpcService(dAtA, i, uint64(m.LocalCredentials.Size())) + n13, err := m.LocalCredentials.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n13 + } + return i, nil +} +func (m *GrpcService_GoogleGrpc_CallCredentials) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GrpcService_GoogleGrpc_CallCredentials) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.CredentialSpecifier != nil { + nn14, err := m.CredentialSpecifier.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += nn14 + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *GrpcService_GoogleGrpc_CallCredentials_AccessToken) MarshalTo(dAtA []byte) (int, error) { + i := 0 + dAtA[i] = 0xa + i++ + i = encodeVarintGrpcService(dAtA, i, uint64(len(m.AccessToken))) + i += copy(dAtA[i:], m.AccessToken) + return i, nil +} +func (m *GrpcService_GoogleGrpc_CallCredentials_GoogleComputeEngine) MarshalTo(dAtA []byte) (int, error) { + i := 0 + if m.GoogleComputeEngine != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintGrpcService(dAtA, i, uint64(m.GoogleComputeEngine.Size())) + n15, err := m.GoogleComputeEngine.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n15 + } + return i, nil +} +func (m *GrpcService_GoogleGrpc_CallCredentials_GoogleRefreshToken) MarshalTo(dAtA []byte) (int, error) { + i := 0 + dAtA[i] = 0x1a + i++ + i = encodeVarintGrpcService(dAtA, i, uint64(len(m.GoogleRefreshToken))) + i += copy(dAtA[i:], m.GoogleRefreshToken) + return i, nil +} +func (m *GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJwtAccess) MarshalTo(dAtA []byte) (int, error) { + i := 0 + if m.ServiceAccountJwtAccess != nil { + dAtA[i] = 0x22 + i++ + i = encodeVarintGrpcService(dAtA, i, uint64(m.ServiceAccountJwtAccess.Size())) + n16, err := m.ServiceAccountJwtAccess.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n16 + } + return i, nil +} +func (m *GrpcService_GoogleGrpc_CallCredentials_GoogleIam) MarshalTo(dAtA []byte) (int, error) { + i := 0 + if m.GoogleIam != nil { + dAtA[i] = 0x2a + i++ + i = encodeVarintGrpcService(dAtA, i, uint64(m.GoogleIam.Size())) + n17, err := m.GoogleIam.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n17 + } + return i, nil +} +func (m *GrpcService_GoogleGrpc_CallCredentials_FromPlugin) MarshalTo(dAtA []byte) (int, error) { + i := 0 + if m.FromPlugin != nil { + dAtA[i] = 0x32 + i++ + i = encodeVarintGrpcService(dAtA, i, uint64(m.FromPlugin.Size())) + n18, err := m.FromPlugin.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n18 + } + return i, nil +} +func (m *GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentials) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentials) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.JsonKey) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintGrpcService(dAtA, i, uint64(len(m.JsonKey))) + i += copy(dAtA[i:], m.JsonKey) + } + if m.TokenLifetimeSeconds != 0 { + dAtA[i] = 0x10 + i++ + i = encodeVarintGrpcService(dAtA, i, uint64(m.TokenLifetimeSeconds)) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentials) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentials) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.AuthorizationToken) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintGrpcService(dAtA, i, uint64(len(m.AuthorizationToken))) + i += copy(dAtA[i:], m.AuthorizationToken) + } + if len(m.AuthoritySelector) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintGrpcService(dAtA, i, uint64(len(m.AuthoritySelector))) + i += copy(dAtA[i:], m.AuthoritySelector) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Name) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintGrpcService(dAtA, i, uint64(len(m.Name))) + i += copy(dAtA[i:], m.Name) + } + if m.Config != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintGrpcService(dAtA, i, uint64(m.Config.Size())) + n19, err := m.Config.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n19 + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func encodeVarintGrpcService(dAtA []byte, offset int, v uint64) int { + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return offset + 1 +} +func (m *GrpcService) Size() (n int) { + var l int + _ = l + if m.TargetSpecifier != nil { + n += m.TargetSpecifier.Size() + } + if m.Timeout != nil { + l = m.Timeout.Size() + n += 1 + l + sovGrpcService(uint64(l)) + } + if len(m.InitialMetadata) > 0 { + for _, e := range m.InitialMetadata { + l = e.Size() + n += 1 + l + sovGrpcService(uint64(l)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *GrpcService_EnvoyGrpc_) Size() (n int) { + var l int + _ = l + if m.EnvoyGrpc != nil { + l = m.EnvoyGrpc.Size() + n += 1 + l + sovGrpcService(uint64(l)) + } + return n +} +func (m *GrpcService_GoogleGrpc_) Size() (n int) { + var l int + _ = l + if m.GoogleGrpc != nil { + l = m.GoogleGrpc.Size() + n += 1 + l + sovGrpcService(uint64(l)) + } + return n +} +func (m *GrpcService_EnvoyGrpc) Size() (n int) { + var l int + _ = l + l = len(m.ClusterName) + if l > 0 { + n += 1 + l + sovGrpcService(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *GrpcService_GoogleGrpc) Size() (n int) { + var l int + _ = l + l = len(m.TargetUri) + if l > 0 { + n += 1 + l + sovGrpcService(uint64(l)) + } + if m.ChannelCredentials != nil { + l = m.ChannelCredentials.Size() + n += 1 + l + sovGrpcService(uint64(l)) + } + if len(m.CallCredentials) > 0 { + for _, e := range m.CallCredentials { + l = e.Size() + n += 1 + l + sovGrpcService(uint64(l)) + } + } + l = len(m.StatPrefix) + if l > 0 { + n += 1 + l + sovGrpcService(uint64(l)) + } + l = len(m.CredentialsFactoryName) + if l > 0 { + n += 1 + l + sovGrpcService(uint64(l)) + } + if m.Config != nil { + l = m.Config.Size() + n += 1 + l + sovGrpcService(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *GrpcService_GoogleGrpc_SslCredentials) Size() (n int) { + var l int + _ = l + if m.RootCerts != nil { + l = m.RootCerts.Size() + n += 1 + l + sovGrpcService(uint64(l)) + } + if m.PrivateKey != nil { + l = m.PrivateKey.Size() + n += 1 + l + sovGrpcService(uint64(l)) + } + if m.CertChain != nil { + l = m.CertChain.Size() + n += 1 + l + sovGrpcService(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *GrpcService_GoogleGrpc_GoogleLocalCredentials) Size() (n int) { + var l int + _ = l + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *GrpcService_GoogleGrpc_ChannelCredentials) Size() (n int) { + var l int + _ = l + if m.CredentialSpecifier != nil { + n += m.CredentialSpecifier.Size() + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *GrpcService_GoogleGrpc_ChannelCredentials_SslCredentials) Size() (n int) { + var l int + _ = l + if m.SslCredentials != nil { + l = m.SslCredentials.Size() + n += 1 + l + sovGrpcService(uint64(l)) + } + return n +} +func (m *GrpcService_GoogleGrpc_ChannelCredentials_GoogleDefault) Size() (n int) { + var l int + _ = l + if m.GoogleDefault != nil { + l = m.GoogleDefault.Size() + n += 1 + l + sovGrpcService(uint64(l)) + } + return n +} +func (m *GrpcService_GoogleGrpc_ChannelCredentials_LocalCredentials) Size() (n int) { + var l int + _ = l + if m.LocalCredentials != nil { + l = m.LocalCredentials.Size() + n += 1 + l + sovGrpcService(uint64(l)) + } + return n +} +func (m *GrpcService_GoogleGrpc_CallCredentials) Size() (n int) { + var l int + _ = l + if m.CredentialSpecifier != nil { + n += m.CredentialSpecifier.Size() + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *GrpcService_GoogleGrpc_CallCredentials_AccessToken) Size() (n int) { + var l int + _ = l + l = len(m.AccessToken) + n += 1 + l + sovGrpcService(uint64(l)) + return n +} +func (m *GrpcService_GoogleGrpc_CallCredentials_GoogleComputeEngine) Size() (n int) { + var l int + _ = l + if m.GoogleComputeEngine != nil { + l = m.GoogleComputeEngine.Size() + n += 1 + l + sovGrpcService(uint64(l)) + } + return n +} +func (m *GrpcService_GoogleGrpc_CallCredentials_GoogleRefreshToken) Size() (n int) { + var l int + _ = l + l = len(m.GoogleRefreshToken) + n += 1 + l + sovGrpcService(uint64(l)) + return n +} +func (m *GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJwtAccess) Size() (n int) { + var l int + _ = l + if m.ServiceAccountJwtAccess != nil { + l = m.ServiceAccountJwtAccess.Size() + n += 1 + l + sovGrpcService(uint64(l)) + } + return n +} +func (m *GrpcService_GoogleGrpc_CallCredentials_GoogleIam) Size() (n int) { + var l int + _ = l + if m.GoogleIam != nil { + l = m.GoogleIam.Size() + n += 1 + l + sovGrpcService(uint64(l)) + } + return n +} +func (m *GrpcService_GoogleGrpc_CallCredentials_FromPlugin) Size() (n int) { + var l int + _ = l + if m.FromPlugin != nil { + l = m.FromPlugin.Size() + n += 1 + l + sovGrpcService(uint64(l)) + } + return n +} +func (m *GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentials) Size() (n int) { + var l int + _ = l + l = len(m.JsonKey) + if l > 0 { + n += 1 + l + sovGrpcService(uint64(l)) + } + if m.TokenLifetimeSeconds != 0 { + n += 1 + sovGrpcService(uint64(m.TokenLifetimeSeconds)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentials) Size() (n int) { + var l int + _ = l + l = len(m.AuthorizationToken) + if l > 0 { + n += 1 + l + sovGrpcService(uint64(l)) + } + l = len(m.AuthoritySelector) + if l > 0 { + n += 1 + l + sovGrpcService(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin) Size() (n int) { + var l int + _ = l + l = len(m.Name) + if l > 0 { + n += 1 + l + sovGrpcService(uint64(l)) + } + if m.Config != nil { + l = m.Config.Size() + n += 1 + l + sovGrpcService(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func sovGrpcService(x uint64) (n int) { + for { + n++ + x >>= 7 + if x == 0 { + break + } + } + return n +} +func sozGrpcService(x uint64) (n int) { + return sovGrpcService(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *GrpcService) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGrpcService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GrpcService: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GrpcService: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field EnvoyGrpc", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGrpcService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGrpcService + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &GrpcService_EnvoyGrpc{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.TargetSpecifier = &GrpcService_EnvoyGrpc_{v} + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field GoogleGrpc", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGrpcService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGrpcService + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &GrpcService_GoogleGrpc{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.TargetSpecifier = &GrpcService_GoogleGrpc_{v} + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Timeout", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGrpcService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGrpcService + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Timeout == nil { + m.Timeout = &types.Duration{} + } + if err := m.Timeout.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field InitialMetadata", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGrpcService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGrpcService + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.InitialMetadata = append(m.InitialMetadata, &HeaderValue{}) + if err := m.InitialMetadata[len(m.InitialMetadata)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGrpcService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthGrpcService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GrpcService_EnvoyGrpc) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGrpcService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: EnvoyGrpc: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EnvoyGrpc: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ClusterName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGrpcService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGrpcService + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ClusterName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGrpcService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthGrpcService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GrpcService_GoogleGrpc) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGrpcService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GoogleGrpc: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GoogleGrpc: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TargetUri", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGrpcService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGrpcService + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TargetUri = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ChannelCredentials", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGrpcService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGrpcService + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.ChannelCredentials == nil { + m.ChannelCredentials = &GrpcService_GoogleGrpc_ChannelCredentials{} + } + if err := m.ChannelCredentials.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CallCredentials", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGrpcService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGrpcService + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.CallCredentials = append(m.CallCredentials, &GrpcService_GoogleGrpc_CallCredentials{}) + if err := m.CallCredentials[len(m.CallCredentials)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field StatPrefix", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGrpcService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGrpcService + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.StatPrefix = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CredentialsFactoryName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGrpcService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGrpcService + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.CredentialsFactoryName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Config", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGrpcService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGrpcService + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Config == nil { + m.Config = &types.Struct{} + } + if err := m.Config.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGrpcService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthGrpcService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GrpcService_GoogleGrpc_SslCredentials) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGrpcService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: SslCredentials: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SslCredentials: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RootCerts", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGrpcService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGrpcService + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.RootCerts == nil { + m.RootCerts = &DataSource{} + } + if err := m.RootCerts.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PrivateKey", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGrpcService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGrpcService + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.PrivateKey == nil { + m.PrivateKey = &DataSource{} + } + if err := m.PrivateKey.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CertChain", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGrpcService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGrpcService + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.CertChain == nil { + m.CertChain = &DataSource{} + } + if err := m.CertChain.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGrpcService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthGrpcService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GrpcService_GoogleGrpc_GoogleLocalCredentials) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGrpcService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GoogleLocalCredentials: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GoogleLocalCredentials: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipGrpcService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthGrpcService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GrpcService_GoogleGrpc_ChannelCredentials) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGrpcService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ChannelCredentials: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ChannelCredentials: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SslCredentials", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGrpcService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGrpcService + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &GrpcService_GoogleGrpc_SslCredentials{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.CredentialSpecifier = &GrpcService_GoogleGrpc_ChannelCredentials_SslCredentials{v} + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field GoogleDefault", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGrpcService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGrpcService + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &types.Empty{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.CredentialSpecifier = &GrpcService_GoogleGrpc_ChannelCredentials_GoogleDefault{v} + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LocalCredentials", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGrpcService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGrpcService + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &GrpcService_GoogleGrpc_GoogleLocalCredentials{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.CredentialSpecifier = &GrpcService_GoogleGrpc_ChannelCredentials_LocalCredentials{v} + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGrpcService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthGrpcService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GrpcService_GoogleGrpc_CallCredentials) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGrpcService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: CallCredentials: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CallCredentials: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AccessToken", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGrpcService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGrpcService + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.CredentialSpecifier = &GrpcService_GoogleGrpc_CallCredentials_AccessToken{string(dAtA[iNdEx:postIndex])} + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field GoogleComputeEngine", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGrpcService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGrpcService + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &types.Empty{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.CredentialSpecifier = &GrpcService_GoogleGrpc_CallCredentials_GoogleComputeEngine{v} + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field GoogleRefreshToken", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGrpcService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGrpcService + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.CredentialSpecifier = &GrpcService_GoogleGrpc_CallCredentials_GoogleRefreshToken{string(dAtA[iNdEx:postIndex])} + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ServiceAccountJwtAccess", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGrpcService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGrpcService + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentials{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.CredentialSpecifier = &GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJwtAccess{v} + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field GoogleIam", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGrpcService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGrpcService + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentials{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.CredentialSpecifier = &GrpcService_GoogleGrpc_CallCredentials_GoogleIam{v} + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FromPlugin", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGrpcService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGrpcService + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.CredentialSpecifier = &GrpcService_GoogleGrpc_CallCredentials_FromPlugin{v} + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGrpcService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthGrpcService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentials) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGrpcService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ServiceAccountJWTAccessCredentials: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ServiceAccountJWTAccessCredentials: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field JsonKey", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGrpcService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGrpcService + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.JsonKey = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TokenLifetimeSeconds", wireType) + } + m.TokenLifetimeSeconds = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGrpcService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TokenLifetimeSeconds |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipGrpcService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthGrpcService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentials) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGrpcService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GoogleIAMCredentials: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GoogleIAMCredentials: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AuthorizationToken", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGrpcService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGrpcService + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.AuthorizationToken = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AuthoritySelector", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGrpcService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGrpcService + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.AuthoritySelector = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGrpcService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthGrpcService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGrpcService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MetadataCredentialsFromPlugin: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MetadataCredentialsFromPlugin: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGrpcService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGrpcService + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Config", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGrpcService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGrpcService + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Config == nil { + m.Config = &types.Struct{} + } + if err := m.Config.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGrpcService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthGrpcService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipGrpcService(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGrpcService + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGrpcService + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + return iNdEx, nil + case 1: + iNdEx += 8 + return iNdEx, nil + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGrpcService + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + iNdEx += length + if length < 0 { + return 0, ErrInvalidLengthGrpcService + } + return iNdEx, nil + case 3: + for { + var innerWire uint64 + var start int = iNdEx + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGrpcService + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + innerWire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + innerWireType := int(innerWire & 0x7) + if innerWireType == 4 { + break + } + next, err := skipGrpcService(dAtA[start:]) + if err != nil { + return 0, err + } + iNdEx = start + next + } + return iNdEx, nil + case 4: + return iNdEx, nil + case 5: + iNdEx += 4 + return iNdEx, nil + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + } + panic("unreachable") +} + +var ( + ErrInvalidLengthGrpcService = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowGrpcService = fmt.Errorf("proto: integer overflow") +) + +func init() { + proto.RegisterFile("envoy/api/v2/core/grpc_service.proto", fileDescriptor_grpc_service_2df2b8908a2b5284) +} + +var fileDescriptor_grpc_service_2df2b8908a2b5284 = []byte{ + // 1016 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x55, 0xdd, 0x6e, 0x1b, 0xc5, + 0x17, 0x8f, 0x63, 0x27, 0xa9, 0xcf, 0xf6, 0x9f, 0x38, 0x93, 0xfc, 0x13, 0x67, 0x69, 0xac, 0xa8, + 0x70, 0x11, 0x10, 0xac, 0x25, 0x97, 0x8b, 0x56, 0xaa, 0x80, 0x7c, 0xb5, 0x4e, 0x49, 0xab, 0x6a, + 0x5d, 0xe8, 0x0d, 0xd2, 0x68, 0x32, 0x1e, 0x3b, 0xd3, 0xee, 0xee, 0xac, 0x66, 0x67, 0x5d, 0xdc, + 0xc7, 0xe0, 0x86, 0x0b, 0x5e, 0x80, 0x37, 0x00, 0x71, 0xd5, 0x4b, 0x84, 0xb8, 0xe0, 0x11, 0x50, + 0xee, 0xfa, 0x16, 0x68, 0x3e, 0x9c, 0x78, 0xed, 0x08, 0x87, 0xdc, 0xcd, 0x9c, 0xdf, 0xf9, 0xfc, + 0xcd, 0x99, 0x73, 0xe0, 0x23, 0x96, 0x0c, 0xc4, 0xb0, 0x49, 0x52, 0xde, 0x1c, 0xb4, 0x9a, 0x54, + 0x48, 0xd6, 0xec, 0xcb, 0x94, 0xe2, 0x8c, 0xc9, 0x01, 0xa7, 0x2c, 0x48, 0xa5, 0x50, 0x02, 0xad, + 0x1a, 0xad, 0x80, 0xa4, 0x3c, 0x18, 0xb4, 0x02, 0xad, 0xe5, 0xdf, 0x99, 0x36, 0x3c, 0x25, 0x99, + 0x33, 0xf0, 0x1b, 0x7d, 0x21, 0xfa, 0x11, 0x6b, 0x9a, 0xdb, 0x69, 0xde, 0x6b, 0x76, 0x73, 0x49, + 0x14, 0x17, 0x89, 0xc3, 0xef, 0x4c, 0xe2, 0x99, 0x92, 0x39, 0x55, 0x0e, 0xfd, 0x60, 0x12, 0x65, + 0x71, 0xaa, 0x86, 0x0e, 0xdc, 0x1c, 0x90, 0x88, 0x77, 0x89, 0x62, 0xcd, 0xd1, 0xc1, 0x01, 0xeb, + 0x7d, 0xd1, 0x17, 0xe6, 0xd8, 0xd4, 0x27, 0x2b, 0xbd, 0xfb, 0x23, 0x02, 0xef, 0xb1, 0x4c, 0x69, + 0xc7, 0x16, 0x84, 0x8e, 0x01, 0x4c, 0xe6, 0x58, 0x97, 0x59, 0x2f, 0xed, 0x94, 0x76, 0xbd, 0xd6, + 0x6e, 0x30, 0x55, 0x5f, 0x30, 0x66, 0x13, 0x1c, 0x69, 0x54, 0x0b, 0xda, 0x73, 0x61, 0x95, 0x8d, + 0x2e, 0xe8, 0x04, 0x3c, 0x9b, 0xa8, 0xf5, 0x35, 0x6f, 0x7c, 0x7d, 0x3c, 0xc3, 0xd7, 0x63, 0x63, + 0xe1, 0x9c, 0x41, 0xff, 0xe2, 0x86, 0xee, 0xc1, 0x92, 0xe2, 0x31, 0x13, 0xb9, 0xaa, 0x97, 0x8d, + 0xa7, 0xad, 0xc0, 0xa2, 0xc1, 0x88, 0x86, 0xe0, 0xd0, 0x91, 0x18, 0x8e, 0x34, 0xd1, 0x31, 0xd4, + 0x78, 0xc2, 0x15, 0x27, 0x11, 0x8e, 0x99, 0x22, 0x5d, 0xa2, 0x48, 0x7d, 0x61, 0xa7, 0xbc, 0xeb, + 0xb5, 0x1a, 0x57, 0xe4, 0xd1, 0x66, 0xa4, 0xcb, 0xe4, 0xb7, 0x24, 0xca, 0x59, 0xb8, 0xe2, 0xec, + 0x9e, 0x3a, 0x33, 0xff, 0x01, 0x54, 0x2f, 0xea, 0x44, 0x9f, 0xc2, 0x6d, 0x1a, 0xe5, 0x99, 0x62, + 0x12, 0x27, 0x24, 0x66, 0x86, 0xa7, 0xea, 0x7e, 0xf5, 0xb7, 0xf7, 0xef, 0xca, 0x15, 0x39, 0xbf, + 0x53, 0x0a, 0x3d, 0x07, 0x3f, 0x23, 0x31, 0xf3, 0x7f, 0x58, 0x01, 0xb8, 0xac, 0x0b, 0xed, 0x02, + 0x28, 0x22, 0xfb, 0x4c, 0xe1, 0x5c, 0xf2, 0x69, 0xd3, 0xaa, 0x05, 0xbf, 0x91, 0x1c, 0xc5, 0xb0, + 0x46, 0xcf, 0x48, 0x92, 0xb0, 0x08, 0x53, 0xc9, 0xba, 0x2c, 0xd1, 0x19, 0x65, 0x8e, 0xc9, 0x87, + 0xd7, 0x66, 0x32, 0x38, 0xb0, 0x4e, 0x0e, 0x2e, 0x7d, 0x84, 0x88, 0x4e, 0xc9, 0x50, 0x17, 0x6a, + 0x94, 0x44, 0xc5, 0x58, 0x65, 0xc3, 0xd6, 0x83, 0xff, 0x10, 0x8b, 0x44, 0x85, 0x40, 0x2b, 0xb4, + 0x28, 0x40, 0x9f, 0x80, 0x97, 0x29, 0xa2, 0x70, 0x2a, 0x59, 0x8f, 0x7f, 0x5f, 0xaf, 0x4c, 0xd6, + 0x0f, 0x1a, 0x7d, 0x6e, 0x40, 0x74, 0x1f, 0xea, 0x63, 0xc9, 0xe0, 0x1e, 0xa1, 0x4a, 0xc8, 0xa1, + 0xe5, 0x7c, 0x41, 0x1b, 0x86, 0x1b, 0x63, 0xf8, 0x23, 0x0b, 0x6b, 0xce, 0x51, 0x13, 0x16, 0xa9, + 0x48, 0x7a, 0xbc, 0x5f, 0x5f, 0x34, 0x6c, 0x6d, 0x4e, 0x75, 0x4b, 0xc7, 0x7c, 0xa9, 0xd0, 0xa9, + 0xf9, 0x7f, 0x96, 0x60, 0xb9, 0x93, 0x15, 0x32, 0x7d, 0x08, 0x20, 0x85, 0x50, 0x98, 0x32, 0xa9, + 0x32, 0xf7, 0x17, 0xb6, 0xaf, 0x60, 0xe2, 0x90, 0x28, 0xd2, 0x11, 0xb9, 0xa4, 0x2c, 0xac, 0x6a, + 0x83, 0x03, 0xad, 0x8f, 0xbe, 0x00, 0x2f, 0x95, 0x7c, 0x40, 0x14, 0xc3, 0xaf, 0xd9, 0xd0, 0x3d, + 0xda, 0x0c, 0x73, 0x70, 0x16, 0x5f, 0xb3, 0xa1, 0x8e, 0xae, 0x03, 0x63, 0x7a, 0x46, 0x78, 0xe2, + 0x7a, 0x7e, 0x56, 0x74, 0x6d, 0x70, 0xa0, 0xf5, 0xfd, 0x3a, 0x6c, 0xd8, 0x47, 0x39, 0x11, 0x94, + 0x8c, 0x57, 0xe5, 0xff, 0x31, 0x0f, 0x68, 0xba, 0x21, 0x10, 0x85, 0x95, 0x2c, 0x2b, 0xbe, 0xbd, + 0xad, 0xf8, 0xfe, 0xf5, 0xdf, 0xbe, 0xc8, 0x5f, 0x7b, 0x2e, 0x5c, 0xce, 0x8a, 0x8c, 0x7e, 0x09, + 0xcb, 0x6e, 0x24, 0x74, 0x59, 0x8f, 0xe4, 0x91, 0x72, 0xb4, 0x6c, 0x4c, 0xbd, 0xce, 0x91, 0x1e, + 0x69, 0xed, 0xb9, 0xf0, 0x7f, 0x16, 0x38, 0xb4, 0xea, 0x48, 0xc0, 0x6a, 0xa4, 0x0b, 0x9a, 0xe8, + 0x51, 0xed, 0xe3, 0xab, 0xeb, 0xe7, 0x79, 0x35, 0x33, 0xed, 0xb9, 0xb0, 0x16, 0x4d, 0xc8, 0xf6, + 0xb7, 0x61, 0xfd, 0x32, 0x14, 0xce, 0x52, 0x46, 0x79, 0x8f, 0x33, 0x89, 0x16, 0x7e, 0x7d, 0xff, + 0xae, 0x5c, 0xf2, 0x7f, 0x59, 0x82, 0x95, 0x89, 0x8e, 0x47, 0x1f, 0xc2, 0x6d, 0x42, 0x29, 0xcb, + 0x32, 0xac, 0xc4, 0x6b, 0x96, 0xd8, 0x1f, 0xde, 0x9e, 0x0b, 0x3d, 0x2b, 0x7d, 0xa1, 0x85, 0xe8, + 0x04, 0xfe, 0xef, 0x98, 0xa0, 0x22, 0x4e, 0x73, 0xc5, 0x30, 0x4b, 0xfa, 0x3c, 0x61, 0x33, 0x09, + 0x59, 0xb3, 0xc0, 0x81, 0xb5, 0x3a, 0x32, 0x46, 0xa8, 0x05, 0xeb, 0xce, 0x9b, 0x64, 0x3d, 0xc9, + 0xb2, 0x33, 0x17, 0xba, 0xec, 0x42, 0x23, 0x8b, 0x86, 0x16, 0xb4, 0x19, 0xfc, 0x54, 0x02, 0xdf, + 0xad, 0x31, 0x4c, 0x28, 0x15, 0x79, 0xa2, 0xf0, 0xab, 0x37, 0x0a, 0xdb, 0x2c, 0xcd, 0xbf, 0xf4, + 0x5a, 0xdf, 0xdd, 0xf8, 0xe3, 0x07, 0x4e, 0x65, 0xcf, 0xba, 0x7e, 0xf2, 0xf2, 0xc5, 0x9e, 0x71, + 0x5c, 0x24, 0x7c, 0x33, 0x2b, 0x6a, 0xbd, 0x51, 0x56, 0x0b, 0x09, 0x70, 0xc3, 0x1f, 0x73, 0x12, + 0x9b, 0xbf, 0xee, 0xb5, 0x9e, 0xdd, 0x3c, 0x19, 0x0b, 0x1d, 0xef, 0x3d, 0x2d, 0x86, 0xaf, 0xda, + 0x18, 0xc7, 0x24, 0x46, 0x6f, 0xc1, 0xeb, 0x49, 0x11, 0xe3, 0x34, 0xca, 0xfb, 0x3c, 0x71, 0x53, + 0xe3, 0xe5, 0xcd, 0x23, 0x8e, 0x16, 0xc7, 0x98, 0xec, 0x91, 0x14, 0xf1, 0x73, 0xe3, 0x5e, 0xef, + 0xb6, 0xde, 0xc5, 0xcd, 0xcf, 0xe1, 0xee, 0x6c, 0xb6, 0xd0, 0x16, 0xdc, 0x7a, 0x95, 0x89, 0xc4, + 0x4c, 0x13, 0xd3, 0x53, 0xe1, 0x92, 0xbe, 0xeb, 0x59, 0xf1, 0x39, 0x6c, 0x98, 0x07, 0xc7, 0x11, + 0xef, 0x31, 0xbd, 0xfc, 0x70, 0xc6, 0xa8, 0x48, 0xba, 0x76, 0x57, 0x54, 0xc2, 0x75, 0x83, 0x9e, + 0x38, 0xb0, 0x63, 0x31, 0x7f, 0x00, 0xeb, 0x57, 0xf1, 0x82, 0x9a, 0xb0, 0x46, 0x72, 0x75, 0x26, + 0x24, 0x7f, 0x6b, 0xf6, 0xe9, 0x78, 0x1f, 0x87, 0xa8, 0x00, 0xd9, 0x56, 0xfa, 0x0c, 0x46, 0x52, + 0x35, 0xc4, 0x19, 0x8b, 0x98, 0x9e, 0xc3, 0x26, 0x74, 0x35, 0x5c, 0xbd, 0x40, 0x3a, 0x0e, 0xf0, + 0xbb, 0xb0, 0xfd, 0xaf, 0xec, 0x20, 0x04, 0x95, 0xcb, 0xb5, 0x1a, 0x9a, 0xf3, 0xd8, 0x40, 0x9f, + 0xbf, 0xd6, 0x40, 0x9f, 0xf1, 0x73, 0xf7, 0xb7, 0xa0, 0xe6, 0xb6, 0xf0, 0x24, 0xf4, 0xa4, 0x72, + 0xab, 0x52, 0x5b, 0xd8, 0xaf, 0xfd, 0x7c, 0xde, 0x28, 0xfd, 0x7e, 0xde, 0x28, 0xfd, 0x75, 0xde, + 0x28, 0xfd, 0x7d, 0xde, 0x28, 0x9d, 0x2e, 0x9a, 0x50, 0xf7, 0xfe, 0x09, 0x00, 0x00, 0xff, 0xff, + 0xb9, 0x5d, 0xca, 0xa0, 0x15, 0x0a, 0x00, 0x00, +} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/core/grpc_service.pb.validate.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/core/grpc_service.pb.validate.go new file mode 100644 index 000000000000..f92c6a359af5 --- /dev/null +++ b/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/core/grpc_service.pb.validate.go @@ -0,0 +1,746 @@ +// Code generated by protoc-gen-validate +// source: envoy/api/v2/core/grpc_service.proto +// DO NOT EDIT!!! + +package core + +import ( + "bytes" + "errors" + "fmt" + "net" + "net/mail" + "net/url" + "regexp" + "strings" + "time" + "unicode/utf8" + + "github.com/gogo/protobuf/types" +) + +// ensure the imports are used +var ( + _ = bytes.MinRead + _ = errors.New("") + _ = fmt.Print + _ = utf8.UTFMax + _ = (*regexp.Regexp)(nil) + _ = (*strings.Reader)(nil) + _ = net.IPv4len + _ = time.Duration(0) + _ = (*url.URL)(nil) + _ = (*mail.Address)(nil) + _ = types.DynamicAny{} +) + +// Validate checks the field values on GrpcService with the rules defined in +// the proto definition for this message. If any rules are violated, an error +// is returned. +func (m *GrpcService) Validate() error { + if m == nil { + return nil + } + + if v, ok := interface{}(m.GetTimeout()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return GrpcServiceValidationError{ + Field: "Timeout", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + for idx, item := range m.GetInitialMetadata() { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return GrpcServiceValidationError{ + Field: fmt.Sprintf("InitialMetadata[%v]", idx), + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + } + + switch m.TargetSpecifier.(type) { + + case *GrpcService_EnvoyGrpc_: + + if v, ok := interface{}(m.GetEnvoyGrpc()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return GrpcServiceValidationError{ + Field: "EnvoyGrpc", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + case *GrpcService_GoogleGrpc_: + + if v, ok := interface{}(m.GetGoogleGrpc()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return GrpcServiceValidationError{ + Field: "GoogleGrpc", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + default: + return GrpcServiceValidationError{ + Field: "TargetSpecifier", + Reason: "value is required", + } + + } + + return nil +} + +// GrpcServiceValidationError is the validation error returned by +// GrpcService.Validate if the designated constraints aren't met. +type GrpcServiceValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e GrpcServiceValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sGrpcService.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = GrpcServiceValidationError{} + +// Validate checks the field values on GrpcService_EnvoyGrpc with the rules +// defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *GrpcService_EnvoyGrpc) Validate() error { + if m == nil { + return nil + } + + if len(m.GetClusterName()) < 1 { + return GrpcService_EnvoyGrpcValidationError{ + Field: "ClusterName", + Reason: "value length must be at least 1 bytes", + } + } + + return nil +} + +// GrpcService_EnvoyGrpcValidationError is the validation error returned by +// GrpcService_EnvoyGrpc.Validate if the designated constraints aren't met. +type GrpcService_EnvoyGrpcValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e GrpcService_EnvoyGrpcValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sGrpcService_EnvoyGrpc.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = GrpcService_EnvoyGrpcValidationError{} + +// Validate checks the field values on GrpcService_GoogleGrpc with the rules +// defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *GrpcService_GoogleGrpc) Validate() error { + if m == nil { + return nil + } + + if len(m.GetTargetUri()) < 1 { + return GrpcService_GoogleGrpcValidationError{ + Field: "TargetUri", + Reason: "value length must be at least 1 bytes", + } + } + + if v, ok := interface{}(m.GetChannelCredentials()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return GrpcService_GoogleGrpcValidationError{ + Field: "ChannelCredentials", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + for idx, item := range m.GetCallCredentials() { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return GrpcService_GoogleGrpcValidationError{ + Field: fmt.Sprintf("CallCredentials[%v]", idx), + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + } + + if len(m.GetStatPrefix()) < 1 { + return GrpcService_GoogleGrpcValidationError{ + Field: "StatPrefix", + Reason: "value length must be at least 1 bytes", + } + } + + // no validation rules for CredentialsFactoryName + + if v, ok := interface{}(m.GetConfig()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return GrpcService_GoogleGrpcValidationError{ + Field: "Config", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + return nil +} + +// GrpcService_GoogleGrpcValidationError is the validation error returned by +// GrpcService_GoogleGrpc.Validate if the designated constraints aren't met. +type GrpcService_GoogleGrpcValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e GrpcService_GoogleGrpcValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sGrpcService_GoogleGrpc.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = GrpcService_GoogleGrpcValidationError{} + +// Validate checks the field values on GrpcService_GoogleGrpc_SslCredentials +// with the rules defined in the proto definition for this message. If any +// rules are violated, an error is returned. +func (m *GrpcService_GoogleGrpc_SslCredentials) Validate() error { + if m == nil { + return nil + } + + if v, ok := interface{}(m.GetRootCerts()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return GrpcService_GoogleGrpc_SslCredentialsValidationError{ + Field: "RootCerts", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + if v, ok := interface{}(m.GetPrivateKey()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return GrpcService_GoogleGrpc_SslCredentialsValidationError{ + Field: "PrivateKey", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + if v, ok := interface{}(m.GetCertChain()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return GrpcService_GoogleGrpc_SslCredentialsValidationError{ + Field: "CertChain", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + return nil +} + +// GrpcService_GoogleGrpc_SslCredentialsValidationError is the validation error +// returned by GrpcService_GoogleGrpc_SslCredentials.Validate if the +// designated constraints aren't met. +type GrpcService_GoogleGrpc_SslCredentialsValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e GrpcService_GoogleGrpc_SslCredentialsValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sGrpcService_GoogleGrpc_SslCredentials.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = GrpcService_GoogleGrpc_SslCredentialsValidationError{} + +// Validate checks the field values on +// GrpcService_GoogleGrpc_GoogleLocalCredentials with the rules defined in the +// proto definition for this message. If any rules are violated, an error is returned. +func (m *GrpcService_GoogleGrpc_GoogleLocalCredentials) Validate() error { + if m == nil { + return nil + } + + return nil +} + +// GrpcService_GoogleGrpc_GoogleLocalCredentialsValidationError is the +// validation error returned by +// GrpcService_GoogleGrpc_GoogleLocalCredentials.Validate if the designated +// constraints aren't met. +type GrpcService_GoogleGrpc_GoogleLocalCredentialsValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e GrpcService_GoogleGrpc_GoogleLocalCredentialsValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sGrpcService_GoogleGrpc_GoogleLocalCredentials.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = GrpcService_GoogleGrpc_GoogleLocalCredentialsValidationError{} + +// Validate checks the field values on +// GrpcService_GoogleGrpc_ChannelCredentials with the rules defined in the +// proto definition for this message. If any rules are violated, an error is returned. +func (m *GrpcService_GoogleGrpc_ChannelCredentials) Validate() error { + if m == nil { + return nil + } + + switch m.CredentialSpecifier.(type) { + + case *GrpcService_GoogleGrpc_ChannelCredentials_SslCredentials: + + if v, ok := interface{}(m.GetSslCredentials()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return GrpcService_GoogleGrpc_ChannelCredentialsValidationError{ + Field: "SslCredentials", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + case *GrpcService_GoogleGrpc_ChannelCredentials_GoogleDefault: + + if v, ok := interface{}(m.GetGoogleDefault()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return GrpcService_GoogleGrpc_ChannelCredentialsValidationError{ + Field: "GoogleDefault", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + case *GrpcService_GoogleGrpc_ChannelCredentials_LocalCredentials: + + if v, ok := interface{}(m.GetLocalCredentials()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return GrpcService_GoogleGrpc_ChannelCredentialsValidationError{ + Field: "LocalCredentials", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + default: + return GrpcService_GoogleGrpc_ChannelCredentialsValidationError{ + Field: "CredentialSpecifier", + Reason: "value is required", + } + + } + + return nil +} + +// GrpcService_GoogleGrpc_ChannelCredentialsValidationError is the validation +// error returned by GrpcService_GoogleGrpc_ChannelCredentials.Validate if the +// designated constraints aren't met. +type GrpcService_GoogleGrpc_ChannelCredentialsValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e GrpcService_GoogleGrpc_ChannelCredentialsValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sGrpcService_GoogleGrpc_ChannelCredentials.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = GrpcService_GoogleGrpc_ChannelCredentialsValidationError{} + +// Validate checks the field values on GrpcService_GoogleGrpc_CallCredentials +// with the rules defined in the proto definition for this message. If any +// rules are violated, an error is returned. +func (m *GrpcService_GoogleGrpc_CallCredentials) Validate() error { + if m == nil { + return nil + } + + switch m.CredentialSpecifier.(type) { + + case *GrpcService_GoogleGrpc_CallCredentials_AccessToken: + // no validation rules for AccessToken + + case *GrpcService_GoogleGrpc_CallCredentials_GoogleComputeEngine: + + if v, ok := interface{}(m.GetGoogleComputeEngine()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return GrpcService_GoogleGrpc_CallCredentialsValidationError{ + Field: "GoogleComputeEngine", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + case *GrpcService_GoogleGrpc_CallCredentials_GoogleRefreshToken: + // no validation rules for GoogleRefreshToken + + case *GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJwtAccess: + + if v, ok := interface{}(m.GetServiceAccountJwtAccess()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return GrpcService_GoogleGrpc_CallCredentialsValidationError{ + Field: "ServiceAccountJwtAccess", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + case *GrpcService_GoogleGrpc_CallCredentials_GoogleIam: + + if v, ok := interface{}(m.GetGoogleIam()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return GrpcService_GoogleGrpc_CallCredentialsValidationError{ + Field: "GoogleIam", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + case *GrpcService_GoogleGrpc_CallCredentials_FromPlugin: + + if v, ok := interface{}(m.GetFromPlugin()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return GrpcService_GoogleGrpc_CallCredentialsValidationError{ + Field: "FromPlugin", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + default: + return GrpcService_GoogleGrpc_CallCredentialsValidationError{ + Field: "CredentialSpecifier", + Reason: "value is required", + } + + } + + return nil +} + +// GrpcService_GoogleGrpc_CallCredentialsValidationError is the validation +// error returned by GrpcService_GoogleGrpc_CallCredentials.Validate if the +// designated constraints aren't met. +type GrpcService_GoogleGrpc_CallCredentialsValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e GrpcService_GoogleGrpc_CallCredentialsValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sGrpcService_GoogleGrpc_CallCredentials.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = GrpcService_GoogleGrpc_CallCredentialsValidationError{} + +// Validate checks the field values on +// GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentials +// with the rules defined in the proto definition for this message. If any +// rules are violated, an error is returned. +func (m *GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentials) Validate() error { + if m == nil { + return nil + } + + // no validation rules for JsonKey + + // no validation rules for TokenLifetimeSeconds + + return nil +} + +// GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentialsValidationError +// is the validation error returned by +// GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentials.Validate +// if the designated constraints aren't met. +type GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentialsValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentialsValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sGrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentials.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentialsValidationError{} + +// Validate checks the field values on +// GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentials with the rules +// defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentials) Validate() error { + if m == nil { + return nil + } + + // no validation rules for AuthorizationToken + + // no validation rules for AuthoritySelector + + return nil +} + +// GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentialsValidationError +// is the validation error returned by +// GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentials.Validate if the +// designated constraints aren't met. +type GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentialsValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentialsValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sGrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentials.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentialsValidationError{} + +// Validate checks the field values on +// GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin with +// the rules defined in the proto definition for this message. If any rules +// are violated, an error is returned. +func (m *GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin) Validate() error { + if m == nil { + return nil + } + + // no validation rules for Name + + if v, ok := interface{}(m.GetConfig()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPluginValidationError{ + Field: "Config", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + return nil +} + +// GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPluginValidationError +// is the validation error returned by +// GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin.Validate +// if the designated constraints aren't met. +type GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPluginValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPluginValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sGrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPluginValidationError{} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/core/health_check.pb.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/core/health_check.pb.go new file mode 100644 index 000000000000..52b1d2fb5f25 --- /dev/null +++ b/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/core/health_check.pb.go @@ -0,0 +1,3602 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: envoy/api/v2/core/health_check.proto + +package core + +import proto "github.com/gogo/protobuf/proto" +import fmt "fmt" +import math "math" +import _ "github.com/gogo/protobuf/gogoproto" +import types "github.com/gogo/protobuf/types" +import _ "github.com/lyft/protoc-gen-validate/validate" + +import time "time" + +import bytes "bytes" + +import github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" + +import io "io" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf +var _ = time.Kitchen + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package + +// Endpoint health status. +type HealthStatus int32 + +const ( + // The health status is not known. This is interpreted by Envoy as *HEALTHY*. + HealthStatus_UNKNOWN HealthStatus = 0 + // Healthy. + HealthStatus_HEALTHY HealthStatus = 1 + // Unhealthy. + HealthStatus_UNHEALTHY HealthStatus = 2 + // Connection draining in progress. E.g., + // ``_ + // or + // ``_. + // This is interpreted by Envoy as *UNHEALTHY*. + HealthStatus_DRAINING HealthStatus = 3 + // Health check timed out. This is part of HDS and is interpreted by Envoy as + // *UNHEALTHY*. + HealthStatus_TIMEOUT HealthStatus = 4 +) + +var HealthStatus_name = map[int32]string{ + 0: "UNKNOWN", + 1: "HEALTHY", + 2: "UNHEALTHY", + 3: "DRAINING", + 4: "TIMEOUT", +} +var HealthStatus_value = map[string]int32{ + "UNKNOWN": 0, + "HEALTHY": 1, + "UNHEALTHY": 2, + "DRAINING": 3, + "TIMEOUT": 4, +} + +func (x HealthStatus) String() string { + return proto.EnumName(HealthStatus_name, int32(x)) +} +func (HealthStatus) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_health_check_ccd217d94c083297, []int{0} +} + +type HealthCheck struct { + // The time to wait for a health check response. If the timeout is reached the + // health check attempt will be considered a failure. + Timeout *time.Duration `protobuf:"bytes,1,opt,name=timeout,stdduration" json:"timeout,omitempty"` + // The interval between health checks. + Interval *time.Duration `protobuf:"bytes,2,opt,name=interval,stdduration" json:"interval,omitempty"` + // An optional jitter amount in millseconds. If specified, during every + // interval Envoy will add 0 to interval_jitter to the wait time. + IntervalJitter *types.Duration `protobuf:"bytes,3,opt,name=interval_jitter,json=intervalJitter" json:"interval_jitter,omitempty"` + // An optional jitter amount as a percentage of interval_ms. If specified, + // during every interval Envoy will add 0 to interval_ms * + // interval_jitter_percent / 100 to the wait time. + // + // If interval_jitter_ms and interval_jitter_percent are both set, both of + // them will be used to increase the wait time. + IntervalJitterPercent uint32 `protobuf:"varint,18,opt,name=interval_jitter_percent,json=intervalJitterPercent,proto3" json:"interval_jitter_percent,omitempty"` + // The number of unhealthy health checks required before a host is marked + // unhealthy. Note that for *http* health checking if a host responds with 503 + // this threshold is ignored and the host is considered unhealthy immediately. + UnhealthyThreshold *types.UInt32Value `protobuf:"bytes,4,opt,name=unhealthy_threshold,json=unhealthyThreshold" json:"unhealthy_threshold,omitempty"` + // The number of healthy health checks required before a host is marked + // healthy. Note that during startup, only a single successful health check is + // required to mark a host healthy. + HealthyThreshold *types.UInt32Value `protobuf:"bytes,5,opt,name=healthy_threshold,json=healthyThreshold" json:"healthy_threshold,omitempty"` + // [#not-implemented-hide:] Non-serving port for health checking. + AltPort *types.UInt32Value `protobuf:"bytes,6,opt,name=alt_port,json=altPort" json:"alt_port,omitempty"` + // Reuse health check connection between health checks. Default is true. + ReuseConnection *types.BoolValue `protobuf:"bytes,7,opt,name=reuse_connection,json=reuseConnection" json:"reuse_connection,omitempty"` + // Types that are valid to be assigned to HealthChecker: + // *HealthCheck_HttpHealthCheck_ + // *HealthCheck_TcpHealthCheck_ + // *HealthCheck_GrpcHealthCheck_ + // *HealthCheck_CustomHealthCheck_ + HealthChecker isHealthCheck_HealthChecker `protobuf_oneof:"health_checker"` + // The "no traffic interval" is a special health check interval that is used when a cluster has + // never had traffic routed to it. This lower interval allows cluster information to be kept up to + // date, without sending a potentially large amount of active health checking traffic for no + // reason. Once a cluster has been used for traffic routing, Envoy will shift back to using the + // standard health check interval that is defined. Note that this interval takes precedence over + // any other. + // + // The default value for "no traffic interval" is 60 seconds. + NoTrafficInterval *types.Duration `protobuf:"bytes,12,opt,name=no_traffic_interval,json=noTrafficInterval" json:"no_traffic_interval,omitempty"` + // The "unhealthy interval" is a health check interval that is used for hosts that are marked as + // unhealthy. As soon as the host is marked as healthy, Envoy will shift back to using the + // standard health check interval that is defined. + // + // The default value for "unhealthy interval" is the same as "interval". + UnhealthyInterval *types.Duration `protobuf:"bytes,14,opt,name=unhealthy_interval,json=unhealthyInterval" json:"unhealthy_interval,omitempty"` + // The "unhealthy edge interval" is a special health check interval that is used for the first + // health check right after a host is marked as unhealthy. For subsequent health checks + // Envoy will shift back to using either "unhealthy interval" if present or the standard health + // check interval that is defined. + // + // The default value for "unhealthy edge interval" is the same as "unhealthy interval". + UnhealthyEdgeInterval *types.Duration `protobuf:"bytes,15,opt,name=unhealthy_edge_interval,json=unhealthyEdgeInterval" json:"unhealthy_edge_interval,omitempty"` + // The "healthy edge interval" is a special health check interval that is used for the first + // health check right after a host is marked as healthy. For subsequent health checks + // Envoy will shift back to using the standard health check interval that is defined. + // + // The default value for "healthy edge interval" is the same as the default interval. + HealthyEdgeInterval *types.Duration `protobuf:"bytes,16,opt,name=healthy_edge_interval,json=healthyEdgeInterval" json:"healthy_edge_interval,omitempty"` + // Specifies the path to the :ref:`health check event log `. + // If empty, no event log will be written. + EventLogPath string `protobuf:"bytes,17,opt,name=event_log_path,json=eventLogPath,proto3" json:"event_log_path,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *HealthCheck) Reset() { *m = HealthCheck{} } +func (m *HealthCheck) String() string { return proto.CompactTextString(m) } +func (*HealthCheck) ProtoMessage() {} +func (*HealthCheck) Descriptor() ([]byte, []int) { + return fileDescriptor_health_check_ccd217d94c083297, []int{0} +} +func (m *HealthCheck) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *HealthCheck) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_HealthCheck.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *HealthCheck) XXX_Merge(src proto.Message) { + xxx_messageInfo_HealthCheck.Merge(dst, src) +} +func (m *HealthCheck) XXX_Size() int { + return m.Size() +} +func (m *HealthCheck) XXX_DiscardUnknown() { + xxx_messageInfo_HealthCheck.DiscardUnknown(m) +} + +var xxx_messageInfo_HealthCheck proto.InternalMessageInfo + +type isHealthCheck_HealthChecker interface { + isHealthCheck_HealthChecker() + Equal(interface{}) bool + MarshalTo([]byte) (int, error) + Size() int +} + +type HealthCheck_HttpHealthCheck_ struct { + HttpHealthCheck *HealthCheck_HttpHealthCheck `protobuf:"bytes,8,opt,name=http_health_check,json=httpHealthCheck,oneof"` +} +type HealthCheck_TcpHealthCheck_ struct { + TcpHealthCheck *HealthCheck_TcpHealthCheck `protobuf:"bytes,9,opt,name=tcp_health_check,json=tcpHealthCheck,oneof"` +} +type HealthCheck_GrpcHealthCheck_ struct { + GrpcHealthCheck *HealthCheck_GrpcHealthCheck `protobuf:"bytes,11,opt,name=grpc_health_check,json=grpcHealthCheck,oneof"` +} +type HealthCheck_CustomHealthCheck_ struct { + CustomHealthCheck *HealthCheck_CustomHealthCheck `protobuf:"bytes,13,opt,name=custom_health_check,json=customHealthCheck,oneof"` +} + +func (*HealthCheck_HttpHealthCheck_) isHealthCheck_HealthChecker() {} +func (*HealthCheck_TcpHealthCheck_) isHealthCheck_HealthChecker() {} +func (*HealthCheck_GrpcHealthCheck_) isHealthCheck_HealthChecker() {} +func (*HealthCheck_CustomHealthCheck_) isHealthCheck_HealthChecker() {} + +func (m *HealthCheck) GetHealthChecker() isHealthCheck_HealthChecker { + if m != nil { + return m.HealthChecker + } + return nil +} + +func (m *HealthCheck) GetTimeout() *time.Duration { + if m != nil { + return m.Timeout + } + return nil +} + +func (m *HealthCheck) GetInterval() *time.Duration { + if m != nil { + return m.Interval + } + return nil +} + +func (m *HealthCheck) GetIntervalJitter() *types.Duration { + if m != nil { + return m.IntervalJitter + } + return nil +} + +func (m *HealthCheck) GetIntervalJitterPercent() uint32 { + if m != nil { + return m.IntervalJitterPercent + } + return 0 +} + +func (m *HealthCheck) GetUnhealthyThreshold() *types.UInt32Value { + if m != nil { + return m.UnhealthyThreshold + } + return nil +} + +func (m *HealthCheck) GetHealthyThreshold() *types.UInt32Value { + if m != nil { + return m.HealthyThreshold + } + return nil +} + +func (m *HealthCheck) GetAltPort() *types.UInt32Value { + if m != nil { + return m.AltPort + } + return nil +} + +func (m *HealthCheck) GetReuseConnection() *types.BoolValue { + if m != nil { + return m.ReuseConnection + } + return nil +} + +func (m *HealthCheck) GetHttpHealthCheck() *HealthCheck_HttpHealthCheck { + if x, ok := m.GetHealthChecker().(*HealthCheck_HttpHealthCheck_); ok { + return x.HttpHealthCheck + } + return nil +} + +func (m *HealthCheck) GetTcpHealthCheck() *HealthCheck_TcpHealthCheck { + if x, ok := m.GetHealthChecker().(*HealthCheck_TcpHealthCheck_); ok { + return x.TcpHealthCheck + } + return nil +} + +func (m *HealthCheck) GetGrpcHealthCheck() *HealthCheck_GrpcHealthCheck { + if x, ok := m.GetHealthChecker().(*HealthCheck_GrpcHealthCheck_); ok { + return x.GrpcHealthCheck + } + return nil +} + +func (m *HealthCheck) GetCustomHealthCheck() *HealthCheck_CustomHealthCheck { + if x, ok := m.GetHealthChecker().(*HealthCheck_CustomHealthCheck_); ok { + return x.CustomHealthCheck + } + return nil +} + +func (m *HealthCheck) GetNoTrafficInterval() *types.Duration { + if m != nil { + return m.NoTrafficInterval + } + return nil +} + +func (m *HealthCheck) GetUnhealthyInterval() *types.Duration { + if m != nil { + return m.UnhealthyInterval + } + return nil +} + +func (m *HealthCheck) GetUnhealthyEdgeInterval() *types.Duration { + if m != nil { + return m.UnhealthyEdgeInterval + } + return nil +} + +func (m *HealthCheck) GetHealthyEdgeInterval() *types.Duration { + if m != nil { + return m.HealthyEdgeInterval + } + return nil +} + +func (m *HealthCheck) GetEventLogPath() string { + if m != nil { + return m.EventLogPath + } + return "" +} + +// XXX_OneofFuncs is for the internal use of the proto package. +func (*HealthCheck) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { + return _HealthCheck_OneofMarshaler, _HealthCheck_OneofUnmarshaler, _HealthCheck_OneofSizer, []interface{}{ + (*HealthCheck_HttpHealthCheck_)(nil), + (*HealthCheck_TcpHealthCheck_)(nil), + (*HealthCheck_GrpcHealthCheck_)(nil), + (*HealthCheck_CustomHealthCheck_)(nil), + } +} + +func _HealthCheck_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { + m := msg.(*HealthCheck) + // health_checker + switch x := m.HealthChecker.(type) { + case *HealthCheck_HttpHealthCheck_: + _ = b.EncodeVarint(8<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.HttpHealthCheck); err != nil { + return err + } + case *HealthCheck_TcpHealthCheck_: + _ = b.EncodeVarint(9<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.TcpHealthCheck); err != nil { + return err + } + case *HealthCheck_GrpcHealthCheck_: + _ = b.EncodeVarint(11<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.GrpcHealthCheck); err != nil { + return err + } + case *HealthCheck_CustomHealthCheck_: + _ = b.EncodeVarint(13<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.CustomHealthCheck); err != nil { + return err + } + case nil: + default: + return fmt.Errorf("HealthCheck.HealthChecker has unexpected type %T", x) + } + return nil +} + +func _HealthCheck_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { + m := msg.(*HealthCheck) + switch tag { + case 8: // health_checker.http_health_check + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(HealthCheck_HttpHealthCheck) + err := b.DecodeMessage(msg) + m.HealthChecker = &HealthCheck_HttpHealthCheck_{msg} + return true, err + case 9: // health_checker.tcp_health_check + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(HealthCheck_TcpHealthCheck) + err := b.DecodeMessage(msg) + m.HealthChecker = &HealthCheck_TcpHealthCheck_{msg} + return true, err + case 11: // health_checker.grpc_health_check + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(HealthCheck_GrpcHealthCheck) + err := b.DecodeMessage(msg) + m.HealthChecker = &HealthCheck_GrpcHealthCheck_{msg} + return true, err + case 13: // health_checker.custom_health_check + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(HealthCheck_CustomHealthCheck) + err := b.DecodeMessage(msg) + m.HealthChecker = &HealthCheck_CustomHealthCheck_{msg} + return true, err + default: + return false, nil + } +} + +func _HealthCheck_OneofSizer(msg proto.Message) (n int) { + m := msg.(*HealthCheck) + // health_checker + switch x := m.HealthChecker.(type) { + case *HealthCheck_HttpHealthCheck_: + s := proto.Size(x.HttpHealthCheck) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case *HealthCheck_TcpHealthCheck_: + s := proto.Size(x.TcpHealthCheck) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case *HealthCheck_GrpcHealthCheck_: + s := proto.Size(x.GrpcHealthCheck) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case *HealthCheck_CustomHealthCheck_: + s := proto.Size(x.CustomHealthCheck) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case nil: + default: + panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) + } + return n +} + +// Describes the encoding of the payload bytes in the payload. +type HealthCheck_Payload struct { + // Types that are valid to be assigned to Payload: + // *HealthCheck_Payload_Text + // *HealthCheck_Payload_Binary + Payload isHealthCheck_Payload_Payload `protobuf_oneof:"payload"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *HealthCheck_Payload) Reset() { *m = HealthCheck_Payload{} } +func (m *HealthCheck_Payload) String() string { return proto.CompactTextString(m) } +func (*HealthCheck_Payload) ProtoMessage() {} +func (*HealthCheck_Payload) Descriptor() ([]byte, []int) { + return fileDescriptor_health_check_ccd217d94c083297, []int{0, 0} +} +func (m *HealthCheck_Payload) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *HealthCheck_Payload) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_HealthCheck_Payload.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *HealthCheck_Payload) XXX_Merge(src proto.Message) { + xxx_messageInfo_HealthCheck_Payload.Merge(dst, src) +} +func (m *HealthCheck_Payload) XXX_Size() int { + return m.Size() +} +func (m *HealthCheck_Payload) XXX_DiscardUnknown() { + xxx_messageInfo_HealthCheck_Payload.DiscardUnknown(m) +} + +var xxx_messageInfo_HealthCheck_Payload proto.InternalMessageInfo + +type isHealthCheck_Payload_Payload interface { + isHealthCheck_Payload_Payload() + Equal(interface{}) bool + MarshalTo([]byte) (int, error) + Size() int +} + +type HealthCheck_Payload_Text struct { + Text string `protobuf:"bytes,1,opt,name=text,proto3,oneof"` +} +type HealthCheck_Payload_Binary struct { + Binary []byte `protobuf:"bytes,2,opt,name=binary,proto3,oneof"` +} + +func (*HealthCheck_Payload_Text) isHealthCheck_Payload_Payload() {} +func (*HealthCheck_Payload_Binary) isHealthCheck_Payload_Payload() {} + +func (m *HealthCheck_Payload) GetPayload() isHealthCheck_Payload_Payload { + if m != nil { + return m.Payload + } + return nil +} + +func (m *HealthCheck_Payload) GetText() string { + if x, ok := m.GetPayload().(*HealthCheck_Payload_Text); ok { + return x.Text + } + return "" +} + +func (m *HealthCheck_Payload) GetBinary() []byte { + if x, ok := m.GetPayload().(*HealthCheck_Payload_Binary); ok { + return x.Binary + } + return nil +} + +// XXX_OneofFuncs is for the internal use of the proto package. +func (*HealthCheck_Payload) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { + return _HealthCheck_Payload_OneofMarshaler, _HealthCheck_Payload_OneofUnmarshaler, _HealthCheck_Payload_OneofSizer, []interface{}{ + (*HealthCheck_Payload_Text)(nil), + (*HealthCheck_Payload_Binary)(nil), + } +} + +func _HealthCheck_Payload_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { + m := msg.(*HealthCheck_Payload) + // payload + switch x := m.Payload.(type) { + case *HealthCheck_Payload_Text: + _ = b.EncodeVarint(1<<3 | proto.WireBytes) + _ = b.EncodeStringBytes(x.Text) + case *HealthCheck_Payload_Binary: + _ = b.EncodeVarint(2<<3 | proto.WireBytes) + _ = b.EncodeRawBytes(x.Binary) + case nil: + default: + return fmt.Errorf("HealthCheck_Payload.Payload has unexpected type %T", x) + } + return nil +} + +func _HealthCheck_Payload_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { + m := msg.(*HealthCheck_Payload) + switch tag { + case 1: // payload.text + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeStringBytes() + m.Payload = &HealthCheck_Payload_Text{x} + return true, err + case 2: // payload.binary + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeRawBytes(true) + m.Payload = &HealthCheck_Payload_Binary{x} + return true, err + default: + return false, nil + } +} + +func _HealthCheck_Payload_OneofSizer(msg proto.Message) (n int) { + m := msg.(*HealthCheck_Payload) + // payload + switch x := m.Payload.(type) { + case *HealthCheck_Payload_Text: + n += 1 // tag and wire + n += proto.SizeVarint(uint64(len(x.Text))) + n += len(x.Text) + case *HealthCheck_Payload_Binary: + n += 1 // tag and wire + n += proto.SizeVarint(uint64(len(x.Binary))) + n += len(x.Binary) + case nil: + default: + panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) + } + return n +} + +type HealthCheck_HttpHealthCheck struct { + // The value of the host header in the HTTP health check request. If + // left empty (default value), the name of the cluster this health check is associated + // with will be used. + Host string `protobuf:"bytes,1,opt,name=host,proto3" json:"host,omitempty"` + // Specifies the HTTP path that will be requested during health checking. For example + // */healthcheck*. + Path string `protobuf:"bytes,2,opt,name=path,proto3" json:"path,omitempty"` + // [#not-implemented-hide:] HTTP specific payload. + Send *HealthCheck_Payload `protobuf:"bytes,3,opt,name=send" json:"send,omitempty"` + // [#not-implemented-hide:] HTTP specific response. + Receive *HealthCheck_Payload `protobuf:"bytes,4,opt,name=receive" json:"receive,omitempty"` + // An optional service name parameter which is used to validate the identity of + // the health checked cluster. See the :ref:`architecture overview + // ` for more information. + ServiceName string `protobuf:"bytes,5,opt,name=service_name,json=serviceName,proto3" json:"service_name,omitempty"` + // Specifies a list of HTTP headers that should be added to each request that is sent to the + // health checked cluster. For more information, including details on header value syntax, see + // the documentation on :ref:`custom request headers + // `. + RequestHeadersToAdd []*HeaderValueOption `protobuf:"bytes,6,rep,name=request_headers_to_add,json=requestHeadersToAdd" json:"request_headers_to_add,omitempty"` + // If set, health checks will be made using http/2. + UseHttp2 bool `protobuf:"varint,7,opt,name=use_http2,json=useHttp2,proto3" json:"use_http2,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *HealthCheck_HttpHealthCheck) Reset() { *m = HealthCheck_HttpHealthCheck{} } +func (m *HealthCheck_HttpHealthCheck) String() string { return proto.CompactTextString(m) } +func (*HealthCheck_HttpHealthCheck) ProtoMessage() {} +func (*HealthCheck_HttpHealthCheck) Descriptor() ([]byte, []int) { + return fileDescriptor_health_check_ccd217d94c083297, []int{0, 1} +} +func (m *HealthCheck_HttpHealthCheck) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *HealthCheck_HttpHealthCheck) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_HealthCheck_HttpHealthCheck.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *HealthCheck_HttpHealthCheck) XXX_Merge(src proto.Message) { + xxx_messageInfo_HealthCheck_HttpHealthCheck.Merge(dst, src) +} +func (m *HealthCheck_HttpHealthCheck) XXX_Size() int { + return m.Size() +} +func (m *HealthCheck_HttpHealthCheck) XXX_DiscardUnknown() { + xxx_messageInfo_HealthCheck_HttpHealthCheck.DiscardUnknown(m) +} + +var xxx_messageInfo_HealthCheck_HttpHealthCheck proto.InternalMessageInfo + +func (m *HealthCheck_HttpHealthCheck) GetHost() string { + if m != nil { + return m.Host + } + return "" +} + +func (m *HealthCheck_HttpHealthCheck) GetPath() string { + if m != nil { + return m.Path + } + return "" +} + +func (m *HealthCheck_HttpHealthCheck) GetSend() *HealthCheck_Payload { + if m != nil { + return m.Send + } + return nil +} + +func (m *HealthCheck_HttpHealthCheck) GetReceive() *HealthCheck_Payload { + if m != nil { + return m.Receive + } + return nil +} + +func (m *HealthCheck_HttpHealthCheck) GetServiceName() string { + if m != nil { + return m.ServiceName + } + return "" +} + +func (m *HealthCheck_HttpHealthCheck) GetRequestHeadersToAdd() []*HeaderValueOption { + if m != nil { + return m.RequestHeadersToAdd + } + return nil +} + +func (m *HealthCheck_HttpHealthCheck) GetUseHttp2() bool { + if m != nil { + return m.UseHttp2 + } + return false +} + +type HealthCheck_TcpHealthCheck struct { + // Empty payloads imply a connect-only health check. + Send *HealthCheck_Payload `protobuf:"bytes,1,opt,name=send" json:"send,omitempty"` + // When checking the response, “fuzzy” matching is performed such that each + // binary block must be found, and in the order specified, but not + // necessarily contiguous. + Receive []*HealthCheck_Payload `protobuf:"bytes,2,rep,name=receive" json:"receive,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *HealthCheck_TcpHealthCheck) Reset() { *m = HealthCheck_TcpHealthCheck{} } +func (m *HealthCheck_TcpHealthCheck) String() string { return proto.CompactTextString(m) } +func (*HealthCheck_TcpHealthCheck) ProtoMessage() {} +func (*HealthCheck_TcpHealthCheck) Descriptor() ([]byte, []int) { + return fileDescriptor_health_check_ccd217d94c083297, []int{0, 2} +} +func (m *HealthCheck_TcpHealthCheck) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *HealthCheck_TcpHealthCheck) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_HealthCheck_TcpHealthCheck.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *HealthCheck_TcpHealthCheck) XXX_Merge(src proto.Message) { + xxx_messageInfo_HealthCheck_TcpHealthCheck.Merge(dst, src) +} +func (m *HealthCheck_TcpHealthCheck) XXX_Size() int { + return m.Size() +} +func (m *HealthCheck_TcpHealthCheck) XXX_DiscardUnknown() { + xxx_messageInfo_HealthCheck_TcpHealthCheck.DiscardUnknown(m) +} + +var xxx_messageInfo_HealthCheck_TcpHealthCheck proto.InternalMessageInfo + +func (m *HealthCheck_TcpHealthCheck) GetSend() *HealthCheck_Payload { + if m != nil { + return m.Send + } + return nil +} + +func (m *HealthCheck_TcpHealthCheck) GetReceive() []*HealthCheck_Payload { + if m != nil { + return m.Receive + } + return nil +} + +type HealthCheck_RedisHealthCheck struct { + // If set, optionally perform ``EXISTS `` instead of ``PING``. A return value + // from Redis of 0 (does not exist) is considered a passing healthcheck. A return value other + // than 0 is considered a failure. This allows the user to mark a Redis instance for maintenance + // by setting the specified key to any value and waiting for traffic to drain. + Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *HealthCheck_RedisHealthCheck) Reset() { *m = HealthCheck_RedisHealthCheck{} } +func (m *HealthCheck_RedisHealthCheck) String() string { return proto.CompactTextString(m) } +func (*HealthCheck_RedisHealthCheck) ProtoMessage() {} +func (*HealthCheck_RedisHealthCheck) Descriptor() ([]byte, []int) { + return fileDescriptor_health_check_ccd217d94c083297, []int{0, 3} +} +func (m *HealthCheck_RedisHealthCheck) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *HealthCheck_RedisHealthCheck) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_HealthCheck_RedisHealthCheck.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *HealthCheck_RedisHealthCheck) XXX_Merge(src proto.Message) { + xxx_messageInfo_HealthCheck_RedisHealthCheck.Merge(dst, src) +} +func (m *HealthCheck_RedisHealthCheck) XXX_Size() int { + return m.Size() +} +func (m *HealthCheck_RedisHealthCheck) XXX_DiscardUnknown() { + xxx_messageInfo_HealthCheck_RedisHealthCheck.DiscardUnknown(m) +} + +var xxx_messageInfo_HealthCheck_RedisHealthCheck proto.InternalMessageInfo + +func (m *HealthCheck_RedisHealthCheck) GetKey() string { + if m != nil { + return m.Key + } + return "" +} + +// `grpc.health.v1.Health +// `_-based +// healthcheck. See `gRPC doc `_ +// for details. +type HealthCheck_GrpcHealthCheck struct { + // An optional service name parameter which will be sent to gRPC service in + // `grpc.health.v1.HealthCheckRequest + // `_. + // message. See `gRPC health-checking overview + // `_ for more information. + ServiceName string `protobuf:"bytes,1,opt,name=service_name,json=serviceName,proto3" json:"service_name,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *HealthCheck_GrpcHealthCheck) Reset() { *m = HealthCheck_GrpcHealthCheck{} } +func (m *HealthCheck_GrpcHealthCheck) String() string { return proto.CompactTextString(m) } +func (*HealthCheck_GrpcHealthCheck) ProtoMessage() {} +func (*HealthCheck_GrpcHealthCheck) Descriptor() ([]byte, []int) { + return fileDescriptor_health_check_ccd217d94c083297, []int{0, 4} +} +func (m *HealthCheck_GrpcHealthCheck) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *HealthCheck_GrpcHealthCheck) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_HealthCheck_GrpcHealthCheck.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *HealthCheck_GrpcHealthCheck) XXX_Merge(src proto.Message) { + xxx_messageInfo_HealthCheck_GrpcHealthCheck.Merge(dst, src) +} +func (m *HealthCheck_GrpcHealthCheck) XXX_Size() int { + return m.Size() +} +func (m *HealthCheck_GrpcHealthCheck) XXX_DiscardUnknown() { + xxx_messageInfo_HealthCheck_GrpcHealthCheck.DiscardUnknown(m) +} + +var xxx_messageInfo_HealthCheck_GrpcHealthCheck proto.InternalMessageInfo + +func (m *HealthCheck_GrpcHealthCheck) GetServiceName() string { + if m != nil { + return m.ServiceName + } + return "" +} + +// Custom health check. +type HealthCheck_CustomHealthCheck struct { + // The registered name of the custom health checker. + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // A custom health checker specific configuration which depends on the custom health checker + // being instantiated. See :api:`envoy/config/health_checker` for reference. + Config *types.Struct `protobuf:"bytes,2,opt,name=config" json:"config,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *HealthCheck_CustomHealthCheck) Reset() { *m = HealthCheck_CustomHealthCheck{} } +func (m *HealthCheck_CustomHealthCheck) String() string { return proto.CompactTextString(m) } +func (*HealthCheck_CustomHealthCheck) ProtoMessage() {} +func (*HealthCheck_CustomHealthCheck) Descriptor() ([]byte, []int) { + return fileDescriptor_health_check_ccd217d94c083297, []int{0, 5} +} +func (m *HealthCheck_CustomHealthCheck) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *HealthCheck_CustomHealthCheck) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_HealthCheck_CustomHealthCheck.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *HealthCheck_CustomHealthCheck) XXX_Merge(src proto.Message) { + xxx_messageInfo_HealthCheck_CustomHealthCheck.Merge(dst, src) +} +func (m *HealthCheck_CustomHealthCheck) XXX_Size() int { + return m.Size() +} +func (m *HealthCheck_CustomHealthCheck) XXX_DiscardUnknown() { + xxx_messageInfo_HealthCheck_CustomHealthCheck.DiscardUnknown(m) +} + +var xxx_messageInfo_HealthCheck_CustomHealthCheck proto.InternalMessageInfo + +func (m *HealthCheck_CustomHealthCheck) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *HealthCheck_CustomHealthCheck) GetConfig() *types.Struct { + if m != nil { + return m.Config + } + return nil +} + +func init() { + proto.RegisterType((*HealthCheck)(nil), "envoy.api.v2.core.HealthCheck") + proto.RegisterType((*HealthCheck_Payload)(nil), "envoy.api.v2.core.HealthCheck.Payload") + proto.RegisterType((*HealthCheck_HttpHealthCheck)(nil), "envoy.api.v2.core.HealthCheck.HttpHealthCheck") + proto.RegisterType((*HealthCheck_TcpHealthCheck)(nil), "envoy.api.v2.core.HealthCheck.TcpHealthCheck") + proto.RegisterType((*HealthCheck_RedisHealthCheck)(nil), "envoy.api.v2.core.HealthCheck.RedisHealthCheck") + proto.RegisterType((*HealthCheck_GrpcHealthCheck)(nil), "envoy.api.v2.core.HealthCheck.GrpcHealthCheck") + proto.RegisterType((*HealthCheck_CustomHealthCheck)(nil), "envoy.api.v2.core.HealthCheck.CustomHealthCheck") + proto.RegisterEnum("envoy.api.v2.core.HealthStatus", HealthStatus_name, HealthStatus_value) +} +func (this *HealthCheck) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*HealthCheck) + if !ok { + that2, ok := that.(HealthCheck) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Timeout != nil && that1.Timeout != nil { + if *this.Timeout != *that1.Timeout { + return false + } + } else if this.Timeout != nil { + return false + } else if that1.Timeout != nil { + return false + } + if this.Interval != nil && that1.Interval != nil { + if *this.Interval != *that1.Interval { + return false + } + } else if this.Interval != nil { + return false + } else if that1.Interval != nil { + return false + } + if !this.IntervalJitter.Equal(that1.IntervalJitter) { + return false + } + if this.IntervalJitterPercent != that1.IntervalJitterPercent { + return false + } + if !this.UnhealthyThreshold.Equal(that1.UnhealthyThreshold) { + return false + } + if !this.HealthyThreshold.Equal(that1.HealthyThreshold) { + return false + } + if !this.AltPort.Equal(that1.AltPort) { + return false + } + if !this.ReuseConnection.Equal(that1.ReuseConnection) { + return false + } + if that1.HealthChecker == nil { + if this.HealthChecker != nil { + return false + } + } else if this.HealthChecker == nil { + return false + } else if !this.HealthChecker.Equal(that1.HealthChecker) { + return false + } + if !this.NoTrafficInterval.Equal(that1.NoTrafficInterval) { + return false + } + if !this.UnhealthyInterval.Equal(that1.UnhealthyInterval) { + return false + } + if !this.UnhealthyEdgeInterval.Equal(that1.UnhealthyEdgeInterval) { + return false + } + if !this.HealthyEdgeInterval.Equal(that1.HealthyEdgeInterval) { + return false + } + if this.EventLogPath != that1.EventLogPath { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *HealthCheck_HttpHealthCheck_) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*HealthCheck_HttpHealthCheck_) + if !ok { + that2, ok := that.(HealthCheck_HttpHealthCheck_) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.HttpHealthCheck.Equal(that1.HttpHealthCheck) { + return false + } + return true +} +func (this *HealthCheck_TcpHealthCheck_) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*HealthCheck_TcpHealthCheck_) + if !ok { + that2, ok := that.(HealthCheck_TcpHealthCheck_) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.TcpHealthCheck.Equal(that1.TcpHealthCheck) { + return false + } + return true +} +func (this *HealthCheck_GrpcHealthCheck_) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*HealthCheck_GrpcHealthCheck_) + if !ok { + that2, ok := that.(HealthCheck_GrpcHealthCheck_) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.GrpcHealthCheck.Equal(that1.GrpcHealthCheck) { + return false + } + return true +} +func (this *HealthCheck_CustomHealthCheck_) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*HealthCheck_CustomHealthCheck_) + if !ok { + that2, ok := that.(HealthCheck_CustomHealthCheck_) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.CustomHealthCheck.Equal(that1.CustomHealthCheck) { + return false + } + return true +} +func (this *HealthCheck_Payload) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*HealthCheck_Payload) + if !ok { + that2, ok := that.(HealthCheck_Payload) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if that1.Payload == nil { + if this.Payload != nil { + return false + } + } else if this.Payload == nil { + return false + } else if !this.Payload.Equal(that1.Payload) { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *HealthCheck_Payload_Text) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*HealthCheck_Payload_Text) + if !ok { + that2, ok := that.(HealthCheck_Payload_Text) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Text != that1.Text { + return false + } + return true +} +func (this *HealthCheck_Payload_Binary) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*HealthCheck_Payload_Binary) + if !ok { + that2, ok := that.(HealthCheck_Payload_Binary) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !bytes.Equal(this.Binary, that1.Binary) { + return false + } + return true +} +func (this *HealthCheck_HttpHealthCheck) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*HealthCheck_HttpHealthCheck) + if !ok { + that2, ok := that.(HealthCheck_HttpHealthCheck) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Host != that1.Host { + return false + } + if this.Path != that1.Path { + return false + } + if !this.Send.Equal(that1.Send) { + return false + } + if !this.Receive.Equal(that1.Receive) { + return false + } + if this.ServiceName != that1.ServiceName { + return false + } + if len(this.RequestHeadersToAdd) != len(that1.RequestHeadersToAdd) { + return false + } + for i := range this.RequestHeadersToAdd { + if !this.RequestHeadersToAdd[i].Equal(that1.RequestHeadersToAdd[i]) { + return false + } + } + if this.UseHttp2 != that1.UseHttp2 { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *HealthCheck_TcpHealthCheck) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*HealthCheck_TcpHealthCheck) + if !ok { + that2, ok := that.(HealthCheck_TcpHealthCheck) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.Send.Equal(that1.Send) { + return false + } + if len(this.Receive) != len(that1.Receive) { + return false + } + for i := range this.Receive { + if !this.Receive[i].Equal(that1.Receive[i]) { + return false + } + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *HealthCheck_RedisHealthCheck) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*HealthCheck_RedisHealthCheck) + if !ok { + that2, ok := that.(HealthCheck_RedisHealthCheck) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Key != that1.Key { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *HealthCheck_GrpcHealthCheck) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*HealthCheck_GrpcHealthCheck) + if !ok { + that2, ok := that.(HealthCheck_GrpcHealthCheck) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.ServiceName != that1.ServiceName { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *HealthCheck_CustomHealthCheck) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*HealthCheck_CustomHealthCheck) + if !ok { + that2, ok := that.(HealthCheck_CustomHealthCheck) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Name != that1.Name { + return false + } + if !this.Config.Equal(that1.Config) { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (m *HealthCheck) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *HealthCheck) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Timeout != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintHealthCheck(dAtA, i, uint64(github_com_gogo_protobuf_types.SizeOfStdDuration(*m.Timeout))) + n1, err := github_com_gogo_protobuf_types.StdDurationMarshalTo(*m.Timeout, dAtA[i:]) + if err != nil { + return 0, err + } + i += n1 + } + if m.Interval != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintHealthCheck(dAtA, i, uint64(github_com_gogo_protobuf_types.SizeOfStdDuration(*m.Interval))) + n2, err := github_com_gogo_protobuf_types.StdDurationMarshalTo(*m.Interval, dAtA[i:]) + if err != nil { + return 0, err + } + i += n2 + } + if m.IntervalJitter != nil { + dAtA[i] = 0x1a + i++ + i = encodeVarintHealthCheck(dAtA, i, uint64(m.IntervalJitter.Size())) + n3, err := m.IntervalJitter.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n3 + } + if m.UnhealthyThreshold != nil { + dAtA[i] = 0x22 + i++ + i = encodeVarintHealthCheck(dAtA, i, uint64(m.UnhealthyThreshold.Size())) + n4, err := m.UnhealthyThreshold.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n4 + } + if m.HealthyThreshold != nil { + dAtA[i] = 0x2a + i++ + i = encodeVarintHealthCheck(dAtA, i, uint64(m.HealthyThreshold.Size())) + n5, err := m.HealthyThreshold.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n5 + } + if m.AltPort != nil { + dAtA[i] = 0x32 + i++ + i = encodeVarintHealthCheck(dAtA, i, uint64(m.AltPort.Size())) + n6, err := m.AltPort.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n6 + } + if m.ReuseConnection != nil { + dAtA[i] = 0x3a + i++ + i = encodeVarintHealthCheck(dAtA, i, uint64(m.ReuseConnection.Size())) + n7, err := m.ReuseConnection.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n7 + } + if m.HealthChecker != nil { + nn8, err := m.HealthChecker.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += nn8 + } + if m.NoTrafficInterval != nil { + dAtA[i] = 0x62 + i++ + i = encodeVarintHealthCheck(dAtA, i, uint64(m.NoTrafficInterval.Size())) + n9, err := m.NoTrafficInterval.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n9 + } + if m.UnhealthyInterval != nil { + dAtA[i] = 0x72 + i++ + i = encodeVarintHealthCheck(dAtA, i, uint64(m.UnhealthyInterval.Size())) + n10, err := m.UnhealthyInterval.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n10 + } + if m.UnhealthyEdgeInterval != nil { + dAtA[i] = 0x7a + i++ + i = encodeVarintHealthCheck(dAtA, i, uint64(m.UnhealthyEdgeInterval.Size())) + n11, err := m.UnhealthyEdgeInterval.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n11 + } + if m.HealthyEdgeInterval != nil { + dAtA[i] = 0x82 + i++ + dAtA[i] = 0x1 + i++ + i = encodeVarintHealthCheck(dAtA, i, uint64(m.HealthyEdgeInterval.Size())) + n12, err := m.HealthyEdgeInterval.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n12 + } + if len(m.EventLogPath) > 0 { + dAtA[i] = 0x8a + i++ + dAtA[i] = 0x1 + i++ + i = encodeVarintHealthCheck(dAtA, i, uint64(len(m.EventLogPath))) + i += copy(dAtA[i:], m.EventLogPath) + } + if m.IntervalJitterPercent != 0 { + dAtA[i] = 0x90 + i++ + dAtA[i] = 0x1 + i++ + i = encodeVarintHealthCheck(dAtA, i, uint64(m.IntervalJitterPercent)) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *HealthCheck_HttpHealthCheck_) MarshalTo(dAtA []byte) (int, error) { + i := 0 + if m.HttpHealthCheck != nil { + dAtA[i] = 0x42 + i++ + i = encodeVarintHealthCheck(dAtA, i, uint64(m.HttpHealthCheck.Size())) + n13, err := m.HttpHealthCheck.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n13 + } + return i, nil +} +func (m *HealthCheck_TcpHealthCheck_) MarshalTo(dAtA []byte) (int, error) { + i := 0 + if m.TcpHealthCheck != nil { + dAtA[i] = 0x4a + i++ + i = encodeVarintHealthCheck(dAtA, i, uint64(m.TcpHealthCheck.Size())) + n14, err := m.TcpHealthCheck.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n14 + } + return i, nil +} +func (m *HealthCheck_GrpcHealthCheck_) MarshalTo(dAtA []byte) (int, error) { + i := 0 + if m.GrpcHealthCheck != nil { + dAtA[i] = 0x5a + i++ + i = encodeVarintHealthCheck(dAtA, i, uint64(m.GrpcHealthCheck.Size())) + n15, err := m.GrpcHealthCheck.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n15 + } + return i, nil +} +func (m *HealthCheck_CustomHealthCheck_) MarshalTo(dAtA []byte) (int, error) { + i := 0 + if m.CustomHealthCheck != nil { + dAtA[i] = 0x6a + i++ + i = encodeVarintHealthCheck(dAtA, i, uint64(m.CustomHealthCheck.Size())) + n16, err := m.CustomHealthCheck.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n16 + } + return i, nil +} +func (m *HealthCheck_Payload) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *HealthCheck_Payload) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Payload != nil { + nn17, err := m.Payload.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += nn17 + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *HealthCheck_Payload_Text) MarshalTo(dAtA []byte) (int, error) { + i := 0 + dAtA[i] = 0xa + i++ + i = encodeVarintHealthCheck(dAtA, i, uint64(len(m.Text))) + i += copy(dAtA[i:], m.Text) + return i, nil +} +func (m *HealthCheck_Payload_Binary) MarshalTo(dAtA []byte) (int, error) { + i := 0 + if m.Binary != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintHealthCheck(dAtA, i, uint64(len(m.Binary))) + i += copy(dAtA[i:], m.Binary) + } + return i, nil +} +func (m *HealthCheck_HttpHealthCheck) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *HealthCheck_HttpHealthCheck) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Host) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintHealthCheck(dAtA, i, uint64(len(m.Host))) + i += copy(dAtA[i:], m.Host) + } + if len(m.Path) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintHealthCheck(dAtA, i, uint64(len(m.Path))) + i += copy(dAtA[i:], m.Path) + } + if m.Send != nil { + dAtA[i] = 0x1a + i++ + i = encodeVarintHealthCheck(dAtA, i, uint64(m.Send.Size())) + n18, err := m.Send.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n18 + } + if m.Receive != nil { + dAtA[i] = 0x22 + i++ + i = encodeVarintHealthCheck(dAtA, i, uint64(m.Receive.Size())) + n19, err := m.Receive.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n19 + } + if len(m.ServiceName) > 0 { + dAtA[i] = 0x2a + i++ + i = encodeVarintHealthCheck(dAtA, i, uint64(len(m.ServiceName))) + i += copy(dAtA[i:], m.ServiceName) + } + if len(m.RequestHeadersToAdd) > 0 { + for _, msg := range m.RequestHeadersToAdd { + dAtA[i] = 0x32 + i++ + i = encodeVarintHealthCheck(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if m.UseHttp2 { + dAtA[i] = 0x38 + i++ + if m.UseHttp2 { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i++ + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *HealthCheck_TcpHealthCheck) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *HealthCheck_TcpHealthCheck) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Send != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintHealthCheck(dAtA, i, uint64(m.Send.Size())) + n20, err := m.Send.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n20 + } + if len(m.Receive) > 0 { + for _, msg := range m.Receive { + dAtA[i] = 0x12 + i++ + i = encodeVarintHealthCheck(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *HealthCheck_RedisHealthCheck) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *HealthCheck_RedisHealthCheck) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Key) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintHealthCheck(dAtA, i, uint64(len(m.Key))) + i += copy(dAtA[i:], m.Key) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *HealthCheck_GrpcHealthCheck) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *HealthCheck_GrpcHealthCheck) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.ServiceName) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintHealthCheck(dAtA, i, uint64(len(m.ServiceName))) + i += copy(dAtA[i:], m.ServiceName) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *HealthCheck_CustomHealthCheck) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *HealthCheck_CustomHealthCheck) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Name) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintHealthCheck(dAtA, i, uint64(len(m.Name))) + i += copy(dAtA[i:], m.Name) + } + if m.Config != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintHealthCheck(dAtA, i, uint64(m.Config.Size())) + n21, err := m.Config.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n21 + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func encodeVarintHealthCheck(dAtA []byte, offset int, v uint64) int { + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return offset + 1 +} +func (m *HealthCheck) Size() (n int) { + var l int + _ = l + if m.Timeout != nil { + l = github_com_gogo_protobuf_types.SizeOfStdDuration(*m.Timeout) + n += 1 + l + sovHealthCheck(uint64(l)) + } + if m.Interval != nil { + l = github_com_gogo_protobuf_types.SizeOfStdDuration(*m.Interval) + n += 1 + l + sovHealthCheck(uint64(l)) + } + if m.IntervalJitter != nil { + l = m.IntervalJitter.Size() + n += 1 + l + sovHealthCheck(uint64(l)) + } + if m.UnhealthyThreshold != nil { + l = m.UnhealthyThreshold.Size() + n += 1 + l + sovHealthCheck(uint64(l)) + } + if m.HealthyThreshold != nil { + l = m.HealthyThreshold.Size() + n += 1 + l + sovHealthCheck(uint64(l)) + } + if m.AltPort != nil { + l = m.AltPort.Size() + n += 1 + l + sovHealthCheck(uint64(l)) + } + if m.ReuseConnection != nil { + l = m.ReuseConnection.Size() + n += 1 + l + sovHealthCheck(uint64(l)) + } + if m.HealthChecker != nil { + n += m.HealthChecker.Size() + } + if m.NoTrafficInterval != nil { + l = m.NoTrafficInterval.Size() + n += 1 + l + sovHealthCheck(uint64(l)) + } + if m.UnhealthyInterval != nil { + l = m.UnhealthyInterval.Size() + n += 1 + l + sovHealthCheck(uint64(l)) + } + if m.UnhealthyEdgeInterval != nil { + l = m.UnhealthyEdgeInterval.Size() + n += 1 + l + sovHealthCheck(uint64(l)) + } + if m.HealthyEdgeInterval != nil { + l = m.HealthyEdgeInterval.Size() + n += 2 + l + sovHealthCheck(uint64(l)) + } + l = len(m.EventLogPath) + if l > 0 { + n += 2 + l + sovHealthCheck(uint64(l)) + } + if m.IntervalJitterPercent != 0 { + n += 2 + sovHealthCheck(uint64(m.IntervalJitterPercent)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *HealthCheck_HttpHealthCheck_) Size() (n int) { + var l int + _ = l + if m.HttpHealthCheck != nil { + l = m.HttpHealthCheck.Size() + n += 1 + l + sovHealthCheck(uint64(l)) + } + return n +} +func (m *HealthCheck_TcpHealthCheck_) Size() (n int) { + var l int + _ = l + if m.TcpHealthCheck != nil { + l = m.TcpHealthCheck.Size() + n += 1 + l + sovHealthCheck(uint64(l)) + } + return n +} +func (m *HealthCheck_GrpcHealthCheck_) Size() (n int) { + var l int + _ = l + if m.GrpcHealthCheck != nil { + l = m.GrpcHealthCheck.Size() + n += 1 + l + sovHealthCheck(uint64(l)) + } + return n +} +func (m *HealthCheck_CustomHealthCheck_) Size() (n int) { + var l int + _ = l + if m.CustomHealthCheck != nil { + l = m.CustomHealthCheck.Size() + n += 1 + l + sovHealthCheck(uint64(l)) + } + return n +} +func (m *HealthCheck_Payload) Size() (n int) { + var l int + _ = l + if m.Payload != nil { + n += m.Payload.Size() + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *HealthCheck_Payload_Text) Size() (n int) { + var l int + _ = l + l = len(m.Text) + n += 1 + l + sovHealthCheck(uint64(l)) + return n +} +func (m *HealthCheck_Payload_Binary) Size() (n int) { + var l int + _ = l + if m.Binary != nil { + l = len(m.Binary) + n += 1 + l + sovHealthCheck(uint64(l)) + } + return n +} +func (m *HealthCheck_HttpHealthCheck) Size() (n int) { + var l int + _ = l + l = len(m.Host) + if l > 0 { + n += 1 + l + sovHealthCheck(uint64(l)) + } + l = len(m.Path) + if l > 0 { + n += 1 + l + sovHealthCheck(uint64(l)) + } + if m.Send != nil { + l = m.Send.Size() + n += 1 + l + sovHealthCheck(uint64(l)) + } + if m.Receive != nil { + l = m.Receive.Size() + n += 1 + l + sovHealthCheck(uint64(l)) + } + l = len(m.ServiceName) + if l > 0 { + n += 1 + l + sovHealthCheck(uint64(l)) + } + if len(m.RequestHeadersToAdd) > 0 { + for _, e := range m.RequestHeadersToAdd { + l = e.Size() + n += 1 + l + sovHealthCheck(uint64(l)) + } + } + if m.UseHttp2 { + n += 2 + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *HealthCheck_TcpHealthCheck) Size() (n int) { + var l int + _ = l + if m.Send != nil { + l = m.Send.Size() + n += 1 + l + sovHealthCheck(uint64(l)) + } + if len(m.Receive) > 0 { + for _, e := range m.Receive { + l = e.Size() + n += 1 + l + sovHealthCheck(uint64(l)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *HealthCheck_RedisHealthCheck) Size() (n int) { + var l int + _ = l + l = len(m.Key) + if l > 0 { + n += 1 + l + sovHealthCheck(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *HealthCheck_GrpcHealthCheck) Size() (n int) { + var l int + _ = l + l = len(m.ServiceName) + if l > 0 { + n += 1 + l + sovHealthCheck(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *HealthCheck_CustomHealthCheck) Size() (n int) { + var l int + _ = l + l = len(m.Name) + if l > 0 { + n += 1 + l + sovHealthCheck(uint64(l)) + } + if m.Config != nil { + l = m.Config.Size() + n += 1 + l + sovHealthCheck(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func sovHealthCheck(x uint64) (n int) { + for { + n++ + x >>= 7 + if x == 0 { + break + } + } + return n +} +func sozHealthCheck(x uint64) (n int) { + return sovHealthCheck(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *HealthCheck) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHealthCheck + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: HealthCheck: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: HealthCheck: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Timeout", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHealthCheck + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthHealthCheck + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Timeout == nil { + m.Timeout = new(time.Duration) + } + if err := github_com_gogo_protobuf_types.StdDurationUnmarshal(m.Timeout, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Interval", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHealthCheck + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthHealthCheck + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Interval == nil { + m.Interval = new(time.Duration) + } + if err := github_com_gogo_protobuf_types.StdDurationUnmarshal(m.Interval, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field IntervalJitter", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHealthCheck + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthHealthCheck + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.IntervalJitter == nil { + m.IntervalJitter = &types.Duration{} + } + if err := m.IntervalJitter.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field UnhealthyThreshold", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHealthCheck + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthHealthCheck + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.UnhealthyThreshold == nil { + m.UnhealthyThreshold = &types.UInt32Value{} + } + if err := m.UnhealthyThreshold.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field HealthyThreshold", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHealthCheck + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthHealthCheck + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.HealthyThreshold == nil { + m.HealthyThreshold = &types.UInt32Value{} + } + if err := m.HealthyThreshold.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AltPort", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHealthCheck + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthHealthCheck + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.AltPort == nil { + m.AltPort = &types.UInt32Value{} + } + if err := m.AltPort.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ReuseConnection", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHealthCheck + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthHealthCheck + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.ReuseConnection == nil { + m.ReuseConnection = &types.BoolValue{} + } + if err := m.ReuseConnection.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field HttpHealthCheck", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHealthCheck + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthHealthCheck + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &HealthCheck_HttpHealthCheck{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.HealthChecker = &HealthCheck_HttpHealthCheck_{v} + iNdEx = postIndex + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TcpHealthCheck", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHealthCheck + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthHealthCheck + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &HealthCheck_TcpHealthCheck{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.HealthChecker = &HealthCheck_TcpHealthCheck_{v} + iNdEx = postIndex + case 11: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field GrpcHealthCheck", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHealthCheck + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthHealthCheck + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &HealthCheck_GrpcHealthCheck{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.HealthChecker = &HealthCheck_GrpcHealthCheck_{v} + iNdEx = postIndex + case 12: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NoTrafficInterval", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHealthCheck + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthHealthCheck + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.NoTrafficInterval == nil { + m.NoTrafficInterval = &types.Duration{} + } + if err := m.NoTrafficInterval.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 13: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CustomHealthCheck", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHealthCheck + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthHealthCheck + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &HealthCheck_CustomHealthCheck{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.HealthChecker = &HealthCheck_CustomHealthCheck_{v} + iNdEx = postIndex + case 14: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field UnhealthyInterval", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHealthCheck + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthHealthCheck + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.UnhealthyInterval == nil { + m.UnhealthyInterval = &types.Duration{} + } + if err := m.UnhealthyInterval.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 15: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field UnhealthyEdgeInterval", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHealthCheck + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthHealthCheck + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.UnhealthyEdgeInterval == nil { + m.UnhealthyEdgeInterval = &types.Duration{} + } + if err := m.UnhealthyEdgeInterval.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 16: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field HealthyEdgeInterval", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHealthCheck + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthHealthCheck + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.HealthyEdgeInterval == nil { + m.HealthyEdgeInterval = &types.Duration{} + } + if err := m.HealthyEdgeInterval.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 17: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field EventLogPath", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHealthCheck + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthHealthCheck + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.EventLogPath = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 18: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field IntervalJitterPercent", wireType) + } + m.IntervalJitterPercent = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHealthCheck + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.IntervalJitterPercent |= (uint32(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipHealthCheck(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthHealthCheck + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *HealthCheck_Payload) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHealthCheck + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Payload: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Payload: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Text", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHealthCheck + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthHealthCheck + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Payload = &HealthCheck_Payload_Text{string(dAtA[iNdEx:postIndex])} + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Binary", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHealthCheck + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthHealthCheck + } + postIndex := iNdEx + byteLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := make([]byte, postIndex-iNdEx) + copy(v, dAtA[iNdEx:postIndex]) + m.Payload = &HealthCheck_Payload_Binary{v} + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipHealthCheck(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthHealthCheck + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *HealthCheck_HttpHealthCheck) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHealthCheck + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: HttpHealthCheck: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: HttpHealthCheck: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Host", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHealthCheck + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthHealthCheck + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Host = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Path", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHealthCheck + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthHealthCheck + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Path = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Send", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHealthCheck + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthHealthCheck + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Send == nil { + m.Send = &HealthCheck_Payload{} + } + if err := m.Send.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Receive", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHealthCheck + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthHealthCheck + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Receive == nil { + m.Receive = &HealthCheck_Payload{} + } + if err := m.Receive.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ServiceName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHealthCheck + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthHealthCheck + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ServiceName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestHeadersToAdd", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHealthCheck + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthHealthCheck + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RequestHeadersToAdd = append(m.RequestHeadersToAdd, &HeaderValueOption{}) + if err := m.RequestHeadersToAdd[len(m.RequestHeadersToAdd)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field UseHttp2", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHealthCheck + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.UseHttp2 = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skipHealthCheck(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthHealthCheck + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *HealthCheck_TcpHealthCheck) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHealthCheck + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: TcpHealthCheck: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TcpHealthCheck: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Send", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHealthCheck + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthHealthCheck + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Send == nil { + m.Send = &HealthCheck_Payload{} + } + if err := m.Send.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Receive", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHealthCheck + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthHealthCheck + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Receive = append(m.Receive, &HealthCheck_Payload{}) + if err := m.Receive[len(m.Receive)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipHealthCheck(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthHealthCheck + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *HealthCheck_RedisHealthCheck) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHealthCheck + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: RedisHealthCheck: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RedisHealthCheck: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHealthCheck + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthHealthCheck + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Key = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipHealthCheck(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthHealthCheck + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *HealthCheck_GrpcHealthCheck) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHealthCheck + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GrpcHealthCheck: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GrpcHealthCheck: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ServiceName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHealthCheck + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthHealthCheck + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ServiceName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipHealthCheck(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthHealthCheck + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *HealthCheck_CustomHealthCheck) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHealthCheck + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: CustomHealthCheck: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CustomHealthCheck: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHealthCheck + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthHealthCheck + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Config", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHealthCheck + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthHealthCheck + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Config == nil { + m.Config = &types.Struct{} + } + if err := m.Config.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipHealthCheck(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthHealthCheck + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipHealthCheck(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowHealthCheck + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowHealthCheck + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + return iNdEx, nil + case 1: + iNdEx += 8 + return iNdEx, nil + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowHealthCheck + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + iNdEx += length + if length < 0 { + return 0, ErrInvalidLengthHealthCheck + } + return iNdEx, nil + case 3: + for { + var innerWire uint64 + var start int = iNdEx + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowHealthCheck + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + innerWire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + innerWireType := int(innerWire & 0x7) + if innerWireType == 4 { + break + } + next, err := skipHealthCheck(dAtA[start:]) + if err != nil { + return 0, err + } + iNdEx = start + next + } + return iNdEx, nil + case 4: + return iNdEx, nil + case 5: + iNdEx += 4 + return iNdEx, nil + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + } + panic("unreachable") +} + +var ( + ErrInvalidLengthHealthCheck = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowHealthCheck = fmt.Errorf("proto: integer overflow") +) + +func init() { + proto.RegisterFile("envoy/api/v2/core/health_check.proto", fileDescriptor_health_check_ccd217d94c083297) +} + +var fileDescriptor_health_check_ccd217d94c083297 = []byte{ + // 990 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x96, 0xd1, 0x6e, 0xe3, 0x44, + 0x14, 0x86, 0xeb, 0x24, 0xdb, 0x24, 0x27, 0x69, 0xe2, 0x4c, 0x29, 0x35, 0xa1, 0x74, 0x0b, 0xaa, + 0x50, 0xb5, 0x12, 0x0e, 0xca, 0x22, 0x90, 0xb8, 0xa2, 0xe9, 0x56, 0x4d, 0x96, 0x6d, 0x5a, 0xbc, + 0xe9, 0xa2, 0x4a, 0x48, 0xd6, 0xd4, 0x3e, 0x75, 0xcc, 0xba, 0x1e, 0x33, 0x1e, 0x07, 0xfa, 0x12, + 0x5c, 0xf3, 0x08, 0x88, 0x27, 0x40, 0x5c, 0xed, 0xe5, 0x5e, 0xf2, 0x02, 0x08, 0xd4, 0xbb, 0x7d, + 0x0b, 0xe4, 0xb1, 0x93, 0xc6, 0x71, 0x51, 0xba, 0xe2, 0x6e, 0xe6, 0xcc, 0xfc, 0xdf, 0xfc, 0x33, + 0x3e, 0xf9, 0x5b, 0xd8, 0x45, 0x7f, 0xc2, 0xae, 0x3b, 0x34, 0x70, 0x3b, 0x93, 0x6e, 0xc7, 0x62, + 0x1c, 0x3b, 0x63, 0xa4, 0x9e, 0x18, 0x9b, 0xd6, 0x18, 0xad, 0x97, 0x7a, 0xc0, 0x99, 0x60, 0xa4, + 0x25, 0x77, 0xe9, 0x34, 0x70, 0xf5, 0x49, 0x57, 0x8f, 0x77, 0xb5, 0xb7, 0xf2, 0xc2, 0x0b, 0x1a, + 0x62, 0x22, 0x68, 0x6f, 0x3b, 0x8c, 0x39, 0x1e, 0x76, 0xe4, 0xec, 0x22, 0xba, 0xec, 0xd8, 0x11, + 0xa7, 0xc2, 0x65, 0x7e, 0xba, 0xbe, 0xb5, 0xb8, 0x1e, 0x0a, 0x1e, 0x59, 0xe2, 0xbf, 0xd4, 0x3f, + 0x72, 0x1a, 0x04, 0xc8, 0xc3, 0x74, 0x7d, 0x73, 0x42, 0x3d, 0xd7, 0xa6, 0x02, 0x3b, 0xd3, 0x41, + 0xba, 0xf0, 0x8e, 0xc3, 0x1c, 0x26, 0x87, 0x9d, 0x78, 0x94, 0x54, 0x3f, 0x7a, 0xad, 0x42, 0xad, + 0x2f, 0x2f, 0x75, 0x10, 0xdf, 0x89, 0x1c, 0x42, 0x59, 0xb8, 0x57, 0xc8, 0x22, 0xa1, 0x29, 0x3b, + 0xca, 0x5e, 0xad, 0xfb, 0x9e, 0x9e, 0x1c, 0xa8, 0x4f, 0x0f, 0xd4, 0x9f, 0xa4, 0x76, 0x7b, 0xea, + 0x2f, 0x7f, 0x3f, 0x54, 0xfe, 0x78, 0xf3, 0xaa, 0x58, 0xfe, 0x4d, 0x29, 0x55, 0x94, 0x47, 0x2b, + 0xc6, 0x54, 0x4b, 0x8e, 0xa0, 0xe2, 0xfa, 0x02, 0xf9, 0x84, 0x7a, 0x5a, 0xe1, 0xed, 0x39, 0x33, + 0x31, 0xe9, 0x41, 0x73, 0x3a, 0x36, 0xbf, 0x77, 0x85, 0x40, 0xae, 0x15, 0x97, 0xf0, 0x8c, 0xc6, + 0x54, 0xf1, 0x54, 0x0a, 0xc8, 0x31, 0xac, 0x47, 0x7e, 0xf2, 0xe5, 0xae, 0x4d, 0x31, 0xe6, 0x18, + 0x8e, 0x99, 0x67, 0x6b, 0x25, 0xc9, 0xd9, 0xca, 0x71, 0xce, 0x06, 0xbe, 0x78, 0xdc, 0x7d, 0x41, + 0xbd, 0x08, 0x0d, 0x32, 0x13, 0x8e, 0xa6, 0x3a, 0x32, 0x80, 0x56, 0x1e, 0xf6, 0xe0, 0x1e, 0x30, + 0x35, 0x87, 0xfa, 0x02, 0x2a, 0xd4, 0x13, 0x66, 0xc0, 0xb8, 0xd0, 0x56, 0xef, 0x41, 0x28, 0x53, + 0x4f, 0x9c, 0x32, 0x2e, 0xc8, 0x21, 0xa8, 0x1c, 0xa3, 0x10, 0x4d, 0x8b, 0xf9, 0x3e, 0x5a, 0xf1, + 0xb5, 0xb5, 0xb2, 0x04, 0xb4, 0x73, 0x80, 0x1e, 0x63, 0x5e, 0x22, 0x6f, 0x4a, 0xcd, 0xc1, 0x4c, + 0x42, 0xbe, 0x83, 0xd6, 0x58, 0x88, 0xc0, 0x9c, 0x6f, 0x6b, 0xad, 0x22, 0x39, 0xba, 0x9e, 0xeb, + 0x6b, 0x7d, 0xae, 0x51, 0xf4, 0xbe, 0x10, 0xc1, 0xdc, 0xbc, 0xbf, 0x62, 0x34, 0xc7, 0xd9, 0x12, + 0x39, 0x07, 0x55, 0x58, 0x0b, 0xf0, 0xaa, 0x84, 0x7f, 0xb2, 0x04, 0x3e, 0xb2, 0x16, 0xd8, 0x0d, + 0x91, 0xa9, 0xc4, 0xc6, 0x1d, 0x1e, 0x58, 0x59, 0x76, 0xed, 0x5e, 0xc6, 0x8f, 0x78, 0x60, 0x2d, + 0x18, 0x77, 0xb2, 0x25, 0x32, 0x80, 0x75, 0x9f, 0x99, 0x82, 0xd3, 0xcb, 0x4b, 0xd7, 0x32, 0x67, + 0x8d, 0x5c, 0x5f, 0xd6, 0x78, 0x2d, 0x9f, 0x8d, 0x12, 0xd1, 0x60, 0xda, 0xbf, 0x17, 0xb0, 0x6e, + 0x45, 0xa1, 0x60, 0x57, 0x59, 0xab, 0x6b, 0x12, 0xf5, 0xe9, 0x12, 0xab, 0x07, 0x52, 0x99, 0x35, + 0xdb, 0xb2, 0x16, 0x8b, 0xa4, 0x0f, 0xb7, 0x6d, 0x7a, 0xeb, 0xb6, 0xb1, 0xd4, 0xed, 0x4c, 0x34, + 0x73, 0xfb, 0x0d, 0x6c, 0xde, 0x92, 0xd0, 0x76, 0xf0, 0x16, 0xd7, 0x5c, 0x86, 0xdb, 0x98, 0x29, + 0x0f, 0x6d, 0x07, 0x67, 0xc8, 0x63, 0xd8, 0xb8, 0x1b, 0xa8, 0x2e, 0x03, 0xae, 0xdf, 0x85, 0xdb, + 0x85, 0x06, 0x4e, 0xd0, 0x17, 0xa6, 0xc7, 0x1c, 0x33, 0xa0, 0x62, 0xac, 0xb5, 0x76, 0x94, 0xbd, + 0xaa, 0x51, 0x97, 0xd5, 0x67, 0xcc, 0x39, 0xa5, 0x62, 0x4c, 0x3e, 0x87, 0xcd, 0x85, 0xd4, 0x30, + 0x03, 0xe4, 0x16, 0xfa, 0x42, 0x23, 0x3b, 0xca, 0xde, 0x9a, 0xb1, 0x91, 0x8d, 0x88, 0xd3, 0x64, + 0xb1, 0xfd, 0x02, 0xca, 0xa7, 0xf4, 0xda, 0x63, 0xd4, 0x26, 0x0f, 0xa1, 0x24, 0xf0, 0xa7, 0x24, + 0x05, 0xab, 0xbd, 0x6a, 0x1c, 0x4f, 0x25, 0x5e, 0xd8, 0x51, 0xfa, 0x2b, 0x86, 0x5c, 0x20, 0x1a, + 0xac, 0x5e, 0xb8, 0x3e, 0xe5, 0xd7, 0x32, 0xe0, 0xea, 0xfd, 0x15, 0x23, 0x9d, 0xf7, 0x54, 0x28, + 0x07, 0x29, 0xe5, 0xc1, 0xef, 0x6f, 0x5e, 0x15, 0x95, 0xf6, 0x5f, 0x05, 0x68, 0x2e, 0xfc, 0x60, + 0x08, 0x81, 0xd2, 0x98, 0x85, 0xe9, 0x01, 0x86, 0x1c, 0x93, 0x0f, 0xa0, 0x24, 0xef, 0x54, 0x58, + 0x38, 0xd4, 0x90, 0x65, 0xf2, 0x25, 0x94, 0x42, 0xf4, 0xed, 0x34, 0x01, 0x3f, 0x5e, 0xd2, 0x3d, + 0xe9, 0x4d, 0x0c, 0xa9, 0x21, 0x5f, 0x41, 0x99, 0xa3, 0x85, 0xee, 0x04, 0xd3, 0xe0, 0xbb, 0xaf, + 0x7c, 0x2a, 0x23, 0x1f, 0x42, 0x3d, 0x44, 0x3e, 0x71, 0x2d, 0x34, 0x7d, 0x7a, 0x85, 0x32, 0xf2, + 0xaa, 0x46, 0x2d, 0xad, 0x0d, 0xe9, 0x15, 0x92, 0x73, 0x78, 0x97, 0xe3, 0x0f, 0x11, 0x86, 0x22, + 0x6e, 0x77, 0x1b, 0x79, 0x68, 0x0a, 0x66, 0x52, 0xdb, 0xd6, 0x56, 0x77, 0x8a, 0x7b, 0xb5, 0xee, + 0xee, 0xdd, 0x67, 0xda, 0xc8, 0x65, 0x40, 0x9d, 0x04, 0xc9, 0x87, 0x4f, 0x19, 0xc9, 0x4a, 0x38, + 0x62, 0xfb, 0xb6, 0x4d, 0xde, 0x87, 0x6a, 0x9c, 0x77, 0x71, 0xc6, 0x74, 0x65, 0xd4, 0x55, 0x8c, + 0x4a, 0x14, 0x62, 0xfc, 0xaa, 0xdd, 0xf6, 0xcf, 0x0a, 0x34, 0xb2, 0x99, 0x31, 0x7b, 0x2b, 0xe5, + 0xff, 0xbd, 0x55, 0x41, 0xfa, 0x7e, 0xdb, 0xb7, 0x6a, 0xef, 0x82, 0x6a, 0xa0, 0xed, 0x86, 0xf3, + 0x8e, 0x54, 0x28, 0xbe, 0xc4, 0xeb, 0xf4, 0x7b, 0xc7, 0xc3, 0xf6, 0x67, 0xd0, 0x5c, 0x48, 0xa3, + 0xdc, 0x23, 0x2b, 0xb9, 0x47, 0x6e, 0x5b, 0xd0, 0xca, 0x05, 0x43, 0xdc, 0x39, 0xb7, 0xfb, 0x33, + 0x9d, 0x13, 0x97, 0x49, 0x07, 0x56, 0x2d, 0xe6, 0x5f, 0xba, 0x4e, 0xfa, 0xd7, 0x78, 0x33, 0xf7, + 0xb3, 0x7b, 0x2e, 0xff, 0xc9, 0x30, 0xd2, 0x6d, 0xbd, 0x4d, 0x68, 0xcc, 0x07, 0x16, 0xf2, 0xb4, + 0x95, 0x9f, 0x96, 0x2a, 0xa0, 0xd6, 0x0c, 0xc2, 0xe3, 0xdb, 0x65, 0x32, 0xed, 0x91, 0x01, 0xf5, + 0xc4, 0xd1, 0x73, 0x41, 0x45, 0x14, 0x92, 0x1a, 0x94, 0xcf, 0x86, 0x5f, 0x0f, 0x4f, 0xbe, 0x1d, + 0xaa, 0x2b, 0xf1, 0xa4, 0x7f, 0xb8, 0xff, 0x6c, 0xd4, 0x3f, 0x57, 0x15, 0xb2, 0x06, 0xd5, 0xb3, + 0xe1, 0x74, 0x5a, 0x20, 0x75, 0xa8, 0x3c, 0x31, 0xf6, 0x07, 0xc3, 0xc1, 0xf0, 0x48, 0x2d, 0xc6, + 0x3b, 0x47, 0x83, 0xe3, 0xc3, 0x93, 0xb3, 0x91, 0x5a, 0xea, 0xa9, 0xbf, 0xde, 0x6c, 0x2b, 0xaf, + 0x6f, 0xb6, 0x95, 0x3f, 0x6f, 0xb6, 0x95, 0x7f, 0x6e, 0xb6, 0x95, 0x8b, 0x55, 0xe9, 0xf8, 0xf1, + 0xbf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x75, 0x62, 0x60, 0x99, 0x9d, 0x09, 0x00, 0x00, +} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/core/health_check.pb.validate.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/core/health_check.pb.validate.go new file mode 100644 index 000000000000..da31fa042324 --- /dev/null +++ b/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/core/health_check.pb.validate.go @@ -0,0 +1,643 @@ +// Code generated by protoc-gen-validate +// source: envoy/api/v2/core/health_check.proto +// DO NOT EDIT!!! + +package core + +import ( + "bytes" + "errors" + "fmt" + "net" + "net/mail" + "net/url" + "regexp" + "strings" + "time" + "unicode/utf8" + + "github.com/gogo/protobuf/types" +) + +// ensure the imports are used +var ( + _ = bytes.MinRead + _ = errors.New("") + _ = fmt.Print + _ = utf8.UTFMax + _ = (*regexp.Regexp)(nil) + _ = (*strings.Reader)(nil) + _ = net.IPv4len + _ = time.Duration(0) + _ = (*url.URL)(nil) + _ = (*mail.Address)(nil) + _ = types.DynamicAny{} +) + +// Validate checks the field values on HealthCheck with the rules defined in +// the proto definition for this message. If any rules are violated, an error +// is returned. +func (m *HealthCheck) Validate() error { + if m == nil { + return nil + } + + if m.GetTimeout() == nil { + return HealthCheckValidationError{ + Field: "Timeout", + Reason: "value is required", + } + } + + if d := m.GetTimeout(); d != nil { + dur := *d + + gt := time.Duration(0*time.Second + 0*time.Nanosecond) + + if dur <= gt { + return HealthCheckValidationError{ + Field: "Timeout", + Reason: "value must be greater than 0s", + } + } + + } + + if m.GetInterval() == nil { + return HealthCheckValidationError{ + Field: "Interval", + Reason: "value is required", + } + } + + if d := m.GetInterval(); d != nil { + dur := *d + + gt := time.Duration(0*time.Second + 0*time.Nanosecond) + + if dur <= gt { + return HealthCheckValidationError{ + Field: "Interval", + Reason: "value must be greater than 0s", + } + } + + } + + if v, ok := interface{}(m.GetIntervalJitter()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return HealthCheckValidationError{ + Field: "IntervalJitter", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + // no validation rules for IntervalJitterPercent + + if v, ok := interface{}(m.GetUnhealthyThreshold()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return HealthCheckValidationError{ + Field: "UnhealthyThreshold", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + if v, ok := interface{}(m.GetHealthyThreshold()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return HealthCheckValidationError{ + Field: "HealthyThreshold", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + if v, ok := interface{}(m.GetAltPort()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return HealthCheckValidationError{ + Field: "AltPort", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + if v, ok := interface{}(m.GetReuseConnection()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return HealthCheckValidationError{ + Field: "ReuseConnection", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + if v, ok := interface{}(m.GetNoTrafficInterval()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return HealthCheckValidationError{ + Field: "NoTrafficInterval", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + if v, ok := interface{}(m.GetUnhealthyInterval()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return HealthCheckValidationError{ + Field: "UnhealthyInterval", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + if v, ok := interface{}(m.GetUnhealthyEdgeInterval()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return HealthCheckValidationError{ + Field: "UnhealthyEdgeInterval", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + if v, ok := interface{}(m.GetHealthyEdgeInterval()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return HealthCheckValidationError{ + Field: "HealthyEdgeInterval", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + // no validation rules for EventLogPath + + switch m.HealthChecker.(type) { + + case *HealthCheck_HttpHealthCheck_: + + if v, ok := interface{}(m.GetHttpHealthCheck()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return HealthCheckValidationError{ + Field: "HttpHealthCheck", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + case *HealthCheck_TcpHealthCheck_: + + if v, ok := interface{}(m.GetTcpHealthCheck()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return HealthCheckValidationError{ + Field: "TcpHealthCheck", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + case *HealthCheck_GrpcHealthCheck_: + + if v, ok := interface{}(m.GetGrpcHealthCheck()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return HealthCheckValidationError{ + Field: "GrpcHealthCheck", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + case *HealthCheck_CustomHealthCheck_: + + if v, ok := interface{}(m.GetCustomHealthCheck()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return HealthCheckValidationError{ + Field: "CustomHealthCheck", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + default: + return HealthCheckValidationError{ + Field: "HealthChecker", + Reason: "value is required", + } + + } + + return nil +} + +// HealthCheckValidationError is the validation error returned by +// HealthCheck.Validate if the designated constraints aren't met. +type HealthCheckValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e HealthCheckValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sHealthCheck.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = HealthCheckValidationError{} + +// Validate checks the field values on HealthCheck_Payload with the rules +// defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *HealthCheck_Payload) Validate() error { + if m == nil { + return nil + } + + switch m.Payload.(type) { + + case *HealthCheck_Payload_Text: + + if len(m.GetText()) < 1 { + return HealthCheck_PayloadValidationError{ + Field: "Text", + Reason: "value length must be at least 1 bytes", + } + } + + case *HealthCheck_Payload_Binary: + // no validation rules for Binary + + default: + return HealthCheck_PayloadValidationError{ + Field: "Payload", + Reason: "value is required", + } + + } + + return nil +} + +// HealthCheck_PayloadValidationError is the validation error returned by +// HealthCheck_Payload.Validate if the designated constraints aren't met. +type HealthCheck_PayloadValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e HealthCheck_PayloadValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sHealthCheck_Payload.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = HealthCheck_PayloadValidationError{} + +// Validate checks the field values on HealthCheck_HttpHealthCheck with the +// rules defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *HealthCheck_HttpHealthCheck) Validate() error { + if m == nil { + return nil + } + + // no validation rules for Host + + if len(m.GetPath()) < 1 { + return HealthCheck_HttpHealthCheckValidationError{ + Field: "Path", + Reason: "value length must be at least 1 bytes", + } + } + + if v, ok := interface{}(m.GetSend()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return HealthCheck_HttpHealthCheckValidationError{ + Field: "Send", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + if v, ok := interface{}(m.GetReceive()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return HealthCheck_HttpHealthCheckValidationError{ + Field: "Receive", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + // no validation rules for ServiceName + + for idx, item := range m.GetRequestHeadersToAdd() { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return HealthCheck_HttpHealthCheckValidationError{ + Field: fmt.Sprintf("RequestHeadersToAdd[%v]", idx), + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + } + + // no validation rules for UseHttp2 + + return nil +} + +// HealthCheck_HttpHealthCheckValidationError is the validation error returned +// by HealthCheck_HttpHealthCheck.Validate if the designated constraints +// aren't met. +type HealthCheck_HttpHealthCheckValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e HealthCheck_HttpHealthCheckValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sHealthCheck_HttpHealthCheck.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = HealthCheck_HttpHealthCheckValidationError{} + +// Validate checks the field values on HealthCheck_TcpHealthCheck with the +// rules defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *HealthCheck_TcpHealthCheck) Validate() error { + if m == nil { + return nil + } + + if v, ok := interface{}(m.GetSend()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return HealthCheck_TcpHealthCheckValidationError{ + Field: "Send", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + for idx, item := range m.GetReceive() { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return HealthCheck_TcpHealthCheckValidationError{ + Field: fmt.Sprintf("Receive[%v]", idx), + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + } + + return nil +} + +// HealthCheck_TcpHealthCheckValidationError is the validation error returned +// by HealthCheck_TcpHealthCheck.Validate if the designated constraints aren't met. +type HealthCheck_TcpHealthCheckValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e HealthCheck_TcpHealthCheckValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sHealthCheck_TcpHealthCheck.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = HealthCheck_TcpHealthCheckValidationError{} + +// Validate checks the field values on HealthCheck_RedisHealthCheck with the +// rules defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *HealthCheck_RedisHealthCheck) Validate() error { + if m == nil { + return nil + } + + // no validation rules for Key + + return nil +} + +// HealthCheck_RedisHealthCheckValidationError is the validation error returned +// by HealthCheck_RedisHealthCheck.Validate if the designated constraints +// aren't met. +type HealthCheck_RedisHealthCheckValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e HealthCheck_RedisHealthCheckValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sHealthCheck_RedisHealthCheck.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = HealthCheck_RedisHealthCheckValidationError{} + +// Validate checks the field values on HealthCheck_GrpcHealthCheck with the +// rules defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *HealthCheck_GrpcHealthCheck) Validate() error { + if m == nil { + return nil + } + + // no validation rules for ServiceName + + return nil +} + +// HealthCheck_GrpcHealthCheckValidationError is the validation error returned +// by HealthCheck_GrpcHealthCheck.Validate if the designated constraints +// aren't met. +type HealthCheck_GrpcHealthCheckValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e HealthCheck_GrpcHealthCheckValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sHealthCheck_GrpcHealthCheck.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = HealthCheck_GrpcHealthCheckValidationError{} + +// Validate checks the field values on HealthCheck_CustomHealthCheck with the +// rules defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *HealthCheck_CustomHealthCheck) Validate() error { + if m == nil { + return nil + } + + if len(m.GetName()) < 1 { + return HealthCheck_CustomHealthCheckValidationError{ + Field: "Name", + Reason: "value length must be at least 1 bytes", + } + } + + if v, ok := interface{}(m.GetConfig()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return HealthCheck_CustomHealthCheckValidationError{ + Field: "Config", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + return nil +} + +// HealthCheck_CustomHealthCheckValidationError is the validation error +// returned by HealthCheck_CustomHealthCheck.Validate if the designated +// constraints aren't met. +type HealthCheck_CustomHealthCheckValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e HealthCheck_CustomHealthCheckValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sHealthCheck_CustomHealthCheck.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = HealthCheck_CustomHealthCheckValidationError{} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/core/http_uri.pb.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/core/http_uri.pb.go new file mode 100644 index 000000000000..2ac570da8266 --- /dev/null +++ b/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/core/http_uri.pb.go @@ -0,0 +1,557 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: envoy/api/v2/core/http_uri.proto + +package core + +import proto "github.com/gogo/protobuf/proto" +import fmt "fmt" +import math "math" +import _ "github.com/gogo/protobuf/gogoproto" +import _ "github.com/gogo/protobuf/types" +import _ "github.com/lyft/protoc-gen-validate/validate" + +import time "time" + +import github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" + +import io "io" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf +var _ = time.Kitchen + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package + +// Envoy external URI descriptor +type HttpUri struct { + // The HTTP server URI. It should be a full FQDN with protocol, host and path. + // + // Example: + // + // .. code-block:: yaml + // + // uri: https://www.googleapis.com/oauth2/v1/certs + // + Uri string `protobuf:"bytes,1,opt,name=uri,proto3" json:"uri,omitempty"` + // Specify how `uri` is to be fetched. Today, this requires an explicit + // cluster, but in the future we may support dynamic cluster creation or + // inline DNS resolution. See `issue + // `_. + // + // Types that are valid to be assigned to HttpUpstreamType: + // *HttpUri_Cluster + HttpUpstreamType isHttpUri_HttpUpstreamType `protobuf_oneof:"http_upstream_type"` + // Sets the maximum duration in milliseconds that a response can take to arrive upon request. + Timeout *time.Duration `protobuf:"bytes,3,opt,name=timeout,stdduration" json:"timeout,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *HttpUri) Reset() { *m = HttpUri{} } +func (m *HttpUri) String() string { return proto.CompactTextString(m) } +func (*HttpUri) ProtoMessage() {} +func (*HttpUri) Descriptor() ([]byte, []int) { + return fileDescriptor_http_uri_a8729bd15bcc4a68, []int{0} +} +func (m *HttpUri) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *HttpUri) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_HttpUri.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *HttpUri) XXX_Merge(src proto.Message) { + xxx_messageInfo_HttpUri.Merge(dst, src) +} +func (m *HttpUri) XXX_Size() int { + return m.Size() +} +func (m *HttpUri) XXX_DiscardUnknown() { + xxx_messageInfo_HttpUri.DiscardUnknown(m) +} + +var xxx_messageInfo_HttpUri proto.InternalMessageInfo + +type isHttpUri_HttpUpstreamType interface { + isHttpUri_HttpUpstreamType() + MarshalTo([]byte) (int, error) + Size() int +} + +type HttpUri_Cluster struct { + Cluster string `protobuf:"bytes,2,opt,name=cluster,proto3,oneof"` +} + +func (*HttpUri_Cluster) isHttpUri_HttpUpstreamType() {} + +func (m *HttpUri) GetHttpUpstreamType() isHttpUri_HttpUpstreamType { + if m != nil { + return m.HttpUpstreamType + } + return nil +} + +func (m *HttpUri) GetUri() string { + if m != nil { + return m.Uri + } + return "" +} + +func (m *HttpUri) GetCluster() string { + if x, ok := m.GetHttpUpstreamType().(*HttpUri_Cluster); ok { + return x.Cluster + } + return "" +} + +func (m *HttpUri) GetTimeout() *time.Duration { + if m != nil { + return m.Timeout + } + return nil +} + +// XXX_OneofFuncs is for the internal use of the proto package. +func (*HttpUri) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { + return _HttpUri_OneofMarshaler, _HttpUri_OneofUnmarshaler, _HttpUri_OneofSizer, []interface{}{ + (*HttpUri_Cluster)(nil), + } +} + +func _HttpUri_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { + m := msg.(*HttpUri) + // http_upstream_type + switch x := m.HttpUpstreamType.(type) { + case *HttpUri_Cluster: + _ = b.EncodeVarint(2<<3 | proto.WireBytes) + _ = b.EncodeStringBytes(x.Cluster) + case nil: + default: + return fmt.Errorf("HttpUri.HttpUpstreamType has unexpected type %T", x) + } + return nil +} + +func _HttpUri_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { + m := msg.(*HttpUri) + switch tag { + case 2: // http_upstream_type.cluster + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeStringBytes() + m.HttpUpstreamType = &HttpUri_Cluster{x} + return true, err + default: + return false, nil + } +} + +func _HttpUri_OneofSizer(msg proto.Message) (n int) { + m := msg.(*HttpUri) + // http_upstream_type + switch x := m.HttpUpstreamType.(type) { + case *HttpUri_Cluster: + n += 1 // tag and wire + n += proto.SizeVarint(uint64(len(x.Cluster))) + n += len(x.Cluster) + case nil: + default: + panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) + } + return n +} + +func init() { + proto.RegisterType((*HttpUri)(nil), "envoy.api.v2.core.HttpUri") +} +func (m *HttpUri) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *HttpUri) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Uri) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintHttpUri(dAtA, i, uint64(len(m.Uri))) + i += copy(dAtA[i:], m.Uri) + } + if m.HttpUpstreamType != nil { + nn1, err := m.HttpUpstreamType.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += nn1 + } + if m.Timeout != nil { + dAtA[i] = 0x1a + i++ + i = encodeVarintHttpUri(dAtA, i, uint64(github_com_gogo_protobuf_types.SizeOfStdDuration(*m.Timeout))) + n2, err := github_com_gogo_protobuf_types.StdDurationMarshalTo(*m.Timeout, dAtA[i:]) + if err != nil { + return 0, err + } + i += n2 + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *HttpUri_Cluster) MarshalTo(dAtA []byte) (int, error) { + i := 0 + dAtA[i] = 0x12 + i++ + i = encodeVarintHttpUri(dAtA, i, uint64(len(m.Cluster))) + i += copy(dAtA[i:], m.Cluster) + return i, nil +} +func encodeVarintHttpUri(dAtA []byte, offset int, v uint64) int { + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return offset + 1 +} +func (m *HttpUri) Size() (n int) { + var l int + _ = l + l = len(m.Uri) + if l > 0 { + n += 1 + l + sovHttpUri(uint64(l)) + } + if m.HttpUpstreamType != nil { + n += m.HttpUpstreamType.Size() + } + if m.Timeout != nil { + l = github_com_gogo_protobuf_types.SizeOfStdDuration(*m.Timeout) + n += 1 + l + sovHttpUri(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *HttpUri_Cluster) Size() (n int) { + var l int + _ = l + l = len(m.Cluster) + n += 1 + l + sovHttpUri(uint64(l)) + return n +} + +func sovHttpUri(x uint64) (n int) { + for { + n++ + x >>= 7 + if x == 0 { + break + } + } + return n +} +func sozHttpUri(x uint64) (n int) { + return sovHttpUri(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *HttpUri) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHttpUri + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: HttpUri: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: HttpUri: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Uri", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHttpUri + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthHttpUri + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Uri = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Cluster", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHttpUri + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthHttpUri + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.HttpUpstreamType = &HttpUri_Cluster{string(dAtA[iNdEx:postIndex])} + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Timeout", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHttpUri + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthHttpUri + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Timeout == nil { + m.Timeout = new(time.Duration) + } + if err := github_com_gogo_protobuf_types.StdDurationUnmarshal(m.Timeout, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipHttpUri(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthHttpUri + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipHttpUri(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowHttpUri + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowHttpUri + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + return iNdEx, nil + case 1: + iNdEx += 8 + return iNdEx, nil + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowHttpUri + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + iNdEx += length + if length < 0 { + return 0, ErrInvalidLengthHttpUri + } + return iNdEx, nil + case 3: + for { + var innerWire uint64 + var start int = iNdEx + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowHttpUri + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + innerWire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + innerWireType := int(innerWire & 0x7) + if innerWireType == 4 { + break + } + next, err := skipHttpUri(dAtA[start:]) + if err != nil { + return 0, err + } + iNdEx = start + next + } + return iNdEx, nil + case 4: + return iNdEx, nil + case 5: + iNdEx += 4 + return iNdEx, nil + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + } + panic("unreachable") +} + +var ( + ErrInvalidLengthHttpUri = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowHttpUri = fmt.Errorf("proto: integer overflow") +) + +func init() { + proto.RegisterFile("envoy/api/v2/core/http_uri.proto", fileDescriptor_http_uri_a8729bd15bcc4a68) +} + +var fileDescriptor_http_uri_a8729bd15bcc4a68 = []byte{ + // 279 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x5c, 0x90, 0x31, 0x4e, 0xf3, 0x30, + 0x14, 0xc7, 0xfb, 0x92, 0xaf, 0x5f, 0xa8, 0x61, 0xc1, 0x42, 0x22, 0xb4, 0x52, 0x88, 0x90, 0x90, + 0x3a, 0xd9, 0x52, 0xb8, 0x41, 0xc4, 0xd0, 0x85, 0x25, 0x12, 0x73, 0xe5, 0xb6, 0x26, 0x58, 0x4a, + 0x6b, 0xcb, 0x7d, 0x8e, 0xd4, 0x9b, 0x70, 0x06, 0x4e, 0x00, 0x4c, 0x1d, 0x19, 0xb9, 0x01, 0x28, + 0x5b, 0x6f, 0x81, 0x92, 0xd4, 0x0b, 0xdb, 0x4f, 0xef, 0xfd, 0xfc, 0xf7, 0x5f, 0x8f, 0xa4, 0x72, + 0x53, 0xeb, 0x1d, 0x17, 0x46, 0xf1, 0x3a, 0xe3, 0x4b, 0x6d, 0x25, 0x7f, 0x46, 0x34, 0x73, 0x67, + 0x15, 0x33, 0x56, 0xa3, 0xa6, 0xe7, 0x9d, 0xc1, 0x84, 0x51, 0xac, 0xce, 0x58, 0x6b, 0x8c, 0x93, + 0x52, 0xeb, 0xb2, 0x92, 0xbc, 0x13, 0x16, 0xee, 0x89, 0xaf, 0x9c, 0x15, 0xa8, 0xf4, 0xa6, 0x7f, + 0x32, 0xbe, 0x28, 0x75, 0xa9, 0x3b, 0xe4, 0x2d, 0x1d, 0xa7, 0x97, 0xb5, 0xa8, 0xd4, 0x4a, 0xa0, + 0xe4, 0x1e, 0xfa, 0xc5, 0xcd, 0x3b, 0x90, 0x68, 0x86, 0x68, 0x1e, 0xad, 0xa2, 0x13, 0x12, 0x3a, + 0xab, 0x62, 0x48, 0x61, 0x3a, 0xca, 0x47, 0x1f, 0x87, 0x7d, 0xf8, 0xcf, 0x06, 0x29, 0x14, 0xed, + 0x94, 0xde, 0x92, 0x68, 0x59, 0xb9, 0x2d, 0x4a, 0x1b, 0x07, 0x7f, 0x84, 0xd9, 0xa0, 0xf0, 0x3b, + 0xfa, 0x40, 0x22, 0x54, 0x6b, 0xa9, 0x1d, 0xc6, 0x61, 0x0a, 0xd3, 0xd3, 0xec, 0x8a, 0xf5, 0x85, + 0x99, 0x2f, 0xcc, 0xee, 0x8f, 0x85, 0xf3, 0xf8, 0xe5, 0xfb, 0x1a, 0xda, 0x94, 0xe1, 0x2b, 0x04, + 0xd9, 0xc0, 0xd3, 0x09, 0x14, 0x3e, 0x23, 0x9f, 0x10, 0xda, 0x9f, 0xc4, 0x6c, 0xd1, 0x4a, 0xb1, + 0x9e, 0xe3, 0xce, 0x48, 0x3a, 0x7c, 0x3b, 0xec, 0x43, 0xc8, 0xcf, 0x3e, 0x9b, 0x04, 0xbe, 0x9a, + 0x04, 0x7e, 0x9a, 0x04, 0x16, 0xff, 0xbb, 0x0f, 0xee, 0x7e, 0x03, 0x00, 0x00, 0xff, 0xff, 0xee, + 0x33, 0x45, 0x4d, 0x56, 0x01, 0x00, 0x00, +} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/core/http_uri.pb.validate.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/core/http_uri.pb.validate.go new file mode 100644 index 000000000000..5abe4d624d4f --- /dev/null +++ b/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/core/http_uri.pb.validate.go @@ -0,0 +1,109 @@ +// Code generated by protoc-gen-validate +// source: envoy/api/v2/core/http_uri.proto +// DO NOT EDIT!!! + +package core + +import ( + "bytes" + "errors" + "fmt" + "net" + "net/mail" + "net/url" + "regexp" + "strings" + "time" + "unicode/utf8" + + "github.com/gogo/protobuf/types" +) + +// ensure the imports are used +var ( + _ = bytes.MinRead + _ = errors.New("") + _ = fmt.Print + _ = utf8.UTFMax + _ = (*regexp.Regexp)(nil) + _ = (*strings.Reader)(nil) + _ = net.IPv4len + _ = time.Duration(0) + _ = (*url.URL)(nil) + _ = (*mail.Address)(nil) + _ = types.DynamicAny{} +) + +// Validate checks the field values on HttpUri with the rules defined in the +// proto definition for this message. If any rules are violated, an error is returned. +func (m *HttpUri) Validate() error { + if m == nil { + return nil + } + + if len(m.GetUri()) < 1 { + return HttpUriValidationError{ + Field: "Uri", + Reason: "value length must be at least 1 bytes", + } + } + + if m.GetTimeout() == nil { + return HttpUriValidationError{ + Field: "Timeout", + Reason: "value is required", + } + } + + switch m.HttpUpstreamType.(type) { + + case *HttpUri_Cluster: + + if len(m.GetCluster()) < 1 { + return HttpUriValidationError{ + Field: "Cluster", + Reason: "value length must be at least 1 bytes", + } + } + + default: + return HttpUriValidationError{ + Field: "HttpUpstreamType", + Reason: "value is required", + } + + } + + return nil +} + +// HttpUriValidationError is the validation error returned by HttpUri.Validate +// if the designated constraints aren't met. +type HttpUriValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e HttpUriValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sHttpUri.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = HttpUriValidationError{} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/core/protocol.pb.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/core/protocol.pb.go new file mode 100644 index 000000000000..8b2d0eef6cec --- /dev/null +++ b/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/core/protocol.pb.go @@ -0,0 +1,1519 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: envoy/api/v2/core/protocol.proto + +package core + +import proto "github.com/gogo/protobuf/proto" +import fmt "fmt" +import math "math" +import _ "github.com/gogo/protobuf/gogoproto" +import types "github.com/gogo/protobuf/types" +import _ "github.com/lyft/protoc-gen-validate/validate" + +import time "time" + +import bytes "bytes" + +import github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" + +import io "io" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf +var _ = time.Kitchen + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package + +// [#not-implemented-hide:] +type TcpProtocolOptions struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *TcpProtocolOptions) Reset() { *m = TcpProtocolOptions{} } +func (m *TcpProtocolOptions) String() string { return proto.CompactTextString(m) } +func (*TcpProtocolOptions) ProtoMessage() {} +func (*TcpProtocolOptions) Descriptor() ([]byte, []int) { + return fileDescriptor_protocol_4320d5a758919a50, []int{0} +} +func (m *TcpProtocolOptions) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *TcpProtocolOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_TcpProtocolOptions.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *TcpProtocolOptions) XXX_Merge(src proto.Message) { + xxx_messageInfo_TcpProtocolOptions.Merge(dst, src) +} +func (m *TcpProtocolOptions) XXX_Size() int { + return m.Size() +} +func (m *TcpProtocolOptions) XXX_DiscardUnknown() { + xxx_messageInfo_TcpProtocolOptions.DiscardUnknown(m) +} + +var xxx_messageInfo_TcpProtocolOptions proto.InternalMessageInfo + +type HttpProtocolOptions struct { + // The idle timeout for upstream connection pool connections. The idle timeout is defined as the + // period in which there are no active requests. If not set, there is no idle timeout. When the + // idle timeout is reached the connection will be closed. Note that request based timeouts mean + // that HTTP/2 PINGs will not keep the connection alive. + IdleTimeout *time.Duration `protobuf:"bytes,1,opt,name=idle_timeout,json=idleTimeout,stdduration" json:"idle_timeout,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *HttpProtocolOptions) Reset() { *m = HttpProtocolOptions{} } +func (m *HttpProtocolOptions) String() string { return proto.CompactTextString(m) } +func (*HttpProtocolOptions) ProtoMessage() {} +func (*HttpProtocolOptions) Descriptor() ([]byte, []int) { + return fileDescriptor_protocol_4320d5a758919a50, []int{1} +} +func (m *HttpProtocolOptions) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *HttpProtocolOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_HttpProtocolOptions.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *HttpProtocolOptions) XXX_Merge(src proto.Message) { + xxx_messageInfo_HttpProtocolOptions.Merge(dst, src) +} +func (m *HttpProtocolOptions) XXX_Size() int { + return m.Size() +} +func (m *HttpProtocolOptions) XXX_DiscardUnknown() { + xxx_messageInfo_HttpProtocolOptions.DiscardUnknown(m) +} + +var xxx_messageInfo_HttpProtocolOptions proto.InternalMessageInfo + +func (m *HttpProtocolOptions) GetIdleTimeout() *time.Duration { + if m != nil { + return m.IdleTimeout + } + return nil +} + +type Http1ProtocolOptions struct { + // Handle HTTP requests with absolute URLs in the requests. These requests + // are generally sent by clients to forward/explicit proxies. This allows clients to configure + // envoy as their HTTP proxy. In Unix, for example, this is typically done by setting the + // *http_proxy* environment variable. + AllowAbsoluteUrl *types.BoolValue `protobuf:"bytes,1,opt,name=allow_absolute_url,json=allowAbsoluteUrl" json:"allow_absolute_url,omitempty"` + // Handle incoming HTTP/1.0 and HTTP 0.9 requests. + // This is off by default, and not fully standards compliant. There is support for pre-HTTP/1.1 + // style connect logic, dechunking, and handling lack of client host iff + // *default_host_for_http_10* is configured. + AcceptHttp_10 bool `protobuf:"varint,2,opt,name=accept_http_10,json=acceptHttp10,proto3" json:"accept_http_10,omitempty"` + // A default host for HTTP/1.0 requests. This is highly suggested if *accept_http_10* is true as + // Envoy does not otherwise support HTTP/1.0 without a Host header. + // This is a no-op if *accept_http_10* is not true. + DefaultHostForHttp_10 string `protobuf:"bytes,3,opt,name=default_host_for_http_10,json=defaultHostForHttp10,proto3" json:"default_host_for_http_10,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Http1ProtocolOptions) Reset() { *m = Http1ProtocolOptions{} } +func (m *Http1ProtocolOptions) String() string { return proto.CompactTextString(m) } +func (*Http1ProtocolOptions) ProtoMessage() {} +func (*Http1ProtocolOptions) Descriptor() ([]byte, []int) { + return fileDescriptor_protocol_4320d5a758919a50, []int{2} +} +func (m *Http1ProtocolOptions) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Http1ProtocolOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Http1ProtocolOptions.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *Http1ProtocolOptions) XXX_Merge(src proto.Message) { + xxx_messageInfo_Http1ProtocolOptions.Merge(dst, src) +} +func (m *Http1ProtocolOptions) XXX_Size() int { + return m.Size() +} +func (m *Http1ProtocolOptions) XXX_DiscardUnknown() { + xxx_messageInfo_Http1ProtocolOptions.DiscardUnknown(m) +} + +var xxx_messageInfo_Http1ProtocolOptions proto.InternalMessageInfo + +func (m *Http1ProtocolOptions) GetAllowAbsoluteUrl() *types.BoolValue { + if m != nil { + return m.AllowAbsoluteUrl + } + return nil +} + +func (m *Http1ProtocolOptions) GetAcceptHttp_10() bool { + if m != nil { + return m.AcceptHttp_10 + } + return false +} + +func (m *Http1ProtocolOptions) GetDefaultHostForHttp_10() string { + if m != nil { + return m.DefaultHostForHttp_10 + } + return "" +} + +type Http2ProtocolOptions struct { + // `Maximum table size `_ + // (in octets) that the encoder is permitted to use for the dynamic HPACK table. Valid values + // range from 0 to 4294967295 (2^32 - 1) and defaults to 4096. 0 effectively disables header + // compression. + HpackTableSize *types.UInt32Value `protobuf:"bytes,1,opt,name=hpack_table_size,json=hpackTableSize" json:"hpack_table_size,omitempty"` + // `Maximum concurrent streams `_ + // allowed for peer on one HTTP/2 connection. Valid values range from 1 to 2147483647 (2^31 - 1) + // and defaults to 2147483647. + MaxConcurrentStreams *types.UInt32Value `protobuf:"bytes,2,opt,name=max_concurrent_streams,json=maxConcurrentStreams" json:"max_concurrent_streams,omitempty"` + // This field also acts as a soft limit on the number of bytes Envoy will buffer per-stream in the + // HTTP/2 codec buffers. Once the buffer reaches this pointer, watermark callbacks will fire to + // stop the flow of data to the codec buffers. + InitialStreamWindowSize *types.UInt32Value `protobuf:"bytes,3,opt,name=initial_stream_window_size,json=initialStreamWindowSize" json:"initial_stream_window_size,omitempty"` + // Similar to *initial_stream_window_size*, but for connection-level flow-control + // window. Currently, this has the same minimum/maximum/default as *initial_stream_window_size*. + InitialConnectionWindowSize *types.UInt32Value `protobuf:"bytes,4,opt,name=initial_connection_window_size,json=initialConnectionWindowSize" json:"initial_connection_window_size,omitempty"` + // [#not-implemented-hide:] Hiding until nghttp2 has native support. + // + // Allows proxying Websocket and other upgrades over H2 connect. + // + // THIS IS NOT SAFE TO USE IN PRODUCTION + // + // This currently works via disabling all HTTP sanity checks for H2 traffic + // which is a much larger hammer than we'd like to use. Eventually when + // https://github.com/nghttp2/nghttp2/issues/1181 is resolved, this will work + // with simply enabling CONNECT for H2. This may require some tweaks to the + // headers making pre-CONNECT-support proxying not backwards compatible with + // post-CONNECT-support proxying. + AllowConnect bool `protobuf:"varint,5,opt,name=allow_connect,json=allowConnect,proto3" json:"allow_connect,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Http2ProtocolOptions) Reset() { *m = Http2ProtocolOptions{} } +func (m *Http2ProtocolOptions) String() string { return proto.CompactTextString(m) } +func (*Http2ProtocolOptions) ProtoMessage() {} +func (*Http2ProtocolOptions) Descriptor() ([]byte, []int) { + return fileDescriptor_protocol_4320d5a758919a50, []int{3} +} +func (m *Http2ProtocolOptions) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Http2ProtocolOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Http2ProtocolOptions.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *Http2ProtocolOptions) XXX_Merge(src proto.Message) { + xxx_messageInfo_Http2ProtocolOptions.Merge(dst, src) +} +func (m *Http2ProtocolOptions) XXX_Size() int { + return m.Size() +} +func (m *Http2ProtocolOptions) XXX_DiscardUnknown() { + xxx_messageInfo_Http2ProtocolOptions.DiscardUnknown(m) +} + +var xxx_messageInfo_Http2ProtocolOptions proto.InternalMessageInfo + +func (m *Http2ProtocolOptions) GetHpackTableSize() *types.UInt32Value { + if m != nil { + return m.HpackTableSize + } + return nil +} + +func (m *Http2ProtocolOptions) GetMaxConcurrentStreams() *types.UInt32Value { + if m != nil { + return m.MaxConcurrentStreams + } + return nil +} + +func (m *Http2ProtocolOptions) GetInitialStreamWindowSize() *types.UInt32Value { + if m != nil { + return m.InitialStreamWindowSize + } + return nil +} + +func (m *Http2ProtocolOptions) GetInitialConnectionWindowSize() *types.UInt32Value { + if m != nil { + return m.InitialConnectionWindowSize + } + return nil +} + +func (m *Http2ProtocolOptions) GetAllowConnect() bool { + if m != nil { + return m.AllowConnect + } + return false +} + +// [#not-implemented-hide:] +type GrpcProtocolOptions struct { + Http2ProtocolOptions *Http2ProtocolOptions `protobuf:"bytes,1,opt,name=http2_protocol_options,json=http2ProtocolOptions" json:"http2_protocol_options,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GrpcProtocolOptions) Reset() { *m = GrpcProtocolOptions{} } +func (m *GrpcProtocolOptions) String() string { return proto.CompactTextString(m) } +func (*GrpcProtocolOptions) ProtoMessage() {} +func (*GrpcProtocolOptions) Descriptor() ([]byte, []int) { + return fileDescriptor_protocol_4320d5a758919a50, []int{4} +} +func (m *GrpcProtocolOptions) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GrpcProtocolOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GrpcProtocolOptions.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *GrpcProtocolOptions) XXX_Merge(src proto.Message) { + xxx_messageInfo_GrpcProtocolOptions.Merge(dst, src) +} +func (m *GrpcProtocolOptions) XXX_Size() int { + return m.Size() +} +func (m *GrpcProtocolOptions) XXX_DiscardUnknown() { + xxx_messageInfo_GrpcProtocolOptions.DiscardUnknown(m) +} + +var xxx_messageInfo_GrpcProtocolOptions proto.InternalMessageInfo + +func (m *GrpcProtocolOptions) GetHttp2ProtocolOptions() *Http2ProtocolOptions { + if m != nil { + return m.Http2ProtocolOptions + } + return nil +} + +func init() { + proto.RegisterType((*TcpProtocolOptions)(nil), "envoy.api.v2.core.TcpProtocolOptions") + proto.RegisterType((*HttpProtocolOptions)(nil), "envoy.api.v2.core.HttpProtocolOptions") + proto.RegisterType((*Http1ProtocolOptions)(nil), "envoy.api.v2.core.Http1ProtocolOptions") + proto.RegisterType((*Http2ProtocolOptions)(nil), "envoy.api.v2.core.Http2ProtocolOptions") + proto.RegisterType((*GrpcProtocolOptions)(nil), "envoy.api.v2.core.GrpcProtocolOptions") +} +func (this *TcpProtocolOptions) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*TcpProtocolOptions) + if !ok { + that2, ok := that.(TcpProtocolOptions) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *HttpProtocolOptions) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*HttpProtocolOptions) + if !ok { + that2, ok := that.(HttpProtocolOptions) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.IdleTimeout != nil && that1.IdleTimeout != nil { + if *this.IdleTimeout != *that1.IdleTimeout { + return false + } + } else if this.IdleTimeout != nil { + return false + } else if that1.IdleTimeout != nil { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *Http1ProtocolOptions) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Http1ProtocolOptions) + if !ok { + that2, ok := that.(Http1ProtocolOptions) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.AllowAbsoluteUrl.Equal(that1.AllowAbsoluteUrl) { + return false + } + if this.AcceptHttp_10 != that1.AcceptHttp_10 { + return false + } + if this.DefaultHostForHttp_10 != that1.DefaultHostForHttp_10 { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *Http2ProtocolOptions) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Http2ProtocolOptions) + if !ok { + that2, ok := that.(Http2ProtocolOptions) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.HpackTableSize.Equal(that1.HpackTableSize) { + return false + } + if !this.MaxConcurrentStreams.Equal(that1.MaxConcurrentStreams) { + return false + } + if !this.InitialStreamWindowSize.Equal(that1.InitialStreamWindowSize) { + return false + } + if !this.InitialConnectionWindowSize.Equal(that1.InitialConnectionWindowSize) { + return false + } + if this.AllowConnect != that1.AllowConnect { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *GrpcProtocolOptions) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*GrpcProtocolOptions) + if !ok { + that2, ok := that.(GrpcProtocolOptions) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.Http2ProtocolOptions.Equal(that1.Http2ProtocolOptions) { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (m *TcpProtocolOptions) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *TcpProtocolOptions) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *HttpProtocolOptions) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *HttpProtocolOptions) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.IdleTimeout != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintProtocol(dAtA, i, uint64(github_com_gogo_protobuf_types.SizeOfStdDuration(*m.IdleTimeout))) + n1, err := github_com_gogo_protobuf_types.StdDurationMarshalTo(*m.IdleTimeout, dAtA[i:]) + if err != nil { + return 0, err + } + i += n1 + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *Http1ProtocolOptions) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Http1ProtocolOptions) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.AllowAbsoluteUrl != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintProtocol(dAtA, i, uint64(m.AllowAbsoluteUrl.Size())) + n2, err := m.AllowAbsoluteUrl.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n2 + } + if m.AcceptHttp_10 { + dAtA[i] = 0x10 + i++ + if m.AcceptHttp_10 { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i++ + } + if len(m.DefaultHostForHttp_10) > 0 { + dAtA[i] = 0x1a + i++ + i = encodeVarintProtocol(dAtA, i, uint64(len(m.DefaultHostForHttp_10))) + i += copy(dAtA[i:], m.DefaultHostForHttp_10) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *Http2ProtocolOptions) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Http2ProtocolOptions) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.HpackTableSize != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintProtocol(dAtA, i, uint64(m.HpackTableSize.Size())) + n3, err := m.HpackTableSize.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n3 + } + if m.MaxConcurrentStreams != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintProtocol(dAtA, i, uint64(m.MaxConcurrentStreams.Size())) + n4, err := m.MaxConcurrentStreams.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n4 + } + if m.InitialStreamWindowSize != nil { + dAtA[i] = 0x1a + i++ + i = encodeVarintProtocol(dAtA, i, uint64(m.InitialStreamWindowSize.Size())) + n5, err := m.InitialStreamWindowSize.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n5 + } + if m.InitialConnectionWindowSize != nil { + dAtA[i] = 0x22 + i++ + i = encodeVarintProtocol(dAtA, i, uint64(m.InitialConnectionWindowSize.Size())) + n6, err := m.InitialConnectionWindowSize.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n6 + } + if m.AllowConnect { + dAtA[i] = 0x28 + i++ + if m.AllowConnect { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i++ + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *GrpcProtocolOptions) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GrpcProtocolOptions) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Http2ProtocolOptions != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintProtocol(dAtA, i, uint64(m.Http2ProtocolOptions.Size())) + n7, err := m.Http2ProtocolOptions.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n7 + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func encodeVarintProtocol(dAtA []byte, offset int, v uint64) int { + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return offset + 1 +} +func (m *TcpProtocolOptions) Size() (n int) { + var l int + _ = l + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *HttpProtocolOptions) Size() (n int) { + var l int + _ = l + if m.IdleTimeout != nil { + l = github_com_gogo_protobuf_types.SizeOfStdDuration(*m.IdleTimeout) + n += 1 + l + sovProtocol(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *Http1ProtocolOptions) Size() (n int) { + var l int + _ = l + if m.AllowAbsoluteUrl != nil { + l = m.AllowAbsoluteUrl.Size() + n += 1 + l + sovProtocol(uint64(l)) + } + if m.AcceptHttp_10 { + n += 2 + } + l = len(m.DefaultHostForHttp_10) + if l > 0 { + n += 1 + l + sovProtocol(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *Http2ProtocolOptions) Size() (n int) { + var l int + _ = l + if m.HpackTableSize != nil { + l = m.HpackTableSize.Size() + n += 1 + l + sovProtocol(uint64(l)) + } + if m.MaxConcurrentStreams != nil { + l = m.MaxConcurrentStreams.Size() + n += 1 + l + sovProtocol(uint64(l)) + } + if m.InitialStreamWindowSize != nil { + l = m.InitialStreamWindowSize.Size() + n += 1 + l + sovProtocol(uint64(l)) + } + if m.InitialConnectionWindowSize != nil { + l = m.InitialConnectionWindowSize.Size() + n += 1 + l + sovProtocol(uint64(l)) + } + if m.AllowConnect { + n += 2 + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *GrpcProtocolOptions) Size() (n int) { + var l int + _ = l + if m.Http2ProtocolOptions != nil { + l = m.Http2ProtocolOptions.Size() + n += 1 + l + sovProtocol(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func sovProtocol(x uint64) (n int) { + for { + n++ + x >>= 7 + if x == 0 { + break + } + } + return n +} +func sozProtocol(x uint64) (n int) { + return sovProtocol(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *TcpProtocolOptions) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProtocol + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: TcpProtocolOptions: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TcpProtocolOptions: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipProtocol(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthProtocol + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *HttpProtocolOptions) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProtocol + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: HttpProtocolOptions: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: HttpProtocolOptions: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field IdleTimeout", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProtocol + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthProtocol + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.IdleTimeout == nil { + m.IdleTimeout = new(time.Duration) + } + if err := github_com_gogo_protobuf_types.StdDurationUnmarshal(m.IdleTimeout, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipProtocol(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthProtocol + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Http1ProtocolOptions) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProtocol + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Http1ProtocolOptions: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Http1ProtocolOptions: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AllowAbsoluteUrl", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProtocol + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthProtocol + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.AllowAbsoluteUrl == nil { + m.AllowAbsoluteUrl = &types.BoolValue{} + } + if err := m.AllowAbsoluteUrl.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field AcceptHttp_10", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProtocol + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.AcceptHttp_10 = bool(v != 0) + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DefaultHostForHttp_10", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProtocol + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthProtocol + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DefaultHostForHttp_10 = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipProtocol(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthProtocol + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Http2ProtocolOptions) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProtocol + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Http2ProtocolOptions: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Http2ProtocolOptions: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field HpackTableSize", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProtocol + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthProtocol + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.HpackTableSize == nil { + m.HpackTableSize = &types.UInt32Value{} + } + if err := m.HpackTableSize.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxConcurrentStreams", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProtocol + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthProtocol + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.MaxConcurrentStreams == nil { + m.MaxConcurrentStreams = &types.UInt32Value{} + } + if err := m.MaxConcurrentStreams.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field InitialStreamWindowSize", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProtocol + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthProtocol + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.InitialStreamWindowSize == nil { + m.InitialStreamWindowSize = &types.UInt32Value{} + } + if err := m.InitialStreamWindowSize.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field InitialConnectionWindowSize", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProtocol + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthProtocol + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.InitialConnectionWindowSize == nil { + m.InitialConnectionWindowSize = &types.UInt32Value{} + } + if err := m.InitialConnectionWindowSize.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field AllowConnect", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProtocol + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.AllowConnect = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skipProtocol(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthProtocol + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GrpcProtocolOptions) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProtocol + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GrpcProtocolOptions: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GrpcProtocolOptions: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Http2ProtocolOptions", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProtocol + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthProtocol + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Http2ProtocolOptions == nil { + m.Http2ProtocolOptions = &Http2ProtocolOptions{} + } + if err := m.Http2ProtocolOptions.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipProtocol(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthProtocol + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipProtocol(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowProtocol + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowProtocol + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + return iNdEx, nil + case 1: + iNdEx += 8 + return iNdEx, nil + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowProtocol + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + iNdEx += length + if length < 0 { + return 0, ErrInvalidLengthProtocol + } + return iNdEx, nil + case 3: + for { + var innerWire uint64 + var start int = iNdEx + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowProtocol + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + innerWire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + innerWireType := int(innerWire & 0x7) + if innerWireType == 4 { + break + } + next, err := skipProtocol(dAtA[start:]) + if err != nil { + return 0, err + } + iNdEx = start + next + } + return iNdEx, nil + case 4: + return iNdEx, nil + case 5: + iNdEx += 4 + return iNdEx, nil + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + } + panic("unreachable") +} + +var ( + ErrInvalidLengthProtocol = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowProtocol = fmt.Errorf("proto: integer overflow") +) + +func init() { + proto.RegisterFile("envoy/api/v2/core/protocol.proto", fileDescriptor_protocol_4320d5a758919a50) +} + +var fileDescriptor_protocol_4320d5a758919a50 = []byte{ + // 556 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x93, 0xc1, 0x6e, 0xd3, 0x40, + 0x10, 0x86, 0x65, 0x52, 0xa0, 0x6c, 0x4b, 0x49, 0x5d, 0xab, 0x0d, 0x01, 0x99, 0x28, 0x20, 0x11, + 0xf5, 0x60, 0xb7, 0xae, 0xc4, 0x9d, 0x14, 0x95, 0x70, 0x02, 0xb9, 0x29, 0x88, 0x03, 0x5a, 0x6d, + 0x36, 0x9b, 0x64, 0xc5, 0xc6, 0xb3, 0x5a, 0xaf, 0x93, 0xd2, 0x27, 0xe1, 0x11, 0x78, 0x06, 0x0e, + 0x88, 0x23, 0x07, 0x0e, 0xbc, 0x01, 0x28, 0x37, 0x9e, 0xc2, 0xc8, 0xde, 0x4d, 0x04, 0x49, 0x25, + 0x10, 0xb7, 0xd1, 0xcc, 0xfc, 0xff, 0x37, 0x63, 0xcf, 0xa2, 0x06, 0x4b, 0x26, 0xf0, 0x2e, 0x24, + 0x92, 0x87, 0x93, 0x28, 0xa4, 0xa0, 0x58, 0x28, 0x15, 0x68, 0xa0, 0x20, 0x82, 0x32, 0x70, 0xb7, + 0xcb, 0x8e, 0x80, 0x48, 0x1e, 0x4c, 0xa2, 0xa0, 0xe8, 0xa8, 0xfb, 0x43, 0x80, 0xa1, 0xb0, 0x9d, + 0xbd, 0x6c, 0x10, 0xf6, 0x33, 0x45, 0x34, 0x87, 0xc4, 0x48, 0x56, 0xeb, 0x53, 0x45, 0xa4, 0x64, + 0x2a, 0xb5, 0xf5, 0xbd, 0x09, 0x11, 0xbc, 0x4f, 0x34, 0x0b, 0xe7, 0x81, 0x2d, 0x78, 0x43, 0x18, + 0x42, 0x19, 0x86, 0x45, 0x64, 0xb2, 0x4d, 0x0f, 0xb9, 0x5d, 0x2a, 0x5f, 0xd8, 0xb1, 0x9e, 0xcb, + 0x82, 0x94, 0x36, 0x5f, 0xa3, 0x9d, 0x8e, 0xd6, 0xcb, 0x69, 0xb7, 0x8d, 0x36, 0x79, 0x5f, 0x30, + 0xac, 0xf9, 0x98, 0x41, 0xa6, 0x6b, 0x4e, 0xc3, 0x69, 0x6d, 0x44, 0xb7, 0x03, 0x33, 0x52, 0x30, + 0x1f, 0x29, 0x78, 0x62, 0x47, 0x6e, 0xaf, 0xbd, 0xff, 0x7e, 0xcf, 0x89, 0x37, 0x0a, 0x51, 0xd7, + 0x68, 0x9a, 0x9f, 0x1c, 0xe4, 0x15, 0xde, 0x87, 0xcb, 0xe6, 0x1d, 0xe4, 0x12, 0x21, 0x60, 0x8a, + 0x49, 0x2f, 0x05, 0x91, 0x69, 0x86, 0x33, 0x25, 0x2c, 0xa2, 0xbe, 0x82, 0x68, 0x03, 0x88, 0x97, + 0x44, 0x64, 0x2c, 0xae, 0x96, 0xaa, 0xc7, 0x56, 0x74, 0xa6, 0x84, 0xfb, 0x00, 0x6d, 0x11, 0x4a, + 0x99, 0xd4, 0x78, 0xa4, 0xb5, 0xc4, 0x87, 0x07, 0xb5, 0x2b, 0x0d, 0xa7, 0xb5, 0x1e, 0x6f, 0x9a, + 0x6c, 0x49, 0x3f, 0x70, 0x1f, 0xa1, 0x5a, 0x9f, 0x0d, 0x48, 0x26, 0x34, 0x1e, 0x41, 0xaa, 0xf1, + 0x00, 0xd4, 0xa2, 0xbf, 0xd2, 0x70, 0x5a, 0x37, 0x62, 0xcf, 0xd6, 0x3b, 0x90, 0xea, 0x13, 0x50, + 0x46, 0xd7, 0xfc, 0x5a, 0x31, 0x0b, 0x44, 0xcb, 0x0b, 0x9c, 0xa0, 0xea, 0x48, 0x12, 0xfa, 0x16, + 0x6b, 0xd2, 0x13, 0x0c, 0xa7, 0xfc, 0x82, 0xd9, 0xf1, 0xef, 0xae, 0x8c, 0x7f, 0xf6, 0x2c, 0xd1, + 0x47, 0x91, 0x59, 0x60, 0xab, 0x54, 0x75, 0x0b, 0xd1, 0x29, 0xbf, 0x60, 0x2e, 0x45, 0xbb, 0x63, + 0x72, 0x8e, 0x29, 0x24, 0x34, 0x53, 0x8a, 0x25, 0x1a, 0xa7, 0x5a, 0x31, 0x32, 0x4e, 0xcb, 0x35, + 0xfe, 0xe2, 0xd6, 0xbe, 0xf5, 0xf1, 0xe7, 0xe7, 0x0a, 0xda, 0x5f, 0xaf, 0xe5, 0x79, 0x9e, 0x5f, + 0x6f, 0x39, 0xb1, 0x37, 0x26, 0xe7, 0xc7, 0x0b, 0xaf, 0x53, 0x63, 0xe5, 0x0a, 0x54, 0xe7, 0x09, + 0xd7, 0x9c, 0x08, 0xeb, 0x8e, 0xa7, 0x3c, 0xe9, 0xc3, 0xd4, 0x8c, 0x5d, 0xf9, 0x07, 0xd0, 0x76, + 0x01, 0xda, 0xdc, 0x47, 0x16, 0x94, 0xe7, 0x95, 0x78, 0xcf, 0x5a, 0x1a, 0xc8, 0xab, 0xd2, 0xb0, + 0x5c, 0x49, 0x23, 0x7f, 0x4e, 0xa3, 0x90, 0x24, 0x8c, 0x16, 0x5f, 0xec, 0x0f, 0xe2, 0xda, 0xff, + 0x11, 0xef, 0x58, 0xdb, 0xe3, 0x85, 0xeb, 0x6f, 0xd4, 0xfb, 0xe8, 0xa6, 0xb9, 0x28, 0xcb, 0xac, + 0x5d, 0xb5, 0x67, 0x50, 0x24, 0xad, 0xa2, 0xa9, 0xd1, 0xce, 0x53, 0x25, 0xe9, 0xf2, 0xcf, 0x7c, + 0x83, 0x76, 0x8b, 0x63, 0x88, 0xf0, 0xfc, 0xc5, 0x62, 0x30, 0x15, 0xfb, 0x4b, 0x1f, 0x06, 0x2b, + 0x4f, 0x37, 0xb8, 0xec, 0x2a, 0x62, 0x6f, 0x74, 0x49, 0xb6, 0x5d, 0xfd, 0x30, 0xf3, 0x9d, 0x2f, + 0x33, 0xdf, 0xf9, 0x36, 0xf3, 0x9d, 0x1f, 0x33, 0xdf, 0xe9, 0x5d, 0x2b, 0x41, 0x47, 0xbf, 0x02, + 0x00, 0x00, 0xff, 0xff, 0x01, 0x63, 0xb4, 0x84, 0x35, 0x04, 0x00, 0x00, +} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/core/protocol.pb.validate.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/core/protocol.pb.validate.go new file mode 100644 index 000000000000..66294c882c04 --- /dev/null +++ b/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/core/protocol.pb.validate.go @@ -0,0 +1,324 @@ +// Code generated by protoc-gen-validate +// source: envoy/api/v2/core/protocol.proto +// DO NOT EDIT!!! + +package core + +import ( + "bytes" + "errors" + "fmt" + "net" + "net/mail" + "net/url" + "regexp" + "strings" + "time" + "unicode/utf8" + + "github.com/gogo/protobuf/types" +) + +// ensure the imports are used +var ( + _ = bytes.MinRead + _ = errors.New("") + _ = fmt.Print + _ = utf8.UTFMax + _ = (*regexp.Regexp)(nil) + _ = (*strings.Reader)(nil) + _ = net.IPv4len + _ = time.Duration(0) + _ = (*url.URL)(nil) + _ = (*mail.Address)(nil) + _ = types.DynamicAny{} +) + +// Validate checks the field values on TcpProtocolOptions with the rules +// defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *TcpProtocolOptions) Validate() error { + if m == nil { + return nil + } + + return nil +} + +// TcpProtocolOptionsValidationError is the validation error returned by +// TcpProtocolOptions.Validate if the designated constraints aren't met. +type TcpProtocolOptionsValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e TcpProtocolOptionsValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sTcpProtocolOptions.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = TcpProtocolOptionsValidationError{} + +// Validate checks the field values on HttpProtocolOptions with the rules +// defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *HttpProtocolOptions) Validate() error { + if m == nil { + return nil + } + + if v, ok := interface{}(m.GetIdleTimeout()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return HttpProtocolOptionsValidationError{ + Field: "IdleTimeout", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + return nil +} + +// HttpProtocolOptionsValidationError is the validation error returned by +// HttpProtocolOptions.Validate if the designated constraints aren't met. +type HttpProtocolOptionsValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e HttpProtocolOptionsValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sHttpProtocolOptions.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = HttpProtocolOptionsValidationError{} + +// Validate checks the field values on Http1ProtocolOptions with the rules +// defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *Http1ProtocolOptions) Validate() error { + if m == nil { + return nil + } + + if v, ok := interface{}(m.GetAllowAbsoluteUrl()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return Http1ProtocolOptionsValidationError{ + Field: "AllowAbsoluteUrl", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + // no validation rules for AcceptHttp_10 + + // no validation rules for DefaultHostForHttp_10 + + return nil +} + +// Http1ProtocolOptionsValidationError is the validation error returned by +// Http1ProtocolOptions.Validate if the designated constraints aren't met. +type Http1ProtocolOptionsValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e Http1ProtocolOptionsValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sHttp1ProtocolOptions.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = Http1ProtocolOptionsValidationError{} + +// Validate checks the field values on Http2ProtocolOptions with the rules +// defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *Http2ProtocolOptions) Validate() error { + if m == nil { + return nil + } + + if v, ok := interface{}(m.GetHpackTableSize()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return Http2ProtocolOptionsValidationError{ + Field: "HpackTableSize", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + if wrapper := m.GetMaxConcurrentStreams(); wrapper != nil { + + if val := wrapper.GetValue(); val < 1 || val > 2147483647 { + return Http2ProtocolOptionsValidationError{ + Field: "MaxConcurrentStreams", + Reason: "value must be inside range [1, 2147483647]", + } + } + + } + + if wrapper := m.GetInitialStreamWindowSize(); wrapper != nil { + + if val := wrapper.GetValue(); val < 65535 || val > 2147483647 { + return Http2ProtocolOptionsValidationError{ + Field: "InitialStreamWindowSize", + Reason: "value must be inside range [65535, 2147483647]", + } + } + + } + + if wrapper := m.GetInitialConnectionWindowSize(); wrapper != nil { + + if val := wrapper.GetValue(); val < 65535 || val > 2147483647 { + return Http2ProtocolOptionsValidationError{ + Field: "InitialConnectionWindowSize", + Reason: "value must be inside range [65535, 2147483647]", + } + } + + } + + // no validation rules for AllowConnect + + return nil +} + +// Http2ProtocolOptionsValidationError is the validation error returned by +// Http2ProtocolOptions.Validate if the designated constraints aren't met. +type Http2ProtocolOptionsValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e Http2ProtocolOptionsValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sHttp2ProtocolOptions.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = Http2ProtocolOptionsValidationError{} + +// Validate checks the field values on GrpcProtocolOptions with the rules +// defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *GrpcProtocolOptions) Validate() error { + if m == nil { + return nil + } + + if v, ok := interface{}(m.GetHttp2ProtocolOptions()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return GrpcProtocolOptionsValidationError{ + Field: "Http2ProtocolOptions", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + return nil +} + +// GrpcProtocolOptionsValidationError is the validation error returned by +// GrpcProtocolOptions.Validate if the designated constraints aren't met. +type GrpcProtocolOptionsValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e GrpcProtocolOptionsValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sGrpcProtocolOptions.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = GrpcProtocolOptionsValidationError{} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/discovery.pb.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/discovery.pb.go new file mode 100644 index 000000000000..552b8c78628e --- /dev/null +++ b/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/discovery.pb.go @@ -0,0 +1,2490 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: envoy/api/v2/discovery.proto + +package v2 + +import proto "github.com/gogo/protobuf/proto" +import fmt "fmt" +import math "math" +import core "github.com/envoyproxy/go-control-plane/envoy/api/v2/core" +import rpc "github.com/gogo/googleapis/google/rpc" +import _ "github.com/gogo/protobuf/gogoproto" +import types "github.com/gogo/protobuf/types" + +import bytes "bytes" + +import io "io" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package + +// A DiscoveryRequest requests a set of versioned resources of the same type for +// a given Envoy node on some API. +type DiscoveryRequest struct { + // The version_info provided in the request messages will be the version_info + // received with the most recent successfully processed response or empty on + // the first request. It is expected that no new request is sent after a + // response is received until the Envoy instance is ready to ACK/NACK the new + // configuration. ACK/NACK takes place by returning the new API config version + // as applied or the previous API config version respectively. Each type_url + // (see below) has an independent version associated with it. + VersionInfo string `protobuf:"bytes,1,opt,name=version_info,json=versionInfo,proto3" json:"version_info,omitempty"` + // The node making the request. + Node *core.Node `protobuf:"bytes,2,opt,name=node" json:"node,omitempty"` + // List of resources to subscribe to, e.g. list of cluster names or a route + // configuration name. If this is empty, all resources for the API are + // returned. LDS/CDS expect empty resource_names, since this is global + // discovery for the Envoy instance. The LDS and CDS responses will then imply + // a number of resources that need to be fetched via EDS/RDS, which will be + // explicitly enumerated in resource_names. + ResourceNames []string `protobuf:"bytes,3,rep,name=resource_names,json=resourceNames" json:"resource_names,omitempty"` + // Type of the resource that is being requested, e.g. + // "type.googleapis.com/envoy.api.v2.ClusterLoadAssignment". This is implicit + // in requests made via singleton xDS APIs such as CDS, LDS, etc. but is + // required for ADS. + TypeUrl string `protobuf:"bytes,4,opt,name=type_url,json=typeUrl,proto3" json:"type_url,omitempty"` + // nonce corresponding to DiscoveryResponse being ACK/NACKed. See above + // discussion on version_info and the DiscoveryResponse nonce comment. This + // may be empty if no nonce is available, e.g. at startup or for non-stream + // xDS implementations. + ResponseNonce string `protobuf:"bytes,5,opt,name=response_nonce,json=responseNonce,proto3" json:"response_nonce,omitempty"` + // This is populated when the previous :ref:`DiscoveryResponse ` + // failed to update configuration. The *message* field in *error_details* provides the Envoy + // internal exception related to the failure. It is only intended for consumption during manual + // debugging, the string provided is not guaranteed to be stable across Envoy versions. + ErrorDetail *rpc.Status `protobuf:"bytes,6,opt,name=error_detail,json=errorDetail" json:"error_detail,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *DiscoveryRequest) Reset() { *m = DiscoveryRequest{} } +func (m *DiscoveryRequest) String() string { return proto.CompactTextString(m) } +func (*DiscoveryRequest) ProtoMessage() {} +func (*DiscoveryRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_discovery_51dc66d5d71581c9, []int{0} +} +func (m *DiscoveryRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DiscoveryRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_DiscoveryRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *DiscoveryRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_DiscoveryRequest.Merge(dst, src) +} +func (m *DiscoveryRequest) XXX_Size() int { + return m.Size() +} +func (m *DiscoveryRequest) XXX_DiscardUnknown() { + xxx_messageInfo_DiscoveryRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_DiscoveryRequest proto.InternalMessageInfo + +func (m *DiscoveryRequest) GetVersionInfo() string { + if m != nil { + return m.VersionInfo + } + return "" +} + +func (m *DiscoveryRequest) GetNode() *core.Node { + if m != nil { + return m.Node + } + return nil +} + +func (m *DiscoveryRequest) GetResourceNames() []string { + if m != nil { + return m.ResourceNames + } + return nil +} + +func (m *DiscoveryRequest) GetTypeUrl() string { + if m != nil { + return m.TypeUrl + } + return "" +} + +func (m *DiscoveryRequest) GetResponseNonce() string { + if m != nil { + return m.ResponseNonce + } + return "" +} + +func (m *DiscoveryRequest) GetErrorDetail() *rpc.Status { + if m != nil { + return m.ErrorDetail + } + return nil +} + +type DiscoveryResponse struct { + // The version of the response data. + VersionInfo string `protobuf:"bytes,1,opt,name=version_info,json=versionInfo,proto3" json:"version_info,omitempty"` + // The response resources. These resources are typed and depend on the API being called. + Resources []types.Any `protobuf:"bytes,2,rep,name=resources" json:"resources"` + // [#not-implemented-hide:] + // Canary is used to support two Envoy command line flags: + // + // * --terminate-on-canary-transition-failure. When set, Envoy is able to + // terminate if it detects that configuration is stuck at canary. Consider + // this example sequence of updates: + // - Management server applies a canary config successfully. + // - Management server rolls back to a production config. + // - Envoy rejects the new production config. + // Since there is no sensible way to continue receiving configuration + // updates, Envoy will then terminate and apply production config from a + // clean slate. + // * --dry-run-canary. When set, a canary response will never be applied, only + // validated via a dry run. + Canary bool `protobuf:"varint,3,opt,name=canary,proto3" json:"canary,omitempty"` + // Type URL for resources. This must be consistent with the type_url in the + // Any messages for resources if resources is non-empty. This effectively + // identifies the xDS API when muxing over ADS. + TypeUrl string `protobuf:"bytes,4,opt,name=type_url,json=typeUrl,proto3" json:"type_url,omitempty"` + // For gRPC based subscriptions, the nonce provides a way to explicitly ack a + // specific DiscoveryResponse in a following DiscoveryRequest. Additional + // messages may have been sent by Envoy to the management server for the + // previous version on the stream prior to this DiscoveryResponse, that were + // unprocessed at response send time. The nonce allows the management server + // to ignore any further DiscoveryRequests for the previous version until a + // DiscoveryRequest bearing the nonce. The nonce is optional and is not + // required for non-stream based xDS implementations. + Nonce string `protobuf:"bytes,5,opt,name=nonce,proto3" json:"nonce,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *DiscoveryResponse) Reset() { *m = DiscoveryResponse{} } +func (m *DiscoveryResponse) String() string { return proto.CompactTextString(m) } +func (*DiscoveryResponse) ProtoMessage() {} +func (*DiscoveryResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_discovery_51dc66d5d71581c9, []int{1} +} +func (m *DiscoveryResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DiscoveryResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_DiscoveryResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *DiscoveryResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_DiscoveryResponse.Merge(dst, src) +} +func (m *DiscoveryResponse) XXX_Size() int { + return m.Size() +} +func (m *DiscoveryResponse) XXX_DiscardUnknown() { + xxx_messageInfo_DiscoveryResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_DiscoveryResponse proto.InternalMessageInfo + +func (m *DiscoveryResponse) GetVersionInfo() string { + if m != nil { + return m.VersionInfo + } + return "" +} + +func (m *DiscoveryResponse) GetResources() []types.Any { + if m != nil { + return m.Resources + } + return nil +} + +func (m *DiscoveryResponse) GetCanary() bool { + if m != nil { + return m.Canary + } + return false +} + +func (m *DiscoveryResponse) GetTypeUrl() string { + if m != nil { + return m.TypeUrl + } + return "" +} + +func (m *DiscoveryResponse) GetNonce() string { + if m != nil { + return m.Nonce + } + return "" +} + +// IncrementalDiscoveryRequest and IncrementalDiscoveryResponse are used in a +// new gRPC endpoint for Incremental xDS. The feature is not supported for REST +// management servers. +// +// With Incremental xDS, the IncrementalDiscoveryResponses do not need to +// include a full snapshot of the tracked resources. Instead +// IncrementalDiscoveryResponses are a diff to the state of a xDS client. +// In Incremental XDS there are per resource versions which allows to track +// state at the resource granularity. +// An xDS Incremental session is always in the context of a gRPC bidirectional +// stream. This allows the xDS server to keep track of the state of xDS clients +// connected to it. +// +// In Incremental xDS the nonce field is required and used to pair +// IncrementalDiscoveryResponse to a IncrementalDiscoveryRequest ACK or NACK. +// Optionaly, a response message level system_version_info is present for +// debugging purposes only. +// +// IncrementalDiscoveryRequest can be sent in 3 situations: +// 1. Initial message in a xDS bidirectional gRPC stream. +// 2. As a ACK or NACK response to a previous IncrementalDiscoveryResponse. +// In this case the response_nonce is set to the nonce value in the Response. +// ACK or NACK is determined by the absence or presence of error_detail. +// 3. Spontaneous IncrementalDiscoveryRequest from the client. +// This can be done to dynamically add or remove elements from the tracked +// resource_names set. In this case response_nonce must be omitted. +type IncrementalDiscoveryRequest struct { + // The node making the request. + Node *core.Node `protobuf:"bytes,1,opt,name=node" json:"node,omitempty"` + // Type of the resource that is being requested, e.g. + // "type.googleapis.com/envoy.api.v2.ClusterLoadAssignment". This is implicit + // in requests made via singleton xDS APIs such as CDS, LDS, etc. but is + // required for ADS. + TypeUrl string `protobuf:"bytes,2,opt,name=type_url,json=typeUrl,proto3" json:"type_url,omitempty"` + // IncrementalDiscoveryRequests allow the client to add or remove individual + // resources to the set of tracked resources in the context of a stream. + // All resource names in the resource_names_subscribe list are added to the + // set of tracked resources and all resource names in the resource_names_unsubscribe + // list are removed from the set of tracked resources. + // Unlike in non incremental xDS, an empty resource_names_subscribe or + // resource_names_unsubscribe list simply means that no resources are to be + // added or removed to the resource list. + // The xDS server must send updates for all tracked resources but can also + // send updates for resources the client has not subscribed to. This behavior + // is similar to non incremental xDS. + // These two fields can be set for all types of IncrementalDiscoveryRequests + // (initial, ACK/NACK or spontaneous). + // + // A list of Resource names to add to the list of tracked resources. + ResourceNamesSubscribe []string `protobuf:"bytes,3,rep,name=resource_names_subscribe,json=resourceNamesSubscribe" json:"resource_names_subscribe,omitempty"` + // A list of Resource names to remove from the list of tracked resources. + ResourceNamesUnsubscribe []string `protobuf:"bytes,4,rep,name=resource_names_unsubscribe,json=resourceNamesUnsubscribe" json:"resource_names_unsubscribe,omitempty"` + // This map must be populated when the IncrementalDiscoveryRequest is the + // first in a stream. The keys are the resources names of the xDS resources + // known to the xDS client. The values in the map are the associated resource + // level version info. + InitialResourceVersions map[string]string `protobuf:"bytes,5,rep,name=initial_resource_versions,json=initialResourceVersions" json:"initial_resource_versions,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + // When the IncrementalDiscoveryRequest is a ACK or NACK message in response + // to a previous IncrementalDiscoveryResponse, the response_nonce must be the + // nonce in the IncrementalDiscoveryResponse. + // Otherwise response_nonce must be omitted. + ResponseNonce string `protobuf:"bytes,6,opt,name=response_nonce,json=responseNonce,proto3" json:"response_nonce,omitempty"` + // This is populated when the previous :ref:`DiscoveryResponse ` + // failed to update configuration. The *message* field in *error_details* + // provides the Envoy internal exception related to the failure. + ErrorDetail *rpc.Status `protobuf:"bytes,7,opt,name=error_detail,json=errorDetail" json:"error_detail,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *IncrementalDiscoveryRequest) Reset() { *m = IncrementalDiscoveryRequest{} } +func (m *IncrementalDiscoveryRequest) String() string { return proto.CompactTextString(m) } +func (*IncrementalDiscoveryRequest) ProtoMessage() {} +func (*IncrementalDiscoveryRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_discovery_51dc66d5d71581c9, []int{2} +} +func (m *IncrementalDiscoveryRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *IncrementalDiscoveryRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_IncrementalDiscoveryRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *IncrementalDiscoveryRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_IncrementalDiscoveryRequest.Merge(dst, src) +} +func (m *IncrementalDiscoveryRequest) XXX_Size() int { + return m.Size() +} +func (m *IncrementalDiscoveryRequest) XXX_DiscardUnknown() { + xxx_messageInfo_IncrementalDiscoveryRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_IncrementalDiscoveryRequest proto.InternalMessageInfo + +func (m *IncrementalDiscoveryRequest) GetNode() *core.Node { + if m != nil { + return m.Node + } + return nil +} + +func (m *IncrementalDiscoveryRequest) GetTypeUrl() string { + if m != nil { + return m.TypeUrl + } + return "" +} + +func (m *IncrementalDiscoveryRequest) GetResourceNamesSubscribe() []string { + if m != nil { + return m.ResourceNamesSubscribe + } + return nil +} + +func (m *IncrementalDiscoveryRequest) GetResourceNamesUnsubscribe() []string { + if m != nil { + return m.ResourceNamesUnsubscribe + } + return nil +} + +func (m *IncrementalDiscoveryRequest) GetInitialResourceVersions() map[string]string { + if m != nil { + return m.InitialResourceVersions + } + return nil +} + +func (m *IncrementalDiscoveryRequest) GetResponseNonce() string { + if m != nil { + return m.ResponseNonce + } + return "" +} + +func (m *IncrementalDiscoveryRequest) GetErrorDetail() *rpc.Status { + if m != nil { + return m.ErrorDetail + } + return nil +} + +type IncrementalDiscoveryResponse struct { + // The version of the response data (used for debugging). + SystemVersionInfo string `protobuf:"bytes,1,opt,name=system_version_info,json=systemVersionInfo,proto3" json:"system_version_info,omitempty"` + // The response resources. These are typed resources that match the type url + // in the IncrementalDiscoveryRequest. + Resources []Resource `protobuf:"bytes,2,rep,name=resources" json:"resources"` + // Resources names of resources that have be deleted and to be removed from the xDS Client. + // Removed resources for missing resources can be ignored. + RemovedResources []string `protobuf:"bytes,6,rep,name=removed_resources,json=removedResources" json:"removed_resources,omitempty"` + // The nonce provides a way for IncrementalDiscoveryRequests to uniquely + // reference a IncrementalDiscoveryResponse. The nonce is required. + Nonce string `protobuf:"bytes,5,opt,name=nonce,proto3" json:"nonce,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *IncrementalDiscoveryResponse) Reset() { *m = IncrementalDiscoveryResponse{} } +func (m *IncrementalDiscoveryResponse) String() string { return proto.CompactTextString(m) } +func (*IncrementalDiscoveryResponse) ProtoMessage() {} +func (*IncrementalDiscoveryResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_discovery_51dc66d5d71581c9, []int{3} +} +func (m *IncrementalDiscoveryResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *IncrementalDiscoveryResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_IncrementalDiscoveryResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *IncrementalDiscoveryResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_IncrementalDiscoveryResponse.Merge(dst, src) +} +func (m *IncrementalDiscoveryResponse) XXX_Size() int { + return m.Size() +} +func (m *IncrementalDiscoveryResponse) XXX_DiscardUnknown() { + xxx_messageInfo_IncrementalDiscoveryResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_IncrementalDiscoveryResponse proto.InternalMessageInfo + +func (m *IncrementalDiscoveryResponse) GetSystemVersionInfo() string { + if m != nil { + return m.SystemVersionInfo + } + return "" +} + +func (m *IncrementalDiscoveryResponse) GetResources() []Resource { + if m != nil { + return m.Resources + } + return nil +} + +func (m *IncrementalDiscoveryResponse) GetRemovedResources() []string { + if m != nil { + return m.RemovedResources + } + return nil +} + +func (m *IncrementalDiscoveryResponse) GetNonce() string { + if m != nil { + return m.Nonce + } + return "" +} + +type Resource struct { + // The resource level version. It allows xDS to track the state of individual + // resources. + Version string `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` + // The resource being tracked. + Resource *types.Any `protobuf:"bytes,2,opt,name=resource" json:"resource,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Resource) Reset() { *m = Resource{} } +func (m *Resource) String() string { return proto.CompactTextString(m) } +func (*Resource) ProtoMessage() {} +func (*Resource) Descriptor() ([]byte, []int) { + return fileDescriptor_discovery_51dc66d5d71581c9, []int{4} +} +func (m *Resource) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Resource) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Resource.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *Resource) XXX_Merge(src proto.Message) { + xxx_messageInfo_Resource.Merge(dst, src) +} +func (m *Resource) XXX_Size() int { + return m.Size() +} +func (m *Resource) XXX_DiscardUnknown() { + xxx_messageInfo_Resource.DiscardUnknown(m) +} + +var xxx_messageInfo_Resource proto.InternalMessageInfo + +func (m *Resource) GetVersion() string { + if m != nil { + return m.Version + } + return "" +} + +func (m *Resource) GetResource() *types.Any { + if m != nil { + return m.Resource + } + return nil +} + +func init() { + proto.RegisterType((*DiscoveryRequest)(nil), "envoy.api.v2.DiscoveryRequest") + proto.RegisterType((*DiscoveryResponse)(nil), "envoy.api.v2.DiscoveryResponse") + proto.RegisterType((*IncrementalDiscoveryRequest)(nil), "envoy.api.v2.IncrementalDiscoveryRequest") + proto.RegisterMapType((map[string]string)(nil), "envoy.api.v2.IncrementalDiscoveryRequest.InitialResourceVersionsEntry") + proto.RegisterType((*IncrementalDiscoveryResponse)(nil), "envoy.api.v2.IncrementalDiscoveryResponse") + proto.RegisterType((*Resource)(nil), "envoy.api.v2.Resource") +} +func (this *DiscoveryRequest) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*DiscoveryRequest) + if !ok { + that2, ok := that.(DiscoveryRequest) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.VersionInfo != that1.VersionInfo { + return false + } + if !this.Node.Equal(that1.Node) { + return false + } + if len(this.ResourceNames) != len(that1.ResourceNames) { + return false + } + for i := range this.ResourceNames { + if this.ResourceNames[i] != that1.ResourceNames[i] { + return false + } + } + if this.TypeUrl != that1.TypeUrl { + return false + } + if this.ResponseNonce != that1.ResponseNonce { + return false + } + if !this.ErrorDetail.Equal(that1.ErrorDetail) { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *DiscoveryResponse) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*DiscoveryResponse) + if !ok { + that2, ok := that.(DiscoveryResponse) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.VersionInfo != that1.VersionInfo { + return false + } + if len(this.Resources) != len(that1.Resources) { + return false + } + for i := range this.Resources { + if !this.Resources[i].Equal(&that1.Resources[i]) { + return false + } + } + if this.Canary != that1.Canary { + return false + } + if this.TypeUrl != that1.TypeUrl { + return false + } + if this.Nonce != that1.Nonce { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *IncrementalDiscoveryRequest) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*IncrementalDiscoveryRequest) + if !ok { + that2, ok := that.(IncrementalDiscoveryRequest) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.Node.Equal(that1.Node) { + return false + } + if this.TypeUrl != that1.TypeUrl { + return false + } + if len(this.ResourceNamesSubscribe) != len(that1.ResourceNamesSubscribe) { + return false + } + for i := range this.ResourceNamesSubscribe { + if this.ResourceNamesSubscribe[i] != that1.ResourceNamesSubscribe[i] { + return false + } + } + if len(this.ResourceNamesUnsubscribe) != len(that1.ResourceNamesUnsubscribe) { + return false + } + for i := range this.ResourceNamesUnsubscribe { + if this.ResourceNamesUnsubscribe[i] != that1.ResourceNamesUnsubscribe[i] { + return false + } + } + if len(this.InitialResourceVersions) != len(that1.InitialResourceVersions) { + return false + } + for i := range this.InitialResourceVersions { + if this.InitialResourceVersions[i] != that1.InitialResourceVersions[i] { + return false + } + } + if this.ResponseNonce != that1.ResponseNonce { + return false + } + if !this.ErrorDetail.Equal(that1.ErrorDetail) { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *IncrementalDiscoveryResponse) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*IncrementalDiscoveryResponse) + if !ok { + that2, ok := that.(IncrementalDiscoveryResponse) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.SystemVersionInfo != that1.SystemVersionInfo { + return false + } + if len(this.Resources) != len(that1.Resources) { + return false + } + for i := range this.Resources { + if !this.Resources[i].Equal(&that1.Resources[i]) { + return false + } + } + if len(this.RemovedResources) != len(that1.RemovedResources) { + return false + } + for i := range this.RemovedResources { + if this.RemovedResources[i] != that1.RemovedResources[i] { + return false + } + } + if this.Nonce != that1.Nonce { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *Resource) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Resource) + if !ok { + that2, ok := that.(Resource) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Version != that1.Version { + return false + } + if !this.Resource.Equal(that1.Resource) { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (m *DiscoveryRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *DiscoveryRequest) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.VersionInfo) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintDiscovery(dAtA, i, uint64(len(m.VersionInfo))) + i += copy(dAtA[i:], m.VersionInfo) + } + if m.Node != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintDiscovery(dAtA, i, uint64(m.Node.Size())) + n1, err := m.Node.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n1 + } + if len(m.ResourceNames) > 0 { + for _, s := range m.ResourceNames { + dAtA[i] = 0x1a + i++ + l = len(s) + for l >= 1<<7 { + dAtA[i] = uint8(uint64(l)&0x7f | 0x80) + l >>= 7 + i++ + } + dAtA[i] = uint8(l) + i++ + i += copy(dAtA[i:], s) + } + } + if len(m.TypeUrl) > 0 { + dAtA[i] = 0x22 + i++ + i = encodeVarintDiscovery(dAtA, i, uint64(len(m.TypeUrl))) + i += copy(dAtA[i:], m.TypeUrl) + } + if len(m.ResponseNonce) > 0 { + dAtA[i] = 0x2a + i++ + i = encodeVarintDiscovery(dAtA, i, uint64(len(m.ResponseNonce))) + i += copy(dAtA[i:], m.ResponseNonce) + } + if m.ErrorDetail != nil { + dAtA[i] = 0x32 + i++ + i = encodeVarintDiscovery(dAtA, i, uint64(m.ErrorDetail.Size())) + n2, err := m.ErrorDetail.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n2 + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *DiscoveryResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *DiscoveryResponse) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.VersionInfo) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintDiscovery(dAtA, i, uint64(len(m.VersionInfo))) + i += copy(dAtA[i:], m.VersionInfo) + } + if len(m.Resources) > 0 { + for _, msg := range m.Resources { + dAtA[i] = 0x12 + i++ + i = encodeVarintDiscovery(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if m.Canary { + dAtA[i] = 0x18 + i++ + if m.Canary { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i++ + } + if len(m.TypeUrl) > 0 { + dAtA[i] = 0x22 + i++ + i = encodeVarintDiscovery(dAtA, i, uint64(len(m.TypeUrl))) + i += copy(dAtA[i:], m.TypeUrl) + } + if len(m.Nonce) > 0 { + dAtA[i] = 0x2a + i++ + i = encodeVarintDiscovery(dAtA, i, uint64(len(m.Nonce))) + i += copy(dAtA[i:], m.Nonce) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *IncrementalDiscoveryRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *IncrementalDiscoveryRequest) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Node != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintDiscovery(dAtA, i, uint64(m.Node.Size())) + n3, err := m.Node.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n3 + } + if len(m.TypeUrl) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintDiscovery(dAtA, i, uint64(len(m.TypeUrl))) + i += copy(dAtA[i:], m.TypeUrl) + } + if len(m.ResourceNamesSubscribe) > 0 { + for _, s := range m.ResourceNamesSubscribe { + dAtA[i] = 0x1a + i++ + l = len(s) + for l >= 1<<7 { + dAtA[i] = uint8(uint64(l)&0x7f | 0x80) + l >>= 7 + i++ + } + dAtA[i] = uint8(l) + i++ + i += copy(dAtA[i:], s) + } + } + if len(m.ResourceNamesUnsubscribe) > 0 { + for _, s := range m.ResourceNamesUnsubscribe { + dAtA[i] = 0x22 + i++ + l = len(s) + for l >= 1<<7 { + dAtA[i] = uint8(uint64(l)&0x7f | 0x80) + l >>= 7 + i++ + } + dAtA[i] = uint8(l) + i++ + i += copy(dAtA[i:], s) + } + } + if len(m.InitialResourceVersions) > 0 { + for k, _ := range m.InitialResourceVersions { + dAtA[i] = 0x2a + i++ + v := m.InitialResourceVersions[k] + mapSize := 1 + len(k) + sovDiscovery(uint64(len(k))) + 1 + len(v) + sovDiscovery(uint64(len(v))) + i = encodeVarintDiscovery(dAtA, i, uint64(mapSize)) + dAtA[i] = 0xa + i++ + i = encodeVarintDiscovery(dAtA, i, uint64(len(k))) + i += copy(dAtA[i:], k) + dAtA[i] = 0x12 + i++ + i = encodeVarintDiscovery(dAtA, i, uint64(len(v))) + i += copy(dAtA[i:], v) + } + } + if len(m.ResponseNonce) > 0 { + dAtA[i] = 0x32 + i++ + i = encodeVarintDiscovery(dAtA, i, uint64(len(m.ResponseNonce))) + i += copy(dAtA[i:], m.ResponseNonce) + } + if m.ErrorDetail != nil { + dAtA[i] = 0x3a + i++ + i = encodeVarintDiscovery(dAtA, i, uint64(m.ErrorDetail.Size())) + n4, err := m.ErrorDetail.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n4 + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *IncrementalDiscoveryResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *IncrementalDiscoveryResponse) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.SystemVersionInfo) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintDiscovery(dAtA, i, uint64(len(m.SystemVersionInfo))) + i += copy(dAtA[i:], m.SystemVersionInfo) + } + if len(m.Resources) > 0 { + for _, msg := range m.Resources { + dAtA[i] = 0x12 + i++ + i = encodeVarintDiscovery(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if len(m.Nonce) > 0 { + dAtA[i] = 0x2a + i++ + i = encodeVarintDiscovery(dAtA, i, uint64(len(m.Nonce))) + i += copy(dAtA[i:], m.Nonce) + } + if len(m.RemovedResources) > 0 { + for _, s := range m.RemovedResources { + dAtA[i] = 0x32 + i++ + l = len(s) + for l >= 1<<7 { + dAtA[i] = uint8(uint64(l)&0x7f | 0x80) + l >>= 7 + i++ + } + dAtA[i] = uint8(l) + i++ + i += copy(dAtA[i:], s) + } + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *Resource) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Resource) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Version) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintDiscovery(dAtA, i, uint64(len(m.Version))) + i += copy(dAtA[i:], m.Version) + } + if m.Resource != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintDiscovery(dAtA, i, uint64(m.Resource.Size())) + n5, err := m.Resource.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n5 + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func encodeVarintDiscovery(dAtA []byte, offset int, v uint64) int { + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return offset + 1 +} +func (m *DiscoveryRequest) Size() (n int) { + var l int + _ = l + l = len(m.VersionInfo) + if l > 0 { + n += 1 + l + sovDiscovery(uint64(l)) + } + if m.Node != nil { + l = m.Node.Size() + n += 1 + l + sovDiscovery(uint64(l)) + } + if len(m.ResourceNames) > 0 { + for _, s := range m.ResourceNames { + l = len(s) + n += 1 + l + sovDiscovery(uint64(l)) + } + } + l = len(m.TypeUrl) + if l > 0 { + n += 1 + l + sovDiscovery(uint64(l)) + } + l = len(m.ResponseNonce) + if l > 0 { + n += 1 + l + sovDiscovery(uint64(l)) + } + if m.ErrorDetail != nil { + l = m.ErrorDetail.Size() + n += 1 + l + sovDiscovery(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *DiscoveryResponse) Size() (n int) { + var l int + _ = l + l = len(m.VersionInfo) + if l > 0 { + n += 1 + l + sovDiscovery(uint64(l)) + } + if len(m.Resources) > 0 { + for _, e := range m.Resources { + l = e.Size() + n += 1 + l + sovDiscovery(uint64(l)) + } + } + if m.Canary { + n += 2 + } + l = len(m.TypeUrl) + if l > 0 { + n += 1 + l + sovDiscovery(uint64(l)) + } + l = len(m.Nonce) + if l > 0 { + n += 1 + l + sovDiscovery(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *IncrementalDiscoveryRequest) Size() (n int) { + var l int + _ = l + if m.Node != nil { + l = m.Node.Size() + n += 1 + l + sovDiscovery(uint64(l)) + } + l = len(m.TypeUrl) + if l > 0 { + n += 1 + l + sovDiscovery(uint64(l)) + } + if len(m.ResourceNamesSubscribe) > 0 { + for _, s := range m.ResourceNamesSubscribe { + l = len(s) + n += 1 + l + sovDiscovery(uint64(l)) + } + } + if len(m.ResourceNamesUnsubscribe) > 0 { + for _, s := range m.ResourceNamesUnsubscribe { + l = len(s) + n += 1 + l + sovDiscovery(uint64(l)) + } + } + if len(m.InitialResourceVersions) > 0 { + for k, v := range m.InitialResourceVersions { + _ = k + _ = v + mapEntrySize := 1 + len(k) + sovDiscovery(uint64(len(k))) + 1 + len(v) + sovDiscovery(uint64(len(v))) + n += mapEntrySize + 1 + sovDiscovery(uint64(mapEntrySize)) + } + } + l = len(m.ResponseNonce) + if l > 0 { + n += 1 + l + sovDiscovery(uint64(l)) + } + if m.ErrorDetail != nil { + l = m.ErrorDetail.Size() + n += 1 + l + sovDiscovery(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *IncrementalDiscoveryResponse) Size() (n int) { + var l int + _ = l + l = len(m.SystemVersionInfo) + if l > 0 { + n += 1 + l + sovDiscovery(uint64(l)) + } + if len(m.Resources) > 0 { + for _, e := range m.Resources { + l = e.Size() + n += 1 + l + sovDiscovery(uint64(l)) + } + } + l = len(m.Nonce) + if l > 0 { + n += 1 + l + sovDiscovery(uint64(l)) + } + if len(m.RemovedResources) > 0 { + for _, s := range m.RemovedResources { + l = len(s) + n += 1 + l + sovDiscovery(uint64(l)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *Resource) Size() (n int) { + var l int + _ = l + l = len(m.Version) + if l > 0 { + n += 1 + l + sovDiscovery(uint64(l)) + } + if m.Resource != nil { + l = m.Resource.Size() + n += 1 + l + sovDiscovery(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func sovDiscovery(x uint64) (n int) { + for { + n++ + x >>= 7 + if x == 0 { + break + } + } + return n +} +func sozDiscovery(x uint64) (n int) { + return sovDiscovery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *DiscoveryRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDiscovery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DiscoveryRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DiscoveryRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field VersionInfo", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDiscovery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthDiscovery + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.VersionInfo = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Node", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDiscovery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDiscovery + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Node == nil { + m.Node = &core.Node{} + } + if err := m.Node.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ResourceNames", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDiscovery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthDiscovery + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ResourceNames = append(m.ResourceNames, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TypeUrl", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDiscovery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthDiscovery + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TypeUrl = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ResponseNonce", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDiscovery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthDiscovery + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ResponseNonce = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ErrorDetail", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDiscovery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDiscovery + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.ErrorDetail == nil { + m.ErrorDetail = &rpc.Status{} + } + if err := m.ErrorDetail.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipDiscovery(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthDiscovery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DiscoveryResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDiscovery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DiscoveryResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DiscoveryResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field VersionInfo", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDiscovery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthDiscovery + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.VersionInfo = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Resources", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDiscovery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDiscovery + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Resources = append(m.Resources, types.Any{}) + if err := m.Resources[len(m.Resources)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Canary", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDiscovery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.Canary = bool(v != 0) + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TypeUrl", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDiscovery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthDiscovery + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TypeUrl = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Nonce", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDiscovery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthDiscovery + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Nonce = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipDiscovery(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthDiscovery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *IncrementalDiscoveryRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDiscovery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: IncrementalDiscoveryRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: IncrementalDiscoveryRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Node", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDiscovery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDiscovery + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Node == nil { + m.Node = &core.Node{} + } + if err := m.Node.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TypeUrl", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDiscovery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthDiscovery + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TypeUrl = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ResourceNamesSubscribe", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDiscovery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthDiscovery + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ResourceNamesSubscribe = append(m.ResourceNamesSubscribe, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ResourceNamesUnsubscribe", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDiscovery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthDiscovery + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ResourceNamesUnsubscribe = append(m.ResourceNamesUnsubscribe, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field InitialResourceVersions", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDiscovery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDiscovery + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.InitialResourceVersions == nil { + m.InitialResourceVersions = make(map[string]string) + } + var mapkey string + var mapvalue string + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDiscovery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + var stringLenmapkey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDiscovery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapkey |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return ErrInvalidLengthDiscovery + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey > l { + return io.ErrUnexpectedEOF + } + mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) + iNdEx = postStringIndexmapkey + } else if fieldNum == 2 { + var stringLenmapvalue uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDiscovery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapvalue |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapvalue := int(stringLenmapvalue) + if intStringLenmapvalue < 0 { + return ErrInvalidLengthDiscovery + } + postStringIndexmapvalue := iNdEx + intStringLenmapvalue + if postStringIndexmapvalue > l { + return io.ErrUnexpectedEOF + } + mapvalue = string(dAtA[iNdEx:postStringIndexmapvalue]) + iNdEx = postStringIndexmapvalue + } else { + iNdEx = entryPreIndex + skippy, err := skipDiscovery(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthDiscovery + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.InitialResourceVersions[mapkey] = mapvalue + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ResponseNonce", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDiscovery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthDiscovery + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ResponseNonce = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ErrorDetail", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDiscovery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDiscovery + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.ErrorDetail == nil { + m.ErrorDetail = &rpc.Status{} + } + if err := m.ErrorDetail.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipDiscovery(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthDiscovery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *IncrementalDiscoveryResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDiscovery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: IncrementalDiscoveryResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: IncrementalDiscoveryResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SystemVersionInfo", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDiscovery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthDiscovery + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SystemVersionInfo = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Resources", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDiscovery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDiscovery + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Resources = append(m.Resources, Resource{}) + if err := m.Resources[len(m.Resources)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Nonce", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDiscovery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthDiscovery + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Nonce = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RemovedResources", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDiscovery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthDiscovery + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RemovedResources = append(m.RemovedResources, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipDiscovery(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthDiscovery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Resource) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDiscovery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Resource: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Resource: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDiscovery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthDiscovery + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Version = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Resource", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDiscovery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDiscovery + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Resource == nil { + m.Resource = &types.Any{} + } + if err := m.Resource.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipDiscovery(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthDiscovery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipDiscovery(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowDiscovery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowDiscovery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + return iNdEx, nil + case 1: + iNdEx += 8 + return iNdEx, nil + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowDiscovery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + iNdEx += length + if length < 0 { + return 0, ErrInvalidLengthDiscovery + } + return iNdEx, nil + case 3: + for { + var innerWire uint64 + var start int = iNdEx + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowDiscovery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + innerWire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + innerWireType := int(innerWire & 0x7) + if innerWireType == 4 { + break + } + next, err := skipDiscovery(dAtA[start:]) + if err != nil { + return 0, err + } + iNdEx = start + next + } + return iNdEx, nil + case 4: + return iNdEx, nil + case 5: + iNdEx += 4 + return iNdEx, nil + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + } + panic("unreachable") +} + +var ( + ErrInvalidLengthDiscovery = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowDiscovery = fmt.Errorf("proto: integer overflow") +) + +func init() { + proto.RegisterFile("envoy/api/v2/discovery.proto", fileDescriptor_discovery_51dc66d5d71581c9) +} + +var fileDescriptor_discovery_51dc66d5d71581c9 = []byte{ + // 633 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x54, 0xc1, 0x6a, 0xdb, 0x4c, + 0x10, 0xfe, 0xd7, 0x76, 0x1c, 0x67, 0x9d, 0xfc, 0x24, 0x5b, 0x93, 0x28, 0x6e, 0x70, 0x5d, 0x43, + 0xc1, 0x10, 0x58, 0x15, 0x97, 0x42, 0x08, 0xbd, 0x34, 0xa4, 0x85, 0xf4, 0x90, 0x83, 0x42, 0x72, + 0xe8, 0x45, 0xac, 0xe5, 0x89, 0x11, 0x95, 0x77, 0xd5, 0x5d, 0x49, 0xa0, 0x6b, 0xce, 0x7d, 0x90, + 0xbe, 0x42, 0xdf, 0x20, 0x97, 0x42, 0x9f, 0xa0, 0x14, 0x3f, 0x49, 0xd1, 0x6a, 0x37, 0xb6, 0x1a, + 0x13, 0x7c, 0xdb, 0x99, 0xf9, 0xf6, 0xdb, 0x99, 0xf9, 0x3e, 0x09, 0x1f, 0x01, 0xcf, 0x44, 0xee, + 0xb2, 0x38, 0x74, 0xb3, 0x91, 0x3b, 0x09, 0x55, 0x20, 0x32, 0x90, 0x39, 0x8d, 0xa5, 0x48, 0x04, + 0xd9, 0xd6, 0x55, 0xca, 0xe2, 0x90, 0x66, 0xa3, 0x6e, 0x15, 0x1b, 0x08, 0x09, 0xee, 0x98, 0x29, + 0x28, 0xb1, 0xdd, 0xc3, 0xa9, 0x10, 0xd3, 0x08, 0x5c, 0x1d, 0x8d, 0xd3, 0x5b, 0x97, 0x71, 0x43, + 0xd3, 0x3d, 0x30, 0x25, 0x19, 0x07, 0xae, 0x4a, 0x58, 0x92, 0x2a, 0x53, 0xe8, 0x4c, 0xc5, 0x54, + 0xe8, 0xa3, 0x5b, 0x9c, 0xca, 0xec, 0xe0, 0xae, 0x86, 0x77, 0xcf, 0x6d, 0x27, 0x1e, 0x7c, 0x4d, + 0x41, 0x25, 0xe4, 0x25, 0xde, 0xce, 0x40, 0xaa, 0x50, 0x70, 0x3f, 0xe4, 0xb7, 0xc2, 0x41, 0x7d, + 0x34, 0xdc, 0xf2, 0xda, 0x26, 0x77, 0xc1, 0x6f, 0x05, 0x39, 0xc6, 0x0d, 0x2e, 0x26, 0xe0, 0xd4, + 0xfa, 0x68, 0xd8, 0x1e, 0x1d, 0xd0, 0xe5, 0xe6, 0x69, 0xd1, 0x2e, 0xbd, 0x14, 0x13, 0xf0, 0x34, + 0x88, 0xbc, 0xc2, 0xff, 0x4b, 0x50, 0x22, 0x95, 0x01, 0xf8, 0x9c, 0xcd, 0x40, 0x39, 0xf5, 0x7e, + 0x7d, 0xb8, 0xe5, 0xed, 0xd8, 0xec, 0x65, 0x91, 0x24, 0x87, 0xb8, 0x95, 0xe4, 0x31, 0xf8, 0xa9, + 0x8c, 0x9c, 0x86, 0x7e, 0x72, 0xb3, 0x88, 0xaf, 0x65, 0x64, 0x18, 0x62, 0xc1, 0x15, 0xf8, 0x5c, + 0xf0, 0x00, 0x9c, 0x0d, 0x0d, 0xd8, 0xb1, 0xd9, 0xcb, 0x22, 0x49, 0xde, 0xe2, 0x6d, 0x90, 0x52, + 0x48, 0x7f, 0x02, 0x09, 0x0b, 0x23, 0xa7, 0xa9, 0xbb, 0x23, 0xb4, 0xdc, 0x09, 0x95, 0x71, 0x40, + 0xaf, 0xf4, 0x4e, 0xbc, 0xb6, 0xc6, 0x9d, 0x6b, 0xd8, 0xe0, 0x07, 0xc2, 0x7b, 0x4b, 0x4b, 0x28, + 0x19, 0xd7, 0xd9, 0xc2, 0x09, 0xde, 0xb2, 0x23, 0x28, 0xa7, 0xd6, 0xaf, 0x0f, 0xdb, 0xa3, 0x8e, + 0x7d, 0xcc, 0x6a, 0x43, 0xdf, 0xf3, 0xfc, 0xac, 0x71, 0xff, 0xfb, 0xc5, 0x7f, 0xde, 0x02, 0x4c, + 0xf6, 0x71, 0x33, 0x60, 0x9c, 0xc9, 0xdc, 0xa9, 0xf7, 0xd1, 0xb0, 0xe5, 0x99, 0xe8, 0xa9, 0x1d, + 0x74, 0xf0, 0xc6, 0xf2, 0xe8, 0x65, 0x30, 0xf8, 0xd6, 0xc0, 0xcf, 0x2f, 0x78, 0x20, 0x61, 0x06, + 0x3c, 0x61, 0xd1, 0x23, 0x2d, 0xad, 0x50, 0x68, 0x1d, 0xa1, 0x96, 0x5f, 0xaf, 0x55, 0x5f, 0x3f, + 0xc1, 0x4e, 0x55, 0x43, 0x5f, 0xa5, 0x63, 0x15, 0xc8, 0x70, 0x0c, 0x46, 0xcd, 0xfd, 0x8a, 0x9a, + 0x57, 0xb6, 0x4a, 0xde, 0xe1, 0xee, 0x3f, 0x37, 0x53, 0xbe, 0xb8, 0xdb, 0xd0, 0x77, 0x9d, 0xca, + 0xdd, 0xeb, 0x45, 0x9d, 0xdc, 0x21, 0x7c, 0x18, 0xf2, 0x30, 0x09, 0x59, 0xe4, 0x3f, 0xd0, 0x18, + 0x0d, 0x94, 0xb3, 0xa1, 0x77, 0xfe, 0xb1, 0x3a, 0xd5, 0x13, 0xeb, 0xa0, 0x17, 0x25, 0x95, 0x67, + 0x98, 0x6e, 0x0c, 0xd1, 0x07, 0x9e, 0xc8, 0xdc, 0x3b, 0x08, 0x57, 0x57, 0x57, 0xd8, 0xaf, 0xb9, + 0x8e, 0xfd, 0x36, 0xd7, 0xb2, 0x5f, 0xf7, 0x13, 0x3e, 0x7a, 0xaa, 0x2d, 0xb2, 0x8b, 0xeb, 0x5f, + 0x20, 0x37, 0xfe, 0x2b, 0x8e, 0x85, 0x15, 0x32, 0x16, 0xa5, 0x60, 0x44, 0x2a, 0x83, 0xd3, 0xda, + 0x09, 0x1a, 0xfc, 0x44, 0x05, 0xd9, 0xaa, 0xf9, 0x8d, 0xab, 0x29, 0x7e, 0xa6, 0x72, 0x95, 0xc0, + 0xcc, 0x5f, 0x61, 0xee, 0xbd, 0xb2, 0x74, 0xb3, 0x64, 0xf1, 0xd3, 0xc7, 0x16, 0xdf, 0xaf, 0xae, + 0xdb, 0x36, 0xfd, 0xd8, 0xe4, 0x2b, 0x1d, 0x4b, 0x8e, 0xf1, 0x9e, 0x84, 0x99, 0xc8, 0x60, 0xe2, + 0x2f, 0x98, 0x9b, 0xda, 0x06, 0xbb, 0xa6, 0x60, 0x29, 0xd5, 0xe0, 0x06, 0xb7, 0x6c, 0x40, 0x1c, + 0xbc, 0x69, 0x7a, 0x36, 0xed, 0xda, 0x90, 0xbc, 0xc6, 0x2d, 0x4b, 0x65, 0xfe, 0x48, 0x2b, 0x3f, + 0x43, 0xef, 0x01, 0x75, 0xd6, 0xf9, 0x3e, 0xef, 0xa1, 0xfb, 0x79, 0x0f, 0xfd, 0x9a, 0xf7, 0xd0, + 0x9f, 0x79, 0x0f, 0x7d, 0xae, 0x65, 0xa3, 0x71, 0x53, 0xa3, 0xdf, 0xfc, 0x0d, 0x00, 0x00, 0xff, + 0xff, 0x29, 0x86, 0xc0, 0x01, 0xaa, 0x05, 0x00, 0x00, +} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/discovery.pb.validate.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/discovery.pb.validate.go new file mode 100644 index 000000000000..e1d501a58b7a --- /dev/null +++ b/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/discovery.pb.validate.go @@ -0,0 +1,352 @@ +// Code generated by protoc-gen-validate +// source: envoy/api/v2/discovery.proto +// DO NOT EDIT!!! + +package v2 + +import ( + "bytes" + "errors" + "fmt" + "net" + "net/mail" + "net/url" + "regexp" + "strings" + "time" + "unicode/utf8" + + "github.com/gogo/protobuf/types" +) + +// ensure the imports are used +var ( + _ = bytes.MinRead + _ = errors.New("") + _ = fmt.Print + _ = utf8.UTFMax + _ = (*regexp.Regexp)(nil) + _ = (*strings.Reader)(nil) + _ = net.IPv4len + _ = time.Duration(0) + _ = (*url.URL)(nil) + _ = (*mail.Address)(nil) + _ = types.DynamicAny{} +) + +// Validate checks the field values on DiscoveryRequest with the rules defined +// in the proto definition for this message. If any rules are violated, an +// error is returned. +func (m *DiscoveryRequest) Validate() error { + if m == nil { + return nil + } + + // no validation rules for VersionInfo + + if v, ok := interface{}(m.GetNode()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return DiscoveryRequestValidationError{ + Field: "Node", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + // no validation rules for TypeUrl + + // no validation rules for ResponseNonce + + if v, ok := interface{}(m.GetErrorDetail()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return DiscoveryRequestValidationError{ + Field: "ErrorDetail", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + return nil +} + +// DiscoveryRequestValidationError is the validation error returned by +// DiscoveryRequest.Validate if the designated constraints aren't met. +type DiscoveryRequestValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e DiscoveryRequestValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sDiscoveryRequest.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = DiscoveryRequestValidationError{} + +// Validate checks the field values on DiscoveryResponse with the rules defined +// in the proto definition for this message. If any rules are violated, an +// error is returned. +func (m *DiscoveryResponse) Validate() error { + if m == nil { + return nil + } + + // no validation rules for VersionInfo + + for idx, item := range m.GetResources() { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return DiscoveryResponseValidationError{ + Field: fmt.Sprintf("Resources[%v]", idx), + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + } + + // no validation rules for Canary + + // no validation rules for TypeUrl + + // no validation rules for Nonce + + return nil +} + +// DiscoveryResponseValidationError is the validation error returned by +// DiscoveryResponse.Validate if the designated constraints aren't met. +type DiscoveryResponseValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e DiscoveryResponseValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sDiscoveryResponse.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = DiscoveryResponseValidationError{} + +// Validate checks the field values on IncrementalDiscoveryRequest with the +// rules defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *IncrementalDiscoveryRequest) Validate() error { + if m == nil { + return nil + } + + if v, ok := interface{}(m.GetNode()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return IncrementalDiscoveryRequestValidationError{ + Field: "Node", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + // no validation rules for TypeUrl + + // no validation rules for InitialResourceVersions + + // no validation rules for ResponseNonce + + if v, ok := interface{}(m.GetErrorDetail()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return IncrementalDiscoveryRequestValidationError{ + Field: "ErrorDetail", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + return nil +} + +// IncrementalDiscoveryRequestValidationError is the validation error returned +// by IncrementalDiscoveryRequest.Validate if the designated constraints +// aren't met. +type IncrementalDiscoveryRequestValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e IncrementalDiscoveryRequestValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sIncrementalDiscoveryRequest.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = IncrementalDiscoveryRequestValidationError{} + +// Validate checks the field values on IncrementalDiscoveryResponse with the +// rules defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *IncrementalDiscoveryResponse) Validate() error { + if m == nil { + return nil + } + + // no validation rules for SystemVersionInfo + + for idx, item := range m.GetResources() { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return IncrementalDiscoveryResponseValidationError{ + Field: fmt.Sprintf("Resources[%v]", idx), + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + } + + // no validation rules for Nonce + + return nil +} + +// IncrementalDiscoveryResponseValidationError is the validation error returned +// by IncrementalDiscoveryResponse.Validate if the designated constraints +// aren't met. +type IncrementalDiscoveryResponseValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e IncrementalDiscoveryResponseValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sIncrementalDiscoveryResponse.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = IncrementalDiscoveryResponseValidationError{} + +// Validate checks the field values on Resource with the rules defined in the +// proto definition for this message. If any rules are violated, an error is returned. +func (m *Resource) Validate() error { + if m == nil { + return nil + } + + // no validation rules for Version + + if v, ok := interface{}(m.GetResource()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return ResourceValidationError{ + Field: "Resource", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + return nil +} + +// ResourceValidationError is the validation error returned by +// Resource.Validate if the designated constraints aren't met. +type ResourceValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e ResourceValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sResource.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = ResourceValidationError{} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/eds.pb.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/eds.pb.go new file mode 100644 index 000000000000..9ff4080e872f --- /dev/null +++ b/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/eds.pb.go @@ -0,0 +1,1232 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: envoy/api/v2/eds.proto + +package v2 + +import proto "github.com/gogo/protobuf/proto" +import fmt "fmt" +import math "math" +import endpoint "github.com/envoyproxy/go-control-plane/envoy/api/v2/endpoint" +import _type "github.com/envoyproxy/go-control-plane/envoy/type" +import _ "github.com/gogo/googleapis/google/api" +import _ "github.com/gogo/protobuf/gogoproto" +import types "github.com/gogo/protobuf/types" +import _ "github.com/lyft/protoc-gen-validate/validate" + +import bytes "bytes" + +import context "golang.org/x/net/context" +import grpc "google.golang.org/grpc" + +import io "io" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package + +// Each route from RDS will map to a single cluster or traffic split across +// clusters using weights expressed in the RDS WeightedCluster. +// +// With EDS, each cluster is treated independently from a LB perspective, with +// LB taking place between the Localities within a cluster and at a finer +// granularity between the hosts within a locality. For a given cluster, the +// effective weight of a host is its load_balancing_weight multiplied by the +// load_balancing_weight of its Locality. +type ClusterLoadAssignment struct { + // Name of the cluster. This will be the :ref:`service_name + // ` value if specified + // in the cluster :ref:`EdsClusterConfig + // `. + ClusterName string `protobuf:"bytes,1,opt,name=cluster_name,json=clusterName,proto3" json:"cluster_name,omitempty"` + // List of endpoints to load balance to. + Endpoints []endpoint.LocalityLbEndpoints `protobuf:"bytes,2,rep,name=endpoints" json:"endpoints"` + // Load balancing policy settings. + Policy *ClusterLoadAssignment_Policy `protobuf:"bytes,4,opt,name=policy" json:"policy,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ClusterLoadAssignment) Reset() { *m = ClusterLoadAssignment{} } +func (m *ClusterLoadAssignment) String() string { return proto.CompactTextString(m) } +func (*ClusterLoadAssignment) ProtoMessage() {} +func (*ClusterLoadAssignment) Descriptor() ([]byte, []int) { + return fileDescriptor_eds_4dda14f752f4a5e3, []int{0} +} +func (m *ClusterLoadAssignment) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ClusterLoadAssignment) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ClusterLoadAssignment.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *ClusterLoadAssignment) XXX_Merge(src proto.Message) { + xxx_messageInfo_ClusterLoadAssignment.Merge(dst, src) +} +func (m *ClusterLoadAssignment) XXX_Size() int { + return m.Size() +} +func (m *ClusterLoadAssignment) XXX_DiscardUnknown() { + xxx_messageInfo_ClusterLoadAssignment.DiscardUnknown(m) +} + +var xxx_messageInfo_ClusterLoadAssignment proto.InternalMessageInfo + +func (m *ClusterLoadAssignment) GetClusterName() string { + if m != nil { + return m.ClusterName + } + return "" +} + +func (m *ClusterLoadAssignment) GetEndpoints() []endpoint.LocalityLbEndpoints { + if m != nil { + return m.Endpoints + } + return nil +} + +func (m *ClusterLoadAssignment) GetPolicy() *ClusterLoadAssignment_Policy { + if m != nil { + return m.Policy + } + return nil +} + +// Load balancing policy settings. +type ClusterLoadAssignment_Policy struct { + // Action to trim the overall incoming traffic to protect the upstream + // hosts. This action allows protection in case the hosts are unable to + // recover from an outage, or unable to autoscale or unable to handle + // incoming traffic volume for any reason. + // + // At the client each category is applied one after the other to generate + // the 'actual' drop percentage on all outgoing traffic. For example: + // + // .. code-block:: json + // + // { "drop_overloads": [ + // { "category": "throttle", "drop_percentage": 60 } + // { "category": "lb", "drop_percentage": 50 } + // ]} + // + // The actual drop percentages applied to the traffic at the clients will be + // "throttle"_drop = 60% + // "lb"_drop = 20% // 50% of the remaining 'actual' load, which is 40%. + // actual_outgoing_load = 20% // remaining after applying all categories. + DropOverloads []*ClusterLoadAssignment_Policy_DropOverload `protobuf:"bytes,2,rep,name=drop_overloads,json=dropOverloads" json:"drop_overloads,omitempty"` + // Priority levels and localities are considered overprovisioned with this + // factor (in percentage). This means that we don't consider a priority + // level or locality unhealthy until the percentage of healthy hosts + // multiplied by the overprovisioning factor drops below 100. + // With the default value 140(1.4), Envoy doesn't consider a priority level + // or a locality unhealthy until their percentage of healthy hosts drops + // below 72%. + // Read more at :ref:`priority levels ` and + // :ref:`localities `. + OverprovisioningFactor *types.UInt32Value `protobuf:"bytes,3,opt,name=overprovisioning_factor,json=overprovisioningFactor" json:"overprovisioning_factor,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ClusterLoadAssignment_Policy) Reset() { *m = ClusterLoadAssignment_Policy{} } +func (m *ClusterLoadAssignment_Policy) String() string { return proto.CompactTextString(m) } +func (*ClusterLoadAssignment_Policy) ProtoMessage() {} +func (*ClusterLoadAssignment_Policy) Descriptor() ([]byte, []int) { + return fileDescriptor_eds_4dda14f752f4a5e3, []int{0, 0} +} +func (m *ClusterLoadAssignment_Policy) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ClusterLoadAssignment_Policy) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ClusterLoadAssignment_Policy.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *ClusterLoadAssignment_Policy) XXX_Merge(src proto.Message) { + xxx_messageInfo_ClusterLoadAssignment_Policy.Merge(dst, src) +} +func (m *ClusterLoadAssignment_Policy) XXX_Size() int { + return m.Size() +} +func (m *ClusterLoadAssignment_Policy) XXX_DiscardUnknown() { + xxx_messageInfo_ClusterLoadAssignment_Policy.DiscardUnknown(m) +} + +var xxx_messageInfo_ClusterLoadAssignment_Policy proto.InternalMessageInfo + +func (m *ClusterLoadAssignment_Policy) GetDropOverloads() []*ClusterLoadAssignment_Policy_DropOverload { + if m != nil { + return m.DropOverloads + } + return nil +} + +func (m *ClusterLoadAssignment_Policy) GetOverprovisioningFactor() *types.UInt32Value { + if m != nil { + return m.OverprovisioningFactor + } + return nil +} + +type ClusterLoadAssignment_Policy_DropOverload struct { + // Identifier for the policy specifying the drop. + Category string `protobuf:"bytes,1,opt,name=category,proto3" json:"category,omitempty"` + // Percentage of traffic that should be dropped for the category. + DropPercentage *_type.FractionalPercent `protobuf:"bytes,2,opt,name=drop_percentage,json=dropPercentage" json:"drop_percentage,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ClusterLoadAssignment_Policy_DropOverload) Reset() { + *m = ClusterLoadAssignment_Policy_DropOverload{} +} +func (m *ClusterLoadAssignment_Policy_DropOverload) String() string { return proto.CompactTextString(m) } +func (*ClusterLoadAssignment_Policy_DropOverload) ProtoMessage() {} +func (*ClusterLoadAssignment_Policy_DropOverload) Descriptor() ([]byte, []int) { + return fileDescriptor_eds_4dda14f752f4a5e3, []int{0, 0, 0} +} +func (m *ClusterLoadAssignment_Policy_DropOverload) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ClusterLoadAssignment_Policy_DropOverload) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ClusterLoadAssignment_Policy_DropOverload.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *ClusterLoadAssignment_Policy_DropOverload) XXX_Merge(src proto.Message) { + xxx_messageInfo_ClusterLoadAssignment_Policy_DropOverload.Merge(dst, src) +} +func (m *ClusterLoadAssignment_Policy_DropOverload) XXX_Size() int { + return m.Size() +} +func (m *ClusterLoadAssignment_Policy_DropOverload) XXX_DiscardUnknown() { + xxx_messageInfo_ClusterLoadAssignment_Policy_DropOverload.DiscardUnknown(m) +} + +var xxx_messageInfo_ClusterLoadAssignment_Policy_DropOverload proto.InternalMessageInfo + +func (m *ClusterLoadAssignment_Policy_DropOverload) GetCategory() string { + if m != nil { + return m.Category + } + return "" +} + +func (m *ClusterLoadAssignment_Policy_DropOverload) GetDropPercentage() *_type.FractionalPercent { + if m != nil { + return m.DropPercentage + } + return nil +} + +func init() { + proto.RegisterType((*ClusterLoadAssignment)(nil), "envoy.api.v2.ClusterLoadAssignment") + proto.RegisterType((*ClusterLoadAssignment_Policy)(nil), "envoy.api.v2.ClusterLoadAssignment.Policy") + proto.RegisterType((*ClusterLoadAssignment_Policy_DropOverload)(nil), "envoy.api.v2.ClusterLoadAssignment.Policy.DropOverload") +} +func (this *ClusterLoadAssignment) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*ClusterLoadAssignment) + if !ok { + that2, ok := that.(ClusterLoadAssignment) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.ClusterName != that1.ClusterName { + return false + } + if len(this.Endpoints) != len(that1.Endpoints) { + return false + } + for i := range this.Endpoints { + if !this.Endpoints[i].Equal(&that1.Endpoints[i]) { + return false + } + } + if !this.Policy.Equal(that1.Policy) { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *ClusterLoadAssignment_Policy) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*ClusterLoadAssignment_Policy) + if !ok { + that2, ok := that.(ClusterLoadAssignment_Policy) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if len(this.DropOverloads) != len(that1.DropOverloads) { + return false + } + for i := range this.DropOverloads { + if !this.DropOverloads[i].Equal(that1.DropOverloads[i]) { + return false + } + } + if !this.OverprovisioningFactor.Equal(that1.OverprovisioningFactor) { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *ClusterLoadAssignment_Policy_DropOverload) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*ClusterLoadAssignment_Policy_DropOverload) + if !ok { + that2, ok := that.(ClusterLoadAssignment_Policy_DropOverload) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Category != that1.Category { + return false + } + if !this.DropPercentage.Equal(that1.DropPercentage) { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// Client API for EndpointDiscoveryService service + +type EndpointDiscoveryServiceClient interface { + // The resource_names field in DiscoveryRequest specifies a list of clusters + // to subscribe to updates for. + StreamEndpoints(ctx context.Context, opts ...grpc.CallOption) (EndpointDiscoveryService_StreamEndpointsClient, error) + FetchEndpoints(ctx context.Context, in *DiscoveryRequest, opts ...grpc.CallOption) (*DiscoveryResponse, error) +} + +type endpointDiscoveryServiceClient struct { + cc *grpc.ClientConn +} + +func NewEndpointDiscoveryServiceClient(cc *grpc.ClientConn) EndpointDiscoveryServiceClient { + return &endpointDiscoveryServiceClient{cc} +} + +func (c *endpointDiscoveryServiceClient) StreamEndpoints(ctx context.Context, opts ...grpc.CallOption) (EndpointDiscoveryService_StreamEndpointsClient, error) { + stream, err := c.cc.NewStream(ctx, &_EndpointDiscoveryService_serviceDesc.Streams[0], "/envoy.api.v2.EndpointDiscoveryService/StreamEndpoints", opts...) + if err != nil { + return nil, err + } + x := &endpointDiscoveryServiceStreamEndpointsClient{stream} + return x, nil +} + +type EndpointDiscoveryService_StreamEndpointsClient interface { + Send(*DiscoveryRequest) error + Recv() (*DiscoveryResponse, error) + grpc.ClientStream +} + +type endpointDiscoveryServiceStreamEndpointsClient struct { + grpc.ClientStream +} + +func (x *endpointDiscoveryServiceStreamEndpointsClient) Send(m *DiscoveryRequest) error { + return x.ClientStream.SendMsg(m) +} + +func (x *endpointDiscoveryServiceStreamEndpointsClient) Recv() (*DiscoveryResponse, error) { + m := new(DiscoveryResponse) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *endpointDiscoveryServiceClient) FetchEndpoints(ctx context.Context, in *DiscoveryRequest, opts ...grpc.CallOption) (*DiscoveryResponse, error) { + out := new(DiscoveryResponse) + err := c.cc.Invoke(ctx, "/envoy.api.v2.EndpointDiscoveryService/FetchEndpoints", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// Server API for EndpointDiscoveryService service + +type EndpointDiscoveryServiceServer interface { + // The resource_names field in DiscoveryRequest specifies a list of clusters + // to subscribe to updates for. + StreamEndpoints(EndpointDiscoveryService_StreamEndpointsServer) error + FetchEndpoints(context.Context, *DiscoveryRequest) (*DiscoveryResponse, error) +} + +func RegisterEndpointDiscoveryServiceServer(s *grpc.Server, srv EndpointDiscoveryServiceServer) { + s.RegisterService(&_EndpointDiscoveryService_serviceDesc, srv) +} + +func _EndpointDiscoveryService_StreamEndpoints_Handler(srv interface{}, stream grpc.ServerStream) error { + return srv.(EndpointDiscoveryServiceServer).StreamEndpoints(&endpointDiscoveryServiceStreamEndpointsServer{stream}) +} + +type EndpointDiscoveryService_StreamEndpointsServer interface { + Send(*DiscoveryResponse) error + Recv() (*DiscoveryRequest, error) + grpc.ServerStream +} + +type endpointDiscoveryServiceStreamEndpointsServer struct { + grpc.ServerStream +} + +func (x *endpointDiscoveryServiceStreamEndpointsServer) Send(m *DiscoveryResponse) error { + return x.ServerStream.SendMsg(m) +} + +func (x *endpointDiscoveryServiceStreamEndpointsServer) Recv() (*DiscoveryRequest, error) { + m := new(DiscoveryRequest) + if err := x.ServerStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func _EndpointDiscoveryService_FetchEndpoints_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DiscoveryRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(EndpointDiscoveryServiceServer).FetchEndpoints(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/envoy.api.v2.EndpointDiscoveryService/FetchEndpoints", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(EndpointDiscoveryServiceServer).FetchEndpoints(ctx, req.(*DiscoveryRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _EndpointDiscoveryService_serviceDesc = grpc.ServiceDesc{ + ServiceName: "envoy.api.v2.EndpointDiscoveryService", + HandlerType: (*EndpointDiscoveryServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "FetchEndpoints", + Handler: _EndpointDiscoveryService_FetchEndpoints_Handler, + }, + }, + Streams: []grpc.StreamDesc{ + { + StreamName: "StreamEndpoints", + Handler: _EndpointDiscoveryService_StreamEndpoints_Handler, + ServerStreams: true, + ClientStreams: true, + }, + }, + Metadata: "envoy/api/v2/eds.proto", +} + +func (m *ClusterLoadAssignment) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ClusterLoadAssignment) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.ClusterName) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintEds(dAtA, i, uint64(len(m.ClusterName))) + i += copy(dAtA[i:], m.ClusterName) + } + if len(m.Endpoints) > 0 { + for _, msg := range m.Endpoints { + dAtA[i] = 0x12 + i++ + i = encodeVarintEds(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if m.Policy != nil { + dAtA[i] = 0x22 + i++ + i = encodeVarintEds(dAtA, i, uint64(m.Policy.Size())) + n1, err := m.Policy.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n1 + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *ClusterLoadAssignment_Policy) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ClusterLoadAssignment_Policy) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.DropOverloads) > 0 { + for _, msg := range m.DropOverloads { + dAtA[i] = 0x12 + i++ + i = encodeVarintEds(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if m.OverprovisioningFactor != nil { + dAtA[i] = 0x1a + i++ + i = encodeVarintEds(dAtA, i, uint64(m.OverprovisioningFactor.Size())) + n2, err := m.OverprovisioningFactor.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n2 + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *ClusterLoadAssignment_Policy_DropOverload) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ClusterLoadAssignment_Policy_DropOverload) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Category) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintEds(dAtA, i, uint64(len(m.Category))) + i += copy(dAtA[i:], m.Category) + } + if m.DropPercentage != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintEds(dAtA, i, uint64(m.DropPercentage.Size())) + n3, err := m.DropPercentage.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n3 + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func encodeVarintEds(dAtA []byte, offset int, v uint64) int { + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return offset + 1 +} +func (m *ClusterLoadAssignment) Size() (n int) { + var l int + _ = l + l = len(m.ClusterName) + if l > 0 { + n += 1 + l + sovEds(uint64(l)) + } + if len(m.Endpoints) > 0 { + for _, e := range m.Endpoints { + l = e.Size() + n += 1 + l + sovEds(uint64(l)) + } + } + if m.Policy != nil { + l = m.Policy.Size() + n += 1 + l + sovEds(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *ClusterLoadAssignment_Policy) Size() (n int) { + var l int + _ = l + if len(m.DropOverloads) > 0 { + for _, e := range m.DropOverloads { + l = e.Size() + n += 1 + l + sovEds(uint64(l)) + } + } + if m.OverprovisioningFactor != nil { + l = m.OverprovisioningFactor.Size() + n += 1 + l + sovEds(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *ClusterLoadAssignment_Policy_DropOverload) Size() (n int) { + var l int + _ = l + l = len(m.Category) + if l > 0 { + n += 1 + l + sovEds(uint64(l)) + } + if m.DropPercentage != nil { + l = m.DropPercentage.Size() + n += 1 + l + sovEds(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func sovEds(x uint64) (n int) { + for { + n++ + x >>= 7 + if x == 0 { + break + } + } + return n +} +func sozEds(x uint64) (n int) { + return sovEds(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *ClusterLoadAssignment) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ClusterLoadAssignment: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ClusterLoadAssignment: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ClusterName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEds + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ClusterName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Endpoints", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthEds + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Endpoints = append(m.Endpoints, endpoint.LocalityLbEndpoints{}) + if err := m.Endpoints[len(m.Endpoints)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Policy", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthEds + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Policy == nil { + m.Policy = &ClusterLoadAssignment_Policy{} + } + if err := m.Policy.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipEds(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthEds + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ClusterLoadAssignment_Policy) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Policy: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Policy: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DropOverloads", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthEds + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DropOverloads = append(m.DropOverloads, &ClusterLoadAssignment_Policy_DropOverload{}) + if err := m.DropOverloads[len(m.DropOverloads)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OverprovisioningFactor", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthEds + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.OverprovisioningFactor == nil { + m.OverprovisioningFactor = &types.UInt32Value{} + } + if err := m.OverprovisioningFactor.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipEds(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthEds + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ClusterLoadAssignment_Policy_DropOverload) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DropOverload: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DropOverload: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Category", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEds + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Category = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DropPercentage", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthEds + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.DropPercentage == nil { + m.DropPercentage = &_type.FractionalPercent{} + } + if err := m.DropPercentage.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipEds(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthEds + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipEds(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowEds + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowEds + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + return iNdEx, nil + case 1: + iNdEx += 8 + return iNdEx, nil + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowEds + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + iNdEx += length + if length < 0 { + return 0, ErrInvalidLengthEds + } + return iNdEx, nil + case 3: + for { + var innerWire uint64 + var start int = iNdEx + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowEds + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + innerWire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + innerWireType := int(innerWire & 0x7) + if innerWireType == 4 { + break + } + next, err := skipEds(dAtA[start:]) + if err != nil { + return 0, err + } + iNdEx = start + next + } + return iNdEx, nil + case 4: + return iNdEx, nil + case 5: + iNdEx += 4 + return iNdEx, nil + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + } + panic("unreachable") +} + +var ( + ErrInvalidLengthEds = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowEds = fmt.Errorf("proto: integer overflow") +) + +func init() { proto.RegisterFile("envoy/api/v2/eds.proto", fileDescriptor_eds_4dda14f752f4a5e3) } + +var fileDescriptor_eds_4dda14f752f4a5e3 = []byte{ + // 562 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x53, 0x41, 0x8b, 0xd3, 0x40, + 0x14, 0xde, 0xc9, 0x96, 0x65, 0x77, 0xb6, 0xee, 0x4a, 0xd4, 0x6d, 0x08, 0x35, 0x5b, 0x8a, 0x42, + 0x29, 0x92, 0x48, 0xf7, 0x20, 0xec, 0xcd, 0xba, 0x16, 0x94, 0xb2, 0x96, 0x2c, 0x8a, 0x27, 0xeb, + 0x34, 0x79, 0x1b, 0x07, 0xd2, 0x99, 0x71, 0x32, 0x8d, 0xe4, 0xe0, 0xc5, 0x93, 0x77, 0xff, 0x84, + 0xe0, 0x3f, 0xf0, 0xe4, 0x71, 0x6f, 0x0a, 0xde, 0x45, 0x8a, 0x17, 0xf1, 0x4f, 0x48, 0x93, 0x49, + 0x6c, 0x5d, 0x05, 0x0f, 0xde, 0x5e, 0xe6, 0x7b, 0xdf, 0xc7, 0xf7, 0xde, 0xf7, 0x82, 0xf7, 0x80, + 0xa5, 0x3c, 0xf3, 0x88, 0xa0, 0x5e, 0xda, 0xf3, 0x20, 0x4c, 0x5c, 0x21, 0xb9, 0xe2, 0x66, 0x3d, + 0x7f, 0x77, 0x89, 0xa0, 0x6e, 0xda, 0xb3, 0x9b, 0x2b, 0x5d, 0x21, 0x4d, 0x02, 0x9e, 0x82, 0xcc, + 0x8a, 0x5e, 0xfb, 0xda, 0xaa, 0x06, 0x0b, 0x05, 0xa7, 0x4c, 0x55, 0x85, 0xee, 0xb2, 0x8a, 0x2e, + 0x95, 0x09, 0xf0, 0x04, 0xc8, 0x00, 0x2a, 0xa4, 0x19, 0x71, 0x1e, 0xc5, 0x90, 0x0b, 0x10, 0xc6, + 0xb8, 0x22, 0x8a, 0x72, 0xa6, 0x9d, 0xd8, 0x8d, 0x94, 0xc4, 0x34, 0x24, 0x0a, 0xbc, 0xb2, 0xd0, + 0xc0, 0xe5, 0x88, 0x47, 0x3c, 0x2f, 0xbd, 0x45, 0xa5, 0x5f, 0x1d, 0x2d, 0x96, 0x7f, 0x4d, 0x66, + 0xa7, 0xde, 0x0b, 0x49, 0x84, 0x00, 0xa9, 0xe5, 0xda, 0xef, 0x6a, 0xf8, 0xca, 0x9d, 0x78, 0x96, + 0x28, 0x90, 0x43, 0x4e, 0xc2, 0xdb, 0x49, 0x42, 0x23, 0x36, 0x05, 0xa6, 0xcc, 0x1b, 0xb8, 0x1e, + 0x14, 0xc0, 0x98, 0x91, 0x29, 0x58, 0xa8, 0x85, 0x3a, 0x5b, 0xfd, 0xad, 0xf7, 0xdf, 0x3f, 0xac, + 0xd7, 0xa4, 0xd1, 0x42, 0xfe, 0xb6, 0x86, 0x8f, 0xc9, 0x14, 0xcc, 0x63, 0xbc, 0x55, 0x0e, 0x98, + 0x58, 0x46, 0x6b, 0xbd, 0xb3, 0xdd, 0xeb, 0xba, 0xcb, 0x4b, 0x73, 0xab, 0xf9, 0x87, 0x3c, 0x20, + 0x31, 0x55, 0xd9, 0x70, 0x72, 0xb7, 0x64, 0xf4, 0x6b, 0x67, 0x5f, 0xf6, 0xd7, 0xfc, 0x5f, 0x12, + 0x66, 0x1f, 0x6f, 0x08, 0x1e, 0xd3, 0x20, 0xb3, 0x6a, 0x2d, 0x74, 0x5e, 0xec, 0x8f, 0x96, 0xdd, + 0x51, 0xce, 0xf0, 0x35, 0xd3, 0xfe, 0x68, 0xe0, 0x8d, 0xe2, 0xc9, 0x7c, 0x82, 0x77, 0x42, 0xc9, + 0xc5, 0x78, 0x91, 0x53, 0xcc, 0x49, 0x58, 0x7a, 0xbc, 0xf5, 0xef, 0xb2, 0xee, 0x91, 0xe4, 0xe2, + 0x81, 0xe6, 0xfb, 0x17, 0xc2, 0xa5, 0xaf, 0xc4, 0x7c, 0x8a, 0x1b, 0x0b, 0x69, 0x21, 0x79, 0x4a, + 0x13, 0xca, 0x19, 0x65, 0xd1, 0xf8, 0x94, 0x04, 0x8a, 0x4b, 0x6b, 0x3d, 0xf7, 0xdf, 0x74, 0x8b, + 0x20, 0xdc, 0x32, 0x08, 0xf7, 0xe1, 0x3d, 0xa6, 0x0e, 0x7a, 0x8f, 0x48, 0x3c, 0x03, 0xbd, 0xd5, + 0xae, 0xd1, 0x5a, 0xf3, 0xf7, 0x7e, 0xd7, 0x19, 0xe4, 0x32, 0xf6, 0x4b, 0x5c, 0x5f, 0x36, 0x60, + 0x5e, 0xc7, 0x9b, 0x01, 0x51, 0x10, 0x71, 0x99, 0x9d, 0x8f, 0xa6, 0x82, 0xcc, 0x01, 0xde, 0xcd, + 0x07, 0xd7, 0x27, 0x46, 0x22, 0xb0, 0x8c, 0xdc, 0xd0, 0x55, 0x3d, 0xf9, 0xe2, 0x00, 0xdd, 0x81, + 0x24, 0xc1, 0xe2, 0xc8, 0x48, 0x3c, 0x2a, 0xfa, 0xfc, 0x7c, 0x5d, 0xa3, 0x8a, 0x74, 0xbf, 0xb6, + 0x89, 0x2e, 0x1a, 0xbd, 0x1f, 0x08, 0x5b, 0x65, 0x68, 0x47, 0xe5, 0xd9, 0x9f, 0x80, 0x4c, 0x69, + 0x00, 0xe6, 0x63, 0xbc, 0x7b, 0xa2, 0x24, 0x90, 0x69, 0x15, 0xab, 0xe9, 0xac, 0xae, 0xb7, 0xa2, + 0xf8, 0xf0, 0x7c, 0x06, 0x89, 0xb2, 0xf7, 0xff, 0x8a, 0x27, 0x82, 0xb3, 0x04, 0xda, 0x6b, 0x1d, + 0x74, 0x13, 0x99, 0x33, 0xbc, 0x33, 0x00, 0x15, 0x3c, 0xfb, 0x8f, 0xc2, 0xed, 0x57, 0x9f, 0xbf, + 0xbd, 0x31, 0x9a, 0xed, 0xc6, 0xca, 0x1f, 0x7c, 0x58, 0x1d, 0xe0, 0x21, 0xea, 0xf6, 0x2f, 0xbd, + 0x9d, 0x3b, 0xe8, 0x6c, 0xee, 0xa0, 0x4f, 0x73, 0x07, 0x7d, 0x9d, 0x3b, 0xe8, 0x35, 0x42, 0x93, + 0x8d, 0x3c, 0xc0, 0x83, 0x9f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x05, 0x1a, 0x1d, 0x66, 0x2a, 0x04, + 0x00, 0x00, +} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/eds.pb.validate.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/eds.pb.validate.go new file mode 100644 index 000000000000..4d89c90d182e --- /dev/null +++ b/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/eds.pb.validate.go @@ -0,0 +1,238 @@ +// Code generated by protoc-gen-validate +// source: envoy/api/v2/eds.proto +// DO NOT EDIT!!! + +package v2 + +import ( + "bytes" + "errors" + "fmt" + "net" + "net/mail" + "net/url" + "regexp" + "strings" + "time" + "unicode/utf8" + + "github.com/gogo/protobuf/types" +) + +// ensure the imports are used +var ( + _ = bytes.MinRead + _ = errors.New("") + _ = fmt.Print + _ = utf8.UTFMax + _ = (*regexp.Regexp)(nil) + _ = (*strings.Reader)(nil) + _ = net.IPv4len + _ = time.Duration(0) + _ = (*url.URL)(nil) + _ = (*mail.Address)(nil) + _ = types.DynamicAny{} +) + +// Validate checks the field values on ClusterLoadAssignment with the rules +// defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *ClusterLoadAssignment) Validate() error { + if m == nil { + return nil + } + + if len(m.GetClusterName()) < 1 { + return ClusterLoadAssignmentValidationError{ + Field: "ClusterName", + Reason: "value length must be at least 1 bytes", + } + } + + for idx, item := range m.GetEndpoints() { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return ClusterLoadAssignmentValidationError{ + Field: fmt.Sprintf("Endpoints[%v]", idx), + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + } + + if v, ok := interface{}(m.GetPolicy()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return ClusterLoadAssignmentValidationError{ + Field: "Policy", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + return nil +} + +// ClusterLoadAssignmentValidationError is the validation error returned by +// ClusterLoadAssignment.Validate if the designated constraints aren't met. +type ClusterLoadAssignmentValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e ClusterLoadAssignmentValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sClusterLoadAssignment.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = ClusterLoadAssignmentValidationError{} + +// Validate checks the field values on ClusterLoadAssignment_Policy with the +// rules defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *ClusterLoadAssignment_Policy) Validate() error { + if m == nil { + return nil + } + + for idx, item := range m.GetDropOverloads() { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return ClusterLoadAssignment_PolicyValidationError{ + Field: fmt.Sprintf("DropOverloads[%v]", idx), + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + } + + if wrapper := m.GetOverprovisioningFactor(); wrapper != nil { + + if wrapper.GetValue() <= 0 { + return ClusterLoadAssignment_PolicyValidationError{ + Field: "OverprovisioningFactor", + Reason: "value must be greater than 0", + } + } + + } + + return nil +} + +// ClusterLoadAssignment_PolicyValidationError is the validation error returned +// by ClusterLoadAssignment_Policy.Validate if the designated constraints +// aren't met. +type ClusterLoadAssignment_PolicyValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e ClusterLoadAssignment_PolicyValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sClusterLoadAssignment_Policy.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = ClusterLoadAssignment_PolicyValidationError{} + +// Validate checks the field values on +// ClusterLoadAssignment_Policy_DropOverload with the rules defined in the +// proto definition for this message. If any rules are violated, an error is returned. +func (m *ClusterLoadAssignment_Policy_DropOverload) Validate() error { + if m == nil { + return nil + } + + if len(m.GetCategory()) < 1 { + return ClusterLoadAssignment_Policy_DropOverloadValidationError{ + Field: "Category", + Reason: "value length must be at least 1 bytes", + } + } + + if v, ok := interface{}(m.GetDropPercentage()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return ClusterLoadAssignment_Policy_DropOverloadValidationError{ + Field: "DropPercentage", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + return nil +} + +// ClusterLoadAssignment_Policy_DropOverloadValidationError is the validation +// error returned by ClusterLoadAssignment_Policy_DropOverload.Validate if the +// designated constraints aren't met. +type ClusterLoadAssignment_Policy_DropOverloadValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e ClusterLoadAssignment_Policy_DropOverloadValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sClusterLoadAssignment_Policy_DropOverload.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = ClusterLoadAssignment_Policy_DropOverloadValidationError{} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/endpoint/endpoint.pb.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/endpoint/endpoint.pb.go new file mode 100644 index 000000000000..1b69e0919f2a --- /dev/null +++ b/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/endpoint/endpoint.pb.go @@ -0,0 +1,1442 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: envoy/api/v2/endpoint/endpoint.proto + +package endpoint + +import proto "github.com/gogo/protobuf/proto" +import fmt "fmt" +import math "math" +import core "github.com/envoyproxy/go-control-plane/envoy/api/v2/core" +import _ "github.com/gogo/protobuf/gogoproto" +import types "github.com/gogo/protobuf/types" +import _ "github.com/lyft/protoc-gen-validate/validate" + +import bytes "bytes" + +import io "io" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package + +// Upstream host identifier. +type Endpoint struct { + // The upstream host address. + // + // .. attention:: + // + // The form of host address depends on the given cluster type. For STATIC or EDS, + // it is expected to be a direct IP address (or something resolvable by the + // specified :ref:`resolver ` + // in the Address). For LOGICAL or STRICT DNS, it is expected to be hostname, + // and will be resolved via DNS. + Address *core.Address `protobuf:"bytes,1,opt,name=address" json:"address,omitempty"` + // The optional health check configuration is used as configuration for the + // health checker to contact the health checked host. + // + // .. attention:: + // + // This takes into effect only for upstream clusters with + // :ref:`active health checking ` enabled. + HealthCheckConfig *Endpoint_HealthCheckConfig `protobuf:"bytes,2,opt,name=health_check_config,json=healthCheckConfig" json:"health_check_config,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Endpoint) Reset() { *m = Endpoint{} } +func (m *Endpoint) String() string { return proto.CompactTextString(m) } +func (*Endpoint) ProtoMessage() {} +func (*Endpoint) Descriptor() ([]byte, []int) { + return fileDescriptor_endpoint_7c5d3aaa3ee54675, []int{0} +} +func (m *Endpoint) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Endpoint) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Endpoint.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *Endpoint) XXX_Merge(src proto.Message) { + xxx_messageInfo_Endpoint.Merge(dst, src) +} +func (m *Endpoint) XXX_Size() int { + return m.Size() +} +func (m *Endpoint) XXX_DiscardUnknown() { + xxx_messageInfo_Endpoint.DiscardUnknown(m) +} + +var xxx_messageInfo_Endpoint proto.InternalMessageInfo + +func (m *Endpoint) GetAddress() *core.Address { + if m != nil { + return m.Address + } + return nil +} + +func (m *Endpoint) GetHealthCheckConfig() *Endpoint_HealthCheckConfig { + if m != nil { + return m.HealthCheckConfig + } + return nil +} + +// The optional health check configuration. +type Endpoint_HealthCheckConfig struct { + // Optional alternative health check port value. + // + // By default the health check address port of an upstream host is the same + // as the host's serving address port. This provides an alternative health + // check port. Setting this with a non-zero value allows an upstream host + // to have different health check address port. + PortValue uint32 `protobuf:"varint,1,opt,name=port_value,json=portValue,proto3" json:"port_value,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Endpoint_HealthCheckConfig) Reset() { *m = Endpoint_HealthCheckConfig{} } +func (m *Endpoint_HealthCheckConfig) String() string { return proto.CompactTextString(m) } +func (*Endpoint_HealthCheckConfig) ProtoMessage() {} +func (*Endpoint_HealthCheckConfig) Descriptor() ([]byte, []int) { + return fileDescriptor_endpoint_7c5d3aaa3ee54675, []int{0, 0} +} +func (m *Endpoint_HealthCheckConfig) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Endpoint_HealthCheckConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Endpoint_HealthCheckConfig.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *Endpoint_HealthCheckConfig) XXX_Merge(src proto.Message) { + xxx_messageInfo_Endpoint_HealthCheckConfig.Merge(dst, src) +} +func (m *Endpoint_HealthCheckConfig) XXX_Size() int { + return m.Size() +} +func (m *Endpoint_HealthCheckConfig) XXX_DiscardUnknown() { + xxx_messageInfo_Endpoint_HealthCheckConfig.DiscardUnknown(m) +} + +var xxx_messageInfo_Endpoint_HealthCheckConfig proto.InternalMessageInfo + +func (m *Endpoint_HealthCheckConfig) GetPortValue() uint32 { + if m != nil { + return m.PortValue + } + return 0 +} + +// An Endpoint that Envoy can route traffic to. +type LbEndpoint struct { + // Upstream host identifier + Endpoint *Endpoint `protobuf:"bytes,1,opt,name=endpoint" json:"endpoint,omitempty"` + // Optional health status when known and supplied by EDS server. + HealthStatus core.HealthStatus `protobuf:"varint,2,opt,name=health_status,json=healthStatus,proto3,enum=envoy.api.v2.core.HealthStatus" json:"health_status,omitempty"` + // The endpoint metadata specifies values that may be used by the load + // balancer to select endpoints in a cluster for a given request. The filter + // name should be specified as *envoy.lb*. An example boolean key-value pair + // is *canary*, providing the optional canary status of the upstream host. + // This may be matched against in a route's + // :ref:`RouteAction ` metadata_match field + // to subset the endpoints considered in cluster load balancing. + Metadata *core.Metadata `protobuf:"bytes,3,opt,name=metadata" json:"metadata,omitempty"` + // The optional load balancing weight of the upstream host, in the range 1 - + // 128. Envoy uses the load balancing weight in some of the built in load + // balancers. The load balancing weight for an endpoint is divided by the sum + // of the weights of all endpoints in the endpoint's locality to produce a + // percentage of traffic for the endpoint. This percentage is then further + // weighted by the endpoint's locality's load balancing weight from + // LocalityLbEndpoints. If unspecified, each host is presumed to have equal + // weight in a locality. + // + // .. attention:: + // + // The limit of 128 is somewhat arbitrary, but is applied due to performance + // concerns with the current implementation and can be removed when + // `this issue `_ is fixed. + LoadBalancingWeight *types.UInt32Value `protobuf:"bytes,4,opt,name=load_balancing_weight,json=loadBalancingWeight" json:"load_balancing_weight,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *LbEndpoint) Reset() { *m = LbEndpoint{} } +func (m *LbEndpoint) String() string { return proto.CompactTextString(m) } +func (*LbEndpoint) ProtoMessage() {} +func (*LbEndpoint) Descriptor() ([]byte, []int) { + return fileDescriptor_endpoint_7c5d3aaa3ee54675, []int{1} +} +func (m *LbEndpoint) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *LbEndpoint) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_LbEndpoint.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *LbEndpoint) XXX_Merge(src proto.Message) { + xxx_messageInfo_LbEndpoint.Merge(dst, src) +} +func (m *LbEndpoint) XXX_Size() int { + return m.Size() +} +func (m *LbEndpoint) XXX_DiscardUnknown() { + xxx_messageInfo_LbEndpoint.DiscardUnknown(m) +} + +var xxx_messageInfo_LbEndpoint proto.InternalMessageInfo + +func (m *LbEndpoint) GetEndpoint() *Endpoint { + if m != nil { + return m.Endpoint + } + return nil +} + +func (m *LbEndpoint) GetHealthStatus() core.HealthStatus { + if m != nil { + return m.HealthStatus + } + return core.HealthStatus_UNKNOWN +} + +func (m *LbEndpoint) GetMetadata() *core.Metadata { + if m != nil { + return m.Metadata + } + return nil +} + +func (m *LbEndpoint) GetLoadBalancingWeight() *types.UInt32Value { + if m != nil { + return m.LoadBalancingWeight + } + return nil +} + +// A group of endpoints belonging to a Locality. +// One can have multiple LocalityLbEndpoints for a locality, but this is +// generally only done if the different groups need to have different load +// balancing weights or different priorities. +type LocalityLbEndpoints struct { + // Identifies location of where the upstream hosts run. + Locality *core.Locality `protobuf:"bytes,1,opt,name=locality" json:"locality,omitempty"` + // The group of endpoints belonging to the locality specified. + LbEndpoints []LbEndpoint `protobuf:"bytes,2,rep,name=lb_endpoints,json=lbEndpoints" json:"lb_endpoints"` + // Optional: Per priority/region/zone/sub_zone weight - range 1-128. The load + // balancing weight for a locality is divided by the sum of the weights of all + // localities at the same priority level to produce the effective percentage + // of traffic for the locality. + // + // Locality weights are only considered when :ref:`locality weighted load + // balancing ` is + // configured. These weights are ignored otherwise. If no weights are + // specificed when locality weighted load balancing is enabled, the cluster is + // assumed to have a weight of 1. + // + // .. attention:: + // + // The limit of 128 is somewhat arbitrary, but is applied due to performance + // concerns with the current implementation and can be removed when + // `this issue `_ is fixed. + LoadBalancingWeight *types.UInt32Value `protobuf:"bytes,3,opt,name=load_balancing_weight,json=loadBalancingWeight" json:"load_balancing_weight,omitempty"` + // Optional: the priority for this LocalityLbEndpoints. If unspecified this will + // default to the highest priority (0). + // + // Under usual circumstances, Envoy will only select endpoints for the highest + // priority (0). In the event all endpoints for a particular priority are + // unavailable/unhealthy, Envoy will fail over to selecting endpoints for the + // next highest priority group. + // + // Priorities should range from 0 (highest) to N (lowest) without skipping. + Priority uint32 `protobuf:"varint,5,opt,name=priority,proto3" json:"priority,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *LocalityLbEndpoints) Reset() { *m = LocalityLbEndpoints{} } +func (m *LocalityLbEndpoints) String() string { return proto.CompactTextString(m) } +func (*LocalityLbEndpoints) ProtoMessage() {} +func (*LocalityLbEndpoints) Descriptor() ([]byte, []int) { + return fileDescriptor_endpoint_7c5d3aaa3ee54675, []int{2} +} +func (m *LocalityLbEndpoints) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *LocalityLbEndpoints) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_LocalityLbEndpoints.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *LocalityLbEndpoints) XXX_Merge(src proto.Message) { + xxx_messageInfo_LocalityLbEndpoints.Merge(dst, src) +} +func (m *LocalityLbEndpoints) XXX_Size() int { + return m.Size() +} +func (m *LocalityLbEndpoints) XXX_DiscardUnknown() { + xxx_messageInfo_LocalityLbEndpoints.DiscardUnknown(m) +} + +var xxx_messageInfo_LocalityLbEndpoints proto.InternalMessageInfo + +func (m *LocalityLbEndpoints) GetLocality() *core.Locality { + if m != nil { + return m.Locality + } + return nil +} + +func (m *LocalityLbEndpoints) GetLbEndpoints() []LbEndpoint { + if m != nil { + return m.LbEndpoints + } + return nil +} + +func (m *LocalityLbEndpoints) GetLoadBalancingWeight() *types.UInt32Value { + if m != nil { + return m.LoadBalancingWeight + } + return nil +} + +func (m *LocalityLbEndpoints) GetPriority() uint32 { + if m != nil { + return m.Priority + } + return 0 +} + +func init() { + proto.RegisterType((*Endpoint)(nil), "envoy.api.v2.endpoint.Endpoint") + proto.RegisterType((*Endpoint_HealthCheckConfig)(nil), "envoy.api.v2.endpoint.Endpoint.HealthCheckConfig") + proto.RegisterType((*LbEndpoint)(nil), "envoy.api.v2.endpoint.LbEndpoint") + proto.RegisterType((*LocalityLbEndpoints)(nil), "envoy.api.v2.endpoint.LocalityLbEndpoints") +} +func (this *Endpoint) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Endpoint) + if !ok { + that2, ok := that.(Endpoint) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.Address.Equal(that1.Address) { + return false + } + if !this.HealthCheckConfig.Equal(that1.HealthCheckConfig) { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *Endpoint_HealthCheckConfig) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Endpoint_HealthCheckConfig) + if !ok { + that2, ok := that.(Endpoint_HealthCheckConfig) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.PortValue != that1.PortValue { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *LbEndpoint) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*LbEndpoint) + if !ok { + that2, ok := that.(LbEndpoint) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.Endpoint.Equal(that1.Endpoint) { + return false + } + if this.HealthStatus != that1.HealthStatus { + return false + } + if !this.Metadata.Equal(that1.Metadata) { + return false + } + if !this.LoadBalancingWeight.Equal(that1.LoadBalancingWeight) { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *LocalityLbEndpoints) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*LocalityLbEndpoints) + if !ok { + that2, ok := that.(LocalityLbEndpoints) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.Locality.Equal(that1.Locality) { + return false + } + if len(this.LbEndpoints) != len(that1.LbEndpoints) { + return false + } + for i := range this.LbEndpoints { + if !this.LbEndpoints[i].Equal(&that1.LbEndpoints[i]) { + return false + } + } + if !this.LoadBalancingWeight.Equal(that1.LoadBalancingWeight) { + return false + } + if this.Priority != that1.Priority { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (m *Endpoint) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Endpoint) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Address != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintEndpoint(dAtA, i, uint64(m.Address.Size())) + n1, err := m.Address.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n1 + } + if m.HealthCheckConfig != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintEndpoint(dAtA, i, uint64(m.HealthCheckConfig.Size())) + n2, err := m.HealthCheckConfig.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n2 + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *Endpoint_HealthCheckConfig) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Endpoint_HealthCheckConfig) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.PortValue != 0 { + dAtA[i] = 0x8 + i++ + i = encodeVarintEndpoint(dAtA, i, uint64(m.PortValue)) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *LbEndpoint) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *LbEndpoint) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Endpoint != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintEndpoint(dAtA, i, uint64(m.Endpoint.Size())) + n3, err := m.Endpoint.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n3 + } + if m.HealthStatus != 0 { + dAtA[i] = 0x10 + i++ + i = encodeVarintEndpoint(dAtA, i, uint64(m.HealthStatus)) + } + if m.Metadata != nil { + dAtA[i] = 0x1a + i++ + i = encodeVarintEndpoint(dAtA, i, uint64(m.Metadata.Size())) + n4, err := m.Metadata.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n4 + } + if m.LoadBalancingWeight != nil { + dAtA[i] = 0x22 + i++ + i = encodeVarintEndpoint(dAtA, i, uint64(m.LoadBalancingWeight.Size())) + n5, err := m.LoadBalancingWeight.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n5 + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *LocalityLbEndpoints) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *LocalityLbEndpoints) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Locality != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintEndpoint(dAtA, i, uint64(m.Locality.Size())) + n6, err := m.Locality.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n6 + } + if len(m.LbEndpoints) > 0 { + for _, msg := range m.LbEndpoints { + dAtA[i] = 0x12 + i++ + i = encodeVarintEndpoint(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if m.LoadBalancingWeight != nil { + dAtA[i] = 0x1a + i++ + i = encodeVarintEndpoint(dAtA, i, uint64(m.LoadBalancingWeight.Size())) + n7, err := m.LoadBalancingWeight.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n7 + } + if m.Priority != 0 { + dAtA[i] = 0x28 + i++ + i = encodeVarintEndpoint(dAtA, i, uint64(m.Priority)) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func encodeVarintEndpoint(dAtA []byte, offset int, v uint64) int { + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return offset + 1 +} +func (m *Endpoint) Size() (n int) { + var l int + _ = l + if m.Address != nil { + l = m.Address.Size() + n += 1 + l + sovEndpoint(uint64(l)) + } + if m.HealthCheckConfig != nil { + l = m.HealthCheckConfig.Size() + n += 1 + l + sovEndpoint(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *Endpoint_HealthCheckConfig) Size() (n int) { + var l int + _ = l + if m.PortValue != 0 { + n += 1 + sovEndpoint(uint64(m.PortValue)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *LbEndpoint) Size() (n int) { + var l int + _ = l + if m.Endpoint != nil { + l = m.Endpoint.Size() + n += 1 + l + sovEndpoint(uint64(l)) + } + if m.HealthStatus != 0 { + n += 1 + sovEndpoint(uint64(m.HealthStatus)) + } + if m.Metadata != nil { + l = m.Metadata.Size() + n += 1 + l + sovEndpoint(uint64(l)) + } + if m.LoadBalancingWeight != nil { + l = m.LoadBalancingWeight.Size() + n += 1 + l + sovEndpoint(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *LocalityLbEndpoints) Size() (n int) { + var l int + _ = l + if m.Locality != nil { + l = m.Locality.Size() + n += 1 + l + sovEndpoint(uint64(l)) + } + if len(m.LbEndpoints) > 0 { + for _, e := range m.LbEndpoints { + l = e.Size() + n += 1 + l + sovEndpoint(uint64(l)) + } + } + if m.LoadBalancingWeight != nil { + l = m.LoadBalancingWeight.Size() + n += 1 + l + sovEndpoint(uint64(l)) + } + if m.Priority != 0 { + n += 1 + sovEndpoint(uint64(m.Priority)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func sovEndpoint(x uint64) (n int) { + for { + n++ + x >>= 7 + if x == 0 { + break + } + } + return n +} +func sozEndpoint(x uint64) (n int) { + return sovEndpoint(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Endpoint) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEndpoint + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Endpoint: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Endpoint: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEndpoint + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthEndpoint + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Address == nil { + m.Address = &core.Address{} + } + if err := m.Address.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field HealthCheckConfig", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEndpoint + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthEndpoint + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.HealthCheckConfig == nil { + m.HealthCheckConfig = &Endpoint_HealthCheckConfig{} + } + if err := m.HealthCheckConfig.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipEndpoint(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthEndpoint + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Endpoint_HealthCheckConfig) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEndpoint + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: HealthCheckConfig: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: HealthCheckConfig: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field PortValue", wireType) + } + m.PortValue = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEndpoint + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.PortValue |= (uint32(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipEndpoint(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthEndpoint + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *LbEndpoint) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEndpoint + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: LbEndpoint: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: LbEndpoint: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Endpoint", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEndpoint + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthEndpoint + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Endpoint == nil { + m.Endpoint = &Endpoint{} + } + if err := m.Endpoint.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field HealthStatus", wireType) + } + m.HealthStatus = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEndpoint + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.HealthStatus |= (core.HealthStatus(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Metadata", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEndpoint + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthEndpoint + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Metadata == nil { + m.Metadata = &core.Metadata{} + } + if err := m.Metadata.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LoadBalancingWeight", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEndpoint + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthEndpoint + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.LoadBalancingWeight == nil { + m.LoadBalancingWeight = &types.UInt32Value{} + } + if err := m.LoadBalancingWeight.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipEndpoint(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthEndpoint + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *LocalityLbEndpoints) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEndpoint + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: LocalityLbEndpoints: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: LocalityLbEndpoints: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Locality", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEndpoint + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthEndpoint + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Locality == nil { + m.Locality = &core.Locality{} + } + if err := m.Locality.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LbEndpoints", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEndpoint + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthEndpoint + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.LbEndpoints = append(m.LbEndpoints, LbEndpoint{}) + if err := m.LbEndpoints[len(m.LbEndpoints)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LoadBalancingWeight", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEndpoint + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthEndpoint + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.LoadBalancingWeight == nil { + m.LoadBalancingWeight = &types.UInt32Value{} + } + if err := m.LoadBalancingWeight.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Priority", wireType) + } + m.Priority = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEndpoint + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Priority |= (uint32(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipEndpoint(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthEndpoint + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipEndpoint(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowEndpoint + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowEndpoint + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + return iNdEx, nil + case 1: + iNdEx += 8 + return iNdEx, nil + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowEndpoint + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + iNdEx += length + if length < 0 { + return 0, ErrInvalidLengthEndpoint + } + return iNdEx, nil + case 3: + for { + var innerWire uint64 + var start int = iNdEx + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowEndpoint + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + innerWire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + innerWireType := int(innerWire & 0x7) + if innerWireType == 4 { + break + } + next, err := skipEndpoint(dAtA[start:]) + if err != nil { + return 0, err + } + iNdEx = start + next + } + return iNdEx, nil + case 4: + return iNdEx, nil + case 5: + iNdEx += 4 + return iNdEx, nil + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + } + panic("unreachable") +} + +var ( + ErrInvalidLengthEndpoint = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowEndpoint = fmt.Errorf("proto: integer overflow") +) + +func init() { + proto.RegisterFile("envoy/api/v2/endpoint/endpoint.proto", fileDescriptor_endpoint_7c5d3aaa3ee54675) +} + +var fileDescriptor_endpoint_7c5d3aaa3ee54675 = []byte{ + // 532 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x52, 0x41, 0x6f, 0xd3, 0x30, + 0x14, 0xc6, 0x4b, 0xbb, 0x15, 0xb7, 0x43, 0x5a, 0xca, 0x44, 0x54, 0xa6, 0x16, 0xaa, 0x09, 0x55, + 0x3d, 0x38, 0xa2, 0x43, 0xe2, 0xc0, 0x01, 0xd1, 0x81, 0x04, 0x68, 0x5c, 0x8c, 0x00, 0x89, 0x03, + 0x91, 0x93, 0x78, 0x49, 0x84, 0x89, 0xa3, 0xc4, 0xcd, 0xb4, 0xdb, 0x7e, 0x0b, 0xa7, 0xfd, 0x06, + 0x4e, 0x1c, 0x77, 0xe4, 0x17, 0x20, 0x54, 0x71, 0xe1, 0x57, 0x0c, 0xd9, 0xb1, 0xb3, 0x6e, 0xed, + 0xc4, 0x85, 0xdb, 0xb3, 0xdf, 0xf7, 0xbd, 0xf7, 0x7d, 0x9f, 0x1e, 0xdc, 0xa5, 0x69, 0xc9, 0x8f, + 0x5d, 0x92, 0x25, 0x6e, 0x39, 0x71, 0x69, 0x1a, 0x66, 0x3c, 0x49, 0x45, 0x5d, 0xa0, 0x2c, 0xe7, + 0x82, 0xdb, 0xdb, 0x0a, 0x85, 0x48, 0x96, 0xa0, 0x72, 0x82, 0x4c, 0xb3, 0x37, 0xb8, 0x44, 0x0e, + 0x78, 0x4e, 0x5d, 0x12, 0x86, 0x39, 0x2d, 0x8a, 0x8a, 0xd7, 0xdb, 0x59, 0x06, 0xf8, 0xa4, 0xa0, + 0xba, 0xbb, 0xbb, 0xdc, 0x8d, 0x29, 0x61, 0x22, 0xf6, 0x82, 0x98, 0x06, 0x9f, 0x35, 0xaa, 0x1f, + 0x71, 0x1e, 0x31, 0xea, 0xaa, 0x97, 0x3f, 0x3b, 0x74, 0x8f, 0x72, 0x92, 0x65, 0x34, 0x37, 0x3b, + 0xee, 0x94, 0x84, 0x25, 0x21, 0x11, 0xd4, 0x35, 0x85, 0x6e, 0xdc, 0x8e, 0x78, 0xc4, 0x55, 0xe9, + 0xca, 0xaa, 0xfa, 0x1d, 0xfe, 0x06, 0xb0, 0xf5, 0x42, 0x1b, 0xb0, 0x1f, 0xc1, 0x0d, 0x2d, 0xd8, + 0x01, 0xf7, 0xc0, 0xa8, 0x3d, 0xe9, 0xa1, 0x4b, 0x4e, 0xa5, 0x26, 0xf4, 0xac, 0x42, 0x60, 0x03, + 0xb5, 0x09, 0xec, 0x2e, 0xea, 0xf4, 0x02, 0x9e, 0x1e, 0x26, 0x91, 0xb3, 0xa6, 0x26, 0x3c, 0x44, + 0x2b, 0xb3, 0x42, 0x66, 0x27, 0x7a, 0xa9, 0xa8, 0xfb, 0x92, 0xb9, 0xaf, 0x88, 0x78, 0x2b, 0xbe, + 0xfa, 0xd5, 0x7b, 0x0a, 0xb7, 0x96, 0x70, 0xf6, 0x18, 0xc2, 0x8c, 0xe7, 0xc2, 0x2b, 0x09, 0x9b, + 0x51, 0x25, 0x78, 0x73, 0xda, 0xfe, 0xf6, 0xe7, 0xbb, 0xb5, 0x3e, 0x6e, 0x38, 0xe7, 0xe7, 0x16, + 0xbe, 0x29, 0xdb, 0xef, 0x65, 0x77, 0x78, 0xba, 0x06, 0xe1, 0x81, 0x5f, 0x1b, 0x7d, 0x02, 0x5b, + 0x46, 0x89, 0x76, 0x3a, 0xf8, 0x87, 0x4e, 0x5c, 0x13, 0xec, 0xe7, 0x70, 0x53, 0xfb, 0x2d, 0x04, + 0x11, 0xb3, 0x42, 0x39, 0xbd, 0x75, 0x75, 0x82, 0xca, 0xaa, 0x12, 0xfd, 0x56, 0xc1, 0x70, 0x27, + 0x5e, 0x78, 0xd9, 0x8f, 0x61, 0xeb, 0x0b, 0x15, 0x24, 0x24, 0x82, 0x38, 0x96, 0x92, 0x70, 0x77, + 0xc5, 0x80, 0x37, 0x1a, 0x82, 0x6b, 0xb0, 0xfd, 0x09, 0x6e, 0x33, 0x4e, 0x42, 0xcf, 0x27, 0x8c, + 0xa4, 0x41, 0x92, 0x46, 0xde, 0x11, 0x4d, 0xa2, 0x58, 0x38, 0x0d, 0x35, 0x65, 0x07, 0x55, 0x07, + 0x82, 0xcc, 0x81, 0xa0, 0x77, 0xaf, 0x52, 0xb1, 0x37, 0x51, 0x39, 0x4c, 0x3b, 0x32, 0x9f, 0x8d, + 0x71, 0xd3, 0x39, 0x01, 0x23, 0x80, 0xbb, 0x72, 0xd0, 0xd4, 0xcc, 0xf9, 0xa0, 0xc6, 0x0c, 0xbf, + 0xae, 0xc1, 0xee, 0x01, 0x0f, 0x08, 0x4b, 0xc4, 0xf1, 0x45, 0x64, 0x4a, 0x30, 0xd3, 0xdf, 0x3a, + 0xb3, 0x55, 0x82, 0x0d, 0x13, 0xd7, 0x60, 0xfb, 0x35, 0xec, 0x30, 0xdf, 0x33, 0xf1, 0xc9, 0xb8, + 0xac, 0x51, 0x7b, 0x72, 0xff, 0x9a, 0xc0, 0x2f, 0x56, 0x4e, 0x1b, 0x67, 0x3f, 0x07, 0x37, 0x70, + 0x9b, 0x2d, 0x88, 0xb8, 0xd6, 0xbc, 0xf5, 0x5f, 0xcc, 0xdb, 0x0f, 0x60, 0x2b, 0xcb, 0x13, 0x9e, + 0x4b, 0x93, 0x4d, 0x75, 0x51, 0x50, 0x92, 0x9a, 0x63, 0xcb, 0x39, 0x01, 0xb8, 0xee, 0x4d, 0x7b, + 0xa7, 0xf3, 0x3e, 0x38, 0x9b, 0xf7, 0xc1, 0x8f, 0x79, 0x1f, 0xfc, 0x9a, 0xf7, 0xc1, 0xc7, 0xfa, + 0x3e, 0xfc, 0x75, 0xb5, 0x7c, 0xef, 0x6f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xc8, 0xe0, 0x0f, 0x4c, + 0x4c, 0x04, 0x00, 0x00, +} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/endpoint/endpoint.pb.validate.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/endpoint/endpoint.pb.validate.go new file mode 100644 index 000000000000..c52d2f80d9f9 --- /dev/null +++ b/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/endpoint/endpoint.pb.validate.go @@ -0,0 +1,304 @@ +// Code generated by protoc-gen-validate +// source: envoy/api/v2/endpoint/endpoint.proto +// DO NOT EDIT!!! + +package endpoint + +import ( + "bytes" + "errors" + "fmt" + "net" + "net/mail" + "net/url" + "regexp" + "strings" + "time" + "unicode/utf8" + + "github.com/gogo/protobuf/types" +) + +// ensure the imports are used +var ( + _ = bytes.MinRead + _ = errors.New("") + _ = fmt.Print + _ = utf8.UTFMax + _ = (*regexp.Regexp)(nil) + _ = (*strings.Reader)(nil) + _ = net.IPv4len + _ = time.Duration(0) + _ = (*url.URL)(nil) + _ = (*mail.Address)(nil) + _ = types.DynamicAny{} +) + +// Validate checks the field values on Endpoint with the rules defined in the +// proto definition for this message. If any rules are violated, an error is returned. +func (m *Endpoint) Validate() error { + if m == nil { + return nil + } + + if v, ok := interface{}(m.GetAddress()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return EndpointValidationError{ + Field: "Address", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + if v, ok := interface{}(m.GetHealthCheckConfig()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return EndpointValidationError{ + Field: "HealthCheckConfig", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + return nil +} + +// EndpointValidationError is the validation error returned by +// Endpoint.Validate if the designated constraints aren't met. +type EndpointValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e EndpointValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sEndpoint.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = EndpointValidationError{} + +// Validate checks the field values on LbEndpoint with the rules defined in the +// proto definition for this message. If any rules are violated, an error is returned. +func (m *LbEndpoint) Validate() error { + if m == nil { + return nil + } + + if v, ok := interface{}(m.GetEndpoint()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return LbEndpointValidationError{ + Field: "Endpoint", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + // no validation rules for HealthStatus + + if v, ok := interface{}(m.GetMetadata()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return LbEndpointValidationError{ + Field: "Metadata", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + if wrapper := m.GetLoadBalancingWeight(); wrapper != nil { + + if val := wrapper.GetValue(); val < 1 || val > 128 { + return LbEndpointValidationError{ + Field: "LoadBalancingWeight", + Reason: "value must be inside range [1, 128]", + } + } + + } + + return nil +} + +// LbEndpointValidationError is the validation error returned by +// LbEndpoint.Validate if the designated constraints aren't met. +type LbEndpointValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e LbEndpointValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sLbEndpoint.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = LbEndpointValidationError{} + +// Validate checks the field values on LocalityLbEndpoints with the rules +// defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *LocalityLbEndpoints) Validate() error { + if m == nil { + return nil + } + + if v, ok := interface{}(m.GetLocality()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return LocalityLbEndpointsValidationError{ + Field: "Locality", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + for idx, item := range m.GetLbEndpoints() { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return LocalityLbEndpointsValidationError{ + Field: fmt.Sprintf("LbEndpoints[%v]", idx), + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + } + + if wrapper := m.GetLoadBalancingWeight(); wrapper != nil { + + if val := wrapper.GetValue(); val < 1 || val > 128 { + return LocalityLbEndpointsValidationError{ + Field: "LoadBalancingWeight", + Reason: "value must be inside range [1, 128]", + } + } + + } + + if m.GetPriority() > 128 { + return LocalityLbEndpointsValidationError{ + Field: "Priority", + Reason: "value must be less than or equal to 128", + } + } + + return nil +} + +// LocalityLbEndpointsValidationError is the validation error returned by +// LocalityLbEndpoints.Validate if the designated constraints aren't met. +type LocalityLbEndpointsValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e LocalityLbEndpointsValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sLocalityLbEndpoints.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = LocalityLbEndpointsValidationError{} + +// Validate checks the field values on Endpoint_HealthCheckConfig with the +// rules defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *Endpoint_HealthCheckConfig) Validate() error { + if m == nil { + return nil + } + + if m.GetPortValue() > 65535 { + return Endpoint_HealthCheckConfigValidationError{ + Field: "PortValue", + Reason: "value must be less than or equal to 65535", + } + } + + return nil +} + +// Endpoint_HealthCheckConfigValidationError is the validation error returned +// by Endpoint_HealthCheckConfig.Validate if the designated constraints aren't met. +type Endpoint_HealthCheckConfigValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e Endpoint_HealthCheckConfigValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sEndpoint_HealthCheckConfig.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = Endpoint_HealthCheckConfigValidationError{} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/endpoint/load_report.pb.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/endpoint/load_report.pb.go new file mode 100644 index 000000000000..d50374b3849b --- /dev/null +++ b/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/endpoint/load_report.pb.go @@ -0,0 +1,1866 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: envoy/api/v2/endpoint/load_report.proto + +package endpoint + +import proto "github.com/gogo/protobuf/proto" +import fmt "fmt" +import math "math" +import core "github.com/envoyproxy/go-control-plane/envoy/api/v2/core" +import _ "github.com/gogo/protobuf/gogoproto" +import types "github.com/gogo/protobuf/types" +import _ "github.com/lyft/protoc-gen-validate/validate" + +import encoding_binary "encoding/binary" + +import io "io" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package + +// These are stats Envoy reports to GLB every so often. Report frequency is +// defined by +// :ref:`LoadStatsResponse.load_reporting_interval`. +// Stats per upstream region/zone and optionally per subzone. +// [#not-implemented-hide:] Not configuration. TBD how to doc proto APIs. +type UpstreamLocalityStats struct { + // Name of zone, region and optionally endpoint group these metrics were + // collected from. Zone and region names could be empty if unknown. + Locality *core.Locality `protobuf:"bytes,1,opt,name=locality" json:"locality,omitempty"` + // The total number of requests sent by this Envoy since the last report. This + // information is aggregated over all the upstream Endpoints. total_requests + // can be inferred from: + // + // .. code-block:: none + // + // total_requests = total_successful_requests + total_requests_in_progress + + // total_error_requests + // + // The total number of requests successfully completed by the endpoints in the + // locality. + TotalSuccessfulRequests uint64 `protobuf:"varint,2,opt,name=total_successful_requests,json=totalSuccessfulRequests,proto3" json:"total_successful_requests,omitempty"` + // The total number of unfinished requests + TotalRequestsInProgress uint64 `protobuf:"varint,3,opt,name=total_requests_in_progress,json=totalRequestsInProgress,proto3" json:"total_requests_in_progress,omitempty"` + // The total number of requests that failed due to errors at the endpoint, + // aggregated over all endpoints in the locality. + TotalErrorRequests uint64 `protobuf:"varint,4,opt,name=total_error_requests,json=totalErrorRequests,proto3" json:"total_error_requests,omitempty"` + // Stats for multi-dimensional load balancing. + LoadMetricStats []*EndpointLoadMetricStats `protobuf:"bytes,5,rep,name=load_metric_stats,json=loadMetricStats" json:"load_metric_stats,omitempty"` + // Endpoint granularity stats information for this locality. This information + // is populated if the Server requests it by setting + // :ref:`LoadStatsResponse.report_endpoint_granularity`. + UpstreamEndpointStats []*UpstreamEndpointStats `protobuf:"bytes,7,rep,name=upstream_endpoint_stats,json=upstreamEndpointStats" json:"upstream_endpoint_stats,omitempty"` + // [#not-implemented-hide:] The priority of the endpoint group these metrics + // were collected from. + Priority uint32 `protobuf:"varint,6,opt,name=priority,proto3" json:"priority,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *UpstreamLocalityStats) Reset() { *m = UpstreamLocalityStats{} } +func (m *UpstreamLocalityStats) String() string { return proto.CompactTextString(m) } +func (*UpstreamLocalityStats) ProtoMessage() {} +func (*UpstreamLocalityStats) Descriptor() ([]byte, []int) { + return fileDescriptor_load_report_f37a4b76945e0aeb, []int{0} +} +func (m *UpstreamLocalityStats) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *UpstreamLocalityStats) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_UpstreamLocalityStats.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *UpstreamLocalityStats) XXX_Merge(src proto.Message) { + xxx_messageInfo_UpstreamLocalityStats.Merge(dst, src) +} +func (m *UpstreamLocalityStats) XXX_Size() int { + return m.Size() +} +func (m *UpstreamLocalityStats) XXX_DiscardUnknown() { + xxx_messageInfo_UpstreamLocalityStats.DiscardUnknown(m) +} + +var xxx_messageInfo_UpstreamLocalityStats proto.InternalMessageInfo + +func (m *UpstreamLocalityStats) GetLocality() *core.Locality { + if m != nil { + return m.Locality + } + return nil +} + +func (m *UpstreamLocalityStats) GetTotalSuccessfulRequests() uint64 { + if m != nil { + return m.TotalSuccessfulRequests + } + return 0 +} + +func (m *UpstreamLocalityStats) GetTotalRequestsInProgress() uint64 { + if m != nil { + return m.TotalRequestsInProgress + } + return 0 +} + +func (m *UpstreamLocalityStats) GetTotalErrorRequests() uint64 { + if m != nil { + return m.TotalErrorRequests + } + return 0 +} + +func (m *UpstreamLocalityStats) GetLoadMetricStats() []*EndpointLoadMetricStats { + if m != nil { + return m.LoadMetricStats + } + return nil +} + +func (m *UpstreamLocalityStats) GetUpstreamEndpointStats() []*UpstreamEndpointStats { + if m != nil { + return m.UpstreamEndpointStats + } + return nil +} + +func (m *UpstreamLocalityStats) GetPriority() uint32 { + if m != nil { + return m.Priority + } + return 0 +} + +type UpstreamEndpointStats struct { + // Upstream host address. + Address *core.Address `protobuf:"bytes,1,opt,name=address" json:"address,omitempty"` + // The total number of requests successfully completed by the endpoint. A + // single HTTP or gRPC request or stream is counted as one request. A TCP + // connection is also treated as one request. There is no explicit + // total_requests field below for an endpoint, but it may be inferred from: + // + // .. code-block:: none + // + // total_requests = total_successful_requests + total_requests_in_progress + + // total_error_requests + // + // The total number of requests successfully completed by the endpoints in the + // locality. These include non-5xx responses for HTTP, where errors + // originate at the client and the endpoint responded successfully. For gRPC, + // the grpc-status values are those not covered by total_error_requests below. + TotalSuccessfulRequests uint64 `protobuf:"varint,2,opt,name=total_successful_requests,json=totalSuccessfulRequests,proto3" json:"total_successful_requests,omitempty"` + // The total number of unfinished requests for this endpoint. + TotalRequestsInProgress uint64 `protobuf:"varint,3,opt,name=total_requests_in_progress,json=totalRequestsInProgress,proto3" json:"total_requests_in_progress,omitempty"` + // The total number of requests that failed due to errors at the endpoint. + // For HTTP these are responses with 5xx status codes and for gRPC the + // grpc-status values: + // + // - DeadlineExceeded + // - Unimplemented + // - Internal + // - Unavailable + // - Unknown + // - DataLoss + TotalErrorRequests uint64 `protobuf:"varint,4,opt,name=total_error_requests,json=totalErrorRequests,proto3" json:"total_error_requests,omitempty"` + // Stats for multi-dimensional load balancing. + LoadMetricStats []*EndpointLoadMetricStats `protobuf:"bytes,5,rep,name=load_metric_stats,json=loadMetricStats" json:"load_metric_stats,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *UpstreamEndpointStats) Reset() { *m = UpstreamEndpointStats{} } +func (m *UpstreamEndpointStats) String() string { return proto.CompactTextString(m) } +func (*UpstreamEndpointStats) ProtoMessage() {} +func (*UpstreamEndpointStats) Descriptor() ([]byte, []int) { + return fileDescriptor_load_report_f37a4b76945e0aeb, []int{1} +} +func (m *UpstreamEndpointStats) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *UpstreamEndpointStats) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_UpstreamEndpointStats.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *UpstreamEndpointStats) XXX_Merge(src proto.Message) { + xxx_messageInfo_UpstreamEndpointStats.Merge(dst, src) +} +func (m *UpstreamEndpointStats) XXX_Size() int { + return m.Size() +} +func (m *UpstreamEndpointStats) XXX_DiscardUnknown() { + xxx_messageInfo_UpstreamEndpointStats.DiscardUnknown(m) +} + +var xxx_messageInfo_UpstreamEndpointStats proto.InternalMessageInfo + +func (m *UpstreamEndpointStats) GetAddress() *core.Address { + if m != nil { + return m.Address + } + return nil +} + +func (m *UpstreamEndpointStats) GetTotalSuccessfulRequests() uint64 { + if m != nil { + return m.TotalSuccessfulRequests + } + return 0 +} + +func (m *UpstreamEndpointStats) GetTotalRequestsInProgress() uint64 { + if m != nil { + return m.TotalRequestsInProgress + } + return 0 +} + +func (m *UpstreamEndpointStats) GetTotalErrorRequests() uint64 { + if m != nil { + return m.TotalErrorRequests + } + return 0 +} + +func (m *UpstreamEndpointStats) GetLoadMetricStats() []*EndpointLoadMetricStats { + if m != nil { + return m.LoadMetricStats + } + return nil +} + +// [#not-implemented-hide:] Not configuration. TBD how to doc proto APIs. +type EndpointLoadMetricStats struct { + // Name of the metric; may be empty. + MetricName string `protobuf:"bytes,1,opt,name=metric_name,json=metricName,proto3" json:"metric_name,omitempty"` + // Number of calls that finished and included this metric. + NumRequestsFinishedWithMetric uint64 `protobuf:"varint,2,opt,name=num_requests_finished_with_metric,json=numRequestsFinishedWithMetric,proto3" json:"num_requests_finished_with_metric,omitempty"` + // Sum of metric values across all calls that finished with this metric for + // load_reporting_interval. + TotalMetricValue float64 `protobuf:"fixed64,3,opt,name=total_metric_value,json=totalMetricValue,proto3" json:"total_metric_value,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *EndpointLoadMetricStats) Reset() { *m = EndpointLoadMetricStats{} } +func (m *EndpointLoadMetricStats) String() string { return proto.CompactTextString(m) } +func (*EndpointLoadMetricStats) ProtoMessage() {} +func (*EndpointLoadMetricStats) Descriptor() ([]byte, []int) { + return fileDescriptor_load_report_f37a4b76945e0aeb, []int{2} +} +func (m *EndpointLoadMetricStats) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EndpointLoadMetricStats) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EndpointLoadMetricStats.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *EndpointLoadMetricStats) XXX_Merge(src proto.Message) { + xxx_messageInfo_EndpointLoadMetricStats.Merge(dst, src) +} +func (m *EndpointLoadMetricStats) XXX_Size() int { + return m.Size() +} +func (m *EndpointLoadMetricStats) XXX_DiscardUnknown() { + xxx_messageInfo_EndpointLoadMetricStats.DiscardUnknown(m) +} + +var xxx_messageInfo_EndpointLoadMetricStats proto.InternalMessageInfo + +func (m *EndpointLoadMetricStats) GetMetricName() string { + if m != nil { + return m.MetricName + } + return "" +} + +func (m *EndpointLoadMetricStats) GetNumRequestsFinishedWithMetric() uint64 { + if m != nil { + return m.NumRequestsFinishedWithMetric + } + return 0 +} + +func (m *EndpointLoadMetricStats) GetTotalMetricValue() float64 { + if m != nil { + return m.TotalMetricValue + } + return 0 +} + +// Per cluster load stats. Envoy reports these stats a management server in a +// :ref:`LoadStatsRequest` +// [#not-implemented-hide:] Not configuration. TBD how to doc proto APIs. +type ClusterStats struct { + // The name of the cluster. + ClusterName string `protobuf:"bytes,1,opt,name=cluster_name,json=clusterName,proto3" json:"cluster_name,omitempty"` + // Need at least one. + UpstreamLocalityStats []*UpstreamLocalityStats `protobuf:"bytes,2,rep,name=upstream_locality_stats,json=upstreamLocalityStats" json:"upstream_locality_stats,omitempty"` + // Cluster-level stats such as total_successful_requests may be computed by + // summing upstream_locality_stats. In addition, below there are additional + // cluster-wide stats. The following total_requests equality holds at the + // cluster-level: + // + // .. code-block:: none + // + // sum_locality(total_successful_requests) + sum_locality(total_requests_in_progress) + + // sum_locality(total_error_requests) + total_dropped_requests` + // + // The total number of dropped requests. This covers requests + // deliberately dropped by the drop_overload policy and circuit breaking. + TotalDroppedRequests uint64 `protobuf:"varint,3,opt,name=total_dropped_requests,json=totalDroppedRequests,proto3" json:"total_dropped_requests,omitempty"` + // Information about deliberately dropped requests for each category specified + // in the DropOverload policy. + DroppedRequests []*ClusterStats_DroppedRequests `protobuf:"bytes,5,rep,name=dropped_requests,json=droppedRequests" json:"dropped_requests,omitempty"` + // Period over which the actual load report occurred. This will be guaranteed to include every + // request reported. Due to system load and delays between the *LoadStatsRequest* sent from Envoy + // and the *LoadStatsResponse* message sent from the management server, this may be longer than + // the requested load reporting interval in the *LoadStatsResponse*. + LoadReportInterval *types.Duration `protobuf:"bytes,4,opt,name=load_report_interval,json=loadReportInterval" json:"load_report_interval,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ClusterStats) Reset() { *m = ClusterStats{} } +func (m *ClusterStats) String() string { return proto.CompactTextString(m) } +func (*ClusterStats) ProtoMessage() {} +func (*ClusterStats) Descriptor() ([]byte, []int) { + return fileDescriptor_load_report_f37a4b76945e0aeb, []int{3} +} +func (m *ClusterStats) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ClusterStats) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ClusterStats.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *ClusterStats) XXX_Merge(src proto.Message) { + xxx_messageInfo_ClusterStats.Merge(dst, src) +} +func (m *ClusterStats) XXX_Size() int { + return m.Size() +} +func (m *ClusterStats) XXX_DiscardUnknown() { + xxx_messageInfo_ClusterStats.DiscardUnknown(m) +} + +var xxx_messageInfo_ClusterStats proto.InternalMessageInfo + +func (m *ClusterStats) GetClusterName() string { + if m != nil { + return m.ClusterName + } + return "" +} + +func (m *ClusterStats) GetUpstreamLocalityStats() []*UpstreamLocalityStats { + if m != nil { + return m.UpstreamLocalityStats + } + return nil +} + +func (m *ClusterStats) GetTotalDroppedRequests() uint64 { + if m != nil { + return m.TotalDroppedRequests + } + return 0 +} + +func (m *ClusterStats) GetDroppedRequests() []*ClusterStats_DroppedRequests { + if m != nil { + return m.DroppedRequests + } + return nil +} + +func (m *ClusterStats) GetLoadReportInterval() *types.Duration { + if m != nil { + return m.LoadReportInterval + } + return nil +} + +type ClusterStats_DroppedRequests struct { + // Identifier for the policy specifying the drop. + Category string `protobuf:"bytes,1,opt,name=category,proto3" json:"category,omitempty"` + // Total number of deliberately dropped requests for the category. + DroppedCount uint64 `protobuf:"varint,2,opt,name=dropped_count,json=droppedCount,proto3" json:"dropped_count,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ClusterStats_DroppedRequests) Reset() { *m = ClusterStats_DroppedRequests{} } +func (m *ClusterStats_DroppedRequests) String() string { return proto.CompactTextString(m) } +func (*ClusterStats_DroppedRequests) ProtoMessage() {} +func (*ClusterStats_DroppedRequests) Descriptor() ([]byte, []int) { + return fileDescriptor_load_report_f37a4b76945e0aeb, []int{3, 0} +} +func (m *ClusterStats_DroppedRequests) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ClusterStats_DroppedRequests) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ClusterStats_DroppedRequests.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *ClusterStats_DroppedRequests) XXX_Merge(src proto.Message) { + xxx_messageInfo_ClusterStats_DroppedRequests.Merge(dst, src) +} +func (m *ClusterStats_DroppedRequests) XXX_Size() int { + return m.Size() +} +func (m *ClusterStats_DroppedRequests) XXX_DiscardUnknown() { + xxx_messageInfo_ClusterStats_DroppedRequests.DiscardUnknown(m) +} + +var xxx_messageInfo_ClusterStats_DroppedRequests proto.InternalMessageInfo + +func (m *ClusterStats_DroppedRequests) GetCategory() string { + if m != nil { + return m.Category + } + return "" +} + +func (m *ClusterStats_DroppedRequests) GetDroppedCount() uint64 { + if m != nil { + return m.DroppedCount + } + return 0 +} + +func init() { + proto.RegisterType((*UpstreamLocalityStats)(nil), "envoy.api.v2.endpoint.UpstreamLocalityStats") + proto.RegisterType((*UpstreamEndpointStats)(nil), "envoy.api.v2.endpoint.UpstreamEndpointStats") + proto.RegisterType((*EndpointLoadMetricStats)(nil), "envoy.api.v2.endpoint.EndpointLoadMetricStats") + proto.RegisterType((*ClusterStats)(nil), "envoy.api.v2.endpoint.ClusterStats") + proto.RegisterType((*ClusterStats_DroppedRequests)(nil), "envoy.api.v2.endpoint.ClusterStats.DroppedRequests") +} +func (m *UpstreamLocalityStats) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *UpstreamLocalityStats) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Locality != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintLoadReport(dAtA, i, uint64(m.Locality.Size())) + n1, err := m.Locality.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n1 + } + if m.TotalSuccessfulRequests != 0 { + dAtA[i] = 0x10 + i++ + i = encodeVarintLoadReport(dAtA, i, uint64(m.TotalSuccessfulRequests)) + } + if m.TotalRequestsInProgress != 0 { + dAtA[i] = 0x18 + i++ + i = encodeVarintLoadReport(dAtA, i, uint64(m.TotalRequestsInProgress)) + } + if m.TotalErrorRequests != 0 { + dAtA[i] = 0x20 + i++ + i = encodeVarintLoadReport(dAtA, i, uint64(m.TotalErrorRequests)) + } + if len(m.LoadMetricStats) > 0 { + for _, msg := range m.LoadMetricStats { + dAtA[i] = 0x2a + i++ + i = encodeVarintLoadReport(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if m.Priority != 0 { + dAtA[i] = 0x30 + i++ + i = encodeVarintLoadReport(dAtA, i, uint64(m.Priority)) + } + if len(m.UpstreamEndpointStats) > 0 { + for _, msg := range m.UpstreamEndpointStats { + dAtA[i] = 0x3a + i++ + i = encodeVarintLoadReport(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *UpstreamEndpointStats) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *UpstreamEndpointStats) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Address != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintLoadReport(dAtA, i, uint64(m.Address.Size())) + n2, err := m.Address.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n2 + } + if m.TotalSuccessfulRequests != 0 { + dAtA[i] = 0x10 + i++ + i = encodeVarintLoadReport(dAtA, i, uint64(m.TotalSuccessfulRequests)) + } + if m.TotalRequestsInProgress != 0 { + dAtA[i] = 0x18 + i++ + i = encodeVarintLoadReport(dAtA, i, uint64(m.TotalRequestsInProgress)) + } + if m.TotalErrorRequests != 0 { + dAtA[i] = 0x20 + i++ + i = encodeVarintLoadReport(dAtA, i, uint64(m.TotalErrorRequests)) + } + if len(m.LoadMetricStats) > 0 { + for _, msg := range m.LoadMetricStats { + dAtA[i] = 0x2a + i++ + i = encodeVarintLoadReport(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *EndpointLoadMetricStats) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *EndpointLoadMetricStats) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.MetricName) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintLoadReport(dAtA, i, uint64(len(m.MetricName))) + i += copy(dAtA[i:], m.MetricName) + } + if m.NumRequestsFinishedWithMetric != 0 { + dAtA[i] = 0x10 + i++ + i = encodeVarintLoadReport(dAtA, i, uint64(m.NumRequestsFinishedWithMetric)) + } + if m.TotalMetricValue != 0 { + dAtA[i] = 0x19 + i++ + encoding_binary.LittleEndian.PutUint64(dAtA[i:], uint64(math.Float64bits(float64(m.TotalMetricValue)))) + i += 8 + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *ClusterStats) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ClusterStats) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.ClusterName) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintLoadReport(dAtA, i, uint64(len(m.ClusterName))) + i += copy(dAtA[i:], m.ClusterName) + } + if len(m.UpstreamLocalityStats) > 0 { + for _, msg := range m.UpstreamLocalityStats { + dAtA[i] = 0x12 + i++ + i = encodeVarintLoadReport(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if m.TotalDroppedRequests != 0 { + dAtA[i] = 0x18 + i++ + i = encodeVarintLoadReport(dAtA, i, uint64(m.TotalDroppedRequests)) + } + if m.LoadReportInterval != nil { + dAtA[i] = 0x22 + i++ + i = encodeVarintLoadReport(dAtA, i, uint64(m.LoadReportInterval.Size())) + n3, err := m.LoadReportInterval.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n3 + } + if len(m.DroppedRequests) > 0 { + for _, msg := range m.DroppedRequests { + dAtA[i] = 0x2a + i++ + i = encodeVarintLoadReport(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *ClusterStats_DroppedRequests) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ClusterStats_DroppedRequests) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Category) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintLoadReport(dAtA, i, uint64(len(m.Category))) + i += copy(dAtA[i:], m.Category) + } + if m.DroppedCount != 0 { + dAtA[i] = 0x10 + i++ + i = encodeVarintLoadReport(dAtA, i, uint64(m.DroppedCount)) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func encodeVarintLoadReport(dAtA []byte, offset int, v uint64) int { + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return offset + 1 +} +func (m *UpstreamLocalityStats) Size() (n int) { + var l int + _ = l + if m.Locality != nil { + l = m.Locality.Size() + n += 1 + l + sovLoadReport(uint64(l)) + } + if m.TotalSuccessfulRequests != 0 { + n += 1 + sovLoadReport(uint64(m.TotalSuccessfulRequests)) + } + if m.TotalRequestsInProgress != 0 { + n += 1 + sovLoadReport(uint64(m.TotalRequestsInProgress)) + } + if m.TotalErrorRequests != 0 { + n += 1 + sovLoadReport(uint64(m.TotalErrorRequests)) + } + if len(m.LoadMetricStats) > 0 { + for _, e := range m.LoadMetricStats { + l = e.Size() + n += 1 + l + sovLoadReport(uint64(l)) + } + } + if m.Priority != 0 { + n += 1 + sovLoadReport(uint64(m.Priority)) + } + if len(m.UpstreamEndpointStats) > 0 { + for _, e := range m.UpstreamEndpointStats { + l = e.Size() + n += 1 + l + sovLoadReport(uint64(l)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *UpstreamEndpointStats) Size() (n int) { + var l int + _ = l + if m.Address != nil { + l = m.Address.Size() + n += 1 + l + sovLoadReport(uint64(l)) + } + if m.TotalSuccessfulRequests != 0 { + n += 1 + sovLoadReport(uint64(m.TotalSuccessfulRequests)) + } + if m.TotalRequestsInProgress != 0 { + n += 1 + sovLoadReport(uint64(m.TotalRequestsInProgress)) + } + if m.TotalErrorRequests != 0 { + n += 1 + sovLoadReport(uint64(m.TotalErrorRequests)) + } + if len(m.LoadMetricStats) > 0 { + for _, e := range m.LoadMetricStats { + l = e.Size() + n += 1 + l + sovLoadReport(uint64(l)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *EndpointLoadMetricStats) Size() (n int) { + var l int + _ = l + l = len(m.MetricName) + if l > 0 { + n += 1 + l + sovLoadReport(uint64(l)) + } + if m.NumRequestsFinishedWithMetric != 0 { + n += 1 + sovLoadReport(uint64(m.NumRequestsFinishedWithMetric)) + } + if m.TotalMetricValue != 0 { + n += 9 + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *ClusterStats) Size() (n int) { + var l int + _ = l + l = len(m.ClusterName) + if l > 0 { + n += 1 + l + sovLoadReport(uint64(l)) + } + if len(m.UpstreamLocalityStats) > 0 { + for _, e := range m.UpstreamLocalityStats { + l = e.Size() + n += 1 + l + sovLoadReport(uint64(l)) + } + } + if m.TotalDroppedRequests != 0 { + n += 1 + sovLoadReport(uint64(m.TotalDroppedRequests)) + } + if m.LoadReportInterval != nil { + l = m.LoadReportInterval.Size() + n += 1 + l + sovLoadReport(uint64(l)) + } + if len(m.DroppedRequests) > 0 { + for _, e := range m.DroppedRequests { + l = e.Size() + n += 1 + l + sovLoadReport(uint64(l)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *ClusterStats_DroppedRequests) Size() (n int) { + var l int + _ = l + l = len(m.Category) + if l > 0 { + n += 1 + l + sovLoadReport(uint64(l)) + } + if m.DroppedCount != 0 { + n += 1 + sovLoadReport(uint64(m.DroppedCount)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func sovLoadReport(x uint64) (n int) { + for { + n++ + x >>= 7 + if x == 0 { + break + } + } + return n +} +func sozLoadReport(x uint64) (n int) { + return sovLoadReport(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *UpstreamLocalityStats) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLoadReport + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: UpstreamLocalityStats: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: UpstreamLocalityStats: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Locality", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLoadReport + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthLoadReport + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Locality == nil { + m.Locality = &core.Locality{} + } + if err := m.Locality.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TotalSuccessfulRequests", wireType) + } + m.TotalSuccessfulRequests = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLoadReport + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TotalSuccessfulRequests |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TotalRequestsInProgress", wireType) + } + m.TotalRequestsInProgress = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLoadReport + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TotalRequestsInProgress |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TotalErrorRequests", wireType) + } + m.TotalErrorRequests = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLoadReport + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TotalErrorRequests |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LoadMetricStats", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLoadReport + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthLoadReport + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.LoadMetricStats = append(m.LoadMetricStats, &EndpointLoadMetricStats{}) + if err := m.LoadMetricStats[len(m.LoadMetricStats)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Priority", wireType) + } + m.Priority = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLoadReport + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Priority |= (uint32(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field UpstreamEndpointStats", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLoadReport + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthLoadReport + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.UpstreamEndpointStats = append(m.UpstreamEndpointStats, &UpstreamEndpointStats{}) + if err := m.UpstreamEndpointStats[len(m.UpstreamEndpointStats)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipLoadReport(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthLoadReport + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *UpstreamEndpointStats) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLoadReport + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: UpstreamEndpointStats: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: UpstreamEndpointStats: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLoadReport + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthLoadReport + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Address == nil { + m.Address = &core.Address{} + } + if err := m.Address.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TotalSuccessfulRequests", wireType) + } + m.TotalSuccessfulRequests = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLoadReport + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TotalSuccessfulRequests |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TotalRequestsInProgress", wireType) + } + m.TotalRequestsInProgress = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLoadReport + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TotalRequestsInProgress |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TotalErrorRequests", wireType) + } + m.TotalErrorRequests = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLoadReport + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TotalErrorRequests |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LoadMetricStats", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLoadReport + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthLoadReport + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.LoadMetricStats = append(m.LoadMetricStats, &EndpointLoadMetricStats{}) + if err := m.LoadMetricStats[len(m.LoadMetricStats)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipLoadReport(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthLoadReport + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *EndpointLoadMetricStats) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLoadReport + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: EndpointLoadMetricStats: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EndpointLoadMetricStats: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MetricName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLoadReport + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthLoadReport + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.MetricName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field NumRequestsFinishedWithMetric", wireType) + } + m.NumRequestsFinishedWithMetric = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLoadReport + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.NumRequestsFinishedWithMetric |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 1 { + return fmt.Errorf("proto: wrong wireType = %d for field TotalMetricValue", wireType) + } + var v uint64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = uint64(encoding_binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + m.TotalMetricValue = float64(math.Float64frombits(v)) + default: + iNdEx = preIndex + skippy, err := skipLoadReport(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthLoadReport + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ClusterStats) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLoadReport + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ClusterStats: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ClusterStats: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ClusterName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLoadReport + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthLoadReport + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ClusterName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field UpstreamLocalityStats", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLoadReport + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthLoadReport + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.UpstreamLocalityStats = append(m.UpstreamLocalityStats, &UpstreamLocalityStats{}) + if err := m.UpstreamLocalityStats[len(m.UpstreamLocalityStats)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TotalDroppedRequests", wireType) + } + m.TotalDroppedRequests = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLoadReport + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TotalDroppedRequests |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LoadReportInterval", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLoadReport + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthLoadReport + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.LoadReportInterval == nil { + m.LoadReportInterval = &types.Duration{} + } + if err := m.LoadReportInterval.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DroppedRequests", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLoadReport + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthLoadReport + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DroppedRequests = append(m.DroppedRequests, &ClusterStats_DroppedRequests{}) + if err := m.DroppedRequests[len(m.DroppedRequests)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipLoadReport(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthLoadReport + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ClusterStats_DroppedRequests) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLoadReport + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DroppedRequests: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DroppedRequests: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Category", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLoadReport + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthLoadReport + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Category = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field DroppedCount", wireType) + } + m.DroppedCount = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLoadReport + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.DroppedCount |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipLoadReport(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthLoadReport + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipLoadReport(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowLoadReport + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowLoadReport + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + return iNdEx, nil + case 1: + iNdEx += 8 + return iNdEx, nil + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowLoadReport + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + iNdEx += length + if length < 0 { + return 0, ErrInvalidLengthLoadReport + } + return iNdEx, nil + case 3: + for { + var innerWire uint64 + var start int = iNdEx + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowLoadReport + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + innerWire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + innerWireType := int(innerWire & 0x7) + if innerWireType == 4 { + break + } + next, err := skipLoadReport(dAtA[start:]) + if err != nil { + return 0, err + } + iNdEx = start + next + } + return iNdEx, nil + case 4: + return iNdEx, nil + case 5: + iNdEx += 4 + return iNdEx, nil + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + } + panic("unreachable") +} + +var ( + ErrInvalidLengthLoadReport = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowLoadReport = fmt.Errorf("proto: integer overflow") +) + +func init() { + proto.RegisterFile("envoy/api/v2/endpoint/load_report.proto", fileDescriptor_load_report_f37a4b76945e0aeb) +} + +var fileDescriptor_load_report_f37a4b76945e0aeb = []byte{ + // 691 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x54, 0xcb, 0x6e, 0xd3, 0x40, + 0x14, 0x95, 0x93, 0x3e, 0xd2, 0x49, 0xaa, 0x96, 0x51, 0x4b, 0xd2, 0x00, 0x69, 0x28, 0x42, 0x64, + 0x51, 0x8d, 0x51, 0x5a, 0x09, 0x09, 0x56, 0xf4, 0x81, 0xa8, 0x28, 0x08, 0xb9, 0x02, 0x24, 0x24, + 0xb0, 0xa6, 0xf6, 0x34, 0x1d, 0xc9, 0xf1, 0x98, 0x79, 0x04, 0xf5, 0x37, 0xf8, 0x14, 0x96, 0xac, + 0x58, 0xb2, 0x64, 0xc1, 0x86, 0x1d, 0xea, 0x8e, 0x1d, 0x9f, 0x80, 0x3c, 0x0f, 0x27, 0x6e, 0x1b, + 0x89, 0x0f, 0x60, 0x37, 0xbe, 0xe7, 0x9e, 0xdc, 0x7b, 0xcf, 0xb9, 0xb9, 0xe0, 0x1e, 0x49, 0x47, + 0xec, 0xcc, 0xc7, 0x19, 0xf5, 0x47, 0x7d, 0x9f, 0xa4, 0x71, 0xc6, 0x68, 0x2a, 0xfd, 0x84, 0xe1, + 0x38, 0xe4, 0x24, 0x63, 0x5c, 0xa2, 0x8c, 0x33, 0xc9, 0xe0, 0xaa, 0x4e, 0x44, 0x38, 0xa3, 0x68, + 0xd4, 0x47, 0x2e, 0xb1, 0xbd, 0x5e, 0xe2, 0x47, 0x8c, 0x13, 0x1f, 0xc7, 0x31, 0x27, 0x42, 0x18, + 0x5e, 0xfb, 0xe6, 0xe5, 0x84, 0x63, 0x2c, 0x88, 0x45, 0x3b, 0x03, 0xc6, 0x06, 0x09, 0xf1, 0xf5, + 0xd7, 0xb1, 0x3a, 0xf1, 0x63, 0xc5, 0xb1, 0xa4, 0x2c, 0xb5, 0x78, 0x73, 0x84, 0x13, 0x1a, 0x63, + 0x49, 0x7c, 0xf7, 0xb0, 0xc0, 0xca, 0x80, 0x0d, 0x98, 0x7e, 0xfa, 0xf9, 0xcb, 0x44, 0x37, 0x7e, + 0x56, 0xc1, 0xea, 0xab, 0x4c, 0x48, 0x4e, 0xf0, 0xf0, 0x90, 0x45, 0x38, 0xa1, 0xf2, 0xec, 0x48, + 0x62, 0x29, 0xe0, 0x03, 0x50, 0x4b, 0x6c, 0xa0, 0xe5, 0x75, 0xbd, 0x5e, 0xbd, 0x7f, 0x03, 0x95, + 0x26, 0xca, 0x3b, 0x43, 0x8e, 0x13, 0x14, 0xc9, 0xf0, 0x21, 0x58, 0x93, 0x4c, 0xe2, 0x24, 0x14, + 0x2a, 0x8a, 0x88, 0x10, 0x27, 0x2a, 0x09, 0x39, 0xf9, 0xa0, 0x88, 0x90, 0xa2, 0x55, 0xe9, 0x7a, + 0xbd, 0x99, 0xa0, 0xa9, 0x13, 0x8e, 0x0a, 0x3c, 0xb0, 0x30, 0x7c, 0x04, 0xda, 0x86, 0xeb, 0x08, + 0x21, 0x4d, 0xc3, 0x8c, 0xb3, 0x41, 0xae, 0x4f, 0xab, 0x3a, 0x41, 0x76, 0x94, 0x83, 0xf4, 0xa5, + 0x85, 0xe1, 0x7d, 0xb0, 0x62, 0xc8, 0x84, 0x73, 0xc6, 0xc7, 0x35, 0x67, 0x34, 0x0d, 0x6a, 0x6c, + 0x3f, 0x87, 0x8a, 0x72, 0x6f, 0xc1, 0x35, 0xed, 0xdb, 0x90, 0x48, 0x4e, 0xa3, 0x50, 0xe4, 0x83, + 0xb7, 0x66, 0xbb, 0xd5, 0x5e, 0xbd, 0x8f, 0xd0, 0x95, 0xf6, 0xa1, 0x7d, 0xfb, 0x38, 0x64, 0x38, + 0x7e, 0xae, 0x69, 0x5a, 0xae, 0x60, 0x29, 0x29, 0x07, 0x60, 0x1b, 0xd4, 0x32, 0x4e, 0x19, 0xcf, + 0xf5, 0x9b, 0xeb, 0x7a, 0xbd, 0xc5, 0xa0, 0xf8, 0x86, 0x31, 0x68, 0x2a, 0x2b, 0x7a, 0xe8, 0x7e, + 0xd9, 0x56, 0x9f, 0xd7, 0xd5, 0x37, 0xa7, 0x54, 0x77, 0x56, 0xb9, 0x2e, 0x4c, 0xed, 0x55, 0x75, + 0x55, 0x78, 0xe3, 0x47, 0x65, 0xec, 0x6d, 0x09, 0x81, 0xdb, 0x60, 0xde, 0xee, 0x9c, 0xb5, 0xb6, + 0x7d, 0x85, 0xb5, 0x8f, 0x4d, 0x46, 0xe0, 0x52, 0xff, 0x1b, 0x6b, 0x64, 0xfd, 0xec, 0x81, 0xe6, + 0x94, 0x64, 0xb8, 0x0e, 0xea, 0xb6, 0x64, 0x8a, 0x87, 0x44, 0x8b, 0xbb, 0x10, 0x00, 0x13, 0x7a, + 0x81, 0x87, 0x04, 0x3e, 0x05, 0xb7, 0x53, 0x35, 0x1c, 0xab, 0x70, 0x42, 0x53, 0x2a, 0x4e, 0x49, + 0x1c, 0x7e, 0xa4, 0xf2, 0xd4, 0xb6, 0x6b, 0xb5, 0xbc, 0x95, 0xaa, 0xa1, 0x1b, 0xe8, 0x89, 0x4d, + 0x7b, 0x43, 0xe5, 0xa9, 0xa9, 0x07, 0x37, 0x81, 0x19, 0xdc, 0xcd, 0x38, 0xc2, 0x89, 0x22, 0x5a, + 0x49, 0x2f, 0x58, 0xd6, 0x88, 0x49, 0x7c, 0x9d, 0xc7, 0x37, 0xfe, 0x54, 0x41, 0x63, 0x37, 0x51, + 0x42, 0x12, 0x6e, 0x3a, 0xdd, 0x04, 0x8d, 0xc8, 0x7c, 0x4f, 0xb4, 0xba, 0xb3, 0xf0, 0xe5, 0xf7, + 0xd7, 0xea, 0x0c, 0xaf, 0x74, 0xbd, 0xa0, 0x6e, 0x61, 0xdd, 0x76, 0x36, 0xb1, 0xb0, 0xee, 0x8f, + 0x6e, 0x55, 0xad, 0xfc, 0xd3, 0xc2, 0x96, 0x6e, 0xcb, 0x0e, 0xc8, 0xcb, 0xcc, 0x7e, 0xf2, 0x2a, + 0x35, 0x6f, 0xbc, 0xbc, 0xe5, 0xf3, 0xb3, 0x0d, 0xae, 0x9b, 0xf1, 0x62, 0xce, 0xb2, 0x8c, 0xc4, + 0x63, 0xd7, 0xcd, 0xb2, 0x98, 0x8d, 0xd8, 0x33, 0x60, 0xe1, 0xfb, 0x33, 0xb0, 0x32, 0x71, 0x88, + 0x43, 0x9a, 0x4a, 0xc2, 0x47, 0x38, 0xd1, 0x9b, 0x52, 0xef, 0xaf, 0x21, 0x73, 0x3c, 0x91, 0x3b, + 0x9e, 0x68, 0xcf, 0x1e, 0xcf, 0x00, 0xe6, 0xb4, 0x40, 0xb3, 0x0e, 0x2c, 0x09, 0xbe, 0x07, 0xcb, + 0x97, 0x8a, 0x9b, 0x1d, 0xda, 0x9a, 0x32, 0xed, 0xa4, 0xc2, 0xe8, 0x42, 0x6f, 0xc1, 0x52, 0x5c, + 0x0e, 0xb4, 0xdf, 0x81, 0xa5, 0x8b, 0xfd, 0xdf, 0x05, 0xb5, 0x08, 0x4b, 0x32, 0x60, 0xfc, 0xec, + 0xb2, 0x23, 0x05, 0x04, 0xef, 0x80, 0x45, 0xd7, 0x59, 0xc4, 0x54, 0x2a, 0xed, 0xc6, 0x34, 0x6c, + 0x70, 0x37, 0x8f, 0xed, 0x34, 0xbe, 0x9d, 0x77, 0xbc, 0xef, 0xe7, 0x1d, 0xef, 0xd7, 0x79, 0xc7, + 0x3b, 0x9e, 0xd3, 0x33, 0x6f, 0xfd, 0x0d, 0x00, 0x00, 0xff, 0xff, 0x64, 0x96, 0x8e, 0xbf, 0xbf, + 0x06, 0x00, 0x00, +} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/endpoint/load_report.pb.validate.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/endpoint/load_report.pb.validate.go new file mode 100644 index 000000000000..13d292f22d96 --- /dev/null +++ b/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/endpoint/load_report.pb.validate.go @@ -0,0 +1,396 @@ +// Code generated by protoc-gen-validate +// source: envoy/api/v2/endpoint/load_report.proto +// DO NOT EDIT!!! + +package endpoint + +import ( + "bytes" + "errors" + "fmt" + "net" + "net/mail" + "net/url" + "regexp" + "strings" + "time" + "unicode/utf8" + + "github.com/gogo/protobuf/types" +) + +// ensure the imports are used +var ( + _ = bytes.MinRead + _ = errors.New("") + _ = fmt.Print + _ = utf8.UTFMax + _ = (*regexp.Regexp)(nil) + _ = (*strings.Reader)(nil) + _ = net.IPv4len + _ = time.Duration(0) + _ = (*url.URL)(nil) + _ = (*mail.Address)(nil) + _ = types.DynamicAny{} +) + +// Validate checks the field values on UpstreamLocalityStats with the rules +// defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *UpstreamLocalityStats) Validate() error { + if m == nil { + return nil + } + + if v, ok := interface{}(m.GetLocality()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return UpstreamLocalityStatsValidationError{ + Field: "Locality", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + // no validation rules for TotalSuccessfulRequests + + // no validation rules for TotalRequestsInProgress + + // no validation rules for TotalErrorRequests + + for idx, item := range m.GetLoadMetricStats() { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return UpstreamLocalityStatsValidationError{ + Field: fmt.Sprintf("LoadMetricStats[%v]", idx), + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + } + + for idx, item := range m.GetUpstreamEndpointStats() { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return UpstreamLocalityStatsValidationError{ + Field: fmt.Sprintf("UpstreamEndpointStats[%v]", idx), + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + } + + // no validation rules for Priority + + return nil +} + +// UpstreamLocalityStatsValidationError is the validation error returned by +// UpstreamLocalityStats.Validate if the designated constraints aren't met. +type UpstreamLocalityStatsValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e UpstreamLocalityStatsValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sUpstreamLocalityStats.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = UpstreamLocalityStatsValidationError{} + +// Validate checks the field values on UpstreamEndpointStats with the rules +// defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *UpstreamEndpointStats) Validate() error { + if m == nil { + return nil + } + + if v, ok := interface{}(m.GetAddress()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return UpstreamEndpointStatsValidationError{ + Field: "Address", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + // no validation rules for TotalSuccessfulRequests + + // no validation rules for TotalRequestsInProgress + + // no validation rules for TotalErrorRequests + + for idx, item := range m.GetLoadMetricStats() { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return UpstreamEndpointStatsValidationError{ + Field: fmt.Sprintf("LoadMetricStats[%v]", idx), + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + } + + return nil +} + +// UpstreamEndpointStatsValidationError is the validation error returned by +// UpstreamEndpointStats.Validate if the designated constraints aren't met. +type UpstreamEndpointStatsValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e UpstreamEndpointStatsValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sUpstreamEndpointStats.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = UpstreamEndpointStatsValidationError{} + +// Validate checks the field values on EndpointLoadMetricStats with the rules +// defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *EndpointLoadMetricStats) Validate() error { + if m == nil { + return nil + } + + // no validation rules for MetricName + + // no validation rules for NumRequestsFinishedWithMetric + + // no validation rules for TotalMetricValue + + return nil +} + +// EndpointLoadMetricStatsValidationError is the validation error returned by +// EndpointLoadMetricStats.Validate if the designated constraints aren't met. +type EndpointLoadMetricStatsValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e EndpointLoadMetricStatsValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sEndpointLoadMetricStats.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = EndpointLoadMetricStatsValidationError{} + +// Validate checks the field values on ClusterStats with the rules defined in +// the proto definition for this message. If any rules are violated, an error +// is returned. +func (m *ClusterStats) Validate() error { + if m == nil { + return nil + } + + if len(m.GetClusterName()) < 1 { + return ClusterStatsValidationError{ + Field: "ClusterName", + Reason: "value length must be at least 1 bytes", + } + } + + if len(m.GetUpstreamLocalityStats()) < 1 { + return ClusterStatsValidationError{ + Field: "UpstreamLocalityStats", + Reason: "value must contain at least 1 item(s)", + } + } + + for idx, item := range m.GetUpstreamLocalityStats() { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return ClusterStatsValidationError{ + Field: fmt.Sprintf("UpstreamLocalityStats[%v]", idx), + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + } + + // no validation rules for TotalDroppedRequests + + for idx, item := range m.GetDroppedRequests() { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return ClusterStatsValidationError{ + Field: fmt.Sprintf("DroppedRequests[%v]", idx), + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + } + + if v, ok := interface{}(m.GetLoadReportInterval()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return ClusterStatsValidationError{ + Field: "LoadReportInterval", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + return nil +} + +// ClusterStatsValidationError is the validation error returned by +// ClusterStats.Validate if the designated constraints aren't met. +type ClusterStatsValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e ClusterStatsValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sClusterStats.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = ClusterStatsValidationError{} + +// Validate checks the field values on ClusterStats_DroppedRequests with the +// rules defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *ClusterStats_DroppedRequests) Validate() error { + if m == nil { + return nil + } + + if len(m.GetCategory()) < 1 { + return ClusterStats_DroppedRequestsValidationError{ + Field: "Category", + Reason: "value length must be at least 1 bytes", + } + } + + // no validation rules for DroppedCount + + return nil +} + +// ClusterStats_DroppedRequestsValidationError is the validation error returned +// by ClusterStats_DroppedRequests.Validate if the designated constraints +// aren't met. +type ClusterStats_DroppedRequestsValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e ClusterStats_DroppedRequestsValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sClusterStats_DroppedRequests.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = ClusterStats_DroppedRequestsValidationError{} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/lds.pb.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/lds.pb.go new file mode 100644 index 000000000000..bb62e25fee30 --- /dev/null +++ b/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/lds.pb.go @@ -0,0 +1,1560 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: envoy/api/v2/lds.proto + +package v2 + +import proto "github.com/gogo/protobuf/proto" +import fmt "fmt" +import math "math" +import core "github.com/envoyproxy/go-control-plane/envoy/api/v2/core" +import listener "github.com/envoyproxy/go-control-plane/envoy/api/v2/listener" +import _ "github.com/gogo/googleapis/google/api" +import _ "github.com/gogo/protobuf/gogoproto" +import types "github.com/gogo/protobuf/types" +import _ "github.com/lyft/protoc-gen-validate/validate" + +import bytes "bytes" + +import context "golang.org/x/net/context" +import grpc "google.golang.org/grpc" + +import io "io" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package + +type Listener_DrainType int32 + +const ( + // Drain in response to calling /healthcheck/fail admin endpoint (along with the health check + // filter), listener removal/modification, and hot restart. + Listener_DEFAULT Listener_DrainType = 0 + // Drain in response to listener removal/modification and hot restart. This setting does not + // include /healthcheck/fail. This setting may be desirable if Envoy is hosting both ingress + // and egress listeners. + Listener_MODIFY_ONLY Listener_DrainType = 1 +) + +var Listener_DrainType_name = map[int32]string{ + 0: "DEFAULT", + 1: "MODIFY_ONLY", +} +var Listener_DrainType_value = map[string]int32{ + "DEFAULT": 0, + "MODIFY_ONLY": 1, +} + +func (x Listener_DrainType) String() string { + return proto.EnumName(Listener_DrainType_name, int32(x)) +} +func (Listener_DrainType) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_lds_e1558ab11a5a16bb, []int{0, 0} +} + +type Listener struct { + // The unique name by which this listener is known. If no name is provided, + // Envoy will allocate an internal UUID for the listener. If the listener is to be dynamically + // updated or removed via :ref:`LDS ` a unique name must be provided. + // By default, the maximum length of a listener's name is limited to 60 characters. This limit can + // be increased by setting the :option:`--max-obj-name-len` command line argument to the desired + // value. + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // The address that the listener should listen on. In general, the address must be unique, though + // that is governed by the bind rules of the OS. E.g., multiple listeners can listen on port 0 on + // Linux as the actual port will be allocated by the OS. + Address core.Address `protobuf:"bytes,2,opt,name=address" json:"address"` + // A list of filter chains to consider for this listener. The + // :ref:`FilterChain ` with the most specific + // :ref:`FilterChainMatch ` criteria is used on a + // connection. + // + // Example using SNI for filter chain selection can be found in the + // :ref:`FAQ entry `. + FilterChains []listener.FilterChain `protobuf:"bytes,3,rep,name=filter_chains,json=filterChains" json:"filter_chains"` + // If a connection is redirected using *iptables*, the port on which the proxy + // receives it might be different from the original destination address. When this flag is set to + // true, the listener hands off redirected connections to the listener associated with the + // original destination address. If there is no listener associated with the original destination + // address, the connection is handled by the listener that receives it. Defaults to false. + // + // .. attention:: + // + // This field is deprecated. Use :ref:`an original_dst ` + // :ref:`listener filter ` instead. + // + // Note that hand off to another listener is *NOT* performed without this flag. Once + // :ref:`FilterChainMatch ` is implemented this flag + // will be removed, as filter chain matching can be used to select a filter chain based on the + // restored destination address. + UseOriginalDst *types.BoolValue `protobuf:"bytes,4,opt,name=use_original_dst,json=useOriginalDst" json:"use_original_dst,omitempty"` // Deprecated: Do not use. + // Soft limit on size of the listener’s new connection read and write buffers. + // If unspecified, an implementation defined default is applied (1MiB). + PerConnectionBufferLimitBytes *types.UInt32Value `protobuf:"bytes,5,opt,name=per_connection_buffer_limit_bytes,json=perConnectionBufferLimitBytes" json:"per_connection_buffer_limit_bytes,omitempty"` + // Listener metadata. + Metadata *core.Metadata `protobuf:"bytes,6,opt,name=metadata" json:"metadata,omitempty"` + // [#not-implemented-hide:] + DeprecatedV1 *Listener_DeprecatedV1 `protobuf:"bytes,7,opt,name=deprecated_v1,json=deprecatedV1" json:"deprecated_v1,omitempty"` + // The type of draining to perform at a listener-wide level. + DrainType Listener_DrainType `protobuf:"varint,8,opt,name=drain_type,json=drainType,proto3,enum=envoy.api.v2.Listener_DrainType" json:"drain_type,omitempty"` + // Listener filters have the opportunity to manipulate and augment the connection metadata that + // is used in connection filter chain matching, for example. These filters are run before any in + // :ref:`filter_chains `. Order matters as the + // filters are processed sequentially right after a socket has been accepted by the listener, and + // before a connection is created. + ListenerFilters []listener.ListenerFilter `protobuf:"bytes,9,rep,name=listener_filters,json=listenerFilters" json:"listener_filters"` + // Whether the listener should be set as a transparent socket. + // When this flag is set to true, connections can be redirected to the listener using an + // *iptables* *TPROXY* target, in which case the original source and destination addresses and + // ports are preserved on accepted connections. This flag should be used in combination with + // :ref:`an original_dst ` :ref:`listener filter + // ` to mark the connections' local addresses as + // "restored." This can be used to hand off each redirected connection to another listener + // associated with the connection's destination address. Direct connections to the socket without + // using *TPROXY* cannot be distinguished from connections redirected using *TPROXY* and are + // therefore treated as if they were redirected. + // When this flag is set to false, the listener's socket is explicitly reset as non-transparent. + // Setting this flag requires Envoy to run with the *CAP_NET_ADMIN* capability. + // When this flag is not set (default), the socket is not modified, i.e. the transparent option + // is neither set nor reset. + Transparent *types.BoolValue `protobuf:"bytes,10,opt,name=transparent" json:"transparent,omitempty"` + // Whether the listener should set the *IP_FREEBIND* socket option. When this + // flag is set to true, listeners can be bound to an IP address that is not + // configured on the system running Envoy. When this flag is set to false, the + // option *IP_FREEBIND* is disabled on the socket. When this flag is not set + // (default), the socket is not modified, i.e. the option is neither enabled + // nor disabled. + Freebind *types.BoolValue `protobuf:"bytes,11,opt,name=freebind" json:"freebind,omitempty"` + // Additional socket options that may not be present in Envoy source code or + // precompiled binaries. + SocketOptions []*core.SocketOption `protobuf:"bytes,13,rep,name=socket_options,json=socketOptions" json:"socket_options,omitempty"` + // Whether the listener should accept TCP Fast Open (TFO) connections. + // When this flag is set to a value greater than 0, the option TCP_FASTOPEN is enabled on + // the socket, with a queue length of the specified size + // (see `details in RFC7413 `_). + // When this flag is set to 0, the option TCP_FASTOPEN is disabled on the socket. + // When this flag is not set (default), the socket is not modified, + // i.e. the option is neither enabled nor disabled. + // + // On Linux, the net.ipv4.tcp_fastopen kernel parameter must include flag 0x2 to enable + // TCP_FASTOPEN. + // See `ip-sysctl.txt `_. + // + // On macOS, only values of 0, 1, and unset are valid; other values may result in an error. + // To set the queue length on macOS, set the net.inet.tcp.fastopen_backlog kernel parameter. + TcpFastOpenQueueLength *types.UInt32Value `protobuf:"bytes,12,opt,name=tcp_fast_open_queue_length,json=tcpFastOpenQueueLength" json:"tcp_fast_open_queue_length,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Listener) Reset() { *m = Listener{} } +func (m *Listener) String() string { return proto.CompactTextString(m) } +func (*Listener) ProtoMessage() {} +func (*Listener) Descriptor() ([]byte, []int) { + return fileDescriptor_lds_e1558ab11a5a16bb, []int{0} +} +func (m *Listener) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Listener) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Listener.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *Listener) XXX_Merge(src proto.Message) { + xxx_messageInfo_Listener.Merge(dst, src) +} +func (m *Listener) XXX_Size() int { + return m.Size() +} +func (m *Listener) XXX_DiscardUnknown() { + xxx_messageInfo_Listener.DiscardUnknown(m) +} + +var xxx_messageInfo_Listener proto.InternalMessageInfo + +func (m *Listener) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *Listener) GetAddress() core.Address { + if m != nil { + return m.Address + } + return core.Address{} +} + +func (m *Listener) GetFilterChains() []listener.FilterChain { + if m != nil { + return m.FilterChains + } + return nil +} + +// Deprecated: Do not use. +func (m *Listener) GetUseOriginalDst() *types.BoolValue { + if m != nil { + return m.UseOriginalDst + } + return nil +} + +func (m *Listener) GetPerConnectionBufferLimitBytes() *types.UInt32Value { + if m != nil { + return m.PerConnectionBufferLimitBytes + } + return nil +} + +func (m *Listener) GetMetadata() *core.Metadata { + if m != nil { + return m.Metadata + } + return nil +} + +func (m *Listener) GetDeprecatedV1() *Listener_DeprecatedV1 { + if m != nil { + return m.DeprecatedV1 + } + return nil +} + +func (m *Listener) GetDrainType() Listener_DrainType { + if m != nil { + return m.DrainType + } + return Listener_DEFAULT +} + +func (m *Listener) GetListenerFilters() []listener.ListenerFilter { + if m != nil { + return m.ListenerFilters + } + return nil +} + +func (m *Listener) GetTransparent() *types.BoolValue { + if m != nil { + return m.Transparent + } + return nil +} + +func (m *Listener) GetFreebind() *types.BoolValue { + if m != nil { + return m.Freebind + } + return nil +} + +func (m *Listener) GetSocketOptions() []*core.SocketOption { + if m != nil { + return m.SocketOptions + } + return nil +} + +func (m *Listener) GetTcpFastOpenQueueLength() *types.UInt32Value { + if m != nil { + return m.TcpFastOpenQueueLength + } + return nil +} + +// [#not-implemented-hide:] +type Listener_DeprecatedV1 struct { + // Whether the listener should bind to the port. A listener that doesn’t + // bind can only receive connections redirected from other listeners that + // set use_original_dst parameter to true. Default is true. + // + // [V2-API-DIFF] This is deprecated in v2, all Listeners will bind to their + // port. An additional filter chain must be created for every original + // destination port this listener may redirect to in v2, with the original + // port specified in the FilterChainMatch destination_port field. + BindToPort *types.BoolValue `protobuf:"bytes,1,opt,name=bind_to_port,json=bindToPort" json:"bind_to_port,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Listener_DeprecatedV1) Reset() { *m = Listener_DeprecatedV1{} } +func (m *Listener_DeprecatedV1) String() string { return proto.CompactTextString(m) } +func (*Listener_DeprecatedV1) ProtoMessage() {} +func (*Listener_DeprecatedV1) Descriptor() ([]byte, []int) { + return fileDescriptor_lds_e1558ab11a5a16bb, []int{0, 0} +} +func (m *Listener_DeprecatedV1) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Listener_DeprecatedV1) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Listener_DeprecatedV1.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *Listener_DeprecatedV1) XXX_Merge(src proto.Message) { + xxx_messageInfo_Listener_DeprecatedV1.Merge(dst, src) +} +func (m *Listener_DeprecatedV1) XXX_Size() int { + return m.Size() +} +func (m *Listener_DeprecatedV1) XXX_DiscardUnknown() { + xxx_messageInfo_Listener_DeprecatedV1.DiscardUnknown(m) +} + +var xxx_messageInfo_Listener_DeprecatedV1 proto.InternalMessageInfo + +func (m *Listener_DeprecatedV1) GetBindToPort() *types.BoolValue { + if m != nil { + return m.BindToPort + } + return nil +} + +func init() { + proto.RegisterType((*Listener)(nil), "envoy.api.v2.Listener") + proto.RegisterType((*Listener_DeprecatedV1)(nil), "envoy.api.v2.Listener.DeprecatedV1") + proto.RegisterEnum("envoy.api.v2.Listener_DrainType", Listener_DrainType_name, Listener_DrainType_value) +} +func (this *Listener) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Listener) + if !ok { + that2, ok := that.(Listener) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Name != that1.Name { + return false + } + if !this.Address.Equal(&that1.Address) { + return false + } + if len(this.FilterChains) != len(that1.FilterChains) { + return false + } + for i := range this.FilterChains { + if !this.FilterChains[i].Equal(&that1.FilterChains[i]) { + return false + } + } + if !this.UseOriginalDst.Equal(that1.UseOriginalDst) { + return false + } + if !this.PerConnectionBufferLimitBytes.Equal(that1.PerConnectionBufferLimitBytes) { + return false + } + if !this.Metadata.Equal(that1.Metadata) { + return false + } + if !this.DeprecatedV1.Equal(that1.DeprecatedV1) { + return false + } + if this.DrainType != that1.DrainType { + return false + } + if len(this.ListenerFilters) != len(that1.ListenerFilters) { + return false + } + for i := range this.ListenerFilters { + if !this.ListenerFilters[i].Equal(&that1.ListenerFilters[i]) { + return false + } + } + if !this.Transparent.Equal(that1.Transparent) { + return false + } + if !this.Freebind.Equal(that1.Freebind) { + return false + } + if len(this.SocketOptions) != len(that1.SocketOptions) { + return false + } + for i := range this.SocketOptions { + if !this.SocketOptions[i].Equal(that1.SocketOptions[i]) { + return false + } + } + if !this.TcpFastOpenQueueLength.Equal(that1.TcpFastOpenQueueLength) { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *Listener_DeprecatedV1) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Listener_DeprecatedV1) + if !ok { + that2, ok := that.(Listener_DeprecatedV1) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.BindToPort.Equal(that1.BindToPort) { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// Client API for ListenerDiscoveryService service + +type ListenerDiscoveryServiceClient interface { + StreamListeners(ctx context.Context, opts ...grpc.CallOption) (ListenerDiscoveryService_StreamListenersClient, error) + FetchListeners(ctx context.Context, in *DiscoveryRequest, opts ...grpc.CallOption) (*DiscoveryResponse, error) +} + +type listenerDiscoveryServiceClient struct { + cc *grpc.ClientConn +} + +func NewListenerDiscoveryServiceClient(cc *grpc.ClientConn) ListenerDiscoveryServiceClient { + return &listenerDiscoveryServiceClient{cc} +} + +func (c *listenerDiscoveryServiceClient) StreamListeners(ctx context.Context, opts ...grpc.CallOption) (ListenerDiscoveryService_StreamListenersClient, error) { + stream, err := c.cc.NewStream(ctx, &_ListenerDiscoveryService_serviceDesc.Streams[0], "/envoy.api.v2.ListenerDiscoveryService/StreamListeners", opts...) + if err != nil { + return nil, err + } + x := &listenerDiscoveryServiceStreamListenersClient{stream} + return x, nil +} + +type ListenerDiscoveryService_StreamListenersClient interface { + Send(*DiscoveryRequest) error + Recv() (*DiscoveryResponse, error) + grpc.ClientStream +} + +type listenerDiscoveryServiceStreamListenersClient struct { + grpc.ClientStream +} + +func (x *listenerDiscoveryServiceStreamListenersClient) Send(m *DiscoveryRequest) error { + return x.ClientStream.SendMsg(m) +} + +func (x *listenerDiscoveryServiceStreamListenersClient) Recv() (*DiscoveryResponse, error) { + m := new(DiscoveryResponse) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *listenerDiscoveryServiceClient) FetchListeners(ctx context.Context, in *DiscoveryRequest, opts ...grpc.CallOption) (*DiscoveryResponse, error) { + out := new(DiscoveryResponse) + err := c.cc.Invoke(ctx, "/envoy.api.v2.ListenerDiscoveryService/FetchListeners", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// Server API for ListenerDiscoveryService service + +type ListenerDiscoveryServiceServer interface { + StreamListeners(ListenerDiscoveryService_StreamListenersServer) error + FetchListeners(context.Context, *DiscoveryRequest) (*DiscoveryResponse, error) +} + +func RegisterListenerDiscoveryServiceServer(s *grpc.Server, srv ListenerDiscoveryServiceServer) { + s.RegisterService(&_ListenerDiscoveryService_serviceDesc, srv) +} + +func _ListenerDiscoveryService_StreamListeners_Handler(srv interface{}, stream grpc.ServerStream) error { + return srv.(ListenerDiscoveryServiceServer).StreamListeners(&listenerDiscoveryServiceStreamListenersServer{stream}) +} + +type ListenerDiscoveryService_StreamListenersServer interface { + Send(*DiscoveryResponse) error + Recv() (*DiscoveryRequest, error) + grpc.ServerStream +} + +type listenerDiscoveryServiceStreamListenersServer struct { + grpc.ServerStream +} + +func (x *listenerDiscoveryServiceStreamListenersServer) Send(m *DiscoveryResponse) error { + return x.ServerStream.SendMsg(m) +} + +func (x *listenerDiscoveryServiceStreamListenersServer) Recv() (*DiscoveryRequest, error) { + m := new(DiscoveryRequest) + if err := x.ServerStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func _ListenerDiscoveryService_FetchListeners_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DiscoveryRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ListenerDiscoveryServiceServer).FetchListeners(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/envoy.api.v2.ListenerDiscoveryService/FetchListeners", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ListenerDiscoveryServiceServer).FetchListeners(ctx, req.(*DiscoveryRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _ListenerDiscoveryService_serviceDesc = grpc.ServiceDesc{ + ServiceName: "envoy.api.v2.ListenerDiscoveryService", + HandlerType: (*ListenerDiscoveryServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "FetchListeners", + Handler: _ListenerDiscoveryService_FetchListeners_Handler, + }, + }, + Streams: []grpc.StreamDesc{ + { + StreamName: "StreamListeners", + Handler: _ListenerDiscoveryService_StreamListeners_Handler, + ServerStreams: true, + ClientStreams: true, + }, + }, + Metadata: "envoy/api/v2/lds.proto", +} + +func (m *Listener) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Listener) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Name) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintLds(dAtA, i, uint64(len(m.Name))) + i += copy(dAtA[i:], m.Name) + } + dAtA[i] = 0x12 + i++ + i = encodeVarintLds(dAtA, i, uint64(m.Address.Size())) + n1, err := m.Address.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n1 + if len(m.FilterChains) > 0 { + for _, msg := range m.FilterChains { + dAtA[i] = 0x1a + i++ + i = encodeVarintLds(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if m.UseOriginalDst != nil { + dAtA[i] = 0x22 + i++ + i = encodeVarintLds(dAtA, i, uint64(m.UseOriginalDst.Size())) + n2, err := m.UseOriginalDst.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n2 + } + if m.PerConnectionBufferLimitBytes != nil { + dAtA[i] = 0x2a + i++ + i = encodeVarintLds(dAtA, i, uint64(m.PerConnectionBufferLimitBytes.Size())) + n3, err := m.PerConnectionBufferLimitBytes.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n3 + } + if m.Metadata != nil { + dAtA[i] = 0x32 + i++ + i = encodeVarintLds(dAtA, i, uint64(m.Metadata.Size())) + n4, err := m.Metadata.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n4 + } + if m.DeprecatedV1 != nil { + dAtA[i] = 0x3a + i++ + i = encodeVarintLds(dAtA, i, uint64(m.DeprecatedV1.Size())) + n5, err := m.DeprecatedV1.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n5 + } + if m.DrainType != 0 { + dAtA[i] = 0x40 + i++ + i = encodeVarintLds(dAtA, i, uint64(m.DrainType)) + } + if len(m.ListenerFilters) > 0 { + for _, msg := range m.ListenerFilters { + dAtA[i] = 0x4a + i++ + i = encodeVarintLds(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if m.Transparent != nil { + dAtA[i] = 0x52 + i++ + i = encodeVarintLds(dAtA, i, uint64(m.Transparent.Size())) + n6, err := m.Transparent.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n6 + } + if m.Freebind != nil { + dAtA[i] = 0x5a + i++ + i = encodeVarintLds(dAtA, i, uint64(m.Freebind.Size())) + n7, err := m.Freebind.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n7 + } + if m.TcpFastOpenQueueLength != nil { + dAtA[i] = 0x62 + i++ + i = encodeVarintLds(dAtA, i, uint64(m.TcpFastOpenQueueLength.Size())) + n8, err := m.TcpFastOpenQueueLength.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n8 + } + if len(m.SocketOptions) > 0 { + for _, msg := range m.SocketOptions { + dAtA[i] = 0x6a + i++ + i = encodeVarintLds(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *Listener_DeprecatedV1) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Listener_DeprecatedV1) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.BindToPort != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintLds(dAtA, i, uint64(m.BindToPort.Size())) + n9, err := m.BindToPort.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n9 + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func encodeVarintLds(dAtA []byte, offset int, v uint64) int { + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return offset + 1 +} +func (m *Listener) Size() (n int) { + var l int + _ = l + l = len(m.Name) + if l > 0 { + n += 1 + l + sovLds(uint64(l)) + } + l = m.Address.Size() + n += 1 + l + sovLds(uint64(l)) + if len(m.FilterChains) > 0 { + for _, e := range m.FilterChains { + l = e.Size() + n += 1 + l + sovLds(uint64(l)) + } + } + if m.UseOriginalDst != nil { + l = m.UseOriginalDst.Size() + n += 1 + l + sovLds(uint64(l)) + } + if m.PerConnectionBufferLimitBytes != nil { + l = m.PerConnectionBufferLimitBytes.Size() + n += 1 + l + sovLds(uint64(l)) + } + if m.Metadata != nil { + l = m.Metadata.Size() + n += 1 + l + sovLds(uint64(l)) + } + if m.DeprecatedV1 != nil { + l = m.DeprecatedV1.Size() + n += 1 + l + sovLds(uint64(l)) + } + if m.DrainType != 0 { + n += 1 + sovLds(uint64(m.DrainType)) + } + if len(m.ListenerFilters) > 0 { + for _, e := range m.ListenerFilters { + l = e.Size() + n += 1 + l + sovLds(uint64(l)) + } + } + if m.Transparent != nil { + l = m.Transparent.Size() + n += 1 + l + sovLds(uint64(l)) + } + if m.Freebind != nil { + l = m.Freebind.Size() + n += 1 + l + sovLds(uint64(l)) + } + if m.TcpFastOpenQueueLength != nil { + l = m.TcpFastOpenQueueLength.Size() + n += 1 + l + sovLds(uint64(l)) + } + if len(m.SocketOptions) > 0 { + for _, e := range m.SocketOptions { + l = e.Size() + n += 1 + l + sovLds(uint64(l)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *Listener_DeprecatedV1) Size() (n int) { + var l int + _ = l + if m.BindToPort != nil { + l = m.BindToPort.Size() + n += 1 + l + sovLds(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func sovLds(x uint64) (n int) { + for { + n++ + x >>= 7 + if x == 0 { + break + } + } + return n +} +func sozLds(x uint64) (n int) { + return sovLds(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Listener) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Listener: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Listener: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthLds + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthLds + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Address.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FilterChains", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthLds + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.FilterChains = append(m.FilterChains, listener.FilterChain{}) + if err := m.FilterChains[len(m.FilterChains)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field UseOriginalDst", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthLds + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.UseOriginalDst == nil { + m.UseOriginalDst = &types.BoolValue{} + } + if err := m.UseOriginalDst.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PerConnectionBufferLimitBytes", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthLds + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.PerConnectionBufferLimitBytes == nil { + m.PerConnectionBufferLimitBytes = &types.UInt32Value{} + } + if err := m.PerConnectionBufferLimitBytes.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Metadata", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthLds + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Metadata == nil { + m.Metadata = &core.Metadata{} + } + if err := m.Metadata.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DeprecatedV1", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthLds + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.DeprecatedV1 == nil { + m.DeprecatedV1 = &Listener_DeprecatedV1{} + } + if err := m.DeprecatedV1.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 8: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field DrainType", wireType) + } + m.DrainType = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.DrainType |= (Listener_DrainType(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ListenerFilters", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthLds + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ListenerFilters = append(m.ListenerFilters, listener.ListenerFilter{}) + if err := m.ListenerFilters[len(m.ListenerFilters)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 10: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Transparent", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthLds + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Transparent == nil { + m.Transparent = &types.BoolValue{} + } + if err := m.Transparent.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 11: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Freebind", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthLds + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Freebind == nil { + m.Freebind = &types.BoolValue{} + } + if err := m.Freebind.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 12: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TcpFastOpenQueueLength", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthLds + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.TcpFastOpenQueueLength == nil { + m.TcpFastOpenQueueLength = &types.UInt32Value{} + } + if err := m.TcpFastOpenQueueLength.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 13: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SocketOptions", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthLds + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SocketOptions = append(m.SocketOptions, &core.SocketOption{}) + if err := m.SocketOptions[len(m.SocketOptions)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipLds(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthLds + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Listener_DeprecatedV1) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DeprecatedV1: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DeprecatedV1: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BindToPort", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthLds + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.BindToPort == nil { + m.BindToPort = &types.BoolValue{} + } + if err := m.BindToPort.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipLds(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthLds + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipLds(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowLds + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowLds + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + return iNdEx, nil + case 1: + iNdEx += 8 + return iNdEx, nil + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowLds + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + iNdEx += length + if length < 0 { + return 0, ErrInvalidLengthLds + } + return iNdEx, nil + case 3: + for { + var innerWire uint64 + var start int = iNdEx + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowLds + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + innerWire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + innerWireType := int(innerWire & 0x7) + if innerWireType == 4 { + break + } + next, err := skipLds(dAtA[start:]) + if err != nil { + return 0, err + } + iNdEx = start + next + } + return iNdEx, nil + case 4: + return iNdEx, nil + case 5: + iNdEx += 4 + return iNdEx, nil + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + } + panic("unreachable") +} + +var ( + ErrInvalidLengthLds = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowLds = fmt.Errorf("proto: integer overflow") +) + +func init() { proto.RegisterFile("envoy/api/v2/lds.proto", fileDescriptor_lds_e1558ab11a5a16bb) } + +var fileDescriptor_lds_e1558ab11a5a16bb = []byte{ + // 789 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x94, 0x4f, 0x8f, 0xdb, 0x44, + 0x18, 0xc6, 0x77, 0xb2, 0xdb, 0x6e, 0x76, 0xf2, 0x67, 0xa3, 0x01, 0xb5, 0x56, 0x58, 0x92, 0x10, + 0x40, 0x0a, 0x1c, 0x1c, 0x9a, 0x4a, 0x20, 0x55, 0x95, 0x50, 0xd3, 0x10, 0xb5, 0x52, 0x4a, 0xc0, + 0xbb, 0x5d, 0xda, 0xd3, 0x68, 0x62, 0xbf, 0xce, 0x5a, 0x38, 0x33, 0xd3, 0x99, 0x71, 0x50, 0xae, + 0x9c, 0x10, 0x47, 0xb8, 0xf2, 0x01, 0xf8, 0x0c, 0x9c, 0x38, 0xf6, 0x88, 0xc4, 0x1d, 0xa1, 0x88, + 0x0b, 0xe2, 0x4b, 0x20, 0x4f, 0x6c, 0x93, 0xa8, 0xbb, 0x2c, 0x07, 0x6e, 0xef, 0xcc, 0xfb, 0x7b, + 0x1f, 0x8f, 0x9f, 0xc7, 0x1e, 0x7c, 0x0b, 0xf8, 0x52, 0xac, 0xfa, 0x4c, 0x46, 0xfd, 0xe5, 0xa0, + 0x1f, 0x07, 0xda, 0x95, 0x4a, 0x18, 0x41, 0xaa, 0x76, 0xdf, 0x65, 0x32, 0x72, 0x97, 0x83, 0x66, + 0x7b, 0x87, 0xf2, 0x85, 0x82, 0x3e, 0x0b, 0x02, 0x05, 0x3a, 0xc3, 0x9b, 0x27, 0xaf, 0x02, 0x33, + 0xa6, 0xe1, 0xd2, 0x6e, 0x10, 0x69, 0x5f, 0x2c, 0x41, 0xad, 0xb2, 0xee, 0x3b, 0xbb, 0x47, 0x88, + 0xb4, 0x01, 0x0e, 0xaa, 0x28, 0x72, 0x8d, 0xb9, 0x10, 0xf3, 0x18, 0x2c, 0xc6, 0x38, 0x17, 0x86, + 0x99, 0x48, 0xf0, 0xfc, 0xf9, 0xad, 0xac, 0x6b, 0x57, 0xb3, 0x24, 0xec, 0x7f, 0xa5, 0x98, 0x94, + 0xa0, 0xf2, 0xfe, 0xed, 0x25, 0x8b, 0xa3, 0x80, 0x19, 0xe8, 0xe7, 0x45, 0xd6, 0x78, 0x7d, 0x2e, + 0xe6, 0xc2, 0x96, 0xfd, 0xb4, 0xda, 0xec, 0x76, 0x7f, 0x28, 0xe3, 0xf2, 0x24, 0x7b, 0x3e, 0x21, + 0xf8, 0x80, 0xb3, 0x05, 0x38, 0xa8, 0x83, 0x7a, 0x47, 0x9e, 0xad, 0xc9, 0x08, 0x1f, 0x66, 0x06, + 0x38, 0xa5, 0x0e, 0xea, 0x55, 0x06, 0x4d, 0x77, 0xdb, 0x30, 0x37, 0x75, 0xc0, 0x7d, 0xb0, 0x21, + 0x86, 0xf5, 0x97, 0xbf, 0xb5, 0xf7, 0x7e, 0xfa, 0xf3, 0xe7, 0xfd, 0x1b, 0xdf, 0xa2, 0x52, 0x03, + 0x79, 0xf9, 0x28, 0xf9, 0x02, 0xd7, 0xc2, 0x28, 0x36, 0xa0, 0xa8, 0x7f, 0xc1, 0x22, 0xae, 0x9d, + 0xfd, 0xce, 0x7e, 0xaf, 0x32, 0xe8, 0xee, 0x6a, 0x15, 0x46, 0x8c, 0x2d, 0xfb, 0x30, 0x45, 0xb7, + 0x34, 0xbf, 0x43, 0xa5, 0x32, 0xf2, 0xaa, 0xe1, 0x3f, 0x4d, 0x4d, 0x1e, 0xe1, 0x46, 0xa2, 0x81, + 0x0a, 0x15, 0xcd, 0x23, 0xce, 0x62, 0x1a, 0x68, 0xe3, 0x1c, 0x64, 0xe7, 0xdc, 0x38, 0xe5, 0xe6, + 0x4e, 0xb9, 0x43, 0x21, 0xe2, 0x73, 0x16, 0x27, 0x30, 0x2c, 0x39, 0xc8, 0xab, 0x27, 0x1a, 0xa6, + 0xd9, 0xd8, 0x48, 0x1b, 0x12, 0xe2, 0xb7, 0x64, 0x7a, 0x3e, 0xc1, 0x39, 0xf8, 0xa9, 0xe3, 0x74, + 0x96, 0x84, 0x21, 0x28, 0x1a, 0x47, 0x8b, 0xc8, 0xd0, 0xd9, 0xca, 0x80, 0x76, 0x6e, 0x58, 0xe9, + 0x93, 0x57, 0xa4, 0x9f, 0x3e, 0xe6, 0xe6, 0xee, 0xc0, 0x8a, 0x7b, 0x6f, 0x4a, 0x50, 0x0f, 0x0b, + 0x95, 0xa1, 0x15, 0x99, 0xa4, 0x1a, 0xc3, 0x54, 0x82, 0x7c, 0x84, 0xcb, 0x0b, 0x30, 0x2c, 0x60, + 0x86, 0x39, 0x37, 0xad, 0xdc, 0x1b, 0x97, 0x38, 0xfa, 0x24, 0x43, 0xbc, 0x02, 0x26, 0x8f, 0x70, + 0x2d, 0x00, 0xa9, 0xc0, 0x67, 0x06, 0x02, 0xba, 0xbc, 0xe3, 0x1c, 0xda, 0xe9, 0xb7, 0x77, 0xa7, + 0xf3, 0x30, 0xdd, 0x51, 0xc1, 0x9e, 0xdf, 0xf1, 0xaa, 0xc1, 0xd6, 0x8a, 0x7c, 0x8c, 0x71, 0xa0, + 0x58, 0xc4, 0xa9, 0x59, 0x49, 0x70, 0xca, 0x1d, 0xd4, 0xab, 0x0f, 0x3a, 0x57, 0xc9, 0xa4, 0xe0, + 0xd9, 0x4a, 0x82, 0x77, 0x14, 0xe4, 0x25, 0x39, 0xc7, 0x8d, 0x3c, 0x2b, 0xba, 0x89, 0x43, 0x3b, + 0x47, 0x36, 0xd1, 0x77, 0xaf, 0x48, 0x34, 0xd7, 0xdb, 0x24, 0x3b, 0x3c, 0x48, 0x43, 0xf5, 0x8e, + 0xe3, 0x9d, 0x5d, 0x4d, 0xee, 0xe3, 0x8a, 0x51, 0x8c, 0x6b, 0xc9, 0x14, 0x70, 0xe3, 0xe0, 0xeb, + 0x82, 0xf4, 0xb6, 0x71, 0xf2, 0x21, 0x2e, 0x87, 0x0a, 0x60, 0x16, 0xf1, 0xc0, 0xa9, 0x5c, 0x3b, + 0x5a, 0xb0, 0xe4, 0x19, 0x6e, 0x1a, 0x5f, 0xd2, 0x90, 0x69, 0x43, 0x85, 0x04, 0x4e, 0x5f, 0x24, + 0x90, 0x00, 0x8d, 0x81, 0xcf, 0xcd, 0x85, 0x53, 0xfd, 0x0f, 0x91, 0xdf, 0x32, 0xbe, 0x1c, 0x33, + 0x6d, 0xa6, 0x12, 0xf8, 0xe7, 0xe9, 0xf0, 0xc4, 0xce, 0x92, 0x31, 0xae, 0x6b, 0xe1, 0x7f, 0x09, + 0xa9, 0xae, 0xfd, 0x89, 0x9d, 0x9a, 0x75, 0xa9, 0x7d, 0x49, 0xe2, 0xa7, 0x16, 0x9c, 0x5a, 0xce, + 0xab, 0xe9, 0xad, 0x95, 0x6e, 0x4e, 0x70, 0x75, 0x3b, 0x4e, 0x72, 0x1f, 0x57, 0xd3, 0x93, 0x53, + 0x23, 0xa8, 0x14, 0xca, 0xd8, 0x1f, 0xf6, 0xdf, 0xdf, 0x16, 0xa7, 0xfc, 0x99, 0xf8, 0x4c, 0x28, + 0xd3, 0x7d, 0x0f, 0x1f, 0x15, 0xa9, 0x92, 0x0a, 0x3e, 0x1c, 0x7d, 0x32, 0x7e, 0xf0, 0x74, 0x72, + 0xd6, 0xd8, 0x23, 0xc7, 0xb8, 0xf2, 0x64, 0x3a, 0x7a, 0x3c, 0x7e, 0x4e, 0xa7, 0x9f, 0x4e, 0x9e, + 0x37, 0xd0, 0xe0, 0x2f, 0x84, 0x9d, 0x3c, 0xba, 0x51, 0x7e, 0x9b, 0x9d, 0x82, 0x5a, 0x46, 0x3e, + 0x90, 0x67, 0xf8, 0xf8, 0xd4, 0x28, 0x60, 0x8b, 0x9c, 0xd0, 0xa4, 0xb5, 0xfb, 0x62, 0xc5, 0x88, + 0x07, 0x2f, 0x12, 0xd0, 0xa6, 0xd9, 0xbe, 0xb2, 0xaf, 0xa5, 0xe0, 0x1a, 0xba, 0x7b, 0x3d, 0xf4, + 0x01, 0x22, 0x09, 0xae, 0x8f, 0xc1, 0xf8, 0x17, 0xff, 0xa3, 0x70, 0xf7, 0xeb, 0x5f, 0xff, 0xf8, + 0xbe, 0x74, 0xd2, 0xbd, 0xbd, 0x73, 0x31, 0xdf, 0xcb, 0xbf, 0x40, 0x7d, 0x0f, 0xbd, 0x3f, 0x7c, + 0xed, 0xc7, 0x75, 0x0b, 0xbd, 0x5c, 0xb7, 0xd0, 0x2f, 0xeb, 0x16, 0xfa, 0x7d, 0xdd, 0x42, 0xdf, + 0x20, 0x34, 0xbb, 0x69, 0xdd, 0xbc, 0xfb, 0x77, 0x00, 0x00, 0x00, 0xff, 0xff, 0xfa, 0x09, 0x10, + 0x6b, 0x40, 0x06, 0x00, 0x00, +} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/lds.pb.validate.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/lds.pb.validate.go new file mode 100644 index 000000000000..1e9300fe5e6d --- /dev/null +++ b/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/lds.pb.validate.go @@ -0,0 +1,264 @@ +// Code generated by protoc-gen-validate +// source: envoy/api/v2/lds.proto +// DO NOT EDIT!!! + +package v2 + +import ( + "bytes" + "errors" + "fmt" + "net" + "net/mail" + "net/url" + "regexp" + "strings" + "time" + "unicode/utf8" + + "github.com/gogo/protobuf/types" +) + +// ensure the imports are used +var ( + _ = bytes.MinRead + _ = errors.New("") + _ = fmt.Print + _ = utf8.UTFMax + _ = (*regexp.Regexp)(nil) + _ = (*strings.Reader)(nil) + _ = net.IPv4len + _ = time.Duration(0) + _ = (*url.URL)(nil) + _ = (*mail.Address)(nil) + _ = types.DynamicAny{} +) + +// Validate checks the field values on Listener with the rules defined in the +// proto definition for this message. If any rules are violated, an error is returned. +func (m *Listener) Validate() error { + if m == nil { + return nil + } + + // no validation rules for Name + + if v, ok := interface{}(m.GetAddress()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return ListenerValidationError{ + Field: "Address", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + if len(m.GetFilterChains()) < 1 { + return ListenerValidationError{ + Field: "FilterChains", + Reason: "value must contain at least 1 item(s)", + } + } + + for idx, item := range m.GetFilterChains() { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return ListenerValidationError{ + Field: fmt.Sprintf("FilterChains[%v]", idx), + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + } + + if v, ok := interface{}(m.GetUseOriginalDst()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return ListenerValidationError{ + Field: "UseOriginalDst", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + if v, ok := interface{}(m.GetPerConnectionBufferLimitBytes()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return ListenerValidationError{ + Field: "PerConnectionBufferLimitBytes", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + if v, ok := interface{}(m.GetMetadata()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return ListenerValidationError{ + Field: "Metadata", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + if v, ok := interface{}(m.GetDeprecatedV1()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return ListenerValidationError{ + Field: "DeprecatedV1", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + // no validation rules for DrainType + + for idx, item := range m.GetListenerFilters() { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return ListenerValidationError{ + Field: fmt.Sprintf("ListenerFilters[%v]", idx), + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + } + + if v, ok := interface{}(m.GetTransparent()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return ListenerValidationError{ + Field: "Transparent", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + if v, ok := interface{}(m.GetFreebind()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return ListenerValidationError{ + Field: "Freebind", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + for idx, item := range m.GetSocketOptions() { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return ListenerValidationError{ + Field: fmt.Sprintf("SocketOptions[%v]", idx), + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + } + + if v, ok := interface{}(m.GetTcpFastOpenQueueLength()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return ListenerValidationError{ + Field: "TcpFastOpenQueueLength", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + return nil +} + +// ListenerValidationError is the validation error returned by +// Listener.Validate if the designated constraints aren't met. +type ListenerValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e ListenerValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sListener.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = ListenerValidationError{} + +// Validate checks the field values on Listener_DeprecatedV1 with the rules +// defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *Listener_DeprecatedV1) Validate() error { + if m == nil { + return nil + } + + if v, ok := interface{}(m.GetBindToPort()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return Listener_DeprecatedV1ValidationError{ + Field: "BindToPort", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + return nil +} + +// Listener_DeprecatedV1ValidationError is the validation error returned by +// Listener_DeprecatedV1.Validate if the designated constraints aren't met. +type Listener_DeprecatedV1ValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e Listener_DeprecatedV1ValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sListener_DeprecatedV1.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = Listener_DeprecatedV1ValidationError{} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/listener/listener.pb.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/listener/listener.pb.go new file mode 100644 index 000000000000..a0d6b2991a84 --- /dev/null +++ b/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/listener/listener.pb.go @@ -0,0 +1,2284 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: envoy/api/v2/listener/listener.proto + +package listener + +import proto "github.com/gogo/protobuf/proto" +import fmt "fmt" +import math "math" +import auth "github.com/envoyproxy/go-control-plane/envoy/api/v2/auth" +import core "github.com/envoyproxy/go-control-plane/envoy/api/v2/core" +import _ "github.com/gogo/protobuf/gogoproto" +import types "github.com/gogo/protobuf/types" +import _ "github.com/lyft/protoc-gen-validate/validate" + +import bytes "bytes" + +import io "io" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package + +type Filter struct { + // The name of the filter to instantiate. The name must match a supported + // filter. The built-in filters are: + // + // [#comment:TODO(mattklein123): Auto generate the following list] + // * :ref:`envoy.client_ssl_auth` + // * :ref:`envoy.echo ` + // * :ref:`envoy.http_connection_manager ` + // * :ref:`envoy.mongo_proxy ` + // * :ref:`envoy.ratelimit ` + // * :ref:`envoy.redis_proxy ` + // * :ref:`envoy.tcp_proxy ` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // Filter specific configuration which depends on the filter being + // instantiated. See the supported filters for further documentation. + Config *types.Struct `protobuf:"bytes,2,opt,name=config" json:"config,omitempty"` + // [#not-implemented-hide:] + DeprecatedV1 *Filter_DeprecatedV1 `protobuf:"bytes,3,opt,name=deprecated_v1,json=deprecatedV1" json:"deprecated_v1,omitempty"` // Deprecated: Do not use. + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Filter) Reset() { *m = Filter{} } +func (m *Filter) String() string { return proto.CompactTextString(m) } +func (*Filter) ProtoMessage() {} +func (*Filter) Descriptor() ([]byte, []int) { + return fileDescriptor_listener_3375c0acf9db00a4, []int{0} +} +func (m *Filter) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Filter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Filter.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *Filter) XXX_Merge(src proto.Message) { + xxx_messageInfo_Filter.Merge(dst, src) +} +func (m *Filter) XXX_Size() int { + return m.Size() +} +func (m *Filter) XXX_DiscardUnknown() { + xxx_messageInfo_Filter.DiscardUnknown(m) +} + +var xxx_messageInfo_Filter proto.InternalMessageInfo + +func (m *Filter) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *Filter) GetConfig() *types.Struct { + if m != nil { + return m.Config + } + return nil +} + +// Deprecated: Do not use. +func (m *Filter) GetDeprecatedV1() *Filter_DeprecatedV1 { + if m != nil { + return m.DeprecatedV1 + } + return nil +} + +// [#not-implemented-hide:] +type Filter_DeprecatedV1 struct { + Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Filter_DeprecatedV1) Reset() { *m = Filter_DeprecatedV1{} } +func (m *Filter_DeprecatedV1) String() string { return proto.CompactTextString(m) } +func (*Filter_DeprecatedV1) ProtoMessage() {} +func (*Filter_DeprecatedV1) Descriptor() ([]byte, []int) { + return fileDescriptor_listener_3375c0acf9db00a4, []int{0, 0} +} +func (m *Filter_DeprecatedV1) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Filter_DeprecatedV1) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Filter_DeprecatedV1.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *Filter_DeprecatedV1) XXX_Merge(src proto.Message) { + xxx_messageInfo_Filter_DeprecatedV1.Merge(dst, src) +} +func (m *Filter_DeprecatedV1) XXX_Size() int { + return m.Size() +} +func (m *Filter_DeprecatedV1) XXX_DiscardUnknown() { + xxx_messageInfo_Filter_DeprecatedV1.DiscardUnknown(m) +} + +var xxx_messageInfo_Filter_DeprecatedV1 proto.InternalMessageInfo + +func (m *Filter_DeprecatedV1) GetType() string { + if m != nil { + return m.Type + } + return "" +} + +// Specifies the match criteria for selecting a specific filter chain for a +// listener. +// +// In order for a filter chain to be selected, *ALL* of its criteria must be +// fulfilled by the incoming connection, properties of which are set by the +// networking stack and/or listener filters. +// +// The following order applies: +// +// 1. Destination port. +// 2. Destination IP address. +// 3. Server name (e.g. SNI for TLS protocol), +// 4. Transport protocol. +// 5. Application protocols (e.g. ALPN for TLS protocol). +// +// For criterias that allow ranges or wildcards, the most specific value in any +// of the configured filter chains that matches the incoming connection is going +// to be used (e.g. for SNI ``www.example.com`` the most specific match would be +// ``www.example.com``, then ``*.example.com``, then ``*.com``, then any filter +// chain without ``server_names`` requirements). +// +// [#comment: Implemented rules are kept in the preference order, with deprecated fields +// listed at the end, because that's how we want to list them in the docs. +// +// [#comment:TODO(PiotrSikora): Add support for configurable precedence of the rules] +type FilterChainMatch struct { + // Optional destination port to consider when use_original_dst is set on the + // listener in determining a filter chain match. + DestinationPort *types.UInt32Value `protobuf:"bytes,8,opt,name=destination_port,json=destinationPort" json:"destination_port,omitempty"` + // If non-empty, an IP address and prefix length to match addresses when the + // listener is bound to 0.0.0.0/:: or when use_original_dst is specified. + PrefixRanges []*core.CidrRange `protobuf:"bytes,3,rep,name=prefix_ranges,json=prefixRanges" json:"prefix_ranges,omitempty"` + // If non-empty, an IP address and suffix length to match addresses when the + // listener is bound to 0.0.0.0/:: or when use_original_dst is specified. + // [#not-implemented-hide:] + AddressSuffix string `protobuf:"bytes,4,opt,name=address_suffix,json=addressSuffix,proto3" json:"address_suffix,omitempty"` + // [#not-implemented-hide:] + SuffixLen *types.UInt32Value `protobuf:"bytes,5,opt,name=suffix_len,json=suffixLen" json:"suffix_len,omitempty"` + // The criteria is satisfied if the source IP address of the downstream + // connection is contained in at least one of the specified subnets. If the + // parameter is not specified or the list is empty, the source IP address is + // ignored. + // [#not-implemented-hide:] + SourcePrefixRanges []*core.CidrRange `protobuf:"bytes,6,rep,name=source_prefix_ranges,json=sourcePrefixRanges" json:"source_prefix_ranges,omitempty"` + // The criteria is satisfied if the source port of the downstream connection + // is contained in at least one of the specified ports. If the parameter is + // not specified, the source port is ignored. + // [#not-implemented-hide:] + SourcePorts []*types.UInt32Value `protobuf:"bytes,7,rep,name=source_ports,json=sourcePorts" json:"source_ports,omitempty"` + // If non-empty, a list of server names (e.g. SNI for TLS protocol) to consider when determining + // a filter chain match. Those values will be compared against the server names of a new + // connection, when detected by one of the listener filters. + // + // The server name will be matched against all wildcard domains, i.e. ``www.example.com`` + // will be first matched against ``www.example.com``, then ``*.example.com``, then ``*.com``. + // + // Note that partial wildcards are not supported, and values like ``*w.example.com`` are invalid. + // + // .. attention:: + // + // See the :ref:`FAQ entry ` on how to configure SNI for more + // information. + ServerNames []string `protobuf:"bytes,11,rep,name=server_names,json=serverNames" json:"server_names,omitempty"` + // If non-empty, a transport protocol to consider when determining a filter chain match. + // This value will be compared against the transport protocol of a new connection, when + // it's detected by one of the listener filters. + // + // Suggested values include: + // + // * ``raw_buffer`` - default, used when no transport protocol is detected, + // * ``tls`` - set by :ref:`envoy.listener.tls_inspector ` + // when TLS protocol is detected. + TransportProtocol string `protobuf:"bytes,9,opt,name=transport_protocol,json=transportProtocol,proto3" json:"transport_protocol,omitempty"` + // If non-empty, a list of application protocols (e.g. ALPN for TLS protocol) to consider when + // determining a filter chain match. Those values will be compared against the application + // protocols of a new connection, when detected by one of the listener filters. + // + // Suggested values include: + // + // * ``http/1.1`` - set by :ref:`envoy.listener.tls_inspector + // `, + // * ``h2`` - set by :ref:`envoy.listener.tls_inspector ` + // + // .. attention:: + // + // Currently, only :ref:`TLS Inspector ` provides + // application protocol detection based on the requested + // `ALPN `_ values. + // + // However, the use of ALPN is pretty much limited to the HTTP/2 traffic on the Internet, + // and matching on values other than ``h2`` is going to lead to a lot of false negatives, + // unless all connecting clients are known to use ALPN. + ApplicationProtocols []string `protobuf:"bytes,10,rep,name=application_protocols,json=applicationProtocols" json:"application_protocols,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *FilterChainMatch) Reset() { *m = FilterChainMatch{} } +func (m *FilterChainMatch) String() string { return proto.CompactTextString(m) } +func (*FilterChainMatch) ProtoMessage() {} +func (*FilterChainMatch) Descriptor() ([]byte, []int) { + return fileDescriptor_listener_3375c0acf9db00a4, []int{1} +} +func (m *FilterChainMatch) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *FilterChainMatch) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_FilterChainMatch.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *FilterChainMatch) XXX_Merge(src proto.Message) { + xxx_messageInfo_FilterChainMatch.Merge(dst, src) +} +func (m *FilterChainMatch) XXX_Size() int { + return m.Size() +} +func (m *FilterChainMatch) XXX_DiscardUnknown() { + xxx_messageInfo_FilterChainMatch.DiscardUnknown(m) +} + +var xxx_messageInfo_FilterChainMatch proto.InternalMessageInfo + +func (m *FilterChainMatch) GetDestinationPort() *types.UInt32Value { + if m != nil { + return m.DestinationPort + } + return nil +} + +func (m *FilterChainMatch) GetPrefixRanges() []*core.CidrRange { + if m != nil { + return m.PrefixRanges + } + return nil +} + +func (m *FilterChainMatch) GetAddressSuffix() string { + if m != nil { + return m.AddressSuffix + } + return "" +} + +func (m *FilterChainMatch) GetSuffixLen() *types.UInt32Value { + if m != nil { + return m.SuffixLen + } + return nil +} + +func (m *FilterChainMatch) GetSourcePrefixRanges() []*core.CidrRange { + if m != nil { + return m.SourcePrefixRanges + } + return nil +} + +func (m *FilterChainMatch) GetSourcePorts() []*types.UInt32Value { + if m != nil { + return m.SourcePorts + } + return nil +} + +func (m *FilterChainMatch) GetServerNames() []string { + if m != nil { + return m.ServerNames + } + return nil +} + +func (m *FilterChainMatch) GetTransportProtocol() string { + if m != nil { + return m.TransportProtocol + } + return "" +} + +func (m *FilterChainMatch) GetApplicationProtocols() []string { + if m != nil { + return m.ApplicationProtocols + } + return nil +} + +// A filter chain wraps a set of match criteria, an option TLS context, a set of filters, and +// various other parameters. +type FilterChain struct { + // The criteria to use when matching a connection to this filter chain. + FilterChainMatch *FilterChainMatch `protobuf:"bytes,1,opt,name=filter_chain_match,json=filterChainMatch" json:"filter_chain_match,omitempty"` + // The TLS context for this filter chain. + TlsContext *auth.DownstreamTlsContext `protobuf:"bytes,2,opt,name=tls_context,json=tlsContext" json:"tls_context,omitempty"` + // A list of individual network filters that make up the filter chain for + // connections established with the listener. Order matters as the filters are + // processed sequentially as connection events happen. Note: If the filter + // list is empty, the connection will close by default. + Filters []Filter `protobuf:"bytes,3,rep,name=filters" json:"filters"` + // Whether the listener should expect a PROXY protocol V1 header on new + // connections. If this option is enabled, the listener will assume that that + // remote address of the connection is the one specified in the header. Some + // load balancers including the AWS ELB support this option. If the option is + // absent or set to false, Envoy will use the physical peer address of the + // connection as the remote address. + UseProxyProto *types.BoolValue `protobuf:"bytes,4,opt,name=use_proxy_proto,json=useProxyProto" json:"use_proxy_proto,omitempty"` + // [#not-implemented-hide:] filter chain metadata. + Metadata *core.Metadata `protobuf:"bytes,5,opt,name=metadata" json:"metadata,omitempty"` + // See :ref:`base.TransportSocket` description. + TransportSocket *core.TransportSocket `protobuf:"bytes,6,opt,name=transport_socket,json=transportSocket" json:"transport_socket,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *FilterChain) Reset() { *m = FilterChain{} } +func (m *FilterChain) String() string { return proto.CompactTextString(m) } +func (*FilterChain) ProtoMessage() {} +func (*FilterChain) Descriptor() ([]byte, []int) { + return fileDescriptor_listener_3375c0acf9db00a4, []int{2} +} +func (m *FilterChain) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *FilterChain) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_FilterChain.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *FilterChain) XXX_Merge(src proto.Message) { + xxx_messageInfo_FilterChain.Merge(dst, src) +} +func (m *FilterChain) XXX_Size() int { + return m.Size() +} +func (m *FilterChain) XXX_DiscardUnknown() { + xxx_messageInfo_FilterChain.DiscardUnknown(m) +} + +var xxx_messageInfo_FilterChain proto.InternalMessageInfo + +func (m *FilterChain) GetFilterChainMatch() *FilterChainMatch { + if m != nil { + return m.FilterChainMatch + } + return nil +} + +func (m *FilterChain) GetTlsContext() *auth.DownstreamTlsContext { + if m != nil { + return m.TlsContext + } + return nil +} + +func (m *FilterChain) GetFilters() []Filter { + if m != nil { + return m.Filters + } + return nil +} + +func (m *FilterChain) GetUseProxyProto() *types.BoolValue { + if m != nil { + return m.UseProxyProto + } + return nil +} + +func (m *FilterChain) GetMetadata() *core.Metadata { + if m != nil { + return m.Metadata + } + return nil +} + +func (m *FilterChain) GetTransportSocket() *core.TransportSocket { + if m != nil { + return m.TransportSocket + } + return nil +} + +type ListenerFilter struct { + // The name of the filter to instantiate. The name must match a supported + // filter. The built-in filters are: + // + // [#comment:TODO(mattklein123): Auto generate the following list] + // * :ref:`envoy.listener.original_dst ` + // * :ref:`envoy.listener.tls_inspector ` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // Filter specific configuration which depends on the filter being + // instantiated. See the supported filters for further documentation. + Config *types.Struct `protobuf:"bytes,2,opt,name=config" json:"config,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ListenerFilter) Reset() { *m = ListenerFilter{} } +func (m *ListenerFilter) String() string { return proto.CompactTextString(m) } +func (*ListenerFilter) ProtoMessage() {} +func (*ListenerFilter) Descriptor() ([]byte, []int) { + return fileDescriptor_listener_3375c0acf9db00a4, []int{3} +} +func (m *ListenerFilter) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ListenerFilter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ListenerFilter.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *ListenerFilter) XXX_Merge(src proto.Message) { + xxx_messageInfo_ListenerFilter.Merge(dst, src) +} +func (m *ListenerFilter) XXX_Size() int { + return m.Size() +} +func (m *ListenerFilter) XXX_DiscardUnknown() { + xxx_messageInfo_ListenerFilter.DiscardUnknown(m) +} + +var xxx_messageInfo_ListenerFilter proto.InternalMessageInfo + +func (m *ListenerFilter) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *ListenerFilter) GetConfig() *types.Struct { + if m != nil { + return m.Config + } + return nil +} + +func init() { + proto.RegisterType((*Filter)(nil), "envoy.api.v2.listener.Filter") + proto.RegisterType((*Filter_DeprecatedV1)(nil), "envoy.api.v2.listener.Filter.DeprecatedV1") + proto.RegisterType((*FilterChainMatch)(nil), "envoy.api.v2.listener.FilterChainMatch") + proto.RegisterType((*FilterChain)(nil), "envoy.api.v2.listener.FilterChain") + proto.RegisterType((*ListenerFilter)(nil), "envoy.api.v2.listener.ListenerFilter") +} +func (this *Filter) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Filter) + if !ok { + that2, ok := that.(Filter) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Name != that1.Name { + return false + } + if !this.Config.Equal(that1.Config) { + return false + } + if !this.DeprecatedV1.Equal(that1.DeprecatedV1) { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *Filter_DeprecatedV1) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Filter_DeprecatedV1) + if !ok { + that2, ok := that.(Filter_DeprecatedV1) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Type != that1.Type { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *FilterChainMatch) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*FilterChainMatch) + if !ok { + that2, ok := that.(FilterChainMatch) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.DestinationPort.Equal(that1.DestinationPort) { + return false + } + if len(this.PrefixRanges) != len(that1.PrefixRanges) { + return false + } + for i := range this.PrefixRanges { + if !this.PrefixRanges[i].Equal(that1.PrefixRanges[i]) { + return false + } + } + if this.AddressSuffix != that1.AddressSuffix { + return false + } + if !this.SuffixLen.Equal(that1.SuffixLen) { + return false + } + if len(this.SourcePrefixRanges) != len(that1.SourcePrefixRanges) { + return false + } + for i := range this.SourcePrefixRanges { + if !this.SourcePrefixRanges[i].Equal(that1.SourcePrefixRanges[i]) { + return false + } + } + if len(this.SourcePorts) != len(that1.SourcePorts) { + return false + } + for i := range this.SourcePorts { + if !this.SourcePorts[i].Equal(that1.SourcePorts[i]) { + return false + } + } + if len(this.ServerNames) != len(that1.ServerNames) { + return false + } + for i := range this.ServerNames { + if this.ServerNames[i] != that1.ServerNames[i] { + return false + } + } + if this.TransportProtocol != that1.TransportProtocol { + return false + } + if len(this.ApplicationProtocols) != len(that1.ApplicationProtocols) { + return false + } + for i := range this.ApplicationProtocols { + if this.ApplicationProtocols[i] != that1.ApplicationProtocols[i] { + return false + } + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *FilterChain) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*FilterChain) + if !ok { + that2, ok := that.(FilterChain) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.FilterChainMatch.Equal(that1.FilterChainMatch) { + return false + } + if !this.TlsContext.Equal(that1.TlsContext) { + return false + } + if len(this.Filters) != len(that1.Filters) { + return false + } + for i := range this.Filters { + if !this.Filters[i].Equal(&that1.Filters[i]) { + return false + } + } + if !this.UseProxyProto.Equal(that1.UseProxyProto) { + return false + } + if !this.Metadata.Equal(that1.Metadata) { + return false + } + if !this.TransportSocket.Equal(that1.TransportSocket) { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *ListenerFilter) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*ListenerFilter) + if !ok { + that2, ok := that.(ListenerFilter) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Name != that1.Name { + return false + } + if !this.Config.Equal(that1.Config) { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (m *Filter) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Filter) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Name) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintListener(dAtA, i, uint64(len(m.Name))) + i += copy(dAtA[i:], m.Name) + } + if m.Config != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintListener(dAtA, i, uint64(m.Config.Size())) + n1, err := m.Config.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n1 + } + if m.DeprecatedV1 != nil { + dAtA[i] = 0x1a + i++ + i = encodeVarintListener(dAtA, i, uint64(m.DeprecatedV1.Size())) + n2, err := m.DeprecatedV1.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n2 + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *Filter_DeprecatedV1) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Filter_DeprecatedV1) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Type) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintListener(dAtA, i, uint64(len(m.Type))) + i += copy(dAtA[i:], m.Type) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *FilterChainMatch) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *FilterChainMatch) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.PrefixRanges) > 0 { + for _, msg := range m.PrefixRanges { + dAtA[i] = 0x1a + i++ + i = encodeVarintListener(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if len(m.AddressSuffix) > 0 { + dAtA[i] = 0x22 + i++ + i = encodeVarintListener(dAtA, i, uint64(len(m.AddressSuffix))) + i += copy(dAtA[i:], m.AddressSuffix) + } + if m.SuffixLen != nil { + dAtA[i] = 0x2a + i++ + i = encodeVarintListener(dAtA, i, uint64(m.SuffixLen.Size())) + n3, err := m.SuffixLen.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n3 + } + if len(m.SourcePrefixRanges) > 0 { + for _, msg := range m.SourcePrefixRanges { + dAtA[i] = 0x32 + i++ + i = encodeVarintListener(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if len(m.SourcePorts) > 0 { + for _, msg := range m.SourcePorts { + dAtA[i] = 0x3a + i++ + i = encodeVarintListener(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if m.DestinationPort != nil { + dAtA[i] = 0x42 + i++ + i = encodeVarintListener(dAtA, i, uint64(m.DestinationPort.Size())) + n4, err := m.DestinationPort.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n4 + } + if len(m.TransportProtocol) > 0 { + dAtA[i] = 0x4a + i++ + i = encodeVarintListener(dAtA, i, uint64(len(m.TransportProtocol))) + i += copy(dAtA[i:], m.TransportProtocol) + } + if len(m.ApplicationProtocols) > 0 { + for _, s := range m.ApplicationProtocols { + dAtA[i] = 0x52 + i++ + l = len(s) + for l >= 1<<7 { + dAtA[i] = uint8(uint64(l)&0x7f | 0x80) + l >>= 7 + i++ + } + dAtA[i] = uint8(l) + i++ + i += copy(dAtA[i:], s) + } + } + if len(m.ServerNames) > 0 { + for _, s := range m.ServerNames { + dAtA[i] = 0x5a + i++ + l = len(s) + for l >= 1<<7 { + dAtA[i] = uint8(uint64(l)&0x7f | 0x80) + l >>= 7 + i++ + } + dAtA[i] = uint8(l) + i++ + i += copy(dAtA[i:], s) + } + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *FilterChain) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *FilterChain) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.FilterChainMatch != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintListener(dAtA, i, uint64(m.FilterChainMatch.Size())) + n5, err := m.FilterChainMatch.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n5 + } + if m.TlsContext != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintListener(dAtA, i, uint64(m.TlsContext.Size())) + n6, err := m.TlsContext.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n6 + } + if len(m.Filters) > 0 { + for _, msg := range m.Filters { + dAtA[i] = 0x1a + i++ + i = encodeVarintListener(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if m.UseProxyProto != nil { + dAtA[i] = 0x22 + i++ + i = encodeVarintListener(dAtA, i, uint64(m.UseProxyProto.Size())) + n7, err := m.UseProxyProto.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n7 + } + if m.Metadata != nil { + dAtA[i] = 0x2a + i++ + i = encodeVarintListener(dAtA, i, uint64(m.Metadata.Size())) + n8, err := m.Metadata.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n8 + } + if m.TransportSocket != nil { + dAtA[i] = 0x32 + i++ + i = encodeVarintListener(dAtA, i, uint64(m.TransportSocket.Size())) + n9, err := m.TransportSocket.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n9 + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *ListenerFilter) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ListenerFilter) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Name) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintListener(dAtA, i, uint64(len(m.Name))) + i += copy(dAtA[i:], m.Name) + } + if m.Config != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintListener(dAtA, i, uint64(m.Config.Size())) + n10, err := m.Config.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n10 + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func encodeVarintListener(dAtA []byte, offset int, v uint64) int { + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return offset + 1 +} +func (m *Filter) Size() (n int) { + var l int + _ = l + l = len(m.Name) + if l > 0 { + n += 1 + l + sovListener(uint64(l)) + } + if m.Config != nil { + l = m.Config.Size() + n += 1 + l + sovListener(uint64(l)) + } + if m.DeprecatedV1 != nil { + l = m.DeprecatedV1.Size() + n += 1 + l + sovListener(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *Filter_DeprecatedV1) Size() (n int) { + var l int + _ = l + l = len(m.Type) + if l > 0 { + n += 1 + l + sovListener(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *FilterChainMatch) Size() (n int) { + var l int + _ = l + if len(m.PrefixRanges) > 0 { + for _, e := range m.PrefixRanges { + l = e.Size() + n += 1 + l + sovListener(uint64(l)) + } + } + l = len(m.AddressSuffix) + if l > 0 { + n += 1 + l + sovListener(uint64(l)) + } + if m.SuffixLen != nil { + l = m.SuffixLen.Size() + n += 1 + l + sovListener(uint64(l)) + } + if len(m.SourcePrefixRanges) > 0 { + for _, e := range m.SourcePrefixRanges { + l = e.Size() + n += 1 + l + sovListener(uint64(l)) + } + } + if len(m.SourcePorts) > 0 { + for _, e := range m.SourcePorts { + l = e.Size() + n += 1 + l + sovListener(uint64(l)) + } + } + if m.DestinationPort != nil { + l = m.DestinationPort.Size() + n += 1 + l + sovListener(uint64(l)) + } + l = len(m.TransportProtocol) + if l > 0 { + n += 1 + l + sovListener(uint64(l)) + } + if len(m.ApplicationProtocols) > 0 { + for _, s := range m.ApplicationProtocols { + l = len(s) + n += 1 + l + sovListener(uint64(l)) + } + } + if len(m.ServerNames) > 0 { + for _, s := range m.ServerNames { + l = len(s) + n += 1 + l + sovListener(uint64(l)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *FilterChain) Size() (n int) { + var l int + _ = l + if m.FilterChainMatch != nil { + l = m.FilterChainMatch.Size() + n += 1 + l + sovListener(uint64(l)) + } + if m.TlsContext != nil { + l = m.TlsContext.Size() + n += 1 + l + sovListener(uint64(l)) + } + if len(m.Filters) > 0 { + for _, e := range m.Filters { + l = e.Size() + n += 1 + l + sovListener(uint64(l)) + } + } + if m.UseProxyProto != nil { + l = m.UseProxyProto.Size() + n += 1 + l + sovListener(uint64(l)) + } + if m.Metadata != nil { + l = m.Metadata.Size() + n += 1 + l + sovListener(uint64(l)) + } + if m.TransportSocket != nil { + l = m.TransportSocket.Size() + n += 1 + l + sovListener(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *ListenerFilter) Size() (n int) { + var l int + _ = l + l = len(m.Name) + if l > 0 { + n += 1 + l + sovListener(uint64(l)) + } + if m.Config != nil { + l = m.Config.Size() + n += 1 + l + sovListener(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func sovListener(x uint64) (n int) { + for { + n++ + x >>= 7 + if x == 0 { + break + } + } + return n +} +func sozListener(x uint64) (n int) { + return sovListener(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Filter) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowListener + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Filter: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Filter: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowListener + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthListener + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Config", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowListener + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthListener + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Config == nil { + m.Config = &types.Struct{} + } + if err := m.Config.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DeprecatedV1", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowListener + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthListener + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.DeprecatedV1 == nil { + m.DeprecatedV1 = &Filter_DeprecatedV1{} + } + if err := m.DeprecatedV1.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipListener(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthListener + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Filter_DeprecatedV1) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowListener + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DeprecatedV1: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DeprecatedV1: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowListener + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthListener + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Type = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipListener(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthListener + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *FilterChainMatch) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowListener + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: FilterChainMatch: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: FilterChainMatch: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PrefixRanges", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowListener + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthListener + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PrefixRanges = append(m.PrefixRanges, &core.CidrRange{}) + if err := m.PrefixRanges[len(m.PrefixRanges)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AddressSuffix", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowListener + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthListener + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.AddressSuffix = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SuffixLen", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowListener + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthListener + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.SuffixLen == nil { + m.SuffixLen = &types.UInt32Value{} + } + if err := m.SuffixLen.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SourcePrefixRanges", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowListener + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthListener + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SourcePrefixRanges = append(m.SourcePrefixRanges, &core.CidrRange{}) + if err := m.SourcePrefixRanges[len(m.SourcePrefixRanges)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SourcePorts", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowListener + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthListener + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SourcePorts = append(m.SourcePorts, &types.UInt32Value{}) + if err := m.SourcePorts[len(m.SourcePorts)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DestinationPort", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowListener + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthListener + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.DestinationPort == nil { + m.DestinationPort = &types.UInt32Value{} + } + if err := m.DestinationPort.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TransportProtocol", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowListener + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthListener + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TransportProtocol = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 10: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ApplicationProtocols", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowListener + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthListener + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ApplicationProtocols = append(m.ApplicationProtocols, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 11: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ServerNames", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowListener + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthListener + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ServerNames = append(m.ServerNames, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipListener(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthListener + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *FilterChain) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowListener + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: FilterChain: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: FilterChain: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FilterChainMatch", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowListener + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthListener + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.FilterChainMatch == nil { + m.FilterChainMatch = &FilterChainMatch{} + } + if err := m.FilterChainMatch.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TlsContext", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowListener + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthListener + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.TlsContext == nil { + m.TlsContext = &auth.DownstreamTlsContext{} + } + if err := m.TlsContext.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Filters", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowListener + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthListener + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Filters = append(m.Filters, Filter{}) + if err := m.Filters[len(m.Filters)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field UseProxyProto", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowListener + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthListener + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.UseProxyProto == nil { + m.UseProxyProto = &types.BoolValue{} + } + if err := m.UseProxyProto.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Metadata", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowListener + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthListener + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Metadata == nil { + m.Metadata = &core.Metadata{} + } + if err := m.Metadata.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TransportSocket", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowListener + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthListener + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.TransportSocket == nil { + m.TransportSocket = &core.TransportSocket{} + } + if err := m.TransportSocket.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipListener(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthListener + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ListenerFilter) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowListener + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ListenerFilter: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ListenerFilter: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowListener + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthListener + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Config", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowListener + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthListener + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Config == nil { + m.Config = &types.Struct{} + } + if err := m.Config.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipListener(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthListener + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipListener(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowListener + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowListener + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + return iNdEx, nil + case 1: + iNdEx += 8 + return iNdEx, nil + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowListener + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + iNdEx += length + if length < 0 { + return 0, ErrInvalidLengthListener + } + return iNdEx, nil + case 3: + for { + var innerWire uint64 + var start int = iNdEx + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowListener + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + innerWire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + innerWireType := int(innerWire & 0x7) + if innerWireType == 4 { + break + } + next, err := skipListener(dAtA[start:]) + if err != nil { + return 0, err + } + iNdEx = start + next + } + return iNdEx, nil + case 4: + return iNdEx, nil + case 5: + iNdEx += 4 + return iNdEx, nil + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + } + panic("unreachable") +} + +var ( + ErrInvalidLengthListener = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowListener = fmt.Errorf("proto: integer overflow") +) + +func init() { + proto.RegisterFile("envoy/api/v2/listener/listener.proto", fileDescriptor_listener_3375c0acf9db00a4) +} + +var fileDescriptor_listener_3375c0acf9db00a4 = []byte{ + // 782 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x54, 0x41, 0x4f, 0xdb, 0x48, + 0x18, 0x5d, 0x27, 0xd9, 0x90, 0x8c, 0x13, 0xc8, 0x8e, 0x40, 0x58, 0x59, 0x08, 0xd9, 0x68, 0x57, + 0x1b, 0x21, 0xad, 0x2d, 0xcc, 0x4a, 0x7b, 0x58, 0xad, 0x56, 0x04, 0x5a, 0xb5, 0x15, 0x20, 0xe4, + 0x40, 0x0e, 0xbd, 0xb8, 0x83, 0x3d, 0x09, 0xa3, 0x3a, 0x33, 0xd6, 0xcc, 0x38, 0x84, 0x7f, 0x54, + 0xf5, 0x1f, 0xb4, 0xea, 0xa1, 0x47, 0x8e, 0xed, 0x1f, 0xa8, 0xaa, 0xdc, 0xfa, 0x2b, 0xa8, 0x3c, + 0xb6, 0x43, 0x02, 0x11, 0xed, 0xa5, 0xb7, 0x6f, 0xbe, 0xef, 0xbd, 0x97, 0x37, 0xdf, 0xbc, 0x18, + 0xfc, 0x8e, 0xe9, 0x88, 0x5d, 0x59, 0x28, 0x24, 0xd6, 0xc8, 0xb6, 0x02, 0x22, 0x24, 0xa6, 0x98, + 0x4f, 0x0b, 0x33, 0xe4, 0x4c, 0x32, 0xb8, 0xa6, 0x50, 0x26, 0x0a, 0x89, 0x39, 0xb2, 0xcd, 0x6c, + 0x58, 0xdf, 0x9a, 0x23, 0x7b, 0x8c, 0x63, 0x0b, 0xf9, 0x3e, 0xc7, 0x42, 0x24, 0xbc, 0xfa, 0xc6, + 0x1c, 0x00, 0x45, 0xf2, 0xc2, 0xf2, 0x30, 0x97, 0x0b, 0xa7, 0x8a, 0x7e, 0x8e, 0x04, 0xce, 0xa6, + 0x03, 0xc6, 0x06, 0x01, 0xb6, 0xd4, 0xe9, 0x3c, 0xea, 0x5b, 0x42, 0xf2, 0xc8, 0xcb, 0xb8, 0x8d, + 0xbb, 0xd3, 0x4b, 0x8e, 0xc2, 0x10, 0xf3, 0xec, 0x97, 0xd7, 0x47, 0x28, 0x20, 0x3e, 0x92, 0xd8, + 0xca, 0x8a, 0x74, 0xb0, 0x3a, 0x60, 0x03, 0xa6, 0x4a, 0x2b, 0xae, 0x92, 0x6e, 0xeb, 0xa3, 0x06, + 0x8a, 0x8f, 0x49, 0x20, 0x31, 0x87, 0x9b, 0xa0, 0x40, 0xd1, 0x10, 0x1b, 0x5a, 0x53, 0x6b, 0x97, + 0x3b, 0xe5, 0xb7, 0x5f, 0xde, 0xe7, 0x0b, 0x3c, 0xd7, 0xd4, 0x1c, 0xd5, 0x86, 0x16, 0x28, 0x7a, + 0x8c, 0xf6, 0xc9, 0xc0, 0xc8, 0x35, 0xb5, 0xb6, 0x6e, 0xaf, 0x9b, 0x89, 0x13, 0x33, 0x73, 0x62, + 0x76, 0x95, 0x4f, 0x27, 0x85, 0xc1, 0x2e, 0xa8, 0xfa, 0x38, 0xe4, 0xd8, 0x43, 0x12, 0xfb, 0xee, + 0x68, 0xc7, 0xc8, 0x2b, 0xde, 0xb6, 0xb9, 0x70, 0xa7, 0x66, 0xe2, 0xc2, 0x3c, 0x98, 0x52, 0x7a, + 0x3b, 0x9d, 0x9c, 0xa1, 0x39, 0x15, 0x7f, 0xa6, 0x53, 0x6f, 0x81, 0xca, 0x2c, 0x02, 0x42, 0x50, + 0x90, 0x57, 0x61, 0x6a, 0xda, 0x51, 0x75, 0xeb, 0x5d, 0x01, 0xd4, 0x12, 0xb5, 0xfd, 0x0b, 0x44, + 0xe8, 0x11, 0x92, 0xde, 0x05, 0xdc, 0x03, 0xd5, 0x90, 0xe3, 0x3e, 0x19, 0xbb, 0x1c, 0xd1, 0x01, + 0x16, 0x46, 0xbe, 0x99, 0x6f, 0xeb, 0xf6, 0xc6, 0xbc, 0x9b, 0xf8, 0x2d, 0xcc, 0x7d, 0xe2, 0x73, + 0x27, 0x06, 0x39, 0x95, 0x84, 0xa2, 0x0e, 0x02, 0xfe, 0x01, 0x96, 0xd3, 0x57, 0x76, 0x45, 0xd4, + 0xef, 0x93, 0xb1, 0x51, 0x50, 0xbf, 0x5a, 0x4d, 0xbb, 0x5d, 0xd5, 0x84, 0xff, 0x02, 0x90, 0x8c, + 0xdd, 0x00, 0x53, 0xe3, 0x67, 0x75, 0xe9, 0x8d, 0x7b, 0xcb, 0x3a, 0x7b, 0x4a, 0xe5, 0xae, 0xdd, + 0x43, 0x41, 0x84, 0x9d, 0x72, 0x82, 0x3f, 0xc4, 0x14, 0x1e, 0x83, 0x55, 0xc1, 0x22, 0xee, 0x61, + 0x77, 0xde, 0x6d, 0xf1, 0x3b, 0xdc, 0xc2, 0x84, 0x79, 0x32, 0xeb, 0xf9, 0x7f, 0x50, 0xc9, 0xf4, + 0x18, 0x97, 0xc2, 0x58, 0x4a, 0x75, 0x1e, 0xb2, 0xa3, 0xa7, 0x3a, 0x31, 0x01, 0xf6, 0x40, 0xcd, + 0xc7, 0x42, 0x12, 0x8a, 0x24, 0x61, 0x54, 0xa9, 0x18, 0xa5, 0x6f, 0xdf, 0xa9, 0x53, 0x8d, 0xf3, + 0x53, 0xda, 0x2e, 0x1a, 0x37, 0x37, 0xf9, 0xb6, 0xe6, 0xac, 0xcc, 0x88, 0xc4, 0xc2, 0xf0, 0x2f, + 0x00, 0x25, 0x47, 0x54, 0xc4, 0x82, 0xae, 0x52, 0xf0, 0x58, 0x60, 0x94, 0xd5, 0x42, 0x7f, 0x99, + 0x4e, 0x4e, 0xd2, 0x01, 0xdc, 0x05, 0x6b, 0x28, 0x0c, 0x03, 0xe2, 0xa5, 0x36, 0xd2, 0xbe, 0x30, + 0x40, 0x33, 0xdf, 0x2e, 0x3b, 0xab, 0x33, 0xc3, 0x8c, 0x23, 0xe0, 0x6f, 0xa0, 0x22, 0x30, 0x1f, + 0x61, 0xee, 0xc6, 0x09, 0x16, 0x86, 0xae, 0xb0, 0x7a, 0xd2, 0x3b, 0x8e, 0x5b, 0xcf, 0x0a, 0x25, + 0xad, 0x96, 0x73, 0x74, 0x41, 0x89, 0xeb, 0xb3, 0x21, 0x22, 0x54, 0xb4, 0xde, 0xe4, 0x81, 0x3e, + 0x13, 0x1f, 0x78, 0x06, 0x60, 0x5f, 0x1d, 0x5d, 0x2f, 0x3e, 0xbb, 0xc3, 0x38, 0x4f, 0x2a, 0x70, + 0xba, 0xfd, 0xe7, 0x83, 0x61, 0xbe, 0x8d, 0x9f, 0x53, 0xeb, 0xdf, 0x0d, 0xe4, 0x13, 0xa0, 0xcb, + 0x40, 0xb8, 0x1e, 0xa3, 0x12, 0x8f, 0x65, 0xfa, 0xa7, 0xba, 0xa3, 0x17, 0x7f, 0x38, 0xcc, 0x03, + 0x76, 0x49, 0x85, 0xe4, 0x18, 0x0d, 0x4f, 0x03, 0xb1, 0x9f, 0xc0, 0x1d, 0x20, 0xa7, 0x35, 0xfc, + 0x0f, 0x2c, 0x25, 0xea, 0x59, 0xa8, 0x37, 0x1f, 0x74, 0xd5, 0x29, 0x5c, 0x7f, 0xda, 0xfa, 0xc9, + 0xc9, 0x38, 0xb0, 0x03, 0x56, 0x22, 0x11, 0xe7, 0x8d, 0x8d, 0xaf, 0x92, 0xc5, 0xaa, 0x5c, 0xeb, + 0x76, 0xfd, 0xde, 0x03, 0x77, 0x18, 0x0b, 0x92, 0x8c, 0x54, 0x23, 0x81, 0x4f, 0x62, 0x86, 0xda, + 0x36, 0xfc, 0x07, 0x94, 0x86, 0x58, 0x22, 0x1f, 0x49, 0x94, 0x26, 0xfe, 0xd7, 0x05, 0x51, 0x3d, + 0x4a, 0x21, 0xce, 0x14, 0x0c, 0x8f, 0x40, 0xed, 0x36, 0x06, 0x82, 0x79, 0x2f, 0xb1, 0x34, 0x8a, + 0x4a, 0xa0, 0xb5, 0x40, 0xe0, 0x34, 0x83, 0x76, 0x15, 0xd2, 0x59, 0x91, 0xf3, 0x8d, 0xd6, 0x0b, + 0xb0, 0x7c, 0x98, 0xde, 0xf6, 0xc7, 0x7c, 0xd5, 0x3a, 0x7f, 0xbf, 0x9a, 0x34, 0xb4, 0xeb, 0x49, + 0x43, 0xfb, 0x30, 0x69, 0x68, 0x9f, 0x27, 0x0d, 0xed, 0x79, 0x29, 0xdb, 0xef, 0xeb, 0xdc, 0xfa, + 0x23, 0x65, 0x79, 0x2f, 0x24, 0x66, 0xcf, 0x36, 0x33, 0x27, 0xc7, 0xdd, 0xf3, 0xa2, 0x92, 0xdb, + 0xfd, 0x1a, 0x00, 0x00, 0xff, 0xff, 0x9f, 0x6b, 0xd4, 0x7d, 0x76, 0x06, 0x00, 0x00, +} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/listener/listener.pb.validate.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/listener/listener.pb.validate.go new file mode 100644 index 000000000000..ceec95ab7732 --- /dev/null +++ b/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/listener/listener.pb.validate.go @@ -0,0 +1,425 @@ +// Code generated by protoc-gen-validate +// source: envoy/api/v2/listener/listener.proto +// DO NOT EDIT!!! + +package listener + +import ( + "bytes" + "errors" + "fmt" + "net" + "net/mail" + "net/url" + "regexp" + "strings" + "time" + "unicode/utf8" + + "github.com/gogo/protobuf/types" +) + +// ensure the imports are used +var ( + _ = bytes.MinRead + _ = errors.New("") + _ = fmt.Print + _ = utf8.UTFMax + _ = (*regexp.Regexp)(nil) + _ = (*strings.Reader)(nil) + _ = net.IPv4len + _ = time.Duration(0) + _ = (*url.URL)(nil) + _ = (*mail.Address)(nil) + _ = types.DynamicAny{} +) + +// Validate checks the field values on Filter with the rules defined in the +// proto definition for this message. If any rules are violated, an error is returned. +func (m *Filter) Validate() error { + if m == nil { + return nil + } + + if len(m.GetName()) < 1 { + return FilterValidationError{ + Field: "Name", + Reason: "value length must be at least 1 bytes", + } + } + + if v, ok := interface{}(m.GetConfig()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return FilterValidationError{ + Field: "Config", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + if v, ok := interface{}(m.GetDeprecatedV1()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return FilterValidationError{ + Field: "DeprecatedV1", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + return nil +} + +// FilterValidationError is the validation error returned by Filter.Validate if +// the designated constraints aren't met. +type FilterValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e FilterValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sFilter.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = FilterValidationError{} + +// Validate checks the field values on FilterChainMatch with the rules defined +// in the proto definition for this message. If any rules are violated, an +// error is returned. +func (m *FilterChainMatch) Validate() error { + if m == nil { + return nil + } + + if wrapper := m.GetDestinationPort(); wrapper != nil { + + if val := wrapper.GetValue(); val < 1 || val > 65535 { + return FilterChainMatchValidationError{ + Field: "DestinationPort", + Reason: "value must be inside range [1, 65535]", + } + } + + } + + for idx, item := range m.GetPrefixRanges() { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return FilterChainMatchValidationError{ + Field: fmt.Sprintf("PrefixRanges[%v]", idx), + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + } + + // no validation rules for AddressSuffix + + if v, ok := interface{}(m.GetSuffixLen()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return FilterChainMatchValidationError{ + Field: "SuffixLen", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + for idx, item := range m.GetSourcePrefixRanges() { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return FilterChainMatchValidationError{ + Field: fmt.Sprintf("SourcePrefixRanges[%v]", idx), + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + } + + for idx, item := range m.GetSourcePorts() { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return FilterChainMatchValidationError{ + Field: fmt.Sprintf("SourcePorts[%v]", idx), + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + } + + // no validation rules for TransportProtocol + + return nil +} + +// FilterChainMatchValidationError is the validation error returned by +// FilterChainMatch.Validate if the designated constraints aren't met. +type FilterChainMatchValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e FilterChainMatchValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sFilterChainMatch.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = FilterChainMatchValidationError{} + +// Validate checks the field values on FilterChain with the rules defined in +// the proto definition for this message. If any rules are violated, an error +// is returned. +func (m *FilterChain) Validate() error { + if m == nil { + return nil + } + + if v, ok := interface{}(m.GetFilterChainMatch()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return FilterChainValidationError{ + Field: "FilterChainMatch", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + if v, ok := interface{}(m.GetTlsContext()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return FilterChainValidationError{ + Field: "TlsContext", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + for idx, item := range m.GetFilters() { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return FilterChainValidationError{ + Field: fmt.Sprintf("Filters[%v]", idx), + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + } + + if v, ok := interface{}(m.GetUseProxyProto()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return FilterChainValidationError{ + Field: "UseProxyProto", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + if v, ok := interface{}(m.GetMetadata()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return FilterChainValidationError{ + Field: "Metadata", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + if v, ok := interface{}(m.GetTransportSocket()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return FilterChainValidationError{ + Field: "TransportSocket", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + return nil +} + +// FilterChainValidationError is the validation error returned by +// FilterChain.Validate if the designated constraints aren't met. +type FilterChainValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e FilterChainValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sFilterChain.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = FilterChainValidationError{} + +// Validate checks the field values on ListenerFilter with the rules defined in +// the proto definition for this message. If any rules are violated, an error +// is returned. +func (m *ListenerFilter) Validate() error { + if m == nil { + return nil + } + + if len(m.GetName()) < 1 { + return ListenerFilterValidationError{ + Field: "Name", + Reason: "value length must be at least 1 bytes", + } + } + + if v, ok := interface{}(m.GetConfig()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return ListenerFilterValidationError{ + Field: "Config", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + return nil +} + +// ListenerFilterValidationError is the validation error returned by +// ListenerFilter.Validate if the designated constraints aren't met. +type ListenerFilterValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e ListenerFilterValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sListenerFilter.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = ListenerFilterValidationError{} + +// Validate checks the field values on Filter_DeprecatedV1 with the rules +// defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *Filter_DeprecatedV1) Validate() error { + if m == nil { + return nil + } + + // no validation rules for Type + + return nil +} + +// Filter_DeprecatedV1ValidationError is the validation error returned by +// Filter_DeprecatedV1.Validate if the designated constraints aren't met. +type Filter_DeprecatedV1ValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e Filter_DeprecatedV1ValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sFilter_DeprecatedV1.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = Filter_DeprecatedV1ValidationError{} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/rds.pb.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/rds.pb.go new file mode 100644 index 000000000000..fa69c2103d9a --- /dev/null +++ b/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/rds.pb.go @@ -0,0 +1,1019 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: envoy/api/v2/rds.proto + +package v2 + +import proto "github.com/gogo/protobuf/proto" +import fmt "fmt" +import math "math" +import core "github.com/envoyproxy/go-control-plane/envoy/api/v2/core" +import route "github.com/envoyproxy/go-control-plane/envoy/api/v2/route" +import _ "github.com/gogo/googleapis/google/api" +import _ "github.com/gogo/protobuf/gogoproto" +import types "github.com/gogo/protobuf/types" + +import bytes "bytes" + +import context "golang.org/x/net/context" +import grpc "google.golang.org/grpc" + +import io "io" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package + +type RouteConfiguration struct { + // The name of the route configuration. For example, it might match + // :ref:`route_config_name + // ` in + // :ref:`envoy_api_msg_config.filter.network.http_connection_manager.v2.Rds`. + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // An array of virtual hosts that make up the route table. + VirtualHosts []route.VirtualHost `protobuf:"bytes,2,rep,name=virtual_hosts,json=virtualHosts" json:"virtual_hosts"` + // Optionally specifies a list of HTTP headers that the connection manager + // will consider to be internal only. If they are found on external requests they will be cleaned + // prior to filter invocation. See :ref:`config_http_conn_man_headers_x-envoy-internal` for more + // information. + InternalOnlyHeaders []string `protobuf:"bytes,3,rep,name=internal_only_headers,json=internalOnlyHeaders" json:"internal_only_headers,omitempty"` + // Specifies a list of HTTP headers that should be added to each response that + // the connection manager encodes. Headers specified at this level are applied + // after headers from any enclosed :ref:`envoy_api_msg_route.VirtualHost` or + // :ref:`envoy_api_msg_route.RouteAction`. For more information, including details on + // header value syntax, see the documentation on :ref:`custom request headers + // `. + ResponseHeadersToAdd []*core.HeaderValueOption `protobuf:"bytes,4,rep,name=response_headers_to_add,json=responseHeadersToAdd" json:"response_headers_to_add,omitempty"` + // Specifies a list of HTTP headers that should be removed from each response + // that the connection manager encodes. + ResponseHeadersToRemove []string `protobuf:"bytes,5,rep,name=response_headers_to_remove,json=responseHeadersToRemove" json:"response_headers_to_remove,omitempty"` + // Specifies a list of HTTP headers that should be added to each request + // routed by the HTTP connection manager. Headers specified at this level are + // applied after headers from any enclosed :ref:`envoy_api_msg_route.VirtualHost` or + // :ref:`envoy_api_msg_route.RouteAction`. For more information, including details on + // header value syntax, see the documentation on :ref:`custom request headers + // `. + RequestHeadersToAdd []*core.HeaderValueOption `protobuf:"bytes,6,rep,name=request_headers_to_add,json=requestHeadersToAdd" json:"request_headers_to_add,omitempty"` + // An optional boolean that specifies whether the clusters that the route + // table refers to will be validated by the cluster manager. If set to true + // and a route refers to a non-existent cluster, the route table will not + // load. If set to false and a route refers to a non-existent cluster, the + // route table will load and the router filter will return a 404 if the route + // is selected at runtime. This setting defaults to true if the route table + // is statically defined via the :ref:`route_config + // ` + // option. This setting default to false if the route table is loaded dynamically via the + // :ref:`rds + // ` + // option. Users may which to override the default behavior in certain cases (for example when + // using CDS with a static route table). + ValidateClusters *types.BoolValue `protobuf:"bytes,7,opt,name=validate_clusters,json=validateClusters" json:"validate_clusters,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *RouteConfiguration) Reset() { *m = RouteConfiguration{} } +func (m *RouteConfiguration) String() string { return proto.CompactTextString(m) } +func (*RouteConfiguration) ProtoMessage() {} +func (*RouteConfiguration) Descriptor() ([]byte, []int) { + return fileDescriptor_rds_49b8428ed0bf9596, []int{0} +} +func (m *RouteConfiguration) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RouteConfiguration) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_RouteConfiguration.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *RouteConfiguration) XXX_Merge(src proto.Message) { + xxx_messageInfo_RouteConfiguration.Merge(dst, src) +} +func (m *RouteConfiguration) XXX_Size() int { + return m.Size() +} +func (m *RouteConfiguration) XXX_DiscardUnknown() { + xxx_messageInfo_RouteConfiguration.DiscardUnknown(m) +} + +var xxx_messageInfo_RouteConfiguration proto.InternalMessageInfo + +func (m *RouteConfiguration) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *RouteConfiguration) GetVirtualHosts() []route.VirtualHost { + if m != nil { + return m.VirtualHosts + } + return nil +} + +func (m *RouteConfiguration) GetInternalOnlyHeaders() []string { + if m != nil { + return m.InternalOnlyHeaders + } + return nil +} + +func (m *RouteConfiguration) GetResponseHeadersToAdd() []*core.HeaderValueOption { + if m != nil { + return m.ResponseHeadersToAdd + } + return nil +} + +func (m *RouteConfiguration) GetResponseHeadersToRemove() []string { + if m != nil { + return m.ResponseHeadersToRemove + } + return nil +} + +func (m *RouteConfiguration) GetRequestHeadersToAdd() []*core.HeaderValueOption { + if m != nil { + return m.RequestHeadersToAdd + } + return nil +} + +func (m *RouteConfiguration) GetValidateClusters() *types.BoolValue { + if m != nil { + return m.ValidateClusters + } + return nil +} + +func init() { + proto.RegisterType((*RouteConfiguration)(nil), "envoy.api.v2.RouteConfiguration") +} +func (this *RouteConfiguration) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*RouteConfiguration) + if !ok { + that2, ok := that.(RouteConfiguration) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Name != that1.Name { + return false + } + if len(this.VirtualHosts) != len(that1.VirtualHosts) { + return false + } + for i := range this.VirtualHosts { + if !this.VirtualHosts[i].Equal(&that1.VirtualHosts[i]) { + return false + } + } + if len(this.InternalOnlyHeaders) != len(that1.InternalOnlyHeaders) { + return false + } + for i := range this.InternalOnlyHeaders { + if this.InternalOnlyHeaders[i] != that1.InternalOnlyHeaders[i] { + return false + } + } + if len(this.ResponseHeadersToAdd) != len(that1.ResponseHeadersToAdd) { + return false + } + for i := range this.ResponseHeadersToAdd { + if !this.ResponseHeadersToAdd[i].Equal(that1.ResponseHeadersToAdd[i]) { + return false + } + } + if len(this.ResponseHeadersToRemove) != len(that1.ResponseHeadersToRemove) { + return false + } + for i := range this.ResponseHeadersToRemove { + if this.ResponseHeadersToRemove[i] != that1.ResponseHeadersToRemove[i] { + return false + } + } + if len(this.RequestHeadersToAdd) != len(that1.RequestHeadersToAdd) { + return false + } + for i := range this.RequestHeadersToAdd { + if !this.RequestHeadersToAdd[i].Equal(that1.RequestHeadersToAdd[i]) { + return false + } + } + if !this.ValidateClusters.Equal(that1.ValidateClusters) { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// Client API for RouteDiscoveryService service + +type RouteDiscoveryServiceClient interface { + StreamRoutes(ctx context.Context, opts ...grpc.CallOption) (RouteDiscoveryService_StreamRoutesClient, error) + IncrementalRoutes(ctx context.Context, opts ...grpc.CallOption) (RouteDiscoveryService_IncrementalRoutesClient, error) + FetchRoutes(ctx context.Context, in *DiscoveryRequest, opts ...grpc.CallOption) (*DiscoveryResponse, error) +} + +type routeDiscoveryServiceClient struct { + cc *grpc.ClientConn +} + +func NewRouteDiscoveryServiceClient(cc *grpc.ClientConn) RouteDiscoveryServiceClient { + return &routeDiscoveryServiceClient{cc} +} + +func (c *routeDiscoveryServiceClient) StreamRoutes(ctx context.Context, opts ...grpc.CallOption) (RouteDiscoveryService_StreamRoutesClient, error) { + stream, err := c.cc.NewStream(ctx, &_RouteDiscoveryService_serviceDesc.Streams[0], "/envoy.api.v2.RouteDiscoveryService/StreamRoutes", opts...) + if err != nil { + return nil, err + } + x := &routeDiscoveryServiceStreamRoutesClient{stream} + return x, nil +} + +type RouteDiscoveryService_StreamRoutesClient interface { + Send(*DiscoveryRequest) error + Recv() (*DiscoveryResponse, error) + grpc.ClientStream +} + +type routeDiscoveryServiceStreamRoutesClient struct { + grpc.ClientStream +} + +func (x *routeDiscoveryServiceStreamRoutesClient) Send(m *DiscoveryRequest) error { + return x.ClientStream.SendMsg(m) +} + +func (x *routeDiscoveryServiceStreamRoutesClient) Recv() (*DiscoveryResponse, error) { + m := new(DiscoveryResponse) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *routeDiscoveryServiceClient) IncrementalRoutes(ctx context.Context, opts ...grpc.CallOption) (RouteDiscoveryService_IncrementalRoutesClient, error) { + stream, err := c.cc.NewStream(ctx, &_RouteDiscoveryService_serviceDesc.Streams[1], "/envoy.api.v2.RouteDiscoveryService/IncrementalRoutes", opts...) + if err != nil { + return nil, err + } + x := &routeDiscoveryServiceIncrementalRoutesClient{stream} + return x, nil +} + +type RouteDiscoveryService_IncrementalRoutesClient interface { + Send(*IncrementalDiscoveryRequest) error + Recv() (*IncrementalDiscoveryResponse, error) + grpc.ClientStream +} + +type routeDiscoveryServiceIncrementalRoutesClient struct { + grpc.ClientStream +} + +func (x *routeDiscoveryServiceIncrementalRoutesClient) Send(m *IncrementalDiscoveryRequest) error { + return x.ClientStream.SendMsg(m) +} + +func (x *routeDiscoveryServiceIncrementalRoutesClient) Recv() (*IncrementalDiscoveryResponse, error) { + m := new(IncrementalDiscoveryResponse) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *routeDiscoveryServiceClient) FetchRoutes(ctx context.Context, in *DiscoveryRequest, opts ...grpc.CallOption) (*DiscoveryResponse, error) { + out := new(DiscoveryResponse) + err := c.cc.Invoke(ctx, "/envoy.api.v2.RouteDiscoveryService/FetchRoutes", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// Server API for RouteDiscoveryService service + +type RouteDiscoveryServiceServer interface { + StreamRoutes(RouteDiscoveryService_StreamRoutesServer) error + IncrementalRoutes(RouteDiscoveryService_IncrementalRoutesServer) error + FetchRoutes(context.Context, *DiscoveryRequest) (*DiscoveryResponse, error) +} + +func RegisterRouteDiscoveryServiceServer(s *grpc.Server, srv RouteDiscoveryServiceServer) { + s.RegisterService(&_RouteDiscoveryService_serviceDesc, srv) +} + +func _RouteDiscoveryService_StreamRoutes_Handler(srv interface{}, stream grpc.ServerStream) error { + return srv.(RouteDiscoveryServiceServer).StreamRoutes(&routeDiscoveryServiceStreamRoutesServer{stream}) +} + +type RouteDiscoveryService_StreamRoutesServer interface { + Send(*DiscoveryResponse) error + Recv() (*DiscoveryRequest, error) + grpc.ServerStream +} + +type routeDiscoveryServiceStreamRoutesServer struct { + grpc.ServerStream +} + +func (x *routeDiscoveryServiceStreamRoutesServer) Send(m *DiscoveryResponse) error { + return x.ServerStream.SendMsg(m) +} + +func (x *routeDiscoveryServiceStreamRoutesServer) Recv() (*DiscoveryRequest, error) { + m := new(DiscoveryRequest) + if err := x.ServerStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func _RouteDiscoveryService_IncrementalRoutes_Handler(srv interface{}, stream grpc.ServerStream) error { + return srv.(RouteDiscoveryServiceServer).IncrementalRoutes(&routeDiscoveryServiceIncrementalRoutesServer{stream}) +} + +type RouteDiscoveryService_IncrementalRoutesServer interface { + Send(*IncrementalDiscoveryResponse) error + Recv() (*IncrementalDiscoveryRequest, error) + grpc.ServerStream +} + +type routeDiscoveryServiceIncrementalRoutesServer struct { + grpc.ServerStream +} + +func (x *routeDiscoveryServiceIncrementalRoutesServer) Send(m *IncrementalDiscoveryResponse) error { + return x.ServerStream.SendMsg(m) +} + +func (x *routeDiscoveryServiceIncrementalRoutesServer) Recv() (*IncrementalDiscoveryRequest, error) { + m := new(IncrementalDiscoveryRequest) + if err := x.ServerStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func _RouteDiscoveryService_FetchRoutes_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DiscoveryRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(RouteDiscoveryServiceServer).FetchRoutes(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/envoy.api.v2.RouteDiscoveryService/FetchRoutes", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(RouteDiscoveryServiceServer).FetchRoutes(ctx, req.(*DiscoveryRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _RouteDiscoveryService_serviceDesc = grpc.ServiceDesc{ + ServiceName: "envoy.api.v2.RouteDiscoveryService", + HandlerType: (*RouteDiscoveryServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "FetchRoutes", + Handler: _RouteDiscoveryService_FetchRoutes_Handler, + }, + }, + Streams: []grpc.StreamDesc{ + { + StreamName: "StreamRoutes", + Handler: _RouteDiscoveryService_StreamRoutes_Handler, + ServerStreams: true, + ClientStreams: true, + }, + { + StreamName: "IncrementalRoutes", + Handler: _RouteDiscoveryService_IncrementalRoutes_Handler, + ServerStreams: true, + ClientStreams: true, + }, + }, + Metadata: "envoy/api/v2/rds.proto", +} + +func (m *RouteConfiguration) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *RouteConfiguration) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Name) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintRds(dAtA, i, uint64(len(m.Name))) + i += copy(dAtA[i:], m.Name) + } + if len(m.VirtualHosts) > 0 { + for _, msg := range m.VirtualHosts { + dAtA[i] = 0x12 + i++ + i = encodeVarintRds(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if len(m.InternalOnlyHeaders) > 0 { + for _, s := range m.InternalOnlyHeaders { + dAtA[i] = 0x1a + i++ + l = len(s) + for l >= 1<<7 { + dAtA[i] = uint8(uint64(l)&0x7f | 0x80) + l >>= 7 + i++ + } + dAtA[i] = uint8(l) + i++ + i += copy(dAtA[i:], s) + } + } + if len(m.ResponseHeadersToAdd) > 0 { + for _, msg := range m.ResponseHeadersToAdd { + dAtA[i] = 0x22 + i++ + i = encodeVarintRds(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if len(m.ResponseHeadersToRemove) > 0 { + for _, s := range m.ResponseHeadersToRemove { + dAtA[i] = 0x2a + i++ + l = len(s) + for l >= 1<<7 { + dAtA[i] = uint8(uint64(l)&0x7f | 0x80) + l >>= 7 + i++ + } + dAtA[i] = uint8(l) + i++ + i += copy(dAtA[i:], s) + } + } + if len(m.RequestHeadersToAdd) > 0 { + for _, msg := range m.RequestHeadersToAdd { + dAtA[i] = 0x32 + i++ + i = encodeVarintRds(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if m.ValidateClusters != nil { + dAtA[i] = 0x3a + i++ + i = encodeVarintRds(dAtA, i, uint64(m.ValidateClusters.Size())) + n1, err := m.ValidateClusters.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n1 + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func encodeVarintRds(dAtA []byte, offset int, v uint64) int { + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return offset + 1 +} +func (m *RouteConfiguration) Size() (n int) { + var l int + _ = l + l = len(m.Name) + if l > 0 { + n += 1 + l + sovRds(uint64(l)) + } + if len(m.VirtualHosts) > 0 { + for _, e := range m.VirtualHosts { + l = e.Size() + n += 1 + l + sovRds(uint64(l)) + } + } + if len(m.InternalOnlyHeaders) > 0 { + for _, s := range m.InternalOnlyHeaders { + l = len(s) + n += 1 + l + sovRds(uint64(l)) + } + } + if len(m.ResponseHeadersToAdd) > 0 { + for _, e := range m.ResponseHeadersToAdd { + l = e.Size() + n += 1 + l + sovRds(uint64(l)) + } + } + if len(m.ResponseHeadersToRemove) > 0 { + for _, s := range m.ResponseHeadersToRemove { + l = len(s) + n += 1 + l + sovRds(uint64(l)) + } + } + if len(m.RequestHeadersToAdd) > 0 { + for _, e := range m.RequestHeadersToAdd { + l = e.Size() + n += 1 + l + sovRds(uint64(l)) + } + } + if m.ValidateClusters != nil { + l = m.ValidateClusters.Size() + n += 1 + l + sovRds(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func sovRds(x uint64) (n int) { + for { + n++ + x >>= 7 + if x == 0 { + break + } + } + return n +} +func sozRds(x uint64) (n int) { + return sovRds(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *RouteConfiguration) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: RouteConfiguration: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RouteConfiguration: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthRds + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field VirtualHosts", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRds + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.VirtualHosts = append(m.VirtualHosts, route.VirtualHost{}) + if err := m.VirtualHosts[len(m.VirtualHosts)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field InternalOnlyHeaders", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthRds + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.InternalOnlyHeaders = append(m.InternalOnlyHeaders, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ResponseHeadersToAdd", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRds + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ResponseHeadersToAdd = append(m.ResponseHeadersToAdd, &core.HeaderValueOption{}) + if err := m.ResponseHeadersToAdd[len(m.ResponseHeadersToAdd)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ResponseHeadersToRemove", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthRds + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ResponseHeadersToRemove = append(m.ResponseHeadersToRemove, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestHeadersToAdd", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRds + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RequestHeadersToAdd = append(m.RequestHeadersToAdd, &core.HeaderValueOption{}) + if err := m.RequestHeadersToAdd[len(m.RequestHeadersToAdd)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidateClusters", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRds + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.ValidateClusters == nil { + m.ValidateClusters = &types.BoolValue{} + } + if err := m.ValidateClusters.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipRds(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthRds + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipRds(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowRds + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowRds + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + return iNdEx, nil + case 1: + iNdEx += 8 + return iNdEx, nil + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowRds + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + iNdEx += length + if length < 0 { + return 0, ErrInvalidLengthRds + } + return iNdEx, nil + case 3: + for { + var innerWire uint64 + var start int = iNdEx + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowRds + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + innerWire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + innerWireType := int(innerWire & 0x7) + if innerWireType == 4 { + break + } + next, err := skipRds(dAtA[start:]) + if err != nil { + return 0, err + } + iNdEx = start + next + } + return iNdEx, nil + case 4: + return iNdEx, nil + case 5: + iNdEx += 4 + return iNdEx, nil + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + } + panic("unreachable") +} + +var ( + ErrInvalidLengthRds = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowRds = fmt.Errorf("proto: integer overflow") +) + +func init() { proto.RegisterFile("envoy/api/v2/rds.proto", fileDescriptor_rds_49b8428ed0bf9596) } + +var fileDescriptor_rds_49b8428ed0bf9596 = []byte{ + // 526 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x53, 0x3f, 0x6f, 0xd3, 0x40, + 0x14, 0xef, 0x25, 0xa1, 0xa8, 0x97, 0x20, 0xd1, 0x4b, 0xda, 0x86, 0x08, 0x39, 0x51, 0xc4, 0x10, + 0x3a, 0xd8, 0xc8, 0x6c, 0x65, 0x22, 0x45, 0x50, 0x58, 0x2a, 0xb9, 0x50, 0x09, 0x31, 0x58, 0x17, + 0xfb, 0x35, 0xb1, 0xe4, 0xdc, 0x33, 0x77, 0x67, 0xa3, 0xac, 0x4c, 0xec, 0x7c, 0x09, 0x3e, 0x4a, + 0x47, 0x10, 0x3b, 0x42, 0x11, 0xe2, 0x73, 0x20, 0x9f, 0x6d, 0xa8, 0x5b, 0x90, 0x40, 0x62, 0x89, + 0x2e, 0xef, 0xf7, 0xe7, 0xfd, 0xee, 0xbd, 0x33, 0xdd, 0x05, 0x91, 0xe1, 0xca, 0xe1, 0x49, 0xe4, + 0x64, 0xae, 0x23, 0x43, 0x65, 0x27, 0x12, 0x35, 0xb2, 0x8e, 0xa9, 0xdb, 0x3c, 0x89, 0xec, 0xcc, + 0x1d, 0xdc, 0xae, 0xb1, 0x02, 0x94, 0xe0, 0xcc, 0xb8, 0x82, 0x82, 0x7b, 0x09, 0x0d, 0x23, 0x15, + 0x60, 0x06, 0x72, 0x55, 0xa2, 0x56, 0xbd, 0x03, 0xa6, 0x1a, 0x8a, 0xdf, 0x4a, 0x3d, 0x47, 0x9c, + 0xc7, 0x60, 0x08, 0x5c, 0x08, 0xd4, 0x5c, 0x47, 0x28, 0x54, 0xa5, 0x2e, 0x51, 0xf3, 0x6f, 0x96, + 0x9e, 0x39, 0x6f, 0x24, 0x4f, 0x12, 0x90, 0x15, 0xde, 0x9b, 0xe3, 0x1c, 0xcd, 0xd1, 0xc9, 0x4f, + 0x45, 0x75, 0xfc, 0xbd, 0x49, 0x99, 0x97, 0xf7, 0x38, 0x44, 0x71, 0x16, 0xcd, 0x53, 0x69, 0x3c, + 0x19, 0xa3, 0x2d, 0xc1, 0x97, 0xd0, 0x27, 0x23, 0x32, 0xd9, 0xf2, 0xcc, 0x99, 0x3d, 0xa3, 0x37, + 0xb2, 0x48, 0xea, 0x94, 0xc7, 0xfe, 0x02, 0x95, 0x56, 0xfd, 0xc6, 0xa8, 0x39, 0x69, 0xbb, 0x43, + 0xfb, 0xe2, 0x00, 0xec, 0x22, 0xf0, 0x69, 0x41, 0x3c, 0x42, 0xa5, 0xa7, 0xad, 0xf3, 0x2f, 0xc3, + 0x0d, 0xaf, 0x93, 0xfd, 0x2a, 0x29, 0xe6, 0xd2, 0x9d, 0x48, 0x68, 0x90, 0x82, 0xc7, 0x3e, 0x8a, + 0x78, 0xe5, 0x2f, 0x80, 0x87, 0x20, 0x55, 0xbf, 0x39, 0x6a, 0x4e, 0xb6, 0xbc, 0x6e, 0x05, 0x1e, + 0x8b, 0x78, 0x75, 0x54, 0x40, 0xec, 0x15, 0xdd, 0x93, 0xa0, 0x12, 0x14, 0x0a, 0x2a, 0xba, 0xaf, + 0xd1, 0xe7, 0x61, 0xd8, 0x6f, 0x99, 0x24, 0x77, 0xea, 0x49, 0xf2, 0xe1, 0xdb, 0x85, 0xf8, 0x94, + 0xc7, 0x29, 0x1c, 0x27, 0xf9, 0xd5, 0xbc, 0x5e, 0x65, 0x52, 0xfa, 0x3e, 0xc7, 0x87, 0x61, 0xc8, + 0x1e, 0xd0, 0xc1, 0xef, 0xcc, 0x25, 0x2c, 0x31, 0x83, 0xfe, 0x35, 0x93, 0x6a, 0xef, 0x8a, 0xd2, + 0x33, 0x30, 0x7b, 0x49, 0x77, 0x25, 0xbc, 0x4e, 0x41, 0xe9, 0xcb, 0xc1, 0x36, 0xff, 0x21, 0x58, + 0xb7, 0xf4, 0xa8, 0xe5, 0x7a, 0x42, 0xb7, 0x33, 0x1e, 0x47, 0x21, 0xd7, 0xe0, 0x07, 0x71, 0xaa, + 0x74, 0x3e, 0xa4, 0xeb, 0x23, 0x32, 0x69, 0xbb, 0x03, 0xbb, 0xd8, 0xb8, 0x5d, 0x6d, 0xdc, 0x9e, + 0x22, 0xc6, 0xc6, 0xd1, 0xbb, 0x59, 0x89, 0x0e, 0x4b, 0x8d, 0xfb, 0xa9, 0x41, 0x77, 0xcc, 0xa2, + 0x1f, 0x55, 0xaf, 0xee, 0x04, 0x64, 0x16, 0x05, 0xc0, 0x5e, 0xd0, 0xce, 0x89, 0x96, 0xc0, 0x97, + 0x06, 0x56, 0xcc, 0xaa, 0xa7, 0xfd, 0xc9, 0xf7, 0x8a, 0x78, 0x83, 0xe1, 0x1f, 0xf1, 0x62, 0x3a, + 0xe3, 0x8d, 0x09, 0xb9, 0x47, 0x58, 0x42, 0xb7, 0x9f, 0x8a, 0x40, 0xc2, 0x12, 0x84, 0xe6, 0x71, + 0xe9, 0x7d, 0xb7, 0xae, 0xbd, 0x40, 0xb8, 0xd2, 0x66, 0xff, 0x6f, 0xa8, 0xb5, 0x8e, 0x48, 0xdb, + 0x8f, 0x41, 0x07, 0x8b, 0xff, 0x75, 0x8f, 0xe1, 0xdb, 0xcf, 0xdf, 0xde, 0x37, 0x6e, 0x8d, 0x7b, + 0xb5, 0x8f, 0xf5, 0xc0, 0xbc, 0x70, 0x75, 0x40, 0xf6, 0xa7, 0xdd, 0x0f, 0x6b, 0x8b, 0x9c, 0xaf, + 0x2d, 0xf2, 0x71, 0x6d, 0x91, 0xaf, 0x6b, 0x8b, 0xbc, 0x23, 0x64, 0xb6, 0x69, 0xd6, 0x71, 0xff, + 0x47, 0x00, 0x00, 0x00, 0xff, 0xff, 0x86, 0xf0, 0xa4, 0xcb, 0x30, 0x04, 0x00, 0x00, +} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/rds.pb.validate.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/rds.pb.validate.go new file mode 100644 index 000000000000..a7a52165c661 --- /dev/null +++ b/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/rds.pb.validate.go @@ -0,0 +1,134 @@ +// Code generated by protoc-gen-validate +// source: envoy/api/v2/rds.proto +// DO NOT EDIT!!! + +package v2 + +import ( + "bytes" + "errors" + "fmt" + "net" + "net/mail" + "net/url" + "regexp" + "strings" + "time" + "unicode/utf8" + + "github.com/gogo/protobuf/types" +) + +// ensure the imports are used +var ( + _ = bytes.MinRead + _ = errors.New("") + _ = fmt.Print + _ = utf8.UTFMax + _ = (*regexp.Regexp)(nil) + _ = (*strings.Reader)(nil) + _ = net.IPv4len + _ = time.Duration(0) + _ = (*url.URL)(nil) + _ = (*mail.Address)(nil) + _ = types.DynamicAny{} +) + +// Validate checks the field values on RouteConfiguration with the rules +// defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *RouteConfiguration) Validate() error { + if m == nil { + return nil + } + + // no validation rules for Name + + for idx, item := range m.GetVirtualHosts() { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return RouteConfigurationValidationError{ + Field: fmt.Sprintf("VirtualHosts[%v]", idx), + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + } + + for idx, item := range m.GetResponseHeadersToAdd() { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return RouteConfigurationValidationError{ + Field: fmt.Sprintf("ResponseHeadersToAdd[%v]", idx), + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + } + + for idx, item := range m.GetRequestHeadersToAdd() { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return RouteConfigurationValidationError{ + Field: fmt.Sprintf("RequestHeadersToAdd[%v]", idx), + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + } + + if v, ok := interface{}(m.GetValidateClusters()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return RouteConfigurationValidationError{ + Field: "ValidateClusters", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + return nil +} + +// RouteConfigurationValidationError is the validation error returned by +// RouteConfiguration.Validate if the designated constraints aren't met. +type RouteConfigurationValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e RouteConfigurationValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sRouteConfiguration.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = RouteConfigurationValidationError{} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/route/route.pb.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/route/route.pb.go new file mode 100644 index 000000000000..210efc376be3 --- /dev/null +++ b/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/route/route.pb.go @@ -0,0 +1,14955 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: envoy/api/v2/route/route.proto + +package route + +import proto "github.com/gogo/protobuf/proto" +import fmt "fmt" +import math "math" +import core "github.com/envoyproxy/go-control-plane/envoy/api/v2/core" +import _type "github.com/envoyproxy/go-control-plane/envoy/type" +import _ "github.com/gogo/protobuf/gogoproto" +import types "github.com/gogo/protobuf/types" +import _ "github.com/lyft/protoc-gen-validate/validate" + +import time "time" + +import bytes "bytes" + +import github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" + +import io "io" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf +var _ = time.Kitchen + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package + +type VirtualHost_TlsRequirementType int32 + +const ( + // No TLS requirement for the virtual host. + VirtualHost_NONE VirtualHost_TlsRequirementType = 0 + // External requests must use TLS. If a request is external and it is not + // using TLS, a 301 redirect will be sent telling the client to use HTTPS. + VirtualHost_EXTERNAL_ONLY VirtualHost_TlsRequirementType = 1 + // All requests must use TLS. If a request is not using TLS, a 301 redirect + // will be sent telling the client to use HTTPS. + VirtualHost_ALL VirtualHost_TlsRequirementType = 2 +) + +var VirtualHost_TlsRequirementType_name = map[int32]string{ + 0: "NONE", + 1: "EXTERNAL_ONLY", + 2: "ALL", +} +var VirtualHost_TlsRequirementType_value = map[string]int32{ + "NONE": 0, + "EXTERNAL_ONLY": 1, + "ALL": 2, +} + +func (x VirtualHost_TlsRequirementType) String() string { + return proto.EnumName(VirtualHost_TlsRequirementType_name, int32(x)) +} +func (VirtualHost_TlsRequirementType) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_route_91aab16f18e3dd7f, []int{0, 0} +} + +type RouteAction_ClusterNotFoundResponseCode int32 + +const ( + // HTTP status code - 503 Service Unavailable. + RouteAction_SERVICE_UNAVAILABLE RouteAction_ClusterNotFoundResponseCode = 0 + // HTTP status code - 404 Not Found. + RouteAction_NOT_FOUND RouteAction_ClusterNotFoundResponseCode = 1 +) + +var RouteAction_ClusterNotFoundResponseCode_name = map[int32]string{ + 0: "SERVICE_UNAVAILABLE", + 1: "NOT_FOUND", +} +var RouteAction_ClusterNotFoundResponseCode_value = map[string]int32{ + "SERVICE_UNAVAILABLE": 0, + "NOT_FOUND": 1, +} + +func (x RouteAction_ClusterNotFoundResponseCode) String() string { + return proto.EnumName(RouteAction_ClusterNotFoundResponseCode_name, int32(x)) +} +func (RouteAction_ClusterNotFoundResponseCode) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_route_91aab16f18e3dd7f, []int{5, 0} +} + +type RedirectAction_RedirectResponseCode int32 + +const ( + // Moved Permanently HTTP Status Code - 301. + RedirectAction_MOVED_PERMANENTLY RedirectAction_RedirectResponseCode = 0 + // Found HTTP Status Code - 302. + RedirectAction_FOUND RedirectAction_RedirectResponseCode = 1 + // See Other HTTP Status Code - 303. + RedirectAction_SEE_OTHER RedirectAction_RedirectResponseCode = 2 + // Temporary Redirect HTTP Status Code - 307. + RedirectAction_TEMPORARY_REDIRECT RedirectAction_RedirectResponseCode = 3 + // Permanent Redirect HTTP Status Code - 308. + RedirectAction_PERMANENT_REDIRECT RedirectAction_RedirectResponseCode = 4 +) + +var RedirectAction_RedirectResponseCode_name = map[int32]string{ + 0: "MOVED_PERMANENTLY", + 1: "FOUND", + 2: "SEE_OTHER", + 3: "TEMPORARY_REDIRECT", + 4: "PERMANENT_REDIRECT", +} +var RedirectAction_RedirectResponseCode_value = map[string]int32{ + "MOVED_PERMANENTLY": 0, + "FOUND": 1, + "SEE_OTHER": 2, + "TEMPORARY_REDIRECT": 3, + "PERMANENT_REDIRECT": 4, +} + +func (x RedirectAction_RedirectResponseCode) String() string { + return proto.EnumName(RedirectAction_RedirectResponseCode_name, int32(x)) +} +func (RedirectAction_RedirectResponseCode) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_route_91aab16f18e3dd7f, []int{6, 0} +} + +// The top level element in the routing configuration is a virtual host. Each virtual host has +// a logical name as well as a set of domains that get routed to it based on the incoming request's +// host header. This allows a single listener to service multiple top level domain path trees. Once +// a virtual host is selected based on the domain, the routes are processed in order to see which +// upstream cluster to route to or whether to perform a redirect. +type VirtualHost struct { + // The logical name of the virtual host. This is used when emitting certain + // statistics but is not relevant for routing. + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // A list of domains (host/authority header) that will be matched to this + // virtual host. Wildcard hosts are supported in the form of ``*.foo.com`` or + // ``*-bar.foo.com``. + // + // .. note:: + // + // The wildcard will not match the empty string. + // e.g. ``*-bar.foo.com`` will match ``baz-bar.foo.com`` but not ``-bar.foo.com``. + // Additionally, a special entry ``*`` is allowed which will match any + // host/authority header. Only a single virtual host in the entire route + // configuration can match on ``*``. A domain must be unique across all virtual + // hosts or the config will fail to load. + Domains []string `protobuf:"bytes,2,rep,name=domains" json:"domains,omitempty"` + // The list of routes that will be matched, in order, for incoming requests. + // The first route that matches will be used. + Routes []Route `protobuf:"bytes,3,rep,name=routes" json:"routes"` + // Specifies the type of TLS enforcement the virtual host expects. If this option is not + // specified, there is no TLS requirement for the virtual host. + RequireTls VirtualHost_TlsRequirementType `protobuf:"varint,4,opt,name=require_tls,json=requireTls,proto3,enum=envoy.api.v2.route.VirtualHost_TlsRequirementType" json:"require_tls,omitempty"` + // A list of virtual clusters defined for this virtual host. Virtual clusters + // are used for additional statistics gathering. + VirtualClusters []*VirtualCluster `protobuf:"bytes,5,rep,name=virtual_clusters,json=virtualClusters" json:"virtual_clusters,omitempty"` + // Specifies a set of rate limit configurations that will be applied to the + // virtual host. + RateLimits []*RateLimit `protobuf:"bytes,6,rep,name=rate_limits,json=rateLimits" json:"rate_limits,omitempty"` + // Specifies a list of HTTP headers that should be added to each request + // handled by this virtual host. Headers specified at this level are applied + // after headers from enclosed :ref:`envoy_api_msg_route.Route` and before headers from the + // enclosing :ref:`envoy_api_msg_RouteConfiguration`. For more information, including + // details on header value syntax, see the documentation on :ref:`custom request headers + // `. + RequestHeadersToAdd []*core.HeaderValueOption `protobuf:"bytes,7,rep,name=request_headers_to_add,json=requestHeadersToAdd" json:"request_headers_to_add,omitempty"` + // Specifies a list of HTTP headers that should be added to each response + // handled by this virtual host. Headers specified at this level are applied + // after headers from enclosed :ref:`envoy_api_msg_route.Route` and before headers from the + // enclosing :ref:`envoy_api_msg_RouteConfiguration`. For more information, including + // details on header value syntax, see the documentation on :ref:`custom request headers + // `. + ResponseHeadersToAdd []*core.HeaderValueOption `protobuf:"bytes,10,rep,name=response_headers_to_add,json=responseHeadersToAdd" json:"response_headers_to_add,omitempty"` + // Specifies a list of HTTP headers that should be removed from each response + // handled by this virtual host. + ResponseHeadersToRemove []string `protobuf:"bytes,11,rep,name=response_headers_to_remove,json=responseHeadersToRemove" json:"response_headers_to_remove,omitempty"` + // Indicates that the virtual host has a CORS policy. + Cors *CorsPolicy `protobuf:"bytes,8,opt,name=cors" json:"cors,omitempty"` + // The per_filter_config field can be used to provide virtual host-specific + // configurations for filters. The key should match the filter name, such as + // *envoy.buffer* for the HTTP buffer filter. Use of this field is filter + // specific; see the :ref:`HTTP filter documentation ` + // for if and how it is utilized. + PerFilterConfig map[string]*types.Struct `protobuf:"bytes,12,rep,name=per_filter_config,json=perFilterConfig" json:"per_filter_config,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *VirtualHost) Reset() { *m = VirtualHost{} } +func (m *VirtualHost) String() string { return proto.CompactTextString(m) } +func (*VirtualHost) ProtoMessage() {} +func (*VirtualHost) Descriptor() ([]byte, []int) { + return fileDescriptor_route_91aab16f18e3dd7f, []int{0} +} +func (m *VirtualHost) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *VirtualHost) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_VirtualHost.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *VirtualHost) XXX_Merge(src proto.Message) { + xxx_messageInfo_VirtualHost.Merge(dst, src) +} +func (m *VirtualHost) XXX_Size() int { + return m.Size() +} +func (m *VirtualHost) XXX_DiscardUnknown() { + xxx_messageInfo_VirtualHost.DiscardUnknown(m) +} + +var xxx_messageInfo_VirtualHost proto.InternalMessageInfo + +func (m *VirtualHost) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *VirtualHost) GetDomains() []string { + if m != nil { + return m.Domains + } + return nil +} + +func (m *VirtualHost) GetRoutes() []Route { + if m != nil { + return m.Routes + } + return nil +} + +func (m *VirtualHost) GetRequireTls() VirtualHost_TlsRequirementType { + if m != nil { + return m.RequireTls + } + return VirtualHost_NONE +} + +func (m *VirtualHost) GetVirtualClusters() []*VirtualCluster { + if m != nil { + return m.VirtualClusters + } + return nil +} + +func (m *VirtualHost) GetRateLimits() []*RateLimit { + if m != nil { + return m.RateLimits + } + return nil +} + +func (m *VirtualHost) GetRequestHeadersToAdd() []*core.HeaderValueOption { + if m != nil { + return m.RequestHeadersToAdd + } + return nil +} + +func (m *VirtualHost) GetResponseHeadersToAdd() []*core.HeaderValueOption { + if m != nil { + return m.ResponseHeadersToAdd + } + return nil +} + +func (m *VirtualHost) GetResponseHeadersToRemove() []string { + if m != nil { + return m.ResponseHeadersToRemove + } + return nil +} + +func (m *VirtualHost) GetCors() *CorsPolicy { + if m != nil { + return m.Cors + } + return nil +} + +func (m *VirtualHost) GetPerFilterConfig() map[string]*types.Struct { + if m != nil { + return m.PerFilterConfig + } + return nil +} + +// A route is both a specification of how to match a request as well as an indication of what to do +// next (e.g., redirect, forward, rewrite, etc.). +// +// .. attention:: +// +// Envoy supports routing on HTTP method via :ref:`header matching +// `. +type Route struct { + // Route matching parameters. + Match RouteMatch `protobuf:"bytes,1,opt,name=match" json:"match"` + // Types that are valid to be assigned to Action: + // *Route_Route + // *Route_Redirect + // *Route_DirectResponse + Action isRoute_Action `protobuf_oneof:"action"` + // The Metadata field can be used to provide additional information + // about the route. It can be used for configuration, stats, and logging. + // The metadata should go under the filter namespace that will need it. + // For instance, if the metadata is intended for the Router filter, + // the filter name should be specified as *envoy.router*. + Metadata *core.Metadata `protobuf:"bytes,4,opt,name=metadata" json:"metadata,omitempty"` + // Decorator for the matched route. + Decorator *Decorator `protobuf:"bytes,5,opt,name=decorator" json:"decorator,omitempty"` + // The per_filter_config field can be used to provide route-specific + // configurations for filters. The key should match the filter name, such as + // *envoy.buffer* for the HTTP buffer filter. Use of this field is filter + // specific; see the :ref:`HTTP filter documentation ` for + // if and how it is utilized. + PerFilterConfig map[string]*types.Struct `protobuf:"bytes,8,rep,name=per_filter_config,json=perFilterConfig" json:"per_filter_config,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value"` + // Specifies a set of headers that will be added to requests matching this + // route. Headers specified at this level are applied before headers from the + // enclosing :ref:`envoy_api_msg_route.VirtualHost` and + // :ref:`envoy_api_msg_RouteConfiguration`. For more information, including details on + // header value syntax, see the documentation on :ref:`custom request headers + // `. + RequestHeadersToAdd []*core.HeaderValueOption `protobuf:"bytes,9,rep,name=request_headers_to_add,json=requestHeadersToAdd" json:"request_headers_to_add,omitempty"` + // Specifies a set of headers that will be added to responses to requests + // matching this route. Headers specified at this level are applied before + // headers from the enclosing :ref:`envoy_api_msg_route.VirtualHost` and + // :ref:`envoy_api_msg_RouteConfiguration`. For more information, including + // details on header value syntax, see the documentation on + // :ref:`custom request headers `. + ResponseHeadersToAdd []*core.HeaderValueOption `protobuf:"bytes,10,rep,name=response_headers_to_add,json=responseHeadersToAdd" json:"response_headers_to_add,omitempty"` + // Specifies a list of HTTP headers that should be removed from each response + // to requests matching this route. + ResponseHeadersToRemove []string `protobuf:"bytes,11,rep,name=response_headers_to_remove,json=responseHeadersToRemove" json:"response_headers_to_remove,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Route) Reset() { *m = Route{} } +func (m *Route) String() string { return proto.CompactTextString(m) } +func (*Route) ProtoMessage() {} +func (*Route) Descriptor() ([]byte, []int) { + return fileDescriptor_route_91aab16f18e3dd7f, []int{1} +} +func (m *Route) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Route) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Route.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *Route) XXX_Merge(src proto.Message) { + xxx_messageInfo_Route.Merge(dst, src) +} +func (m *Route) XXX_Size() int { + return m.Size() +} +func (m *Route) XXX_DiscardUnknown() { + xxx_messageInfo_Route.DiscardUnknown(m) +} + +var xxx_messageInfo_Route proto.InternalMessageInfo + +type isRoute_Action interface { + isRoute_Action() + Equal(interface{}) bool + MarshalTo([]byte) (int, error) + Size() int +} + +type Route_Route struct { + Route *RouteAction `protobuf:"bytes,2,opt,name=route,oneof"` +} +type Route_Redirect struct { + Redirect *RedirectAction `protobuf:"bytes,3,opt,name=redirect,oneof"` +} +type Route_DirectResponse struct { + DirectResponse *DirectResponseAction `protobuf:"bytes,7,opt,name=direct_response,json=directResponse,oneof"` +} + +func (*Route_Route) isRoute_Action() {} +func (*Route_Redirect) isRoute_Action() {} +func (*Route_DirectResponse) isRoute_Action() {} + +func (m *Route) GetAction() isRoute_Action { + if m != nil { + return m.Action + } + return nil +} + +func (m *Route) GetMatch() RouteMatch { + if m != nil { + return m.Match + } + return RouteMatch{} +} + +func (m *Route) GetRoute() *RouteAction { + if x, ok := m.GetAction().(*Route_Route); ok { + return x.Route + } + return nil +} + +func (m *Route) GetRedirect() *RedirectAction { + if x, ok := m.GetAction().(*Route_Redirect); ok { + return x.Redirect + } + return nil +} + +func (m *Route) GetDirectResponse() *DirectResponseAction { + if x, ok := m.GetAction().(*Route_DirectResponse); ok { + return x.DirectResponse + } + return nil +} + +func (m *Route) GetMetadata() *core.Metadata { + if m != nil { + return m.Metadata + } + return nil +} + +func (m *Route) GetDecorator() *Decorator { + if m != nil { + return m.Decorator + } + return nil +} + +func (m *Route) GetPerFilterConfig() map[string]*types.Struct { + if m != nil { + return m.PerFilterConfig + } + return nil +} + +func (m *Route) GetRequestHeadersToAdd() []*core.HeaderValueOption { + if m != nil { + return m.RequestHeadersToAdd + } + return nil +} + +func (m *Route) GetResponseHeadersToAdd() []*core.HeaderValueOption { + if m != nil { + return m.ResponseHeadersToAdd + } + return nil +} + +func (m *Route) GetResponseHeadersToRemove() []string { + if m != nil { + return m.ResponseHeadersToRemove + } + return nil +} + +// XXX_OneofFuncs is for the internal use of the proto package. +func (*Route) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { + return _Route_OneofMarshaler, _Route_OneofUnmarshaler, _Route_OneofSizer, []interface{}{ + (*Route_Route)(nil), + (*Route_Redirect)(nil), + (*Route_DirectResponse)(nil), + } +} + +func _Route_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { + m := msg.(*Route) + // action + switch x := m.Action.(type) { + case *Route_Route: + _ = b.EncodeVarint(2<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.Route); err != nil { + return err + } + case *Route_Redirect: + _ = b.EncodeVarint(3<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.Redirect); err != nil { + return err + } + case *Route_DirectResponse: + _ = b.EncodeVarint(7<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.DirectResponse); err != nil { + return err + } + case nil: + default: + return fmt.Errorf("Route.Action has unexpected type %T", x) + } + return nil +} + +func _Route_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { + m := msg.(*Route) + switch tag { + case 2: // action.route + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(RouteAction) + err := b.DecodeMessage(msg) + m.Action = &Route_Route{msg} + return true, err + case 3: // action.redirect + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(RedirectAction) + err := b.DecodeMessage(msg) + m.Action = &Route_Redirect{msg} + return true, err + case 7: // action.direct_response + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(DirectResponseAction) + err := b.DecodeMessage(msg) + m.Action = &Route_DirectResponse{msg} + return true, err + default: + return false, nil + } +} + +func _Route_OneofSizer(msg proto.Message) (n int) { + m := msg.(*Route) + // action + switch x := m.Action.(type) { + case *Route_Route: + s := proto.Size(x.Route) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case *Route_Redirect: + s := proto.Size(x.Redirect) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case *Route_DirectResponse: + s := proto.Size(x.DirectResponse) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case nil: + default: + panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) + } + return n +} + +// Compared to the :ref:`cluster ` field that specifies a +// single upstream cluster as the target of a request, the :ref:`weighted_clusters +// ` option allows for specification of +// multiple upstream clusters along with weights that indicate the percentage of +// traffic to be forwarded to each cluster. The router selects an upstream cluster based on the +// weights. +type WeightedCluster struct { + // Specifies one or more upstream clusters associated with the route. + Clusters []*WeightedCluster_ClusterWeight `protobuf:"bytes,1,rep,name=clusters" json:"clusters,omitempty"` + // Specifies the total weight across all clusters. The sum of all cluster weights must equal this + // value, which must be greater than 0. Defaults to 100. + TotalWeight *types.UInt32Value `protobuf:"bytes,3,opt,name=total_weight,json=totalWeight" json:"total_weight,omitempty"` + // Specifies the runtime key prefix that should be used to construct the + // runtime keys associated with each cluster. When the *runtime_key_prefix* is + // specified, the router will look for weights associated with each upstream + // cluster under the key *runtime_key_prefix* + "." + *cluster[i].name* where + // *cluster[i]* denotes an entry in the clusters array field. If the runtime + // key for the cluster does not exist, the value specified in the + // configuration file will be used as the default weight. See the :ref:`runtime documentation + // ` for how key names map to the underlying implementation. + RuntimeKeyPrefix string `protobuf:"bytes,2,opt,name=runtime_key_prefix,json=runtimeKeyPrefix,proto3" json:"runtime_key_prefix,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *WeightedCluster) Reset() { *m = WeightedCluster{} } +func (m *WeightedCluster) String() string { return proto.CompactTextString(m) } +func (*WeightedCluster) ProtoMessage() {} +func (*WeightedCluster) Descriptor() ([]byte, []int) { + return fileDescriptor_route_91aab16f18e3dd7f, []int{2} +} +func (m *WeightedCluster) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *WeightedCluster) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_WeightedCluster.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *WeightedCluster) XXX_Merge(src proto.Message) { + xxx_messageInfo_WeightedCluster.Merge(dst, src) +} +func (m *WeightedCluster) XXX_Size() int { + return m.Size() +} +func (m *WeightedCluster) XXX_DiscardUnknown() { + xxx_messageInfo_WeightedCluster.DiscardUnknown(m) +} + +var xxx_messageInfo_WeightedCluster proto.InternalMessageInfo + +func (m *WeightedCluster) GetClusters() []*WeightedCluster_ClusterWeight { + if m != nil { + return m.Clusters + } + return nil +} + +func (m *WeightedCluster) GetTotalWeight() *types.UInt32Value { + if m != nil { + return m.TotalWeight + } + return nil +} + +func (m *WeightedCluster) GetRuntimeKeyPrefix() string { + if m != nil { + return m.RuntimeKeyPrefix + } + return "" +} + +type WeightedCluster_ClusterWeight struct { + // Name of the upstream cluster. The cluster must exist in the + // :ref:`cluster manager configuration `. + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // An integer between 0 and :ref:`total_weight + // `. When a request matches the route, + // the choice of an upstream cluster is determined by its weight. The sum of weights across all + // entries in the clusters array must add up to the total_weight, which defaults to 100. + Weight *types.UInt32Value `protobuf:"bytes,2,opt,name=weight" json:"weight,omitempty"` + // Optional endpoint metadata match criteria used by the subset load balancer. Only endpoints in + // the upstream cluster with metadata matching what is set in this field will be considered for + // load balancing. Note that this will be merged with what's provided in :ref: + // `RouteAction.MetadataMatch `, with values + // here taking precedence. The filter name should be specified as *envoy.lb*. + MetadataMatch *core.Metadata `protobuf:"bytes,3,opt,name=metadata_match,json=metadataMatch" json:"metadata_match,omitempty"` + // Specifies a list of headers to be added to requests when this cluster is selected + // through the enclosing :ref:`envoy_api_msg_route.RouteAction`. + // Headers specified at this level are applied before headers from the enclosing + // :ref:`envoy_api_msg_route.Route`, :ref:`envoy_api_msg_route.VirtualHost`, and + // :ref:`envoy_api_msg_RouteConfiguration`. For more information, including details on + // header value syntax, see the documentation on :ref:`custom request headers + // `. + RequestHeadersToAdd []*core.HeaderValueOption `protobuf:"bytes,4,rep,name=request_headers_to_add,json=requestHeadersToAdd" json:"request_headers_to_add,omitempty"` + // Specifies a list of headers to be added to responses when this cluster is selected + // through the enclosing :ref:`envoy_api_msg_route.RouteAction`. + // Headers specified at this level are applied before headers from the enclosing + // :ref:`envoy_api_msg_route.Route`, :ref:`envoy_api_msg_route.VirtualHost`, and + // :ref:`envoy_api_msg_RouteConfiguration`. For more information, including details on + // header value syntax, see the documentation on :ref:`custom request headers + // `. + ResponseHeadersToAdd []*core.HeaderValueOption `protobuf:"bytes,5,rep,name=response_headers_to_add,json=responseHeadersToAdd" json:"response_headers_to_add,omitempty"` + // Specifies a list of headers to be removed from responses when this cluster is selected + // through the enclosing :ref:`envoy_api_msg_route.RouteAction`. + ResponseHeadersToRemove []string `protobuf:"bytes,6,rep,name=response_headers_to_remove,json=responseHeadersToRemove" json:"response_headers_to_remove,omitempty"` + // The per_filter_config field can be used to provide weighted cluster-specific + // configurations for filters. The key should match the filter name, such as + // *envoy.buffer* for the HTTP buffer filter. Use of this field is filter + // specific; see the :ref:`HTTP filter documentation ` + // for if and how it is utilized. + PerFilterConfig map[string]*types.Struct `protobuf:"bytes,8,rep,name=per_filter_config,json=perFilterConfig" json:"per_filter_config,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *WeightedCluster_ClusterWeight) Reset() { *m = WeightedCluster_ClusterWeight{} } +func (m *WeightedCluster_ClusterWeight) String() string { return proto.CompactTextString(m) } +func (*WeightedCluster_ClusterWeight) ProtoMessage() {} +func (*WeightedCluster_ClusterWeight) Descriptor() ([]byte, []int) { + return fileDescriptor_route_91aab16f18e3dd7f, []int{2, 0} +} +func (m *WeightedCluster_ClusterWeight) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *WeightedCluster_ClusterWeight) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_WeightedCluster_ClusterWeight.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *WeightedCluster_ClusterWeight) XXX_Merge(src proto.Message) { + xxx_messageInfo_WeightedCluster_ClusterWeight.Merge(dst, src) +} +func (m *WeightedCluster_ClusterWeight) XXX_Size() int { + return m.Size() +} +func (m *WeightedCluster_ClusterWeight) XXX_DiscardUnknown() { + xxx_messageInfo_WeightedCluster_ClusterWeight.DiscardUnknown(m) +} + +var xxx_messageInfo_WeightedCluster_ClusterWeight proto.InternalMessageInfo + +func (m *WeightedCluster_ClusterWeight) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *WeightedCluster_ClusterWeight) GetWeight() *types.UInt32Value { + if m != nil { + return m.Weight + } + return nil +} + +func (m *WeightedCluster_ClusterWeight) GetMetadataMatch() *core.Metadata { + if m != nil { + return m.MetadataMatch + } + return nil +} + +func (m *WeightedCluster_ClusterWeight) GetRequestHeadersToAdd() []*core.HeaderValueOption { + if m != nil { + return m.RequestHeadersToAdd + } + return nil +} + +func (m *WeightedCluster_ClusterWeight) GetResponseHeadersToAdd() []*core.HeaderValueOption { + if m != nil { + return m.ResponseHeadersToAdd + } + return nil +} + +func (m *WeightedCluster_ClusterWeight) GetResponseHeadersToRemove() []string { + if m != nil { + return m.ResponseHeadersToRemove + } + return nil +} + +func (m *WeightedCluster_ClusterWeight) GetPerFilterConfig() map[string]*types.Struct { + if m != nil { + return m.PerFilterConfig + } + return nil +} + +type RouteMatch struct { + // Types that are valid to be assigned to PathSpecifier: + // *RouteMatch_Prefix + // *RouteMatch_Path + // *RouteMatch_Regex + PathSpecifier isRouteMatch_PathSpecifier `protobuf_oneof:"path_specifier"` + // Indicates that prefix/path matching should be case insensitive. The default + // is true. + CaseSensitive *types.BoolValue `protobuf:"bytes,4,opt,name=case_sensitive,json=caseSensitive" json:"case_sensitive,omitempty"` + // Indicates that the route should additionally match on a runtime key. An + // integer between 0-100. Every time the route is considered for a match, a + // random number between 0-99 is selected. If the number is <= the value found + // in the key (checked first) or, if the key is not present, the default + // value, the route is a match (assuming everything also about the route + // matches). A runtime route configuration can be used to roll out route changes in a + // gradual manner without full code/config deploys. Refer to the + // :ref:`traffic shifting ` docs + // for additional documentation. + Runtime *core.RuntimeUInt32 `protobuf:"bytes,5,opt,name=runtime" json:"runtime,omitempty"` + // Specifies a set of headers that the route should match on. The router will + // check the request’s headers against all the specified headers in the route + // config. A match will happen if all the headers in the route are present in + // the request with the same values (or based on presence if the value field + // is not in the config). + Headers []*HeaderMatcher `protobuf:"bytes,6,rep,name=headers" json:"headers,omitempty"` + // Specifies a set of URL query parameters on which the route should + // match. The router will check the query string from the *path* header + // against all the specified query parameters. If the number of specified + // query parameters is nonzero, they all must match the *path* header's + // query string for a match to occur. + QueryParameters []*QueryParameterMatcher `protobuf:"bytes,7,rep,name=query_parameters,json=queryParameters" json:"query_parameters,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *RouteMatch) Reset() { *m = RouteMatch{} } +func (m *RouteMatch) String() string { return proto.CompactTextString(m) } +func (*RouteMatch) ProtoMessage() {} +func (*RouteMatch) Descriptor() ([]byte, []int) { + return fileDescriptor_route_91aab16f18e3dd7f, []int{3} +} +func (m *RouteMatch) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RouteMatch) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_RouteMatch.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *RouteMatch) XXX_Merge(src proto.Message) { + xxx_messageInfo_RouteMatch.Merge(dst, src) +} +func (m *RouteMatch) XXX_Size() int { + return m.Size() +} +func (m *RouteMatch) XXX_DiscardUnknown() { + xxx_messageInfo_RouteMatch.DiscardUnknown(m) +} + +var xxx_messageInfo_RouteMatch proto.InternalMessageInfo + +type isRouteMatch_PathSpecifier interface { + isRouteMatch_PathSpecifier() + Equal(interface{}) bool + MarshalTo([]byte) (int, error) + Size() int +} + +type RouteMatch_Prefix struct { + Prefix string `protobuf:"bytes,1,opt,name=prefix,proto3,oneof"` +} +type RouteMatch_Path struct { + Path string `protobuf:"bytes,2,opt,name=path,proto3,oneof"` +} +type RouteMatch_Regex struct { + Regex string `protobuf:"bytes,3,opt,name=regex,proto3,oneof"` +} + +func (*RouteMatch_Prefix) isRouteMatch_PathSpecifier() {} +func (*RouteMatch_Path) isRouteMatch_PathSpecifier() {} +func (*RouteMatch_Regex) isRouteMatch_PathSpecifier() {} + +func (m *RouteMatch) GetPathSpecifier() isRouteMatch_PathSpecifier { + if m != nil { + return m.PathSpecifier + } + return nil +} + +func (m *RouteMatch) GetPrefix() string { + if x, ok := m.GetPathSpecifier().(*RouteMatch_Prefix); ok { + return x.Prefix + } + return "" +} + +func (m *RouteMatch) GetPath() string { + if x, ok := m.GetPathSpecifier().(*RouteMatch_Path); ok { + return x.Path + } + return "" +} + +func (m *RouteMatch) GetRegex() string { + if x, ok := m.GetPathSpecifier().(*RouteMatch_Regex); ok { + return x.Regex + } + return "" +} + +func (m *RouteMatch) GetCaseSensitive() *types.BoolValue { + if m != nil { + return m.CaseSensitive + } + return nil +} + +func (m *RouteMatch) GetRuntime() *core.RuntimeUInt32 { + if m != nil { + return m.Runtime + } + return nil +} + +func (m *RouteMatch) GetHeaders() []*HeaderMatcher { + if m != nil { + return m.Headers + } + return nil +} + +func (m *RouteMatch) GetQueryParameters() []*QueryParameterMatcher { + if m != nil { + return m.QueryParameters + } + return nil +} + +// XXX_OneofFuncs is for the internal use of the proto package. +func (*RouteMatch) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { + return _RouteMatch_OneofMarshaler, _RouteMatch_OneofUnmarshaler, _RouteMatch_OneofSizer, []interface{}{ + (*RouteMatch_Prefix)(nil), + (*RouteMatch_Path)(nil), + (*RouteMatch_Regex)(nil), + } +} + +func _RouteMatch_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { + m := msg.(*RouteMatch) + // path_specifier + switch x := m.PathSpecifier.(type) { + case *RouteMatch_Prefix: + _ = b.EncodeVarint(1<<3 | proto.WireBytes) + _ = b.EncodeStringBytes(x.Prefix) + case *RouteMatch_Path: + _ = b.EncodeVarint(2<<3 | proto.WireBytes) + _ = b.EncodeStringBytes(x.Path) + case *RouteMatch_Regex: + _ = b.EncodeVarint(3<<3 | proto.WireBytes) + _ = b.EncodeStringBytes(x.Regex) + case nil: + default: + return fmt.Errorf("RouteMatch.PathSpecifier has unexpected type %T", x) + } + return nil +} + +func _RouteMatch_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { + m := msg.(*RouteMatch) + switch tag { + case 1: // path_specifier.prefix + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeStringBytes() + m.PathSpecifier = &RouteMatch_Prefix{x} + return true, err + case 2: // path_specifier.path + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeStringBytes() + m.PathSpecifier = &RouteMatch_Path{x} + return true, err + case 3: // path_specifier.regex + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeStringBytes() + m.PathSpecifier = &RouteMatch_Regex{x} + return true, err + default: + return false, nil + } +} + +func _RouteMatch_OneofSizer(msg proto.Message) (n int) { + m := msg.(*RouteMatch) + // path_specifier + switch x := m.PathSpecifier.(type) { + case *RouteMatch_Prefix: + n += 1 // tag and wire + n += proto.SizeVarint(uint64(len(x.Prefix))) + n += len(x.Prefix) + case *RouteMatch_Path: + n += 1 // tag and wire + n += proto.SizeVarint(uint64(len(x.Path))) + n += len(x.Path) + case *RouteMatch_Regex: + n += 1 // tag and wire + n += proto.SizeVarint(uint64(len(x.Regex))) + n += len(x.Regex) + case nil: + default: + panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) + } + return n +} + +// [#comment:next free field: 9] +type CorsPolicy struct { + // Specifies the origins that will be allowed to do CORS requests. + // + // An origin is allowed if either allow_origin or allow_origin_regex match. + AllowOrigin []string `protobuf:"bytes,1,rep,name=allow_origin,json=allowOrigin" json:"allow_origin,omitempty"` + // Specifies regex patterns that match allowed origins. + // + // An origin is allowed if either allow_origin or allow_origin_regex match. + AllowOriginRegex []string `protobuf:"bytes,8,rep,name=allow_origin_regex,json=allowOriginRegex" json:"allow_origin_regex,omitempty"` + // Specifies the content for the *access-control-allow-methods* header. + AllowMethods string `protobuf:"bytes,2,opt,name=allow_methods,json=allowMethods,proto3" json:"allow_methods,omitempty"` + // Specifies the content for the *access-control-allow-headers* header. + AllowHeaders string `protobuf:"bytes,3,opt,name=allow_headers,json=allowHeaders,proto3" json:"allow_headers,omitempty"` + // Specifies the content for the *access-control-expose-headers* header. + ExposeHeaders string `protobuf:"bytes,4,opt,name=expose_headers,json=exposeHeaders,proto3" json:"expose_headers,omitempty"` + // Specifies the content for the *access-control-max-age* header. + MaxAge string `protobuf:"bytes,5,opt,name=max_age,json=maxAge,proto3" json:"max_age,omitempty"` + // Specifies whether the resource allows credentials. + AllowCredentials *types.BoolValue `protobuf:"bytes,6,opt,name=allow_credentials,json=allowCredentials" json:"allow_credentials,omitempty"` + // Specifies if CORS is enabled. Defaults to true. Only effective on route. + Enabled *types.BoolValue `protobuf:"bytes,7,opt,name=enabled" json:"enabled,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *CorsPolicy) Reset() { *m = CorsPolicy{} } +func (m *CorsPolicy) String() string { return proto.CompactTextString(m) } +func (*CorsPolicy) ProtoMessage() {} +func (*CorsPolicy) Descriptor() ([]byte, []int) { + return fileDescriptor_route_91aab16f18e3dd7f, []int{4} +} +func (m *CorsPolicy) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *CorsPolicy) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_CorsPolicy.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *CorsPolicy) XXX_Merge(src proto.Message) { + xxx_messageInfo_CorsPolicy.Merge(dst, src) +} +func (m *CorsPolicy) XXX_Size() int { + return m.Size() +} +func (m *CorsPolicy) XXX_DiscardUnknown() { + xxx_messageInfo_CorsPolicy.DiscardUnknown(m) +} + +var xxx_messageInfo_CorsPolicy proto.InternalMessageInfo + +func (m *CorsPolicy) GetAllowOrigin() []string { + if m != nil { + return m.AllowOrigin + } + return nil +} + +func (m *CorsPolicy) GetAllowOriginRegex() []string { + if m != nil { + return m.AllowOriginRegex + } + return nil +} + +func (m *CorsPolicy) GetAllowMethods() string { + if m != nil { + return m.AllowMethods + } + return "" +} + +func (m *CorsPolicy) GetAllowHeaders() string { + if m != nil { + return m.AllowHeaders + } + return "" +} + +func (m *CorsPolicy) GetExposeHeaders() string { + if m != nil { + return m.ExposeHeaders + } + return "" +} + +func (m *CorsPolicy) GetMaxAge() string { + if m != nil { + return m.MaxAge + } + return "" +} + +func (m *CorsPolicy) GetAllowCredentials() *types.BoolValue { + if m != nil { + return m.AllowCredentials + } + return nil +} + +func (m *CorsPolicy) GetEnabled() *types.BoolValue { + if m != nil { + return m.Enabled + } + return nil +} + +// [#comment:next free field: 25] +type RouteAction struct { + // Types that are valid to be assigned to ClusterSpecifier: + // *RouteAction_Cluster + // *RouteAction_ClusterHeader + // *RouteAction_WeightedClusters + ClusterSpecifier isRouteAction_ClusterSpecifier `protobuf_oneof:"cluster_specifier"` + // The HTTP status code to use when configured cluster is not found. + // The default response code is 503 Service Unavailable. + ClusterNotFoundResponseCode RouteAction_ClusterNotFoundResponseCode `protobuf:"varint,20,opt,name=cluster_not_found_response_code,json=clusterNotFoundResponseCode,proto3,enum=envoy.api.v2.route.RouteAction_ClusterNotFoundResponseCode" json:"cluster_not_found_response_code,omitempty"` + // Optional endpoint metadata match criteria used by the subset load balancer. Only endpoints + // in the upstream cluster with metadata matching what's set in this field will be considered + // for load balancing. If using :ref:`weighted_clusters + // `, metadata will be merged, with values + // provided there taking precedence. The filter name should be specified as *envoy.lb*. + MetadataMatch *core.Metadata `protobuf:"bytes,4,opt,name=metadata_match,json=metadataMatch" json:"metadata_match,omitempty"` + // Indicates that during forwarding, the matched prefix (or path) should be + // swapped with this value. This option allows application URLs to be rooted + // at a different path from those exposed at the reverse proxy layer. The router filter will + // place the original path before rewrite into the :ref:`x-envoy-original-path + // ` header. + // + // .. attention:: + // + // Pay careful attention to the use of trailing slashes in the + // :ref:`route's match ` prefix value. + // Stripping a prefix from a path requires multiple Routes to handle all cases. For example, + // rewriting */prefix* to */* and */prefix/etc* to */etc* cannot be done in a single + // :ref:`Route `, as shown by the below config entries: + // + // .. code-block:: yaml + // + // - match: + // prefix: "/prefix/" + // route: + // prefix_rewrite: "/" + // - match: + // prefix: "/prefix" + // route: + // prefix_rewrite: "/" + // + // Having above entries in the config, requests to */prefix* will be stripped to */*, while + // requests to */prefix/etc* will be stripped to */etc*. + PrefixRewrite string `protobuf:"bytes,5,opt,name=prefix_rewrite,json=prefixRewrite,proto3" json:"prefix_rewrite,omitempty"` + // Types that are valid to be assigned to HostRewriteSpecifier: + // *RouteAction_HostRewrite + // *RouteAction_AutoHostRewrite + HostRewriteSpecifier isRouteAction_HostRewriteSpecifier `protobuf_oneof:"host_rewrite_specifier"` + // Specifies the upstream timeout for the route. If not specified, the default is 15s. This + // spans between the point at which the entire downstream request (i.e. end-of-stream) has been + // processed and when the upstream response has been completely processed. + // + // .. note:: + // + // This timeout includes all retries. See also + // :ref:`config_http_filters_router_x-envoy-upstream-rq-timeout-ms`, + // :ref:`config_http_filters_router_x-envoy-upstream-rq-per-try-timeout-ms`, and the + // :ref:`retry overview `. + Timeout *time.Duration `protobuf:"bytes,8,opt,name=timeout,stdduration" json:"timeout,omitempty"` + // Specifies the idle timeout for the route. If not specified, there is no per-route idle timeout, + // although the connection manager wide :ref:`stream_idle_timeout + // ` + // will still apply. A value of 0 will completely disable the route's idle timeout, even if a + // connection manager stream idle timeout is configured. + // + // The idle timeout is distinct to :ref:`timeout + // `, which provides an upper bound + // on the upstream response time; :ref:`idle_timeout + // ` instead bounds the amount + // of time the request's stream may be idle. + // + // After header decoding, the idle timeout will apply on downstream and + // upstream request events. Each time an encode/decode event for headers or + // data is processed for the stream, the timer will be reset. If the timeout + // fires, the stream is terminated with a 408 Request Timeout error code if no + // upstream response header has been received, otherwise a stream reset + // occurs. + IdleTimeout *time.Duration `protobuf:"bytes,24,opt,name=idle_timeout,json=idleTimeout,stdduration" json:"idle_timeout,omitempty"` + // Indicates that the route has a retry policy. + RetryPolicy *RouteAction_RetryPolicy `protobuf:"bytes,9,opt,name=retry_policy,json=retryPolicy" json:"retry_policy,omitempty"` + // Indicates that the route has a request mirroring policy. + RequestMirrorPolicy *RouteAction_RequestMirrorPolicy `protobuf:"bytes,10,opt,name=request_mirror_policy,json=requestMirrorPolicy" json:"request_mirror_policy,omitempty"` + // Optionally specifies the :ref:`routing priority `. + // [#comment:TODO(htuch): add (validate.rules).enum.defined_only = true once + // https://github.com/lyft/protoc-gen-validate/issues/42 is resolved.] + Priority core.RoutingPriority `protobuf:"varint,11,opt,name=priority,proto3,enum=envoy.api.v2.core.RoutingPriority" json:"priority,omitempty"` + // [#not-implemented-hide:] + RequestHeadersToAdd []*core.HeaderValueOption `protobuf:"bytes,12,rep,name=request_headers_to_add,json=requestHeadersToAdd" json:"request_headers_to_add,omitempty"` // Deprecated: Do not use. + // [#not-implemented-hide:] + ResponseHeadersToAdd []*core.HeaderValueOption `protobuf:"bytes,18,rep,name=response_headers_to_add,json=responseHeadersToAdd" json:"response_headers_to_add,omitempty"` // Deprecated: Do not use. + // [#not-implemented-hide:] + ResponseHeadersToRemove []string `protobuf:"bytes,19,rep,name=response_headers_to_remove,json=responseHeadersToRemove" json:"response_headers_to_remove,omitempty"` // Deprecated: Do not use. + // Specifies a set of rate limit configurations that could be applied to the + // route. + RateLimits []*RateLimit `protobuf:"bytes,13,rep,name=rate_limits,json=rateLimits" json:"rate_limits,omitempty"` + // Specifies if the rate limit filter should include the virtual host rate + // limits. By default, if the route configured rate limits, the virtual host + // :ref:`rate_limits ` are not applied to the + // request. + IncludeVhRateLimits *types.BoolValue `protobuf:"bytes,14,opt,name=include_vh_rate_limits,json=includeVhRateLimits" json:"include_vh_rate_limits,omitempty"` + // Specifies a list of hash policies to use for ring hash load balancing. Each + // hash policy is evaluated individually and the combined result is used to + // route the request. The method of combination is deterministic such that + // identical lists of hash policies will produce the same hash. Since a hash + // policy examines specific parts of a request, it can fail to produce a hash + // (i.e. if the hashed header is not present). If (and only if) all configured + // hash policies fail to generate a hash, no hash will be produced for + // the route. In this case, the behavior is the same as if no hash policies + // were specified (i.e. the ring hash load balancer will choose a random + // backend). If a hash policy has the "terminal" attribute set to true, and + // there is already a hash generated, the hash is returned immediately, + // ignoring the rest of the hash policy list. + HashPolicy []*RouteAction_HashPolicy `protobuf:"bytes,15,rep,name=hash_policy,json=hashPolicy" json:"hash_policy,omitempty"` + // Indicates that a HTTP/1.1 client connection to this particular route is allowed to + // upgrade to a WebSocket connection. The default is false. + // + // .. attention:: + // + // If a connection is upgraded to a WebSocket connection, Envoy will set up plain TCP + // proxying between the client and the upstream server. Hence, an upstream + // server that rejects the WebSocket upgrade request is also responsible for + // closing the associated connection. Until then, Envoy will continue to + // proxy data from the client to the upstream server. + // + // Redirects are not supported on routes where WebSocket upgrades are allowed. + UseWebsocket *types.BoolValue `protobuf:"bytes,16,opt,name=use_websocket,json=useWebsocket" json:"use_websocket,omitempty"` // Deprecated: Do not use. + // Proxy configuration used for WebSocket connections. If unset, the default values as specified + // in :ref:`TcpProxy ` are used. + WebsocketConfig *RouteAction_WebSocketProxyConfig `protobuf:"bytes,22,opt,name=websocket_config,json=websocketConfig" json:"websocket_config,omitempty"` // Deprecated: Do not use. + // Indicates that the route has a CORS policy. + Cors *CorsPolicy `protobuf:"bytes,17,opt,name=cors" json:"cors,omitempty"` + // If present, and the request is a gRPC request, use the + // `grpc-timeout header `_, + // or its default value (infinity) instead of + // :ref:`timeout `, but limit the applied timeout + // to the maximum value specified here. If configured as 0, the maximum allowed timeout for + // gRPC requests is infinity. If not configured at all, the `grpc-timeout` header is not used + // and gRPC requests time out like any other requests using + // :ref:`timeout ` or its default. + // This can be used to prevent unexpected upstream request timeouts due to potentially long + // time gaps between gRPC request and response in gRPC streaming mode. + MaxGrpcTimeout *time.Duration `protobuf:"bytes,23,opt,name=max_grpc_timeout,json=maxGrpcTimeout,stdduration" json:"max_grpc_timeout,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *RouteAction) Reset() { *m = RouteAction{} } +func (m *RouteAction) String() string { return proto.CompactTextString(m) } +func (*RouteAction) ProtoMessage() {} +func (*RouteAction) Descriptor() ([]byte, []int) { + return fileDescriptor_route_91aab16f18e3dd7f, []int{5} +} +func (m *RouteAction) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RouteAction) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_RouteAction.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *RouteAction) XXX_Merge(src proto.Message) { + xxx_messageInfo_RouteAction.Merge(dst, src) +} +func (m *RouteAction) XXX_Size() int { + return m.Size() +} +func (m *RouteAction) XXX_DiscardUnknown() { + xxx_messageInfo_RouteAction.DiscardUnknown(m) +} + +var xxx_messageInfo_RouteAction proto.InternalMessageInfo + +type isRouteAction_ClusterSpecifier interface { + isRouteAction_ClusterSpecifier() + Equal(interface{}) bool + MarshalTo([]byte) (int, error) + Size() int +} +type isRouteAction_HostRewriteSpecifier interface { + isRouteAction_HostRewriteSpecifier() + Equal(interface{}) bool + MarshalTo([]byte) (int, error) + Size() int +} + +type RouteAction_Cluster struct { + Cluster string `protobuf:"bytes,1,opt,name=cluster,proto3,oneof"` +} +type RouteAction_ClusterHeader struct { + ClusterHeader string `protobuf:"bytes,2,opt,name=cluster_header,json=clusterHeader,proto3,oneof"` +} +type RouteAction_WeightedClusters struct { + WeightedClusters *WeightedCluster `protobuf:"bytes,3,opt,name=weighted_clusters,json=weightedClusters,oneof"` +} +type RouteAction_HostRewrite struct { + HostRewrite string `protobuf:"bytes,6,opt,name=host_rewrite,json=hostRewrite,proto3,oneof"` +} +type RouteAction_AutoHostRewrite struct { + AutoHostRewrite *types.BoolValue `protobuf:"bytes,7,opt,name=auto_host_rewrite,json=autoHostRewrite,oneof"` +} + +func (*RouteAction_Cluster) isRouteAction_ClusterSpecifier() {} +func (*RouteAction_ClusterHeader) isRouteAction_ClusterSpecifier() {} +func (*RouteAction_WeightedClusters) isRouteAction_ClusterSpecifier() {} +func (*RouteAction_HostRewrite) isRouteAction_HostRewriteSpecifier() {} +func (*RouteAction_AutoHostRewrite) isRouteAction_HostRewriteSpecifier() {} + +func (m *RouteAction) GetClusterSpecifier() isRouteAction_ClusterSpecifier { + if m != nil { + return m.ClusterSpecifier + } + return nil +} +func (m *RouteAction) GetHostRewriteSpecifier() isRouteAction_HostRewriteSpecifier { + if m != nil { + return m.HostRewriteSpecifier + } + return nil +} + +func (m *RouteAction) GetCluster() string { + if x, ok := m.GetClusterSpecifier().(*RouteAction_Cluster); ok { + return x.Cluster + } + return "" +} + +func (m *RouteAction) GetClusterHeader() string { + if x, ok := m.GetClusterSpecifier().(*RouteAction_ClusterHeader); ok { + return x.ClusterHeader + } + return "" +} + +func (m *RouteAction) GetWeightedClusters() *WeightedCluster { + if x, ok := m.GetClusterSpecifier().(*RouteAction_WeightedClusters); ok { + return x.WeightedClusters + } + return nil +} + +func (m *RouteAction) GetClusterNotFoundResponseCode() RouteAction_ClusterNotFoundResponseCode { + if m != nil { + return m.ClusterNotFoundResponseCode + } + return RouteAction_SERVICE_UNAVAILABLE +} + +func (m *RouteAction) GetMetadataMatch() *core.Metadata { + if m != nil { + return m.MetadataMatch + } + return nil +} + +func (m *RouteAction) GetPrefixRewrite() string { + if m != nil { + return m.PrefixRewrite + } + return "" +} + +func (m *RouteAction) GetHostRewrite() string { + if x, ok := m.GetHostRewriteSpecifier().(*RouteAction_HostRewrite); ok { + return x.HostRewrite + } + return "" +} + +func (m *RouteAction) GetAutoHostRewrite() *types.BoolValue { + if x, ok := m.GetHostRewriteSpecifier().(*RouteAction_AutoHostRewrite); ok { + return x.AutoHostRewrite + } + return nil +} + +func (m *RouteAction) GetTimeout() *time.Duration { + if m != nil { + return m.Timeout + } + return nil +} + +func (m *RouteAction) GetIdleTimeout() *time.Duration { + if m != nil { + return m.IdleTimeout + } + return nil +} + +func (m *RouteAction) GetRetryPolicy() *RouteAction_RetryPolicy { + if m != nil { + return m.RetryPolicy + } + return nil +} + +func (m *RouteAction) GetRequestMirrorPolicy() *RouteAction_RequestMirrorPolicy { + if m != nil { + return m.RequestMirrorPolicy + } + return nil +} + +func (m *RouteAction) GetPriority() core.RoutingPriority { + if m != nil { + return m.Priority + } + return core.RoutingPriority_DEFAULT +} + +// Deprecated: Do not use. +func (m *RouteAction) GetRequestHeadersToAdd() []*core.HeaderValueOption { + if m != nil { + return m.RequestHeadersToAdd + } + return nil +} + +// Deprecated: Do not use. +func (m *RouteAction) GetResponseHeadersToAdd() []*core.HeaderValueOption { + if m != nil { + return m.ResponseHeadersToAdd + } + return nil +} + +// Deprecated: Do not use. +func (m *RouteAction) GetResponseHeadersToRemove() []string { + if m != nil { + return m.ResponseHeadersToRemove + } + return nil +} + +func (m *RouteAction) GetRateLimits() []*RateLimit { + if m != nil { + return m.RateLimits + } + return nil +} + +func (m *RouteAction) GetIncludeVhRateLimits() *types.BoolValue { + if m != nil { + return m.IncludeVhRateLimits + } + return nil +} + +func (m *RouteAction) GetHashPolicy() []*RouteAction_HashPolicy { + if m != nil { + return m.HashPolicy + } + return nil +} + +// Deprecated: Do not use. +func (m *RouteAction) GetUseWebsocket() *types.BoolValue { + if m != nil { + return m.UseWebsocket + } + return nil +} + +// Deprecated: Do not use. +func (m *RouteAction) GetWebsocketConfig() *RouteAction_WebSocketProxyConfig { + if m != nil { + return m.WebsocketConfig + } + return nil +} + +func (m *RouteAction) GetCors() *CorsPolicy { + if m != nil { + return m.Cors + } + return nil +} + +func (m *RouteAction) GetMaxGrpcTimeout() *time.Duration { + if m != nil { + return m.MaxGrpcTimeout + } + return nil +} + +// XXX_OneofFuncs is for the internal use of the proto package. +func (*RouteAction) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { + return _RouteAction_OneofMarshaler, _RouteAction_OneofUnmarshaler, _RouteAction_OneofSizer, []interface{}{ + (*RouteAction_Cluster)(nil), + (*RouteAction_ClusterHeader)(nil), + (*RouteAction_WeightedClusters)(nil), + (*RouteAction_HostRewrite)(nil), + (*RouteAction_AutoHostRewrite)(nil), + } +} + +func _RouteAction_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { + m := msg.(*RouteAction) + // cluster_specifier + switch x := m.ClusterSpecifier.(type) { + case *RouteAction_Cluster: + _ = b.EncodeVarint(1<<3 | proto.WireBytes) + _ = b.EncodeStringBytes(x.Cluster) + case *RouteAction_ClusterHeader: + _ = b.EncodeVarint(2<<3 | proto.WireBytes) + _ = b.EncodeStringBytes(x.ClusterHeader) + case *RouteAction_WeightedClusters: + _ = b.EncodeVarint(3<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.WeightedClusters); err != nil { + return err + } + case nil: + default: + return fmt.Errorf("RouteAction.ClusterSpecifier has unexpected type %T", x) + } + // host_rewrite_specifier + switch x := m.HostRewriteSpecifier.(type) { + case *RouteAction_HostRewrite: + _ = b.EncodeVarint(6<<3 | proto.WireBytes) + _ = b.EncodeStringBytes(x.HostRewrite) + case *RouteAction_AutoHostRewrite: + _ = b.EncodeVarint(7<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.AutoHostRewrite); err != nil { + return err + } + case nil: + default: + return fmt.Errorf("RouteAction.HostRewriteSpecifier has unexpected type %T", x) + } + return nil +} + +func _RouteAction_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { + m := msg.(*RouteAction) + switch tag { + case 1: // cluster_specifier.cluster + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeStringBytes() + m.ClusterSpecifier = &RouteAction_Cluster{x} + return true, err + case 2: // cluster_specifier.cluster_header + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeStringBytes() + m.ClusterSpecifier = &RouteAction_ClusterHeader{x} + return true, err + case 3: // cluster_specifier.weighted_clusters + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(WeightedCluster) + err := b.DecodeMessage(msg) + m.ClusterSpecifier = &RouteAction_WeightedClusters{msg} + return true, err + case 6: // host_rewrite_specifier.host_rewrite + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeStringBytes() + m.HostRewriteSpecifier = &RouteAction_HostRewrite{x} + return true, err + case 7: // host_rewrite_specifier.auto_host_rewrite + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(types.BoolValue) + err := b.DecodeMessage(msg) + m.HostRewriteSpecifier = &RouteAction_AutoHostRewrite{msg} + return true, err + default: + return false, nil + } +} + +func _RouteAction_OneofSizer(msg proto.Message) (n int) { + m := msg.(*RouteAction) + // cluster_specifier + switch x := m.ClusterSpecifier.(type) { + case *RouteAction_Cluster: + n += 1 // tag and wire + n += proto.SizeVarint(uint64(len(x.Cluster))) + n += len(x.Cluster) + case *RouteAction_ClusterHeader: + n += 1 // tag and wire + n += proto.SizeVarint(uint64(len(x.ClusterHeader))) + n += len(x.ClusterHeader) + case *RouteAction_WeightedClusters: + s := proto.Size(x.WeightedClusters) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case nil: + default: + panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) + } + // host_rewrite_specifier + switch x := m.HostRewriteSpecifier.(type) { + case *RouteAction_HostRewrite: + n += 1 // tag and wire + n += proto.SizeVarint(uint64(len(x.HostRewrite))) + n += len(x.HostRewrite) + case *RouteAction_AutoHostRewrite: + s := proto.Size(x.AutoHostRewrite) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case nil: + default: + panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) + } + return n +} + +// HTTP retry :ref:`architecture overview `. +type RouteAction_RetryPolicy struct { + // Specifies the conditions under which retry takes place. These are the same + // conditions documented for :ref:`config_http_filters_router_x-envoy-retry-on` and + // :ref:`config_http_filters_router_x-envoy-retry-grpc-on`. + RetryOn string `protobuf:"bytes,1,opt,name=retry_on,json=retryOn,proto3" json:"retry_on,omitempty"` + // Specifies the allowed number of retries. This parameter is optional and + // defaults to 1. These are the same conditions documented for + // :ref:`config_http_filters_router_x-envoy-max-retries`. + NumRetries *types.UInt32Value `protobuf:"bytes,2,opt,name=num_retries,json=numRetries" json:"num_retries,omitempty"` + // Specifies a non-zero upstream timeout per retry attempt. This parameter is optional. The + // same conditions documented for + // :ref:`config_http_filters_router_x-envoy-upstream-rq-per-try-timeout-ms` apply. + // + // .. note:: + // + // If left unspecified, Envoy will use the global + // :ref:`route timeout ` for the request. + // Consequently, when using a :ref:`5xx ` based + // retry policy, a request that times out will not be retried as the total timeout budget + // would have been exhausted. + PerTryTimeout *time.Duration `protobuf:"bytes,3,opt,name=per_try_timeout,json=perTryTimeout,stdduration" json:"per_try_timeout,omitempty"` + // [#not-implemented-hide:] + // Specifies an implementation of a RetryPriority which is used to determine the + // distribution of load across priorities used for retries. + RetryPriority *RouteAction_RetryPolicy_RetryPriority `protobuf:"bytes,4,opt,name=retry_priority,json=retryPriority" json:"retry_priority,omitempty"` + // [#not-implemented-hide:] + // Specifies a collection of RetryHostPredicates that will be consulted when selecting a host + // for retries. If any of the predicates reject the host, host selection will be reattempted. + RetryHostPredicate []*RouteAction_RetryPolicy_RetryHostPredicate `protobuf:"bytes,5,rep,name=retry_host_predicate,json=retryHostPredicate" json:"retry_host_predicate,omitempty"` + // [#not-implemented-hide:] + // The maximum number of times host selection will be reattempted before giving up, at which + // point the host that was last selected will be routed to. If unspecified, this will default to + // retrying once. + HostSelectionRetryMaxAttempts int64 `protobuf:"varint,6,opt,name=host_selection_retry_max_attempts,json=hostSelectionRetryMaxAttempts,proto3" json:"host_selection_retry_max_attempts,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *RouteAction_RetryPolicy) Reset() { *m = RouteAction_RetryPolicy{} } +func (m *RouteAction_RetryPolicy) String() string { return proto.CompactTextString(m) } +func (*RouteAction_RetryPolicy) ProtoMessage() {} +func (*RouteAction_RetryPolicy) Descriptor() ([]byte, []int) { + return fileDescriptor_route_91aab16f18e3dd7f, []int{5, 0} +} +func (m *RouteAction_RetryPolicy) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RouteAction_RetryPolicy) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_RouteAction_RetryPolicy.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *RouteAction_RetryPolicy) XXX_Merge(src proto.Message) { + xxx_messageInfo_RouteAction_RetryPolicy.Merge(dst, src) +} +func (m *RouteAction_RetryPolicy) XXX_Size() int { + return m.Size() +} +func (m *RouteAction_RetryPolicy) XXX_DiscardUnknown() { + xxx_messageInfo_RouteAction_RetryPolicy.DiscardUnknown(m) +} + +var xxx_messageInfo_RouteAction_RetryPolicy proto.InternalMessageInfo + +func (m *RouteAction_RetryPolicy) GetRetryOn() string { + if m != nil { + return m.RetryOn + } + return "" +} + +func (m *RouteAction_RetryPolicy) GetNumRetries() *types.UInt32Value { + if m != nil { + return m.NumRetries + } + return nil +} + +func (m *RouteAction_RetryPolicy) GetPerTryTimeout() *time.Duration { + if m != nil { + return m.PerTryTimeout + } + return nil +} + +func (m *RouteAction_RetryPolicy) GetRetryPriority() *RouteAction_RetryPolicy_RetryPriority { + if m != nil { + return m.RetryPriority + } + return nil +} + +func (m *RouteAction_RetryPolicy) GetRetryHostPredicate() []*RouteAction_RetryPolicy_RetryHostPredicate { + if m != nil { + return m.RetryHostPredicate + } + return nil +} + +func (m *RouteAction_RetryPolicy) GetHostSelectionRetryMaxAttempts() int64 { + if m != nil { + return m.HostSelectionRetryMaxAttempts + } + return 0 +} + +type RouteAction_RetryPolicy_RetryPriority struct { + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Config *types.Struct `protobuf:"bytes,2,opt,name=config" json:"config,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *RouteAction_RetryPolicy_RetryPriority) Reset() { *m = RouteAction_RetryPolicy_RetryPriority{} } +func (m *RouteAction_RetryPolicy_RetryPriority) String() string { return proto.CompactTextString(m) } +func (*RouteAction_RetryPolicy_RetryPriority) ProtoMessage() {} +func (*RouteAction_RetryPolicy_RetryPriority) Descriptor() ([]byte, []int) { + return fileDescriptor_route_91aab16f18e3dd7f, []int{5, 0, 0} +} +func (m *RouteAction_RetryPolicy_RetryPriority) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RouteAction_RetryPolicy_RetryPriority) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_RouteAction_RetryPolicy_RetryPriority.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *RouteAction_RetryPolicy_RetryPriority) XXX_Merge(src proto.Message) { + xxx_messageInfo_RouteAction_RetryPolicy_RetryPriority.Merge(dst, src) +} +func (m *RouteAction_RetryPolicy_RetryPriority) XXX_Size() int { + return m.Size() +} +func (m *RouteAction_RetryPolicy_RetryPriority) XXX_DiscardUnknown() { + xxx_messageInfo_RouteAction_RetryPolicy_RetryPriority.DiscardUnknown(m) +} + +var xxx_messageInfo_RouteAction_RetryPolicy_RetryPriority proto.InternalMessageInfo + +func (m *RouteAction_RetryPolicy_RetryPriority) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *RouteAction_RetryPolicy_RetryPriority) GetConfig() *types.Struct { + if m != nil { + return m.Config + } + return nil +} + +type RouteAction_RetryPolicy_RetryHostPredicate struct { + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Config *types.Struct `protobuf:"bytes,2,opt,name=config" json:"config,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *RouteAction_RetryPolicy_RetryHostPredicate) Reset() { + *m = RouteAction_RetryPolicy_RetryHostPredicate{} +} +func (m *RouteAction_RetryPolicy_RetryHostPredicate) String() string { + return proto.CompactTextString(m) +} +func (*RouteAction_RetryPolicy_RetryHostPredicate) ProtoMessage() {} +func (*RouteAction_RetryPolicy_RetryHostPredicate) Descriptor() ([]byte, []int) { + return fileDescriptor_route_91aab16f18e3dd7f, []int{5, 0, 1} +} +func (m *RouteAction_RetryPolicy_RetryHostPredicate) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RouteAction_RetryPolicy_RetryHostPredicate) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_RouteAction_RetryPolicy_RetryHostPredicate.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *RouteAction_RetryPolicy_RetryHostPredicate) XXX_Merge(src proto.Message) { + xxx_messageInfo_RouteAction_RetryPolicy_RetryHostPredicate.Merge(dst, src) +} +func (m *RouteAction_RetryPolicy_RetryHostPredicate) XXX_Size() int { + return m.Size() +} +func (m *RouteAction_RetryPolicy_RetryHostPredicate) XXX_DiscardUnknown() { + xxx_messageInfo_RouteAction_RetryPolicy_RetryHostPredicate.DiscardUnknown(m) +} + +var xxx_messageInfo_RouteAction_RetryPolicy_RetryHostPredicate proto.InternalMessageInfo + +func (m *RouteAction_RetryPolicy_RetryHostPredicate) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *RouteAction_RetryPolicy_RetryHostPredicate) GetConfig() *types.Struct { + if m != nil { + return m.Config + } + return nil +} + +// The router is capable of shadowing traffic from one cluster to another. The current +// implementation is "fire and forget," meaning Envoy will not wait for the shadow cluster to +// respond before returning the response from the primary cluster. All normal statistics are +// collected for the shadow cluster making this feature useful for testing. +// +// During shadowing, the host/authority header is altered such that *-shadow* is appended. This is +// useful for logging. For example, *cluster1* becomes *cluster1-shadow*. +type RouteAction_RequestMirrorPolicy struct { + // Specifies the cluster that requests will be mirrored to. The cluster must + // exist in the cluster manager configuration. + Cluster string `protobuf:"bytes,1,opt,name=cluster,proto3" json:"cluster,omitempty"` + // If not specified, all requests to the target cluster will be mirrored. If + // specified, Envoy will lookup the runtime key to get the % of requests to + // mirror. Valid values are from 0 to 10000, allowing for increments of + // 0.01% of requests to be mirrored. If the runtime key is specified in the + // configuration but not present in runtime, 0 is the default and thus 0% of + // requests will be mirrored. + RuntimeKey string `protobuf:"bytes,2,opt,name=runtime_key,json=runtimeKey,proto3" json:"runtime_key,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *RouteAction_RequestMirrorPolicy) Reset() { *m = RouteAction_RequestMirrorPolicy{} } +func (m *RouteAction_RequestMirrorPolicy) String() string { return proto.CompactTextString(m) } +func (*RouteAction_RequestMirrorPolicy) ProtoMessage() {} +func (*RouteAction_RequestMirrorPolicy) Descriptor() ([]byte, []int) { + return fileDescriptor_route_91aab16f18e3dd7f, []int{5, 1} +} +func (m *RouteAction_RequestMirrorPolicy) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RouteAction_RequestMirrorPolicy) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_RouteAction_RequestMirrorPolicy.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *RouteAction_RequestMirrorPolicy) XXX_Merge(src proto.Message) { + xxx_messageInfo_RouteAction_RequestMirrorPolicy.Merge(dst, src) +} +func (m *RouteAction_RequestMirrorPolicy) XXX_Size() int { + return m.Size() +} +func (m *RouteAction_RequestMirrorPolicy) XXX_DiscardUnknown() { + xxx_messageInfo_RouteAction_RequestMirrorPolicy.DiscardUnknown(m) +} + +var xxx_messageInfo_RouteAction_RequestMirrorPolicy proto.InternalMessageInfo + +func (m *RouteAction_RequestMirrorPolicy) GetCluster() string { + if m != nil { + return m.Cluster + } + return "" +} + +func (m *RouteAction_RequestMirrorPolicy) GetRuntimeKey() string { + if m != nil { + return m.RuntimeKey + } + return "" +} + +// Specifies the route's hashing policy if the upstream cluster uses a hashing :ref:`load balancer +// `. +type RouteAction_HashPolicy struct { + // Types that are valid to be assigned to PolicySpecifier: + // *RouteAction_HashPolicy_Header_ + // *RouteAction_HashPolicy_Cookie_ + // *RouteAction_HashPolicy_ConnectionProperties_ + PolicySpecifier isRouteAction_HashPolicy_PolicySpecifier `protobuf_oneof:"policy_specifier"` + // The flag that shortcircuits the hash computing. This field provides a + // 'fallback' style of configuration: "if a terminal policy doesn't work, + // fallback to rest of the policy list", it saves time when the terminal + // policy works. + // + // If true, and there is already a hash computed, ignore rest of the + // list of hash polices. + // For example, if the following hash methods are configured: + // + // ========= ======== + // specifier terminal + // ========= ======== + // Header A true + // Header B false + // Header C false + // ========= ======== + // + // The generateHash process ends if policy "header A" generates a hash, as + // it's a terminal policy. + Terminal bool `protobuf:"varint,4,opt,name=terminal,proto3" json:"terminal,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *RouteAction_HashPolicy) Reset() { *m = RouteAction_HashPolicy{} } +func (m *RouteAction_HashPolicy) String() string { return proto.CompactTextString(m) } +func (*RouteAction_HashPolicy) ProtoMessage() {} +func (*RouteAction_HashPolicy) Descriptor() ([]byte, []int) { + return fileDescriptor_route_91aab16f18e3dd7f, []int{5, 2} +} +func (m *RouteAction_HashPolicy) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RouteAction_HashPolicy) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_RouteAction_HashPolicy.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *RouteAction_HashPolicy) XXX_Merge(src proto.Message) { + xxx_messageInfo_RouteAction_HashPolicy.Merge(dst, src) +} +func (m *RouteAction_HashPolicy) XXX_Size() int { + return m.Size() +} +func (m *RouteAction_HashPolicy) XXX_DiscardUnknown() { + xxx_messageInfo_RouteAction_HashPolicy.DiscardUnknown(m) +} + +var xxx_messageInfo_RouteAction_HashPolicy proto.InternalMessageInfo + +type isRouteAction_HashPolicy_PolicySpecifier interface { + isRouteAction_HashPolicy_PolicySpecifier() + Equal(interface{}) bool + MarshalTo([]byte) (int, error) + Size() int +} + +type RouteAction_HashPolicy_Header_ struct { + Header *RouteAction_HashPolicy_Header `protobuf:"bytes,1,opt,name=header,oneof"` +} +type RouteAction_HashPolicy_Cookie_ struct { + Cookie *RouteAction_HashPolicy_Cookie `protobuf:"bytes,2,opt,name=cookie,oneof"` +} +type RouteAction_HashPolicy_ConnectionProperties_ struct { + ConnectionProperties *RouteAction_HashPolicy_ConnectionProperties `protobuf:"bytes,3,opt,name=connection_properties,json=connectionProperties,oneof"` +} + +func (*RouteAction_HashPolicy_Header_) isRouteAction_HashPolicy_PolicySpecifier() {} +func (*RouteAction_HashPolicy_Cookie_) isRouteAction_HashPolicy_PolicySpecifier() {} +func (*RouteAction_HashPolicy_ConnectionProperties_) isRouteAction_HashPolicy_PolicySpecifier() {} + +func (m *RouteAction_HashPolicy) GetPolicySpecifier() isRouteAction_HashPolicy_PolicySpecifier { + if m != nil { + return m.PolicySpecifier + } + return nil +} + +func (m *RouteAction_HashPolicy) GetHeader() *RouteAction_HashPolicy_Header { + if x, ok := m.GetPolicySpecifier().(*RouteAction_HashPolicy_Header_); ok { + return x.Header + } + return nil +} + +func (m *RouteAction_HashPolicy) GetCookie() *RouteAction_HashPolicy_Cookie { + if x, ok := m.GetPolicySpecifier().(*RouteAction_HashPolicy_Cookie_); ok { + return x.Cookie + } + return nil +} + +func (m *RouteAction_HashPolicy) GetConnectionProperties() *RouteAction_HashPolicy_ConnectionProperties { + if x, ok := m.GetPolicySpecifier().(*RouteAction_HashPolicy_ConnectionProperties_); ok { + return x.ConnectionProperties + } + return nil +} + +func (m *RouteAction_HashPolicy) GetTerminal() bool { + if m != nil { + return m.Terminal + } + return false +} + +// XXX_OneofFuncs is for the internal use of the proto package. +func (*RouteAction_HashPolicy) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { + return _RouteAction_HashPolicy_OneofMarshaler, _RouteAction_HashPolicy_OneofUnmarshaler, _RouteAction_HashPolicy_OneofSizer, []interface{}{ + (*RouteAction_HashPolicy_Header_)(nil), + (*RouteAction_HashPolicy_Cookie_)(nil), + (*RouteAction_HashPolicy_ConnectionProperties_)(nil), + } +} + +func _RouteAction_HashPolicy_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { + m := msg.(*RouteAction_HashPolicy) + // policy_specifier + switch x := m.PolicySpecifier.(type) { + case *RouteAction_HashPolicy_Header_: + _ = b.EncodeVarint(1<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.Header); err != nil { + return err + } + case *RouteAction_HashPolicy_Cookie_: + _ = b.EncodeVarint(2<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.Cookie); err != nil { + return err + } + case *RouteAction_HashPolicy_ConnectionProperties_: + _ = b.EncodeVarint(3<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.ConnectionProperties); err != nil { + return err + } + case nil: + default: + return fmt.Errorf("RouteAction_HashPolicy.PolicySpecifier has unexpected type %T", x) + } + return nil +} + +func _RouteAction_HashPolicy_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { + m := msg.(*RouteAction_HashPolicy) + switch tag { + case 1: // policy_specifier.header + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(RouteAction_HashPolicy_Header) + err := b.DecodeMessage(msg) + m.PolicySpecifier = &RouteAction_HashPolicy_Header_{msg} + return true, err + case 2: // policy_specifier.cookie + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(RouteAction_HashPolicy_Cookie) + err := b.DecodeMessage(msg) + m.PolicySpecifier = &RouteAction_HashPolicy_Cookie_{msg} + return true, err + case 3: // policy_specifier.connection_properties + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(RouteAction_HashPolicy_ConnectionProperties) + err := b.DecodeMessage(msg) + m.PolicySpecifier = &RouteAction_HashPolicy_ConnectionProperties_{msg} + return true, err + default: + return false, nil + } +} + +func _RouteAction_HashPolicy_OneofSizer(msg proto.Message) (n int) { + m := msg.(*RouteAction_HashPolicy) + // policy_specifier + switch x := m.PolicySpecifier.(type) { + case *RouteAction_HashPolicy_Header_: + s := proto.Size(x.Header) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case *RouteAction_HashPolicy_Cookie_: + s := proto.Size(x.Cookie) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case *RouteAction_HashPolicy_ConnectionProperties_: + s := proto.Size(x.ConnectionProperties) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case nil: + default: + panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) + } + return n +} + +type RouteAction_HashPolicy_Header struct { + // The name of the request header that will be used to obtain the hash + // key. If the request header is not present, no hash will be produced. + HeaderName string `protobuf:"bytes,1,opt,name=header_name,json=headerName,proto3" json:"header_name,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *RouteAction_HashPolicy_Header) Reset() { *m = RouteAction_HashPolicy_Header{} } +func (m *RouteAction_HashPolicy_Header) String() string { return proto.CompactTextString(m) } +func (*RouteAction_HashPolicy_Header) ProtoMessage() {} +func (*RouteAction_HashPolicy_Header) Descriptor() ([]byte, []int) { + return fileDescriptor_route_91aab16f18e3dd7f, []int{5, 2, 0} +} +func (m *RouteAction_HashPolicy_Header) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RouteAction_HashPolicy_Header) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_RouteAction_HashPolicy_Header.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *RouteAction_HashPolicy_Header) XXX_Merge(src proto.Message) { + xxx_messageInfo_RouteAction_HashPolicy_Header.Merge(dst, src) +} +func (m *RouteAction_HashPolicy_Header) XXX_Size() int { + return m.Size() +} +func (m *RouteAction_HashPolicy_Header) XXX_DiscardUnknown() { + xxx_messageInfo_RouteAction_HashPolicy_Header.DiscardUnknown(m) +} + +var xxx_messageInfo_RouteAction_HashPolicy_Header proto.InternalMessageInfo + +func (m *RouteAction_HashPolicy_Header) GetHeaderName() string { + if m != nil { + return m.HeaderName + } + return "" +} + +// Envoy supports two types of cookie affinity: +// +// 1. Passive. Envoy takes a cookie that's present in the cookies header and +// hashes on its value. +// +// 2. Generated. Envoy generates and sets a cookie with an expiration (TTL) +// on the first request from the client in its response to the client, +// based on the endpoint the request gets sent to. The client then +// presents this on the next and all subsequent requests. The hash of +// this is sufficient to ensure these requests get sent to the same +// endpoint. The cookie is generated by hashing the source and +// destination ports and addresses so that multiple independent HTTP2 +// streams on the same connection will independently receive the same +// cookie, even if they arrive at the Envoy simultaneously. +type RouteAction_HashPolicy_Cookie struct { + // The name of the cookie that will be used to obtain the hash key. If the + // cookie is not present and ttl below is not set, no hash will be + // produced. + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // If specified, a cookie with the TTL will be generated if the cookie is + // not present. If the TTL is present and zero, the generated cookie will + // be a session cookie. + Ttl *time.Duration `protobuf:"bytes,2,opt,name=ttl,stdduration" json:"ttl,omitempty"` + // The name of the path for the cookie. If no path is specified here, no path + // will be set for the cookie. + Path string `protobuf:"bytes,3,opt,name=path,proto3" json:"path,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *RouteAction_HashPolicy_Cookie) Reset() { *m = RouteAction_HashPolicy_Cookie{} } +func (m *RouteAction_HashPolicy_Cookie) String() string { return proto.CompactTextString(m) } +func (*RouteAction_HashPolicy_Cookie) ProtoMessage() {} +func (*RouteAction_HashPolicy_Cookie) Descriptor() ([]byte, []int) { + return fileDescriptor_route_91aab16f18e3dd7f, []int{5, 2, 1} +} +func (m *RouteAction_HashPolicy_Cookie) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RouteAction_HashPolicy_Cookie) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_RouteAction_HashPolicy_Cookie.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *RouteAction_HashPolicy_Cookie) XXX_Merge(src proto.Message) { + xxx_messageInfo_RouteAction_HashPolicy_Cookie.Merge(dst, src) +} +func (m *RouteAction_HashPolicy_Cookie) XXX_Size() int { + return m.Size() +} +func (m *RouteAction_HashPolicy_Cookie) XXX_DiscardUnknown() { + xxx_messageInfo_RouteAction_HashPolicy_Cookie.DiscardUnknown(m) +} + +var xxx_messageInfo_RouteAction_HashPolicy_Cookie proto.InternalMessageInfo + +func (m *RouteAction_HashPolicy_Cookie) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *RouteAction_HashPolicy_Cookie) GetTtl() *time.Duration { + if m != nil { + return m.Ttl + } + return nil +} + +func (m *RouteAction_HashPolicy_Cookie) GetPath() string { + if m != nil { + return m.Path + } + return "" +} + +type RouteAction_HashPolicy_ConnectionProperties struct { + // Hash on source IP address. + SourceIp bool `protobuf:"varint,1,opt,name=source_ip,json=sourceIp,proto3" json:"source_ip,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *RouteAction_HashPolicy_ConnectionProperties) Reset() { + *m = RouteAction_HashPolicy_ConnectionProperties{} +} +func (m *RouteAction_HashPolicy_ConnectionProperties) String() string { + return proto.CompactTextString(m) +} +func (*RouteAction_HashPolicy_ConnectionProperties) ProtoMessage() {} +func (*RouteAction_HashPolicy_ConnectionProperties) Descriptor() ([]byte, []int) { + return fileDescriptor_route_91aab16f18e3dd7f, []int{5, 2, 2} +} +func (m *RouteAction_HashPolicy_ConnectionProperties) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RouteAction_HashPolicy_ConnectionProperties) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_RouteAction_HashPolicy_ConnectionProperties.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *RouteAction_HashPolicy_ConnectionProperties) XXX_Merge(src proto.Message) { + xxx_messageInfo_RouteAction_HashPolicy_ConnectionProperties.Merge(dst, src) +} +func (m *RouteAction_HashPolicy_ConnectionProperties) XXX_Size() int { + return m.Size() +} +func (m *RouteAction_HashPolicy_ConnectionProperties) XXX_DiscardUnknown() { + xxx_messageInfo_RouteAction_HashPolicy_ConnectionProperties.DiscardUnknown(m) +} + +var xxx_messageInfo_RouteAction_HashPolicy_ConnectionProperties proto.InternalMessageInfo + +func (m *RouteAction_HashPolicy_ConnectionProperties) GetSourceIp() bool { + if m != nil { + return m.SourceIp + } + return false +} + +type RouteAction_WebSocketProxyConfig struct { + // See :ref:`stat_prefix + // `. If the parameter + // is not specified, the default value of "websocket" is used. + // + // WebSocket connections support the :ref:`downstream statistics + // ` for TCP proxy, except for the following, which are + // reported in the :ref:`HTTP Connection Manager statistics `: + // - downstream_cx_tx_bytes_total + // - downstream_cx_tx_bytes_buffered + // - downstream_cx_rx_bytes_total + // - downstream_cx_rx_bytes_buffered + StatPrefix string `protobuf:"bytes,1,opt,name=stat_prefix,json=statPrefix,proto3" json:"stat_prefix,omitempty"` + // See :ref:`idle_timeout + // `. This timeout is + // only in effect after the WebSocket upgrade request is received by Envoy. It does not cover + // the initial part of the HTTP request. + IdleTimeout *time.Duration `protobuf:"bytes,2,opt,name=idle_timeout,json=idleTimeout,stdduration" json:"idle_timeout,omitempty"` + // See :ref:`max_connect_attempts + // `. + MaxConnectAttempts *types.UInt32Value `protobuf:"bytes,3,opt,name=max_connect_attempts,json=maxConnectAttempts" json:"max_connect_attempts,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *RouteAction_WebSocketProxyConfig) Reset() { *m = RouteAction_WebSocketProxyConfig{} } +func (m *RouteAction_WebSocketProxyConfig) String() string { return proto.CompactTextString(m) } +func (*RouteAction_WebSocketProxyConfig) ProtoMessage() {} +func (*RouteAction_WebSocketProxyConfig) Descriptor() ([]byte, []int) { + return fileDescriptor_route_91aab16f18e3dd7f, []int{5, 3} +} +func (m *RouteAction_WebSocketProxyConfig) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RouteAction_WebSocketProxyConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_RouteAction_WebSocketProxyConfig.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *RouteAction_WebSocketProxyConfig) XXX_Merge(src proto.Message) { + xxx_messageInfo_RouteAction_WebSocketProxyConfig.Merge(dst, src) +} +func (m *RouteAction_WebSocketProxyConfig) XXX_Size() int { + return m.Size() +} +func (m *RouteAction_WebSocketProxyConfig) XXX_DiscardUnknown() { + xxx_messageInfo_RouteAction_WebSocketProxyConfig.DiscardUnknown(m) +} + +var xxx_messageInfo_RouteAction_WebSocketProxyConfig proto.InternalMessageInfo + +func (m *RouteAction_WebSocketProxyConfig) GetStatPrefix() string { + if m != nil { + return m.StatPrefix + } + return "" +} + +func (m *RouteAction_WebSocketProxyConfig) GetIdleTimeout() *time.Duration { + if m != nil { + return m.IdleTimeout + } + return nil +} + +func (m *RouteAction_WebSocketProxyConfig) GetMaxConnectAttempts() *types.UInt32Value { + if m != nil { + return m.MaxConnectAttempts + } + return nil +} + +type RedirectAction struct { + // The host portion of the URL will be swapped with this value. + HostRedirect string `protobuf:"bytes,1,opt,name=host_redirect,json=hostRedirect,proto3" json:"host_redirect,omitempty"` + // Types that are valid to be assigned to PathRewriteSpecifier: + // *RedirectAction_PathRedirect + // *RedirectAction_PrefixRewrite + PathRewriteSpecifier isRedirectAction_PathRewriteSpecifier `protobuf_oneof:"path_rewrite_specifier"` + // The HTTP status code to use in the redirect response. The default response + // code is MOVED_PERMANENTLY (301). + ResponseCode RedirectAction_RedirectResponseCode `protobuf:"varint,3,opt,name=response_code,json=responseCode,proto3,enum=envoy.api.v2.route.RedirectAction_RedirectResponseCode" json:"response_code,omitempty"` + // The scheme portion of the URL will be swapped with "https". + HttpsRedirect bool `protobuf:"varint,4,opt,name=https_redirect,json=httpsRedirect,proto3" json:"https_redirect,omitempty"` + // Indicates that during redirection, the query portion of the URL will + // be removed. Default value is false. + StripQuery bool `protobuf:"varint,6,opt,name=strip_query,json=stripQuery,proto3" json:"strip_query,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *RedirectAction) Reset() { *m = RedirectAction{} } +func (m *RedirectAction) String() string { return proto.CompactTextString(m) } +func (*RedirectAction) ProtoMessage() {} +func (*RedirectAction) Descriptor() ([]byte, []int) { + return fileDescriptor_route_91aab16f18e3dd7f, []int{6} +} +func (m *RedirectAction) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RedirectAction) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_RedirectAction.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *RedirectAction) XXX_Merge(src proto.Message) { + xxx_messageInfo_RedirectAction.Merge(dst, src) +} +func (m *RedirectAction) XXX_Size() int { + return m.Size() +} +func (m *RedirectAction) XXX_DiscardUnknown() { + xxx_messageInfo_RedirectAction.DiscardUnknown(m) +} + +var xxx_messageInfo_RedirectAction proto.InternalMessageInfo + +type isRedirectAction_PathRewriteSpecifier interface { + isRedirectAction_PathRewriteSpecifier() + Equal(interface{}) bool + MarshalTo([]byte) (int, error) + Size() int +} + +type RedirectAction_PathRedirect struct { + PathRedirect string `protobuf:"bytes,2,opt,name=path_redirect,json=pathRedirect,proto3,oneof"` +} +type RedirectAction_PrefixRewrite struct { + PrefixRewrite string `protobuf:"bytes,5,opt,name=prefix_rewrite,json=prefixRewrite,proto3,oneof"` +} + +func (*RedirectAction_PathRedirect) isRedirectAction_PathRewriteSpecifier() {} +func (*RedirectAction_PrefixRewrite) isRedirectAction_PathRewriteSpecifier() {} + +func (m *RedirectAction) GetPathRewriteSpecifier() isRedirectAction_PathRewriteSpecifier { + if m != nil { + return m.PathRewriteSpecifier + } + return nil +} + +func (m *RedirectAction) GetHostRedirect() string { + if m != nil { + return m.HostRedirect + } + return "" +} + +func (m *RedirectAction) GetPathRedirect() string { + if x, ok := m.GetPathRewriteSpecifier().(*RedirectAction_PathRedirect); ok { + return x.PathRedirect + } + return "" +} + +func (m *RedirectAction) GetPrefixRewrite() string { + if x, ok := m.GetPathRewriteSpecifier().(*RedirectAction_PrefixRewrite); ok { + return x.PrefixRewrite + } + return "" +} + +func (m *RedirectAction) GetResponseCode() RedirectAction_RedirectResponseCode { + if m != nil { + return m.ResponseCode + } + return RedirectAction_MOVED_PERMANENTLY +} + +func (m *RedirectAction) GetHttpsRedirect() bool { + if m != nil { + return m.HttpsRedirect + } + return false +} + +func (m *RedirectAction) GetStripQuery() bool { + if m != nil { + return m.StripQuery + } + return false +} + +// XXX_OneofFuncs is for the internal use of the proto package. +func (*RedirectAction) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { + return _RedirectAction_OneofMarshaler, _RedirectAction_OneofUnmarshaler, _RedirectAction_OneofSizer, []interface{}{ + (*RedirectAction_PathRedirect)(nil), + (*RedirectAction_PrefixRewrite)(nil), + } +} + +func _RedirectAction_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { + m := msg.(*RedirectAction) + // path_rewrite_specifier + switch x := m.PathRewriteSpecifier.(type) { + case *RedirectAction_PathRedirect: + _ = b.EncodeVarint(2<<3 | proto.WireBytes) + _ = b.EncodeStringBytes(x.PathRedirect) + case *RedirectAction_PrefixRewrite: + _ = b.EncodeVarint(5<<3 | proto.WireBytes) + _ = b.EncodeStringBytes(x.PrefixRewrite) + case nil: + default: + return fmt.Errorf("RedirectAction.PathRewriteSpecifier has unexpected type %T", x) + } + return nil +} + +func _RedirectAction_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { + m := msg.(*RedirectAction) + switch tag { + case 2: // path_rewrite_specifier.path_redirect + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeStringBytes() + m.PathRewriteSpecifier = &RedirectAction_PathRedirect{x} + return true, err + case 5: // path_rewrite_specifier.prefix_rewrite + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeStringBytes() + m.PathRewriteSpecifier = &RedirectAction_PrefixRewrite{x} + return true, err + default: + return false, nil + } +} + +func _RedirectAction_OneofSizer(msg proto.Message) (n int) { + m := msg.(*RedirectAction) + // path_rewrite_specifier + switch x := m.PathRewriteSpecifier.(type) { + case *RedirectAction_PathRedirect: + n += 1 // tag and wire + n += proto.SizeVarint(uint64(len(x.PathRedirect))) + n += len(x.PathRedirect) + case *RedirectAction_PrefixRewrite: + n += 1 // tag and wire + n += proto.SizeVarint(uint64(len(x.PrefixRewrite))) + n += len(x.PrefixRewrite) + case nil: + default: + panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) + } + return n +} + +type DirectResponseAction struct { + // Specifies the HTTP response status to be returned. + Status uint32 `protobuf:"varint,1,opt,name=status,proto3" json:"status,omitempty"` + // Specifies the content of the response body. If this setting is omitted, + // no body is included in the generated response. + // + // .. note:: + // + // Headers can be specified using *response_headers_to_add* in the enclosing + // :ref:`envoy_api_msg_route.Route`, :ref:`envoy_api_msg_RouteConfiguration` or + // :ref:`envoy_api_msg_route.VirtualHost`. + Body *core.DataSource `protobuf:"bytes,2,opt,name=body" json:"body,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *DirectResponseAction) Reset() { *m = DirectResponseAction{} } +func (m *DirectResponseAction) String() string { return proto.CompactTextString(m) } +func (*DirectResponseAction) ProtoMessage() {} +func (*DirectResponseAction) Descriptor() ([]byte, []int) { + return fileDescriptor_route_91aab16f18e3dd7f, []int{7} +} +func (m *DirectResponseAction) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DirectResponseAction) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_DirectResponseAction.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *DirectResponseAction) XXX_Merge(src proto.Message) { + xxx_messageInfo_DirectResponseAction.Merge(dst, src) +} +func (m *DirectResponseAction) XXX_Size() int { + return m.Size() +} +func (m *DirectResponseAction) XXX_DiscardUnknown() { + xxx_messageInfo_DirectResponseAction.DiscardUnknown(m) +} + +var xxx_messageInfo_DirectResponseAction proto.InternalMessageInfo + +func (m *DirectResponseAction) GetStatus() uint32 { + if m != nil { + return m.Status + } + return 0 +} + +func (m *DirectResponseAction) GetBody() *core.DataSource { + if m != nil { + return m.Body + } + return nil +} + +type Decorator struct { + // The operation name associated with the request matched to this route. If tracing is + // enabled, this information will be used as the span name reported for this request. + // + // .. note:: + // + // For ingress (inbound) requests, or egress (outbound) responses, this value may be overridden + // by the :ref:`x-envoy-decorator-operation + // ` header. + Operation string `protobuf:"bytes,1,opt,name=operation,proto3" json:"operation,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Decorator) Reset() { *m = Decorator{} } +func (m *Decorator) String() string { return proto.CompactTextString(m) } +func (*Decorator) ProtoMessage() {} +func (*Decorator) Descriptor() ([]byte, []int) { + return fileDescriptor_route_91aab16f18e3dd7f, []int{8} +} +func (m *Decorator) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Decorator) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Decorator.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *Decorator) XXX_Merge(src proto.Message) { + xxx_messageInfo_Decorator.Merge(dst, src) +} +func (m *Decorator) XXX_Size() int { + return m.Size() +} +func (m *Decorator) XXX_DiscardUnknown() { + xxx_messageInfo_Decorator.DiscardUnknown(m) +} + +var xxx_messageInfo_Decorator proto.InternalMessageInfo + +func (m *Decorator) GetOperation() string { + if m != nil { + return m.Operation + } + return "" +} + +// A virtual cluster is a way of specifying a regex matching rule against +// certain important endpoints such that statistics are generated explicitly for +// the matched requests. The reason this is useful is that when doing +// prefix/path matching Envoy does not always know what the application +// considers to be an endpoint. Thus, it’s impossible for Envoy to generically +// emit per endpoint statistics. However, often systems have highly critical +// endpoints that they wish to get “perfect” statistics on. Virtual cluster +// statistics are perfect in the sense that they are emitted on the downstream +// side such that they include network level failures. +// +// Documentation for :ref:`virtual cluster statistics `. +// +// .. note:: +// +// Virtual clusters are a useful tool, but we do not recommend setting up a virtual cluster for +// every application endpoint. This is both not easily maintainable and as well the matching and +// statistics output are not free. +type VirtualCluster struct { + // Specifies a regex pattern to use for matching requests. The entire path of the request + // must match the regex. The regex grammar used is defined `here + // `_. + // + // Examples: + // + // * The regex */rides/\d+* matches the path */rides/0* + // * The regex */rides/\d+* matches the path */rides/123* + // * The regex */rides/\d+* does not match the path */rides/123/456* + Pattern string `protobuf:"bytes,1,opt,name=pattern,proto3" json:"pattern,omitempty"` + // Specifies the name of the virtual cluster. The virtual cluster name as well + // as the virtual host name are used when emitting statistics. The statistics are emitted by the + // router filter and are documented :ref:`here `. + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + // Optionally specifies the HTTP method to match on. For example GET, PUT, + // etc. + // [#comment:TODO(htuch): add (validate.rules).enum.defined_only = true once + // https://github.com/lyft/protoc-gen-validate/issues/42 is resolved.] + Method core.RequestMethod `protobuf:"varint,3,opt,name=method,proto3,enum=envoy.api.v2.core.RequestMethod" json:"method,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *VirtualCluster) Reset() { *m = VirtualCluster{} } +func (m *VirtualCluster) String() string { return proto.CompactTextString(m) } +func (*VirtualCluster) ProtoMessage() {} +func (*VirtualCluster) Descriptor() ([]byte, []int) { + return fileDescriptor_route_91aab16f18e3dd7f, []int{9} +} +func (m *VirtualCluster) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *VirtualCluster) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_VirtualCluster.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *VirtualCluster) XXX_Merge(src proto.Message) { + xxx_messageInfo_VirtualCluster.Merge(dst, src) +} +func (m *VirtualCluster) XXX_Size() int { + return m.Size() +} +func (m *VirtualCluster) XXX_DiscardUnknown() { + xxx_messageInfo_VirtualCluster.DiscardUnknown(m) +} + +var xxx_messageInfo_VirtualCluster proto.InternalMessageInfo + +func (m *VirtualCluster) GetPattern() string { + if m != nil { + return m.Pattern + } + return "" +} + +func (m *VirtualCluster) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *VirtualCluster) GetMethod() core.RequestMethod { + if m != nil { + return m.Method + } + return core.METHOD_UNSPECIFIED +} + +// Global rate limiting :ref:`architecture overview `. +type RateLimit struct { + // Refers to the stage set in the filter. The rate limit configuration only + // applies to filters with the same stage number. The default stage number is + // 0. + // + // .. note:: + // + // The filter supports a range of 0 - 10 inclusively for stage numbers. + Stage *types.UInt32Value `protobuf:"bytes,1,opt,name=stage" json:"stage,omitempty"` + // The key to be set in runtime to disable this rate limit configuration. + DisableKey string `protobuf:"bytes,2,opt,name=disable_key,json=disableKey,proto3" json:"disable_key,omitempty"` + // A list of actions that are to be applied for this rate limit configuration. + // Order matters as the actions are processed sequentially and the descriptor + // is composed by appending descriptor entries in that sequence. If an action + // cannot append a descriptor entry, no descriptor is generated for the + // configuration. See :ref:`composing actions + // ` for additional documentation. + Actions []*RateLimit_Action `protobuf:"bytes,3,rep,name=actions" json:"actions,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *RateLimit) Reset() { *m = RateLimit{} } +func (m *RateLimit) String() string { return proto.CompactTextString(m) } +func (*RateLimit) ProtoMessage() {} +func (*RateLimit) Descriptor() ([]byte, []int) { + return fileDescriptor_route_91aab16f18e3dd7f, []int{10} +} +func (m *RateLimit) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RateLimit) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_RateLimit.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *RateLimit) XXX_Merge(src proto.Message) { + xxx_messageInfo_RateLimit.Merge(dst, src) +} +func (m *RateLimit) XXX_Size() int { + return m.Size() +} +func (m *RateLimit) XXX_DiscardUnknown() { + xxx_messageInfo_RateLimit.DiscardUnknown(m) +} + +var xxx_messageInfo_RateLimit proto.InternalMessageInfo + +func (m *RateLimit) GetStage() *types.UInt32Value { + if m != nil { + return m.Stage + } + return nil +} + +func (m *RateLimit) GetDisableKey() string { + if m != nil { + return m.DisableKey + } + return "" +} + +func (m *RateLimit) GetActions() []*RateLimit_Action { + if m != nil { + return m.Actions + } + return nil +} + +type RateLimit_Action struct { + // Types that are valid to be assigned to ActionSpecifier: + // *RateLimit_Action_SourceCluster_ + // *RateLimit_Action_DestinationCluster_ + // *RateLimit_Action_RequestHeaders_ + // *RateLimit_Action_RemoteAddress_ + // *RateLimit_Action_GenericKey_ + // *RateLimit_Action_HeaderValueMatch_ + ActionSpecifier isRateLimit_Action_ActionSpecifier `protobuf_oneof:"action_specifier"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *RateLimit_Action) Reset() { *m = RateLimit_Action{} } +func (m *RateLimit_Action) String() string { return proto.CompactTextString(m) } +func (*RateLimit_Action) ProtoMessage() {} +func (*RateLimit_Action) Descriptor() ([]byte, []int) { + return fileDescriptor_route_91aab16f18e3dd7f, []int{10, 0} +} +func (m *RateLimit_Action) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RateLimit_Action) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_RateLimit_Action.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *RateLimit_Action) XXX_Merge(src proto.Message) { + xxx_messageInfo_RateLimit_Action.Merge(dst, src) +} +func (m *RateLimit_Action) XXX_Size() int { + return m.Size() +} +func (m *RateLimit_Action) XXX_DiscardUnknown() { + xxx_messageInfo_RateLimit_Action.DiscardUnknown(m) +} + +var xxx_messageInfo_RateLimit_Action proto.InternalMessageInfo + +type isRateLimit_Action_ActionSpecifier interface { + isRateLimit_Action_ActionSpecifier() + Equal(interface{}) bool + MarshalTo([]byte) (int, error) + Size() int +} + +type RateLimit_Action_SourceCluster_ struct { + SourceCluster *RateLimit_Action_SourceCluster `protobuf:"bytes,1,opt,name=source_cluster,json=sourceCluster,oneof"` +} +type RateLimit_Action_DestinationCluster_ struct { + DestinationCluster *RateLimit_Action_DestinationCluster `protobuf:"bytes,2,opt,name=destination_cluster,json=destinationCluster,oneof"` +} +type RateLimit_Action_RequestHeaders_ struct { + RequestHeaders *RateLimit_Action_RequestHeaders `protobuf:"bytes,3,opt,name=request_headers,json=requestHeaders,oneof"` +} +type RateLimit_Action_RemoteAddress_ struct { + RemoteAddress *RateLimit_Action_RemoteAddress `protobuf:"bytes,4,opt,name=remote_address,json=remoteAddress,oneof"` +} +type RateLimit_Action_GenericKey_ struct { + GenericKey *RateLimit_Action_GenericKey `protobuf:"bytes,5,opt,name=generic_key,json=genericKey,oneof"` +} +type RateLimit_Action_HeaderValueMatch_ struct { + HeaderValueMatch *RateLimit_Action_HeaderValueMatch `protobuf:"bytes,6,opt,name=header_value_match,json=headerValueMatch,oneof"` +} + +func (*RateLimit_Action_SourceCluster_) isRateLimit_Action_ActionSpecifier() {} +func (*RateLimit_Action_DestinationCluster_) isRateLimit_Action_ActionSpecifier() {} +func (*RateLimit_Action_RequestHeaders_) isRateLimit_Action_ActionSpecifier() {} +func (*RateLimit_Action_RemoteAddress_) isRateLimit_Action_ActionSpecifier() {} +func (*RateLimit_Action_GenericKey_) isRateLimit_Action_ActionSpecifier() {} +func (*RateLimit_Action_HeaderValueMatch_) isRateLimit_Action_ActionSpecifier() {} + +func (m *RateLimit_Action) GetActionSpecifier() isRateLimit_Action_ActionSpecifier { + if m != nil { + return m.ActionSpecifier + } + return nil +} + +func (m *RateLimit_Action) GetSourceCluster() *RateLimit_Action_SourceCluster { + if x, ok := m.GetActionSpecifier().(*RateLimit_Action_SourceCluster_); ok { + return x.SourceCluster + } + return nil +} + +func (m *RateLimit_Action) GetDestinationCluster() *RateLimit_Action_DestinationCluster { + if x, ok := m.GetActionSpecifier().(*RateLimit_Action_DestinationCluster_); ok { + return x.DestinationCluster + } + return nil +} + +func (m *RateLimit_Action) GetRequestHeaders() *RateLimit_Action_RequestHeaders { + if x, ok := m.GetActionSpecifier().(*RateLimit_Action_RequestHeaders_); ok { + return x.RequestHeaders + } + return nil +} + +func (m *RateLimit_Action) GetRemoteAddress() *RateLimit_Action_RemoteAddress { + if x, ok := m.GetActionSpecifier().(*RateLimit_Action_RemoteAddress_); ok { + return x.RemoteAddress + } + return nil +} + +func (m *RateLimit_Action) GetGenericKey() *RateLimit_Action_GenericKey { + if x, ok := m.GetActionSpecifier().(*RateLimit_Action_GenericKey_); ok { + return x.GenericKey + } + return nil +} + +func (m *RateLimit_Action) GetHeaderValueMatch() *RateLimit_Action_HeaderValueMatch { + if x, ok := m.GetActionSpecifier().(*RateLimit_Action_HeaderValueMatch_); ok { + return x.HeaderValueMatch + } + return nil +} + +// XXX_OneofFuncs is for the internal use of the proto package. +func (*RateLimit_Action) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { + return _RateLimit_Action_OneofMarshaler, _RateLimit_Action_OneofUnmarshaler, _RateLimit_Action_OneofSizer, []interface{}{ + (*RateLimit_Action_SourceCluster_)(nil), + (*RateLimit_Action_DestinationCluster_)(nil), + (*RateLimit_Action_RequestHeaders_)(nil), + (*RateLimit_Action_RemoteAddress_)(nil), + (*RateLimit_Action_GenericKey_)(nil), + (*RateLimit_Action_HeaderValueMatch_)(nil), + } +} + +func _RateLimit_Action_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { + m := msg.(*RateLimit_Action) + // action_specifier + switch x := m.ActionSpecifier.(type) { + case *RateLimit_Action_SourceCluster_: + _ = b.EncodeVarint(1<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.SourceCluster); err != nil { + return err + } + case *RateLimit_Action_DestinationCluster_: + _ = b.EncodeVarint(2<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.DestinationCluster); err != nil { + return err + } + case *RateLimit_Action_RequestHeaders_: + _ = b.EncodeVarint(3<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.RequestHeaders); err != nil { + return err + } + case *RateLimit_Action_RemoteAddress_: + _ = b.EncodeVarint(4<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.RemoteAddress); err != nil { + return err + } + case *RateLimit_Action_GenericKey_: + _ = b.EncodeVarint(5<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.GenericKey); err != nil { + return err + } + case *RateLimit_Action_HeaderValueMatch_: + _ = b.EncodeVarint(6<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.HeaderValueMatch); err != nil { + return err + } + case nil: + default: + return fmt.Errorf("RateLimit_Action.ActionSpecifier has unexpected type %T", x) + } + return nil +} + +func _RateLimit_Action_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { + m := msg.(*RateLimit_Action) + switch tag { + case 1: // action_specifier.source_cluster + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(RateLimit_Action_SourceCluster) + err := b.DecodeMessage(msg) + m.ActionSpecifier = &RateLimit_Action_SourceCluster_{msg} + return true, err + case 2: // action_specifier.destination_cluster + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(RateLimit_Action_DestinationCluster) + err := b.DecodeMessage(msg) + m.ActionSpecifier = &RateLimit_Action_DestinationCluster_{msg} + return true, err + case 3: // action_specifier.request_headers + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(RateLimit_Action_RequestHeaders) + err := b.DecodeMessage(msg) + m.ActionSpecifier = &RateLimit_Action_RequestHeaders_{msg} + return true, err + case 4: // action_specifier.remote_address + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(RateLimit_Action_RemoteAddress) + err := b.DecodeMessage(msg) + m.ActionSpecifier = &RateLimit_Action_RemoteAddress_{msg} + return true, err + case 5: // action_specifier.generic_key + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(RateLimit_Action_GenericKey) + err := b.DecodeMessage(msg) + m.ActionSpecifier = &RateLimit_Action_GenericKey_{msg} + return true, err + case 6: // action_specifier.header_value_match + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(RateLimit_Action_HeaderValueMatch) + err := b.DecodeMessage(msg) + m.ActionSpecifier = &RateLimit_Action_HeaderValueMatch_{msg} + return true, err + default: + return false, nil + } +} + +func _RateLimit_Action_OneofSizer(msg proto.Message) (n int) { + m := msg.(*RateLimit_Action) + // action_specifier + switch x := m.ActionSpecifier.(type) { + case *RateLimit_Action_SourceCluster_: + s := proto.Size(x.SourceCluster) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case *RateLimit_Action_DestinationCluster_: + s := proto.Size(x.DestinationCluster) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case *RateLimit_Action_RequestHeaders_: + s := proto.Size(x.RequestHeaders) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case *RateLimit_Action_RemoteAddress_: + s := proto.Size(x.RemoteAddress) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case *RateLimit_Action_GenericKey_: + s := proto.Size(x.GenericKey) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case *RateLimit_Action_HeaderValueMatch_: + s := proto.Size(x.HeaderValueMatch) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case nil: + default: + panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) + } + return n +} + +// The following descriptor entry is appended to the descriptor: +// +// .. code-block:: cpp +// +// ("source_cluster", "") +// +// is derived from the :option:`--service-cluster` option. +type RateLimit_Action_SourceCluster struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *RateLimit_Action_SourceCluster) Reset() { *m = RateLimit_Action_SourceCluster{} } +func (m *RateLimit_Action_SourceCluster) String() string { return proto.CompactTextString(m) } +func (*RateLimit_Action_SourceCluster) ProtoMessage() {} +func (*RateLimit_Action_SourceCluster) Descriptor() ([]byte, []int) { + return fileDescriptor_route_91aab16f18e3dd7f, []int{10, 0, 0} +} +func (m *RateLimit_Action_SourceCluster) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RateLimit_Action_SourceCluster) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_RateLimit_Action_SourceCluster.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *RateLimit_Action_SourceCluster) XXX_Merge(src proto.Message) { + xxx_messageInfo_RateLimit_Action_SourceCluster.Merge(dst, src) +} +func (m *RateLimit_Action_SourceCluster) XXX_Size() int { + return m.Size() +} +func (m *RateLimit_Action_SourceCluster) XXX_DiscardUnknown() { + xxx_messageInfo_RateLimit_Action_SourceCluster.DiscardUnknown(m) +} + +var xxx_messageInfo_RateLimit_Action_SourceCluster proto.InternalMessageInfo + +// The following descriptor entry is appended to the descriptor: +// +// .. code-block:: cpp +// +// ("destination_cluster", "") +// +// Once a request matches against a route table rule, a routed cluster is determined by one of +// the following :ref:`route table configuration ` +// settings: +// +// * :ref:`cluster ` indicates the upstream cluster +// to route to. +// * :ref:`weighted_clusters ` +// chooses a cluster randomly from a set of clusters with attributed weight. +// * :ref:`cluster_header ` indicates which +// header in the request contains the target cluster. +type RateLimit_Action_DestinationCluster struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *RateLimit_Action_DestinationCluster) Reset() { *m = RateLimit_Action_DestinationCluster{} } +func (m *RateLimit_Action_DestinationCluster) String() string { return proto.CompactTextString(m) } +func (*RateLimit_Action_DestinationCluster) ProtoMessage() {} +func (*RateLimit_Action_DestinationCluster) Descriptor() ([]byte, []int) { + return fileDescriptor_route_91aab16f18e3dd7f, []int{10, 0, 1} +} +func (m *RateLimit_Action_DestinationCluster) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RateLimit_Action_DestinationCluster) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_RateLimit_Action_DestinationCluster.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *RateLimit_Action_DestinationCluster) XXX_Merge(src proto.Message) { + xxx_messageInfo_RateLimit_Action_DestinationCluster.Merge(dst, src) +} +func (m *RateLimit_Action_DestinationCluster) XXX_Size() int { + return m.Size() +} +func (m *RateLimit_Action_DestinationCluster) XXX_DiscardUnknown() { + xxx_messageInfo_RateLimit_Action_DestinationCluster.DiscardUnknown(m) +} + +var xxx_messageInfo_RateLimit_Action_DestinationCluster proto.InternalMessageInfo + +// The following descriptor entry is appended when a header contains a key that matches the +// *header_name*: +// +// .. code-block:: cpp +// +// ("", "") +type RateLimit_Action_RequestHeaders struct { + // The header name to be queried from the request headers. The header’s + // value is used to populate the value of the descriptor entry for the + // descriptor_key. + HeaderName string `protobuf:"bytes,1,opt,name=header_name,json=headerName,proto3" json:"header_name,omitempty"` + // The key to use in the descriptor entry. + DescriptorKey string `protobuf:"bytes,2,opt,name=descriptor_key,json=descriptorKey,proto3" json:"descriptor_key,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *RateLimit_Action_RequestHeaders) Reset() { *m = RateLimit_Action_RequestHeaders{} } +func (m *RateLimit_Action_RequestHeaders) String() string { return proto.CompactTextString(m) } +func (*RateLimit_Action_RequestHeaders) ProtoMessage() {} +func (*RateLimit_Action_RequestHeaders) Descriptor() ([]byte, []int) { + return fileDescriptor_route_91aab16f18e3dd7f, []int{10, 0, 2} +} +func (m *RateLimit_Action_RequestHeaders) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RateLimit_Action_RequestHeaders) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_RateLimit_Action_RequestHeaders.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *RateLimit_Action_RequestHeaders) XXX_Merge(src proto.Message) { + xxx_messageInfo_RateLimit_Action_RequestHeaders.Merge(dst, src) +} +func (m *RateLimit_Action_RequestHeaders) XXX_Size() int { + return m.Size() +} +func (m *RateLimit_Action_RequestHeaders) XXX_DiscardUnknown() { + xxx_messageInfo_RateLimit_Action_RequestHeaders.DiscardUnknown(m) +} + +var xxx_messageInfo_RateLimit_Action_RequestHeaders proto.InternalMessageInfo + +func (m *RateLimit_Action_RequestHeaders) GetHeaderName() string { + if m != nil { + return m.HeaderName + } + return "" +} + +func (m *RateLimit_Action_RequestHeaders) GetDescriptorKey() string { + if m != nil { + return m.DescriptorKey + } + return "" +} + +// The following descriptor entry is appended to the descriptor and is populated using the +// trusted address from :ref:`x-forwarded-for `: +// +// .. code-block:: cpp +// +// ("remote_address", "") +type RateLimit_Action_RemoteAddress struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *RateLimit_Action_RemoteAddress) Reset() { *m = RateLimit_Action_RemoteAddress{} } +func (m *RateLimit_Action_RemoteAddress) String() string { return proto.CompactTextString(m) } +func (*RateLimit_Action_RemoteAddress) ProtoMessage() {} +func (*RateLimit_Action_RemoteAddress) Descriptor() ([]byte, []int) { + return fileDescriptor_route_91aab16f18e3dd7f, []int{10, 0, 3} +} +func (m *RateLimit_Action_RemoteAddress) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RateLimit_Action_RemoteAddress) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_RateLimit_Action_RemoteAddress.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *RateLimit_Action_RemoteAddress) XXX_Merge(src proto.Message) { + xxx_messageInfo_RateLimit_Action_RemoteAddress.Merge(dst, src) +} +func (m *RateLimit_Action_RemoteAddress) XXX_Size() int { + return m.Size() +} +func (m *RateLimit_Action_RemoteAddress) XXX_DiscardUnknown() { + xxx_messageInfo_RateLimit_Action_RemoteAddress.DiscardUnknown(m) +} + +var xxx_messageInfo_RateLimit_Action_RemoteAddress proto.InternalMessageInfo + +// The following descriptor entry is appended to the descriptor: +// +// .. code-block:: cpp +// +// ("generic_key", "") +type RateLimit_Action_GenericKey struct { + // The value to use in the descriptor entry. + DescriptorValue string `protobuf:"bytes,1,opt,name=descriptor_value,json=descriptorValue,proto3" json:"descriptor_value,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *RateLimit_Action_GenericKey) Reset() { *m = RateLimit_Action_GenericKey{} } +func (m *RateLimit_Action_GenericKey) String() string { return proto.CompactTextString(m) } +func (*RateLimit_Action_GenericKey) ProtoMessage() {} +func (*RateLimit_Action_GenericKey) Descriptor() ([]byte, []int) { + return fileDescriptor_route_91aab16f18e3dd7f, []int{10, 0, 4} +} +func (m *RateLimit_Action_GenericKey) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RateLimit_Action_GenericKey) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_RateLimit_Action_GenericKey.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *RateLimit_Action_GenericKey) XXX_Merge(src proto.Message) { + xxx_messageInfo_RateLimit_Action_GenericKey.Merge(dst, src) +} +func (m *RateLimit_Action_GenericKey) XXX_Size() int { + return m.Size() +} +func (m *RateLimit_Action_GenericKey) XXX_DiscardUnknown() { + xxx_messageInfo_RateLimit_Action_GenericKey.DiscardUnknown(m) +} + +var xxx_messageInfo_RateLimit_Action_GenericKey proto.InternalMessageInfo + +func (m *RateLimit_Action_GenericKey) GetDescriptorValue() string { + if m != nil { + return m.DescriptorValue + } + return "" +} + +// The following descriptor entry is appended to the descriptor: +// +// .. code-block:: cpp +// +// ("header_match", "") +type RateLimit_Action_HeaderValueMatch struct { + // The value to use in the descriptor entry. + DescriptorValue string `protobuf:"bytes,1,opt,name=descriptor_value,json=descriptorValue,proto3" json:"descriptor_value,omitempty"` + // If set to true, the action will append a descriptor entry when the + // request matches the headers. If set to false, the action will append a + // descriptor entry when the request does not match the headers. The + // default value is true. + ExpectMatch *types.BoolValue `protobuf:"bytes,2,opt,name=expect_match,json=expectMatch" json:"expect_match,omitempty"` + // Specifies a set of headers that the rate limit action should match + // on. The action will check the request’s headers against all the + // specified headers in the config. A match will happen if all the + // headers in the config are present in the request with the same values + // (or based on presence if the value field is not in the config). + Headers []*HeaderMatcher `protobuf:"bytes,3,rep,name=headers" json:"headers,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *RateLimit_Action_HeaderValueMatch) Reset() { *m = RateLimit_Action_HeaderValueMatch{} } +func (m *RateLimit_Action_HeaderValueMatch) String() string { return proto.CompactTextString(m) } +func (*RateLimit_Action_HeaderValueMatch) ProtoMessage() {} +func (*RateLimit_Action_HeaderValueMatch) Descriptor() ([]byte, []int) { + return fileDescriptor_route_91aab16f18e3dd7f, []int{10, 0, 5} +} +func (m *RateLimit_Action_HeaderValueMatch) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RateLimit_Action_HeaderValueMatch) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_RateLimit_Action_HeaderValueMatch.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *RateLimit_Action_HeaderValueMatch) XXX_Merge(src proto.Message) { + xxx_messageInfo_RateLimit_Action_HeaderValueMatch.Merge(dst, src) +} +func (m *RateLimit_Action_HeaderValueMatch) XXX_Size() int { + return m.Size() +} +func (m *RateLimit_Action_HeaderValueMatch) XXX_DiscardUnknown() { + xxx_messageInfo_RateLimit_Action_HeaderValueMatch.DiscardUnknown(m) +} + +var xxx_messageInfo_RateLimit_Action_HeaderValueMatch proto.InternalMessageInfo + +func (m *RateLimit_Action_HeaderValueMatch) GetDescriptorValue() string { + if m != nil { + return m.DescriptorValue + } + return "" +} + +func (m *RateLimit_Action_HeaderValueMatch) GetExpectMatch() *types.BoolValue { + if m != nil { + return m.ExpectMatch + } + return nil +} + +func (m *RateLimit_Action_HeaderValueMatch) GetHeaders() []*HeaderMatcher { + if m != nil { + return m.Headers + } + return nil +} + +// .. attention:: +// +// Internally, Envoy always uses the HTTP/2 *:authority* header to represent the HTTP/1 *Host* +// header. Thus, if attempting to match on *Host*, match on *:authority* instead. +// +// .. attention:: +// +// To route on HTTP method, use the special HTTP/2 *:method* header. This works for both +// HTTP/1 and HTTP/2 as Envoy normalizes headers. E.g., +// +// .. code-block:: json +// +// { +// "name": ":method", +// "exact_match": "POST" +// } +// +// .. attention:: +// In the absence of any header match specifier, match will default to :ref:`present_match +// `. i.e, a request that has the :ref:`name +// ` header will match, regardless of the header's +// value. +// +type HeaderMatcher struct { + // Specifies the name of the header in the request. + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // Specifies how the header match will be performed to route the request. + // + // Types that are valid to be assigned to HeaderMatchSpecifier: + // *HeaderMatcher_ExactMatch + // *HeaderMatcher_RegexMatch + // *HeaderMatcher_RangeMatch + // *HeaderMatcher_PresentMatch + // *HeaderMatcher_PrefixMatch + // *HeaderMatcher_SuffixMatch + HeaderMatchSpecifier isHeaderMatcher_HeaderMatchSpecifier `protobuf_oneof:"header_match_specifier"` + // If specified, the match result will be inverted before checking. Defaults to false. + // + // Examples: + // + // * The regex *\d{3}* does not match the value *1234*, so it will match when inverted. + // * The range [-10,0) will match the value -1, so it will not match when inverted. + InvertMatch bool `protobuf:"varint,8,opt,name=invert_match,json=invertMatch,proto3" json:"invert_match,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *HeaderMatcher) Reset() { *m = HeaderMatcher{} } +func (m *HeaderMatcher) String() string { return proto.CompactTextString(m) } +func (*HeaderMatcher) ProtoMessage() {} +func (*HeaderMatcher) Descriptor() ([]byte, []int) { + return fileDescriptor_route_91aab16f18e3dd7f, []int{11} +} +func (m *HeaderMatcher) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *HeaderMatcher) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_HeaderMatcher.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *HeaderMatcher) XXX_Merge(src proto.Message) { + xxx_messageInfo_HeaderMatcher.Merge(dst, src) +} +func (m *HeaderMatcher) XXX_Size() int { + return m.Size() +} +func (m *HeaderMatcher) XXX_DiscardUnknown() { + xxx_messageInfo_HeaderMatcher.DiscardUnknown(m) +} + +var xxx_messageInfo_HeaderMatcher proto.InternalMessageInfo + +type isHeaderMatcher_HeaderMatchSpecifier interface { + isHeaderMatcher_HeaderMatchSpecifier() + Equal(interface{}) bool + MarshalTo([]byte) (int, error) + Size() int +} + +type HeaderMatcher_ExactMatch struct { + ExactMatch string `protobuf:"bytes,4,opt,name=exact_match,json=exactMatch,proto3,oneof"` +} +type HeaderMatcher_RegexMatch struct { + RegexMatch string `protobuf:"bytes,5,opt,name=regex_match,json=regexMatch,proto3,oneof"` +} +type HeaderMatcher_RangeMatch struct { + RangeMatch *_type.Int64Range `protobuf:"bytes,6,opt,name=range_match,json=rangeMatch,oneof"` +} +type HeaderMatcher_PresentMatch struct { + PresentMatch bool `protobuf:"varint,7,opt,name=present_match,json=presentMatch,proto3,oneof"` +} +type HeaderMatcher_PrefixMatch struct { + PrefixMatch string `protobuf:"bytes,9,opt,name=prefix_match,json=prefixMatch,proto3,oneof"` +} +type HeaderMatcher_SuffixMatch struct { + SuffixMatch string `protobuf:"bytes,10,opt,name=suffix_match,json=suffixMatch,proto3,oneof"` +} + +func (*HeaderMatcher_ExactMatch) isHeaderMatcher_HeaderMatchSpecifier() {} +func (*HeaderMatcher_RegexMatch) isHeaderMatcher_HeaderMatchSpecifier() {} +func (*HeaderMatcher_RangeMatch) isHeaderMatcher_HeaderMatchSpecifier() {} +func (*HeaderMatcher_PresentMatch) isHeaderMatcher_HeaderMatchSpecifier() {} +func (*HeaderMatcher_PrefixMatch) isHeaderMatcher_HeaderMatchSpecifier() {} +func (*HeaderMatcher_SuffixMatch) isHeaderMatcher_HeaderMatchSpecifier() {} + +func (m *HeaderMatcher) GetHeaderMatchSpecifier() isHeaderMatcher_HeaderMatchSpecifier { + if m != nil { + return m.HeaderMatchSpecifier + } + return nil +} + +func (m *HeaderMatcher) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *HeaderMatcher) GetExactMatch() string { + if x, ok := m.GetHeaderMatchSpecifier().(*HeaderMatcher_ExactMatch); ok { + return x.ExactMatch + } + return "" +} + +func (m *HeaderMatcher) GetRegexMatch() string { + if x, ok := m.GetHeaderMatchSpecifier().(*HeaderMatcher_RegexMatch); ok { + return x.RegexMatch + } + return "" +} + +func (m *HeaderMatcher) GetRangeMatch() *_type.Int64Range { + if x, ok := m.GetHeaderMatchSpecifier().(*HeaderMatcher_RangeMatch); ok { + return x.RangeMatch + } + return nil +} + +func (m *HeaderMatcher) GetPresentMatch() bool { + if x, ok := m.GetHeaderMatchSpecifier().(*HeaderMatcher_PresentMatch); ok { + return x.PresentMatch + } + return false +} + +func (m *HeaderMatcher) GetPrefixMatch() string { + if x, ok := m.GetHeaderMatchSpecifier().(*HeaderMatcher_PrefixMatch); ok { + return x.PrefixMatch + } + return "" +} + +func (m *HeaderMatcher) GetSuffixMatch() string { + if x, ok := m.GetHeaderMatchSpecifier().(*HeaderMatcher_SuffixMatch); ok { + return x.SuffixMatch + } + return "" +} + +func (m *HeaderMatcher) GetInvertMatch() bool { + if m != nil { + return m.InvertMatch + } + return false +} + +// XXX_OneofFuncs is for the internal use of the proto package. +func (*HeaderMatcher) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { + return _HeaderMatcher_OneofMarshaler, _HeaderMatcher_OneofUnmarshaler, _HeaderMatcher_OneofSizer, []interface{}{ + (*HeaderMatcher_ExactMatch)(nil), + (*HeaderMatcher_RegexMatch)(nil), + (*HeaderMatcher_RangeMatch)(nil), + (*HeaderMatcher_PresentMatch)(nil), + (*HeaderMatcher_PrefixMatch)(nil), + (*HeaderMatcher_SuffixMatch)(nil), + } +} + +func _HeaderMatcher_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { + m := msg.(*HeaderMatcher) + // header_match_specifier + switch x := m.HeaderMatchSpecifier.(type) { + case *HeaderMatcher_ExactMatch: + _ = b.EncodeVarint(4<<3 | proto.WireBytes) + _ = b.EncodeStringBytes(x.ExactMatch) + case *HeaderMatcher_RegexMatch: + _ = b.EncodeVarint(5<<3 | proto.WireBytes) + _ = b.EncodeStringBytes(x.RegexMatch) + case *HeaderMatcher_RangeMatch: + _ = b.EncodeVarint(6<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.RangeMatch); err != nil { + return err + } + case *HeaderMatcher_PresentMatch: + t := uint64(0) + if x.PresentMatch { + t = 1 + } + _ = b.EncodeVarint(7<<3 | proto.WireVarint) + _ = b.EncodeVarint(t) + case *HeaderMatcher_PrefixMatch: + _ = b.EncodeVarint(9<<3 | proto.WireBytes) + _ = b.EncodeStringBytes(x.PrefixMatch) + case *HeaderMatcher_SuffixMatch: + _ = b.EncodeVarint(10<<3 | proto.WireBytes) + _ = b.EncodeStringBytes(x.SuffixMatch) + case nil: + default: + return fmt.Errorf("HeaderMatcher.HeaderMatchSpecifier has unexpected type %T", x) + } + return nil +} + +func _HeaderMatcher_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { + m := msg.(*HeaderMatcher) + switch tag { + case 4: // header_match_specifier.exact_match + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeStringBytes() + m.HeaderMatchSpecifier = &HeaderMatcher_ExactMatch{x} + return true, err + case 5: // header_match_specifier.regex_match + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeStringBytes() + m.HeaderMatchSpecifier = &HeaderMatcher_RegexMatch{x} + return true, err + case 6: // header_match_specifier.range_match + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(_type.Int64Range) + err := b.DecodeMessage(msg) + m.HeaderMatchSpecifier = &HeaderMatcher_RangeMatch{msg} + return true, err + case 7: // header_match_specifier.present_match + if wire != proto.WireVarint { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeVarint() + m.HeaderMatchSpecifier = &HeaderMatcher_PresentMatch{x != 0} + return true, err + case 9: // header_match_specifier.prefix_match + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeStringBytes() + m.HeaderMatchSpecifier = &HeaderMatcher_PrefixMatch{x} + return true, err + case 10: // header_match_specifier.suffix_match + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeStringBytes() + m.HeaderMatchSpecifier = &HeaderMatcher_SuffixMatch{x} + return true, err + default: + return false, nil + } +} + +func _HeaderMatcher_OneofSizer(msg proto.Message) (n int) { + m := msg.(*HeaderMatcher) + // header_match_specifier + switch x := m.HeaderMatchSpecifier.(type) { + case *HeaderMatcher_ExactMatch: + n += 1 // tag and wire + n += proto.SizeVarint(uint64(len(x.ExactMatch))) + n += len(x.ExactMatch) + case *HeaderMatcher_RegexMatch: + n += 1 // tag and wire + n += proto.SizeVarint(uint64(len(x.RegexMatch))) + n += len(x.RegexMatch) + case *HeaderMatcher_RangeMatch: + s := proto.Size(x.RangeMatch) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case *HeaderMatcher_PresentMatch: + n += 1 // tag and wire + n += 1 + case *HeaderMatcher_PrefixMatch: + n += 1 // tag and wire + n += proto.SizeVarint(uint64(len(x.PrefixMatch))) + n += len(x.PrefixMatch) + case *HeaderMatcher_SuffixMatch: + n += 1 // tag and wire + n += proto.SizeVarint(uint64(len(x.SuffixMatch))) + n += len(x.SuffixMatch) + case nil: + default: + panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) + } + return n +} + +// Query parameter matching treats the query string of a request's :path header +// as an ampersand-separated list of keys and/or key=value elements. +type QueryParameterMatcher struct { + // Specifies the name of a key that must be present in the requested + // *path*'s query string. + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // Specifies the value of the key. If the value is absent, a request + // that contains the key in its query string will match, whether the + // key appears with a value (e.g., "?debug=true") or not (e.g., "?debug") + Value string `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"` + // Specifies whether the query parameter value is a regular expression. + // Defaults to false. The entire query parameter value (i.e., the part to + // the right of the equals sign in "key=value") must match the regex. + // E.g., the regex "\d+$" will match "123" but not "a123" or "123a". + Regex *types.BoolValue `protobuf:"bytes,4,opt,name=regex" json:"regex,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *QueryParameterMatcher) Reset() { *m = QueryParameterMatcher{} } +func (m *QueryParameterMatcher) String() string { return proto.CompactTextString(m) } +func (*QueryParameterMatcher) ProtoMessage() {} +func (*QueryParameterMatcher) Descriptor() ([]byte, []int) { + return fileDescriptor_route_91aab16f18e3dd7f, []int{12} +} +func (m *QueryParameterMatcher) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryParameterMatcher) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryParameterMatcher.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *QueryParameterMatcher) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryParameterMatcher.Merge(dst, src) +} +func (m *QueryParameterMatcher) XXX_Size() int { + return m.Size() +} +func (m *QueryParameterMatcher) XXX_DiscardUnknown() { + xxx_messageInfo_QueryParameterMatcher.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryParameterMatcher proto.InternalMessageInfo + +func (m *QueryParameterMatcher) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *QueryParameterMatcher) GetValue() string { + if m != nil { + return m.Value + } + return "" +} + +func (m *QueryParameterMatcher) GetRegex() *types.BoolValue { + if m != nil { + return m.Regex + } + return nil +} + +func init() { + proto.RegisterType((*VirtualHost)(nil), "envoy.api.v2.route.VirtualHost") + proto.RegisterMapType((map[string]*types.Struct)(nil), "envoy.api.v2.route.VirtualHost.PerFilterConfigEntry") + proto.RegisterType((*Route)(nil), "envoy.api.v2.route.Route") + proto.RegisterMapType((map[string]*types.Struct)(nil), "envoy.api.v2.route.Route.PerFilterConfigEntry") + proto.RegisterType((*WeightedCluster)(nil), "envoy.api.v2.route.WeightedCluster") + proto.RegisterType((*WeightedCluster_ClusterWeight)(nil), "envoy.api.v2.route.WeightedCluster.ClusterWeight") + proto.RegisterMapType((map[string]*types.Struct)(nil), "envoy.api.v2.route.WeightedCluster.ClusterWeight.PerFilterConfigEntry") + proto.RegisterType((*RouteMatch)(nil), "envoy.api.v2.route.RouteMatch") + proto.RegisterType((*CorsPolicy)(nil), "envoy.api.v2.route.CorsPolicy") + proto.RegisterType((*RouteAction)(nil), "envoy.api.v2.route.RouteAction") + proto.RegisterType((*RouteAction_RetryPolicy)(nil), "envoy.api.v2.route.RouteAction.RetryPolicy") + proto.RegisterType((*RouteAction_RetryPolicy_RetryPriority)(nil), "envoy.api.v2.route.RouteAction.RetryPolicy.RetryPriority") + proto.RegisterType((*RouteAction_RetryPolicy_RetryHostPredicate)(nil), "envoy.api.v2.route.RouteAction.RetryPolicy.RetryHostPredicate") + proto.RegisterType((*RouteAction_RequestMirrorPolicy)(nil), "envoy.api.v2.route.RouteAction.RequestMirrorPolicy") + proto.RegisterType((*RouteAction_HashPolicy)(nil), "envoy.api.v2.route.RouteAction.HashPolicy") + proto.RegisterType((*RouteAction_HashPolicy_Header)(nil), "envoy.api.v2.route.RouteAction.HashPolicy.Header") + proto.RegisterType((*RouteAction_HashPolicy_Cookie)(nil), "envoy.api.v2.route.RouteAction.HashPolicy.Cookie") + proto.RegisterType((*RouteAction_HashPolicy_ConnectionProperties)(nil), "envoy.api.v2.route.RouteAction.HashPolicy.ConnectionProperties") + proto.RegisterType((*RouteAction_WebSocketProxyConfig)(nil), "envoy.api.v2.route.RouteAction.WebSocketProxyConfig") + proto.RegisterType((*RedirectAction)(nil), "envoy.api.v2.route.RedirectAction") + proto.RegisterType((*DirectResponseAction)(nil), "envoy.api.v2.route.DirectResponseAction") + proto.RegisterType((*Decorator)(nil), "envoy.api.v2.route.Decorator") + proto.RegisterType((*VirtualCluster)(nil), "envoy.api.v2.route.VirtualCluster") + proto.RegisterType((*RateLimit)(nil), "envoy.api.v2.route.RateLimit") + proto.RegisterType((*RateLimit_Action)(nil), "envoy.api.v2.route.RateLimit.Action") + proto.RegisterType((*RateLimit_Action_SourceCluster)(nil), "envoy.api.v2.route.RateLimit.Action.SourceCluster") + proto.RegisterType((*RateLimit_Action_DestinationCluster)(nil), "envoy.api.v2.route.RateLimit.Action.DestinationCluster") + proto.RegisterType((*RateLimit_Action_RequestHeaders)(nil), "envoy.api.v2.route.RateLimit.Action.RequestHeaders") + proto.RegisterType((*RateLimit_Action_RemoteAddress)(nil), "envoy.api.v2.route.RateLimit.Action.RemoteAddress") + proto.RegisterType((*RateLimit_Action_GenericKey)(nil), "envoy.api.v2.route.RateLimit.Action.GenericKey") + proto.RegisterType((*RateLimit_Action_HeaderValueMatch)(nil), "envoy.api.v2.route.RateLimit.Action.HeaderValueMatch") + proto.RegisterType((*HeaderMatcher)(nil), "envoy.api.v2.route.HeaderMatcher") + proto.RegisterType((*QueryParameterMatcher)(nil), "envoy.api.v2.route.QueryParameterMatcher") + proto.RegisterEnum("envoy.api.v2.route.VirtualHost_TlsRequirementType", VirtualHost_TlsRequirementType_name, VirtualHost_TlsRequirementType_value) + proto.RegisterEnum("envoy.api.v2.route.RouteAction_ClusterNotFoundResponseCode", RouteAction_ClusterNotFoundResponseCode_name, RouteAction_ClusterNotFoundResponseCode_value) + proto.RegisterEnum("envoy.api.v2.route.RedirectAction_RedirectResponseCode", RedirectAction_RedirectResponseCode_name, RedirectAction_RedirectResponseCode_value) +} +func (this *VirtualHost) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*VirtualHost) + if !ok { + that2, ok := that.(VirtualHost) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Name != that1.Name { + return false + } + if len(this.Domains) != len(that1.Domains) { + return false + } + for i := range this.Domains { + if this.Domains[i] != that1.Domains[i] { + return false + } + } + if len(this.Routes) != len(that1.Routes) { + return false + } + for i := range this.Routes { + if !this.Routes[i].Equal(&that1.Routes[i]) { + return false + } + } + if this.RequireTls != that1.RequireTls { + return false + } + if len(this.VirtualClusters) != len(that1.VirtualClusters) { + return false + } + for i := range this.VirtualClusters { + if !this.VirtualClusters[i].Equal(that1.VirtualClusters[i]) { + return false + } + } + if len(this.RateLimits) != len(that1.RateLimits) { + return false + } + for i := range this.RateLimits { + if !this.RateLimits[i].Equal(that1.RateLimits[i]) { + return false + } + } + if len(this.RequestHeadersToAdd) != len(that1.RequestHeadersToAdd) { + return false + } + for i := range this.RequestHeadersToAdd { + if !this.RequestHeadersToAdd[i].Equal(that1.RequestHeadersToAdd[i]) { + return false + } + } + if len(this.ResponseHeadersToAdd) != len(that1.ResponseHeadersToAdd) { + return false + } + for i := range this.ResponseHeadersToAdd { + if !this.ResponseHeadersToAdd[i].Equal(that1.ResponseHeadersToAdd[i]) { + return false + } + } + if len(this.ResponseHeadersToRemove) != len(that1.ResponseHeadersToRemove) { + return false + } + for i := range this.ResponseHeadersToRemove { + if this.ResponseHeadersToRemove[i] != that1.ResponseHeadersToRemove[i] { + return false + } + } + if !this.Cors.Equal(that1.Cors) { + return false + } + if len(this.PerFilterConfig) != len(that1.PerFilterConfig) { + return false + } + for i := range this.PerFilterConfig { + if !this.PerFilterConfig[i].Equal(that1.PerFilterConfig[i]) { + return false + } + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *Route) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Route) + if !ok { + that2, ok := that.(Route) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.Match.Equal(&that1.Match) { + return false + } + if that1.Action == nil { + if this.Action != nil { + return false + } + } else if this.Action == nil { + return false + } else if !this.Action.Equal(that1.Action) { + return false + } + if !this.Metadata.Equal(that1.Metadata) { + return false + } + if !this.Decorator.Equal(that1.Decorator) { + return false + } + if len(this.PerFilterConfig) != len(that1.PerFilterConfig) { + return false + } + for i := range this.PerFilterConfig { + if !this.PerFilterConfig[i].Equal(that1.PerFilterConfig[i]) { + return false + } + } + if len(this.RequestHeadersToAdd) != len(that1.RequestHeadersToAdd) { + return false + } + for i := range this.RequestHeadersToAdd { + if !this.RequestHeadersToAdd[i].Equal(that1.RequestHeadersToAdd[i]) { + return false + } + } + if len(this.ResponseHeadersToAdd) != len(that1.ResponseHeadersToAdd) { + return false + } + for i := range this.ResponseHeadersToAdd { + if !this.ResponseHeadersToAdd[i].Equal(that1.ResponseHeadersToAdd[i]) { + return false + } + } + if len(this.ResponseHeadersToRemove) != len(that1.ResponseHeadersToRemove) { + return false + } + for i := range this.ResponseHeadersToRemove { + if this.ResponseHeadersToRemove[i] != that1.ResponseHeadersToRemove[i] { + return false + } + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *Route_Route) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Route_Route) + if !ok { + that2, ok := that.(Route_Route) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.Route.Equal(that1.Route) { + return false + } + return true +} +func (this *Route_Redirect) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Route_Redirect) + if !ok { + that2, ok := that.(Route_Redirect) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.Redirect.Equal(that1.Redirect) { + return false + } + return true +} +func (this *Route_DirectResponse) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Route_DirectResponse) + if !ok { + that2, ok := that.(Route_DirectResponse) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.DirectResponse.Equal(that1.DirectResponse) { + return false + } + return true +} +func (this *WeightedCluster) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*WeightedCluster) + if !ok { + that2, ok := that.(WeightedCluster) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if len(this.Clusters) != len(that1.Clusters) { + return false + } + for i := range this.Clusters { + if !this.Clusters[i].Equal(that1.Clusters[i]) { + return false + } + } + if !this.TotalWeight.Equal(that1.TotalWeight) { + return false + } + if this.RuntimeKeyPrefix != that1.RuntimeKeyPrefix { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *WeightedCluster_ClusterWeight) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*WeightedCluster_ClusterWeight) + if !ok { + that2, ok := that.(WeightedCluster_ClusterWeight) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Name != that1.Name { + return false + } + if !this.Weight.Equal(that1.Weight) { + return false + } + if !this.MetadataMatch.Equal(that1.MetadataMatch) { + return false + } + if len(this.RequestHeadersToAdd) != len(that1.RequestHeadersToAdd) { + return false + } + for i := range this.RequestHeadersToAdd { + if !this.RequestHeadersToAdd[i].Equal(that1.RequestHeadersToAdd[i]) { + return false + } + } + if len(this.ResponseHeadersToAdd) != len(that1.ResponseHeadersToAdd) { + return false + } + for i := range this.ResponseHeadersToAdd { + if !this.ResponseHeadersToAdd[i].Equal(that1.ResponseHeadersToAdd[i]) { + return false + } + } + if len(this.ResponseHeadersToRemove) != len(that1.ResponseHeadersToRemove) { + return false + } + for i := range this.ResponseHeadersToRemove { + if this.ResponseHeadersToRemove[i] != that1.ResponseHeadersToRemove[i] { + return false + } + } + if len(this.PerFilterConfig) != len(that1.PerFilterConfig) { + return false + } + for i := range this.PerFilterConfig { + if !this.PerFilterConfig[i].Equal(that1.PerFilterConfig[i]) { + return false + } + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *RouteMatch) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*RouteMatch) + if !ok { + that2, ok := that.(RouteMatch) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if that1.PathSpecifier == nil { + if this.PathSpecifier != nil { + return false + } + } else if this.PathSpecifier == nil { + return false + } else if !this.PathSpecifier.Equal(that1.PathSpecifier) { + return false + } + if !this.CaseSensitive.Equal(that1.CaseSensitive) { + return false + } + if !this.Runtime.Equal(that1.Runtime) { + return false + } + if len(this.Headers) != len(that1.Headers) { + return false + } + for i := range this.Headers { + if !this.Headers[i].Equal(that1.Headers[i]) { + return false + } + } + if len(this.QueryParameters) != len(that1.QueryParameters) { + return false + } + for i := range this.QueryParameters { + if !this.QueryParameters[i].Equal(that1.QueryParameters[i]) { + return false + } + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *RouteMatch_Prefix) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*RouteMatch_Prefix) + if !ok { + that2, ok := that.(RouteMatch_Prefix) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Prefix != that1.Prefix { + return false + } + return true +} +func (this *RouteMatch_Path) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*RouteMatch_Path) + if !ok { + that2, ok := that.(RouteMatch_Path) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Path != that1.Path { + return false + } + return true +} +func (this *RouteMatch_Regex) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*RouteMatch_Regex) + if !ok { + that2, ok := that.(RouteMatch_Regex) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Regex != that1.Regex { + return false + } + return true +} +func (this *CorsPolicy) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*CorsPolicy) + if !ok { + that2, ok := that.(CorsPolicy) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if len(this.AllowOrigin) != len(that1.AllowOrigin) { + return false + } + for i := range this.AllowOrigin { + if this.AllowOrigin[i] != that1.AllowOrigin[i] { + return false + } + } + if len(this.AllowOriginRegex) != len(that1.AllowOriginRegex) { + return false + } + for i := range this.AllowOriginRegex { + if this.AllowOriginRegex[i] != that1.AllowOriginRegex[i] { + return false + } + } + if this.AllowMethods != that1.AllowMethods { + return false + } + if this.AllowHeaders != that1.AllowHeaders { + return false + } + if this.ExposeHeaders != that1.ExposeHeaders { + return false + } + if this.MaxAge != that1.MaxAge { + return false + } + if !this.AllowCredentials.Equal(that1.AllowCredentials) { + return false + } + if !this.Enabled.Equal(that1.Enabled) { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *RouteAction) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*RouteAction) + if !ok { + that2, ok := that.(RouteAction) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if that1.ClusterSpecifier == nil { + if this.ClusterSpecifier != nil { + return false + } + } else if this.ClusterSpecifier == nil { + return false + } else if !this.ClusterSpecifier.Equal(that1.ClusterSpecifier) { + return false + } + if this.ClusterNotFoundResponseCode != that1.ClusterNotFoundResponseCode { + return false + } + if !this.MetadataMatch.Equal(that1.MetadataMatch) { + return false + } + if this.PrefixRewrite != that1.PrefixRewrite { + return false + } + if that1.HostRewriteSpecifier == nil { + if this.HostRewriteSpecifier != nil { + return false + } + } else if this.HostRewriteSpecifier == nil { + return false + } else if !this.HostRewriteSpecifier.Equal(that1.HostRewriteSpecifier) { + return false + } + if this.Timeout != nil && that1.Timeout != nil { + if *this.Timeout != *that1.Timeout { + return false + } + } else if this.Timeout != nil { + return false + } else if that1.Timeout != nil { + return false + } + if this.IdleTimeout != nil && that1.IdleTimeout != nil { + if *this.IdleTimeout != *that1.IdleTimeout { + return false + } + } else if this.IdleTimeout != nil { + return false + } else if that1.IdleTimeout != nil { + return false + } + if !this.RetryPolicy.Equal(that1.RetryPolicy) { + return false + } + if !this.RequestMirrorPolicy.Equal(that1.RequestMirrorPolicy) { + return false + } + if this.Priority != that1.Priority { + return false + } + if len(this.RequestHeadersToAdd) != len(that1.RequestHeadersToAdd) { + return false + } + for i := range this.RequestHeadersToAdd { + if !this.RequestHeadersToAdd[i].Equal(that1.RequestHeadersToAdd[i]) { + return false + } + } + if len(this.ResponseHeadersToAdd) != len(that1.ResponseHeadersToAdd) { + return false + } + for i := range this.ResponseHeadersToAdd { + if !this.ResponseHeadersToAdd[i].Equal(that1.ResponseHeadersToAdd[i]) { + return false + } + } + if len(this.ResponseHeadersToRemove) != len(that1.ResponseHeadersToRemove) { + return false + } + for i := range this.ResponseHeadersToRemove { + if this.ResponseHeadersToRemove[i] != that1.ResponseHeadersToRemove[i] { + return false + } + } + if len(this.RateLimits) != len(that1.RateLimits) { + return false + } + for i := range this.RateLimits { + if !this.RateLimits[i].Equal(that1.RateLimits[i]) { + return false + } + } + if !this.IncludeVhRateLimits.Equal(that1.IncludeVhRateLimits) { + return false + } + if len(this.HashPolicy) != len(that1.HashPolicy) { + return false + } + for i := range this.HashPolicy { + if !this.HashPolicy[i].Equal(that1.HashPolicy[i]) { + return false + } + } + if !this.UseWebsocket.Equal(that1.UseWebsocket) { + return false + } + if !this.WebsocketConfig.Equal(that1.WebsocketConfig) { + return false + } + if !this.Cors.Equal(that1.Cors) { + return false + } + if this.MaxGrpcTimeout != nil && that1.MaxGrpcTimeout != nil { + if *this.MaxGrpcTimeout != *that1.MaxGrpcTimeout { + return false + } + } else if this.MaxGrpcTimeout != nil { + return false + } else if that1.MaxGrpcTimeout != nil { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *RouteAction_Cluster) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*RouteAction_Cluster) + if !ok { + that2, ok := that.(RouteAction_Cluster) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Cluster != that1.Cluster { + return false + } + return true +} +func (this *RouteAction_ClusterHeader) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*RouteAction_ClusterHeader) + if !ok { + that2, ok := that.(RouteAction_ClusterHeader) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.ClusterHeader != that1.ClusterHeader { + return false + } + return true +} +func (this *RouteAction_WeightedClusters) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*RouteAction_WeightedClusters) + if !ok { + that2, ok := that.(RouteAction_WeightedClusters) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.WeightedClusters.Equal(that1.WeightedClusters) { + return false + } + return true +} +func (this *RouteAction_HostRewrite) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*RouteAction_HostRewrite) + if !ok { + that2, ok := that.(RouteAction_HostRewrite) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.HostRewrite != that1.HostRewrite { + return false + } + return true +} +func (this *RouteAction_AutoHostRewrite) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*RouteAction_AutoHostRewrite) + if !ok { + that2, ok := that.(RouteAction_AutoHostRewrite) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.AutoHostRewrite.Equal(that1.AutoHostRewrite) { + return false + } + return true +} +func (this *RouteAction_RetryPolicy) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*RouteAction_RetryPolicy) + if !ok { + that2, ok := that.(RouteAction_RetryPolicy) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.RetryOn != that1.RetryOn { + return false + } + if !this.NumRetries.Equal(that1.NumRetries) { + return false + } + if this.PerTryTimeout != nil && that1.PerTryTimeout != nil { + if *this.PerTryTimeout != *that1.PerTryTimeout { + return false + } + } else if this.PerTryTimeout != nil { + return false + } else if that1.PerTryTimeout != nil { + return false + } + if !this.RetryPriority.Equal(that1.RetryPriority) { + return false + } + if len(this.RetryHostPredicate) != len(that1.RetryHostPredicate) { + return false + } + for i := range this.RetryHostPredicate { + if !this.RetryHostPredicate[i].Equal(that1.RetryHostPredicate[i]) { + return false + } + } + if this.HostSelectionRetryMaxAttempts != that1.HostSelectionRetryMaxAttempts { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *RouteAction_RetryPolicy_RetryPriority) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*RouteAction_RetryPolicy_RetryPriority) + if !ok { + that2, ok := that.(RouteAction_RetryPolicy_RetryPriority) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Name != that1.Name { + return false + } + if !this.Config.Equal(that1.Config) { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *RouteAction_RetryPolicy_RetryHostPredicate) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*RouteAction_RetryPolicy_RetryHostPredicate) + if !ok { + that2, ok := that.(RouteAction_RetryPolicy_RetryHostPredicate) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Name != that1.Name { + return false + } + if !this.Config.Equal(that1.Config) { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *RouteAction_RequestMirrorPolicy) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*RouteAction_RequestMirrorPolicy) + if !ok { + that2, ok := that.(RouteAction_RequestMirrorPolicy) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Cluster != that1.Cluster { + return false + } + if this.RuntimeKey != that1.RuntimeKey { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *RouteAction_HashPolicy) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*RouteAction_HashPolicy) + if !ok { + that2, ok := that.(RouteAction_HashPolicy) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if that1.PolicySpecifier == nil { + if this.PolicySpecifier != nil { + return false + } + } else if this.PolicySpecifier == nil { + return false + } else if !this.PolicySpecifier.Equal(that1.PolicySpecifier) { + return false + } + if this.Terminal != that1.Terminal { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *RouteAction_HashPolicy_Header_) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*RouteAction_HashPolicy_Header_) + if !ok { + that2, ok := that.(RouteAction_HashPolicy_Header_) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.Header.Equal(that1.Header) { + return false + } + return true +} +func (this *RouteAction_HashPolicy_Cookie_) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*RouteAction_HashPolicy_Cookie_) + if !ok { + that2, ok := that.(RouteAction_HashPolicy_Cookie_) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.Cookie.Equal(that1.Cookie) { + return false + } + return true +} +func (this *RouteAction_HashPolicy_ConnectionProperties_) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*RouteAction_HashPolicy_ConnectionProperties_) + if !ok { + that2, ok := that.(RouteAction_HashPolicy_ConnectionProperties_) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.ConnectionProperties.Equal(that1.ConnectionProperties) { + return false + } + return true +} +func (this *RouteAction_HashPolicy_Header) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*RouteAction_HashPolicy_Header) + if !ok { + that2, ok := that.(RouteAction_HashPolicy_Header) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.HeaderName != that1.HeaderName { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *RouteAction_HashPolicy_Cookie) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*RouteAction_HashPolicy_Cookie) + if !ok { + that2, ok := that.(RouteAction_HashPolicy_Cookie) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Name != that1.Name { + return false + } + if this.Ttl != nil && that1.Ttl != nil { + if *this.Ttl != *that1.Ttl { + return false + } + } else if this.Ttl != nil { + return false + } else if that1.Ttl != nil { + return false + } + if this.Path != that1.Path { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *RouteAction_HashPolicy_ConnectionProperties) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*RouteAction_HashPolicy_ConnectionProperties) + if !ok { + that2, ok := that.(RouteAction_HashPolicy_ConnectionProperties) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.SourceIp != that1.SourceIp { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *RouteAction_WebSocketProxyConfig) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*RouteAction_WebSocketProxyConfig) + if !ok { + that2, ok := that.(RouteAction_WebSocketProxyConfig) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.StatPrefix != that1.StatPrefix { + return false + } + if this.IdleTimeout != nil && that1.IdleTimeout != nil { + if *this.IdleTimeout != *that1.IdleTimeout { + return false + } + } else if this.IdleTimeout != nil { + return false + } else if that1.IdleTimeout != nil { + return false + } + if !this.MaxConnectAttempts.Equal(that1.MaxConnectAttempts) { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *RedirectAction) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*RedirectAction) + if !ok { + that2, ok := that.(RedirectAction) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.HostRedirect != that1.HostRedirect { + return false + } + if that1.PathRewriteSpecifier == nil { + if this.PathRewriteSpecifier != nil { + return false + } + } else if this.PathRewriteSpecifier == nil { + return false + } else if !this.PathRewriteSpecifier.Equal(that1.PathRewriteSpecifier) { + return false + } + if this.ResponseCode != that1.ResponseCode { + return false + } + if this.HttpsRedirect != that1.HttpsRedirect { + return false + } + if this.StripQuery != that1.StripQuery { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *RedirectAction_PathRedirect) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*RedirectAction_PathRedirect) + if !ok { + that2, ok := that.(RedirectAction_PathRedirect) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.PathRedirect != that1.PathRedirect { + return false + } + return true +} +func (this *RedirectAction_PrefixRewrite) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*RedirectAction_PrefixRewrite) + if !ok { + that2, ok := that.(RedirectAction_PrefixRewrite) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.PrefixRewrite != that1.PrefixRewrite { + return false + } + return true +} +func (this *DirectResponseAction) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*DirectResponseAction) + if !ok { + that2, ok := that.(DirectResponseAction) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Status != that1.Status { + return false + } + if !this.Body.Equal(that1.Body) { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *Decorator) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Decorator) + if !ok { + that2, ok := that.(Decorator) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Operation != that1.Operation { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *VirtualCluster) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*VirtualCluster) + if !ok { + that2, ok := that.(VirtualCluster) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Pattern != that1.Pattern { + return false + } + if this.Name != that1.Name { + return false + } + if this.Method != that1.Method { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *RateLimit) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*RateLimit) + if !ok { + that2, ok := that.(RateLimit) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.Stage.Equal(that1.Stage) { + return false + } + if this.DisableKey != that1.DisableKey { + return false + } + if len(this.Actions) != len(that1.Actions) { + return false + } + for i := range this.Actions { + if !this.Actions[i].Equal(that1.Actions[i]) { + return false + } + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *RateLimit_Action) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*RateLimit_Action) + if !ok { + that2, ok := that.(RateLimit_Action) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if that1.ActionSpecifier == nil { + if this.ActionSpecifier != nil { + return false + } + } else if this.ActionSpecifier == nil { + return false + } else if !this.ActionSpecifier.Equal(that1.ActionSpecifier) { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *RateLimit_Action_SourceCluster_) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*RateLimit_Action_SourceCluster_) + if !ok { + that2, ok := that.(RateLimit_Action_SourceCluster_) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.SourceCluster.Equal(that1.SourceCluster) { + return false + } + return true +} +func (this *RateLimit_Action_DestinationCluster_) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*RateLimit_Action_DestinationCluster_) + if !ok { + that2, ok := that.(RateLimit_Action_DestinationCluster_) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.DestinationCluster.Equal(that1.DestinationCluster) { + return false + } + return true +} +func (this *RateLimit_Action_RequestHeaders_) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*RateLimit_Action_RequestHeaders_) + if !ok { + that2, ok := that.(RateLimit_Action_RequestHeaders_) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.RequestHeaders.Equal(that1.RequestHeaders) { + return false + } + return true +} +func (this *RateLimit_Action_RemoteAddress_) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*RateLimit_Action_RemoteAddress_) + if !ok { + that2, ok := that.(RateLimit_Action_RemoteAddress_) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.RemoteAddress.Equal(that1.RemoteAddress) { + return false + } + return true +} +func (this *RateLimit_Action_GenericKey_) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*RateLimit_Action_GenericKey_) + if !ok { + that2, ok := that.(RateLimit_Action_GenericKey_) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.GenericKey.Equal(that1.GenericKey) { + return false + } + return true +} +func (this *RateLimit_Action_HeaderValueMatch_) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*RateLimit_Action_HeaderValueMatch_) + if !ok { + that2, ok := that.(RateLimit_Action_HeaderValueMatch_) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.HeaderValueMatch.Equal(that1.HeaderValueMatch) { + return false + } + return true +} +func (this *RateLimit_Action_SourceCluster) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*RateLimit_Action_SourceCluster) + if !ok { + that2, ok := that.(RateLimit_Action_SourceCluster) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *RateLimit_Action_DestinationCluster) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*RateLimit_Action_DestinationCluster) + if !ok { + that2, ok := that.(RateLimit_Action_DestinationCluster) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *RateLimit_Action_RequestHeaders) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*RateLimit_Action_RequestHeaders) + if !ok { + that2, ok := that.(RateLimit_Action_RequestHeaders) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.HeaderName != that1.HeaderName { + return false + } + if this.DescriptorKey != that1.DescriptorKey { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *RateLimit_Action_RemoteAddress) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*RateLimit_Action_RemoteAddress) + if !ok { + that2, ok := that.(RateLimit_Action_RemoteAddress) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *RateLimit_Action_GenericKey) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*RateLimit_Action_GenericKey) + if !ok { + that2, ok := that.(RateLimit_Action_GenericKey) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.DescriptorValue != that1.DescriptorValue { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *RateLimit_Action_HeaderValueMatch) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*RateLimit_Action_HeaderValueMatch) + if !ok { + that2, ok := that.(RateLimit_Action_HeaderValueMatch) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.DescriptorValue != that1.DescriptorValue { + return false + } + if !this.ExpectMatch.Equal(that1.ExpectMatch) { + return false + } + if len(this.Headers) != len(that1.Headers) { + return false + } + for i := range this.Headers { + if !this.Headers[i].Equal(that1.Headers[i]) { + return false + } + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *HeaderMatcher) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*HeaderMatcher) + if !ok { + that2, ok := that.(HeaderMatcher) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Name != that1.Name { + return false + } + if that1.HeaderMatchSpecifier == nil { + if this.HeaderMatchSpecifier != nil { + return false + } + } else if this.HeaderMatchSpecifier == nil { + return false + } else if !this.HeaderMatchSpecifier.Equal(that1.HeaderMatchSpecifier) { + return false + } + if this.InvertMatch != that1.InvertMatch { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *HeaderMatcher_ExactMatch) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*HeaderMatcher_ExactMatch) + if !ok { + that2, ok := that.(HeaderMatcher_ExactMatch) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.ExactMatch != that1.ExactMatch { + return false + } + return true +} +func (this *HeaderMatcher_RegexMatch) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*HeaderMatcher_RegexMatch) + if !ok { + that2, ok := that.(HeaderMatcher_RegexMatch) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.RegexMatch != that1.RegexMatch { + return false + } + return true +} +func (this *HeaderMatcher_RangeMatch) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*HeaderMatcher_RangeMatch) + if !ok { + that2, ok := that.(HeaderMatcher_RangeMatch) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.RangeMatch.Equal(that1.RangeMatch) { + return false + } + return true +} +func (this *HeaderMatcher_PresentMatch) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*HeaderMatcher_PresentMatch) + if !ok { + that2, ok := that.(HeaderMatcher_PresentMatch) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.PresentMatch != that1.PresentMatch { + return false + } + return true +} +func (this *HeaderMatcher_PrefixMatch) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*HeaderMatcher_PrefixMatch) + if !ok { + that2, ok := that.(HeaderMatcher_PrefixMatch) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.PrefixMatch != that1.PrefixMatch { + return false + } + return true +} +func (this *HeaderMatcher_SuffixMatch) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*HeaderMatcher_SuffixMatch) + if !ok { + that2, ok := that.(HeaderMatcher_SuffixMatch) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.SuffixMatch != that1.SuffixMatch { + return false + } + return true +} +func (this *QueryParameterMatcher) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*QueryParameterMatcher) + if !ok { + that2, ok := that.(QueryParameterMatcher) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Name != that1.Name { + return false + } + if this.Value != that1.Value { + return false + } + if !this.Regex.Equal(that1.Regex) { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (m *VirtualHost) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *VirtualHost) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Name) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintRoute(dAtA, i, uint64(len(m.Name))) + i += copy(dAtA[i:], m.Name) + } + if len(m.Domains) > 0 { + for _, s := range m.Domains { + dAtA[i] = 0x12 + i++ + l = len(s) + for l >= 1<<7 { + dAtA[i] = uint8(uint64(l)&0x7f | 0x80) + l >>= 7 + i++ + } + dAtA[i] = uint8(l) + i++ + i += copy(dAtA[i:], s) + } + } + if len(m.Routes) > 0 { + for _, msg := range m.Routes { + dAtA[i] = 0x1a + i++ + i = encodeVarintRoute(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if m.RequireTls != 0 { + dAtA[i] = 0x20 + i++ + i = encodeVarintRoute(dAtA, i, uint64(m.RequireTls)) + } + if len(m.VirtualClusters) > 0 { + for _, msg := range m.VirtualClusters { + dAtA[i] = 0x2a + i++ + i = encodeVarintRoute(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if len(m.RateLimits) > 0 { + for _, msg := range m.RateLimits { + dAtA[i] = 0x32 + i++ + i = encodeVarintRoute(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if len(m.RequestHeadersToAdd) > 0 { + for _, msg := range m.RequestHeadersToAdd { + dAtA[i] = 0x3a + i++ + i = encodeVarintRoute(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if m.Cors != nil { + dAtA[i] = 0x42 + i++ + i = encodeVarintRoute(dAtA, i, uint64(m.Cors.Size())) + n1, err := m.Cors.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n1 + } + if len(m.ResponseHeadersToAdd) > 0 { + for _, msg := range m.ResponseHeadersToAdd { + dAtA[i] = 0x52 + i++ + i = encodeVarintRoute(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if len(m.ResponseHeadersToRemove) > 0 { + for _, s := range m.ResponseHeadersToRemove { + dAtA[i] = 0x5a + i++ + l = len(s) + for l >= 1<<7 { + dAtA[i] = uint8(uint64(l)&0x7f | 0x80) + l >>= 7 + i++ + } + dAtA[i] = uint8(l) + i++ + i += copy(dAtA[i:], s) + } + } + if len(m.PerFilterConfig) > 0 { + for k, _ := range m.PerFilterConfig { + dAtA[i] = 0x62 + i++ + v := m.PerFilterConfig[k] + msgSize := 0 + if v != nil { + msgSize = v.Size() + msgSize += 1 + sovRoute(uint64(msgSize)) + } + mapSize := 1 + len(k) + sovRoute(uint64(len(k))) + msgSize + i = encodeVarintRoute(dAtA, i, uint64(mapSize)) + dAtA[i] = 0xa + i++ + i = encodeVarintRoute(dAtA, i, uint64(len(k))) + i += copy(dAtA[i:], k) + if v != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintRoute(dAtA, i, uint64(v.Size())) + n2, err := v.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n2 + } + } + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *Route) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Route) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + dAtA[i] = 0xa + i++ + i = encodeVarintRoute(dAtA, i, uint64(m.Match.Size())) + n3, err := m.Match.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n3 + if m.Action != nil { + nn4, err := m.Action.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += nn4 + } + if m.Metadata != nil { + dAtA[i] = 0x22 + i++ + i = encodeVarintRoute(dAtA, i, uint64(m.Metadata.Size())) + n5, err := m.Metadata.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n5 + } + if m.Decorator != nil { + dAtA[i] = 0x2a + i++ + i = encodeVarintRoute(dAtA, i, uint64(m.Decorator.Size())) + n6, err := m.Decorator.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n6 + } + if len(m.PerFilterConfig) > 0 { + for k, _ := range m.PerFilterConfig { + dAtA[i] = 0x42 + i++ + v := m.PerFilterConfig[k] + msgSize := 0 + if v != nil { + msgSize = v.Size() + msgSize += 1 + sovRoute(uint64(msgSize)) + } + mapSize := 1 + len(k) + sovRoute(uint64(len(k))) + msgSize + i = encodeVarintRoute(dAtA, i, uint64(mapSize)) + dAtA[i] = 0xa + i++ + i = encodeVarintRoute(dAtA, i, uint64(len(k))) + i += copy(dAtA[i:], k) + if v != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintRoute(dAtA, i, uint64(v.Size())) + n7, err := v.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n7 + } + } + } + if len(m.RequestHeadersToAdd) > 0 { + for _, msg := range m.RequestHeadersToAdd { + dAtA[i] = 0x4a + i++ + i = encodeVarintRoute(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if len(m.ResponseHeadersToAdd) > 0 { + for _, msg := range m.ResponseHeadersToAdd { + dAtA[i] = 0x52 + i++ + i = encodeVarintRoute(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if len(m.ResponseHeadersToRemove) > 0 { + for _, s := range m.ResponseHeadersToRemove { + dAtA[i] = 0x5a + i++ + l = len(s) + for l >= 1<<7 { + dAtA[i] = uint8(uint64(l)&0x7f | 0x80) + l >>= 7 + i++ + } + dAtA[i] = uint8(l) + i++ + i += copy(dAtA[i:], s) + } + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *Route_Route) MarshalTo(dAtA []byte) (int, error) { + i := 0 + if m.Route != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintRoute(dAtA, i, uint64(m.Route.Size())) + n8, err := m.Route.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n8 + } + return i, nil +} +func (m *Route_Redirect) MarshalTo(dAtA []byte) (int, error) { + i := 0 + if m.Redirect != nil { + dAtA[i] = 0x1a + i++ + i = encodeVarintRoute(dAtA, i, uint64(m.Redirect.Size())) + n9, err := m.Redirect.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n9 + } + return i, nil +} +func (m *Route_DirectResponse) MarshalTo(dAtA []byte) (int, error) { + i := 0 + if m.DirectResponse != nil { + dAtA[i] = 0x3a + i++ + i = encodeVarintRoute(dAtA, i, uint64(m.DirectResponse.Size())) + n10, err := m.DirectResponse.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n10 + } + return i, nil +} +func (m *WeightedCluster) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *WeightedCluster) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Clusters) > 0 { + for _, msg := range m.Clusters { + dAtA[i] = 0xa + i++ + i = encodeVarintRoute(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if len(m.RuntimeKeyPrefix) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintRoute(dAtA, i, uint64(len(m.RuntimeKeyPrefix))) + i += copy(dAtA[i:], m.RuntimeKeyPrefix) + } + if m.TotalWeight != nil { + dAtA[i] = 0x1a + i++ + i = encodeVarintRoute(dAtA, i, uint64(m.TotalWeight.Size())) + n11, err := m.TotalWeight.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n11 + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *WeightedCluster_ClusterWeight) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *WeightedCluster_ClusterWeight) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Name) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintRoute(dAtA, i, uint64(len(m.Name))) + i += copy(dAtA[i:], m.Name) + } + if m.Weight != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintRoute(dAtA, i, uint64(m.Weight.Size())) + n12, err := m.Weight.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n12 + } + if m.MetadataMatch != nil { + dAtA[i] = 0x1a + i++ + i = encodeVarintRoute(dAtA, i, uint64(m.MetadataMatch.Size())) + n13, err := m.MetadataMatch.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n13 + } + if len(m.RequestHeadersToAdd) > 0 { + for _, msg := range m.RequestHeadersToAdd { + dAtA[i] = 0x22 + i++ + i = encodeVarintRoute(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if len(m.ResponseHeadersToAdd) > 0 { + for _, msg := range m.ResponseHeadersToAdd { + dAtA[i] = 0x2a + i++ + i = encodeVarintRoute(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if len(m.ResponseHeadersToRemove) > 0 { + for _, s := range m.ResponseHeadersToRemove { + dAtA[i] = 0x32 + i++ + l = len(s) + for l >= 1<<7 { + dAtA[i] = uint8(uint64(l)&0x7f | 0x80) + l >>= 7 + i++ + } + dAtA[i] = uint8(l) + i++ + i += copy(dAtA[i:], s) + } + } + if len(m.PerFilterConfig) > 0 { + for k, _ := range m.PerFilterConfig { + dAtA[i] = 0x42 + i++ + v := m.PerFilterConfig[k] + msgSize := 0 + if v != nil { + msgSize = v.Size() + msgSize += 1 + sovRoute(uint64(msgSize)) + } + mapSize := 1 + len(k) + sovRoute(uint64(len(k))) + msgSize + i = encodeVarintRoute(dAtA, i, uint64(mapSize)) + dAtA[i] = 0xa + i++ + i = encodeVarintRoute(dAtA, i, uint64(len(k))) + i += copy(dAtA[i:], k) + if v != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintRoute(dAtA, i, uint64(v.Size())) + n14, err := v.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n14 + } + } + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *RouteMatch) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *RouteMatch) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.PathSpecifier != nil { + nn15, err := m.PathSpecifier.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += nn15 + } + if m.CaseSensitive != nil { + dAtA[i] = 0x22 + i++ + i = encodeVarintRoute(dAtA, i, uint64(m.CaseSensitive.Size())) + n16, err := m.CaseSensitive.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n16 + } + if m.Runtime != nil { + dAtA[i] = 0x2a + i++ + i = encodeVarintRoute(dAtA, i, uint64(m.Runtime.Size())) + n17, err := m.Runtime.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n17 + } + if len(m.Headers) > 0 { + for _, msg := range m.Headers { + dAtA[i] = 0x32 + i++ + i = encodeVarintRoute(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if len(m.QueryParameters) > 0 { + for _, msg := range m.QueryParameters { + dAtA[i] = 0x3a + i++ + i = encodeVarintRoute(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *RouteMatch_Prefix) MarshalTo(dAtA []byte) (int, error) { + i := 0 + dAtA[i] = 0xa + i++ + i = encodeVarintRoute(dAtA, i, uint64(len(m.Prefix))) + i += copy(dAtA[i:], m.Prefix) + return i, nil +} +func (m *RouteMatch_Path) MarshalTo(dAtA []byte) (int, error) { + i := 0 + dAtA[i] = 0x12 + i++ + i = encodeVarintRoute(dAtA, i, uint64(len(m.Path))) + i += copy(dAtA[i:], m.Path) + return i, nil +} +func (m *RouteMatch_Regex) MarshalTo(dAtA []byte) (int, error) { + i := 0 + dAtA[i] = 0x1a + i++ + i = encodeVarintRoute(dAtA, i, uint64(len(m.Regex))) + i += copy(dAtA[i:], m.Regex) + return i, nil +} +func (m *CorsPolicy) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *CorsPolicy) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.AllowOrigin) > 0 { + for _, s := range m.AllowOrigin { + dAtA[i] = 0xa + i++ + l = len(s) + for l >= 1<<7 { + dAtA[i] = uint8(uint64(l)&0x7f | 0x80) + l >>= 7 + i++ + } + dAtA[i] = uint8(l) + i++ + i += copy(dAtA[i:], s) + } + } + if len(m.AllowMethods) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintRoute(dAtA, i, uint64(len(m.AllowMethods))) + i += copy(dAtA[i:], m.AllowMethods) + } + if len(m.AllowHeaders) > 0 { + dAtA[i] = 0x1a + i++ + i = encodeVarintRoute(dAtA, i, uint64(len(m.AllowHeaders))) + i += copy(dAtA[i:], m.AllowHeaders) + } + if len(m.ExposeHeaders) > 0 { + dAtA[i] = 0x22 + i++ + i = encodeVarintRoute(dAtA, i, uint64(len(m.ExposeHeaders))) + i += copy(dAtA[i:], m.ExposeHeaders) + } + if len(m.MaxAge) > 0 { + dAtA[i] = 0x2a + i++ + i = encodeVarintRoute(dAtA, i, uint64(len(m.MaxAge))) + i += copy(dAtA[i:], m.MaxAge) + } + if m.AllowCredentials != nil { + dAtA[i] = 0x32 + i++ + i = encodeVarintRoute(dAtA, i, uint64(m.AllowCredentials.Size())) + n18, err := m.AllowCredentials.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n18 + } + if m.Enabled != nil { + dAtA[i] = 0x3a + i++ + i = encodeVarintRoute(dAtA, i, uint64(m.Enabled.Size())) + n19, err := m.Enabled.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n19 + } + if len(m.AllowOriginRegex) > 0 { + for _, s := range m.AllowOriginRegex { + dAtA[i] = 0x42 + i++ + l = len(s) + for l >= 1<<7 { + dAtA[i] = uint8(uint64(l)&0x7f | 0x80) + l >>= 7 + i++ + } + dAtA[i] = uint8(l) + i++ + i += copy(dAtA[i:], s) + } + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *RouteAction) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *RouteAction) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.ClusterSpecifier != nil { + nn20, err := m.ClusterSpecifier.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += nn20 + } + if m.MetadataMatch != nil { + dAtA[i] = 0x22 + i++ + i = encodeVarintRoute(dAtA, i, uint64(m.MetadataMatch.Size())) + n21, err := m.MetadataMatch.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n21 + } + if len(m.PrefixRewrite) > 0 { + dAtA[i] = 0x2a + i++ + i = encodeVarintRoute(dAtA, i, uint64(len(m.PrefixRewrite))) + i += copy(dAtA[i:], m.PrefixRewrite) + } + if m.HostRewriteSpecifier != nil { + nn22, err := m.HostRewriteSpecifier.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += nn22 + } + if m.Timeout != nil { + dAtA[i] = 0x42 + i++ + i = encodeVarintRoute(dAtA, i, uint64(github_com_gogo_protobuf_types.SizeOfStdDuration(*m.Timeout))) + n23, err := github_com_gogo_protobuf_types.StdDurationMarshalTo(*m.Timeout, dAtA[i:]) + if err != nil { + return 0, err + } + i += n23 + } + if m.RetryPolicy != nil { + dAtA[i] = 0x4a + i++ + i = encodeVarintRoute(dAtA, i, uint64(m.RetryPolicy.Size())) + n24, err := m.RetryPolicy.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n24 + } + if m.RequestMirrorPolicy != nil { + dAtA[i] = 0x52 + i++ + i = encodeVarintRoute(dAtA, i, uint64(m.RequestMirrorPolicy.Size())) + n25, err := m.RequestMirrorPolicy.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n25 + } + if m.Priority != 0 { + dAtA[i] = 0x58 + i++ + i = encodeVarintRoute(dAtA, i, uint64(m.Priority)) + } + if len(m.RequestHeadersToAdd) > 0 { + for _, msg := range m.RequestHeadersToAdd { + dAtA[i] = 0x62 + i++ + i = encodeVarintRoute(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if len(m.RateLimits) > 0 { + for _, msg := range m.RateLimits { + dAtA[i] = 0x6a + i++ + i = encodeVarintRoute(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if m.IncludeVhRateLimits != nil { + dAtA[i] = 0x72 + i++ + i = encodeVarintRoute(dAtA, i, uint64(m.IncludeVhRateLimits.Size())) + n26, err := m.IncludeVhRateLimits.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n26 + } + if len(m.HashPolicy) > 0 { + for _, msg := range m.HashPolicy { + dAtA[i] = 0x7a + i++ + i = encodeVarintRoute(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if m.UseWebsocket != nil { + dAtA[i] = 0x82 + i++ + dAtA[i] = 0x1 + i++ + i = encodeVarintRoute(dAtA, i, uint64(m.UseWebsocket.Size())) + n27, err := m.UseWebsocket.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n27 + } + if m.Cors != nil { + dAtA[i] = 0x8a + i++ + dAtA[i] = 0x1 + i++ + i = encodeVarintRoute(dAtA, i, uint64(m.Cors.Size())) + n28, err := m.Cors.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n28 + } + if len(m.ResponseHeadersToAdd) > 0 { + for _, msg := range m.ResponseHeadersToAdd { + dAtA[i] = 0x92 + i++ + dAtA[i] = 0x1 + i++ + i = encodeVarintRoute(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if len(m.ResponseHeadersToRemove) > 0 { + for _, s := range m.ResponseHeadersToRemove { + dAtA[i] = 0x9a + i++ + dAtA[i] = 0x1 + i++ + l = len(s) + for l >= 1<<7 { + dAtA[i] = uint8(uint64(l)&0x7f | 0x80) + l >>= 7 + i++ + } + dAtA[i] = uint8(l) + i++ + i += copy(dAtA[i:], s) + } + } + if m.ClusterNotFoundResponseCode != 0 { + dAtA[i] = 0xa0 + i++ + dAtA[i] = 0x1 + i++ + i = encodeVarintRoute(dAtA, i, uint64(m.ClusterNotFoundResponseCode)) + } + if m.WebsocketConfig != nil { + dAtA[i] = 0xb2 + i++ + dAtA[i] = 0x1 + i++ + i = encodeVarintRoute(dAtA, i, uint64(m.WebsocketConfig.Size())) + n29, err := m.WebsocketConfig.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n29 + } + if m.MaxGrpcTimeout != nil { + dAtA[i] = 0xba + i++ + dAtA[i] = 0x1 + i++ + i = encodeVarintRoute(dAtA, i, uint64(github_com_gogo_protobuf_types.SizeOfStdDuration(*m.MaxGrpcTimeout))) + n30, err := github_com_gogo_protobuf_types.StdDurationMarshalTo(*m.MaxGrpcTimeout, dAtA[i:]) + if err != nil { + return 0, err + } + i += n30 + } + if m.IdleTimeout != nil { + dAtA[i] = 0xc2 + i++ + dAtA[i] = 0x1 + i++ + i = encodeVarintRoute(dAtA, i, uint64(github_com_gogo_protobuf_types.SizeOfStdDuration(*m.IdleTimeout))) + n31, err := github_com_gogo_protobuf_types.StdDurationMarshalTo(*m.IdleTimeout, dAtA[i:]) + if err != nil { + return 0, err + } + i += n31 + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *RouteAction_Cluster) MarshalTo(dAtA []byte) (int, error) { + i := 0 + dAtA[i] = 0xa + i++ + i = encodeVarintRoute(dAtA, i, uint64(len(m.Cluster))) + i += copy(dAtA[i:], m.Cluster) + return i, nil +} +func (m *RouteAction_ClusterHeader) MarshalTo(dAtA []byte) (int, error) { + i := 0 + dAtA[i] = 0x12 + i++ + i = encodeVarintRoute(dAtA, i, uint64(len(m.ClusterHeader))) + i += copy(dAtA[i:], m.ClusterHeader) + return i, nil +} +func (m *RouteAction_WeightedClusters) MarshalTo(dAtA []byte) (int, error) { + i := 0 + if m.WeightedClusters != nil { + dAtA[i] = 0x1a + i++ + i = encodeVarintRoute(dAtA, i, uint64(m.WeightedClusters.Size())) + n32, err := m.WeightedClusters.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n32 + } + return i, nil +} +func (m *RouteAction_HostRewrite) MarshalTo(dAtA []byte) (int, error) { + i := 0 + dAtA[i] = 0x32 + i++ + i = encodeVarintRoute(dAtA, i, uint64(len(m.HostRewrite))) + i += copy(dAtA[i:], m.HostRewrite) + return i, nil +} +func (m *RouteAction_AutoHostRewrite) MarshalTo(dAtA []byte) (int, error) { + i := 0 + if m.AutoHostRewrite != nil { + dAtA[i] = 0x3a + i++ + i = encodeVarintRoute(dAtA, i, uint64(m.AutoHostRewrite.Size())) + n33, err := m.AutoHostRewrite.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n33 + } + return i, nil +} +func (m *RouteAction_RetryPolicy) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *RouteAction_RetryPolicy) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.RetryOn) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintRoute(dAtA, i, uint64(len(m.RetryOn))) + i += copy(dAtA[i:], m.RetryOn) + } + if m.NumRetries != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintRoute(dAtA, i, uint64(m.NumRetries.Size())) + n34, err := m.NumRetries.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n34 + } + if m.PerTryTimeout != nil { + dAtA[i] = 0x1a + i++ + i = encodeVarintRoute(dAtA, i, uint64(github_com_gogo_protobuf_types.SizeOfStdDuration(*m.PerTryTimeout))) + n35, err := github_com_gogo_protobuf_types.StdDurationMarshalTo(*m.PerTryTimeout, dAtA[i:]) + if err != nil { + return 0, err + } + i += n35 + } + if m.RetryPriority != nil { + dAtA[i] = 0x22 + i++ + i = encodeVarintRoute(dAtA, i, uint64(m.RetryPriority.Size())) + n36, err := m.RetryPriority.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n36 + } + if len(m.RetryHostPredicate) > 0 { + for _, msg := range m.RetryHostPredicate { + dAtA[i] = 0x2a + i++ + i = encodeVarintRoute(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if m.HostSelectionRetryMaxAttempts != 0 { + dAtA[i] = 0x30 + i++ + i = encodeVarintRoute(dAtA, i, uint64(m.HostSelectionRetryMaxAttempts)) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *RouteAction_RetryPolicy_RetryPriority) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *RouteAction_RetryPolicy_RetryPriority) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Name) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintRoute(dAtA, i, uint64(len(m.Name))) + i += copy(dAtA[i:], m.Name) + } + if m.Config != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintRoute(dAtA, i, uint64(m.Config.Size())) + n37, err := m.Config.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n37 + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *RouteAction_RetryPolicy_RetryHostPredicate) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *RouteAction_RetryPolicy_RetryHostPredicate) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Name) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintRoute(dAtA, i, uint64(len(m.Name))) + i += copy(dAtA[i:], m.Name) + } + if m.Config != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintRoute(dAtA, i, uint64(m.Config.Size())) + n38, err := m.Config.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n38 + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *RouteAction_RequestMirrorPolicy) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *RouteAction_RequestMirrorPolicy) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Cluster) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintRoute(dAtA, i, uint64(len(m.Cluster))) + i += copy(dAtA[i:], m.Cluster) + } + if len(m.RuntimeKey) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintRoute(dAtA, i, uint64(len(m.RuntimeKey))) + i += copy(dAtA[i:], m.RuntimeKey) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *RouteAction_HashPolicy) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *RouteAction_HashPolicy) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.PolicySpecifier != nil { + nn39, err := m.PolicySpecifier.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += nn39 + } + if m.Terminal { + dAtA[i] = 0x20 + i++ + if m.Terminal { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i++ + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *RouteAction_HashPolicy_Header_) MarshalTo(dAtA []byte) (int, error) { + i := 0 + if m.Header != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintRoute(dAtA, i, uint64(m.Header.Size())) + n40, err := m.Header.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n40 + } + return i, nil +} +func (m *RouteAction_HashPolicy_Cookie_) MarshalTo(dAtA []byte) (int, error) { + i := 0 + if m.Cookie != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintRoute(dAtA, i, uint64(m.Cookie.Size())) + n41, err := m.Cookie.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n41 + } + return i, nil +} +func (m *RouteAction_HashPolicy_ConnectionProperties_) MarshalTo(dAtA []byte) (int, error) { + i := 0 + if m.ConnectionProperties != nil { + dAtA[i] = 0x1a + i++ + i = encodeVarintRoute(dAtA, i, uint64(m.ConnectionProperties.Size())) + n42, err := m.ConnectionProperties.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n42 + } + return i, nil +} +func (m *RouteAction_HashPolicy_Header) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *RouteAction_HashPolicy_Header) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.HeaderName) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintRoute(dAtA, i, uint64(len(m.HeaderName))) + i += copy(dAtA[i:], m.HeaderName) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *RouteAction_HashPolicy_Cookie) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *RouteAction_HashPolicy_Cookie) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Name) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintRoute(dAtA, i, uint64(len(m.Name))) + i += copy(dAtA[i:], m.Name) + } + if m.Ttl != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintRoute(dAtA, i, uint64(github_com_gogo_protobuf_types.SizeOfStdDuration(*m.Ttl))) + n43, err := github_com_gogo_protobuf_types.StdDurationMarshalTo(*m.Ttl, dAtA[i:]) + if err != nil { + return 0, err + } + i += n43 + } + if len(m.Path) > 0 { + dAtA[i] = 0x1a + i++ + i = encodeVarintRoute(dAtA, i, uint64(len(m.Path))) + i += copy(dAtA[i:], m.Path) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *RouteAction_HashPolicy_ConnectionProperties) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *RouteAction_HashPolicy_ConnectionProperties) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.SourceIp { + dAtA[i] = 0x8 + i++ + if m.SourceIp { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i++ + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *RouteAction_WebSocketProxyConfig) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *RouteAction_WebSocketProxyConfig) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.StatPrefix) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintRoute(dAtA, i, uint64(len(m.StatPrefix))) + i += copy(dAtA[i:], m.StatPrefix) + } + if m.IdleTimeout != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintRoute(dAtA, i, uint64(github_com_gogo_protobuf_types.SizeOfStdDuration(*m.IdleTimeout))) + n44, err := github_com_gogo_protobuf_types.StdDurationMarshalTo(*m.IdleTimeout, dAtA[i:]) + if err != nil { + return 0, err + } + i += n44 + } + if m.MaxConnectAttempts != nil { + dAtA[i] = 0x1a + i++ + i = encodeVarintRoute(dAtA, i, uint64(m.MaxConnectAttempts.Size())) + n45, err := m.MaxConnectAttempts.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n45 + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *RedirectAction) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *RedirectAction) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.HostRedirect) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintRoute(dAtA, i, uint64(len(m.HostRedirect))) + i += copy(dAtA[i:], m.HostRedirect) + } + if m.PathRewriteSpecifier != nil { + nn46, err := m.PathRewriteSpecifier.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += nn46 + } + if m.ResponseCode != 0 { + dAtA[i] = 0x18 + i++ + i = encodeVarintRoute(dAtA, i, uint64(m.ResponseCode)) + } + if m.HttpsRedirect { + dAtA[i] = 0x20 + i++ + if m.HttpsRedirect { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i++ + } + if m.StripQuery { + dAtA[i] = 0x30 + i++ + if m.StripQuery { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i++ + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *RedirectAction_PathRedirect) MarshalTo(dAtA []byte) (int, error) { + i := 0 + dAtA[i] = 0x12 + i++ + i = encodeVarintRoute(dAtA, i, uint64(len(m.PathRedirect))) + i += copy(dAtA[i:], m.PathRedirect) + return i, nil +} +func (m *RedirectAction_PrefixRewrite) MarshalTo(dAtA []byte) (int, error) { + i := 0 + dAtA[i] = 0x2a + i++ + i = encodeVarintRoute(dAtA, i, uint64(len(m.PrefixRewrite))) + i += copy(dAtA[i:], m.PrefixRewrite) + return i, nil +} +func (m *DirectResponseAction) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *DirectResponseAction) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Status != 0 { + dAtA[i] = 0x8 + i++ + i = encodeVarintRoute(dAtA, i, uint64(m.Status)) + } + if m.Body != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintRoute(dAtA, i, uint64(m.Body.Size())) + n47, err := m.Body.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n47 + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *Decorator) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Decorator) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Operation) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintRoute(dAtA, i, uint64(len(m.Operation))) + i += copy(dAtA[i:], m.Operation) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *VirtualCluster) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *VirtualCluster) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Pattern) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintRoute(dAtA, i, uint64(len(m.Pattern))) + i += copy(dAtA[i:], m.Pattern) + } + if len(m.Name) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintRoute(dAtA, i, uint64(len(m.Name))) + i += copy(dAtA[i:], m.Name) + } + if m.Method != 0 { + dAtA[i] = 0x18 + i++ + i = encodeVarintRoute(dAtA, i, uint64(m.Method)) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *RateLimit) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *RateLimit) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Stage != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintRoute(dAtA, i, uint64(m.Stage.Size())) + n48, err := m.Stage.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n48 + } + if len(m.DisableKey) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintRoute(dAtA, i, uint64(len(m.DisableKey))) + i += copy(dAtA[i:], m.DisableKey) + } + if len(m.Actions) > 0 { + for _, msg := range m.Actions { + dAtA[i] = 0x1a + i++ + i = encodeVarintRoute(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *RateLimit_Action) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *RateLimit_Action) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.ActionSpecifier != nil { + nn49, err := m.ActionSpecifier.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += nn49 + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *RateLimit_Action_SourceCluster_) MarshalTo(dAtA []byte) (int, error) { + i := 0 + if m.SourceCluster != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintRoute(dAtA, i, uint64(m.SourceCluster.Size())) + n50, err := m.SourceCluster.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n50 + } + return i, nil +} +func (m *RateLimit_Action_DestinationCluster_) MarshalTo(dAtA []byte) (int, error) { + i := 0 + if m.DestinationCluster != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintRoute(dAtA, i, uint64(m.DestinationCluster.Size())) + n51, err := m.DestinationCluster.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n51 + } + return i, nil +} +func (m *RateLimit_Action_RequestHeaders_) MarshalTo(dAtA []byte) (int, error) { + i := 0 + if m.RequestHeaders != nil { + dAtA[i] = 0x1a + i++ + i = encodeVarintRoute(dAtA, i, uint64(m.RequestHeaders.Size())) + n52, err := m.RequestHeaders.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n52 + } + return i, nil +} +func (m *RateLimit_Action_RemoteAddress_) MarshalTo(dAtA []byte) (int, error) { + i := 0 + if m.RemoteAddress != nil { + dAtA[i] = 0x22 + i++ + i = encodeVarintRoute(dAtA, i, uint64(m.RemoteAddress.Size())) + n53, err := m.RemoteAddress.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n53 + } + return i, nil +} +func (m *RateLimit_Action_GenericKey_) MarshalTo(dAtA []byte) (int, error) { + i := 0 + if m.GenericKey != nil { + dAtA[i] = 0x2a + i++ + i = encodeVarintRoute(dAtA, i, uint64(m.GenericKey.Size())) + n54, err := m.GenericKey.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n54 + } + return i, nil +} +func (m *RateLimit_Action_HeaderValueMatch_) MarshalTo(dAtA []byte) (int, error) { + i := 0 + if m.HeaderValueMatch != nil { + dAtA[i] = 0x32 + i++ + i = encodeVarintRoute(dAtA, i, uint64(m.HeaderValueMatch.Size())) + n55, err := m.HeaderValueMatch.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n55 + } + return i, nil +} +func (m *RateLimit_Action_SourceCluster) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *RateLimit_Action_SourceCluster) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *RateLimit_Action_DestinationCluster) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *RateLimit_Action_DestinationCluster) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *RateLimit_Action_RequestHeaders) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *RateLimit_Action_RequestHeaders) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.HeaderName) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintRoute(dAtA, i, uint64(len(m.HeaderName))) + i += copy(dAtA[i:], m.HeaderName) + } + if len(m.DescriptorKey) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintRoute(dAtA, i, uint64(len(m.DescriptorKey))) + i += copy(dAtA[i:], m.DescriptorKey) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *RateLimit_Action_RemoteAddress) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *RateLimit_Action_RemoteAddress) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *RateLimit_Action_GenericKey) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *RateLimit_Action_GenericKey) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.DescriptorValue) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintRoute(dAtA, i, uint64(len(m.DescriptorValue))) + i += copy(dAtA[i:], m.DescriptorValue) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *RateLimit_Action_HeaderValueMatch) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *RateLimit_Action_HeaderValueMatch) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.DescriptorValue) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintRoute(dAtA, i, uint64(len(m.DescriptorValue))) + i += copy(dAtA[i:], m.DescriptorValue) + } + if m.ExpectMatch != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintRoute(dAtA, i, uint64(m.ExpectMatch.Size())) + n56, err := m.ExpectMatch.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n56 + } + if len(m.Headers) > 0 { + for _, msg := range m.Headers { + dAtA[i] = 0x1a + i++ + i = encodeVarintRoute(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *HeaderMatcher) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *HeaderMatcher) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Name) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintRoute(dAtA, i, uint64(len(m.Name))) + i += copy(dAtA[i:], m.Name) + } + if m.HeaderMatchSpecifier != nil { + nn57, err := m.HeaderMatchSpecifier.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += nn57 + } + if m.InvertMatch { + dAtA[i] = 0x40 + i++ + if m.InvertMatch { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i++ + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *HeaderMatcher_ExactMatch) MarshalTo(dAtA []byte) (int, error) { + i := 0 + dAtA[i] = 0x22 + i++ + i = encodeVarintRoute(dAtA, i, uint64(len(m.ExactMatch))) + i += copy(dAtA[i:], m.ExactMatch) + return i, nil +} +func (m *HeaderMatcher_RegexMatch) MarshalTo(dAtA []byte) (int, error) { + i := 0 + dAtA[i] = 0x2a + i++ + i = encodeVarintRoute(dAtA, i, uint64(len(m.RegexMatch))) + i += copy(dAtA[i:], m.RegexMatch) + return i, nil +} +func (m *HeaderMatcher_RangeMatch) MarshalTo(dAtA []byte) (int, error) { + i := 0 + if m.RangeMatch != nil { + dAtA[i] = 0x32 + i++ + i = encodeVarintRoute(dAtA, i, uint64(m.RangeMatch.Size())) + n58, err := m.RangeMatch.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n58 + } + return i, nil +} +func (m *HeaderMatcher_PresentMatch) MarshalTo(dAtA []byte) (int, error) { + i := 0 + dAtA[i] = 0x38 + i++ + if m.PresentMatch { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i++ + return i, nil +} +func (m *HeaderMatcher_PrefixMatch) MarshalTo(dAtA []byte) (int, error) { + i := 0 + dAtA[i] = 0x4a + i++ + i = encodeVarintRoute(dAtA, i, uint64(len(m.PrefixMatch))) + i += copy(dAtA[i:], m.PrefixMatch) + return i, nil +} +func (m *HeaderMatcher_SuffixMatch) MarshalTo(dAtA []byte) (int, error) { + i := 0 + dAtA[i] = 0x52 + i++ + i = encodeVarintRoute(dAtA, i, uint64(len(m.SuffixMatch))) + i += copy(dAtA[i:], m.SuffixMatch) + return i, nil +} +func (m *QueryParameterMatcher) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryParameterMatcher) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Name) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintRoute(dAtA, i, uint64(len(m.Name))) + i += copy(dAtA[i:], m.Name) + } + if len(m.Value) > 0 { + dAtA[i] = 0x1a + i++ + i = encodeVarintRoute(dAtA, i, uint64(len(m.Value))) + i += copy(dAtA[i:], m.Value) + } + if m.Regex != nil { + dAtA[i] = 0x22 + i++ + i = encodeVarintRoute(dAtA, i, uint64(m.Regex.Size())) + n59, err := m.Regex.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n59 + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func encodeVarintRoute(dAtA []byte, offset int, v uint64) int { + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return offset + 1 +} +func (m *VirtualHost) Size() (n int) { + var l int + _ = l + l = len(m.Name) + if l > 0 { + n += 1 + l + sovRoute(uint64(l)) + } + if len(m.Domains) > 0 { + for _, s := range m.Domains { + l = len(s) + n += 1 + l + sovRoute(uint64(l)) + } + } + if len(m.Routes) > 0 { + for _, e := range m.Routes { + l = e.Size() + n += 1 + l + sovRoute(uint64(l)) + } + } + if m.RequireTls != 0 { + n += 1 + sovRoute(uint64(m.RequireTls)) + } + if len(m.VirtualClusters) > 0 { + for _, e := range m.VirtualClusters { + l = e.Size() + n += 1 + l + sovRoute(uint64(l)) + } + } + if len(m.RateLimits) > 0 { + for _, e := range m.RateLimits { + l = e.Size() + n += 1 + l + sovRoute(uint64(l)) + } + } + if len(m.RequestHeadersToAdd) > 0 { + for _, e := range m.RequestHeadersToAdd { + l = e.Size() + n += 1 + l + sovRoute(uint64(l)) + } + } + if m.Cors != nil { + l = m.Cors.Size() + n += 1 + l + sovRoute(uint64(l)) + } + if len(m.ResponseHeadersToAdd) > 0 { + for _, e := range m.ResponseHeadersToAdd { + l = e.Size() + n += 1 + l + sovRoute(uint64(l)) + } + } + if len(m.ResponseHeadersToRemove) > 0 { + for _, s := range m.ResponseHeadersToRemove { + l = len(s) + n += 1 + l + sovRoute(uint64(l)) + } + } + if len(m.PerFilterConfig) > 0 { + for k, v := range m.PerFilterConfig { + _ = k + _ = v + l = 0 + if v != nil { + l = v.Size() + l += 1 + sovRoute(uint64(l)) + } + mapEntrySize := 1 + len(k) + sovRoute(uint64(len(k))) + l + n += mapEntrySize + 1 + sovRoute(uint64(mapEntrySize)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *Route) Size() (n int) { + var l int + _ = l + l = m.Match.Size() + n += 1 + l + sovRoute(uint64(l)) + if m.Action != nil { + n += m.Action.Size() + } + if m.Metadata != nil { + l = m.Metadata.Size() + n += 1 + l + sovRoute(uint64(l)) + } + if m.Decorator != nil { + l = m.Decorator.Size() + n += 1 + l + sovRoute(uint64(l)) + } + if len(m.PerFilterConfig) > 0 { + for k, v := range m.PerFilterConfig { + _ = k + _ = v + l = 0 + if v != nil { + l = v.Size() + l += 1 + sovRoute(uint64(l)) + } + mapEntrySize := 1 + len(k) + sovRoute(uint64(len(k))) + l + n += mapEntrySize + 1 + sovRoute(uint64(mapEntrySize)) + } + } + if len(m.RequestHeadersToAdd) > 0 { + for _, e := range m.RequestHeadersToAdd { + l = e.Size() + n += 1 + l + sovRoute(uint64(l)) + } + } + if len(m.ResponseHeadersToAdd) > 0 { + for _, e := range m.ResponseHeadersToAdd { + l = e.Size() + n += 1 + l + sovRoute(uint64(l)) + } + } + if len(m.ResponseHeadersToRemove) > 0 { + for _, s := range m.ResponseHeadersToRemove { + l = len(s) + n += 1 + l + sovRoute(uint64(l)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *Route_Route) Size() (n int) { + var l int + _ = l + if m.Route != nil { + l = m.Route.Size() + n += 1 + l + sovRoute(uint64(l)) + } + return n +} +func (m *Route_Redirect) Size() (n int) { + var l int + _ = l + if m.Redirect != nil { + l = m.Redirect.Size() + n += 1 + l + sovRoute(uint64(l)) + } + return n +} +func (m *Route_DirectResponse) Size() (n int) { + var l int + _ = l + if m.DirectResponse != nil { + l = m.DirectResponse.Size() + n += 1 + l + sovRoute(uint64(l)) + } + return n +} +func (m *WeightedCluster) Size() (n int) { + var l int + _ = l + if len(m.Clusters) > 0 { + for _, e := range m.Clusters { + l = e.Size() + n += 1 + l + sovRoute(uint64(l)) + } + } + l = len(m.RuntimeKeyPrefix) + if l > 0 { + n += 1 + l + sovRoute(uint64(l)) + } + if m.TotalWeight != nil { + l = m.TotalWeight.Size() + n += 1 + l + sovRoute(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *WeightedCluster_ClusterWeight) Size() (n int) { + var l int + _ = l + l = len(m.Name) + if l > 0 { + n += 1 + l + sovRoute(uint64(l)) + } + if m.Weight != nil { + l = m.Weight.Size() + n += 1 + l + sovRoute(uint64(l)) + } + if m.MetadataMatch != nil { + l = m.MetadataMatch.Size() + n += 1 + l + sovRoute(uint64(l)) + } + if len(m.RequestHeadersToAdd) > 0 { + for _, e := range m.RequestHeadersToAdd { + l = e.Size() + n += 1 + l + sovRoute(uint64(l)) + } + } + if len(m.ResponseHeadersToAdd) > 0 { + for _, e := range m.ResponseHeadersToAdd { + l = e.Size() + n += 1 + l + sovRoute(uint64(l)) + } + } + if len(m.ResponseHeadersToRemove) > 0 { + for _, s := range m.ResponseHeadersToRemove { + l = len(s) + n += 1 + l + sovRoute(uint64(l)) + } + } + if len(m.PerFilterConfig) > 0 { + for k, v := range m.PerFilterConfig { + _ = k + _ = v + l = 0 + if v != nil { + l = v.Size() + l += 1 + sovRoute(uint64(l)) + } + mapEntrySize := 1 + len(k) + sovRoute(uint64(len(k))) + l + n += mapEntrySize + 1 + sovRoute(uint64(mapEntrySize)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *RouteMatch) Size() (n int) { + var l int + _ = l + if m.PathSpecifier != nil { + n += m.PathSpecifier.Size() + } + if m.CaseSensitive != nil { + l = m.CaseSensitive.Size() + n += 1 + l + sovRoute(uint64(l)) + } + if m.Runtime != nil { + l = m.Runtime.Size() + n += 1 + l + sovRoute(uint64(l)) + } + if len(m.Headers) > 0 { + for _, e := range m.Headers { + l = e.Size() + n += 1 + l + sovRoute(uint64(l)) + } + } + if len(m.QueryParameters) > 0 { + for _, e := range m.QueryParameters { + l = e.Size() + n += 1 + l + sovRoute(uint64(l)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *RouteMatch_Prefix) Size() (n int) { + var l int + _ = l + l = len(m.Prefix) + n += 1 + l + sovRoute(uint64(l)) + return n +} +func (m *RouteMatch_Path) Size() (n int) { + var l int + _ = l + l = len(m.Path) + n += 1 + l + sovRoute(uint64(l)) + return n +} +func (m *RouteMatch_Regex) Size() (n int) { + var l int + _ = l + l = len(m.Regex) + n += 1 + l + sovRoute(uint64(l)) + return n +} +func (m *CorsPolicy) Size() (n int) { + var l int + _ = l + if len(m.AllowOrigin) > 0 { + for _, s := range m.AllowOrigin { + l = len(s) + n += 1 + l + sovRoute(uint64(l)) + } + } + l = len(m.AllowMethods) + if l > 0 { + n += 1 + l + sovRoute(uint64(l)) + } + l = len(m.AllowHeaders) + if l > 0 { + n += 1 + l + sovRoute(uint64(l)) + } + l = len(m.ExposeHeaders) + if l > 0 { + n += 1 + l + sovRoute(uint64(l)) + } + l = len(m.MaxAge) + if l > 0 { + n += 1 + l + sovRoute(uint64(l)) + } + if m.AllowCredentials != nil { + l = m.AllowCredentials.Size() + n += 1 + l + sovRoute(uint64(l)) + } + if m.Enabled != nil { + l = m.Enabled.Size() + n += 1 + l + sovRoute(uint64(l)) + } + if len(m.AllowOriginRegex) > 0 { + for _, s := range m.AllowOriginRegex { + l = len(s) + n += 1 + l + sovRoute(uint64(l)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *RouteAction) Size() (n int) { + var l int + _ = l + if m.ClusterSpecifier != nil { + n += m.ClusterSpecifier.Size() + } + if m.MetadataMatch != nil { + l = m.MetadataMatch.Size() + n += 1 + l + sovRoute(uint64(l)) + } + l = len(m.PrefixRewrite) + if l > 0 { + n += 1 + l + sovRoute(uint64(l)) + } + if m.HostRewriteSpecifier != nil { + n += m.HostRewriteSpecifier.Size() + } + if m.Timeout != nil { + l = github_com_gogo_protobuf_types.SizeOfStdDuration(*m.Timeout) + n += 1 + l + sovRoute(uint64(l)) + } + if m.RetryPolicy != nil { + l = m.RetryPolicy.Size() + n += 1 + l + sovRoute(uint64(l)) + } + if m.RequestMirrorPolicy != nil { + l = m.RequestMirrorPolicy.Size() + n += 1 + l + sovRoute(uint64(l)) + } + if m.Priority != 0 { + n += 1 + sovRoute(uint64(m.Priority)) + } + if len(m.RequestHeadersToAdd) > 0 { + for _, e := range m.RequestHeadersToAdd { + l = e.Size() + n += 1 + l + sovRoute(uint64(l)) + } + } + if len(m.RateLimits) > 0 { + for _, e := range m.RateLimits { + l = e.Size() + n += 1 + l + sovRoute(uint64(l)) + } + } + if m.IncludeVhRateLimits != nil { + l = m.IncludeVhRateLimits.Size() + n += 1 + l + sovRoute(uint64(l)) + } + if len(m.HashPolicy) > 0 { + for _, e := range m.HashPolicy { + l = e.Size() + n += 1 + l + sovRoute(uint64(l)) + } + } + if m.UseWebsocket != nil { + l = m.UseWebsocket.Size() + n += 2 + l + sovRoute(uint64(l)) + } + if m.Cors != nil { + l = m.Cors.Size() + n += 2 + l + sovRoute(uint64(l)) + } + if len(m.ResponseHeadersToAdd) > 0 { + for _, e := range m.ResponseHeadersToAdd { + l = e.Size() + n += 2 + l + sovRoute(uint64(l)) + } + } + if len(m.ResponseHeadersToRemove) > 0 { + for _, s := range m.ResponseHeadersToRemove { + l = len(s) + n += 2 + l + sovRoute(uint64(l)) + } + } + if m.ClusterNotFoundResponseCode != 0 { + n += 2 + sovRoute(uint64(m.ClusterNotFoundResponseCode)) + } + if m.WebsocketConfig != nil { + l = m.WebsocketConfig.Size() + n += 2 + l + sovRoute(uint64(l)) + } + if m.MaxGrpcTimeout != nil { + l = github_com_gogo_protobuf_types.SizeOfStdDuration(*m.MaxGrpcTimeout) + n += 2 + l + sovRoute(uint64(l)) + } + if m.IdleTimeout != nil { + l = github_com_gogo_protobuf_types.SizeOfStdDuration(*m.IdleTimeout) + n += 2 + l + sovRoute(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *RouteAction_Cluster) Size() (n int) { + var l int + _ = l + l = len(m.Cluster) + n += 1 + l + sovRoute(uint64(l)) + return n +} +func (m *RouteAction_ClusterHeader) Size() (n int) { + var l int + _ = l + l = len(m.ClusterHeader) + n += 1 + l + sovRoute(uint64(l)) + return n +} +func (m *RouteAction_WeightedClusters) Size() (n int) { + var l int + _ = l + if m.WeightedClusters != nil { + l = m.WeightedClusters.Size() + n += 1 + l + sovRoute(uint64(l)) + } + return n +} +func (m *RouteAction_HostRewrite) Size() (n int) { + var l int + _ = l + l = len(m.HostRewrite) + n += 1 + l + sovRoute(uint64(l)) + return n +} +func (m *RouteAction_AutoHostRewrite) Size() (n int) { + var l int + _ = l + if m.AutoHostRewrite != nil { + l = m.AutoHostRewrite.Size() + n += 1 + l + sovRoute(uint64(l)) + } + return n +} +func (m *RouteAction_RetryPolicy) Size() (n int) { + var l int + _ = l + l = len(m.RetryOn) + if l > 0 { + n += 1 + l + sovRoute(uint64(l)) + } + if m.NumRetries != nil { + l = m.NumRetries.Size() + n += 1 + l + sovRoute(uint64(l)) + } + if m.PerTryTimeout != nil { + l = github_com_gogo_protobuf_types.SizeOfStdDuration(*m.PerTryTimeout) + n += 1 + l + sovRoute(uint64(l)) + } + if m.RetryPriority != nil { + l = m.RetryPriority.Size() + n += 1 + l + sovRoute(uint64(l)) + } + if len(m.RetryHostPredicate) > 0 { + for _, e := range m.RetryHostPredicate { + l = e.Size() + n += 1 + l + sovRoute(uint64(l)) + } + } + if m.HostSelectionRetryMaxAttempts != 0 { + n += 1 + sovRoute(uint64(m.HostSelectionRetryMaxAttempts)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *RouteAction_RetryPolicy_RetryPriority) Size() (n int) { + var l int + _ = l + l = len(m.Name) + if l > 0 { + n += 1 + l + sovRoute(uint64(l)) + } + if m.Config != nil { + l = m.Config.Size() + n += 1 + l + sovRoute(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *RouteAction_RetryPolicy_RetryHostPredicate) Size() (n int) { + var l int + _ = l + l = len(m.Name) + if l > 0 { + n += 1 + l + sovRoute(uint64(l)) + } + if m.Config != nil { + l = m.Config.Size() + n += 1 + l + sovRoute(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *RouteAction_RequestMirrorPolicy) Size() (n int) { + var l int + _ = l + l = len(m.Cluster) + if l > 0 { + n += 1 + l + sovRoute(uint64(l)) + } + l = len(m.RuntimeKey) + if l > 0 { + n += 1 + l + sovRoute(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *RouteAction_HashPolicy) Size() (n int) { + var l int + _ = l + if m.PolicySpecifier != nil { + n += m.PolicySpecifier.Size() + } + if m.Terminal { + n += 2 + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *RouteAction_HashPolicy_Header_) Size() (n int) { + var l int + _ = l + if m.Header != nil { + l = m.Header.Size() + n += 1 + l + sovRoute(uint64(l)) + } + return n +} +func (m *RouteAction_HashPolicy_Cookie_) Size() (n int) { + var l int + _ = l + if m.Cookie != nil { + l = m.Cookie.Size() + n += 1 + l + sovRoute(uint64(l)) + } + return n +} +func (m *RouteAction_HashPolicy_ConnectionProperties_) Size() (n int) { + var l int + _ = l + if m.ConnectionProperties != nil { + l = m.ConnectionProperties.Size() + n += 1 + l + sovRoute(uint64(l)) + } + return n +} +func (m *RouteAction_HashPolicy_Header) Size() (n int) { + var l int + _ = l + l = len(m.HeaderName) + if l > 0 { + n += 1 + l + sovRoute(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *RouteAction_HashPolicy_Cookie) Size() (n int) { + var l int + _ = l + l = len(m.Name) + if l > 0 { + n += 1 + l + sovRoute(uint64(l)) + } + if m.Ttl != nil { + l = github_com_gogo_protobuf_types.SizeOfStdDuration(*m.Ttl) + n += 1 + l + sovRoute(uint64(l)) + } + l = len(m.Path) + if l > 0 { + n += 1 + l + sovRoute(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *RouteAction_HashPolicy_ConnectionProperties) Size() (n int) { + var l int + _ = l + if m.SourceIp { + n += 2 + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *RouteAction_WebSocketProxyConfig) Size() (n int) { + var l int + _ = l + l = len(m.StatPrefix) + if l > 0 { + n += 1 + l + sovRoute(uint64(l)) + } + if m.IdleTimeout != nil { + l = github_com_gogo_protobuf_types.SizeOfStdDuration(*m.IdleTimeout) + n += 1 + l + sovRoute(uint64(l)) + } + if m.MaxConnectAttempts != nil { + l = m.MaxConnectAttempts.Size() + n += 1 + l + sovRoute(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *RedirectAction) Size() (n int) { + var l int + _ = l + l = len(m.HostRedirect) + if l > 0 { + n += 1 + l + sovRoute(uint64(l)) + } + if m.PathRewriteSpecifier != nil { + n += m.PathRewriteSpecifier.Size() + } + if m.ResponseCode != 0 { + n += 1 + sovRoute(uint64(m.ResponseCode)) + } + if m.HttpsRedirect { + n += 2 + } + if m.StripQuery { + n += 2 + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *RedirectAction_PathRedirect) Size() (n int) { + var l int + _ = l + l = len(m.PathRedirect) + n += 1 + l + sovRoute(uint64(l)) + return n +} +func (m *RedirectAction_PrefixRewrite) Size() (n int) { + var l int + _ = l + l = len(m.PrefixRewrite) + n += 1 + l + sovRoute(uint64(l)) + return n +} +func (m *DirectResponseAction) Size() (n int) { + var l int + _ = l + if m.Status != 0 { + n += 1 + sovRoute(uint64(m.Status)) + } + if m.Body != nil { + l = m.Body.Size() + n += 1 + l + sovRoute(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *Decorator) Size() (n int) { + var l int + _ = l + l = len(m.Operation) + if l > 0 { + n += 1 + l + sovRoute(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *VirtualCluster) Size() (n int) { + var l int + _ = l + l = len(m.Pattern) + if l > 0 { + n += 1 + l + sovRoute(uint64(l)) + } + l = len(m.Name) + if l > 0 { + n += 1 + l + sovRoute(uint64(l)) + } + if m.Method != 0 { + n += 1 + sovRoute(uint64(m.Method)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *RateLimit) Size() (n int) { + var l int + _ = l + if m.Stage != nil { + l = m.Stage.Size() + n += 1 + l + sovRoute(uint64(l)) + } + l = len(m.DisableKey) + if l > 0 { + n += 1 + l + sovRoute(uint64(l)) + } + if len(m.Actions) > 0 { + for _, e := range m.Actions { + l = e.Size() + n += 1 + l + sovRoute(uint64(l)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *RateLimit_Action) Size() (n int) { + var l int + _ = l + if m.ActionSpecifier != nil { + n += m.ActionSpecifier.Size() + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *RateLimit_Action_SourceCluster_) Size() (n int) { + var l int + _ = l + if m.SourceCluster != nil { + l = m.SourceCluster.Size() + n += 1 + l + sovRoute(uint64(l)) + } + return n +} +func (m *RateLimit_Action_DestinationCluster_) Size() (n int) { + var l int + _ = l + if m.DestinationCluster != nil { + l = m.DestinationCluster.Size() + n += 1 + l + sovRoute(uint64(l)) + } + return n +} +func (m *RateLimit_Action_RequestHeaders_) Size() (n int) { + var l int + _ = l + if m.RequestHeaders != nil { + l = m.RequestHeaders.Size() + n += 1 + l + sovRoute(uint64(l)) + } + return n +} +func (m *RateLimit_Action_RemoteAddress_) Size() (n int) { + var l int + _ = l + if m.RemoteAddress != nil { + l = m.RemoteAddress.Size() + n += 1 + l + sovRoute(uint64(l)) + } + return n +} +func (m *RateLimit_Action_GenericKey_) Size() (n int) { + var l int + _ = l + if m.GenericKey != nil { + l = m.GenericKey.Size() + n += 1 + l + sovRoute(uint64(l)) + } + return n +} +func (m *RateLimit_Action_HeaderValueMatch_) Size() (n int) { + var l int + _ = l + if m.HeaderValueMatch != nil { + l = m.HeaderValueMatch.Size() + n += 1 + l + sovRoute(uint64(l)) + } + return n +} +func (m *RateLimit_Action_SourceCluster) Size() (n int) { + var l int + _ = l + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *RateLimit_Action_DestinationCluster) Size() (n int) { + var l int + _ = l + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *RateLimit_Action_RequestHeaders) Size() (n int) { + var l int + _ = l + l = len(m.HeaderName) + if l > 0 { + n += 1 + l + sovRoute(uint64(l)) + } + l = len(m.DescriptorKey) + if l > 0 { + n += 1 + l + sovRoute(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *RateLimit_Action_RemoteAddress) Size() (n int) { + var l int + _ = l + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *RateLimit_Action_GenericKey) Size() (n int) { + var l int + _ = l + l = len(m.DescriptorValue) + if l > 0 { + n += 1 + l + sovRoute(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *RateLimit_Action_HeaderValueMatch) Size() (n int) { + var l int + _ = l + l = len(m.DescriptorValue) + if l > 0 { + n += 1 + l + sovRoute(uint64(l)) + } + if m.ExpectMatch != nil { + l = m.ExpectMatch.Size() + n += 1 + l + sovRoute(uint64(l)) + } + if len(m.Headers) > 0 { + for _, e := range m.Headers { + l = e.Size() + n += 1 + l + sovRoute(uint64(l)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *HeaderMatcher) Size() (n int) { + var l int + _ = l + l = len(m.Name) + if l > 0 { + n += 1 + l + sovRoute(uint64(l)) + } + if m.HeaderMatchSpecifier != nil { + n += m.HeaderMatchSpecifier.Size() + } + if m.InvertMatch { + n += 2 + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *HeaderMatcher_ExactMatch) Size() (n int) { + var l int + _ = l + l = len(m.ExactMatch) + n += 1 + l + sovRoute(uint64(l)) + return n +} +func (m *HeaderMatcher_RegexMatch) Size() (n int) { + var l int + _ = l + l = len(m.RegexMatch) + n += 1 + l + sovRoute(uint64(l)) + return n +} +func (m *HeaderMatcher_RangeMatch) Size() (n int) { + var l int + _ = l + if m.RangeMatch != nil { + l = m.RangeMatch.Size() + n += 1 + l + sovRoute(uint64(l)) + } + return n +} +func (m *HeaderMatcher_PresentMatch) Size() (n int) { + var l int + _ = l + n += 2 + return n +} +func (m *HeaderMatcher_PrefixMatch) Size() (n int) { + var l int + _ = l + l = len(m.PrefixMatch) + n += 1 + l + sovRoute(uint64(l)) + return n +} +func (m *HeaderMatcher_SuffixMatch) Size() (n int) { + var l int + _ = l + l = len(m.SuffixMatch) + n += 1 + l + sovRoute(uint64(l)) + return n +} +func (m *QueryParameterMatcher) Size() (n int) { + var l int + _ = l + l = len(m.Name) + if l > 0 { + n += 1 + l + sovRoute(uint64(l)) + } + l = len(m.Value) + if l > 0 { + n += 1 + l + sovRoute(uint64(l)) + } + if m.Regex != nil { + l = m.Regex.Size() + n += 1 + l + sovRoute(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func sovRoute(x uint64) (n int) { + for { + n++ + x >>= 7 + if x == 0 { + break + } + } + return n +} +func sozRoute(x uint64) (n int) { + return sovRoute(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *VirtualHost) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: VirtualHost: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: VirtualHost: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Domains", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Domains = append(m.Domains, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Routes", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Routes = append(m.Routes, Route{}) + if err := m.Routes[len(m.Routes)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field RequireTls", wireType) + } + m.RequireTls = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.RequireTls |= (VirtualHost_TlsRequirementType(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field VirtualClusters", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.VirtualClusters = append(m.VirtualClusters, &VirtualCluster{}) + if err := m.VirtualClusters[len(m.VirtualClusters)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RateLimits", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RateLimits = append(m.RateLimits, &RateLimit{}) + if err := m.RateLimits[len(m.RateLimits)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestHeadersToAdd", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RequestHeadersToAdd = append(m.RequestHeadersToAdd, &core.HeaderValueOption{}) + if err := m.RequestHeadersToAdd[len(m.RequestHeadersToAdd)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Cors", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Cors == nil { + m.Cors = &CorsPolicy{} + } + if err := m.Cors.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 10: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ResponseHeadersToAdd", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ResponseHeadersToAdd = append(m.ResponseHeadersToAdd, &core.HeaderValueOption{}) + if err := m.ResponseHeadersToAdd[len(m.ResponseHeadersToAdd)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 11: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ResponseHeadersToRemove", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ResponseHeadersToRemove = append(m.ResponseHeadersToRemove, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 12: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PerFilterConfig", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.PerFilterConfig == nil { + m.PerFilterConfig = make(map[string]*types.Struct) + } + var mapkey string + var mapvalue *types.Struct + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + var stringLenmapkey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapkey |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return ErrInvalidLengthRoute + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey > l { + return io.ErrUnexpectedEOF + } + mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) + iNdEx = postStringIndexmapkey + } else if fieldNum == 2 { + var mapmsglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + mapmsglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if mapmsglen < 0 { + return ErrInvalidLengthRoute + } + postmsgIndex := iNdEx + mapmsglen + if mapmsglen < 0 { + return ErrInvalidLengthRoute + } + if postmsgIndex > l { + return io.ErrUnexpectedEOF + } + mapvalue = &types.Struct{} + if err := mapvalue.Unmarshal(dAtA[iNdEx:postmsgIndex]); err != nil { + return err + } + iNdEx = postmsgIndex + } else { + iNdEx = entryPreIndex + skippy, err := skipRoute(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthRoute + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.PerFilterConfig[mapkey] = mapvalue + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipRoute(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthRoute + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Route) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Route: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Route: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Match", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Match.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Route", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &RouteAction{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Action = &Route_Route{v} + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Redirect", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &RedirectAction{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Action = &Route_Redirect{v} + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Metadata", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Metadata == nil { + m.Metadata = &core.Metadata{} + } + if err := m.Metadata.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Decorator", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Decorator == nil { + m.Decorator = &Decorator{} + } + if err := m.Decorator.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DirectResponse", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &DirectResponseAction{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Action = &Route_DirectResponse{v} + iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PerFilterConfig", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.PerFilterConfig == nil { + m.PerFilterConfig = make(map[string]*types.Struct) + } + var mapkey string + var mapvalue *types.Struct + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + var stringLenmapkey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapkey |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return ErrInvalidLengthRoute + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey > l { + return io.ErrUnexpectedEOF + } + mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) + iNdEx = postStringIndexmapkey + } else if fieldNum == 2 { + var mapmsglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + mapmsglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if mapmsglen < 0 { + return ErrInvalidLengthRoute + } + postmsgIndex := iNdEx + mapmsglen + if mapmsglen < 0 { + return ErrInvalidLengthRoute + } + if postmsgIndex > l { + return io.ErrUnexpectedEOF + } + mapvalue = &types.Struct{} + if err := mapvalue.Unmarshal(dAtA[iNdEx:postmsgIndex]); err != nil { + return err + } + iNdEx = postmsgIndex + } else { + iNdEx = entryPreIndex + skippy, err := skipRoute(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthRoute + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.PerFilterConfig[mapkey] = mapvalue + iNdEx = postIndex + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestHeadersToAdd", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RequestHeadersToAdd = append(m.RequestHeadersToAdd, &core.HeaderValueOption{}) + if err := m.RequestHeadersToAdd[len(m.RequestHeadersToAdd)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 10: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ResponseHeadersToAdd", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ResponseHeadersToAdd = append(m.ResponseHeadersToAdd, &core.HeaderValueOption{}) + if err := m.ResponseHeadersToAdd[len(m.ResponseHeadersToAdd)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 11: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ResponseHeadersToRemove", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ResponseHeadersToRemove = append(m.ResponseHeadersToRemove, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipRoute(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthRoute + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *WeightedCluster) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: WeightedCluster: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: WeightedCluster: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Clusters", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Clusters = append(m.Clusters, &WeightedCluster_ClusterWeight{}) + if err := m.Clusters[len(m.Clusters)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RuntimeKeyPrefix", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RuntimeKeyPrefix = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TotalWeight", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.TotalWeight == nil { + m.TotalWeight = &types.UInt32Value{} + } + if err := m.TotalWeight.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipRoute(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthRoute + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *WeightedCluster_ClusterWeight) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ClusterWeight: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ClusterWeight: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Weight", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Weight == nil { + m.Weight = &types.UInt32Value{} + } + if err := m.Weight.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MetadataMatch", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.MetadataMatch == nil { + m.MetadataMatch = &core.Metadata{} + } + if err := m.MetadataMatch.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestHeadersToAdd", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RequestHeadersToAdd = append(m.RequestHeadersToAdd, &core.HeaderValueOption{}) + if err := m.RequestHeadersToAdd[len(m.RequestHeadersToAdd)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ResponseHeadersToAdd", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ResponseHeadersToAdd = append(m.ResponseHeadersToAdd, &core.HeaderValueOption{}) + if err := m.ResponseHeadersToAdd[len(m.ResponseHeadersToAdd)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ResponseHeadersToRemove", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ResponseHeadersToRemove = append(m.ResponseHeadersToRemove, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PerFilterConfig", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.PerFilterConfig == nil { + m.PerFilterConfig = make(map[string]*types.Struct) + } + var mapkey string + var mapvalue *types.Struct + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + var stringLenmapkey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapkey |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return ErrInvalidLengthRoute + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey > l { + return io.ErrUnexpectedEOF + } + mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) + iNdEx = postStringIndexmapkey + } else if fieldNum == 2 { + var mapmsglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + mapmsglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if mapmsglen < 0 { + return ErrInvalidLengthRoute + } + postmsgIndex := iNdEx + mapmsglen + if mapmsglen < 0 { + return ErrInvalidLengthRoute + } + if postmsgIndex > l { + return io.ErrUnexpectedEOF + } + mapvalue = &types.Struct{} + if err := mapvalue.Unmarshal(dAtA[iNdEx:postmsgIndex]); err != nil { + return err + } + iNdEx = postmsgIndex + } else { + iNdEx = entryPreIndex + skippy, err := skipRoute(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthRoute + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.PerFilterConfig[mapkey] = mapvalue + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipRoute(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthRoute + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *RouteMatch) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: RouteMatch: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RouteMatch: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Prefix", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PathSpecifier = &RouteMatch_Prefix{string(dAtA[iNdEx:postIndex])} + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Path", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PathSpecifier = &RouteMatch_Path{string(dAtA[iNdEx:postIndex])} + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Regex", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PathSpecifier = &RouteMatch_Regex{string(dAtA[iNdEx:postIndex])} + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CaseSensitive", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.CaseSensitive == nil { + m.CaseSensitive = &types.BoolValue{} + } + if err := m.CaseSensitive.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Runtime", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Runtime == nil { + m.Runtime = &core.RuntimeUInt32{} + } + if err := m.Runtime.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Headers", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Headers = append(m.Headers, &HeaderMatcher{}) + if err := m.Headers[len(m.Headers)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field QueryParameters", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.QueryParameters = append(m.QueryParameters, &QueryParameterMatcher{}) + if err := m.QueryParameters[len(m.QueryParameters)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipRoute(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthRoute + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CorsPolicy) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: CorsPolicy: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CorsPolicy: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AllowOrigin", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.AllowOrigin = append(m.AllowOrigin, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AllowMethods", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.AllowMethods = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AllowHeaders", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.AllowHeaders = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ExposeHeaders", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ExposeHeaders = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxAge", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.MaxAge = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AllowCredentials", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.AllowCredentials == nil { + m.AllowCredentials = &types.BoolValue{} + } + if err := m.AllowCredentials.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Enabled", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Enabled == nil { + m.Enabled = &types.BoolValue{} + } + if err := m.Enabled.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AllowOriginRegex", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.AllowOriginRegex = append(m.AllowOriginRegex, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipRoute(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthRoute + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *RouteAction) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: RouteAction: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RouteAction: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Cluster", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ClusterSpecifier = &RouteAction_Cluster{string(dAtA[iNdEx:postIndex])} + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ClusterHeader", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ClusterSpecifier = &RouteAction_ClusterHeader{string(dAtA[iNdEx:postIndex])} + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field WeightedClusters", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &WeightedCluster{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.ClusterSpecifier = &RouteAction_WeightedClusters{v} + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MetadataMatch", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.MetadataMatch == nil { + m.MetadataMatch = &core.Metadata{} + } + if err := m.MetadataMatch.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PrefixRewrite", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PrefixRewrite = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field HostRewrite", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.HostRewriteSpecifier = &RouteAction_HostRewrite{string(dAtA[iNdEx:postIndex])} + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AutoHostRewrite", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &types.BoolValue{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.HostRewriteSpecifier = &RouteAction_AutoHostRewrite{v} + iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Timeout", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Timeout == nil { + m.Timeout = new(time.Duration) + } + if err := github_com_gogo_protobuf_types.StdDurationUnmarshal(m.Timeout, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RetryPolicy", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.RetryPolicy == nil { + m.RetryPolicy = &RouteAction_RetryPolicy{} + } + if err := m.RetryPolicy.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 10: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestMirrorPolicy", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.RequestMirrorPolicy == nil { + m.RequestMirrorPolicy = &RouteAction_RequestMirrorPolicy{} + } + if err := m.RequestMirrorPolicy.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 11: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Priority", wireType) + } + m.Priority = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Priority |= (core.RoutingPriority(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 12: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestHeadersToAdd", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RequestHeadersToAdd = append(m.RequestHeadersToAdd, &core.HeaderValueOption{}) + if err := m.RequestHeadersToAdd[len(m.RequestHeadersToAdd)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 13: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RateLimits", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RateLimits = append(m.RateLimits, &RateLimit{}) + if err := m.RateLimits[len(m.RateLimits)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 14: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field IncludeVhRateLimits", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.IncludeVhRateLimits == nil { + m.IncludeVhRateLimits = &types.BoolValue{} + } + if err := m.IncludeVhRateLimits.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 15: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field HashPolicy", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.HashPolicy = append(m.HashPolicy, &RouteAction_HashPolicy{}) + if err := m.HashPolicy[len(m.HashPolicy)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 16: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field UseWebsocket", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.UseWebsocket == nil { + m.UseWebsocket = &types.BoolValue{} + } + if err := m.UseWebsocket.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 17: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Cors", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Cors == nil { + m.Cors = &CorsPolicy{} + } + if err := m.Cors.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 18: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ResponseHeadersToAdd", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ResponseHeadersToAdd = append(m.ResponseHeadersToAdd, &core.HeaderValueOption{}) + if err := m.ResponseHeadersToAdd[len(m.ResponseHeadersToAdd)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 19: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ResponseHeadersToRemove", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ResponseHeadersToRemove = append(m.ResponseHeadersToRemove, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 20: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ClusterNotFoundResponseCode", wireType) + } + m.ClusterNotFoundResponseCode = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ClusterNotFoundResponseCode |= (RouteAction_ClusterNotFoundResponseCode(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 22: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field WebsocketConfig", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.WebsocketConfig == nil { + m.WebsocketConfig = &RouteAction_WebSocketProxyConfig{} + } + if err := m.WebsocketConfig.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 23: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxGrpcTimeout", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.MaxGrpcTimeout == nil { + m.MaxGrpcTimeout = new(time.Duration) + } + if err := github_com_gogo_protobuf_types.StdDurationUnmarshal(m.MaxGrpcTimeout, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 24: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field IdleTimeout", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.IdleTimeout == nil { + m.IdleTimeout = new(time.Duration) + } + if err := github_com_gogo_protobuf_types.StdDurationUnmarshal(m.IdleTimeout, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipRoute(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthRoute + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *RouteAction_RetryPolicy) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: RetryPolicy: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RetryPolicy: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RetryOn", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RetryOn = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NumRetries", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.NumRetries == nil { + m.NumRetries = &types.UInt32Value{} + } + if err := m.NumRetries.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PerTryTimeout", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.PerTryTimeout == nil { + m.PerTryTimeout = new(time.Duration) + } + if err := github_com_gogo_protobuf_types.StdDurationUnmarshal(m.PerTryTimeout, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RetryPriority", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.RetryPriority == nil { + m.RetryPriority = &RouteAction_RetryPolicy_RetryPriority{} + } + if err := m.RetryPriority.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RetryHostPredicate", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RetryHostPredicate = append(m.RetryHostPredicate, &RouteAction_RetryPolicy_RetryHostPredicate{}) + if err := m.RetryHostPredicate[len(m.RetryHostPredicate)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field HostSelectionRetryMaxAttempts", wireType) + } + m.HostSelectionRetryMaxAttempts = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.HostSelectionRetryMaxAttempts |= (int64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipRoute(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthRoute + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *RouteAction_RetryPolicy_RetryPriority) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: RetryPriority: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RetryPriority: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Config", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Config == nil { + m.Config = &types.Struct{} + } + if err := m.Config.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipRoute(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthRoute + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *RouteAction_RetryPolicy_RetryHostPredicate) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: RetryHostPredicate: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RetryHostPredicate: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Config", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Config == nil { + m.Config = &types.Struct{} + } + if err := m.Config.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipRoute(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthRoute + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *RouteAction_RequestMirrorPolicy) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: RequestMirrorPolicy: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RequestMirrorPolicy: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Cluster", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Cluster = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RuntimeKey", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RuntimeKey = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipRoute(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthRoute + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *RouteAction_HashPolicy) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: HashPolicy: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: HashPolicy: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &RouteAction_HashPolicy_Header{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.PolicySpecifier = &RouteAction_HashPolicy_Header_{v} + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Cookie", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &RouteAction_HashPolicy_Cookie{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.PolicySpecifier = &RouteAction_HashPolicy_Cookie_{v} + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ConnectionProperties", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &RouteAction_HashPolicy_ConnectionProperties{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.PolicySpecifier = &RouteAction_HashPolicy_ConnectionProperties_{v} + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Terminal", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.Terminal = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skipRoute(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthRoute + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *RouteAction_HashPolicy_Header) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Header: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Header: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field HeaderName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.HeaderName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipRoute(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthRoute + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *RouteAction_HashPolicy_Cookie) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Cookie: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Cookie: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Ttl", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Ttl == nil { + m.Ttl = new(time.Duration) + } + if err := github_com_gogo_protobuf_types.StdDurationUnmarshal(m.Ttl, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Path", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Path = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipRoute(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthRoute + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *RouteAction_HashPolicy_ConnectionProperties) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ConnectionProperties: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ConnectionProperties: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field SourceIp", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.SourceIp = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skipRoute(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthRoute + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *RouteAction_WebSocketProxyConfig) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: WebSocketProxyConfig: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: WebSocketProxyConfig: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field StatPrefix", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.StatPrefix = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field IdleTimeout", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.IdleTimeout == nil { + m.IdleTimeout = new(time.Duration) + } + if err := github_com_gogo_protobuf_types.StdDurationUnmarshal(m.IdleTimeout, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxConnectAttempts", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.MaxConnectAttempts == nil { + m.MaxConnectAttempts = &types.UInt32Value{} + } + if err := m.MaxConnectAttempts.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipRoute(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthRoute + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *RedirectAction) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: RedirectAction: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RedirectAction: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field HostRedirect", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.HostRedirect = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PathRedirect", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PathRewriteSpecifier = &RedirectAction_PathRedirect{string(dAtA[iNdEx:postIndex])} + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ResponseCode", wireType) + } + m.ResponseCode = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ResponseCode |= (RedirectAction_RedirectResponseCode(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field HttpsRedirect", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.HttpsRedirect = bool(v != 0) + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PrefixRewrite", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PathRewriteSpecifier = &RedirectAction_PrefixRewrite{string(dAtA[iNdEx:postIndex])} + iNdEx = postIndex + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field StripQuery", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.StripQuery = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skipRoute(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthRoute + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DirectResponseAction) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DirectResponseAction: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DirectResponseAction: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + } + m.Status = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Status |= (uint32(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Body", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Body == nil { + m.Body = &core.DataSource{} + } + if err := m.Body.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipRoute(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthRoute + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Decorator) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Decorator: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Decorator: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Operation", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Operation = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipRoute(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthRoute + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *VirtualCluster) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: VirtualCluster: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: VirtualCluster: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pattern", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Pattern = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Method", wireType) + } + m.Method = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Method |= (core.RequestMethod(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipRoute(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthRoute + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *RateLimit) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: RateLimit: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RateLimit: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Stage", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Stage == nil { + m.Stage = &types.UInt32Value{} + } + if err := m.Stage.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DisableKey", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DisableKey = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Actions", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Actions = append(m.Actions, &RateLimit_Action{}) + if err := m.Actions[len(m.Actions)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipRoute(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthRoute + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *RateLimit_Action) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Action: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Action: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SourceCluster", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &RateLimit_Action_SourceCluster{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.ActionSpecifier = &RateLimit_Action_SourceCluster_{v} + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DestinationCluster", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &RateLimit_Action_DestinationCluster{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.ActionSpecifier = &RateLimit_Action_DestinationCluster_{v} + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestHeaders", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &RateLimit_Action_RequestHeaders{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.ActionSpecifier = &RateLimit_Action_RequestHeaders_{v} + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RemoteAddress", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &RateLimit_Action_RemoteAddress{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.ActionSpecifier = &RateLimit_Action_RemoteAddress_{v} + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field GenericKey", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &RateLimit_Action_GenericKey{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.ActionSpecifier = &RateLimit_Action_GenericKey_{v} + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field HeaderValueMatch", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &RateLimit_Action_HeaderValueMatch{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.ActionSpecifier = &RateLimit_Action_HeaderValueMatch_{v} + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipRoute(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthRoute + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *RateLimit_Action_SourceCluster) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: SourceCluster: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SourceCluster: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipRoute(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthRoute + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *RateLimit_Action_DestinationCluster) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DestinationCluster: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DestinationCluster: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipRoute(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthRoute + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *RateLimit_Action_RequestHeaders) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: RequestHeaders: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RequestHeaders: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field HeaderName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.HeaderName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DescriptorKey", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DescriptorKey = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipRoute(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthRoute + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *RateLimit_Action_RemoteAddress) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: RemoteAddress: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RemoteAddress: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipRoute(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthRoute + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *RateLimit_Action_GenericKey) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GenericKey: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GenericKey: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DescriptorValue", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DescriptorValue = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipRoute(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthRoute + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *RateLimit_Action_HeaderValueMatch) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: HeaderValueMatch: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: HeaderValueMatch: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DescriptorValue", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DescriptorValue = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ExpectMatch", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.ExpectMatch == nil { + m.ExpectMatch = &types.BoolValue{} + } + if err := m.ExpectMatch.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Headers", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Headers = append(m.Headers, &HeaderMatcher{}) + if err := m.Headers[len(m.Headers)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipRoute(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthRoute + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *HeaderMatcher) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: HeaderMatcher: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: HeaderMatcher: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ExactMatch", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.HeaderMatchSpecifier = &HeaderMatcher_ExactMatch{string(dAtA[iNdEx:postIndex])} + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RegexMatch", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.HeaderMatchSpecifier = &HeaderMatcher_RegexMatch{string(dAtA[iNdEx:postIndex])} + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RangeMatch", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &_type.Int64Range{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.HeaderMatchSpecifier = &HeaderMatcher_RangeMatch{v} + iNdEx = postIndex + case 7: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field PresentMatch", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + b := bool(v != 0) + m.HeaderMatchSpecifier = &HeaderMatcher_PresentMatch{b} + case 8: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field InvertMatch", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.InvertMatch = bool(v != 0) + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PrefixMatch", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.HeaderMatchSpecifier = &HeaderMatcher_PrefixMatch{string(dAtA[iNdEx:postIndex])} + iNdEx = postIndex + case 10: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SuffixMatch", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.HeaderMatchSpecifier = &HeaderMatcher_SuffixMatch{string(dAtA[iNdEx:postIndex])} + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipRoute(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthRoute + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryParameterMatcher) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryParameterMatcher: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryParameterMatcher: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Value = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Regex", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Regex == nil { + m.Regex = &types.BoolValue{} + } + if err := m.Regex.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipRoute(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthRoute + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipRoute(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowRoute + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowRoute + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + return iNdEx, nil + case 1: + iNdEx += 8 + return iNdEx, nil + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowRoute + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + iNdEx += length + if length < 0 { + return 0, ErrInvalidLengthRoute + } + return iNdEx, nil + case 3: + for { + var innerWire uint64 + var start int = iNdEx + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowRoute + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + innerWire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + innerWireType := int(innerWire & 0x7) + if innerWireType == 4 { + break + } + next, err := skipRoute(dAtA[start:]) + if err != nil { + return 0, err + } + iNdEx = start + next + } + return iNdEx, nil + case 4: + return iNdEx, nil + case 5: + iNdEx += 4 + return iNdEx, nil + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + } + panic("unreachable") +} + +var ( + ErrInvalidLengthRoute = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowRoute = fmt.Errorf("proto: integer overflow") +) + +func init() { + proto.RegisterFile("envoy/api/v2/route/route.proto", fileDescriptor_route_91aab16f18e3dd7f) +} + +var fileDescriptor_route_91aab16f18e3dd7f = []byte{ + // 3108 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x5a, 0x4d, 0x6c, 0x1b, 0xc7, + 0xf5, 0xd7, 0x92, 0x14, 0x3f, 0x1e, 0x3f, 0xb4, 0x1a, 0xcb, 0x12, 0x4d, 0xc7, 0xb6, 0x4c, 0xdb, + 0xff, 0xe8, 0xef, 0xff, 0x3f, 0x54, 0x2c, 0xab, 0x75, 0x12, 0xc3, 0x49, 0x45, 0x89, 0x36, 0x6d, + 0xeb, 0xab, 0x23, 0xc5, 0xa9, 0x63, 0xb4, 0x9b, 0x15, 0x77, 0x4c, 0x6e, 0x4d, 0xee, 0x6e, 0x66, + 0x87, 0x92, 0x78, 0x4b, 0x7b, 0x2a, 0x1a, 0xf4, 0xd0, 0x00, 0x05, 0xda, 0x73, 0x2f, 0x45, 0x4f, + 0x3d, 0x16, 0x3d, 0x14, 0x39, 0x06, 0x3d, 0xe5, 0x98, 0x4b, 0xda, 0xc0, 0xb7, 0xdc, 0x0b, 0xf4, + 0x5a, 0xcc, 0xc7, 0x92, 0x5c, 0x71, 0x25, 0x4a, 0x4d, 0x03, 0xe4, 0x62, 0x73, 0xdf, 0xfc, 0xde, + 0x9b, 0xd9, 0xf7, 0xfd, 0x66, 0x05, 0x97, 0x89, 0xb3, 0xef, 0xf6, 0x16, 0x4d, 0xcf, 0x5e, 0xdc, + 0x5f, 0x5a, 0xa4, 0x6e, 0x97, 0x11, 0xf9, 0x6f, 0xc5, 0xa3, 0x2e, 0x73, 0x11, 0x12, 0xeb, 0x15, + 0xd3, 0xb3, 0x2b, 0xfb, 0x4b, 0x15, 0xb1, 0x52, 0x7a, 0x25, 0xc4, 0xd3, 0x70, 0x29, 0x59, 0xdc, + 0x33, 0x7d, 0xc5, 0x51, 0x9a, 0x95, 0xab, 0xac, 0xe7, 0x91, 0x45, 0x6a, 0x3a, 0xcd, 0x80, 0x7e, + 0xb9, 0xe9, 0xba, 0xcd, 0x36, 0x59, 0x14, 0x4f, 0x7b, 0xdd, 0xe7, 0x8b, 0x56, 0x97, 0x9a, 0xcc, + 0x76, 0x1d, 0xb5, 0xfe, 0xca, 0xd1, 0x75, 0x9f, 0xd1, 0x6e, 0x83, 0x1d, 0xc7, 0x7d, 0x40, 0x4d, + 0xcf, 0x23, 0xd4, 0x57, 0xeb, 0x73, 0xfb, 0x66, 0xdb, 0xb6, 0x4c, 0x46, 0x16, 0x83, 0x1f, 0x6a, + 0x61, 0xa6, 0xe9, 0x36, 0x5d, 0xf1, 0x73, 0x91, 0xff, 0x92, 0xd4, 0xf2, 0xef, 0x52, 0x90, 0x7d, + 0x62, 0x53, 0xd6, 0x35, 0xdb, 0x75, 0xd7, 0x67, 0xe8, 0x12, 0x24, 0x1c, 0xb3, 0x43, 0x8a, 0xda, + 0xbc, 0xb6, 0x90, 0xa9, 0x66, 0xfe, 0xf2, 0xf5, 0xa7, 0xf1, 0x04, 0x8d, 0xcd, 0x6b, 0x58, 0x90, + 0xd1, 0x75, 0x48, 0x59, 0x6e, 0xc7, 0xb4, 0x1d, 0xbf, 0x18, 0x9b, 0x8f, 0x2f, 0x64, 0xaa, 0xc0, + 0x11, 0x93, 0x9f, 0x68, 0xb1, 0xb4, 0x86, 0x83, 0x25, 0x74, 0x07, 0x92, 0x42, 0x41, 0x7e, 0x31, + 0x3e, 0x1f, 0x5f, 0xc8, 0x2e, 0x5d, 0xa8, 0x8c, 0x2a, 0xaf, 0x82, 0xf9, 0xbf, 0xd5, 0xc4, 0x67, + 0x7f, 0xbf, 0x32, 0x81, 0x15, 0x1c, 0xed, 0x40, 0x96, 0x92, 0x0f, 0xbb, 0x36, 0x25, 0x06, 0x6b, + 0xfb, 0xc5, 0xc4, 0xbc, 0xb6, 0x50, 0x58, 0x5a, 0x8a, 0xe2, 0x1e, 0x3a, 0x73, 0x65, 0xb7, 0xed, + 0x63, 0xc9, 0xd5, 0x21, 0x0e, 0xdb, 0xed, 0x79, 0x04, 0x83, 0x12, 0xb3, 0xdb, 0xf6, 0xd1, 0x06, + 0xe8, 0xfb, 0x12, 0x6d, 0x34, 0xda, 0x5d, 0x9f, 0x11, 0xea, 0x17, 0x27, 0xc5, 0xb9, 0xca, 0x27, + 0x48, 0x5e, 0x95, 0x50, 0x3c, 0xb5, 0x1f, 0x7a, 0xf6, 0xd1, 0xdb, 0x90, 0xa5, 0x26, 0x23, 0x46, + 0xdb, 0xee, 0xd8, 0xcc, 0x2f, 0x26, 0x85, 0xa4, 0x4b, 0x91, 0x6f, 0x68, 0x32, 0xb2, 0xce, 0x51, + 0x18, 0x68, 0xf0, 0xd3, 0x47, 0x4f, 0x61, 0x96, 0x1f, 0x8e, 0xf8, 0xcc, 0x68, 0x11, 0xd3, 0x22, + 0xd4, 0x37, 0x98, 0x6b, 0x98, 0x96, 0x55, 0x4c, 0x09, 0x51, 0xd7, 0xc3, 0xa2, 0xb8, 0x57, 0x55, + 0xea, 0x02, 0xf8, 0xc4, 0x6c, 0x77, 0xc9, 0x96, 0xc7, 0x5d, 0x05, 0x9f, 0x53, 0x32, 0xe4, 0x8a, + 0xbf, 0xeb, 0xae, 0x58, 0x16, 0x5a, 0x82, 0x44, 0xc3, 0xa5, 0x7e, 0x31, 0x3d, 0xaf, 0x2d, 0x64, + 0x97, 0x2e, 0x47, 0x9d, 0x69, 0xd5, 0xa5, 0xfe, 0xb6, 0xdb, 0xb6, 0x1b, 0x3d, 0x2c, 0xb0, 0xe8, + 0x19, 0xcc, 0x51, 0xe2, 0x7b, 0xae, 0xe3, 0x93, 0xa3, 0xe7, 0x81, 0x33, 0x9c, 0x67, 0x26, 0x10, + 0x12, 0x3a, 0xd0, 0x5d, 0x28, 0x45, 0x09, 0xa7, 0xa4, 0xe3, 0xee, 0x93, 0x62, 0x96, 0x7b, 0x10, + 0x9e, 0x1b, 0xe1, 0xc4, 0x62, 0x19, 0x7d, 0x00, 0xd3, 0x1e, 0xa1, 0xc6, 0x73, 0xbb, 0xcd, 0x08, + 0x35, 0x1a, 0xae, 0xf3, 0xdc, 0x6e, 0x16, 0x73, 0xe2, 0x4c, 0xcb, 0xe3, 0x5c, 0x62, 0x9b, 0xd0, + 0xfb, 0x82, 0x6f, 0x55, 0xb0, 0xd5, 0x1c, 0x46, 0x7b, 0x78, 0xca, 0x0b, 0x53, 0x4b, 0xcf, 0x60, + 0x26, 0x0a, 0x88, 0x74, 0x88, 0xbf, 0x20, 0x3d, 0x19, 0x03, 0x98, 0xff, 0x44, 0xaf, 0xc1, 0xe4, + 0x3e, 0x7f, 0xdb, 0x62, 0x4c, 0xa8, 0x76, 0xae, 0x22, 0xa3, 0xb0, 0x12, 0x44, 0x61, 0x65, 0x47, + 0xc4, 0x28, 0x96, 0xa8, 0xb7, 0x62, 0x6f, 0x68, 0xe5, 0xb7, 0x00, 0x8d, 0x3a, 0x26, 0x4a, 0x43, + 0x62, 0x73, 0x6b, 0xb3, 0xa6, 0x4f, 0xa0, 0x69, 0xc8, 0xd7, 0x7e, 0xb4, 0x5b, 0xc3, 0x9b, 0x2b, + 0xeb, 0xc6, 0xd6, 0xe6, 0xfa, 0x53, 0x5d, 0x43, 0x29, 0x88, 0xaf, 0xac, 0xaf, 0xeb, 0xb1, 0x47, + 0x89, 0x74, 0x46, 0x87, 0xf2, 0x17, 0x49, 0x98, 0x14, 0x51, 0x82, 0xd6, 0x60, 0xb2, 0x63, 0xb2, + 0x46, 0x4b, 0x1c, 0xe9, 0x18, 0xcb, 0x0a, 0xe4, 0x06, 0x47, 0x55, 0x0b, 0x3c, 0xa8, 0x44, 0x60, + 0xfe, 0x52, 0x8b, 0xe9, 0x1a, 0x96, 0xcc, 0xe8, 0x0e, 0x4c, 0x0a, 0xa8, 0x7a, 0x89, 0x2b, 0xc7, + 0x4a, 0x59, 0x69, 0x70, 0x9b, 0xd6, 0x27, 0xb0, 0xc4, 0xa3, 0x1f, 0x40, 0x9a, 0x12, 0xcb, 0xa6, + 0xa4, 0xc1, 0x8a, 0x71, 0xc1, 0x1b, 0x19, 0x39, 0x58, 0x61, 0xfa, 0xec, 0x7d, 0x2e, 0x74, 0x07, + 0xd2, 0x1d, 0xc2, 0x4c, 0xcb, 0x64, 0xa6, 0x88, 0xea, 0xec, 0xd2, 0xc5, 0x08, 0xb7, 0xda, 0x50, + 0x10, 0xdc, 0x07, 0xa3, 0xbb, 0x90, 0xb1, 0x48, 0xc3, 0xa5, 0x26, 0x73, 0x69, 0x71, 0x52, 0x70, + 0x46, 0xc6, 0xda, 0x5a, 0x00, 0xc2, 0x03, 0x3c, 0xda, 0x81, 0x29, 0xb9, 0xbf, 0x11, 0xf8, 0x58, + 0x31, 0x25, 0x44, 0x2c, 0x44, 0x8a, 0x10, 0x50, 0xac, 0x90, 0xfd, 0x97, 0x28, 0x58, 0x21, 0x3a, + 0x7a, 0x3f, 0xca, 0x2d, 0xd3, 0xc2, 0x2d, 0x2b, 0xc7, 0x6a, 0xf4, 0x74, 0x0e, 0x79, 0x42, 0x6e, + 0xc8, 0x7c, 0xd3, 0xdc, 0xf0, 0x9d, 0x8d, 0xf3, 0x6f, 0x35, 0x0a, 0xab, 0x53, 0x90, 0x34, 0x85, + 0x25, 0xd1, 0xe4, 0x9f, 0xbf, 0xfe, 0x34, 0xae, 0x3d, 0x4a, 0xa4, 0x93, 0x7a, 0xaa, 0xfc, 0x65, + 0x12, 0xa6, 0xde, 0x23, 0x76, 0xb3, 0xc5, 0x88, 0xa5, 0x32, 0x3b, 0x7a, 0x0a, 0xe9, 0x7e, 0x7d, + 0xd0, 0x84, 0x4a, 0x6e, 0x45, 0xd9, 0xf3, 0x08, 0x5b, 0x45, 0xfd, 0x2f, 0xc9, 0xa1, 0x7a, 0xd8, + 0x17, 0x87, 0xfe, 0x1f, 0x10, 0xed, 0x3a, 0xcc, 0xee, 0x10, 0xe3, 0x05, 0xe9, 0x19, 0x1e, 0x25, + 0xcf, 0xed, 0x43, 0xf1, 0x16, 0x19, 0xac, 0xab, 0x95, 0xc7, 0xa4, 0xb7, 0x2d, 0xe8, 0xe8, 0x11, + 0xe4, 0x98, 0xcb, 0xcc, 0xb6, 0x71, 0x20, 0x64, 0xaa, 0x90, 0x7b, 0x65, 0xe4, 0x6d, 0xdf, 0x7d, + 0xe8, 0xb0, 0xdb, 0x4b, 0xc2, 0x3a, 0xaa, 0x52, 0xdf, 0x8c, 0x2d, 0x68, 0x38, 0x2b, 0x98, 0xe5, + 0x79, 0x4a, 0xff, 0x4c, 0x40, 0x3e, 0x74, 0xc2, 0x71, 0x15, 0x7e, 0x19, 0x92, 0x6a, 0xdb, 0xd8, + 0xf8, 0x6d, 0xb1, 0xc2, 0xa2, 0x2a, 0x14, 0x82, 0x90, 0x35, 0x64, 0xa6, 0x8a, 0x8f, 0x8f, 0xf2, + 0x7c, 0xc0, 0x22, 0xb2, 0xd6, 0x09, 0xce, 0x9f, 0xf8, 0x16, 0x9d, 0x7f, 0xf2, 0x5b, 0x76, 0xfe, + 0xe4, 0xc9, 0x45, 0x8e, 0x1e, 0x9f, 0x4d, 0xee, 0x9f, 0xd9, 0xfb, 0xbe, 0x03, 0x65, 0xef, 0x51, + 0x22, 0x9d, 0xd2, 0xd3, 0xe5, 0x8f, 0xe3, 0x00, 0x83, 0x82, 0x84, 0x8a, 0x90, 0x54, 0x3e, 0x2f, + 0x84, 0xd7, 0x27, 0xb0, 0x7a, 0x46, 0x33, 0x90, 0xf0, 0x4c, 0xd6, 0x92, 0xb1, 0x50, 0x9f, 0xc0, + 0xe2, 0x09, 0x95, 0x61, 0x92, 0x92, 0x26, 0x39, 0x14, 0x5e, 0x14, 0x34, 0x99, 0x34, 0xbe, 0xf0, + 0x51, 0x5a, 0x14, 0x25, 0xbe, 0x84, 0x56, 0xa0, 0xd0, 0x30, 0x7d, 0x62, 0xf8, 0xc4, 0xf1, 0x6d, + 0x66, 0xef, 0x13, 0x55, 0x58, 0x4a, 0x23, 0x87, 0xac, 0xba, 0x6e, 0x5b, 0xba, 0x6b, 0x9e, 0x73, + 0xec, 0x04, 0x0c, 0xe8, 0x2d, 0x48, 0xa9, 0xe0, 0x53, 0xa5, 0x65, 0x3e, 0xc2, 0x0d, 0xb0, 0x44, + 0x48, 0xaf, 0xc7, 0x01, 0x03, 0xba, 0x0b, 0x29, 0x65, 0x6c, 0xd5, 0x02, 0x5e, 0x8d, 0x32, 0x97, + 0x34, 0xb7, 0x50, 0x02, 0xa1, 0x38, 0xe0, 0x40, 0xbb, 0xa0, 0x7f, 0xd8, 0x25, 0xb4, 0x67, 0x78, + 0x26, 0x35, 0x3b, 0x44, 0xa4, 0x1c, 0xd9, 0xfd, 0xfd, 0x6f, 0x94, 0x94, 0x1f, 0x72, 0xec, 0x76, + 0x00, 0x0d, 0xa4, 0x4d, 0x7d, 0x18, 0x22, 0xfb, 0xd5, 0x39, 0x28, 0x70, 0xed, 0x19, 0xbe, 0x47, + 0x1a, 0xf6, 0x73, 0x9b, 0x50, 0x95, 0xf3, 0xca, 0xff, 0x8a, 0x01, 0x0c, 0x1a, 0x3f, 0x74, 0x15, + 0x72, 0x66, 0xbb, 0xed, 0x1e, 0x18, 0x2e, 0xb5, 0x9b, 0xb6, 0x23, 0x92, 0x5d, 0x06, 0x67, 0x05, + 0x6d, 0x4b, 0x90, 0xd0, 0x35, 0xc8, 0x4b, 0x48, 0x87, 0xb0, 0x96, 0x6b, 0xf9, 0x2a, 0x57, 0x49, + 0xbe, 0x0d, 0x49, 0x1b, 0x80, 0x02, 0x45, 0xc4, 0x87, 0x40, 0xca, 0xd1, 0xd1, 0x0d, 0x28, 0x90, + 0x43, 0xcf, 0x1d, 0xc4, 0x86, 0x30, 0x53, 0x06, 0xe7, 0x25, 0x35, 0x80, 0xcd, 0x41, 0xaa, 0x63, + 0x1e, 0x1a, 0x66, 0x53, 0x9a, 0x22, 0x83, 0x93, 0x1d, 0xf3, 0x70, 0xa5, 0x49, 0xd0, 0x03, 0x98, + 0x96, 0x9b, 0x34, 0x28, 0xb1, 0x88, 0xc3, 0x6c, 0xb3, 0xcd, 0x35, 0x3e, 0xce, 0xd2, 0xba, 0x60, + 0x5a, 0x1d, 0xf0, 0xa0, 0x65, 0x48, 0x11, 0xc7, 0xdc, 0x6b, 0x13, 0x4b, 0x35, 0x01, 0x27, 0xb1, + 0x07, 0x50, 0x74, 0x0f, 0xd0, 0xb0, 0xae, 0x0c, 0xe9, 0x96, 0x69, 0x31, 0xfb, 0x4c, 0x71, 0xb7, + 0x84, 0x4f, 0xb4, 0x54, 0x59, 0xfa, 0xa6, 0xda, 0x54, 0xaa, 0x10, 0x73, 0x60, 0xf9, 0xaf, 0x25, + 0xc8, 0x0e, 0xb5, 0x54, 0xe8, 0x06, 0xa4, 0x54, 0x51, 0x18, 0xc9, 0xbf, 0xf5, 0x09, 0x1c, 0xac, + 0xa1, 0x25, 0x28, 0xa8, 0x9f, 0x4a, 0x6b, 0x52, 0xff, 0x61, 0x74, 0x5e, 0x41, 0xa4, 0x0a, 0x11, + 0x86, 0xe9, 0x03, 0x95, 0x1c, 0x06, 0x73, 0x8e, 0xcc, 0xc2, 0xd7, 0x4e, 0x91, 0x49, 0xea, 0x13, + 0x58, 0x3f, 0x08, 0x93, 0xfc, 0x88, 0xb4, 0x9e, 0x38, 0x73, 0x5a, 0xbf, 0x01, 0x05, 0x19, 0xeb, + 0x06, 0x25, 0x07, 0xd4, 0x66, 0x81, 0x81, 0xf3, 0x92, 0x8a, 0x25, 0x11, 0x5d, 0x83, 0x5c, 0xcb, + 0xf5, 0x59, 0x1f, 0x94, 0x14, 0x09, 0x41, 0xc3, 0x59, 0x4e, 0x0d, 0x40, 0x75, 0x98, 0x36, 0xbb, + 0xcc, 0x35, 0x42, 0xc8, 0xb1, 0xd6, 0xac, 0x6b, 0x78, 0x8a, 0xb3, 0xd5, 0x87, 0x24, 0xbd, 0x09, + 0x29, 0x1e, 0xc6, 0x6e, 0x97, 0xa9, 0x69, 0xe9, 0xc2, 0x08, 0xff, 0x9a, 0x1a, 0xcb, 0xab, 0x89, + 0xdf, 0xfe, 0xe3, 0x8a, 0x86, 0x03, 0x3c, 0xda, 0x84, 0x1c, 0x25, 0x8c, 0x07, 0xaf, 0x08, 0xa7, + 0x62, 0x46, 0xf0, 0xff, 0xdf, 0x98, 0x6e, 0xba, 0x82, 0x39, 0x8f, 0x1a, 0xbd, 0xb2, 0x74, 0xf0, + 0x80, 0x9a, 0x70, 0x3e, 0xa8, 0x7b, 0x1d, 0x9b, 0x52, 0x97, 0x06, 0x82, 0x41, 0x08, 0xbe, 0x3d, + 0x5e, 0xb0, 0x60, 0xde, 0x10, 0xbc, 0x6a, 0x83, 0xa0, 0x0a, 0x0e, 0x13, 0xd1, 0xdb, 0x90, 0xf6, + 0xa8, 0xed, 0x52, 0x9b, 0xf5, 0x8a, 0x59, 0x31, 0x5a, 0x97, 0xa3, 0xf2, 0x9d, 0xdb, 0x65, 0xb6, + 0xd3, 0xdc, 0x56, 0x48, 0xdc, 0xe7, 0x41, 0x3f, 0x3e, 0xb6, 0x40, 0xe7, 0x4e, 0x5f, 0x44, 0xab, + 0xb1, 0xa2, 0x16, 0x5d, 0xa4, 0x8f, 0x0c, 0xd6, 0xf9, 0xb3, 0x0e, 0xd6, 0x5b, 0x30, 0x6b, 0x3b, + 0x8d, 0x76, 0xd7, 0x22, 0xc6, 0x7e, 0xcb, 0x18, 0x16, 0x55, 0x18, 0x1b, 0xef, 0xe7, 0x14, 0xe7, + 0x93, 0x16, 0x1e, 0x08, 0x7c, 0x0c, 0xd9, 0x96, 0xe9, 0xb7, 0x02, 0x73, 0x4c, 0x89, 0x03, 0xdd, + 0x1c, 0x67, 0x8e, 0xba, 0xe9, 0xb7, 0x94, 0x15, 0xa0, 0xd5, 0xff, 0x8d, 0x56, 0x21, 0xdf, 0xf5, + 0x89, 0x71, 0x40, 0xf6, 0x7c, 0xb7, 0xf1, 0x82, 0xb0, 0xa2, 0x3e, 0xee, 0x50, 0x42, 0x53, 0xb9, + 0xae, 0x4f, 0xde, 0x0b, 0x78, 0xfa, 0x03, 0xfe, 0xf4, 0x19, 0x06, 0x7c, 0xe3, 0xf8, 0xde, 0x07, + 0x9d, 0xd1, 0x6c, 0xd1, 0xfd, 0xcf, 0x3b, 0x27, 0xf6, 0x3f, 0xe7, 0x44, 0xaa, 0xe4, 0xdc, 0xc7, + 0xf6, 0x40, 0xbf, 0xd2, 0xe0, 0x4a, 0x90, 0xee, 0x1c, 0x97, 0x19, 0xcf, 0xdd, 0xae, 0x63, 0xf5, + 0x47, 0x36, 0xa3, 0xe1, 0x5a, 0xa4, 0x38, 0x23, 0xfc, 0xf5, 0xee, 0x38, 0xe5, 0xab, 0xcc, 0xb5, + 0xe9, 0xb2, 0xfb, 0x5c, 0x48, 0x30, 0xb4, 0xad, 0xba, 0x16, 0x51, 0x5d, 0xc4, 0xcf, 0xc5, 0x44, + 0x7c, 0xb1, 0x71, 0x3c, 0x10, 0x35, 0x40, 0xef, 0x9b, 0x29, 0x68, 0xc9, 0x66, 0x85, 0xc6, 0x97, + 0xc7, 0xed, 0xff, 0x1e, 0xd9, 0xdb, 0x11, 0x7c, 0xdb, 0xd4, 0x3d, 0xec, 0xc9, 0xe6, 0x4a, 0xbc, + 0xfc, 0x54, 0x5f, 0xa2, 0x1a, 0xf5, 0x1e, 0x82, 0xce, 0x0b, 0x5e, 0x93, 0x7a, 0x0d, 0x23, 0xc8, + 0x44, 0x73, 0xa7, 0xcb, 0x44, 0x85, 0x8e, 0x79, 0xf8, 0x80, 0x7a, 0x8d, 0x5d, 0x95, 0x90, 0xd6, + 0x21, 0x67, 0x5b, 0x6d, 0xd2, 0x17, 0x53, 0x1c, 0x27, 0xa6, 0xc0, 0xc5, 0x08, 0x6d, 0xfc, 0x51, + 0x8b, 0xdd, 0x9c, 0xc0, 0x59, 0xce, 0xae, 0xa4, 0x95, 0x7e, 0x33, 0x09, 0xd9, 0xa1, 0x5c, 0x85, + 0x2e, 0xf0, 0xe1, 0x9f, 0xa7, 0x3b, 0xd7, 0x51, 0xad, 0x61, 0x4a, 0x3c, 0x6f, 0x39, 0xe8, 0x1e, + 0x64, 0x9d, 0x6e, 0xc7, 0xe0, 0x8f, 0x36, 0xf1, 0x4f, 0x35, 0x30, 0x80, 0xd3, 0xed, 0x60, 0x89, + 0x47, 0x0f, 0x80, 0xb7, 0xa6, 0x06, 0x97, 0x1d, 0x1c, 0x3d, 0x7e, 0x3a, 0x0d, 0xe4, 0x3d, 0x42, + 0x77, 0x69, 0x2f, 0x50, 0xc0, 0x07, 0x50, 0x50, 0x19, 0x39, 0x48, 0x6f, 0xb2, 0x4c, 0xbd, 0x79, + 0x86, 0x9c, 0xac, 0x7e, 0x07, 0x59, 0x2f, 0x4f, 0x87, 0x1f, 0x91, 0x07, 0x33, 0x72, 0x07, 0x51, + 0x79, 0x3c, 0x4a, 0x2c, 0xbb, 0x61, 0x8a, 0x52, 0xc6, 0x23, 0xe8, 0xed, 0x33, 0xef, 0xc3, 0x4b, + 0xd1, 0x76, 0x20, 0x05, 0x23, 0x3a, 0x42, 0x43, 0x75, 0xb8, 0x2a, 0xf6, 0xf2, 0x49, 0x9b, 0x08, + 0x21, 0x86, 0x3c, 0x80, 0xe8, 0x92, 0x18, 0x23, 0x1d, 0x8f, 0xc9, 0x3e, 0x28, 0x8e, 0x2f, 0x71, + 0xe0, 0x4e, 0x80, 0x13, 0xf2, 0x37, 0xcc, 0xc3, 0x15, 0x05, 0x2a, 0x19, 0x90, 0x0f, 0xbd, 0xdb, + 0xb8, 0x09, 0x70, 0x11, 0x92, 0xca, 0xe9, 0xc7, 0x74, 0xfd, 0x0a, 0x56, 0xb2, 0x00, 0x8d, 0xbe, + 0xd4, 0x7f, 0x7d, 0x97, 0x67, 0x70, 0x2e, 0xa2, 0xd2, 0xa1, 0x6b, 0xc7, 0x77, 0x54, 0x83, 0x7e, + 0xea, 0x0a, 0x64, 0x87, 0xe6, 0x6f, 0xd5, 0xcc, 0xc2, 0x60, 0xf0, 0x2e, 0xfd, 0x29, 0x01, 0x30, + 0x48, 0xdc, 0xe8, 0x31, 0x24, 0x55, 0xdf, 0x25, 0x2f, 0xdc, 0x6e, 0x9d, 0x3e, 0xe9, 0xab, 0xd4, + 0xc9, 0x47, 0x1c, 0x29, 0x82, 0x0b, 0x6b, 0xb8, 0xee, 0x0b, 0x3b, 0x98, 0xa2, 0xce, 0x22, 0x6c, + 0x55, 0x30, 0x72, 0x61, 0x52, 0x04, 0xda, 0x87, 0xf3, 0x0d, 0xd7, 0x71, 0x94, 0x4b, 0x78, 0xd4, + 0xf5, 0x08, 0x65, 0x36, 0x09, 0x3a, 0xbd, 0x77, 0xce, 0x24, 0x3b, 0x90, 0xb3, 0xdd, 0x17, 0x53, + 0x9f, 0xc0, 0x33, 0x8d, 0x08, 0x3a, 0x2a, 0x41, 0x9a, 0x11, 0xda, 0xb1, 0x1d, 0xb3, 0x2d, 0x82, + 0x2b, 0x8d, 0xfb, 0xcf, 0xa5, 0x65, 0x48, 0xaa, 0x1e, 0xf4, 0x26, 0x64, 0xe5, 0x4b, 0x1b, 0xd1, + 0xa6, 0x07, 0xb9, 0xba, 0x69, 0x76, 0x48, 0xc9, 0x81, 0xa4, 0x7c, 0xbb, 0x71, 0x9e, 0x72, 0x0b, + 0xe2, 0x8c, 0xb5, 0x95, 0xf2, 0xc6, 0xa6, 0x06, 0x8e, 0x45, 0x48, 0x4d, 0x95, 0x72, 0x20, 0x11, + 0xbf, 0x4b, 0xb7, 0x61, 0x26, 0xea, 0x8d, 0xd1, 0x45, 0xc8, 0xf8, 0x6e, 0x97, 0x36, 0x88, 0x61, + 0x7b, 0xe2, 0x08, 0x69, 0x9c, 0x96, 0x84, 0x87, 0x5e, 0xf5, 0x02, 0xe8, 0xb2, 0xfa, 0x8f, 0x0c, + 0x55, 0xa5, 0xaf, 0x34, 0x98, 0x89, 0x4a, 0xf7, 0xdc, 0xd9, 0x7c, 0x66, 0x32, 0x63, 0x78, 0xe2, + 0xc5, 0xc0, 0x49, 0xea, 0x7e, 0xe7, 0x68, 0xbe, 0x8e, 0x7d, 0x93, 0x7c, 0x8d, 0x9e, 0xc2, 0x0c, + 0xcf, 0x09, 0xca, 0x6a, 0x83, 0xdc, 0x70, 0xc6, 0x5b, 0x23, 0xd4, 0x31, 0x0f, 0x95, 0x7e, 0x82, + 0xcc, 0x51, 0xae, 0xc1, 0xc5, 0x13, 0x0a, 0x2a, 0x9a, 0x83, 0x73, 0x3b, 0x35, 0xfc, 0xe4, 0xe1, + 0x6a, 0xcd, 0x78, 0x77, 0x73, 0xe5, 0xc9, 0xca, 0xc3, 0xf5, 0x95, 0xea, 0x7a, 0x4d, 0x9f, 0x40, + 0x79, 0xc8, 0x6c, 0x6e, 0xed, 0x1a, 0xf7, 0xb7, 0xde, 0xdd, 0x5c, 0xd3, 0xb5, 0x6a, 0x09, 0xa6, + 0x83, 0xf2, 0x7e, 0x54, 0x8b, 0xd5, 0x22, 0xcc, 0x0e, 0x37, 0xf3, 0x03, 0xc0, 0xa3, 0x44, 0xfa, + 0xbc, 0x3e, 0x5b, 0xfe, 0x5b, 0x1c, 0x0a, 0xe1, 0x7b, 0x65, 0x3e, 0x76, 0x2a, 0x16, 0x75, 0x25, + 0x2d, 0x35, 0x9c, 0x93, 0x83, 0x82, 0xba, 0x70, 0xbe, 0x01, 0x79, 0x31, 0x0b, 0xf7, 0x41, 0xc1, + 0x05, 0x43, 0x8e, 0x93, 0xfb, 0xb0, 0x16, 0xe4, 0xc3, 0x7d, 0x46, 0x5c, 0xf4, 0x19, 0x77, 0xc6, + 0x5f, 0x6f, 0xf7, 0x1f, 0x8f, 0xed, 0x31, 0x72, 0x74, 0x58, 0x59, 0x37, 0xa0, 0xd0, 0x62, 0xcc, + 0xf3, 0x07, 0x27, 0x92, 0x61, 0x94, 0x17, 0xd4, 0xfe, 0x81, 0x5e, 0x8d, 0x9e, 0x96, 0xf8, 0xb8, + 0x17, 0x9e, 0x97, 0x84, 0x97, 0x51, 0xdb, 0x33, 0xc4, 0x2d, 0x80, 0xa8, 0x04, 0x69, 0xee, 0x65, + 0xd4, 0xf6, 0xc4, 0x75, 0x41, 0xf9, 0x00, 0x66, 0xa2, 0x8e, 0x88, 0xce, 0xc3, 0xf4, 0xc6, 0xd6, + 0x93, 0xda, 0x9a, 0xb1, 0x5d, 0xc3, 0x1b, 0x2b, 0x9b, 0xb5, 0xcd, 0xdd, 0xf5, 0xa7, 0xfa, 0x04, + 0xca, 0xc0, 0xa4, 0xb2, 0x17, 0x37, 0xdf, 0x4e, 0xad, 0x66, 0x6c, 0xed, 0xd6, 0x6b, 0x58, 0x8f, + 0xa1, 0x59, 0x40, 0xbb, 0xb5, 0x8d, 0xed, 0x2d, 0xbc, 0x82, 0x9f, 0x1a, 0xb8, 0xb6, 0xf6, 0x10, + 0xd7, 0x56, 0x77, 0xf5, 0x38, 0xa7, 0xf7, 0x45, 0x0c, 0xe8, 0x09, 0x6e, 0x52, 0xa5, 0xfa, 0x23, + 0x26, 0x2d, 0xbb, 0x30, 0x13, 0x75, 0xc9, 0x8e, 0xae, 0x43, 0x92, 0x87, 0x47, 0xd7, 0x17, 0xa6, + 0xcc, 0x57, 0x73, 0x5c, 0x8b, 0xa9, 0x9b, 0x93, 0xfa, 0x17, 0x89, 0x05, 0x0b, 0xab, 0x35, 0x74, + 0x0b, 0x12, 0x7b, 0xae, 0xd5, 0x53, 0xe1, 0x72, 0x29, 0xa2, 0x6b, 0x5d, 0x33, 0x99, 0xb9, 0x23, + 0x42, 0x17, 0x0b, 0x68, 0x79, 0x19, 0x32, 0xfd, 0x0f, 0x03, 0xe8, 0x55, 0xc8, 0xf0, 0xa0, 0x17, + 0x21, 0x35, 0x9a, 0x6b, 0x06, 0x6b, 0xe5, 0x5f, 0x6b, 0x50, 0x08, 0x7f, 0x05, 0x44, 0xff, 0x03, + 0x29, 0x8f, 0x47, 0x16, 0x0d, 0x38, 0xe5, 0x11, 0x29, 0x37, 0xce, 0x47, 0x69, 0x1c, 0x2c, 0xf6, + 0x53, 0x59, 0x2c, 0x3a, 0x95, 0xbd, 0x01, 0x49, 0x79, 0xa1, 0xa2, 0xfc, 0x2c, 0xf2, 0xbe, 0x49, + 0x15, 0x39, 0x81, 0xc3, 0x0a, 0x5f, 0xfe, 0x32, 0x03, 0x99, 0xfe, 0x68, 0x82, 0xee, 0xc1, 0xa4, + 0xcf, 0xcc, 0x26, 0x51, 0xe5, 0xe9, 0x74, 0x41, 0x5e, 0x04, 0x2c, 0xb9, 0xb8, 0xef, 0x58, 0xb6, + 0x6f, 0xee, 0xb5, 0x43, 0xe5, 0x50, 0x91, 0x1e, 0x93, 0x1e, 0x7a, 0x04, 0x29, 0x79, 0x6b, 0x1e, + 0x7c, 0xc1, 0xbd, 0x7e, 0xe2, 0x18, 0x56, 0x91, 0x76, 0x0c, 0x7f, 0x0c, 0x56, 0x02, 0x4a, 0xbf, + 0x4f, 0x43, 0x52, 0xd9, 0xf9, 0x19, 0x14, 0x54, 0xaa, 0x1d, 0x2e, 0xd9, 0xd9, 0xe8, 0x2f, 0xbc, + 0x47, 0xa5, 0x57, 0xa4, 0x65, 0x07, 0xd7, 0x15, 0x79, 0x7f, 0x98, 0x80, 0x7e, 0x0a, 0xe7, 0x2c, + 0xe2, 0x33, 0xdb, 0x11, 0x46, 0xec, 0xef, 0x20, 0xbd, 0xe5, 0xce, 0xa9, 0x76, 0x58, 0x1b, 0xf0, + 0x0f, 0xb6, 0x41, 0xd6, 0x08, 0x15, 0xfd, 0x04, 0xa6, 0x8e, 0x4c, 0xc2, 0x2a, 0xdd, 0xde, 0x3e, + 0xd5, 0x3e, 0x38, 0x34, 0xfd, 0xd6, 0x27, 0x70, 0x21, 0x3c, 0x0f, 0x73, 0x45, 0xf1, 0xf1, 0x89, + 0x11, 0x3e, 0xa6, 0x51, 0xe2, 0xfb, 0xaa, 0xa1, 0x5d, 0x3a, 0xa5, 0x78, 0xce, 0xba, 0x22, 0x39, + 0xb9, 0xa2, 0xe8, 0x30, 0x01, 0x61, 0xc8, 0x36, 0x89, 0x43, 0xa8, 0xdd, 0x10, 0xd6, 0x97, 0x37, + 0x9f, 0x8b, 0xa7, 0x92, 0xfc, 0x40, 0xf2, 0x3d, 0x26, 0xbd, 0xfa, 0x04, 0x86, 0x66, 0xff, 0x09, + 0x11, 0x40, 0xaa, 0xf0, 0x8b, 0x9b, 0x60, 0x75, 0x59, 0x24, 0xaf, 0xe9, 0xbe, 0x77, 0x2a, 0xd1, + 0x43, 0x13, 0xa7, 0xb8, 0x37, 0xaa, 0x4f, 0x60, 0xbd, 0x75, 0x84, 0x56, 0x9a, 0x82, 0x7c, 0xc8, + 0x0b, 0x4a, 0x33, 0x80, 0x46, 0x8d, 0x56, 0x72, 0x78, 0xcd, 0x08, 0x29, 0xf4, 0x0c, 0x8d, 0x09, + 0x7a, 0x1d, 0x0a, 0x16, 0xf1, 0x1b, 0xd4, 0xf6, 0x98, 0x4b, 0x07, 0x01, 0x32, 0x0c, 0xcf, 0x0f, + 0x00, 0xbc, 0x7b, 0x9c, 0xe2, 0x1d, 0xf6, 0x90, 0x8a, 0x4b, 0x55, 0x80, 0x81, 0xaa, 0xd0, 0x32, + 0xe8, 0x43, 0x02, 0xe5, 0x85, 0xfa, 0xc8, 0x09, 0xa6, 0x06, 0x10, 0xf1, 0xc2, 0xa5, 0xcf, 0x35, + 0xd0, 0x8f, 0x2a, 0xe5, 0x3f, 0x13, 0x85, 0xee, 0x41, 0x8e, 0x1c, 0x7a, 0xbc, 0x3b, 0x90, 0x76, + 0x89, 0x8d, 0xbd, 0x0f, 0xc9, 0x4a, 0xbc, 0xdc, 0xf4, 0xc1, 0xe0, 0xaa, 0x3b, 0x7e, 0xca, 0xab, + 0xee, 0x70, 0x2a, 0x50, 0xdc, 0xbc, 0x9b, 0x92, 0x59, 0x61, 0xf4, 0x8a, 0xfa, 0xe3, 0x38, 0xe4, + 0x43, 0x12, 0xc6, 0x75, 0x85, 0x57, 0x21, 0x4b, 0x0e, 0xcd, 0xfe, 0x2b, 0x25, 0x54, 0x95, 0x04, + 0x41, 0x94, 0xe7, 0x7e, 0x0d, 0xb2, 0xe2, 0xba, 0x56, 0x41, 0x26, 0x23, 0xbe, 0x25, 0x80, 0x00, + 0x48, 0xf8, 0x9b, 0x90, 0x15, 0x7f, 0xa6, 0x13, 0x72, 0xde, 0x59, 0xf5, 0xaa, 0xac, 0xe7, 0x91, + 0xca, 0x43, 0x87, 0x7d, 0x7f, 0x19, 0x73, 0x8c, 0x60, 0xe5, 0x3f, 0x82, 0x3b, 0x4e, 0x5e, 0x9d, + 0x7d, 0xe2, 0x04, 0xc7, 0x49, 0xf1, 0x72, 0x2c, 0xba, 0x0d, 0x49, 0x96, 0xb0, 0xab, 0x90, 0xb3, + 0x9d, 0x7d, 0x42, 0x03, 0x54, 0x5a, 0x14, 0xed, 0xac, 0xa4, 0x49, 0x48, 0x05, 0x72, 0xaa, 0xfe, + 0x4b, 0x48, 0x66, 0xf4, 0xde, 0x37, 0x2b, 0x01, 0x7d, 0xbc, 0xdf, 0x7d, 0x3e, 0xc0, 0x43, 0x04, + 0x5e, 0x02, 0xe4, 0x9f, 0x06, 0xf0, 0x7e, 0x4b, 0x06, 0x82, 0xc0, 0x87, 0xfa, 0xad, 0x98, 0x1e, + 0x7f, 0x94, 0x48, 0xc7, 0xf5, 0x44, 0xf9, 0x67, 0x1a, 0x9c, 0x8f, 0xfc, 0xe8, 0x80, 0xe6, 0x43, + 0x56, 0x09, 0x57, 0x41, 0x69, 0x98, 0x99, 0xe0, 0x9b, 0x91, 0x6c, 0xbe, 0xe5, 0x03, 0x7a, 0x3d, + 0xf8, 0xa2, 0x33, 0xfe, 0x23, 0x8d, 0x04, 0x56, 0x4b, 0x7f, 0x78, 0x79, 0x59, 0xfb, 0xec, 0xe5, + 0x65, 0xed, 0xf3, 0x97, 0x97, 0xb5, 0xaf, 0x5e, 0x5e, 0xd6, 0xde, 0x97, 0x7f, 0x8d, 0xf0, 0x0b, + 0x4d, 0xdb, 0x4b, 0x0a, 0xb6, 0xdb, 0xff, 0x0e, 0x00, 0x00, 0xff, 0xff, 0x2e, 0x68, 0xb4, 0x6c, + 0xb5, 0x25, 0x00, 0x00, +} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/route/route.pb.validate.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/route/route.pb.validate.go new file mode 100644 index 000000000000..920044ded162 --- /dev/null +++ b/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/route/route.pb.validate.go @@ -0,0 +1,2470 @@ +// Code generated by protoc-gen-validate +// source: envoy/api/v2/route/route.proto +// DO NOT EDIT!!! + +package route + +import ( + "bytes" + "errors" + "fmt" + "net" + "net/mail" + "net/url" + "regexp" + "strings" + "time" + "unicode/utf8" + + "github.com/gogo/protobuf/types" +) + +// ensure the imports are used +var ( + _ = bytes.MinRead + _ = errors.New("") + _ = fmt.Print + _ = utf8.UTFMax + _ = (*regexp.Regexp)(nil) + _ = (*strings.Reader)(nil) + _ = net.IPv4len + _ = time.Duration(0) + _ = (*url.URL)(nil) + _ = (*mail.Address)(nil) + _ = types.DynamicAny{} +) + +// Validate checks the field values on VirtualHost with the rules defined in +// the proto definition for this message. If any rules are violated, an error +// is returned. +func (m *VirtualHost) Validate() error { + if m == nil { + return nil + } + + if len(m.GetName()) < 1 { + return VirtualHostValidationError{ + Field: "Name", + Reason: "value length must be at least 1 bytes", + } + } + + if len(m.GetDomains()) < 1 { + return VirtualHostValidationError{ + Field: "Domains", + Reason: "value must contain at least 1 item(s)", + } + } + + for idx, item := range m.GetRoutes() { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return VirtualHostValidationError{ + Field: fmt.Sprintf("Routes[%v]", idx), + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + } + + // no validation rules for RequireTls + + for idx, item := range m.GetVirtualClusters() { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return VirtualHostValidationError{ + Field: fmt.Sprintf("VirtualClusters[%v]", idx), + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + } + + for idx, item := range m.GetRateLimits() { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return VirtualHostValidationError{ + Field: fmt.Sprintf("RateLimits[%v]", idx), + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + } + + for idx, item := range m.GetRequestHeadersToAdd() { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return VirtualHostValidationError{ + Field: fmt.Sprintf("RequestHeadersToAdd[%v]", idx), + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + } + + for idx, item := range m.GetResponseHeadersToAdd() { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return VirtualHostValidationError{ + Field: fmt.Sprintf("ResponseHeadersToAdd[%v]", idx), + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + } + + if v, ok := interface{}(m.GetCors()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return VirtualHostValidationError{ + Field: "Cors", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + // no validation rules for PerFilterConfig + + return nil +} + +// VirtualHostValidationError is the validation error returned by +// VirtualHost.Validate if the designated constraints aren't met. +type VirtualHostValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e VirtualHostValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sVirtualHost.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = VirtualHostValidationError{} + +// Validate checks the field values on Route with the rules defined in the +// proto definition for this message. If any rules are violated, an error is returned. +func (m *Route) Validate() error { + if m == nil { + return nil + } + + if v, ok := interface{}(m.GetMatch()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return RouteValidationError{ + Field: "Match", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + if v, ok := interface{}(m.GetMetadata()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return RouteValidationError{ + Field: "Metadata", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + if v, ok := interface{}(m.GetDecorator()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return RouteValidationError{ + Field: "Decorator", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + // no validation rules for PerFilterConfig + + for idx, item := range m.GetRequestHeadersToAdd() { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return RouteValidationError{ + Field: fmt.Sprintf("RequestHeadersToAdd[%v]", idx), + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + } + + for idx, item := range m.GetResponseHeadersToAdd() { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return RouteValidationError{ + Field: fmt.Sprintf("ResponseHeadersToAdd[%v]", idx), + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + } + + switch m.Action.(type) { + + case *Route_Route: + + if v, ok := interface{}(m.GetRoute()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return RouteValidationError{ + Field: "Route", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + case *Route_Redirect: + + if v, ok := interface{}(m.GetRedirect()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return RouteValidationError{ + Field: "Redirect", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + case *Route_DirectResponse: + + if v, ok := interface{}(m.GetDirectResponse()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return RouteValidationError{ + Field: "DirectResponse", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + default: + return RouteValidationError{ + Field: "Action", + Reason: "value is required", + } + + } + + return nil +} + +// RouteValidationError is the validation error returned by Route.Validate if +// the designated constraints aren't met. +type RouteValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e RouteValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sRoute.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = RouteValidationError{} + +// Validate checks the field values on WeightedCluster with the rules defined +// in the proto definition for this message. If any rules are violated, an +// error is returned. +func (m *WeightedCluster) Validate() error { + if m == nil { + return nil + } + + if len(m.GetClusters()) < 1 { + return WeightedClusterValidationError{ + Field: "Clusters", + Reason: "value must contain at least 1 item(s)", + } + } + + for idx, item := range m.GetClusters() { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return WeightedClusterValidationError{ + Field: fmt.Sprintf("Clusters[%v]", idx), + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + } + + if wrapper := m.GetTotalWeight(); wrapper != nil { + + if wrapper.GetValue() < 1 { + return WeightedClusterValidationError{ + Field: "TotalWeight", + Reason: "value must be greater than or equal to 1", + } + } + + } + + // no validation rules for RuntimeKeyPrefix + + return nil +} + +// WeightedClusterValidationError is the validation error returned by +// WeightedCluster.Validate if the designated constraints aren't met. +type WeightedClusterValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e WeightedClusterValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sWeightedCluster.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = WeightedClusterValidationError{} + +// Validate checks the field values on RouteMatch with the rules defined in the +// proto definition for this message. If any rules are violated, an error is returned. +func (m *RouteMatch) Validate() error { + if m == nil { + return nil + } + + if v, ok := interface{}(m.GetCaseSensitive()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return RouteMatchValidationError{ + Field: "CaseSensitive", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + if v, ok := interface{}(m.GetRuntime()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return RouteMatchValidationError{ + Field: "Runtime", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + for idx, item := range m.GetHeaders() { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return RouteMatchValidationError{ + Field: fmt.Sprintf("Headers[%v]", idx), + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + } + + for idx, item := range m.GetQueryParameters() { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return RouteMatchValidationError{ + Field: fmt.Sprintf("QueryParameters[%v]", idx), + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + } + + switch m.PathSpecifier.(type) { + + case *RouteMatch_Prefix: + // no validation rules for Prefix + + case *RouteMatch_Path: + // no validation rules for Path + + case *RouteMatch_Regex: + + if len(m.GetRegex()) > 1024 { + return RouteMatchValidationError{ + Field: "Regex", + Reason: "value length must be at most 1024 bytes", + } + } + + default: + return RouteMatchValidationError{ + Field: "PathSpecifier", + Reason: "value is required", + } + + } + + return nil +} + +// RouteMatchValidationError is the validation error returned by +// RouteMatch.Validate if the designated constraints aren't met. +type RouteMatchValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e RouteMatchValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sRouteMatch.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = RouteMatchValidationError{} + +// Validate checks the field values on CorsPolicy with the rules defined in the +// proto definition for this message. If any rules are violated, an error is returned. +func (m *CorsPolicy) Validate() error { + if m == nil { + return nil + } + + for idx, item := range m.GetAllowOriginRegex() { + _, _ = idx, item + + if len(item) > 1024 { + return CorsPolicyValidationError{ + Field: fmt.Sprintf("AllowOriginRegex[%v]", idx), + Reason: "value length must be at most 1024 bytes", + } + } + + } + + // no validation rules for AllowMethods + + // no validation rules for AllowHeaders + + // no validation rules for ExposeHeaders + + // no validation rules for MaxAge + + if v, ok := interface{}(m.GetAllowCredentials()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return CorsPolicyValidationError{ + Field: "AllowCredentials", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + if v, ok := interface{}(m.GetEnabled()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return CorsPolicyValidationError{ + Field: "Enabled", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + return nil +} + +// CorsPolicyValidationError is the validation error returned by +// CorsPolicy.Validate if the designated constraints aren't met. +type CorsPolicyValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e CorsPolicyValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sCorsPolicy.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = CorsPolicyValidationError{} + +// Validate checks the field values on RouteAction with the rules defined in +// the proto definition for this message. If any rules are violated, an error +// is returned. +func (m *RouteAction) Validate() error { + if m == nil { + return nil + } + + if _, ok := RouteAction_ClusterNotFoundResponseCode_name[int32(m.GetClusterNotFoundResponseCode())]; !ok { + return RouteActionValidationError{ + Field: "ClusterNotFoundResponseCode", + Reason: "value must be one of the defined enum values", + } + } + + if v, ok := interface{}(m.GetMetadataMatch()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return RouteActionValidationError{ + Field: "MetadataMatch", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + // no validation rules for PrefixRewrite + + if v, ok := interface{}(m.GetTimeout()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return RouteActionValidationError{ + Field: "Timeout", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + if d := m.GetIdleTimeout(); d != nil { + dur := *d + + gt := time.Duration(0*time.Second + 0*time.Nanosecond) + + if dur <= gt { + return RouteActionValidationError{ + Field: "IdleTimeout", + Reason: "value must be greater than 0s", + } + } + + } + + if v, ok := interface{}(m.GetRetryPolicy()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return RouteActionValidationError{ + Field: "RetryPolicy", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + if v, ok := interface{}(m.GetRequestMirrorPolicy()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return RouteActionValidationError{ + Field: "RequestMirrorPolicy", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + // no validation rules for Priority + + for idx, item := range m.GetRequestHeadersToAdd() { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return RouteActionValidationError{ + Field: fmt.Sprintf("RequestHeadersToAdd[%v]", idx), + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + } + + for idx, item := range m.GetResponseHeadersToAdd() { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return RouteActionValidationError{ + Field: fmt.Sprintf("ResponseHeadersToAdd[%v]", idx), + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + } + + for idx, item := range m.GetRateLimits() { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return RouteActionValidationError{ + Field: fmt.Sprintf("RateLimits[%v]", idx), + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + } + + if v, ok := interface{}(m.GetIncludeVhRateLimits()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return RouteActionValidationError{ + Field: "IncludeVhRateLimits", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + for idx, item := range m.GetHashPolicy() { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return RouteActionValidationError{ + Field: fmt.Sprintf("HashPolicy[%v]", idx), + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + } + + if v, ok := interface{}(m.GetUseWebsocket()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return RouteActionValidationError{ + Field: "UseWebsocket", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + if v, ok := interface{}(m.GetWebsocketConfig()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return RouteActionValidationError{ + Field: "WebsocketConfig", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + if v, ok := interface{}(m.GetCors()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return RouteActionValidationError{ + Field: "Cors", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + if v, ok := interface{}(m.GetMaxGrpcTimeout()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return RouteActionValidationError{ + Field: "MaxGrpcTimeout", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + switch m.ClusterSpecifier.(type) { + + case *RouteAction_Cluster: + + if len(m.GetCluster()) < 1 { + return RouteActionValidationError{ + Field: "Cluster", + Reason: "value length must be at least 1 bytes", + } + } + + case *RouteAction_ClusterHeader: + + if len(m.GetClusterHeader()) < 1 { + return RouteActionValidationError{ + Field: "ClusterHeader", + Reason: "value length must be at least 1 bytes", + } + } + + case *RouteAction_WeightedClusters: + + if v, ok := interface{}(m.GetWeightedClusters()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return RouteActionValidationError{ + Field: "WeightedClusters", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + default: + return RouteActionValidationError{ + Field: "ClusterSpecifier", + Reason: "value is required", + } + + } + + switch m.HostRewriteSpecifier.(type) { + + case *RouteAction_HostRewrite: + // no validation rules for HostRewrite + + case *RouteAction_AutoHostRewrite: + + if v, ok := interface{}(m.GetAutoHostRewrite()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return RouteActionValidationError{ + Field: "AutoHostRewrite", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + } + + return nil +} + +// RouteActionValidationError is the validation error returned by +// RouteAction.Validate if the designated constraints aren't met. +type RouteActionValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e RouteActionValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sRouteAction.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = RouteActionValidationError{} + +// Validate checks the field values on RedirectAction with the rules defined in +// the proto definition for this message. If any rules are violated, an error +// is returned. +func (m *RedirectAction) Validate() error { + if m == nil { + return nil + } + + // no validation rules for HostRedirect + + if _, ok := RedirectAction_RedirectResponseCode_name[int32(m.GetResponseCode())]; !ok { + return RedirectActionValidationError{ + Field: "ResponseCode", + Reason: "value must be one of the defined enum values", + } + } + + // no validation rules for HttpsRedirect + + // no validation rules for StripQuery + + switch m.PathRewriteSpecifier.(type) { + + case *RedirectAction_PathRedirect: + // no validation rules for PathRedirect + + case *RedirectAction_PrefixRewrite: + // no validation rules for PrefixRewrite + + } + + return nil +} + +// RedirectActionValidationError is the validation error returned by +// RedirectAction.Validate if the designated constraints aren't met. +type RedirectActionValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e RedirectActionValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sRedirectAction.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = RedirectActionValidationError{} + +// Validate checks the field values on DirectResponseAction with the rules +// defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *DirectResponseAction) Validate() error { + if m == nil { + return nil + } + + if val := m.GetStatus(); val < 100 || val >= 600 { + return DirectResponseActionValidationError{ + Field: "Status", + Reason: "value must be inside range [100, 600)", + } + } + + if v, ok := interface{}(m.GetBody()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return DirectResponseActionValidationError{ + Field: "Body", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + return nil +} + +// DirectResponseActionValidationError is the validation error returned by +// DirectResponseAction.Validate if the designated constraints aren't met. +type DirectResponseActionValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e DirectResponseActionValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sDirectResponseAction.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = DirectResponseActionValidationError{} + +// Validate checks the field values on Decorator with the rules defined in the +// proto definition for this message. If any rules are violated, an error is returned. +func (m *Decorator) Validate() error { + if m == nil { + return nil + } + + if len(m.GetOperation()) < 1 { + return DecoratorValidationError{ + Field: "Operation", + Reason: "value length must be at least 1 bytes", + } + } + + return nil +} + +// DecoratorValidationError is the validation error returned by +// Decorator.Validate if the designated constraints aren't met. +type DecoratorValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e DecoratorValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sDecorator.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = DecoratorValidationError{} + +// Validate checks the field values on VirtualCluster with the rules defined in +// the proto definition for this message. If any rules are violated, an error +// is returned. +func (m *VirtualCluster) Validate() error { + if m == nil { + return nil + } + + if l := len(m.GetPattern()); l < 1 || l > 1024 { + return VirtualClusterValidationError{ + Field: "Pattern", + Reason: "value length must be between 1 and 1024 bytes, inclusive", + } + } + + if len(m.GetName()) < 1 { + return VirtualClusterValidationError{ + Field: "Name", + Reason: "value length must be at least 1 bytes", + } + } + + // no validation rules for Method + + return nil +} + +// VirtualClusterValidationError is the validation error returned by +// VirtualCluster.Validate if the designated constraints aren't met. +type VirtualClusterValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e VirtualClusterValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sVirtualCluster.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = VirtualClusterValidationError{} + +// Validate checks the field values on RateLimit with the rules defined in the +// proto definition for this message. If any rules are violated, an error is returned. +func (m *RateLimit) Validate() error { + if m == nil { + return nil + } + + if wrapper := m.GetStage(); wrapper != nil { + + if wrapper.GetValue() > 10 { + return RateLimitValidationError{ + Field: "Stage", + Reason: "value must be less than or equal to 10", + } + } + + } + + // no validation rules for DisableKey + + if len(m.GetActions()) < 1 { + return RateLimitValidationError{ + Field: "Actions", + Reason: "value must contain at least 1 item(s)", + } + } + + for idx, item := range m.GetActions() { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return RateLimitValidationError{ + Field: fmt.Sprintf("Actions[%v]", idx), + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + } + + return nil +} + +// RateLimitValidationError is the validation error returned by +// RateLimit.Validate if the designated constraints aren't met. +type RateLimitValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e RateLimitValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sRateLimit.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = RateLimitValidationError{} + +// Validate checks the field values on HeaderMatcher with the rules defined in +// the proto definition for this message. If any rules are violated, an error +// is returned. +func (m *HeaderMatcher) Validate() error { + if m == nil { + return nil + } + + if len(m.GetName()) < 1 { + return HeaderMatcherValidationError{ + Field: "Name", + Reason: "value length must be at least 1 bytes", + } + } + + // no validation rules for InvertMatch + + switch m.HeaderMatchSpecifier.(type) { + + case *HeaderMatcher_ExactMatch: + // no validation rules for ExactMatch + + case *HeaderMatcher_RegexMatch: + + if len(m.GetRegexMatch()) > 1024 { + return HeaderMatcherValidationError{ + Field: "RegexMatch", + Reason: "value length must be at most 1024 bytes", + } + } + + case *HeaderMatcher_RangeMatch: + + if v, ok := interface{}(m.GetRangeMatch()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return HeaderMatcherValidationError{ + Field: "RangeMatch", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + case *HeaderMatcher_PresentMatch: + // no validation rules for PresentMatch + + case *HeaderMatcher_PrefixMatch: + + if len(m.GetPrefixMatch()) < 1 { + return HeaderMatcherValidationError{ + Field: "PrefixMatch", + Reason: "value length must be at least 1 bytes", + } + } + + case *HeaderMatcher_SuffixMatch: + + if len(m.GetSuffixMatch()) < 1 { + return HeaderMatcherValidationError{ + Field: "SuffixMatch", + Reason: "value length must be at least 1 bytes", + } + } + + } + + return nil +} + +// HeaderMatcherValidationError is the validation error returned by +// HeaderMatcher.Validate if the designated constraints aren't met. +type HeaderMatcherValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e HeaderMatcherValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sHeaderMatcher.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = HeaderMatcherValidationError{} + +// Validate checks the field values on QueryParameterMatcher with the rules +// defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *QueryParameterMatcher) Validate() error { + if m == nil { + return nil + } + + if l := len(m.GetName()); l < 1 || l > 1024 { + return QueryParameterMatcherValidationError{ + Field: "Name", + Reason: "value length must be between 1 and 1024 bytes, inclusive", + } + } + + // no validation rules for Value + + if v, ok := interface{}(m.GetRegex()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return QueryParameterMatcherValidationError{ + Field: "Regex", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + return nil +} + +// QueryParameterMatcherValidationError is the validation error returned by +// QueryParameterMatcher.Validate if the designated constraints aren't met. +type QueryParameterMatcherValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e QueryParameterMatcherValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sQueryParameterMatcher.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = QueryParameterMatcherValidationError{} + +// Validate checks the field values on WeightedCluster_ClusterWeight with the +// rules defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *WeightedCluster_ClusterWeight) Validate() error { + if m == nil { + return nil + } + + if len(m.GetName()) < 1 { + return WeightedCluster_ClusterWeightValidationError{ + Field: "Name", + Reason: "value length must be at least 1 bytes", + } + } + + if v, ok := interface{}(m.GetWeight()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return WeightedCluster_ClusterWeightValidationError{ + Field: "Weight", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + if v, ok := interface{}(m.GetMetadataMatch()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return WeightedCluster_ClusterWeightValidationError{ + Field: "MetadataMatch", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + for idx, item := range m.GetRequestHeadersToAdd() { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return WeightedCluster_ClusterWeightValidationError{ + Field: fmt.Sprintf("RequestHeadersToAdd[%v]", idx), + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + } + + for idx, item := range m.GetResponseHeadersToAdd() { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return WeightedCluster_ClusterWeightValidationError{ + Field: fmt.Sprintf("ResponseHeadersToAdd[%v]", idx), + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + } + + // no validation rules for PerFilterConfig + + return nil +} + +// WeightedCluster_ClusterWeightValidationError is the validation error +// returned by WeightedCluster_ClusterWeight.Validate if the designated +// constraints aren't met. +type WeightedCluster_ClusterWeightValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e WeightedCluster_ClusterWeightValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sWeightedCluster_ClusterWeight.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = WeightedCluster_ClusterWeightValidationError{} + +// Validate checks the field values on RouteAction_RetryPolicy with the rules +// defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *RouteAction_RetryPolicy) Validate() error { + if m == nil { + return nil + } + + // no validation rules for RetryOn + + if v, ok := interface{}(m.GetNumRetries()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return RouteAction_RetryPolicyValidationError{ + Field: "NumRetries", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + if v, ok := interface{}(m.GetPerTryTimeout()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return RouteAction_RetryPolicyValidationError{ + Field: "PerTryTimeout", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + if v, ok := interface{}(m.GetRetryPriority()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return RouteAction_RetryPolicyValidationError{ + Field: "RetryPriority", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + for idx, item := range m.GetRetryHostPredicate() { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return RouteAction_RetryPolicyValidationError{ + Field: fmt.Sprintf("RetryHostPredicate[%v]", idx), + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + } + + // no validation rules for HostSelectionRetryMaxAttempts + + return nil +} + +// RouteAction_RetryPolicyValidationError is the validation error returned by +// RouteAction_RetryPolicy.Validate if the designated constraints aren't met. +type RouteAction_RetryPolicyValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e RouteAction_RetryPolicyValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sRouteAction_RetryPolicy.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = RouteAction_RetryPolicyValidationError{} + +// Validate checks the field values on RouteAction_RequestMirrorPolicy with the +// rules defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *RouteAction_RequestMirrorPolicy) Validate() error { + if m == nil { + return nil + } + + if len(m.GetCluster()) < 1 { + return RouteAction_RequestMirrorPolicyValidationError{ + Field: "Cluster", + Reason: "value length must be at least 1 bytes", + } + } + + // no validation rules for RuntimeKey + + return nil +} + +// RouteAction_RequestMirrorPolicyValidationError is the validation error +// returned by RouteAction_RequestMirrorPolicy.Validate if the designated +// constraints aren't met. +type RouteAction_RequestMirrorPolicyValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e RouteAction_RequestMirrorPolicyValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sRouteAction_RequestMirrorPolicy.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = RouteAction_RequestMirrorPolicyValidationError{} + +// Validate checks the field values on RouteAction_HashPolicy with the rules +// defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *RouteAction_HashPolicy) Validate() error { + if m == nil { + return nil + } + + // no validation rules for Terminal + + switch m.PolicySpecifier.(type) { + + case *RouteAction_HashPolicy_Header_: + + if v, ok := interface{}(m.GetHeader()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return RouteAction_HashPolicyValidationError{ + Field: "Header", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + case *RouteAction_HashPolicy_Cookie_: + + if v, ok := interface{}(m.GetCookie()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return RouteAction_HashPolicyValidationError{ + Field: "Cookie", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + case *RouteAction_HashPolicy_ConnectionProperties_: + + if v, ok := interface{}(m.GetConnectionProperties()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return RouteAction_HashPolicyValidationError{ + Field: "ConnectionProperties", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + default: + return RouteAction_HashPolicyValidationError{ + Field: "PolicySpecifier", + Reason: "value is required", + } + + } + + return nil +} + +// RouteAction_HashPolicyValidationError is the validation error returned by +// RouteAction_HashPolicy.Validate if the designated constraints aren't met. +type RouteAction_HashPolicyValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e RouteAction_HashPolicyValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sRouteAction_HashPolicy.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = RouteAction_HashPolicyValidationError{} + +// Validate checks the field values on RouteAction_WebSocketProxyConfig with +// the rules defined in the proto definition for this message. If any rules +// are violated, an error is returned. +func (m *RouteAction_WebSocketProxyConfig) Validate() error { + if m == nil { + return nil + } + + // no validation rules for StatPrefix + + if d := m.GetIdleTimeout(); d != nil { + dur := *d + + gt := time.Duration(0*time.Second + 0*time.Nanosecond) + + if dur <= gt { + return RouteAction_WebSocketProxyConfigValidationError{ + Field: "IdleTimeout", + Reason: "value must be greater than 0s", + } + } + + } + + if wrapper := m.GetMaxConnectAttempts(); wrapper != nil { + + if wrapper.GetValue() < 1 { + return RouteAction_WebSocketProxyConfigValidationError{ + Field: "MaxConnectAttempts", + Reason: "value must be greater than or equal to 1", + } + } + + } + + return nil +} + +// RouteAction_WebSocketProxyConfigValidationError is the validation error +// returned by RouteAction_WebSocketProxyConfig.Validate if the designated +// constraints aren't met. +type RouteAction_WebSocketProxyConfigValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e RouteAction_WebSocketProxyConfigValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sRouteAction_WebSocketProxyConfig.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = RouteAction_WebSocketProxyConfigValidationError{} + +// Validate checks the field values on RouteAction_RetryPolicy_RetryPriority +// with the rules defined in the proto definition for this message. If any +// rules are violated, an error is returned. +func (m *RouteAction_RetryPolicy_RetryPriority) Validate() error { + if m == nil { + return nil + } + + if len(m.GetName()) < 1 { + return RouteAction_RetryPolicy_RetryPriorityValidationError{ + Field: "Name", + Reason: "value length must be at least 1 bytes", + } + } + + if v, ok := interface{}(m.GetConfig()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return RouteAction_RetryPolicy_RetryPriorityValidationError{ + Field: "Config", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + return nil +} + +// RouteAction_RetryPolicy_RetryPriorityValidationError is the validation error +// returned by RouteAction_RetryPolicy_RetryPriority.Validate if the +// designated constraints aren't met. +type RouteAction_RetryPolicy_RetryPriorityValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e RouteAction_RetryPolicy_RetryPriorityValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sRouteAction_RetryPolicy_RetryPriority.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = RouteAction_RetryPolicy_RetryPriorityValidationError{} + +// Validate checks the field values on +// RouteAction_RetryPolicy_RetryHostPredicate with the rules defined in the +// proto definition for this message. If any rules are violated, an error is returned. +func (m *RouteAction_RetryPolicy_RetryHostPredicate) Validate() error { + if m == nil { + return nil + } + + if len(m.GetName()) < 1 { + return RouteAction_RetryPolicy_RetryHostPredicateValidationError{ + Field: "Name", + Reason: "value length must be at least 1 bytes", + } + } + + if v, ok := interface{}(m.GetConfig()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return RouteAction_RetryPolicy_RetryHostPredicateValidationError{ + Field: "Config", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + return nil +} + +// RouteAction_RetryPolicy_RetryHostPredicateValidationError is the validation +// error returned by RouteAction_RetryPolicy_RetryHostPredicate.Validate if +// the designated constraints aren't met. +type RouteAction_RetryPolicy_RetryHostPredicateValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e RouteAction_RetryPolicy_RetryHostPredicateValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sRouteAction_RetryPolicy_RetryHostPredicate.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = RouteAction_RetryPolicy_RetryHostPredicateValidationError{} + +// Validate checks the field values on RouteAction_HashPolicy_Header with the +// rules defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *RouteAction_HashPolicy_Header) Validate() error { + if m == nil { + return nil + } + + if len(m.GetHeaderName()) < 1 { + return RouteAction_HashPolicy_HeaderValidationError{ + Field: "HeaderName", + Reason: "value length must be at least 1 bytes", + } + } + + return nil +} + +// RouteAction_HashPolicy_HeaderValidationError is the validation error +// returned by RouteAction_HashPolicy_Header.Validate if the designated +// constraints aren't met. +type RouteAction_HashPolicy_HeaderValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e RouteAction_HashPolicy_HeaderValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sRouteAction_HashPolicy_Header.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = RouteAction_HashPolicy_HeaderValidationError{} + +// Validate checks the field values on RouteAction_HashPolicy_Cookie with the +// rules defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *RouteAction_HashPolicy_Cookie) Validate() error { + if m == nil { + return nil + } + + if len(m.GetName()) < 1 { + return RouteAction_HashPolicy_CookieValidationError{ + Field: "Name", + Reason: "value length must be at least 1 bytes", + } + } + + if v, ok := interface{}(m.GetTtl()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return RouteAction_HashPolicy_CookieValidationError{ + Field: "Ttl", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + // no validation rules for Path + + return nil +} + +// RouteAction_HashPolicy_CookieValidationError is the validation error +// returned by RouteAction_HashPolicy_Cookie.Validate if the designated +// constraints aren't met. +type RouteAction_HashPolicy_CookieValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e RouteAction_HashPolicy_CookieValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sRouteAction_HashPolicy_Cookie.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = RouteAction_HashPolicy_CookieValidationError{} + +// Validate checks the field values on +// RouteAction_HashPolicy_ConnectionProperties with the rules defined in the +// proto definition for this message. If any rules are violated, an error is returned. +func (m *RouteAction_HashPolicy_ConnectionProperties) Validate() error { + if m == nil { + return nil + } + + // no validation rules for SourceIp + + return nil +} + +// RouteAction_HashPolicy_ConnectionPropertiesValidationError is the validation +// error returned by RouteAction_HashPolicy_ConnectionProperties.Validate if +// the designated constraints aren't met. +type RouteAction_HashPolicy_ConnectionPropertiesValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e RouteAction_HashPolicy_ConnectionPropertiesValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sRouteAction_HashPolicy_ConnectionProperties.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = RouteAction_HashPolicy_ConnectionPropertiesValidationError{} + +// Validate checks the field values on RateLimit_Action with the rules defined +// in the proto definition for this message. If any rules are violated, an +// error is returned. +func (m *RateLimit_Action) Validate() error { + if m == nil { + return nil + } + + switch m.ActionSpecifier.(type) { + + case *RateLimit_Action_SourceCluster_: + + if v, ok := interface{}(m.GetSourceCluster()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return RateLimit_ActionValidationError{ + Field: "SourceCluster", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + case *RateLimit_Action_DestinationCluster_: + + if v, ok := interface{}(m.GetDestinationCluster()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return RateLimit_ActionValidationError{ + Field: "DestinationCluster", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + case *RateLimit_Action_RequestHeaders_: + + if v, ok := interface{}(m.GetRequestHeaders()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return RateLimit_ActionValidationError{ + Field: "RequestHeaders", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + case *RateLimit_Action_RemoteAddress_: + + if v, ok := interface{}(m.GetRemoteAddress()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return RateLimit_ActionValidationError{ + Field: "RemoteAddress", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + case *RateLimit_Action_GenericKey_: + + if v, ok := interface{}(m.GetGenericKey()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return RateLimit_ActionValidationError{ + Field: "GenericKey", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + case *RateLimit_Action_HeaderValueMatch_: + + if v, ok := interface{}(m.GetHeaderValueMatch()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return RateLimit_ActionValidationError{ + Field: "HeaderValueMatch", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + default: + return RateLimit_ActionValidationError{ + Field: "ActionSpecifier", + Reason: "value is required", + } + + } + + return nil +} + +// RateLimit_ActionValidationError is the validation error returned by +// RateLimit_Action.Validate if the designated constraints aren't met. +type RateLimit_ActionValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e RateLimit_ActionValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sRateLimit_Action.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = RateLimit_ActionValidationError{} + +// Validate checks the field values on RateLimit_Action_SourceCluster with the +// rules defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *RateLimit_Action_SourceCluster) Validate() error { + if m == nil { + return nil + } + + return nil +} + +// RateLimit_Action_SourceClusterValidationError is the validation error +// returned by RateLimit_Action_SourceCluster.Validate if the designated +// constraints aren't met. +type RateLimit_Action_SourceClusterValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e RateLimit_Action_SourceClusterValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sRateLimit_Action_SourceCluster.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = RateLimit_Action_SourceClusterValidationError{} + +// Validate checks the field values on RateLimit_Action_DestinationCluster with +// the rules defined in the proto definition for this message. If any rules +// are violated, an error is returned. +func (m *RateLimit_Action_DestinationCluster) Validate() error { + if m == nil { + return nil + } + + return nil +} + +// RateLimit_Action_DestinationClusterValidationError is the validation error +// returned by RateLimit_Action_DestinationCluster.Validate if the designated +// constraints aren't met. +type RateLimit_Action_DestinationClusterValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e RateLimit_Action_DestinationClusterValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sRateLimit_Action_DestinationCluster.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = RateLimit_Action_DestinationClusterValidationError{} + +// Validate checks the field values on RateLimit_Action_RequestHeaders with the +// rules defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *RateLimit_Action_RequestHeaders) Validate() error { + if m == nil { + return nil + } + + if len(m.GetHeaderName()) < 1 { + return RateLimit_Action_RequestHeadersValidationError{ + Field: "HeaderName", + Reason: "value length must be at least 1 bytes", + } + } + + if len(m.GetDescriptorKey()) < 1 { + return RateLimit_Action_RequestHeadersValidationError{ + Field: "DescriptorKey", + Reason: "value length must be at least 1 bytes", + } + } + + return nil +} + +// RateLimit_Action_RequestHeadersValidationError is the validation error +// returned by RateLimit_Action_RequestHeaders.Validate if the designated +// constraints aren't met. +type RateLimit_Action_RequestHeadersValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e RateLimit_Action_RequestHeadersValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sRateLimit_Action_RequestHeaders.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = RateLimit_Action_RequestHeadersValidationError{} + +// Validate checks the field values on RateLimit_Action_RemoteAddress with the +// rules defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *RateLimit_Action_RemoteAddress) Validate() error { + if m == nil { + return nil + } + + return nil +} + +// RateLimit_Action_RemoteAddressValidationError is the validation error +// returned by RateLimit_Action_RemoteAddress.Validate if the designated +// constraints aren't met. +type RateLimit_Action_RemoteAddressValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e RateLimit_Action_RemoteAddressValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sRateLimit_Action_RemoteAddress.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = RateLimit_Action_RemoteAddressValidationError{} + +// Validate checks the field values on RateLimit_Action_GenericKey with the +// rules defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *RateLimit_Action_GenericKey) Validate() error { + if m == nil { + return nil + } + + if len(m.GetDescriptorValue()) < 1 { + return RateLimit_Action_GenericKeyValidationError{ + Field: "DescriptorValue", + Reason: "value length must be at least 1 bytes", + } + } + + return nil +} + +// RateLimit_Action_GenericKeyValidationError is the validation error returned +// by RateLimit_Action_GenericKey.Validate if the designated constraints +// aren't met. +type RateLimit_Action_GenericKeyValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e RateLimit_Action_GenericKeyValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sRateLimit_Action_GenericKey.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = RateLimit_Action_GenericKeyValidationError{} + +// Validate checks the field values on RateLimit_Action_HeaderValueMatch with +// the rules defined in the proto definition for this message. If any rules +// are violated, an error is returned. +func (m *RateLimit_Action_HeaderValueMatch) Validate() error { + if m == nil { + return nil + } + + if len(m.GetDescriptorValue()) < 1 { + return RateLimit_Action_HeaderValueMatchValidationError{ + Field: "DescriptorValue", + Reason: "value length must be at least 1 bytes", + } + } + + if v, ok := interface{}(m.GetExpectMatch()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return RateLimit_Action_HeaderValueMatchValidationError{ + Field: "ExpectMatch", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + if len(m.GetHeaders()) < 1 { + return RateLimit_Action_HeaderValueMatchValidationError{ + Field: "Headers", + Reason: "value must contain at least 1 item(s)", + } + } + + for idx, item := range m.GetHeaders() { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return RateLimit_Action_HeaderValueMatchValidationError{ + Field: fmt.Sprintf("Headers[%v]", idx), + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + } + + return nil +} + +// RateLimit_Action_HeaderValueMatchValidationError is the validation error +// returned by RateLimit_Action_HeaderValueMatch.Validate if the designated +// constraints aren't met. +type RateLimit_Action_HeaderValueMatchValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e RateLimit_Action_HeaderValueMatchValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sRateLimit_Action_HeaderValueMatch.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = RateLimit_Action_HeaderValueMatchValidationError{} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/config/filter/accesslog/v2/accesslog.pb.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/config/filter/accesslog/v2/accesslog.pb.go new file mode 100644 index 000000000000..9888935bd81d --- /dev/null +++ b/vendor/github.com/envoyproxy/go-control-plane/envoy/config/filter/accesslog/v2/accesslog.pb.go @@ -0,0 +1,3322 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: envoy/config/filter/accesslog/v2/accesslog.proto + +package v2 + +import proto "github.com/gogo/protobuf/proto" +import fmt "fmt" +import math "math" +import core "github.com/envoyproxy/go-control-plane/envoy/api/v2/core" +import route "github.com/envoyproxy/go-control-plane/envoy/api/v2/route" +import _type "github.com/envoyproxy/go-control-plane/envoy/type" +import types "github.com/gogo/protobuf/types" +import _ "github.com/lyft/protoc-gen-validate/validate" + +import io "io" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package + +type ComparisonFilter_Op int32 + +const ( + // = + ComparisonFilter_EQ ComparisonFilter_Op = 0 + // >= + ComparisonFilter_GE ComparisonFilter_Op = 1 + // <= + ComparisonFilter_LE ComparisonFilter_Op = 2 +) + +var ComparisonFilter_Op_name = map[int32]string{ + 0: "EQ", + 1: "GE", + 2: "LE", +} +var ComparisonFilter_Op_value = map[string]int32{ + "EQ": 0, + "GE": 1, + "LE": 2, +} + +func (x ComparisonFilter_Op) String() string { + return proto.EnumName(ComparisonFilter_Op_name, int32(x)) +} +func (ComparisonFilter_Op) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_accesslog_227c9aa0019a1c53, []int{2, 0} +} + +type AccessLog struct { + // The name of the access log implementation to instantiate. The name must + // match a statically registered access log. Current built-in loggers include: + // + // #. "envoy.file_access_log" + // #. "envoy.http_grpc_access_log" + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // Filter which is used to determine if the access log needs to be written. + Filter *AccessLogFilter `protobuf:"bytes,2,opt,name=filter" json:"filter,omitempty"` + // Custom configuration that depends on the access log being instantiated. Built-in configurations + // include: + // + // #. "envoy.file_access_log": :ref:`FileAccessLog + // ` + // #. "envoy.http_grpc_access_log": :ref:`HttpGrpcAccessLogConfig + // ` + Config *types.Struct `protobuf:"bytes,3,opt,name=config" json:"config,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *AccessLog) Reset() { *m = AccessLog{} } +func (m *AccessLog) String() string { return proto.CompactTextString(m) } +func (*AccessLog) ProtoMessage() {} +func (*AccessLog) Descriptor() ([]byte, []int) { + return fileDescriptor_accesslog_227c9aa0019a1c53, []int{0} +} +func (m *AccessLog) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AccessLog) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AccessLog.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *AccessLog) XXX_Merge(src proto.Message) { + xxx_messageInfo_AccessLog.Merge(dst, src) +} +func (m *AccessLog) XXX_Size() int { + return m.Size() +} +func (m *AccessLog) XXX_DiscardUnknown() { + xxx_messageInfo_AccessLog.DiscardUnknown(m) +} + +var xxx_messageInfo_AccessLog proto.InternalMessageInfo + +func (m *AccessLog) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *AccessLog) GetFilter() *AccessLogFilter { + if m != nil { + return m.Filter + } + return nil +} + +func (m *AccessLog) GetConfig() *types.Struct { + if m != nil { + return m.Config + } + return nil +} + +type AccessLogFilter struct { + // Types that are valid to be assigned to FilterSpecifier: + // *AccessLogFilter_StatusCodeFilter + // *AccessLogFilter_DurationFilter + // *AccessLogFilter_NotHealthCheckFilter + // *AccessLogFilter_TraceableFilter + // *AccessLogFilter_RuntimeFilter + // *AccessLogFilter_AndFilter + // *AccessLogFilter_OrFilter + // *AccessLogFilter_HeaderFilter + // *AccessLogFilter_ResponseFlagFilter + FilterSpecifier isAccessLogFilter_FilterSpecifier `protobuf_oneof:"filter_specifier"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *AccessLogFilter) Reset() { *m = AccessLogFilter{} } +func (m *AccessLogFilter) String() string { return proto.CompactTextString(m) } +func (*AccessLogFilter) ProtoMessage() {} +func (*AccessLogFilter) Descriptor() ([]byte, []int) { + return fileDescriptor_accesslog_227c9aa0019a1c53, []int{1} +} +func (m *AccessLogFilter) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AccessLogFilter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AccessLogFilter.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *AccessLogFilter) XXX_Merge(src proto.Message) { + xxx_messageInfo_AccessLogFilter.Merge(dst, src) +} +func (m *AccessLogFilter) XXX_Size() int { + return m.Size() +} +func (m *AccessLogFilter) XXX_DiscardUnknown() { + xxx_messageInfo_AccessLogFilter.DiscardUnknown(m) +} + +var xxx_messageInfo_AccessLogFilter proto.InternalMessageInfo + +type isAccessLogFilter_FilterSpecifier interface { + isAccessLogFilter_FilterSpecifier() + MarshalTo([]byte) (int, error) + Size() int +} + +type AccessLogFilter_StatusCodeFilter struct { + StatusCodeFilter *StatusCodeFilter `protobuf:"bytes,1,opt,name=status_code_filter,json=statusCodeFilter,oneof"` +} +type AccessLogFilter_DurationFilter struct { + DurationFilter *DurationFilter `protobuf:"bytes,2,opt,name=duration_filter,json=durationFilter,oneof"` +} +type AccessLogFilter_NotHealthCheckFilter struct { + NotHealthCheckFilter *NotHealthCheckFilter `protobuf:"bytes,3,opt,name=not_health_check_filter,json=notHealthCheckFilter,oneof"` +} +type AccessLogFilter_TraceableFilter struct { + TraceableFilter *TraceableFilter `protobuf:"bytes,4,opt,name=traceable_filter,json=traceableFilter,oneof"` +} +type AccessLogFilter_RuntimeFilter struct { + RuntimeFilter *RuntimeFilter `protobuf:"bytes,5,opt,name=runtime_filter,json=runtimeFilter,oneof"` +} +type AccessLogFilter_AndFilter struct { + AndFilter *AndFilter `protobuf:"bytes,6,opt,name=and_filter,json=andFilter,oneof"` +} +type AccessLogFilter_OrFilter struct { + OrFilter *OrFilter `protobuf:"bytes,7,opt,name=or_filter,json=orFilter,oneof"` +} +type AccessLogFilter_HeaderFilter struct { + HeaderFilter *HeaderFilter `protobuf:"bytes,8,opt,name=header_filter,json=headerFilter,oneof"` +} +type AccessLogFilter_ResponseFlagFilter struct { + ResponseFlagFilter *ResponseFlagFilter `protobuf:"bytes,9,opt,name=response_flag_filter,json=responseFlagFilter,oneof"` +} + +func (*AccessLogFilter_StatusCodeFilter) isAccessLogFilter_FilterSpecifier() {} +func (*AccessLogFilter_DurationFilter) isAccessLogFilter_FilterSpecifier() {} +func (*AccessLogFilter_NotHealthCheckFilter) isAccessLogFilter_FilterSpecifier() {} +func (*AccessLogFilter_TraceableFilter) isAccessLogFilter_FilterSpecifier() {} +func (*AccessLogFilter_RuntimeFilter) isAccessLogFilter_FilterSpecifier() {} +func (*AccessLogFilter_AndFilter) isAccessLogFilter_FilterSpecifier() {} +func (*AccessLogFilter_OrFilter) isAccessLogFilter_FilterSpecifier() {} +func (*AccessLogFilter_HeaderFilter) isAccessLogFilter_FilterSpecifier() {} +func (*AccessLogFilter_ResponseFlagFilter) isAccessLogFilter_FilterSpecifier() {} + +func (m *AccessLogFilter) GetFilterSpecifier() isAccessLogFilter_FilterSpecifier { + if m != nil { + return m.FilterSpecifier + } + return nil +} + +func (m *AccessLogFilter) GetStatusCodeFilter() *StatusCodeFilter { + if x, ok := m.GetFilterSpecifier().(*AccessLogFilter_StatusCodeFilter); ok { + return x.StatusCodeFilter + } + return nil +} + +func (m *AccessLogFilter) GetDurationFilter() *DurationFilter { + if x, ok := m.GetFilterSpecifier().(*AccessLogFilter_DurationFilter); ok { + return x.DurationFilter + } + return nil +} + +func (m *AccessLogFilter) GetNotHealthCheckFilter() *NotHealthCheckFilter { + if x, ok := m.GetFilterSpecifier().(*AccessLogFilter_NotHealthCheckFilter); ok { + return x.NotHealthCheckFilter + } + return nil +} + +func (m *AccessLogFilter) GetTraceableFilter() *TraceableFilter { + if x, ok := m.GetFilterSpecifier().(*AccessLogFilter_TraceableFilter); ok { + return x.TraceableFilter + } + return nil +} + +func (m *AccessLogFilter) GetRuntimeFilter() *RuntimeFilter { + if x, ok := m.GetFilterSpecifier().(*AccessLogFilter_RuntimeFilter); ok { + return x.RuntimeFilter + } + return nil +} + +func (m *AccessLogFilter) GetAndFilter() *AndFilter { + if x, ok := m.GetFilterSpecifier().(*AccessLogFilter_AndFilter); ok { + return x.AndFilter + } + return nil +} + +func (m *AccessLogFilter) GetOrFilter() *OrFilter { + if x, ok := m.GetFilterSpecifier().(*AccessLogFilter_OrFilter); ok { + return x.OrFilter + } + return nil +} + +func (m *AccessLogFilter) GetHeaderFilter() *HeaderFilter { + if x, ok := m.GetFilterSpecifier().(*AccessLogFilter_HeaderFilter); ok { + return x.HeaderFilter + } + return nil +} + +func (m *AccessLogFilter) GetResponseFlagFilter() *ResponseFlagFilter { + if x, ok := m.GetFilterSpecifier().(*AccessLogFilter_ResponseFlagFilter); ok { + return x.ResponseFlagFilter + } + return nil +} + +// XXX_OneofFuncs is for the internal use of the proto package. +func (*AccessLogFilter) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { + return _AccessLogFilter_OneofMarshaler, _AccessLogFilter_OneofUnmarshaler, _AccessLogFilter_OneofSizer, []interface{}{ + (*AccessLogFilter_StatusCodeFilter)(nil), + (*AccessLogFilter_DurationFilter)(nil), + (*AccessLogFilter_NotHealthCheckFilter)(nil), + (*AccessLogFilter_TraceableFilter)(nil), + (*AccessLogFilter_RuntimeFilter)(nil), + (*AccessLogFilter_AndFilter)(nil), + (*AccessLogFilter_OrFilter)(nil), + (*AccessLogFilter_HeaderFilter)(nil), + (*AccessLogFilter_ResponseFlagFilter)(nil), + } +} + +func _AccessLogFilter_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { + m := msg.(*AccessLogFilter) + // filter_specifier + switch x := m.FilterSpecifier.(type) { + case *AccessLogFilter_StatusCodeFilter: + _ = b.EncodeVarint(1<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.StatusCodeFilter); err != nil { + return err + } + case *AccessLogFilter_DurationFilter: + _ = b.EncodeVarint(2<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.DurationFilter); err != nil { + return err + } + case *AccessLogFilter_NotHealthCheckFilter: + _ = b.EncodeVarint(3<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.NotHealthCheckFilter); err != nil { + return err + } + case *AccessLogFilter_TraceableFilter: + _ = b.EncodeVarint(4<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.TraceableFilter); err != nil { + return err + } + case *AccessLogFilter_RuntimeFilter: + _ = b.EncodeVarint(5<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.RuntimeFilter); err != nil { + return err + } + case *AccessLogFilter_AndFilter: + _ = b.EncodeVarint(6<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.AndFilter); err != nil { + return err + } + case *AccessLogFilter_OrFilter: + _ = b.EncodeVarint(7<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.OrFilter); err != nil { + return err + } + case *AccessLogFilter_HeaderFilter: + _ = b.EncodeVarint(8<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.HeaderFilter); err != nil { + return err + } + case *AccessLogFilter_ResponseFlagFilter: + _ = b.EncodeVarint(9<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.ResponseFlagFilter); err != nil { + return err + } + case nil: + default: + return fmt.Errorf("AccessLogFilter.FilterSpecifier has unexpected type %T", x) + } + return nil +} + +func _AccessLogFilter_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { + m := msg.(*AccessLogFilter) + switch tag { + case 1: // filter_specifier.status_code_filter + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(StatusCodeFilter) + err := b.DecodeMessage(msg) + m.FilterSpecifier = &AccessLogFilter_StatusCodeFilter{msg} + return true, err + case 2: // filter_specifier.duration_filter + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(DurationFilter) + err := b.DecodeMessage(msg) + m.FilterSpecifier = &AccessLogFilter_DurationFilter{msg} + return true, err + case 3: // filter_specifier.not_health_check_filter + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(NotHealthCheckFilter) + err := b.DecodeMessage(msg) + m.FilterSpecifier = &AccessLogFilter_NotHealthCheckFilter{msg} + return true, err + case 4: // filter_specifier.traceable_filter + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(TraceableFilter) + err := b.DecodeMessage(msg) + m.FilterSpecifier = &AccessLogFilter_TraceableFilter{msg} + return true, err + case 5: // filter_specifier.runtime_filter + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(RuntimeFilter) + err := b.DecodeMessage(msg) + m.FilterSpecifier = &AccessLogFilter_RuntimeFilter{msg} + return true, err + case 6: // filter_specifier.and_filter + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(AndFilter) + err := b.DecodeMessage(msg) + m.FilterSpecifier = &AccessLogFilter_AndFilter{msg} + return true, err + case 7: // filter_specifier.or_filter + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(OrFilter) + err := b.DecodeMessage(msg) + m.FilterSpecifier = &AccessLogFilter_OrFilter{msg} + return true, err + case 8: // filter_specifier.header_filter + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(HeaderFilter) + err := b.DecodeMessage(msg) + m.FilterSpecifier = &AccessLogFilter_HeaderFilter{msg} + return true, err + case 9: // filter_specifier.response_flag_filter + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(ResponseFlagFilter) + err := b.DecodeMessage(msg) + m.FilterSpecifier = &AccessLogFilter_ResponseFlagFilter{msg} + return true, err + default: + return false, nil + } +} + +func _AccessLogFilter_OneofSizer(msg proto.Message) (n int) { + m := msg.(*AccessLogFilter) + // filter_specifier + switch x := m.FilterSpecifier.(type) { + case *AccessLogFilter_StatusCodeFilter: + s := proto.Size(x.StatusCodeFilter) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case *AccessLogFilter_DurationFilter: + s := proto.Size(x.DurationFilter) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case *AccessLogFilter_NotHealthCheckFilter: + s := proto.Size(x.NotHealthCheckFilter) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case *AccessLogFilter_TraceableFilter: + s := proto.Size(x.TraceableFilter) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case *AccessLogFilter_RuntimeFilter: + s := proto.Size(x.RuntimeFilter) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case *AccessLogFilter_AndFilter: + s := proto.Size(x.AndFilter) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case *AccessLogFilter_OrFilter: + s := proto.Size(x.OrFilter) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case *AccessLogFilter_HeaderFilter: + s := proto.Size(x.HeaderFilter) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case *AccessLogFilter_ResponseFlagFilter: + s := proto.Size(x.ResponseFlagFilter) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case nil: + default: + panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) + } + return n +} + +// Filter on an integer comparison. +type ComparisonFilter struct { + // Comparison operator. + Op ComparisonFilter_Op `protobuf:"varint,1,opt,name=op,proto3,enum=envoy.config.filter.accesslog.v2.ComparisonFilter_Op" json:"op,omitempty"` + // Value to compare against. + Value *core.RuntimeUInt32 `protobuf:"bytes,2,opt,name=value" json:"value,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ComparisonFilter) Reset() { *m = ComparisonFilter{} } +func (m *ComparisonFilter) String() string { return proto.CompactTextString(m) } +func (*ComparisonFilter) ProtoMessage() {} +func (*ComparisonFilter) Descriptor() ([]byte, []int) { + return fileDescriptor_accesslog_227c9aa0019a1c53, []int{2} +} +func (m *ComparisonFilter) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ComparisonFilter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ComparisonFilter.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *ComparisonFilter) XXX_Merge(src proto.Message) { + xxx_messageInfo_ComparisonFilter.Merge(dst, src) +} +func (m *ComparisonFilter) XXX_Size() int { + return m.Size() +} +func (m *ComparisonFilter) XXX_DiscardUnknown() { + xxx_messageInfo_ComparisonFilter.DiscardUnknown(m) +} + +var xxx_messageInfo_ComparisonFilter proto.InternalMessageInfo + +func (m *ComparisonFilter) GetOp() ComparisonFilter_Op { + if m != nil { + return m.Op + } + return ComparisonFilter_EQ +} + +func (m *ComparisonFilter) GetValue() *core.RuntimeUInt32 { + if m != nil { + return m.Value + } + return nil +} + +// Filters on HTTP response/status code. +type StatusCodeFilter struct { + // Comparison. + Comparison *ComparisonFilter `protobuf:"bytes,1,opt,name=comparison" json:"comparison,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *StatusCodeFilter) Reset() { *m = StatusCodeFilter{} } +func (m *StatusCodeFilter) String() string { return proto.CompactTextString(m) } +func (*StatusCodeFilter) ProtoMessage() {} +func (*StatusCodeFilter) Descriptor() ([]byte, []int) { + return fileDescriptor_accesslog_227c9aa0019a1c53, []int{3} +} +func (m *StatusCodeFilter) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *StatusCodeFilter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_StatusCodeFilter.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *StatusCodeFilter) XXX_Merge(src proto.Message) { + xxx_messageInfo_StatusCodeFilter.Merge(dst, src) +} +func (m *StatusCodeFilter) XXX_Size() int { + return m.Size() +} +func (m *StatusCodeFilter) XXX_DiscardUnknown() { + xxx_messageInfo_StatusCodeFilter.DiscardUnknown(m) +} + +var xxx_messageInfo_StatusCodeFilter proto.InternalMessageInfo + +func (m *StatusCodeFilter) GetComparison() *ComparisonFilter { + if m != nil { + return m.Comparison + } + return nil +} + +// Filters on total request duration in milliseconds. +type DurationFilter struct { + // Comparison. + Comparison *ComparisonFilter `protobuf:"bytes,1,opt,name=comparison" json:"comparison,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *DurationFilter) Reset() { *m = DurationFilter{} } +func (m *DurationFilter) String() string { return proto.CompactTextString(m) } +func (*DurationFilter) ProtoMessage() {} +func (*DurationFilter) Descriptor() ([]byte, []int) { + return fileDescriptor_accesslog_227c9aa0019a1c53, []int{4} +} +func (m *DurationFilter) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DurationFilter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_DurationFilter.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *DurationFilter) XXX_Merge(src proto.Message) { + xxx_messageInfo_DurationFilter.Merge(dst, src) +} +func (m *DurationFilter) XXX_Size() int { + return m.Size() +} +func (m *DurationFilter) XXX_DiscardUnknown() { + xxx_messageInfo_DurationFilter.DiscardUnknown(m) +} + +var xxx_messageInfo_DurationFilter proto.InternalMessageInfo + +func (m *DurationFilter) GetComparison() *ComparisonFilter { + if m != nil { + return m.Comparison + } + return nil +} + +// Filters for requests that are not health check requests. A health check +// request is marked by the health check filter. +type NotHealthCheckFilter struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *NotHealthCheckFilter) Reset() { *m = NotHealthCheckFilter{} } +func (m *NotHealthCheckFilter) String() string { return proto.CompactTextString(m) } +func (*NotHealthCheckFilter) ProtoMessage() {} +func (*NotHealthCheckFilter) Descriptor() ([]byte, []int) { + return fileDescriptor_accesslog_227c9aa0019a1c53, []int{5} +} +func (m *NotHealthCheckFilter) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *NotHealthCheckFilter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_NotHealthCheckFilter.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *NotHealthCheckFilter) XXX_Merge(src proto.Message) { + xxx_messageInfo_NotHealthCheckFilter.Merge(dst, src) +} +func (m *NotHealthCheckFilter) XXX_Size() int { + return m.Size() +} +func (m *NotHealthCheckFilter) XXX_DiscardUnknown() { + xxx_messageInfo_NotHealthCheckFilter.DiscardUnknown(m) +} + +var xxx_messageInfo_NotHealthCheckFilter proto.InternalMessageInfo + +// Filters for requests that are traceable. See the tracing overview for more +// information on how a request becomes traceable. +type TraceableFilter struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *TraceableFilter) Reset() { *m = TraceableFilter{} } +func (m *TraceableFilter) String() string { return proto.CompactTextString(m) } +func (*TraceableFilter) ProtoMessage() {} +func (*TraceableFilter) Descriptor() ([]byte, []int) { + return fileDescriptor_accesslog_227c9aa0019a1c53, []int{6} +} +func (m *TraceableFilter) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *TraceableFilter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_TraceableFilter.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *TraceableFilter) XXX_Merge(src proto.Message) { + xxx_messageInfo_TraceableFilter.Merge(dst, src) +} +func (m *TraceableFilter) XXX_Size() int { + return m.Size() +} +func (m *TraceableFilter) XXX_DiscardUnknown() { + xxx_messageInfo_TraceableFilter.DiscardUnknown(m) +} + +var xxx_messageInfo_TraceableFilter proto.InternalMessageInfo + +// Filters for random sampling of requests. +type RuntimeFilter struct { + // Runtime key to get an optional overridden numerator for use in the *percent_sampled* field. + // If found in runtime, this value will replace the default numerator. + RuntimeKey string `protobuf:"bytes,1,opt,name=runtime_key,json=runtimeKey,proto3" json:"runtime_key,omitempty"` + // The default sampling percentage. If not specified, defaults to 0% with denominator of 100. + PercentSampled *_type.FractionalPercent `protobuf:"bytes,2,opt,name=percent_sampled,json=percentSampled" json:"percent_sampled,omitempty"` + // By default, sampling pivots on the header + // :ref:`x-request-id` being present. If + // :ref:`x-request-id` is present, the filter will + // consistently sample across multiple hosts based on the runtime key value and the value + // extracted from :ref:`x-request-id`. If it is + // missing, or *use_independent_randomness* is set to true, the filter will randomly sample based + // on the runtime key value alone. *use_independent_randomness* can be used for logging kill + // switches within complex nested :ref:`AndFilter + // ` and :ref:`OrFilter + // ` blocks that are easier to reason about + // from a probability perspective (i.e., setting to true will cause the filter to behave like + // an independent random variable when composed within logical operator filters). + UseIndependentRandomness bool `protobuf:"varint,3,opt,name=use_independent_randomness,json=useIndependentRandomness,proto3" json:"use_independent_randomness,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *RuntimeFilter) Reset() { *m = RuntimeFilter{} } +func (m *RuntimeFilter) String() string { return proto.CompactTextString(m) } +func (*RuntimeFilter) ProtoMessage() {} +func (*RuntimeFilter) Descriptor() ([]byte, []int) { + return fileDescriptor_accesslog_227c9aa0019a1c53, []int{7} +} +func (m *RuntimeFilter) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RuntimeFilter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_RuntimeFilter.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *RuntimeFilter) XXX_Merge(src proto.Message) { + xxx_messageInfo_RuntimeFilter.Merge(dst, src) +} +func (m *RuntimeFilter) XXX_Size() int { + return m.Size() +} +func (m *RuntimeFilter) XXX_DiscardUnknown() { + xxx_messageInfo_RuntimeFilter.DiscardUnknown(m) +} + +var xxx_messageInfo_RuntimeFilter proto.InternalMessageInfo + +func (m *RuntimeFilter) GetRuntimeKey() string { + if m != nil { + return m.RuntimeKey + } + return "" +} + +func (m *RuntimeFilter) GetPercentSampled() *_type.FractionalPercent { + if m != nil { + return m.PercentSampled + } + return nil +} + +func (m *RuntimeFilter) GetUseIndependentRandomness() bool { + if m != nil { + return m.UseIndependentRandomness + } + return false +} + +// Performs a logical “and” operation on the result of each filter in filters. +// Filters are evaluated sequentially and if one of them returns false, the +// filter returns false immediately. +type AndFilter struct { + Filters []*AccessLogFilter `protobuf:"bytes,1,rep,name=filters" json:"filters,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *AndFilter) Reset() { *m = AndFilter{} } +func (m *AndFilter) String() string { return proto.CompactTextString(m) } +func (*AndFilter) ProtoMessage() {} +func (*AndFilter) Descriptor() ([]byte, []int) { + return fileDescriptor_accesslog_227c9aa0019a1c53, []int{8} +} +func (m *AndFilter) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AndFilter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AndFilter.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *AndFilter) XXX_Merge(src proto.Message) { + xxx_messageInfo_AndFilter.Merge(dst, src) +} +func (m *AndFilter) XXX_Size() int { + return m.Size() +} +func (m *AndFilter) XXX_DiscardUnknown() { + xxx_messageInfo_AndFilter.DiscardUnknown(m) +} + +var xxx_messageInfo_AndFilter proto.InternalMessageInfo + +func (m *AndFilter) GetFilters() []*AccessLogFilter { + if m != nil { + return m.Filters + } + return nil +} + +// Performs a logical “or” operation on the result of each individual filter. +// Filters are evaluated sequentially and if one of them returns true, the +// filter returns true immediately. +type OrFilter struct { + Filters []*AccessLogFilter `protobuf:"bytes,2,rep,name=filters" json:"filters,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *OrFilter) Reset() { *m = OrFilter{} } +func (m *OrFilter) String() string { return proto.CompactTextString(m) } +func (*OrFilter) ProtoMessage() {} +func (*OrFilter) Descriptor() ([]byte, []int) { + return fileDescriptor_accesslog_227c9aa0019a1c53, []int{9} +} +func (m *OrFilter) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *OrFilter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_OrFilter.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *OrFilter) XXX_Merge(src proto.Message) { + xxx_messageInfo_OrFilter.Merge(dst, src) +} +func (m *OrFilter) XXX_Size() int { + return m.Size() +} +func (m *OrFilter) XXX_DiscardUnknown() { + xxx_messageInfo_OrFilter.DiscardUnknown(m) +} + +var xxx_messageInfo_OrFilter proto.InternalMessageInfo + +func (m *OrFilter) GetFilters() []*AccessLogFilter { + if m != nil { + return m.Filters + } + return nil +} + +// Filters requests based on the presence or value of a request header. +type HeaderFilter struct { + // Only requests with a header which matches the specified HeaderMatcher will pass the filter + // check. + Header *route.HeaderMatcher `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *HeaderFilter) Reset() { *m = HeaderFilter{} } +func (m *HeaderFilter) String() string { return proto.CompactTextString(m) } +func (*HeaderFilter) ProtoMessage() {} +func (*HeaderFilter) Descriptor() ([]byte, []int) { + return fileDescriptor_accesslog_227c9aa0019a1c53, []int{10} +} +func (m *HeaderFilter) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *HeaderFilter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_HeaderFilter.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *HeaderFilter) XXX_Merge(src proto.Message) { + xxx_messageInfo_HeaderFilter.Merge(dst, src) +} +func (m *HeaderFilter) XXX_Size() int { + return m.Size() +} +func (m *HeaderFilter) XXX_DiscardUnknown() { + xxx_messageInfo_HeaderFilter.DiscardUnknown(m) +} + +var xxx_messageInfo_HeaderFilter proto.InternalMessageInfo + +func (m *HeaderFilter) GetHeader() *route.HeaderMatcher { + if m != nil { + return m.Header + } + return nil +} + +// Filters requests that received responses with an Envoy response flag set. +// A list of the response flags can be found +// in the access log formatter :ref:`documentation`. +type ResponseFlagFilter struct { + // Only responses with the any of the flags listed in this field will be logged. + // This field is optional. If it is not specified, then any response flag will pass + // the filter check. + Flags []string `protobuf:"bytes,1,rep,name=flags" json:"flags,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ResponseFlagFilter) Reset() { *m = ResponseFlagFilter{} } +func (m *ResponseFlagFilter) String() string { return proto.CompactTextString(m) } +func (*ResponseFlagFilter) ProtoMessage() {} +func (*ResponseFlagFilter) Descriptor() ([]byte, []int) { + return fileDescriptor_accesslog_227c9aa0019a1c53, []int{11} +} +func (m *ResponseFlagFilter) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ResponseFlagFilter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ResponseFlagFilter.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *ResponseFlagFilter) XXX_Merge(src proto.Message) { + xxx_messageInfo_ResponseFlagFilter.Merge(dst, src) +} +func (m *ResponseFlagFilter) XXX_Size() int { + return m.Size() +} +func (m *ResponseFlagFilter) XXX_DiscardUnknown() { + xxx_messageInfo_ResponseFlagFilter.DiscardUnknown(m) +} + +var xxx_messageInfo_ResponseFlagFilter proto.InternalMessageInfo + +func (m *ResponseFlagFilter) GetFlags() []string { + if m != nil { + return m.Flags + } + return nil +} + +func init() { + proto.RegisterType((*AccessLog)(nil), "envoy.config.filter.accesslog.v2.AccessLog") + proto.RegisterType((*AccessLogFilter)(nil), "envoy.config.filter.accesslog.v2.AccessLogFilter") + proto.RegisterType((*ComparisonFilter)(nil), "envoy.config.filter.accesslog.v2.ComparisonFilter") + proto.RegisterType((*StatusCodeFilter)(nil), "envoy.config.filter.accesslog.v2.StatusCodeFilter") + proto.RegisterType((*DurationFilter)(nil), "envoy.config.filter.accesslog.v2.DurationFilter") + proto.RegisterType((*NotHealthCheckFilter)(nil), "envoy.config.filter.accesslog.v2.NotHealthCheckFilter") + proto.RegisterType((*TraceableFilter)(nil), "envoy.config.filter.accesslog.v2.TraceableFilter") + proto.RegisterType((*RuntimeFilter)(nil), "envoy.config.filter.accesslog.v2.RuntimeFilter") + proto.RegisterType((*AndFilter)(nil), "envoy.config.filter.accesslog.v2.AndFilter") + proto.RegisterType((*OrFilter)(nil), "envoy.config.filter.accesslog.v2.OrFilter") + proto.RegisterType((*HeaderFilter)(nil), "envoy.config.filter.accesslog.v2.HeaderFilter") + proto.RegisterType((*ResponseFlagFilter)(nil), "envoy.config.filter.accesslog.v2.ResponseFlagFilter") + proto.RegisterEnum("envoy.config.filter.accesslog.v2.ComparisonFilter_Op", ComparisonFilter_Op_name, ComparisonFilter_Op_value) +} +func (m *AccessLog) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *AccessLog) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Name) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintAccesslog(dAtA, i, uint64(len(m.Name))) + i += copy(dAtA[i:], m.Name) + } + if m.Filter != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintAccesslog(dAtA, i, uint64(m.Filter.Size())) + n1, err := m.Filter.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n1 + } + if m.Config != nil { + dAtA[i] = 0x1a + i++ + i = encodeVarintAccesslog(dAtA, i, uint64(m.Config.Size())) + n2, err := m.Config.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n2 + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *AccessLogFilter) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *AccessLogFilter) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.FilterSpecifier != nil { + nn3, err := m.FilterSpecifier.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += nn3 + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *AccessLogFilter_StatusCodeFilter) MarshalTo(dAtA []byte) (int, error) { + i := 0 + if m.StatusCodeFilter != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintAccesslog(dAtA, i, uint64(m.StatusCodeFilter.Size())) + n4, err := m.StatusCodeFilter.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n4 + } + return i, nil +} +func (m *AccessLogFilter_DurationFilter) MarshalTo(dAtA []byte) (int, error) { + i := 0 + if m.DurationFilter != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintAccesslog(dAtA, i, uint64(m.DurationFilter.Size())) + n5, err := m.DurationFilter.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n5 + } + return i, nil +} +func (m *AccessLogFilter_NotHealthCheckFilter) MarshalTo(dAtA []byte) (int, error) { + i := 0 + if m.NotHealthCheckFilter != nil { + dAtA[i] = 0x1a + i++ + i = encodeVarintAccesslog(dAtA, i, uint64(m.NotHealthCheckFilter.Size())) + n6, err := m.NotHealthCheckFilter.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n6 + } + return i, nil +} +func (m *AccessLogFilter_TraceableFilter) MarshalTo(dAtA []byte) (int, error) { + i := 0 + if m.TraceableFilter != nil { + dAtA[i] = 0x22 + i++ + i = encodeVarintAccesslog(dAtA, i, uint64(m.TraceableFilter.Size())) + n7, err := m.TraceableFilter.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n7 + } + return i, nil +} +func (m *AccessLogFilter_RuntimeFilter) MarshalTo(dAtA []byte) (int, error) { + i := 0 + if m.RuntimeFilter != nil { + dAtA[i] = 0x2a + i++ + i = encodeVarintAccesslog(dAtA, i, uint64(m.RuntimeFilter.Size())) + n8, err := m.RuntimeFilter.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n8 + } + return i, nil +} +func (m *AccessLogFilter_AndFilter) MarshalTo(dAtA []byte) (int, error) { + i := 0 + if m.AndFilter != nil { + dAtA[i] = 0x32 + i++ + i = encodeVarintAccesslog(dAtA, i, uint64(m.AndFilter.Size())) + n9, err := m.AndFilter.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n9 + } + return i, nil +} +func (m *AccessLogFilter_OrFilter) MarshalTo(dAtA []byte) (int, error) { + i := 0 + if m.OrFilter != nil { + dAtA[i] = 0x3a + i++ + i = encodeVarintAccesslog(dAtA, i, uint64(m.OrFilter.Size())) + n10, err := m.OrFilter.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n10 + } + return i, nil +} +func (m *AccessLogFilter_HeaderFilter) MarshalTo(dAtA []byte) (int, error) { + i := 0 + if m.HeaderFilter != nil { + dAtA[i] = 0x42 + i++ + i = encodeVarintAccesslog(dAtA, i, uint64(m.HeaderFilter.Size())) + n11, err := m.HeaderFilter.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n11 + } + return i, nil +} +func (m *AccessLogFilter_ResponseFlagFilter) MarshalTo(dAtA []byte) (int, error) { + i := 0 + if m.ResponseFlagFilter != nil { + dAtA[i] = 0x4a + i++ + i = encodeVarintAccesslog(dAtA, i, uint64(m.ResponseFlagFilter.Size())) + n12, err := m.ResponseFlagFilter.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n12 + } + return i, nil +} +func (m *ComparisonFilter) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ComparisonFilter) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Op != 0 { + dAtA[i] = 0x8 + i++ + i = encodeVarintAccesslog(dAtA, i, uint64(m.Op)) + } + if m.Value != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintAccesslog(dAtA, i, uint64(m.Value.Size())) + n13, err := m.Value.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n13 + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *StatusCodeFilter) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *StatusCodeFilter) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Comparison != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintAccesslog(dAtA, i, uint64(m.Comparison.Size())) + n14, err := m.Comparison.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n14 + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *DurationFilter) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *DurationFilter) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Comparison != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintAccesslog(dAtA, i, uint64(m.Comparison.Size())) + n15, err := m.Comparison.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n15 + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *NotHealthCheckFilter) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *NotHealthCheckFilter) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *TraceableFilter) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *TraceableFilter) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *RuntimeFilter) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *RuntimeFilter) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.RuntimeKey) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintAccesslog(dAtA, i, uint64(len(m.RuntimeKey))) + i += copy(dAtA[i:], m.RuntimeKey) + } + if m.PercentSampled != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintAccesslog(dAtA, i, uint64(m.PercentSampled.Size())) + n16, err := m.PercentSampled.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n16 + } + if m.UseIndependentRandomness { + dAtA[i] = 0x18 + i++ + if m.UseIndependentRandomness { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i++ + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *AndFilter) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *AndFilter) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Filters) > 0 { + for _, msg := range m.Filters { + dAtA[i] = 0xa + i++ + i = encodeVarintAccesslog(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *OrFilter) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *OrFilter) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Filters) > 0 { + for _, msg := range m.Filters { + dAtA[i] = 0x12 + i++ + i = encodeVarintAccesslog(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *HeaderFilter) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *HeaderFilter) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Header != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintAccesslog(dAtA, i, uint64(m.Header.Size())) + n17, err := m.Header.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n17 + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *ResponseFlagFilter) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ResponseFlagFilter) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Flags) > 0 { + for _, s := range m.Flags { + dAtA[i] = 0xa + i++ + l = len(s) + for l >= 1<<7 { + dAtA[i] = uint8(uint64(l)&0x7f | 0x80) + l >>= 7 + i++ + } + dAtA[i] = uint8(l) + i++ + i += copy(dAtA[i:], s) + } + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func encodeVarintAccesslog(dAtA []byte, offset int, v uint64) int { + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return offset + 1 +} +func (m *AccessLog) Size() (n int) { + var l int + _ = l + l = len(m.Name) + if l > 0 { + n += 1 + l + sovAccesslog(uint64(l)) + } + if m.Filter != nil { + l = m.Filter.Size() + n += 1 + l + sovAccesslog(uint64(l)) + } + if m.Config != nil { + l = m.Config.Size() + n += 1 + l + sovAccesslog(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *AccessLogFilter) Size() (n int) { + var l int + _ = l + if m.FilterSpecifier != nil { + n += m.FilterSpecifier.Size() + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *AccessLogFilter_StatusCodeFilter) Size() (n int) { + var l int + _ = l + if m.StatusCodeFilter != nil { + l = m.StatusCodeFilter.Size() + n += 1 + l + sovAccesslog(uint64(l)) + } + return n +} +func (m *AccessLogFilter_DurationFilter) Size() (n int) { + var l int + _ = l + if m.DurationFilter != nil { + l = m.DurationFilter.Size() + n += 1 + l + sovAccesslog(uint64(l)) + } + return n +} +func (m *AccessLogFilter_NotHealthCheckFilter) Size() (n int) { + var l int + _ = l + if m.NotHealthCheckFilter != nil { + l = m.NotHealthCheckFilter.Size() + n += 1 + l + sovAccesslog(uint64(l)) + } + return n +} +func (m *AccessLogFilter_TraceableFilter) Size() (n int) { + var l int + _ = l + if m.TraceableFilter != nil { + l = m.TraceableFilter.Size() + n += 1 + l + sovAccesslog(uint64(l)) + } + return n +} +func (m *AccessLogFilter_RuntimeFilter) Size() (n int) { + var l int + _ = l + if m.RuntimeFilter != nil { + l = m.RuntimeFilter.Size() + n += 1 + l + sovAccesslog(uint64(l)) + } + return n +} +func (m *AccessLogFilter_AndFilter) Size() (n int) { + var l int + _ = l + if m.AndFilter != nil { + l = m.AndFilter.Size() + n += 1 + l + sovAccesslog(uint64(l)) + } + return n +} +func (m *AccessLogFilter_OrFilter) Size() (n int) { + var l int + _ = l + if m.OrFilter != nil { + l = m.OrFilter.Size() + n += 1 + l + sovAccesslog(uint64(l)) + } + return n +} +func (m *AccessLogFilter_HeaderFilter) Size() (n int) { + var l int + _ = l + if m.HeaderFilter != nil { + l = m.HeaderFilter.Size() + n += 1 + l + sovAccesslog(uint64(l)) + } + return n +} +func (m *AccessLogFilter_ResponseFlagFilter) Size() (n int) { + var l int + _ = l + if m.ResponseFlagFilter != nil { + l = m.ResponseFlagFilter.Size() + n += 1 + l + sovAccesslog(uint64(l)) + } + return n +} +func (m *ComparisonFilter) Size() (n int) { + var l int + _ = l + if m.Op != 0 { + n += 1 + sovAccesslog(uint64(m.Op)) + } + if m.Value != nil { + l = m.Value.Size() + n += 1 + l + sovAccesslog(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *StatusCodeFilter) Size() (n int) { + var l int + _ = l + if m.Comparison != nil { + l = m.Comparison.Size() + n += 1 + l + sovAccesslog(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *DurationFilter) Size() (n int) { + var l int + _ = l + if m.Comparison != nil { + l = m.Comparison.Size() + n += 1 + l + sovAccesslog(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *NotHealthCheckFilter) Size() (n int) { + var l int + _ = l + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *TraceableFilter) Size() (n int) { + var l int + _ = l + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *RuntimeFilter) Size() (n int) { + var l int + _ = l + l = len(m.RuntimeKey) + if l > 0 { + n += 1 + l + sovAccesslog(uint64(l)) + } + if m.PercentSampled != nil { + l = m.PercentSampled.Size() + n += 1 + l + sovAccesslog(uint64(l)) + } + if m.UseIndependentRandomness { + n += 2 + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *AndFilter) Size() (n int) { + var l int + _ = l + if len(m.Filters) > 0 { + for _, e := range m.Filters { + l = e.Size() + n += 1 + l + sovAccesslog(uint64(l)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *OrFilter) Size() (n int) { + var l int + _ = l + if len(m.Filters) > 0 { + for _, e := range m.Filters { + l = e.Size() + n += 1 + l + sovAccesslog(uint64(l)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *HeaderFilter) Size() (n int) { + var l int + _ = l + if m.Header != nil { + l = m.Header.Size() + n += 1 + l + sovAccesslog(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *ResponseFlagFilter) Size() (n int) { + var l int + _ = l + if len(m.Flags) > 0 { + for _, s := range m.Flags { + l = len(s) + n += 1 + l + sovAccesslog(uint64(l)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func sovAccesslog(x uint64) (n int) { + for { + n++ + x >>= 7 + if x == 0 { + break + } + } + return n +} +func sozAccesslog(x uint64) (n int) { + return sovAccesslog(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *AccessLog) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAccesslog + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: AccessLog: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: AccessLog: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAccesslog + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthAccesslog + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Filter", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAccesslog + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthAccesslog + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Filter == nil { + m.Filter = &AccessLogFilter{} + } + if err := m.Filter.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Config", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAccesslog + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthAccesslog + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Config == nil { + m.Config = &types.Struct{} + } + if err := m.Config.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipAccesslog(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthAccesslog + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *AccessLogFilter) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAccesslog + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: AccessLogFilter: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: AccessLogFilter: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field StatusCodeFilter", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAccesslog + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthAccesslog + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &StatusCodeFilter{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.FilterSpecifier = &AccessLogFilter_StatusCodeFilter{v} + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DurationFilter", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAccesslog + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthAccesslog + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &DurationFilter{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.FilterSpecifier = &AccessLogFilter_DurationFilter{v} + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NotHealthCheckFilter", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAccesslog + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthAccesslog + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &NotHealthCheckFilter{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.FilterSpecifier = &AccessLogFilter_NotHealthCheckFilter{v} + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TraceableFilter", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAccesslog + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthAccesslog + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &TraceableFilter{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.FilterSpecifier = &AccessLogFilter_TraceableFilter{v} + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RuntimeFilter", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAccesslog + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthAccesslog + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &RuntimeFilter{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.FilterSpecifier = &AccessLogFilter_RuntimeFilter{v} + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AndFilter", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAccesslog + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthAccesslog + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &AndFilter{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.FilterSpecifier = &AccessLogFilter_AndFilter{v} + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OrFilter", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAccesslog + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthAccesslog + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &OrFilter{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.FilterSpecifier = &AccessLogFilter_OrFilter{v} + iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field HeaderFilter", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAccesslog + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthAccesslog + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &HeaderFilter{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.FilterSpecifier = &AccessLogFilter_HeaderFilter{v} + iNdEx = postIndex + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ResponseFlagFilter", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAccesslog + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthAccesslog + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &ResponseFlagFilter{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.FilterSpecifier = &AccessLogFilter_ResponseFlagFilter{v} + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipAccesslog(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthAccesslog + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ComparisonFilter) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAccesslog + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ComparisonFilter: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ComparisonFilter: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Op", wireType) + } + m.Op = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAccesslog + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Op |= (ComparisonFilter_Op(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAccesslog + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthAccesslog + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Value == nil { + m.Value = &core.RuntimeUInt32{} + } + if err := m.Value.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipAccesslog(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthAccesslog + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *StatusCodeFilter) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAccesslog + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: StatusCodeFilter: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: StatusCodeFilter: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Comparison", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAccesslog + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthAccesslog + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Comparison == nil { + m.Comparison = &ComparisonFilter{} + } + if err := m.Comparison.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipAccesslog(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthAccesslog + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DurationFilter) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAccesslog + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DurationFilter: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DurationFilter: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Comparison", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAccesslog + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthAccesslog + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Comparison == nil { + m.Comparison = &ComparisonFilter{} + } + if err := m.Comparison.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipAccesslog(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthAccesslog + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *NotHealthCheckFilter) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAccesslog + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: NotHealthCheckFilter: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: NotHealthCheckFilter: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipAccesslog(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthAccesslog + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *TraceableFilter) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAccesslog + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: TraceableFilter: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TraceableFilter: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipAccesslog(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthAccesslog + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *RuntimeFilter) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAccesslog + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: RuntimeFilter: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RuntimeFilter: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RuntimeKey", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAccesslog + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthAccesslog + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RuntimeKey = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PercentSampled", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAccesslog + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthAccesslog + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.PercentSampled == nil { + m.PercentSampled = &_type.FractionalPercent{} + } + if err := m.PercentSampled.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field UseIndependentRandomness", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAccesslog + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.UseIndependentRandomness = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skipAccesslog(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthAccesslog + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *AndFilter) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAccesslog + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: AndFilter: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: AndFilter: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Filters", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAccesslog + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthAccesslog + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Filters = append(m.Filters, &AccessLogFilter{}) + if err := m.Filters[len(m.Filters)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipAccesslog(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthAccesslog + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *OrFilter) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAccesslog + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: OrFilter: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: OrFilter: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Filters", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAccesslog + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthAccesslog + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Filters = append(m.Filters, &AccessLogFilter{}) + if err := m.Filters[len(m.Filters)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipAccesslog(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthAccesslog + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *HeaderFilter) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAccesslog + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: HeaderFilter: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: HeaderFilter: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAccesslog + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthAccesslog + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Header == nil { + m.Header = &route.HeaderMatcher{} + } + if err := m.Header.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipAccesslog(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthAccesslog + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ResponseFlagFilter) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAccesslog + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ResponseFlagFilter: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ResponseFlagFilter: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Flags", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAccesslog + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthAccesslog + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Flags = append(m.Flags, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipAccesslog(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthAccesslog + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipAccesslog(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowAccesslog + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowAccesslog + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + return iNdEx, nil + case 1: + iNdEx += 8 + return iNdEx, nil + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowAccesslog + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + iNdEx += length + if length < 0 { + return 0, ErrInvalidLengthAccesslog + } + return iNdEx, nil + case 3: + for { + var innerWire uint64 + var start int = iNdEx + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowAccesslog + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + innerWire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + innerWireType := int(innerWire & 0x7) + if innerWireType == 4 { + break + } + next, err := skipAccesslog(dAtA[start:]) + if err != nil { + return 0, err + } + iNdEx = start + next + } + return iNdEx, nil + case 4: + return iNdEx, nil + case 5: + iNdEx += 4 + return iNdEx, nil + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + } + panic("unreachable") +} + +var ( + ErrInvalidLengthAccesslog = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowAccesslog = fmt.Errorf("proto: integer overflow") +) + +func init() { + proto.RegisterFile("envoy/config/filter/accesslog/v2/accesslog.proto", fileDescriptor_accesslog_227c9aa0019a1c53) +} + +var fileDescriptor_accesslog_227c9aa0019a1c53 = []byte{ + // 928 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x95, 0xc1, 0x6f, 0xdb, 0xb6, + 0x17, 0xc7, 0x2b, 0x26, 0x76, 0xed, 0xd7, 0xc6, 0xd6, 0x8f, 0x08, 0x7e, 0xf1, 0x82, 0x2c, 0xf0, + 0x74, 0x2a, 0x3a, 0x40, 0xea, 0xdc, 0xad, 0xa7, 0x62, 0x58, 0xed, 0xda, 0xb3, 0x31, 0xaf, 0x59, + 0x99, 0x1a, 0x2b, 0x36, 0x20, 0x06, 0x2d, 0xd1, 0xb6, 0x50, 0x59, 0x14, 0x28, 0xda, 0x40, 0xae, + 0x3b, 0xee, 0xd8, 0xeb, 0xfe, 0x91, 0x61, 0xbb, 0x74, 0xb7, 0x1d, 0xf7, 0x27, 0x0c, 0xb9, 0xf5, + 0xba, 0xbf, 0x60, 0x10, 0x49, 0x29, 0xb6, 0x5b, 0xc0, 0xc1, 0xb0, 0x1d, 0x6c, 0x89, 0x7c, 0xfc, + 0x7e, 0xde, 0x7b, 0x14, 0xdf, 0x23, 0x3c, 0x60, 0xf1, 0x8a, 0x5f, 0x7a, 0x3e, 0x8f, 0xa7, 0xe1, + 0xcc, 0x9b, 0x86, 0x91, 0x64, 0xc2, 0xa3, 0xbe, 0xcf, 0xd2, 0x34, 0xe2, 0x33, 0x6f, 0xd5, 0xba, + 0x1e, 0xb8, 0x89, 0xe0, 0x92, 0xe3, 0xa6, 0x52, 0xb8, 0x5a, 0xe1, 0x6a, 0x85, 0x7b, 0xbd, 0x68, + 0xd5, 0x3a, 0x3e, 0xd1, 0x4c, 0x9a, 0x84, 0x99, 0xde, 0xe7, 0x82, 0x79, 0x13, 0x9a, 0x32, 0xad, + 0x3f, 0x3e, 0xdd, 0xb0, 0x0a, 0xbe, 0x94, 0x4c, 0xff, 0x1b, 0x7b, 0x43, 0xdb, 0xe5, 0x65, 0xc2, + 0xbc, 0x84, 0x09, 0x9f, 0xc5, 0xd2, 0x58, 0x4e, 0x66, 0x9c, 0xcf, 0x22, 0xe6, 0xa9, 0xd1, 0x64, + 0x39, 0xf5, 0x52, 0x29, 0x96, 0x7e, 0x6e, 0x3d, 0x5a, 0xd1, 0x28, 0x0c, 0xa8, 0x64, 0x5e, 0xfe, + 0xa2, 0x0d, 0xce, 0x4f, 0x16, 0x54, 0x9f, 0xa8, 0xf8, 0x86, 0x7c, 0x86, 0x31, 0xec, 0xc7, 0x74, + 0xc1, 0x1a, 0x56, 0xd3, 0xba, 0x57, 0x25, 0xea, 0x1d, 0x0f, 0xa0, 0xac, 0xf3, 0x68, 0xa0, 0xa6, + 0x75, 0xef, 0x4e, 0xeb, 0x13, 0x77, 0x57, 0x8e, 0x6e, 0x01, 0xec, 0x29, 0x23, 0x31, 0x00, 0xec, + 0x41, 0x59, 0xab, 0x1a, 0x7b, 0x0a, 0x75, 0xe4, 0xea, 0xa0, 0xdd, 0x3c, 0x68, 0xf7, 0x5c, 0x05, + 0x4d, 0xcc, 0x32, 0xe7, 0xaf, 0x32, 0xd4, 0xb7, 0x60, 0x78, 0x02, 0x38, 0x95, 0x54, 0x2e, 0xd3, + 0xb1, 0xcf, 0x03, 0x36, 0x36, 0xb1, 0x59, 0x0a, 0xd8, 0xda, 0x1d, 0xdb, 0xb9, 0xd2, 0x76, 0x78, + 0xc0, 0x34, 0xaf, 0x7f, 0x8b, 0xd8, 0xe9, 0xd6, 0x1c, 0xfe, 0x1e, 0xea, 0xc1, 0x52, 0x50, 0x19, + 0xf2, 0x78, 0xbc, 0x91, 0xfc, 0x83, 0xdd, 0x0e, 0x9e, 0x1a, 0x61, 0x81, 0xaf, 0x05, 0x1b, 0x33, + 0x98, 0xc3, 0x51, 0xcc, 0xe5, 0x78, 0xce, 0x68, 0x24, 0xe7, 0x63, 0x7f, 0xce, 0xfc, 0x57, 0xb9, + 0x13, 0xbd, 0x2d, 0x8f, 0x76, 0x3b, 0x79, 0xc6, 0x65, 0x5f, 0xe9, 0x3b, 0x99, 0xbc, 0x70, 0x75, + 0x18, 0xbf, 0x67, 0x1e, 0x5f, 0x80, 0x2d, 0x05, 0xf5, 0x19, 0x9d, 0x44, 0xc5, 0x7e, 0xed, 0xdf, + 0xf4, 0x5b, 0xbe, 0xc8, 0x95, 0x85, 0x93, 0xba, 0xdc, 0x9c, 0xc2, 0x2f, 0xa1, 0x26, 0x96, 0xb1, + 0x0c, 0x17, 0x05, 0xbd, 0xa4, 0xe8, 0xde, 0x6e, 0x3a, 0xd1, 0xba, 0x82, 0x7d, 0x20, 0xd6, 0x27, + 0xf0, 0x10, 0x80, 0xc6, 0x41, 0x4e, 0x2d, 0x2b, 0xea, 0xc7, 0x37, 0x38, 0x7f, 0x71, 0x50, 0x10, + 0xab, 0x34, 0x1f, 0xe0, 0x01, 0x54, 0xb9, 0xc8, 0x61, 0xb7, 0x15, 0xec, 0xfe, 0x6e, 0xd8, 0x99, + 0x28, 0x58, 0x15, 0x6e, 0xde, 0xf1, 0x08, 0x0e, 0xe6, 0x8c, 0x06, 0xac, 0xc0, 0x55, 0x14, 0xce, + 0xdd, 0x8d, 0xeb, 0x2b, 0x59, 0x81, 0xbc, 0x3b, 0x5f, 0x1b, 0xe3, 0x39, 0x1c, 0x0a, 0x96, 0x26, + 0x3c, 0x4e, 0xd9, 0x78, 0x1a, 0xd1, 0x59, 0x4e, 0xaf, 0x2a, 0xfa, 0xa7, 0x37, 0xd8, 0x4f, 0xa3, + 0xee, 0x45, 0x74, 0x56, 0xf8, 0xc0, 0xe2, 0x9d, 0xd9, 0xf6, 0x07, 0x60, 0x6b, 0xfd, 0x38, 0x4d, + 0x98, 0x1f, 0x4e, 0x43, 0x26, 0x70, 0xe9, 0xe7, 0xb7, 0x6f, 0xf6, 0x2c, 0xe7, 0x57, 0x0b, 0xec, + 0x0e, 0x5f, 0x24, 0x54, 0x84, 0x69, 0x71, 0x68, 0x9f, 0x03, 0xe2, 0x89, 0xaa, 0xb2, 0x5a, 0xeb, + 0xb3, 0xdd, 0x71, 0x6c, 0xeb, 0xdd, 0xb3, 0xa4, 0x0d, 0xbf, 0xbc, 0x7d, 0xb3, 0x57, 0xfa, 0xc1, + 0x42, 0xb6, 0x45, 0x10, 0x4f, 0xf0, 0x23, 0x28, 0xad, 0x68, 0xb4, 0x64, 0xa6, 0xb4, 0x9a, 0x86, + 0x4a, 0x93, 0x30, 0x23, 0x64, 0x9d, 0x31, 0x3f, 0x1e, 0xa3, 0x41, 0x2c, 0x1f, 0xb6, 0x88, 0x5e, + 0xee, 0x9c, 0x00, 0x3a, 0x4b, 0x70, 0x19, 0x50, 0xf7, 0xb9, 0x7d, 0x2b, 0x7b, 0x7e, 0xd9, 0xb5, + 0xad, 0xec, 0x39, 0xec, 0xda, 0xc8, 0x11, 0x60, 0x6f, 0x97, 0x38, 0xbe, 0x00, 0xf0, 0x8b, 0x80, + 0x6e, 0xde, 0x2a, 0xb6, 0x93, 0x30, 0x19, 0xfc, 0xa8, 0x32, 0x58, 0x23, 0x3a, 0x09, 0xd4, 0x36, + 0xab, 0xfe, 0x3f, 0xf7, 0xf8, 0x7f, 0x38, 0x7c, 0x5f, 0x0b, 0x70, 0xfe, 0x07, 0xf5, 0xad, 0x82, + 0x75, 0x7e, 0xb3, 0xe0, 0x60, 0xa3, 0xcc, 0xf0, 0x7d, 0xb8, 0x93, 0xd7, 0xeb, 0x2b, 0x76, 0xa9, + 0x9b, 0x7d, 0xbb, 0x9a, 0x79, 0xda, 0x17, 0xa8, 0x69, 0x11, 0x30, 0xd6, 0xaf, 0xd8, 0x25, 0xee, + 0x41, 0xdd, 0xdc, 0x33, 0xe3, 0x94, 0x2e, 0x92, 0x88, 0x05, 0xe6, 0x73, 0x7d, 0x68, 0xb2, 0xc9, + 0xae, 0x22, 0xb7, 0x27, 0xa8, 0x9f, 0x65, 0x4f, 0xa3, 0x6f, 0xf4, 0x62, 0x52, 0x33, 0xaa, 0x73, + 0x2d, 0xc2, 0x8f, 0xe1, 0x78, 0x99, 0xb2, 0x71, 0x18, 0x07, 0x2c, 0x61, 0x71, 0x90, 0xf1, 0x04, + 0x8d, 0x03, 0xbe, 0x88, 0x59, 0x9a, 0xaa, 0xbe, 0x57, 0x21, 0x8d, 0x65, 0xca, 0x06, 0xd7, 0x0b, + 0x48, 0x61, 0x77, 0x02, 0xa8, 0x16, 0x35, 0x8d, 0xbf, 0x85, 0xdb, 0x7a, 0xef, 0xd2, 0x86, 0xd5, + 0xdc, 0xfb, 0x47, 0x37, 0x92, 0xd9, 0xd7, 0xd7, 0x16, 0xaa, 0x20, 0x92, 0xd3, 0x1c, 0x1f, 0x2a, + 0x79, 0xb1, 0xaf, 0x3b, 0x41, 0xff, 0xaa, 0x93, 0x11, 0xdc, 0x5d, 0x6f, 0x01, 0xb8, 0x0b, 0x65, + 0xdd, 0x02, 0xcc, 0x29, 0xf9, 0x68, 0xb3, 0x0c, 0xf4, 0xe5, 0xaf, 0x15, 0x5f, 0x53, 0xe9, 0xcf, + 0xb7, 0x0e, 0x85, 0x11, 0x3b, 0x12, 0xf0, 0xbb, 0xb5, 0x8f, 0x2f, 0xa0, 0x94, 0xb5, 0x11, 0xbd, + 0x51, 0xd5, 0x76, 0x3f, 0x13, 0x76, 0x5e, 0x5b, 0x5f, 0x38, 0x9f, 0x8b, 0xc7, 0x04, 0x0d, 0xfb, + 0x04, 0x8d, 0xb2, 0xdf, 0x0b, 0x82, 0x86, 0x84, 0xa0, 0x51, 0xf6, 0xeb, 0x11, 0x34, 0xea, 0x10, + 0x34, 0x3a, 0x23, 0xe8, 0x19, 0x21, 0xe8, 0xe9, 0x80, 0xa0, 0xde, 0x80, 0x20, 0x32, 0x24, 0xfb, + 0xa3, 0x27, 0xdd, 0x97, 0x64, 0x9f, 0x0c, 0xcf, 0xbb, 0x44, 0x63, 0xdb, 0xf6, 0xef, 0x57, 0xa7, + 0xd6, 0x1f, 0x57, 0xa7, 0xd6, 0x9f, 0x57, 0xa7, 0xd6, 0x77, 0x68, 0xd5, 0x9a, 0x94, 0xd5, 0x55, + 0xfe, 0xf0, 0xef, 0x00, 0x00, 0x00, 0xff, 0xff, 0x1c, 0x57, 0x65, 0x8d, 0x3b, 0x09, 0x00, 0x00, +} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/config/filter/accesslog/v2/accesslog.pb.validate.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/config/filter/accesslog/v2/accesslog.pb.validate.go new file mode 100644 index 000000000000..2502cfac2a45 --- /dev/null +++ b/vendor/github.com/envoyproxy/go-control-plane/envoy/config/filter/accesslog/v2/accesslog.pb.validate.go @@ -0,0 +1,836 @@ +// Code generated by protoc-gen-validate +// source: envoy/config/filter/accesslog/v2/accesslog.proto +// DO NOT EDIT!!! + +package v2 + +import ( + "bytes" + "errors" + "fmt" + "net" + "net/mail" + "net/url" + "regexp" + "strings" + "time" + "unicode/utf8" + + "github.com/gogo/protobuf/types" +) + +// ensure the imports are used +var ( + _ = bytes.MinRead + _ = errors.New("") + _ = fmt.Print + _ = utf8.UTFMax + _ = (*regexp.Regexp)(nil) + _ = (*strings.Reader)(nil) + _ = net.IPv4len + _ = time.Duration(0) + _ = (*url.URL)(nil) + _ = (*mail.Address)(nil) + _ = types.DynamicAny{} +) + +// Validate checks the field values on AccessLog with the rules defined in the +// proto definition for this message. If any rules are violated, an error is returned. +func (m *AccessLog) Validate() error { + if m == nil { + return nil + } + + // no validation rules for Name + + if v, ok := interface{}(m.GetFilter()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return AccessLogValidationError{ + Field: "Filter", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + if v, ok := interface{}(m.GetConfig()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return AccessLogValidationError{ + Field: "Config", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + return nil +} + +// AccessLogValidationError is the validation error returned by +// AccessLog.Validate if the designated constraints aren't met. +type AccessLogValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e AccessLogValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sAccessLog.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = AccessLogValidationError{} + +// Validate checks the field values on AccessLogFilter with the rules defined +// in the proto definition for this message. If any rules are violated, an +// error is returned. +func (m *AccessLogFilter) Validate() error { + if m == nil { + return nil + } + + switch m.FilterSpecifier.(type) { + + case *AccessLogFilter_StatusCodeFilter: + + if v, ok := interface{}(m.GetStatusCodeFilter()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return AccessLogFilterValidationError{ + Field: "StatusCodeFilter", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + case *AccessLogFilter_DurationFilter: + + if v, ok := interface{}(m.GetDurationFilter()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return AccessLogFilterValidationError{ + Field: "DurationFilter", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + case *AccessLogFilter_NotHealthCheckFilter: + + if v, ok := interface{}(m.GetNotHealthCheckFilter()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return AccessLogFilterValidationError{ + Field: "NotHealthCheckFilter", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + case *AccessLogFilter_TraceableFilter: + + if v, ok := interface{}(m.GetTraceableFilter()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return AccessLogFilterValidationError{ + Field: "TraceableFilter", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + case *AccessLogFilter_RuntimeFilter: + + if v, ok := interface{}(m.GetRuntimeFilter()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return AccessLogFilterValidationError{ + Field: "RuntimeFilter", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + case *AccessLogFilter_AndFilter: + + if v, ok := interface{}(m.GetAndFilter()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return AccessLogFilterValidationError{ + Field: "AndFilter", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + case *AccessLogFilter_OrFilter: + + if v, ok := interface{}(m.GetOrFilter()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return AccessLogFilterValidationError{ + Field: "OrFilter", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + case *AccessLogFilter_HeaderFilter: + + if v, ok := interface{}(m.GetHeaderFilter()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return AccessLogFilterValidationError{ + Field: "HeaderFilter", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + case *AccessLogFilter_ResponseFlagFilter: + + if v, ok := interface{}(m.GetResponseFlagFilter()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return AccessLogFilterValidationError{ + Field: "ResponseFlagFilter", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + default: + return AccessLogFilterValidationError{ + Field: "FilterSpecifier", + Reason: "value is required", + } + + } + + return nil +} + +// AccessLogFilterValidationError is the validation error returned by +// AccessLogFilter.Validate if the designated constraints aren't met. +type AccessLogFilterValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e AccessLogFilterValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sAccessLogFilter.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = AccessLogFilterValidationError{} + +// Validate checks the field values on ComparisonFilter with the rules defined +// in the proto definition for this message. If any rules are violated, an +// error is returned. +func (m *ComparisonFilter) Validate() error { + if m == nil { + return nil + } + + if _, ok := ComparisonFilter_Op_name[int32(m.GetOp())]; !ok { + return ComparisonFilterValidationError{ + Field: "Op", + Reason: "value must be one of the defined enum values", + } + } + + if v, ok := interface{}(m.GetValue()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return ComparisonFilterValidationError{ + Field: "Value", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + return nil +} + +// ComparisonFilterValidationError is the validation error returned by +// ComparisonFilter.Validate if the designated constraints aren't met. +type ComparisonFilterValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e ComparisonFilterValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sComparisonFilter.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = ComparisonFilterValidationError{} + +// Validate checks the field values on StatusCodeFilter with the rules defined +// in the proto definition for this message. If any rules are violated, an +// error is returned. +func (m *StatusCodeFilter) Validate() error { + if m == nil { + return nil + } + + if m.GetComparison() == nil { + return StatusCodeFilterValidationError{ + Field: "Comparison", + Reason: "value is required", + } + } + + if v, ok := interface{}(m.GetComparison()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return StatusCodeFilterValidationError{ + Field: "Comparison", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + return nil +} + +// StatusCodeFilterValidationError is the validation error returned by +// StatusCodeFilter.Validate if the designated constraints aren't met. +type StatusCodeFilterValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e StatusCodeFilterValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sStatusCodeFilter.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = StatusCodeFilterValidationError{} + +// Validate checks the field values on DurationFilter with the rules defined in +// the proto definition for this message. If any rules are violated, an error +// is returned. +func (m *DurationFilter) Validate() error { + if m == nil { + return nil + } + + if m.GetComparison() == nil { + return DurationFilterValidationError{ + Field: "Comparison", + Reason: "value is required", + } + } + + if v, ok := interface{}(m.GetComparison()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return DurationFilterValidationError{ + Field: "Comparison", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + return nil +} + +// DurationFilterValidationError is the validation error returned by +// DurationFilter.Validate if the designated constraints aren't met. +type DurationFilterValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e DurationFilterValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sDurationFilter.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = DurationFilterValidationError{} + +// Validate checks the field values on NotHealthCheckFilter with the rules +// defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *NotHealthCheckFilter) Validate() error { + if m == nil { + return nil + } + + return nil +} + +// NotHealthCheckFilterValidationError is the validation error returned by +// NotHealthCheckFilter.Validate if the designated constraints aren't met. +type NotHealthCheckFilterValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e NotHealthCheckFilterValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sNotHealthCheckFilter.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = NotHealthCheckFilterValidationError{} + +// Validate checks the field values on TraceableFilter with the rules defined +// in the proto definition for this message. If any rules are violated, an +// error is returned. +func (m *TraceableFilter) Validate() error { + if m == nil { + return nil + } + + return nil +} + +// TraceableFilterValidationError is the validation error returned by +// TraceableFilter.Validate if the designated constraints aren't met. +type TraceableFilterValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e TraceableFilterValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sTraceableFilter.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = TraceableFilterValidationError{} + +// Validate checks the field values on RuntimeFilter with the rules defined in +// the proto definition for this message. If any rules are violated, an error +// is returned. +func (m *RuntimeFilter) Validate() error { + if m == nil { + return nil + } + + if len(m.GetRuntimeKey()) < 1 { + return RuntimeFilterValidationError{ + Field: "RuntimeKey", + Reason: "value length must be at least 1 bytes", + } + } + + if v, ok := interface{}(m.GetPercentSampled()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return RuntimeFilterValidationError{ + Field: "PercentSampled", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + // no validation rules for UseIndependentRandomness + + return nil +} + +// RuntimeFilterValidationError is the validation error returned by +// RuntimeFilter.Validate if the designated constraints aren't met. +type RuntimeFilterValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e RuntimeFilterValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sRuntimeFilter.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = RuntimeFilterValidationError{} + +// Validate checks the field values on AndFilter with the rules defined in the +// proto definition for this message. If any rules are violated, an error is returned. +func (m *AndFilter) Validate() error { + if m == nil { + return nil + } + + if len(m.GetFilters()) < 2 { + return AndFilterValidationError{ + Field: "Filters", + Reason: "value must contain at least 2 item(s)", + } + } + + for idx, item := range m.GetFilters() { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return AndFilterValidationError{ + Field: fmt.Sprintf("Filters[%v]", idx), + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + } + + return nil +} + +// AndFilterValidationError is the validation error returned by +// AndFilter.Validate if the designated constraints aren't met. +type AndFilterValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e AndFilterValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sAndFilter.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = AndFilterValidationError{} + +// Validate checks the field values on OrFilter with the rules defined in the +// proto definition for this message. If any rules are violated, an error is returned. +func (m *OrFilter) Validate() error { + if m == nil { + return nil + } + + if len(m.GetFilters()) < 2 { + return OrFilterValidationError{ + Field: "Filters", + Reason: "value must contain at least 2 item(s)", + } + } + + for idx, item := range m.GetFilters() { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return OrFilterValidationError{ + Field: fmt.Sprintf("Filters[%v]", idx), + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + } + + return nil +} + +// OrFilterValidationError is the validation error returned by +// OrFilter.Validate if the designated constraints aren't met. +type OrFilterValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e OrFilterValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sOrFilter.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = OrFilterValidationError{} + +// Validate checks the field values on HeaderFilter with the rules defined in +// the proto definition for this message. If any rules are violated, an error +// is returned. +func (m *HeaderFilter) Validate() error { + if m == nil { + return nil + } + + if m.GetHeader() == nil { + return HeaderFilterValidationError{ + Field: "Header", + Reason: "value is required", + } + } + + if v, ok := interface{}(m.GetHeader()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return HeaderFilterValidationError{ + Field: "Header", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + return nil +} + +// HeaderFilterValidationError is the validation error returned by +// HeaderFilter.Validate if the designated constraints aren't met. +type HeaderFilterValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e HeaderFilterValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sHeaderFilter.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = HeaderFilterValidationError{} + +// Validate checks the field values on ResponseFlagFilter with the rules +// defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *ResponseFlagFilter) Validate() error { + if m == nil { + return nil + } + + for idx, item := range m.GetFlags() { + _, _ = idx, item + + if _, ok := _ResponseFlagFilter_Flags_InLookup[item]; !ok { + return ResponseFlagFilterValidationError{ + Field: fmt.Sprintf("Flags[%v]", idx), + Reason: "value must be in list [LH UH UT LR UR UF UC UO NR DI FI RL UAEX RLSE]", + } + } + + } + + return nil +} + +// ResponseFlagFilterValidationError is the validation error returned by +// ResponseFlagFilter.Validate if the designated constraints aren't met. +type ResponseFlagFilterValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e ResponseFlagFilterValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sResponseFlagFilter.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = ResponseFlagFilterValidationError{} + +var _ResponseFlagFilter_Flags_InLookup = map[string]struct{}{ + "LH": {}, + "UH": {}, + "UT": {}, + "LR": {}, + "UR": {}, + "UF": {}, + "UC": {}, + "UO": {}, + "NR": {}, + "DI": {}, + "FI": {}, + "RL": {}, + "UAEX": {}, + "RLSE": {}, +} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/config/filter/network/ext_authz/v2/ext_authz.pb.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/config/filter/network/ext_authz/v2/ext_authz.pb.go new file mode 100644 index 000000000000..88b5c6ee4c22 --- /dev/null +++ b/vendor/github.com/envoyproxy/go-control-plane/envoy/config/filter/network/ext_authz/v2/ext_authz.pb.go @@ -0,0 +1,453 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: envoy/config/filter/network/ext_authz/v2/ext_authz.proto + +package v2 + +import proto "github.com/gogo/protobuf/proto" +import fmt "fmt" +import math "math" +import core "github.com/envoyproxy/go-control-plane/envoy/api/v2/core" +import _ "github.com/lyft/protoc-gen-validate/validate" + +import io "io" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package + +// External Authorization filter calls out to an external service over the +// gRPC Authorization API defined by +// :ref:`CheckRequest `. +// A failed check will cause this filter to close the TCP connection. +type ExtAuthz struct { + // The prefix to use when emitting statistics. + StatPrefix string `protobuf:"bytes,1,opt,name=stat_prefix,json=statPrefix,proto3" json:"stat_prefix,omitempty"` + // The external authorization gRPC service configuration. + // The default timeout is set to 200ms by this filter. + GrpcService *core.GrpcService `protobuf:"bytes,2,opt,name=grpc_service,json=grpcService" json:"grpc_service,omitempty"` + // The filter's behaviour in case the external authorization service does + // not respond back. When it is set to true, Envoy will also allow traffic in case of + // communication failure between authorization service and the proxy. + // Defaults to false. + FailureModeAllow bool `protobuf:"varint,3,opt,name=failure_mode_allow,json=failureModeAllow,proto3" json:"failure_mode_allow,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ExtAuthz) Reset() { *m = ExtAuthz{} } +func (m *ExtAuthz) String() string { return proto.CompactTextString(m) } +func (*ExtAuthz) ProtoMessage() {} +func (*ExtAuthz) Descriptor() ([]byte, []int) { + return fileDescriptor_ext_authz_7a3ac1c283c600e4, []int{0} +} +func (m *ExtAuthz) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ExtAuthz) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ExtAuthz.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *ExtAuthz) XXX_Merge(src proto.Message) { + xxx_messageInfo_ExtAuthz.Merge(dst, src) +} +func (m *ExtAuthz) XXX_Size() int { + return m.Size() +} +func (m *ExtAuthz) XXX_DiscardUnknown() { + xxx_messageInfo_ExtAuthz.DiscardUnknown(m) +} + +var xxx_messageInfo_ExtAuthz proto.InternalMessageInfo + +func (m *ExtAuthz) GetStatPrefix() string { + if m != nil { + return m.StatPrefix + } + return "" +} + +func (m *ExtAuthz) GetGrpcService() *core.GrpcService { + if m != nil { + return m.GrpcService + } + return nil +} + +func (m *ExtAuthz) GetFailureModeAllow() bool { + if m != nil { + return m.FailureModeAllow + } + return false +} + +func init() { + proto.RegisterType((*ExtAuthz)(nil), "envoy.config.filter.network.ext_authz.v2.ExtAuthz") +} +func (m *ExtAuthz) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ExtAuthz) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.StatPrefix) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintExtAuthz(dAtA, i, uint64(len(m.StatPrefix))) + i += copy(dAtA[i:], m.StatPrefix) + } + if m.GrpcService != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintExtAuthz(dAtA, i, uint64(m.GrpcService.Size())) + n1, err := m.GrpcService.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n1 + } + if m.FailureModeAllow { + dAtA[i] = 0x18 + i++ + if m.FailureModeAllow { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i++ + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func encodeVarintExtAuthz(dAtA []byte, offset int, v uint64) int { + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return offset + 1 +} +func (m *ExtAuthz) Size() (n int) { + var l int + _ = l + l = len(m.StatPrefix) + if l > 0 { + n += 1 + l + sovExtAuthz(uint64(l)) + } + if m.GrpcService != nil { + l = m.GrpcService.Size() + n += 1 + l + sovExtAuthz(uint64(l)) + } + if m.FailureModeAllow { + n += 2 + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func sovExtAuthz(x uint64) (n int) { + for { + n++ + x >>= 7 + if x == 0 { + break + } + } + return n +} +func sozExtAuthz(x uint64) (n int) { + return sovExtAuthz(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *ExtAuthz) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowExtAuthz + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ExtAuthz: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ExtAuthz: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field StatPrefix", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowExtAuthz + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthExtAuthz + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.StatPrefix = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field GrpcService", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowExtAuthz + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthExtAuthz + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.GrpcService == nil { + m.GrpcService = &core.GrpcService{} + } + if err := m.GrpcService.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field FailureModeAllow", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowExtAuthz + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.FailureModeAllow = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skipExtAuthz(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthExtAuthz + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipExtAuthz(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowExtAuthz + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowExtAuthz + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + return iNdEx, nil + case 1: + iNdEx += 8 + return iNdEx, nil + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowExtAuthz + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + iNdEx += length + if length < 0 { + return 0, ErrInvalidLengthExtAuthz + } + return iNdEx, nil + case 3: + for { + var innerWire uint64 + var start int = iNdEx + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowExtAuthz + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + innerWire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + innerWireType := int(innerWire & 0x7) + if innerWireType == 4 { + break + } + next, err := skipExtAuthz(dAtA[start:]) + if err != nil { + return 0, err + } + iNdEx = start + next + } + return iNdEx, nil + case 4: + return iNdEx, nil + case 5: + iNdEx += 4 + return iNdEx, nil + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + } + panic("unreachable") +} + +var ( + ErrInvalidLengthExtAuthz = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowExtAuthz = fmt.Errorf("proto: integer overflow") +) + +func init() { + proto.RegisterFile("envoy/config/filter/network/ext_authz/v2/ext_authz.proto", fileDescriptor_ext_authz_7a3ac1c283c600e4) +} + +var fileDescriptor_ext_authz_7a3ac1c283c600e4 = []byte{ + // 283 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x4c, 0x8f, 0x31, 0x4b, 0xc4, 0x30, + 0x14, 0xc7, 0x49, 0x4f, 0xe4, 0x2e, 0x75, 0x38, 0xba, 0x58, 0x6e, 0x28, 0x45, 0x1c, 0x8a, 0x48, + 0x02, 0x75, 0x71, 0xed, 0x81, 0x38, 0x09, 0x52, 0x37, 0x97, 0x12, 0xdb, 0xd7, 0x1a, 0xac, 0x4d, + 0xc8, 0xe5, 0x72, 0xd5, 0x2f, 0xe4, 0x77, 0x70, 0x72, 0x74, 0xf4, 0x23, 0x48, 0x37, 0xbf, 0x85, + 0xa4, 0x39, 0xa9, 0x5b, 0x5e, 0x7e, 0xef, 0xf7, 0x7f, 0xef, 0xe1, 0x4b, 0xe8, 0x8c, 0x78, 0xa1, + 0xa5, 0xe8, 0x6a, 0xde, 0xd0, 0x9a, 0xb7, 0x1a, 0x14, 0xed, 0x40, 0xef, 0x84, 0x7a, 0xa2, 0xd0, + 0xeb, 0x82, 0x6d, 0xf5, 0xe3, 0x2b, 0x35, 0xe9, 0x54, 0x10, 0xa9, 0x84, 0x16, 0x41, 0x32, 0x9a, + 0xc4, 0x99, 0xc4, 0x99, 0x64, 0x6f, 0x92, 0xa9, 0xd9, 0xa4, 0xab, 0x53, 0x37, 0x83, 0x49, 0x6e, + 0x73, 0x4a, 0xa1, 0x80, 0x36, 0x4a, 0x96, 0xc5, 0x06, 0x94, 0xe1, 0x25, 0xb8, 0xbc, 0xd5, 0xb1, + 0x61, 0x2d, 0xaf, 0x98, 0x06, 0xfa, 0xf7, 0x70, 0xe0, 0xe4, 0x0d, 0xe1, 0xf9, 0x55, 0xaf, 0x33, + 0x1b, 0x17, 0x9c, 0x61, 0x7f, 0xa3, 0x99, 0x2e, 0xa4, 0x82, 0x9a, 0xf7, 0x21, 0x8a, 0x51, 0xb2, + 0x58, 0x2f, 0xde, 0x7f, 0x3e, 0x66, 0x07, 0xca, 0x8b, 0x51, 0x8e, 0x2d, 0xbd, 0x1d, 0x61, 0x90, + 0xe1, 0xa3, 0xff, 0x73, 0x42, 0x2f, 0x46, 0x89, 0x9f, 0x46, 0xc4, 0x2d, 0xce, 0x24, 0x27, 0x26, + 0x25, 0x76, 0x1d, 0x72, 0xad, 0x64, 0x79, 0xe7, 0xba, 0x72, 0xbf, 0x99, 0x8a, 0xe0, 0x1c, 0x07, + 0x35, 0xe3, 0xed, 0x56, 0x41, 0xf1, 0x2c, 0x2a, 0x28, 0x58, 0xdb, 0x8a, 0x5d, 0x38, 0x8b, 0x51, + 0x32, 0xcf, 0x97, 0x7b, 0x72, 0x23, 0x2a, 0xc8, 0xec, 0xff, 0x7a, 0xf9, 0x39, 0x44, 0xe8, 0x6b, + 0x88, 0xd0, 0xf7, 0x10, 0xa1, 0x7b, 0xcf, 0xa4, 0x0f, 0x87, 0xe3, 0x09, 0x17, 0xbf, 0x01, 0x00, + 0x00, 0xff, 0xff, 0xe2, 0x7f, 0x73, 0x37, 0x67, 0x01, 0x00, 0x00, +} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/config/filter/network/ext_authz/v2/ext_authz.pb.validate.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/config/filter/network/ext_authz/v2/ext_authz.pb.validate.go new file mode 100644 index 000000000000..7546a8caba89 --- /dev/null +++ b/vendor/github.com/envoyproxy/go-control-plane/envoy/config/filter/network/ext_authz/v2/ext_authz.pb.validate.go @@ -0,0 +1,95 @@ +// Code generated by protoc-gen-validate +// source: envoy/config/filter/network/ext_authz/v2/ext_authz.proto +// DO NOT EDIT!!! + +package v2 + +import ( + "bytes" + "errors" + "fmt" + "net" + "net/mail" + "net/url" + "regexp" + "strings" + "time" + "unicode/utf8" + + "github.com/gogo/protobuf/types" +) + +// ensure the imports are used +var ( + _ = bytes.MinRead + _ = errors.New("") + _ = fmt.Print + _ = utf8.UTFMax + _ = (*regexp.Regexp)(nil) + _ = (*strings.Reader)(nil) + _ = net.IPv4len + _ = time.Duration(0) + _ = (*url.URL)(nil) + _ = (*mail.Address)(nil) + _ = types.DynamicAny{} +) + +// Validate checks the field values on ExtAuthz with the rules defined in the +// proto definition for this message. If any rules are violated, an error is returned. +func (m *ExtAuthz) Validate() error { + if m == nil { + return nil + } + + if len(m.GetStatPrefix()) < 1 { + return ExtAuthzValidationError{ + Field: "StatPrefix", + Reason: "value length must be at least 1 bytes", + } + } + + if v, ok := interface{}(m.GetGrpcService()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return ExtAuthzValidationError{ + Field: "GrpcService", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + // no validation rules for FailureModeAllow + + return nil +} + +// ExtAuthzValidationError is the validation error returned by +// ExtAuthz.Validate if the designated constraints aren't met. +type ExtAuthzValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e ExtAuthzValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sExtAuthz.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = ExtAuthzValidationError{} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/config/filter/network/http_connection_manager/v2/http_connection_manager.pb.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/config/filter/network/http_connection_manager/v2/http_connection_manager.pb.go new file mode 100644 index 000000000000..95631d4e30c2 --- /dev/null +++ b/vendor/github.com/envoyproxy/go-control-plane/envoy/config/filter/network/http_connection_manager/v2/http_connection_manager.pb.go @@ -0,0 +1,3598 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: envoy/config/filter/network/http_connection_manager/v2/http_connection_manager.proto + +package v2 + +import proto "github.com/gogo/protobuf/proto" +import fmt "fmt" +import math "math" +import v2 "github.com/envoyproxy/go-control-plane/envoy/api/v2" +import core "github.com/envoyproxy/go-control-plane/envoy/api/v2/core" +import v21 "github.com/envoyproxy/go-control-plane/envoy/config/filter/accesslog/v2" +import _type "github.com/envoyproxy/go-control-plane/envoy/type" +import _ "github.com/gogo/protobuf/gogoproto" +import types "github.com/gogo/protobuf/types" +import _ "github.com/lyft/protoc-gen-validate/validate" + +import time "time" + +import github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" + +import io "io" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf +var _ = time.Kitchen + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package + +type HttpConnectionManager_CodecType int32 + +const ( + // For every new connection, the connection manager will determine which + // codec to use. This mode supports both ALPN for TLS listeners as well as + // protocol inference for plaintext listeners. If ALPN data is available, it + // is preferred, otherwise protocol inference is used. In almost all cases, + // this is the right option to choose for this setting. + AUTO HttpConnectionManager_CodecType = 0 + // The connection manager will assume that the client is speaking HTTP/1.1. + HTTP1 HttpConnectionManager_CodecType = 1 + // The connection manager will assume that the client is speaking HTTP/2 + // (Envoy does not require HTTP/2 to take place over TLS or to use ALPN. + // Prior knowledge is allowed). + HTTP2 HttpConnectionManager_CodecType = 2 +) + +var HttpConnectionManager_CodecType_name = map[int32]string{ + 0: "AUTO", + 1: "HTTP1", + 2: "HTTP2", +} +var HttpConnectionManager_CodecType_value = map[string]int32{ + "AUTO": 0, + "HTTP1": 1, + "HTTP2": 2, +} + +func (x HttpConnectionManager_CodecType) String() string { + return proto.EnumName(HttpConnectionManager_CodecType_name, int32(x)) +} +func (HttpConnectionManager_CodecType) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_http_connection_manager_5c85b4f0eeee8fe7, []int{0, 0} +} + +// How to handle the :ref:`config_http_conn_man_headers_x-forwarded-client-cert` (XFCC) HTTP +// header. +type HttpConnectionManager_ForwardClientCertDetails int32 + +const ( + // Do not send the XFCC header to the next hop. This is the default value. + SANITIZE HttpConnectionManager_ForwardClientCertDetails = 0 + // When the client connection is mTLS (Mutual TLS), forward the XFCC header + // in the request. + FORWARD_ONLY HttpConnectionManager_ForwardClientCertDetails = 1 + // When the client connection is mTLS, append the client certificate + // information to the request’s XFCC header and forward it. + APPEND_FORWARD HttpConnectionManager_ForwardClientCertDetails = 2 + // When the client connection is mTLS, reset the XFCC header with the client + // certificate information and send it to the next hop. + SANITIZE_SET HttpConnectionManager_ForwardClientCertDetails = 3 + // Always forward the XFCC header in the request, regardless of whether the + // client connection is mTLS. + ALWAYS_FORWARD_ONLY HttpConnectionManager_ForwardClientCertDetails = 4 +) + +var HttpConnectionManager_ForwardClientCertDetails_name = map[int32]string{ + 0: "SANITIZE", + 1: "FORWARD_ONLY", + 2: "APPEND_FORWARD", + 3: "SANITIZE_SET", + 4: "ALWAYS_FORWARD_ONLY", +} +var HttpConnectionManager_ForwardClientCertDetails_value = map[string]int32{ + "SANITIZE": 0, + "FORWARD_ONLY": 1, + "APPEND_FORWARD": 2, + "SANITIZE_SET": 3, + "ALWAYS_FORWARD_ONLY": 4, +} + +func (x HttpConnectionManager_ForwardClientCertDetails) String() string { + return proto.EnumName(HttpConnectionManager_ForwardClientCertDetails_name, int32(x)) +} +func (HttpConnectionManager_ForwardClientCertDetails) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_http_connection_manager_5c85b4f0eeee8fe7, []int{0, 1} +} + +type HttpConnectionManager_Tracing_OperationName int32 + +const ( + // The HTTP listener is used for ingress/incoming requests. + INGRESS HttpConnectionManager_Tracing_OperationName = 0 + // The HTTP listener is used for egress/outgoing requests. + EGRESS HttpConnectionManager_Tracing_OperationName = 1 +) + +var HttpConnectionManager_Tracing_OperationName_name = map[int32]string{ + 0: "INGRESS", + 1: "EGRESS", +} +var HttpConnectionManager_Tracing_OperationName_value = map[string]int32{ + "INGRESS": 0, + "EGRESS": 1, +} + +func (x HttpConnectionManager_Tracing_OperationName) String() string { + return proto.EnumName(HttpConnectionManager_Tracing_OperationName_name, int32(x)) +} +func (HttpConnectionManager_Tracing_OperationName) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_http_connection_manager_5c85b4f0eeee8fe7, []int{0, 0, 0} +} + +// [#comment:next free field: 25] +type HttpConnectionManager struct { + // Supplies the type of codec that the connection manager should use. + CodecType HttpConnectionManager_CodecType `protobuf:"varint,1,opt,name=codec_type,json=codecType,proto3,enum=envoy.config.filter.network.http_connection_manager.v2.HttpConnectionManager_CodecType" json:"codec_type,omitempty"` + // The human readable prefix to use when emitting statistics for the + // connection manager. See the :ref:`statistics documentation ` for + // more information. + StatPrefix string `protobuf:"bytes,2,opt,name=stat_prefix,json=statPrefix,proto3" json:"stat_prefix,omitempty"` + // Types that are valid to be assigned to RouteSpecifier: + // *HttpConnectionManager_Rds + // *HttpConnectionManager_RouteConfig + RouteSpecifier isHttpConnectionManager_RouteSpecifier `protobuf_oneof:"route_specifier"` + // A list of individual HTTP filters that make up the filter chain for + // requests made to the connection manager. Order matters as the filters are + // processed sequentially as request events happen. + HttpFilters []*HttpFilter `protobuf:"bytes,5,rep,name=http_filters,json=httpFilters" json:"http_filters,omitempty"` + // Whether the connection manager manipulates the :ref:`config_http_conn_man_headers_user-agent` + // and :ref:`config_http_conn_man_headers_downstream-service-cluster` headers. See the linked + // documentation for more information. Defaults to false. + AddUserAgent *types.BoolValue `protobuf:"bytes,6,opt,name=add_user_agent,json=addUserAgent" json:"add_user_agent,omitempty"` + // Presence of the object defines whether the connection manager + // emits :ref:`tracing ` data to the :ref:`configured tracing provider + // `. + Tracing *HttpConnectionManager_Tracing `protobuf:"bytes,7,opt,name=tracing" json:"tracing,omitempty"` + // Additional HTTP/1 settings that are passed to the HTTP/1 codec. + HttpProtocolOptions *core.Http1ProtocolOptions `protobuf:"bytes,8,opt,name=http_protocol_options,json=httpProtocolOptions" json:"http_protocol_options,omitempty"` + // Additional HTTP/2 settings that are passed directly to the HTTP/2 codec. + Http2ProtocolOptions *core.Http2ProtocolOptions `protobuf:"bytes,9,opt,name=http2_protocol_options,json=http2ProtocolOptions" json:"http2_protocol_options,omitempty"` + // An optional override that the connection manager will write to the server + // header in responses. If not set, the default is *envoy*. + ServerName string `protobuf:"bytes,10,opt,name=server_name,json=serverName,proto3" json:"server_name,omitempty"` + // The idle timeout for connections managed by the connection manager. The + // idle timeout is defined as the period in which there are no active + // requests. If not set, there is no idle timeout. When the idle timeout is + // reached the connection will be closed. If the connection is an HTTP/2 + // connection a drain sequence will occur prior to closing the connection. See + // :ref:`drain_timeout + // `. + IdleTimeout *time.Duration `protobuf:"bytes,11,opt,name=idle_timeout,json=idleTimeout,stdduration" json:"idle_timeout,omitempty"` + // The stream idle timeout for connections managed by the connection manager. + // If not specified, this defaults to 5 minutes. The default value was selected + // so as not to interfere with any smaller configured timeouts that may have + // existed in configurations prior to the introduction of this feature, while + // introducing robustness to TCP connections that terminate without a FIN. + // + // This idle timeout applies to new streams and is overridable by the + // :ref:`route-level idle_timeout + // `. Even on a stream in + // which the override applies, prior to receipt of the initial request + // headers, the :ref:`stream_idle_timeout + // ` + // applies. Each time an encode/decode event for headers or data is processed + // for the stream, the timer will be reset. If the timeout fires, the stream + // is terminated with a 408 Request Timeout error code if no upstream response + // header has been received, otherwise a stream reset occurs. + // + // Note that it is possible to idle timeout even if the wire traffic for a stream is non-idle, due + // to the granularity of events presented to the connection manager. For example, while receiving + // very large request headers, it may be the case that there is traffic regularly arriving on the + // wire while the connection manage is only able to observe the end-of-headers event, hence the + // stream may still idle timeout. + // + // A value of 0 will completely disable the connection manager stream idle + // timeout, although per-route idle timeout overrides will continue to apply. + StreamIdleTimeout *time.Duration `protobuf:"bytes,24,opt,name=stream_idle_timeout,json=streamIdleTimeout,stdduration" json:"stream_idle_timeout,omitempty"` + // The time that Envoy will wait between sending an HTTP/2 “shutdown + // notification” (GOAWAY frame with max stream ID) and a final GOAWAY frame. + // This is used so that Envoy provides a grace period for new streams that + // race with the final GOAWAY frame. During this grace period, Envoy will + // continue to accept new streams. After the grace period, a final GOAWAY + // frame is sent and Envoy will start refusing new streams. Draining occurs + // both when a connection hits the idle timeout or during general server + // draining. The default grace period is 5000 milliseconds (5 seconds) if this + // option is not specified. + DrainTimeout *time.Duration `protobuf:"bytes,12,opt,name=drain_timeout,json=drainTimeout,stdduration" json:"drain_timeout,omitempty"` + // Configuration for :ref:`HTTP access logs ` + // emitted by the connection manager. + AccessLog []*v21.AccessLog `protobuf:"bytes,13,rep,name=access_log,json=accessLog" json:"access_log,omitempty"` + // If set to true, the connection manager will use the real remote address + // of the client connection when determining internal versus external origin and manipulating + // various headers. If set to false or absent, the connection manager will use the + // :ref:`config_http_conn_man_headers_x-forwarded-for` HTTP header. See the documentation for + // :ref:`config_http_conn_man_headers_x-forwarded-for`, + // :ref:`config_http_conn_man_headers_x-envoy-internal`, and + // :ref:`config_http_conn_man_headers_x-envoy-external-address` for more information. + UseRemoteAddress *types.BoolValue `protobuf:"bytes,14,opt,name=use_remote_address,json=useRemoteAddress" json:"use_remote_address,omitempty"` + // The number of additional ingress proxy hops from the right side of the + // :ref:`config_http_conn_man_headers_x-forwarded-for` HTTP header to trust when + // determining the origin client's IP address. The default is zero if this option + // is not specified. See the documentation for + // :ref:`config_http_conn_man_headers_x-forwarded-for` for more information. + XffNumTrustedHops uint32 `protobuf:"varint,19,opt,name=xff_num_trusted_hops,json=xffNumTrustedHops,proto3" json:"xff_num_trusted_hops,omitempty"` + // If set, Envoy will not append the remote address to the + // :ref:`config_http_conn_man_headers_x-forwarded-for` HTTP header. This may be used in + // conjunction with HTTP filters that explicitly manipulate XFF after the HTTP connection manager + // has mutated the request headers. While :ref:`use_remote_address + // ` will also suppress XFF addition, it has consequences + // for logging and other Envoy uses of the remote address, so *skip_xff_append* should be used + // when only an elision of XFF addition is intended. + SkipXffAppend bool `protobuf:"varint,21,opt,name=skip_xff_append,json=skipXffAppend,proto3" json:"skip_xff_append,omitempty"` + // Via header value to append to request and response headers. If this is + // empty, no via header will be appended. + Via string `protobuf:"bytes,22,opt,name=via,proto3" json:"via,omitempty"` + // Whether the connection manager will generate the :ref:`x-request-id + // ` header if it does not exist. This defaults to + // true. Generating a random UUID4 is expensive so in high throughput scenarios where this feature + // is not desired it can be disabled. + GenerateRequestId *types.BoolValue `protobuf:"bytes,15,opt,name=generate_request_id,json=generateRequestId" json:"generate_request_id,omitempty"` + // How to handle the :ref:`config_http_conn_man_headers_x-forwarded-client-cert` (XFCC) HTTP + // header. + ForwardClientCertDetails HttpConnectionManager_ForwardClientCertDetails `protobuf:"varint,16,opt,name=forward_client_cert_details,json=forwardClientCertDetails,proto3,enum=envoy.config.filter.network.http_connection_manager.v2.HttpConnectionManager_ForwardClientCertDetails" json:"forward_client_cert_details,omitempty"` + // This field is valid only when :ref:`forward_client_cert_details + // ` + // is APPEND_FORWARD or SANITIZE_SET and the client connection is mTLS. It specifies the fields in + // the client certificate to be forwarded. Note that in the + // :ref:`config_http_conn_man_headers_x-forwarded-client-cert` header, *Hash* is always set, and + // *By* is always set when the client certificate presents the URI type Subject Alternative Name + // value. + SetCurrentClientCertDetails *HttpConnectionManager_SetCurrentClientCertDetails `protobuf:"bytes,17,opt,name=set_current_client_cert_details,json=setCurrentClientCertDetails" json:"set_current_client_cert_details,omitempty"` + // If proxy_100_continue is true, Envoy will proxy incoming "Expect: + // 100-continue" headers upstream, and forward "100 Continue" responses + // downstream. If this is false or not set, Envoy will instead strip the + // "Expect: 100-continue" header, and send a "100 Continue" response itself. + Proxy_100Continue bool `protobuf:"varint,18,opt,name=proxy_100_continue,json=proxy100Continue,proto3" json:"proxy_100_continue,omitempty"` + // If + // :ref:`use_remote_address + // ` + // is true and represent_ipv4_remote_address_as_ipv4_mapped_ipv6 is true and the remote address is + // an IPv4 address, the address will be mapped to IPv6 before it is appended to *x-forwarded-for*. + // This is useful for testing compatibility of upstream services that parse the header value. For + // example, 50.0.0.1 is represented as ::FFFF:50.0.0.1. See `IPv4-Mapped IPv6 Addresses + // `_ for details. This will also affect the + // :ref:`config_http_conn_man_headers_x-envoy-external-address` header. See + // :ref:`http_connection_manager.represent_ipv4_remote_address_as_ipv4_mapped_ipv6 + // ` for runtime + // control. + RepresentIpv4RemoteAddressAsIpv4MappedIpv6 bool `protobuf:"varint,20,opt,name=represent_ipv4_remote_address_as_ipv4_mapped_ipv6,json=representIpv4RemoteAddressAsIpv4MappedIpv6,proto3" json:"represent_ipv4_remote_address_as_ipv4_mapped_ipv6,omitempty"` + UpgradeConfigs []*HttpConnectionManager_UpgradeConfig `protobuf:"bytes,23,rep,name=upgrade_configs,json=upgradeConfigs" json:"upgrade_configs,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *HttpConnectionManager) Reset() { *m = HttpConnectionManager{} } +func (m *HttpConnectionManager) String() string { return proto.CompactTextString(m) } +func (*HttpConnectionManager) ProtoMessage() {} +func (*HttpConnectionManager) Descriptor() ([]byte, []int) { + return fileDescriptor_http_connection_manager_5c85b4f0eeee8fe7, []int{0} +} +func (m *HttpConnectionManager) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *HttpConnectionManager) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_HttpConnectionManager.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *HttpConnectionManager) XXX_Merge(src proto.Message) { + xxx_messageInfo_HttpConnectionManager.Merge(dst, src) +} +func (m *HttpConnectionManager) XXX_Size() int { + return m.Size() +} +func (m *HttpConnectionManager) XXX_DiscardUnknown() { + xxx_messageInfo_HttpConnectionManager.DiscardUnknown(m) +} + +var xxx_messageInfo_HttpConnectionManager proto.InternalMessageInfo + +type isHttpConnectionManager_RouteSpecifier interface { + isHttpConnectionManager_RouteSpecifier() + MarshalTo([]byte) (int, error) + Size() int +} + +type HttpConnectionManager_Rds struct { + Rds *Rds `protobuf:"bytes,3,opt,name=rds,oneof"` +} +type HttpConnectionManager_RouteConfig struct { + RouteConfig *v2.RouteConfiguration `protobuf:"bytes,4,opt,name=route_config,json=routeConfig,oneof"` +} + +func (*HttpConnectionManager_Rds) isHttpConnectionManager_RouteSpecifier() {} +func (*HttpConnectionManager_RouteConfig) isHttpConnectionManager_RouteSpecifier() {} + +func (m *HttpConnectionManager) GetRouteSpecifier() isHttpConnectionManager_RouteSpecifier { + if m != nil { + return m.RouteSpecifier + } + return nil +} + +func (m *HttpConnectionManager) GetCodecType() HttpConnectionManager_CodecType { + if m != nil { + return m.CodecType + } + return AUTO +} + +func (m *HttpConnectionManager) GetStatPrefix() string { + if m != nil { + return m.StatPrefix + } + return "" +} + +func (m *HttpConnectionManager) GetRds() *Rds { + if x, ok := m.GetRouteSpecifier().(*HttpConnectionManager_Rds); ok { + return x.Rds + } + return nil +} + +func (m *HttpConnectionManager) GetRouteConfig() *v2.RouteConfiguration { + if x, ok := m.GetRouteSpecifier().(*HttpConnectionManager_RouteConfig); ok { + return x.RouteConfig + } + return nil +} + +func (m *HttpConnectionManager) GetHttpFilters() []*HttpFilter { + if m != nil { + return m.HttpFilters + } + return nil +} + +func (m *HttpConnectionManager) GetAddUserAgent() *types.BoolValue { + if m != nil { + return m.AddUserAgent + } + return nil +} + +func (m *HttpConnectionManager) GetTracing() *HttpConnectionManager_Tracing { + if m != nil { + return m.Tracing + } + return nil +} + +func (m *HttpConnectionManager) GetHttpProtocolOptions() *core.Http1ProtocolOptions { + if m != nil { + return m.HttpProtocolOptions + } + return nil +} + +func (m *HttpConnectionManager) GetHttp2ProtocolOptions() *core.Http2ProtocolOptions { + if m != nil { + return m.Http2ProtocolOptions + } + return nil +} + +func (m *HttpConnectionManager) GetServerName() string { + if m != nil { + return m.ServerName + } + return "" +} + +func (m *HttpConnectionManager) GetIdleTimeout() *time.Duration { + if m != nil { + return m.IdleTimeout + } + return nil +} + +func (m *HttpConnectionManager) GetStreamIdleTimeout() *time.Duration { + if m != nil { + return m.StreamIdleTimeout + } + return nil +} + +func (m *HttpConnectionManager) GetDrainTimeout() *time.Duration { + if m != nil { + return m.DrainTimeout + } + return nil +} + +func (m *HttpConnectionManager) GetAccessLog() []*v21.AccessLog { + if m != nil { + return m.AccessLog + } + return nil +} + +func (m *HttpConnectionManager) GetUseRemoteAddress() *types.BoolValue { + if m != nil { + return m.UseRemoteAddress + } + return nil +} + +func (m *HttpConnectionManager) GetXffNumTrustedHops() uint32 { + if m != nil { + return m.XffNumTrustedHops + } + return 0 +} + +func (m *HttpConnectionManager) GetSkipXffAppend() bool { + if m != nil { + return m.SkipXffAppend + } + return false +} + +func (m *HttpConnectionManager) GetVia() string { + if m != nil { + return m.Via + } + return "" +} + +func (m *HttpConnectionManager) GetGenerateRequestId() *types.BoolValue { + if m != nil { + return m.GenerateRequestId + } + return nil +} + +func (m *HttpConnectionManager) GetForwardClientCertDetails() HttpConnectionManager_ForwardClientCertDetails { + if m != nil { + return m.ForwardClientCertDetails + } + return SANITIZE +} + +func (m *HttpConnectionManager) GetSetCurrentClientCertDetails() *HttpConnectionManager_SetCurrentClientCertDetails { + if m != nil { + return m.SetCurrentClientCertDetails + } + return nil +} + +func (m *HttpConnectionManager) GetProxy_100Continue() bool { + if m != nil { + return m.Proxy_100Continue + } + return false +} + +func (m *HttpConnectionManager) GetRepresentIpv4RemoteAddressAsIpv4MappedIpv6() bool { + if m != nil { + return m.RepresentIpv4RemoteAddressAsIpv4MappedIpv6 + } + return false +} + +func (m *HttpConnectionManager) GetUpgradeConfigs() []*HttpConnectionManager_UpgradeConfig { + if m != nil { + return m.UpgradeConfigs + } + return nil +} + +// XXX_OneofFuncs is for the internal use of the proto package. +func (*HttpConnectionManager) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { + return _HttpConnectionManager_OneofMarshaler, _HttpConnectionManager_OneofUnmarshaler, _HttpConnectionManager_OneofSizer, []interface{}{ + (*HttpConnectionManager_Rds)(nil), + (*HttpConnectionManager_RouteConfig)(nil), + } +} + +func _HttpConnectionManager_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { + m := msg.(*HttpConnectionManager) + // route_specifier + switch x := m.RouteSpecifier.(type) { + case *HttpConnectionManager_Rds: + _ = b.EncodeVarint(3<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.Rds); err != nil { + return err + } + case *HttpConnectionManager_RouteConfig: + _ = b.EncodeVarint(4<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.RouteConfig); err != nil { + return err + } + case nil: + default: + return fmt.Errorf("HttpConnectionManager.RouteSpecifier has unexpected type %T", x) + } + return nil +} + +func _HttpConnectionManager_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { + m := msg.(*HttpConnectionManager) + switch tag { + case 3: // route_specifier.rds + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(Rds) + err := b.DecodeMessage(msg) + m.RouteSpecifier = &HttpConnectionManager_Rds{msg} + return true, err + case 4: // route_specifier.route_config + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(v2.RouteConfiguration) + err := b.DecodeMessage(msg) + m.RouteSpecifier = &HttpConnectionManager_RouteConfig{msg} + return true, err + default: + return false, nil + } +} + +func _HttpConnectionManager_OneofSizer(msg proto.Message) (n int) { + m := msg.(*HttpConnectionManager) + // route_specifier + switch x := m.RouteSpecifier.(type) { + case *HttpConnectionManager_Rds: + s := proto.Size(x.Rds) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case *HttpConnectionManager_RouteConfig: + s := proto.Size(x.RouteConfig) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case nil: + default: + panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) + } + return n +} + +type HttpConnectionManager_Tracing struct { + // The span name will be derived from this field. + OperationName HttpConnectionManager_Tracing_OperationName `protobuf:"varint,1,opt,name=operation_name,json=operationName,proto3,enum=envoy.config.filter.network.http_connection_manager.v2.HttpConnectionManager_Tracing_OperationName" json:"operation_name,omitempty"` + // A list of header names used to create tags for the active span. The header name is used to + // populate the tag name, and the header value is used to populate the tag value. The tag is + // created if the specified header name is present in the request's headers. + RequestHeadersForTags []string `protobuf:"bytes,2,rep,name=request_headers_for_tags,json=requestHeadersForTags" json:"request_headers_for_tags,omitempty"` + // Target percentage of requests managed by this HTTP connection manager that will be force + // traced if the :ref:`x-client-trace-id ` + // header is set. This field is a direct analog for the runtime variable + // 'tracing.client_sampling' in the :ref:`HTTP Connection Manager + // `. + // Default: 100% + ClientSampling *_type.Percent `protobuf:"bytes,3,opt,name=client_sampling,json=clientSampling" json:"client_sampling,omitempty"` + // Target percentage of requests managed by this HTTP connection manager that will be randomly + // selected for trace generation, if not requested by the client or not forced. This field is + // a direct analog for the runtime variable 'tracing.random_sampling' in the + // :ref:`HTTP Connection Manager `. + // Default: 100% + RandomSampling *_type.Percent `protobuf:"bytes,4,opt,name=random_sampling,json=randomSampling" json:"random_sampling,omitempty"` + // Target percentage of requests managed by this HTTP connection manager that will be traced + // after all other sampling checks have been applied (client-directed, force tracing, random + // sampling). This field functions as an upper limit on the total configured sampling rate. For + // instance, setting client_sampling to 100% but overall_sampling to 1% will result in only 1% + // of client requests with the appropriate headers to be force traced. This field is a direct + // analog for the runtime variable 'tracing.global_enabled' in the + // :ref:`HTTP Connection Manager `. + // Default: 100% + OverallSampling *_type.Percent `protobuf:"bytes,5,opt,name=overall_sampling,json=overallSampling" json:"overall_sampling,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *HttpConnectionManager_Tracing) Reset() { *m = HttpConnectionManager_Tracing{} } +func (m *HttpConnectionManager_Tracing) String() string { return proto.CompactTextString(m) } +func (*HttpConnectionManager_Tracing) ProtoMessage() {} +func (*HttpConnectionManager_Tracing) Descriptor() ([]byte, []int) { + return fileDescriptor_http_connection_manager_5c85b4f0eeee8fe7, []int{0, 0} +} +func (m *HttpConnectionManager_Tracing) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *HttpConnectionManager_Tracing) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_HttpConnectionManager_Tracing.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *HttpConnectionManager_Tracing) XXX_Merge(src proto.Message) { + xxx_messageInfo_HttpConnectionManager_Tracing.Merge(dst, src) +} +func (m *HttpConnectionManager_Tracing) XXX_Size() int { + return m.Size() +} +func (m *HttpConnectionManager_Tracing) XXX_DiscardUnknown() { + xxx_messageInfo_HttpConnectionManager_Tracing.DiscardUnknown(m) +} + +var xxx_messageInfo_HttpConnectionManager_Tracing proto.InternalMessageInfo + +func (m *HttpConnectionManager_Tracing) GetOperationName() HttpConnectionManager_Tracing_OperationName { + if m != nil { + return m.OperationName + } + return INGRESS +} + +func (m *HttpConnectionManager_Tracing) GetRequestHeadersForTags() []string { + if m != nil { + return m.RequestHeadersForTags + } + return nil +} + +func (m *HttpConnectionManager_Tracing) GetClientSampling() *_type.Percent { + if m != nil { + return m.ClientSampling + } + return nil +} + +func (m *HttpConnectionManager_Tracing) GetRandomSampling() *_type.Percent { + if m != nil { + return m.RandomSampling + } + return nil +} + +func (m *HttpConnectionManager_Tracing) GetOverallSampling() *_type.Percent { + if m != nil { + return m.OverallSampling + } + return nil +} + +type HttpConnectionManager_SetCurrentClientCertDetails struct { + // Whether to forward the subject of the client cert. Defaults to false. + Subject *types.BoolValue `protobuf:"bytes,1,opt,name=subject" json:"subject,omitempty"` + // Whether to forward the entire client cert in URL encoded PEM format. This will appear in the + // XFCC header comma separated from other values with the value Cert="PEM". + // Defaults to false. + Cert bool `protobuf:"varint,3,opt,name=cert,proto3" json:"cert,omitempty"` + // Whether to forward the DNS type Subject Alternative Names of the client cert. + // Defaults to false. + Dns bool `protobuf:"varint,4,opt,name=dns,proto3" json:"dns,omitempty"` + // Whether to forward the URI type Subject Alternative Name of the client cert. Defaults to + // false. + Uri bool `protobuf:"varint,5,opt,name=uri,proto3" json:"uri,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *HttpConnectionManager_SetCurrentClientCertDetails) Reset() { + *m = HttpConnectionManager_SetCurrentClientCertDetails{} +} +func (m *HttpConnectionManager_SetCurrentClientCertDetails) String() string { + return proto.CompactTextString(m) +} +func (*HttpConnectionManager_SetCurrentClientCertDetails) ProtoMessage() {} +func (*HttpConnectionManager_SetCurrentClientCertDetails) Descriptor() ([]byte, []int) { + return fileDescriptor_http_connection_manager_5c85b4f0eeee8fe7, []int{0, 1} +} +func (m *HttpConnectionManager_SetCurrentClientCertDetails) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *HttpConnectionManager_SetCurrentClientCertDetails) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_HttpConnectionManager_SetCurrentClientCertDetails.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *HttpConnectionManager_SetCurrentClientCertDetails) XXX_Merge(src proto.Message) { + xxx_messageInfo_HttpConnectionManager_SetCurrentClientCertDetails.Merge(dst, src) +} +func (m *HttpConnectionManager_SetCurrentClientCertDetails) XXX_Size() int { + return m.Size() +} +func (m *HttpConnectionManager_SetCurrentClientCertDetails) XXX_DiscardUnknown() { + xxx_messageInfo_HttpConnectionManager_SetCurrentClientCertDetails.DiscardUnknown(m) +} + +var xxx_messageInfo_HttpConnectionManager_SetCurrentClientCertDetails proto.InternalMessageInfo + +func (m *HttpConnectionManager_SetCurrentClientCertDetails) GetSubject() *types.BoolValue { + if m != nil { + return m.Subject + } + return nil +} + +func (m *HttpConnectionManager_SetCurrentClientCertDetails) GetCert() bool { + if m != nil { + return m.Cert + } + return false +} + +func (m *HttpConnectionManager_SetCurrentClientCertDetails) GetDns() bool { + if m != nil { + return m.Dns + } + return false +} + +func (m *HttpConnectionManager_SetCurrentClientCertDetails) GetUri() bool { + if m != nil { + return m.Uri + } + return false +} + +// The configuration for HTTP upgrades. +// For each upgrade type desired, an UpgradeConfig must be added. +// +// .. warning:: +// +// The current implementation of upgrade headers does not handle +// multi-valued upgrade headers. Support for multi-valued headers may be +// added in the future if needed. +// +// .. warning:: +// The current implementation of upgrade headers does not work with HTTP/2 +// upstreams. +type HttpConnectionManager_UpgradeConfig struct { + // The case-insensitive name of this upgrade, e.g. "websocket". + // For each upgrade type present in upgrade_configs, requests with + // Upgrade: [upgrade_type] + // will be proxied upstream. + UpgradeType string `protobuf:"bytes,1,opt,name=upgrade_type,json=upgradeType,proto3" json:"upgrade_type,omitempty"` + // If present, this represents the filter chain which will be created for + // this type of upgrade. If no filters are present, the filter chain for + // HTTP connections will be used for this upgrade type. + Filters []*HttpFilter `protobuf:"bytes,2,rep,name=filters" json:"filters,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *HttpConnectionManager_UpgradeConfig) Reset() { *m = HttpConnectionManager_UpgradeConfig{} } +func (m *HttpConnectionManager_UpgradeConfig) String() string { return proto.CompactTextString(m) } +func (*HttpConnectionManager_UpgradeConfig) ProtoMessage() {} +func (*HttpConnectionManager_UpgradeConfig) Descriptor() ([]byte, []int) { + return fileDescriptor_http_connection_manager_5c85b4f0eeee8fe7, []int{0, 2} +} +func (m *HttpConnectionManager_UpgradeConfig) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *HttpConnectionManager_UpgradeConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_HttpConnectionManager_UpgradeConfig.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *HttpConnectionManager_UpgradeConfig) XXX_Merge(src proto.Message) { + xxx_messageInfo_HttpConnectionManager_UpgradeConfig.Merge(dst, src) +} +func (m *HttpConnectionManager_UpgradeConfig) XXX_Size() int { + return m.Size() +} +func (m *HttpConnectionManager_UpgradeConfig) XXX_DiscardUnknown() { + xxx_messageInfo_HttpConnectionManager_UpgradeConfig.DiscardUnknown(m) +} + +var xxx_messageInfo_HttpConnectionManager_UpgradeConfig proto.InternalMessageInfo + +func (m *HttpConnectionManager_UpgradeConfig) GetUpgradeType() string { + if m != nil { + return m.UpgradeType + } + return "" +} + +func (m *HttpConnectionManager_UpgradeConfig) GetFilters() []*HttpFilter { + if m != nil { + return m.Filters + } + return nil +} + +type Rds struct { + // Configuration source specifier for RDS. + ConfigSource core.ConfigSource `protobuf:"bytes,1,opt,name=config_source,json=configSource" json:"config_source"` + // The name of the route configuration. This name will be passed to the RDS + // API. This allows an Envoy configuration with multiple HTTP listeners (and + // associated HTTP connection manager filters) to use different route + // configurations. + RouteConfigName string `protobuf:"bytes,2,opt,name=route_config_name,json=routeConfigName,proto3" json:"route_config_name,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Rds) Reset() { *m = Rds{} } +func (m *Rds) String() string { return proto.CompactTextString(m) } +func (*Rds) ProtoMessage() {} +func (*Rds) Descriptor() ([]byte, []int) { + return fileDescriptor_http_connection_manager_5c85b4f0eeee8fe7, []int{1} +} +func (m *Rds) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Rds) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Rds.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *Rds) XXX_Merge(src proto.Message) { + xxx_messageInfo_Rds.Merge(dst, src) +} +func (m *Rds) XXX_Size() int { + return m.Size() +} +func (m *Rds) XXX_DiscardUnknown() { + xxx_messageInfo_Rds.DiscardUnknown(m) +} + +var xxx_messageInfo_Rds proto.InternalMessageInfo + +func (m *Rds) GetConfigSource() core.ConfigSource { + if m != nil { + return m.ConfigSource + } + return core.ConfigSource{} +} + +func (m *Rds) GetRouteConfigName() string { + if m != nil { + return m.RouteConfigName + } + return "" +} + +type HttpFilter struct { + // The name of the filter to instantiate. The name must match a supported + // filter. The built-in filters are: + // + // [#comment:TODO(mattklein123): Auto generate the following list] + // * :ref:`envoy.buffer ` + // * :ref:`envoy.cors ` + // * :ref:`envoy.fault ` + // * :ref:`envoy.gzip ` + // * :ref:`envoy.http_dynamo_filter ` + // * :ref:`envoy.grpc_http1_bridge ` + // * :ref:`envoy.grpc_json_transcoder ` + // * :ref:`envoy.grpc_web ` + // * :ref:`envoy.health_check ` + // * :ref:`envoy.header_to_metadata ` + // * :ref:`envoy.ip_tagging ` + // * :ref:`envoy.lua ` + // * :ref:`envoy.rate_limit ` + // * :ref:`envoy.router ` + // * :ref:`envoy.squash ` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // Filter specific configuration which depends on the filter being + // instantiated. See the supported filters for further documentation. + Config *types.Struct `protobuf:"bytes,2,opt,name=config" json:"config,omitempty"` + // [#not-implemented-hide:] + // This is hidden as type has been deprecated and is no longer required. + DeprecatedV1 *HttpFilter_DeprecatedV1 `protobuf:"bytes,3,opt,name=deprecated_v1,json=deprecatedV1" json:"deprecated_v1,omitempty"` // Deprecated: Do not use. + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *HttpFilter) Reset() { *m = HttpFilter{} } +func (m *HttpFilter) String() string { return proto.CompactTextString(m) } +func (*HttpFilter) ProtoMessage() {} +func (*HttpFilter) Descriptor() ([]byte, []int) { + return fileDescriptor_http_connection_manager_5c85b4f0eeee8fe7, []int{2} +} +func (m *HttpFilter) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *HttpFilter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_HttpFilter.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *HttpFilter) XXX_Merge(src proto.Message) { + xxx_messageInfo_HttpFilter.Merge(dst, src) +} +func (m *HttpFilter) XXX_Size() int { + return m.Size() +} +func (m *HttpFilter) XXX_DiscardUnknown() { + xxx_messageInfo_HttpFilter.DiscardUnknown(m) +} + +var xxx_messageInfo_HttpFilter proto.InternalMessageInfo + +func (m *HttpFilter) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *HttpFilter) GetConfig() *types.Struct { + if m != nil { + return m.Config + } + return nil +} + +// Deprecated: Do not use. +func (m *HttpFilter) GetDeprecatedV1() *HttpFilter_DeprecatedV1 { + if m != nil { + return m.DeprecatedV1 + } + return nil +} + +// [#not-implemented-hide:] +// This is hidden as type has been deprecated and is no longer required. +type HttpFilter_DeprecatedV1 struct { + Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *HttpFilter_DeprecatedV1) Reset() { *m = HttpFilter_DeprecatedV1{} } +func (m *HttpFilter_DeprecatedV1) String() string { return proto.CompactTextString(m) } +func (*HttpFilter_DeprecatedV1) ProtoMessage() {} +func (*HttpFilter_DeprecatedV1) Descriptor() ([]byte, []int) { + return fileDescriptor_http_connection_manager_5c85b4f0eeee8fe7, []int{2, 0} +} +func (m *HttpFilter_DeprecatedV1) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *HttpFilter_DeprecatedV1) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_HttpFilter_DeprecatedV1.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *HttpFilter_DeprecatedV1) XXX_Merge(src proto.Message) { + xxx_messageInfo_HttpFilter_DeprecatedV1.Merge(dst, src) +} +func (m *HttpFilter_DeprecatedV1) XXX_Size() int { + return m.Size() +} +func (m *HttpFilter_DeprecatedV1) XXX_DiscardUnknown() { + xxx_messageInfo_HttpFilter_DeprecatedV1.DiscardUnknown(m) +} + +var xxx_messageInfo_HttpFilter_DeprecatedV1 proto.InternalMessageInfo + +func (m *HttpFilter_DeprecatedV1) GetType() string { + if m != nil { + return m.Type + } + return "" +} + +func init() { + proto.RegisterType((*HttpConnectionManager)(nil), "envoy.config.filter.network.http_connection_manager.v2.HttpConnectionManager") + proto.RegisterType((*HttpConnectionManager_Tracing)(nil), "envoy.config.filter.network.http_connection_manager.v2.HttpConnectionManager.Tracing") + proto.RegisterType((*HttpConnectionManager_SetCurrentClientCertDetails)(nil), "envoy.config.filter.network.http_connection_manager.v2.HttpConnectionManager.SetCurrentClientCertDetails") + proto.RegisterType((*HttpConnectionManager_UpgradeConfig)(nil), "envoy.config.filter.network.http_connection_manager.v2.HttpConnectionManager.UpgradeConfig") + proto.RegisterType((*Rds)(nil), "envoy.config.filter.network.http_connection_manager.v2.Rds") + proto.RegisterType((*HttpFilter)(nil), "envoy.config.filter.network.http_connection_manager.v2.HttpFilter") + proto.RegisterType((*HttpFilter_DeprecatedV1)(nil), "envoy.config.filter.network.http_connection_manager.v2.HttpFilter.DeprecatedV1") + proto.RegisterEnum("envoy.config.filter.network.http_connection_manager.v2.HttpConnectionManager_CodecType", HttpConnectionManager_CodecType_name, HttpConnectionManager_CodecType_value) + proto.RegisterEnum("envoy.config.filter.network.http_connection_manager.v2.HttpConnectionManager_ForwardClientCertDetails", HttpConnectionManager_ForwardClientCertDetails_name, HttpConnectionManager_ForwardClientCertDetails_value) + proto.RegisterEnum("envoy.config.filter.network.http_connection_manager.v2.HttpConnectionManager_Tracing_OperationName", HttpConnectionManager_Tracing_OperationName_name, HttpConnectionManager_Tracing_OperationName_value) +} +func (m *HttpConnectionManager) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *HttpConnectionManager) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.CodecType != 0 { + dAtA[i] = 0x8 + i++ + i = encodeVarintHttpConnectionManager(dAtA, i, uint64(m.CodecType)) + } + if len(m.StatPrefix) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintHttpConnectionManager(dAtA, i, uint64(len(m.StatPrefix))) + i += copy(dAtA[i:], m.StatPrefix) + } + if m.RouteSpecifier != nil { + nn1, err := m.RouteSpecifier.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += nn1 + } + if len(m.HttpFilters) > 0 { + for _, msg := range m.HttpFilters { + dAtA[i] = 0x2a + i++ + i = encodeVarintHttpConnectionManager(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if m.AddUserAgent != nil { + dAtA[i] = 0x32 + i++ + i = encodeVarintHttpConnectionManager(dAtA, i, uint64(m.AddUserAgent.Size())) + n2, err := m.AddUserAgent.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n2 + } + if m.Tracing != nil { + dAtA[i] = 0x3a + i++ + i = encodeVarintHttpConnectionManager(dAtA, i, uint64(m.Tracing.Size())) + n3, err := m.Tracing.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n3 + } + if m.HttpProtocolOptions != nil { + dAtA[i] = 0x42 + i++ + i = encodeVarintHttpConnectionManager(dAtA, i, uint64(m.HttpProtocolOptions.Size())) + n4, err := m.HttpProtocolOptions.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n4 + } + if m.Http2ProtocolOptions != nil { + dAtA[i] = 0x4a + i++ + i = encodeVarintHttpConnectionManager(dAtA, i, uint64(m.Http2ProtocolOptions.Size())) + n5, err := m.Http2ProtocolOptions.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n5 + } + if len(m.ServerName) > 0 { + dAtA[i] = 0x52 + i++ + i = encodeVarintHttpConnectionManager(dAtA, i, uint64(len(m.ServerName))) + i += copy(dAtA[i:], m.ServerName) + } + if m.IdleTimeout != nil { + dAtA[i] = 0x5a + i++ + i = encodeVarintHttpConnectionManager(dAtA, i, uint64(github_com_gogo_protobuf_types.SizeOfStdDuration(*m.IdleTimeout))) + n6, err := github_com_gogo_protobuf_types.StdDurationMarshalTo(*m.IdleTimeout, dAtA[i:]) + if err != nil { + return 0, err + } + i += n6 + } + if m.DrainTimeout != nil { + dAtA[i] = 0x62 + i++ + i = encodeVarintHttpConnectionManager(dAtA, i, uint64(github_com_gogo_protobuf_types.SizeOfStdDuration(*m.DrainTimeout))) + n7, err := github_com_gogo_protobuf_types.StdDurationMarshalTo(*m.DrainTimeout, dAtA[i:]) + if err != nil { + return 0, err + } + i += n7 + } + if len(m.AccessLog) > 0 { + for _, msg := range m.AccessLog { + dAtA[i] = 0x6a + i++ + i = encodeVarintHttpConnectionManager(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if m.UseRemoteAddress != nil { + dAtA[i] = 0x72 + i++ + i = encodeVarintHttpConnectionManager(dAtA, i, uint64(m.UseRemoteAddress.Size())) + n8, err := m.UseRemoteAddress.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n8 + } + if m.GenerateRequestId != nil { + dAtA[i] = 0x7a + i++ + i = encodeVarintHttpConnectionManager(dAtA, i, uint64(m.GenerateRequestId.Size())) + n9, err := m.GenerateRequestId.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n9 + } + if m.ForwardClientCertDetails != 0 { + dAtA[i] = 0x80 + i++ + dAtA[i] = 0x1 + i++ + i = encodeVarintHttpConnectionManager(dAtA, i, uint64(m.ForwardClientCertDetails)) + } + if m.SetCurrentClientCertDetails != nil { + dAtA[i] = 0x8a + i++ + dAtA[i] = 0x1 + i++ + i = encodeVarintHttpConnectionManager(dAtA, i, uint64(m.SetCurrentClientCertDetails.Size())) + n10, err := m.SetCurrentClientCertDetails.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n10 + } + if m.Proxy_100Continue { + dAtA[i] = 0x90 + i++ + dAtA[i] = 0x1 + i++ + if m.Proxy_100Continue { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i++ + } + if m.XffNumTrustedHops != 0 { + dAtA[i] = 0x98 + i++ + dAtA[i] = 0x1 + i++ + i = encodeVarintHttpConnectionManager(dAtA, i, uint64(m.XffNumTrustedHops)) + } + if m.RepresentIpv4RemoteAddressAsIpv4MappedIpv6 { + dAtA[i] = 0xa0 + i++ + dAtA[i] = 0x1 + i++ + if m.RepresentIpv4RemoteAddressAsIpv4MappedIpv6 { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i++ + } + if m.SkipXffAppend { + dAtA[i] = 0xa8 + i++ + dAtA[i] = 0x1 + i++ + if m.SkipXffAppend { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i++ + } + if len(m.Via) > 0 { + dAtA[i] = 0xb2 + i++ + dAtA[i] = 0x1 + i++ + i = encodeVarintHttpConnectionManager(dAtA, i, uint64(len(m.Via))) + i += copy(dAtA[i:], m.Via) + } + if len(m.UpgradeConfigs) > 0 { + for _, msg := range m.UpgradeConfigs { + dAtA[i] = 0xba + i++ + dAtA[i] = 0x1 + i++ + i = encodeVarintHttpConnectionManager(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if m.StreamIdleTimeout != nil { + dAtA[i] = 0xc2 + i++ + dAtA[i] = 0x1 + i++ + i = encodeVarintHttpConnectionManager(dAtA, i, uint64(github_com_gogo_protobuf_types.SizeOfStdDuration(*m.StreamIdleTimeout))) + n11, err := github_com_gogo_protobuf_types.StdDurationMarshalTo(*m.StreamIdleTimeout, dAtA[i:]) + if err != nil { + return 0, err + } + i += n11 + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *HttpConnectionManager_Rds) MarshalTo(dAtA []byte) (int, error) { + i := 0 + if m.Rds != nil { + dAtA[i] = 0x1a + i++ + i = encodeVarintHttpConnectionManager(dAtA, i, uint64(m.Rds.Size())) + n12, err := m.Rds.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n12 + } + return i, nil +} +func (m *HttpConnectionManager_RouteConfig) MarshalTo(dAtA []byte) (int, error) { + i := 0 + if m.RouteConfig != nil { + dAtA[i] = 0x22 + i++ + i = encodeVarintHttpConnectionManager(dAtA, i, uint64(m.RouteConfig.Size())) + n13, err := m.RouteConfig.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n13 + } + return i, nil +} +func (m *HttpConnectionManager_Tracing) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *HttpConnectionManager_Tracing) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.OperationName != 0 { + dAtA[i] = 0x8 + i++ + i = encodeVarintHttpConnectionManager(dAtA, i, uint64(m.OperationName)) + } + if len(m.RequestHeadersForTags) > 0 { + for _, s := range m.RequestHeadersForTags { + dAtA[i] = 0x12 + i++ + l = len(s) + for l >= 1<<7 { + dAtA[i] = uint8(uint64(l)&0x7f | 0x80) + l >>= 7 + i++ + } + dAtA[i] = uint8(l) + i++ + i += copy(dAtA[i:], s) + } + } + if m.ClientSampling != nil { + dAtA[i] = 0x1a + i++ + i = encodeVarintHttpConnectionManager(dAtA, i, uint64(m.ClientSampling.Size())) + n14, err := m.ClientSampling.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n14 + } + if m.RandomSampling != nil { + dAtA[i] = 0x22 + i++ + i = encodeVarintHttpConnectionManager(dAtA, i, uint64(m.RandomSampling.Size())) + n15, err := m.RandomSampling.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n15 + } + if m.OverallSampling != nil { + dAtA[i] = 0x2a + i++ + i = encodeVarintHttpConnectionManager(dAtA, i, uint64(m.OverallSampling.Size())) + n16, err := m.OverallSampling.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n16 + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *HttpConnectionManager_SetCurrentClientCertDetails) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *HttpConnectionManager_SetCurrentClientCertDetails) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Subject != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintHttpConnectionManager(dAtA, i, uint64(m.Subject.Size())) + n17, err := m.Subject.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n17 + } + if m.Cert { + dAtA[i] = 0x18 + i++ + if m.Cert { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i++ + } + if m.Dns { + dAtA[i] = 0x20 + i++ + if m.Dns { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i++ + } + if m.Uri { + dAtA[i] = 0x28 + i++ + if m.Uri { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i++ + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *HttpConnectionManager_UpgradeConfig) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *HttpConnectionManager_UpgradeConfig) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.UpgradeType) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintHttpConnectionManager(dAtA, i, uint64(len(m.UpgradeType))) + i += copy(dAtA[i:], m.UpgradeType) + } + if len(m.Filters) > 0 { + for _, msg := range m.Filters { + dAtA[i] = 0x12 + i++ + i = encodeVarintHttpConnectionManager(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *Rds) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Rds) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + dAtA[i] = 0xa + i++ + i = encodeVarintHttpConnectionManager(dAtA, i, uint64(m.ConfigSource.Size())) + n18, err := m.ConfigSource.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n18 + if len(m.RouteConfigName) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintHttpConnectionManager(dAtA, i, uint64(len(m.RouteConfigName))) + i += copy(dAtA[i:], m.RouteConfigName) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *HttpFilter) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *HttpFilter) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Name) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintHttpConnectionManager(dAtA, i, uint64(len(m.Name))) + i += copy(dAtA[i:], m.Name) + } + if m.Config != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintHttpConnectionManager(dAtA, i, uint64(m.Config.Size())) + n19, err := m.Config.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n19 + } + if m.DeprecatedV1 != nil { + dAtA[i] = 0x1a + i++ + i = encodeVarintHttpConnectionManager(dAtA, i, uint64(m.DeprecatedV1.Size())) + n20, err := m.DeprecatedV1.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n20 + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *HttpFilter_DeprecatedV1) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *HttpFilter_DeprecatedV1) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Type) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintHttpConnectionManager(dAtA, i, uint64(len(m.Type))) + i += copy(dAtA[i:], m.Type) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func encodeVarintHttpConnectionManager(dAtA []byte, offset int, v uint64) int { + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return offset + 1 +} +func (m *HttpConnectionManager) Size() (n int) { + var l int + _ = l + if m.CodecType != 0 { + n += 1 + sovHttpConnectionManager(uint64(m.CodecType)) + } + l = len(m.StatPrefix) + if l > 0 { + n += 1 + l + sovHttpConnectionManager(uint64(l)) + } + if m.RouteSpecifier != nil { + n += m.RouteSpecifier.Size() + } + if len(m.HttpFilters) > 0 { + for _, e := range m.HttpFilters { + l = e.Size() + n += 1 + l + sovHttpConnectionManager(uint64(l)) + } + } + if m.AddUserAgent != nil { + l = m.AddUserAgent.Size() + n += 1 + l + sovHttpConnectionManager(uint64(l)) + } + if m.Tracing != nil { + l = m.Tracing.Size() + n += 1 + l + sovHttpConnectionManager(uint64(l)) + } + if m.HttpProtocolOptions != nil { + l = m.HttpProtocolOptions.Size() + n += 1 + l + sovHttpConnectionManager(uint64(l)) + } + if m.Http2ProtocolOptions != nil { + l = m.Http2ProtocolOptions.Size() + n += 1 + l + sovHttpConnectionManager(uint64(l)) + } + l = len(m.ServerName) + if l > 0 { + n += 1 + l + sovHttpConnectionManager(uint64(l)) + } + if m.IdleTimeout != nil { + l = github_com_gogo_protobuf_types.SizeOfStdDuration(*m.IdleTimeout) + n += 1 + l + sovHttpConnectionManager(uint64(l)) + } + if m.DrainTimeout != nil { + l = github_com_gogo_protobuf_types.SizeOfStdDuration(*m.DrainTimeout) + n += 1 + l + sovHttpConnectionManager(uint64(l)) + } + if len(m.AccessLog) > 0 { + for _, e := range m.AccessLog { + l = e.Size() + n += 1 + l + sovHttpConnectionManager(uint64(l)) + } + } + if m.UseRemoteAddress != nil { + l = m.UseRemoteAddress.Size() + n += 1 + l + sovHttpConnectionManager(uint64(l)) + } + if m.GenerateRequestId != nil { + l = m.GenerateRequestId.Size() + n += 1 + l + sovHttpConnectionManager(uint64(l)) + } + if m.ForwardClientCertDetails != 0 { + n += 2 + sovHttpConnectionManager(uint64(m.ForwardClientCertDetails)) + } + if m.SetCurrentClientCertDetails != nil { + l = m.SetCurrentClientCertDetails.Size() + n += 2 + l + sovHttpConnectionManager(uint64(l)) + } + if m.Proxy_100Continue { + n += 3 + } + if m.XffNumTrustedHops != 0 { + n += 2 + sovHttpConnectionManager(uint64(m.XffNumTrustedHops)) + } + if m.RepresentIpv4RemoteAddressAsIpv4MappedIpv6 { + n += 3 + } + if m.SkipXffAppend { + n += 3 + } + l = len(m.Via) + if l > 0 { + n += 2 + l + sovHttpConnectionManager(uint64(l)) + } + if len(m.UpgradeConfigs) > 0 { + for _, e := range m.UpgradeConfigs { + l = e.Size() + n += 2 + l + sovHttpConnectionManager(uint64(l)) + } + } + if m.StreamIdleTimeout != nil { + l = github_com_gogo_protobuf_types.SizeOfStdDuration(*m.StreamIdleTimeout) + n += 2 + l + sovHttpConnectionManager(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *HttpConnectionManager_Rds) Size() (n int) { + var l int + _ = l + if m.Rds != nil { + l = m.Rds.Size() + n += 1 + l + sovHttpConnectionManager(uint64(l)) + } + return n +} +func (m *HttpConnectionManager_RouteConfig) Size() (n int) { + var l int + _ = l + if m.RouteConfig != nil { + l = m.RouteConfig.Size() + n += 1 + l + sovHttpConnectionManager(uint64(l)) + } + return n +} +func (m *HttpConnectionManager_Tracing) Size() (n int) { + var l int + _ = l + if m.OperationName != 0 { + n += 1 + sovHttpConnectionManager(uint64(m.OperationName)) + } + if len(m.RequestHeadersForTags) > 0 { + for _, s := range m.RequestHeadersForTags { + l = len(s) + n += 1 + l + sovHttpConnectionManager(uint64(l)) + } + } + if m.ClientSampling != nil { + l = m.ClientSampling.Size() + n += 1 + l + sovHttpConnectionManager(uint64(l)) + } + if m.RandomSampling != nil { + l = m.RandomSampling.Size() + n += 1 + l + sovHttpConnectionManager(uint64(l)) + } + if m.OverallSampling != nil { + l = m.OverallSampling.Size() + n += 1 + l + sovHttpConnectionManager(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *HttpConnectionManager_SetCurrentClientCertDetails) Size() (n int) { + var l int + _ = l + if m.Subject != nil { + l = m.Subject.Size() + n += 1 + l + sovHttpConnectionManager(uint64(l)) + } + if m.Cert { + n += 2 + } + if m.Dns { + n += 2 + } + if m.Uri { + n += 2 + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *HttpConnectionManager_UpgradeConfig) Size() (n int) { + var l int + _ = l + l = len(m.UpgradeType) + if l > 0 { + n += 1 + l + sovHttpConnectionManager(uint64(l)) + } + if len(m.Filters) > 0 { + for _, e := range m.Filters { + l = e.Size() + n += 1 + l + sovHttpConnectionManager(uint64(l)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *Rds) Size() (n int) { + var l int + _ = l + l = m.ConfigSource.Size() + n += 1 + l + sovHttpConnectionManager(uint64(l)) + l = len(m.RouteConfigName) + if l > 0 { + n += 1 + l + sovHttpConnectionManager(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *HttpFilter) Size() (n int) { + var l int + _ = l + l = len(m.Name) + if l > 0 { + n += 1 + l + sovHttpConnectionManager(uint64(l)) + } + if m.Config != nil { + l = m.Config.Size() + n += 1 + l + sovHttpConnectionManager(uint64(l)) + } + if m.DeprecatedV1 != nil { + l = m.DeprecatedV1.Size() + n += 1 + l + sovHttpConnectionManager(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *HttpFilter_DeprecatedV1) Size() (n int) { + var l int + _ = l + l = len(m.Type) + if l > 0 { + n += 1 + l + sovHttpConnectionManager(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func sovHttpConnectionManager(x uint64) (n int) { + for { + n++ + x >>= 7 + if x == 0 { + break + } + } + return n +} +func sozHttpConnectionManager(x uint64) (n int) { + return sovHttpConnectionManager(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *HttpConnectionManager) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHttpConnectionManager + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: HttpConnectionManager: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: HttpConnectionManager: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field CodecType", wireType) + } + m.CodecType = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHttpConnectionManager + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.CodecType |= (HttpConnectionManager_CodecType(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field StatPrefix", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHttpConnectionManager + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthHttpConnectionManager + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.StatPrefix = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Rds", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHttpConnectionManager + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthHttpConnectionManager + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &Rds{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.RouteSpecifier = &HttpConnectionManager_Rds{v} + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RouteConfig", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHttpConnectionManager + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthHttpConnectionManager + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &v2.RouteConfiguration{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.RouteSpecifier = &HttpConnectionManager_RouteConfig{v} + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field HttpFilters", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHttpConnectionManager + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthHttpConnectionManager + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.HttpFilters = append(m.HttpFilters, &HttpFilter{}) + if err := m.HttpFilters[len(m.HttpFilters)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AddUserAgent", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHttpConnectionManager + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthHttpConnectionManager + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.AddUserAgent == nil { + m.AddUserAgent = &types.BoolValue{} + } + if err := m.AddUserAgent.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Tracing", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHttpConnectionManager + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthHttpConnectionManager + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Tracing == nil { + m.Tracing = &HttpConnectionManager_Tracing{} + } + if err := m.Tracing.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field HttpProtocolOptions", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHttpConnectionManager + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthHttpConnectionManager + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.HttpProtocolOptions == nil { + m.HttpProtocolOptions = &core.Http1ProtocolOptions{} + } + if err := m.HttpProtocolOptions.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Http2ProtocolOptions", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHttpConnectionManager + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthHttpConnectionManager + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Http2ProtocolOptions == nil { + m.Http2ProtocolOptions = &core.Http2ProtocolOptions{} + } + if err := m.Http2ProtocolOptions.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 10: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ServerName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHttpConnectionManager + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthHttpConnectionManager + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ServerName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 11: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field IdleTimeout", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHttpConnectionManager + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthHttpConnectionManager + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.IdleTimeout == nil { + m.IdleTimeout = new(time.Duration) + } + if err := github_com_gogo_protobuf_types.StdDurationUnmarshal(m.IdleTimeout, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 12: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DrainTimeout", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHttpConnectionManager + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthHttpConnectionManager + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.DrainTimeout == nil { + m.DrainTimeout = new(time.Duration) + } + if err := github_com_gogo_protobuf_types.StdDurationUnmarshal(m.DrainTimeout, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 13: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AccessLog", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHttpConnectionManager + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthHttpConnectionManager + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.AccessLog = append(m.AccessLog, &v21.AccessLog{}) + if err := m.AccessLog[len(m.AccessLog)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 14: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field UseRemoteAddress", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHttpConnectionManager + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthHttpConnectionManager + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.UseRemoteAddress == nil { + m.UseRemoteAddress = &types.BoolValue{} + } + if err := m.UseRemoteAddress.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 15: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field GenerateRequestId", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHttpConnectionManager + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthHttpConnectionManager + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.GenerateRequestId == nil { + m.GenerateRequestId = &types.BoolValue{} + } + if err := m.GenerateRequestId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 16: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ForwardClientCertDetails", wireType) + } + m.ForwardClientCertDetails = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHttpConnectionManager + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ForwardClientCertDetails |= (HttpConnectionManager_ForwardClientCertDetails(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 17: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SetCurrentClientCertDetails", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHttpConnectionManager + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthHttpConnectionManager + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.SetCurrentClientCertDetails == nil { + m.SetCurrentClientCertDetails = &HttpConnectionManager_SetCurrentClientCertDetails{} + } + if err := m.SetCurrentClientCertDetails.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 18: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Proxy_100Continue", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHttpConnectionManager + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.Proxy_100Continue = bool(v != 0) + case 19: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field XffNumTrustedHops", wireType) + } + m.XffNumTrustedHops = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHttpConnectionManager + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.XffNumTrustedHops |= (uint32(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 20: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field RepresentIpv4RemoteAddressAsIpv4MappedIpv6", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHttpConnectionManager + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.RepresentIpv4RemoteAddressAsIpv4MappedIpv6 = bool(v != 0) + case 21: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field SkipXffAppend", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHttpConnectionManager + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.SkipXffAppend = bool(v != 0) + case 22: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Via", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHttpConnectionManager + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthHttpConnectionManager + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Via = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 23: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field UpgradeConfigs", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHttpConnectionManager + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthHttpConnectionManager + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.UpgradeConfigs = append(m.UpgradeConfigs, &HttpConnectionManager_UpgradeConfig{}) + if err := m.UpgradeConfigs[len(m.UpgradeConfigs)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 24: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field StreamIdleTimeout", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHttpConnectionManager + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthHttpConnectionManager + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.StreamIdleTimeout == nil { + m.StreamIdleTimeout = new(time.Duration) + } + if err := github_com_gogo_protobuf_types.StdDurationUnmarshal(m.StreamIdleTimeout, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipHttpConnectionManager(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthHttpConnectionManager + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *HttpConnectionManager_Tracing) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHttpConnectionManager + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Tracing: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Tracing: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field OperationName", wireType) + } + m.OperationName = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHttpConnectionManager + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.OperationName |= (HttpConnectionManager_Tracing_OperationName(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestHeadersForTags", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHttpConnectionManager + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthHttpConnectionManager + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RequestHeadersForTags = append(m.RequestHeadersForTags, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ClientSampling", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHttpConnectionManager + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthHttpConnectionManager + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.ClientSampling == nil { + m.ClientSampling = &_type.Percent{} + } + if err := m.ClientSampling.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RandomSampling", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHttpConnectionManager + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthHttpConnectionManager + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.RandomSampling == nil { + m.RandomSampling = &_type.Percent{} + } + if err := m.RandomSampling.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OverallSampling", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHttpConnectionManager + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthHttpConnectionManager + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.OverallSampling == nil { + m.OverallSampling = &_type.Percent{} + } + if err := m.OverallSampling.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipHttpConnectionManager(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthHttpConnectionManager + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *HttpConnectionManager_SetCurrentClientCertDetails) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHttpConnectionManager + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: SetCurrentClientCertDetails: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SetCurrentClientCertDetails: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Subject", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHttpConnectionManager + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthHttpConnectionManager + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Subject == nil { + m.Subject = &types.BoolValue{} + } + if err := m.Subject.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Cert", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHttpConnectionManager + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.Cert = bool(v != 0) + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Dns", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHttpConnectionManager + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.Dns = bool(v != 0) + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Uri", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHttpConnectionManager + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.Uri = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skipHttpConnectionManager(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthHttpConnectionManager + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *HttpConnectionManager_UpgradeConfig) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHttpConnectionManager + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: UpgradeConfig: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: UpgradeConfig: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field UpgradeType", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHttpConnectionManager + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthHttpConnectionManager + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.UpgradeType = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Filters", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHttpConnectionManager + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthHttpConnectionManager + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Filters = append(m.Filters, &HttpFilter{}) + if err := m.Filters[len(m.Filters)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipHttpConnectionManager(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthHttpConnectionManager + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Rds) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHttpConnectionManager + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Rds: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Rds: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ConfigSource", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHttpConnectionManager + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthHttpConnectionManager + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ConfigSource.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RouteConfigName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHttpConnectionManager + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthHttpConnectionManager + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RouteConfigName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipHttpConnectionManager(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthHttpConnectionManager + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *HttpFilter) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHttpConnectionManager + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: HttpFilter: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: HttpFilter: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHttpConnectionManager + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthHttpConnectionManager + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Config", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHttpConnectionManager + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthHttpConnectionManager + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Config == nil { + m.Config = &types.Struct{} + } + if err := m.Config.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DeprecatedV1", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHttpConnectionManager + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthHttpConnectionManager + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.DeprecatedV1 == nil { + m.DeprecatedV1 = &HttpFilter_DeprecatedV1{} + } + if err := m.DeprecatedV1.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipHttpConnectionManager(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthHttpConnectionManager + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *HttpFilter_DeprecatedV1) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHttpConnectionManager + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DeprecatedV1: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DeprecatedV1: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHttpConnectionManager + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthHttpConnectionManager + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Type = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipHttpConnectionManager(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthHttpConnectionManager + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipHttpConnectionManager(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowHttpConnectionManager + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowHttpConnectionManager + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + return iNdEx, nil + case 1: + iNdEx += 8 + return iNdEx, nil + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowHttpConnectionManager + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + iNdEx += length + if length < 0 { + return 0, ErrInvalidLengthHttpConnectionManager + } + return iNdEx, nil + case 3: + for { + var innerWire uint64 + var start int = iNdEx + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowHttpConnectionManager + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + innerWire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + innerWireType := int(innerWire & 0x7) + if innerWireType == 4 { + break + } + next, err := skipHttpConnectionManager(dAtA[start:]) + if err != nil { + return 0, err + } + iNdEx = start + next + } + return iNdEx, nil + case 4: + return iNdEx, nil + case 5: + iNdEx += 4 + return iNdEx, nil + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + } + panic("unreachable") +} + +var ( + ErrInvalidLengthHttpConnectionManager = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowHttpConnectionManager = fmt.Errorf("proto: integer overflow") +) + +func init() { + proto.RegisterFile("envoy/config/filter/network/http_connection_manager/v2/http_connection_manager.proto", fileDescriptor_http_connection_manager_5c85b4f0eeee8fe7) +} + +var fileDescriptor_http_connection_manager_5c85b4f0eeee8fe7 = []byte{ + // 1537 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x57, 0x4f, 0x6f, 0x23, 0x49, + 0x15, 0x4f, 0xdb, 0xce, 0xc4, 0x7e, 0xfe, 0x93, 0x4e, 0x65, 0x66, 0xd2, 0x78, 0x20, 0x31, 0x91, + 0x80, 0x68, 0x41, 0xed, 0xd8, 0x0c, 0xc3, 0x01, 0x84, 0xb0, 0x93, 0x0c, 0xc9, 0x68, 0x36, 0x8e, + 0xda, 0x9e, 0x1d, 0x76, 0x17, 0x54, 0xaa, 0xe9, 0x2e, 0x3b, 0xcd, 0xda, 0x5d, 0x4d, 0x55, 0xb5, + 0x27, 0x39, 0x21, 0xad, 0x38, 0x20, 0x4e, 0xc0, 0x01, 0x71, 0xe7, 0x03, 0x20, 0x6e, 0x88, 0xd3, + 0xdc, 0xd8, 0x23, 0x9f, 0x00, 0xd0, 0xdc, 0xf6, 0x2b, 0x70, 0x42, 0x55, 0xd5, 0xed, 0xd8, 0xf9, + 0xb7, 0xab, 0xdd, 0x70, 0x7b, 0x7e, 0xef, 0xfd, 0x7e, 0xef, 0x75, 0xd5, 0x7b, 0xaf, 0x9e, 0x61, + 0x40, 0xa3, 0x29, 0x3b, 0x6f, 0xfa, 0x2c, 0x1a, 0x86, 0xa3, 0xe6, 0x30, 0x1c, 0x4b, 0xca, 0x9b, + 0x11, 0x95, 0xaf, 0x19, 0xff, 0xa8, 0x79, 0x2a, 0x65, 0x8c, 0x7d, 0x16, 0x45, 0xd4, 0x97, 0x21, + 0x8b, 0xf0, 0x84, 0x44, 0x64, 0x44, 0x79, 0x73, 0xda, 0xbe, 0xc9, 0xe4, 0xc6, 0x9c, 0x49, 0x86, + 0x9e, 0x68, 0x56, 0xd7, 0xb0, 0xba, 0x86, 0xd5, 0x4d, 0x59, 0xdd, 0x9b, 0xa0, 0xd3, 0x76, 0xfd, + 0x1b, 0x26, 0x1b, 0x12, 0x87, 0x2a, 0x86, 0xcf, 0x38, 0x4d, 0x33, 0xc3, 0x82, 0x25, 0xdc, 0xa7, + 0x86, 0xbe, 0xde, 0xb8, 0xea, 0xa6, 0x0d, 0x3e, 0x1b, 0xa7, 0x1e, 0x0f, 0x17, 0x3c, 0x78, 0x20, + 0x52, 0xfd, 0xee, 0x75, 0x9f, 0x4b, 0x7c, 0x9f, 0x0a, 0x31, 0x66, 0x23, 0xe5, 0x3b, 0xfb, 0x91, + 0x22, 0x1c, 0x83, 0x90, 0xe7, 0x31, 0x6d, 0xc6, 0x94, 0xfb, 0x34, 0x92, 0xa9, 0x65, 0x73, 0xc4, + 0xd8, 0x68, 0x9c, 0x86, 0x7e, 0x95, 0x0c, 0x9b, 0x41, 0xc2, 0x89, 0xfa, 0xa2, 0xd4, 0xfe, 0xd5, + 0xcb, 0x76, 0x21, 0x79, 0xe2, 0xdf, 0x88, 0x7e, 0xcd, 0x49, 0x1c, 0x53, 0x9e, 0x65, 0xba, 0x31, + 0x25, 0xe3, 0x30, 0x20, 0x92, 0x36, 0x33, 0x21, 0x35, 0xdc, 0x1f, 0xb1, 0x11, 0xd3, 0x62, 0x53, + 0x49, 0x46, 0xbb, 0xfd, 0x66, 0x03, 0x1e, 0x1c, 0x4a, 0x19, 0xef, 0xcd, 0xce, 0xf5, 0x5d, 0x73, + 0xac, 0xe8, 0x63, 0x0b, 0xc0, 0x67, 0x01, 0xf5, 0xb1, 0xfa, 0x06, 0xc7, 0x6a, 0x58, 0x3b, 0xb5, + 0xf6, 0x4b, 0xf7, 0x8b, 0xdd, 0x90, 0x7b, 0x6d, 0x0c, 0x77, 0x4f, 0xf1, 0x0f, 0xce, 0x63, 0xda, + 0x85, 0xbf, 0x7f, 0xfa, 0x26, 0xbf, 0xfc, 0xb1, 0x95, 0xb3, 0x2d, 0xaf, 0xe4, 0x67, 0x6a, 0xf4, + 0x0e, 0x94, 0x85, 0x24, 0x12, 0xc7, 0x9c, 0x0e, 0xc3, 0x33, 0x27, 0xd7, 0xb0, 0x76, 0x4a, 0xdd, + 0x92, 0xf2, 0x2d, 0xf0, 0x5c, 0xc3, 0xf2, 0x40, 0x59, 0x4f, 0xb4, 0x11, 0xf5, 0x20, 0xcf, 0x03, + 0xe1, 0xe4, 0x1b, 0xd6, 0x4e, 0xb9, 0xfd, 0x83, 0x2f, 0x9a, 0xa8, 0x17, 0x88, 0xc3, 0x25, 0x4f, + 0x31, 0xa1, 0x03, 0xa8, 0x70, 0x96, 0x48, 0x8a, 0x0d, 0x89, 0x53, 0xd0, 0xcc, 0x8d, 0x94, 0x99, + 0xc4, 0xa1, 0xf6, 0x57, 0x1e, 0x7b, 0xda, 0x21, 0xbd, 0xc6, 0xc3, 0x25, 0xaf, 0xcc, 0x2f, 0xb4, + 0x88, 0x42, 0x45, 0xc7, 0x33, 0x39, 0x08, 0x67, 0xb9, 0x91, 0xdf, 0x29, 0xb7, 0xbb, 0x5f, 0xe6, + 0x24, 0x9f, 0x6a, 0x6f, 0xaf, 0x7c, 0x3a, 0x93, 0x05, 0xfa, 0x31, 0xd4, 0x48, 0x10, 0xe0, 0x44, + 0x50, 0x8e, 0xc9, 0x88, 0x46, 0xd2, 0xb9, 0xa7, 0xf3, 0xad, 0xbb, 0xa6, 0x62, 0xdc, 0xac, 0x62, + 0xdc, 0x2e, 0x63, 0xe3, 0xf7, 0xc8, 0x38, 0xa1, 0x5e, 0x85, 0x04, 0xc1, 0x0b, 0x41, 0x79, 0x47, + 0xf9, 0x23, 0x06, 0x2b, 0x92, 0x13, 0x3f, 0x8c, 0x46, 0xce, 0x8a, 0x86, 0xbe, 0xb8, 0xdb, 0xdb, + 0x1e, 0x18, 0x72, 0x2f, 0x8b, 0x82, 0x3e, 0x84, 0x07, 0x9a, 0x24, 0x6b, 0x42, 0xcc, 0x62, 0xe5, + 0x2f, 0x9c, 0xa2, 0x0e, 0xff, 0xad, 0xc5, 0x93, 0x56, 0xfd, 0xaa, 0x99, 0x5b, 0x27, 0xa9, 0x7f, + 0xcf, 0xb8, 0x7b, 0xeb, 0x8a, 0xe5, 0x92, 0x12, 0xfd, 0x1c, 0x1e, 0x2a, 0x75, 0xfb, 0x2a, 0x7b, + 0xe9, 0x56, 0xf6, 0xf6, 0x65, 0xf6, 0xfb, 0xa7, 0xd7, 0x68, 0xd1, 0x16, 0x94, 0x05, 0xe5, 0x53, + 0xca, 0x71, 0x44, 0x26, 0xd4, 0x01, 0x55, 0x99, 0x1e, 0x18, 0xd5, 0x31, 0x99, 0x50, 0xd4, 0x85, + 0x4a, 0x18, 0x8c, 0x29, 0x96, 0xe1, 0x84, 0xb2, 0x44, 0x3a, 0x65, 0x1d, 0xf5, 0x2b, 0x57, 0x6e, + 0x63, 0x3f, 0x2d, 0x9b, 0x6e, 0xe1, 0x4f, 0xff, 0xde, 0xb2, 0xbc, 0xb2, 0x02, 0x0d, 0x0c, 0x06, + 0xed, 0x43, 0x35, 0xe0, 0x24, 0x8c, 0x66, 0x24, 0x95, 0xcf, 0x47, 0x52, 0xd1, 0xa8, 0x8c, 0xe5, + 0x19, 0x80, 0x99, 0x4e, 0x78, 0xcc, 0x46, 0x4e, 0x55, 0x97, 0xdf, 0xb7, 0xaf, 0xbd, 0xda, 0x8b, + 0x21, 0x36, 0x6d, 0xbb, 0x1d, 0xfd, 0xe3, 0x39, 0x1b, 0x79, 0x25, 0x92, 0x89, 0xe8, 0x10, 0x50, + 0x22, 0x28, 0xe6, 0x74, 0xc2, 0x24, 0xc5, 0x24, 0x08, 0x38, 0x15, 0xc2, 0xa9, 0x7d, 0x66, 0xa5, + 0xd9, 0x89, 0xa0, 0x9e, 0x06, 0x75, 0x0c, 0x06, 0x3d, 0x83, 0xf5, 0x11, 0x8d, 0x28, 0x27, 0x52, + 0xd1, 0xfd, 0x32, 0xa1, 0x42, 0xe2, 0x30, 0x70, 0x56, 0x3f, 0x93, 0x6a, 0x2d, 0x83, 0x79, 0x06, + 0x75, 0x14, 0xa0, 0xbf, 0x5a, 0xf0, 0x68, 0xc8, 0xf8, 0x6b, 0xc2, 0x03, 0xec, 0x8f, 0x43, 0x1a, + 0x49, 0xec, 0x53, 0x2e, 0x71, 0x40, 0x25, 0x09, 0xc7, 0xc2, 0xb1, 0xf5, 0xf0, 0x1a, 0xde, 0x6d, + 0x39, 0x3f, 0x35, 0x01, 0xf7, 0x74, 0xbc, 0x3d, 0xca, 0xe5, 0xbe, 0x89, 0xb6, 0x30, 0xcb, 0x9c, + 0xe1, 0x0d, 0x5e, 0xe8, 0x2f, 0x16, 0x6c, 0x09, 0x2a, 0xb1, 0x9f, 0x70, 0xae, 0x13, 0xbe, 0x26, + 0xef, 0x35, 0x7d, 0x18, 0xe1, 0xdd, 0xe6, 0xdd, 0xa7, 0x72, 0xcf, 0xc4, 0xbc, 0x92, 0x94, 0xf7, + 0x48, 0xdc, 0x6c, 0x44, 0xdf, 0x01, 0x14, 0x73, 0x76, 0x76, 0x8e, 0x5b, 0xbb, 0xbb, 0x2a, 0xa2, + 0x0c, 0xa3, 0x84, 0x3a, 0xa8, 0x61, 0xed, 0x14, 0x3d, 0x5b, 0x5b, 0x5a, 0xbb, 0xbb, 0x7b, 0xa9, + 0x1e, 0x35, 0xe1, 0xfe, 0xd9, 0x70, 0x88, 0xa3, 0x64, 0x82, 0x25, 0x4f, 0x84, 0xa4, 0x01, 0x3e, + 0x65, 0xb1, 0x70, 0xd6, 0x1b, 0xd6, 0x4e, 0xd5, 0x5b, 0x3b, 0x1b, 0x0e, 0x8f, 0x93, 0xc9, 0xc0, + 0x58, 0x0e, 0x59, 0x2c, 0x10, 0x85, 0x16, 0xa7, 0x31, 0xa7, 0x42, 0x1d, 0x43, 0x18, 0x4f, 0x1f, + 0x5f, 0xaa, 0x32, 0x4c, 0x84, 0x51, 0x4f, 0xd4, 0x83, 0x17, 0x28, 0xf9, 0x89, 0x73, 0x5f, 0x47, + 0x7f, 0x67, 0x06, 0x3c, 0x8a, 0xa7, 0x8f, 0x17, 0xea, 0xac, 0x23, 0x94, 0xea, 0x5d, 0x0d, 0x39, + 0x8a, 0xa7, 0x4f, 0xd0, 0x37, 0x61, 0x55, 0x7c, 0x14, 0xc6, 0x58, 0x25, 0xa7, 0xb4, 0x51, 0xe0, + 0x3c, 0xd0, 0x24, 0x55, 0xa5, 0xfe, 0xe9, 0x70, 0xd8, 0xd1, 0x4a, 0x64, 0x43, 0x7e, 0x1a, 0x12, + 0xe7, 0xa1, 0x6e, 0x6c, 0x25, 0xa2, 0x5f, 0x5b, 0xb0, 0x9a, 0xc4, 0x23, 0x4e, 0x82, 0xec, 0x49, + 0x10, 0xce, 0x86, 0xee, 0xa6, 0x0f, 0xef, 0xf6, 0x86, 0x5e, 0x98, 0x20, 0xe6, 0xfd, 0xf0, 0x6a, + 0xc9, 0xfc, 0x4f, 0x81, 0x7a, 0xb0, 0x2e, 0x24, 0xa7, 0x64, 0x82, 0x17, 0xe6, 0x8b, 0xf3, 0xf9, + 0x46, 0xc3, 0x9a, 0xc1, 0x1e, 0x5d, 0x4c, 0x99, 0xfa, 0x3f, 0xf2, 0xb0, 0x92, 0xce, 0x66, 0xf4, + 0x47, 0x0b, 0x6a, 0x2c, 0xa6, 0x06, 0x62, 0x46, 0x9b, 0x79, 0xf9, 0xfd, 0xff, 0xcb, 0x5b, 0xe0, + 0xf6, 0xb2, 0x58, 0x6a, 0x66, 0x2e, 0x74, 0x4e, 0x95, 0xcd, 0x9b, 0xd0, 0xf7, 0xc1, 0xc9, 0xa6, + 0xc4, 0x29, 0x25, 0x01, 0xe5, 0x02, 0x0f, 0x19, 0xc7, 0x92, 0x8c, 0x84, 0x93, 0x6b, 0xe4, 0x77, + 0x4a, 0xde, 0x83, 0xd4, 0x7e, 0x68, 0xcc, 0x4f, 0x19, 0x1f, 0x90, 0x91, 0x40, 0x3f, 0x84, 0xd5, + 0xb4, 0xb5, 0x04, 0x99, 0xc4, 0x63, 0xf5, 0xba, 0x99, 0x15, 0x61, 0x3d, 0xfd, 0x22, 0xb5, 0xde, + 0xb8, 0x27, 0x66, 0x45, 0xf3, 0x6a, 0xc6, 0xb7, 0x9f, 0xba, 0x2a, 0x34, 0x27, 0x51, 0xc0, 0x26, + 0x17, 0xe8, 0xc2, 0x2d, 0x68, 0xe3, 0x3b, 0x43, 0xff, 0x08, 0x6c, 0x36, 0xa5, 0x9c, 0x8c, 0xc7, + 0x17, 0xf0, 0xe5, 0x9b, 0xe1, 0xab, 0xa9, 0x73, 0x86, 0xdf, 0x76, 0xa1, 0xba, 0x70, 0x40, 0xa8, + 0x0c, 0x2b, 0x47, 0xc7, 0x3f, 0xf1, 0x0e, 0xfa, 0x7d, 0x7b, 0x09, 0x01, 0xdc, 0x3b, 0x30, 0xb2, + 0x55, 0x2f, 0xfc, 0xe6, 0xcf, 0x9b, 0x4b, 0xf5, 0xdf, 0x5b, 0xf0, 0xe8, 0x96, 0xf6, 0x46, 0x8f, + 0x61, 0x45, 0x24, 0xaf, 0x7e, 0x41, 0x7d, 0xa9, 0x6f, 0xf5, 0xf6, 0x39, 0x9b, 0xb9, 0x22, 0x04, + 0x05, 0x35, 0x95, 0xf4, 0xb1, 0x15, 0x3d, 0x2d, 0xab, 0xee, 0x08, 0x22, 0xa1, 0xcf, 0xa2, 0xe8, + 0x29, 0x51, 0x69, 0x12, 0x1e, 0xea, 0xcf, 0x2b, 0x7a, 0x4a, 0x7c, 0x56, 0x28, 0xe6, 0xec, 0x7c, + 0xfd, 0x77, 0x16, 0x54, 0x17, 0x0a, 0x1a, 0x7d, 0x1d, 0x2a, 0x59, 0x1b, 0xcd, 0x56, 0xcb, 0x92, + 0x57, 0x4e, 0x75, 0x7a, 0xef, 0xfb, 0x19, 0xac, 0x64, 0xeb, 0x52, 0xee, 0xce, 0xd6, 0xa5, 0x8c, + 0x72, 0xbb, 0x05, 0xa5, 0xd9, 0xe6, 0x89, 0x8a, 0x50, 0xe8, 0xbc, 0x18, 0xf4, 0xec, 0x25, 0x54, + 0x82, 0xe5, 0xc3, 0xc1, 0xe0, 0xa4, 0x65, 0x5b, 0x99, 0xd8, 0xb6, 0x73, 0xe6, 0x64, 0xb7, 0x7f, + 0x05, 0xce, 0x4d, 0xf3, 0x1e, 0x55, 0xa0, 0xd8, 0xef, 0x1c, 0x1f, 0x0d, 0x8e, 0x3e, 0x38, 0xb0, + 0x97, 0x90, 0x0d, 0x95, 0xa7, 0x3d, 0xef, 0x65, 0xc7, 0xdb, 0xc7, 0xbd, 0xe3, 0xe7, 0xef, 0xdb, + 0x16, 0x42, 0x50, 0xeb, 0x9c, 0x9c, 0x1c, 0x1c, 0xef, 0xe3, 0xd4, 0x60, 0xe7, 0x94, 0x57, 0x86, + 0xc1, 0xfd, 0x83, 0x81, 0x9d, 0x47, 0x1b, 0xb0, 0xde, 0x79, 0xfe, 0xb2, 0xf3, 0x7e, 0x1f, 0x2f, + 0xc0, 0x0b, 0x26, 0x81, 0xae, 0x03, 0xab, 0x66, 0x19, 0x15, 0x31, 0xf5, 0xc3, 0x61, 0x48, 0x39, + 0x5a, 0xfe, 0xdb, 0xa7, 0x6f, 0xf2, 0xd6, 0xf6, 0x1f, 0x2c, 0xc8, 0x7b, 0x81, 0x40, 0x03, 0xa8, + 0x2e, 0xfc, 0xe9, 0x49, 0xaf, 0x78, 0xeb, 0x9a, 0x3d, 0xc7, 0x5c, 0x44, 0x5f, 0xbb, 0x75, 0x6b, + 0x9f, 0xfc, 0x6b, 0x6b, 0x49, 0x37, 0xde, 0x6f, 0x75, 0xe3, 0x55, 0xfc, 0x39, 0x2b, 0xfa, 0x1e, + 0xac, 0xcd, 0x2f, 0xc1, 0x66, 0x24, 0x5c, 0xd9, 0xc3, 0x57, 0xe7, 0x16, 0x5e, 0x55, 0xa8, 0xdb, + 0xff, 0xb5, 0x00, 0x2e, 0x8e, 0x1e, 0x7d, 0x0d, 0x0a, 0xb3, 0x59, 0xb2, 0x00, 0xd4, 0x6a, 0xd4, + 0x84, 0x7b, 0xe9, 0x8e, 0x9d, 0xd3, 0x39, 0x6f, 0x5c, 0x29, 0xcb, 0xbe, 0xfe, 0x0f, 0xe4, 0xa5, + 0x6e, 0xe8, 0x0c, 0xaa, 0x81, 0x1a, 0xf9, 0x3e, 0x51, 0xef, 0xca, 0xb4, 0x95, 0xb6, 0x74, 0xef, + 0xcb, 0x57, 0x89, 0xbb, 0x3f, 0xe3, 0x7d, 0xaf, 0xd5, 0xcd, 0x39, 0x6a, 0x99, 0x9a, 0xd3, 0xd4, + 0xb7, 0xa1, 0x32, 0xef, 0xa1, 0x9a, 0x63, 0xae, 0x88, 0xb5, 0xdc, 0xb5, 0x3f, 0x79, 0xbb, 0x69, + 0xfd, 0xf3, 0xed, 0xa6, 0xf5, 0x9f, 0xb7, 0x9b, 0xd6, 0x07, 0xb9, 0x69, 0xfb, 0xd5, 0x3d, 0xfd, + 0x21, 0xdf, 0xfd, 0x5f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xf4, 0xbc, 0xe5, 0x71, 0x37, 0x0f, 0x00, + 0x00, +} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/config/filter/network/http_connection_manager/v2/http_connection_manager.pb.validate.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/config/filter/network/http_connection_manager/v2/http_connection_manager.pb.validate.go new file mode 100644 index 000000000000..f99a666b9f7a --- /dev/null +++ b/vendor/github.com/envoyproxy/go-control-plane/envoy/config/filter/network/http_connection_manager/v2/http_connection_manager.pb.validate.go @@ -0,0 +1,660 @@ +// Code generated by protoc-gen-validate +// source: envoy/config/filter/network/http_connection_manager/v2/http_connection_manager.proto +// DO NOT EDIT!!! + +package v2 + +import ( + "bytes" + "errors" + "fmt" + "net" + "net/mail" + "net/url" + "regexp" + "strings" + "time" + "unicode/utf8" + + "github.com/gogo/protobuf/types" +) + +// ensure the imports are used +var ( + _ = bytes.MinRead + _ = errors.New("") + _ = fmt.Print + _ = utf8.UTFMax + _ = (*regexp.Regexp)(nil) + _ = (*strings.Reader)(nil) + _ = net.IPv4len + _ = time.Duration(0) + _ = (*url.URL)(nil) + _ = (*mail.Address)(nil) + _ = types.DynamicAny{} +) + +// Validate checks the field values on HttpConnectionManager with the rules +// defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *HttpConnectionManager) Validate() error { + if m == nil { + return nil + } + + if _, ok := HttpConnectionManager_CodecType_name[int32(m.GetCodecType())]; !ok { + return HttpConnectionManagerValidationError{ + Field: "CodecType", + Reason: "value must be one of the defined enum values", + } + } + + if len(m.GetStatPrefix()) < 1 { + return HttpConnectionManagerValidationError{ + Field: "StatPrefix", + Reason: "value length must be at least 1 bytes", + } + } + + for idx, item := range m.GetHttpFilters() { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return HttpConnectionManagerValidationError{ + Field: fmt.Sprintf("HttpFilters[%v]", idx), + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + } + + if v, ok := interface{}(m.GetAddUserAgent()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return HttpConnectionManagerValidationError{ + Field: "AddUserAgent", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + if v, ok := interface{}(m.GetTracing()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return HttpConnectionManagerValidationError{ + Field: "Tracing", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + if v, ok := interface{}(m.GetHttpProtocolOptions()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return HttpConnectionManagerValidationError{ + Field: "HttpProtocolOptions", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + if v, ok := interface{}(m.GetHttp2ProtocolOptions()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return HttpConnectionManagerValidationError{ + Field: "Http2ProtocolOptions", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + // no validation rules for ServerName + + if v, ok := interface{}(m.GetIdleTimeout()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return HttpConnectionManagerValidationError{ + Field: "IdleTimeout", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + if v, ok := interface{}(m.GetStreamIdleTimeout()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return HttpConnectionManagerValidationError{ + Field: "StreamIdleTimeout", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + if v, ok := interface{}(m.GetDrainTimeout()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return HttpConnectionManagerValidationError{ + Field: "DrainTimeout", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + for idx, item := range m.GetAccessLog() { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return HttpConnectionManagerValidationError{ + Field: fmt.Sprintf("AccessLog[%v]", idx), + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + } + + if v, ok := interface{}(m.GetUseRemoteAddress()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return HttpConnectionManagerValidationError{ + Field: "UseRemoteAddress", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + // no validation rules for XffNumTrustedHops + + // no validation rules for SkipXffAppend + + // no validation rules for Via + + if v, ok := interface{}(m.GetGenerateRequestId()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return HttpConnectionManagerValidationError{ + Field: "GenerateRequestId", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + if _, ok := HttpConnectionManager_ForwardClientCertDetails_name[int32(m.GetForwardClientCertDetails())]; !ok { + return HttpConnectionManagerValidationError{ + Field: "ForwardClientCertDetails", + Reason: "value must be one of the defined enum values", + } + } + + if v, ok := interface{}(m.GetSetCurrentClientCertDetails()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return HttpConnectionManagerValidationError{ + Field: "SetCurrentClientCertDetails", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + // no validation rules for Proxy_100Continue + + // no validation rules for RepresentIpv4RemoteAddressAsIpv4MappedIpv6 + + for idx, item := range m.GetUpgradeConfigs() { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return HttpConnectionManagerValidationError{ + Field: fmt.Sprintf("UpgradeConfigs[%v]", idx), + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + } + + switch m.RouteSpecifier.(type) { + + case *HttpConnectionManager_Rds: + + if v, ok := interface{}(m.GetRds()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return HttpConnectionManagerValidationError{ + Field: "Rds", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + case *HttpConnectionManager_RouteConfig: + + if v, ok := interface{}(m.GetRouteConfig()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return HttpConnectionManagerValidationError{ + Field: "RouteConfig", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + default: + return HttpConnectionManagerValidationError{ + Field: "RouteSpecifier", + Reason: "value is required", + } + + } + + return nil +} + +// HttpConnectionManagerValidationError is the validation error returned by +// HttpConnectionManager.Validate if the designated constraints aren't met. +type HttpConnectionManagerValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e HttpConnectionManagerValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sHttpConnectionManager.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = HttpConnectionManagerValidationError{} + +// Validate checks the field values on Rds with the rules defined in the proto +// definition for this message. If any rules are violated, an error is returned. +func (m *Rds) Validate() error { + if m == nil { + return nil + } + + if v, ok := interface{}(m.GetConfigSource()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return RdsValidationError{ + Field: "ConfigSource", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + if len(m.GetRouteConfigName()) < 1 { + return RdsValidationError{ + Field: "RouteConfigName", + Reason: "value length must be at least 1 bytes", + } + } + + return nil +} + +// RdsValidationError is the validation error returned by Rds.Validate if the +// designated constraints aren't met. +type RdsValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e RdsValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sRds.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = RdsValidationError{} + +// Validate checks the field values on HttpFilter with the rules defined in the +// proto definition for this message. If any rules are violated, an error is returned. +func (m *HttpFilter) Validate() error { + if m == nil { + return nil + } + + if len(m.GetName()) < 1 { + return HttpFilterValidationError{ + Field: "Name", + Reason: "value length must be at least 1 bytes", + } + } + + if v, ok := interface{}(m.GetConfig()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return HttpFilterValidationError{ + Field: "Config", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + if v, ok := interface{}(m.GetDeprecatedV1()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return HttpFilterValidationError{ + Field: "DeprecatedV1", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + return nil +} + +// HttpFilterValidationError is the validation error returned by +// HttpFilter.Validate if the designated constraints aren't met. +type HttpFilterValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e HttpFilterValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sHttpFilter.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = HttpFilterValidationError{} + +// Validate checks the field values on HttpConnectionManager_Tracing with the +// rules defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *HttpConnectionManager_Tracing) Validate() error { + if m == nil { + return nil + } + + if _, ok := HttpConnectionManager_Tracing_OperationName_name[int32(m.GetOperationName())]; !ok { + return HttpConnectionManager_TracingValidationError{ + Field: "OperationName", + Reason: "value must be one of the defined enum values", + } + } + + if v, ok := interface{}(m.GetClientSampling()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return HttpConnectionManager_TracingValidationError{ + Field: "ClientSampling", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + if v, ok := interface{}(m.GetRandomSampling()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return HttpConnectionManager_TracingValidationError{ + Field: "RandomSampling", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + if v, ok := interface{}(m.GetOverallSampling()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return HttpConnectionManager_TracingValidationError{ + Field: "OverallSampling", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + return nil +} + +// HttpConnectionManager_TracingValidationError is the validation error +// returned by HttpConnectionManager_Tracing.Validate if the designated +// constraints aren't met. +type HttpConnectionManager_TracingValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e HttpConnectionManager_TracingValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sHttpConnectionManager_Tracing.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = HttpConnectionManager_TracingValidationError{} + +// Validate checks the field values on +// HttpConnectionManager_SetCurrentClientCertDetails with the rules defined in +// the proto definition for this message. If any rules are violated, an error +// is returned. +func (m *HttpConnectionManager_SetCurrentClientCertDetails) Validate() error { + if m == nil { + return nil + } + + if v, ok := interface{}(m.GetSubject()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return HttpConnectionManager_SetCurrentClientCertDetailsValidationError{ + Field: "Subject", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + // no validation rules for Cert + + // no validation rules for Dns + + // no validation rules for Uri + + return nil +} + +// HttpConnectionManager_SetCurrentClientCertDetailsValidationError is the +// validation error returned by +// HttpConnectionManager_SetCurrentClientCertDetails.Validate if the +// designated constraints aren't met. +type HttpConnectionManager_SetCurrentClientCertDetailsValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e HttpConnectionManager_SetCurrentClientCertDetailsValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sHttpConnectionManager_SetCurrentClientCertDetails.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = HttpConnectionManager_SetCurrentClientCertDetailsValidationError{} + +// Validate checks the field values on HttpConnectionManager_UpgradeConfig with +// the rules defined in the proto definition for this message. If any rules +// are violated, an error is returned. +func (m *HttpConnectionManager_UpgradeConfig) Validate() error { + if m == nil { + return nil + } + + // no validation rules for UpgradeType + + for idx, item := range m.GetFilters() { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return HttpConnectionManager_UpgradeConfigValidationError{ + Field: fmt.Sprintf("Filters[%v]", idx), + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + } + + return nil +} + +// HttpConnectionManager_UpgradeConfigValidationError is the validation error +// returned by HttpConnectionManager_UpgradeConfig.Validate if the designated +// constraints aren't met. +type HttpConnectionManager_UpgradeConfigValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e HttpConnectionManager_UpgradeConfigValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sHttpConnectionManager_UpgradeConfig.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = HttpConnectionManager_UpgradeConfigValidationError{} + +// Validate checks the field values on HttpFilter_DeprecatedV1 with the rules +// defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *HttpFilter_DeprecatedV1) Validate() error { + if m == nil { + return nil + } + + // no validation rules for Type + + return nil +} + +// HttpFilter_DeprecatedV1ValidationError is the validation error returned by +// HttpFilter_DeprecatedV1.Validate if the designated constraints aren't met. +type HttpFilter_DeprecatedV1ValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e HttpFilter_DeprecatedV1ValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sHttpFilter_DeprecatedV1.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = HttpFilter_DeprecatedV1ValidationError{} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/config/filter/network/tcp_proxy/v2/tcp_proxy.pb.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/config/filter/network/tcp_proxy/v2/tcp_proxy.pb.go new file mode 100644 index 000000000000..5c7f39093021 --- /dev/null +++ b/vendor/github.com/envoyproxy/go-control-plane/envoy/config/filter/network/tcp_proxy/v2/tcp_proxy.pb.go @@ -0,0 +1,1448 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: envoy/config/filter/network/tcp_proxy/v2/tcp_proxy.proto + +package v2 + +import proto "github.com/gogo/protobuf/proto" +import fmt "fmt" +import math "math" +import core "github.com/envoyproxy/go-control-plane/envoy/api/v2/core" +import v2 "github.com/envoyproxy/go-control-plane/envoy/config/filter/accesslog/v2" +import _ "github.com/gogo/protobuf/gogoproto" +import types "github.com/gogo/protobuf/types" +import _ "github.com/lyft/protoc-gen-validate/validate" + +import time "time" + +import github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" + +import io "io" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf +var _ = time.Kitchen + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package + +type TcpProxy struct { + // The prefix to use when emitting :ref:`statistics + // `. + StatPrefix string `protobuf:"bytes,1,opt,name=stat_prefix,json=statPrefix,proto3" json:"stat_prefix,omitempty"` + // The upstream cluster to connect to. + // + // .. note:: + // + // Once full filter chain matching is implemented in listeners, this field will become the only + // way to configure the target cluster. All other matching will be done via :ref:`filter chain + // matching rules `. For very simple configurations, + // this field can still be used to select the cluster when no other matching rules are required. + // Otherwise, a :ref:`deprecated_v1 + // ` configuration is + // required to use more complex routing in the interim. + // + Cluster string `protobuf:"bytes,2,opt,name=cluster,proto3" json:"cluster,omitempty"` + // Optional endpoint metadata match criteria. Only endpoints in the upstream + // cluster with metadata matching that set in metadata_match will be + // considered. The filter name should be specified as *envoy.lb*. + MetadataMatch *core.Metadata `protobuf:"bytes,9,opt,name=metadata_match,json=metadataMatch" json:"metadata_match,omitempty"` + // The idle timeout for connections managed by the TCP proxy filter. The idle timeout + // is defined as the period in which there are no bytes sent or received on either + // the upstream or downstream connection. If not set, connections will never be closed + // by the TCP proxy due to being idle. + IdleTimeout *time.Duration `protobuf:"bytes,8,opt,name=idle_timeout,json=idleTimeout,stdduration" json:"idle_timeout,omitempty"` + // [#not-implemented-hide:] The idle timeout for connections managed by the TCP proxy + // filter. The idle timeout is defined as the period in which there is no + // active traffic. If not set, there is no idle timeout. When the idle timeout + // is reached the connection will be closed. The distinction between + // downstream_idle_timeout/upstream_idle_timeout provides a means to set + // timeout based on the last byte sent on the downstream/upstream connection. + DownstreamIdleTimeout *types.Duration `protobuf:"bytes,3,opt,name=downstream_idle_timeout,json=downstreamIdleTimeout" json:"downstream_idle_timeout,omitempty"` + // [#not-implemented-hide:] + UpstreamIdleTimeout *types.Duration `protobuf:"bytes,4,opt,name=upstream_idle_timeout,json=upstreamIdleTimeout" json:"upstream_idle_timeout,omitempty"` + // Configuration for :ref:`access logs ` + // emitted by the this tcp_proxy. + AccessLog []*v2.AccessLog `protobuf:"bytes,5,rep,name=access_log,json=accessLog" json:"access_log,omitempty"` + // TCP Proxy filter configuration using deprecated V1 format. This is required for complex + // routing until filter chain matching in the listener is implemented. + // + // .. attention:: + // + // Using this field will lead to `problems loading the configuration + // `_. If you want to configure the filter + // using v1 config structure, please make this field a boolean with value ``true`` and configure + // via the opaque ``value`` field like is suggested in :api:`envoy/config/filter/README.md`. + DeprecatedV1 *TcpProxy_DeprecatedV1 `protobuf:"bytes,6,opt,name=deprecated_v1,json=deprecatedV1" json:"deprecated_v1,omitempty"` // Deprecated: Do not use. + // The maximum number of unsuccessful connection attempts that will be made before + // giving up. If the parameter is not specified, 1 connection attempt will be made. + MaxConnectAttempts *types.UInt32Value `protobuf:"bytes,7,opt,name=max_connect_attempts,json=maxConnectAttempts" json:"max_connect_attempts,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *TcpProxy) Reset() { *m = TcpProxy{} } +func (m *TcpProxy) String() string { return proto.CompactTextString(m) } +func (*TcpProxy) ProtoMessage() {} +func (*TcpProxy) Descriptor() ([]byte, []int) { + return fileDescriptor_tcp_proxy_a4de2eb36d680bd4, []int{0} +} +func (m *TcpProxy) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *TcpProxy) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_TcpProxy.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *TcpProxy) XXX_Merge(src proto.Message) { + xxx_messageInfo_TcpProxy.Merge(dst, src) +} +func (m *TcpProxy) XXX_Size() int { + return m.Size() +} +func (m *TcpProxy) XXX_DiscardUnknown() { + xxx_messageInfo_TcpProxy.DiscardUnknown(m) +} + +var xxx_messageInfo_TcpProxy proto.InternalMessageInfo + +func (m *TcpProxy) GetStatPrefix() string { + if m != nil { + return m.StatPrefix + } + return "" +} + +func (m *TcpProxy) GetCluster() string { + if m != nil { + return m.Cluster + } + return "" +} + +func (m *TcpProxy) GetMetadataMatch() *core.Metadata { + if m != nil { + return m.MetadataMatch + } + return nil +} + +func (m *TcpProxy) GetIdleTimeout() *time.Duration { + if m != nil { + return m.IdleTimeout + } + return nil +} + +func (m *TcpProxy) GetDownstreamIdleTimeout() *types.Duration { + if m != nil { + return m.DownstreamIdleTimeout + } + return nil +} + +func (m *TcpProxy) GetUpstreamIdleTimeout() *types.Duration { + if m != nil { + return m.UpstreamIdleTimeout + } + return nil +} + +func (m *TcpProxy) GetAccessLog() []*v2.AccessLog { + if m != nil { + return m.AccessLog + } + return nil +} + +// Deprecated: Do not use. +func (m *TcpProxy) GetDeprecatedV1() *TcpProxy_DeprecatedV1 { + if m != nil { + return m.DeprecatedV1 + } + return nil +} + +func (m *TcpProxy) GetMaxConnectAttempts() *types.UInt32Value { + if m != nil { + return m.MaxConnectAttempts + } + return nil +} + +// TCP Proxy filter configuration using V1 format, until Envoy gets the +// ability to match source/destination at the listener level (called +// :ref:`filter chain match `). +type TcpProxy_DeprecatedV1 struct { + // The route table for the filter. All filter instances must have a route + // table, even if it is empty. + Routes []*TcpProxy_DeprecatedV1_TCPRoute `protobuf:"bytes,1,rep,name=routes" json:"routes,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *TcpProxy_DeprecatedV1) Reset() { *m = TcpProxy_DeprecatedV1{} } +func (m *TcpProxy_DeprecatedV1) String() string { return proto.CompactTextString(m) } +func (*TcpProxy_DeprecatedV1) ProtoMessage() {} +func (*TcpProxy_DeprecatedV1) Descriptor() ([]byte, []int) { + return fileDescriptor_tcp_proxy_a4de2eb36d680bd4, []int{0, 0} +} +func (m *TcpProxy_DeprecatedV1) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *TcpProxy_DeprecatedV1) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_TcpProxy_DeprecatedV1.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *TcpProxy_DeprecatedV1) XXX_Merge(src proto.Message) { + xxx_messageInfo_TcpProxy_DeprecatedV1.Merge(dst, src) +} +func (m *TcpProxy_DeprecatedV1) XXX_Size() int { + return m.Size() +} +func (m *TcpProxy_DeprecatedV1) XXX_DiscardUnknown() { + xxx_messageInfo_TcpProxy_DeprecatedV1.DiscardUnknown(m) +} + +var xxx_messageInfo_TcpProxy_DeprecatedV1 proto.InternalMessageInfo + +func (m *TcpProxy_DeprecatedV1) GetRoutes() []*TcpProxy_DeprecatedV1_TCPRoute { + if m != nil { + return m.Routes + } + return nil +} + +// A TCP proxy route consists of a set of optional L4 criteria and the +// name of a cluster. If a downstream connection matches all the +// specified criteria, the cluster in the route is used for the +// corresponding upstream connection. Routes are tried in the order +// specified until a match is found. If no match is found, the connection +// is closed. A route with no criteria is valid and always produces a +// match. +type TcpProxy_DeprecatedV1_TCPRoute struct { + // The cluster to connect to when a the downstream network connection + // matches the specified criteria. + Cluster string `protobuf:"bytes,1,opt,name=cluster,proto3" json:"cluster,omitempty"` + // An optional list of IP address subnets in the form + // “ip_address/xx”. The criteria is satisfied if the destination IP + // address of the downstream connection is contained in at least one of + // the specified subnets. If the parameter is not specified or the list + // is empty, the destination IP address is ignored. The destination IP + // address of the downstream connection might be different from the + // addresses on which the proxy is listening if the connection has been + // redirected. + DestinationIpList []*core.CidrRange `protobuf:"bytes,2,rep,name=destination_ip_list,json=destinationIpList" json:"destination_ip_list,omitempty"` + // An optional string containing a comma-separated list of port numbers + // or ranges. The criteria is satisfied if the destination port of the + // downstream connection is contained in at least one of the specified + // ranges. If the parameter is not specified, the destination port is + // ignored. The destination port address of the downstream connection + // might be different from the port on which the proxy is listening if + // the connection has been redirected. + DestinationPorts string `protobuf:"bytes,3,opt,name=destination_ports,json=destinationPorts,proto3" json:"destination_ports,omitempty"` + // An optional list of IP address subnets in the form + // “ip_address/xx”. The criteria is satisfied if the source IP address + // of the downstream connection is contained in at least one of the + // specified subnets. If the parameter is not specified or the list is + // empty, the source IP address is ignored. + SourceIpList []*core.CidrRange `protobuf:"bytes,4,rep,name=source_ip_list,json=sourceIpList" json:"source_ip_list,omitempty"` + // An optional string containing a comma-separated list of port numbers + // or ranges. The criteria is satisfied if the source port of the + // downstream connection is contained in at least one of the specified + // ranges. If the parameter is not specified, the source port is + // ignored. + SourcePorts string `protobuf:"bytes,5,opt,name=source_ports,json=sourcePorts,proto3" json:"source_ports,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *TcpProxy_DeprecatedV1_TCPRoute) Reset() { *m = TcpProxy_DeprecatedV1_TCPRoute{} } +func (m *TcpProxy_DeprecatedV1_TCPRoute) String() string { return proto.CompactTextString(m) } +func (*TcpProxy_DeprecatedV1_TCPRoute) ProtoMessage() {} +func (*TcpProxy_DeprecatedV1_TCPRoute) Descriptor() ([]byte, []int) { + return fileDescriptor_tcp_proxy_a4de2eb36d680bd4, []int{0, 0, 0} +} +func (m *TcpProxy_DeprecatedV1_TCPRoute) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *TcpProxy_DeprecatedV1_TCPRoute) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_TcpProxy_DeprecatedV1_TCPRoute.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *TcpProxy_DeprecatedV1_TCPRoute) XXX_Merge(src proto.Message) { + xxx_messageInfo_TcpProxy_DeprecatedV1_TCPRoute.Merge(dst, src) +} +func (m *TcpProxy_DeprecatedV1_TCPRoute) XXX_Size() int { + return m.Size() +} +func (m *TcpProxy_DeprecatedV1_TCPRoute) XXX_DiscardUnknown() { + xxx_messageInfo_TcpProxy_DeprecatedV1_TCPRoute.DiscardUnknown(m) +} + +var xxx_messageInfo_TcpProxy_DeprecatedV1_TCPRoute proto.InternalMessageInfo + +func (m *TcpProxy_DeprecatedV1_TCPRoute) GetCluster() string { + if m != nil { + return m.Cluster + } + return "" +} + +func (m *TcpProxy_DeprecatedV1_TCPRoute) GetDestinationIpList() []*core.CidrRange { + if m != nil { + return m.DestinationIpList + } + return nil +} + +func (m *TcpProxy_DeprecatedV1_TCPRoute) GetDestinationPorts() string { + if m != nil { + return m.DestinationPorts + } + return "" +} + +func (m *TcpProxy_DeprecatedV1_TCPRoute) GetSourceIpList() []*core.CidrRange { + if m != nil { + return m.SourceIpList + } + return nil +} + +func (m *TcpProxy_DeprecatedV1_TCPRoute) GetSourcePorts() string { + if m != nil { + return m.SourcePorts + } + return "" +} + +func init() { + proto.RegisterType((*TcpProxy)(nil), "envoy.config.filter.network.tcp_proxy.v2.TcpProxy") + proto.RegisterType((*TcpProxy_DeprecatedV1)(nil), "envoy.config.filter.network.tcp_proxy.v2.TcpProxy.DeprecatedV1") + proto.RegisterType((*TcpProxy_DeprecatedV1_TCPRoute)(nil), "envoy.config.filter.network.tcp_proxy.v2.TcpProxy.DeprecatedV1.TCPRoute") +} +func (m *TcpProxy) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *TcpProxy) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.StatPrefix) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintTcpProxy(dAtA, i, uint64(len(m.StatPrefix))) + i += copy(dAtA[i:], m.StatPrefix) + } + if len(m.Cluster) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintTcpProxy(dAtA, i, uint64(len(m.Cluster))) + i += copy(dAtA[i:], m.Cluster) + } + if m.DownstreamIdleTimeout != nil { + dAtA[i] = 0x1a + i++ + i = encodeVarintTcpProxy(dAtA, i, uint64(m.DownstreamIdleTimeout.Size())) + n1, err := m.DownstreamIdleTimeout.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n1 + } + if m.UpstreamIdleTimeout != nil { + dAtA[i] = 0x22 + i++ + i = encodeVarintTcpProxy(dAtA, i, uint64(m.UpstreamIdleTimeout.Size())) + n2, err := m.UpstreamIdleTimeout.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n2 + } + if len(m.AccessLog) > 0 { + for _, msg := range m.AccessLog { + dAtA[i] = 0x2a + i++ + i = encodeVarintTcpProxy(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if m.DeprecatedV1 != nil { + dAtA[i] = 0x32 + i++ + i = encodeVarintTcpProxy(dAtA, i, uint64(m.DeprecatedV1.Size())) + n3, err := m.DeprecatedV1.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n3 + } + if m.MaxConnectAttempts != nil { + dAtA[i] = 0x3a + i++ + i = encodeVarintTcpProxy(dAtA, i, uint64(m.MaxConnectAttempts.Size())) + n4, err := m.MaxConnectAttempts.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n4 + } + if m.IdleTimeout != nil { + dAtA[i] = 0x42 + i++ + i = encodeVarintTcpProxy(dAtA, i, uint64(github_com_gogo_protobuf_types.SizeOfStdDuration(*m.IdleTimeout))) + n5, err := github_com_gogo_protobuf_types.StdDurationMarshalTo(*m.IdleTimeout, dAtA[i:]) + if err != nil { + return 0, err + } + i += n5 + } + if m.MetadataMatch != nil { + dAtA[i] = 0x4a + i++ + i = encodeVarintTcpProxy(dAtA, i, uint64(m.MetadataMatch.Size())) + n6, err := m.MetadataMatch.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n6 + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *TcpProxy_DeprecatedV1) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *TcpProxy_DeprecatedV1) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Routes) > 0 { + for _, msg := range m.Routes { + dAtA[i] = 0xa + i++ + i = encodeVarintTcpProxy(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *TcpProxy_DeprecatedV1_TCPRoute) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *TcpProxy_DeprecatedV1_TCPRoute) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Cluster) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintTcpProxy(dAtA, i, uint64(len(m.Cluster))) + i += copy(dAtA[i:], m.Cluster) + } + if len(m.DestinationIpList) > 0 { + for _, msg := range m.DestinationIpList { + dAtA[i] = 0x12 + i++ + i = encodeVarintTcpProxy(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if len(m.DestinationPorts) > 0 { + dAtA[i] = 0x1a + i++ + i = encodeVarintTcpProxy(dAtA, i, uint64(len(m.DestinationPorts))) + i += copy(dAtA[i:], m.DestinationPorts) + } + if len(m.SourceIpList) > 0 { + for _, msg := range m.SourceIpList { + dAtA[i] = 0x22 + i++ + i = encodeVarintTcpProxy(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if len(m.SourcePorts) > 0 { + dAtA[i] = 0x2a + i++ + i = encodeVarintTcpProxy(dAtA, i, uint64(len(m.SourcePorts))) + i += copy(dAtA[i:], m.SourcePorts) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func encodeVarintTcpProxy(dAtA []byte, offset int, v uint64) int { + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return offset + 1 +} +func (m *TcpProxy) Size() (n int) { + var l int + _ = l + l = len(m.StatPrefix) + if l > 0 { + n += 1 + l + sovTcpProxy(uint64(l)) + } + l = len(m.Cluster) + if l > 0 { + n += 1 + l + sovTcpProxy(uint64(l)) + } + if m.DownstreamIdleTimeout != nil { + l = m.DownstreamIdleTimeout.Size() + n += 1 + l + sovTcpProxy(uint64(l)) + } + if m.UpstreamIdleTimeout != nil { + l = m.UpstreamIdleTimeout.Size() + n += 1 + l + sovTcpProxy(uint64(l)) + } + if len(m.AccessLog) > 0 { + for _, e := range m.AccessLog { + l = e.Size() + n += 1 + l + sovTcpProxy(uint64(l)) + } + } + if m.DeprecatedV1 != nil { + l = m.DeprecatedV1.Size() + n += 1 + l + sovTcpProxy(uint64(l)) + } + if m.MaxConnectAttempts != nil { + l = m.MaxConnectAttempts.Size() + n += 1 + l + sovTcpProxy(uint64(l)) + } + if m.IdleTimeout != nil { + l = github_com_gogo_protobuf_types.SizeOfStdDuration(*m.IdleTimeout) + n += 1 + l + sovTcpProxy(uint64(l)) + } + if m.MetadataMatch != nil { + l = m.MetadataMatch.Size() + n += 1 + l + sovTcpProxy(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *TcpProxy_DeprecatedV1) Size() (n int) { + var l int + _ = l + if len(m.Routes) > 0 { + for _, e := range m.Routes { + l = e.Size() + n += 1 + l + sovTcpProxy(uint64(l)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *TcpProxy_DeprecatedV1_TCPRoute) Size() (n int) { + var l int + _ = l + l = len(m.Cluster) + if l > 0 { + n += 1 + l + sovTcpProxy(uint64(l)) + } + if len(m.DestinationIpList) > 0 { + for _, e := range m.DestinationIpList { + l = e.Size() + n += 1 + l + sovTcpProxy(uint64(l)) + } + } + l = len(m.DestinationPorts) + if l > 0 { + n += 1 + l + sovTcpProxy(uint64(l)) + } + if len(m.SourceIpList) > 0 { + for _, e := range m.SourceIpList { + l = e.Size() + n += 1 + l + sovTcpProxy(uint64(l)) + } + } + l = len(m.SourcePorts) + if l > 0 { + n += 1 + l + sovTcpProxy(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func sovTcpProxy(x uint64) (n int) { + for { + n++ + x >>= 7 + if x == 0 { + break + } + } + return n +} +func sozTcpProxy(x uint64) (n int) { + return sovTcpProxy(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *TcpProxy) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTcpProxy + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: TcpProxy: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TcpProxy: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field StatPrefix", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTcpProxy + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTcpProxy + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.StatPrefix = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Cluster", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTcpProxy + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTcpProxy + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Cluster = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DownstreamIdleTimeout", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTcpProxy + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTcpProxy + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.DownstreamIdleTimeout == nil { + m.DownstreamIdleTimeout = &types.Duration{} + } + if err := m.DownstreamIdleTimeout.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field UpstreamIdleTimeout", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTcpProxy + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTcpProxy + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.UpstreamIdleTimeout == nil { + m.UpstreamIdleTimeout = &types.Duration{} + } + if err := m.UpstreamIdleTimeout.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AccessLog", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTcpProxy + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTcpProxy + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.AccessLog = append(m.AccessLog, &v2.AccessLog{}) + if err := m.AccessLog[len(m.AccessLog)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DeprecatedV1", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTcpProxy + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTcpProxy + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.DeprecatedV1 == nil { + m.DeprecatedV1 = &TcpProxy_DeprecatedV1{} + } + if err := m.DeprecatedV1.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxConnectAttempts", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTcpProxy + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTcpProxy + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.MaxConnectAttempts == nil { + m.MaxConnectAttempts = &types.UInt32Value{} + } + if err := m.MaxConnectAttempts.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field IdleTimeout", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTcpProxy + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTcpProxy + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.IdleTimeout == nil { + m.IdleTimeout = new(time.Duration) + } + if err := github_com_gogo_protobuf_types.StdDurationUnmarshal(m.IdleTimeout, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MetadataMatch", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTcpProxy + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTcpProxy + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.MetadataMatch == nil { + m.MetadataMatch = &core.Metadata{} + } + if err := m.MetadataMatch.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTcpProxy(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTcpProxy + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *TcpProxy_DeprecatedV1) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTcpProxy + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DeprecatedV1: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DeprecatedV1: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Routes", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTcpProxy + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTcpProxy + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Routes = append(m.Routes, &TcpProxy_DeprecatedV1_TCPRoute{}) + if err := m.Routes[len(m.Routes)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTcpProxy(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTcpProxy + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *TcpProxy_DeprecatedV1_TCPRoute) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTcpProxy + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: TCPRoute: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TCPRoute: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Cluster", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTcpProxy + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTcpProxy + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Cluster = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DestinationIpList", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTcpProxy + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTcpProxy + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DestinationIpList = append(m.DestinationIpList, &core.CidrRange{}) + if err := m.DestinationIpList[len(m.DestinationIpList)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DestinationPorts", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTcpProxy + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTcpProxy + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DestinationPorts = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SourceIpList", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTcpProxy + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTcpProxy + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SourceIpList = append(m.SourceIpList, &core.CidrRange{}) + if err := m.SourceIpList[len(m.SourceIpList)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SourcePorts", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTcpProxy + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTcpProxy + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SourcePorts = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTcpProxy(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTcpProxy + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipTcpProxy(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTcpProxy + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTcpProxy + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + return iNdEx, nil + case 1: + iNdEx += 8 + return iNdEx, nil + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTcpProxy + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + iNdEx += length + if length < 0 { + return 0, ErrInvalidLengthTcpProxy + } + return iNdEx, nil + case 3: + for { + var innerWire uint64 + var start int = iNdEx + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTcpProxy + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + innerWire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + innerWireType := int(innerWire & 0x7) + if innerWireType == 4 { + break + } + next, err := skipTcpProxy(dAtA[start:]) + if err != nil { + return 0, err + } + iNdEx = start + next + } + return iNdEx, nil + case 4: + return iNdEx, nil + case 5: + iNdEx += 4 + return iNdEx, nil + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + } + panic("unreachable") +} + +var ( + ErrInvalidLengthTcpProxy = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTcpProxy = fmt.Errorf("proto: integer overflow") +) + +func init() { + proto.RegisterFile("envoy/config/filter/network/tcp_proxy/v2/tcp_proxy.proto", fileDescriptor_tcp_proxy_a4de2eb36d680bd4) +} + +var fileDescriptor_tcp_proxy_a4de2eb36d680bd4 = []byte{ + // 683 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x53, 0xcd, 0x6e, 0xd3, 0x4a, + 0x14, 0xbe, 0xe3, 0xf4, 0x27, 0x99, 0xa4, 0x55, 0xaf, 0xdb, 0xaa, 0xbe, 0xb9, 0x55, 0x1a, 0x60, + 0x13, 0xb5, 0xd2, 0x98, 0xa6, 0x1b, 0x76, 0xa8, 0x69, 0x17, 0x14, 0xa5, 0x52, 0xb0, 0x4a, 0x25, + 0xd8, 0x58, 0x53, 0x7b, 0xe2, 0x8e, 0xb0, 0x3d, 0xa3, 0x99, 0xb1, 0x9b, 0xbe, 0x05, 0xb0, 0xe2, + 0x11, 0x10, 0x8f, 0xc0, 0x8a, 0x25, 0x4b, 0xde, 0x00, 0xd4, 0x1d, 0x6f, 0x81, 0x3c, 0xb6, 0x13, + 0xa3, 0x06, 0xb5, 0x12, 0xbb, 0x39, 0x3f, 0xdf, 0xf7, 0xf9, 0x7c, 0xe7, 0x18, 0x3e, 0x21, 0x71, + 0xca, 0xae, 0x6d, 0x8f, 0xc5, 0x63, 0x1a, 0xd8, 0x63, 0x1a, 0x2a, 0x22, 0xec, 0x98, 0xa8, 0x2b, + 0x26, 0xde, 0xd8, 0xca, 0xe3, 0x2e, 0x17, 0x6c, 0x72, 0x6d, 0xa7, 0xfd, 0x59, 0x80, 0xb8, 0x60, + 0x8a, 0x99, 0x3d, 0x8d, 0x44, 0x39, 0x12, 0xe5, 0x48, 0x54, 0x20, 0xd1, 0xac, 0x39, 0xed, 0xb7, + 0x1f, 0xcf, 0xd3, 0xc0, 0x9e, 0x47, 0xa4, 0x0c, 0x59, 0x90, 0x71, 0x4f, 0x83, 0x9c, 0xbb, 0xbd, + 0x93, 0x23, 0x30, 0xa7, 0x59, 0xd5, 0x63, 0x82, 0xd8, 0xd8, 0xf7, 0x05, 0x91, 0xb2, 0x68, 0xd8, + 0xbe, 0xdd, 0x70, 0x81, 0x25, 0x29, 0xaa, 0x9d, 0x80, 0xb1, 0x20, 0x24, 0xb6, 0x8e, 0x2e, 0x92, + 0xb1, 0xed, 0x27, 0x02, 0x2b, 0xca, 0xe2, 0x3f, 0xd5, 0xaf, 0x04, 0xe6, 0x9c, 0x88, 0x92, 0x7d, + 0x2b, 0xc5, 0x21, 0xf5, 0xb1, 0x22, 0x76, 0xf9, 0x28, 0x0a, 0x1b, 0x01, 0x0b, 0x98, 0x7e, 0xda, + 0xd9, 0x2b, 0xcf, 0x3e, 0xfc, 0x58, 0x87, 0xf5, 0x33, 0x8f, 0x8f, 0xb2, 0x79, 0xcd, 0x5d, 0xd8, + 0x94, 0x0a, 0x2b, 0x97, 0x0b, 0x32, 0xa6, 0x13, 0x0b, 0x74, 0x41, 0xaf, 0x31, 0x68, 0x7c, 0xfe, + 0xf9, 0xa5, 0xb6, 0x20, 0x8c, 0x2e, 0x70, 0x60, 0x56, 0x1d, 0xe9, 0xa2, 0x69, 0xc1, 0x65, 0x2f, + 0x4c, 0xa4, 0x22, 0xc2, 0x32, 0xb2, 0x3e, 0xa7, 0x0c, 0xcd, 0x17, 0x70, 0xcb, 0x67, 0x57, 0xb1, + 0x54, 0x82, 0xe0, 0xc8, 0xa5, 0x7e, 0x48, 0x5c, 0x45, 0x23, 0xc2, 0x12, 0x65, 0xd5, 0xba, 0xa0, + 0xd7, 0xec, 0xff, 0x87, 0xf2, 0x19, 0x50, 0x39, 0x03, 0x3a, 0x2e, 0x66, 0x74, 0x36, 0x67, 0xc8, + 0x13, 0x3f, 0x24, 0x67, 0x39, 0xce, 0x3c, 0x85, 0x9b, 0x09, 0x9f, 0x47, 0xb8, 0x70, 0x17, 0xe1, + 0x7a, 0x89, 0xab, 0xd2, 0x3d, 0x87, 0x30, 0xdf, 0x9a, 0x1b, 0xb2, 0xc0, 0x5a, 0xec, 0xd6, 0x7a, + 0xcd, 0xfe, 0x1e, 0x9a, 0x77, 0x13, 0xb3, 0xe5, 0xa6, 0x7d, 0x74, 0xa8, 0x83, 0x21, 0x0b, 0x9c, + 0x06, 0x2e, 0x9f, 0xe6, 0x25, 0x5c, 0xf1, 0x09, 0x17, 0xc4, 0xc3, 0x8a, 0xf8, 0x6e, 0xba, 0x6f, + 0x2d, 0xe9, 0x4f, 0x7a, 0x8a, 0xee, 0x7b, 0x62, 0xa8, 0xb4, 0x1f, 0x1d, 0x4f, 0x79, 0xce, 0xf7, + 0x07, 0x86, 0x05, 0x9c, 0x96, 0x5f, 0xc9, 0x98, 0xaf, 0xe0, 0x46, 0x84, 0x27, 0xae, 0xc7, 0xe2, + 0x98, 0x78, 0xca, 0xc5, 0x4a, 0x91, 0x88, 0x2b, 0x69, 0x2d, 0x6b, 0xc1, 0xed, 0x5b, 0x1e, 0xbc, + 0x3c, 0x89, 0xd5, 0x41, 0xff, 0x1c, 0x87, 0x09, 0x29, 0x96, 0xb8, 0x6b, 0xf4, 0x80, 0x63, 0x46, + 0x78, 0x72, 0x94, 0x73, 0x1c, 0x16, 0x14, 0xe6, 0x10, 0xb6, 0x7e, 0xb3, 0xb5, 0x7e, 0x87, 0xad, + 0x83, 0xd5, 0x0f, 0xdf, 0x77, 0x40, 0xc6, 0xb9, 0xf8, 0x09, 0x18, 0xbb, 0xff, 0x38, 0x4d, 0x5a, + 0xb1, 0x77, 0x00, 0x57, 0x23, 0xa2, 0xb0, 0x8f, 0x15, 0x76, 0x23, 0xac, 0xbc, 0x4b, 0xab, 0xa1, + 0xf9, 0xfe, 0x2f, 0x3c, 0xc1, 0x9c, 0x66, 0x73, 0x67, 0x97, 0x8f, 0x4e, 0x8b, 0x46, 0x67, 0xa5, + 0x84, 0x9c, 0x66, 0x88, 0xf6, 0xdb, 0x1a, 0x6c, 0x55, 0xfd, 0x30, 0x43, 0xb8, 0x24, 0x58, 0xa2, + 0x88, 0xb4, 0x80, 0xde, 0xd7, 0xb3, 0xbf, 0x34, 0x18, 0x9d, 0x1d, 0x8d, 0x9c, 0x8c, 0x70, 0x00, + 0xf5, 0x1c, 0xef, 0x81, 0x51, 0x07, 0x4e, 0xa1, 0xd1, 0x7e, 0x67, 0xc0, 0x7a, 0xd9, 0x60, 0x3e, + 0x9a, 0x9d, 0xfa, 0xad, 0x5f, 0x62, 0x7a, 0xf5, 0x43, 0xb8, 0xee, 0x13, 0xa9, 0x68, 0xac, 0x0d, + 0x72, 0x29, 0x77, 0x43, 0x2a, 0x95, 0x65, 0xe8, 0x8f, 0xdd, 0x9e, 0x33, 0xf9, 0x11, 0xf5, 0x85, + 0x83, 0xe3, 0x80, 0x38, 0xff, 0x56, 0x80, 0x27, 0x7c, 0x48, 0xa5, 0x32, 0xf7, 0x60, 0x35, 0xe9, + 0x72, 0x26, 0x94, 0xd4, 0x7f, 0x4f, 0xc3, 0x59, 0xab, 0x14, 0x46, 0x59, 0x3e, 0xf3, 0x5b, 0xb2, + 0x44, 0x78, 0x64, 0xaa, 0xba, 0x70, 0x0f, 0xd5, 0x56, 0x8e, 0x29, 0x04, 0x1f, 0xc0, 0x22, 0x2e, + 0xb4, 0x16, 0xb5, 0x56, 0x33, 0xcf, 0x69, 0x99, 0xc1, 0xda, 0xd7, 0x9b, 0x0e, 0xf8, 0x76, 0xd3, + 0x01, 0x3f, 0x6e, 0x3a, 0xe0, 0xb5, 0x91, 0xf6, 0x2f, 0x96, 0xf4, 0x61, 0x1c, 0xfc, 0x0a, 0x00, + 0x00, 0xff, 0xff, 0x3d, 0x36, 0xb9, 0xaf, 0x89, 0x05, 0x00, 0x00, +} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/config/filter/network/tcp_proxy/v2/tcp_proxy.pb.validate.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/config/filter/network/tcp_proxy/v2/tcp_proxy.pb.validate.go new file mode 100644 index 000000000000..720b0414feb4 --- /dev/null +++ b/vendor/github.com/envoyproxy/go-control-plane/envoy/config/filter/network/tcp_proxy/v2/tcp_proxy.pb.validate.go @@ -0,0 +1,313 @@ +// Code generated by protoc-gen-validate +// source: envoy/config/filter/network/tcp_proxy/v2/tcp_proxy.proto +// DO NOT EDIT!!! + +package v2 + +import ( + "bytes" + "errors" + "fmt" + "net" + "net/mail" + "net/url" + "regexp" + "strings" + "time" + "unicode/utf8" + + "github.com/gogo/protobuf/types" +) + +// ensure the imports are used +var ( + _ = bytes.MinRead + _ = errors.New("") + _ = fmt.Print + _ = utf8.UTFMax + _ = (*regexp.Regexp)(nil) + _ = (*strings.Reader)(nil) + _ = net.IPv4len + _ = time.Duration(0) + _ = (*url.URL)(nil) + _ = (*mail.Address)(nil) + _ = types.DynamicAny{} +) + +// Validate checks the field values on TcpProxy with the rules defined in the +// proto definition for this message. If any rules are violated, an error is returned. +func (m *TcpProxy) Validate() error { + if m == nil { + return nil + } + + if len(m.GetStatPrefix()) < 1 { + return TcpProxyValidationError{ + Field: "StatPrefix", + Reason: "value length must be at least 1 bytes", + } + } + + // no validation rules for Cluster + + if v, ok := interface{}(m.GetMetadataMatch()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return TcpProxyValidationError{ + Field: "MetadataMatch", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + if d := m.GetIdleTimeout(); d != nil { + dur := *d + + gt := time.Duration(0*time.Second + 0*time.Nanosecond) + + if dur <= gt { + return TcpProxyValidationError{ + Field: "IdleTimeout", + Reason: "value must be greater than 0s", + } + } + + } + + if v, ok := interface{}(m.GetDownstreamIdleTimeout()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return TcpProxyValidationError{ + Field: "DownstreamIdleTimeout", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + if v, ok := interface{}(m.GetUpstreamIdleTimeout()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return TcpProxyValidationError{ + Field: "UpstreamIdleTimeout", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + for idx, item := range m.GetAccessLog() { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return TcpProxyValidationError{ + Field: fmt.Sprintf("AccessLog[%v]", idx), + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + } + + if v, ok := interface{}(m.GetDeprecatedV1()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return TcpProxyValidationError{ + Field: "DeprecatedV1", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + if wrapper := m.GetMaxConnectAttempts(); wrapper != nil { + + if wrapper.GetValue() < 1 { + return TcpProxyValidationError{ + Field: "MaxConnectAttempts", + Reason: "value must be greater than or equal to 1", + } + } + + } + + return nil +} + +// TcpProxyValidationError is the validation error returned by +// TcpProxy.Validate if the designated constraints aren't met. +type TcpProxyValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e TcpProxyValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sTcpProxy.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = TcpProxyValidationError{} + +// Validate checks the field values on TcpProxy_DeprecatedV1 with the rules +// defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *TcpProxy_DeprecatedV1) Validate() error { + if m == nil { + return nil + } + + if len(m.GetRoutes()) < 1 { + return TcpProxy_DeprecatedV1ValidationError{ + Field: "Routes", + Reason: "value must contain at least 1 item(s)", + } + } + + for idx, item := range m.GetRoutes() { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return TcpProxy_DeprecatedV1ValidationError{ + Field: fmt.Sprintf("Routes[%v]", idx), + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + } + + return nil +} + +// TcpProxy_DeprecatedV1ValidationError is the validation error returned by +// TcpProxy_DeprecatedV1.Validate if the designated constraints aren't met. +type TcpProxy_DeprecatedV1ValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e TcpProxy_DeprecatedV1ValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sTcpProxy_DeprecatedV1.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = TcpProxy_DeprecatedV1ValidationError{} + +// Validate checks the field values on TcpProxy_DeprecatedV1_TCPRoute with the +// rules defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *TcpProxy_DeprecatedV1_TCPRoute) Validate() error { + if m == nil { + return nil + } + + if len(m.GetCluster()) < 1 { + return TcpProxy_DeprecatedV1_TCPRouteValidationError{ + Field: "Cluster", + Reason: "value length must be at least 1 bytes", + } + } + + for idx, item := range m.GetDestinationIpList() { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return TcpProxy_DeprecatedV1_TCPRouteValidationError{ + Field: fmt.Sprintf("DestinationIpList[%v]", idx), + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + } + + // no validation rules for DestinationPorts + + for idx, item := range m.GetSourceIpList() { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return TcpProxy_DeprecatedV1_TCPRouteValidationError{ + Field: fmt.Sprintf("SourceIpList[%v]", idx), + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + } + + // no validation rules for SourcePorts + + return nil +} + +// TcpProxy_DeprecatedV1_TCPRouteValidationError is the validation error +// returned by TcpProxy_DeprecatedV1_TCPRoute.Validate if the designated +// constraints aren't met. +type TcpProxy_DeprecatedV1_TCPRouteValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e TcpProxy_DeprecatedV1_TCPRouteValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sTcpProxy_DeprecatedV1_TCPRoute.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = TcpProxy_DeprecatedV1_TCPRouteValidationError{} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/service/auth/v2alpha/attribute_context.pb.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/service/auth/v2alpha/attribute_context.pb.go new file mode 100644 index 000000000000..09ebb8ce172c --- /dev/null +++ b/vendor/github.com/envoyproxy/go-control-plane/envoy/service/auth/v2alpha/attribute_context.pb.go @@ -0,0 +1,2034 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: envoy/service/auth/v2alpha/attribute_context.proto + +package v2alpha + +import proto "github.com/gogo/protobuf/proto" +import fmt "fmt" +import math "math" +import core "github.com/envoyproxy/go-control-plane/envoy/api/v2/core" +import types "github.com/gogo/protobuf/types" + +import io "io" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package + +// An attribute is a piece of metadata that describes an activity on a network. +// For example, the size of an HTTP request, or the status code of an HTTP response. +// +// Each attribute has a type and a name, which is logically defined as a proto message field +// of the `AttributeContext`. The `AttributeContext` is a collection of individual attributes +// supported by Envoy authorization system. +type AttributeContext struct { + // The source of a network activity, such as starting a TCP connection. + // In a multi hop network activity, the source represents the sender of the + // last hop. + Source *AttributeContext_Peer `protobuf:"bytes,1,opt,name=source" json:"source,omitempty"` + // The destination of a network activity, such as accepting a TCP connection. + // In a multi hop network activity, the destination represents the receiver of + // the last hop. + Destination *AttributeContext_Peer `protobuf:"bytes,2,opt,name=destination" json:"destination,omitempty"` + // Represents a network request, such as an HTTP request. + Request *AttributeContext_Request `protobuf:"bytes,4,opt,name=request" json:"request,omitempty"` + // This is analogous to http_request.headers, however these contents will not be sent to the + // upstream server. Context_extensions provide an extension mechanism for sending additional + // information to the auth server without modifying the proto definition. It maps to the + // internal opaque context in the filter chain. + ContextExtensions map[string]string `protobuf:"bytes,10,rep,name=context_extensions,json=contextExtensions" json:"context_extensions,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *AttributeContext) Reset() { *m = AttributeContext{} } +func (m *AttributeContext) String() string { return proto.CompactTextString(m) } +func (*AttributeContext) ProtoMessage() {} +func (*AttributeContext) Descriptor() ([]byte, []int) { + return fileDescriptor_attribute_context_39427310f2e1e0f8, []int{0} +} +func (m *AttributeContext) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AttributeContext) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AttributeContext.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *AttributeContext) XXX_Merge(src proto.Message) { + xxx_messageInfo_AttributeContext.Merge(dst, src) +} +func (m *AttributeContext) XXX_Size() int { + return m.Size() +} +func (m *AttributeContext) XXX_DiscardUnknown() { + xxx_messageInfo_AttributeContext.DiscardUnknown(m) +} + +var xxx_messageInfo_AttributeContext proto.InternalMessageInfo + +func (m *AttributeContext) GetSource() *AttributeContext_Peer { + if m != nil { + return m.Source + } + return nil +} + +func (m *AttributeContext) GetDestination() *AttributeContext_Peer { + if m != nil { + return m.Destination + } + return nil +} + +func (m *AttributeContext) GetRequest() *AttributeContext_Request { + if m != nil { + return m.Request + } + return nil +} + +func (m *AttributeContext) GetContextExtensions() map[string]string { + if m != nil { + return m.ContextExtensions + } + return nil +} + +// This message defines attributes for a node that handles a network request. +// The node can be either a service or an application that sends, forwards, +// or receives the request. Service peers should fill in the `service`, +// `principal`, and `labels` as appropriate. +type AttributeContext_Peer struct { + // The address of the peer, this is typically the IP address. + // It can also be UDS path, or others. + Address *core.Address `protobuf:"bytes,1,opt,name=address" json:"address,omitempty"` + // The canonical service name of the peer. + // It should be set to :ref:`the HTTP x-envoy-downstream-service-cluster + // ` + // If a more trusted source of the service name is available through mTLS/secure naming, it + // should be used. + Service string `protobuf:"bytes,2,opt,name=service,proto3" json:"service,omitempty"` + // The labels associated with the peer. + // These could be pod labels for Kubernetes or tags for VMs. + // The source of the labels could be an X.509 certificate or other configuration. + Labels map[string]string `protobuf:"bytes,3,rep,name=labels" json:"labels,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + // The authenticated identity of this peer. + // For example, the identity associated with the workload such as a service account. + // If an X.509 certificate is used to assert the identity this field should be sourced from + // `Subject` or `Subject Alternative Names`. The primary identity should be the principal. + // The principal format is issuer specific. + // + // Example: + // * SPIFFE format is `spiffe://trust-domain/path` + // * Google account format is `https://accounts.google.com/{userid}` + Principal string `protobuf:"bytes,4,opt,name=principal,proto3" json:"principal,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *AttributeContext_Peer) Reset() { *m = AttributeContext_Peer{} } +func (m *AttributeContext_Peer) String() string { return proto.CompactTextString(m) } +func (*AttributeContext_Peer) ProtoMessage() {} +func (*AttributeContext_Peer) Descriptor() ([]byte, []int) { + return fileDescriptor_attribute_context_39427310f2e1e0f8, []int{0, 0} +} +func (m *AttributeContext_Peer) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AttributeContext_Peer) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AttributeContext_Peer.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *AttributeContext_Peer) XXX_Merge(src proto.Message) { + xxx_messageInfo_AttributeContext_Peer.Merge(dst, src) +} +func (m *AttributeContext_Peer) XXX_Size() int { + return m.Size() +} +func (m *AttributeContext_Peer) XXX_DiscardUnknown() { + xxx_messageInfo_AttributeContext_Peer.DiscardUnknown(m) +} + +var xxx_messageInfo_AttributeContext_Peer proto.InternalMessageInfo + +func (m *AttributeContext_Peer) GetAddress() *core.Address { + if m != nil { + return m.Address + } + return nil +} + +func (m *AttributeContext_Peer) GetService() string { + if m != nil { + return m.Service + } + return "" +} + +func (m *AttributeContext_Peer) GetLabels() map[string]string { + if m != nil { + return m.Labels + } + return nil +} + +func (m *AttributeContext_Peer) GetPrincipal() string { + if m != nil { + return m.Principal + } + return "" +} + +// Represents a network request, such as an HTTP request. +type AttributeContext_Request struct { + // The timestamp when the proxy receives the first byte of the request. + Time *types.Timestamp `protobuf:"bytes,1,opt,name=time" json:"time,omitempty"` + // Represents an HTTP request or an HTTP-like request. + Http *AttributeContext_HttpRequest `protobuf:"bytes,2,opt,name=http" json:"http,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *AttributeContext_Request) Reset() { *m = AttributeContext_Request{} } +func (m *AttributeContext_Request) String() string { return proto.CompactTextString(m) } +func (*AttributeContext_Request) ProtoMessage() {} +func (*AttributeContext_Request) Descriptor() ([]byte, []int) { + return fileDescriptor_attribute_context_39427310f2e1e0f8, []int{0, 1} +} +func (m *AttributeContext_Request) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AttributeContext_Request) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AttributeContext_Request.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *AttributeContext_Request) XXX_Merge(src proto.Message) { + xxx_messageInfo_AttributeContext_Request.Merge(dst, src) +} +func (m *AttributeContext_Request) XXX_Size() int { + return m.Size() +} +func (m *AttributeContext_Request) XXX_DiscardUnknown() { + xxx_messageInfo_AttributeContext_Request.DiscardUnknown(m) +} + +var xxx_messageInfo_AttributeContext_Request proto.InternalMessageInfo + +func (m *AttributeContext_Request) GetTime() *types.Timestamp { + if m != nil { + return m.Time + } + return nil +} + +func (m *AttributeContext_Request) GetHttp() *AttributeContext_HttpRequest { + if m != nil { + return m.Http + } + return nil +} + +// This message defines attributes for an HTTP request. +// HTTP/1.x, HTTP/2, gRPC are all considered as HTTP requests. +type AttributeContext_HttpRequest struct { + // The unique ID for a request, which can be propagated to downstream + // systems. The ID should have low probability of collision + // within a single day for a specific service. + // For HTTP requests, it should be X-Request-ID or equivalent. + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + // The HTTP request method, such as `GET`, `POST`. + Method string `protobuf:"bytes,2,opt,name=method,proto3" json:"method,omitempty"` + // The HTTP request headers. If multiple headers share the same key, they + // must be merged according to the HTTP spec. All header keys must be + // lowercased, because HTTP header keys are case-insensitive. + Headers map[string]string `protobuf:"bytes,3,rep,name=headers" json:"headers,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + // The HTTP URL path. + Path string `protobuf:"bytes,4,opt,name=path,proto3" json:"path,omitempty"` + // The HTTP request `Host` or 'Authority` header value. + Host string `protobuf:"bytes,5,opt,name=host,proto3" json:"host,omitempty"` + // The HTTP URL scheme, such as `http` and `https`. + Scheme string `protobuf:"bytes,6,opt,name=scheme,proto3" json:"scheme,omitempty"` + // The HTTP URL query in the format of `name1=value`&name2=value2`, as it + // appears in the first line of the HTTP request. No decoding is performed. + Query string `protobuf:"bytes,7,opt,name=query,proto3" json:"query,omitempty"` + // The HTTP URL fragment, excluding leading `#`. No URL decoding is performed. + Fragment string `protobuf:"bytes,8,opt,name=fragment,proto3" json:"fragment,omitempty"` + // The HTTP request size in bytes. If unknown, it must be -1. + Size_ int64 `protobuf:"varint,9,opt,name=size,proto3" json:"size,omitempty"` + // The network protocol used with the request, such as + // "http/1.1", "spdy/3", "h2", "h2c" + Protocol string `protobuf:"bytes,10,opt,name=protocol,proto3" json:"protocol,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *AttributeContext_HttpRequest) Reset() { *m = AttributeContext_HttpRequest{} } +func (m *AttributeContext_HttpRequest) String() string { return proto.CompactTextString(m) } +func (*AttributeContext_HttpRequest) ProtoMessage() {} +func (*AttributeContext_HttpRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_attribute_context_39427310f2e1e0f8, []int{0, 2} +} +func (m *AttributeContext_HttpRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AttributeContext_HttpRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AttributeContext_HttpRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *AttributeContext_HttpRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_AttributeContext_HttpRequest.Merge(dst, src) +} +func (m *AttributeContext_HttpRequest) XXX_Size() int { + return m.Size() +} +func (m *AttributeContext_HttpRequest) XXX_DiscardUnknown() { + xxx_messageInfo_AttributeContext_HttpRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_AttributeContext_HttpRequest proto.InternalMessageInfo + +func (m *AttributeContext_HttpRequest) GetId() string { + if m != nil { + return m.Id + } + return "" +} + +func (m *AttributeContext_HttpRequest) GetMethod() string { + if m != nil { + return m.Method + } + return "" +} + +func (m *AttributeContext_HttpRequest) GetHeaders() map[string]string { + if m != nil { + return m.Headers + } + return nil +} + +func (m *AttributeContext_HttpRequest) GetPath() string { + if m != nil { + return m.Path + } + return "" +} + +func (m *AttributeContext_HttpRequest) GetHost() string { + if m != nil { + return m.Host + } + return "" +} + +func (m *AttributeContext_HttpRequest) GetScheme() string { + if m != nil { + return m.Scheme + } + return "" +} + +func (m *AttributeContext_HttpRequest) GetQuery() string { + if m != nil { + return m.Query + } + return "" +} + +func (m *AttributeContext_HttpRequest) GetFragment() string { + if m != nil { + return m.Fragment + } + return "" +} + +func (m *AttributeContext_HttpRequest) GetSize_() int64 { + if m != nil { + return m.Size_ + } + return 0 +} + +func (m *AttributeContext_HttpRequest) GetProtocol() string { + if m != nil { + return m.Protocol + } + return "" +} + +func init() { + proto.RegisterType((*AttributeContext)(nil), "envoy.service.auth.v2alpha.AttributeContext") + proto.RegisterMapType((map[string]string)(nil), "envoy.service.auth.v2alpha.AttributeContext.ContextExtensionsEntry") + proto.RegisterType((*AttributeContext_Peer)(nil), "envoy.service.auth.v2alpha.AttributeContext.Peer") + proto.RegisterMapType((map[string]string)(nil), "envoy.service.auth.v2alpha.AttributeContext.Peer.LabelsEntry") + proto.RegisterType((*AttributeContext_Request)(nil), "envoy.service.auth.v2alpha.AttributeContext.Request") + proto.RegisterType((*AttributeContext_HttpRequest)(nil), "envoy.service.auth.v2alpha.AttributeContext.HttpRequest") + proto.RegisterMapType((map[string]string)(nil), "envoy.service.auth.v2alpha.AttributeContext.HttpRequest.HeadersEntry") +} +func (m *AttributeContext) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *AttributeContext) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Source != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintAttributeContext(dAtA, i, uint64(m.Source.Size())) + n1, err := m.Source.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n1 + } + if m.Destination != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintAttributeContext(dAtA, i, uint64(m.Destination.Size())) + n2, err := m.Destination.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n2 + } + if m.Request != nil { + dAtA[i] = 0x22 + i++ + i = encodeVarintAttributeContext(dAtA, i, uint64(m.Request.Size())) + n3, err := m.Request.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n3 + } + if len(m.ContextExtensions) > 0 { + for k, _ := range m.ContextExtensions { + dAtA[i] = 0x52 + i++ + v := m.ContextExtensions[k] + mapSize := 1 + len(k) + sovAttributeContext(uint64(len(k))) + 1 + len(v) + sovAttributeContext(uint64(len(v))) + i = encodeVarintAttributeContext(dAtA, i, uint64(mapSize)) + dAtA[i] = 0xa + i++ + i = encodeVarintAttributeContext(dAtA, i, uint64(len(k))) + i += copy(dAtA[i:], k) + dAtA[i] = 0x12 + i++ + i = encodeVarintAttributeContext(dAtA, i, uint64(len(v))) + i += copy(dAtA[i:], v) + } + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *AttributeContext_Peer) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *AttributeContext_Peer) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Address != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintAttributeContext(dAtA, i, uint64(m.Address.Size())) + n4, err := m.Address.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n4 + } + if len(m.Service) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintAttributeContext(dAtA, i, uint64(len(m.Service))) + i += copy(dAtA[i:], m.Service) + } + if len(m.Labels) > 0 { + for k, _ := range m.Labels { + dAtA[i] = 0x1a + i++ + v := m.Labels[k] + mapSize := 1 + len(k) + sovAttributeContext(uint64(len(k))) + 1 + len(v) + sovAttributeContext(uint64(len(v))) + i = encodeVarintAttributeContext(dAtA, i, uint64(mapSize)) + dAtA[i] = 0xa + i++ + i = encodeVarintAttributeContext(dAtA, i, uint64(len(k))) + i += copy(dAtA[i:], k) + dAtA[i] = 0x12 + i++ + i = encodeVarintAttributeContext(dAtA, i, uint64(len(v))) + i += copy(dAtA[i:], v) + } + } + if len(m.Principal) > 0 { + dAtA[i] = 0x22 + i++ + i = encodeVarintAttributeContext(dAtA, i, uint64(len(m.Principal))) + i += copy(dAtA[i:], m.Principal) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *AttributeContext_Request) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *AttributeContext_Request) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Time != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintAttributeContext(dAtA, i, uint64(m.Time.Size())) + n5, err := m.Time.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n5 + } + if m.Http != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintAttributeContext(dAtA, i, uint64(m.Http.Size())) + n6, err := m.Http.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n6 + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *AttributeContext_HttpRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *AttributeContext_HttpRequest) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Id) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintAttributeContext(dAtA, i, uint64(len(m.Id))) + i += copy(dAtA[i:], m.Id) + } + if len(m.Method) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintAttributeContext(dAtA, i, uint64(len(m.Method))) + i += copy(dAtA[i:], m.Method) + } + if len(m.Headers) > 0 { + for k, _ := range m.Headers { + dAtA[i] = 0x1a + i++ + v := m.Headers[k] + mapSize := 1 + len(k) + sovAttributeContext(uint64(len(k))) + 1 + len(v) + sovAttributeContext(uint64(len(v))) + i = encodeVarintAttributeContext(dAtA, i, uint64(mapSize)) + dAtA[i] = 0xa + i++ + i = encodeVarintAttributeContext(dAtA, i, uint64(len(k))) + i += copy(dAtA[i:], k) + dAtA[i] = 0x12 + i++ + i = encodeVarintAttributeContext(dAtA, i, uint64(len(v))) + i += copy(dAtA[i:], v) + } + } + if len(m.Path) > 0 { + dAtA[i] = 0x22 + i++ + i = encodeVarintAttributeContext(dAtA, i, uint64(len(m.Path))) + i += copy(dAtA[i:], m.Path) + } + if len(m.Host) > 0 { + dAtA[i] = 0x2a + i++ + i = encodeVarintAttributeContext(dAtA, i, uint64(len(m.Host))) + i += copy(dAtA[i:], m.Host) + } + if len(m.Scheme) > 0 { + dAtA[i] = 0x32 + i++ + i = encodeVarintAttributeContext(dAtA, i, uint64(len(m.Scheme))) + i += copy(dAtA[i:], m.Scheme) + } + if len(m.Query) > 0 { + dAtA[i] = 0x3a + i++ + i = encodeVarintAttributeContext(dAtA, i, uint64(len(m.Query))) + i += copy(dAtA[i:], m.Query) + } + if len(m.Fragment) > 0 { + dAtA[i] = 0x42 + i++ + i = encodeVarintAttributeContext(dAtA, i, uint64(len(m.Fragment))) + i += copy(dAtA[i:], m.Fragment) + } + if m.Size_ != 0 { + dAtA[i] = 0x48 + i++ + i = encodeVarintAttributeContext(dAtA, i, uint64(m.Size_)) + } + if len(m.Protocol) > 0 { + dAtA[i] = 0x52 + i++ + i = encodeVarintAttributeContext(dAtA, i, uint64(len(m.Protocol))) + i += copy(dAtA[i:], m.Protocol) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func encodeVarintAttributeContext(dAtA []byte, offset int, v uint64) int { + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return offset + 1 +} +func (m *AttributeContext) Size() (n int) { + var l int + _ = l + if m.Source != nil { + l = m.Source.Size() + n += 1 + l + sovAttributeContext(uint64(l)) + } + if m.Destination != nil { + l = m.Destination.Size() + n += 1 + l + sovAttributeContext(uint64(l)) + } + if m.Request != nil { + l = m.Request.Size() + n += 1 + l + sovAttributeContext(uint64(l)) + } + if len(m.ContextExtensions) > 0 { + for k, v := range m.ContextExtensions { + _ = k + _ = v + mapEntrySize := 1 + len(k) + sovAttributeContext(uint64(len(k))) + 1 + len(v) + sovAttributeContext(uint64(len(v))) + n += mapEntrySize + 1 + sovAttributeContext(uint64(mapEntrySize)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *AttributeContext_Peer) Size() (n int) { + var l int + _ = l + if m.Address != nil { + l = m.Address.Size() + n += 1 + l + sovAttributeContext(uint64(l)) + } + l = len(m.Service) + if l > 0 { + n += 1 + l + sovAttributeContext(uint64(l)) + } + if len(m.Labels) > 0 { + for k, v := range m.Labels { + _ = k + _ = v + mapEntrySize := 1 + len(k) + sovAttributeContext(uint64(len(k))) + 1 + len(v) + sovAttributeContext(uint64(len(v))) + n += mapEntrySize + 1 + sovAttributeContext(uint64(mapEntrySize)) + } + } + l = len(m.Principal) + if l > 0 { + n += 1 + l + sovAttributeContext(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *AttributeContext_Request) Size() (n int) { + var l int + _ = l + if m.Time != nil { + l = m.Time.Size() + n += 1 + l + sovAttributeContext(uint64(l)) + } + if m.Http != nil { + l = m.Http.Size() + n += 1 + l + sovAttributeContext(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *AttributeContext_HttpRequest) Size() (n int) { + var l int + _ = l + l = len(m.Id) + if l > 0 { + n += 1 + l + sovAttributeContext(uint64(l)) + } + l = len(m.Method) + if l > 0 { + n += 1 + l + sovAttributeContext(uint64(l)) + } + if len(m.Headers) > 0 { + for k, v := range m.Headers { + _ = k + _ = v + mapEntrySize := 1 + len(k) + sovAttributeContext(uint64(len(k))) + 1 + len(v) + sovAttributeContext(uint64(len(v))) + n += mapEntrySize + 1 + sovAttributeContext(uint64(mapEntrySize)) + } + } + l = len(m.Path) + if l > 0 { + n += 1 + l + sovAttributeContext(uint64(l)) + } + l = len(m.Host) + if l > 0 { + n += 1 + l + sovAttributeContext(uint64(l)) + } + l = len(m.Scheme) + if l > 0 { + n += 1 + l + sovAttributeContext(uint64(l)) + } + l = len(m.Query) + if l > 0 { + n += 1 + l + sovAttributeContext(uint64(l)) + } + l = len(m.Fragment) + if l > 0 { + n += 1 + l + sovAttributeContext(uint64(l)) + } + if m.Size_ != 0 { + n += 1 + sovAttributeContext(uint64(m.Size_)) + } + l = len(m.Protocol) + if l > 0 { + n += 1 + l + sovAttributeContext(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func sovAttributeContext(x uint64) (n int) { + for { + n++ + x >>= 7 + if x == 0 { + break + } + } + return n +} +func sozAttributeContext(x uint64) (n int) { + return sovAttributeContext(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *AttributeContext) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAttributeContext + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: AttributeContext: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: AttributeContext: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Source", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAttributeContext + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthAttributeContext + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Source == nil { + m.Source = &AttributeContext_Peer{} + } + if err := m.Source.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Destination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAttributeContext + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthAttributeContext + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Destination == nil { + m.Destination = &AttributeContext_Peer{} + } + if err := m.Destination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Request", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAttributeContext + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthAttributeContext + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Request == nil { + m.Request = &AttributeContext_Request{} + } + if err := m.Request.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 10: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ContextExtensions", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAttributeContext + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthAttributeContext + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.ContextExtensions == nil { + m.ContextExtensions = make(map[string]string) + } + var mapkey string + var mapvalue string + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAttributeContext + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + var stringLenmapkey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAttributeContext + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapkey |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return ErrInvalidLengthAttributeContext + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey > l { + return io.ErrUnexpectedEOF + } + mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) + iNdEx = postStringIndexmapkey + } else if fieldNum == 2 { + var stringLenmapvalue uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAttributeContext + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapvalue |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapvalue := int(stringLenmapvalue) + if intStringLenmapvalue < 0 { + return ErrInvalidLengthAttributeContext + } + postStringIndexmapvalue := iNdEx + intStringLenmapvalue + if postStringIndexmapvalue > l { + return io.ErrUnexpectedEOF + } + mapvalue = string(dAtA[iNdEx:postStringIndexmapvalue]) + iNdEx = postStringIndexmapvalue + } else { + iNdEx = entryPreIndex + skippy, err := skipAttributeContext(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthAttributeContext + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.ContextExtensions[mapkey] = mapvalue + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipAttributeContext(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthAttributeContext + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *AttributeContext_Peer) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAttributeContext + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Peer: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Peer: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAttributeContext + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthAttributeContext + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Address == nil { + m.Address = &core.Address{} + } + if err := m.Address.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Service", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAttributeContext + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthAttributeContext + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Service = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Labels", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAttributeContext + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthAttributeContext + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Labels == nil { + m.Labels = make(map[string]string) + } + var mapkey string + var mapvalue string + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAttributeContext + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + var stringLenmapkey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAttributeContext + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapkey |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return ErrInvalidLengthAttributeContext + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey > l { + return io.ErrUnexpectedEOF + } + mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) + iNdEx = postStringIndexmapkey + } else if fieldNum == 2 { + var stringLenmapvalue uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAttributeContext + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapvalue |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapvalue := int(stringLenmapvalue) + if intStringLenmapvalue < 0 { + return ErrInvalidLengthAttributeContext + } + postStringIndexmapvalue := iNdEx + intStringLenmapvalue + if postStringIndexmapvalue > l { + return io.ErrUnexpectedEOF + } + mapvalue = string(dAtA[iNdEx:postStringIndexmapvalue]) + iNdEx = postStringIndexmapvalue + } else { + iNdEx = entryPreIndex + skippy, err := skipAttributeContext(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthAttributeContext + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.Labels[mapkey] = mapvalue + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Principal", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAttributeContext + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthAttributeContext + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Principal = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipAttributeContext(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthAttributeContext + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *AttributeContext_Request) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAttributeContext + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Request: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Request: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Time", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAttributeContext + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthAttributeContext + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Time == nil { + m.Time = &types.Timestamp{} + } + if err := m.Time.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Http", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAttributeContext + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthAttributeContext + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Http == nil { + m.Http = &AttributeContext_HttpRequest{} + } + if err := m.Http.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipAttributeContext(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthAttributeContext + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *AttributeContext_HttpRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAttributeContext + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: HttpRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: HttpRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAttributeContext + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthAttributeContext + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Id = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Method", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAttributeContext + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthAttributeContext + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Method = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Headers", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAttributeContext + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthAttributeContext + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Headers == nil { + m.Headers = make(map[string]string) + } + var mapkey string + var mapvalue string + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAttributeContext + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + var stringLenmapkey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAttributeContext + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapkey |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return ErrInvalidLengthAttributeContext + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey > l { + return io.ErrUnexpectedEOF + } + mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) + iNdEx = postStringIndexmapkey + } else if fieldNum == 2 { + var stringLenmapvalue uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAttributeContext + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapvalue |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapvalue := int(stringLenmapvalue) + if intStringLenmapvalue < 0 { + return ErrInvalidLengthAttributeContext + } + postStringIndexmapvalue := iNdEx + intStringLenmapvalue + if postStringIndexmapvalue > l { + return io.ErrUnexpectedEOF + } + mapvalue = string(dAtA[iNdEx:postStringIndexmapvalue]) + iNdEx = postStringIndexmapvalue + } else { + iNdEx = entryPreIndex + skippy, err := skipAttributeContext(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthAttributeContext + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.Headers[mapkey] = mapvalue + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Path", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAttributeContext + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthAttributeContext + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Path = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Host", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAttributeContext + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthAttributeContext + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Host = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Scheme", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAttributeContext + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthAttributeContext + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Scheme = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Query", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAttributeContext + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthAttributeContext + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Query = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Fragment", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAttributeContext + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthAttributeContext + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Fragment = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 9: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Size_", wireType) + } + m.Size_ = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAttributeContext + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Size_ |= (int64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 10: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Protocol", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAttributeContext + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthAttributeContext + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Protocol = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipAttributeContext(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthAttributeContext + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipAttributeContext(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowAttributeContext + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowAttributeContext + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + return iNdEx, nil + case 1: + iNdEx += 8 + return iNdEx, nil + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowAttributeContext + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + iNdEx += length + if length < 0 { + return 0, ErrInvalidLengthAttributeContext + } + return iNdEx, nil + case 3: + for { + var innerWire uint64 + var start int = iNdEx + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowAttributeContext + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + innerWire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + innerWireType := int(innerWire & 0x7) + if innerWireType == 4 { + break + } + next, err := skipAttributeContext(dAtA[start:]) + if err != nil { + return 0, err + } + iNdEx = start + next + } + return iNdEx, nil + case 4: + return iNdEx, nil + case 5: + iNdEx += 4 + return iNdEx, nil + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + } + panic("unreachable") +} + +var ( + ErrInvalidLengthAttributeContext = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowAttributeContext = fmt.Errorf("proto: integer overflow") +) + +func init() { + proto.RegisterFile("envoy/service/auth/v2alpha/attribute_context.proto", fileDescriptor_attribute_context_39427310f2e1e0f8) +} + +var fileDescriptor_attribute_context_39427310f2e1e0f8 = []byte{ + // 582 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x53, 0xd1, 0x6e, 0xd3, 0x30, + 0x14, 0x55, 0xda, 0xae, 0x5d, 0x6f, 0x27, 0x34, 0x2c, 0x34, 0x59, 0x11, 0xda, 0x26, 0x9e, 0xf6, + 0xe4, 0x88, 0xb0, 0x87, 0x31, 0x89, 0x87, 0x31, 0x26, 0x0d, 0x69, 0x42, 0x28, 0xc0, 0xf3, 0xe4, + 0x26, 0x77, 0x8b, 0x45, 0x1a, 0x67, 0xb6, 0x13, 0xad, 0x7c, 0x00, 0xfc, 0x19, 0xe2, 0x91, 0x4f, + 0x40, 0xfb, 0x06, 0x3e, 0x00, 0xc5, 0x76, 0x4a, 0x35, 0xc1, 0x43, 0xf6, 0x54, 0x9f, 0xdb, 0x7b, + 0x8e, 0xcf, 0x3d, 0xbe, 0x81, 0x18, 0xcb, 0x46, 0x2e, 0x23, 0x8d, 0xaa, 0x11, 0x29, 0x46, 0xbc, + 0x36, 0x79, 0xd4, 0xc4, 0xbc, 0xa8, 0x72, 0x1e, 0x71, 0x63, 0x94, 0x98, 0xd7, 0x06, 0x2f, 0x53, + 0x59, 0x1a, 0xbc, 0x35, 0xac, 0x52, 0xd2, 0x48, 0x12, 0x5a, 0x0e, 0xf3, 0x1c, 0xd6, 0x72, 0x98, + 0xe7, 0x84, 0x7b, 0x4e, 0x8f, 0x57, 0x22, 0x6a, 0xe2, 0x28, 0x95, 0x0a, 0x23, 0x9e, 0x65, 0x0a, + 0xb5, 0x76, 0xe4, 0x70, 0xef, 0x5a, 0xca, 0xeb, 0x02, 0x23, 0x8b, 0xe6, 0xf5, 0x55, 0x64, 0xc4, + 0x02, 0xb5, 0xe1, 0x8b, 0xca, 0x35, 0x3c, 0xfb, 0x3e, 0x85, 0xed, 0x93, 0xee, 0xe6, 0x53, 0x77, + 0x31, 0x79, 0x0b, 0x63, 0x2d, 0x6b, 0x95, 0x22, 0x0d, 0xf6, 0x83, 0x83, 0x59, 0xfc, 0x9c, 0xfd, + 0xdf, 0x03, 0xbb, 0xcf, 0x66, 0xef, 0x11, 0x55, 0xe2, 0x05, 0xc8, 0x07, 0x98, 0x65, 0xa8, 0x8d, + 0x28, 0xb9, 0x11, 0xb2, 0xa4, 0x83, 0x87, 0xea, 0xad, 0xab, 0x90, 0x77, 0x30, 0x51, 0x78, 0x53, + 0xa3, 0x36, 0x74, 0x64, 0x05, 0x0f, 0x7b, 0x09, 0x26, 0x8e, 0x9b, 0x74, 0x22, 0x44, 0x01, 0xf1, + 0x99, 0x5f, 0xe2, 0xad, 0xc1, 0x52, 0x0b, 0x59, 0x6a, 0x0a, 0xfb, 0xc3, 0x83, 0x59, 0x7c, 0xda, + 0x4b, 0xda, 0xff, 0x9e, 0xad, 0x54, 0xce, 0x4a, 0xa3, 0x96, 0xc9, 0xe3, 0xf4, 0x7e, 0x3d, 0xfc, + 0x3a, 0x80, 0x51, 0x3b, 0x19, 0x39, 0x84, 0x89, 0x7f, 0x33, 0x9f, 0x76, 0xe8, 0x6f, 0xe4, 0x95, + 0x60, 0x4d, 0xcc, 0xda, 0x57, 0x65, 0x27, 0xae, 0x23, 0xe9, 0x5a, 0x09, 0x85, 0x89, 0x77, 0x64, + 0x33, 0x9d, 0x26, 0x1d, 0x24, 0x9f, 0x60, 0x5c, 0xf0, 0x39, 0x16, 0x9a, 0x0e, 0xed, 0x00, 0xaf, + 0x7a, 0x87, 0xcd, 0x2e, 0x2c, 0xdf, 0x59, 0xf7, 0x62, 0xe4, 0x29, 0x4c, 0x2b, 0x25, 0xca, 0x54, + 0x54, 0xbc, 0xb0, 0xa9, 0x4f, 0x93, 0xbf, 0x85, 0xf0, 0x25, 0xcc, 0xd6, 0x48, 0x64, 0x1b, 0x86, + 0x9f, 0x71, 0x69, 0xe7, 0x99, 0x26, 0xed, 0x91, 0x3c, 0x81, 0x8d, 0x86, 0x17, 0x75, 0xe7, 0xd6, + 0x81, 0xe3, 0xc1, 0x51, 0x10, 0x7e, 0x0b, 0x60, 0xe2, 0x5f, 0x84, 0x30, 0x18, 0xb5, 0x0b, 0xba, + 0x0a, 0xc2, 0x6d, 0x2f, 0xeb, 0xb6, 0x97, 0x7d, 0xec, 0xb6, 0x37, 0xb1, 0x7d, 0xe4, 0x02, 0x46, + 0xb9, 0x31, 0x95, 0x5f, 0xab, 0xa3, 0x5e, 0x93, 0x9e, 0x1b, 0x53, 0x75, 0x9b, 0x60, 0x55, 0xc2, + 0xdf, 0x03, 0x98, 0xad, 0x55, 0xc9, 0x23, 0x18, 0x88, 0xcc, 0x0f, 0x31, 0x10, 0x19, 0xd9, 0x81, + 0xf1, 0x02, 0x4d, 0x2e, 0x33, 0x3f, 0x84, 0x47, 0xe4, 0x12, 0x26, 0x39, 0xf2, 0x0c, 0x55, 0x17, + 0xf9, 0xd9, 0x43, 0x8d, 0xb0, 0x73, 0xa7, 0xe3, 0xa2, 0xef, 0x54, 0x09, 0x81, 0x51, 0xc5, 0x4d, + 0xee, 0x63, 0xb7, 0xe7, 0xb6, 0x96, 0x4b, 0x6d, 0xe8, 0x86, 0xab, 0xb5, 0xe7, 0xd6, 0xa0, 0x4e, + 0x73, 0x5c, 0x20, 0x1d, 0x3b, 0x83, 0x0e, 0xb5, 0xe1, 0xdf, 0xd4, 0xa8, 0x96, 0x74, 0xe2, 0xc2, + 0xb7, 0x80, 0x84, 0xb0, 0x79, 0xa5, 0xf8, 0xf5, 0x02, 0x4b, 0x43, 0x37, 0xed, 0x1f, 0x2b, 0xdc, + 0xaa, 0x6b, 0xf1, 0x05, 0xe9, 0x74, 0x3f, 0x38, 0x18, 0x26, 0xf6, 0xdc, 0xf6, 0xdb, 0x87, 0x48, + 0x65, 0x41, 0xc1, 0xf5, 0x77, 0x38, 0x3c, 0x86, 0xad, 0x75, 0xeb, 0xbd, 0x16, 0xe0, 0x0d, 0xec, + 0xfc, 0xfb, 0xb3, 0xe9, 0xa3, 0xf2, 0x7a, 0xeb, 0xc7, 0xdd, 0x6e, 0xf0, 0xf3, 0x6e, 0x37, 0xf8, + 0x75, 0xb7, 0x1b, 0xcc, 0xc7, 0xd6, 0xd9, 0x8b, 0x3f, 0x01, 0x00, 0x00, 0xff, 0xff, 0xa2, 0xf7, + 0xdf, 0x99, 0x71, 0x05, 0x00, 0x00, +} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/service/auth/v2alpha/attribute_context.pb.validate.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/service/auth/v2alpha/attribute_context.pb.validate.go new file mode 100644 index 000000000000..5d950406eac0 --- /dev/null +++ b/vendor/github.com/envoyproxy/go-control-plane/envoy/service/auth/v2alpha/attribute_context.pb.validate.go @@ -0,0 +1,292 @@ +// Code generated by protoc-gen-validate +// source: envoy/service/auth/v2alpha/attribute_context.proto +// DO NOT EDIT!!! + +package v2alpha + +import ( + "bytes" + "errors" + "fmt" + "net" + "net/mail" + "net/url" + "regexp" + "strings" + "time" + "unicode/utf8" + + "github.com/gogo/protobuf/types" +) + +// ensure the imports are used +var ( + _ = bytes.MinRead + _ = errors.New("") + _ = fmt.Print + _ = utf8.UTFMax + _ = (*regexp.Regexp)(nil) + _ = (*strings.Reader)(nil) + _ = net.IPv4len + _ = time.Duration(0) + _ = (*url.URL)(nil) + _ = (*mail.Address)(nil) + _ = types.DynamicAny{} +) + +// Validate checks the field values on AttributeContext with the rules defined +// in the proto definition for this message. If any rules are violated, an +// error is returned. +func (m *AttributeContext) Validate() error { + if m == nil { + return nil + } + + if v, ok := interface{}(m.GetSource()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return AttributeContextValidationError{ + Field: "Source", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + if v, ok := interface{}(m.GetDestination()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return AttributeContextValidationError{ + Field: "Destination", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + if v, ok := interface{}(m.GetRequest()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return AttributeContextValidationError{ + Field: "Request", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + // no validation rules for ContextExtensions + + return nil +} + +// AttributeContextValidationError is the validation error returned by +// AttributeContext.Validate if the designated constraints aren't met. +type AttributeContextValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e AttributeContextValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sAttributeContext.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = AttributeContextValidationError{} + +// Validate checks the field values on AttributeContext_Peer with the rules +// defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *AttributeContext_Peer) Validate() error { + if m == nil { + return nil + } + + if v, ok := interface{}(m.GetAddress()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return AttributeContext_PeerValidationError{ + Field: "Address", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + // no validation rules for Service + + // no validation rules for Labels + + // no validation rules for Principal + + return nil +} + +// AttributeContext_PeerValidationError is the validation error returned by +// AttributeContext_Peer.Validate if the designated constraints aren't met. +type AttributeContext_PeerValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e AttributeContext_PeerValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sAttributeContext_Peer.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = AttributeContext_PeerValidationError{} + +// Validate checks the field values on AttributeContext_Request with the rules +// defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *AttributeContext_Request) Validate() error { + if m == nil { + return nil + } + + if v, ok := interface{}(m.GetTime()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return AttributeContext_RequestValidationError{ + Field: "Time", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + if v, ok := interface{}(m.GetHttp()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return AttributeContext_RequestValidationError{ + Field: "Http", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + return nil +} + +// AttributeContext_RequestValidationError is the validation error returned by +// AttributeContext_Request.Validate if the designated constraints aren't met. +type AttributeContext_RequestValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e AttributeContext_RequestValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sAttributeContext_Request.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = AttributeContext_RequestValidationError{} + +// Validate checks the field values on AttributeContext_HttpRequest with the +// rules defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *AttributeContext_HttpRequest) Validate() error { + if m == nil { + return nil + } + + // no validation rules for Id + + // no validation rules for Method + + // no validation rules for Headers + + // no validation rules for Path + + // no validation rules for Host + + // no validation rules for Scheme + + // no validation rules for Query + + // no validation rules for Fragment + + // no validation rules for Size + + // no validation rules for Protocol + + return nil +} + +// AttributeContext_HttpRequestValidationError is the validation error returned +// by AttributeContext_HttpRequest.Validate if the designated constraints +// aren't met. +type AttributeContext_HttpRequestValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e AttributeContext_HttpRequestValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sAttributeContext_HttpRequest.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = AttributeContext_HttpRequestValidationError{} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/service/auth/v2alpha/external_auth.pb.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/service/auth/v2alpha/external_auth.pb.go new file mode 100644 index 000000000000..08f1b96c06ac --- /dev/null +++ b/vendor/github.com/envoyproxy/go-control-plane/envoy/service/auth/v2alpha/external_auth.pb.go @@ -0,0 +1,1339 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: envoy/service/auth/v2alpha/external_auth.proto + +package v2alpha + +import proto "github.com/gogo/protobuf/proto" +import fmt "fmt" +import math "math" +import core "github.com/envoyproxy/go-control-plane/envoy/api/v2/core" +import _type "github.com/envoyproxy/go-control-plane/envoy/type" +import rpc "github.com/gogo/googleapis/google/rpc" +import _ "github.com/lyft/protoc-gen-validate/validate" + +import context "golang.org/x/net/context" +import grpc "google.golang.org/grpc" + +import io "io" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package + +type CheckRequest struct { + // The request attributes. + Attributes *AttributeContext `protobuf:"bytes,1,opt,name=attributes" json:"attributes,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *CheckRequest) Reset() { *m = CheckRequest{} } +func (m *CheckRequest) String() string { return proto.CompactTextString(m) } +func (*CheckRequest) ProtoMessage() {} +func (*CheckRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_external_auth_ef836df974545be5, []int{0} +} +func (m *CheckRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *CheckRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_CheckRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *CheckRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_CheckRequest.Merge(dst, src) +} +func (m *CheckRequest) XXX_Size() int { + return m.Size() +} +func (m *CheckRequest) XXX_DiscardUnknown() { + xxx_messageInfo_CheckRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_CheckRequest proto.InternalMessageInfo + +func (m *CheckRequest) GetAttributes() *AttributeContext { + if m != nil { + return m.Attributes + } + return nil +} + +// HTTP attributes for a denied response. +type DeniedHttpResponse struct { + // This field allows the authorization service to send a HTTP response status + // code to the downstream client other than 403 (Forbidden). + Status *_type.HttpStatus `protobuf:"bytes,1,opt,name=status" json:"status,omitempty"` + // This field allows the authorization service to send HTTP response headers + // to the the downstream client. + Headers []*core.HeaderValueOption `protobuf:"bytes,2,rep,name=headers" json:"headers,omitempty"` + // This field allows the authorization service to send a response body data + // to the the downstream client. + Body string `protobuf:"bytes,3,opt,name=body,proto3" json:"body,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *DeniedHttpResponse) Reset() { *m = DeniedHttpResponse{} } +func (m *DeniedHttpResponse) String() string { return proto.CompactTextString(m) } +func (*DeniedHttpResponse) ProtoMessage() {} +func (*DeniedHttpResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_external_auth_ef836df974545be5, []int{1} +} +func (m *DeniedHttpResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DeniedHttpResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_DeniedHttpResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *DeniedHttpResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_DeniedHttpResponse.Merge(dst, src) +} +func (m *DeniedHttpResponse) XXX_Size() int { + return m.Size() +} +func (m *DeniedHttpResponse) XXX_DiscardUnknown() { + xxx_messageInfo_DeniedHttpResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_DeniedHttpResponse proto.InternalMessageInfo + +func (m *DeniedHttpResponse) GetStatus() *_type.HttpStatus { + if m != nil { + return m.Status + } + return nil +} + +func (m *DeniedHttpResponse) GetHeaders() []*core.HeaderValueOption { + if m != nil { + return m.Headers + } + return nil +} + +func (m *DeniedHttpResponse) GetBody() string { + if m != nil { + return m.Body + } + return "" +} + +// HTTP attributes for an ok response. +type OkHttpResponse struct { + // HTTP entity headers in addition to the original request headers. This allows the authorization + // service to append, to add or to override headers from the original request before + // dispatching it to the upstream. By setting `append` field to `true` in the `HeaderValueOption`, + // the filter will append the correspondent header value to the matched request header. Note that + // by Leaving `append` as false, the filter will either add a new header, or override an existing + // one if there is a match. + Headers []*core.HeaderValueOption `protobuf:"bytes,2,rep,name=headers" json:"headers,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *OkHttpResponse) Reset() { *m = OkHttpResponse{} } +func (m *OkHttpResponse) String() string { return proto.CompactTextString(m) } +func (*OkHttpResponse) ProtoMessage() {} +func (*OkHttpResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_external_auth_ef836df974545be5, []int{2} +} +func (m *OkHttpResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *OkHttpResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_OkHttpResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *OkHttpResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_OkHttpResponse.Merge(dst, src) +} +func (m *OkHttpResponse) XXX_Size() int { + return m.Size() +} +func (m *OkHttpResponse) XXX_DiscardUnknown() { + xxx_messageInfo_OkHttpResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_OkHttpResponse proto.InternalMessageInfo + +func (m *OkHttpResponse) GetHeaders() []*core.HeaderValueOption { + if m != nil { + return m.Headers + } + return nil +} + +// Intended for gRPC and Network Authorization servers `only`. +type CheckResponse struct { + // Status `OK` allows the request. Any other status indicates the request should be denied. + Status *rpc.Status `protobuf:"bytes,1,opt,name=status" json:"status,omitempty"` + // An message that contains HTTP response attributes. This message is + // used when the authorization service needs to send custom responses to the + // downstream client or, to modify/add request headers being dispatched to the upstream. + // + // Types that are valid to be assigned to HttpResponse: + // *CheckResponse_DeniedResponse + // *CheckResponse_OkResponse + HttpResponse isCheckResponse_HttpResponse `protobuf_oneof:"http_response"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *CheckResponse) Reset() { *m = CheckResponse{} } +func (m *CheckResponse) String() string { return proto.CompactTextString(m) } +func (*CheckResponse) ProtoMessage() {} +func (*CheckResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_external_auth_ef836df974545be5, []int{3} +} +func (m *CheckResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *CheckResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_CheckResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *CheckResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_CheckResponse.Merge(dst, src) +} +func (m *CheckResponse) XXX_Size() int { + return m.Size() +} +func (m *CheckResponse) XXX_DiscardUnknown() { + xxx_messageInfo_CheckResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_CheckResponse proto.InternalMessageInfo + +type isCheckResponse_HttpResponse interface { + isCheckResponse_HttpResponse() + MarshalTo([]byte) (int, error) + Size() int +} + +type CheckResponse_DeniedResponse struct { + DeniedResponse *DeniedHttpResponse `protobuf:"bytes,2,opt,name=denied_response,json=deniedResponse,oneof"` +} +type CheckResponse_OkResponse struct { + OkResponse *OkHttpResponse `protobuf:"bytes,3,opt,name=ok_response,json=okResponse,oneof"` +} + +func (*CheckResponse_DeniedResponse) isCheckResponse_HttpResponse() {} +func (*CheckResponse_OkResponse) isCheckResponse_HttpResponse() {} + +func (m *CheckResponse) GetHttpResponse() isCheckResponse_HttpResponse { + if m != nil { + return m.HttpResponse + } + return nil +} + +func (m *CheckResponse) GetStatus() *rpc.Status { + if m != nil { + return m.Status + } + return nil +} + +func (m *CheckResponse) GetDeniedResponse() *DeniedHttpResponse { + if x, ok := m.GetHttpResponse().(*CheckResponse_DeniedResponse); ok { + return x.DeniedResponse + } + return nil +} + +func (m *CheckResponse) GetOkResponse() *OkHttpResponse { + if x, ok := m.GetHttpResponse().(*CheckResponse_OkResponse); ok { + return x.OkResponse + } + return nil +} + +// XXX_OneofFuncs is for the internal use of the proto package. +func (*CheckResponse) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { + return _CheckResponse_OneofMarshaler, _CheckResponse_OneofUnmarshaler, _CheckResponse_OneofSizer, []interface{}{ + (*CheckResponse_DeniedResponse)(nil), + (*CheckResponse_OkResponse)(nil), + } +} + +func _CheckResponse_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { + m := msg.(*CheckResponse) + // http_response + switch x := m.HttpResponse.(type) { + case *CheckResponse_DeniedResponse: + _ = b.EncodeVarint(2<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.DeniedResponse); err != nil { + return err + } + case *CheckResponse_OkResponse: + _ = b.EncodeVarint(3<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.OkResponse); err != nil { + return err + } + case nil: + default: + return fmt.Errorf("CheckResponse.HttpResponse has unexpected type %T", x) + } + return nil +} + +func _CheckResponse_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { + m := msg.(*CheckResponse) + switch tag { + case 2: // http_response.denied_response + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(DeniedHttpResponse) + err := b.DecodeMessage(msg) + m.HttpResponse = &CheckResponse_DeniedResponse{msg} + return true, err + case 3: // http_response.ok_response + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(OkHttpResponse) + err := b.DecodeMessage(msg) + m.HttpResponse = &CheckResponse_OkResponse{msg} + return true, err + default: + return false, nil + } +} + +func _CheckResponse_OneofSizer(msg proto.Message) (n int) { + m := msg.(*CheckResponse) + // http_response + switch x := m.HttpResponse.(type) { + case *CheckResponse_DeniedResponse: + s := proto.Size(x.DeniedResponse) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case *CheckResponse_OkResponse: + s := proto.Size(x.OkResponse) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case nil: + default: + panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) + } + return n +} + +func init() { + proto.RegisterType((*CheckRequest)(nil), "envoy.service.auth.v2alpha.CheckRequest") + proto.RegisterType((*DeniedHttpResponse)(nil), "envoy.service.auth.v2alpha.DeniedHttpResponse") + proto.RegisterType((*OkHttpResponse)(nil), "envoy.service.auth.v2alpha.OkHttpResponse") + proto.RegisterType((*CheckResponse)(nil), "envoy.service.auth.v2alpha.CheckResponse") +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// Client API for Authorization service + +type AuthorizationClient interface { + // Performs authorization check based on the attributes associated with the + // incoming request, and returns status `OK` or not `OK`. + Check(ctx context.Context, in *CheckRequest, opts ...grpc.CallOption) (*CheckResponse, error) +} + +type authorizationClient struct { + cc *grpc.ClientConn +} + +func NewAuthorizationClient(cc *grpc.ClientConn) AuthorizationClient { + return &authorizationClient{cc} +} + +func (c *authorizationClient) Check(ctx context.Context, in *CheckRequest, opts ...grpc.CallOption) (*CheckResponse, error) { + out := new(CheckResponse) + err := c.cc.Invoke(ctx, "/envoy.service.auth.v2alpha.Authorization/Check", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// Server API for Authorization service + +type AuthorizationServer interface { + // Performs authorization check based on the attributes associated with the + // incoming request, and returns status `OK` or not `OK`. + Check(context.Context, *CheckRequest) (*CheckResponse, error) +} + +func RegisterAuthorizationServer(s *grpc.Server, srv AuthorizationServer) { + s.RegisterService(&_Authorization_serviceDesc, srv) +} + +func _Authorization_Check_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CheckRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AuthorizationServer).Check(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/envoy.service.auth.v2alpha.Authorization/Check", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AuthorizationServer).Check(ctx, req.(*CheckRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Authorization_serviceDesc = grpc.ServiceDesc{ + ServiceName: "envoy.service.auth.v2alpha.Authorization", + HandlerType: (*AuthorizationServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Check", + Handler: _Authorization_Check_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "envoy/service/auth/v2alpha/external_auth.proto", +} + +func (m *CheckRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *CheckRequest) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Attributes != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintExternalAuth(dAtA, i, uint64(m.Attributes.Size())) + n1, err := m.Attributes.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n1 + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *DeniedHttpResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *DeniedHttpResponse) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Status != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintExternalAuth(dAtA, i, uint64(m.Status.Size())) + n2, err := m.Status.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n2 + } + if len(m.Headers) > 0 { + for _, msg := range m.Headers { + dAtA[i] = 0x12 + i++ + i = encodeVarintExternalAuth(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if len(m.Body) > 0 { + dAtA[i] = 0x1a + i++ + i = encodeVarintExternalAuth(dAtA, i, uint64(len(m.Body))) + i += copy(dAtA[i:], m.Body) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *OkHttpResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *OkHttpResponse) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Headers) > 0 { + for _, msg := range m.Headers { + dAtA[i] = 0x12 + i++ + i = encodeVarintExternalAuth(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *CheckResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *CheckResponse) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Status != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintExternalAuth(dAtA, i, uint64(m.Status.Size())) + n3, err := m.Status.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n3 + } + if m.HttpResponse != nil { + nn4, err := m.HttpResponse.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += nn4 + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *CheckResponse_DeniedResponse) MarshalTo(dAtA []byte) (int, error) { + i := 0 + if m.DeniedResponse != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintExternalAuth(dAtA, i, uint64(m.DeniedResponse.Size())) + n5, err := m.DeniedResponse.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n5 + } + return i, nil +} +func (m *CheckResponse_OkResponse) MarshalTo(dAtA []byte) (int, error) { + i := 0 + if m.OkResponse != nil { + dAtA[i] = 0x1a + i++ + i = encodeVarintExternalAuth(dAtA, i, uint64(m.OkResponse.Size())) + n6, err := m.OkResponse.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n6 + } + return i, nil +} +func encodeVarintExternalAuth(dAtA []byte, offset int, v uint64) int { + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return offset + 1 +} +func (m *CheckRequest) Size() (n int) { + var l int + _ = l + if m.Attributes != nil { + l = m.Attributes.Size() + n += 1 + l + sovExternalAuth(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *DeniedHttpResponse) Size() (n int) { + var l int + _ = l + if m.Status != nil { + l = m.Status.Size() + n += 1 + l + sovExternalAuth(uint64(l)) + } + if len(m.Headers) > 0 { + for _, e := range m.Headers { + l = e.Size() + n += 1 + l + sovExternalAuth(uint64(l)) + } + } + l = len(m.Body) + if l > 0 { + n += 1 + l + sovExternalAuth(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *OkHttpResponse) Size() (n int) { + var l int + _ = l + if len(m.Headers) > 0 { + for _, e := range m.Headers { + l = e.Size() + n += 1 + l + sovExternalAuth(uint64(l)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *CheckResponse) Size() (n int) { + var l int + _ = l + if m.Status != nil { + l = m.Status.Size() + n += 1 + l + sovExternalAuth(uint64(l)) + } + if m.HttpResponse != nil { + n += m.HttpResponse.Size() + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *CheckResponse_DeniedResponse) Size() (n int) { + var l int + _ = l + if m.DeniedResponse != nil { + l = m.DeniedResponse.Size() + n += 1 + l + sovExternalAuth(uint64(l)) + } + return n +} +func (m *CheckResponse_OkResponse) Size() (n int) { + var l int + _ = l + if m.OkResponse != nil { + l = m.OkResponse.Size() + n += 1 + l + sovExternalAuth(uint64(l)) + } + return n +} + +func sovExternalAuth(x uint64) (n int) { + for { + n++ + x >>= 7 + if x == 0 { + break + } + } + return n +} +func sozExternalAuth(x uint64) (n int) { + return sovExternalAuth(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *CheckRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowExternalAuth + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: CheckRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CheckRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Attributes", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowExternalAuth + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthExternalAuth + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Attributes == nil { + m.Attributes = &AttributeContext{} + } + if err := m.Attributes.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipExternalAuth(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthExternalAuth + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DeniedHttpResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowExternalAuth + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DeniedHttpResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DeniedHttpResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowExternalAuth + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthExternalAuth + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Status == nil { + m.Status = &_type.HttpStatus{} + } + if err := m.Status.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Headers", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowExternalAuth + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthExternalAuth + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Headers = append(m.Headers, &core.HeaderValueOption{}) + if err := m.Headers[len(m.Headers)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Body", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowExternalAuth + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthExternalAuth + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Body = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipExternalAuth(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthExternalAuth + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *OkHttpResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowExternalAuth + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: OkHttpResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: OkHttpResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Headers", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowExternalAuth + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthExternalAuth + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Headers = append(m.Headers, &core.HeaderValueOption{}) + if err := m.Headers[len(m.Headers)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipExternalAuth(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthExternalAuth + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CheckResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowExternalAuth + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: CheckResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CheckResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowExternalAuth + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthExternalAuth + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Status == nil { + m.Status = &rpc.Status{} + } + if err := m.Status.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DeniedResponse", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowExternalAuth + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthExternalAuth + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &DeniedHttpResponse{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.HttpResponse = &CheckResponse_DeniedResponse{v} + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OkResponse", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowExternalAuth + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthExternalAuth + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &OkHttpResponse{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.HttpResponse = &CheckResponse_OkResponse{v} + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipExternalAuth(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthExternalAuth + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipExternalAuth(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowExternalAuth + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowExternalAuth + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + return iNdEx, nil + case 1: + iNdEx += 8 + return iNdEx, nil + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowExternalAuth + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + iNdEx += length + if length < 0 { + return 0, ErrInvalidLengthExternalAuth + } + return iNdEx, nil + case 3: + for { + var innerWire uint64 + var start int = iNdEx + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowExternalAuth + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + innerWire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + innerWireType := int(innerWire & 0x7) + if innerWireType == 4 { + break + } + next, err := skipExternalAuth(dAtA[start:]) + if err != nil { + return 0, err + } + iNdEx = start + next + } + return iNdEx, nil + case 4: + return iNdEx, nil + case 5: + iNdEx += 4 + return iNdEx, nil + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + } + panic("unreachable") +} + +var ( + ErrInvalidLengthExternalAuth = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowExternalAuth = fmt.Errorf("proto: integer overflow") +) + +func init() { + proto.RegisterFile("envoy/service/auth/v2alpha/external_auth.proto", fileDescriptor_external_auth_ef836df974545be5) +} + +var fileDescriptor_external_auth_ef836df974545be5 = []byte{ + // 477 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x52, 0x41, 0x6b, 0x13, 0x41, + 0x18, 0xed, 0x24, 0xb6, 0xc5, 0x89, 0x69, 0x65, 0x0e, 0x76, 0x09, 0x12, 0x42, 0xf0, 0x10, 0x8b, + 0xcc, 0xc0, 0x7a, 0xf3, 0x20, 0xb4, 0xf5, 0x90, 0x83, 0x52, 0x59, 0x41, 0x50, 0x0a, 0x61, 0xb2, + 0xfb, 0xd1, 0x5d, 0xb2, 0xee, 0x8c, 0x33, 0xdf, 0x2e, 0x8d, 0xbf, 0x40, 0xfc, 0x1d, 0xfe, 0x0a, + 0x4f, 0x1e, 0x3d, 0xfa, 0x13, 0x24, 0x37, 0xff, 0x80, 0x67, 0xd9, 0xd9, 0xd9, 0xd8, 0x28, 0x06, + 0xc1, 0xdb, 0xb2, 0xdf, 0x7b, 0xef, 0x7b, 0xef, 0xcd, 0x47, 0x39, 0x14, 0x95, 0x5a, 0x0a, 0x0b, + 0xa6, 0xca, 0x62, 0x10, 0xb2, 0xc4, 0x54, 0x54, 0xa1, 0xcc, 0x75, 0x2a, 0x05, 0x5c, 0x21, 0x98, + 0x42, 0xe6, 0xb3, 0xfa, 0x2f, 0xd7, 0x46, 0xa1, 0x62, 0x03, 0x87, 0xe7, 0x1e, 0xcf, 0xdd, 0xc4, + 0xe3, 0x07, 0x77, 0x1b, 0x2d, 0xa9, 0x33, 0x51, 0x85, 0x22, 0x56, 0x06, 0xc4, 0x5c, 0x5a, 0x68, + 0x98, 0xed, 0x14, 0x97, 0x1a, 0x44, 0x8a, 0xa8, 0x67, 0x16, 0x25, 0x96, 0xd6, 0x4f, 0xc3, 0x2d, + 0x3e, 0x24, 0xa2, 0xc9, 0xe6, 0x25, 0xc2, 0x2c, 0x56, 0x05, 0xc2, 0x15, 0x7a, 0xce, 0xd1, 0xa5, + 0x52, 0x97, 0x39, 0x08, 0xa3, 0x63, 0xb1, 0x21, 0x76, 0x54, 0xc9, 0x3c, 0x4b, 0x24, 0x82, 0x68, + 0x3f, 0x9a, 0xc1, 0xf8, 0x82, 0xde, 0x3a, 0x4b, 0x21, 0x5e, 0x44, 0xf0, 0xb6, 0x04, 0x8b, 0xec, + 0x29, 0xa5, 0x6b, 0x71, 0x1b, 0x90, 0x11, 0x99, 0xf4, 0xc2, 0x07, 0xfc, 0xef, 0x11, 0xf9, 0x49, + 0x8b, 0x3e, 0x6b, 0x9c, 0x44, 0xd7, 0xf8, 0xe3, 0x8f, 0x84, 0xb2, 0x27, 0x50, 0x64, 0x90, 0x4c, + 0x11, 0x75, 0x04, 0x56, 0xab, 0xc2, 0x02, 0x7b, 0x44, 0xf7, 0x1a, 0x77, 0x7e, 0xc1, 0x1d, 0xbf, + 0xa0, 0x6e, 0x82, 0xd7, 0xc8, 0x17, 0x6e, 0x7a, 0x4a, 0x3f, 0x7d, 0xff, 0xdc, 0xdd, 0xfd, 0x40, + 0x3a, 0xb7, 0x49, 0xe4, 0x19, 0xec, 0x31, 0xdd, 0x4f, 0x41, 0x26, 0x60, 0x6c, 0xd0, 0x19, 0x75, + 0x27, 0xbd, 0xf0, 0x9e, 0x27, 0x4b, 0x9d, 0xf1, 0x2a, 0xe4, 0x75, 0xc9, 0x7c, 0xea, 0x10, 0x2f, + 0x65, 0x5e, 0xc2, 0xb9, 0xc6, 0x4c, 0x15, 0x51, 0x4b, 0x62, 0x8c, 0xde, 0x98, 0xab, 0x64, 0x19, + 0x74, 0x47, 0x64, 0x72, 0x33, 0x72, 0xdf, 0xe3, 0xe7, 0xf4, 0xe0, 0x7c, 0xb1, 0xe1, 0xf0, 0x3f, + 0xb7, 0x8c, 0x7f, 0x10, 0xda, 0xf7, 0xbd, 0x7a, 0xc5, 0xe3, 0xdf, 0x32, 0x33, 0xde, 0xbc, 0x15, + 0x37, 0x3a, 0xe6, 0x4d, 0xde, 0x75, 0xc6, 0x57, 0xf4, 0x30, 0x71, 0xad, 0xcd, 0x8c, 0xa7, 0x07, + 0x1d, 0x47, 0xe2, 0xdb, 0x5e, 0xe2, 0xcf, 0xa2, 0xa7, 0x3b, 0xd1, 0x41, 0x23, 0xb4, 0xb6, 0xf1, + 0x8c, 0xf6, 0xd4, 0xe2, 0x97, 0x6c, 0xd7, 0xc9, 0x1e, 0x6f, 0x93, 0xdd, 0x6c, 0x66, 0xba, 0x13, + 0x51, 0xb5, 0x4e, 0x75, 0x7a, 0x48, 0xfb, 0xee, 0x72, 0x5b, 0xc1, 0xf0, 0x0d, 0xed, 0x9f, 0x94, + 0x98, 0x2a, 0x93, 0xbd, 0x93, 0x75, 0x25, 0xec, 0x82, 0xee, 0xba, 0x22, 0xd8, 0x64, 0xdb, 0x92, + 0xeb, 0x37, 0x38, 0xb8, 0xff, 0x0f, 0x48, 0xbf, 0x3f, 0xf8, 0xb2, 0x1a, 0x92, 0xaf, 0xab, 0x21, + 0xf9, 0xb6, 0x1a, 0x92, 0xd7, 0xfb, 0x1e, 0xf4, 0x9e, 0x90, 0xf9, 0x9e, 0xbb, 0xef, 0x87, 0x3f, + 0x03, 0x00, 0x00, 0xff, 0xff, 0x26, 0xea, 0x51, 0xbb, 0xcf, 0x03, 0x00, 0x00, +} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/service/auth/v2alpha/external_auth.pb.validate.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/service/auth/v2alpha/external_auth.pb.validate.go new file mode 100644 index 000000000000..08dfeaf8beb6 --- /dev/null +++ b/vendor/github.com/envoyproxy/go-control-plane/envoy/service/auth/v2alpha/external_auth.pb.validate.go @@ -0,0 +1,300 @@ +// Code generated by protoc-gen-validate +// source: envoy/service/auth/v2alpha/external_auth.proto +// DO NOT EDIT!!! + +package v2alpha + +import ( + "bytes" + "errors" + "fmt" + "net" + "net/mail" + "net/url" + "regexp" + "strings" + "time" + "unicode/utf8" + + "github.com/gogo/protobuf/types" +) + +// ensure the imports are used +var ( + _ = bytes.MinRead + _ = errors.New("") + _ = fmt.Print + _ = utf8.UTFMax + _ = (*regexp.Regexp)(nil) + _ = (*strings.Reader)(nil) + _ = net.IPv4len + _ = time.Duration(0) + _ = (*url.URL)(nil) + _ = (*mail.Address)(nil) + _ = types.DynamicAny{} +) + +// Validate checks the field values on CheckRequest with the rules defined in +// the proto definition for this message. If any rules are violated, an error +// is returned. +func (m *CheckRequest) Validate() error { + if m == nil { + return nil + } + + if v, ok := interface{}(m.GetAttributes()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return CheckRequestValidationError{ + Field: "Attributes", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + return nil +} + +// CheckRequestValidationError is the validation error returned by +// CheckRequest.Validate if the designated constraints aren't met. +type CheckRequestValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e CheckRequestValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sCheckRequest.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = CheckRequestValidationError{} + +// Validate checks the field values on DeniedHttpResponse with the rules +// defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *DeniedHttpResponse) Validate() error { + if m == nil { + return nil + } + + if m.GetStatus() == nil { + return DeniedHttpResponseValidationError{ + Field: "Status", + Reason: "value is required", + } + } + + if v, ok := interface{}(m.GetStatus()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return DeniedHttpResponseValidationError{ + Field: "Status", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + for idx, item := range m.GetHeaders() { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return DeniedHttpResponseValidationError{ + Field: fmt.Sprintf("Headers[%v]", idx), + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + } + + // no validation rules for Body + + return nil +} + +// DeniedHttpResponseValidationError is the validation error returned by +// DeniedHttpResponse.Validate if the designated constraints aren't met. +type DeniedHttpResponseValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e DeniedHttpResponseValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sDeniedHttpResponse.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = DeniedHttpResponseValidationError{} + +// Validate checks the field values on OkHttpResponse with the rules defined in +// the proto definition for this message. If any rules are violated, an error +// is returned. +func (m *OkHttpResponse) Validate() error { + if m == nil { + return nil + } + + for idx, item := range m.GetHeaders() { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return OkHttpResponseValidationError{ + Field: fmt.Sprintf("Headers[%v]", idx), + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + } + + return nil +} + +// OkHttpResponseValidationError is the validation error returned by +// OkHttpResponse.Validate if the designated constraints aren't met. +type OkHttpResponseValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e OkHttpResponseValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sOkHttpResponse.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = OkHttpResponseValidationError{} + +// Validate checks the field values on CheckResponse with the rules defined in +// the proto definition for this message. If any rules are violated, an error +// is returned. +func (m *CheckResponse) Validate() error { + if m == nil { + return nil + } + + if v, ok := interface{}(m.GetStatus()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return CheckResponseValidationError{ + Field: "Status", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + switch m.HttpResponse.(type) { + + case *CheckResponse_DeniedResponse: + + if v, ok := interface{}(m.GetDeniedResponse()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return CheckResponseValidationError{ + Field: "DeniedResponse", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + case *CheckResponse_OkResponse: + + if v, ok := interface{}(m.GetOkResponse()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return CheckResponseValidationError{ + Field: "OkResponse", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + } + + return nil +} + +// CheckResponseValidationError is the validation error returned by +// CheckResponse.Validate if the designated constraints aren't met. +type CheckResponseValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e CheckResponseValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sCheckResponse.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = CheckResponseValidationError{} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/service/discovery/v2/ads.pb.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/service/discovery/v2/ads.pb.go new file mode 100644 index 000000000000..440524e23667 --- /dev/null +++ b/vendor/github.com/envoyproxy/go-control-plane/envoy/service/discovery/v2/ads.pb.go @@ -0,0 +1,472 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: envoy/service/discovery/v2/ads.proto + +package v2 + +import proto "github.com/gogo/protobuf/proto" +import fmt "fmt" +import math "math" +import v2 "github.com/envoyproxy/go-control-plane/envoy/api/v2" + +import context "golang.org/x/net/context" +import grpc "google.golang.org/grpc" + +import io "io" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package + +// [#not-implemented-hide:] Not configuration. Workaround c++ protobuf issue with importing +// services: https://github.com/google/protobuf/issues/4221 +type AdsDummy struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *AdsDummy) Reset() { *m = AdsDummy{} } +func (m *AdsDummy) String() string { return proto.CompactTextString(m) } +func (*AdsDummy) ProtoMessage() {} +func (*AdsDummy) Descriptor() ([]byte, []int) { + return fileDescriptor_ads_e55e118c12e4a4c7, []int{0} +} +func (m *AdsDummy) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AdsDummy) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AdsDummy.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *AdsDummy) XXX_Merge(src proto.Message) { + xxx_messageInfo_AdsDummy.Merge(dst, src) +} +func (m *AdsDummy) XXX_Size() int { + return m.Size() +} +func (m *AdsDummy) XXX_DiscardUnknown() { + xxx_messageInfo_AdsDummy.DiscardUnknown(m) +} + +var xxx_messageInfo_AdsDummy proto.InternalMessageInfo + +func init() { + proto.RegisterType((*AdsDummy)(nil), "envoy.service.discovery.v2.AdsDummy") +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// Client API for AggregatedDiscoveryService service + +type AggregatedDiscoveryServiceClient interface { + // This is a gRPC-only API. + StreamAggregatedResources(ctx context.Context, opts ...grpc.CallOption) (AggregatedDiscoveryService_StreamAggregatedResourcesClient, error) + IncrementalAggregatedResources(ctx context.Context, opts ...grpc.CallOption) (AggregatedDiscoveryService_IncrementalAggregatedResourcesClient, error) +} + +type aggregatedDiscoveryServiceClient struct { + cc *grpc.ClientConn +} + +func NewAggregatedDiscoveryServiceClient(cc *grpc.ClientConn) AggregatedDiscoveryServiceClient { + return &aggregatedDiscoveryServiceClient{cc} +} + +func (c *aggregatedDiscoveryServiceClient) StreamAggregatedResources(ctx context.Context, opts ...grpc.CallOption) (AggregatedDiscoveryService_StreamAggregatedResourcesClient, error) { + stream, err := c.cc.NewStream(ctx, &_AggregatedDiscoveryService_serviceDesc.Streams[0], "/envoy.service.discovery.v2.AggregatedDiscoveryService/StreamAggregatedResources", opts...) + if err != nil { + return nil, err + } + x := &aggregatedDiscoveryServiceStreamAggregatedResourcesClient{stream} + return x, nil +} + +type AggregatedDiscoveryService_StreamAggregatedResourcesClient interface { + Send(*v2.DiscoveryRequest) error + Recv() (*v2.DiscoveryResponse, error) + grpc.ClientStream +} + +type aggregatedDiscoveryServiceStreamAggregatedResourcesClient struct { + grpc.ClientStream +} + +func (x *aggregatedDiscoveryServiceStreamAggregatedResourcesClient) Send(m *v2.DiscoveryRequest) error { + return x.ClientStream.SendMsg(m) +} + +func (x *aggregatedDiscoveryServiceStreamAggregatedResourcesClient) Recv() (*v2.DiscoveryResponse, error) { + m := new(v2.DiscoveryResponse) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *aggregatedDiscoveryServiceClient) IncrementalAggregatedResources(ctx context.Context, opts ...grpc.CallOption) (AggregatedDiscoveryService_IncrementalAggregatedResourcesClient, error) { + stream, err := c.cc.NewStream(ctx, &_AggregatedDiscoveryService_serviceDesc.Streams[1], "/envoy.service.discovery.v2.AggregatedDiscoveryService/IncrementalAggregatedResources", opts...) + if err != nil { + return nil, err + } + x := &aggregatedDiscoveryServiceIncrementalAggregatedResourcesClient{stream} + return x, nil +} + +type AggregatedDiscoveryService_IncrementalAggregatedResourcesClient interface { + Send(*v2.IncrementalDiscoveryRequest) error + Recv() (*v2.IncrementalDiscoveryResponse, error) + grpc.ClientStream +} + +type aggregatedDiscoveryServiceIncrementalAggregatedResourcesClient struct { + grpc.ClientStream +} + +func (x *aggregatedDiscoveryServiceIncrementalAggregatedResourcesClient) Send(m *v2.IncrementalDiscoveryRequest) error { + return x.ClientStream.SendMsg(m) +} + +func (x *aggregatedDiscoveryServiceIncrementalAggregatedResourcesClient) Recv() (*v2.IncrementalDiscoveryResponse, error) { + m := new(v2.IncrementalDiscoveryResponse) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +// Server API for AggregatedDiscoveryService service + +type AggregatedDiscoveryServiceServer interface { + // This is a gRPC-only API. + StreamAggregatedResources(AggregatedDiscoveryService_StreamAggregatedResourcesServer) error + IncrementalAggregatedResources(AggregatedDiscoveryService_IncrementalAggregatedResourcesServer) error +} + +func RegisterAggregatedDiscoveryServiceServer(s *grpc.Server, srv AggregatedDiscoveryServiceServer) { + s.RegisterService(&_AggregatedDiscoveryService_serviceDesc, srv) +} + +func _AggregatedDiscoveryService_StreamAggregatedResources_Handler(srv interface{}, stream grpc.ServerStream) error { + return srv.(AggregatedDiscoveryServiceServer).StreamAggregatedResources(&aggregatedDiscoveryServiceStreamAggregatedResourcesServer{stream}) +} + +type AggregatedDiscoveryService_StreamAggregatedResourcesServer interface { + Send(*v2.DiscoveryResponse) error + Recv() (*v2.DiscoveryRequest, error) + grpc.ServerStream +} + +type aggregatedDiscoveryServiceStreamAggregatedResourcesServer struct { + grpc.ServerStream +} + +func (x *aggregatedDiscoveryServiceStreamAggregatedResourcesServer) Send(m *v2.DiscoveryResponse) error { + return x.ServerStream.SendMsg(m) +} + +func (x *aggregatedDiscoveryServiceStreamAggregatedResourcesServer) Recv() (*v2.DiscoveryRequest, error) { + m := new(v2.DiscoveryRequest) + if err := x.ServerStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func _AggregatedDiscoveryService_IncrementalAggregatedResources_Handler(srv interface{}, stream grpc.ServerStream) error { + return srv.(AggregatedDiscoveryServiceServer).IncrementalAggregatedResources(&aggregatedDiscoveryServiceIncrementalAggregatedResourcesServer{stream}) +} + +type AggregatedDiscoveryService_IncrementalAggregatedResourcesServer interface { + Send(*v2.IncrementalDiscoveryResponse) error + Recv() (*v2.IncrementalDiscoveryRequest, error) + grpc.ServerStream +} + +type aggregatedDiscoveryServiceIncrementalAggregatedResourcesServer struct { + grpc.ServerStream +} + +func (x *aggregatedDiscoveryServiceIncrementalAggregatedResourcesServer) Send(m *v2.IncrementalDiscoveryResponse) error { + return x.ServerStream.SendMsg(m) +} + +func (x *aggregatedDiscoveryServiceIncrementalAggregatedResourcesServer) Recv() (*v2.IncrementalDiscoveryRequest, error) { + m := new(v2.IncrementalDiscoveryRequest) + if err := x.ServerStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +var _AggregatedDiscoveryService_serviceDesc = grpc.ServiceDesc{ + ServiceName: "envoy.service.discovery.v2.AggregatedDiscoveryService", + HandlerType: (*AggregatedDiscoveryServiceServer)(nil), + Methods: []grpc.MethodDesc{}, + Streams: []grpc.StreamDesc{ + { + StreamName: "StreamAggregatedResources", + Handler: _AggregatedDiscoveryService_StreamAggregatedResources_Handler, + ServerStreams: true, + ClientStreams: true, + }, + { + StreamName: "IncrementalAggregatedResources", + Handler: _AggregatedDiscoveryService_IncrementalAggregatedResources_Handler, + ServerStreams: true, + ClientStreams: true, + }, + }, + Metadata: "envoy/service/discovery/v2/ads.proto", +} + +func (m *AdsDummy) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *AdsDummy) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func encodeVarintAds(dAtA []byte, offset int, v uint64) int { + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return offset + 1 +} +func (m *AdsDummy) Size() (n int) { + var l int + _ = l + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func sovAds(x uint64) (n int) { + for { + n++ + x >>= 7 + if x == 0 { + break + } + } + return n +} +func sozAds(x uint64) (n int) { + return sovAds(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *AdsDummy) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: AdsDummy: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: AdsDummy: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipAds(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthAds + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipAds(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowAds + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowAds + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + return iNdEx, nil + case 1: + iNdEx += 8 + return iNdEx, nil + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowAds + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + iNdEx += length + if length < 0 { + return 0, ErrInvalidLengthAds + } + return iNdEx, nil + case 3: + for { + var innerWire uint64 + var start int = iNdEx + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowAds + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + innerWire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + innerWireType := int(innerWire & 0x7) + if innerWireType == 4 { + break + } + next, err := skipAds(dAtA[start:]) + if err != nil { + return 0, err + } + iNdEx = start + next + } + return iNdEx, nil + case 4: + return iNdEx, nil + case 5: + iNdEx += 4 + return iNdEx, nil + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + } + panic("unreachable") +} + +var ( + ErrInvalidLengthAds = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowAds = fmt.Errorf("proto: integer overflow") +) + +func init() { + proto.RegisterFile("envoy/service/discovery/v2/ads.proto", fileDescriptor_ads_e55e118c12e4a4c7) +} + +var fileDescriptor_ads_e55e118c12e4a4c7 = []byte{ + // 237 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0xd0, 0xbd, 0x4a, 0x04, 0x31, + 0x14, 0x05, 0x60, 0xaf, 0x85, 0x48, 0xca, 0xb1, 0x72, 0x90, 0x08, 0x8b, 0x85, 0x5a, 0x64, 0x24, + 0x3e, 0xc1, 0xca, 0x36, 0xb6, 0xbb, 0x9d, 0x5d, 0x36, 0xb9, 0x0c, 0x01, 0xf3, 0x63, 0x6e, 0x26, + 0x30, 0x85, 0xbd, 0x8f, 0x66, 0xe9, 0x23, 0xc8, 0xbc, 0x88, 0xe2, 0x8c, 0xee, 0xae, 0xa8, 0x60, + 0x7d, 0xbf, 0x73, 0x4e, 0x08, 0x3b, 0x43, 0x5f, 0x42, 0xdf, 0x10, 0xa6, 0x62, 0x35, 0x36, 0xc6, + 0x92, 0x0e, 0x05, 0x53, 0xdf, 0x14, 0xd9, 0x28, 0x43, 0x22, 0xa6, 0x90, 0x43, 0x55, 0x8f, 0x4a, + 0x7c, 0x2a, 0xb1, 0x51, 0xa2, 0xc8, 0xfa, 0x64, 0x6a, 0x50, 0xd1, 0x7e, 0x64, 0xb6, 0xa7, 0x31, + 0x39, 0x63, 0xec, 0x70, 0x6e, 0x68, 0xd1, 0x39, 0xd7, 0xcb, 0x37, 0x60, 0xf5, 0xbc, 0x6d, 0x13, + 0xb6, 0x2a, 0xa3, 0x59, 0x7c, 0xc9, 0xd5, 0xd4, 0x5a, 0xad, 0xd9, 0xf1, 0x2a, 0x27, 0x54, 0x6e, + 0x6b, 0x96, 0x48, 0xa1, 0x4b, 0x1a, 0xa9, 0xe2, 0x62, 0x7a, 0x82, 0x8a, 0x56, 0x14, 0x29, 0x36, + 0xe1, 0x25, 0x3e, 0x74, 0x48, 0xb9, 0x3e, 0xfd, 0xf3, 0x4e, 0x31, 0x78, 0xc2, 0xd9, 0xde, 0x39, + 0x5c, 0x41, 0xf5, 0xc8, 0xf8, 0xad, 0xd7, 0x09, 0x1d, 0xfa, 0xac, 0xee, 0x7f, 0x1b, 0xba, 0xf8, + 0x5e, 0xb4, 0xa3, 0x7f, 0x6c, 0x5e, 0xfe, 0x87, 0xee, 0xce, 0xdf, 0x1c, 0x3d, 0x0f, 0x1c, 0x5e, + 0x06, 0x0e, 0xaf, 0x03, 0x87, 0xbb, 0xfd, 0x22, 0x9f, 0x00, 0xd6, 0x07, 0xe3, 0x4f, 0x5d, 0xbf, + 0x07, 0x00, 0x00, 0xff, 0xff, 0x9b, 0xe6, 0x5f, 0x1d, 0x8b, 0x01, 0x00, 0x00, +} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/service/discovery/v2/ads.pb.validate.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/service/discovery/v2/ads.pb.validate.go new file mode 100644 index 000000000000..2ad4e6d67679 --- /dev/null +++ b/vendor/github.com/envoyproxy/go-control-plane/envoy/service/discovery/v2/ads.pb.validate.go @@ -0,0 +1,76 @@ +// Code generated by protoc-gen-validate +// source: envoy/service/discovery/v2/ads.proto +// DO NOT EDIT!!! + +package v2 + +import ( + "bytes" + "errors" + "fmt" + "net" + "net/mail" + "net/url" + "regexp" + "strings" + "time" + "unicode/utf8" + + "github.com/gogo/protobuf/types" +) + +// ensure the imports are used +var ( + _ = bytes.MinRead + _ = errors.New("") + _ = fmt.Print + _ = utf8.UTFMax + _ = (*regexp.Regexp)(nil) + _ = (*strings.Reader)(nil) + _ = net.IPv4len + _ = time.Duration(0) + _ = (*url.URL)(nil) + _ = (*mail.Address)(nil) + _ = types.DynamicAny{} +) + +// Validate checks the field values on AdsDummy with the rules defined in the +// proto definition for this message. If any rules are violated, an error is returned. +func (m *AdsDummy) Validate() error { + if m == nil { + return nil + } + + return nil +} + +// AdsDummyValidationError is the validation error returned by +// AdsDummy.Validate if the designated constraints aren't met. +type AdsDummyValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e AdsDummyValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sAdsDummy.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = AdsDummyValidationError{} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/service/discovery/v2/hds.pb.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/service/discovery/v2/hds.pb.go new file mode 100644 index 000000000000..f00772eb0b7f --- /dev/null +++ b/vendor/github.com/envoyproxy/go-control-plane/envoy/service/discovery/v2/hds.pb.go @@ -0,0 +1,2406 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: envoy/service/discovery/v2/hds.proto + +package v2 + +import proto "github.com/gogo/protobuf/proto" +import fmt "fmt" +import math "math" +import core "github.com/envoyproxy/go-control-plane/envoy/api/v2/core" +import endpoint "github.com/envoyproxy/go-control-plane/envoy/api/v2/endpoint" +import _ "github.com/gogo/googleapis/google/api" +import types "github.com/gogo/protobuf/types" + +import context "golang.org/x/net/context" +import grpc "google.golang.org/grpc" + +import io "io" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package + +// Different Envoy instances may have different capabilities (e.g. Redis) +// and/or have ports enabled for different protocols. +type Capability_Protocol int32 + +const ( + Capability_HTTP Capability_Protocol = 0 + Capability_TCP Capability_Protocol = 1 + Capability_REDIS Capability_Protocol = 2 +) + +var Capability_Protocol_name = map[int32]string{ + 0: "HTTP", + 1: "TCP", + 2: "REDIS", +} +var Capability_Protocol_value = map[string]int32{ + "HTTP": 0, + "TCP": 1, + "REDIS": 2, +} + +func (x Capability_Protocol) String() string { + return proto.EnumName(Capability_Protocol_name, int32(x)) +} +func (Capability_Protocol) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_hds_1203598eb36a833b, []int{0, 0} +} + +// Defines supported protocols etc, so the management server can assign proper +// endpoints to healthcheck. +type Capability struct { + HealthCheckProtocols []Capability_Protocol `protobuf:"varint,1,rep,packed,name=health_check_protocols,json=healthCheckProtocols,enum=envoy.service.discovery.v2.Capability_Protocol" json:"health_check_protocols,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Capability) Reset() { *m = Capability{} } +func (m *Capability) String() string { return proto.CompactTextString(m) } +func (*Capability) ProtoMessage() {} +func (*Capability) Descriptor() ([]byte, []int) { + return fileDescriptor_hds_1203598eb36a833b, []int{0} +} +func (m *Capability) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Capability) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Capability.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *Capability) XXX_Merge(src proto.Message) { + xxx_messageInfo_Capability.Merge(dst, src) +} +func (m *Capability) XXX_Size() int { + return m.Size() +} +func (m *Capability) XXX_DiscardUnknown() { + xxx_messageInfo_Capability.DiscardUnknown(m) +} + +var xxx_messageInfo_Capability proto.InternalMessageInfo + +func (m *Capability) GetHealthCheckProtocols() []Capability_Protocol { + if m != nil { + return m.HealthCheckProtocols + } + return nil +} + +type HealthCheckRequest struct { + Node *core.Node `protobuf:"bytes,1,opt,name=node" json:"node,omitempty"` + Capability *Capability `protobuf:"bytes,2,opt,name=capability" json:"capability,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *HealthCheckRequest) Reset() { *m = HealthCheckRequest{} } +func (m *HealthCheckRequest) String() string { return proto.CompactTextString(m) } +func (*HealthCheckRequest) ProtoMessage() {} +func (*HealthCheckRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_hds_1203598eb36a833b, []int{1} +} +func (m *HealthCheckRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *HealthCheckRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_HealthCheckRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *HealthCheckRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_HealthCheckRequest.Merge(dst, src) +} +func (m *HealthCheckRequest) XXX_Size() int { + return m.Size() +} +func (m *HealthCheckRequest) XXX_DiscardUnknown() { + xxx_messageInfo_HealthCheckRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_HealthCheckRequest proto.InternalMessageInfo + +func (m *HealthCheckRequest) GetNode() *core.Node { + if m != nil { + return m.Node + } + return nil +} + +func (m *HealthCheckRequest) GetCapability() *Capability { + if m != nil { + return m.Capability + } + return nil +} + +type EndpointHealth struct { + Endpoint *endpoint.Endpoint `protobuf:"bytes,1,opt,name=endpoint" json:"endpoint,omitempty"` + HealthStatus core.HealthStatus `protobuf:"varint,2,opt,name=health_status,json=healthStatus,proto3,enum=envoy.api.v2.core.HealthStatus" json:"health_status,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *EndpointHealth) Reset() { *m = EndpointHealth{} } +func (m *EndpointHealth) String() string { return proto.CompactTextString(m) } +func (*EndpointHealth) ProtoMessage() {} +func (*EndpointHealth) Descriptor() ([]byte, []int) { + return fileDescriptor_hds_1203598eb36a833b, []int{2} +} +func (m *EndpointHealth) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EndpointHealth) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EndpointHealth.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *EndpointHealth) XXX_Merge(src proto.Message) { + xxx_messageInfo_EndpointHealth.Merge(dst, src) +} +func (m *EndpointHealth) XXX_Size() int { + return m.Size() +} +func (m *EndpointHealth) XXX_DiscardUnknown() { + xxx_messageInfo_EndpointHealth.DiscardUnknown(m) +} + +var xxx_messageInfo_EndpointHealth proto.InternalMessageInfo + +func (m *EndpointHealth) GetEndpoint() *endpoint.Endpoint { + if m != nil { + return m.Endpoint + } + return nil +} + +func (m *EndpointHealth) GetHealthStatus() core.HealthStatus { + if m != nil { + return m.HealthStatus + } + return core.HealthStatus_UNKNOWN +} + +type EndpointHealthResponse struct { + EndpointsHealth []*EndpointHealth `protobuf:"bytes,1,rep,name=endpoints_health,json=endpointsHealth" json:"endpoints_health,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *EndpointHealthResponse) Reset() { *m = EndpointHealthResponse{} } +func (m *EndpointHealthResponse) String() string { return proto.CompactTextString(m) } +func (*EndpointHealthResponse) ProtoMessage() {} +func (*EndpointHealthResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_hds_1203598eb36a833b, []int{3} +} +func (m *EndpointHealthResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EndpointHealthResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EndpointHealthResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *EndpointHealthResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_EndpointHealthResponse.Merge(dst, src) +} +func (m *EndpointHealthResponse) XXX_Size() int { + return m.Size() +} +func (m *EndpointHealthResponse) XXX_DiscardUnknown() { + xxx_messageInfo_EndpointHealthResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_EndpointHealthResponse proto.InternalMessageInfo + +func (m *EndpointHealthResponse) GetEndpointsHealth() []*EndpointHealth { + if m != nil { + return m.EndpointsHealth + } + return nil +} + +type HealthCheckRequestOrEndpointHealthResponse struct { + // Types that are valid to be assigned to RequestType: + // *HealthCheckRequestOrEndpointHealthResponse_HealthCheckRequest + // *HealthCheckRequestOrEndpointHealthResponse_EndpointHealthResponse + RequestType isHealthCheckRequestOrEndpointHealthResponse_RequestType `protobuf_oneof:"request_type"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *HealthCheckRequestOrEndpointHealthResponse) Reset() { + *m = HealthCheckRequestOrEndpointHealthResponse{} +} +func (m *HealthCheckRequestOrEndpointHealthResponse) String() string { + return proto.CompactTextString(m) +} +func (*HealthCheckRequestOrEndpointHealthResponse) ProtoMessage() {} +func (*HealthCheckRequestOrEndpointHealthResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_hds_1203598eb36a833b, []int{4} +} +func (m *HealthCheckRequestOrEndpointHealthResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *HealthCheckRequestOrEndpointHealthResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_HealthCheckRequestOrEndpointHealthResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *HealthCheckRequestOrEndpointHealthResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_HealthCheckRequestOrEndpointHealthResponse.Merge(dst, src) +} +func (m *HealthCheckRequestOrEndpointHealthResponse) XXX_Size() int { + return m.Size() +} +func (m *HealthCheckRequestOrEndpointHealthResponse) XXX_DiscardUnknown() { + xxx_messageInfo_HealthCheckRequestOrEndpointHealthResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_HealthCheckRequestOrEndpointHealthResponse proto.InternalMessageInfo + +type isHealthCheckRequestOrEndpointHealthResponse_RequestType interface { + isHealthCheckRequestOrEndpointHealthResponse_RequestType() + MarshalTo([]byte) (int, error) + Size() int +} + +type HealthCheckRequestOrEndpointHealthResponse_HealthCheckRequest struct { + HealthCheckRequest *HealthCheckRequest `protobuf:"bytes,1,opt,name=health_check_request,json=healthCheckRequest,oneof"` +} +type HealthCheckRequestOrEndpointHealthResponse_EndpointHealthResponse struct { + EndpointHealthResponse *EndpointHealthResponse `protobuf:"bytes,2,opt,name=endpoint_health_response,json=endpointHealthResponse,oneof"` +} + +func (*HealthCheckRequestOrEndpointHealthResponse_HealthCheckRequest) isHealthCheckRequestOrEndpointHealthResponse_RequestType() { +} +func (*HealthCheckRequestOrEndpointHealthResponse_EndpointHealthResponse) isHealthCheckRequestOrEndpointHealthResponse_RequestType() { +} + +func (m *HealthCheckRequestOrEndpointHealthResponse) GetRequestType() isHealthCheckRequestOrEndpointHealthResponse_RequestType { + if m != nil { + return m.RequestType + } + return nil +} + +func (m *HealthCheckRequestOrEndpointHealthResponse) GetHealthCheckRequest() *HealthCheckRequest { + if x, ok := m.GetRequestType().(*HealthCheckRequestOrEndpointHealthResponse_HealthCheckRequest); ok { + return x.HealthCheckRequest + } + return nil +} + +func (m *HealthCheckRequestOrEndpointHealthResponse) GetEndpointHealthResponse() *EndpointHealthResponse { + if x, ok := m.GetRequestType().(*HealthCheckRequestOrEndpointHealthResponse_EndpointHealthResponse); ok { + return x.EndpointHealthResponse + } + return nil +} + +// XXX_OneofFuncs is for the internal use of the proto package. +func (*HealthCheckRequestOrEndpointHealthResponse) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { + return _HealthCheckRequestOrEndpointHealthResponse_OneofMarshaler, _HealthCheckRequestOrEndpointHealthResponse_OneofUnmarshaler, _HealthCheckRequestOrEndpointHealthResponse_OneofSizer, []interface{}{ + (*HealthCheckRequestOrEndpointHealthResponse_HealthCheckRequest)(nil), + (*HealthCheckRequestOrEndpointHealthResponse_EndpointHealthResponse)(nil), + } +} + +func _HealthCheckRequestOrEndpointHealthResponse_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { + m := msg.(*HealthCheckRequestOrEndpointHealthResponse) + // request_type + switch x := m.RequestType.(type) { + case *HealthCheckRequestOrEndpointHealthResponse_HealthCheckRequest: + _ = b.EncodeVarint(1<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.HealthCheckRequest); err != nil { + return err + } + case *HealthCheckRequestOrEndpointHealthResponse_EndpointHealthResponse: + _ = b.EncodeVarint(2<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.EndpointHealthResponse); err != nil { + return err + } + case nil: + default: + return fmt.Errorf("HealthCheckRequestOrEndpointHealthResponse.RequestType has unexpected type %T", x) + } + return nil +} + +func _HealthCheckRequestOrEndpointHealthResponse_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { + m := msg.(*HealthCheckRequestOrEndpointHealthResponse) + switch tag { + case 1: // request_type.health_check_request + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(HealthCheckRequest) + err := b.DecodeMessage(msg) + m.RequestType = &HealthCheckRequestOrEndpointHealthResponse_HealthCheckRequest{msg} + return true, err + case 2: // request_type.endpoint_health_response + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(EndpointHealthResponse) + err := b.DecodeMessage(msg) + m.RequestType = &HealthCheckRequestOrEndpointHealthResponse_EndpointHealthResponse{msg} + return true, err + default: + return false, nil + } +} + +func _HealthCheckRequestOrEndpointHealthResponse_OneofSizer(msg proto.Message) (n int) { + m := msg.(*HealthCheckRequestOrEndpointHealthResponse) + // request_type + switch x := m.RequestType.(type) { + case *HealthCheckRequestOrEndpointHealthResponse_HealthCheckRequest: + s := proto.Size(x.HealthCheckRequest) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case *HealthCheckRequestOrEndpointHealthResponse_EndpointHealthResponse: + s := proto.Size(x.EndpointHealthResponse) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case nil: + default: + panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) + } + return n +} + +type LocalityEndpoints struct { + Locality *core.Locality `protobuf:"bytes,1,opt,name=locality" json:"locality,omitempty"` + Endpoints []*endpoint.Endpoint `protobuf:"bytes,2,rep,name=endpoints" json:"endpoints,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *LocalityEndpoints) Reset() { *m = LocalityEndpoints{} } +func (m *LocalityEndpoints) String() string { return proto.CompactTextString(m) } +func (*LocalityEndpoints) ProtoMessage() {} +func (*LocalityEndpoints) Descriptor() ([]byte, []int) { + return fileDescriptor_hds_1203598eb36a833b, []int{5} +} +func (m *LocalityEndpoints) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *LocalityEndpoints) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_LocalityEndpoints.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *LocalityEndpoints) XXX_Merge(src proto.Message) { + xxx_messageInfo_LocalityEndpoints.Merge(dst, src) +} +func (m *LocalityEndpoints) XXX_Size() int { + return m.Size() +} +func (m *LocalityEndpoints) XXX_DiscardUnknown() { + xxx_messageInfo_LocalityEndpoints.DiscardUnknown(m) +} + +var xxx_messageInfo_LocalityEndpoints proto.InternalMessageInfo + +func (m *LocalityEndpoints) GetLocality() *core.Locality { + if m != nil { + return m.Locality + } + return nil +} + +func (m *LocalityEndpoints) GetEndpoints() []*endpoint.Endpoint { + if m != nil { + return m.Endpoints + } + return nil +} + +// The cluster name and locality is provided to Envoy for the endpoints that it +// health checks to support statistics reporting, logging and debugging by the +// Envoy instance (outside of HDS). For maximum usefulness, it should match the +// same cluster structure as that provided by EDS. +type ClusterHealthCheck struct { + ClusterName string `protobuf:"bytes,1,opt,name=cluster_name,json=clusterName,proto3" json:"cluster_name,omitempty"` + HealthChecks []*core.HealthCheck `protobuf:"bytes,2,rep,name=health_checks,json=healthChecks" json:"health_checks,omitempty"` + LocalityEndpoints []*LocalityEndpoints `protobuf:"bytes,3,rep,name=locality_endpoints,json=localityEndpoints" json:"locality_endpoints,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ClusterHealthCheck) Reset() { *m = ClusterHealthCheck{} } +func (m *ClusterHealthCheck) String() string { return proto.CompactTextString(m) } +func (*ClusterHealthCheck) ProtoMessage() {} +func (*ClusterHealthCheck) Descriptor() ([]byte, []int) { + return fileDescriptor_hds_1203598eb36a833b, []int{6} +} +func (m *ClusterHealthCheck) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ClusterHealthCheck) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ClusterHealthCheck.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *ClusterHealthCheck) XXX_Merge(src proto.Message) { + xxx_messageInfo_ClusterHealthCheck.Merge(dst, src) +} +func (m *ClusterHealthCheck) XXX_Size() int { + return m.Size() +} +func (m *ClusterHealthCheck) XXX_DiscardUnknown() { + xxx_messageInfo_ClusterHealthCheck.DiscardUnknown(m) +} + +var xxx_messageInfo_ClusterHealthCheck proto.InternalMessageInfo + +func (m *ClusterHealthCheck) GetClusterName() string { + if m != nil { + return m.ClusterName + } + return "" +} + +func (m *ClusterHealthCheck) GetHealthChecks() []*core.HealthCheck { + if m != nil { + return m.HealthChecks + } + return nil +} + +func (m *ClusterHealthCheck) GetLocalityEndpoints() []*LocalityEndpoints { + if m != nil { + return m.LocalityEndpoints + } + return nil +} + +type HealthCheckSpecifier struct { + ClusterHealthChecks []*ClusterHealthCheck `protobuf:"bytes,1,rep,name=cluster_health_checks,json=clusterHealthChecks" json:"cluster_health_checks,omitempty"` + // The default is 1 second. + Interval *types.Duration `protobuf:"bytes,2,opt,name=interval" json:"interval,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *HealthCheckSpecifier) Reset() { *m = HealthCheckSpecifier{} } +func (m *HealthCheckSpecifier) String() string { return proto.CompactTextString(m) } +func (*HealthCheckSpecifier) ProtoMessage() {} +func (*HealthCheckSpecifier) Descriptor() ([]byte, []int) { + return fileDescriptor_hds_1203598eb36a833b, []int{7} +} +func (m *HealthCheckSpecifier) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *HealthCheckSpecifier) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_HealthCheckSpecifier.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *HealthCheckSpecifier) XXX_Merge(src proto.Message) { + xxx_messageInfo_HealthCheckSpecifier.Merge(dst, src) +} +func (m *HealthCheckSpecifier) XXX_Size() int { + return m.Size() +} +func (m *HealthCheckSpecifier) XXX_DiscardUnknown() { + xxx_messageInfo_HealthCheckSpecifier.DiscardUnknown(m) +} + +var xxx_messageInfo_HealthCheckSpecifier proto.InternalMessageInfo + +func (m *HealthCheckSpecifier) GetClusterHealthChecks() []*ClusterHealthCheck { + if m != nil { + return m.ClusterHealthChecks + } + return nil +} + +func (m *HealthCheckSpecifier) GetInterval() *types.Duration { + if m != nil { + return m.Interval + } + return nil +} + +func init() { + proto.RegisterType((*Capability)(nil), "envoy.service.discovery.v2.Capability") + proto.RegisterType((*HealthCheckRequest)(nil), "envoy.service.discovery.v2.HealthCheckRequest") + proto.RegisterType((*EndpointHealth)(nil), "envoy.service.discovery.v2.EndpointHealth") + proto.RegisterType((*EndpointHealthResponse)(nil), "envoy.service.discovery.v2.EndpointHealthResponse") + proto.RegisterType((*HealthCheckRequestOrEndpointHealthResponse)(nil), "envoy.service.discovery.v2.HealthCheckRequestOrEndpointHealthResponse") + proto.RegisterType((*LocalityEndpoints)(nil), "envoy.service.discovery.v2.LocalityEndpoints") + proto.RegisterType((*ClusterHealthCheck)(nil), "envoy.service.discovery.v2.ClusterHealthCheck") + proto.RegisterType((*HealthCheckSpecifier)(nil), "envoy.service.discovery.v2.HealthCheckSpecifier") + proto.RegisterEnum("envoy.service.discovery.v2.Capability_Protocol", Capability_Protocol_name, Capability_Protocol_value) +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// Client API for HealthDiscoveryService service + +type HealthDiscoveryServiceClient interface { + // 1. Envoy starts up and if its can_healthcheck option in the static + // bootstrap config is enabled, sends HealthCheckRequest to the management + // server. It supplies its capabilities (which protocol it can health check + // with, what zone it resides in, etc.). + // 2. In response to (1), the management server designates this Envoy as a + // healthchecker to health check a subset of all upstream hosts for a given + // cluster (for example upstream Host 1 and Host 2). It streams + // HealthCheckSpecifier messages with cluster related configuration for all + // clusters this Envoy is designated to health check. Subsequent + // HealthCheckSpecifier message will be sent on changes to: + // a. Endpoints to health checks + // b. Per cluster configuration change + // 3. Envoy creates a health probe based on the HealthCheck config and sends + // it to endpoint(ip:port) of Host 1 and 2. Based on the HealthCheck + // configuration Envoy waits upon the arrival of the probe response and + // looks at the content of the response to decide whether the endpoint is + // healthy or not. If a response hasn’t been received within the timeout + // interval, the endpoint health status is considered TIMEOUT. + // 4. Envoy reports results back in an EndpointHealthResponse message. + // Envoy streams responses as often as the interval configured by the + // management server in HealthCheckSpecifier. + // 5. The management Server collects health statuses for all endpoints in the + // cluster (for all clusters) and uses this information to construct + // EndpointDiscoveryResponse messages. + // 6. Once Envoy has a list of upstream endpoints to send traffic to, it load + // balances traffic to them without additional health checking. It may + // use inline healthcheck (i.e. consider endpoint UNHEALTHY if connection + // failed to a particular endpoint to account for health status propagation + // delay between HDS and EDS). + // By default, can_healthcheck is true. If can_healthcheck is false, Cluster + // configuration may not contain HealthCheck message. + // TODO(htuch): How is can_healthcheck communicated to CDS to ensure the above + // invariant? + // TODO(htuch): Add @amb67's diagram. + StreamHealthCheck(ctx context.Context, opts ...grpc.CallOption) (HealthDiscoveryService_StreamHealthCheckClient, error) + // TODO(htuch): Unlike the gRPC version, there is no stream-based binding of + // request/response. Should we add an identifier to the HealthCheckSpecifier + // to bind with the response? + FetchHealthCheck(ctx context.Context, in *HealthCheckRequestOrEndpointHealthResponse, opts ...grpc.CallOption) (*HealthCheckSpecifier, error) +} + +type healthDiscoveryServiceClient struct { + cc *grpc.ClientConn +} + +func NewHealthDiscoveryServiceClient(cc *grpc.ClientConn) HealthDiscoveryServiceClient { + return &healthDiscoveryServiceClient{cc} +} + +func (c *healthDiscoveryServiceClient) StreamHealthCheck(ctx context.Context, opts ...grpc.CallOption) (HealthDiscoveryService_StreamHealthCheckClient, error) { + stream, err := c.cc.NewStream(ctx, &_HealthDiscoveryService_serviceDesc.Streams[0], "/envoy.service.discovery.v2.HealthDiscoveryService/StreamHealthCheck", opts...) + if err != nil { + return nil, err + } + x := &healthDiscoveryServiceStreamHealthCheckClient{stream} + return x, nil +} + +type HealthDiscoveryService_StreamHealthCheckClient interface { + Send(*HealthCheckRequestOrEndpointHealthResponse) error + Recv() (*HealthCheckSpecifier, error) + grpc.ClientStream +} + +type healthDiscoveryServiceStreamHealthCheckClient struct { + grpc.ClientStream +} + +func (x *healthDiscoveryServiceStreamHealthCheckClient) Send(m *HealthCheckRequestOrEndpointHealthResponse) error { + return x.ClientStream.SendMsg(m) +} + +func (x *healthDiscoveryServiceStreamHealthCheckClient) Recv() (*HealthCheckSpecifier, error) { + m := new(HealthCheckSpecifier) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *healthDiscoveryServiceClient) FetchHealthCheck(ctx context.Context, in *HealthCheckRequestOrEndpointHealthResponse, opts ...grpc.CallOption) (*HealthCheckSpecifier, error) { + out := new(HealthCheckSpecifier) + err := c.cc.Invoke(ctx, "/envoy.service.discovery.v2.HealthDiscoveryService/FetchHealthCheck", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// Server API for HealthDiscoveryService service + +type HealthDiscoveryServiceServer interface { + // 1. Envoy starts up and if its can_healthcheck option in the static + // bootstrap config is enabled, sends HealthCheckRequest to the management + // server. It supplies its capabilities (which protocol it can health check + // with, what zone it resides in, etc.). + // 2. In response to (1), the management server designates this Envoy as a + // healthchecker to health check a subset of all upstream hosts for a given + // cluster (for example upstream Host 1 and Host 2). It streams + // HealthCheckSpecifier messages with cluster related configuration for all + // clusters this Envoy is designated to health check. Subsequent + // HealthCheckSpecifier message will be sent on changes to: + // a. Endpoints to health checks + // b. Per cluster configuration change + // 3. Envoy creates a health probe based on the HealthCheck config and sends + // it to endpoint(ip:port) of Host 1 and 2. Based on the HealthCheck + // configuration Envoy waits upon the arrival of the probe response and + // looks at the content of the response to decide whether the endpoint is + // healthy or not. If a response hasn’t been received within the timeout + // interval, the endpoint health status is considered TIMEOUT. + // 4. Envoy reports results back in an EndpointHealthResponse message. + // Envoy streams responses as often as the interval configured by the + // management server in HealthCheckSpecifier. + // 5. The management Server collects health statuses for all endpoints in the + // cluster (for all clusters) and uses this information to construct + // EndpointDiscoveryResponse messages. + // 6. Once Envoy has a list of upstream endpoints to send traffic to, it load + // balances traffic to them without additional health checking. It may + // use inline healthcheck (i.e. consider endpoint UNHEALTHY if connection + // failed to a particular endpoint to account for health status propagation + // delay between HDS and EDS). + // By default, can_healthcheck is true. If can_healthcheck is false, Cluster + // configuration may not contain HealthCheck message. + // TODO(htuch): How is can_healthcheck communicated to CDS to ensure the above + // invariant? + // TODO(htuch): Add @amb67's diagram. + StreamHealthCheck(HealthDiscoveryService_StreamHealthCheckServer) error + // TODO(htuch): Unlike the gRPC version, there is no stream-based binding of + // request/response. Should we add an identifier to the HealthCheckSpecifier + // to bind with the response? + FetchHealthCheck(context.Context, *HealthCheckRequestOrEndpointHealthResponse) (*HealthCheckSpecifier, error) +} + +func RegisterHealthDiscoveryServiceServer(s *grpc.Server, srv HealthDiscoveryServiceServer) { + s.RegisterService(&_HealthDiscoveryService_serviceDesc, srv) +} + +func _HealthDiscoveryService_StreamHealthCheck_Handler(srv interface{}, stream grpc.ServerStream) error { + return srv.(HealthDiscoveryServiceServer).StreamHealthCheck(&healthDiscoveryServiceStreamHealthCheckServer{stream}) +} + +type HealthDiscoveryService_StreamHealthCheckServer interface { + Send(*HealthCheckSpecifier) error + Recv() (*HealthCheckRequestOrEndpointHealthResponse, error) + grpc.ServerStream +} + +type healthDiscoveryServiceStreamHealthCheckServer struct { + grpc.ServerStream +} + +func (x *healthDiscoveryServiceStreamHealthCheckServer) Send(m *HealthCheckSpecifier) error { + return x.ServerStream.SendMsg(m) +} + +func (x *healthDiscoveryServiceStreamHealthCheckServer) Recv() (*HealthCheckRequestOrEndpointHealthResponse, error) { + m := new(HealthCheckRequestOrEndpointHealthResponse) + if err := x.ServerStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func _HealthDiscoveryService_FetchHealthCheck_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(HealthCheckRequestOrEndpointHealthResponse) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(HealthDiscoveryServiceServer).FetchHealthCheck(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/envoy.service.discovery.v2.HealthDiscoveryService/FetchHealthCheck", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(HealthDiscoveryServiceServer).FetchHealthCheck(ctx, req.(*HealthCheckRequestOrEndpointHealthResponse)) + } + return interceptor(ctx, in, info, handler) +} + +var _HealthDiscoveryService_serviceDesc = grpc.ServiceDesc{ + ServiceName: "envoy.service.discovery.v2.HealthDiscoveryService", + HandlerType: (*HealthDiscoveryServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "FetchHealthCheck", + Handler: _HealthDiscoveryService_FetchHealthCheck_Handler, + }, + }, + Streams: []grpc.StreamDesc{ + { + StreamName: "StreamHealthCheck", + Handler: _HealthDiscoveryService_StreamHealthCheck_Handler, + ServerStreams: true, + ClientStreams: true, + }, + }, + Metadata: "envoy/service/discovery/v2/hds.proto", +} + +func (m *Capability) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Capability) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.HealthCheckProtocols) > 0 { + dAtA2 := make([]byte, len(m.HealthCheckProtocols)*10) + var j1 int + for _, num := range m.HealthCheckProtocols { + for num >= 1<<7 { + dAtA2[j1] = uint8(uint64(num)&0x7f | 0x80) + num >>= 7 + j1++ + } + dAtA2[j1] = uint8(num) + j1++ + } + dAtA[i] = 0xa + i++ + i = encodeVarintHds(dAtA, i, uint64(j1)) + i += copy(dAtA[i:], dAtA2[:j1]) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *HealthCheckRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *HealthCheckRequest) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Node != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintHds(dAtA, i, uint64(m.Node.Size())) + n3, err := m.Node.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n3 + } + if m.Capability != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintHds(dAtA, i, uint64(m.Capability.Size())) + n4, err := m.Capability.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n4 + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *EndpointHealth) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *EndpointHealth) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Endpoint != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintHds(dAtA, i, uint64(m.Endpoint.Size())) + n5, err := m.Endpoint.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n5 + } + if m.HealthStatus != 0 { + dAtA[i] = 0x10 + i++ + i = encodeVarintHds(dAtA, i, uint64(m.HealthStatus)) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *EndpointHealthResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *EndpointHealthResponse) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.EndpointsHealth) > 0 { + for _, msg := range m.EndpointsHealth { + dAtA[i] = 0xa + i++ + i = encodeVarintHds(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *HealthCheckRequestOrEndpointHealthResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *HealthCheckRequestOrEndpointHealthResponse) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.RequestType != nil { + nn6, err := m.RequestType.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += nn6 + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *HealthCheckRequestOrEndpointHealthResponse_HealthCheckRequest) MarshalTo(dAtA []byte) (int, error) { + i := 0 + if m.HealthCheckRequest != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintHds(dAtA, i, uint64(m.HealthCheckRequest.Size())) + n7, err := m.HealthCheckRequest.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n7 + } + return i, nil +} +func (m *HealthCheckRequestOrEndpointHealthResponse_EndpointHealthResponse) MarshalTo(dAtA []byte) (int, error) { + i := 0 + if m.EndpointHealthResponse != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintHds(dAtA, i, uint64(m.EndpointHealthResponse.Size())) + n8, err := m.EndpointHealthResponse.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n8 + } + return i, nil +} +func (m *LocalityEndpoints) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *LocalityEndpoints) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Locality != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintHds(dAtA, i, uint64(m.Locality.Size())) + n9, err := m.Locality.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n9 + } + if len(m.Endpoints) > 0 { + for _, msg := range m.Endpoints { + dAtA[i] = 0x12 + i++ + i = encodeVarintHds(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *ClusterHealthCheck) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ClusterHealthCheck) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.ClusterName) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintHds(dAtA, i, uint64(len(m.ClusterName))) + i += copy(dAtA[i:], m.ClusterName) + } + if len(m.HealthChecks) > 0 { + for _, msg := range m.HealthChecks { + dAtA[i] = 0x12 + i++ + i = encodeVarintHds(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if len(m.LocalityEndpoints) > 0 { + for _, msg := range m.LocalityEndpoints { + dAtA[i] = 0x1a + i++ + i = encodeVarintHds(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *HealthCheckSpecifier) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *HealthCheckSpecifier) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.ClusterHealthChecks) > 0 { + for _, msg := range m.ClusterHealthChecks { + dAtA[i] = 0xa + i++ + i = encodeVarintHds(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if m.Interval != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintHds(dAtA, i, uint64(m.Interval.Size())) + n10, err := m.Interval.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n10 + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func encodeVarintHds(dAtA []byte, offset int, v uint64) int { + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return offset + 1 +} +func (m *Capability) Size() (n int) { + var l int + _ = l + if len(m.HealthCheckProtocols) > 0 { + l = 0 + for _, e := range m.HealthCheckProtocols { + l += sovHds(uint64(e)) + } + n += 1 + sovHds(uint64(l)) + l + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *HealthCheckRequest) Size() (n int) { + var l int + _ = l + if m.Node != nil { + l = m.Node.Size() + n += 1 + l + sovHds(uint64(l)) + } + if m.Capability != nil { + l = m.Capability.Size() + n += 1 + l + sovHds(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *EndpointHealth) Size() (n int) { + var l int + _ = l + if m.Endpoint != nil { + l = m.Endpoint.Size() + n += 1 + l + sovHds(uint64(l)) + } + if m.HealthStatus != 0 { + n += 1 + sovHds(uint64(m.HealthStatus)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *EndpointHealthResponse) Size() (n int) { + var l int + _ = l + if len(m.EndpointsHealth) > 0 { + for _, e := range m.EndpointsHealth { + l = e.Size() + n += 1 + l + sovHds(uint64(l)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *HealthCheckRequestOrEndpointHealthResponse) Size() (n int) { + var l int + _ = l + if m.RequestType != nil { + n += m.RequestType.Size() + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *HealthCheckRequestOrEndpointHealthResponse_HealthCheckRequest) Size() (n int) { + var l int + _ = l + if m.HealthCheckRequest != nil { + l = m.HealthCheckRequest.Size() + n += 1 + l + sovHds(uint64(l)) + } + return n +} +func (m *HealthCheckRequestOrEndpointHealthResponse_EndpointHealthResponse) Size() (n int) { + var l int + _ = l + if m.EndpointHealthResponse != nil { + l = m.EndpointHealthResponse.Size() + n += 1 + l + sovHds(uint64(l)) + } + return n +} +func (m *LocalityEndpoints) Size() (n int) { + var l int + _ = l + if m.Locality != nil { + l = m.Locality.Size() + n += 1 + l + sovHds(uint64(l)) + } + if len(m.Endpoints) > 0 { + for _, e := range m.Endpoints { + l = e.Size() + n += 1 + l + sovHds(uint64(l)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *ClusterHealthCheck) Size() (n int) { + var l int + _ = l + l = len(m.ClusterName) + if l > 0 { + n += 1 + l + sovHds(uint64(l)) + } + if len(m.HealthChecks) > 0 { + for _, e := range m.HealthChecks { + l = e.Size() + n += 1 + l + sovHds(uint64(l)) + } + } + if len(m.LocalityEndpoints) > 0 { + for _, e := range m.LocalityEndpoints { + l = e.Size() + n += 1 + l + sovHds(uint64(l)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *HealthCheckSpecifier) Size() (n int) { + var l int + _ = l + if len(m.ClusterHealthChecks) > 0 { + for _, e := range m.ClusterHealthChecks { + l = e.Size() + n += 1 + l + sovHds(uint64(l)) + } + } + if m.Interval != nil { + l = m.Interval.Size() + n += 1 + l + sovHds(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func sovHds(x uint64) (n int) { + for { + n++ + x >>= 7 + if x == 0 { + break + } + } + return n +} +func sozHds(x uint64) (n int) { + return sovHds(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Capability) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Capability: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Capability: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType == 0 { + var v Capability_Protocol + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (Capability_Protocol(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.HealthCheckProtocols = append(m.HealthCheckProtocols, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLengthHds + } + postIndex := iNdEx + packedLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + for iNdEx < postIndex { + var v Capability_Protocol + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (Capability_Protocol(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.HealthCheckProtocols = append(m.HealthCheckProtocols, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field HealthCheckProtocols", wireType) + } + default: + iNdEx = preIndex + skippy, err := skipHds(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthHds + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *HealthCheckRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: HealthCheckRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: HealthCheckRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Node", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthHds + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Node == nil { + m.Node = &core.Node{} + } + if err := m.Node.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Capability", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthHds + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Capability == nil { + m.Capability = &Capability{} + } + if err := m.Capability.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipHds(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthHds + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *EndpointHealth) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: EndpointHealth: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EndpointHealth: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Endpoint", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthHds + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Endpoint == nil { + m.Endpoint = &endpoint.Endpoint{} + } + if err := m.Endpoint.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field HealthStatus", wireType) + } + m.HealthStatus = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.HealthStatus |= (core.HealthStatus(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipHds(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthHds + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *EndpointHealthResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: EndpointHealthResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EndpointHealthResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field EndpointsHealth", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthHds + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.EndpointsHealth = append(m.EndpointsHealth, &EndpointHealth{}) + if err := m.EndpointsHealth[len(m.EndpointsHealth)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipHds(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthHds + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *HealthCheckRequestOrEndpointHealthResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: HealthCheckRequestOrEndpointHealthResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: HealthCheckRequestOrEndpointHealthResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field HealthCheckRequest", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthHds + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &HealthCheckRequest{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.RequestType = &HealthCheckRequestOrEndpointHealthResponse_HealthCheckRequest{v} + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field EndpointHealthResponse", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthHds + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &EndpointHealthResponse{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.RequestType = &HealthCheckRequestOrEndpointHealthResponse_EndpointHealthResponse{v} + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipHds(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthHds + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *LocalityEndpoints) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: LocalityEndpoints: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: LocalityEndpoints: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Locality", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthHds + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Locality == nil { + m.Locality = &core.Locality{} + } + if err := m.Locality.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Endpoints", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthHds + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Endpoints = append(m.Endpoints, &endpoint.Endpoint{}) + if err := m.Endpoints[len(m.Endpoints)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipHds(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthHds + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ClusterHealthCheck) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ClusterHealthCheck: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ClusterHealthCheck: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ClusterName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthHds + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ClusterName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field HealthChecks", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthHds + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.HealthChecks = append(m.HealthChecks, &core.HealthCheck{}) + if err := m.HealthChecks[len(m.HealthChecks)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LocalityEndpoints", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthHds + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.LocalityEndpoints = append(m.LocalityEndpoints, &LocalityEndpoints{}) + if err := m.LocalityEndpoints[len(m.LocalityEndpoints)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipHds(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthHds + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *HealthCheckSpecifier) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: HealthCheckSpecifier: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: HealthCheckSpecifier: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ClusterHealthChecks", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthHds + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ClusterHealthChecks = append(m.ClusterHealthChecks, &ClusterHealthCheck{}) + if err := m.ClusterHealthChecks[len(m.ClusterHealthChecks)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Interval", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthHds + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Interval == nil { + m.Interval = &types.Duration{} + } + if err := m.Interval.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipHds(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthHds + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipHds(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowHds + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowHds + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + return iNdEx, nil + case 1: + iNdEx += 8 + return iNdEx, nil + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowHds + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + iNdEx += length + if length < 0 { + return 0, ErrInvalidLengthHds + } + return iNdEx, nil + case 3: + for { + var innerWire uint64 + var start int = iNdEx + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowHds + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + innerWire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + innerWireType := int(innerWire & 0x7) + if innerWireType == 4 { + break + } + next, err := skipHds(dAtA[start:]) + if err != nil { + return 0, err + } + iNdEx = start + next + } + return iNdEx, nil + case 4: + return iNdEx, nil + case 5: + iNdEx += 4 + return iNdEx, nil + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + } + panic("unreachable") +} + +var ( + ErrInvalidLengthHds = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowHds = fmt.Errorf("proto: integer overflow") +) + +func init() { + proto.RegisterFile("envoy/service/discovery/v2/hds.proto", fileDescriptor_hds_1203598eb36a833b) +} + +var fileDescriptor_hds_1203598eb36a833b = []byte{ + // 746 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x55, 0x41, 0x6f, 0xd3, 0x4a, + 0x10, 0xce, 0xa6, 0x7d, 0xef, 0xa5, 0xd3, 0xbc, 0x34, 0x5d, 0x4a, 0x08, 0xa1, 0x4a, 0x8b, 0x55, + 0x50, 0x54, 0x84, 0x53, 0x05, 0x21, 0xa4, 0x22, 0x2e, 0x4d, 0x5a, 0x05, 0x09, 0x95, 0x6a, 0x53, + 0x6e, 0x48, 0x91, 0xe3, 0x6c, 0x1b, 0x0b, 0xd7, 0x6b, 0xbc, 0x9b, 0x48, 0xb9, 0x72, 0x02, 0x71, + 0x41, 0xea, 0x99, 0x1f, 0x81, 0xf8, 0x13, 0x1c, 0x91, 0xb8, 0x71, 0x42, 0x55, 0x7f, 0x08, 0xca, + 0xee, 0xda, 0x71, 0xea, 0x26, 0xb4, 0x37, 0x6e, 0xf1, 0xec, 0x37, 0x33, 0xdf, 0x37, 0xdf, 0xec, + 0x06, 0x36, 0xa8, 0x37, 0x60, 0xc3, 0x2a, 0xa7, 0xc1, 0xc0, 0xb1, 0x69, 0xb5, 0xeb, 0x70, 0x9b, + 0x0d, 0x68, 0x30, 0xac, 0x0e, 0x6a, 0xd5, 0x5e, 0x97, 0x9b, 0x7e, 0xc0, 0x04, 0xc3, 0x25, 0x89, + 0x32, 0x35, 0xca, 0x8c, 0x50, 0xe6, 0xa0, 0x56, 0x5a, 0x55, 0x15, 0x2c, 0xdf, 0x19, 0xe5, 0xd8, + 0x2c, 0xa0, 0xd5, 0x8e, 0xc5, 0xa9, 0xca, 0x2c, 0x6d, 0x24, 0x4f, 0x7b, 0xd4, 0x72, 0x45, 0xaf, + 0x6d, 0xf7, 0xa8, 0xfd, 0xe6, 0x52, 0x14, 0xf5, 0xba, 0x3e, 0x73, 0x3c, 0x11, 0xfd, 0xd0, 0xa8, + 0xd5, 0x63, 0xc6, 0x8e, 0x5d, 0x2a, 0x61, 0x96, 0xe7, 0x31, 0x61, 0x09, 0x87, 0x79, 0x9a, 0x63, + 0xa9, 0xac, 0x4f, 0xe5, 0x57, 0xa7, 0x7f, 0x54, 0xed, 0xf6, 0x03, 0x09, 0x50, 0xe7, 0xc6, 0x67, + 0x04, 0x50, 0xb7, 0x7c, 0xab, 0xe3, 0xb8, 0x8e, 0x18, 0x62, 0x0a, 0x85, 0x38, 0x91, 0xb6, 0x04, + 0xd9, 0xcc, 0xe5, 0x45, 0xb4, 0x3e, 0x57, 0xc9, 0xd5, 0xaa, 0xe6, 0x74, 0xcd, 0xe6, 0xb8, 0x8e, + 0x79, 0xa0, 0xf3, 0xc8, 0x8a, 0x2a, 0x57, 0x1f, 0x55, 0x0b, 0x83, 0xdc, 0xa8, 0x40, 0x26, 0xfc, + 0xc0, 0x19, 0x98, 0x6f, 0x1e, 0x1e, 0x1e, 0xe4, 0x53, 0xf8, 0x3f, 0x98, 0x3b, 0xac, 0x1f, 0xe4, + 0x11, 0x5e, 0x80, 0x7f, 0xc8, 0x6e, 0xe3, 0x79, 0x2b, 0x9f, 0x36, 0x3e, 0x20, 0xc0, 0xcd, 0x71, + 0x09, 0x42, 0xdf, 0xf6, 0x29, 0x17, 0xf8, 0x01, 0xcc, 0x7b, 0xac, 0x4b, 0x8b, 0x68, 0x1d, 0x55, + 0x16, 0x6b, 0xb7, 0x34, 0x2b, 0xcb, 0x77, 0x46, 0x3c, 0x46, 0xf3, 0x34, 0xf7, 0x59, 0x97, 0x12, + 0x09, 0xc2, 0x7b, 0x00, 0x76, 0x44, 0xad, 0x98, 0x96, 0x29, 0xf7, 0xaf, 0x26, 0x84, 0xc4, 0x32, + 0x8d, 0x53, 0x04, 0xb9, 0x5d, 0x3d, 0x7c, 0xc5, 0x09, 0x3f, 0x85, 0x4c, 0x68, 0x87, 0xe6, 0xb2, + 0x36, 0xc9, 0x25, 0x32, 0x2b, 0x4c, 0x24, 0x51, 0x02, 0x6e, 0xc0, 0xff, 0x7a, 0xd8, 0x5c, 0x58, + 0xa2, 0xcf, 0x25, 0xb5, 0xdc, 0xc5, 0x0a, 0x52, 0x8d, 0x6a, 0xd7, 0x92, 0x30, 0x92, 0xed, 0xc5, + 0xbe, 0x0c, 0x06, 0x85, 0x49, 0x52, 0x84, 0x72, 0x9f, 0x79, 0x9c, 0xe2, 0x57, 0x90, 0x0f, 0x7b, + 0xf1, 0xb6, 0xca, 0x91, 0x36, 0x2e, 0xd6, 0x36, 0x67, 0xa9, 0xbf, 0x50, 0x6d, 0x29, 0xaa, 0xa1, + 0x02, 0xc6, 0xa7, 0x34, 0x6c, 0x26, 0x2d, 0x79, 0x19, 0x4c, 0x61, 0xd1, 0x81, 0x95, 0x89, 0x95, + 0x0a, 0x14, 0x5e, 0x8f, 0xcb, 0x9c, 0xc5, 0x24, 0xd9, 0xa5, 0x99, 0x22, 0xb8, 0x97, 0x5c, 0x07, + 0x0f, 0x8a, 0x21, 0x4b, 0x2d, 0xb4, 0x1d, 0xe8, 0xfe, 0xda, 0xef, 0xda, 0x35, 0x14, 0xeb, 0xcc, + 0x66, 0x8a, 0x14, 0xe8, 0xa5, 0x27, 0x3b, 0x39, 0xc8, 0x6a, 0x19, 0x6d, 0x31, 0xf4, 0xa9, 0xf1, + 0x11, 0xc1, 0xf2, 0x0b, 0x66, 0x5b, 0xa3, 0x35, 0x09, 0x8b, 0x71, 0xfc, 0x04, 0x32, 0xae, 0x0e, + 0x6a, 0xb5, 0x77, 0x2e, 0xb1, 0x36, 0xcc, 0x23, 0x11, 0x18, 0x3f, 0x83, 0x85, 0x68, 0xe8, 0xc5, + 0xb4, 0x74, 0xec, 0x8f, 0x6b, 0x35, 0xce, 0x30, 0x7e, 0x22, 0xc0, 0x75, 0xb7, 0xcf, 0x05, 0x0d, + 0x62, 0x13, 0xc4, 0x77, 0x21, 0x6b, 0xab, 0x68, 0xdb, 0xb3, 0x4e, 0xd4, 0xdd, 0x59, 0x20, 0x8b, + 0x3a, 0xb6, 0x6f, 0x9d, 0x50, 0x5c, 0x8f, 0x36, 0x52, 0x7a, 0x15, 0x36, 0x2f, 0x4f, 0xdd, 0x48, + 0xe5, 0x42, 0x36, 0x66, 0x09, 0xc7, 0xaf, 0x01, 0x87, 0x4a, 0xda, 0x63, 0x19, 0x73, 0xb2, 0xd2, + 0xc3, 0x59, 0x36, 0x24, 0x26, 0x48, 0x96, 0xdd, 0x8b, 0x21, 0xe3, 0x0b, 0x82, 0x95, 0x58, 0xef, + 0x96, 0x4f, 0x6d, 0xe7, 0xc8, 0xa1, 0x01, 0xee, 0xc0, 0xcd, 0x50, 0xde, 0xa4, 0x06, 0xb5, 0xf2, + 0x33, 0x17, 0x2d, 0x39, 0x2d, 0x72, 0xc3, 0x4e, 0xc4, 0x38, 0x7e, 0x0c, 0x19, 0xc7, 0x13, 0x34, + 0x18, 0x58, 0xae, 0xde, 0xab, 0xdb, 0xa6, 0x7a, 0x60, 0xcd, 0xf0, 0x81, 0x35, 0x1b, 0xfa, 0x81, + 0x25, 0x11, 0xb4, 0x76, 0x9e, 0x86, 0x82, 0xaa, 0xd3, 0x08, 0xbb, 0xb6, 0x14, 0x0d, 0x7c, 0x8a, + 0x60, 0xb9, 0x25, 0x02, 0x6a, 0x9d, 0xc4, 0xad, 0xda, 0xbb, 0xde, 0xad, 0x98, 0x76, 0xf7, 0x4a, + 0x5b, 0x57, 0xac, 0x13, 0x4d, 0xd1, 0x48, 0x55, 0xd0, 0x16, 0xc2, 0x5f, 0x11, 0xe4, 0xf7, 0xa8, + 0xb0, 0x7b, 0x7f, 0x07, 0xa9, 0x7b, 0xef, 0x7e, 0x9c, 0x9f, 0xa6, 0xd7, 0x8c, 0xd2, 0xe8, 0x7f, + 0x30, 0x82, 0x6f, 0xc7, 0x6d, 0xde, 0x46, 0x9b, 0x3b, 0x4b, 0xdf, 0xce, 0xca, 0xe8, 0xfb, 0x59, + 0x19, 0xfd, 0x3a, 0x2b, 0xa3, 0xf7, 0x08, 0x75, 0xfe, 0x95, 0xa6, 0x3c, 0xfa, 0x1d, 0x00, 0x00, + 0xff, 0xff, 0x2d, 0x5f, 0x47, 0x93, 0xcf, 0x07, 0x00, 0x00, +} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/service/discovery/v2/hds.pb.validate.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/service/discovery/v2/hds.pb.validate.go new file mode 100644 index 000000000000..8d5111c8246c --- /dev/null +++ b/vendor/github.com/envoyproxy/go-control-plane/envoy/service/discovery/v2/hds.pb.validate.go @@ -0,0 +1,528 @@ +// Code generated by protoc-gen-validate +// source: envoy/service/discovery/v2/hds.proto +// DO NOT EDIT!!! + +package v2 + +import ( + "bytes" + "errors" + "fmt" + "net" + "net/mail" + "net/url" + "regexp" + "strings" + "time" + "unicode/utf8" + + "github.com/gogo/protobuf/types" +) + +// ensure the imports are used +var ( + _ = bytes.MinRead + _ = errors.New("") + _ = fmt.Print + _ = utf8.UTFMax + _ = (*regexp.Regexp)(nil) + _ = (*strings.Reader)(nil) + _ = net.IPv4len + _ = time.Duration(0) + _ = (*url.URL)(nil) + _ = (*mail.Address)(nil) + _ = types.DynamicAny{} +) + +// Validate checks the field values on Capability with the rules defined in the +// proto definition for this message. If any rules are violated, an error is returned. +func (m *Capability) Validate() error { + if m == nil { + return nil + } + + return nil +} + +// CapabilityValidationError is the validation error returned by +// Capability.Validate if the designated constraints aren't met. +type CapabilityValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e CapabilityValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sCapability.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = CapabilityValidationError{} + +// Validate checks the field values on HealthCheckRequest with the rules +// defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *HealthCheckRequest) Validate() error { + if m == nil { + return nil + } + + if v, ok := interface{}(m.GetNode()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return HealthCheckRequestValidationError{ + Field: "Node", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + if v, ok := interface{}(m.GetCapability()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return HealthCheckRequestValidationError{ + Field: "Capability", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + return nil +} + +// HealthCheckRequestValidationError is the validation error returned by +// HealthCheckRequest.Validate if the designated constraints aren't met. +type HealthCheckRequestValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e HealthCheckRequestValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sHealthCheckRequest.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = HealthCheckRequestValidationError{} + +// Validate checks the field values on EndpointHealth with the rules defined in +// the proto definition for this message. If any rules are violated, an error +// is returned. +func (m *EndpointHealth) Validate() error { + if m == nil { + return nil + } + + if v, ok := interface{}(m.GetEndpoint()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return EndpointHealthValidationError{ + Field: "Endpoint", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + // no validation rules for HealthStatus + + return nil +} + +// EndpointHealthValidationError is the validation error returned by +// EndpointHealth.Validate if the designated constraints aren't met. +type EndpointHealthValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e EndpointHealthValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sEndpointHealth.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = EndpointHealthValidationError{} + +// Validate checks the field values on EndpointHealthResponse with the rules +// defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *EndpointHealthResponse) Validate() error { + if m == nil { + return nil + } + + for idx, item := range m.GetEndpointsHealth() { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return EndpointHealthResponseValidationError{ + Field: fmt.Sprintf("EndpointsHealth[%v]", idx), + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + } + + return nil +} + +// EndpointHealthResponseValidationError is the validation error returned by +// EndpointHealthResponse.Validate if the designated constraints aren't met. +type EndpointHealthResponseValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e EndpointHealthResponseValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sEndpointHealthResponse.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = EndpointHealthResponseValidationError{} + +// Validate checks the field values on +// HealthCheckRequestOrEndpointHealthResponse with the rules defined in the +// proto definition for this message. If any rules are violated, an error is returned. +func (m *HealthCheckRequestOrEndpointHealthResponse) Validate() error { + if m == nil { + return nil + } + + switch m.RequestType.(type) { + + case *HealthCheckRequestOrEndpointHealthResponse_HealthCheckRequest: + + if v, ok := interface{}(m.GetHealthCheckRequest()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return HealthCheckRequestOrEndpointHealthResponseValidationError{ + Field: "HealthCheckRequest", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + case *HealthCheckRequestOrEndpointHealthResponse_EndpointHealthResponse: + + if v, ok := interface{}(m.GetEndpointHealthResponse()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return HealthCheckRequestOrEndpointHealthResponseValidationError{ + Field: "EndpointHealthResponse", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + } + + return nil +} + +// HealthCheckRequestOrEndpointHealthResponseValidationError is the validation +// error returned by HealthCheckRequestOrEndpointHealthResponse.Validate if +// the designated constraints aren't met. +type HealthCheckRequestOrEndpointHealthResponseValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e HealthCheckRequestOrEndpointHealthResponseValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sHealthCheckRequestOrEndpointHealthResponse.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = HealthCheckRequestOrEndpointHealthResponseValidationError{} + +// Validate checks the field values on LocalityEndpoints with the rules defined +// in the proto definition for this message. If any rules are violated, an +// error is returned. +func (m *LocalityEndpoints) Validate() error { + if m == nil { + return nil + } + + if v, ok := interface{}(m.GetLocality()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return LocalityEndpointsValidationError{ + Field: "Locality", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + for idx, item := range m.GetEndpoints() { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return LocalityEndpointsValidationError{ + Field: fmt.Sprintf("Endpoints[%v]", idx), + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + } + + return nil +} + +// LocalityEndpointsValidationError is the validation error returned by +// LocalityEndpoints.Validate if the designated constraints aren't met. +type LocalityEndpointsValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e LocalityEndpointsValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sLocalityEndpoints.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = LocalityEndpointsValidationError{} + +// Validate checks the field values on ClusterHealthCheck with the rules +// defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *ClusterHealthCheck) Validate() error { + if m == nil { + return nil + } + + // no validation rules for ClusterName + + for idx, item := range m.GetHealthChecks() { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return ClusterHealthCheckValidationError{ + Field: fmt.Sprintf("HealthChecks[%v]", idx), + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + } + + for idx, item := range m.GetLocalityEndpoints() { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return ClusterHealthCheckValidationError{ + Field: fmt.Sprintf("LocalityEndpoints[%v]", idx), + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + } + + return nil +} + +// ClusterHealthCheckValidationError is the validation error returned by +// ClusterHealthCheck.Validate if the designated constraints aren't met. +type ClusterHealthCheckValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e ClusterHealthCheckValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sClusterHealthCheck.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = ClusterHealthCheckValidationError{} + +// Validate checks the field values on HealthCheckSpecifier with the rules +// defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *HealthCheckSpecifier) Validate() error { + if m == nil { + return nil + } + + for idx, item := range m.GetClusterHealthChecks() { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return HealthCheckSpecifierValidationError{ + Field: fmt.Sprintf("ClusterHealthChecks[%v]", idx), + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + } + + if v, ok := interface{}(m.GetInterval()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return HealthCheckSpecifierValidationError{ + Field: "Interval", + Reason: "embedded message failed validation", + Cause: err, + } + } + } + + return nil +} + +// HealthCheckSpecifierValidationError is the validation error returned by +// HealthCheckSpecifier.Validate if the designated constraints aren't met. +type HealthCheckSpecifierValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e HealthCheckSpecifierValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sHealthCheckSpecifier.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = HealthCheckSpecifierValidationError{} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/service/discovery/v2/sds.pb.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/service/discovery/v2/sds.pb.go new file mode 100644 index 000000000000..1049caa8a2e9 --- /dev/null +++ b/vendor/github.com/envoyproxy/go-control-plane/envoy/service/discovery/v2/sds.pb.go @@ -0,0 +1,440 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: envoy/service/discovery/v2/sds.proto + +package v2 + +import proto "github.com/gogo/protobuf/proto" +import fmt "fmt" +import math "math" +import v2 "github.com/envoyproxy/go-control-plane/envoy/api/v2" +import _ "github.com/gogo/googleapis/google/api" + +import context "golang.org/x/net/context" +import grpc "google.golang.org/grpc" + +import io "io" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package + +// [#not-implemented-hide:] Not configuration. Workaround c++ protobuf issue with importing +// services: https://github.com/google/protobuf/issues/4221 +type SdsDummy struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SdsDummy) Reset() { *m = SdsDummy{} } +func (m *SdsDummy) String() string { return proto.CompactTextString(m) } +func (*SdsDummy) ProtoMessage() {} +func (*SdsDummy) Descriptor() ([]byte, []int) { + return fileDescriptor_sds_5335c571b383ba10, []int{0} +} +func (m *SdsDummy) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *SdsDummy) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_SdsDummy.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *SdsDummy) XXX_Merge(src proto.Message) { + xxx_messageInfo_SdsDummy.Merge(dst, src) +} +func (m *SdsDummy) XXX_Size() int { + return m.Size() +} +func (m *SdsDummy) XXX_DiscardUnknown() { + xxx_messageInfo_SdsDummy.DiscardUnknown(m) +} + +var xxx_messageInfo_SdsDummy proto.InternalMessageInfo + +func init() { + proto.RegisterType((*SdsDummy)(nil), "envoy.service.discovery.v2.SdsDummy") +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// Client API for SecretDiscoveryService service + +type SecretDiscoveryServiceClient interface { + StreamSecrets(ctx context.Context, opts ...grpc.CallOption) (SecretDiscoveryService_StreamSecretsClient, error) + FetchSecrets(ctx context.Context, in *v2.DiscoveryRequest, opts ...grpc.CallOption) (*v2.DiscoveryResponse, error) +} + +type secretDiscoveryServiceClient struct { + cc *grpc.ClientConn +} + +func NewSecretDiscoveryServiceClient(cc *grpc.ClientConn) SecretDiscoveryServiceClient { + return &secretDiscoveryServiceClient{cc} +} + +func (c *secretDiscoveryServiceClient) StreamSecrets(ctx context.Context, opts ...grpc.CallOption) (SecretDiscoveryService_StreamSecretsClient, error) { + stream, err := c.cc.NewStream(ctx, &_SecretDiscoveryService_serviceDesc.Streams[0], "/envoy.service.discovery.v2.SecretDiscoveryService/StreamSecrets", opts...) + if err != nil { + return nil, err + } + x := &secretDiscoveryServiceStreamSecretsClient{stream} + return x, nil +} + +type SecretDiscoveryService_StreamSecretsClient interface { + Send(*v2.DiscoveryRequest) error + Recv() (*v2.DiscoveryResponse, error) + grpc.ClientStream +} + +type secretDiscoveryServiceStreamSecretsClient struct { + grpc.ClientStream +} + +func (x *secretDiscoveryServiceStreamSecretsClient) Send(m *v2.DiscoveryRequest) error { + return x.ClientStream.SendMsg(m) +} + +func (x *secretDiscoveryServiceStreamSecretsClient) Recv() (*v2.DiscoveryResponse, error) { + m := new(v2.DiscoveryResponse) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *secretDiscoveryServiceClient) FetchSecrets(ctx context.Context, in *v2.DiscoveryRequest, opts ...grpc.CallOption) (*v2.DiscoveryResponse, error) { + out := new(v2.DiscoveryResponse) + err := c.cc.Invoke(ctx, "/envoy.service.discovery.v2.SecretDiscoveryService/FetchSecrets", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// Server API for SecretDiscoveryService service + +type SecretDiscoveryServiceServer interface { + StreamSecrets(SecretDiscoveryService_StreamSecretsServer) error + FetchSecrets(context.Context, *v2.DiscoveryRequest) (*v2.DiscoveryResponse, error) +} + +func RegisterSecretDiscoveryServiceServer(s *grpc.Server, srv SecretDiscoveryServiceServer) { + s.RegisterService(&_SecretDiscoveryService_serviceDesc, srv) +} + +func _SecretDiscoveryService_StreamSecrets_Handler(srv interface{}, stream grpc.ServerStream) error { + return srv.(SecretDiscoveryServiceServer).StreamSecrets(&secretDiscoveryServiceStreamSecretsServer{stream}) +} + +type SecretDiscoveryService_StreamSecretsServer interface { + Send(*v2.DiscoveryResponse) error + Recv() (*v2.DiscoveryRequest, error) + grpc.ServerStream +} + +type secretDiscoveryServiceStreamSecretsServer struct { + grpc.ServerStream +} + +func (x *secretDiscoveryServiceStreamSecretsServer) Send(m *v2.DiscoveryResponse) error { + return x.ServerStream.SendMsg(m) +} + +func (x *secretDiscoveryServiceStreamSecretsServer) Recv() (*v2.DiscoveryRequest, error) { + m := new(v2.DiscoveryRequest) + if err := x.ServerStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func _SecretDiscoveryService_FetchSecrets_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(v2.DiscoveryRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SecretDiscoveryServiceServer).FetchSecrets(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/envoy.service.discovery.v2.SecretDiscoveryService/FetchSecrets", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SecretDiscoveryServiceServer).FetchSecrets(ctx, req.(*v2.DiscoveryRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _SecretDiscoveryService_serviceDesc = grpc.ServiceDesc{ + ServiceName: "envoy.service.discovery.v2.SecretDiscoveryService", + HandlerType: (*SecretDiscoveryServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "FetchSecrets", + Handler: _SecretDiscoveryService_FetchSecrets_Handler, + }, + }, + Streams: []grpc.StreamDesc{ + { + StreamName: "StreamSecrets", + Handler: _SecretDiscoveryService_StreamSecrets_Handler, + ServerStreams: true, + ClientStreams: true, + }, + }, + Metadata: "envoy/service/discovery/v2/sds.proto", +} + +func (m *SdsDummy) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *SdsDummy) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func encodeVarintSds(dAtA []byte, offset int, v uint64) int { + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return offset + 1 +} +func (m *SdsDummy) Size() (n int) { + var l int + _ = l + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func sovSds(x uint64) (n int) { + for { + n++ + x >>= 7 + if x == 0 { + break + } + } + return n +} +func sozSds(x uint64) (n int) { + return sovSds(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *SdsDummy) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: SdsDummy: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SdsDummy: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipSds(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthSds + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipSds(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowSds + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowSds + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + return iNdEx, nil + case 1: + iNdEx += 8 + return iNdEx, nil + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowSds + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + iNdEx += length + if length < 0 { + return 0, ErrInvalidLengthSds + } + return iNdEx, nil + case 3: + for { + var innerWire uint64 + var start int = iNdEx + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowSds + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + innerWire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + innerWireType := int(innerWire & 0x7) + if innerWireType == 4 { + break + } + next, err := skipSds(dAtA[start:]) + if err != nil { + return 0, err + } + iNdEx = start + next + } + return iNdEx, nil + case 4: + return iNdEx, nil + case 5: + iNdEx += 4 + return iNdEx, nil + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + } + panic("unreachable") +} + +var ( + ErrInvalidLengthSds = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowSds = fmt.Errorf("proto: integer overflow") +) + +func init() { + proto.RegisterFile("envoy/service/discovery/v2/sds.proto", fileDescriptor_sds_5335c571b383ba10) +} + +var fileDescriptor_sds_5335c571b383ba10 = []byte{ + // 240 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x49, 0xcd, 0x2b, 0xcb, + 0xaf, 0xd4, 0x2f, 0x4e, 0x2d, 0x2a, 0xcb, 0x4c, 0x4e, 0xd5, 0x4f, 0xc9, 0x2c, 0x4e, 0xce, 0x2f, + 0x4b, 0x2d, 0xaa, 0xd4, 0x2f, 0x33, 0xd2, 0x2f, 0x4e, 0x29, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, + 0x17, 0x92, 0x02, 0xab, 0xd2, 0x83, 0xaa, 0xd2, 0x83, 0xab, 0xd2, 0x2b, 0x33, 0x92, 0x92, 0x81, + 0x98, 0x90, 0x58, 0x90, 0x09, 0xd2, 0x83, 0x90, 0x02, 0xeb, 0x94, 0x92, 0x49, 0xcf, 0xcf, 0x4f, + 0xcf, 0x49, 0x05, 0x4b, 0x27, 0xe6, 0xe5, 0xe5, 0x97, 0x24, 0x96, 0x64, 0xe6, 0xe7, 0x41, 0xcd, + 0x55, 0xe2, 0xe2, 0xe2, 0x08, 0x4e, 0x29, 0x76, 0x29, 0xcd, 0xcd, 0xad, 0x34, 0x7a, 0xcc, 0xc8, + 0x25, 0x16, 0x9c, 0x9a, 0x5c, 0x94, 0x5a, 0xe2, 0x02, 0x33, 0x23, 0x18, 0x62, 0x9f, 0x50, 0x18, + 0x17, 0x6f, 0x70, 0x49, 0x51, 0x6a, 0x62, 0x2e, 0x44, 0xbe, 0x58, 0x48, 0x4e, 0x0f, 0xe2, 0xa0, + 0xc4, 0x82, 0x4c, 0xbd, 0x32, 0x23, 0x3d, 0xb8, 0x86, 0xa0, 0xd4, 0xc2, 0xd2, 0xd4, 0xe2, 0x12, + 0x29, 0x79, 0x9c, 0xf2, 0xc5, 0x05, 0xf9, 0x79, 0xc5, 0xa9, 0x4a, 0x0c, 0x1a, 0x8c, 0x06, 0x8c, + 0x42, 0x85, 0x5c, 0x3c, 0x6e, 0xa9, 0x25, 0xc9, 0x19, 0x54, 0x33, 0x56, 0xa1, 0xe9, 0xf2, 0x93, + 0xc9, 0x4c, 0x52, 0x4a, 0xa2, 0x28, 0x41, 0x61, 0x55, 0x0c, 0x31, 0xdf, 0x8a, 0x51, 0xcb, 0x89, + 0xe7, 0xc4, 0x23, 0x39, 0xc6, 0x0b, 0x8f, 0xe4, 0x18, 0x1f, 0x3c, 0x92, 0x63, 0x4c, 0x62, 0x03, + 0x07, 0x83, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0x1a, 0x8c, 0xe4, 0x44, 0x86, 0x01, 0x00, 0x00, +} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/service/discovery/v2/sds.pb.validate.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/service/discovery/v2/sds.pb.validate.go new file mode 100644 index 000000000000..3aab8d5a9b47 --- /dev/null +++ b/vendor/github.com/envoyproxy/go-control-plane/envoy/service/discovery/v2/sds.pb.validate.go @@ -0,0 +1,76 @@ +// Code generated by protoc-gen-validate +// source: envoy/service/discovery/v2/sds.proto +// DO NOT EDIT!!! + +package v2 + +import ( + "bytes" + "errors" + "fmt" + "net" + "net/mail" + "net/url" + "regexp" + "strings" + "time" + "unicode/utf8" + + "github.com/gogo/protobuf/types" +) + +// ensure the imports are used +var ( + _ = bytes.MinRead + _ = errors.New("") + _ = fmt.Print + _ = utf8.UTFMax + _ = (*regexp.Regexp)(nil) + _ = (*strings.Reader)(nil) + _ = net.IPv4len + _ = time.Duration(0) + _ = (*url.URL)(nil) + _ = (*mail.Address)(nil) + _ = types.DynamicAny{} +) + +// Validate checks the field values on SdsDummy with the rules defined in the +// proto definition for this message. If any rules are violated, an error is returned. +func (m *SdsDummy) Validate() error { + if m == nil { + return nil + } + + return nil +} + +// SdsDummyValidationError is the validation error returned by +// SdsDummy.Validate if the designated constraints aren't met. +type SdsDummyValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e SdsDummyValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sSdsDummy.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = SdsDummyValidationError{} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/type/http_status.pb.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/type/http_status.pb.go new file mode 100644 index 000000000000..fa944d459811 --- /dev/null +++ b/vendor/github.com/envoyproxy/go-control-plane/envoy/type/http_status.pb.go @@ -0,0 +1,567 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: envoy/type/http_status.proto + +package envoy_type + +import proto "github.com/gogo/protobuf/proto" +import fmt "fmt" +import math "math" +import _ "github.com/lyft/protoc-gen-validate/validate" + +import io "io" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package + +// HTTP response codes supported in Envoy. +// For more details: http://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml +type StatusCode int32 + +const ( + // Empty - This code not part of the HTTP status code specification, but it is needed for proto + // `enum` type. + StatusCode_Empty StatusCode = 0 + StatusCode_Continue StatusCode = 100 + StatusCode_OK StatusCode = 200 + StatusCode_Created StatusCode = 201 + StatusCode_Accepted StatusCode = 202 + StatusCode_NonAuthoritativeInformation StatusCode = 203 + StatusCode_NoContent StatusCode = 204 + StatusCode_ResetContent StatusCode = 205 + StatusCode_PartialContent StatusCode = 206 + StatusCode_MultiStatus StatusCode = 207 + StatusCode_AlreadyReported StatusCode = 208 + StatusCode_IMUsed StatusCode = 226 + StatusCode_MultipleChoices StatusCode = 300 + StatusCode_MovedPermanently StatusCode = 301 + StatusCode_Found StatusCode = 302 + StatusCode_SeeOther StatusCode = 303 + StatusCode_NotModified StatusCode = 304 + StatusCode_UseProxy StatusCode = 305 + StatusCode_TemporaryRedirect StatusCode = 307 + StatusCode_PermanentRedirect StatusCode = 308 + StatusCode_BadRequest StatusCode = 400 + StatusCode_Unauthorized StatusCode = 401 + StatusCode_PaymentRequired StatusCode = 402 + StatusCode_Forbidden StatusCode = 403 + StatusCode_NotFound StatusCode = 404 + StatusCode_MethodNotAllowed StatusCode = 405 + StatusCode_NotAcceptable StatusCode = 406 + StatusCode_ProxyAuthenticationRequired StatusCode = 407 + StatusCode_RequestTimeout StatusCode = 408 + StatusCode_Conflict StatusCode = 409 + StatusCode_Gone StatusCode = 410 + StatusCode_LengthRequired StatusCode = 411 + StatusCode_PreconditionFailed StatusCode = 412 + StatusCode_PayloadTooLarge StatusCode = 413 + StatusCode_URITooLong StatusCode = 414 + StatusCode_UnsupportedMediaType StatusCode = 415 + StatusCode_RangeNotSatisfiable StatusCode = 416 + StatusCode_ExpectationFailed StatusCode = 417 + StatusCode_MisdirectedRequest StatusCode = 421 + StatusCode_UnprocessableEntity StatusCode = 422 + StatusCode_Locked StatusCode = 423 + StatusCode_FailedDependency StatusCode = 424 + StatusCode_UpgradeRequired StatusCode = 426 + StatusCode_PreconditionRequired StatusCode = 428 + StatusCode_TooManyRequests StatusCode = 429 + StatusCode_RequestHeaderFieldsTooLarge StatusCode = 431 + StatusCode_InternalServerError StatusCode = 500 + StatusCode_NotImplemented StatusCode = 501 + StatusCode_BadGateway StatusCode = 502 + StatusCode_ServiceUnavailable StatusCode = 503 + StatusCode_GatewayTimeout StatusCode = 504 + StatusCode_HTTPVersionNotSupported StatusCode = 505 + StatusCode_VariantAlsoNegotiates StatusCode = 506 + StatusCode_InsufficientStorage StatusCode = 507 + StatusCode_LoopDetected StatusCode = 508 + StatusCode_NotExtended StatusCode = 510 + StatusCode_NetworkAuthenticationRequired StatusCode = 511 +) + +var StatusCode_name = map[int32]string{ + 0: "Empty", + 100: "Continue", + 200: "OK", + 201: "Created", + 202: "Accepted", + 203: "NonAuthoritativeInformation", + 204: "NoContent", + 205: "ResetContent", + 206: "PartialContent", + 207: "MultiStatus", + 208: "AlreadyReported", + 226: "IMUsed", + 300: "MultipleChoices", + 301: "MovedPermanently", + 302: "Found", + 303: "SeeOther", + 304: "NotModified", + 305: "UseProxy", + 307: "TemporaryRedirect", + 308: "PermanentRedirect", + 400: "BadRequest", + 401: "Unauthorized", + 402: "PaymentRequired", + 403: "Forbidden", + 404: "NotFound", + 405: "MethodNotAllowed", + 406: "NotAcceptable", + 407: "ProxyAuthenticationRequired", + 408: "RequestTimeout", + 409: "Conflict", + 410: "Gone", + 411: "LengthRequired", + 412: "PreconditionFailed", + 413: "PayloadTooLarge", + 414: "URITooLong", + 415: "UnsupportedMediaType", + 416: "RangeNotSatisfiable", + 417: "ExpectationFailed", + 421: "MisdirectedRequest", + 422: "UnprocessableEntity", + 423: "Locked", + 424: "FailedDependency", + 426: "UpgradeRequired", + 428: "PreconditionRequired", + 429: "TooManyRequests", + 431: "RequestHeaderFieldsTooLarge", + 500: "InternalServerError", + 501: "NotImplemented", + 502: "BadGateway", + 503: "ServiceUnavailable", + 504: "GatewayTimeout", + 505: "HTTPVersionNotSupported", + 506: "VariantAlsoNegotiates", + 507: "InsufficientStorage", + 508: "LoopDetected", + 510: "NotExtended", + 511: "NetworkAuthenticationRequired", +} +var StatusCode_value = map[string]int32{ + "Empty": 0, + "Continue": 100, + "OK": 200, + "Created": 201, + "Accepted": 202, + "NonAuthoritativeInformation": 203, + "NoContent": 204, + "ResetContent": 205, + "PartialContent": 206, + "MultiStatus": 207, + "AlreadyReported": 208, + "IMUsed": 226, + "MultipleChoices": 300, + "MovedPermanently": 301, + "Found": 302, + "SeeOther": 303, + "NotModified": 304, + "UseProxy": 305, + "TemporaryRedirect": 307, + "PermanentRedirect": 308, + "BadRequest": 400, + "Unauthorized": 401, + "PaymentRequired": 402, + "Forbidden": 403, + "NotFound": 404, + "MethodNotAllowed": 405, + "NotAcceptable": 406, + "ProxyAuthenticationRequired": 407, + "RequestTimeout": 408, + "Conflict": 409, + "Gone": 410, + "LengthRequired": 411, + "PreconditionFailed": 412, + "PayloadTooLarge": 413, + "URITooLong": 414, + "UnsupportedMediaType": 415, + "RangeNotSatisfiable": 416, + "ExpectationFailed": 417, + "MisdirectedRequest": 421, + "UnprocessableEntity": 422, + "Locked": 423, + "FailedDependency": 424, + "UpgradeRequired": 426, + "PreconditionRequired": 428, + "TooManyRequests": 429, + "RequestHeaderFieldsTooLarge": 431, + "InternalServerError": 500, + "NotImplemented": 501, + "BadGateway": 502, + "ServiceUnavailable": 503, + "GatewayTimeout": 504, + "HTTPVersionNotSupported": 505, + "VariantAlsoNegotiates": 506, + "InsufficientStorage": 507, + "LoopDetected": 508, + "NotExtended": 510, + "NetworkAuthenticationRequired": 511, +} + +func (x StatusCode) String() string { + return proto.EnumName(StatusCode_name, int32(x)) +} +func (StatusCode) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_http_status_a08dd77cc74d90ef, []int{0} +} + +// HTTP status. +type HttpStatus struct { + // Supplies HTTP response code. + Code StatusCode `protobuf:"varint,1,opt,name=code,proto3,enum=envoy.type.StatusCode" json:"code,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *HttpStatus) Reset() { *m = HttpStatus{} } +func (m *HttpStatus) String() string { return proto.CompactTextString(m) } +func (*HttpStatus) ProtoMessage() {} +func (*HttpStatus) Descriptor() ([]byte, []int) { + return fileDescriptor_http_status_a08dd77cc74d90ef, []int{0} +} +func (m *HttpStatus) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *HttpStatus) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_HttpStatus.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *HttpStatus) XXX_Merge(src proto.Message) { + xxx_messageInfo_HttpStatus.Merge(dst, src) +} +func (m *HttpStatus) XXX_Size() int { + return m.Size() +} +func (m *HttpStatus) XXX_DiscardUnknown() { + xxx_messageInfo_HttpStatus.DiscardUnknown(m) +} + +var xxx_messageInfo_HttpStatus proto.InternalMessageInfo + +func (m *HttpStatus) GetCode() StatusCode { + if m != nil { + return m.Code + } + return StatusCode_Empty +} + +func init() { + proto.RegisterType((*HttpStatus)(nil), "envoy.type.HttpStatus") + proto.RegisterEnum("envoy.type.StatusCode", StatusCode_name, StatusCode_value) +} +func (m *HttpStatus) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *HttpStatus) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Code != 0 { + dAtA[i] = 0x8 + i++ + i = encodeVarintHttpStatus(dAtA, i, uint64(m.Code)) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func encodeVarintHttpStatus(dAtA []byte, offset int, v uint64) int { + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return offset + 1 +} +func (m *HttpStatus) Size() (n int) { + var l int + _ = l + if m.Code != 0 { + n += 1 + sovHttpStatus(uint64(m.Code)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func sovHttpStatus(x uint64) (n int) { + for { + n++ + x >>= 7 + if x == 0 { + break + } + } + return n +} +func sozHttpStatus(x uint64) (n int) { + return sovHttpStatus(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *HttpStatus) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHttpStatus + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: HttpStatus: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: HttpStatus: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Code", wireType) + } + m.Code = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHttpStatus + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Code |= (StatusCode(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipHttpStatus(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthHttpStatus + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipHttpStatus(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowHttpStatus + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowHttpStatus + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + return iNdEx, nil + case 1: + iNdEx += 8 + return iNdEx, nil + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowHttpStatus + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + iNdEx += length + if length < 0 { + return 0, ErrInvalidLengthHttpStatus + } + return iNdEx, nil + case 3: + for { + var innerWire uint64 + var start int = iNdEx + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowHttpStatus + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + innerWire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + innerWireType := int(innerWire & 0x7) + if innerWireType == 4 { + break + } + next, err := skipHttpStatus(dAtA[start:]) + if err != nil { + return 0, err + } + iNdEx = start + next + } + return iNdEx, nil + case 4: + return iNdEx, nil + case 5: + iNdEx += 4 + return iNdEx, nil + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + } + panic("unreachable") +} + +var ( + ErrInvalidLengthHttpStatus = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowHttpStatus = fmt.Errorf("proto: integer overflow") +) + +func init() { + proto.RegisterFile("envoy/type/http_status.proto", fileDescriptor_http_status_a08dd77cc74d90ef) +} + +var fileDescriptor_http_status_a08dd77cc74d90ef = []byte{ + // 910 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x54, 0x49, 0x6f, 0x1c, 0x45, + 0x14, 0x4e, 0x4f, 0xc5, 0x49, 0x5c, 0x71, 0x9c, 0x97, 0x8a, 0x13, 0x87, 0x10, 0x2c, 0x2b, 0x27, + 0xc4, 0xc1, 0x96, 0xe0, 0x0f, 0x60, 0x3b, 0x76, 0x6c, 0xe1, 0x99, 0x8c, 0xc6, 0x33, 0xb9, 0xa2, + 0x72, 0xd7, 0x9b, 0x99, 0x52, 0x7a, 0xea, 0x75, 0xaa, 0xdf, 0x8c, 0xdd, 0x1c, 0xf9, 0x05, 0xec, + 0xfb, 0x7a, 0x60, 0x11, 0x4a, 0x08, 0x08, 0xb8, 0x70, 0xe2, 0x18, 0xf6, 0xfc, 0x04, 0xe4, 0x1b, + 0x77, 0x76, 0x10, 0xa0, 0xaa, 0x59, 0x92, 0x4b, 0x6e, 0x55, 0xaf, 0xde, 0xf2, 0x2d, 0xaf, 0x5b, + 0x5e, 0x40, 0x37, 0xa0, 0x72, 0x99, 0xcb, 0x1c, 0x97, 0xbb, 0xcc, 0xf9, 0x93, 0x05, 0x6b, 0xee, + 0x17, 0x4b, 0xb9, 0x27, 0x26, 0x25, 0xe3, 0xeb, 0x52, 0x78, 0x3d, 0x3f, 0x3f, 0xd0, 0x99, 0x35, + 0x9a, 0x71, 0x79, 0x7c, 0x18, 0x26, 0x5d, 0xac, 0x49, 0xb9, 0xc9, 0x9c, 0xef, 0xc4, 0x42, 0xf5, + 0xb8, 0x3c, 0x9c, 0x92, 0xc1, 0x73, 0xc9, 0x62, 0xf2, 0xf0, 0xec, 0xa3, 0x67, 0x97, 0xee, 0x76, + 0x58, 0x1a, 0x66, 0xac, 0x91, 0xc1, 0xd5, 0xb9, 0x2f, 0x7f, 0xfe, 0x4a, 0x4c, 0x3d, 0x9d, 0x54, + 0x16, 0x0f, 0x8d, 0x4f, 0x90, 0x34, 0x62, 0xe5, 0x23, 0x5f, 0x4c, 0x4b, 0x79, 0x37, 0x55, 0x4d, + 0xcb, 0xa9, 0xf5, 0x5e, 0xce, 0x25, 0x1c, 0x52, 0x33, 0xf2, 0xd8, 0x1a, 0x39, 0xb6, 0xae, 0x8f, + 0x60, 0xd4, 0x51, 0x59, 0xb9, 0xf2, 0x04, 0xdc, 0x4e, 0xd4, 0x8c, 0x3c, 0xba, 0xe6, 0x51, 0x33, + 0x1a, 0xf8, 0x3a, 0x51, 0x27, 0xe4, 0xb1, 0x95, 0x34, 0xc5, 0x3c, 0x5c, 0xbf, 0x49, 0xd4, 0xa2, + 0x7c, 0xb0, 0x46, 0x6e, 0xa5, 0xcf, 0x5d, 0xf2, 0x96, 0x35, 0xdb, 0x01, 0x6e, 0xb9, 0x36, 0xf9, + 0x9e, 0x66, 0x4b, 0x0e, 0xbe, 0x4d, 0xd4, 0xac, 0x9c, 0xae, 0x51, 0xe8, 0x8b, 0x8e, 0xe1, 0xbb, + 0x44, 0x9d, 0x92, 0x33, 0x0d, 0x2c, 0x90, 0xc7, 0xa1, 0xef, 0x13, 0x75, 0x5a, 0xce, 0xd6, 0xb5, + 0x67, 0xab, 0xb3, 0x71, 0xf0, 0x87, 0x44, 0x81, 0x3c, 0x5e, 0xed, 0x67, 0x6c, 0x87, 0x58, 0xe1, + 0xc7, 0x44, 0xcd, 0xc9, 0x93, 0x2b, 0x99, 0x47, 0x6d, 0xca, 0x06, 0xe6, 0xe4, 0x03, 0x82, 0x3b, + 0x89, 0x3a, 0x2e, 0x8f, 0x6c, 0x55, 0x5b, 0x05, 0x1a, 0x38, 0x88, 0x29, 0xb1, 0x28, 0xcf, 0x70, + 0xad, 0x4b, 0x36, 0xc5, 0x02, 0x6e, 0x54, 0xd4, 0x19, 0x09, 0x55, 0x1a, 0xa0, 0xa9, 0xa3, 0xef, + 0x69, 0x87, 0x8e, 0xb3, 0x12, 0x6e, 0x56, 0x94, 0x94, 0x53, 0x1b, 0xd4, 0x77, 0x06, 0x3e, 0xae, + 0x04, 0x5a, 0x3b, 0x88, 0x57, 0xb8, 0x8b, 0x1e, 0x6e, 0x55, 0xc2, 0xf0, 0x1a, 0x71, 0x95, 0x8c, + 0x6d, 0x5b, 0x34, 0xf0, 0x49, 0x4c, 0x68, 0x15, 0x58, 0xf7, 0xb4, 0x5f, 0xc2, 0xa7, 0x15, 0x75, + 0x56, 0x9e, 0x6a, 0x62, 0x2f, 0x27, 0xaf, 0x7d, 0xd9, 0x40, 0x63, 0x3d, 0xa6, 0x0c, 0x9f, 0xc5, + 0xf8, 0x64, 0xca, 0x24, 0xfe, 0x79, 0x45, 0x9d, 0x94, 0x72, 0x55, 0x9b, 0x06, 0x5e, 0xef, 0x63, + 0xc1, 0xf0, 0x8c, 0x08, 0x32, 0xb4, 0x9c, 0x1e, 0xea, 0xf6, 0x14, 0x1a, 0x78, 0x56, 0x04, 0xf0, + 0x75, 0x5d, 0xf6, 0x62, 0xe5, 0xf5, 0xbe, 0xf5, 0x68, 0xe0, 0x39, 0x11, 0xf4, 0xdb, 0x20, 0xbf, + 0x6b, 0x8d, 0x41, 0x07, 0xcf, 0x8b, 0x00, 0xa4, 0x46, 0x3c, 0x04, 0xfe, 0x82, 0x88, 0xdc, 0x90, + 0xbb, 0x64, 0x6a, 0xc4, 0x2b, 0x59, 0x46, 0x7b, 0x68, 0xe0, 0x45, 0xa1, 0x94, 0x3c, 0x11, 0x02, + 0xd1, 0x29, 0xbd, 0x9b, 0x21, 0xbc, 0x24, 0x82, 0x57, 0x11, 0x7f, 0x70, 0x0b, 0x1d, 0xdb, 0x34, + 0x7a, 0x34, 0x99, 0xf5, 0xb2, 0x08, 0x46, 0x8c, 0x20, 0x36, 0x6d, 0x0f, 0xa9, 0xcf, 0xf0, 0x4a, + 0x1c, 0xb8, 0x46, 0xae, 0x9d, 0xd9, 0x94, 0xe1, 0x55, 0xa1, 0xa6, 0xe5, 0xe1, 0xcb, 0xe4, 0x10, + 0x5e, 0x8b, 0xe9, 0xdb, 0xe8, 0x3a, 0xdc, 0x9d, 0xf4, 0x78, 0x5d, 0xa8, 0x79, 0xa9, 0xea, 0x1e, + 0x53, 0x72, 0xc6, 0x86, 0xf6, 0x1b, 0xda, 0x66, 0x68, 0xe0, 0x8d, 0x31, 0xbd, 0x8c, 0xb4, 0x69, + 0x12, 0x6d, 0x6b, 0xdf, 0x41, 0x78, 0x53, 0x04, 0x61, 0x5a, 0x8d, 0xad, 0x10, 0x21, 0xd7, 0x81, + 0xb7, 0x84, 0x7a, 0x40, 0xce, 0xb5, 0x5c, 0xd1, 0xcf, 0x87, 0x0e, 0x57, 0xd1, 0x58, 0xdd, 0x2c, + 0x73, 0x84, 0xb7, 0x85, 0x3a, 0x27, 0x4f, 0x37, 0xb4, 0xeb, 0x60, 0x8d, 0x78, 0x47, 0xb3, 0x2d, + 0xda, 0x36, 0x52, 0x7b, 0x47, 0x04, 0xd9, 0xd7, 0xf7, 0x73, 0x4c, 0x59, 0xdf, 0x33, 0xf3, 0xdd, + 0x08, 0xa6, 0x6a, 0x8b, 0xa1, 0x0d, 0x38, 0x91, 0xff, 0xbd, 0xd8, 0xaa, 0xe5, 0x72, 0x4f, 0x29, + 0x16, 0x45, 0x68, 0xb2, 0xee, 0xd8, 0x72, 0x09, 0xef, 0x8b, 0xb0, 0x4f, 0xdb, 0x94, 0x5e, 0x43, + 0x03, 0x1f, 0x44, 0x75, 0x87, 0xcd, 0x2e, 0x61, 0x8e, 0xce, 0xa0, 0x4b, 0x4b, 0xf8, 0x30, 0x52, + 0x69, 0xe5, 0x1d, 0xaf, 0x0d, 0x4e, 0x98, 0x7f, 0x14, 0x91, 0xdf, 0xcb, 0x7c, 0xf2, 0x74, 0x23, + 0x16, 0x34, 0x89, 0xaa, 0xda, 0x95, 0x23, 0x0c, 0x05, 0xdc, 0x8c, 0x86, 0x8c, 0xae, 0x9b, 0xa8, + 0x0d, 0xfa, 0x0d, 0x8b, 0x99, 0x29, 0x26, 0xea, 0xdc, 0x8a, 0x30, 0xb7, 0x1c, 0xa3, 0x77, 0x3a, + 0xdb, 0x41, 0x3f, 0x40, 0xbf, 0xee, 0x3d, 0x79, 0xf8, 0x25, 0x6a, 0x5f, 0x23, 0xde, 0xea, 0xe5, + 0x19, 0x86, 0x8d, 0x41, 0x03, 0xbf, 0x8a, 0xd1, 0x96, 0x5d, 0xd6, 0x8c, 0x7b, 0xba, 0x84, 0xdf, + 0x22, 0xff, 0x50, 0x67, 0x53, 0x6c, 0x39, 0x3d, 0xd0, 0x36, 0x8b, 0x82, 0xfd, 0x1e, 0xcb, 0x47, + 0x69, 0x63, 0xa7, 0xff, 0x10, 0xea, 0x82, 0x9c, 0xdf, 0x6c, 0x36, 0xeb, 0x57, 0xd1, 0x17, 0x96, + 0x5c, 0x50, 0x79, 0x6c, 0x03, 0xfc, 0x29, 0xd4, 0x79, 0x79, 0xe6, 0xaa, 0xf6, 0x56, 0x3b, 0x5e, + 0xc9, 0x0a, 0xaa, 0x61, 0x87, 0xd8, 0x6a, 0xc6, 0x02, 0xfe, 0x1a, 0xe1, 0x2c, 0xfa, 0xed, 0xb6, + 0x4d, 0x2d, 0x3a, 0xde, 0x61, 0xf2, 0xba, 0x83, 0xf0, 0x77, 0xdc, 0xf3, 0x6d, 0xa2, 0xfc, 0x12, + 0x72, 0xb4, 0x00, 0xfe, 0x11, 0xa3, 0x8f, 0x6b, 0x7d, 0x9f, 0x83, 0xa2, 0x06, 0xfe, 0x15, 0xea, + 0xa2, 0x7c, 0xa8, 0x86, 0xbc, 0x47, 0xfe, 0xda, 0x7d, 0x76, 0xf3, 0x3f, 0xb1, 0x3a, 0x73, 0xfb, + 0x60, 0x21, 0xb9, 0x73, 0xb0, 0x90, 0xfc, 0x74, 0xb0, 0x90, 0xec, 0x1e, 0x89, 0x3f, 0xc7, 0xc7, + 0xfe, 0x0f, 0x00, 0x00, 0xff, 0xff, 0xc0, 0xfd, 0x12, 0x85, 0x61, 0x05, 0x00, 0x00, +} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/type/http_status.pb.validate.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/type/http_status.pb.validate.go new file mode 100644 index 000000000000..f45a80aeefa4 --- /dev/null +++ b/vendor/github.com/envoyproxy/go-control-plane/envoy/type/http_status.pb.validate.go @@ -0,0 +1,83 @@ +// Code generated by protoc-gen-validate +// source: envoy/type/http_status.proto +// DO NOT EDIT!!! + +package envoy_type + +import ( + "bytes" + "errors" + "fmt" + "net" + "net/mail" + "net/url" + "regexp" + "strings" + "time" + "unicode/utf8" + + "github.com/gogo/protobuf/types" +) + +// ensure the imports are used +var ( + _ = bytes.MinRead + _ = errors.New("") + _ = fmt.Print + _ = utf8.UTFMax + _ = (*regexp.Regexp)(nil) + _ = (*strings.Reader)(nil) + _ = net.IPv4len + _ = time.Duration(0) + _ = (*url.URL)(nil) + _ = (*mail.Address)(nil) + _ = types.DynamicAny{} +) + +// Validate checks the field values on HttpStatus with the rules defined in the +// proto definition for this message. If any rules are violated, an error is returned. +func (m *HttpStatus) Validate() error { + if m == nil { + return nil + } + + if _, ok := StatusCode_name[int32(m.GetCode())]; !ok { + return HttpStatusValidationError{ + Field: "Code", + Reason: "value must be one of the defined enum values", + } + } + + return nil +} + +// HttpStatusValidationError is the validation error returned by +// HttpStatus.Validate if the designated constraints aren't met. +type HttpStatusValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e HttpStatusValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sHttpStatus.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = HttpStatusValidationError{} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/type/percent.pb.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/type/percent.pb.go new file mode 100644 index 000000000000..5ad3b189895f --- /dev/null +++ b/vendor/github.com/envoyproxy/go-control-plane/envoy/type/percent.pb.go @@ -0,0 +1,624 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: envoy/type/percent.proto + +package envoy_type + +import proto "github.com/gogo/protobuf/proto" +import fmt "fmt" +import math "math" +import _ "github.com/gogo/protobuf/gogoproto" +import _ "github.com/lyft/protoc-gen-validate/validate" + +import bytes "bytes" + +import encoding_binary "encoding/binary" + +import io "io" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package + +// Fraction percentages support several fixed denominator values. +type FractionalPercent_DenominatorType int32 + +const ( + // 100. + // + // **Example**: 1/100 = 1%. + FractionalPercent_HUNDRED FractionalPercent_DenominatorType = 0 + // 10,000. + // + // **Example**: 1/10000 = 0.01%. + FractionalPercent_TEN_THOUSAND FractionalPercent_DenominatorType = 1 + // 1,000,000. + // + // **Example**: 1/1000000 = 0.0001%. + FractionalPercent_MILLION FractionalPercent_DenominatorType = 2 +) + +var FractionalPercent_DenominatorType_name = map[int32]string{ + 0: "HUNDRED", + 1: "TEN_THOUSAND", + 2: "MILLION", +} +var FractionalPercent_DenominatorType_value = map[string]int32{ + "HUNDRED": 0, + "TEN_THOUSAND": 1, + "MILLION": 2, +} + +func (x FractionalPercent_DenominatorType) String() string { + return proto.EnumName(FractionalPercent_DenominatorType_name, int32(x)) +} +func (FractionalPercent_DenominatorType) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_percent_9c3a09dc29f751a8, []int{1, 0} +} + +// Identifies a percentage, in the range [0.0, 100.0]. +type Percent struct { + Value float64 `protobuf:"fixed64,1,opt,name=value,proto3" json:"value,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Percent) Reset() { *m = Percent{} } +func (m *Percent) String() string { return proto.CompactTextString(m) } +func (*Percent) ProtoMessage() {} +func (*Percent) Descriptor() ([]byte, []int) { + return fileDescriptor_percent_9c3a09dc29f751a8, []int{0} +} +func (m *Percent) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Percent) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Percent.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *Percent) XXX_Merge(src proto.Message) { + xxx_messageInfo_Percent.Merge(dst, src) +} +func (m *Percent) XXX_Size() int { + return m.Size() +} +func (m *Percent) XXX_DiscardUnknown() { + xxx_messageInfo_Percent.DiscardUnknown(m) +} + +var xxx_messageInfo_Percent proto.InternalMessageInfo + +func (m *Percent) GetValue() float64 { + if m != nil { + return m.Value + } + return 0 +} + +// A fractional percentage is used in cases in which for performance reasons performing floating +// point to integer conversions during randomness calculations is undesirable. The message includes +// both a numerator and denominator that together determine the final fractional value. +// +// * **Example**: 1/100 = 1%. +// * **Example**: 3/10000 = 0.03%. +type FractionalPercent struct { + // Specifies the numerator. Defaults to 0. + Numerator uint32 `protobuf:"varint,1,opt,name=numerator,proto3" json:"numerator,omitempty"` + // Specifies the denominator. If the denominator specified is less than the numerator, the final + // fractional percentage is capped at 1 (100%). + Denominator FractionalPercent_DenominatorType `protobuf:"varint,2,opt,name=denominator,proto3,enum=envoy.type.FractionalPercent_DenominatorType" json:"denominator,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *FractionalPercent) Reset() { *m = FractionalPercent{} } +func (m *FractionalPercent) String() string { return proto.CompactTextString(m) } +func (*FractionalPercent) ProtoMessage() {} +func (*FractionalPercent) Descriptor() ([]byte, []int) { + return fileDescriptor_percent_9c3a09dc29f751a8, []int{1} +} +func (m *FractionalPercent) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *FractionalPercent) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_FractionalPercent.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *FractionalPercent) XXX_Merge(src proto.Message) { + xxx_messageInfo_FractionalPercent.Merge(dst, src) +} +func (m *FractionalPercent) XXX_Size() int { + return m.Size() +} +func (m *FractionalPercent) XXX_DiscardUnknown() { + xxx_messageInfo_FractionalPercent.DiscardUnknown(m) +} + +var xxx_messageInfo_FractionalPercent proto.InternalMessageInfo + +func (m *FractionalPercent) GetNumerator() uint32 { + if m != nil { + return m.Numerator + } + return 0 +} + +func (m *FractionalPercent) GetDenominator() FractionalPercent_DenominatorType { + if m != nil { + return m.Denominator + } + return FractionalPercent_HUNDRED +} + +func init() { + proto.RegisterType((*Percent)(nil), "envoy.type.Percent") + proto.RegisterType((*FractionalPercent)(nil), "envoy.type.FractionalPercent") + proto.RegisterEnum("envoy.type.FractionalPercent_DenominatorType", FractionalPercent_DenominatorType_name, FractionalPercent_DenominatorType_value) +} +func (this *Percent) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Percent) + if !ok { + that2, ok := that.(Percent) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Value != that1.Value { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *FractionalPercent) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*FractionalPercent) + if !ok { + that2, ok := that.(FractionalPercent) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Numerator != that1.Numerator { + return false + } + if this.Denominator != that1.Denominator { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (m *Percent) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Percent) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Value != 0 { + dAtA[i] = 0x9 + i++ + encoding_binary.LittleEndian.PutUint64(dAtA[i:], uint64(math.Float64bits(float64(m.Value)))) + i += 8 + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *FractionalPercent) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *FractionalPercent) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Numerator != 0 { + dAtA[i] = 0x8 + i++ + i = encodeVarintPercent(dAtA, i, uint64(m.Numerator)) + } + if m.Denominator != 0 { + dAtA[i] = 0x10 + i++ + i = encodeVarintPercent(dAtA, i, uint64(m.Denominator)) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func encodeVarintPercent(dAtA []byte, offset int, v uint64) int { + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return offset + 1 +} +func (m *Percent) Size() (n int) { + var l int + _ = l + if m.Value != 0 { + n += 9 + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *FractionalPercent) Size() (n int) { + var l int + _ = l + if m.Numerator != 0 { + n += 1 + sovPercent(uint64(m.Numerator)) + } + if m.Denominator != 0 { + n += 1 + sovPercent(uint64(m.Denominator)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func sovPercent(x uint64) (n int) { + for { + n++ + x >>= 7 + if x == 0 { + break + } + } + return n +} +func sozPercent(x uint64) (n int) { + return sovPercent(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Percent) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPercent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Percent: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Percent: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 1 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + var v uint64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = uint64(encoding_binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + m.Value = float64(math.Float64frombits(v)) + default: + iNdEx = preIndex + skippy, err := skipPercent(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthPercent + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *FractionalPercent) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPercent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: FractionalPercent: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: FractionalPercent: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Numerator", wireType) + } + m.Numerator = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPercent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Numerator |= (uint32(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Denominator", wireType) + } + m.Denominator = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPercent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Denominator |= (FractionalPercent_DenominatorType(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipPercent(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthPercent + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipPercent(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowPercent + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowPercent + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + return iNdEx, nil + case 1: + iNdEx += 8 + return iNdEx, nil + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowPercent + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + iNdEx += length + if length < 0 { + return 0, ErrInvalidLengthPercent + } + return iNdEx, nil + case 3: + for { + var innerWire uint64 + var start int = iNdEx + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowPercent + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + innerWire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + innerWireType := int(innerWire & 0x7) + if innerWireType == 4 { + break + } + next, err := skipPercent(dAtA[start:]) + if err != nil { + return 0, err + } + iNdEx = start + next + } + return iNdEx, nil + case 4: + return iNdEx, nil + case 5: + iNdEx += 4 + return iNdEx, nil + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + } + panic("unreachable") +} + +var ( + ErrInvalidLengthPercent = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowPercent = fmt.Errorf("proto: integer overflow") +) + +func init() { proto.RegisterFile("envoy/type/percent.proto", fileDescriptor_percent_9c3a09dc29f751a8) } + +var fileDescriptor_percent_9c3a09dc29f751a8 = []byte{ + // 283 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x48, 0xcd, 0x2b, 0xcb, + 0xaf, 0xd4, 0x2f, 0xa9, 0x2c, 0x48, 0xd5, 0x2f, 0x48, 0x2d, 0x4a, 0x4e, 0xcd, 0x2b, 0xd1, 0x2b, + 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x02, 0xcb, 0xe8, 0x81, 0x64, 0xa4, 0xc4, 0xcb, 0x12, 0x73, + 0x32, 0x53, 0x12, 0x4b, 0x52, 0xf5, 0x61, 0x0c, 0x88, 0x22, 0x29, 0x91, 0xf4, 0xfc, 0xf4, 0x7c, + 0x30, 0x53, 0x1f, 0xc4, 0x82, 0x88, 0x2a, 0x59, 0x71, 0xb1, 0x07, 0x40, 0xcc, 0x12, 0xd2, 0xe7, + 0x62, 0x2d, 0x4b, 0xcc, 0x29, 0x4d, 0x95, 0x60, 0x54, 0x60, 0xd4, 0x60, 0x74, 0x92, 0xdc, 0xf5, + 0xf2, 0x00, 0xb3, 0x88, 0x90, 0x90, 0x24, 0x03, 0x18, 0x44, 0x3a, 0x68, 0x32, 0x40, 0x41, 0x10, + 0x44, 0x9d, 0xd2, 0x59, 0x46, 0x2e, 0x41, 0xb7, 0xa2, 0xc4, 0xe4, 0x92, 0xcc, 0xfc, 0xbc, 0xc4, + 0x1c, 0x98, 0x31, 0x32, 0x5c, 0x9c, 0x79, 0xa5, 0xb9, 0xa9, 0x45, 0x89, 0x25, 0xf9, 0x45, 0x60, + 0xa3, 0x78, 0x83, 0x10, 0x02, 0x42, 0xd1, 0x5c, 0xdc, 0x29, 0xa9, 0x79, 0xf9, 0xb9, 0x99, 0x79, + 0x60, 0x79, 0x26, 0x05, 0x46, 0x0d, 0x3e, 0x23, 0x5d, 0x3d, 0x84, 0x07, 0xf4, 0x30, 0x4c, 0xd4, + 0x73, 0x41, 0x68, 0x08, 0xa9, 0x2c, 0x48, 0x75, 0xe2, 0x02, 0xb9, 0x8c, 0xb5, 0x89, 0x91, 0x49, + 0x80, 0x31, 0x08, 0xd9, 0x34, 0x25, 0x5b, 0x2e, 0x7e, 0x34, 0xb5, 0x42, 0xdc, 0x5c, 0xec, 0x1e, + 0xa1, 0x7e, 0x2e, 0x41, 0xae, 0x2e, 0x02, 0x0c, 0x42, 0x02, 0x5c, 0x3c, 0x21, 0xae, 0x7e, 0xf1, + 0x21, 0x1e, 0xfe, 0xa1, 0xc1, 0x8e, 0x7e, 0x2e, 0x02, 0x8c, 0x20, 0x69, 0x5f, 0x4f, 0x1f, 0x1f, + 0x4f, 0x7f, 0x3f, 0x01, 0x26, 0x27, 0x81, 0x15, 0x8f, 0xe4, 0x18, 0x4f, 0x3c, 0x92, 0x63, 0xbc, + 0xf0, 0x48, 0x8e, 0xf1, 0xc1, 0x23, 0x39, 0xc6, 0x24, 0x36, 0x70, 0x20, 0x19, 0x03, 0x02, 0x00, + 0x00, 0xff, 0xff, 0x3f, 0x07, 0xea, 0x97, 0x7b, 0x01, 0x00, 0x00, +} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/type/percent.pb.validate.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/type/percent.pb.validate.go new file mode 100644 index 000000000000..38fa3def7631 --- /dev/null +++ b/vendor/github.com/envoyproxy/go-control-plane/envoy/type/percent.pb.validate.go @@ -0,0 +1,134 @@ +// Code generated by protoc-gen-validate +// source: envoy/type/percent.proto +// DO NOT EDIT!!! + +package envoy_type + +import ( + "bytes" + "errors" + "fmt" + "net" + "net/mail" + "net/url" + "regexp" + "strings" + "time" + "unicode/utf8" + + "github.com/gogo/protobuf/types" +) + +// ensure the imports are used +var ( + _ = bytes.MinRead + _ = errors.New("") + _ = fmt.Print + _ = utf8.UTFMax + _ = (*regexp.Regexp)(nil) + _ = (*strings.Reader)(nil) + _ = net.IPv4len + _ = time.Duration(0) + _ = (*url.URL)(nil) + _ = (*mail.Address)(nil) + _ = types.DynamicAny{} +) + +// Validate checks the field values on Percent with the rules defined in the +// proto definition for this message. If any rules are violated, an error is returned. +func (m *Percent) Validate() error { + if m == nil { + return nil + } + + if val := m.GetValue(); val < 0 || val > 100 { + return PercentValidationError{ + Field: "Value", + Reason: "value must be inside range [0, 100]", + } + } + + return nil +} + +// PercentValidationError is the validation error returned by Percent.Validate +// if the designated constraints aren't met. +type PercentValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e PercentValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sPercent.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = PercentValidationError{} + +// Validate checks the field values on FractionalPercent with the rules defined +// in the proto definition for this message. If any rules are violated, an +// error is returned. +func (m *FractionalPercent) Validate() error { + if m == nil { + return nil + } + + // no validation rules for Numerator + + if _, ok := FractionalPercent_DenominatorType_name[int32(m.GetDenominator())]; !ok { + return FractionalPercentValidationError{ + Field: "Denominator", + Reason: "value must be one of the defined enum values", + } + } + + return nil +} + +// FractionalPercentValidationError is the validation error returned by +// FractionalPercent.Validate if the designated constraints aren't met. +type FractionalPercentValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e FractionalPercentValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sFractionalPercent.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = FractionalPercentValidationError{} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/type/range.pb.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/type/range.pb.go new file mode 100644 index 000000000000..2ce552535d75 --- /dev/null +++ b/vendor/github.com/envoyproxy/go-control-plane/envoy/type/range.pb.go @@ -0,0 +1,607 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: envoy/type/range.proto + +package envoy_type + +import proto "github.com/gogo/protobuf/proto" +import fmt "fmt" +import math "math" +import _ "github.com/gogo/protobuf/gogoproto" + +import bytes "bytes" + +import encoding_binary "encoding/binary" + +import io "io" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package + +// Specifies the int64 start and end of the range using half-open interval semantics [start, +// end). +type Int64Range struct { + // start of the range (inclusive) + Start int64 `protobuf:"varint,1,opt,name=start,proto3" json:"start,omitempty"` + // end of the range (exclusive) + End int64 `protobuf:"varint,2,opt,name=end,proto3" json:"end,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Int64Range) Reset() { *m = Int64Range{} } +func (m *Int64Range) String() string { return proto.CompactTextString(m) } +func (*Int64Range) ProtoMessage() {} +func (*Int64Range) Descriptor() ([]byte, []int) { + return fileDescriptor_range_78c6b1fd974bd903, []int{0} +} +func (m *Int64Range) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Int64Range) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Int64Range.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *Int64Range) XXX_Merge(src proto.Message) { + xxx_messageInfo_Int64Range.Merge(dst, src) +} +func (m *Int64Range) XXX_Size() int { + return m.Size() +} +func (m *Int64Range) XXX_DiscardUnknown() { + xxx_messageInfo_Int64Range.DiscardUnknown(m) +} + +var xxx_messageInfo_Int64Range proto.InternalMessageInfo + +func (m *Int64Range) GetStart() int64 { + if m != nil { + return m.Start + } + return 0 +} + +func (m *Int64Range) GetEnd() int64 { + if m != nil { + return m.End + } + return 0 +} + +// Specifies the double start and end of the range using half-open interval semantics [start, +// end). +type DoubleRange struct { + // start of the range (inclusive) + Start float64 `protobuf:"fixed64,1,opt,name=start,proto3" json:"start,omitempty"` + // end of the range (exclusive) + End float64 `protobuf:"fixed64,2,opt,name=end,proto3" json:"end,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *DoubleRange) Reset() { *m = DoubleRange{} } +func (m *DoubleRange) String() string { return proto.CompactTextString(m) } +func (*DoubleRange) ProtoMessage() {} +func (*DoubleRange) Descriptor() ([]byte, []int) { + return fileDescriptor_range_78c6b1fd974bd903, []int{1} +} +func (m *DoubleRange) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DoubleRange) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_DoubleRange.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *DoubleRange) XXX_Merge(src proto.Message) { + xxx_messageInfo_DoubleRange.Merge(dst, src) +} +func (m *DoubleRange) XXX_Size() int { + return m.Size() +} +func (m *DoubleRange) XXX_DiscardUnknown() { + xxx_messageInfo_DoubleRange.DiscardUnknown(m) +} + +var xxx_messageInfo_DoubleRange proto.InternalMessageInfo + +func (m *DoubleRange) GetStart() float64 { + if m != nil { + return m.Start + } + return 0 +} + +func (m *DoubleRange) GetEnd() float64 { + if m != nil { + return m.End + } + return 0 +} + +func init() { + proto.RegisterType((*Int64Range)(nil), "envoy.type.Int64Range") + proto.RegisterType((*DoubleRange)(nil), "envoy.type.DoubleRange") +} +func (this *Int64Range) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Int64Range) + if !ok { + that2, ok := that.(Int64Range) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Start != that1.Start { + return false + } + if this.End != that1.End { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *DoubleRange) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*DoubleRange) + if !ok { + that2, ok := that.(DoubleRange) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Start != that1.Start { + return false + } + if this.End != that1.End { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (m *Int64Range) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Int64Range) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Start != 0 { + dAtA[i] = 0x8 + i++ + i = encodeVarintRange(dAtA, i, uint64(m.Start)) + } + if m.End != 0 { + dAtA[i] = 0x10 + i++ + i = encodeVarintRange(dAtA, i, uint64(m.End)) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *DoubleRange) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *DoubleRange) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Start != 0 { + dAtA[i] = 0x9 + i++ + encoding_binary.LittleEndian.PutUint64(dAtA[i:], uint64(math.Float64bits(float64(m.Start)))) + i += 8 + } + if m.End != 0 { + dAtA[i] = 0x11 + i++ + encoding_binary.LittleEndian.PutUint64(dAtA[i:], uint64(math.Float64bits(float64(m.End)))) + i += 8 + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func encodeVarintRange(dAtA []byte, offset int, v uint64) int { + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return offset + 1 +} +func (m *Int64Range) Size() (n int) { + var l int + _ = l + if m.Start != 0 { + n += 1 + sovRange(uint64(m.Start)) + } + if m.End != 0 { + n += 1 + sovRange(uint64(m.End)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *DoubleRange) Size() (n int) { + var l int + _ = l + if m.Start != 0 { + n += 9 + } + if m.End != 0 { + n += 9 + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func sovRange(x uint64) (n int) { + for { + n++ + x >>= 7 + if x == 0 { + break + } + } + return n +} +func sozRange(x uint64) (n int) { + return sovRange(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Int64Range) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRange + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Int64Range: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Int64Range: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Start", wireType) + } + m.Start = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRange + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Start |= (int64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field End", wireType) + } + m.End = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRange + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.End |= (int64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipRange(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthRange + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DoubleRange) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRange + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DoubleRange: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DoubleRange: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 1 { + return fmt.Errorf("proto: wrong wireType = %d for field Start", wireType) + } + var v uint64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = uint64(encoding_binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + m.Start = float64(math.Float64frombits(v)) + case 2: + if wireType != 1 { + return fmt.Errorf("proto: wrong wireType = %d for field End", wireType) + } + var v uint64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = uint64(encoding_binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + m.End = float64(math.Float64frombits(v)) + default: + iNdEx = preIndex + skippy, err := skipRange(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthRange + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipRange(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowRange + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowRange + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + return iNdEx, nil + case 1: + iNdEx += 8 + return iNdEx, nil + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowRange + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + iNdEx += length + if length < 0 { + return 0, ErrInvalidLengthRange + } + return iNdEx, nil + case 3: + for { + var innerWire uint64 + var start int = iNdEx + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowRange + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + innerWire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + innerWireType := int(innerWire & 0x7) + if innerWireType == 4 { + break + } + next, err := skipRange(dAtA[start:]) + if err != nil { + return 0, err + } + iNdEx = start + next + } + return iNdEx, nil + case 4: + return iNdEx, nil + case 5: + iNdEx += 4 + return iNdEx, nil + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + } + panic("unreachable") +} + +var ( + ErrInvalidLengthRange = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowRange = fmt.Errorf("proto: integer overflow") +) + +func init() { proto.RegisterFile("envoy/type/range.proto", fileDescriptor_range_78c6b1fd974bd903) } + +var fileDescriptor_range_78c6b1fd974bd903 = []byte{ + // 159 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x4b, 0xcd, 0x2b, 0xcb, + 0xaf, 0xd4, 0x2f, 0xa9, 0x2c, 0x48, 0xd5, 0x2f, 0x4a, 0xcc, 0x4b, 0x4f, 0xd5, 0x2b, 0x28, 0xca, + 0x2f, 0xc9, 0x17, 0xe2, 0x02, 0x8b, 0xeb, 0x81, 0xc4, 0xa5, 0x44, 0xd2, 0xf3, 0xd3, 0xf3, 0xc1, + 0xc2, 0xfa, 0x20, 0x16, 0x44, 0x85, 0x92, 0x09, 0x17, 0x97, 0x67, 0x5e, 0x89, 0x99, 0x49, 0x10, + 0x48, 0x97, 0x90, 0x08, 0x17, 0x6b, 0x71, 0x49, 0x62, 0x51, 0x89, 0x04, 0xa3, 0x02, 0xa3, 0x06, + 0x73, 0x10, 0x84, 0x23, 0x24, 0xc0, 0xc5, 0x9c, 0x9a, 0x97, 0x22, 0xc1, 0x04, 0x16, 0x03, 0x31, + 0x95, 0x4c, 0xb9, 0xb8, 0x5d, 0xf2, 0x4b, 0x93, 0x72, 0x52, 0xb1, 0x68, 0x63, 0xc4, 0xa2, 0x8d, + 0x11, 0xac, 0xcd, 0x49, 0x66, 0xc5, 0x23, 0x39, 0xc6, 0x13, 0x8f, 0xe4, 0x18, 0x2f, 0x3c, 0x92, + 0x63, 0x7c, 0xf0, 0x48, 0x8e, 0x31, 0x0a, 0xe2, 0xc0, 0x78, 0x90, 0x03, 0x93, 0xd8, 0xc0, 0x2e, + 0x32, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0xae, 0xd4, 0x26, 0x8b, 0xcd, 0x00, 0x00, 0x00, +} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/type/range.pb.validate.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/type/range.pb.validate.go new file mode 100644 index 000000000000..9ef1aa639e7f --- /dev/null +++ b/vendor/github.com/envoyproxy/go-control-plane/envoy/type/range.pb.validate.go @@ -0,0 +1,126 @@ +// Code generated by protoc-gen-validate +// source: envoy/type/range.proto +// DO NOT EDIT!!! + +package envoy_type + +import ( + "bytes" + "errors" + "fmt" + "net" + "net/mail" + "net/url" + "regexp" + "strings" + "time" + "unicode/utf8" + + "github.com/gogo/protobuf/types" +) + +// ensure the imports are used +var ( + _ = bytes.MinRead + _ = errors.New("") + _ = fmt.Print + _ = utf8.UTFMax + _ = (*regexp.Regexp)(nil) + _ = (*strings.Reader)(nil) + _ = net.IPv4len + _ = time.Duration(0) + _ = (*url.URL)(nil) + _ = (*mail.Address)(nil) + _ = types.DynamicAny{} +) + +// Validate checks the field values on Int64Range with the rules defined in the +// proto definition for this message. If any rules are violated, an error is returned. +func (m *Int64Range) Validate() error { + if m == nil { + return nil + } + + // no validation rules for Start + + // no validation rules for End + + return nil +} + +// Int64RangeValidationError is the validation error returned by +// Int64Range.Validate if the designated constraints aren't met. +type Int64RangeValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e Int64RangeValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sInt64Range.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = Int64RangeValidationError{} + +// Validate checks the field values on DoubleRange with the rules defined in +// the proto definition for this message. If any rules are violated, an error +// is returned. +func (m *DoubleRange) Validate() error { + if m == nil { + return nil + } + + // no validation rules for Start + + // no validation rules for End + + return nil +} + +// DoubleRangeValidationError is the validation error returned by +// DoubleRange.Validate if the designated constraints aren't met. +type DoubleRangeValidationError struct { + Field string + Reason string + Cause error + Key bool +} + +// Error satisfies the builtin error interface +func (e DoubleRangeValidationError) Error() string { + cause := "" + if e.Cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.Cause) + } + + key := "" + if e.Key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sDoubleRange.%s: %s%s", + key, + e.Field, + e.Reason, + cause) +} + +var _ error = DoubleRangeValidationError{} diff --git a/vendor/github.com/envoyproxy/go-control-plane/pkg/cache/cache.go b/vendor/github.com/envoyproxy/go-control-plane/pkg/cache/cache.go new file mode 100644 index 000000000000..657cdd995cf6 --- /dev/null +++ b/vendor/github.com/envoyproxy/go-control-plane/pkg/cache/cache.go @@ -0,0 +1,70 @@ +// Copyright 2018 Envoyproxy Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package cache defines a configuration cache for the server. +package cache + +import ( + "context" + + "github.com/envoyproxy/go-control-plane/envoy/api/v2" +) + +// Request is an alias for the discovery request type. +type Request = v2.DiscoveryRequest + +// ConfigWatcher requests watches for configuration resources by a node, last +// applied version identifier, and resource names hint. The watch should send +// the responses when they are ready. The watch can be cancelled by the +// consumer, in effect terminating the watch for the request. +// ConfigWatcher implementation must be thread-safe. +type ConfigWatcher interface { + // CreateWatch returns a new open watch from a non-empty request. + // + // Value channel produces requested resources, once they are available. If + // the channel is closed prior to cancellation of the watch, an unrecoverable + // error has occurred in the producer, and the consumer should close the + // corresponding stream. + // + // Cancel is an optional function to release resources in the producer. If + // provided, the consumer may call this function multiple times. + CreateWatch(Request) (value chan Response, cancel func()) +} + +// Cache is a generic config cache with a watcher. +type Cache interface { + ConfigWatcher + + // Fetch implements the polling method of the config cache using a non-empty request. + Fetch(context.Context, Request) (*Response, error) + + // GetStatusInfo retrieves status information for a node ID. + GetStatusInfo(string) StatusInfo + + // GetStatusKeys retrieves node IDs for all statuses. + GetStatusKeys() []string +} + +// Response is a pre-serialized xDS response. +type Response struct { + // Request is the original request. + Request v2.DiscoveryRequest + + // Version of the resources as tracked by the cache for the given type. + // Proxy responds with this version as an acknowledgement. + Version string + + // Resources to be included in the response. + Resources []Resource +} diff --git a/vendor/github.com/envoyproxy/go-control-plane/pkg/cache/resource.go b/vendor/github.com/envoyproxy/go-control-plane/pkg/cache/resource.go new file mode 100644 index 000000000000..ad62a1dce30a --- /dev/null +++ b/vendor/github.com/envoyproxy/go-control-plane/pkg/cache/resource.go @@ -0,0 +1,112 @@ +// Copyright 2018 Envoyproxy Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package cache + +import ( + "github.com/gogo/protobuf/proto" + + "github.com/envoyproxy/go-control-plane/envoy/api/v2" + hcm "github.com/envoyproxy/go-control-plane/envoy/config/filter/network/http_connection_manager/v2" + "github.com/envoyproxy/go-control-plane/pkg/util" +) + +// Resource is the base interface for the xDS payload. +type Resource interface { + proto.Message + Equal(interface{}) bool +} + +// Resource types in xDS v2. +const ( + typePrefix = "type.googleapis.com/envoy.api.v2." + EndpointType = typePrefix + "ClusterLoadAssignment" + ClusterType = typePrefix + "Cluster" + RouteType = typePrefix + "RouteConfiguration" + ListenerType = typePrefix + "Listener" + + // AnyType is used only by ADS + AnyType = "" +) + +var ( + // ResponseTypes are supported response types. + ResponseTypes = []string{ + EndpointType, + ClusterType, + RouteType, + ListenerType, + } +) + +// GetResourceName returns the resource name for a valid xDS response type. +func GetResourceName(res Resource) string { + switch v := res.(type) { + case *v2.ClusterLoadAssignment: + return v.GetClusterName() + case *v2.Cluster: + return v.GetName() + case *v2.RouteConfiguration: + return v.GetName() + case *v2.Listener: + return v.GetName() + default: + return "" + } +} + +// GetResourceReferences returns the names for dependent resources (EDS cluster +// names for CDS, RDS routes names for LDS). +func GetResourceReferences(resources map[string]Resource) map[string]bool { + out := make(map[string]bool) + for _, res := range resources { + if res == nil { + continue + } + switch v := res.(type) { + case *v2.ClusterLoadAssignment: + // no dependencies + case *v2.Cluster: + // for EDS type, use cluster name or ServiceName override + if v.Type == v2.Cluster_EDS { + if v.EdsClusterConfig != nil && v.EdsClusterConfig.ServiceName != "" { + out[v.EdsClusterConfig.ServiceName] = true + } else { + out[v.Name] = true + } + } + case *v2.RouteConfiguration: + // References to clusters in both routes (and listeners) are not included + // in the result, because the clusters are retrieved in bulk currently, + // and not by name. + case *v2.Listener: + // extract route configuration names from HTTP connection manager + for _, chain := range v.FilterChains { + for _, filter := range chain.Filters { + if filter.Name != util.HTTPConnectionManager { + continue + } + + config := &hcm.HttpConnectionManager{} + if util.StructToMessage(filter.Config, config) == nil && config != nil { + if rds, ok := config.RouteSpecifier.(*hcm.HttpConnectionManager_Rds); ok && rds != nil && rds.Rds != nil { + out[rds.Rds.RouteConfigName] = true + } + } + } + } + } + } + return out +} diff --git a/vendor/github.com/envoyproxy/go-control-plane/pkg/cache/simple.go b/vendor/github.com/envoyproxy/go-control-plane/pkg/cache/simple.go new file mode 100644 index 000000000000..ed6e73d98679 --- /dev/null +++ b/vendor/github.com/envoyproxy/go-control-plane/pkg/cache/simple.go @@ -0,0 +1,309 @@ +// Copyright 2018 Envoyproxy Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package cache + +import ( + "context" + "errors" + "fmt" + "sync" + "sync/atomic" + "time" + + "github.com/envoyproxy/go-control-plane/pkg/log" +) + +// SnapshotCache is a snapshot-based cache that maintains a single versioned +// snapshot of responses per node. SnapshotCache consistently replies with the +// latest snapshot. For the protocol to work correctly in ADS mode, EDS/RDS +// requests are responded only when all resources in the snapshot xDS response +// are named as part of the request. It is expected that the CDS response names +// all EDS clusters, and the LDS response names all RDS routes in a snapshot, +// to ensure that Envoy makes the request for all EDS clusters or RDS routes +// eventually. +// +// SnapshotCache can operate as a REST or regular xDS backend. The snapshot +// can be partial, e.g. only include RDS or EDS resources. +type SnapshotCache interface { + Cache + + // SetSnapshot sets a response snapshot for a node. For ADS, the snapshots + // should have distinct versions and be internally consistent (e.g. all + // referenced resources must be included in the snapshot). + // + // This method will cause the server to respond to all open watches, for which + // the version differs from the snapshot version. + SetSnapshot(node string, snapshot Snapshot) error + + // ClearSnapshot removes all status and snapshot information associated with a node. + ClearSnapshot(node string) +} + +type snapshotCache struct { + log log.Logger + + // ads flag to hold responses until all resources are named + ads bool + + // snapshots are cached resources indexed by node IDs + snapshots map[string]Snapshot + + // status information for all nodes indexed by node IDs + status map[string]*statusInfo + + // hash is the hashing function for Envoy nodes + hash NodeHash + + // watchCount is an atomic counter incremented for each watch + watchCount int64 + + mu sync.RWMutex +} + +// NewSnapshotCache initializes a simple cache. +// +// ADS flag forces a delay in responding to streaming requests until all +// resources are explicitly named in the request. This avoids the problem of a +// partial request over a single stream for a subset of resources which would +// require generating a fresh version for acknowledgement. ADS flag requires +// snapshot consistency. For non-ADS case (and fetch), mutliple partial +// requests are sent across multiple streams and re-using the snapshot version +// is OK. +// +// Logger is optional. +func NewSnapshotCache(ads bool, hash NodeHash, logger log.Logger) SnapshotCache { + return &snapshotCache{ + log: logger, + ads: ads, + snapshots: make(map[string]Snapshot), + status: make(map[string]*statusInfo), + hash: hash, + } +} + +// SetSnapshotCache updates a snapshot for a node. +func (cache *snapshotCache) SetSnapshot(node string, snapshot Snapshot) error { + cache.mu.Lock() + defer cache.mu.Unlock() + + // update the existing entry + cache.snapshots[node] = snapshot + + // trigger existing watches for which version changed + if info, ok := cache.status[node]; ok { + info.mu.Lock() + for id, watch := range info.watches { + version := snapshot.GetVersion(watch.Request.TypeUrl) + if version != watch.Request.VersionInfo { + if cache.log != nil { + cache.log.Infof("respond open watch %d%v with new version %q", id, watch.Request.ResourceNames, version) + } + cache.respond(watch.Request, watch.Response, snapshot.GetResources(watch.Request.TypeUrl), version) + + // discard the watch + delete(info.watches, id) + } + } + info.mu.Unlock() + } + + return nil +} + +// ClearSnapshot clears snapshot and info for a node. +func (cache *snapshotCache) ClearSnapshot(node string) { + cache.mu.Lock() + defer cache.mu.Unlock() + + delete(cache.snapshots, node) + delete(cache.status, node) +} + +// nameSet creates a map from a string slice to value true. +func nameSet(names []string) map[string]bool { + set := make(map[string]bool) + for _, name := range names { + set[name] = true + } + return set +} + +// superset checks that all resources are listed in the names set. +func superset(names map[string]bool, resources map[string]Resource) error { + for resourceName := range resources { + if _, exists := names[resourceName]; !exists { + return fmt.Errorf("%q not listed", resourceName) + } + } + return nil +} + +// CreateWatch returns a watch for an xDS request. +func (cache *snapshotCache) CreateWatch(request Request) (chan Response, func()) { + nodeID := cache.hash.ID(request.Node) + + cache.mu.Lock() + defer cache.mu.Unlock() + + info, ok := cache.status[nodeID] + if !ok { + info = newStatusInfo(request.Node) + cache.status[nodeID] = info + } + + // update last watch request time + info.mu.Lock() + info.lastWatchRequestTime = time.Now() + info.mu.Unlock() + + // allocate capacity 1 to allow one-time non-blocking use + value := make(chan Response, 1) + + snapshot, exists := cache.snapshots[nodeID] + version := snapshot.GetVersion(request.TypeUrl) + + // if the requested version is up-to-date or missing a response, leave an open watch + if !exists || request.VersionInfo == version { + watchID := cache.nextWatchID() + if cache.log != nil { + cache.log.Infof("open watch %d for %s%v from nodeID %q, version %q", watchID, + request.TypeUrl, request.ResourceNames, nodeID, request.VersionInfo) + } + info.mu.Lock() + info.watches[watchID] = ResponseWatch{Request: request, Response: value} + info.mu.Unlock() + return value, cache.cancelWatch(nodeID, watchID) + } + + // otherwise, the watch may be responded immediately + cache.respond(request, value, snapshot.GetResources(request.TypeUrl), version) + + return value, nil +} + +func (cache *snapshotCache) nextWatchID() int64 { + return atomic.AddInt64(&cache.watchCount, 1) +} + +// cancellation function for cleaning stale watches +func (cache *snapshotCache) cancelWatch(nodeID string, watchID int64) func() { + return func() { + // uses the cache mutex + cache.mu.Lock() + defer cache.mu.Unlock() + if info, ok := cache.status[nodeID]; ok { + info.mu.Lock() + delete(info.watches, watchID) + info.mu.Unlock() + } + } +} + +// Respond to a watch with the snapshot value. The value channel should have capacity not to block. +// TODO(kuat) do not respond always, see issue https://github.com/envoyproxy/go-control-plane/issues/46 +func (cache *snapshotCache) respond(request Request, value chan Response, resources map[string]Resource, version string) { + // for ADS, the request names must match the snapshot names + // if they do not, then the watch is never responded, and it is expected that envoy makes another request + if len(request.ResourceNames) != 0 && cache.ads { + if err := superset(nameSet(request.ResourceNames), resources); err != nil { + if cache.log != nil { + cache.log.Infof("ADS mode: not responding to request: %v", err) + } + return + } + } + if cache.log != nil { + cache.log.Infof("respond %s%v version %q with version %q", + request.TypeUrl, request.ResourceNames, request.VersionInfo, version) + } + + value <- createResponse(request, resources, version) +} + +func createResponse(request Request, resources map[string]Resource, version string) Response { + filtered := make([]Resource, 0, len(resources)) + + // Reply only with the requested resources. Envoy may ask each resource + // individually in a separate stream. It is ok to reply with the same version + // on separate streams since requests do not share their response versions. + if len(request.ResourceNames) != 0 { + set := nameSet(request.ResourceNames) + for name, resource := range resources { + if set[name] { + filtered = append(filtered, resource) + } + } + } else { + for _, resource := range resources { + filtered = append(filtered, resource) + } + } + + return Response{ + Request: request, + Version: version, + Resources: filtered, + } +} + +// Fetch implements the cache fetch function. +// Fetch is called on multiple streams, so responding to individual names with the same version works. +func (cache *snapshotCache) Fetch(ctx context.Context, request Request) (*Response, error) { + nodeID := cache.hash.ID(request.Node) + + cache.mu.RLock() + defer cache.mu.RUnlock() + + if snapshot, exists := cache.snapshots[nodeID]; exists { + // Respond only if the request version is distinct from the current snapshot state. + // It might be beneficial to hold the request since Envoy will re-attempt the refresh. + version := snapshot.GetVersion(request.TypeUrl) + if request.VersionInfo == version { + return nil, errors.New("skip fetch: version up to date") + } + + resources := snapshot.GetResources(request.TypeUrl) + out := createResponse(request, resources, version) + return &out, nil + } + + return nil, fmt.Errorf("missing snapshot for %q", nodeID) +} + +// GetStatusInfo retrieves the status info for the node. +func (cache *snapshotCache) GetStatusInfo(node string) StatusInfo { + cache.mu.RLock() + defer cache.mu.RUnlock() + + info, exists := cache.status[node] + if !exists { + return nil + } + + return info +} + +// GetStatusKeys retrieves all node IDs in the status map. +func (cache *snapshotCache) GetStatusKeys() []string { + cache.mu.RLock() + defer cache.mu.RUnlock() + + out := make([]string, len(cache.status)) + for id := range cache.status { + out = append(out, id) + } + + return out +} diff --git a/vendor/github.com/envoyproxy/go-control-plane/pkg/cache/snapshot.go b/vendor/github.com/envoyproxy/go-control-plane/pkg/cache/snapshot.go new file mode 100644 index 000000000000..da7fbbd31774 --- /dev/null +++ b/vendor/github.com/envoyproxy/go-control-plane/pkg/cache/snapshot.go @@ -0,0 +1,140 @@ +// Copyright 2018 Envoyproxy Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package cache + +import ( + "errors" + "fmt" +) + +// Resources is a versioned group of resources. +type Resources struct { + // Version information. + Version string + + // Items in the group. + Items map[string]Resource +} + +// IndexResourcesByName creates a map from the resource name to the resource. +func IndexResourcesByName(items []Resource) map[string]Resource { + indexed := make(map[string]Resource, len(items)) + for _, item := range items { + indexed[GetResourceName(item)] = item + } + return indexed +} + +// NewResources creates a new resource group. +func NewResources(version string, items []Resource) Resources { + return Resources{ + Version: version, + Items: IndexResourcesByName(items), + } +} + +// Snapshot is an internally consistent snapshot of xDS resources. +// Consistentcy is important for the convergence as different resource types +// from the snapshot may be delivered to the proxy in arbitrary order. +type Snapshot struct { + // Endpoints are items in the EDS response payload. + Endpoints Resources + + // Clusters are items in the CDS response payload. + Clusters Resources + + // Routes are items in the RDS response payload. + Routes Resources + + // Listeners are items in the LDS response payload. + Listeners Resources +} + +// NewSnapshot creates a snapshot from response types and a version. +func NewSnapshot(version string, + endpoints []Resource, + clusters []Resource, + routes []Resource, + listeners []Resource) Snapshot { + return Snapshot{ + Endpoints: NewResources(version, endpoints), + Clusters: NewResources(version, clusters), + Routes: NewResources(version, routes), + Listeners: NewResources(version, listeners), + } +} + +// Consistent check verifies that the dependent resources are exactly listed in the +// snapshot: +// - all EDS resources are listed by name in CDS resources +// - all RDS resources are listed by name in LDS resources +// +// Note that clusters and listeners are requested without name references, so +// Envoy will accept the snapshot list of clusters as-is even if it does not match +// all references found in xDS. +func (s *Snapshot) Consistent() error { + if s == nil { + return errors.New("nil snapshot") + } + endpoints := GetResourceReferences(s.Clusters.Items) + if len(endpoints) != len(s.Endpoints.Items) { + return fmt.Errorf("mismatched endpoint reference and resource lengths: %v != %d", endpoints, len(s.Endpoints.Items)) + } + if err := superset(endpoints, s.Endpoints.Items); err != nil { + return err + } + + routes := GetResourceReferences(s.Listeners.Items) + if len(routes) != len(s.Routes.Items) { + return fmt.Errorf("mismatched route reference and resource lengths: %v != %d", routes, len(s.Routes.Items)) + } + return superset(routes, s.Routes.Items) +} + +// GetResources selects snapshot resources by type. +func (s *Snapshot) GetResources(typ string) map[string]Resource { + if s == nil { + return nil + } + switch typ { + case EndpointType: + return s.Endpoints.Items + case ClusterType: + return s.Clusters.Items + case RouteType: + return s.Routes.Items + case ListenerType: + return s.Listeners.Items + } + return nil +} + +// GetVersion returns the version for a resource type. +func (s *Snapshot) GetVersion(typ string) string { + if s == nil { + return "" + } + switch typ { + case EndpointType: + return s.Endpoints.Version + case ClusterType: + return s.Clusters.Version + case RouteType: + return s.Routes.Version + case ListenerType: + return s.Listeners.Version + } + return "" +} diff --git a/vendor/github.com/envoyproxy/go-control-plane/pkg/cache/status.go b/vendor/github.com/envoyproxy/go-control-plane/pkg/cache/status.go new file mode 100644 index 000000000000..6b7ed4f925e6 --- /dev/null +++ b/vendor/github.com/envoyproxy/go-control-plane/pkg/cache/status.go @@ -0,0 +1,92 @@ +// Copyright 2018 Envoyproxy Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package cache + +import ( + "sync" + "time" + + "github.com/envoyproxy/go-control-plane/envoy/api/v2/core" +) + +// NodeHash computes string identifiers for Envoy nodes. +type NodeHash interface { + // ID function defines a unique string identifier for the remote Envoy node. + ID(node *core.Node) string +} + +// StatusInfo tracks the server state for the remote Envoy node. +// Not all fields are used by all cache implementations. +type StatusInfo interface { + // GetNode returns the node metadata. + GetNode() *core.Node + + // GetNumWatches returns the number of open watches. + GetNumWatches() int + + // GetLastWatchRequestTime returns the timestamp of the last discovery watch request. + GetLastWatchRequestTime() time.Time +} + +type statusInfo struct { + // node is the constant Envoy node metadata. + node *core.Node + + // watches are indexed channels for the response watches and the original requests. + watches map[int64]ResponseWatch + + // the timestamp of the last watch request + lastWatchRequestTime time.Time + + // mutex to protect the status fields. + // should not acquire mutex of the parent cache after acquiring this mutex. + mu sync.RWMutex +} + +// ResponseWatch is a watch record keeping both the request and an open channel for the response. +type ResponseWatch struct { + // Request is the original request for the watch. + Request Request + + // Response is the channel to push response to. + Response chan Response +} + +// newStatusInfo initializes a status info data structure. +func newStatusInfo(node *core.Node) *statusInfo { + out := statusInfo{ + node: node, + watches: make(map[int64]ResponseWatch), + } + return &out +} + +func (info *statusInfo) GetNode() *core.Node { + info.mu.RLock() + defer info.mu.RUnlock() + return info.node +} + +func (info *statusInfo) GetNumWatches() int { + info.mu.RLock() + defer info.mu.RUnlock() + return len(info.watches) +} + +func (info *statusInfo) GetLastWatchRequestTime() time.Time { + info.mu.RLock() + defer info.mu.RUnlock() + return info.lastWatchRequestTime +} diff --git a/vendor/github.com/envoyproxy/go-control-plane/pkg/log/log.go b/vendor/github.com/envoyproxy/go-control-plane/pkg/log/log.go new file mode 100644 index 000000000000..60b0226438ff --- /dev/null +++ b/vendor/github.com/envoyproxy/go-control-plane/pkg/log/log.go @@ -0,0 +1,25 @@ +// Copyright 2018 Envoyproxy Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package log provides a logging interface for use in this library. +package log + +// Logger interface for reporting informational and warning messages. +type Logger interface { + // Infof logs a formatted informational message. + Infof(format string, args ...interface{}) + + // Errorf logs a formatted error message. + Errorf(format string, args ...interface{}) +} diff --git a/vendor/github.com/envoyproxy/go-control-plane/pkg/server/gateway.go b/vendor/github.com/envoyproxy/go-control-plane/pkg/server/gateway.go new file mode 100644 index 000000000000..6d27618af0b0 --- /dev/null +++ b/vendor/github.com/envoyproxy/go-control-plane/pkg/server/gateway.go @@ -0,0 +1,95 @@ +// Copyright 2018 Envoyproxy Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package server + +import ( + "bytes" + "io/ioutil" + "net/http" + "path" + + "github.com/gogo/protobuf/jsonpb" + + "github.com/envoyproxy/go-control-plane/envoy/api/v2" + "github.com/envoyproxy/go-control-plane/pkg/cache" + "github.com/envoyproxy/go-control-plane/pkg/log" +) + +// HTTPGateway is a custom implementation of [gRPC gateway](https://github.com/grpc-ecosystem/grpc-gateway) +// specialized to Envoy xDS API. +type HTTPGateway struct { + // Log is an optional log for errors in response write + Log log.Logger + + // Server is the underlying gRPC server + Server Server +} + +func (h *HTTPGateway) ServeHTTP(resp http.ResponseWriter, req *http.Request) { + p := path.Clean(req.URL.Path) + + typeURL := "" + switch p { + case "/v2/discovery:endpoints": + typeURL = cache.EndpointType + case "/v2/discovery:clusters": + typeURL = cache.ClusterType + case "/v2/discovery:listeners": + typeURL = cache.ListenerType + case "/v2/discovery:routes": + typeURL = cache.RouteType + default: + http.Error(resp, "no endpoint", http.StatusNotFound) + return + } + + if req.Body == nil { + http.Error(resp, "empty body", http.StatusBadRequest) + return + } + + body, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(resp, "cannot read body", http.StatusBadRequest) + return + } + + // parse as JSON + out := &v2.DiscoveryRequest{} + err = jsonpb.UnmarshalString(string(body), out) + if err != nil { + http.Error(resp, "cannot parse JSON body: "+err.Error(), http.StatusBadRequest) + return + } + out.TypeUrl = typeURL + + // fetch results + res, err := h.Server.Fetch(req.Context(), out) + if err != nil { + // Note that this is treated as internal error. We may want to use another code for + // the latest version fetch request. + http.Error(resp, "fetch error: "+err.Error(), http.StatusInternalServerError) + return + } + + buf := &bytes.Buffer{} + if err := (&jsonpb.Marshaler{OrigName: true}).Marshal(buf, res); err != nil { + http.Error(resp, "marshal error: "+err.Error(), http.StatusInternalServerError) + } + + if _, err = resp.Write(buf.Bytes()); err != nil && h.Log != nil { + h.Log.Errorf("gateway error: %v", err) + } +} diff --git a/vendor/github.com/envoyproxy/go-control-plane/pkg/server/server.go b/vendor/github.com/envoyproxy/go-control-plane/pkg/server/server.go new file mode 100644 index 000000000000..7dccd17479a7 --- /dev/null +++ b/vendor/github.com/envoyproxy/go-control-plane/pkg/server/server.go @@ -0,0 +1,377 @@ +// Copyright 2018 Envoyproxy Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package server provides an implementation of a streaming xDS server. +package server + +import ( + "context" + "errors" + "strconv" + "sync/atomic" + + "github.com/gogo/protobuf/proto" + "github.com/gogo/protobuf/types" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + + "github.com/envoyproxy/go-control-plane/envoy/api/v2" + discovery "github.com/envoyproxy/go-control-plane/envoy/service/discovery/v2" + "github.com/envoyproxy/go-control-plane/pkg/cache" +) + +// Server is a collection of handlers for streaming discovery requests. +type Server interface { + v2.EndpointDiscoveryServiceServer + v2.ClusterDiscoveryServiceServer + v2.RouteDiscoveryServiceServer + v2.ListenerDiscoveryServiceServer + discovery.AggregatedDiscoveryServiceServer + + // Fetch is the universal fetch method. + Fetch(context.Context, *v2.DiscoveryRequest) (*v2.DiscoveryResponse, error) +} + +// Callbacks is a collection of callbacks inserted into the server operation. +// The callbacks are invoked synchronously. +type Callbacks interface { + // OnStreamOpen is called once an xDS stream is open with a stream ID and the type URL (or "" for ADS). + OnStreamOpen(int64, string) + // OnStreamClosed is called immediately prior to closing an xDS stream with a stream ID. + OnStreamClosed(int64) + // OnStreamRequest is called once a request is received on a stream. + OnStreamRequest(int64, *v2.DiscoveryRequest) + // OnStreamResponse is called immediately prior to sending a response on a stream. + OnStreamResponse(int64, *v2.DiscoveryRequest, *v2.DiscoveryResponse) + // OnFetchRequest is called for each Fetch request + OnFetchRequest(*v2.DiscoveryRequest) + // OnFetchResponse is called immediately prior to sending a response. + OnFetchResponse(*v2.DiscoveryRequest, *v2.DiscoveryResponse) +} + +// NewServer creates handlers from a config watcher and an optional logger. +func NewServer(config cache.Cache, callbacks Callbacks) Server { + return &server{cache: config, callbacks: callbacks} +} + +type server struct { + cache cache.Cache + callbacks Callbacks + + // streamCount for counting bi-di streams + streamCount int64 +} + +type stream interface { + Send(*v2.DiscoveryResponse) error + Recv() (*v2.DiscoveryRequest, error) +} + +// watches for all xDS resource types +type watches struct { + endpoints chan cache.Response + clusters chan cache.Response + routes chan cache.Response + listeners chan cache.Response + + endpointCancel func() + clusterCancel func() + routeCancel func() + listenerCancel func() + + endpointNonce string + clusterNonce string + routeNonce string + listenerNonce string +} + +// Cancel all watches +func (values watches) Cancel() { + if values.endpointCancel != nil { + values.endpointCancel() + } + if values.clusterCancel != nil { + values.clusterCancel() + } + if values.routeCancel != nil { + values.routeCancel() + } + if values.listenerCancel != nil { + values.listenerCancel() + } +} + +func createResponse(resp *cache.Response, typeURL string) (*v2.DiscoveryResponse, error) { + if resp == nil { + return nil, errors.New("missing response") + } + resources := make([]types.Any, len(resp.Resources)) + for i := 0; i < len(resp.Resources); i++ { + data, err := proto.Marshal(resp.Resources[i]) + if err != nil { + return nil, err + } + resources[i] = types.Any{ + TypeUrl: typeURL, + Value: data, + } + } + out := &v2.DiscoveryResponse{ + VersionInfo: resp.Version, + Resources: resources, + TypeUrl: typeURL, + } + return out, nil +} + +// process handles a bi-di stream request +func (s *server) process(stream stream, reqCh <-chan *v2.DiscoveryRequest, defaultTypeURL string) error { + // increment stream count + streamID := atomic.AddInt64(&s.streamCount, 1) + + // unique nonce generator for req-resp pairs per xDS stream; the server + // ignores stale nonces. nonce is only modified within send() function. + var streamNonce int64 + + // a collection of watches per request type + var values watches + defer func() { + values.Cancel() + if s.callbacks != nil { + s.callbacks.OnStreamClosed(streamID) + } + }() + + // sends a response by serializing to protobuf Any + send := func(resp cache.Response, typeURL string) (string, error) { + out, err := createResponse(&resp, typeURL) + if err != nil { + return "", err + } + + // increment nonce + streamNonce = streamNonce + 1 + out.Nonce = strconv.FormatInt(streamNonce, 10) + if s.callbacks != nil { + s.callbacks.OnStreamResponse(streamID, &resp.Request, out) + } + return out.Nonce, stream.Send(out) + } + + if s.callbacks != nil { + s.callbacks.OnStreamOpen(streamID, defaultTypeURL) + } + + for { + select { + // config watcher can send the requested resources types in any order + case resp, more := <-values.endpoints: + if !more { + return status.Errorf(codes.Unavailable, "endpoints watch failed") + } + nonce, err := send(resp, cache.EndpointType) + if err != nil { + return err + } + values.endpointNonce = nonce + + case resp, more := <-values.clusters: + if !more { + return status.Errorf(codes.Unavailable, "clusters watch failed") + } + nonce, err := send(resp, cache.ClusterType) + if err != nil { + return err + } + values.clusterNonce = nonce + + case resp, more := <-values.routes: + if !more { + return status.Errorf(codes.Unavailable, "routes watch failed") + } + nonce, err := send(resp, cache.RouteType) + if err != nil { + return err + } + values.routeNonce = nonce + + case resp, more := <-values.listeners: + if !more { + return status.Errorf(codes.Unavailable, "listeners watch failed") + } + nonce, err := send(resp, cache.ListenerType) + if err != nil { + return err + } + values.listenerNonce = nonce + + case req, more := <-reqCh: + // input stream ended or errored out + if !more { + return nil + } + if req == nil { + return status.Errorf(codes.Unavailable, "empty request") + } + + // nonces can be reused across streams; we verify nonce only if nonce is not initialized + nonce := req.GetResponseNonce() + + // type URL is required for ADS but is implicit for xDS + if defaultTypeURL == cache.AnyType { + if req.TypeUrl == "" { + return status.Errorf(codes.InvalidArgument, "type URL is required for ADS") + } + } else if req.TypeUrl == "" { + req.TypeUrl = defaultTypeURL + } + + if s.callbacks != nil { + s.callbacks.OnStreamRequest(streamID, req) + } + + // cancel existing watches to (re-)request a newer version + switch { + case req.TypeUrl == cache.EndpointType && (values.endpointNonce == "" || values.endpointNonce == nonce): + if values.endpointCancel != nil { + values.endpointCancel() + } + values.endpoints, values.endpointCancel = s.cache.CreateWatch(*req) + case req.TypeUrl == cache.ClusterType && (values.clusterNonce == "" || values.clusterNonce == nonce): + if values.clusterCancel != nil { + values.clusterCancel() + } + values.clusters, values.clusterCancel = s.cache.CreateWatch(*req) + case req.TypeUrl == cache.RouteType && (values.routeNonce == "" || values.routeNonce == nonce): + if values.routeCancel != nil { + values.routeCancel() + } + values.routes, values.routeCancel = s.cache.CreateWatch(*req) + case req.TypeUrl == cache.ListenerType && (values.listenerNonce == "" || values.listenerNonce == nonce): + if values.listenerCancel != nil { + values.listenerCancel() + } + values.listeners, values.listenerCancel = s.cache.CreateWatch(*req) + } + } + } +} + +// handler converts a blocking read call to channels and initiates stream processing +func (s *server) handler(stream stream, typeURL string) error { + // a channel for receiving incoming requests + reqCh := make(chan *v2.DiscoveryRequest) + reqStop := int32(0) + go func() { + for { + req, err := stream.Recv() + if atomic.LoadInt32(&reqStop) != 0 { + return + } + if err != nil { + close(reqCh) + return + } + reqCh <- req + } + }() + + err := s.process(stream, reqCh, typeURL) + + // prevents writing to a closed channel if send failed on blocked recv + // TODO(kuat) figure out how to unblock recv through gRPC API + atomic.StoreInt32(&reqStop, 1) + + return err +} + +func (s *server) StreamAggregatedResources(stream discovery.AggregatedDiscoveryService_StreamAggregatedResourcesServer) error { + return s.handler(stream, cache.AnyType) +} + +func (s *server) StreamEndpoints(stream v2.EndpointDiscoveryService_StreamEndpointsServer) error { + return s.handler(stream, cache.EndpointType) +} + +func (s *server) StreamClusters(stream v2.ClusterDiscoveryService_StreamClustersServer) error { + return s.handler(stream, cache.ClusterType) +} + +func (s *server) StreamRoutes(stream v2.RouteDiscoveryService_StreamRoutesServer) error { + return s.handler(stream, cache.RouteType) +} + +func (s *server) StreamListeners(stream v2.ListenerDiscoveryService_StreamListenersServer) error { + return s.handler(stream, cache.ListenerType) +} + +// Fetch is the universal fetch method. +func (s *server) Fetch(ctx context.Context, req *v2.DiscoveryRequest) (*v2.DiscoveryResponse, error) { + if s.callbacks != nil { + s.callbacks.OnFetchRequest(req) + } + resp, err := s.cache.Fetch(ctx, *req) + if err != nil { + return nil, err + } + out, err := createResponse(resp, req.TypeUrl) + if s.callbacks != nil { + s.callbacks.OnFetchResponse(req, out) + } + return out, err +} + +func (s *server) FetchEndpoints(ctx context.Context, req *v2.DiscoveryRequest) (*v2.DiscoveryResponse, error) { + if req == nil { + return nil, status.Errorf(codes.Unavailable, "empty request") + } + req.TypeUrl = cache.EndpointType + return s.Fetch(ctx, req) +} + +func (s *server) FetchClusters(ctx context.Context, req *v2.DiscoveryRequest) (*v2.DiscoveryResponse, error) { + if req == nil { + return nil, status.Errorf(codes.Unavailable, "empty request") + } + req.TypeUrl = cache.ClusterType + return s.Fetch(ctx, req) +} + +func (s *server) FetchRoutes(ctx context.Context, req *v2.DiscoveryRequest) (*v2.DiscoveryResponse, error) { + if req == nil { + return nil, status.Errorf(codes.Unavailable, "empty request") + } + req.TypeUrl = cache.RouteType + return s.Fetch(ctx, req) +} + +func (s *server) FetchListeners(ctx context.Context, req *v2.DiscoveryRequest) (*v2.DiscoveryResponse, error) { + if req == nil { + return nil, status.Errorf(codes.Unavailable, "empty request") + } + req.TypeUrl = cache.ListenerType + return s.Fetch(ctx, req) +} + +func (s *server) IncrementalAggregatedResources(_ discovery.AggregatedDiscoveryService_IncrementalAggregatedResourcesServer) error { + return errors.New("not implemented") +} + +func (s *server) IncrementalClusters(_ v2.ClusterDiscoveryService_IncrementalClustersServer) error { + return errors.New("not implemented") +} + +func (s *server) IncrementalRoutes(_ v2.RouteDiscoveryService_IncrementalRoutesServer) error { + return errors.New("not implemented") +} diff --git a/vendor/github.com/envoyproxy/go-control-plane/pkg/util/struct.go b/vendor/github.com/envoyproxy/go-control-plane/pkg/util/struct.go new file mode 100644 index 000000000000..a56e8f956756 --- /dev/null +++ b/vendor/github.com/envoyproxy/go-control-plane/pkg/util/struct.go @@ -0,0 +1,60 @@ +// Copyright 2018 Envoyproxy Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package util contains shared utility functions. +package util + +import ( + "bytes" + "errors" + + "github.com/gogo/protobuf/jsonpb" + "github.com/gogo/protobuf/proto" + "github.com/gogo/protobuf/types" +) + +// MessageToStruct encodes a protobuf Message into a Struct. Hilariously, it +// uses JSON as the intermediary +// author:glen@turbinelabs.io +func MessageToStruct(msg proto.Message) (*types.Struct, error) { + if msg == nil { + return nil, errors.New("nil message") + } + + buf := &bytes.Buffer{} + if err := (&jsonpb.Marshaler{OrigName: true}).Marshal(buf, msg); err != nil { + return nil, err + } + + pbs := &types.Struct{} + if err := jsonpb.Unmarshal(buf, pbs); err != nil { + return nil, err + } + + return pbs, nil +} + +// StructToMessage decodes a protobuf Message from a Struct. +func StructToMessage(pbst *types.Struct, out proto.Message) error { + if pbst == nil { + return errors.New("nil struct") + } + + buf := &bytes.Buffer{} + if err := (&jsonpb.Marshaler{OrigName: true}).Marshal(buf, pbst); err != nil { + return err + } + + return jsonpb.Unmarshal(buf, out) +} diff --git a/vendor/github.com/envoyproxy/go-control-plane/pkg/util/wellknown.go b/vendor/github.com/envoyproxy/go-control-plane/pkg/util/wellknown.go new file mode 100644 index 000000000000..4025f8863585 --- /dev/null +++ b/vendor/github.com/envoyproxy/go-control-plane/pkg/util/wellknown.go @@ -0,0 +1,107 @@ +// Copyright 2018 Envoyproxy Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package util + +// HTTP filter names +const ( + // Buffer HTTP filter + Buffer = "envoy.buffer" + // CORS HTTP filter + CORS = "envoy.cors" + // Dynamo HTTP filter + Dynamo = "envoy.http_dynamo_filter" + // Fault HTTP filter + Fault = "envoy.fault" + // GRPCHTTP1Bridge HTTP filter + GRPCHTTP1Bridge = "envoy.grpc_http1_bridge" + // GRPCJSONTranscoder HTTP filter + GRPCJSONTranscoder = "envoy.grpc_json_transcoder" + // GRPCWeb HTTP filter + GRPCWeb = "envoy.grpc_web" + // Gzip HTTP filter + Gzip = "envoy.gzip" + // IPTagging HTTP filter + IPTagging = "envoy.ip_tagging" + // HTTPRateLimit filter + HTTPRateLimit = "envoy.rate_limit" + // Router HTTP filter + Router = "envoy.router" + // Health checking HTTP filter + HealthCheck = "envoy.health_check" + // Lua HTTP filter + Lua = "envoy.lua" + // Squash HTTP filter + Squash = "envoy.squash" + // HTTPExternalAuthorization HTTP filter + HTTPExternalAuthorization = "envoy.ext_authz" +) + +// Network filter names +const ( + // ClientSSLAuth network filter + ClientSSLAuth = "envoy.client_ssl_auth" + // Echo network filter + Echo = "envoy.echo" + // HTTPConnectionManager network filter + HTTPConnectionManager = "envoy.http_connection_manager" + // TCPProxy network filter + TCPProxy = "envoy.tcp_proxy" + // RateLimit network filter + RateLimit = "envoy.ratelimit" + // MongoProxy network filter + MongoProxy = "envoy.mongo_proxy" + // ThriftProxy network filter + ThriftProxy = "envoy.filters.network.thrift_proxy" + // RedisProxy network filter + RedisProxy = "envoy.redis_proxy" + // ExternalAuthorization network filter + ExternalAuthorization = "envoy.ext_authz" +) + +// Listener filter names +const ( + // OriginalDestination listener filter + OriginalDestination = "envoy.listener.original_dst" + // ProxyProtocol listener filter + ProxyProtocol = "envoy.listener.proxy_protocol" +) + +// Tracing provider names +const ( + // Lightstep tracer name + Lightstep = "envoy.lightstep" + // Zipkin tracer name + Zipkin = "envoy.zipkin" + // DynamicOT tracer name + DynamicOT = "envoy.dynamic.ot" +) + +// Stats sink names +const ( + // Statsd sink + Statsd = "envoy.statsd" + // DogStatsD compatible stastsd sink + DogStatsd = "envoy.dog_statsd" + // MetricsService sink + MetricsService = "envoy.metrics_service" +) + +// Access log sink names +const ( + // FileAccessLog sink name + FileAccessLog = "envoy.file_access_log" + // HTTPGRPCAccessLog sink for the HTTP gRPC access log service + HTTPGRPCAccessLog = "envoy.http_grpc_access_log" +) diff --git a/vendor/github.com/gogo/googleapis/LICENSE b/vendor/github.com/gogo/googleapis/LICENSE new file mode 100644 index 000000000000..d6f85b181780 --- /dev/null +++ b/vendor/github.com/gogo/googleapis/LICENSE @@ -0,0 +1,203 @@ +Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2015, Google Inc + Copyright 2018, GoGo Authors + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + diff --git a/vendor/github.com/gogo/googleapis/google/api/annotations.pb.go b/vendor/github.com/gogo/googleapis/google/api/annotations.pb.go new file mode 100644 index 000000000000..b2c49a92f0f0 --- /dev/null +++ b/vendor/github.com/gogo/googleapis/google/api/annotations.pb.go @@ -0,0 +1,56 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: google/api/annotations.proto + +package api + +import proto "github.com/gogo/protobuf/proto" +import fmt "fmt" +import math "math" +import descriptor "github.com/gogo/protobuf/protoc-gen-gogo/descriptor" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package + +var E_Http = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.MethodOptions)(nil), + ExtensionType: (*HttpRule)(nil), + Field: 72295728, + Name: "google.api.http", + Tag: "bytes,72295728,opt,name=http", + Filename: "google/api/annotations.proto", +} + +func init() { + proto.RegisterExtension(E_Http) +} + +func init() { + proto.RegisterFile("google/api/annotations.proto", fileDescriptor_annotations_0def7614f850d31e) +} + +var fileDescriptor_annotations_0def7614f850d31e = []byte{ + // 230 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x49, 0xcf, 0xcf, 0x4f, + 0xcf, 0x49, 0xd5, 0x4f, 0x2c, 0xc8, 0xd4, 0x4f, 0xcc, 0xcb, 0xcb, 0x2f, 0x49, 0x2c, 0xc9, 0xcc, + 0xcf, 0x2b, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x82, 0xc8, 0xea, 0x25, 0x16, 0x64, + 0x4a, 0x89, 0x22, 0xa9, 0xcc, 0x28, 0x29, 0x29, 0x80, 0x28, 0x91, 0x52, 0x80, 0x0a, 0x83, 0x79, + 0x49, 0xa5, 0x69, 0xfa, 0x29, 0xa9, 0xc5, 0xc9, 0x45, 0x99, 0x05, 0x25, 0xf9, 0x45, 0x10, 0x15, + 0x56, 0xde, 0x5c, 0x2c, 0x20, 0xf5, 0x42, 0x72, 0x7a, 0x50, 0xd3, 0x60, 0x4a, 0xf5, 0x7c, 0x53, + 0x4b, 0x32, 0xf2, 0x53, 0xfc, 0x0b, 0xc0, 0x56, 0x4a, 0x6c, 0x38, 0xb5, 0x47, 0x49, 0x81, 0x51, + 0x83, 0xdb, 0x48, 0x44, 0x0f, 0x61, 0xad, 0x9e, 0x47, 0x49, 0x49, 0x41, 0x50, 0x69, 0x4e, 0x6a, + 0x10, 0xd8, 0x10, 0xa7, 0x84, 0x0b, 0x0f, 0xe5, 0x18, 0x6e, 0x3c, 0x94, 0x63, 0xf8, 0xf0, 0x50, + 0x8e, 0xf1, 0xc7, 0x43, 0x39, 0xc6, 0x86, 0x47, 0x72, 0x8c, 0x2b, 0x1e, 0xc9, 0x31, 0x9e, 0x78, + 0x24, 0xc7, 0x78, 0xe1, 0x91, 0x1c, 0xe3, 0x83, 0x47, 0x72, 0x8c, 0x2f, 0x1e, 0xc9, 0x31, 0x7c, + 0x00, 0x89, 0x3d, 0x96, 0x63, 0xe4, 0xe2, 0x4b, 0xce, 0xcf, 0x45, 0x32, 0xd0, 0x49, 0xc0, 0x11, + 0xe1, 0xcd, 0x00, 0x90, 0x4b, 0x02, 0x18, 0xa3, 0x98, 0x13, 0x0b, 0x32, 0x17, 0x31, 0xb1, 0xb8, + 0x3b, 0x06, 0x78, 0x26, 0xb1, 0x81, 0x9d, 0x67, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, 0x92, 0x1b, + 0xe6, 0x45, 0x1a, 0x01, 0x00, 0x00, +} diff --git a/vendor/google.golang.org/grpc/health/grpc_health_v1/health.proto b/vendor/github.com/gogo/googleapis/google/api/annotations.proto similarity index 59% rename from vendor/google.golang.org/grpc/health/grpc_health_v1/health.proto rename to vendor/github.com/gogo/googleapis/google/api/annotations.proto index 6072fdc3b801..9daedc9f7e9f 100644 --- a/vendor/google.golang.org/grpc/health/grpc_health_v1/health.proto +++ b/vendor/github.com/gogo/googleapis/google/api/annotations.proto @@ -1,4 +1,4 @@ -// Copyright 2017 gRPC authors. +// Copyright (c) 2015, Google Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -14,21 +14,18 @@ syntax = "proto3"; -package grpc.health.v1; +package google.api; -message HealthCheckRequest { - string service = 1; -} +import "google/api/http.proto"; +import "google/protobuf/descriptor.proto"; -message HealthCheckResponse { - enum ServingStatus { - UNKNOWN = 0; - SERVING = 1; - NOT_SERVING = 2; - } - ServingStatus status = 1; -} +option go_package = "api"; +option java_multiple_files = true; +option java_outer_classname = "AnnotationsProto"; +option java_package = "com.google.api"; +option objc_class_prefix = "GAPI"; -service Health{ - rpc Check(HealthCheckRequest) returns (HealthCheckResponse); -} +extend google.protobuf.MethodOptions { + // See `HttpRule`. + HttpRule http = 72295728; +} diff --git a/vendor/github.com/gogo/googleapis/google/api/http.pb.go b/vendor/github.com/gogo/googleapis/google/api/http.pb.go new file mode 100644 index 000000000000..b2bba63db622 --- /dev/null +++ b/vendor/github.com/gogo/googleapis/google/api/http.pb.go @@ -0,0 +1,2338 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: google/api/http.proto + +package api + +import proto "github.com/gogo/protobuf/proto" +import fmt "fmt" +import math "math" + +import bytes "bytes" + +import strings "strings" +import reflect "reflect" + +import io "io" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package + +// Defines the HTTP configuration for an API service. It contains a list of +// [HttpRule][google.api.HttpRule], each specifying the mapping of an RPC method +// to one or more HTTP REST API methods. +type Http struct { + // A list of HTTP configuration rules that apply to individual API methods. + // + // **NOTE:** All service configuration rules follow "last one wins" order. + Rules []*HttpRule `protobuf:"bytes,1,rep,name=rules" json:"rules,omitempty"` + // When set to true, URL path parmeters will be fully URI-decoded except in + // cases of single segment matches in reserved expansion, where "%2F" will be + // left encoded. + // + // The default behavior is to not decode RFC 6570 reserved characters in multi + // segment matches. + FullyDecodeReservedExpansion bool `protobuf:"varint,2,opt,name=fully_decode_reserved_expansion,json=fullyDecodeReservedExpansion,proto3" json:"fully_decode_reserved_expansion,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Http) Reset() { *m = Http{} } +func (*Http) ProtoMessage() {} +func (*Http) Descriptor() ([]byte, []int) { + return fileDescriptor_http_0b206a4af4ed46aa, []int{0} +} +func (m *Http) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Http) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Http.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *Http) XXX_Merge(src proto.Message) { + xxx_messageInfo_Http.Merge(dst, src) +} +func (m *Http) XXX_Size() int { + return m.Size() +} +func (m *Http) XXX_DiscardUnknown() { + xxx_messageInfo_Http.DiscardUnknown(m) +} + +var xxx_messageInfo_Http proto.InternalMessageInfo + +func (m *Http) GetRules() []*HttpRule { + if m != nil { + return m.Rules + } + return nil +} + +func (m *Http) GetFullyDecodeReservedExpansion() bool { + if m != nil { + return m.FullyDecodeReservedExpansion + } + return false +} + +func (*Http) XXX_MessageName() string { + return "google.api.Http" +} + +// `HttpRule` defines the mapping of an RPC method to one or more HTTP +// REST API methods. The mapping specifies how different portions of the RPC +// request message are mapped to URL path, URL query parameters, and +// HTTP request body. The mapping is typically specified as an +// `google.api.http` annotation on the RPC method, +// see "google/api/annotations.proto" for details. +// +// The mapping consists of a field specifying the path template and +// method kind. The path template can refer to fields in the request +// message, as in the example below which describes a REST GET +// operation on a resource collection of messages: +// +// +// service Messaging { +// rpc GetMessage(GetMessageRequest) returns (Message) { +// option (google.api.http).get = "/v1/messages/{message_id}/{sub.subfield}"; +// } +// } +// message GetMessageRequest { +// message SubMessage { +// string subfield = 1; +// } +// string message_id = 1; // mapped to the URL +// SubMessage sub = 2; // `sub.subfield` is url-mapped +// } +// message Message { +// string text = 1; // content of the resource +// } +// +// The same http annotation can alternatively be expressed inside the +// `GRPC API Configuration` YAML file. +// +// http: +// rules: +// - selector: .Messaging.GetMessage +// get: /v1/messages/{message_id}/{sub.subfield} +// +// This definition enables an automatic, bidrectional mapping of HTTP +// JSON to RPC. Example: +// +// HTTP | RPC +// -----|----- +// `GET /v1/messages/123456/foo` | `GetMessage(message_id: "123456" sub: SubMessage(subfield: "foo"))` +// +// In general, not only fields but also field paths can be referenced +// from a path pattern. Fields mapped to the path pattern cannot be +// repeated and must have a primitive (non-message) type. +// +// Any fields in the request message which are not bound by the path +// pattern automatically become (optional) HTTP query +// parameters. Assume the following definition of the request message: +// +// +// service Messaging { +// rpc GetMessage(GetMessageRequest) returns (Message) { +// option (google.api.http).get = "/v1/messages/{message_id}"; +// } +// } +// message GetMessageRequest { +// message SubMessage { +// string subfield = 1; +// } +// string message_id = 1; // mapped to the URL +// int64 revision = 2; // becomes a parameter +// SubMessage sub = 3; // `sub.subfield` becomes a parameter +// } +// +// +// This enables a HTTP JSON to RPC mapping as below: +// +// HTTP | RPC +// -----|----- +// `GET /v1/messages/123456?revision=2&sub.subfield=foo` | `GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield: "foo"))` +// +// Note that fields which are mapped to HTTP parameters must have a +// primitive type or a repeated primitive type. Message types are not +// allowed. In the case of a repeated type, the parameter can be +// repeated in the URL, as in `...?param=A¶m=B`. +// +// For HTTP method kinds which allow a request body, the `body` field +// specifies the mapping. Consider a REST update method on the +// message resource collection: +// +// +// service Messaging { +// rpc UpdateMessage(UpdateMessageRequest) returns (Message) { +// option (google.api.http) = { +// put: "/v1/messages/{message_id}" +// body: "message" +// }; +// } +// } +// message UpdateMessageRequest { +// string message_id = 1; // mapped to the URL +// Message message = 2; // mapped to the body +// } +// +// +// The following HTTP JSON to RPC mapping is enabled, where the +// representation of the JSON in the request body is determined by +// protos JSON encoding: +// +// HTTP | RPC +// -----|----- +// `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" message { text: "Hi!" })` +// +// The special name `*` can be used in the body mapping to define that +// every field not bound by the path template should be mapped to the +// request body. This enables the following alternative definition of +// the update method: +// +// service Messaging { +// rpc UpdateMessage(Message) returns (Message) { +// option (google.api.http) = { +// put: "/v1/messages/{message_id}" +// body: "*" +// }; +// } +// } +// message Message { +// string message_id = 1; +// string text = 2; +// } +// +// +// The following HTTP JSON to RPC mapping is enabled: +// +// HTTP | RPC +// -----|----- +// `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" text: "Hi!")` +// +// Note that when using `*` in the body mapping, it is not possible to +// have HTTP parameters, as all fields not bound by the path end in +// the body. This makes this option more rarely used in practice of +// defining REST APIs. The common usage of `*` is in custom methods +// which don't use the URL at all for transferring data. +// +// It is possible to define multiple HTTP methods for one RPC by using +// the `additional_bindings` option. Example: +// +// service Messaging { +// rpc GetMessage(GetMessageRequest) returns (Message) { +// option (google.api.http) = { +// get: "/v1/messages/{message_id}" +// additional_bindings { +// get: "/v1/users/{user_id}/messages/{message_id}" +// } +// }; +// } +// } +// message GetMessageRequest { +// string message_id = 1; +// string user_id = 2; +// } +// +// +// This enables the following two alternative HTTP JSON to RPC +// mappings: +// +// HTTP | RPC +// -----|----- +// `GET /v1/messages/123456` | `GetMessage(message_id: "123456")` +// `GET /v1/users/me/messages/123456` | `GetMessage(user_id: "me" message_id: "123456")` +// +// # Rules for HTTP mapping +// +// The rules for mapping HTTP path, query parameters, and body fields +// to the request message are as follows: +// +// 1. The `body` field specifies either `*` or a field path, or is +// omitted. If omitted, it indicates there is no HTTP request body. +// 2. Leaf fields (recursive expansion of nested messages in the +// request) can be classified into three types: +// (a) Matched in the URL template. +// (b) Covered by body (if body is `*`, everything except (a) fields; +// else everything under the body field) +// (c) All other fields. +// 3. URL query parameters found in the HTTP request are mapped to (c) fields. +// 4. Any body sent with an HTTP request can contain only (b) fields. +// +// The syntax of the path template is as follows: +// +// Template = "/" Segments [ Verb ] ; +// Segments = Segment { "/" Segment } ; +// Segment = "*" | "**" | LITERAL | Variable ; +// Variable = "{" FieldPath [ "=" Segments ] "}" ; +// FieldPath = IDENT { "." IDENT } ; +// Verb = ":" LITERAL ; +// +// The syntax `*` matches a single path segment. The syntax `**` matches zero +// or more path segments, which must be the last part of the path except the +// `Verb`. The syntax `LITERAL` matches literal text in the path. +// +// The syntax `Variable` matches part of the URL path as specified by its +// template. A variable template must not contain other variables. If a variable +// matches a single path segment, its template may be omitted, e.g. `{var}` +// is equivalent to `{var=*}`. +// +// If a variable contains exactly one path segment, such as `"{var}"` or +// `"{var=*}"`, when such a variable is expanded into a URL path, all characters +// except `[-_.~0-9a-zA-Z]` are percent-encoded. Such variables show up in the +// Discovery Document as `{var}`. +// +// If a variable contains one or more path segments, such as `"{var=foo/*}"` +// or `"{var=**}"`, when such a variable is expanded into a URL path, all +// characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. Such variables +// show up in the Discovery Document as `{+var}`. +// +// NOTE: While the single segment variable matches the semantics of +// [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 +// Simple String Expansion, the multi segment variable **does not** match +// RFC 6570 Reserved Expansion. The reason is that the Reserved Expansion +// does not expand special characters like `?` and `#`, which would lead +// to invalid URLs. +// +// NOTE: the field paths in variables and in the `body` must not refer to +// repeated fields or map fields. +type HttpRule struct { + // Selects methods to which this rule applies. + // + // Refer to [selector][google.api.DocumentationRule.selector] for syntax details. + Selector string `protobuf:"bytes,1,opt,name=selector,proto3" json:"selector,omitempty"` + // Determines the URL pattern is matched by this rules. This pattern can be + // used with any of the {get|put|post|delete|patch} methods. A custom method + // can be defined using the 'custom' field. + // + // Types that are valid to be assigned to Pattern: + // *HttpRule_Get + // *HttpRule_Put + // *HttpRule_Post + // *HttpRule_Delete + // *HttpRule_Patch + // *HttpRule_Custom + Pattern isHttpRule_Pattern `protobuf_oneof:"pattern"` + // The name of the request field whose value is mapped to the HTTP body, or + // `*` for mapping all fields not captured by the path pattern to the HTTP + // body. NOTE: the referred field must not be a repeated field and must be + // present at the top-level of request message type. + Body string `protobuf:"bytes,7,opt,name=body,proto3" json:"body,omitempty"` + // Optional. The name of the response field whose value is mapped to the HTTP + // body of response. Other response fields are ignored. When + // not set, the response message will be used as HTTP body of response. + ResponseBody string `protobuf:"bytes,12,opt,name=response_body,json=responseBody,proto3" json:"response_body,omitempty"` + // Additional HTTP bindings for the selector. Nested bindings must + // not contain an `additional_bindings` field themselves (that is, + // the nesting may only be one level deep). + AdditionalBindings []*HttpRule `protobuf:"bytes,11,rep,name=additional_bindings,json=additionalBindings" json:"additional_bindings,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *HttpRule) Reset() { *m = HttpRule{} } +func (*HttpRule) ProtoMessage() {} +func (*HttpRule) Descriptor() ([]byte, []int) { + return fileDescriptor_http_0b206a4af4ed46aa, []int{1} +} +func (m *HttpRule) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *HttpRule) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_HttpRule.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *HttpRule) XXX_Merge(src proto.Message) { + xxx_messageInfo_HttpRule.Merge(dst, src) +} +func (m *HttpRule) XXX_Size() int { + return m.Size() +} +func (m *HttpRule) XXX_DiscardUnknown() { + xxx_messageInfo_HttpRule.DiscardUnknown(m) +} + +var xxx_messageInfo_HttpRule proto.InternalMessageInfo + +type isHttpRule_Pattern interface { + isHttpRule_Pattern() + Equal(interface{}) bool + MarshalTo([]byte) (int, error) + Size() int +} + +type HttpRule_Get struct { + Get string `protobuf:"bytes,2,opt,name=get,proto3,oneof"` +} +type HttpRule_Put struct { + Put string `protobuf:"bytes,3,opt,name=put,proto3,oneof"` +} +type HttpRule_Post struct { + Post string `protobuf:"bytes,4,opt,name=post,proto3,oneof"` +} +type HttpRule_Delete struct { + Delete string `protobuf:"bytes,5,opt,name=delete,proto3,oneof"` +} +type HttpRule_Patch struct { + Patch string `protobuf:"bytes,6,opt,name=patch,proto3,oneof"` +} +type HttpRule_Custom struct { + Custom *CustomHttpPattern `protobuf:"bytes,8,opt,name=custom,oneof"` +} + +func (*HttpRule_Get) isHttpRule_Pattern() {} +func (*HttpRule_Put) isHttpRule_Pattern() {} +func (*HttpRule_Post) isHttpRule_Pattern() {} +func (*HttpRule_Delete) isHttpRule_Pattern() {} +func (*HttpRule_Patch) isHttpRule_Pattern() {} +func (*HttpRule_Custom) isHttpRule_Pattern() {} + +func (m *HttpRule) GetPattern() isHttpRule_Pattern { + if m != nil { + return m.Pattern + } + return nil +} + +func (m *HttpRule) GetSelector() string { + if m != nil { + return m.Selector + } + return "" +} + +func (m *HttpRule) GetGet() string { + if x, ok := m.GetPattern().(*HttpRule_Get); ok { + return x.Get + } + return "" +} + +func (m *HttpRule) GetPut() string { + if x, ok := m.GetPattern().(*HttpRule_Put); ok { + return x.Put + } + return "" +} + +func (m *HttpRule) GetPost() string { + if x, ok := m.GetPattern().(*HttpRule_Post); ok { + return x.Post + } + return "" +} + +func (m *HttpRule) GetDelete() string { + if x, ok := m.GetPattern().(*HttpRule_Delete); ok { + return x.Delete + } + return "" +} + +func (m *HttpRule) GetPatch() string { + if x, ok := m.GetPattern().(*HttpRule_Patch); ok { + return x.Patch + } + return "" +} + +func (m *HttpRule) GetCustom() *CustomHttpPattern { + if x, ok := m.GetPattern().(*HttpRule_Custom); ok { + return x.Custom + } + return nil +} + +func (m *HttpRule) GetBody() string { + if m != nil { + return m.Body + } + return "" +} + +func (m *HttpRule) GetResponseBody() string { + if m != nil { + return m.ResponseBody + } + return "" +} + +func (m *HttpRule) GetAdditionalBindings() []*HttpRule { + if m != nil { + return m.AdditionalBindings + } + return nil +} + +// XXX_OneofFuncs is for the internal use of the proto package. +func (*HttpRule) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { + return _HttpRule_OneofMarshaler, _HttpRule_OneofUnmarshaler, _HttpRule_OneofSizer, []interface{}{ + (*HttpRule_Get)(nil), + (*HttpRule_Put)(nil), + (*HttpRule_Post)(nil), + (*HttpRule_Delete)(nil), + (*HttpRule_Patch)(nil), + (*HttpRule_Custom)(nil), + } +} + +func _HttpRule_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { + m := msg.(*HttpRule) + // pattern + switch x := m.Pattern.(type) { + case *HttpRule_Get: + _ = b.EncodeVarint(2<<3 | proto.WireBytes) + _ = b.EncodeStringBytes(x.Get) + case *HttpRule_Put: + _ = b.EncodeVarint(3<<3 | proto.WireBytes) + _ = b.EncodeStringBytes(x.Put) + case *HttpRule_Post: + _ = b.EncodeVarint(4<<3 | proto.WireBytes) + _ = b.EncodeStringBytes(x.Post) + case *HttpRule_Delete: + _ = b.EncodeVarint(5<<3 | proto.WireBytes) + _ = b.EncodeStringBytes(x.Delete) + case *HttpRule_Patch: + _ = b.EncodeVarint(6<<3 | proto.WireBytes) + _ = b.EncodeStringBytes(x.Patch) + case *HttpRule_Custom: + _ = b.EncodeVarint(8<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.Custom); err != nil { + return err + } + case nil: + default: + return fmt.Errorf("HttpRule.Pattern has unexpected type %T", x) + } + return nil +} + +func _HttpRule_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { + m := msg.(*HttpRule) + switch tag { + case 2: // pattern.get + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeStringBytes() + m.Pattern = &HttpRule_Get{x} + return true, err + case 3: // pattern.put + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeStringBytes() + m.Pattern = &HttpRule_Put{x} + return true, err + case 4: // pattern.post + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeStringBytes() + m.Pattern = &HttpRule_Post{x} + return true, err + case 5: // pattern.delete + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeStringBytes() + m.Pattern = &HttpRule_Delete{x} + return true, err + case 6: // pattern.patch + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeStringBytes() + m.Pattern = &HttpRule_Patch{x} + return true, err + case 8: // pattern.custom + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(CustomHttpPattern) + err := b.DecodeMessage(msg) + m.Pattern = &HttpRule_Custom{msg} + return true, err + default: + return false, nil + } +} + +func _HttpRule_OneofSizer(msg proto.Message) (n int) { + m := msg.(*HttpRule) + // pattern + switch x := m.Pattern.(type) { + case *HttpRule_Get: + n += 1 // tag and wire + n += proto.SizeVarint(uint64(len(x.Get))) + n += len(x.Get) + case *HttpRule_Put: + n += 1 // tag and wire + n += proto.SizeVarint(uint64(len(x.Put))) + n += len(x.Put) + case *HttpRule_Post: + n += 1 // tag and wire + n += proto.SizeVarint(uint64(len(x.Post))) + n += len(x.Post) + case *HttpRule_Delete: + n += 1 // tag and wire + n += proto.SizeVarint(uint64(len(x.Delete))) + n += len(x.Delete) + case *HttpRule_Patch: + n += 1 // tag and wire + n += proto.SizeVarint(uint64(len(x.Patch))) + n += len(x.Patch) + case *HttpRule_Custom: + s := proto.Size(x.Custom) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case nil: + default: + panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) + } + return n +} + +func (*HttpRule) XXX_MessageName() string { + return "google.api.HttpRule" +} + +// A custom pattern is used for defining custom HTTP verb. +type CustomHttpPattern struct { + // The name of this custom HTTP verb. + Kind string `protobuf:"bytes,1,opt,name=kind,proto3" json:"kind,omitempty"` + // The path matched by this custom verb. + Path string `protobuf:"bytes,2,opt,name=path,proto3" json:"path,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *CustomHttpPattern) Reset() { *m = CustomHttpPattern{} } +func (*CustomHttpPattern) ProtoMessage() {} +func (*CustomHttpPattern) Descriptor() ([]byte, []int) { + return fileDescriptor_http_0b206a4af4ed46aa, []int{2} +} +func (m *CustomHttpPattern) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *CustomHttpPattern) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_CustomHttpPattern.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *CustomHttpPattern) XXX_Merge(src proto.Message) { + xxx_messageInfo_CustomHttpPattern.Merge(dst, src) +} +func (m *CustomHttpPattern) XXX_Size() int { + return m.Size() +} +func (m *CustomHttpPattern) XXX_DiscardUnknown() { + xxx_messageInfo_CustomHttpPattern.DiscardUnknown(m) +} + +var xxx_messageInfo_CustomHttpPattern proto.InternalMessageInfo + +func (m *CustomHttpPattern) GetKind() string { + if m != nil { + return m.Kind + } + return "" +} + +func (m *CustomHttpPattern) GetPath() string { + if m != nil { + return m.Path + } + return "" +} + +func (*CustomHttpPattern) XXX_MessageName() string { + return "google.api.CustomHttpPattern" +} +func init() { + proto.RegisterType((*Http)(nil), "google.api.Http") + proto.RegisterType((*HttpRule)(nil), "google.api.HttpRule") + proto.RegisterType((*CustomHttpPattern)(nil), "google.api.CustomHttpPattern") +} +func (this *Http) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Http) + if !ok { + that2, ok := that.(Http) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if len(this.Rules) != len(that1.Rules) { + return false + } + for i := range this.Rules { + if !this.Rules[i].Equal(that1.Rules[i]) { + return false + } + } + if this.FullyDecodeReservedExpansion != that1.FullyDecodeReservedExpansion { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *HttpRule) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*HttpRule) + if !ok { + that2, ok := that.(HttpRule) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Selector != that1.Selector { + return false + } + if that1.Pattern == nil { + if this.Pattern != nil { + return false + } + } else if this.Pattern == nil { + return false + } else if !this.Pattern.Equal(that1.Pattern) { + return false + } + if this.Body != that1.Body { + return false + } + if this.ResponseBody != that1.ResponseBody { + return false + } + if len(this.AdditionalBindings) != len(that1.AdditionalBindings) { + return false + } + for i := range this.AdditionalBindings { + if !this.AdditionalBindings[i].Equal(that1.AdditionalBindings[i]) { + return false + } + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *HttpRule_Get) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*HttpRule_Get) + if !ok { + that2, ok := that.(HttpRule_Get) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Get != that1.Get { + return false + } + return true +} +func (this *HttpRule_Put) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*HttpRule_Put) + if !ok { + that2, ok := that.(HttpRule_Put) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Put != that1.Put { + return false + } + return true +} +func (this *HttpRule_Post) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*HttpRule_Post) + if !ok { + that2, ok := that.(HttpRule_Post) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Post != that1.Post { + return false + } + return true +} +func (this *HttpRule_Delete) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*HttpRule_Delete) + if !ok { + that2, ok := that.(HttpRule_Delete) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Delete != that1.Delete { + return false + } + return true +} +func (this *HttpRule_Patch) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*HttpRule_Patch) + if !ok { + that2, ok := that.(HttpRule_Patch) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Patch != that1.Patch { + return false + } + return true +} +func (this *HttpRule_Custom) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*HttpRule_Custom) + if !ok { + that2, ok := that.(HttpRule_Custom) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.Custom.Equal(that1.Custom) { + return false + } + return true +} +func (this *CustomHttpPattern) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*CustomHttpPattern) + if !ok { + that2, ok := that.(CustomHttpPattern) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Kind != that1.Kind { + return false + } + if this.Path != that1.Path { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *Http) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 6) + s = append(s, "&api.Http{") + if this.Rules != nil { + s = append(s, "Rules: "+fmt.Sprintf("%#v", this.Rules)+",\n") + } + s = append(s, "FullyDecodeReservedExpansion: "+fmt.Sprintf("%#v", this.FullyDecodeReservedExpansion)+",\n") + if this.XXX_unrecognized != nil { + s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") + } + s = append(s, "}") + return strings.Join(s, "") +} +func (this *HttpRule) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 14) + s = append(s, "&api.HttpRule{") + s = append(s, "Selector: "+fmt.Sprintf("%#v", this.Selector)+",\n") + if this.Pattern != nil { + s = append(s, "Pattern: "+fmt.Sprintf("%#v", this.Pattern)+",\n") + } + s = append(s, "Body: "+fmt.Sprintf("%#v", this.Body)+",\n") + s = append(s, "ResponseBody: "+fmt.Sprintf("%#v", this.ResponseBody)+",\n") + if this.AdditionalBindings != nil { + s = append(s, "AdditionalBindings: "+fmt.Sprintf("%#v", this.AdditionalBindings)+",\n") + } + if this.XXX_unrecognized != nil { + s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") + } + s = append(s, "}") + return strings.Join(s, "") +} +func (this *HttpRule_Get) GoString() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&api.HttpRule_Get{` + + `Get:` + fmt.Sprintf("%#v", this.Get) + `}`}, ", ") + return s +} +func (this *HttpRule_Put) GoString() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&api.HttpRule_Put{` + + `Put:` + fmt.Sprintf("%#v", this.Put) + `}`}, ", ") + return s +} +func (this *HttpRule_Post) GoString() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&api.HttpRule_Post{` + + `Post:` + fmt.Sprintf("%#v", this.Post) + `}`}, ", ") + return s +} +func (this *HttpRule_Delete) GoString() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&api.HttpRule_Delete{` + + `Delete:` + fmt.Sprintf("%#v", this.Delete) + `}`}, ", ") + return s +} +func (this *HttpRule_Patch) GoString() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&api.HttpRule_Patch{` + + `Patch:` + fmt.Sprintf("%#v", this.Patch) + `}`}, ", ") + return s +} +func (this *HttpRule_Custom) GoString() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&api.HttpRule_Custom{` + + `Custom:` + fmt.Sprintf("%#v", this.Custom) + `}`}, ", ") + return s +} +func (this *CustomHttpPattern) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 6) + s = append(s, "&api.CustomHttpPattern{") + s = append(s, "Kind: "+fmt.Sprintf("%#v", this.Kind)+",\n") + s = append(s, "Path: "+fmt.Sprintf("%#v", this.Path)+",\n") + if this.XXX_unrecognized != nil { + s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") + } + s = append(s, "}") + return strings.Join(s, "") +} +func valueToGoStringHttp(v interface{}, typ string) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv) +} +func (m *Http) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Http) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Rules) > 0 { + for _, msg := range m.Rules { + dAtA[i] = 0xa + i++ + i = encodeVarintHttp(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if m.FullyDecodeReservedExpansion { + dAtA[i] = 0x10 + i++ + if m.FullyDecodeReservedExpansion { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i++ + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *HttpRule) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *HttpRule) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Selector) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintHttp(dAtA, i, uint64(len(m.Selector))) + i += copy(dAtA[i:], m.Selector) + } + if m.Pattern != nil { + nn1, err := m.Pattern.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += nn1 + } + if len(m.Body) > 0 { + dAtA[i] = 0x3a + i++ + i = encodeVarintHttp(dAtA, i, uint64(len(m.Body))) + i += copy(dAtA[i:], m.Body) + } + if len(m.AdditionalBindings) > 0 { + for _, msg := range m.AdditionalBindings { + dAtA[i] = 0x5a + i++ + i = encodeVarintHttp(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if len(m.ResponseBody) > 0 { + dAtA[i] = 0x62 + i++ + i = encodeVarintHttp(dAtA, i, uint64(len(m.ResponseBody))) + i += copy(dAtA[i:], m.ResponseBody) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *HttpRule_Get) MarshalTo(dAtA []byte) (int, error) { + i := 0 + dAtA[i] = 0x12 + i++ + i = encodeVarintHttp(dAtA, i, uint64(len(m.Get))) + i += copy(dAtA[i:], m.Get) + return i, nil +} +func (m *HttpRule_Put) MarshalTo(dAtA []byte) (int, error) { + i := 0 + dAtA[i] = 0x1a + i++ + i = encodeVarintHttp(dAtA, i, uint64(len(m.Put))) + i += copy(dAtA[i:], m.Put) + return i, nil +} +func (m *HttpRule_Post) MarshalTo(dAtA []byte) (int, error) { + i := 0 + dAtA[i] = 0x22 + i++ + i = encodeVarintHttp(dAtA, i, uint64(len(m.Post))) + i += copy(dAtA[i:], m.Post) + return i, nil +} +func (m *HttpRule_Delete) MarshalTo(dAtA []byte) (int, error) { + i := 0 + dAtA[i] = 0x2a + i++ + i = encodeVarintHttp(dAtA, i, uint64(len(m.Delete))) + i += copy(dAtA[i:], m.Delete) + return i, nil +} +func (m *HttpRule_Patch) MarshalTo(dAtA []byte) (int, error) { + i := 0 + dAtA[i] = 0x32 + i++ + i = encodeVarintHttp(dAtA, i, uint64(len(m.Patch))) + i += copy(dAtA[i:], m.Patch) + return i, nil +} +func (m *HttpRule_Custom) MarshalTo(dAtA []byte) (int, error) { + i := 0 + if m.Custom != nil { + dAtA[i] = 0x42 + i++ + i = encodeVarintHttp(dAtA, i, uint64(m.Custom.Size())) + n2, err := m.Custom.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n2 + } + return i, nil +} +func (m *CustomHttpPattern) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *CustomHttpPattern) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Kind) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintHttp(dAtA, i, uint64(len(m.Kind))) + i += copy(dAtA[i:], m.Kind) + } + if len(m.Path) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintHttp(dAtA, i, uint64(len(m.Path))) + i += copy(dAtA[i:], m.Path) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func encodeVarintHttp(dAtA []byte, offset int, v uint64) int { + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return offset + 1 +} +func NewPopulatedHttp(r randyHttp, easy bool) *Http { + this := &Http{} + if r.Intn(10) == 0 { + v1 := r.Intn(5) + this.Rules = make([]*HttpRule, v1) + for i := 0; i < v1; i++ { + this.Rules[i] = NewPopulatedHttpRule(r, easy) + } + } + this.FullyDecodeReservedExpansion = bool(bool(r.Intn(2) == 0)) + if !easy && r.Intn(10) != 0 { + this.XXX_unrecognized = randUnrecognizedHttp(r, 3) + } + return this +} + +func NewPopulatedHttpRule(r randyHttp, easy bool) *HttpRule { + this := &HttpRule{} + this.Selector = string(randStringHttp(r)) + oneofNumber_Pattern := []int32{2, 3, 4, 5, 6, 8}[r.Intn(6)] + switch oneofNumber_Pattern { + case 2: + this.Pattern = NewPopulatedHttpRule_Get(r, easy) + case 3: + this.Pattern = NewPopulatedHttpRule_Put(r, easy) + case 4: + this.Pattern = NewPopulatedHttpRule_Post(r, easy) + case 5: + this.Pattern = NewPopulatedHttpRule_Delete(r, easy) + case 6: + this.Pattern = NewPopulatedHttpRule_Patch(r, easy) + case 8: + this.Pattern = NewPopulatedHttpRule_Custom(r, easy) + } + this.Body = string(randStringHttp(r)) + if r.Intn(10) == 0 { + v2 := r.Intn(5) + this.AdditionalBindings = make([]*HttpRule, v2) + for i := 0; i < v2; i++ { + this.AdditionalBindings[i] = NewPopulatedHttpRule(r, easy) + } + } + this.ResponseBody = string(randStringHttp(r)) + if !easy && r.Intn(10) != 0 { + this.XXX_unrecognized = randUnrecognizedHttp(r, 13) + } + return this +} + +func NewPopulatedHttpRule_Get(r randyHttp, easy bool) *HttpRule_Get { + this := &HttpRule_Get{} + this.Get = string(randStringHttp(r)) + return this +} +func NewPopulatedHttpRule_Put(r randyHttp, easy bool) *HttpRule_Put { + this := &HttpRule_Put{} + this.Put = string(randStringHttp(r)) + return this +} +func NewPopulatedHttpRule_Post(r randyHttp, easy bool) *HttpRule_Post { + this := &HttpRule_Post{} + this.Post = string(randStringHttp(r)) + return this +} +func NewPopulatedHttpRule_Delete(r randyHttp, easy bool) *HttpRule_Delete { + this := &HttpRule_Delete{} + this.Delete = string(randStringHttp(r)) + return this +} +func NewPopulatedHttpRule_Patch(r randyHttp, easy bool) *HttpRule_Patch { + this := &HttpRule_Patch{} + this.Patch = string(randStringHttp(r)) + return this +} +func NewPopulatedHttpRule_Custom(r randyHttp, easy bool) *HttpRule_Custom { + this := &HttpRule_Custom{} + this.Custom = NewPopulatedCustomHttpPattern(r, easy) + return this +} +func NewPopulatedCustomHttpPattern(r randyHttp, easy bool) *CustomHttpPattern { + this := &CustomHttpPattern{} + this.Kind = string(randStringHttp(r)) + this.Path = string(randStringHttp(r)) + if !easy && r.Intn(10) != 0 { + this.XXX_unrecognized = randUnrecognizedHttp(r, 3) + } + return this +} + +type randyHttp interface { + Float32() float32 + Float64() float64 + Int63() int64 + Int31() int32 + Uint32() uint32 + Intn(n int) int +} + +func randUTF8RuneHttp(r randyHttp) rune { + ru := r.Intn(62) + if ru < 10 { + return rune(ru + 48) + } else if ru < 36 { + return rune(ru + 55) + } + return rune(ru + 61) +} +func randStringHttp(r randyHttp) string { + v3 := r.Intn(100) + tmps := make([]rune, v3) + for i := 0; i < v3; i++ { + tmps[i] = randUTF8RuneHttp(r) + } + return string(tmps) +} +func randUnrecognizedHttp(r randyHttp, maxFieldNumber int) (dAtA []byte) { + l := r.Intn(5) + for i := 0; i < l; i++ { + wire := r.Intn(4) + if wire == 3 { + wire = 5 + } + fieldNumber := maxFieldNumber + r.Intn(100) + dAtA = randFieldHttp(dAtA, r, fieldNumber, wire) + } + return dAtA +} +func randFieldHttp(dAtA []byte, r randyHttp, fieldNumber int, wire int) []byte { + key := uint32(fieldNumber)<<3 | uint32(wire) + switch wire { + case 0: + dAtA = encodeVarintPopulateHttp(dAtA, uint64(key)) + v4 := r.Int63() + if r.Intn(2) == 0 { + v4 *= -1 + } + dAtA = encodeVarintPopulateHttp(dAtA, uint64(v4)) + case 1: + dAtA = encodeVarintPopulateHttp(dAtA, uint64(key)) + dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256))) + case 2: + dAtA = encodeVarintPopulateHttp(dAtA, uint64(key)) + ll := r.Intn(100) + dAtA = encodeVarintPopulateHttp(dAtA, uint64(ll)) + for j := 0; j < ll; j++ { + dAtA = append(dAtA, byte(r.Intn(256))) + } + default: + dAtA = encodeVarintPopulateHttp(dAtA, uint64(key)) + dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256))) + } + return dAtA +} +func encodeVarintPopulateHttp(dAtA []byte, v uint64) []byte { + for v >= 1<<7 { + dAtA = append(dAtA, uint8(uint64(v)&0x7f|0x80)) + v >>= 7 + } + dAtA = append(dAtA, uint8(v)) + return dAtA +} +func (m *Http) Size() (n int) { + var l int + _ = l + if len(m.Rules) > 0 { + for _, e := range m.Rules { + l = e.Size() + n += 1 + l + sovHttp(uint64(l)) + } + } + if m.FullyDecodeReservedExpansion { + n += 2 + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *HttpRule) Size() (n int) { + var l int + _ = l + l = len(m.Selector) + if l > 0 { + n += 1 + l + sovHttp(uint64(l)) + } + if m.Pattern != nil { + n += m.Pattern.Size() + } + l = len(m.Body) + if l > 0 { + n += 1 + l + sovHttp(uint64(l)) + } + if len(m.AdditionalBindings) > 0 { + for _, e := range m.AdditionalBindings { + l = e.Size() + n += 1 + l + sovHttp(uint64(l)) + } + } + l = len(m.ResponseBody) + if l > 0 { + n += 1 + l + sovHttp(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *HttpRule_Get) Size() (n int) { + var l int + _ = l + l = len(m.Get) + n += 1 + l + sovHttp(uint64(l)) + return n +} +func (m *HttpRule_Put) Size() (n int) { + var l int + _ = l + l = len(m.Put) + n += 1 + l + sovHttp(uint64(l)) + return n +} +func (m *HttpRule_Post) Size() (n int) { + var l int + _ = l + l = len(m.Post) + n += 1 + l + sovHttp(uint64(l)) + return n +} +func (m *HttpRule_Delete) Size() (n int) { + var l int + _ = l + l = len(m.Delete) + n += 1 + l + sovHttp(uint64(l)) + return n +} +func (m *HttpRule_Patch) Size() (n int) { + var l int + _ = l + l = len(m.Patch) + n += 1 + l + sovHttp(uint64(l)) + return n +} +func (m *HttpRule_Custom) Size() (n int) { + var l int + _ = l + if m.Custom != nil { + l = m.Custom.Size() + n += 1 + l + sovHttp(uint64(l)) + } + return n +} +func (m *CustomHttpPattern) Size() (n int) { + var l int + _ = l + l = len(m.Kind) + if l > 0 { + n += 1 + l + sovHttp(uint64(l)) + } + l = len(m.Path) + if l > 0 { + n += 1 + l + sovHttp(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func sovHttp(x uint64) (n int) { + for { + n++ + x >>= 7 + if x == 0 { + break + } + } + return n +} +func sozHttp(x uint64) (n int) { + return sovHttp(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (this *Http) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&Http{`, + `Rules:` + strings.Replace(fmt.Sprintf("%v", this.Rules), "HttpRule", "HttpRule", 1) + `,`, + `FullyDecodeReservedExpansion:` + fmt.Sprintf("%v", this.FullyDecodeReservedExpansion) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *HttpRule) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&HttpRule{`, + `Selector:` + fmt.Sprintf("%v", this.Selector) + `,`, + `Pattern:` + fmt.Sprintf("%v", this.Pattern) + `,`, + `Body:` + fmt.Sprintf("%v", this.Body) + `,`, + `AdditionalBindings:` + strings.Replace(fmt.Sprintf("%v", this.AdditionalBindings), "HttpRule", "HttpRule", 1) + `,`, + `ResponseBody:` + fmt.Sprintf("%v", this.ResponseBody) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *HttpRule_Get) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&HttpRule_Get{`, + `Get:` + fmt.Sprintf("%v", this.Get) + `,`, + `}`, + }, "") + return s +} +func (this *HttpRule_Put) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&HttpRule_Put{`, + `Put:` + fmt.Sprintf("%v", this.Put) + `,`, + `}`, + }, "") + return s +} +func (this *HttpRule_Post) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&HttpRule_Post{`, + `Post:` + fmt.Sprintf("%v", this.Post) + `,`, + `}`, + }, "") + return s +} +func (this *HttpRule_Delete) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&HttpRule_Delete{`, + `Delete:` + fmt.Sprintf("%v", this.Delete) + `,`, + `}`, + }, "") + return s +} +func (this *HttpRule_Patch) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&HttpRule_Patch{`, + `Patch:` + fmt.Sprintf("%v", this.Patch) + `,`, + `}`, + }, "") + return s +} +func (this *HttpRule_Custom) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&HttpRule_Custom{`, + `Custom:` + strings.Replace(fmt.Sprintf("%v", this.Custom), "CustomHttpPattern", "CustomHttpPattern", 1) + `,`, + `}`, + }, "") + return s +} +func (this *CustomHttpPattern) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&CustomHttpPattern{`, + `Kind:` + fmt.Sprintf("%v", this.Kind) + `,`, + `Path:` + fmt.Sprintf("%v", this.Path) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func valueToStringHttp(v interface{}) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("*%v", pv) +} +func (m *Http) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHttp + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Http: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Http: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Rules", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHttp + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthHttp + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Rules = append(m.Rules, &HttpRule{}) + if err := m.Rules[len(m.Rules)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field FullyDecodeReservedExpansion", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHttp + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.FullyDecodeReservedExpansion = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skipHttp(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthHttp + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *HttpRule) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHttp + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: HttpRule: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: HttpRule: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Selector", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHttp + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthHttp + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Selector = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Get", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHttp + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthHttp + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Pattern = &HttpRule_Get{string(dAtA[iNdEx:postIndex])} + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Put", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHttp + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthHttp + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Pattern = &HttpRule_Put{string(dAtA[iNdEx:postIndex])} + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Post", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHttp + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthHttp + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Pattern = &HttpRule_Post{string(dAtA[iNdEx:postIndex])} + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Delete", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHttp + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthHttp + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Pattern = &HttpRule_Delete{string(dAtA[iNdEx:postIndex])} + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Patch", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHttp + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthHttp + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Pattern = &HttpRule_Patch{string(dAtA[iNdEx:postIndex])} + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Body", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHttp + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthHttp + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Body = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Custom", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHttp + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthHttp + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &CustomHttpPattern{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Pattern = &HttpRule_Custom{v} + iNdEx = postIndex + case 11: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AdditionalBindings", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHttp + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthHttp + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.AdditionalBindings = append(m.AdditionalBindings, &HttpRule{}) + if err := m.AdditionalBindings[len(m.AdditionalBindings)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 12: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ResponseBody", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHttp + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthHttp + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ResponseBody = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipHttp(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthHttp + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CustomHttpPattern) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHttp + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: CustomHttpPattern: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CustomHttpPattern: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Kind", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHttp + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthHttp + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Kind = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Path", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHttp + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthHttp + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Path = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipHttp(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthHttp + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipHttp(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowHttp + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowHttp + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + return iNdEx, nil + case 1: + iNdEx += 8 + return iNdEx, nil + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowHttp + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + iNdEx += length + if length < 0 { + return 0, ErrInvalidLengthHttp + } + return iNdEx, nil + case 3: + for { + var innerWire uint64 + var start int = iNdEx + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowHttp + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + innerWire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + innerWireType := int(innerWire & 0x7) + if innerWireType == 4 { + break + } + next, err := skipHttp(dAtA[start:]) + if err != nil { + return 0, err + } + iNdEx = start + next + } + return iNdEx, nil + case 4: + return iNdEx, nil + case 5: + iNdEx += 4 + return iNdEx, nil + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + } + panic("unreachable") +} + +var ( + ErrInvalidLengthHttp = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowHttp = fmt.Errorf("proto: integer overflow") +) + +func init() { proto.RegisterFile("google/api/http.proto", fileDescriptor_http_0b206a4af4ed46aa) } + +var fileDescriptor_http_0b206a4af4ed46aa = []byte{ + // 446 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x92, 0xb1, 0x6f, 0x13, 0x31, + 0x14, 0xc6, 0xe3, 0xe4, 0x92, 0x26, 0x2f, 0x05, 0x09, 0x53, 0x90, 0x85, 0xc0, 0x44, 0x61, 0x89, + 0x18, 0x52, 0xa9, 0x0c, 0x0c, 0x4c, 0x1c, 0x44, 0x94, 0x2d, 0xba, 0x11, 0x21, 0x9d, 0x9c, 0xf3, + 0x23, 0xb1, 0xb8, 0x9e, 0xad, 0xb3, 0x0f, 0x91, 0x8d, 0xbf, 0x85, 0x89, 0x3f, 0x85, 0xb1, 0x23, + 0x62, 0x22, 0xc7, 0xc2, 0xd8, 0xb1, 0x23, 0xb2, 0xef, 0x42, 0x2b, 0x21, 0x75, 0x7b, 0xdf, 0xe7, + 0x9f, 0xed, 0xef, 0x3d, 0x3d, 0xb8, 0xb7, 0xd6, 0x7a, 0x9d, 0xe3, 0xb1, 0x30, 0xea, 0x78, 0xe3, + 0x9c, 0x99, 0x9b, 0x52, 0x3b, 0x4d, 0xa1, 0xb1, 0xe7, 0xc2, 0xa8, 0xe9, 0x16, 0xa2, 0x53, 0xe7, + 0x0c, 0x7d, 0x0a, 0xfd, 0xb2, 0xca, 0xd1, 0x32, 0x32, 0xe9, 0xcd, 0xc6, 0x27, 0x47, 0xf3, 0x2b, + 0x66, 0xee, 0x81, 0xa4, 0xca, 0x31, 0x69, 0x10, 0xba, 0x80, 0xc7, 0x1f, 0xaa, 0x3c, 0xdf, 0xa6, + 0x12, 0x33, 0x2d, 0x31, 0x2d, 0xd1, 0x62, 0xf9, 0x09, 0x65, 0x8a, 0x9f, 0x8d, 0x28, 0xac, 0xd2, + 0x05, 0xeb, 0x4e, 0xc8, 0x6c, 0x98, 0x3c, 0x0c, 0xd8, 0xeb, 0x40, 0x25, 0x2d, 0xb4, 0xd8, 0x33, + 0xd3, 0x9f, 0x5d, 0x18, 0xee, 0x9f, 0xa6, 0x0f, 0x60, 0x68, 0x31, 0xc7, 0xcc, 0xe9, 0x92, 0x91, + 0x09, 0x99, 0x8d, 0x92, 0x7f, 0x9a, 0x52, 0xe8, 0xad, 0xd1, 0x85, 0x37, 0x47, 0xa7, 0x9d, 0xc4, + 0x0b, 0xef, 0x99, 0xca, 0xb1, 0xde, 0xde, 0x33, 0x95, 0xa3, 0x47, 0x10, 0x19, 0x6d, 0x1d, 0x8b, + 0x5a, 0x33, 0x28, 0xca, 0x60, 0x20, 0x31, 0x47, 0x87, 0xac, 0xdf, 0xfa, 0xad, 0xa6, 0xf7, 0xa1, + 0x6f, 0x84, 0xcb, 0x36, 0x6c, 0xd0, 0x1e, 0x34, 0x92, 0x52, 0x88, 0x56, 0x5a, 0x6e, 0xd9, 0x41, + 0xc8, 0x11, 0x6a, 0xfa, 0x1c, 0x06, 0x59, 0x65, 0x9d, 0x3e, 0x63, 0xc3, 0x09, 0x99, 0x8d, 0x4f, + 0x1e, 0x5d, 0x1f, 0xd0, 0xab, 0x70, 0xe2, 0x7b, 0x59, 0x0a, 0xe7, 0xb0, 0x2c, 0xfc, 0x27, 0x0d, + 0x4e, 0x17, 0x70, 0x57, 0x48, 0xa9, 0x9c, 0xd2, 0x85, 0xc8, 0xd3, 0x95, 0x2a, 0xa4, 0x2a, 0xd6, + 0x96, 0x8d, 0x6f, 0x18, 0x33, 0xbd, 0xba, 0x10, 0xb7, 0x3c, 0x7d, 0x02, 0xb7, 0x4a, 0xb4, 0x46, + 0x17, 0x16, 0xd3, 0x10, 0xee, 0x30, 0x84, 0x3b, 0xdc, 0x9b, 0xb1, 0x96, 0xdb, 0x78, 0x04, 0x07, + 0xa6, 0x09, 0x30, 0x7d, 0x01, 0x77, 0xfe, 0x4b, 0xe5, 0x1b, 0xfb, 0xa8, 0x0a, 0xd9, 0x0e, 0x38, + 0xd4, 0xde, 0x33, 0xc2, 0x6d, 0x9a, 0xe9, 0x26, 0xa1, 0x8e, 0xdf, 0x9f, 0xef, 0x78, 0xe7, 0xc7, + 0x8e, 0x77, 0x2e, 0x76, 0x9c, 0x5c, 0xee, 0x38, 0xf9, 0x52, 0x73, 0xf2, 0xad, 0xe6, 0xe4, 0x7b, + 0xcd, 0xc9, 0x79, 0xcd, 0xc9, 0xaf, 0x9a, 0x93, 0x3f, 0x35, 0xef, 0x5c, 0x78, 0xef, 0x37, 0x27, + 0x70, 0x3b, 0xd3, 0x67, 0xd7, 0x7a, 0x89, 0x47, 0xe1, 0x5b, 0xbf, 0x6d, 0x4b, 0xf2, 0xae, 0x27, + 0x8c, 0xba, 0x24, 0xe4, 0x6b, 0x37, 0x7a, 0xf3, 0x72, 0xf9, 0x76, 0x35, 0x08, 0x5b, 0xf8, 0xec, + 0x6f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x40, 0x7e, 0xd3, 0x2c, 0x9e, 0x02, 0x00, 0x00, +} diff --git a/vendor/github.com/gogo/googleapis/google/api/http.proto b/vendor/github.com/gogo/googleapis/google/api/http.proto new file mode 100644 index 000000000000..6f92729b87dd --- /dev/null +++ b/vendor/github.com/gogo/googleapis/google/api/http.proto @@ -0,0 +1,318 @@ +// Copyright 2018 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.api; + +option cc_enable_arenas = true; +option go_package = "api"; +option java_multiple_files = true; +option java_outer_classname = "HttpProto"; +option java_package = "com.google.api"; +option objc_class_prefix = "GAPI"; + + +// Defines the HTTP configuration for an API service. It contains a list of +// [HttpRule][google.api.HttpRule], each specifying the mapping of an RPC method +// to one or more HTTP REST API methods. +message Http { + // A list of HTTP configuration rules that apply to individual API methods. + // + // **NOTE:** All service configuration rules follow "last one wins" order. + repeated HttpRule rules = 1; + + // When set to true, URL path parmeters will be fully URI-decoded except in + // cases of single segment matches in reserved expansion, where "%2F" will be + // left encoded. + // + // The default behavior is to not decode RFC 6570 reserved characters in multi + // segment matches. + bool fully_decode_reserved_expansion = 2; +} + +// `HttpRule` defines the mapping of an RPC method to one or more HTTP +// REST API methods. The mapping specifies how different portions of the RPC +// request message are mapped to URL path, URL query parameters, and +// HTTP request body. The mapping is typically specified as an +// `google.api.http` annotation on the RPC method, +// see "google/api/annotations.proto" for details. +// +// The mapping consists of a field specifying the path template and +// method kind. The path template can refer to fields in the request +// message, as in the example below which describes a REST GET +// operation on a resource collection of messages: +// +// +// service Messaging { +// rpc GetMessage(GetMessageRequest) returns (Message) { +// option (google.api.http).get = "/v1/messages/{message_id}/{sub.subfield}"; +// } +// } +// message GetMessageRequest { +// message SubMessage { +// string subfield = 1; +// } +// string message_id = 1; // mapped to the URL +// SubMessage sub = 2; // `sub.subfield` is url-mapped +// } +// message Message { +// string text = 1; // content of the resource +// } +// +// The same http annotation can alternatively be expressed inside the +// `GRPC API Configuration` YAML file. +// +// http: +// rules: +// - selector: .Messaging.GetMessage +// get: /v1/messages/{message_id}/{sub.subfield} +// +// This definition enables an automatic, bidrectional mapping of HTTP +// JSON to RPC. Example: +// +// HTTP | RPC +// -----|----- +// `GET /v1/messages/123456/foo` | `GetMessage(message_id: "123456" sub: SubMessage(subfield: "foo"))` +// +// In general, not only fields but also field paths can be referenced +// from a path pattern. Fields mapped to the path pattern cannot be +// repeated and must have a primitive (non-message) type. +// +// Any fields in the request message which are not bound by the path +// pattern automatically become (optional) HTTP query +// parameters. Assume the following definition of the request message: +// +// +// service Messaging { +// rpc GetMessage(GetMessageRequest) returns (Message) { +// option (google.api.http).get = "/v1/messages/{message_id}"; +// } +// } +// message GetMessageRequest { +// message SubMessage { +// string subfield = 1; +// } +// string message_id = 1; // mapped to the URL +// int64 revision = 2; // becomes a parameter +// SubMessage sub = 3; // `sub.subfield` becomes a parameter +// } +// +// +// This enables a HTTP JSON to RPC mapping as below: +// +// HTTP | RPC +// -----|----- +// `GET /v1/messages/123456?revision=2&sub.subfield=foo` | `GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield: "foo"))` +// +// Note that fields which are mapped to HTTP parameters must have a +// primitive type or a repeated primitive type. Message types are not +// allowed. In the case of a repeated type, the parameter can be +// repeated in the URL, as in `...?param=A¶m=B`. +// +// For HTTP method kinds which allow a request body, the `body` field +// specifies the mapping. Consider a REST update method on the +// message resource collection: +// +// +// service Messaging { +// rpc UpdateMessage(UpdateMessageRequest) returns (Message) { +// option (google.api.http) = { +// put: "/v1/messages/{message_id}" +// body: "message" +// }; +// } +// } +// message UpdateMessageRequest { +// string message_id = 1; // mapped to the URL +// Message message = 2; // mapped to the body +// } +// +// +// The following HTTP JSON to RPC mapping is enabled, where the +// representation of the JSON in the request body is determined by +// protos JSON encoding: +// +// HTTP | RPC +// -----|----- +// `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" message { text: "Hi!" })` +// +// The special name `*` can be used in the body mapping to define that +// every field not bound by the path template should be mapped to the +// request body. This enables the following alternative definition of +// the update method: +// +// service Messaging { +// rpc UpdateMessage(Message) returns (Message) { +// option (google.api.http) = { +// put: "/v1/messages/{message_id}" +// body: "*" +// }; +// } +// } +// message Message { +// string message_id = 1; +// string text = 2; +// } +// +// +// The following HTTP JSON to RPC mapping is enabled: +// +// HTTP | RPC +// -----|----- +// `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" text: "Hi!")` +// +// Note that when using `*` in the body mapping, it is not possible to +// have HTTP parameters, as all fields not bound by the path end in +// the body. This makes this option more rarely used in practice of +// defining REST APIs. The common usage of `*` is in custom methods +// which don't use the URL at all for transferring data. +// +// It is possible to define multiple HTTP methods for one RPC by using +// the `additional_bindings` option. Example: +// +// service Messaging { +// rpc GetMessage(GetMessageRequest) returns (Message) { +// option (google.api.http) = { +// get: "/v1/messages/{message_id}" +// additional_bindings { +// get: "/v1/users/{user_id}/messages/{message_id}" +// } +// }; +// } +// } +// message GetMessageRequest { +// string message_id = 1; +// string user_id = 2; +// } +// +// +// This enables the following two alternative HTTP JSON to RPC +// mappings: +// +// HTTP | RPC +// -----|----- +// `GET /v1/messages/123456` | `GetMessage(message_id: "123456")` +// `GET /v1/users/me/messages/123456` | `GetMessage(user_id: "me" message_id: "123456")` +// +// # Rules for HTTP mapping +// +// The rules for mapping HTTP path, query parameters, and body fields +// to the request message are as follows: +// +// 1. The `body` field specifies either `*` or a field path, or is +// omitted. If omitted, it indicates there is no HTTP request body. +// 2. Leaf fields (recursive expansion of nested messages in the +// request) can be classified into three types: +// (a) Matched in the URL template. +// (b) Covered by body (if body is `*`, everything except (a) fields; +// else everything under the body field) +// (c) All other fields. +// 3. URL query parameters found in the HTTP request are mapped to (c) fields. +// 4. Any body sent with an HTTP request can contain only (b) fields. +// +// The syntax of the path template is as follows: +// +// Template = "/" Segments [ Verb ] ; +// Segments = Segment { "/" Segment } ; +// Segment = "*" | "**" | LITERAL | Variable ; +// Variable = "{" FieldPath [ "=" Segments ] "}" ; +// FieldPath = IDENT { "." IDENT } ; +// Verb = ":" LITERAL ; +// +// The syntax `*` matches a single path segment. The syntax `**` matches zero +// or more path segments, which must be the last part of the path except the +// `Verb`. The syntax `LITERAL` matches literal text in the path. +// +// The syntax `Variable` matches part of the URL path as specified by its +// template. A variable template must not contain other variables. If a variable +// matches a single path segment, its template may be omitted, e.g. `{var}` +// is equivalent to `{var=*}`. +// +// If a variable contains exactly one path segment, such as `"{var}"` or +// `"{var=*}"`, when such a variable is expanded into a URL path, all characters +// except `[-_.~0-9a-zA-Z]` are percent-encoded. Such variables show up in the +// Discovery Document as `{var}`. +// +// If a variable contains one or more path segments, such as `"{var=foo/*}"` +// or `"{var=**}"`, when such a variable is expanded into a URL path, all +// characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. Such variables +// show up in the Discovery Document as `{+var}`. +// +// NOTE: While the single segment variable matches the semantics of +// [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 +// Simple String Expansion, the multi segment variable **does not** match +// RFC 6570 Reserved Expansion. The reason is that the Reserved Expansion +// does not expand special characters like `?` and `#`, which would lead +// to invalid URLs. +// +// NOTE: the field paths in variables and in the `body` must not refer to +// repeated fields or map fields. +message HttpRule { + // Selects methods to which this rule applies. + // + // Refer to [selector][google.api.DocumentationRule.selector] for syntax details. + string selector = 1; + + // Determines the URL pattern is matched by this rules. This pattern can be + // used with any of the {get|put|post|delete|patch} methods. A custom method + // can be defined using the 'custom' field. + oneof pattern { + // Used for listing and getting information about resources. + string get = 2; + + // Used for updating a resource. + string put = 3; + + // Used for creating a resource. + string post = 4; + + // Used for deleting a resource. + string delete = 5; + + // Used for updating a resource. + string patch = 6; + + // The custom pattern is used for specifying an HTTP method that is not + // included in the `pattern` field, such as HEAD, or "*" to leave the + // HTTP method unspecified for this rule. The wild-card rule is useful + // for services that provide content to Web (HTML) clients. + CustomHttpPattern custom = 8; + } + + // The name of the request field whose value is mapped to the HTTP body, or + // `*` for mapping all fields not captured by the path pattern to the HTTP + // body. NOTE: the referred field must not be a repeated field and must be + // present at the top-level of request message type. + string body = 7; + + // Optional. The name of the response field whose value is mapped to the HTTP + // body of response. Other response fields are ignored. When + // not set, the response message will be used as HTTP body of response. + string response_body = 12; + + // Additional HTTP bindings for the selector. Nested bindings must + // not contain an `additional_bindings` field themselves (that is, + // the nesting may only be one level deep). + repeated HttpRule additional_bindings = 11; +} + +// A custom pattern is used for defining custom HTTP verb. +message CustomHttpPattern { + // The name of this custom HTTP verb. + string kind = 1; + + // The path matched by this custom verb. + string path = 2; +} diff --git a/vendor/github.com/gogo/googleapis/google/rpc/code.pb.go b/vendor/github.com/gogo/googleapis/google/rpc/code.pb.go new file mode 100644 index 000000000000..f2cbae8f76d2 --- /dev/null +++ b/vendor/github.com/gogo/googleapis/google/rpc/code.pb.go @@ -0,0 +1,254 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: google/rpc/code.proto + +package rpc + +import proto "github.com/gogo/protobuf/proto" +import fmt "fmt" +import math "math" + +import strconv "strconv" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package + +// The canonical error codes for Google APIs. +// +// +// Sometimes multiple error codes may apply. Services should return +// the most specific error code that applies. For example, prefer +// `OUT_OF_RANGE` over `FAILED_PRECONDITION` if both codes apply. +// Similarly prefer `NOT_FOUND` or `ALREADY_EXISTS` over `FAILED_PRECONDITION`. +type Code int32 + +const ( + // Not an error; returned on success + // + // HTTP Mapping: 200 OK + OK Code = 0 + // The operation was cancelled, typically by the caller. + // + // HTTP Mapping: 499 Client Closed Request + CANCELLED Code = 1 + // Unknown error. For example, this error may be returned when + // a `Status` value received from another address space belongs to + // an error space that is not known in this address space. Also + // errors raised by APIs that do not return enough error information + // may be converted to this error. + // + // HTTP Mapping: 500 Internal Server Error + UNKNOWN Code = 2 + // The client specified an invalid argument. Note that this differs + // from `FAILED_PRECONDITION`. `INVALID_ARGUMENT` indicates arguments + // that are problematic regardless of the state of the system + // (e.g., a malformed file name). + // + // HTTP Mapping: 400 Bad Request + INVALID_ARGUMENT Code = 3 + // The deadline expired before the operation could complete. For operations + // that change the state of the system, this error may be returned + // even if the operation has completed successfully. For example, a + // successful response from a server could have been delayed long + // enough for the deadline to expire. + // + // HTTP Mapping: 504 Gateway Timeout + DEADLINE_EXCEEDED Code = 4 + // Some requested entity (e.g., file or directory) was not found. + // + // Note to server developers: if a request is denied for an entire class + // of users, such as gradual feature rollout or undocumented whitelist, + // `NOT_FOUND` may be used. If a request is denied for some users within + // a class of users, such as user-based access control, `PERMISSION_DENIED` + // must be used. + // + // HTTP Mapping: 404 Not Found + NOT_FOUND Code = 5 + // The entity that a client attempted to create (e.g., file or directory) + // already exists. + // + // HTTP Mapping: 409 Conflict + ALREADY_EXISTS Code = 6 + // The caller does not have permission to execute the specified + // operation. `PERMISSION_DENIED` must not be used for rejections + // caused by exhausting some resource (use `RESOURCE_EXHAUSTED` + // instead for those errors). `PERMISSION_DENIED` must not be + // used if the caller can not be identified (use `UNAUTHENTICATED` + // instead for those errors). This error code does not imply the + // request is valid or the requested entity exists or satisfies + // other pre-conditions. + // + // HTTP Mapping: 403 Forbidden + PERMISSION_DENIED Code = 7 + // The request does not have valid authentication credentials for the + // operation. + // + // HTTP Mapping: 401 Unauthorized + UNAUTHENTICATED Code = 16 + // Some resource has been exhausted, perhaps a per-user quota, or + // perhaps the entire file system is out of space. + // + // HTTP Mapping: 429 Too Many Requests + RESOURCE_EXHAUSTED Code = 8 + // The operation was rejected because the system is not in a state + // required for the operation's execution. For example, the directory + // to be deleted is non-empty, an rmdir operation is applied to + // a non-directory, etc. + // + // Service implementors can use the following guidelines to decide + // between `FAILED_PRECONDITION`, `ABORTED`, and `UNAVAILABLE`: + // (a) Use `UNAVAILABLE` if the client can retry just the failing call. + // (b) Use `ABORTED` if the client should retry at a higher level + // (e.g., when a client-specified test-and-set fails, indicating the + // client should restart a read-modify-write sequence). + // (c) Use `FAILED_PRECONDITION` if the client should not retry until + // the system state has been explicitly fixed. E.g., if an "rmdir" + // fails because the directory is non-empty, `FAILED_PRECONDITION` + // should be returned since the client should not retry unless + // the files are deleted from the directory. + // + // HTTP Mapping: 400 Bad Request + FAILED_PRECONDITION Code = 9 + // The operation was aborted, typically due to a concurrency issue such as + // a sequencer check failure or transaction abort. + // + // See the guidelines above for deciding between `FAILED_PRECONDITION`, + // `ABORTED`, and `UNAVAILABLE`. + // + // HTTP Mapping: 409 Conflict + ABORTED Code = 10 + // The operation was attempted past the valid range. E.g., seeking or + // reading past end-of-file. + // + // Unlike `INVALID_ARGUMENT`, this error indicates a problem that may + // be fixed if the system state changes. For example, a 32-bit file + // system will generate `INVALID_ARGUMENT` if asked to read at an + // offset that is not in the range [0,2^32-1], but it will generate + // `OUT_OF_RANGE` if asked to read from an offset past the current + // file size. + // + // There is a fair bit of overlap between `FAILED_PRECONDITION` and + // `OUT_OF_RANGE`. We recommend using `OUT_OF_RANGE` (the more specific + // error) when it applies so that callers who are iterating through + // a space can easily look for an `OUT_OF_RANGE` error to detect when + // they are done. + // + // HTTP Mapping: 400 Bad Request + OUT_OF_RANGE Code = 11 + // The operation is not implemented or is not supported/enabled in this + // service. + // + // HTTP Mapping: 501 Not Implemented + UNIMPLEMENTED Code = 12 + // Internal errors. This means that some invariants expected by the + // underlying system have been broken. This error code is reserved + // for serious errors. + // + // HTTP Mapping: 500 Internal Server Error + INTERNAL Code = 13 + // The service is currently unavailable. This is most likely a + // transient condition, which can be corrected by retrying with + // a backoff. + // + // See the guidelines above for deciding between `FAILED_PRECONDITION`, + // `ABORTED`, and `UNAVAILABLE`. + // + // HTTP Mapping: 503 Service Unavailable + UNAVAILABLE Code = 14 + // Unrecoverable data loss or corruption. + // + // HTTP Mapping: 500 Internal Server Error + DATA_LOSS Code = 15 +) + +var Code_name = map[int32]string{ + 0: "OK", + 1: "CANCELLED", + 2: "UNKNOWN", + 3: "INVALID_ARGUMENT", + 4: "DEADLINE_EXCEEDED", + 5: "NOT_FOUND", + 6: "ALREADY_EXISTS", + 7: "PERMISSION_DENIED", + 16: "UNAUTHENTICATED", + 8: "RESOURCE_EXHAUSTED", + 9: "FAILED_PRECONDITION", + 10: "ABORTED", + 11: "OUT_OF_RANGE", + 12: "UNIMPLEMENTED", + 13: "INTERNAL", + 14: "UNAVAILABLE", + 15: "DATA_LOSS", +} +var Code_value = map[string]int32{ + "OK": 0, + "CANCELLED": 1, + "UNKNOWN": 2, + "INVALID_ARGUMENT": 3, + "DEADLINE_EXCEEDED": 4, + "NOT_FOUND": 5, + "ALREADY_EXISTS": 6, + "PERMISSION_DENIED": 7, + "UNAUTHENTICATED": 16, + "RESOURCE_EXHAUSTED": 8, + "FAILED_PRECONDITION": 9, + "ABORTED": 10, + "OUT_OF_RANGE": 11, + "UNIMPLEMENTED": 12, + "INTERNAL": 13, + "UNAVAILABLE": 14, + "DATA_LOSS": 15, +} + +func (Code) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_code_29c527ae4b4f0e5d, []int{0} +} + +func init() { + proto.RegisterEnum("google.rpc.Code", Code_name, Code_value) +} +func (x Code) String() string { + s, ok := Code_name[int32(x)] + if ok { + return s + } + return strconv.Itoa(int(x)) +} + +func init() { proto.RegisterFile("google/rpc/code.proto", fileDescriptor_code_29c527ae4b4f0e5d) } + +var fileDescriptor_code_29c527ae4b4f0e5d = []byte{ + // 393 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x44, 0x91, 0x3d, 0x6e, 0x13, 0x41, + 0x14, 0xc7, 0x3d, 0x76, 0x70, 0xe2, 0xf1, 0xd7, 0xcb, 0x84, 0x40, 0x37, 0x07, 0xa0, 0x70, 0x0a, + 0x4e, 0xf0, 0xbc, 0xf3, 0x9c, 0x8c, 0x32, 0x7e, 0xb3, 0x9a, 0x9d, 0x09, 0x01, 0x21, 0xad, 0xc4, + 0xc6, 0x4a, 0x03, 0x5a, 0xcb, 0xe2, 0x00, 0x9c, 0x85, 0x8a, 0x1b, 0x70, 0x85, 0x94, 0x29, 0x29, + 0xf1, 0xa6, 0xa1, 0x74, 0x49, 0x89, 0x06, 0x0a, 0xda, 0x9f, 0xde, 0xc7, 0xff, 0x43, 0x9e, 0xdf, + 0xb7, 0xed, 0xfd, 0xc7, 0xcd, 0xc5, 0x6e, 0xdb, 0x5c, 0x34, 0xed, 0xdd, 0x66, 0xb1, 0xdd, 0xb5, + 0x9f, 0x5b, 0x25, 0xff, 0xe1, 0xc5, 0x6e, 0xdb, 0xbc, 0xfa, 0xde, 0x97, 0x47, 0x45, 0x7b, 0xb7, + 0x51, 0x43, 0xd9, 0xf7, 0xd7, 0xd0, 0x53, 0x53, 0x39, 0x2a, 0x90, 0x0b, 0x72, 0x8e, 0x0c, 0x08, + 0x35, 0x96, 0xc7, 0x89, 0xaf, 0xd9, 0xbf, 0x61, 0xe8, 0xab, 0xe7, 0x12, 0x2c, 0xdf, 0xa0, 0xb3, + 0xa6, 0xc6, 0x70, 0x99, 0xd6, 0xc4, 0x11, 0x06, 0xea, 0x5c, 0x9e, 0x1a, 0x42, 0xe3, 0x2c, 0x53, + 0x4d, 0xb7, 0x05, 0x91, 0x21, 0x03, 0x47, 0xf9, 0x10, 0xfb, 0x58, 0xaf, 0x7c, 0x62, 0x03, 0xcf, + 0x94, 0x92, 0x33, 0x74, 0x81, 0xd0, 0xbc, 0xad, 0xe9, 0xd6, 0x56, 0xb1, 0x82, 0x61, 0xde, 0x2c, + 0x29, 0xac, 0x6d, 0x55, 0x59, 0xcf, 0xb5, 0x21, 0xb6, 0x64, 0xe0, 0x58, 0x9d, 0xc9, 0x79, 0x62, + 0x4c, 0xf1, 0x8a, 0x38, 0xda, 0x02, 0x23, 0x19, 0x00, 0xf5, 0x42, 0xaa, 0x40, 0x95, 0x4f, 0xa1, + 0xc8, 0x5f, 0xae, 0x30, 0x55, 0x99, 0x9f, 0xa8, 0x97, 0xf2, 0x6c, 0x85, 0xd6, 0x91, 0xa9, 0xcb, + 0x40, 0x85, 0x67, 0x63, 0xa3, 0xf5, 0x0c, 0xa3, 0xac, 0x1c, 0x97, 0x3e, 0xe4, 0x29, 0xa9, 0x40, + 0x4e, 0x7c, 0x8a, 0xb5, 0x5f, 0xd5, 0x01, 0xf9, 0x92, 0x60, 0xac, 0x4e, 0xe5, 0x34, 0xb1, 0x5d, + 0x97, 0x8e, 0xb2, 0x0d, 0x32, 0x30, 0x51, 0x13, 0x79, 0x62, 0x39, 0x52, 0x60, 0x74, 0x30, 0x55, + 0x73, 0x39, 0x4e, 0x8c, 0x37, 0x68, 0x1d, 0x2e, 0x1d, 0xc1, 0x2c, 0x1b, 0x32, 0x18, 0xb1, 0x76, + 0xbe, 0xaa, 0x60, 0xbe, 0x7c, 0xff, 0xb8, 0xd7, 0xbd, 0x1f, 0x7b, 0xdd, 0x3b, 0xec, 0xb5, 0xf8, + 0xbd, 0xd7, 0xe2, 0x4b, 0xa7, 0xc5, 0xb7, 0x4e, 0x8b, 0x87, 0x4e, 0x8b, 0xc7, 0x4e, 0x8b, 0x9f, + 0x9d, 0x16, 0xbf, 0x3a, 0xdd, 0x3b, 0x64, 0xfe, 0xa4, 0xc5, 0xc3, 0x93, 0x16, 0x72, 0xd6, 0xb4, + 0x9f, 0x16, 0xff, 0xf3, 0x5f, 0x8e, 0x72, 0xf8, 0x65, 0xae, 0xa5, 0x14, 0xef, 0x06, 0xbb, 0x6d, + 0xf3, 0xb5, 0x3f, 0x08, 0x65, 0xf1, 0x61, 0xf8, 0xb7, 0xaa, 0xd7, 0x7f, 0x02, 0x00, 0x00, 0xff, + 0xff, 0x03, 0xd4, 0x27, 0xff, 0xc3, 0x01, 0x00, 0x00, +} diff --git a/vendor/github.com/gogo/googleapis/google/rpc/code.proto b/vendor/github.com/gogo/googleapis/google/rpc/code.proto new file mode 100644 index 000000000000..d832de11e981 --- /dev/null +++ b/vendor/github.com/gogo/googleapis/google/rpc/code.proto @@ -0,0 +1,186 @@ +// Copyright 2017 Google Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.rpc; + +option go_package = "rpc"; +option java_multiple_files = true; +option java_outer_classname = "CodeProto"; +option java_package = "com.google.rpc"; +option objc_class_prefix = "RPC"; + + +// The canonical error codes for Google APIs. +// +// +// Sometimes multiple error codes may apply. Services should return +// the most specific error code that applies. For example, prefer +// `OUT_OF_RANGE` over `FAILED_PRECONDITION` if both codes apply. +// Similarly prefer `NOT_FOUND` or `ALREADY_EXISTS` over `FAILED_PRECONDITION`. +enum Code { + // Not an error; returned on success + // + // HTTP Mapping: 200 OK + OK = 0; + + // The operation was cancelled, typically by the caller. + // + // HTTP Mapping: 499 Client Closed Request + CANCELLED = 1; + + // Unknown error. For example, this error may be returned when + // a `Status` value received from another address space belongs to + // an error space that is not known in this address space. Also + // errors raised by APIs that do not return enough error information + // may be converted to this error. + // + // HTTP Mapping: 500 Internal Server Error + UNKNOWN = 2; + + // The client specified an invalid argument. Note that this differs + // from `FAILED_PRECONDITION`. `INVALID_ARGUMENT` indicates arguments + // that are problematic regardless of the state of the system + // (e.g., a malformed file name). + // + // HTTP Mapping: 400 Bad Request + INVALID_ARGUMENT = 3; + + // The deadline expired before the operation could complete. For operations + // that change the state of the system, this error may be returned + // even if the operation has completed successfully. For example, a + // successful response from a server could have been delayed long + // enough for the deadline to expire. + // + // HTTP Mapping: 504 Gateway Timeout + DEADLINE_EXCEEDED = 4; + + // Some requested entity (e.g., file or directory) was not found. + // + // Note to server developers: if a request is denied for an entire class + // of users, such as gradual feature rollout or undocumented whitelist, + // `NOT_FOUND` may be used. If a request is denied for some users within + // a class of users, such as user-based access control, `PERMISSION_DENIED` + // must be used. + // + // HTTP Mapping: 404 Not Found + NOT_FOUND = 5; + + // The entity that a client attempted to create (e.g., file or directory) + // already exists. + // + // HTTP Mapping: 409 Conflict + ALREADY_EXISTS = 6; + + // The caller does not have permission to execute the specified + // operation. `PERMISSION_DENIED` must not be used for rejections + // caused by exhausting some resource (use `RESOURCE_EXHAUSTED` + // instead for those errors). `PERMISSION_DENIED` must not be + // used if the caller can not be identified (use `UNAUTHENTICATED` + // instead for those errors). This error code does not imply the + // request is valid or the requested entity exists or satisfies + // other pre-conditions. + // + // HTTP Mapping: 403 Forbidden + PERMISSION_DENIED = 7; + + // The request does not have valid authentication credentials for the + // operation. + // + // HTTP Mapping: 401 Unauthorized + UNAUTHENTICATED = 16; + + // Some resource has been exhausted, perhaps a per-user quota, or + // perhaps the entire file system is out of space. + // + // HTTP Mapping: 429 Too Many Requests + RESOURCE_EXHAUSTED = 8; + + // The operation was rejected because the system is not in a state + // required for the operation's execution. For example, the directory + // to be deleted is non-empty, an rmdir operation is applied to + // a non-directory, etc. + // + // Service implementors can use the following guidelines to decide + // between `FAILED_PRECONDITION`, `ABORTED`, and `UNAVAILABLE`: + // (a) Use `UNAVAILABLE` if the client can retry just the failing call. + // (b) Use `ABORTED` if the client should retry at a higher level + // (e.g., when a client-specified test-and-set fails, indicating the + // client should restart a read-modify-write sequence). + // (c) Use `FAILED_PRECONDITION` if the client should not retry until + // the system state has been explicitly fixed. E.g., if an "rmdir" + // fails because the directory is non-empty, `FAILED_PRECONDITION` + // should be returned since the client should not retry unless + // the files are deleted from the directory. + // + // HTTP Mapping: 400 Bad Request + FAILED_PRECONDITION = 9; + + // The operation was aborted, typically due to a concurrency issue such as + // a sequencer check failure or transaction abort. + // + // See the guidelines above for deciding between `FAILED_PRECONDITION`, + // `ABORTED`, and `UNAVAILABLE`. + // + // HTTP Mapping: 409 Conflict + ABORTED = 10; + + // The operation was attempted past the valid range. E.g., seeking or + // reading past end-of-file. + // + // Unlike `INVALID_ARGUMENT`, this error indicates a problem that may + // be fixed if the system state changes. For example, a 32-bit file + // system will generate `INVALID_ARGUMENT` if asked to read at an + // offset that is not in the range [0,2^32-1], but it will generate + // `OUT_OF_RANGE` if asked to read from an offset past the current + // file size. + // + // There is a fair bit of overlap between `FAILED_PRECONDITION` and + // `OUT_OF_RANGE`. We recommend using `OUT_OF_RANGE` (the more specific + // error) when it applies so that callers who are iterating through + // a space can easily look for an `OUT_OF_RANGE` error to detect when + // they are done. + // + // HTTP Mapping: 400 Bad Request + OUT_OF_RANGE = 11; + + // The operation is not implemented or is not supported/enabled in this + // service. + // + // HTTP Mapping: 501 Not Implemented + UNIMPLEMENTED = 12; + + // Internal errors. This means that some invariants expected by the + // underlying system have been broken. This error code is reserved + // for serious errors. + // + // HTTP Mapping: 500 Internal Server Error + INTERNAL = 13; + + // The service is currently unavailable. This is most likely a + // transient condition, which can be corrected by retrying with + // a backoff. + // + // See the guidelines above for deciding between `FAILED_PRECONDITION`, + // `ABORTED`, and `UNAVAILABLE`. + // + // HTTP Mapping: 503 Service Unavailable + UNAVAILABLE = 14; + + // Unrecoverable data loss or corruption. + // + // HTTP Mapping: 500 Internal Server Error + DATA_LOSS = 15; +} diff --git a/vendor/github.com/gogo/googleapis/google/rpc/error_details.pb.go b/vendor/github.com/gogo/googleapis/google/rpc/error_details.pb.go new file mode 100644 index 000000000000..9a91abe03d15 --- /dev/null +++ b/vendor/github.com/gogo/googleapis/google/rpc/error_details.pb.go @@ -0,0 +1,4659 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: google/rpc/error_details.proto + +package rpc + +import proto "github.com/gogo/protobuf/proto" +import fmt "fmt" +import math "math" +import types "github.com/gogo/protobuf/types" + +import bytes "bytes" + +import strings "strings" +import reflect "reflect" + +import io "io" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package + +// Describes when the clients can retry a failed request. Clients could ignore +// the recommendation here or retry when this information is missing from error +// responses. +// +// It's always recommended that clients should use exponential backoff when +// retrying. +// +// Clients should wait until `retry_delay` amount of time has passed since +// receiving the error response before retrying. If retrying requests also +// fail, clients should use an exponential backoff scheme to gradually increase +// the delay between retries based on `retry_delay`, until either a maximum +// number of retires have been reached or a maximum retry delay cap has been +// reached. +type RetryInfo struct { + // Clients should wait at least this long between retrying the same request. + RetryDelay *types.Duration `protobuf:"bytes,1,opt,name=retry_delay,json=retryDelay" json:"retry_delay,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *RetryInfo) Reset() { *m = RetryInfo{} } +func (*RetryInfo) ProtoMessage() {} +func (*RetryInfo) Descriptor() ([]byte, []int) { + return fileDescriptor_error_details_ff696d72eb1e7a26, []int{0} +} +func (m *RetryInfo) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RetryInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_RetryInfo.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *RetryInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_RetryInfo.Merge(dst, src) +} +func (m *RetryInfo) XXX_Size() int { + return m.Size() +} +func (m *RetryInfo) XXX_DiscardUnknown() { + xxx_messageInfo_RetryInfo.DiscardUnknown(m) +} + +var xxx_messageInfo_RetryInfo proto.InternalMessageInfo + +func (m *RetryInfo) GetRetryDelay() *types.Duration { + if m != nil { + return m.RetryDelay + } + return nil +} + +func (*RetryInfo) XXX_MessageName() string { + return "google.rpc.RetryInfo" +} + +// Describes additional debugging info. +type DebugInfo struct { + // The stack trace entries indicating where the error occurred. + StackEntries []string `protobuf:"bytes,1,rep,name=stack_entries,json=stackEntries" json:"stack_entries,omitempty"` + // Additional debugging information provided by the server. + Detail string `protobuf:"bytes,2,opt,name=detail,proto3" json:"detail,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *DebugInfo) Reset() { *m = DebugInfo{} } +func (*DebugInfo) ProtoMessage() {} +func (*DebugInfo) Descriptor() ([]byte, []int) { + return fileDescriptor_error_details_ff696d72eb1e7a26, []int{1} +} +func (m *DebugInfo) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DebugInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_DebugInfo.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *DebugInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_DebugInfo.Merge(dst, src) +} +func (m *DebugInfo) XXX_Size() int { + return m.Size() +} +func (m *DebugInfo) XXX_DiscardUnknown() { + xxx_messageInfo_DebugInfo.DiscardUnknown(m) +} + +var xxx_messageInfo_DebugInfo proto.InternalMessageInfo + +func (m *DebugInfo) GetStackEntries() []string { + if m != nil { + return m.StackEntries + } + return nil +} + +func (m *DebugInfo) GetDetail() string { + if m != nil { + return m.Detail + } + return "" +} + +func (*DebugInfo) XXX_MessageName() string { + return "google.rpc.DebugInfo" +} + +// Describes how a quota check failed. +// +// For example if a daily limit was exceeded for the calling project, +// a service could respond with a QuotaFailure detail containing the project +// id and the description of the quota limit that was exceeded. If the +// calling project hasn't enabled the service in the developer console, then +// a service could respond with the project id and set `service_disabled` +// to true. +// +// Also see RetryDetail and Help types for other details about handling a +// quota failure. +type QuotaFailure struct { + // Describes all quota violations. + Violations []*QuotaFailure_Violation `protobuf:"bytes,1,rep,name=violations" json:"violations,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *QuotaFailure) Reset() { *m = QuotaFailure{} } +func (*QuotaFailure) ProtoMessage() {} +func (*QuotaFailure) Descriptor() ([]byte, []int) { + return fileDescriptor_error_details_ff696d72eb1e7a26, []int{2} +} +func (m *QuotaFailure) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QuotaFailure) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QuotaFailure.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *QuotaFailure) XXX_Merge(src proto.Message) { + xxx_messageInfo_QuotaFailure.Merge(dst, src) +} +func (m *QuotaFailure) XXX_Size() int { + return m.Size() +} +func (m *QuotaFailure) XXX_DiscardUnknown() { + xxx_messageInfo_QuotaFailure.DiscardUnknown(m) +} + +var xxx_messageInfo_QuotaFailure proto.InternalMessageInfo + +func (m *QuotaFailure) GetViolations() []*QuotaFailure_Violation { + if m != nil { + return m.Violations + } + return nil +} + +func (*QuotaFailure) XXX_MessageName() string { + return "google.rpc.QuotaFailure" +} + +// A message type used to describe a single quota violation. For example, a +// daily quota or a custom quota that was exceeded. +type QuotaFailure_Violation struct { + // The subject on which the quota check failed. + // For example, "clientip:" or "project:". + Subject string `protobuf:"bytes,1,opt,name=subject,proto3" json:"subject,omitempty"` + // A description of how the quota check failed. Clients can use this + // description to find more about the quota configuration in the service's + // public documentation, or find the relevant quota limit to adjust through + // developer console. + // + // For example: "Service disabled" or "Daily Limit for read operations + // exceeded". + Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *QuotaFailure_Violation) Reset() { *m = QuotaFailure_Violation{} } +func (*QuotaFailure_Violation) ProtoMessage() {} +func (*QuotaFailure_Violation) Descriptor() ([]byte, []int) { + return fileDescriptor_error_details_ff696d72eb1e7a26, []int{2, 0} +} +func (m *QuotaFailure_Violation) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QuotaFailure_Violation) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QuotaFailure_Violation.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *QuotaFailure_Violation) XXX_Merge(src proto.Message) { + xxx_messageInfo_QuotaFailure_Violation.Merge(dst, src) +} +func (m *QuotaFailure_Violation) XXX_Size() int { + return m.Size() +} +func (m *QuotaFailure_Violation) XXX_DiscardUnknown() { + xxx_messageInfo_QuotaFailure_Violation.DiscardUnknown(m) +} + +var xxx_messageInfo_QuotaFailure_Violation proto.InternalMessageInfo + +func (m *QuotaFailure_Violation) GetSubject() string { + if m != nil { + return m.Subject + } + return "" +} + +func (m *QuotaFailure_Violation) GetDescription() string { + if m != nil { + return m.Description + } + return "" +} + +func (*QuotaFailure_Violation) XXX_MessageName() string { + return "google.rpc.QuotaFailure.Violation" +} + +// Describes what preconditions have failed. +// +// For example, if an RPC failed because it required the Terms of Service to be +// acknowledged, it could list the terms of service violation in the +// PreconditionFailure message. +type PreconditionFailure struct { + // Describes all precondition violations. + Violations []*PreconditionFailure_Violation `protobuf:"bytes,1,rep,name=violations" json:"violations,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *PreconditionFailure) Reset() { *m = PreconditionFailure{} } +func (*PreconditionFailure) ProtoMessage() {} +func (*PreconditionFailure) Descriptor() ([]byte, []int) { + return fileDescriptor_error_details_ff696d72eb1e7a26, []int{3} +} +func (m *PreconditionFailure) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *PreconditionFailure) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_PreconditionFailure.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *PreconditionFailure) XXX_Merge(src proto.Message) { + xxx_messageInfo_PreconditionFailure.Merge(dst, src) +} +func (m *PreconditionFailure) XXX_Size() int { + return m.Size() +} +func (m *PreconditionFailure) XXX_DiscardUnknown() { + xxx_messageInfo_PreconditionFailure.DiscardUnknown(m) +} + +var xxx_messageInfo_PreconditionFailure proto.InternalMessageInfo + +func (m *PreconditionFailure) GetViolations() []*PreconditionFailure_Violation { + if m != nil { + return m.Violations + } + return nil +} + +func (*PreconditionFailure) XXX_MessageName() string { + return "google.rpc.PreconditionFailure" +} + +// A message type used to describe a single precondition failure. +type PreconditionFailure_Violation struct { + // The type of PreconditionFailure. We recommend using a service-specific + // enum type to define the supported precondition violation types. For + // example, "TOS" for "Terms of Service violation". + Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` + // The subject, relative to the type, that failed. + // For example, "google.com/cloud" relative to the "TOS" type would + // indicate which terms of service is being referenced. + Subject string `protobuf:"bytes,2,opt,name=subject,proto3" json:"subject,omitempty"` + // A description of how the precondition failed. Developers can use this + // description to understand how to fix the failure. + // + // For example: "Terms of service not accepted". + Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *PreconditionFailure_Violation) Reset() { *m = PreconditionFailure_Violation{} } +func (*PreconditionFailure_Violation) ProtoMessage() {} +func (*PreconditionFailure_Violation) Descriptor() ([]byte, []int) { + return fileDescriptor_error_details_ff696d72eb1e7a26, []int{3, 0} +} +func (m *PreconditionFailure_Violation) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *PreconditionFailure_Violation) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_PreconditionFailure_Violation.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *PreconditionFailure_Violation) XXX_Merge(src proto.Message) { + xxx_messageInfo_PreconditionFailure_Violation.Merge(dst, src) +} +func (m *PreconditionFailure_Violation) XXX_Size() int { + return m.Size() +} +func (m *PreconditionFailure_Violation) XXX_DiscardUnknown() { + xxx_messageInfo_PreconditionFailure_Violation.DiscardUnknown(m) +} + +var xxx_messageInfo_PreconditionFailure_Violation proto.InternalMessageInfo + +func (m *PreconditionFailure_Violation) GetType() string { + if m != nil { + return m.Type + } + return "" +} + +func (m *PreconditionFailure_Violation) GetSubject() string { + if m != nil { + return m.Subject + } + return "" +} + +func (m *PreconditionFailure_Violation) GetDescription() string { + if m != nil { + return m.Description + } + return "" +} + +func (*PreconditionFailure_Violation) XXX_MessageName() string { + return "google.rpc.PreconditionFailure.Violation" +} + +// Describes violations in a client request. This error type focuses on the +// syntactic aspects of the request. +type BadRequest struct { + // Describes all violations in a client request. + FieldViolations []*BadRequest_FieldViolation `protobuf:"bytes,1,rep,name=field_violations,json=fieldViolations" json:"field_violations,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *BadRequest) Reset() { *m = BadRequest{} } +func (*BadRequest) ProtoMessage() {} +func (*BadRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_error_details_ff696d72eb1e7a26, []int{4} +} +func (m *BadRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *BadRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_BadRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *BadRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_BadRequest.Merge(dst, src) +} +func (m *BadRequest) XXX_Size() int { + return m.Size() +} +func (m *BadRequest) XXX_DiscardUnknown() { + xxx_messageInfo_BadRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_BadRequest proto.InternalMessageInfo + +func (m *BadRequest) GetFieldViolations() []*BadRequest_FieldViolation { + if m != nil { + return m.FieldViolations + } + return nil +} + +func (*BadRequest) XXX_MessageName() string { + return "google.rpc.BadRequest" +} + +// A message type used to describe a single bad request field. +type BadRequest_FieldViolation struct { + // A path leading to a field in the request body. The value will be a + // sequence of dot-separated identifiers that identify a protocol buffer + // field. E.g., "field_violations.field" would identify this field. + Field string `protobuf:"bytes,1,opt,name=field,proto3" json:"field,omitempty"` + // A description of why the request element is bad. + Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *BadRequest_FieldViolation) Reset() { *m = BadRequest_FieldViolation{} } +func (*BadRequest_FieldViolation) ProtoMessage() {} +func (*BadRequest_FieldViolation) Descriptor() ([]byte, []int) { + return fileDescriptor_error_details_ff696d72eb1e7a26, []int{4, 0} +} +func (m *BadRequest_FieldViolation) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *BadRequest_FieldViolation) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_BadRequest_FieldViolation.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *BadRequest_FieldViolation) XXX_Merge(src proto.Message) { + xxx_messageInfo_BadRequest_FieldViolation.Merge(dst, src) +} +func (m *BadRequest_FieldViolation) XXX_Size() int { + return m.Size() +} +func (m *BadRequest_FieldViolation) XXX_DiscardUnknown() { + xxx_messageInfo_BadRequest_FieldViolation.DiscardUnknown(m) +} + +var xxx_messageInfo_BadRequest_FieldViolation proto.InternalMessageInfo + +func (m *BadRequest_FieldViolation) GetField() string { + if m != nil { + return m.Field + } + return "" +} + +func (m *BadRequest_FieldViolation) GetDescription() string { + if m != nil { + return m.Description + } + return "" +} + +func (*BadRequest_FieldViolation) XXX_MessageName() string { + return "google.rpc.BadRequest.FieldViolation" +} + +// Contains metadata about the request that clients can attach when filing a bug +// or providing other forms of feedback. +type RequestInfo struct { + // An opaque string that should only be interpreted by the service generating + // it. For example, it can be used to identify requests in the service's logs. + RequestId string `protobuf:"bytes,1,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"` + // Any data that was used to serve this request. For example, an encrypted + // stack trace that can be sent back to the service provider for debugging. + ServingData string `protobuf:"bytes,2,opt,name=serving_data,json=servingData,proto3" json:"serving_data,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *RequestInfo) Reset() { *m = RequestInfo{} } +func (*RequestInfo) ProtoMessage() {} +func (*RequestInfo) Descriptor() ([]byte, []int) { + return fileDescriptor_error_details_ff696d72eb1e7a26, []int{5} +} +func (m *RequestInfo) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RequestInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_RequestInfo.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *RequestInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_RequestInfo.Merge(dst, src) +} +func (m *RequestInfo) XXX_Size() int { + return m.Size() +} +func (m *RequestInfo) XXX_DiscardUnknown() { + xxx_messageInfo_RequestInfo.DiscardUnknown(m) +} + +var xxx_messageInfo_RequestInfo proto.InternalMessageInfo + +func (m *RequestInfo) GetRequestId() string { + if m != nil { + return m.RequestId + } + return "" +} + +func (m *RequestInfo) GetServingData() string { + if m != nil { + return m.ServingData + } + return "" +} + +func (*RequestInfo) XXX_MessageName() string { + return "google.rpc.RequestInfo" +} + +// Describes the resource that is being accessed. +type ResourceInfo struct { + // A name for the type of resource being accessed, e.g. "sql table", + // "cloud storage bucket", "file", "Google calendar"; or the type URL + // of the resource: e.g. "type.googleapis.com/google.pubsub.v1.Topic". + ResourceType string `protobuf:"bytes,1,opt,name=resource_type,json=resourceType,proto3" json:"resource_type,omitempty"` + // The name of the resource being accessed. For example, a shared calendar + // name: "example.com_4fghdhgsrgh@group.calendar.google.com", if the current + // error is [google.rpc.Code.PERMISSION_DENIED][google.rpc.Code.PERMISSION_DENIED]. + ResourceName string `protobuf:"bytes,2,opt,name=resource_name,json=resourceName,proto3" json:"resource_name,omitempty"` + // The owner of the resource (optional). + // For example, "user:" or "project:". + Owner string `protobuf:"bytes,3,opt,name=owner,proto3" json:"owner,omitempty"` + // Describes what error is encountered when accessing this resource. + // For example, updating a cloud project may require the `writer` permission + // on the developer console project. + Description string `protobuf:"bytes,4,opt,name=description,proto3" json:"description,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ResourceInfo) Reset() { *m = ResourceInfo{} } +func (*ResourceInfo) ProtoMessage() {} +func (*ResourceInfo) Descriptor() ([]byte, []int) { + return fileDescriptor_error_details_ff696d72eb1e7a26, []int{6} +} +func (m *ResourceInfo) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ResourceInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ResourceInfo.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *ResourceInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_ResourceInfo.Merge(dst, src) +} +func (m *ResourceInfo) XXX_Size() int { + return m.Size() +} +func (m *ResourceInfo) XXX_DiscardUnknown() { + xxx_messageInfo_ResourceInfo.DiscardUnknown(m) +} + +var xxx_messageInfo_ResourceInfo proto.InternalMessageInfo + +func (m *ResourceInfo) GetResourceType() string { + if m != nil { + return m.ResourceType + } + return "" +} + +func (m *ResourceInfo) GetResourceName() string { + if m != nil { + return m.ResourceName + } + return "" +} + +func (m *ResourceInfo) GetOwner() string { + if m != nil { + return m.Owner + } + return "" +} + +func (m *ResourceInfo) GetDescription() string { + if m != nil { + return m.Description + } + return "" +} + +func (*ResourceInfo) XXX_MessageName() string { + return "google.rpc.ResourceInfo" +} + +// Provides links to documentation or for performing an out of band action. +// +// For example, if a quota check failed with an error indicating the calling +// project hasn't enabled the accessed service, this can contain a URL pointing +// directly to the right place in the developer console to flip the bit. +type Help struct { + // URL(s) pointing to additional information on handling the current error. + Links []*Help_Link `protobuf:"bytes,1,rep,name=links" json:"links,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Help) Reset() { *m = Help{} } +func (*Help) ProtoMessage() {} +func (*Help) Descriptor() ([]byte, []int) { + return fileDescriptor_error_details_ff696d72eb1e7a26, []int{7} +} +func (m *Help) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Help) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Help.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *Help) XXX_Merge(src proto.Message) { + xxx_messageInfo_Help.Merge(dst, src) +} +func (m *Help) XXX_Size() int { + return m.Size() +} +func (m *Help) XXX_DiscardUnknown() { + xxx_messageInfo_Help.DiscardUnknown(m) +} + +var xxx_messageInfo_Help proto.InternalMessageInfo + +func (m *Help) GetLinks() []*Help_Link { + if m != nil { + return m.Links + } + return nil +} + +func (*Help) XXX_MessageName() string { + return "google.rpc.Help" +} + +// Describes a URL link. +type Help_Link struct { + // Describes what the link offers. + Description string `protobuf:"bytes,1,opt,name=description,proto3" json:"description,omitempty"` + // The URL of the link. + Url string `protobuf:"bytes,2,opt,name=url,proto3" json:"url,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Help_Link) Reset() { *m = Help_Link{} } +func (*Help_Link) ProtoMessage() {} +func (*Help_Link) Descriptor() ([]byte, []int) { + return fileDescriptor_error_details_ff696d72eb1e7a26, []int{7, 0} +} +func (m *Help_Link) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Help_Link) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Help_Link.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *Help_Link) XXX_Merge(src proto.Message) { + xxx_messageInfo_Help_Link.Merge(dst, src) +} +func (m *Help_Link) XXX_Size() int { + return m.Size() +} +func (m *Help_Link) XXX_DiscardUnknown() { + xxx_messageInfo_Help_Link.DiscardUnknown(m) +} + +var xxx_messageInfo_Help_Link proto.InternalMessageInfo + +func (m *Help_Link) GetDescription() string { + if m != nil { + return m.Description + } + return "" +} + +func (m *Help_Link) GetUrl() string { + if m != nil { + return m.Url + } + return "" +} + +func (*Help_Link) XXX_MessageName() string { + return "google.rpc.Help.Link" +} + +// Provides a localized error message that is safe to return to the user +// which can be attached to an RPC error. +type LocalizedMessage struct { + // The locale used following the specification defined at + // http://www.rfc-editor.org/rfc/bcp/bcp47.txt. + // Examples are: "en-US", "fr-CH", "es-MX" + Locale string `protobuf:"bytes,1,opt,name=locale,proto3" json:"locale,omitempty"` + // The localized error message in the above locale. + Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *LocalizedMessage) Reset() { *m = LocalizedMessage{} } +func (*LocalizedMessage) ProtoMessage() {} +func (*LocalizedMessage) Descriptor() ([]byte, []int) { + return fileDescriptor_error_details_ff696d72eb1e7a26, []int{8} +} +func (m *LocalizedMessage) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *LocalizedMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_LocalizedMessage.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *LocalizedMessage) XXX_Merge(src proto.Message) { + xxx_messageInfo_LocalizedMessage.Merge(dst, src) +} +func (m *LocalizedMessage) XXX_Size() int { + return m.Size() +} +func (m *LocalizedMessage) XXX_DiscardUnknown() { + xxx_messageInfo_LocalizedMessage.DiscardUnknown(m) +} + +var xxx_messageInfo_LocalizedMessage proto.InternalMessageInfo + +func (m *LocalizedMessage) GetLocale() string { + if m != nil { + return m.Locale + } + return "" +} + +func (m *LocalizedMessage) GetMessage() string { + if m != nil { + return m.Message + } + return "" +} + +func (*LocalizedMessage) XXX_MessageName() string { + return "google.rpc.LocalizedMessage" +} +func init() { + proto.RegisterType((*RetryInfo)(nil), "google.rpc.RetryInfo") + proto.RegisterType((*DebugInfo)(nil), "google.rpc.DebugInfo") + proto.RegisterType((*QuotaFailure)(nil), "google.rpc.QuotaFailure") + proto.RegisterType((*QuotaFailure_Violation)(nil), "google.rpc.QuotaFailure.Violation") + proto.RegisterType((*PreconditionFailure)(nil), "google.rpc.PreconditionFailure") + proto.RegisterType((*PreconditionFailure_Violation)(nil), "google.rpc.PreconditionFailure.Violation") + proto.RegisterType((*BadRequest)(nil), "google.rpc.BadRequest") + proto.RegisterType((*BadRequest_FieldViolation)(nil), "google.rpc.BadRequest.FieldViolation") + proto.RegisterType((*RequestInfo)(nil), "google.rpc.RequestInfo") + proto.RegisterType((*ResourceInfo)(nil), "google.rpc.ResourceInfo") + proto.RegisterType((*Help)(nil), "google.rpc.Help") + proto.RegisterType((*Help_Link)(nil), "google.rpc.Help.Link") + proto.RegisterType((*LocalizedMessage)(nil), "google.rpc.LocalizedMessage") +} +func (this *RetryInfo) Compare(that interface{}) int { + if that == nil { + if this == nil { + return 0 + } + return 1 + } + + that1, ok := that.(*RetryInfo) + if !ok { + that2, ok := that.(RetryInfo) + if ok { + that1 = &that2 + } else { + return 1 + } + } + if that1 == nil { + if this == nil { + return 0 + } + return 1 + } else if this == nil { + return -1 + } + if c := this.RetryDelay.Compare(that1.RetryDelay); c != 0 { + return c + } + if c := bytes.Compare(this.XXX_unrecognized, that1.XXX_unrecognized); c != 0 { + return c + } + return 0 +} +func (this *DebugInfo) Compare(that interface{}) int { + if that == nil { + if this == nil { + return 0 + } + return 1 + } + + that1, ok := that.(*DebugInfo) + if !ok { + that2, ok := that.(DebugInfo) + if ok { + that1 = &that2 + } else { + return 1 + } + } + if that1 == nil { + if this == nil { + return 0 + } + return 1 + } else if this == nil { + return -1 + } + if len(this.StackEntries) != len(that1.StackEntries) { + if len(this.StackEntries) < len(that1.StackEntries) { + return -1 + } + return 1 + } + for i := range this.StackEntries { + if this.StackEntries[i] != that1.StackEntries[i] { + if this.StackEntries[i] < that1.StackEntries[i] { + return -1 + } + return 1 + } + } + if this.Detail != that1.Detail { + if this.Detail < that1.Detail { + return -1 + } + return 1 + } + if c := bytes.Compare(this.XXX_unrecognized, that1.XXX_unrecognized); c != 0 { + return c + } + return 0 +} +func (this *QuotaFailure) Compare(that interface{}) int { + if that == nil { + if this == nil { + return 0 + } + return 1 + } + + that1, ok := that.(*QuotaFailure) + if !ok { + that2, ok := that.(QuotaFailure) + if ok { + that1 = &that2 + } else { + return 1 + } + } + if that1 == nil { + if this == nil { + return 0 + } + return 1 + } else if this == nil { + return -1 + } + if len(this.Violations) != len(that1.Violations) { + if len(this.Violations) < len(that1.Violations) { + return -1 + } + return 1 + } + for i := range this.Violations { + if c := this.Violations[i].Compare(that1.Violations[i]); c != 0 { + return c + } + } + if c := bytes.Compare(this.XXX_unrecognized, that1.XXX_unrecognized); c != 0 { + return c + } + return 0 +} +func (this *QuotaFailure_Violation) Compare(that interface{}) int { + if that == nil { + if this == nil { + return 0 + } + return 1 + } + + that1, ok := that.(*QuotaFailure_Violation) + if !ok { + that2, ok := that.(QuotaFailure_Violation) + if ok { + that1 = &that2 + } else { + return 1 + } + } + if that1 == nil { + if this == nil { + return 0 + } + return 1 + } else if this == nil { + return -1 + } + if this.Subject != that1.Subject { + if this.Subject < that1.Subject { + return -1 + } + return 1 + } + if this.Description != that1.Description { + if this.Description < that1.Description { + return -1 + } + return 1 + } + if c := bytes.Compare(this.XXX_unrecognized, that1.XXX_unrecognized); c != 0 { + return c + } + return 0 +} +func (this *PreconditionFailure) Compare(that interface{}) int { + if that == nil { + if this == nil { + return 0 + } + return 1 + } + + that1, ok := that.(*PreconditionFailure) + if !ok { + that2, ok := that.(PreconditionFailure) + if ok { + that1 = &that2 + } else { + return 1 + } + } + if that1 == nil { + if this == nil { + return 0 + } + return 1 + } else if this == nil { + return -1 + } + if len(this.Violations) != len(that1.Violations) { + if len(this.Violations) < len(that1.Violations) { + return -1 + } + return 1 + } + for i := range this.Violations { + if c := this.Violations[i].Compare(that1.Violations[i]); c != 0 { + return c + } + } + if c := bytes.Compare(this.XXX_unrecognized, that1.XXX_unrecognized); c != 0 { + return c + } + return 0 +} +func (this *PreconditionFailure_Violation) Compare(that interface{}) int { + if that == nil { + if this == nil { + return 0 + } + return 1 + } + + that1, ok := that.(*PreconditionFailure_Violation) + if !ok { + that2, ok := that.(PreconditionFailure_Violation) + if ok { + that1 = &that2 + } else { + return 1 + } + } + if that1 == nil { + if this == nil { + return 0 + } + return 1 + } else if this == nil { + return -1 + } + if this.Type != that1.Type { + if this.Type < that1.Type { + return -1 + } + return 1 + } + if this.Subject != that1.Subject { + if this.Subject < that1.Subject { + return -1 + } + return 1 + } + if this.Description != that1.Description { + if this.Description < that1.Description { + return -1 + } + return 1 + } + if c := bytes.Compare(this.XXX_unrecognized, that1.XXX_unrecognized); c != 0 { + return c + } + return 0 +} +func (this *BadRequest) Compare(that interface{}) int { + if that == nil { + if this == nil { + return 0 + } + return 1 + } + + that1, ok := that.(*BadRequest) + if !ok { + that2, ok := that.(BadRequest) + if ok { + that1 = &that2 + } else { + return 1 + } + } + if that1 == nil { + if this == nil { + return 0 + } + return 1 + } else if this == nil { + return -1 + } + if len(this.FieldViolations) != len(that1.FieldViolations) { + if len(this.FieldViolations) < len(that1.FieldViolations) { + return -1 + } + return 1 + } + for i := range this.FieldViolations { + if c := this.FieldViolations[i].Compare(that1.FieldViolations[i]); c != 0 { + return c + } + } + if c := bytes.Compare(this.XXX_unrecognized, that1.XXX_unrecognized); c != 0 { + return c + } + return 0 +} +func (this *BadRequest_FieldViolation) Compare(that interface{}) int { + if that == nil { + if this == nil { + return 0 + } + return 1 + } + + that1, ok := that.(*BadRequest_FieldViolation) + if !ok { + that2, ok := that.(BadRequest_FieldViolation) + if ok { + that1 = &that2 + } else { + return 1 + } + } + if that1 == nil { + if this == nil { + return 0 + } + return 1 + } else if this == nil { + return -1 + } + if this.Field != that1.Field { + if this.Field < that1.Field { + return -1 + } + return 1 + } + if this.Description != that1.Description { + if this.Description < that1.Description { + return -1 + } + return 1 + } + if c := bytes.Compare(this.XXX_unrecognized, that1.XXX_unrecognized); c != 0 { + return c + } + return 0 +} +func (this *RequestInfo) Compare(that interface{}) int { + if that == nil { + if this == nil { + return 0 + } + return 1 + } + + that1, ok := that.(*RequestInfo) + if !ok { + that2, ok := that.(RequestInfo) + if ok { + that1 = &that2 + } else { + return 1 + } + } + if that1 == nil { + if this == nil { + return 0 + } + return 1 + } else if this == nil { + return -1 + } + if this.RequestId != that1.RequestId { + if this.RequestId < that1.RequestId { + return -1 + } + return 1 + } + if this.ServingData != that1.ServingData { + if this.ServingData < that1.ServingData { + return -1 + } + return 1 + } + if c := bytes.Compare(this.XXX_unrecognized, that1.XXX_unrecognized); c != 0 { + return c + } + return 0 +} +func (this *ResourceInfo) Compare(that interface{}) int { + if that == nil { + if this == nil { + return 0 + } + return 1 + } + + that1, ok := that.(*ResourceInfo) + if !ok { + that2, ok := that.(ResourceInfo) + if ok { + that1 = &that2 + } else { + return 1 + } + } + if that1 == nil { + if this == nil { + return 0 + } + return 1 + } else if this == nil { + return -1 + } + if this.ResourceType != that1.ResourceType { + if this.ResourceType < that1.ResourceType { + return -1 + } + return 1 + } + if this.ResourceName != that1.ResourceName { + if this.ResourceName < that1.ResourceName { + return -1 + } + return 1 + } + if this.Owner != that1.Owner { + if this.Owner < that1.Owner { + return -1 + } + return 1 + } + if this.Description != that1.Description { + if this.Description < that1.Description { + return -1 + } + return 1 + } + if c := bytes.Compare(this.XXX_unrecognized, that1.XXX_unrecognized); c != 0 { + return c + } + return 0 +} +func (this *Help) Compare(that interface{}) int { + if that == nil { + if this == nil { + return 0 + } + return 1 + } + + that1, ok := that.(*Help) + if !ok { + that2, ok := that.(Help) + if ok { + that1 = &that2 + } else { + return 1 + } + } + if that1 == nil { + if this == nil { + return 0 + } + return 1 + } else if this == nil { + return -1 + } + if len(this.Links) != len(that1.Links) { + if len(this.Links) < len(that1.Links) { + return -1 + } + return 1 + } + for i := range this.Links { + if c := this.Links[i].Compare(that1.Links[i]); c != 0 { + return c + } + } + if c := bytes.Compare(this.XXX_unrecognized, that1.XXX_unrecognized); c != 0 { + return c + } + return 0 +} +func (this *Help_Link) Compare(that interface{}) int { + if that == nil { + if this == nil { + return 0 + } + return 1 + } + + that1, ok := that.(*Help_Link) + if !ok { + that2, ok := that.(Help_Link) + if ok { + that1 = &that2 + } else { + return 1 + } + } + if that1 == nil { + if this == nil { + return 0 + } + return 1 + } else if this == nil { + return -1 + } + if this.Description != that1.Description { + if this.Description < that1.Description { + return -1 + } + return 1 + } + if this.Url != that1.Url { + if this.Url < that1.Url { + return -1 + } + return 1 + } + if c := bytes.Compare(this.XXX_unrecognized, that1.XXX_unrecognized); c != 0 { + return c + } + return 0 +} +func (this *LocalizedMessage) Compare(that interface{}) int { + if that == nil { + if this == nil { + return 0 + } + return 1 + } + + that1, ok := that.(*LocalizedMessage) + if !ok { + that2, ok := that.(LocalizedMessage) + if ok { + that1 = &that2 + } else { + return 1 + } + } + if that1 == nil { + if this == nil { + return 0 + } + return 1 + } else if this == nil { + return -1 + } + if this.Locale != that1.Locale { + if this.Locale < that1.Locale { + return -1 + } + return 1 + } + if this.Message != that1.Message { + if this.Message < that1.Message { + return -1 + } + return 1 + } + if c := bytes.Compare(this.XXX_unrecognized, that1.XXX_unrecognized); c != 0 { + return c + } + return 0 +} +func (this *RetryInfo) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*RetryInfo) + if !ok { + that2, ok := that.(RetryInfo) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.RetryDelay.Equal(that1.RetryDelay) { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *DebugInfo) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*DebugInfo) + if !ok { + that2, ok := that.(DebugInfo) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if len(this.StackEntries) != len(that1.StackEntries) { + return false + } + for i := range this.StackEntries { + if this.StackEntries[i] != that1.StackEntries[i] { + return false + } + } + if this.Detail != that1.Detail { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *QuotaFailure) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*QuotaFailure) + if !ok { + that2, ok := that.(QuotaFailure) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if len(this.Violations) != len(that1.Violations) { + return false + } + for i := range this.Violations { + if !this.Violations[i].Equal(that1.Violations[i]) { + return false + } + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *QuotaFailure_Violation) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*QuotaFailure_Violation) + if !ok { + that2, ok := that.(QuotaFailure_Violation) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Subject != that1.Subject { + return false + } + if this.Description != that1.Description { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *PreconditionFailure) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*PreconditionFailure) + if !ok { + that2, ok := that.(PreconditionFailure) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if len(this.Violations) != len(that1.Violations) { + return false + } + for i := range this.Violations { + if !this.Violations[i].Equal(that1.Violations[i]) { + return false + } + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *PreconditionFailure_Violation) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*PreconditionFailure_Violation) + if !ok { + that2, ok := that.(PreconditionFailure_Violation) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Type != that1.Type { + return false + } + if this.Subject != that1.Subject { + return false + } + if this.Description != that1.Description { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *BadRequest) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*BadRequest) + if !ok { + that2, ok := that.(BadRequest) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if len(this.FieldViolations) != len(that1.FieldViolations) { + return false + } + for i := range this.FieldViolations { + if !this.FieldViolations[i].Equal(that1.FieldViolations[i]) { + return false + } + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *BadRequest_FieldViolation) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*BadRequest_FieldViolation) + if !ok { + that2, ok := that.(BadRequest_FieldViolation) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Field != that1.Field { + return false + } + if this.Description != that1.Description { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *RequestInfo) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*RequestInfo) + if !ok { + that2, ok := that.(RequestInfo) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.RequestId != that1.RequestId { + return false + } + if this.ServingData != that1.ServingData { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *ResourceInfo) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*ResourceInfo) + if !ok { + that2, ok := that.(ResourceInfo) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.ResourceType != that1.ResourceType { + return false + } + if this.ResourceName != that1.ResourceName { + return false + } + if this.Owner != that1.Owner { + return false + } + if this.Description != that1.Description { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *Help) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Help) + if !ok { + that2, ok := that.(Help) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if len(this.Links) != len(that1.Links) { + return false + } + for i := range this.Links { + if !this.Links[i].Equal(that1.Links[i]) { + return false + } + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *Help_Link) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Help_Link) + if !ok { + that2, ok := that.(Help_Link) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Description != that1.Description { + return false + } + if this.Url != that1.Url { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *LocalizedMessage) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*LocalizedMessage) + if !ok { + that2, ok := that.(LocalizedMessage) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Locale != that1.Locale { + return false + } + if this.Message != that1.Message { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *RetryInfo) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 5) + s = append(s, "&rpc.RetryInfo{") + if this.RetryDelay != nil { + s = append(s, "RetryDelay: "+fmt.Sprintf("%#v", this.RetryDelay)+",\n") + } + if this.XXX_unrecognized != nil { + s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") + } + s = append(s, "}") + return strings.Join(s, "") +} +func (this *DebugInfo) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 6) + s = append(s, "&rpc.DebugInfo{") + s = append(s, "StackEntries: "+fmt.Sprintf("%#v", this.StackEntries)+",\n") + s = append(s, "Detail: "+fmt.Sprintf("%#v", this.Detail)+",\n") + if this.XXX_unrecognized != nil { + s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") + } + s = append(s, "}") + return strings.Join(s, "") +} +func (this *QuotaFailure) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 5) + s = append(s, "&rpc.QuotaFailure{") + if this.Violations != nil { + s = append(s, "Violations: "+fmt.Sprintf("%#v", this.Violations)+",\n") + } + if this.XXX_unrecognized != nil { + s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") + } + s = append(s, "}") + return strings.Join(s, "") +} +func (this *QuotaFailure_Violation) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 6) + s = append(s, "&rpc.QuotaFailure_Violation{") + s = append(s, "Subject: "+fmt.Sprintf("%#v", this.Subject)+",\n") + s = append(s, "Description: "+fmt.Sprintf("%#v", this.Description)+",\n") + if this.XXX_unrecognized != nil { + s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") + } + s = append(s, "}") + return strings.Join(s, "") +} +func (this *PreconditionFailure) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 5) + s = append(s, "&rpc.PreconditionFailure{") + if this.Violations != nil { + s = append(s, "Violations: "+fmt.Sprintf("%#v", this.Violations)+",\n") + } + if this.XXX_unrecognized != nil { + s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") + } + s = append(s, "}") + return strings.Join(s, "") +} +func (this *PreconditionFailure_Violation) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 7) + s = append(s, "&rpc.PreconditionFailure_Violation{") + s = append(s, "Type: "+fmt.Sprintf("%#v", this.Type)+",\n") + s = append(s, "Subject: "+fmt.Sprintf("%#v", this.Subject)+",\n") + s = append(s, "Description: "+fmt.Sprintf("%#v", this.Description)+",\n") + if this.XXX_unrecognized != nil { + s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") + } + s = append(s, "}") + return strings.Join(s, "") +} +func (this *BadRequest) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 5) + s = append(s, "&rpc.BadRequest{") + if this.FieldViolations != nil { + s = append(s, "FieldViolations: "+fmt.Sprintf("%#v", this.FieldViolations)+",\n") + } + if this.XXX_unrecognized != nil { + s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") + } + s = append(s, "}") + return strings.Join(s, "") +} +func (this *BadRequest_FieldViolation) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 6) + s = append(s, "&rpc.BadRequest_FieldViolation{") + s = append(s, "Field: "+fmt.Sprintf("%#v", this.Field)+",\n") + s = append(s, "Description: "+fmt.Sprintf("%#v", this.Description)+",\n") + if this.XXX_unrecognized != nil { + s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") + } + s = append(s, "}") + return strings.Join(s, "") +} +func (this *RequestInfo) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 6) + s = append(s, "&rpc.RequestInfo{") + s = append(s, "RequestId: "+fmt.Sprintf("%#v", this.RequestId)+",\n") + s = append(s, "ServingData: "+fmt.Sprintf("%#v", this.ServingData)+",\n") + if this.XXX_unrecognized != nil { + s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") + } + s = append(s, "}") + return strings.Join(s, "") +} +func (this *ResourceInfo) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 8) + s = append(s, "&rpc.ResourceInfo{") + s = append(s, "ResourceType: "+fmt.Sprintf("%#v", this.ResourceType)+",\n") + s = append(s, "ResourceName: "+fmt.Sprintf("%#v", this.ResourceName)+",\n") + s = append(s, "Owner: "+fmt.Sprintf("%#v", this.Owner)+",\n") + s = append(s, "Description: "+fmt.Sprintf("%#v", this.Description)+",\n") + if this.XXX_unrecognized != nil { + s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") + } + s = append(s, "}") + return strings.Join(s, "") +} +func (this *Help) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 5) + s = append(s, "&rpc.Help{") + if this.Links != nil { + s = append(s, "Links: "+fmt.Sprintf("%#v", this.Links)+",\n") + } + if this.XXX_unrecognized != nil { + s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") + } + s = append(s, "}") + return strings.Join(s, "") +} +func (this *Help_Link) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 6) + s = append(s, "&rpc.Help_Link{") + s = append(s, "Description: "+fmt.Sprintf("%#v", this.Description)+",\n") + s = append(s, "Url: "+fmt.Sprintf("%#v", this.Url)+",\n") + if this.XXX_unrecognized != nil { + s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") + } + s = append(s, "}") + return strings.Join(s, "") +} +func (this *LocalizedMessage) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 6) + s = append(s, "&rpc.LocalizedMessage{") + s = append(s, "Locale: "+fmt.Sprintf("%#v", this.Locale)+",\n") + s = append(s, "Message: "+fmt.Sprintf("%#v", this.Message)+",\n") + if this.XXX_unrecognized != nil { + s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") + } + s = append(s, "}") + return strings.Join(s, "") +} +func valueToGoStringErrorDetails(v interface{}, typ string) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv) +} +func (m *RetryInfo) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *RetryInfo) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.RetryDelay != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintErrorDetails(dAtA, i, uint64(m.RetryDelay.Size())) + n1, err := m.RetryDelay.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n1 + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *DebugInfo) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *DebugInfo) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.StackEntries) > 0 { + for _, s := range m.StackEntries { + dAtA[i] = 0xa + i++ + l = len(s) + for l >= 1<<7 { + dAtA[i] = uint8(uint64(l)&0x7f | 0x80) + l >>= 7 + i++ + } + dAtA[i] = uint8(l) + i++ + i += copy(dAtA[i:], s) + } + } + if len(m.Detail) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintErrorDetails(dAtA, i, uint64(len(m.Detail))) + i += copy(dAtA[i:], m.Detail) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *QuotaFailure) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QuotaFailure) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Violations) > 0 { + for _, msg := range m.Violations { + dAtA[i] = 0xa + i++ + i = encodeVarintErrorDetails(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *QuotaFailure_Violation) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QuotaFailure_Violation) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Subject) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintErrorDetails(dAtA, i, uint64(len(m.Subject))) + i += copy(dAtA[i:], m.Subject) + } + if len(m.Description) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintErrorDetails(dAtA, i, uint64(len(m.Description))) + i += copy(dAtA[i:], m.Description) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *PreconditionFailure) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *PreconditionFailure) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Violations) > 0 { + for _, msg := range m.Violations { + dAtA[i] = 0xa + i++ + i = encodeVarintErrorDetails(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *PreconditionFailure_Violation) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *PreconditionFailure_Violation) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Type) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintErrorDetails(dAtA, i, uint64(len(m.Type))) + i += copy(dAtA[i:], m.Type) + } + if len(m.Subject) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintErrorDetails(dAtA, i, uint64(len(m.Subject))) + i += copy(dAtA[i:], m.Subject) + } + if len(m.Description) > 0 { + dAtA[i] = 0x1a + i++ + i = encodeVarintErrorDetails(dAtA, i, uint64(len(m.Description))) + i += copy(dAtA[i:], m.Description) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *BadRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *BadRequest) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.FieldViolations) > 0 { + for _, msg := range m.FieldViolations { + dAtA[i] = 0xa + i++ + i = encodeVarintErrorDetails(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *BadRequest_FieldViolation) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *BadRequest_FieldViolation) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Field) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintErrorDetails(dAtA, i, uint64(len(m.Field))) + i += copy(dAtA[i:], m.Field) + } + if len(m.Description) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintErrorDetails(dAtA, i, uint64(len(m.Description))) + i += copy(dAtA[i:], m.Description) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *RequestInfo) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *RequestInfo) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.RequestId) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintErrorDetails(dAtA, i, uint64(len(m.RequestId))) + i += copy(dAtA[i:], m.RequestId) + } + if len(m.ServingData) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintErrorDetails(dAtA, i, uint64(len(m.ServingData))) + i += copy(dAtA[i:], m.ServingData) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *ResourceInfo) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ResourceInfo) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.ResourceType) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintErrorDetails(dAtA, i, uint64(len(m.ResourceType))) + i += copy(dAtA[i:], m.ResourceType) + } + if len(m.ResourceName) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintErrorDetails(dAtA, i, uint64(len(m.ResourceName))) + i += copy(dAtA[i:], m.ResourceName) + } + if len(m.Owner) > 0 { + dAtA[i] = 0x1a + i++ + i = encodeVarintErrorDetails(dAtA, i, uint64(len(m.Owner))) + i += copy(dAtA[i:], m.Owner) + } + if len(m.Description) > 0 { + dAtA[i] = 0x22 + i++ + i = encodeVarintErrorDetails(dAtA, i, uint64(len(m.Description))) + i += copy(dAtA[i:], m.Description) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *Help) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Help) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Links) > 0 { + for _, msg := range m.Links { + dAtA[i] = 0xa + i++ + i = encodeVarintErrorDetails(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *Help_Link) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Help_Link) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Description) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintErrorDetails(dAtA, i, uint64(len(m.Description))) + i += copy(dAtA[i:], m.Description) + } + if len(m.Url) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintErrorDetails(dAtA, i, uint64(len(m.Url))) + i += copy(dAtA[i:], m.Url) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *LocalizedMessage) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *LocalizedMessage) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Locale) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintErrorDetails(dAtA, i, uint64(len(m.Locale))) + i += copy(dAtA[i:], m.Locale) + } + if len(m.Message) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintErrorDetails(dAtA, i, uint64(len(m.Message))) + i += copy(dAtA[i:], m.Message) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func encodeVarintErrorDetails(dAtA []byte, offset int, v uint64) int { + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return offset + 1 +} +func NewPopulatedRetryInfo(r randyErrorDetails, easy bool) *RetryInfo { + this := &RetryInfo{} + if r.Intn(10) != 0 { + this.RetryDelay = types.NewPopulatedDuration(r, easy) + } + if !easy && r.Intn(10) != 0 { + this.XXX_unrecognized = randUnrecognizedErrorDetails(r, 2) + } + return this +} + +func NewPopulatedDebugInfo(r randyErrorDetails, easy bool) *DebugInfo { + this := &DebugInfo{} + v1 := r.Intn(10) + this.StackEntries = make([]string, v1) + for i := 0; i < v1; i++ { + this.StackEntries[i] = string(randStringErrorDetails(r)) + } + this.Detail = string(randStringErrorDetails(r)) + if !easy && r.Intn(10) != 0 { + this.XXX_unrecognized = randUnrecognizedErrorDetails(r, 3) + } + return this +} + +func NewPopulatedQuotaFailure(r randyErrorDetails, easy bool) *QuotaFailure { + this := &QuotaFailure{} + if r.Intn(10) != 0 { + v2 := r.Intn(5) + this.Violations = make([]*QuotaFailure_Violation, v2) + for i := 0; i < v2; i++ { + this.Violations[i] = NewPopulatedQuotaFailure_Violation(r, easy) + } + } + if !easy && r.Intn(10) != 0 { + this.XXX_unrecognized = randUnrecognizedErrorDetails(r, 2) + } + return this +} + +func NewPopulatedQuotaFailure_Violation(r randyErrorDetails, easy bool) *QuotaFailure_Violation { + this := &QuotaFailure_Violation{} + this.Subject = string(randStringErrorDetails(r)) + this.Description = string(randStringErrorDetails(r)) + if !easy && r.Intn(10) != 0 { + this.XXX_unrecognized = randUnrecognizedErrorDetails(r, 3) + } + return this +} + +func NewPopulatedPreconditionFailure(r randyErrorDetails, easy bool) *PreconditionFailure { + this := &PreconditionFailure{} + if r.Intn(10) != 0 { + v3 := r.Intn(5) + this.Violations = make([]*PreconditionFailure_Violation, v3) + for i := 0; i < v3; i++ { + this.Violations[i] = NewPopulatedPreconditionFailure_Violation(r, easy) + } + } + if !easy && r.Intn(10) != 0 { + this.XXX_unrecognized = randUnrecognizedErrorDetails(r, 2) + } + return this +} + +func NewPopulatedPreconditionFailure_Violation(r randyErrorDetails, easy bool) *PreconditionFailure_Violation { + this := &PreconditionFailure_Violation{} + this.Type = string(randStringErrorDetails(r)) + this.Subject = string(randStringErrorDetails(r)) + this.Description = string(randStringErrorDetails(r)) + if !easy && r.Intn(10) != 0 { + this.XXX_unrecognized = randUnrecognizedErrorDetails(r, 4) + } + return this +} + +func NewPopulatedBadRequest(r randyErrorDetails, easy bool) *BadRequest { + this := &BadRequest{} + if r.Intn(10) != 0 { + v4 := r.Intn(5) + this.FieldViolations = make([]*BadRequest_FieldViolation, v4) + for i := 0; i < v4; i++ { + this.FieldViolations[i] = NewPopulatedBadRequest_FieldViolation(r, easy) + } + } + if !easy && r.Intn(10) != 0 { + this.XXX_unrecognized = randUnrecognizedErrorDetails(r, 2) + } + return this +} + +func NewPopulatedBadRequest_FieldViolation(r randyErrorDetails, easy bool) *BadRequest_FieldViolation { + this := &BadRequest_FieldViolation{} + this.Field = string(randStringErrorDetails(r)) + this.Description = string(randStringErrorDetails(r)) + if !easy && r.Intn(10) != 0 { + this.XXX_unrecognized = randUnrecognizedErrorDetails(r, 3) + } + return this +} + +func NewPopulatedRequestInfo(r randyErrorDetails, easy bool) *RequestInfo { + this := &RequestInfo{} + this.RequestId = string(randStringErrorDetails(r)) + this.ServingData = string(randStringErrorDetails(r)) + if !easy && r.Intn(10) != 0 { + this.XXX_unrecognized = randUnrecognizedErrorDetails(r, 3) + } + return this +} + +func NewPopulatedResourceInfo(r randyErrorDetails, easy bool) *ResourceInfo { + this := &ResourceInfo{} + this.ResourceType = string(randStringErrorDetails(r)) + this.ResourceName = string(randStringErrorDetails(r)) + this.Owner = string(randStringErrorDetails(r)) + this.Description = string(randStringErrorDetails(r)) + if !easy && r.Intn(10) != 0 { + this.XXX_unrecognized = randUnrecognizedErrorDetails(r, 5) + } + return this +} + +func NewPopulatedHelp(r randyErrorDetails, easy bool) *Help { + this := &Help{} + if r.Intn(10) != 0 { + v5 := r.Intn(5) + this.Links = make([]*Help_Link, v5) + for i := 0; i < v5; i++ { + this.Links[i] = NewPopulatedHelp_Link(r, easy) + } + } + if !easy && r.Intn(10) != 0 { + this.XXX_unrecognized = randUnrecognizedErrorDetails(r, 2) + } + return this +} + +func NewPopulatedHelp_Link(r randyErrorDetails, easy bool) *Help_Link { + this := &Help_Link{} + this.Description = string(randStringErrorDetails(r)) + this.Url = string(randStringErrorDetails(r)) + if !easy && r.Intn(10) != 0 { + this.XXX_unrecognized = randUnrecognizedErrorDetails(r, 3) + } + return this +} + +func NewPopulatedLocalizedMessage(r randyErrorDetails, easy bool) *LocalizedMessage { + this := &LocalizedMessage{} + this.Locale = string(randStringErrorDetails(r)) + this.Message = string(randStringErrorDetails(r)) + if !easy && r.Intn(10) != 0 { + this.XXX_unrecognized = randUnrecognizedErrorDetails(r, 3) + } + return this +} + +type randyErrorDetails interface { + Float32() float32 + Float64() float64 + Int63() int64 + Int31() int32 + Uint32() uint32 + Intn(n int) int +} + +func randUTF8RuneErrorDetails(r randyErrorDetails) rune { + ru := r.Intn(62) + if ru < 10 { + return rune(ru + 48) + } else if ru < 36 { + return rune(ru + 55) + } + return rune(ru + 61) +} +func randStringErrorDetails(r randyErrorDetails) string { + v6 := r.Intn(100) + tmps := make([]rune, v6) + for i := 0; i < v6; i++ { + tmps[i] = randUTF8RuneErrorDetails(r) + } + return string(tmps) +} +func randUnrecognizedErrorDetails(r randyErrorDetails, maxFieldNumber int) (dAtA []byte) { + l := r.Intn(5) + for i := 0; i < l; i++ { + wire := r.Intn(4) + if wire == 3 { + wire = 5 + } + fieldNumber := maxFieldNumber + r.Intn(100) + dAtA = randFieldErrorDetails(dAtA, r, fieldNumber, wire) + } + return dAtA +} +func randFieldErrorDetails(dAtA []byte, r randyErrorDetails, fieldNumber int, wire int) []byte { + key := uint32(fieldNumber)<<3 | uint32(wire) + switch wire { + case 0: + dAtA = encodeVarintPopulateErrorDetails(dAtA, uint64(key)) + v7 := r.Int63() + if r.Intn(2) == 0 { + v7 *= -1 + } + dAtA = encodeVarintPopulateErrorDetails(dAtA, uint64(v7)) + case 1: + dAtA = encodeVarintPopulateErrorDetails(dAtA, uint64(key)) + dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256))) + case 2: + dAtA = encodeVarintPopulateErrorDetails(dAtA, uint64(key)) + ll := r.Intn(100) + dAtA = encodeVarintPopulateErrorDetails(dAtA, uint64(ll)) + for j := 0; j < ll; j++ { + dAtA = append(dAtA, byte(r.Intn(256))) + } + default: + dAtA = encodeVarintPopulateErrorDetails(dAtA, uint64(key)) + dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256))) + } + return dAtA +} +func encodeVarintPopulateErrorDetails(dAtA []byte, v uint64) []byte { + for v >= 1<<7 { + dAtA = append(dAtA, uint8(uint64(v)&0x7f|0x80)) + v >>= 7 + } + dAtA = append(dAtA, uint8(v)) + return dAtA +} +func (m *RetryInfo) Size() (n int) { + var l int + _ = l + if m.RetryDelay != nil { + l = m.RetryDelay.Size() + n += 1 + l + sovErrorDetails(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *DebugInfo) Size() (n int) { + var l int + _ = l + if len(m.StackEntries) > 0 { + for _, s := range m.StackEntries { + l = len(s) + n += 1 + l + sovErrorDetails(uint64(l)) + } + } + l = len(m.Detail) + if l > 0 { + n += 1 + l + sovErrorDetails(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *QuotaFailure) Size() (n int) { + var l int + _ = l + if len(m.Violations) > 0 { + for _, e := range m.Violations { + l = e.Size() + n += 1 + l + sovErrorDetails(uint64(l)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *QuotaFailure_Violation) Size() (n int) { + var l int + _ = l + l = len(m.Subject) + if l > 0 { + n += 1 + l + sovErrorDetails(uint64(l)) + } + l = len(m.Description) + if l > 0 { + n += 1 + l + sovErrorDetails(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *PreconditionFailure) Size() (n int) { + var l int + _ = l + if len(m.Violations) > 0 { + for _, e := range m.Violations { + l = e.Size() + n += 1 + l + sovErrorDetails(uint64(l)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *PreconditionFailure_Violation) Size() (n int) { + var l int + _ = l + l = len(m.Type) + if l > 0 { + n += 1 + l + sovErrorDetails(uint64(l)) + } + l = len(m.Subject) + if l > 0 { + n += 1 + l + sovErrorDetails(uint64(l)) + } + l = len(m.Description) + if l > 0 { + n += 1 + l + sovErrorDetails(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *BadRequest) Size() (n int) { + var l int + _ = l + if len(m.FieldViolations) > 0 { + for _, e := range m.FieldViolations { + l = e.Size() + n += 1 + l + sovErrorDetails(uint64(l)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *BadRequest_FieldViolation) Size() (n int) { + var l int + _ = l + l = len(m.Field) + if l > 0 { + n += 1 + l + sovErrorDetails(uint64(l)) + } + l = len(m.Description) + if l > 0 { + n += 1 + l + sovErrorDetails(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *RequestInfo) Size() (n int) { + var l int + _ = l + l = len(m.RequestId) + if l > 0 { + n += 1 + l + sovErrorDetails(uint64(l)) + } + l = len(m.ServingData) + if l > 0 { + n += 1 + l + sovErrorDetails(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *ResourceInfo) Size() (n int) { + var l int + _ = l + l = len(m.ResourceType) + if l > 0 { + n += 1 + l + sovErrorDetails(uint64(l)) + } + l = len(m.ResourceName) + if l > 0 { + n += 1 + l + sovErrorDetails(uint64(l)) + } + l = len(m.Owner) + if l > 0 { + n += 1 + l + sovErrorDetails(uint64(l)) + } + l = len(m.Description) + if l > 0 { + n += 1 + l + sovErrorDetails(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *Help) Size() (n int) { + var l int + _ = l + if len(m.Links) > 0 { + for _, e := range m.Links { + l = e.Size() + n += 1 + l + sovErrorDetails(uint64(l)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *Help_Link) Size() (n int) { + var l int + _ = l + l = len(m.Description) + if l > 0 { + n += 1 + l + sovErrorDetails(uint64(l)) + } + l = len(m.Url) + if l > 0 { + n += 1 + l + sovErrorDetails(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *LocalizedMessage) Size() (n int) { + var l int + _ = l + l = len(m.Locale) + if l > 0 { + n += 1 + l + sovErrorDetails(uint64(l)) + } + l = len(m.Message) + if l > 0 { + n += 1 + l + sovErrorDetails(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func sovErrorDetails(x uint64) (n int) { + for { + n++ + x >>= 7 + if x == 0 { + break + } + } + return n +} +func sozErrorDetails(x uint64) (n int) { + return sovErrorDetails(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (this *RetryInfo) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&RetryInfo{`, + `RetryDelay:` + strings.Replace(fmt.Sprintf("%v", this.RetryDelay), "Duration", "types.Duration", 1) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *DebugInfo) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&DebugInfo{`, + `StackEntries:` + fmt.Sprintf("%v", this.StackEntries) + `,`, + `Detail:` + fmt.Sprintf("%v", this.Detail) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *QuotaFailure) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&QuotaFailure{`, + `Violations:` + strings.Replace(fmt.Sprintf("%v", this.Violations), "QuotaFailure_Violation", "QuotaFailure_Violation", 1) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *QuotaFailure_Violation) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&QuotaFailure_Violation{`, + `Subject:` + fmt.Sprintf("%v", this.Subject) + `,`, + `Description:` + fmt.Sprintf("%v", this.Description) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *PreconditionFailure) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&PreconditionFailure{`, + `Violations:` + strings.Replace(fmt.Sprintf("%v", this.Violations), "PreconditionFailure_Violation", "PreconditionFailure_Violation", 1) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *PreconditionFailure_Violation) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&PreconditionFailure_Violation{`, + `Type:` + fmt.Sprintf("%v", this.Type) + `,`, + `Subject:` + fmt.Sprintf("%v", this.Subject) + `,`, + `Description:` + fmt.Sprintf("%v", this.Description) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *BadRequest) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&BadRequest{`, + `FieldViolations:` + strings.Replace(fmt.Sprintf("%v", this.FieldViolations), "BadRequest_FieldViolation", "BadRequest_FieldViolation", 1) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *BadRequest_FieldViolation) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&BadRequest_FieldViolation{`, + `Field:` + fmt.Sprintf("%v", this.Field) + `,`, + `Description:` + fmt.Sprintf("%v", this.Description) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *RequestInfo) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&RequestInfo{`, + `RequestId:` + fmt.Sprintf("%v", this.RequestId) + `,`, + `ServingData:` + fmt.Sprintf("%v", this.ServingData) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *ResourceInfo) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&ResourceInfo{`, + `ResourceType:` + fmt.Sprintf("%v", this.ResourceType) + `,`, + `ResourceName:` + fmt.Sprintf("%v", this.ResourceName) + `,`, + `Owner:` + fmt.Sprintf("%v", this.Owner) + `,`, + `Description:` + fmt.Sprintf("%v", this.Description) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *Help) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&Help{`, + `Links:` + strings.Replace(fmt.Sprintf("%v", this.Links), "Help_Link", "Help_Link", 1) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *Help_Link) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&Help_Link{`, + `Description:` + fmt.Sprintf("%v", this.Description) + `,`, + `Url:` + fmt.Sprintf("%v", this.Url) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *LocalizedMessage) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&LocalizedMessage{`, + `Locale:` + fmt.Sprintf("%v", this.Locale) + `,`, + `Message:` + fmt.Sprintf("%v", this.Message) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func valueToStringErrorDetails(v interface{}) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("*%v", pv) +} +func (m *RetryInfo) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowErrorDetails + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: RetryInfo: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RetryInfo: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RetryDelay", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowErrorDetails + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthErrorDetails + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.RetryDelay == nil { + m.RetryDelay = &types.Duration{} + } + if err := m.RetryDelay.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipErrorDetails(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthErrorDetails + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DebugInfo) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowErrorDetails + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DebugInfo: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DebugInfo: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field StackEntries", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowErrorDetails + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthErrorDetails + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.StackEntries = append(m.StackEntries, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Detail", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowErrorDetails + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthErrorDetails + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Detail = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipErrorDetails(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthErrorDetails + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QuotaFailure) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowErrorDetails + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QuotaFailure: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QuotaFailure: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Violations", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowErrorDetails + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthErrorDetails + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Violations = append(m.Violations, &QuotaFailure_Violation{}) + if err := m.Violations[len(m.Violations)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipErrorDetails(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthErrorDetails + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QuotaFailure_Violation) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowErrorDetails + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Violation: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Violation: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Subject", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowErrorDetails + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthErrorDetails + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Subject = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowErrorDetails + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthErrorDetails + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Description = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipErrorDetails(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthErrorDetails + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *PreconditionFailure) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowErrorDetails + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: PreconditionFailure: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PreconditionFailure: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Violations", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowErrorDetails + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthErrorDetails + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Violations = append(m.Violations, &PreconditionFailure_Violation{}) + if err := m.Violations[len(m.Violations)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipErrorDetails(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthErrorDetails + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *PreconditionFailure_Violation) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowErrorDetails + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Violation: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Violation: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowErrorDetails + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthErrorDetails + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Type = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Subject", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowErrorDetails + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthErrorDetails + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Subject = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowErrorDetails + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthErrorDetails + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Description = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipErrorDetails(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthErrorDetails + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *BadRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowErrorDetails + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: BadRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: BadRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FieldViolations", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowErrorDetails + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthErrorDetails + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.FieldViolations = append(m.FieldViolations, &BadRequest_FieldViolation{}) + if err := m.FieldViolations[len(m.FieldViolations)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipErrorDetails(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthErrorDetails + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *BadRequest_FieldViolation) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowErrorDetails + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: FieldViolation: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: FieldViolation: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Field", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowErrorDetails + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthErrorDetails + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Field = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowErrorDetails + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthErrorDetails + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Description = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipErrorDetails(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthErrorDetails + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *RequestInfo) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowErrorDetails + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: RequestInfo: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RequestInfo: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowErrorDetails + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthErrorDetails + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RequestId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ServingData", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowErrorDetails + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthErrorDetails + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ServingData = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipErrorDetails(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthErrorDetails + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ResourceInfo) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowErrorDetails + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ResourceInfo: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ResourceInfo: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ResourceType", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowErrorDetails + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthErrorDetails + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ResourceType = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ResourceName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowErrorDetails + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthErrorDetails + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ResourceName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowErrorDetails + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthErrorDetails + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Owner = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowErrorDetails + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthErrorDetails + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Description = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipErrorDetails(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthErrorDetails + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Help) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowErrorDetails + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Help: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Help: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Links", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowErrorDetails + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthErrorDetails + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Links = append(m.Links, &Help_Link{}) + if err := m.Links[len(m.Links)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipErrorDetails(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthErrorDetails + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Help_Link) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowErrorDetails + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Link: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Link: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowErrorDetails + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthErrorDetails + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Description = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Url", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowErrorDetails + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthErrorDetails + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Url = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipErrorDetails(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthErrorDetails + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *LocalizedMessage) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowErrorDetails + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: LocalizedMessage: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: LocalizedMessage: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Locale", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowErrorDetails + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthErrorDetails + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Locale = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Message", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowErrorDetails + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthErrorDetails + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Message = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipErrorDetails(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthErrorDetails + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipErrorDetails(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowErrorDetails + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowErrorDetails + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + return iNdEx, nil + case 1: + iNdEx += 8 + return iNdEx, nil + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowErrorDetails + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + iNdEx += length + if length < 0 { + return 0, ErrInvalidLengthErrorDetails + } + return iNdEx, nil + case 3: + for { + var innerWire uint64 + var start int = iNdEx + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowErrorDetails + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + innerWire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + innerWireType := int(innerWire & 0x7) + if innerWireType == 4 { + break + } + next, err := skipErrorDetails(dAtA[start:]) + if err != nil { + return 0, err + } + iNdEx = start + next + } + return iNdEx, nil + case 4: + return iNdEx, nil + case 5: + iNdEx += 4 + return iNdEx, nil + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + } + panic("unreachable") +} + +var ( + ErrInvalidLengthErrorDetails = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowErrorDetails = fmt.Errorf("proto: integer overflow") +) + +func init() { + proto.RegisterFile("google/rpc/error_details.proto", fileDescriptor_error_details_ff696d72eb1e7a26) +} + +var fileDescriptor_error_details_ff696d72eb1e7a26 = []byte{ + // 624 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x54, 0xbf, 0x6f, 0xd3, 0x40, + 0x18, 0xed, 0x35, 0x69, 0x91, 0xbf, 0x84, 0x52, 0xcc, 0x0f, 0x85, 0x48, 0x9c, 0x82, 0x11, 0x52, + 0x11, 0x92, 0x2b, 0x95, 0xad, 0x63, 0x48, 0x7f, 0x49, 0x05, 0x82, 0x85, 0x18, 0x60, 0xb0, 0x2e, + 0xf6, 0x97, 0xe8, 0xa8, 0xe3, 0x33, 0x67, 0xbb, 0xa8, 0x4c, 0xfc, 0x09, 0xec, 0x6c, 0x4c, 0xfd, + 0x27, 0xd8, 0x3b, 0x76, 0x64, 0x24, 0xe9, 0xc2, 0xd8, 0x91, 0x11, 0x9d, 0x7d, 0xd7, 0xba, 0x4d, + 0x41, 0x6c, 0x7e, 0xef, 0xde, 0x3d, 0xbf, 0xf7, 0xe9, 0xee, 0x80, 0x8e, 0x84, 0x18, 0x45, 0xb8, + 0x2a, 0x93, 0x60, 0x15, 0xa5, 0x14, 0xd2, 0x0f, 0x31, 0x63, 0x3c, 0x4a, 0xdd, 0x44, 0x8a, 0x4c, + 0xd8, 0x50, 0xae, 0xbb, 0x32, 0x09, 0xda, 0x46, 0x5b, 0xac, 0x0c, 0xf2, 0xe1, 0x6a, 0x98, 0x4b, + 0x96, 0x71, 0x11, 0x97, 0x5a, 0x67, 0x0b, 0x2c, 0x0f, 0x33, 0x79, 0xb0, 0x13, 0x0f, 0x85, 0xbd, + 0x0e, 0x0d, 0xa9, 0x80, 0x1f, 0x62, 0xc4, 0x0e, 0x5a, 0xa4, 0x43, 0x56, 0x1a, 0x6b, 0xf7, 0x5c, + 0x6d, 0x67, 0x2c, 0xdc, 0x9e, 0xb6, 0xf0, 0xa0, 0x50, 0xf7, 0x94, 0xd8, 0xd9, 0x06, 0xab, 0x87, + 0x83, 0x7c, 0x54, 0x18, 0x3d, 0x84, 0xeb, 0x69, 0xc6, 0x82, 0x3d, 0x1f, 0xe3, 0x4c, 0x72, 0x4c, + 0x5b, 0xa4, 0x53, 0x5b, 0xb1, 0xbc, 0x66, 0x41, 0x6e, 0x94, 0x9c, 0x7d, 0x17, 0x16, 0xcb, 0xdc, + 0xad, 0xf9, 0x0e, 0x59, 0xb1, 0x3c, 0x8d, 0x9c, 0xaf, 0x04, 0x9a, 0xaf, 0x72, 0x91, 0xb1, 0x4d, + 0xc6, 0xa3, 0x5c, 0xa2, 0xdd, 0x05, 0xd8, 0xe7, 0x22, 0x2a, 0xfe, 0x59, 0x5a, 0x35, 0xd6, 0x1c, + 0xf7, 0xbc, 0xa4, 0x5b, 0x55, 0xbb, 0x6f, 0x8c, 0xd4, 0xab, 0xec, 0x6a, 0x6f, 0x81, 0x75, 0xb6, + 0x60, 0xb7, 0xe0, 0x5a, 0x9a, 0x0f, 0xde, 0x63, 0x90, 0x15, 0x1d, 0x2d, 0xcf, 0x40, 0xbb, 0x03, + 0x8d, 0x10, 0xd3, 0x40, 0xf2, 0x44, 0x09, 0x75, 0xb0, 0x2a, 0xe5, 0x7c, 0x27, 0x70, 0xab, 0x2f, + 0x31, 0x10, 0x71, 0xc8, 0x15, 0x61, 0x42, 0xee, 0x5c, 0x11, 0xf2, 0x71, 0x35, 0xe4, 0x15, 0x9b, + 0xfe, 0x92, 0xf5, 0x5d, 0x35, 0xab, 0x0d, 0xf5, 0xec, 0x20, 0x41, 0x1d, 0xb4, 0xf8, 0xae, 0xe6, + 0x9f, 0xff, 0x67, 0xfe, 0xda, 0x6c, 0xfe, 0x43, 0x02, 0xd0, 0x65, 0xa1, 0x87, 0x1f, 0x72, 0x4c, + 0x33, 0xbb, 0x0f, 0xcb, 0x43, 0x8e, 0x51, 0xe8, 0xcf, 0x84, 0x7f, 0x54, 0x0d, 0x7f, 0xbe, 0xc3, + 0xdd, 0x54, 0xf2, 0xf3, 0xe0, 0x37, 0x86, 0x17, 0x70, 0xda, 0xde, 0x86, 0xa5, 0x8b, 0x12, 0xfb, + 0x36, 0x2c, 0x14, 0x22, 0xdd, 0xa1, 0x04, 0xff, 0x31, 0xea, 0x97, 0xd0, 0xd0, 0x3f, 0x2d, 0x0e, + 0xd5, 0x7d, 0x00, 0x59, 0x42, 0x9f, 0x1b, 0x2f, 0x4b, 0x33, 0x3b, 0xa1, 0xfd, 0x00, 0x9a, 0x29, + 0xca, 0x7d, 0x1e, 0x8f, 0xfc, 0x90, 0x65, 0xcc, 0x18, 0x6a, 0xae, 0xc7, 0x32, 0xe6, 0x7c, 0x21, + 0xd0, 0xf4, 0x30, 0x15, 0xb9, 0x0c, 0xd0, 0x9c, 0x53, 0xa9, 0xb1, 0x5f, 0x99, 0x72, 0xd3, 0x90, + 0xaf, 0xd5, 0xb4, 0xab, 0xa2, 0x98, 0x8d, 0x51, 0x3b, 0x9f, 0x89, 0x5e, 0xb0, 0x31, 0xaa, 0x8e, + 0xe2, 0x63, 0x8c, 0x52, 0x8f, 0xbc, 0x04, 0x97, 0x3b, 0xd6, 0x67, 0x3b, 0x0a, 0xa8, 0x6f, 0x63, + 0x94, 0xd8, 0x4f, 0x60, 0x21, 0xe2, 0xf1, 0x9e, 0x19, 0xfe, 0x9d, 0xea, 0xf0, 0x95, 0xc0, 0xdd, + 0xe5, 0xf1, 0x9e, 0x57, 0x6a, 0xda, 0xeb, 0x50, 0x57, 0xf0, 0xb2, 0x3d, 0x99, 0xb1, 0xb7, 0x97, + 0xa1, 0x96, 0x4b, 0x73, 0xc1, 0xd4, 0xa7, 0xd3, 0x83, 0xe5, 0x5d, 0x11, 0xb0, 0x88, 0x7f, 0xc2, + 0xf0, 0x39, 0xa6, 0x29, 0x1b, 0xa1, 0xba, 0x89, 0x91, 0xe2, 0x4c, 0x7f, 0x8d, 0xd4, 0x39, 0x1b, + 0x97, 0x12, 0x73, 0xce, 0x34, 0xec, 0x86, 0xc7, 0x13, 0x3a, 0xf7, 0x63, 0x42, 0xe7, 0x4e, 0x27, + 0x94, 0xfc, 0x9e, 0x50, 0xf2, 0x79, 0x4a, 0xc9, 0xe1, 0x94, 0x92, 0xa3, 0x29, 0x25, 0xc7, 0x53, + 0x4a, 0x7e, 0x4e, 0x29, 0xf9, 0x35, 0xa5, 0x73, 0xa7, 0x8a, 0x3f, 0xa1, 0xe4, 0xe8, 0x84, 0x12, + 0x58, 0x0a, 0xc4, 0xb8, 0x52, 0xac, 0x7b, 0x73, 0x43, 0xbd, 0x5e, 0xbd, 0xf2, 0xf1, 0xea, 0xab, + 0xe7, 0xa5, 0x4f, 0xde, 0xd6, 0x64, 0x12, 0x7c, 0x9b, 0xaf, 0x79, 0xfd, 0x67, 0x83, 0xc5, 0xe2, + 0xc9, 0x79, 0xfa, 0x27, 0x00, 0x00, 0xff, 0xff, 0x63, 0xe4, 0x76, 0x26, 0xf1, 0x04, 0x00, 0x00, +} diff --git a/vendor/github.com/gogo/googleapis/google/rpc/error_details.proto b/vendor/github.com/gogo/googleapis/google/rpc/error_details.proto new file mode 100644 index 000000000000..a62078ba0a0e --- /dev/null +++ b/vendor/github.com/gogo/googleapis/google/rpc/error_details.proto @@ -0,0 +1,200 @@ +// Copyright 2017 Google Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.rpc; + +import "google/protobuf/duration.proto"; + +option go_package = "rpc"; +option java_multiple_files = true; +option java_outer_classname = "ErrorDetailsProto"; +option java_package = "com.google.rpc"; +option objc_class_prefix = "RPC"; + + +// Describes when the clients can retry a failed request. Clients could ignore +// the recommendation here or retry when this information is missing from error +// responses. +// +// It's always recommended that clients should use exponential backoff when +// retrying. +// +// Clients should wait until `retry_delay` amount of time has passed since +// receiving the error response before retrying. If retrying requests also +// fail, clients should use an exponential backoff scheme to gradually increase +// the delay between retries based on `retry_delay`, until either a maximum +// number of retires have been reached or a maximum retry delay cap has been +// reached. +message RetryInfo { + // Clients should wait at least this long between retrying the same request. + google.protobuf.Duration retry_delay = 1; +} + +// Describes additional debugging info. +message DebugInfo { + // The stack trace entries indicating where the error occurred. + repeated string stack_entries = 1; + + // Additional debugging information provided by the server. + string detail = 2; +} + +// Describes how a quota check failed. +// +// For example if a daily limit was exceeded for the calling project, +// a service could respond with a QuotaFailure detail containing the project +// id and the description of the quota limit that was exceeded. If the +// calling project hasn't enabled the service in the developer console, then +// a service could respond with the project id and set `service_disabled` +// to true. +// +// Also see RetryDetail and Help types for other details about handling a +// quota failure. +message QuotaFailure { + // A message type used to describe a single quota violation. For example, a + // daily quota or a custom quota that was exceeded. + message Violation { + // The subject on which the quota check failed. + // For example, "clientip:" or "project:". + string subject = 1; + + // A description of how the quota check failed. Clients can use this + // description to find more about the quota configuration in the service's + // public documentation, or find the relevant quota limit to adjust through + // developer console. + // + // For example: "Service disabled" or "Daily Limit for read operations + // exceeded". + string description = 2; + } + + // Describes all quota violations. + repeated Violation violations = 1; +} + +// Describes what preconditions have failed. +// +// For example, if an RPC failed because it required the Terms of Service to be +// acknowledged, it could list the terms of service violation in the +// PreconditionFailure message. +message PreconditionFailure { + // A message type used to describe a single precondition failure. + message Violation { + // The type of PreconditionFailure. We recommend using a service-specific + // enum type to define the supported precondition violation types. For + // example, "TOS" for "Terms of Service violation". + string type = 1; + + // The subject, relative to the type, that failed. + // For example, "google.com/cloud" relative to the "TOS" type would + // indicate which terms of service is being referenced. + string subject = 2; + + // A description of how the precondition failed. Developers can use this + // description to understand how to fix the failure. + // + // For example: "Terms of service not accepted". + string description = 3; + } + + // Describes all precondition violations. + repeated Violation violations = 1; +} + +// Describes violations in a client request. This error type focuses on the +// syntactic aspects of the request. +message BadRequest { + // A message type used to describe a single bad request field. + message FieldViolation { + // A path leading to a field in the request body. The value will be a + // sequence of dot-separated identifiers that identify a protocol buffer + // field. E.g., "field_violations.field" would identify this field. + string field = 1; + + // A description of why the request element is bad. + string description = 2; + } + + // Describes all violations in a client request. + repeated FieldViolation field_violations = 1; +} + +// Contains metadata about the request that clients can attach when filing a bug +// or providing other forms of feedback. +message RequestInfo { + // An opaque string that should only be interpreted by the service generating + // it. For example, it can be used to identify requests in the service's logs. + string request_id = 1; + + // Any data that was used to serve this request. For example, an encrypted + // stack trace that can be sent back to the service provider for debugging. + string serving_data = 2; +} + +// Describes the resource that is being accessed. +message ResourceInfo { + // A name for the type of resource being accessed, e.g. "sql table", + // "cloud storage bucket", "file", "Google calendar"; or the type URL + // of the resource: e.g. "type.googleapis.com/google.pubsub.v1.Topic". + string resource_type = 1; + + // The name of the resource being accessed. For example, a shared calendar + // name: "example.com_4fghdhgsrgh@group.calendar.google.com", if the current + // error is [google.rpc.Code.PERMISSION_DENIED][google.rpc.Code.PERMISSION_DENIED]. + string resource_name = 2; + + // The owner of the resource (optional). + // For example, "user:" or "project:". + string owner = 3; + + // Describes what error is encountered when accessing this resource. + // For example, updating a cloud project may require the `writer` permission + // on the developer console project. + string description = 4; +} + +// Provides links to documentation or for performing an out of band action. +// +// For example, if a quota check failed with an error indicating the calling +// project hasn't enabled the accessed service, this can contain a URL pointing +// directly to the right place in the developer console to flip the bit. +message Help { + // Describes a URL link. + message Link { + // Describes what the link offers. + string description = 1; + + // The URL of the link. + string url = 2; + } + + // URL(s) pointing to additional information on handling the current error. + repeated Link links = 1; +} + +// Provides a localized error message that is safe to return to the user +// which can be attached to an RPC error. +message LocalizedMessage { + // The locale used following the specification defined at + // http://www.rfc-editor.org/rfc/bcp/bcp47.txt. + // Examples are: "en-US", "fr-CH", "es-MX" + string locale = 1; + + // The localized error message in the above locale. + string message = 2; +} diff --git a/vendor/github.com/gogo/googleapis/google/rpc/status.pb.go b/vendor/github.com/gogo/googleapis/google/rpc/status.pb.go new file mode 100644 index 000000000000..ece1aec11217 --- /dev/null +++ b/vendor/github.com/gogo/googleapis/google/rpc/status.pb.go @@ -0,0 +1,726 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: google/rpc/status.proto + +package rpc + +import proto "github.com/gogo/protobuf/proto" +import fmt "fmt" +import math "math" +import types "github.com/gogo/protobuf/types" + +import bytes "bytes" + +import strings "strings" +import reflect "reflect" + +import io "io" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package + +// The `Status` type defines a logical error model that is suitable for different +// programming environments, including REST APIs and RPC APIs. It is used by +// [gRPC](https://github.com/grpc). The error model is designed to be: +// +// - Simple to use and understand for most users +// - Flexible enough to meet unexpected needs +// +// # Overview +// +// The `Status` message contains three pieces of data: error code, error message, +// and error details. The error code should be an enum value of +// [google.rpc.Code][google.rpc.Code], but it may accept additional error codes if needed. The +// error message should be a developer-facing English message that helps +// developers *understand* and *resolve* the error. If a localized user-facing +// error message is needed, put the localized message in the error details or +// localize it in the client. The optional error details may contain arbitrary +// information about the error. There is a predefined set of error detail types +// in the package `google.rpc` that can be used for common error conditions. +// +// # Language mapping +// +// The `Status` message is the logical representation of the error model, but it +// is not necessarily the actual wire format. When the `Status` message is +// exposed in different client libraries and different wire protocols, it can be +// mapped differently. For example, it will likely be mapped to some exceptions +// in Java, but more likely mapped to some error codes in C. +// +// # Other uses +// +// The error model and the `Status` message can be used in a variety of +// environments, either with or without APIs, to provide a +// consistent developer experience across different environments. +// +// Example uses of this error model include: +// +// - Partial errors. If a service needs to return partial errors to the client, +// it may embed the `Status` in the normal response to indicate the partial +// errors. +// +// - Workflow errors. A typical workflow has multiple steps. Each step may +// have a `Status` message for error reporting. +// +// - Batch operations. If a client uses batch request and batch response, the +// `Status` message should be used directly inside batch response, one for +// each error sub-response. +// +// - Asynchronous operations. If an API call embeds asynchronous operation +// results in its response, the status of those operations should be +// represented directly using the `Status` message. +// +// - Logging. If some API errors are stored in logs, the message `Status` could +// be used directly after any stripping needed for security/privacy reasons. +type Status struct { + // The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code]. + Code int32 `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"` + // A developer-facing error message, which should be in English. Any + // user-facing error message should be localized and sent in the + // [google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client. + Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"` + // A list of messages that carry the error details. There is a common set of + // message types for APIs to use. + Details []*types.Any `protobuf:"bytes,3,rep,name=details" json:"details,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Status) Reset() { *m = Status{} } +func (*Status) ProtoMessage() {} +func (*Status) Descriptor() ([]byte, []int) { + return fileDescriptor_status_8f2fc8d48733ea2f, []int{0} +} +func (m *Status) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Status) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Status.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *Status) XXX_Merge(src proto.Message) { + xxx_messageInfo_Status.Merge(dst, src) +} +func (m *Status) XXX_Size() int { + return m.Size() +} +func (m *Status) XXX_DiscardUnknown() { + xxx_messageInfo_Status.DiscardUnknown(m) +} + +var xxx_messageInfo_Status proto.InternalMessageInfo + +func (m *Status) GetCode() int32 { + if m != nil { + return m.Code + } + return 0 +} + +func (m *Status) GetMessage() string { + if m != nil { + return m.Message + } + return "" +} + +func (m *Status) GetDetails() []*types.Any { + if m != nil { + return m.Details + } + return nil +} + +func (*Status) XXX_MessageName() string { + return "google.rpc.Status" +} +func init() { + proto.RegisterType((*Status)(nil), "google.rpc.Status") +} +func (this *Status) Compare(that interface{}) int { + if that == nil { + if this == nil { + return 0 + } + return 1 + } + + that1, ok := that.(*Status) + if !ok { + that2, ok := that.(Status) + if ok { + that1 = &that2 + } else { + return 1 + } + } + if that1 == nil { + if this == nil { + return 0 + } + return 1 + } else if this == nil { + return -1 + } + if this.Code != that1.Code { + if this.Code < that1.Code { + return -1 + } + return 1 + } + if this.Message != that1.Message { + if this.Message < that1.Message { + return -1 + } + return 1 + } + if len(this.Details) != len(that1.Details) { + if len(this.Details) < len(that1.Details) { + return -1 + } + return 1 + } + for i := range this.Details { + if c := this.Details[i].Compare(that1.Details[i]); c != 0 { + return c + } + } + if c := bytes.Compare(this.XXX_unrecognized, that1.XXX_unrecognized); c != 0 { + return c + } + return 0 +} +func (this *Status) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Status) + if !ok { + that2, ok := that.(Status) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Code != that1.Code { + return false + } + if this.Message != that1.Message { + return false + } + if len(this.Details) != len(that1.Details) { + return false + } + for i := range this.Details { + if !this.Details[i].Equal(that1.Details[i]) { + return false + } + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *Status) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 7) + s = append(s, "&rpc.Status{") + s = append(s, "Code: "+fmt.Sprintf("%#v", this.Code)+",\n") + s = append(s, "Message: "+fmt.Sprintf("%#v", this.Message)+",\n") + if this.Details != nil { + s = append(s, "Details: "+fmt.Sprintf("%#v", this.Details)+",\n") + } + if this.XXX_unrecognized != nil { + s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") + } + s = append(s, "}") + return strings.Join(s, "") +} +func valueToGoStringStatus(v interface{}, typ string) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv) +} +func (m *Status) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Status) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Code != 0 { + dAtA[i] = 0x8 + i++ + i = encodeVarintStatus(dAtA, i, uint64(m.Code)) + } + if len(m.Message) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintStatus(dAtA, i, uint64(len(m.Message))) + i += copy(dAtA[i:], m.Message) + } + if len(m.Details) > 0 { + for _, msg := range m.Details { + dAtA[i] = 0x1a + i++ + i = encodeVarintStatus(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func encodeVarintStatus(dAtA []byte, offset int, v uint64) int { + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return offset + 1 +} +func NewPopulatedStatus(r randyStatus, easy bool) *Status { + this := &Status{} + this.Code = int32(r.Int31()) + if r.Intn(2) == 0 { + this.Code *= -1 + } + this.Message = string(randStringStatus(r)) + if r.Intn(10) != 0 { + v1 := r.Intn(5) + this.Details = make([]*types.Any, v1) + for i := 0; i < v1; i++ { + this.Details[i] = types.NewPopulatedAny(r, easy) + } + } + if !easy && r.Intn(10) != 0 { + this.XXX_unrecognized = randUnrecognizedStatus(r, 4) + } + return this +} + +type randyStatus interface { + Float32() float32 + Float64() float64 + Int63() int64 + Int31() int32 + Uint32() uint32 + Intn(n int) int +} + +func randUTF8RuneStatus(r randyStatus) rune { + ru := r.Intn(62) + if ru < 10 { + return rune(ru + 48) + } else if ru < 36 { + return rune(ru + 55) + } + return rune(ru + 61) +} +func randStringStatus(r randyStatus) string { + v2 := r.Intn(100) + tmps := make([]rune, v2) + for i := 0; i < v2; i++ { + tmps[i] = randUTF8RuneStatus(r) + } + return string(tmps) +} +func randUnrecognizedStatus(r randyStatus, maxFieldNumber int) (dAtA []byte) { + l := r.Intn(5) + for i := 0; i < l; i++ { + wire := r.Intn(4) + if wire == 3 { + wire = 5 + } + fieldNumber := maxFieldNumber + r.Intn(100) + dAtA = randFieldStatus(dAtA, r, fieldNumber, wire) + } + return dAtA +} +func randFieldStatus(dAtA []byte, r randyStatus, fieldNumber int, wire int) []byte { + key := uint32(fieldNumber)<<3 | uint32(wire) + switch wire { + case 0: + dAtA = encodeVarintPopulateStatus(dAtA, uint64(key)) + v3 := r.Int63() + if r.Intn(2) == 0 { + v3 *= -1 + } + dAtA = encodeVarintPopulateStatus(dAtA, uint64(v3)) + case 1: + dAtA = encodeVarintPopulateStatus(dAtA, uint64(key)) + dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256))) + case 2: + dAtA = encodeVarintPopulateStatus(dAtA, uint64(key)) + ll := r.Intn(100) + dAtA = encodeVarintPopulateStatus(dAtA, uint64(ll)) + for j := 0; j < ll; j++ { + dAtA = append(dAtA, byte(r.Intn(256))) + } + default: + dAtA = encodeVarintPopulateStatus(dAtA, uint64(key)) + dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256))) + } + return dAtA +} +func encodeVarintPopulateStatus(dAtA []byte, v uint64) []byte { + for v >= 1<<7 { + dAtA = append(dAtA, uint8(uint64(v)&0x7f|0x80)) + v >>= 7 + } + dAtA = append(dAtA, uint8(v)) + return dAtA +} +func (m *Status) Size() (n int) { + var l int + _ = l + if m.Code != 0 { + n += 1 + sovStatus(uint64(m.Code)) + } + l = len(m.Message) + if l > 0 { + n += 1 + l + sovStatus(uint64(l)) + } + if len(m.Details) > 0 { + for _, e := range m.Details { + l = e.Size() + n += 1 + l + sovStatus(uint64(l)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func sovStatus(x uint64) (n int) { + for { + n++ + x >>= 7 + if x == 0 { + break + } + } + return n +} +func sozStatus(x uint64) (n int) { + return sovStatus(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (this *Status) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&Status{`, + `Code:` + fmt.Sprintf("%v", this.Code) + `,`, + `Message:` + fmt.Sprintf("%v", this.Message) + `,`, + `Details:` + strings.Replace(fmt.Sprintf("%v", this.Details), "Any", "types.Any", 1) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func valueToStringStatus(v interface{}) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("*%v", pv) +} +func (m *Status) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStatus + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Status: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Status: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Code", wireType) + } + m.Code = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStatus + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Code |= (int32(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Message", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStatus + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthStatus + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Message = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Details", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStatus + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthStatus + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Details = append(m.Details, &types.Any{}) + if err := m.Details[len(m.Details)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipStatus(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthStatus + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipStatus(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowStatus + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowStatus + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + return iNdEx, nil + case 1: + iNdEx += 8 + return iNdEx, nil + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowStatus + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + iNdEx += length + if length < 0 { + return 0, ErrInvalidLengthStatus + } + return iNdEx, nil + case 3: + for { + var innerWire uint64 + var start int = iNdEx + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowStatus + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + innerWire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + innerWireType := int(innerWire & 0x7) + if innerWireType == 4 { + break + } + next, err := skipStatus(dAtA[start:]) + if err != nil { + return 0, err + } + iNdEx = start + next + } + return iNdEx, nil + case 4: + return iNdEx, nil + case 5: + iNdEx += 4 + return iNdEx, nil + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + } + panic("unreachable") +} + +var ( + ErrInvalidLengthStatus = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowStatus = fmt.Errorf("proto: integer overflow") +) + +func init() { proto.RegisterFile("google/rpc/status.proto", fileDescriptor_status_8f2fc8d48733ea2f) } + +var fileDescriptor_status_8f2fc8d48733ea2f = []byte{ + // 235 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x4f, 0xcf, 0xcf, 0x4f, + 0xcf, 0x49, 0xd5, 0x2f, 0x2a, 0x48, 0xd6, 0x2f, 0x2e, 0x49, 0x2c, 0x29, 0x2d, 0xd6, 0x2b, 0x28, + 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x82, 0x48, 0xe8, 0x15, 0x15, 0x24, 0x4b, 0x49, 0x42, 0x15, 0x81, + 0x65, 0x92, 0x4a, 0xd3, 0xf4, 0x13, 0xf3, 0x2a, 0x21, 0xca, 0x94, 0xd2, 0xb8, 0xd8, 0x82, 0xc1, + 0xda, 0x84, 0x84, 0xb8, 0x58, 0x92, 0xf3, 0x53, 0x52, 0x25, 0x18, 0x15, 0x18, 0x35, 0x58, 0x83, + 0xc0, 0x6c, 0x21, 0x09, 0x2e, 0xf6, 0xdc, 0xd4, 0xe2, 0xe2, 0xc4, 0xf4, 0x54, 0x09, 0x26, 0x05, + 0x46, 0x0d, 0xce, 0x20, 0x18, 0x57, 0x48, 0x8f, 0x8b, 0x3d, 0x25, 0xb5, 0x24, 0x31, 0x33, 0xa7, + 0x58, 0x82, 0x59, 0x81, 0x59, 0x83, 0xdb, 0x48, 0x44, 0x0f, 0x6a, 0x21, 0xcc, 0x12, 0x3d, 0xc7, + 0xbc, 0xca, 0x20, 0x98, 0x22, 0xa7, 0xb8, 0x0b, 0x0f, 0xe5, 0x18, 0x6e, 0x3c, 0x94, 0x63, 0xf8, + 0xf0, 0x50, 0x8e, 0xf1, 0xc7, 0x43, 0x39, 0xc6, 0x86, 0x47, 0x72, 0x8c, 0x2b, 0x1e, 0xc9, 0x31, + 0x9e, 0x78, 0x24, 0xc7, 0x78, 0xe1, 0x91, 0x1c, 0xe3, 0x83, 0x47, 0x72, 0x8c, 0x2f, 0x1e, 0xc9, + 0x31, 0x7c, 0x00, 0x89, 0x3f, 0x96, 0x63, 0x3c, 0xf1, 0x58, 0x8e, 0x91, 0x8b, 0x2f, 0x39, 0x3f, + 0x57, 0x0f, 0xe1, 0x11, 0x27, 0x6e, 0x88, 0x5b, 0x03, 0x40, 0x56, 0x04, 0x30, 0x46, 0x31, 0x17, + 0x15, 0x24, 0x2f, 0x62, 0x62, 0x0e, 0x0a, 0x70, 0x4e, 0x62, 0x03, 0x5b, 0x6b, 0x0c, 0x08, 0x00, + 0x00, 0xff, 0xff, 0xaa, 0x06, 0xa1, 0xaa, 0x10, 0x01, 0x00, 0x00, +} diff --git a/vendor/github.com/gogo/googleapis/google/rpc/status.proto b/vendor/github.com/gogo/googleapis/google/rpc/status.proto new file mode 100644 index 000000000000..db3226ee06fc --- /dev/null +++ b/vendor/github.com/gogo/googleapis/google/rpc/status.proto @@ -0,0 +1,92 @@ +// Copyright 2017 Google Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.rpc; + +import "google/protobuf/any.proto"; + +option go_package = "rpc"; +option java_multiple_files = true; +option java_outer_classname = "StatusProto"; +option java_package = "com.google.rpc"; +option objc_class_prefix = "RPC"; + + +// The `Status` type defines a logical error model that is suitable for different +// programming environments, including REST APIs and RPC APIs. It is used by +// [gRPC](https://github.com/grpc). The error model is designed to be: +// +// - Simple to use and understand for most users +// - Flexible enough to meet unexpected needs +// +// # Overview +// +// The `Status` message contains three pieces of data: error code, error message, +// and error details. The error code should be an enum value of +// [google.rpc.Code][google.rpc.Code], but it may accept additional error codes if needed. The +// error message should be a developer-facing English message that helps +// developers *understand* and *resolve* the error. If a localized user-facing +// error message is needed, put the localized message in the error details or +// localize it in the client. The optional error details may contain arbitrary +// information about the error. There is a predefined set of error detail types +// in the package `google.rpc` that can be used for common error conditions. +// +// # Language mapping +// +// The `Status` message is the logical representation of the error model, but it +// is not necessarily the actual wire format. When the `Status` message is +// exposed in different client libraries and different wire protocols, it can be +// mapped differently. For example, it will likely be mapped to some exceptions +// in Java, but more likely mapped to some error codes in C. +// +// # Other uses +// +// The error model and the `Status` message can be used in a variety of +// environments, either with or without APIs, to provide a +// consistent developer experience across different environments. +// +// Example uses of this error model include: +// +// - Partial errors. If a service needs to return partial errors to the client, +// it may embed the `Status` in the normal response to indicate the partial +// errors. +// +// - Workflow errors. A typical workflow has multiple steps. Each step may +// have a `Status` message for error reporting. +// +// - Batch operations. If a client uses batch request and batch response, the +// `Status` message should be used directly inside batch response, one for +// each error sub-response. +// +// - Asynchronous operations. If an API call embeds asynchronous operation +// results in its response, the status of those operations should be +// represented directly using the `Status` message. +// +// - Logging. If some API errors are stored in logs, the message `Status` could +// be used directly after any stripping needed for security/privacy reasons. +message Status { + // The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code]. + int32 code = 1; + + // A developer-facing error message, which should be in English. Any + // user-facing error message should be localized and sent in the + // [google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client. + string message = 2; + + // A list of messages that carry the error details. There is a common set of + // message types for APIs to use. + repeated google.protobuf.Any details = 3; +} diff --git a/vendor/github.com/gogo/protobuf/LICENSE b/vendor/github.com/gogo/protobuf/LICENSE new file mode 100644 index 000000000000..f57de90da8ac --- /dev/null +++ b/vendor/github.com/gogo/protobuf/LICENSE @@ -0,0 +1,35 @@ +Copyright (c) 2013, The GoGo Authors. All rights reserved. + +Protocol Buffers for Go with Gadgets + +Go support for Protocol Buffers - Google's data interchange format + +Copyright 2010 The Go Authors. All rights reserved. +https://github.com/golang/protobuf + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + diff --git a/vendor/github.com/gogo/protobuf/gogoproto/Makefile b/vendor/github.com/gogo/protobuf/gogoproto/Makefile new file mode 100644 index 000000000000..0b4659b731e3 --- /dev/null +++ b/vendor/github.com/gogo/protobuf/gogoproto/Makefile @@ -0,0 +1,37 @@ +# Protocol Buffers for Go with Gadgets +# +# Copyright (c) 2013, The GoGo Authors. All rights reserved. +# http://github.com/gogo/protobuf +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +regenerate: + go install github.com/gogo/protobuf/protoc-gen-gogo + protoc --gogo_out=Mgoogle/protobuf/descriptor.proto=github.com/gogo/protobuf/protoc-gen-gogo/descriptor:../../../../ --proto_path=../../../../:../protobuf/:. *.proto + +restore: + cp gogo.pb.golden gogo.pb.go + +preserve: + cp gogo.pb.go gogo.pb.golden diff --git a/vendor/github.com/gogo/protobuf/gogoproto/doc.go b/vendor/github.com/gogo/protobuf/gogoproto/doc.go new file mode 100644 index 000000000000..147b5ecc62fd --- /dev/null +++ b/vendor/github.com/gogo/protobuf/gogoproto/doc.go @@ -0,0 +1,169 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2013, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +/* +Package gogoproto provides extensions for protocol buffers to achieve: + + - fast marshalling and unmarshalling. + - peace of mind by optionally generating test and benchmark code. + - more canonical Go structures. + - less typing by optionally generating extra helper code. + - goprotobuf compatibility + +More Canonical Go Structures + +A lot of time working with a goprotobuf struct will lead you to a place where you create another struct that is easier to work with and then have a function to copy the values between the two structs. +You might also find that basic structs that started their life as part of an API need to be sent over the wire. With gob, you could just send it. With goprotobuf, you need to make a parallel struct. +Gogoprotobuf tries to fix these problems with the nullable, embed, customtype and customname field extensions. + + - nullable, if false, a field is generated without a pointer (see warning below). + - embed, if true, the field is generated as an embedded field. + - customtype, It works with the Marshal and Unmarshal methods, to allow you to have your own types in your struct, but marshal to bytes. For example, custom.Uuid or custom.Fixed128 + - customname (beta), Changes the generated fieldname. This is especially useful when generated methods conflict with fieldnames. + - casttype (beta), Changes the generated fieldtype. All generated code assumes that this type is castable to the protocol buffer field type. It does not work for structs or enums. + - castkey (beta), Changes the generated fieldtype for a map key. All generated code assumes that this type is castable to the protocol buffer field type. Only supported on maps. + - castvalue (beta), Changes the generated fieldtype for a map value. All generated code assumes that this type is castable to the protocol buffer field type. Only supported on maps. + +Warning about nullable: According to the Protocol Buffer specification, you should be able to tell whether a field is set or unset. With the option nullable=false this feature is lost, since your non-nullable fields will always be set. It can be seen as a layer on top of Protocol Buffers, where before and after marshalling all non-nullable fields are set and they cannot be unset. + +Let us look at: + + github.com/gogo/protobuf/test/example/example.proto + +for a quicker overview. + +The following message: + + package test; + + import "github.com/gogo/protobuf/gogoproto/gogo.proto"; + + message A { + optional string Description = 1 [(gogoproto.nullable) = false]; + optional int64 Number = 2 [(gogoproto.nullable) = false]; + optional bytes Id = 3 [(gogoproto.customtype) = "github.com/gogo/protobuf/test/custom.Uuid", (gogoproto.nullable) = false]; + } + +Will generate a go struct which looks a lot like this: + + type A struct { + Description string + Number int64 + Id github_com_gogo_protobuf_test_custom.Uuid + } + +You will see there are no pointers, since all fields are non-nullable. +You will also see a custom type which marshals to a string. +Be warned it is your responsibility to test your custom types thoroughly. +You should think of every possible empty and nil case for your marshaling, unmarshaling and size methods. + +Next we will embed the message A in message B. + + message B { + optional A A = 1 [(gogoproto.nullable) = false, (gogoproto.embed) = true]; + repeated bytes G = 2 [(gogoproto.customtype) = "github.com/gogo/protobuf/test/custom.Uint128", (gogoproto.nullable) = false]; + } + +See below that A is embedded in B. + + type B struct { + A + G []github_com_gogo_protobuf_test_custom.Uint128 + } + +Also see the repeated custom type. + + type Uint128 [2]uint64 + +Next we will create a custom name for one of our fields. + + message C { + optional int64 size = 1 [(gogoproto.customname) = "MySize"]; + } + +See below that the field's name is MySize and not Size. + + type C struct { + MySize *int64 + } + +The is useful when having a protocol buffer message with a field name which conflicts with a generated method. +As an example, having a field name size and using the sizer plugin to generate a Size method will cause a go compiler error. +Using customname you can fix this error without changing the field name. +This is typically useful when working with a protocol buffer that was designed before these methods and/or the go language were avialable. + +Gogoprotobuf also has some more subtle changes, these could be changed back: + + - the generated package name for imports do not have the extra /filename.pb, + but are actually the imports specified in the .proto file. + +Gogoprotobuf also has lost some features which should be brought back with time: + + - Marshalling and unmarshalling with reflect and without the unsafe package, + this requires work in pointer_reflect.go + +Why does nullable break protocol buffer specifications: + +The protocol buffer specification states, somewhere, that you should be able to tell whether a +field is set or unset. With the option nullable=false this feature is lost, +since your non-nullable fields will always be set. It can be seen as a layer on top of +protocol buffers, where before and after marshalling all non-nullable fields are set +and they cannot be unset. + +Goprotobuf Compatibility: + +Gogoprotobuf is compatible with Goprotobuf, because it is compatible with protocol buffers. +Gogoprotobuf generates the same code as goprotobuf if no extensions are used. +The enumprefix, getters and stringer extensions can be used to remove some of the unnecessary code generated by goprotobuf: + + - gogoproto_import, if false, the generated code imports github.com/golang/protobuf/proto instead of github.com/gogo/protobuf/proto. + - goproto_enum_prefix, if false, generates the enum constant names without the messagetype prefix + - goproto_enum_stringer (experimental), if false, the enum is generated without the default string method, this is useful for rather using enum_stringer, or allowing you to write your own string method. + - goproto_getters, if false, the message is generated without get methods, this is useful when you would rather want to use face + - goproto_stringer, if false, the message is generated without the default string method, this is useful for rather using stringer, or allowing you to write your own string method. + - goproto_extensions_map (beta), if false, the extensions field is generated as type []byte instead of type map[int32]proto.Extension + - goproto_unrecognized (beta), if false, XXX_unrecognized field is not generated. This is useful in conjunction with gogoproto.nullable=false, to generate structures completely devoid of pointers and reduce GC pressure at the cost of losing information about unrecognized fields. + - goproto_registration (beta), if true, the generated files will register all messages and types against both gogo/protobuf and golang/protobuf. This is necessary when using third-party packages which read registrations from golang/protobuf (such as the grpc-gateway). + +Less Typing and Peace of Mind is explained in their specific plugin folders godoc: + + - github.com/gogo/protobuf/plugin/ + +If you do not use any of these extension the code that is generated +will be the same as if goprotobuf has generated it. + +The most complete way to see examples is to look at + + github.com/gogo/protobuf/test/thetest.proto + +Gogoprototest is a seperate project, +because we want to keep gogoprotobuf independant of goprotobuf, +but we still want to test it thoroughly. + +*/ +package gogoproto diff --git a/vendor/github.com/gogo/protobuf/gogoproto/gogo.pb.go b/vendor/github.com/gogo/protobuf/gogoproto/gogo.pb.go new file mode 100644 index 000000000000..3c3668abd596 --- /dev/null +++ b/vendor/github.com/gogo/protobuf/gogoproto/gogo.pb.go @@ -0,0 +1,862 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: gogo.proto + +package gogoproto // import "github.com/gogo/protobuf/gogoproto" + +import proto "github.com/gogo/protobuf/proto" +import fmt "fmt" +import math "math" +import descriptor "github.com/gogo/protobuf/protoc-gen-gogo/descriptor" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package + +var E_GoprotoEnumPrefix = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.EnumOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 62001, + Name: "gogoproto.goproto_enum_prefix", + Tag: "varint,62001,opt,name=goproto_enum_prefix,json=goprotoEnumPrefix", + Filename: "gogo.proto", +} + +var E_GoprotoEnumStringer = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.EnumOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 62021, + Name: "gogoproto.goproto_enum_stringer", + Tag: "varint,62021,opt,name=goproto_enum_stringer,json=goprotoEnumStringer", + Filename: "gogo.proto", +} + +var E_EnumStringer = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.EnumOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 62022, + Name: "gogoproto.enum_stringer", + Tag: "varint,62022,opt,name=enum_stringer,json=enumStringer", + Filename: "gogo.proto", +} + +var E_EnumCustomname = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.EnumOptions)(nil), + ExtensionType: (*string)(nil), + Field: 62023, + Name: "gogoproto.enum_customname", + Tag: "bytes,62023,opt,name=enum_customname,json=enumCustomname", + Filename: "gogo.proto", +} + +var E_Enumdecl = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.EnumOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 62024, + Name: "gogoproto.enumdecl", + Tag: "varint,62024,opt,name=enumdecl", + Filename: "gogo.proto", +} + +var E_EnumvalueCustomname = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.EnumValueOptions)(nil), + ExtensionType: (*string)(nil), + Field: 66001, + Name: "gogoproto.enumvalue_customname", + Tag: "bytes,66001,opt,name=enumvalue_customname,json=enumvalueCustomname", + Filename: "gogo.proto", +} + +var E_GoprotoGettersAll = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.FileOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 63001, + Name: "gogoproto.goproto_getters_all", + Tag: "varint,63001,opt,name=goproto_getters_all,json=goprotoGettersAll", + Filename: "gogo.proto", +} + +var E_GoprotoEnumPrefixAll = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.FileOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 63002, + Name: "gogoproto.goproto_enum_prefix_all", + Tag: "varint,63002,opt,name=goproto_enum_prefix_all,json=goprotoEnumPrefixAll", + Filename: "gogo.proto", +} + +var E_GoprotoStringerAll = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.FileOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 63003, + Name: "gogoproto.goproto_stringer_all", + Tag: "varint,63003,opt,name=goproto_stringer_all,json=goprotoStringerAll", + Filename: "gogo.proto", +} + +var E_VerboseEqualAll = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.FileOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 63004, + Name: "gogoproto.verbose_equal_all", + Tag: "varint,63004,opt,name=verbose_equal_all,json=verboseEqualAll", + Filename: "gogo.proto", +} + +var E_FaceAll = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.FileOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 63005, + Name: "gogoproto.face_all", + Tag: "varint,63005,opt,name=face_all,json=faceAll", + Filename: "gogo.proto", +} + +var E_GostringAll = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.FileOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 63006, + Name: "gogoproto.gostring_all", + Tag: "varint,63006,opt,name=gostring_all,json=gostringAll", + Filename: "gogo.proto", +} + +var E_PopulateAll = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.FileOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 63007, + Name: "gogoproto.populate_all", + Tag: "varint,63007,opt,name=populate_all,json=populateAll", + Filename: "gogo.proto", +} + +var E_StringerAll = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.FileOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 63008, + Name: "gogoproto.stringer_all", + Tag: "varint,63008,opt,name=stringer_all,json=stringerAll", + Filename: "gogo.proto", +} + +var E_OnlyoneAll = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.FileOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 63009, + Name: "gogoproto.onlyone_all", + Tag: "varint,63009,opt,name=onlyone_all,json=onlyoneAll", + Filename: "gogo.proto", +} + +var E_EqualAll = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.FileOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 63013, + Name: "gogoproto.equal_all", + Tag: "varint,63013,opt,name=equal_all,json=equalAll", + Filename: "gogo.proto", +} + +var E_DescriptionAll = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.FileOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 63014, + Name: "gogoproto.description_all", + Tag: "varint,63014,opt,name=description_all,json=descriptionAll", + Filename: "gogo.proto", +} + +var E_TestgenAll = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.FileOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 63015, + Name: "gogoproto.testgen_all", + Tag: "varint,63015,opt,name=testgen_all,json=testgenAll", + Filename: "gogo.proto", +} + +var E_BenchgenAll = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.FileOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 63016, + Name: "gogoproto.benchgen_all", + Tag: "varint,63016,opt,name=benchgen_all,json=benchgenAll", + Filename: "gogo.proto", +} + +var E_MarshalerAll = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.FileOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 63017, + Name: "gogoproto.marshaler_all", + Tag: "varint,63017,opt,name=marshaler_all,json=marshalerAll", + Filename: "gogo.proto", +} + +var E_UnmarshalerAll = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.FileOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 63018, + Name: "gogoproto.unmarshaler_all", + Tag: "varint,63018,opt,name=unmarshaler_all,json=unmarshalerAll", + Filename: "gogo.proto", +} + +var E_StableMarshalerAll = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.FileOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 63019, + Name: "gogoproto.stable_marshaler_all", + Tag: "varint,63019,opt,name=stable_marshaler_all,json=stableMarshalerAll", + Filename: "gogo.proto", +} + +var E_SizerAll = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.FileOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 63020, + Name: "gogoproto.sizer_all", + Tag: "varint,63020,opt,name=sizer_all,json=sizerAll", + Filename: "gogo.proto", +} + +var E_GoprotoEnumStringerAll = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.FileOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 63021, + Name: "gogoproto.goproto_enum_stringer_all", + Tag: "varint,63021,opt,name=goproto_enum_stringer_all,json=goprotoEnumStringerAll", + Filename: "gogo.proto", +} + +var E_EnumStringerAll = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.FileOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 63022, + Name: "gogoproto.enum_stringer_all", + Tag: "varint,63022,opt,name=enum_stringer_all,json=enumStringerAll", + Filename: "gogo.proto", +} + +var E_UnsafeMarshalerAll = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.FileOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 63023, + Name: "gogoproto.unsafe_marshaler_all", + Tag: "varint,63023,opt,name=unsafe_marshaler_all,json=unsafeMarshalerAll", + Filename: "gogo.proto", +} + +var E_UnsafeUnmarshalerAll = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.FileOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 63024, + Name: "gogoproto.unsafe_unmarshaler_all", + Tag: "varint,63024,opt,name=unsafe_unmarshaler_all,json=unsafeUnmarshalerAll", + Filename: "gogo.proto", +} + +var E_GoprotoExtensionsMapAll = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.FileOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 63025, + Name: "gogoproto.goproto_extensions_map_all", + Tag: "varint,63025,opt,name=goproto_extensions_map_all,json=goprotoExtensionsMapAll", + Filename: "gogo.proto", +} + +var E_GoprotoUnrecognizedAll = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.FileOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 63026, + Name: "gogoproto.goproto_unrecognized_all", + Tag: "varint,63026,opt,name=goproto_unrecognized_all,json=goprotoUnrecognizedAll", + Filename: "gogo.proto", +} + +var E_GogoprotoImport = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.FileOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 63027, + Name: "gogoproto.gogoproto_import", + Tag: "varint,63027,opt,name=gogoproto_import,json=gogoprotoImport", + Filename: "gogo.proto", +} + +var E_ProtosizerAll = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.FileOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 63028, + Name: "gogoproto.protosizer_all", + Tag: "varint,63028,opt,name=protosizer_all,json=protosizerAll", + Filename: "gogo.proto", +} + +var E_CompareAll = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.FileOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 63029, + Name: "gogoproto.compare_all", + Tag: "varint,63029,opt,name=compare_all,json=compareAll", + Filename: "gogo.proto", +} + +var E_TypedeclAll = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.FileOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 63030, + Name: "gogoproto.typedecl_all", + Tag: "varint,63030,opt,name=typedecl_all,json=typedeclAll", + Filename: "gogo.proto", +} + +var E_EnumdeclAll = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.FileOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 63031, + Name: "gogoproto.enumdecl_all", + Tag: "varint,63031,opt,name=enumdecl_all,json=enumdeclAll", + Filename: "gogo.proto", +} + +var E_GoprotoRegistration = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.FileOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 63032, + Name: "gogoproto.goproto_registration", + Tag: "varint,63032,opt,name=goproto_registration,json=goprotoRegistration", + Filename: "gogo.proto", +} + +var E_MessagenameAll = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.FileOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 63033, + Name: "gogoproto.messagename_all", + Tag: "varint,63033,opt,name=messagename_all,json=messagenameAll", + Filename: "gogo.proto", +} + +var E_GoprotoSizecacheAll = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.FileOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 63034, + Name: "gogoproto.goproto_sizecache_all", + Tag: "varint,63034,opt,name=goproto_sizecache_all,json=goprotoSizecacheAll", + Filename: "gogo.proto", +} + +var E_GoprotoUnkeyedAll = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.FileOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 63035, + Name: "gogoproto.goproto_unkeyed_all", + Tag: "varint,63035,opt,name=goproto_unkeyed_all,json=goprotoUnkeyedAll", + Filename: "gogo.proto", +} + +var E_GoprotoGetters = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.MessageOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 64001, + Name: "gogoproto.goproto_getters", + Tag: "varint,64001,opt,name=goproto_getters,json=goprotoGetters", + Filename: "gogo.proto", +} + +var E_GoprotoStringer = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.MessageOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 64003, + Name: "gogoproto.goproto_stringer", + Tag: "varint,64003,opt,name=goproto_stringer,json=goprotoStringer", + Filename: "gogo.proto", +} + +var E_VerboseEqual = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.MessageOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 64004, + Name: "gogoproto.verbose_equal", + Tag: "varint,64004,opt,name=verbose_equal,json=verboseEqual", + Filename: "gogo.proto", +} + +var E_Face = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.MessageOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 64005, + Name: "gogoproto.face", + Tag: "varint,64005,opt,name=face", + Filename: "gogo.proto", +} + +var E_Gostring = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.MessageOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 64006, + Name: "gogoproto.gostring", + Tag: "varint,64006,opt,name=gostring", + Filename: "gogo.proto", +} + +var E_Populate = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.MessageOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 64007, + Name: "gogoproto.populate", + Tag: "varint,64007,opt,name=populate", + Filename: "gogo.proto", +} + +var E_Stringer = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.MessageOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 67008, + Name: "gogoproto.stringer", + Tag: "varint,67008,opt,name=stringer", + Filename: "gogo.proto", +} + +var E_Onlyone = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.MessageOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 64009, + Name: "gogoproto.onlyone", + Tag: "varint,64009,opt,name=onlyone", + Filename: "gogo.proto", +} + +var E_Equal = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.MessageOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 64013, + Name: "gogoproto.equal", + Tag: "varint,64013,opt,name=equal", + Filename: "gogo.proto", +} + +var E_Description = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.MessageOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 64014, + Name: "gogoproto.description", + Tag: "varint,64014,opt,name=description", + Filename: "gogo.proto", +} + +var E_Testgen = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.MessageOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 64015, + Name: "gogoproto.testgen", + Tag: "varint,64015,opt,name=testgen", + Filename: "gogo.proto", +} + +var E_Benchgen = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.MessageOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 64016, + Name: "gogoproto.benchgen", + Tag: "varint,64016,opt,name=benchgen", + Filename: "gogo.proto", +} + +var E_Marshaler = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.MessageOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 64017, + Name: "gogoproto.marshaler", + Tag: "varint,64017,opt,name=marshaler", + Filename: "gogo.proto", +} + +var E_Unmarshaler = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.MessageOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 64018, + Name: "gogoproto.unmarshaler", + Tag: "varint,64018,opt,name=unmarshaler", + Filename: "gogo.proto", +} + +var E_StableMarshaler = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.MessageOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 64019, + Name: "gogoproto.stable_marshaler", + Tag: "varint,64019,opt,name=stable_marshaler,json=stableMarshaler", + Filename: "gogo.proto", +} + +var E_Sizer = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.MessageOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 64020, + Name: "gogoproto.sizer", + Tag: "varint,64020,opt,name=sizer", + Filename: "gogo.proto", +} + +var E_UnsafeMarshaler = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.MessageOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 64023, + Name: "gogoproto.unsafe_marshaler", + Tag: "varint,64023,opt,name=unsafe_marshaler,json=unsafeMarshaler", + Filename: "gogo.proto", +} + +var E_UnsafeUnmarshaler = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.MessageOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 64024, + Name: "gogoproto.unsafe_unmarshaler", + Tag: "varint,64024,opt,name=unsafe_unmarshaler,json=unsafeUnmarshaler", + Filename: "gogo.proto", +} + +var E_GoprotoExtensionsMap = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.MessageOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 64025, + Name: "gogoproto.goproto_extensions_map", + Tag: "varint,64025,opt,name=goproto_extensions_map,json=goprotoExtensionsMap", + Filename: "gogo.proto", +} + +var E_GoprotoUnrecognized = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.MessageOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 64026, + Name: "gogoproto.goproto_unrecognized", + Tag: "varint,64026,opt,name=goproto_unrecognized,json=goprotoUnrecognized", + Filename: "gogo.proto", +} + +var E_Protosizer = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.MessageOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 64028, + Name: "gogoproto.protosizer", + Tag: "varint,64028,opt,name=protosizer", + Filename: "gogo.proto", +} + +var E_Compare = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.MessageOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 64029, + Name: "gogoproto.compare", + Tag: "varint,64029,opt,name=compare", + Filename: "gogo.proto", +} + +var E_Typedecl = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.MessageOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 64030, + Name: "gogoproto.typedecl", + Tag: "varint,64030,opt,name=typedecl", + Filename: "gogo.proto", +} + +var E_Messagename = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.MessageOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 64033, + Name: "gogoproto.messagename", + Tag: "varint,64033,opt,name=messagename", + Filename: "gogo.proto", +} + +var E_GoprotoSizecache = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.MessageOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 64034, + Name: "gogoproto.goproto_sizecache", + Tag: "varint,64034,opt,name=goproto_sizecache,json=goprotoSizecache", + Filename: "gogo.proto", +} + +var E_GoprotoUnkeyed = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.MessageOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 64035, + Name: "gogoproto.goproto_unkeyed", + Tag: "varint,64035,opt,name=goproto_unkeyed,json=goprotoUnkeyed", + Filename: "gogo.proto", +} + +var E_Nullable = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.FieldOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 65001, + Name: "gogoproto.nullable", + Tag: "varint,65001,opt,name=nullable", + Filename: "gogo.proto", +} + +var E_Embed = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.FieldOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 65002, + Name: "gogoproto.embed", + Tag: "varint,65002,opt,name=embed", + Filename: "gogo.proto", +} + +var E_Customtype = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.FieldOptions)(nil), + ExtensionType: (*string)(nil), + Field: 65003, + Name: "gogoproto.customtype", + Tag: "bytes,65003,opt,name=customtype", + Filename: "gogo.proto", +} + +var E_Customname = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.FieldOptions)(nil), + ExtensionType: (*string)(nil), + Field: 65004, + Name: "gogoproto.customname", + Tag: "bytes,65004,opt,name=customname", + Filename: "gogo.proto", +} + +var E_Jsontag = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.FieldOptions)(nil), + ExtensionType: (*string)(nil), + Field: 65005, + Name: "gogoproto.jsontag", + Tag: "bytes,65005,opt,name=jsontag", + Filename: "gogo.proto", +} + +var E_Moretags = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.FieldOptions)(nil), + ExtensionType: (*string)(nil), + Field: 65006, + Name: "gogoproto.moretags", + Tag: "bytes,65006,opt,name=moretags", + Filename: "gogo.proto", +} + +var E_Casttype = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.FieldOptions)(nil), + ExtensionType: (*string)(nil), + Field: 65007, + Name: "gogoproto.casttype", + Tag: "bytes,65007,opt,name=casttype", + Filename: "gogo.proto", +} + +var E_Castkey = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.FieldOptions)(nil), + ExtensionType: (*string)(nil), + Field: 65008, + Name: "gogoproto.castkey", + Tag: "bytes,65008,opt,name=castkey", + Filename: "gogo.proto", +} + +var E_Castvalue = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.FieldOptions)(nil), + ExtensionType: (*string)(nil), + Field: 65009, + Name: "gogoproto.castvalue", + Tag: "bytes,65009,opt,name=castvalue", + Filename: "gogo.proto", +} + +var E_Stdtime = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.FieldOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 65010, + Name: "gogoproto.stdtime", + Tag: "varint,65010,opt,name=stdtime", + Filename: "gogo.proto", +} + +var E_Stdduration = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.FieldOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 65011, + Name: "gogoproto.stdduration", + Tag: "varint,65011,opt,name=stdduration", + Filename: "gogo.proto", +} + +func init() { + proto.RegisterExtension(E_GoprotoEnumPrefix) + proto.RegisterExtension(E_GoprotoEnumStringer) + proto.RegisterExtension(E_EnumStringer) + proto.RegisterExtension(E_EnumCustomname) + proto.RegisterExtension(E_Enumdecl) + proto.RegisterExtension(E_EnumvalueCustomname) + proto.RegisterExtension(E_GoprotoGettersAll) + proto.RegisterExtension(E_GoprotoEnumPrefixAll) + proto.RegisterExtension(E_GoprotoStringerAll) + proto.RegisterExtension(E_VerboseEqualAll) + proto.RegisterExtension(E_FaceAll) + proto.RegisterExtension(E_GostringAll) + proto.RegisterExtension(E_PopulateAll) + proto.RegisterExtension(E_StringerAll) + proto.RegisterExtension(E_OnlyoneAll) + proto.RegisterExtension(E_EqualAll) + proto.RegisterExtension(E_DescriptionAll) + proto.RegisterExtension(E_TestgenAll) + proto.RegisterExtension(E_BenchgenAll) + proto.RegisterExtension(E_MarshalerAll) + proto.RegisterExtension(E_UnmarshalerAll) + proto.RegisterExtension(E_StableMarshalerAll) + proto.RegisterExtension(E_SizerAll) + proto.RegisterExtension(E_GoprotoEnumStringerAll) + proto.RegisterExtension(E_EnumStringerAll) + proto.RegisterExtension(E_UnsafeMarshalerAll) + proto.RegisterExtension(E_UnsafeUnmarshalerAll) + proto.RegisterExtension(E_GoprotoExtensionsMapAll) + proto.RegisterExtension(E_GoprotoUnrecognizedAll) + proto.RegisterExtension(E_GogoprotoImport) + proto.RegisterExtension(E_ProtosizerAll) + proto.RegisterExtension(E_CompareAll) + proto.RegisterExtension(E_TypedeclAll) + proto.RegisterExtension(E_EnumdeclAll) + proto.RegisterExtension(E_GoprotoRegistration) + proto.RegisterExtension(E_MessagenameAll) + proto.RegisterExtension(E_GoprotoSizecacheAll) + proto.RegisterExtension(E_GoprotoUnkeyedAll) + proto.RegisterExtension(E_GoprotoGetters) + proto.RegisterExtension(E_GoprotoStringer) + proto.RegisterExtension(E_VerboseEqual) + proto.RegisterExtension(E_Face) + proto.RegisterExtension(E_Gostring) + proto.RegisterExtension(E_Populate) + proto.RegisterExtension(E_Stringer) + proto.RegisterExtension(E_Onlyone) + proto.RegisterExtension(E_Equal) + proto.RegisterExtension(E_Description) + proto.RegisterExtension(E_Testgen) + proto.RegisterExtension(E_Benchgen) + proto.RegisterExtension(E_Marshaler) + proto.RegisterExtension(E_Unmarshaler) + proto.RegisterExtension(E_StableMarshaler) + proto.RegisterExtension(E_Sizer) + proto.RegisterExtension(E_UnsafeMarshaler) + proto.RegisterExtension(E_UnsafeUnmarshaler) + proto.RegisterExtension(E_GoprotoExtensionsMap) + proto.RegisterExtension(E_GoprotoUnrecognized) + proto.RegisterExtension(E_Protosizer) + proto.RegisterExtension(E_Compare) + proto.RegisterExtension(E_Typedecl) + proto.RegisterExtension(E_Messagename) + proto.RegisterExtension(E_GoprotoSizecache) + proto.RegisterExtension(E_GoprotoUnkeyed) + proto.RegisterExtension(E_Nullable) + proto.RegisterExtension(E_Embed) + proto.RegisterExtension(E_Customtype) + proto.RegisterExtension(E_Customname) + proto.RegisterExtension(E_Jsontag) + proto.RegisterExtension(E_Moretags) + proto.RegisterExtension(E_Casttype) + proto.RegisterExtension(E_Castkey) + proto.RegisterExtension(E_Castvalue) + proto.RegisterExtension(E_Stdtime) + proto.RegisterExtension(E_Stdduration) +} + +func init() { proto.RegisterFile("gogo.proto", fileDescriptor_gogo_dfc2570aaff3e7bf) } + +var fileDescriptor_gogo_dfc2570aaff3e7bf = []byte{ + // 1314 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x98, 0xc9, 0x6f, 0x1c, 0x45, + 0x17, 0xc0, 0xf5, 0xe9, 0x4b, 0x14, 0xcf, 0xb3, 0x1d, 0xc7, 0x63, 0x63, 0x42, 0x04, 0x22, 0x70, + 0xe2, 0x64, 0x9f, 0x22, 0x94, 0xb2, 0x22, 0xcb, 0xb1, 0x1c, 0x2b, 0x08, 0x07, 0xe3, 0xc4, 0x61, + 0x3b, 0x8c, 0x7a, 0x7a, 0xca, 0xed, 0x26, 0xdd, 0x5d, 0x43, 0x2f, 0x51, 0x9c, 0x1b, 0x0a, 0x8b, + 0x10, 0x62, 0x47, 0x82, 0x84, 0x24, 0x10, 0x10, 0xfb, 0x1a, 0xf6, 0xe5, 0xc2, 0x85, 0xe5, 0xca, + 0xff, 0xc0, 0x05, 0x30, 0xbb, 0x6f, 0xbe, 0xa0, 0xd7, 0xfd, 0x5e, 0x4f, 0x4d, 0x7b, 0xa4, 0xaa, + 0xb9, 0xb5, 0xc7, 0xf5, 0xfb, 0x4d, 0xf5, 0x7b, 0x5d, 0xef, 0xbd, 0x69, 0x00, 0x4f, 0x79, 0x6a, + 0xb2, 0x1d, 0xab, 0x54, 0xd5, 0x6b, 0x78, 0x9d, 0x5f, 0xee, 0xdb, 0xef, 0x29, 0xe5, 0x05, 0x72, + 0x2a, 0xff, 0xab, 0x99, 0xad, 0x4e, 0xb5, 0x64, 0xe2, 0xc6, 0x7e, 0x3b, 0x55, 0x71, 0xb1, 0x58, + 0x1c, 0x83, 0x31, 0x5a, 0xdc, 0x90, 0x51, 0x16, 0x36, 0xda, 0xb1, 0x5c, 0xf5, 0xcf, 0xd4, 0xaf, + 0x9f, 0x2c, 0xc8, 0x49, 0x26, 0x27, 0xe7, 0xa3, 0x2c, 0xbc, 0xa3, 0x9d, 0xfa, 0x2a, 0x4a, 0xf6, + 0x5e, 0xfd, 0xf9, 0xff, 0xfb, 0xff, 0x77, 0xcb, 0xc0, 0xf2, 0x28, 0xa1, 0xf8, 0xbf, 0xa5, 0x1c, + 0x14, 0xcb, 0x70, 0x4d, 0x97, 0x2f, 0x49, 0x63, 0x3f, 0xf2, 0x64, 0x6c, 0x30, 0x7e, 0x47, 0xc6, + 0x31, 0xcd, 0x78, 0x9c, 0x50, 0x31, 0x07, 0xc3, 0xfd, 0xb8, 0xbe, 0x27, 0xd7, 0x90, 0xd4, 0x25, + 0x0b, 0x30, 0x92, 0x4b, 0xdc, 0x2c, 0x49, 0x55, 0x18, 0x39, 0xa1, 0x34, 0x68, 0x7e, 0xc8, 0x35, + 0xb5, 0xe5, 0xdd, 0x88, 0xcd, 0x95, 0x94, 0x10, 0x30, 0x80, 0x9f, 0xb4, 0xa4, 0x1b, 0x18, 0x0c, + 0x3f, 0xd2, 0x46, 0xca, 0xf5, 0xe2, 0x24, 0x8c, 0xe3, 0xf5, 0x69, 0x27, 0xc8, 0xa4, 0xbe, 0x93, + 0x9b, 0x7a, 0x7a, 0x4e, 0xe2, 0x32, 0x96, 0xfd, 0x74, 0x6e, 0x47, 0xbe, 0x9d, 0xb1, 0x52, 0xa0, + 0xed, 0x49, 0xcb, 0xa2, 0x27, 0xd3, 0x54, 0xc6, 0x49, 0xc3, 0x09, 0x7a, 0x6d, 0xef, 0x88, 0x1f, + 0x94, 0xc6, 0xf3, 0x1b, 0xdd, 0x59, 0x5c, 0x28, 0xc8, 0xd9, 0x20, 0x10, 0x2b, 0x70, 0x6d, 0x8f, + 0xa7, 0xc2, 0xc2, 0x79, 0x81, 0x9c, 0xe3, 0xdb, 0x9e, 0x0c, 0xd4, 0x2e, 0x01, 0x7f, 0x5e, 0xe6, + 0xd2, 0xc2, 0xf9, 0x12, 0x39, 0xeb, 0xc4, 0x72, 0x4a, 0xd1, 0x78, 0x1b, 0x8c, 0x9e, 0x96, 0x71, + 0x53, 0x25, 0xb2, 0x21, 0x1f, 0xc8, 0x9c, 0xc0, 0x42, 0x77, 0x91, 0x74, 0x23, 0x04, 0xce, 0x23, + 0x87, 0xae, 0x83, 0x30, 0xb0, 0xea, 0xb8, 0xd2, 0x42, 0x71, 0x89, 0x14, 0xbb, 0x70, 0x3d, 0xa2, + 0xb3, 0x30, 0xe4, 0xa9, 0xe2, 0x96, 0x2c, 0xf0, 0xcb, 0x84, 0x0f, 0x32, 0x43, 0x8a, 0xb6, 0x6a, + 0x67, 0x81, 0x93, 0xda, 0xec, 0xe0, 0x65, 0x56, 0x30, 0x43, 0x8a, 0x3e, 0xc2, 0xfa, 0x0a, 0x2b, + 0x12, 0x2d, 0x9e, 0x33, 0x30, 0xa8, 0xa2, 0x60, 0x5d, 0x45, 0x36, 0x9b, 0xb8, 0x42, 0x06, 0x20, + 0x04, 0x05, 0xd3, 0x50, 0xb3, 0x4d, 0xc4, 0xeb, 0x1b, 0x7c, 0x3c, 0x38, 0x03, 0x0b, 0x30, 0xc2, + 0x05, 0xca, 0x57, 0x91, 0x85, 0xe2, 0x0d, 0x52, 0xec, 0xd6, 0x30, 0xba, 0x8d, 0x54, 0x26, 0xa9, + 0x27, 0x6d, 0x24, 0x6f, 0xf2, 0x6d, 0x10, 0x42, 0xa1, 0x6c, 0xca, 0xc8, 0x5d, 0xb3, 0x33, 0xbc, + 0xc5, 0xa1, 0x64, 0x06, 0x15, 0x73, 0x30, 0x1c, 0x3a, 0x71, 0xb2, 0xe6, 0x04, 0x56, 0xe9, 0x78, + 0x9b, 0x1c, 0x43, 0x25, 0x44, 0x11, 0xc9, 0xa2, 0x7e, 0x34, 0xef, 0x70, 0x44, 0x34, 0x8c, 0x8e, + 0x5e, 0x92, 0x3a, 0xcd, 0x40, 0x36, 0xfa, 0xb1, 0xbd, 0xcb, 0x47, 0xaf, 0x60, 0x17, 0x75, 0xe3, + 0x34, 0xd4, 0x12, 0xff, 0xac, 0x95, 0xe6, 0x3d, 0xce, 0x74, 0x0e, 0x20, 0x7c, 0x0f, 0x5c, 0xd7, + 0xb3, 0x4d, 0x58, 0xc8, 0xde, 0x27, 0xd9, 0x44, 0x8f, 0x56, 0x41, 0x25, 0xa1, 0x5f, 0xe5, 0x07, + 0x5c, 0x12, 0x64, 0xc5, 0xb5, 0x04, 0xe3, 0x59, 0x94, 0x38, 0xab, 0xfd, 0x45, 0xed, 0x43, 0x8e, + 0x5a, 0xc1, 0x76, 0x45, 0xed, 0x04, 0x4c, 0x90, 0xb1, 0xbf, 0xbc, 0x7e, 0xc4, 0x85, 0xb5, 0xa0, + 0x57, 0xba, 0xb3, 0x7b, 0x1f, 0xec, 0x2b, 0xc3, 0x79, 0x26, 0x95, 0x51, 0x82, 0x4c, 0x23, 0x74, + 0xda, 0x16, 0xe6, 0xab, 0x64, 0xe6, 0x8a, 0x3f, 0x5f, 0x0a, 0x16, 0x9d, 0x36, 0xca, 0xef, 0x86, + 0xbd, 0x2c, 0xcf, 0xa2, 0x58, 0xba, 0xca, 0x8b, 0xfc, 0xb3, 0xb2, 0x65, 0xa1, 0xfe, 0xb8, 0x92, + 0xaa, 0x15, 0x0d, 0x47, 0xf3, 0x51, 0xd8, 0x53, 0xce, 0x2a, 0x0d, 0x3f, 0x6c, 0xab, 0x38, 0x35, + 0x18, 0x3f, 0xe1, 0x4c, 0x95, 0xdc, 0xd1, 0x1c, 0x13, 0xf3, 0xb0, 0x3b, 0xff, 0xd3, 0xf6, 0x91, + 0xfc, 0x94, 0x44, 0xc3, 0x1d, 0x8a, 0x0a, 0x87, 0xab, 0xc2, 0xb6, 0x13, 0xdb, 0xd4, 0xbf, 0xcf, + 0xb8, 0x70, 0x10, 0x42, 0x85, 0x23, 0x5d, 0x6f, 0x4b, 0xec, 0xf6, 0x16, 0x86, 0xcf, 0xb9, 0x70, + 0x30, 0x43, 0x0a, 0x1e, 0x18, 0x2c, 0x14, 0x5f, 0xb0, 0x82, 0x19, 0x54, 0xdc, 0xd9, 0x69, 0xb4, + 0xb1, 0xf4, 0xfc, 0x24, 0x8d, 0x1d, 0x5c, 0x6d, 0x50, 0x7d, 0xb9, 0xd1, 0x3d, 0x84, 0x2d, 0x6b, + 0x28, 0x56, 0xa2, 0x50, 0x26, 0x89, 0xe3, 0x49, 0x9c, 0x38, 0x2c, 0x36, 0xf6, 0x15, 0x57, 0x22, + 0x0d, 0xc3, 0xbd, 0x69, 0x13, 0x22, 0x86, 0xdd, 0x75, 0xdc, 0x35, 0x1b, 0xdd, 0xd7, 0x95, 0xcd, + 0x1d, 0x67, 0x16, 0x9d, 0xda, 0xfc, 0x93, 0x45, 0xa7, 0xe4, 0xba, 0xd5, 0xd3, 0xf9, 0x4d, 0x65, + 0xfe, 0x59, 0x29, 0xc8, 0xa2, 0x86, 0x8c, 0x54, 0xe6, 0xa9, 0xfa, 0x8d, 0xdb, 0x5c, 0x8b, 0xc5, + 0x7d, 0xb1, 0xee, 0xc1, 0x4d, 0xba, 0xdf, 0xee, 0x71, 0x4a, 0xdc, 0x8e, 0x0f, 0x79, 0xf7, 0xd0, + 0x63, 0x96, 0x9d, 0xdb, 0x2c, 0x9f, 0xf3, 0xae, 0x99, 0x47, 0x1c, 0x81, 0xe1, 0xae, 0x81, 0xc7, + 0xac, 0x7a, 0x88, 0x54, 0x43, 0xfa, 0xbc, 0x23, 0x0e, 0xc0, 0x0e, 0x1c, 0x5e, 0xcc, 0xf8, 0xc3, + 0x84, 0xe7, 0xcb, 0xc5, 0x21, 0x18, 0xe0, 0xa1, 0xc5, 0x8c, 0x3e, 0x42, 0x68, 0x89, 0x20, 0xce, + 0x03, 0x8b, 0x19, 0x7f, 0x94, 0x71, 0x46, 0x10, 0xb7, 0x0f, 0xe1, 0xb7, 0x8f, 0xef, 0xa0, 0xa6, + 0xc3, 0xb1, 0x9b, 0x86, 0x5d, 0x34, 0xa9, 0x98, 0xe9, 0xc7, 0xe8, 0xcb, 0x99, 0x10, 0xb7, 0xc2, + 0x4e, 0xcb, 0x80, 0x3f, 0x41, 0x68, 0xb1, 0x5e, 0xcc, 0xc1, 0xa0, 0x36, 0x9d, 0x98, 0xf1, 0x27, + 0x09, 0xd7, 0x29, 0xdc, 0x3a, 0x4d, 0x27, 0x66, 0xc1, 0x53, 0xbc, 0x75, 0x22, 0x30, 0x6c, 0x3c, + 0x98, 0x98, 0xe9, 0xa7, 0x39, 0xea, 0x8c, 0x88, 0x19, 0xa8, 0x95, 0xcd, 0xc6, 0xcc, 0x3f, 0x43, + 0x7c, 0x87, 0xc1, 0x08, 0x68, 0xcd, 0xce, 0xac, 0x78, 0x96, 0x23, 0xa0, 0x51, 0x78, 0x8c, 0xaa, + 0x03, 0x8c, 0xd9, 0xf4, 0x1c, 0x1f, 0xa3, 0xca, 0xfc, 0x82, 0xd9, 0xcc, 0x6b, 0xbe, 0x59, 0xf1, + 0x3c, 0x67, 0x33, 0x5f, 0x8f, 0xdb, 0xa8, 0x4e, 0x04, 0x66, 0xc7, 0x0b, 0xbc, 0x8d, 0xca, 0x40, + 0x20, 0x96, 0xa0, 0xbe, 0x7d, 0x1a, 0x30, 0xfb, 0x5e, 0x24, 0xdf, 0xe8, 0xb6, 0x61, 0x40, 0xdc, + 0x05, 0x13, 0xbd, 0x27, 0x01, 0xb3, 0xf5, 0xfc, 0x66, 0xe5, 0xb7, 0x9b, 0x3e, 0x08, 0x88, 0x13, + 0x9d, 0x96, 0xa2, 0x4f, 0x01, 0x66, 0xed, 0x85, 0xcd, 0xee, 0xc2, 0xad, 0x0f, 0x01, 0x62, 0x16, + 0xa0, 0xd3, 0x80, 0xcd, 0xae, 0x8b, 0xe4, 0xd2, 0x20, 0x3c, 0x1a, 0xd4, 0x7f, 0xcd, 0xfc, 0x25, + 0x3e, 0x1a, 0x44, 0xe0, 0xd1, 0xe0, 0xd6, 0x6b, 0xa6, 0x2f, 0xf3, 0xd1, 0x60, 0x04, 0x9f, 0x6c, + 0xad, 0xbb, 0x99, 0x0d, 0x57, 0xf8, 0xc9, 0xd6, 0x28, 0x71, 0x0c, 0x46, 0xb7, 0x35, 0x44, 0xb3, + 0xea, 0x55, 0x52, 0xed, 0xa9, 0xf6, 0x43, 0xbd, 0x79, 0x51, 0x33, 0x34, 0xdb, 0x5e, 0xab, 0x34, + 0x2f, 0xea, 0x85, 0x62, 0x1a, 0x06, 0xa2, 0x2c, 0x08, 0xf0, 0xf0, 0xd4, 0x6f, 0xe8, 0xd1, 0x4d, + 0x65, 0xd0, 0x62, 0xc5, 0x2f, 0x5b, 0x14, 0x1d, 0x06, 0xc4, 0x01, 0xd8, 0x29, 0xc3, 0xa6, 0x6c, + 0x99, 0xc8, 0x5f, 0xb7, 0xb8, 0x60, 0xe2, 0x6a, 0x31, 0x03, 0x50, 0xbc, 0x1a, 0xc1, 0x30, 0x9b, + 0xd8, 0xdf, 0xb6, 0x8a, 0xb7, 0x34, 0x1a, 0xd2, 0x11, 0xe4, 0x49, 0x31, 0x08, 0x36, 0xba, 0x05, + 0x79, 0x46, 0x0e, 0xc2, 0xae, 0xfb, 0x13, 0x15, 0xa5, 0x8e, 0x67, 0xa2, 0x7f, 0x27, 0x9a, 0xd7, + 0x63, 0xc0, 0x42, 0x15, 0xcb, 0xd4, 0xf1, 0x12, 0x13, 0xfb, 0x07, 0xb1, 0x25, 0x80, 0xb0, 0xeb, + 0x24, 0xa9, 0xcd, 0x7d, 0xff, 0xc9, 0x30, 0x03, 0xb8, 0x69, 0xbc, 0x3e, 0x25, 0xd7, 0x4d, 0xec, + 0x5f, 0xbc, 0x69, 0x5a, 0x2f, 0x0e, 0x41, 0x0d, 0x2f, 0xf3, 0xb7, 0x4a, 0x26, 0xf8, 0x6f, 0x82, + 0x3b, 0x04, 0x7e, 0x73, 0x92, 0xb6, 0x52, 0xdf, 0x1c, 0xec, 0x7f, 0x28, 0xd3, 0xbc, 0x5e, 0xcc, + 0xc2, 0x60, 0x92, 0xb6, 0x5a, 0x19, 0xcd, 0xa7, 0x06, 0xfc, 0xdf, 0xad, 0xf2, 0x95, 0x45, 0xc9, + 0x1c, 0x9e, 0x87, 0x31, 0x57, 0x85, 0x55, 0xf0, 0x30, 0x2c, 0xa8, 0x05, 0xb5, 0x94, 0x97, 0x89, + 0x7b, 0x6f, 0xf6, 0xfc, 0x74, 0x2d, 0x6b, 0x4e, 0xba, 0x2a, 0x9c, 0xc2, 0x1f, 0x0e, 0x9d, 0xf7, + 0xa1, 0xe5, 0xcf, 0x88, 0xff, 0x02, 0x00, 0x00, 0xff, 0xff, 0x79, 0x3c, 0xbe, 0x6b, 0x42, 0x15, + 0x00, 0x00, +} diff --git a/vendor/github.com/gogo/protobuf/gogoproto/gogo.pb.golden b/vendor/github.com/gogo/protobuf/gogoproto/gogo.pb.golden new file mode 100644 index 000000000000..f6502e4b9015 --- /dev/null +++ b/vendor/github.com/gogo/protobuf/gogoproto/gogo.pb.golden @@ -0,0 +1,45 @@ +// Code generated by protoc-gen-go. +// source: gogo.proto +// DO NOT EDIT! + +package gogoproto + +import proto "github.com/gogo/protobuf/proto" +import json "encoding/json" +import math "math" +import google_protobuf "github.com/gogo/protobuf/protoc-gen-gogo/descriptor" + +// Reference proto, json, and math imports to suppress error if they are not otherwise used. +var _ = proto.Marshal +var _ = &json.SyntaxError{} +var _ = math.Inf + +var E_Nullable = &proto.ExtensionDesc{ + ExtendedType: (*google_protobuf.FieldOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 51235, + Name: "gogoproto.nullable", + Tag: "varint,51235,opt,name=nullable", +} + +var E_Embed = &proto.ExtensionDesc{ + ExtendedType: (*google_protobuf.FieldOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 51236, + Name: "gogoproto.embed", + Tag: "varint,51236,opt,name=embed", +} + +var E_Customtype = &proto.ExtensionDesc{ + ExtendedType: (*google_protobuf.FieldOptions)(nil), + ExtensionType: (*string)(nil), + Field: 51237, + Name: "gogoproto.customtype", + Tag: "bytes,51237,opt,name=customtype", +} + +func init() { + proto.RegisterExtension(E_Nullable) + proto.RegisterExtension(E_Embed) + proto.RegisterExtension(E_Customtype) +} diff --git a/vendor/github.com/gogo/protobuf/gogoproto/gogo.proto b/vendor/github.com/gogo/protobuf/gogoproto/gogo.proto new file mode 100644 index 000000000000..f8f7463b2ea5 --- /dev/null +++ b/vendor/github.com/gogo/protobuf/gogoproto/gogo.proto @@ -0,0 +1,142 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2013, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +syntax = "proto2"; +package gogoproto; + +import "google/protobuf/descriptor.proto"; + +option java_package = "com.google.protobuf"; +option java_outer_classname = "GoGoProtos"; +option go_package = "github.com/gogo/protobuf/gogoproto"; + +extend google.protobuf.EnumOptions { + optional bool goproto_enum_prefix = 62001; + optional bool goproto_enum_stringer = 62021; + optional bool enum_stringer = 62022; + optional string enum_customname = 62023; + optional bool enumdecl = 62024; +} + +extend google.protobuf.EnumValueOptions { + optional string enumvalue_customname = 66001; +} + +extend google.protobuf.FileOptions { + optional bool goproto_getters_all = 63001; + optional bool goproto_enum_prefix_all = 63002; + optional bool goproto_stringer_all = 63003; + optional bool verbose_equal_all = 63004; + optional bool face_all = 63005; + optional bool gostring_all = 63006; + optional bool populate_all = 63007; + optional bool stringer_all = 63008; + optional bool onlyone_all = 63009; + + optional bool equal_all = 63013; + optional bool description_all = 63014; + optional bool testgen_all = 63015; + optional bool benchgen_all = 63016; + optional bool marshaler_all = 63017; + optional bool unmarshaler_all = 63018; + optional bool stable_marshaler_all = 63019; + + optional bool sizer_all = 63020; + + optional bool goproto_enum_stringer_all = 63021; + optional bool enum_stringer_all = 63022; + + optional bool unsafe_marshaler_all = 63023; + optional bool unsafe_unmarshaler_all = 63024; + + optional bool goproto_extensions_map_all = 63025; + optional bool goproto_unrecognized_all = 63026; + optional bool gogoproto_import = 63027; + optional bool protosizer_all = 63028; + optional bool compare_all = 63029; + optional bool typedecl_all = 63030; + optional bool enumdecl_all = 63031; + + optional bool goproto_registration = 63032; + optional bool messagename_all = 63033; + + optional bool goproto_sizecache_all = 63034; + optional bool goproto_unkeyed_all = 63035; +} + +extend google.protobuf.MessageOptions { + optional bool goproto_getters = 64001; + optional bool goproto_stringer = 64003; + optional bool verbose_equal = 64004; + optional bool face = 64005; + optional bool gostring = 64006; + optional bool populate = 64007; + optional bool stringer = 67008; + optional bool onlyone = 64009; + + optional bool equal = 64013; + optional bool description = 64014; + optional bool testgen = 64015; + optional bool benchgen = 64016; + optional bool marshaler = 64017; + optional bool unmarshaler = 64018; + optional bool stable_marshaler = 64019; + + optional bool sizer = 64020; + + optional bool unsafe_marshaler = 64023; + optional bool unsafe_unmarshaler = 64024; + + optional bool goproto_extensions_map = 64025; + optional bool goproto_unrecognized = 64026; + + optional bool protosizer = 64028; + optional bool compare = 64029; + + optional bool typedecl = 64030; + + optional bool messagename = 64033; + + optional bool goproto_sizecache = 64034; + optional bool goproto_unkeyed = 64035; +} + +extend google.protobuf.FieldOptions { + optional bool nullable = 65001; + optional bool embed = 65002; + optional string customtype = 65003; + optional string customname = 65004; + optional string jsontag = 65005; + optional string moretags = 65006; + optional string casttype = 65007; + optional string castkey = 65008; + optional string castvalue = 65009; + + optional bool stdtime = 65010; + optional bool stdduration = 65011; +} diff --git a/vendor/github.com/gogo/protobuf/gogoproto/helper.go b/vendor/github.com/gogo/protobuf/gogoproto/helper.go new file mode 100644 index 000000000000..c8cafe69a37c --- /dev/null +++ b/vendor/github.com/gogo/protobuf/gogoproto/helper.go @@ -0,0 +1,366 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2013, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +package gogoproto + +import google_protobuf "github.com/gogo/protobuf/protoc-gen-gogo/descriptor" +import proto "github.com/gogo/protobuf/proto" + +func IsEmbed(field *google_protobuf.FieldDescriptorProto) bool { + return proto.GetBoolExtension(field.Options, E_Embed, false) +} + +func IsNullable(field *google_protobuf.FieldDescriptorProto) bool { + return proto.GetBoolExtension(field.Options, E_Nullable, true) +} + +func IsStdTime(field *google_protobuf.FieldDescriptorProto) bool { + return proto.GetBoolExtension(field.Options, E_Stdtime, false) +} + +func IsStdDuration(field *google_protobuf.FieldDescriptorProto) bool { + return proto.GetBoolExtension(field.Options, E_Stdduration, false) +} + +func NeedsNilCheck(proto3 bool, field *google_protobuf.FieldDescriptorProto) bool { + nullable := IsNullable(field) + if field.IsMessage() || IsCustomType(field) { + return nullable + } + if proto3 { + return false + } + return nullable || *field.Type == google_protobuf.FieldDescriptorProto_TYPE_BYTES +} + +func IsCustomType(field *google_protobuf.FieldDescriptorProto) bool { + typ := GetCustomType(field) + if len(typ) > 0 { + return true + } + return false +} + +func IsCastType(field *google_protobuf.FieldDescriptorProto) bool { + typ := GetCastType(field) + if len(typ) > 0 { + return true + } + return false +} + +func IsCastKey(field *google_protobuf.FieldDescriptorProto) bool { + typ := GetCastKey(field) + if len(typ) > 0 { + return true + } + return false +} + +func IsCastValue(field *google_protobuf.FieldDescriptorProto) bool { + typ := GetCastValue(field) + if len(typ) > 0 { + return true + } + return false +} + +func HasEnumDecl(file *google_protobuf.FileDescriptorProto, enum *google_protobuf.EnumDescriptorProto) bool { + return proto.GetBoolExtension(enum.Options, E_Enumdecl, proto.GetBoolExtension(file.Options, E_EnumdeclAll, true)) +} + +func HasTypeDecl(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { + return proto.GetBoolExtension(message.Options, E_Typedecl, proto.GetBoolExtension(file.Options, E_TypedeclAll, true)) +} + +func GetCustomType(field *google_protobuf.FieldDescriptorProto) string { + if field == nil { + return "" + } + if field.Options != nil { + v, err := proto.GetExtension(field.Options, E_Customtype) + if err == nil && v.(*string) != nil { + return *(v.(*string)) + } + } + return "" +} + +func GetCastType(field *google_protobuf.FieldDescriptorProto) string { + if field == nil { + return "" + } + if field.Options != nil { + v, err := proto.GetExtension(field.Options, E_Casttype) + if err == nil && v.(*string) != nil { + return *(v.(*string)) + } + } + return "" +} + +func GetCastKey(field *google_protobuf.FieldDescriptorProto) string { + if field == nil { + return "" + } + if field.Options != nil { + v, err := proto.GetExtension(field.Options, E_Castkey) + if err == nil && v.(*string) != nil { + return *(v.(*string)) + } + } + return "" +} + +func GetCastValue(field *google_protobuf.FieldDescriptorProto) string { + if field == nil { + return "" + } + if field.Options != nil { + v, err := proto.GetExtension(field.Options, E_Castvalue) + if err == nil && v.(*string) != nil { + return *(v.(*string)) + } + } + return "" +} + +func IsCustomName(field *google_protobuf.FieldDescriptorProto) bool { + name := GetCustomName(field) + if len(name) > 0 { + return true + } + return false +} + +func IsEnumCustomName(field *google_protobuf.EnumDescriptorProto) bool { + name := GetEnumCustomName(field) + if len(name) > 0 { + return true + } + return false +} + +func IsEnumValueCustomName(field *google_protobuf.EnumValueDescriptorProto) bool { + name := GetEnumValueCustomName(field) + if len(name) > 0 { + return true + } + return false +} + +func GetCustomName(field *google_protobuf.FieldDescriptorProto) string { + if field == nil { + return "" + } + if field.Options != nil { + v, err := proto.GetExtension(field.Options, E_Customname) + if err == nil && v.(*string) != nil { + return *(v.(*string)) + } + } + return "" +} + +func GetEnumCustomName(field *google_protobuf.EnumDescriptorProto) string { + if field == nil { + return "" + } + if field.Options != nil { + v, err := proto.GetExtension(field.Options, E_EnumCustomname) + if err == nil && v.(*string) != nil { + return *(v.(*string)) + } + } + return "" +} + +func GetEnumValueCustomName(field *google_protobuf.EnumValueDescriptorProto) string { + if field == nil { + return "" + } + if field.Options != nil { + v, err := proto.GetExtension(field.Options, E_EnumvalueCustomname) + if err == nil && v.(*string) != nil { + return *(v.(*string)) + } + } + return "" +} + +func GetJsonTag(field *google_protobuf.FieldDescriptorProto) *string { + if field == nil { + return nil + } + if field.Options != nil { + v, err := proto.GetExtension(field.Options, E_Jsontag) + if err == nil && v.(*string) != nil { + return (v.(*string)) + } + } + return nil +} + +func GetMoreTags(field *google_protobuf.FieldDescriptorProto) *string { + if field == nil { + return nil + } + if field.Options != nil { + v, err := proto.GetExtension(field.Options, E_Moretags) + if err == nil && v.(*string) != nil { + return (v.(*string)) + } + } + return nil +} + +type EnableFunc func(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool + +func EnabledGoEnumPrefix(file *google_protobuf.FileDescriptorProto, enum *google_protobuf.EnumDescriptorProto) bool { + return proto.GetBoolExtension(enum.Options, E_GoprotoEnumPrefix, proto.GetBoolExtension(file.Options, E_GoprotoEnumPrefixAll, true)) +} + +func EnabledGoStringer(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { + return proto.GetBoolExtension(message.Options, E_GoprotoStringer, proto.GetBoolExtension(file.Options, E_GoprotoStringerAll, true)) +} + +func HasGoGetters(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { + return proto.GetBoolExtension(message.Options, E_GoprotoGetters, proto.GetBoolExtension(file.Options, E_GoprotoGettersAll, true)) +} + +func IsUnion(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { + return proto.GetBoolExtension(message.Options, E_Onlyone, proto.GetBoolExtension(file.Options, E_OnlyoneAll, false)) +} + +func HasGoString(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { + return proto.GetBoolExtension(message.Options, E_Gostring, proto.GetBoolExtension(file.Options, E_GostringAll, false)) +} + +func HasEqual(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { + return proto.GetBoolExtension(message.Options, E_Equal, proto.GetBoolExtension(file.Options, E_EqualAll, false)) +} + +func HasVerboseEqual(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { + return proto.GetBoolExtension(message.Options, E_VerboseEqual, proto.GetBoolExtension(file.Options, E_VerboseEqualAll, false)) +} + +func IsStringer(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { + return proto.GetBoolExtension(message.Options, E_Stringer, proto.GetBoolExtension(file.Options, E_StringerAll, false)) +} + +func IsFace(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { + return proto.GetBoolExtension(message.Options, E_Face, proto.GetBoolExtension(file.Options, E_FaceAll, false)) +} + +func HasDescription(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { + return proto.GetBoolExtension(message.Options, E_Description, proto.GetBoolExtension(file.Options, E_DescriptionAll, false)) +} + +func HasPopulate(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { + return proto.GetBoolExtension(message.Options, E_Populate, proto.GetBoolExtension(file.Options, E_PopulateAll, false)) +} + +func HasTestGen(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { + return proto.GetBoolExtension(message.Options, E_Testgen, proto.GetBoolExtension(file.Options, E_TestgenAll, false)) +} + +func HasBenchGen(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { + return proto.GetBoolExtension(message.Options, E_Benchgen, proto.GetBoolExtension(file.Options, E_BenchgenAll, false)) +} + +func IsMarshaler(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { + return proto.GetBoolExtension(message.Options, E_Marshaler, proto.GetBoolExtension(file.Options, E_MarshalerAll, false)) +} + +func IsUnmarshaler(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { + return proto.GetBoolExtension(message.Options, E_Unmarshaler, proto.GetBoolExtension(file.Options, E_UnmarshalerAll, false)) +} + +func IsStableMarshaler(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { + return proto.GetBoolExtension(message.Options, E_StableMarshaler, proto.GetBoolExtension(file.Options, E_StableMarshalerAll, false)) +} + +func IsSizer(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { + return proto.GetBoolExtension(message.Options, E_Sizer, proto.GetBoolExtension(file.Options, E_SizerAll, false)) +} + +func IsProtoSizer(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { + return proto.GetBoolExtension(message.Options, E_Protosizer, proto.GetBoolExtension(file.Options, E_ProtosizerAll, false)) +} + +func IsGoEnumStringer(file *google_protobuf.FileDescriptorProto, enum *google_protobuf.EnumDescriptorProto) bool { + return proto.GetBoolExtension(enum.Options, E_GoprotoEnumStringer, proto.GetBoolExtension(file.Options, E_GoprotoEnumStringerAll, true)) +} + +func IsEnumStringer(file *google_protobuf.FileDescriptorProto, enum *google_protobuf.EnumDescriptorProto) bool { + return proto.GetBoolExtension(enum.Options, E_EnumStringer, proto.GetBoolExtension(file.Options, E_EnumStringerAll, false)) +} + +func IsUnsafeMarshaler(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { + return proto.GetBoolExtension(message.Options, E_UnsafeMarshaler, proto.GetBoolExtension(file.Options, E_UnsafeMarshalerAll, false)) +} + +func IsUnsafeUnmarshaler(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { + return proto.GetBoolExtension(message.Options, E_UnsafeUnmarshaler, proto.GetBoolExtension(file.Options, E_UnsafeUnmarshalerAll, false)) +} + +func HasExtensionsMap(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { + return proto.GetBoolExtension(message.Options, E_GoprotoExtensionsMap, proto.GetBoolExtension(file.Options, E_GoprotoExtensionsMapAll, true)) +} + +func HasUnrecognized(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { + return proto.GetBoolExtension(message.Options, E_GoprotoUnrecognized, proto.GetBoolExtension(file.Options, E_GoprotoUnrecognizedAll, true)) +} + +func IsProto3(file *google_protobuf.FileDescriptorProto) bool { + return file.GetSyntax() == "proto3" +} + +func ImportsGoGoProto(file *google_protobuf.FileDescriptorProto) bool { + return proto.GetBoolExtension(file.Options, E_GogoprotoImport, true) +} + +func HasCompare(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { + return proto.GetBoolExtension(message.Options, E_Compare, proto.GetBoolExtension(file.Options, E_CompareAll, false)) +} + +func RegistersGolangProto(file *google_protobuf.FileDescriptorProto) bool { + return proto.GetBoolExtension(file.Options, E_GoprotoRegistration, false) +} + +func HasMessageName(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { + return proto.GetBoolExtension(message.Options, E_Messagename, proto.GetBoolExtension(file.Options, E_MessagenameAll, false)) +} + +func HasSizecache(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { + return proto.GetBoolExtension(message.Options, E_GoprotoSizecache, proto.GetBoolExtension(file.Options, E_GoprotoSizecacheAll, true)) +} + +func HasUnkeyed(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { + return proto.GetBoolExtension(message.Options, E_GoprotoUnkeyed, proto.GetBoolExtension(file.Options, E_GoprotoUnkeyedAll, true)) +} diff --git a/vendor/github.com/gogo/protobuf/jsonpb/jsonpb.go b/vendor/github.com/gogo/protobuf/jsonpb/jsonpb.go new file mode 100644 index 000000000000..b047d13e501e --- /dev/null +++ b/vendor/github.com/gogo/protobuf/jsonpb/jsonpb.go @@ -0,0 +1,1392 @@ +// Go support for Protocol Buffers - Google's data interchange format +// +// Copyright 2015 The Go Authors. All rights reserved. +// https://github.com/golang/protobuf +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +/* +Package jsonpb provides marshaling and unmarshaling between protocol buffers and JSON. +It follows the specification at https://developers.google.com/protocol-buffers/docs/proto3#json. + +This package produces a different output than the standard "encoding/json" package, +which does not operate correctly on protocol buffers. +*/ +package jsonpb + +import ( + "bytes" + "encoding/json" + "errors" + "fmt" + "io" + "math" + "reflect" + "sort" + "strconv" + "strings" + "time" + + "github.com/gogo/protobuf/proto" + "github.com/gogo/protobuf/types" +) + +const secondInNanos = int64(time.Second / time.Nanosecond) + +// Marshaler is a configurable object for converting between +// protocol buffer objects and a JSON representation for them. +type Marshaler struct { + // Whether to render enum values as integers, as opposed to string values. + EnumsAsInts bool + + // Whether to render fields with zero values. + EmitDefaults bool + + // A string to indent each level by. The presence of this field will + // also cause a space to appear between the field separator and + // value, and for newlines to be appear between fields and array + // elements. + Indent string + + // Whether to use the original (.proto) name for fields. + OrigName bool + + // A custom URL resolver to use when marshaling Any messages to JSON. + // If unset, the default resolution strategy is to extract the + // fully-qualified type name from the type URL and pass that to + // proto.MessageType(string). + AnyResolver AnyResolver +} + +// AnyResolver takes a type URL, present in an Any message, and resolves it into +// an instance of the associated message. +type AnyResolver interface { + Resolve(typeUrl string) (proto.Message, error) +} + +func defaultResolveAny(typeUrl string) (proto.Message, error) { + // Only the part of typeUrl after the last slash is relevant. + mname := typeUrl + if slash := strings.LastIndex(mname, "/"); slash >= 0 { + mname = mname[slash+1:] + } + mt := proto.MessageType(mname) + if mt == nil { + return nil, fmt.Errorf("unknown message type %q", mname) + } + return reflect.New(mt.Elem()).Interface().(proto.Message), nil +} + +// JSONPBMarshaler is implemented by protobuf messages that customize the +// way they are marshaled to JSON. Messages that implement this should +// also implement JSONPBUnmarshaler so that the custom format can be +// parsed. +type JSONPBMarshaler interface { + MarshalJSONPB(*Marshaler) ([]byte, error) +} + +// JSONPBUnmarshaler is implemented by protobuf messages that customize +// the way they are unmarshaled from JSON. Messages that implement this +// should also implement JSONPBMarshaler so that the custom format can be +// produced. +type JSONPBUnmarshaler interface { + UnmarshalJSONPB(*Unmarshaler, []byte) error +} + +// Marshal marshals a protocol buffer into JSON. +func (m *Marshaler) Marshal(out io.Writer, pb proto.Message) error { + v := reflect.ValueOf(pb) + if pb == nil || (v.Kind() == reflect.Ptr && v.IsNil()) { + return errors.New("Marshal called with nil") + } + // Check for unset required fields first. + if err := checkRequiredFields(pb); err != nil { + return err + } + writer := &errWriter{writer: out} + return m.marshalObject(writer, pb, "", "") +} + +// MarshalToString converts a protocol buffer object to JSON string. +func (m *Marshaler) MarshalToString(pb proto.Message) (string, error) { + var buf bytes.Buffer + if err := m.Marshal(&buf, pb); err != nil { + return "", err + } + return buf.String(), nil +} + +type int32Slice []int32 + +var nonFinite = map[string]float64{ + `"NaN"`: math.NaN(), + `"Infinity"`: math.Inf(1), + `"-Infinity"`: math.Inf(-1), +} + +// For sorting extensions ids to ensure stable output. +func (s int32Slice) Len() int { return len(s) } +func (s int32Slice) Less(i, j int) bool { return s[i] < s[j] } +func (s int32Slice) Swap(i, j int) { s[i], s[j] = s[j], s[i] } + +type isWkt interface { + XXX_WellKnownType() string +} + +// marshalObject writes a struct to the Writer. +func (m *Marshaler) marshalObject(out *errWriter, v proto.Message, indent, typeURL string) error { + if jsm, ok := v.(JSONPBMarshaler); ok { + b, err := jsm.MarshalJSONPB(m) + if err != nil { + return err + } + if typeURL != "" { + // we are marshaling this object to an Any type + var js map[string]*json.RawMessage + if err = json.Unmarshal(b, &js); err != nil { + return fmt.Errorf("type %T produced invalid JSON: %v", v, err) + } + turl, err := json.Marshal(typeURL) + if err != nil { + return fmt.Errorf("failed to marshal type URL %q to JSON: %v", typeURL, err) + } + js["@type"] = (*json.RawMessage)(&turl) + if b, err = json.Marshal(js); err != nil { + return err + } + } + + out.write(string(b)) + return out.err + } + + s := reflect.ValueOf(v).Elem() + + // Handle well-known types. + if wkt, ok := v.(isWkt); ok { + switch wkt.XXX_WellKnownType() { + case "DoubleValue", "FloatValue", "Int64Value", "UInt64Value", + "Int32Value", "UInt32Value", "BoolValue", "StringValue", "BytesValue": + // "Wrappers use the same representation in JSON + // as the wrapped primitive type, ..." + sprop := proto.GetProperties(s.Type()) + return m.marshalValue(out, sprop.Prop[0], s.Field(0), indent) + case "Any": + // Any is a bit more involved. + return m.marshalAny(out, v, indent) + case "Duration": + // "Generated output always contains 0, 3, 6, or 9 fractional digits, + // depending on required precision." + s, ns := s.Field(0).Int(), s.Field(1).Int() + if ns <= -secondInNanos || ns >= secondInNanos { + return fmt.Errorf("ns out of range (%v, %v)", -secondInNanos, secondInNanos) + } + if (s > 0 && ns < 0) || (s < 0 && ns > 0) { + return errors.New("signs of seconds and nanos do not match") + } + if s < 0 { + ns = -ns + } + x := fmt.Sprintf("%d.%09d", s, ns) + x = strings.TrimSuffix(x, "000") + x = strings.TrimSuffix(x, "000") + x = strings.TrimSuffix(x, ".000") + out.write(`"`) + out.write(x) + out.write(`s"`) + return out.err + case "Struct", "ListValue": + // Let marshalValue handle the `Struct.fields` map or the `ListValue.values` slice. + // TODO: pass the correct Properties if needed. + return m.marshalValue(out, &proto.Properties{}, s.Field(0), indent) + case "Timestamp": + // "RFC 3339, where generated output will always be Z-normalized + // and uses 0, 3, 6 or 9 fractional digits." + s, ns := s.Field(0).Int(), s.Field(1).Int() + if ns < 0 || ns >= secondInNanos { + return fmt.Errorf("ns out of range [0, %v)", secondInNanos) + } + t := time.Unix(s, ns).UTC() + // time.RFC3339Nano isn't exactly right (we need to get 3/6/9 fractional digits). + x := t.Format("2006-01-02T15:04:05.000000000") + x = strings.TrimSuffix(x, "000") + x = strings.TrimSuffix(x, "000") + x = strings.TrimSuffix(x, ".000") + out.write(`"`) + out.write(x) + out.write(`Z"`) + return out.err + case "Value": + // Value has a single oneof. + kind := s.Field(0) + if kind.IsNil() { + // "absence of any variant indicates an error" + return errors.New("nil Value") + } + // oneof -> *T -> T -> T.F + x := kind.Elem().Elem().Field(0) + // TODO: pass the correct Properties if needed. + return m.marshalValue(out, &proto.Properties{}, x, indent) + } + } + + out.write("{") + if m.Indent != "" { + out.write("\n") + } + + firstField := true + + if typeURL != "" { + if err := m.marshalTypeURL(out, indent, typeURL); err != nil { + return err + } + firstField = false + } + + for i := 0; i < s.NumField(); i++ { + value := s.Field(i) + valueField := s.Type().Field(i) + if strings.HasPrefix(valueField.Name, "XXX_") { + continue + } + + //this is not a protobuf field + if valueField.Tag.Get("protobuf") == "" && valueField.Tag.Get("protobuf_oneof") == "" { + continue + } + + // IsNil will panic on most value kinds. + switch value.Kind() { + case reflect.Chan, reflect.Func, reflect.Interface: + if value.IsNil() { + continue + } + } + + if !m.EmitDefaults { + switch value.Kind() { + case reflect.Bool: + if !value.Bool() { + continue + } + case reflect.Int32, reflect.Int64: + if value.Int() == 0 { + continue + } + case reflect.Uint32, reflect.Uint64: + if value.Uint() == 0 { + continue + } + case reflect.Float32, reflect.Float64: + if value.Float() == 0 { + continue + } + case reflect.String: + if value.Len() == 0 { + continue + } + case reflect.Map, reflect.Ptr, reflect.Slice: + if value.IsNil() { + continue + } + } + } + + // Oneof fields need special handling. + if valueField.Tag.Get("protobuf_oneof") != "" { + // value is an interface containing &T{real_value}. + sv := value.Elem().Elem() // interface -> *T -> T + value = sv.Field(0) + valueField = sv.Type().Field(0) + } + prop := jsonProperties(valueField, m.OrigName) + if !firstField { + m.writeSep(out) + } + // If the map value is a cast type, it may not implement proto.Message, therefore + // allow the struct tag to declare the underlying message type. Instead of changing + // the signatures of the child types (and because prop.mvalue is not public), use + // CustomType as a passer. + if value.Kind() == reflect.Map { + if tag := valueField.Tag.Get("protobuf"); tag != "" { + for _, v := range strings.Split(tag, ",") { + if !strings.HasPrefix(v, "castvaluetype=") { + continue + } + v = strings.TrimPrefix(v, "castvaluetype=") + prop.CustomType = v + break + } + } + } + if err := m.marshalField(out, prop, value, indent); err != nil { + return err + } + firstField = false + } + + // Handle proto2 extensions. + if ep, ok := v.(proto.Message); ok { + extensions := proto.RegisteredExtensions(v) + // Sort extensions for stable output. + ids := make([]int32, 0, len(extensions)) + for id, desc := range extensions { + if !proto.HasExtension(ep, desc) { + continue + } + ids = append(ids, id) + } + sort.Sort(int32Slice(ids)) + for _, id := range ids { + desc := extensions[id] + if desc == nil { + // unknown extension + continue + } + ext, extErr := proto.GetExtension(ep, desc) + if extErr != nil { + return extErr + } + value := reflect.ValueOf(ext) + var prop proto.Properties + prop.Parse(desc.Tag) + prop.JSONName = fmt.Sprintf("[%s]", desc.Name) + if !firstField { + m.writeSep(out) + } + if err := m.marshalField(out, &prop, value, indent); err != nil { + return err + } + firstField = false + } + + } + + if m.Indent != "" { + out.write("\n") + out.write(indent) + } + out.write("}") + return out.err +} + +func (m *Marshaler) writeSep(out *errWriter) { + if m.Indent != "" { + out.write(",\n") + } else { + out.write(",") + } +} + +func (m *Marshaler) marshalAny(out *errWriter, any proto.Message, indent string) error { + // "If the Any contains a value that has a special JSON mapping, + // it will be converted as follows: {"@type": xxx, "value": yyy}. + // Otherwise, the value will be converted into a JSON object, + // and the "@type" field will be inserted to indicate the actual data type." + v := reflect.ValueOf(any).Elem() + turl := v.Field(0).String() + val := v.Field(1).Bytes() + + var msg proto.Message + var err error + if m.AnyResolver != nil { + msg, err = m.AnyResolver.Resolve(turl) + } else { + msg, err = defaultResolveAny(turl) + } + if err != nil { + return err + } + + if err := proto.Unmarshal(val, msg); err != nil { + return err + } + + if _, ok := msg.(isWkt); ok { + out.write("{") + if m.Indent != "" { + out.write("\n") + } + if err := m.marshalTypeURL(out, indent, turl); err != nil { + return err + } + m.writeSep(out) + if m.Indent != "" { + out.write(indent) + out.write(m.Indent) + out.write(`"value": `) + } else { + out.write(`"value":`) + } + if err := m.marshalObject(out, msg, indent+m.Indent, ""); err != nil { + return err + } + if m.Indent != "" { + out.write("\n") + out.write(indent) + } + out.write("}") + return out.err + } + + return m.marshalObject(out, msg, indent, turl) +} + +func (m *Marshaler) marshalTypeURL(out *errWriter, indent, typeURL string) error { + if m.Indent != "" { + out.write(indent) + out.write(m.Indent) + } + out.write(`"@type":`) + if m.Indent != "" { + out.write(" ") + } + b, err := json.Marshal(typeURL) + if err != nil { + return err + } + out.write(string(b)) + return out.err +} + +// marshalField writes field description and value to the Writer. +func (m *Marshaler) marshalField(out *errWriter, prop *proto.Properties, v reflect.Value, indent string) error { + if m.Indent != "" { + out.write(indent) + out.write(m.Indent) + } + out.write(`"`) + out.write(prop.JSONName) + out.write(`":`) + if m.Indent != "" { + out.write(" ") + } + if err := m.marshalValue(out, prop, v, indent); err != nil { + return err + } + return nil +} + +// marshalValue writes the value to the Writer. +func (m *Marshaler) marshalValue(out *errWriter, prop *proto.Properties, v reflect.Value, indent string) error { + + v = reflect.Indirect(v) + + // Handle nil pointer + if v.Kind() == reflect.Invalid { + out.write("null") + return out.err + } + + // Handle repeated elements. + if v.Kind() == reflect.Slice && v.Type().Elem().Kind() != reflect.Uint8 { + out.write("[") + comma := "" + for i := 0; i < v.Len(); i++ { + sliceVal := v.Index(i) + out.write(comma) + if m.Indent != "" { + out.write("\n") + out.write(indent) + out.write(m.Indent) + out.write(m.Indent) + } + if err := m.marshalValue(out, prop, sliceVal, indent+m.Indent); err != nil { + return err + } + comma = "," + } + if m.Indent != "" { + out.write("\n") + out.write(indent) + out.write(m.Indent) + } + out.write("]") + return out.err + } + + // Handle well-known types. + // Most are handled up in marshalObject (because 99% are messages). + if wkt, ok := v.Interface().(isWkt); ok { + switch wkt.XXX_WellKnownType() { + case "NullValue": + out.write("null") + return out.err + } + } + + if t, ok := v.Interface().(time.Time); ok { + ts, err := types.TimestampProto(t) + if err != nil { + return err + } + return m.marshalValue(out, prop, reflect.ValueOf(ts), indent) + } + + if d, ok := v.Interface().(time.Duration); ok { + dur := types.DurationProto(d) + return m.marshalValue(out, prop, reflect.ValueOf(dur), indent) + } + + // Handle enumerations. + if !m.EnumsAsInts && prop.Enum != "" { + // Unknown enum values will are stringified by the proto library as their + // value. Such values should _not_ be quoted or they will be interpreted + // as an enum string instead of their value. + enumStr := v.Interface().(fmt.Stringer).String() + var valStr string + if v.Kind() == reflect.Ptr { + valStr = strconv.Itoa(int(v.Elem().Int())) + } else { + valStr = strconv.Itoa(int(v.Int())) + } + + if m, ok := v.Interface().(interface { + MarshalJSON() ([]byte, error) + }); ok { + data, err := m.MarshalJSON() + if err != nil { + return err + } + enumStr = string(data) + enumStr, err = strconv.Unquote(enumStr) + if err != nil { + return err + } + } + + isKnownEnum := enumStr != valStr + + if isKnownEnum { + out.write(`"`) + } + out.write(enumStr) + if isKnownEnum { + out.write(`"`) + } + return out.err + } + + // Handle nested messages. + if v.Kind() == reflect.Struct { + i := v + if v.CanAddr() { + i = v.Addr() + } else { + i = reflect.New(v.Type()) + i.Elem().Set(v) + } + iface := i.Interface() + if iface == nil { + out.write(`null`) + return out.err + } + + if m, ok := v.Interface().(interface { + MarshalJSON() ([]byte, error) + }); ok { + data, err := m.MarshalJSON() + if err != nil { + return err + } + out.write(string(data)) + return nil + } + + pm, ok := iface.(proto.Message) + if !ok { + if prop.CustomType == "" { + return fmt.Errorf("%v does not implement proto.Message", v.Type()) + } + t := proto.MessageType(prop.CustomType) + if t == nil || !i.Type().ConvertibleTo(t) { + return fmt.Errorf("%v declared custom type %s but it is not convertible to %v", v.Type(), prop.CustomType, t) + } + pm = i.Convert(t).Interface().(proto.Message) + } + return m.marshalObject(out, pm, indent+m.Indent, "") + } + + // Handle maps. + // Since Go randomizes map iteration, we sort keys for stable output. + if v.Kind() == reflect.Map { + out.write(`{`) + keys := v.MapKeys() + sort.Sort(mapKeys(keys)) + for i, k := range keys { + if i > 0 { + out.write(`,`) + } + if m.Indent != "" { + out.write("\n") + out.write(indent) + out.write(m.Indent) + out.write(m.Indent) + } + + b, err := json.Marshal(k.Interface()) + if err != nil { + return err + } + s := string(b) + + // If the JSON is not a string value, encode it again to make it one. + if !strings.HasPrefix(s, `"`) { + b, err := json.Marshal(s) + if err != nil { + return err + } + s = string(b) + } + + out.write(s) + out.write(`:`) + if m.Indent != "" { + out.write(` `) + } + + if err := m.marshalValue(out, prop, v.MapIndex(k), indent+m.Indent); err != nil { + return err + } + } + if m.Indent != "" { + out.write("\n") + out.write(indent) + out.write(m.Indent) + } + out.write(`}`) + return out.err + } + + // Handle non-finite floats, e.g. NaN, Infinity and -Infinity. + if v.Kind() == reflect.Float32 || v.Kind() == reflect.Float64 { + f := v.Float() + var sval string + switch { + case math.IsInf(f, 1): + sval = `"Infinity"` + case math.IsInf(f, -1): + sval = `"-Infinity"` + case math.IsNaN(f): + sval = `"NaN"` + } + if sval != "" { + out.write(sval) + return out.err + } + } + + // Default handling defers to the encoding/json library. + b, err := json.Marshal(v.Interface()) + if err != nil { + return err + } + needToQuote := string(b[0]) != `"` && (v.Kind() == reflect.Int64 || v.Kind() == reflect.Uint64) + if needToQuote { + out.write(`"`) + } + out.write(string(b)) + if needToQuote { + out.write(`"`) + } + return out.err +} + +// Unmarshaler is a configurable object for converting from a JSON +// representation to a protocol buffer object. +type Unmarshaler struct { + // Whether to allow messages to contain unknown fields, as opposed to + // failing to unmarshal. + AllowUnknownFields bool + + // A custom URL resolver to use when unmarshaling Any messages from JSON. + // If unset, the default resolution strategy is to extract the + // fully-qualified type name from the type URL and pass that to + // proto.MessageType(string). + AnyResolver AnyResolver +} + +// UnmarshalNext unmarshals the next protocol buffer from a JSON object stream. +// This function is lenient and will decode any options permutations of the +// related Marshaler. +func (u *Unmarshaler) UnmarshalNext(dec *json.Decoder, pb proto.Message) error { + inputValue := json.RawMessage{} + if err := dec.Decode(&inputValue); err != nil { + return err + } + if err := u.unmarshalValue(reflect.ValueOf(pb).Elem(), inputValue, nil); err != nil { + return err + } + return checkRequiredFields(pb) +} + +// Unmarshal unmarshals a JSON object stream into a protocol +// buffer. This function is lenient and will decode any options +// permutations of the related Marshaler. +func (u *Unmarshaler) Unmarshal(r io.Reader, pb proto.Message) error { + dec := json.NewDecoder(r) + return u.UnmarshalNext(dec, pb) +} + +// UnmarshalNext unmarshals the next protocol buffer from a JSON object stream. +// This function is lenient and will decode any options permutations of the +// related Marshaler. +func UnmarshalNext(dec *json.Decoder, pb proto.Message) error { + return new(Unmarshaler).UnmarshalNext(dec, pb) +} + +// Unmarshal unmarshals a JSON object stream into a protocol +// buffer. This function is lenient and will decode any options +// permutations of the related Marshaler. +func Unmarshal(r io.Reader, pb proto.Message) error { + return new(Unmarshaler).Unmarshal(r, pb) +} + +// UnmarshalString will populate the fields of a protocol buffer based +// on a JSON string. This function is lenient and will decode any options +// permutations of the related Marshaler. +func UnmarshalString(str string, pb proto.Message) error { + return new(Unmarshaler).Unmarshal(strings.NewReader(str), pb) +} + +// unmarshalValue converts/copies a value into the target. +// prop may be nil. +func (u *Unmarshaler) unmarshalValue(target reflect.Value, inputValue json.RawMessage, prop *proto.Properties) error { + targetType := target.Type() + + // Allocate memory for pointer fields. + if targetType.Kind() == reflect.Ptr { + // If input value is "null" and target is a pointer type, then the field should be treated as not set + // UNLESS the target is structpb.Value, in which case it should be set to structpb.NullValue. + _, isJSONPBUnmarshaler := target.Interface().(JSONPBUnmarshaler) + if string(inputValue) == "null" && targetType != reflect.TypeOf(&types.Value{}) && !isJSONPBUnmarshaler { + return nil + } + target.Set(reflect.New(targetType.Elem())) + + return u.unmarshalValue(target.Elem(), inputValue, prop) + } + + if jsu, ok := target.Addr().Interface().(JSONPBUnmarshaler); ok { + return jsu.UnmarshalJSONPB(u, []byte(inputValue)) + } + + // Handle well-known types that are not pointers. + if w, ok := target.Addr().Interface().(isWkt); ok { + switch w.XXX_WellKnownType() { + case "DoubleValue", "FloatValue", "Int64Value", "UInt64Value", + "Int32Value", "UInt32Value", "BoolValue", "StringValue", "BytesValue": + return u.unmarshalValue(target.Field(0), inputValue, prop) + case "Any": + // Use json.RawMessage pointer type instead of value to support pre-1.8 version. + // 1.8 changed RawMessage.MarshalJSON from pointer type to value type, see + // https://github.com/golang/go/issues/14493 + var jsonFields map[string]*json.RawMessage + if err := json.Unmarshal(inputValue, &jsonFields); err != nil { + return err + } + + val, ok := jsonFields["@type"] + if !ok || val == nil { + return errors.New("Any JSON doesn't have '@type'") + } + + var turl string + if err := json.Unmarshal([]byte(*val), &turl); err != nil { + return fmt.Errorf("can't unmarshal Any's '@type': %q", *val) + } + target.Field(0).SetString(turl) + + var m proto.Message + var err error + if u.AnyResolver != nil { + m, err = u.AnyResolver.Resolve(turl) + } else { + m, err = defaultResolveAny(turl) + } + if err != nil { + return err + } + + if _, ok := m.(isWkt); ok { + val, ok := jsonFields["value"] + if !ok { + return errors.New("Any JSON doesn't have 'value'") + } + + if err = u.unmarshalValue(reflect.ValueOf(m).Elem(), *val, nil); err != nil { + return fmt.Errorf("can't unmarshal Any nested proto %T: %v", m, err) + } + } else { + delete(jsonFields, "@type") + nestedProto, uerr := json.Marshal(jsonFields) + if uerr != nil { + return fmt.Errorf("can't generate JSON for Any's nested proto to be unmarshaled: %v", uerr) + } + + if err = u.unmarshalValue(reflect.ValueOf(m).Elem(), nestedProto, nil); err != nil { + return fmt.Errorf("can't unmarshal Any nested proto %T: %v", m, err) + } + } + + b, err := proto.Marshal(m) + if err != nil { + return fmt.Errorf("can't marshal proto %T into Any.Value: %v", m, err) + } + target.Field(1).SetBytes(b) + + return nil + case "Duration": + unq, err := unquote(string(inputValue)) + if err != nil { + return err + } + + d, err := time.ParseDuration(unq) + if err != nil { + return fmt.Errorf("bad Duration: %v", err) + } + + ns := d.Nanoseconds() + s := ns / 1e9 + ns %= 1e9 + target.Field(0).SetInt(s) + target.Field(1).SetInt(ns) + return nil + case "Timestamp": + unq, err := unquote(string(inputValue)) + if err != nil { + return err + } + + t, err := time.Parse(time.RFC3339Nano, unq) + if err != nil { + return fmt.Errorf("bad Timestamp: %v", err) + } + + target.Field(0).SetInt(t.Unix()) + target.Field(1).SetInt(int64(t.Nanosecond())) + return nil + case "Struct": + var m map[string]json.RawMessage + if err := json.Unmarshal(inputValue, &m); err != nil { + return fmt.Errorf("bad StructValue: %v", err) + } + target.Field(0).Set(reflect.ValueOf(map[string]*types.Value{})) + for k, jv := range m { + pv := &types.Value{} + if err := u.unmarshalValue(reflect.ValueOf(pv).Elem(), jv, prop); err != nil { + return fmt.Errorf("bad value in StructValue for key %q: %v", k, err) + } + target.Field(0).SetMapIndex(reflect.ValueOf(k), reflect.ValueOf(pv)) + } + return nil + case "ListValue": + var s []json.RawMessage + if err := json.Unmarshal(inputValue, &s); err != nil { + return fmt.Errorf("bad ListValue: %v", err) + } + + target.Field(0).Set(reflect.ValueOf(make([]*types.Value, len(s)))) + for i, sv := range s { + if err := u.unmarshalValue(target.Field(0).Index(i), sv, prop); err != nil { + return err + } + } + return nil + case "Value": + ivStr := string(inputValue) + if ivStr == "null" { + target.Field(0).Set(reflect.ValueOf(&types.Value_NullValue{})) + } else if v, err := strconv.ParseFloat(ivStr, 0); err == nil { + target.Field(0).Set(reflect.ValueOf(&types.Value_NumberValue{NumberValue: v})) + } else if v, err := unquote(ivStr); err == nil { + target.Field(0).Set(reflect.ValueOf(&types.Value_StringValue{StringValue: v})) + } else if v, err := strconv.ParseBool(ivStr); err == nil { + target.Field(0).Set(reflect.ValueOf(&types.Value_BoolValue{BoolValue: v})) + } else if err := json.Unmarshal(inputValue, &[]json.RawMessage{}); err == nil { + lv := &types.ListValue{} + target.Field(0).Set(reflect.ValueOf(&types.Value_ListValue{ListValue: lv})) + return u.unmarshalValue(reflect.ValueOf(lv).Elem(), inputValue, prop) + } else if err := json.Unmarshal(inputValue, &map[string]json.RawMessage{}); err == nil { + sv := &types.Struct{} + target.Field(0).Set(reflect.ValueOf(&types.Value_StructValue{StructValue: sv})) + return u.unmarshalValue(reflect.ValueOf(sv).Elem(), inputValue, prop) + } else { + return fmt.Errorf("unrecognized type for Value %q", ivStr) + } + return nil + } + } + + if t, ok := target.Addr().Interface().(*time.Time); ok { + ts := &types.Timestamp{} + if err := u.unmarshalValue(reflect.ValueOf(ts).Elem(), inputValue, prop); err != nil { + return err + } + tt, err := types.TimestampFromProto(ts) + if err != nil { + return err + } + *t = tt + return nil + } + + if d, ok := target.Addr().Interface().(*time.Duration); ok { + dur := &types.Duration{} + if err := u.unmarshalValue(reflect.ValueOf(dur).Elem(), inputValue, prop); err != nil { + return err + } + dd, err := types.DurationFromProto(dur) + if err != nil { + return err + } + *d = dd + return nil + } + + // Handle enums, which have an underlying type of int32, + // and may appear as strings. + // The case of an enum appearing as a number is handled + // at the bottom of this function. + if inputValue[0] == '"' && prop != nil && prop.Enum != "" { + vmap := proto.EnumValueMap(prop.Enum) + // Don't need to do unquoting; valid enum names + // are from a limited character set. + s := inputValue[1 : len(inputValue)-1] + n, ok := vmap[string(s)] + if !ok { + return fmt.Errorf("unknown value %q for enum %s", s, prop.Enum) + } + if target.Kind() == reflect.Ptr { // proto2 + target.Set(reflect.New(targetType.Elem())) + target = target.Elem() + } + target.SetInt(int64(n)) + return nil + } + + // Handle nested messages. + if targetType.Kind() == reflect.Struct { + if prop != nil && len(prop.CustomType) > 0 && target.CanAddr() { + if m, ok := target.Addr().Interface().(interface { + UnmarshalJSON([]byte) error + }); ok { + return json.Unmarshal(inputValue, m) + } + } + + var jsonFields map[string]json.RawMessage + if err := json.Unmarshal(inputValue, &jsonFields); err != nil { + return err + } + + consumeField := func(prop *proto.Properties) (json.RawMessage, bool) { + // Be liberal in what names we accept; both orig_name and camelName are okay. + fieldNames := acceptedJSONFieldNames(prop) + + vOrig, okOrig := jsonFields[fieldNames.orig] + vCamel, okCamel := jsonFields[fieldNames.camel] + if !okOrig && !okCamel { + return nil, false + } + // If, for some reason, both are present in the data, favour the camelName. + var raw json.RawMessage + if okOrig { + raw = vOrig + delete(jsonFields, fieldNames.orig) + } + if okCamel { + raw = vCamel + delete(jsonFields, fieldNames.camel) + } + return raw, true + } + + sprops := proto.GetProperties(targetType) + for i := 0; i < target.NumField(); i++ { + ft := target.Type().Field(i) + if strings.HasPrefix(ft.Name, "XXX_") { + continue + } + valueForField, ok := consumeField(sprops.Prop[i]) + if !ok { + continue + } + + if err := u.unmarshalValue(target.Field(i), valueForField, sprops.Prop[i]); err != nil { + return err + } + } + // Check for any oneof fields. + if len(jsonFields) > 0 { + for _, oop := range sprops.OneofTypes { + raw, ok := consumeField(oop.Prop) + if !ok { + continue + } + nv := reflect.New(oop.Type.Elem()) + target.Field(oop.Field).Set(nv) + if err := u.unmarshalValue(nv.Elem().Field(0), raw, oop.Prop); err != nil { + return err + } + } + } + // Handle proto2 extensions. + if len(jsonFields) > 0 { + if ep, ok := target.Addr().Interface().(proto.Message); ok { + for _, ext := range proto.RegisteredExtensions(ep) { + name := fmt.Sprintf("[%s]", ext.Name) + raw, ok := jsonFields[name] + if !ok { + continue + } + delete(jsonFields, name) + nv := reflect.New(reflect.TypeOf(ext.ExtensionType).Elem()) + if err := u.unmarshalValue(nv.Elem(), raw, nil); err != nil { + return err + } + if err := proto.SetExtension(ep, ext, nv.Interface()); err != nil { + return err + } + } + } + } + if !u.AllowUnknownFields && len(jsonFields) > 0 { + // Pick any field to be the scapegoat. + var f string + for fname := range jsonFields { + f = fname + break + } + return fmt.Errorf("unknown field %q in %v", f, targetType) + } + return nil + } + + // Handle arrays + if targetType.Kind() == reflect.Slice { + if targetType.Elem().Kind() == reflect.Uint8 { + outRef := reflect.New(targetType) + outVal := outRef.Interface() + //CustomType with underlying type []byte + if _, ok := outVal.(interface { + UnmarshalJSON([]byte) error + }); ok { + if err := json.Unmarshal(inputValue, outVal); err != nil { + return err + } + target.Set(outRef.Elem()) + return nil + } + // Special case for encoded bytes. Pre-go1.5 doesn't support unmarshalling + // strings into aliased []byte types. + // https://github.com/golang/go/commit/4302fd0409da5e4f1d71471a6770dacdc3301197 + // https://github.com/golang/go/commit/c60707b14d6be26bf4213114d13070bff00d0b0a + var out []byte + if err := json.Unmarshal(inputValue, &out); err != nil { + return err + } + target.SetBytes(out) + return nil + } + + var slc []json.RawMessage + if err := json.Unmarshal(inputValue, &slc); err != nil { + return err + } + if slc != nil { + l := len(slc) + target.Set(reflect.MakeSlice(targetType, l, l)) + for i := 0; i < l; i++ { + if err := u.unmarshalValue(target.Index(i), slc[i], prop); err != nil { + return err + } + } + } + return nil + } + + // Handle maps (whose keys are always strings) + if targetType.Kind() == reflect.Map { + var mp map[string]json.RawMessage + if err := json.Unmarshal(inputValue, &mp); err != nil { + return err + } + if mp != nil { + target.Set(reflect.MakeMap(targetType)) + for ks, raw := range mp { + // Unmarshal map key. The core json library already decoded the key into a + // string, so we handle that specially. Other types were quoted post-serialization. + var k reflect.Value + if targetType.Key().Kind() == reflect.String { + k = reflect.ValueOf(ks) + } else { + k = reflect.New(targetType.Key()).Elem() + // TODO: pass the correct Properties if needed. + if err := u.unmarshalValue(k, json.RawMessage(ks), nil); err != nil { + return err + } + } + + if !k.Type().AssignableTo(targetType.Key()) { + k = k.Convert(targetType.Key()) + } + + // Unmarshal map value. + v := reflect.New(targetType.Elem()).Elem() + // TODO: pass the correct Properties if needed. + if err := u.unmarshalValue(v, raw, nil); err != nil { + return err + } + target.SetMapIndex(k, v) + } + } + return nil + } + + // 64-bit integers can be encoded as strings. In this case we drop + // the quotes and proceed as normal. + isNum := targetType.Kind() == reflect.Int64 || targetType.Kind() == reflect.Uint64 + if isNum && strings.HasPrefix(string(inputValue), `"`) { + inputValue = inputValue[1 : len(inputValue)-1] + } + + // Non-finite numbers can be encoded as strings. + isFloat := targetType.Kind() == reflect.Float32 || targetType.Kind() == reflect.Float64 + if isFloat { + if num, ok := nonFinite[string(inputValue)]; ok { + target.SetFloat(num) + return nil + } + } + + // Use the encoding/json for parsing other value types. + return json.Unmarshal(inputValue, target.Addr().Interface()) +} + +func unquote(s string) (string, error) { + var ret string + err := json.Unmarshal([]byte(s), &ret) + return ret, err +} + +// jsonProperties returns parsed proto.Properties for the field and corrects JSONName attribute. +func jsonProperties(f reflect.StructField, origName bool) *proto.Properties { + var prop proto.Properties + prop.Init(f.Type, f.Name, f.Tag.Get("protobuf"), &f) + if origName || prop.JSONName == "" { + prop.JSONName = prop.OrigName + } + return &prop +} + +type fieldNames struct { + orig, camel string +} + +func acceptedJSONFieldNames(prop *proto.Properties) fieldNames { + opts := fieldNames{orig: prop.OrigName, camel: prop.OrigName} + if prop.JSONName != "" { + opts.camel = prop.JSONName + } + return opts +} + +// Writer wrapper inspired by https://blog.golang.org/errors-are-values +type errWriter struct { + writer io.Writer + err error +} + +func (w *errWriter) write(str string) { + if w.err != nil { + return + } + _, w.err = w.writer.Write([]byte(str)) +} + +// Map fields may have key types of non-float scalars, strings and enums. +// The easiest way to sort them in some deterministic order is to use fmt. +// If this turns out to be inefficient we can always consider other options, +// such as doing a Schwartzian transform. +// +// Numeric keys are sorted in numeric order per +// https://developers.google.com/protocol-buffers/docs/proto#maps. +type mapKeys []reflect.Value + +func (s mapKeys) Len() int { return len(s) } +func (s mapKeys) Swap(i, j int) { s[i], s[j] = s[j], s[i] } +func (s mapKeys) Less(i, j int) bool { + if k := s[i].Kind(); k == s[j].Kind() { + switch k { + case reflect.Int32, reflect.Int64: + return s[i].Int() < s[j].Int() + case reflect.Uint32, reflect.Uint64: + return s[i].Uint() < s[j].Uint() + } + } + return fmt.Sprint(s[i].Interface()) < fmt.Sprint(s[j].Interface()) +} + +// checkRequiredFields returns an error if any required field in the given proto message is not set. +// This function is used by both Marshal and Unmarshal. While required fields only exist in a +// proto2 message, a proto3 message can contain proto2 message(s). +func checkRequiredFields(pb proto.Message) error { + // Most well-known type messages do not contain required fields. The "Any" type may contain + // a message that has required fields. + // + // When an Any message is being marshaled, the code will invoked proto.Unmarshal on Any.Value + // field in order to transform that into JSON, and that should have returned an error if a + // required field is not set in the embedded message. + // + // When an Any message is being unmarshaled, the code will have invoked proto.Marshal on the + // embedded message to store the serialized message in Any.Value field, and that should have + // returned an error if a required field is not set. + if _, ok := pb.(isWkt); ok { + return nil + } + + v := reflect.ValueOf(pb) + // Skip message if it is not a struct pointer. + if v.Kind() != reflect.Ptr { + return nil + } + v = v.Elem() + if v.Kind() != reflect.Struct { + return nil + } + + for i := 0; i < v.NumField(); i++ { + field := v.Field(i) + sfield := v.Type().Field(i) + + if sfield.PkgPath != "" { + // blank PkgPath means the field is exported; skip if not exported + continue + } + + if strings.HasPrefix(sfield.Name, "XXX_") { + continue + } + + // Oneof field is an interface implemented by wrapper structs containing the actual oneof + // field, i.e. an interface containing &T{real_value}. + if sfield.Tag.Get("protobuf_oneof") != "" { + if field.Kind() != reflect.Interface { + continue + } + v := field.Elem() + if v.Kind() != reflect.Ptr || v.IsNil() { + continue + } + v = v.Elem() + if v.Kind() != reflect.Struct || v.NumField() < 1 { + continue + } + field = v.Field(0) + sfield = v.Type().Field(0) + } + + protoTag := sfield.Tag.Get("protobuf") + if protoTag == "" { + continue + } + var prop proto.Properties + prop.Init(sfield.Type, sfield.Name, protoTag, &sfield) + + switch field.Kind() { + case reflect.Map: + if field.IsNil() { + continue + } + // Check each map value. + keys := field.MapKeys() + for _, k := range keys { + v := field.MapIndex(k) + if err := checkRequiredFieldsInValue(v); err != nil { + return err + } + } + case reflect.Slice: + // Handle non-repeated type, e.g. bytes. + if !prop.Repeated { + if prop.Required && field.IsNil() { + return fmt.Errorf("required field %q is not set", prop.Name) + } + continue + } + + // Handle repeated type. + if field.IsNil() { + continue + } + // Check each slice item. + for i := 0; i < field.Len(); i++ { + v := field.Index(i) + if err := checkRequiredFieldsInValue(v); err != nil { + return err + } + } + case reflect.Ptr: + if field.IsNil() { + if prop.Required { + return fmt.Errorf("required field %q is not set", prop.Name) + } + continue + } + if err := checkRequiredFieldsInValue(field); err != nil { + return err + } + } + } + + // Handle proto2 extensions. + for _, ext := range proto.RegisteredExtensions(pb) { + if !proto.HasExtension(pb, ext) { + continue + } + ep, err := proto.GetExtension(pb, ext) + if err != nil { + return err + } + err = checkRequiredFieldsInValue(reflect.ValueOf(ep)) + if err != nil { + return err + } + } + + return nil +} + +func checkRequiredFieldsInValue(v reflect.Value) error { + if pm, ok := v.Interface().(proto.Message); ok { + return checkRequiredFields(pm) + } + return nil +} diff --git a/vendor/github.com/gogo/protobuf/proto/Makefile b/vendor/github.com/gogo/protobuf/proto/Makefile new file mode 100644 index 000000000000..00d65f327732 --- /dev/null +++ b/vendor/github.com/gogo/protobuf/proto/Makefile @@ -0,0 +1,43 @@ +# Go support for Protocol Buffers - Google's data interchange format +# +# Copyright 2010 The Go Authors. All rights reserved. +# https://github.com/golang/protobuf +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +install: + go install + +test: install generate-test-pbs + go test + + +generate-test-pbs: + make install + make -C test_proto + make -C proto3_proto + make diff --git a/vendor/github.com/gogo/protobuf/proto/clone.go b/vendor/github.com/gogo/protobuf/proto/clone.go new file mode 100644 index 000000000000..a26b046d94f1 --- /dev/null +++ b/vendor/github.com/gogo/protobuf/proto/clone.go @@ -0,0 +1,258 @@ +// Go support for Protocol Buffers - Google's data interchange format +// +// Copyright 2011 The Go Authors. All rights reserved. +// https://github.com/golang/protobuf +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// Protocol buffer deep copy and merge. +// TODO: RawMessage. + +package proto + +import ( + "fmt" + "log" + "reflect" + "strings" +) + +// Clone returns a deep copy of a protocol buffer. +func Clone(src Message) Message { + in := reflect.ValueOf(src) + if in.IsNil() { + return src + } + out := reflect.New(in.Type().Elem()) + dst := out.Interface().(Message) + Merge(dst, src) + return dst +} + +// Merger is the interface representing objects that can merge messages of the same type. +type Merger interface { + // Merge merges src into this message. + // Required and optional fields that are set in src will be set to that value in dst. + // Elements of repeated fields will be appended. + // + // Merge may panic if called with a different argument type than the receiver. + Merge(src Message) +} + +// generatedMerger is the custom merge method that generated protos will have. +// We must add this method since a generate Merge method will conflict with +// many existing protos that have a Merge data field already defined. +type generatedMerger interface { + XXX_Merge(src Message) +} + +// Merge merges src into dst. +// Required and optional fields that are set in src will be set to that value in dst. +// Elements of repeated fields will be appended. +// Merge panics if src and dst are not the same type, or if dst is nil. +func Merge(dst, src Message) { + if m, ok := dst.(Merger); ok { + m.Merge(src) + return + } + + in := reflect.ValueOf(src) + out := reflect.ValueOf(dst) + if out.IsNil() { + panic("proto: nil destination") + } + if in.Type() != out.Type() { + panic(fmt.Sprintf("proto.Merge(%T, %T) type mismatch", dst, src)) + } + if in.IsNil() { + return // Merge from nil src is a noop + } + if m, ok := dst.(generatedMerger); ok { + m.XXX_Merge(src) + return + } + mergeStruct(out.Elem(), in.Elem()) +} + +func mergeStruct(out, in reflect.Value) { + sprop := GetProperties(in.Type()) + for i := 0; i < in.NumField(); i++ { + f := in.Type().Field(i) + if strings.HasPrefix(f.Name, "XXX_") { + continue + } + mergeAny(out.Field(i), in.Field(i), false, sprop.Prop[i]) + } + + if emIn, ok := in.Addr().Interface().(extensionsBytes); ok { + emOut := out.Addr().Interface().(extensionsBytes) + bIn := emIn.GetExtensions() + bOut := emOut.GetExtensions() + *bOut = append(*bOut, *bIn...) + } else if emIn, err := extendable(in.Addr().Interface()); err == nil { + emOut, _ := extendable(out.Addr().Interface()) + mIn, muIn := emIn.extensionsRead() + if mIn != nil { + mOut := emOut.extensionsWrite() + muIn.Lock() + mergeExtension(mOut, mIn) + muIn.Unlock() + } + } + + uf := in.FieldByName("XXX_unrecognized") + if !uf.IsValid() { + return + } + uin := uf.Bytes() + if len(uin) > 0 { + out.FieldByName("XXX_unrecognized").SetBytes(append([]byte(nil), uin...)) + } +} + +// mergeAny performs a merge between two values of the same type. +// viaPtr indicates whether the values were indirected through a pointer (implying proto2). +// prop is set if this is a struct field (it may be nil). +func mergeAny(out, in reflect.Value, viaPtr bool, prop *Properties) { + if in.Type() == protoMessageType { + if !in.IsNil() { + if out.IsNil() { + out.Set(reflect.ValueOf(Clone(in.Interface().(Message)))) + } else { + Merge(out.Interface().(Message), in.Interface().(Message)) + } + } + return + } + switch in.Kind() { + case reflect.Bool, reflect.Float32, reflect.Float64, reflect.Int32, reflect.Int64, + reflect.String, reflect.Uint32, reflect.Uint64: + if !viaPtr && isProto3Zero(in) { + return + } + out.Set(in) + case reflect.Interface: + // Probably a oneof field; copy non-nil values. + if in.IsNil() { + return + } + // Allocate destination if it is not set, or set to a different type. + // Otherwise we will merge as normal. + if out.IsNil() || out.Elem().Type() != in.Elem().Type() { + out.Set(reflect.New(in.Elem().Elem().Type())) // interface -> *T -> T -> new(T) + } + mergeAny(out.Elem(), in.Elem(), false, nil) + case reflect.Map: + if in.Len() == 0 { + return + } + if out.IsNil() { + out.Set(reflect.MakeMap(in.Type())) + } + // For maps with value types of *T or []byte we need to deep copy each value. + elemKind := in.Type().Elem().Kind() + for _, key := range in.MapKeys() { + var val reflect.Value + switch elemKind { + case reflect.Ptr: + val = reflect.New(in.Type().Elem().Elem()) + mergeAny(val, in.MapIndex(key), false, nil) + case reflect.Slice: + val = in.MapIndex(key) + val = reflect.ValueOf(append([]byte{}, val.Bytes()...)) + default: + val = in.MapIndex(key) + } + out.SetMapIndex(key, val) + } + case reflect.Ptr: + if in.IsNil() { + return + } + if out.IsNil() { + out.Set(reflect.New(in.Elem().Type())) + } + mergeAny(out.Elem(), in.Elem(), true, nil) + case reflect.Slice: + if in.IsNil() { + return + } + if in.Type().Elem().Kind() == reflect.Uint8 { + // []byte is a scalar bytes field, not a repeated field. + + // Edge case: if this is in a proto3 message, a zero length + // bytes field is considered the zero value, and should not + // be merged. + if prop != nil && prop.proto3 && in.Len() == 0 { + return + } + + // Make a deep copy. + // Append to []byte{} instead of []byte(nil) so that we never end up + // with a nil result. + out.SetBytes(append([]byte{}, in.Bytes()...)) + return + } + n := in.Len() + if out.IsNil() { + out.Set(reflect.MakeSlice(in.Type(), 0, n)) + } + switch in.Type().Elem().Kind() { + case reflect.Bool, reflect.Float32, reflect.Float64, reflect.Int32, reflect.Int64, + reflect.String, reflect.Uint32, reflect.Uint64: + out.Set(reflect.AppendSlice(out, in)) + default: + for i := 0; i < n; i++ { + x := reflect.Indirect(reflect.New(in.Type().Elem())) + mergeAny(x, in.Index(i), false, nil) + out.Set(reflect.Append(out, x)) + } + } + case reflect.Struct: + mergeStruct(out, in) + default: + // unknown type, so not a protocol buffer + log.Printf("proto: don't know how to copy %v", in) + } +} + +func mergeExtension(out, in map[int32]Extension) { + for extNum, eIn := range in { + eOut := Extension{desc: eIn.desc} + if eIn.value != nil { + v := reflect.New(reflect.TypeOf(eIn.value)).Elem() + mergeAny(v, reflect.ValueOf(eIn.value), false, nil) + eOut.value = v.Interface() + } + if eIn.enc != nil { + eOut.enc = make([]byte, len(eIn.enc)) + copy(eOut.enc, eIn.enc) + } + + out[extNum] = eOut + } +} diff --git a/vendor/github.com/gogo/protobuf/proto/custom_gogo.go b/vendor/github.com/gogo/protobuf/proto/custom_gogo.go new file mode 100644 index 000000000000..24552483c6ce --- /dev/null +++ b/vendor/github.com/gogo/protobuf/proto/custom_gogo.go @@ -0,0 +1,39 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2018, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +package proto + +import "reflect" + +type custom interface { + Marshal() ([]byte, error) + Unmarshal(data []byte) error + Size() int +} + +var customType = reflect.TypeOf((*custom)(nil)).Elem() diff --git a/vendor/github.com/gogo/protobuf/proto/decode.go b/vendor/github.com/gogo/protobuf/proto/decode.go new file mode 100644 index 000000000000..d9aa3c42d666 --- /dev/null +++ b/vendor/github.com/gogo/protobuf/proto/decode.go @@ -0,0 +1,428 @@ +// Go support for Protocol Buffers - Google's data interchange format +// +// Copyright 2010 The Go Authors. All rights reserved. +// https://github.com/golang/protobuf +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +package proto + +/* + * Routines for decoding protocol buffer data to construct in-memory representations. + */ + +import ( + "errors" + "fmt" + "io" +) + +// errOverflow is returned when an integer is too large to be represented. +var errOverflow = errors.New("proto: integer overflow") + +// ErrInternalBadWireType is returned by generated code when an incorrect +// wire type is encountered. It does not get returned to user code. +var ErrInternalBadWireType = errors.New("proto: internal error: bad wiretype for oneof") + +// DecodeVarint reads a varint-encoded integer from the slice. +// It returns the integer and the number of bytes consumed, or +// zero if there is not enough. +// This is the format for the +// int32, int64, uint32, uint64, bool, and enum +// protocol buffer types. +func DecodeVarint(buf []byte) (x uint64, n int) { + for shift := uint(0); shift < 64; shift += 7 { + if n >= len(buf) { + return 0, 0 + } + b := uint64(buf[n]) + n++ + x |= (b & 0x7F) << shift + if (b & 0x80) == 0 { + return x, n + } + } + + // The number is too large to represent in a 64-bit value. + return 0, 0 +} + +func (p *Buffer) decodeVarintSlow() (x uint64, err error) { + i := p.index + l := len(p.buf) + + for shift := uint(0); shift < 64; shift += 7 { + if i >= l { + err = io.ErrUnexpectedEOF + return + } + b := p.buf[i] + i++ + x |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + p.index = i + return + } + } + + // The number is too large to represent in a 64-bit value. + err = errOverflow + return +} + +// DecodeVarint reads a varint-encoded integer from the Buffer. +// This is the format for the +// int32, int64, uint32, uint64, bool, and enum +// protocol buffer types. +func (p *Buffer) DecodeVarint() (x uint64, err error) { + i := p.index + buf := p.buf + + if i >= len(buf) { + return 0, io.ErrUnexpectedEOF + } else if buf[i] < 0x80 { + p.index++ + return uint64(buf[i]), nil + } else if len(buf)-i < 10 { + return p.decodeVarintSlow() + } + + var b uint64 + // we already checked the first byte + x = uint64(buf[i]) - 0x80 + i++ + + b = uint64(buf[i]) + i++ + x += b << 7 + if b&0x80 == 0 { + goto done + } + x -= 0x80 << 7 + + b = uint64(buf[i]) + i++ + x += b << 14 + if b&0x80 == 0 { + goto done + } + x -= 0x80 << 14 + + b = uint64(buf[i]) + i++ + x += b << 21 + if b&0x80 == 0 { + goto done + } + x -= 0x80 << 21 + + b = uint64(buf[i]) + i++ + x += b << 28 + if b&0x80 == 0 { + goto done + } + x -= 0x80 << 28 + + b = uint64(buf[i]) + i++ + x += b << 35 + if b&0x80 == 0 { + goto done + } + x -= 0x80 << 35 + + b = uint64(buf[i]) + i++ + x += b << 42 + if b&0x80 == 0 { + goto done + } + x -= 0x80 << 42 + + b = uint64(buf[i]) + i++ + x += b << 49 + if b&0x80 == 0 { + goto done + } + x -= 0x80 << 49 + + b = uint64(buf[i]) + i++ + x += b << 56 + if b&0x80 == 0 { + goto done + } + x -= 0x80 << 56 + + b = uint64(buf[i]) + i++ + x += b << 63 + if b&0x80 == 0 { + goto done + } + // x -= 0x80 << 63 // Always zero. + + return 0, errOverflow + +done: + p.index = i + return x, nil +} + +// DecodeFixed64 reads a 64-bit integer from the Buffer. +// This is the format for the +// fixed64, sfixed64, and double protocol buffer types. +func (p *Buffer) DecodeFixed64() (x uint64, err error) { + // x, err already 0 + i := p.index + 8 + if i < 0 || i > len(p.buf) { + err = io.ErrUnexpectedEOF + return + } + p.index = i + + x = uint64(p.buf[i-8]) + x |= uint64(p.buf[i-7]) << 8 + x |= uint64(p.buf[i-6]) << 16 + x |= uint64(p.buf[i-5]) << 24 + x |= uint64(p.buf[i-4]) << 32 + x |= uint64(p.buf[i-3]) << 40 + x |= uint64(p.buf[i-2]) << 48 + x |= uint64(p.buf[i-1]) << 56 + return +} + +// DecodeFixed32 reads a 32-bit integer from the Buffer. +// This is the format for the +// fixed32, sfixed32, and float protocol buffer types. +func (p *Buffer) DecodeFixed32() (x uint64, err error) { + // x, err already 0 + i := p.index + 4 + if i < 0 || i > len(p.buf) { + err = io.ErrUnexpectedEOF + return + } + p.index = i + + x = uint64(p.buf[i-4]) + x |= uint64(p.buf[i-3]) << 8 + x |= uint64(p.buf[i-2]) << 16 + x |= uint64(p.buf[i-1]) << 24 + return +} + +// DecodeZigzag64 reads a zigzag-encoded 64-bit integer +// from the Buffer. +// This is the format used for the sint64 protocol buffer type. +func (p *Buffer) DecodeZigzag64() (x uint64, err error) { + x, err = p.DecodeVarint() + if err != nil { + return + } + x = (x >> 1) ^ uint64((int64(x&1)<<63)>>63) + return +} + +// DecodeZigzag32 reads a zigzag-encoded 32-bit integer +// from the Buffer. +// This is the format used for the sint32 protocol buffer type. +func (p *Buffer) DecodeZigzag32() (x uint64, err error) { + x, err = p.DecodeVarint() + if err != nil { + return + } + x = uint64((uint32(x) >> 1) ^ uint32((int32(x&1)<<31)>>31)) + return +} + +// DecodeRawBytes reads a count-delimited byte buffer from the Buffer. +// This is the format used for the bytes protocol buffer +// type and for embedded messages. +func (p *Buffer) DecodeRawBytes(alloc bool) (buf []byte, err error) { + n, err := p.DecodeVarint() + if err != nil { + return nil, err + } + + nb := int(n) + if nb < 0 { + return nil, fmt.Errorf("proto: bad byte length %d", nb) + } + end := p.index + nb + if end < p.index || end > len(p.buf) { + return nil, io.ErrUnexpectedEOF + } + + if !alloc { + // todo: check if can get more uses of alloc=false + buf = p.buf[p.index:end] + p.index += nb + return + } + + buf = make([]byte, nb) + copy(buf, p.buf[p.index:]) + p.index += nb + return +} + +// DecodeStringBytes reads an encoded string from the Buffer. +// This is the format used for the proto2 string type. +func (p *Buffer) DecodeStringBytes() (s string, err error) { + buf, err := p.DecodeRawBytes(false) + if err != nil { + return + } + return string(buf), nil +} + +// Unmarshaler is the interface representing objects that can +// unmarshal themselves. The argument points to data that may be +// overwritten, so implementations should not keep references to the +// buffer. +// Unmarshal implementations should not clear the receiver. +// Any unmarshaled data should be merged into the receiver. +// Callers of Unmarshal that do not want to retain existing data +// should Reset the receiver before calling Unmarshal. +type Unmarshaler interface { + Unmarshal([]byte) error +} + +// newUnmarshaler is the interface representing objects that can +// unmarshal themselves. The semantics are identical to Unmarshaler. +// +// This exists to support protoc-gen-go generated messages. +// The proto package will stop type-asserting to this interface in the future. +// +// DO NOT DEPEND ON THIS. +type newUnmarshaler interface { + XXX_Unmarshal([]byte) error +} + +// Unmarshal parses the protocol buffer representation in buf and places the +// decoded result in pb. If the struct underlying pb does not match +// the data in buf, the results can be unpredictable. +// +// Unmarshal resets pb before starting to unmarshal, so any +// existing data in pb is always removed. Use UnmarshalMerge +// to preserve and append to existing data. +func Unmarshal(buf []byte, pb Message) error { + pb.Reset() + if u, ok := pb.(newUnmarshaler); ok { + return u.XXX_Unmarshal(buf) + } + if u, ok := pb.(Unmarshaler); ok { + return u.Unmarshal(buf) + } + return NewBuffer(buf).Unmarshal(pb) +} + +// UnmarshalMerge parses the protocol buffer representation in buf and +// writes the decoded result to pb. If the struct underlying pb does not match +// the data in buf, the results can be unpredictable. +// +// UnmarshalMerge merges into existing data in pb. +// Most code should use Unmarshal instead. +func UnmarshalMerge(buf []byte, pb Message) error { + if u, ok := pb.(newUnmarshaler); ok { + return u.XXX_Unmarshal(buf) + } + if u, ok := pb.(Unmarshaler); ok { + // NOTE: The history of proto have unfortunately been inconsistent + // whether Unmarshaler should or should not implicitly clear itself. + // Some implementations do, most do not. + // Thus, calling this here may or may not do what people want. + // + // See https://github.com/golang/protobuf/issues/424 + return u.Unmarshal(buf) + } + return NewBuffer(buf).Unmarshal(pb) +} + +// DecodeMessage reads a count-delimited message from the Buffer. +func (p *Buffer) DecodeMessage(pb Message) error { + enc, err := p.DecodeRawBytes(false) + if err != nil { + return err + } + return NewBuffer(enc).Unmarshal(pb) +} + +// DecodeGroup reads a tag-delimited group from the Buffer. +// StartGroup tag is already consumed. This function consumes +// EndGroup tag. +func (p *Buffer) DecodeGroup(pb Message) error { + b := p.buf[p.index:] + x, y := findEndGroup(b) + if x < 0 { + return io.ErrUnexpectedEOF + } + err := Unmarshal(b[:x], pb) + p.index += y + return err +} + +// Unmarshal parses the protocol buffer representation in the +// Buffer and places the decoded result in pb. If the struct +// underlying pb does not match the data in the buffer, the results can be +// unpredictable. +// +// Unlike proto.Unmarshal, this does not reset pb before starting to unmarshal. +func (p *Buffer) Unmarshal(pb Message) error { + // If the object can unmarshal itself, let it. + if u, ok := pb.(newUnmarshaler); ok { + err := u.XXX_Unmarshal(p.buf[p.index:]) + p.index = len(p.buf) + return err + } + if u, ok := pb.(Unmarshaler); ok { + // NOTE: The history of proto have unfortunately been inconsistent + // whether Unmarshaler should or should not implicitly clear itself. + // Some implementations do, most do not. + // Thus, calling this here may or may not do what people want. + // + // See https://github.com/golang/protobuf/issues/424 + err := u.Unmarshal(p.buf[p.index:]) + p.index = len(p.buf) + return err + } + + // Slow workaround for messages that aren't Unmarshalers. + // This includes some hand-coded .pb.go files and + // bootstrap protos. + // TODO: fix all of those and then add Unmarshal to + // the Message interface. Then: + // The cast above and code below can be deleted. + // The old unmarshaler can be deleted. + // Clients can call Unmarshal directly (can already do that, actually). + var info InternalMessageInfo + err := info.Unmarshal(pb, p.buf[p.index:]) + p.index = len(p.buf) + return err +} diff --git a/vendor/github.com/gogo/protobuf/proto/discard.go b/vendor/github.com/gogo/protobuf/proto/discard.go new file mode 100644 index 000000000000..fe1bd7d904e2 --- /dev/null +++ b/vendor/github.com/gogo/protobuf/proto/discard.go @@ -0,0 +1,350 @@ +// Go support for Protocol Buffers - Google's data interchange format +// +// Copyright 2017 The Go Authors. All rights reserved. +// https://github.com/golang/protobuf +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +package proto + +import ( + "fmt" + "reflect" + "strings" + "sync" + "sync/atomic" +) + +type generatedDiscarder interface { + XXX_DiscardUnknown() +} + +// DiscardUnknown recursively discards all unknown fields from this message +// and all embedded messages. +// +// When unmarshaling a message with unrecognized fields, the tags and values +// of such fields are preserved in the Message. This allows a later call to +// marshal to be able to produce a message that continues to have those +// unrecognized fields. To avoid this, DiscardUnknown is used to +// explicitly clear the unknown fields after unmarshaling. +// +// For proto2 messages, the unknown fields of message extensions are only +// discarded from messages that have been accessed via GetExtension. +func DiscardUnknown(m Message) { + if m, ok := m.(generatedDiscarder); ok { + m.XXX_DiscardUnknown() + return + } + // TODO: Dynamically populate a InternalMessageInfo for legacy messages, + // but the master branch has no implementation for InternalMessageInfo, + // so it would be more work to replicate that approach. + discardLegacy(m) +} + +// DiscardUnknown recursively discards all unknown fields. +func (a *InternalMessageInfo) DiscardUnknown(m Message) { + di := atomicLoadDiscardInfo(&a.discard) + if di == nil { + di = getDiscardInfo(reflect.TypeOf(m).Elem()) + atomicStoreDiscardInfo(&a.discard, di) + } + di.discard(toPointer(&m)) +} + +type discardInfo struct { + typ reflect.Type + + initialized int32 // 0: only typ is valid, 1: everything is valid + lock sync.Mutex + + fields []discardFieldInfo + unrecognized field +} + +type discardFieldInfo struct { + field field // Offset of field, guaranteed to be valid + discard func(src pointer) +} + +var ( + discardInfoMap = map[reflect.Type]*discardInfo{} + discardInfoLock sync.Mutex +) + +func getDiscardInfo(t reflect.Type) *discardInfo { + discardInfoLock.Lock() + defer discardInfoLock.Unlock() + di := discardInfoMap[t] + if di == nil { + di = &discardInfo{typ: t} + discardInfoMap[t] = di + } + return di +} + +func (di *discardInfo) discard(src pointer) { + if src.isNil() { + return // Nothing to do. + } + + if atomic.LoadInt32(&di.initialized) == 0 { + di.computeDiscardInfo() + } + + for _, fi := range di.fields { + sfp := src.offset(fi.field) + fi.discard(sfp) + } + + // For proto2 messages, only discard unknown fields in message extensions + // that have been accessed via GetExtension. + if em, err := extendable(src.asPointerTo(di.typ).Interface()); err == nil { + // Ignore lock since DiscardUnknown is not concurrency safe. + emm, _ := em.extensionsRead() + for _, mx := range emm { + if m, ok := mx.value.(Message); ok { + DiscardUnknown(m) + } + } + } + + if di.unrecognized.IsValid() { + *src.offset(di.unrecognized).toBytes() = nil + } +} + +func (di *discardInfo) computeDiscardInfo() { + di.lock.Lock() + defer di.lock.Unlock() + if di.initialized != 0 { + return + } + t := di.typ + n := t.NumField() + + for i := 0; i < n; i++ { + f := t.Field(i) + if strings.HasPrefix(f.Name, "XXX_") { + continue + } + + dfi := discardFieldInfo{field: toField(&f)} + tf := f.Type + + // Unwrap tf to get its most basic type. + var isPointer, isSlice bool + if tf.Kind() == reflect.Slice && tf.Elem().Kind() != reflect.Uint8 { + isSlice = true + tf = tf.Elem() + } + if tf.Kind() == reflect.Ptr { + isPointer = true + tf = tf.Elem() + } + if isPointer && isSlice && tf.Kind() != reflect.Struct { + panic(fmt.Sprintf("%v.%s cannot be a slice of pointers to primitive types", t, f.Name)) + } + + switch tf.Kind() { + case reflect.Struct: + switch { + case !isPointer: + panic(fmt.Sprintf("%v.%s cannot be a direct struct value", t, f.Name)) + case isSlice: // E.g., []*pb.T + discardInfo := getDiscardInfo(tf) + dfi.discard = func(src pointer) { + sps := src.getPointerSlice() + for _, sp := range sps { + if !sp.isNil() { + discardInfo.discard(sp) + } + } + } + default: // E.g., *pb.T + discardInfo := getDiscardInfo(tf) + dfi.discard = func(src pointer) { + sp := src.getPointer() + if !sp.isNil() { + discardInfo.discard(sp) + } + } + } + case reflect.Map: + switch { + case isPointer || isSlice: + panic(fmt.Sprintf("%v.%s cannot be a pointer to a map or a slice of map values", t, f.Name)) + default: // E.g., map[K]V + if tf.Elem().Kind() == reflect.Ptr { // Proto struct (e.g., *T) + dfi.discard = func(src pointer) { + sm := src.asPointerTo(tf).Elem() + if sm.Len() == 0 { + return + } + for _, key := range sm.MapKeys() { + val := sm.MapIndex(key) + DiscardUnknown(val.Interface().(Message)) + } + } + } else { + dfi.discard = func(pointer) {} // Noop + } + } + case reflect.Interface: + // Must be oneof field. + switch { + case isPointer || isSlice: + panic(fmt.Sprintf("%v.%s cannot be a pointer to a interface or a slice of interface values", t, f.Name)) + default: // E.g., interface{} + // TODO: Make this faster? + dfi.discard = func(src pointer) { + su := src.asPointerTo(tf).Elem() + if !su.IsNil() { + sv := su.Elem().Elem().Field(0) + if sv.Kind() == reflect.Ptr && sv.IsNil() { + return + } + switch sv.Type().Kind() { + case reflect.Ptr: // Proto struct (e.g., *T) + DiscardUnknown(sv.Interface().(Message)) + } + } + } + } + default: + continue + } + di.fields = append(di.fields, dfi) + } + + di.unrecognized = invalidField + if f, ok := t.FieldByName("XXX_unrecognized"); ok { + if f.Type != reflect.TypeOf([]byte{}) { + panic("expected XXX_unrecognized to be of type []byte") + } + di.unrecognized = toField(&f) + } + + atomic.StoreInt32(&di.initialized, 1) +} + +func discardLegacy(m Message) { + v := reflect.ValueOf(m) + if v.Kind() != reflect.Ptr || v.IsNil() { + return + } + v = v.Elem() + if v.Kind() != reflect.Struct { + return + } + t := v.Type() + + for i := 0; i < v.NumField(); i++ { + f := t.Field(i) + if strings.HasPrefix(f.Name, "XXX_") { + continue + } + vf := v.Field(i) + tf := f.Type + + // Unwrap tf to get its most basic type. + var isPointer, isSlice bool + if tf.Kind() == reflect.Slice && tf.Elem().Kind() != reflect.Uint8 { + isSlice = true + tf = tf.Elem() + } + if tf.Kind() == reflect.Ptr { + isPointer = true + tf = tf.Elem() + } + if isPointer && isSlice && tf.Kind() != reflect.Struct { + panic(fmt.Sprintf("%T.%s cannot be a slice of pointers to primitive types", m, f.Name)) + } + + switch tf.Kind() { + case reflect.Struct: + switch { + case !isPointer: + panic(fmt.Sprintf("%T.%s cannot be a direct struct value", m, f.Name)) + case isSlice: // E.g., []*pb.T + for j := 0; j < vf.Len(); j++ { + discardLegacy(vf.Index(j).Interface().(Message)) + } + default: // E.g., *pb.T + discardLegacy(vf.Interface().(Message)) + } + case reflect.Map: + switch { + case isPointer || isSlice: + panic(fmt.Sprintf("%T.%s cannot be a pointer to a map or a slice of map values", m, f.Name)) + default: // E.g., map[K]V + tv := vf.Type().Elem() + if tv.Kind() == reflect.Ptr && tv.Implements(protoMessageType) { // Proto struct (e.g., *T) + for _, key := range vf.MapKeys() { + val := vf.MapIndex(key) + discardLegacy(val.Interface().(Message)) + } + } + } + case reflect.Interface: + // Must be oneof field. + switch { + case isPointer || isSlice: + panic(fmt.Sprintf("%T.%s cannot be a pointer to a interface or a slice of interface values", m, f.Name)) + default: // E.g., test_proto.isCommunique_Union interface + if !vf.IsNil() && f.Tag.Get("protobuf_oneof") != "" { + vf = vf.Elem() // E.g., *test_proto.Communique_Msg + if !vf.IsNil() { + vf = vf.Elem() // E.g., test_proto.Communique_Msg + vf = vf.Field(0) // E.g., Proto struct (e.g., *T) or primitive value + if vf.Kind() == reflect.Ptr { + discardLegacy(vf.Interface().(Message)) + } + } + } + } + } + } + + if vf := v.FieldByName("XXX_unrecognized"); vf.IsValid() { + if vf.Type() != reflect.TypeOf([]byte{}) { + panic("expected XXX_unrecognized to be of type []byte") + } + vf.Set(reflect.ValueOf([]byte(nil))) + } + + // For proto2 messages, only discard unknown fields in message extensions + // that have been accessed via GetExtension. + if em, err := extendable(m); err == nil { + // Ignore lock since discardLegacy is not concurrency safe. + emm, _ := em.extensionsRead() + for _, mx := range emm { + if m, ok := mx.value.(Message); ok { + discardLegacy(m) + } + } + } +} diff --git a/vendor/github.com/gogo/protobuf/proto/duration.go b/vendor/github.com/gogo/protobuf/proto/duration.go new file mode 100644 index 000000000000..93464c91cffb --- /dev/null +++ b/vendor/github.com/gogo/protobuf/proto/duration.go @@ -0,0 +1,100 @@ +// Go support for Protocol Buffers - Google's data interchange format +// +// Copyright 2016 The Go Authors. All rights reserved. +// https://github.com/golang/protobuf +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +package proto + +// This file implements conversions between google.protobuf.Duration +// and time.Duration. + +import ( + "errors" + "fmt" + "time" +) + +const ( + // Range of a Duration in seconds, as specified in + // google/protobuf/duration.proto. This is about 10,000 years in seconds. + maxSeconds = int64(10000 * 365.25 * 24 * 60 * 60) + minSeconds = -maxSeconds +) + +// validateDuration determines whether the Duration is valid according to the +// definition in google/protobuf/duration.proto. A valid Duration +// may still be too large to fit into a time.Duration (the range of Duration +// is about 10,000 years, and the range of time.Duration is about 290). +func validateDuration(d *duration) error { + if d == nil { + return errors.New("duration: nil Duration") + } + if d.Seconds < minSeconds || d.Seconds > maxSeconds { + return fmt.Errorf("duration: %#v: seconds out of range", d) + } + if d.Nanos <= -1e9 || d.Nanos >= 1e9 { + return fmt.Errorf("duration: %#v: nanos out of range", d) + } + // Seconds and Nanos must have the same sign, unless d.Nanos is zero. + if (d.Seconds < 0 && d.Nanos > 0) || (d.Seconds > 0 && d.Nanos < 0) { + return fmt.Errorf("duration: %#v: seconds and nanos have different signs", d) + } + return nil +} + +// DurationFromProto converts a Duration to a time.Duration. DurationFromProto +// returns an error if the Duration is invalid or is too large to be +// represented in a time.Duration. +func durationFromProto(p *duration) (time.Duration, error) { + if err := validateDuration(p); err != nil { + return 0, err + } + d := time.Duration(p.Seconds) * time.Second + if int64(d/time.Second) != p.Seconds { + return 0, fmt.Errorf("duration: %#v is out of range for time.Duration", p) + } + if p.Nanos != 0 { + d += time.Duration(p.Nanos) + if (d < 0) != (p.Nanos < 0) { + return 0, fmt.Errorf("duration: %#v is out of range for time.Duration", p) + } + } + return d, nil +} + +// DurationProto converts a time.Duration to a Duration. +func durationProto(d time.Duration) *duration { + nanos := d.Nanoseconds() + secs := nanos / 1e9 + nanos -= secs * 1e9 + return &duration{ + Seconds: secs, + Nanos: int32(nanos), + } +} diff --git a/vendor/github.com/gogo/protobuf/proto/duration_gogo.go b/vendor/github.com/gogo/protobuf/proto/duration_gogo.go new file mode 100644 index 000000000000..e748e1730e1c --- /dev/null +++ b/vendor/github.com/gogo/protobuf/proto/duration_gogo.go @@ -0,0 +1,49 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2016, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +package proto + +import ( + "reflect" + "time" +) + +var durationType = reflect.TypeOf((*time.Duration)(nil)).Elem() + +type duration struct { + Seconds int64 `protobuf:"varint,1,opt,name=seconds,proto3" json:"seconds,omitempty"` + Nanos int32 `protobuf:"varint,2,opt,name=nanos,proto3" json:"nanos,omitempty"` +} + +func (m *duration) Reset() { *m = duration{} } +func (*duration) ProtoMessage() {} +func (*duration) String() string { return "duration" } + +func init() { + RegisterType((*duration)(nil), "gogo.protobuf.proto.duration") +} diff --git a/vendor/github.com/gogo/protobuf/proto/encode.go b/vendor/github.com/gogo/protobuf/proto/encode.go new file mode 100644 index 000000000000..4c35d337380c --- /dev/null +++ b/vendor/github.com/gogo/protobuf/proto/encode.go @@ -0,0 +1,218 @@ +// Go support for Protocol Buffers - Google's data interchange format +// +// Copyright 2010 The Go Authors. All rights reserved. +// https://github.com/golang/protobuf +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +package proto + +/* + * Routines for encoding data into the wire format for protocol buffers. + */ + +import ( + "errors" + "fmt" + "reflect" +) + +// RequiredNotSetError is an error type returned by either Marshal or Unmarshal. +// Marshal reports this when a required field is not initialized. +// Unmarshal reports this when a required field is missing from the wire data. +type RequiredNotSetError struct { + field string +} + +func (e *RequiredNotSetError) Error() string { + if e.field == "" { + return fmt.Sprintf("proto: required field not set") + } + return fmt.Sprintf("proto: required field %q not set", e.field) +} + +var ( + // errRepeatedHasNil is the error returned if Marshal is called with + // a struct with a repeated field containing a nil element. + errRepeatedHasNil = errors.New("proto: repeated field has nil element") + + // errOneofHasNil is the error returned if Marshal is called with + // a struct with a oneof field containing a nil element. + errOneofHasNil = errors.New("proto: oneof field has nil value") + + // ErrNil is the error returned if Marshal is called with nil. + ErrNil = errors.New("proto: Marshal called with nil") + + // ErrTooLarge is the error returned if Marshal is called with a + // message that encodes to >2GB. + ErrTooLarge = errors.New("proto: message encodes to over 2 GB") +) + +// The fundamental encoders that put bytes on the wire. +// Those that take integer types all accept uint64 and are +// therefore of type valueEncoder. + +const maxVarintBytes = 10 // maximum length of a varint + +// EncodeVarint returns the varint encoding of x. +// This is the format for the +// int32, int64, uint32, uint64, bool, and enum +// protocol buffer types. +// Not used by the package itself, but helpful to clients +// wishing to use the same encoding. +func EncodeVarint(x uint64) []byte { + var buf [maxVarintBytes]byte + var n int + for n = 0; x > 127; n++ { + buf[n] = 0x80 | uint8(x&0x7F) + x >>= 7 + } + buf[n] = uint8(x) + n++ + return buf[0:n] +} + +// EncodeVarint writes a varint-encoded integer to the Buffer. +// This is the format for the +// int32, int64, uint32, uint64, bool, and enum +// protocol buffer types. +func (p *Buffer) EncodeVarint(x uint64) error { + for x >= 1<<7 { + p.buf = append(p.buf, uint8(x&0x7f|0x80)) + x >>= 7 + } + p.buf = append(p.buf, uint8(x)) + return nil +} + +// SizeVarint returns the varint encoding size of an integer. +func SizeVarint(x uint64) int { + switch { + case x < 1<<7: + return 1 + case x < 1<<14: + return 2 + case x < 1<<21: + return 3 + case x < 1<<28: + return 4 + case x < 1<<35: + return 5 + case x < 1<<42: + return 6 + case x < 1<<49: + return 7 + case x < 1<<56: + return 8 + case x < 1<<63: + return 9 + } + return 10 +} + +// EncodeFixed64 writes a 64-bit integer to the Buffer. +// This is the format for the +// fixed64, sfixed64, and double protocol buffer types. +func (p *Buffer) EncodeFixed64(x uint64) error { + p.buf = append(p.buf, + uint8(x), + uint8(x>>8), + uint8(x>>16), + uint8(x>>24), + uint8(x>>32), + uint8(x>>40), + uint8(x>>48), + uint8(x>>56)) + return nil +} + +// EncodeFixed32 writes a 32-bit integer to the Buffer. +// This is the format for the +// fixed32, sfixed32, and float protocol buffer types. +func (p *Buffer) EncodeFixed32(x uint64) error { + p.buf = append(p.buf, + uint8(x), + uint8(x>>8), + uint8(x>>16), + uint8(x>>24)) + return nil +} + +// EncodeZigzag64 writes a zigzag-encoded 64-bit integer +// to the Buffer. +// This is the format used for the sint64 protocol buffer type. +func (p *Buffer) EncodeZigzag64(x uint64) error { + // use signed number to get arithmetic right shift. + return p.EncodeVarint(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} + +// EncodeZigzag32 writes a zigzag-encoded 32-bit integer +// to the Buffer. +// This is the format used for the sint32 protocol buffer type. +func (p *Buffer) EncodeZigzag32(x uint64) error { + // use signed number to get arithmetic right shift. + return p.EncodeVarint(uint64((uint32(x) << 1) ^ uint32((int32(x) >> 31)))) +} + +// EncodeRawBytes writes a count-delimited byte buffer to the Buffer. +// This is the format used for the bytes protocol buffer +// type and for embedded messages. +func (p *Buffer) EncodeRawBytes(b []byte) error { + p.EncodeVarint(uint64(len(b))) + p.buf = append(p.buf, b...) + return nil +} + +// EncodeStringBytes writes an encoded string to the Buffer. +// This is the format used for the proto2 string type. +func (p *Buffer) EncodeStringBytes(s string) error { + p.EncodeVarint(uint64(len(s))) + p.buf = append(p.buf, s...) + return nil +} + +// Marshaler is the interface representing objects that can marshal themselves. +type Marshaler interface { + Marshal() ([]byte, error) +} + +// EncodeMessage writes the protocol buffer to the Buffer, +// prefixed by a varint-encoded length. +func (p *Buffer) EncodeMessage(pb Message) error { + siz := Size(pb) + p.EncodeVarint(uint64(siz)) + return p.Marshal(pb) +} + +// All protocol buffer fields are nillable, but be careful. +func isNil(v reflect.Value) bool { + switch v.Kind() { + case reflect.Interface, reflect.Map, reflect.Ptr, reflect.Slice: + return v.IsNil() + } + return false +} diff --git a/vendor/github.com/gogo/protobuf/proto/encode_gogo.go b/vendor/github.com/gogo/protobuf/proto/encode_gogo.go new file mode 100644 index 000000000000..0f5fb173e9fd --- /dev/null +++ b/vendor/github.com/gogo/protobuf/proto/encode_gogo.go @@ -0,0 +1,33 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2013, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +package proto + +func NewRequiredNotSetError(field string) *RequiredNotSetError { + return &RequiredNotSetError{field} +} diff --git a/vendor/github.com/gogo/protobuf/proto/equal.go b/vendor/github.com/gogo/protobuf/proto/equal.go new file mode 100644 index 000000000000..d4db5a1c1457 --- /dev/null +++ b/vendor/github.com/gogo/protobuf/proto/equal.go @@ -0,0 +1,300 @@ +// Go support for Protocol Buffers - Google's data interchange format +// +// Copyright 2011 The Go Authors. All rights reserved. +// https://github.com/golang/protobuf +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// Protocol buffer comparison. + +package proto + +import ( + "bytes" + "log" + "reflect" + "strings" +) + +/* +Equal returns true iff protocol buffers a and b are equal. +The arguments must both be pointers to protocol buffer structs. + +Equality is defined in this way: + - Two messages are equal iff they are the same type, + corresponding fields are equal, unknown field sets + are equal, and extensions sets are equal. + - Two set scalar fields are equal iff their values are equal. + If the fields are of a floating-point type, remember that + NaN != x for all x, including NaN. If the message is defined + in a proto3 .proto file, fields are not "set"; specifically, + zero length proto3 "bytes" fields are equal (nil == {}). + - Two repeated fields are equal iff their lengths are the same, + and their corresponding elements are equal. Note a "bytes" field, + although represented by []byte, is not a repeated field and the + rule for the scalar fields described above applies. + - Two unset fields are equal. + - Two unknown field sets are equal if their current + encoded state is equal. + - Two extension sets are equal iff they have corresponding + elements that are pairwise equal. + - Two map fields are equal iff their lengths are the same, + and they contain the same set of elements. Zero-length map + fields are equal. + - Every other combination of things are not equal. + +The return value is undefined if a and b are not protocol buffers. +*/ +func Equal(a, b Message) bool { + if a == nil || b == nil { + return a == b + } + v1, v2 := reflect.ValueOf(a), reflect.ValueOf(b) + if v1.Type() != v2.Type() { + return false + } + if v1.Kind() == reflect.Ptr { + if v1.IsNil() { + return v2.IsNil() + } + if v2.IsNil() { + return false + } + v1, v2 = v1.Elem(), v2.Elem() + } + if v1.Kind() != reflect.Struct { + return false + } + return equalStruct(v1, v2) +} + +// v1 and v2 are known to have the same type. +func equalStruct(v1, v2 reflect.Value) bool { + sprop := GetProperties(v1.Type()) + for i := 0; i < v1.NumField(); i++ { + f := v1.Type().Field(i) + if strings.HasPrefix(f.Name, "XXX_") { + continue + } + f1, f2 := v1.Field(i), v2.Field(i) + if f.Type.Kind() == reflect.Ptr { + if n1, n2 := f1.IsNil(), f2.IsNil(); n1 && n2 { + // both unset + continue + } else if n1 != n2 { + // set/unset mismatch + return false + } + f1, f2 = f1.Elem(), f2.Elem() + } + if !equalAny(f1, f2, sprop.Prop[i]) { + return false + } + } + + if em1 := v1.FieldByName("XXX_InternalExtensions"); em1.IsValid() { + em2 := v2.FieldByName("XXX_InternalExtensions") + if !equalExtensions(v1.Type(), em1.Interface().(XXX_InternalExtensions), em2.Interface().(XXX_InternalExtensions)) { + return false + } + } + + if em1 := v1.FieldByName("XXX_extensions"); em1.IsValid() { + em2 := v2.FieldByName("XXX_extensions") + if !equalExtMap(v1.Type(), em1.Interface().(map[int32]Extension), em2.Interface().(map[int32]Extension)) { + return false + } + } + + uf := v1.FieldByName("XXX_unrecognized") + if !uf.IsValid() { + return true + } + + u1 := uf.Bytes() + u2 := v2.FieldByName("XXX_unrecognized").Bytes() + return bytes.Equal(u1, u2) +} + +// v1 and v2 are known to have the same type. +// prop may be nil. +func equalAny(v1, v2 reflect.Value, prop *Properties) bool { + if v1.Type() == protoMessageType { + m1, _ := v1.Interface().(Message) + m2, _ := v2.Interface().(Message) + return Equal(m1, m2) + } + switch v1.Kind() { + case reflect.Bool: + return v1.Bool() == v2.Bool() + case reflect.Float32, reflect.Float64: + return v1.Float() == v2.Float() + case reflect.Int32, reflect.Int64: + return v1.Int() == v2.Int() + case reflect.Interface: + // Probably a oneof field; compare the inner values. + n1, n2 := v1.IsNil(), v2.IsNil() + if n1 || n2 { + return n1 == n2 + } + e1, e2 := v1.Elem(), v2.Elem() + if e1.Type() != e2.Type() { + return false + } + return equalAny(e1, e2, nil) + case reflect.Map: + if v1.Len() != v2.Len() { + return false + } + for _, key := range v1.MapKeys() { + val2 := v2.MapIndex(key) + if !val2.IsValid() { + // This key was not found in the second map. + return false + } + if !equalAny(v1.MapIndex(key), val2, nil) { + return false + } + } + return true + case reflect.Ptr: + // Maps may have nil values in them, so check for nil. + if v1.IsNil() && v2.IsNil() { + return true + } + if v1.IsNil() != v2.IsNil() { + return false + } + return equalAny(v1.Elem(), v2.Elem(), prop) + case reflect.Slice: + if v1.Type().Elem().Kind() == reflect.Uint8 { + // short circuit: []byte + + // Edge case: if this is in a proto3 message, a zero length + // bytes field is considered the zero value. + if prop != nil && prop.proto3 && v1.Len() == 0 && v2.Len() == 0 { + return true + } + if v1.IsNil() != v2.IsNil() { + return false + } + return bytes.Equal(v1.Interface().([]byte), v2.Interface().([]byte)) + } + + if v1.Len() != v2.Len() { + return false + } + for i := 0; i < v1.Len(); i++ { + if !equalAny(v1.Index(i), v2.Index(i), prop) { + return false + } + } + return true + case reflect.String: + return v1.Interface().(string) == v2.Interface().(string) + case reflect.Struct: + return equalStruct(v1, v2) + case reflect.Uint32, reflect.Uint64: + return v1.Uint() == v2.Uint() + } + + // unknown type, so not a protocol buffer + log.Printf("proto: don't know how to compare %v", v1) + return false +} + +// base is the struct type that the extensions are based on. +// x1 and x2 are InternalExtensions. +func equalExtensions(base reflect.Type, x1, x2 XXX_InternalExtensions) bool { + em1, _ := x1.extensionsRead() + em2, _ := x2.extensionsRead() + return equalExtMap(base, em1, em2) +} + +func equalExtMap(base reflect.Type, em1, em2 map[int32]Extension) bool { + if len(em1) != len(em2) { + return false + } + + for extNum, e1 := range em1 { + e2, ok := em2[extNum] + if !ok { + return false + } + + m1, m2 := e1.value, e2.value + + if m1 == nil && m2 == nil { + // Both have only encoded form. + if bytes.Equal(e1.enc, e2.enc) { + continue + } + // The bytes are different, but the extensions might still be + // equal. We need to decode them to compare. + } + + if m1 != nil && m2 != nil { + // Both are unencoded. + if !equalAny(reflect.ValueOf(m1), reflect.ValueOf(m2), nil) { + return false + } + continue + } + + // At least one is encoded. To do a semantically correct comparison + // we need to unmarshal them first. + var desc *ExtensionDesc + if m := extensionMaps[base]; m != nil { + desc = m[extNum] + } + if desc == nil { + // If both have only encoded form and the bytes are the same, + // it is handled above. We get here when the bytes are different. + // We don't know how to decode it, so just compare them as byte + // slices. + log.Printf("proto: don't know how to compare extension %d of %v", extNum, base) + return false + } + var err error + if m1 == nil { + m1, err = decodeExtension(e1.enc, desc) + } + if m2 == nil && err == nil { + m2, err = decodeExtension(e2.enc, desc) + } + if err != nil { + // The encoded form is invalid. + log.Printf("proto: badly encoded extension %d of %v: %v", extNum, base, err) + return false + } + if !equalAny(reflect.ValueOf(m1), reflect.ValueOf(m2), nil) { + return false + } + } + + return true +} diff --git a/vendor/github.com/gogo/protobuf/proto/extensions.go b/vendor/github.com/gogo/protobuf/proto/extensions.go new file mode 100644 index 000000000000..44ebd457cf61 --- /dev/null +++ b/vendor/github.com/gogo/protobuf/proto/extensions.go @@ -0,0 +1,604 @@ +// Go support for Protocol Buffers - Google's data interchange format +// +// Copyright 2010 The Go Authors. All rights reserved. +// https://github.com/golang/protobuf +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +package proto + +/* + * Types and routines for supporting protocol buffer extensions. + */ + +import ( + "errors" + "fmt" + "io" + "reflect" + "strconv" + "sync" +) + +// ErrMissingExtension is the error returned by GetExtension if the named extension is not in the message. +var ErrMissingExtension = errors.New("proto: missing extension") + +// ExtensionRange represents a range of message extensions for a protocol buffer. +// Used in code generated by the protocol compiler. +type ExtensionRange struct { + Start, End int32 // both inclusive +} + +// extendableProto is an interface implemented by any protocol buffer generated by the current +// proto compiler that may be extended. +type extendableProto interface { + Message + ExtensionRangeArray() []ExtensionRange + extensionsWrite() map[int32]Extension + extensionsRead() (map[int32]Extension, sync.Locker) +} + +// extendableProtoV1 is an interface implemented by a protocol buffer generated by the previous +// version of the proto compiler that may be extended. +type extendableProtoV1 interface { + Message + ExtensionRangeArray() []ExtensionRange + ExtensionMap() map[int32]Extension +} + +// extensionAdapter is a wrapper around extendableProtoV1 that implements extendableProto. +type extensionAdapter struct { + extendableProtoV1 +} + +func (e extensionAdapter) extensionsWrite() map[int32]Extension { + return e.ExtensionMap() +} + +func (e extensionAdapter) extensionsRead() (map[int32]Extension, sync.Locker) { + return e.ExtensionMap(), notLocker{} +} + +// notLocker is a sync.Locker whose Lock and Unlock methods are nops. +type notLocker struct{} + +func (n notLocker) Lock() {} +func (n notLocker) Unlock() {} + +// extendable returns the extendableProto interface for the given generated proto message. +// If the proto message has the old extension format, it returns a wrapper that implements +// the extendableProto interface. +func extendable(p interface{}) (extendableProto, error) { + switch p := p.(type) { + case extendableProto: + if isNilPtr(p) { + return nil, fmt.Errorf("proto: nil %T is not extendable", p) + } + return p, nil + case extendableProtoV1: + if isNilPtr(p) { + return nil, fmt.Errorf("proto: nil %T is not extendable", p) + } + return extensionAdapter{p}, nil + case extensionsBytes: + return slowExtensionAdapter{p}, nil + } + // Don't allocate a specific error containing %T: + // this is the hot path for Clone and MarshalText. + return nil, errNotExtendable +} + +var errNotExtendable = errors.New("proto: not an extendable proto.Message") + +func isNilPtr(x interface{}) bool { + v := reflect.ValueOf(x) + return v.Kind() == reflect.Ptr && v.IsNil() +} + +// XXX_InternalExtensions is an internal representation of proto extensions. +// +// Each generated message struct type embeds an anonymous XXX_InternalExtensions field, +// thus gaining the unexported 'extensions' method, which can be called only from the proto package. +// +// The methods of XXX_InternalExtensions are not concurrency safe in general, +// but calls to logically read-only methods such as has and get may be executed concurrently. +type XXX_InternalExtensions struct { + // The struct must be indirect so that if a user inadvertently copies a + // generated message and its embedded XXX_InternalExtensions, they + // avoid the mayhem of a copied mutex. + // + // The mutex serializes all logically read-only operations to p.extensionMap. + // It is up to the client to ensure that write operations to p.extensionMap are + // mutually exclusive with other accesses. + p *struct { + mu sync.Mutex + extensionMap map[int32]Extension + } +} + +// extensionsWrite returns the extension map, creating it on first use. +func (e *XXX_InternalExtensions) extensionsWrite() map[int32]Extension { + if e.p == nil { + e.p = new(struct { + mu sync.Mutex + extensionMap map[int32]Extension + }) + e.p.extensionMap = make(map[int32]Extension) + } + return e.p.extensionMap +} + +// extensionsRead returns the extensions map for read-only use. It may be nil. +// The caller must hold the returned mutex's lock when accessing Elements within the map. +func (e *XXX_InternalExtensions) extensionsRead() (map[int32]Extension, sync.Locker) { + if e.p == nil { + return nil, nil + } + return e.p.extensionMap, &e.p.mu +} + +// ExtensionDesc represents an extension specification. +// Used in generated code from the protocol compiler. +type ExtensionDesc struct { + ExtendedType Message // nil pointer to the type that is being extended + ExtensionType interface{} // nil pointer to the extension type + Field int32 // field number + Name string // fully-qualified name of extension, for text formatting + Tag string // protobuf tag style + Filename string // name of the file in which the extension is defined +} + +func (ed *ExtensionDesc) repeated() bool { + t := reflect.TypeOf(ed.ExtensionType) + return t.Kind() == reflect.Slice && t.Elem().Kind() != reflect.Uint8 +} + +// Extension represents an extension in a message. +type Extension struct { + // When an extension is stored in a message using SetExtension + // only desc and value are set. When the message is marshaled + // enc will be set to the encoded form of the message. + // + // When a message is unmarshaled and contains extensions, each + // extension will have only enc set. When such an extension is + // accessed using GetExtension (or GetExtensions) desc and value + // will be set. + desc *ExtensionDesc + value interface{} + enc []byte +} + +// SetRawExtension is for testing only. +func SetRawExtension(base Message, id int32, b []byte) { + if ebase, ok := base.(extensionsBytes); ok { + clearExtension(base, id) + ext := ebase.GetExtensions() + *ext = append(*ext, b...) + return + } + epb, err := extendable(base) + if err != nil { + return + } + extmap := epb.extensionsWrite() + extmap[id] = Extension{enc: b} +} + +// isExtensionField returns true iff the given field number is in an extension range. +func isExtensionField(pb extendableProto, field int32) bool { + for _, er := range pb.ExtensionRangeArray() { + if er.Start <= field && field <= er.End { + return true + } + } + return false +} + +// checkExtensionTypes checks that the given extension is valid for pb. +func checkExtensionTypes(pb extendableProto, extension *ExtensionDesc) error { + var pbi interface{} = pb + // Check the extended type. + if ea, ok := pbi.(extensionAdapter); ok { + pbi = ea.extendableProtoV1 + } + if ea, ok := pbi.(slowExtensionAdapter); ok { + pbi = ea.extensionsBytes + } + if a, b := reflect.TypeOf(pbi), reflect.TypeOf(extension.ExtendedType); a != b { + return fmt.Errorf("proto: bad extended type; %v does not extend %v", b, a) + } + // Check the range. + if !isExtensionField(pb, extension.Field) { + return errors.New("proto: bad extension number; not in declared ranges") + } + return nil +} + +// extPropKey is sufficient to uniquely identify an extension. +type extPropKey struct { + base reflect.Type + field int32 +} + +var extProp = struct { + sync.RWMutex + m map[extPropKey]*Properties +}{ + m: make(map[extPropKey]*Properties), +} + +func extensionProperties(ed *ExtensionDesc) *Properties { + key := extPropKey{base: reflect.TypeOf(ed.ExtendedType), field: ed.Field} + + extProp.RLock() + if prop, ok := extProp.m[key]; ok { + extProp.RUnlock() + return prop + } + extProp.RUnlock() + + extProp.Lock() + defer extProp.Unlock() + // Check again. + if prop, ok := extProp.m[key]; ok { + return prop + } + + prop := new(Properties) + prop.Init(reflect.TypeOf(ed.ExtensionType), "unknown_name", ed.Tag, nil) + extProp.m[key] = prop + return prop +} + +// HasExtension returns whether the given extension is present in pb. +func HasExtension(pb Message, extension *ExtensionDesc) bool { + if epb, doki := pb.(extensionsBytes); doki { + ext := epb.GetExtensions() + buf := *ext + o := 0 + for o < len(buf) { + tag, n := DecodeVarint(buf[o:]) + fieldNum := int32(tag >> 3) + if int32(fieldNum) == extension.Field { + return true + } + wireType := int(tag & 0x7) + o += n + l, err := size(buf[o:], wireType) + if err != nil { + return false + } + o += l + } + return false + } + // TODO: Check types, field numbers, etc.? + epb, err := extendable(pb) + if err != nil { + return false + } + extmap, mu := epb.extensionsRead() + if extmap == nil { + return false + } + mu.Lock() + _, ok := extmap[extension.Field] + mu.Unlock() + return ok +} + +// ClearExtension removes the given extension from pb. +func ClearExtension(pb Message, extension *ExtensionDesc) { + clearExtension(pb, extension.Field) +} + +func clearExtension(pb Message, fieldNum int32) { + if epb, ok := pb.(extensionsBytes); ok { + offset := 0 + for offset != -1 { + offset = deleteExtension(epb, fieldNum, offset) + } + return + } + epb, err := extendable(pb) + if err != nil { + return + } + // TODO: Check types, field numbers, etc.? + extmap := epb.extensionsWrite() + delete(extmap, fieldNum) +} + +// GetExtension retrieves a proto2 extended field from pb. +// +// If the descriptor is type complete (i.e., ExtensionDesc.ExtensionType is non-nil), +// then GetExtension parses the encoded field and returns a Go value of the specified type. +// If the field is not present, then the default value is returned (if one is specified), +// otherwise ErrMissingExtension is reported. +// +// If the descriptor is not type complete (i.e., ExtensionDesc.ExtensionType is nil), +// then GetExtension returns the raw encoded bytes of the field extension. +func GetExtension(pb Message, extension *ExtensionDesc) (interface{}, error) { + if epb, doki := pb.(extensionsBytes); doki { + ext := epb.GetExtensions() + return decodeExtensionFromBytes(extension, *ext) + } + + epb, err := extendable(pb) + if err != nil { + return nil, err + } + + if extension.ExtendedType != nil { + // can only check type if this is a complete descriptor + if cerr := checkExtensionTypes(epb, extension); cerr != nil { + return nil, cerr + } + } + + emap, mu := epb.extensionsRead() + if emap == nil { + return defaultExtensionValue(extension) + } + mu.Lock() + defer mu.Unlock() + e, ok := emap[extension.Field] + if !ok { + // defaultExtensionValue returns the default value or + // ErrMissingExtension if there is no default. + return defaultExtensionValue(extension) + } + + if e.value != nil { + // Already decoded. Check the descriptor, though. + if e.desc != extension { + // This shouldn't happen. If it does, it means that + // GetExtension was called twice with two different + // descriptors with the same field number. + return nil, errors.New("proto: descriptor conflict") + } + return e.value, nil + } + + if extension.ExtensionType == nil { + // incomplete descriptor + return e.enc, nil + } + + v, err := decodeExtension(e.enc, extension) + if err != nil { + return nil, err + } + + // Remember the decoded version and drop the encoded version. + // That way it is safe to mutate what we return. + e.value = v + e.desc = extension + e.enc = nil + emap[extension.Field] = e + return e.value, nil +} + +// defaultExtensionValue returns the default value for extension. +// If no default for an extension is defined ErrMissingExtension is returned. +func defaultExtensionValue(extension *ExtensionDesc) (interface{}, error) { + if extension.ExtensionType == nil { + // incomplete descriptor, so no default + return nil, ErrMissingExtension + } + + t := reflect.TypeOf(extension.ExtensionType) + props := extensionProperties(extension) + + sf, _, err := fieldDefault(t, props) + if err != nil { + return nil, err + } + + if sf == nil || sf.value == nil { + // There is no default value. + return nil, ErrMissingExtension + } + + if t.Kind() != reflect.Ptr { + // We do not need to return a Ptr, we can directly return sf.value. + return sf.value, nil + } + + // We need to return an interface{} that is a pointer to sf.value. + value := reflect.New(t).Elem() + value.Set(reflect.New(value.Type().Elem())) + if sf.kind == reflect.Int32 { + // We may have an int32 or an enum, but the underlying data is int32. + // Since we can't set an int32 into a non int32 reflect.value directly + // set it as a int32. + value.Elem().SetInt(int64(sf.value.(int32))) + } else { + value.Elem().Set(reflect.ValueOf(sf.value)) + } + return value.Interface(), nil +} + +// decodeExtension decodes an extension encoded in b. +func decodeExtension(b []byte, extension *ExtensionDesc) (interface{}, error) { + t := reflect.TypeOf(extension.ExtensionType) + unmarshal := typeUnmarshaler(t, extension.Tag) + + // t is a pointer to a struct, pointer to basic type or a slice. + // Allocate space to store the pointer/slice. + value := reflect.New(t).Elem() + + var err error + for { + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + wire := int(x) & 7 + + b, err = unmarshal(b, valToPointer(value.Addr()), wire) + if err != nil { + return nil, err + } + + if len(b) == 0 { + break + } + } + return value.Interface(), nil +} + +// GetExtensions returns a slice of the extensions present in pb that are also listed in es. +// The returned slice has the same length as es; missing extensions will appear as nil elements. +func GetExtensions(pb Message, es []*ExtensionDesc) (extensions []interface{}, err error) { + epb, err := extendable(pb) + if err != nil { + return nil, err + } + extensions = make([]interface{}, len(es)) + for i, e := range es { + extensions[i], err = GetExtension(epb, e) + if err == ErrMissingExtension { + err = nil + } + if err != nil { + return + } + } + return +} + +// ExtensionDescs returns a new slice containing pb's extension descriptors, in undefined order. +// For non-registered extensions, ExtensionDescs returns an incomplete descriptor containing +// just the Field field, which defines the extension's field number. +func ExtensionDescs(pb Message) ([]*ExtensionDesc, error) { + epb, err := extendable(pb) + if err != nil { + return nil, err + } + registeredExtensions := RegisteredExtensions(pb) + + emap, mu := epb.extensionsRead() + if emap == nil { + return nil, nil + } + mu.Lock() + defer mu.Unlock() + extensions := make([]*ExtensionDesc, 0, len(emap)) + for extid, e := range emap { + desc := e.desc + if desc == nil { + desc = registeredExtensions[extid] + if desc == nil { + desc = &ExtensionDesc{Field: extid} + } + } + + extensions = append(extensions, desc) + } + return extensions, nil +} + +// SetExtension sets the specified extension of pb to the specified value. +func SetExtension(pb Message, extension *ExtensionDesc, value interface{}) error { + if epb, ok := pb.(extensionsBytes); ok { + newb, err := encodeExtension(extension, value) + if err != nil { + return err + } + bb := epb.GetExtensions() + *bb = append(*bb, newb...) + return nil + } + epb, err := extendable(pb) + if err != nil { + return err + } + if err := checkExtensionTypes(epb, extension); err != nil { + return err + } + typ := reflect.TypeOf(extension.ExtensionType) + if typ != reflect.TypeOf(value) { + return errors.New("proto: bad extension value type") + } + // nil extension values need to be caught early, because the + // encoder can't distinguish an ErrNil due to a nil extension + // from an ErrNil due to a missing field. Extensions are + // always optional, so the encoder would just swallow the error + // and drop all the extensions from the encoded message. + if reflect.ValueOf(value).IsNil() { + return fmt.Errorf("proto: SetExtension called with nil value of type %T", value) + } + + extmap := epb.extensionsWrite() + extmap[extension.Field] = Extension{desc: extension, value: value} + return nil +} + +// ClearAllExtensions clears all extensions from pb. +func ClearAllExtensions(pb Message) { + if epb, doki := pb.(extensionsBytes); doki { + ext := epb.GetExtensions() + *ext = []byte{} + return + } + epb, err := extendable(pb) + if err != nil { + return + } + m := epb.extensionsWrite() + for k := range m { + delete(m, k) + } +} + +// A global registry of extensions. +// The generated code will register the generated descriptors by calling RegisterExtension. + +var extensionMaps = make(map[reflect.Type]map[int32]*ExtensionDesc) + +// RegisterExtension is called from the generated code. +func RegisterExtension(desc *ExtensionDesc) { + st := reflect.TypeOf(desc.ExtendedType).Elem() + m := extensionMaps[st] + if m == nil { + m = make(map[int32]*ExtensionDesc) + extensionMaps[st] = m + } + if _, ok := m[desc.Field]; ok { + panic("proto: duplicate extension registered: " + st.String() + " " + strconv.Itoa(int(desc.Field))) + } + m[desc.Field] = desc +} + +// RegisteredExtensions returns a map of the registered extensions of a +// protocol buffer struct, indexed by the extension number. +// The argument pb should be a nil pointer to the struct type. +func RegisteredExtensions(pb Message) map[int32]*ExtensionDesc { + return extensionMaps[reflect.TypeOf(pb).Elem()] +} diff --git a/vendor/github.com/gogo/protobuf/proto/extensions_gogo.go b/vendor/github.com/gogo/protobuf/proto/extensions_gogo.go new file mode 100644 index 000000000000..53ebd8cca01c --- /dev/null +++ b/vendor/github.com/gogo/protobuf/proto/extensions_gogo.go @@ -0,0 +1,368 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2013, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +package proto + +import ( + "bytes" + "errors" + "fmt" + "io" + "reflect" + "sort" + "strings" + "sync" +) + +type extensionsBytes interface { + Message + ExtensionRangeArray() []ExtensionRange + GetExtensions() *[]byte +} + +type slowExtensionAdapter struct { + extensionsBytes +} + +func (s slowExtensionAdapter) extensionsWrite() map[int32]Extension { + panic("Please report a bug to github.com/gogo/protobuf if you see this message: Writing extensions is not supported for extensions stored in a byte slice field.") +} + +func (s slowExtensionAdapter) extensionsRead() (map[int32]Extension, sync.Locker) { + b := s.GetExtensions() + m, err := BytesToExtensionsMap(*b) + if err != nil { + panic(err) + } + return m, notLocker{} +} + +func GetBoolExtension(pb Message, extension *ExtensionDesc, ifnotset bool) bool { + if reflect.ValueOf(pb).IsNil() { + return ifnotset + } + value, err := GetExtension(pb, extension) + if err != nil { + return ifnotset + } + if value == nil { + return ifnotset + } + if value.(*bool) == nil { + return ifnotset + } + return *(value.(*bool)) +} + +func (this *Extension) Equal(that *Extension) bool { + if err := this.Encode(); err != nil { + return false + } + if err := that.Encode(); err != nil { + return false + } + return bytes.Equal(this.enc, that.enc) +} + +func (this *Extension) Compare(that *Extension) int { + if err := this.Encode(); err != nil { + return 1 + } + if err := that.Encode(); err != nil { + return -1 + } + return bytes.Compare(this.enc, that.enc) +} + +func SizeOfInternalExtension(m extendableProto) (n int) { + info := getMarshalInfo(reflect.TypeOf(m)) + return info.sizeV1Extensions(m.extensionsWrite()) +} + +type sortableMapElem struct { + field int32 + ext Extension +} + +func newSortableExtensionsFromMap(m map[int32]Extension) sortableExtensions { + s := make(sortableExtensions, 0, len(m)) + for k, v := range m { + s = append(s, &sortableMapElem{field: k, ext: v}) + } + return s +} + +type sortableExtensions []*sortableMapElem + +func (this sortableExtensions) Len() int { return len(this) } + +func (this sortableExtensions) Swap(i, j int) { this[i], this[j] = this[j], this[i] } + +func (this sortableExtensions) Less(i, j int) bool { return this[i].field < this[j].field } + +func (this sortableExtensions) String() string { + sort.Sort(this) + ss := make([]string, len(this)) + for i := range this { + ss[i] = fmt.Sprintf("%d: %v", this[i].field, this[i].ext) + } + return "map[" + strings.Join(ss, ",") + "]" +} + +func StringFromInternalExtension(m extendableProto) string { + return StringFromExtensionsMap(m.extensionsWrite()) +} + +func StringFromExtensionsMap(m map[int32]Extension) string { + return newSortableExtensionsFromMap(m).String() +} + +func StringFromExtensionsBytes(ext []byte) string { + m, err := BytesToExtensionsMap(ext) + if err != nil { + panic(err) + } + return StringFromExtensionsMap(m) +} + +func EncodeInternalExtension(m extendableProto, data []byte) (n int, err error) { + return EncodeExtensionMap(m.extensionsWrite(), data) +} + +func EncodeExtensionMap(m map[int32]Extension, data []byte) (n int, err error) { + o := 0 + for _, e := range m { + if err := e.Encode(); err != nil { + return 0, err + } + n := copy(data[o:], e.enc) + if n != len(e.enc) { + return 0, io.ErrShortBuffer + } + o += n + } + return o, nil +} + +func GetRawExtension(m map[int32]Extension, id int32) ([]byte, error) { + e := m[id] + if err := e.Encode(); err != nil { + return nil, err + } + return e.enc, nil +} + +func size(buf []byte, wire int) (int, error) { + switch wire { + case WireVarint: + _, n := DecodeVarint(buf) + return n, nil + case WireFixed64: + return 8, nil + case WireBytes: + v, n := DecodeVarint(buf) + return int(v) + n, nil + case WireFixed32: + return 4, nil + case WireStartGroup: + offset := 0 + for { + u, n := DecodeVarint(buf[offset:]) + fwire := int(u & 0x7) + offset += n + if fwire == WireEndGroup { + return offset, nil + } + s, err := size(buf[offset:], wire) + if err != nil { + return 0, err + } + offset += s + } + } + return 0, fmt.Errorf("proto: can't get size for unknown wire type %d", wire) +} + +func BytesToExtensionsMap(buf []byte) (map[int32]Extension, error) { + m := make(map[int32]Extension) + i := 0 + for i < len(buf) { + tag, n := DecodeVarint(buf[i:]) + if n <= 0 { + return nil, fmt.Errorf("unable to decode varint") + } + fieldNum := int32(tag >> 3) + wireType := int(tag & 0x7) + l, err := size(buf[i+n:], wireType) + if err != nil { + return nil, err + } + end := i + int(l) + n + m[int32(fieldNum)] = Extension{enc: buf[i:end]} + i = end + } + return m, nil +} + +func NewExtension(e []byte) Extension { + ee := Extension{enc: make([]byte, len(e))} + copy(ee.enc, e) + return ee +} + +func AppendExtension(e Message, tag int32, buf []byte) { + if ee, eok := e.(extensionsBytes); eok { + ext := ee.GetExtensions() + *ext = append(*ext, buf...) + return + } + if ee, eok := e.(extendableProto); eok { + m := ee.extensionsWrite() + ext := m[int32(tag)] // may be missing + ext.enc = append(ext.enc, buf...) + m[int32(tag)] = ext + } +} + +func encodeExtension(extension *ExtensionDesc, value interface{}) ([]byte, error) { + u := getMarshalInfo(reflect.TypeOf(extension.ExtendedType)) + ei := u.getExtElemInfo(extension) + v := value + p := toAddrPointer(&v, ei.isptr) + siz := ei.sizer(p, SizeVarint(ei.wiretag)) + buf := make([]byte, 0, siz) + return ei.marshaler(buf, p, ei.wiretag, false) +} + +func decodeExtensionFromBytes(extension *ExtensionDesc, buf []byte) (interface{}, error) { + o := 0 + for o < len(buf) { + tag, n := DecodeVarint((buf)[o:]) + fieldNum := int32(tag >> 3) + wireType := int(tag & 0x7) + if o+n > len(buf) { + return nil, fmt.Errorf("unable to decode extension") + } + l, err := size((buf)[o+n:], wireType) + if err != nil { + return nil, err + } + if int32(fieldNum) == extension.Field { + if o+n+l > len(buf) { + return nil, fmt.Errorf("unable to decode extension") + } + v, err := decodeExtension((buf)[o:o+n+l], extension) + if err != nil { + return nil, err + } + return v, nil + } + o += n + l + } + return defaultExtensionValue(extension) +} + +func (this *Extension) Encode() error { + if this.enc == nil { + var err error + this.enc, err = encodeExtension(this.desc, this.value) + if err != nil { + return err + } + } + return nil +} + +func (this Extension) GoString() string { + if err := this.Encode(); err != nil { + return fmt.Sprintf("error encoding extension: %v", err) + } + return fmt.Sprintf("proto.NewExtension(%#v)", this.enc) +} + +func SetUnsafeExtension(pb Message, fieldNum int32, value interface{}) error { + typ := reflect.TypeOf(pb).Elem() + ext, ok := extensionMaps[typ] + if !ok { + return fmt.Errorf("proto: bad extended type; %s is not extendable", typ.String()) + } + desc, ok := ext[fieldNum] + if !ok { + return errors.New("proto: bad extension number; not in declared ranges") + } + return SetExtension(pb, desc, value) +} + +func GetUnsafeExtension(pb Message, fieldNum int32) (interface{}, error) { + typ := reflect.TypeOf(pb).Elem() + ext, ok := extensionMaps[typ] + if !ok { + return nil, fmt.Errorf("proto: bad extended type; %s is not extendable", typ.String()) + } + desc, ok := ext[fieldNum] + if !ok { + return nil, fmt.Errorf("unregistered field number %d", fieldNum) + } + return GetExtension(pb, desc) +} + +func NewUnsafeXXX_InternalExtensions(m map[int32]Extension) XXX_InternalExtensions { + x := &XXX_InternalExtensions{ + p: new(struct { + mu sync.Mutex + extensionMap map[int32]Extension + }), + } + x.p.extensionMap = m + return *x +} + +func GetUnsafeExtensionsMap(extendable Message) map[int32]Extension { + pb := extendable.(extendableProto) + return pb.extensionsWrite() +} + +func deleteExtension(pb extensionsBytes, theFieldNum int32, offset int) int { + ext := pb.GetExtensions() + for offset < len(*ext) { + tag, n1 := DecodeVarint((*ext)[offset:]) + fieldNum := int32(tag >> 3) + wireType := int(tag & 0x7) + n2, err := size((*ext)[offset+n1:], wireType) + if err != nil { + panic(err) + } + newOffset := offset + n1 + n2 + if fieldNum == theFieldNum { + *ext = append((*ext)[:offset], (*ext)[newOffset:]...) + return offset + } + offset = newOffset + } + return -1 +} diff --git a/vendor/github.com/gogo/protobuf/proto/lib.go b/vendor/github.com/gogo/protobuf/proto/lib.go new file mode 100644 index 000000000000..37d17813288b --- /dev/null +++ b/vendor/github.com/gogo/protobuf/proto/lib.go @@ -0,0 +1,929 @@ +// Go support for Protocol Buffers - Google's data interchange format +// +// Copyright 2010 The Go Authors. All rights reserved. +// https://github.com/golang/protobuf +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +/* +Package proto converts data structures to and from the wire format of +protocol buffers. It works in concert with the Go source code generated +for .proto files by the protocol compiler. + +A summary of the properties of the protocol buffer interface +for a protocol buffer variable v: + + - Names are turned from camel_case to CamelCase for export. + - There are no methods on v to set fields; just treat + them as structure fields. + - There are getters that return a field's value if set, + and return the field's default value if unset. + The getters work even if the receiver is a nil message. + - The zero value for a struct is its correct initialization state. + All desired fields must be set before marshaling. + - A Reset() method will restore a protobuf struct to its zero state. + - Non-repeated fields are pointers to the values; nil means unset. + That is, optional or required field int32 f becomes F *int32. + - Repeated fields are slices. + - Helper functions are available to aid the setting of fields. + msg.Foo = proto.String("hello") // set field + - Constants are defined to hold the default values of all fields that + have them. They have the form Default_StructName_FieldName. + Because the getter methods handle defaulted values, + direct use of these constants should be rare. + - Enums are given type names and maps from names to values. + Enum values are prefixed by the enclosing message's name, or by the + enum's type name if it is a top-level enum. Enum types have a String + method, and a Enum method to assist in message construction. + - Nested messages, groups and enums have type names prefixed with the name of + the surrounding message type. + - Extensions are given descriptor names that start with E_, + followed by an underscore-delimited list of the nested messages + that contain it (if any) followed by the CamelCased name of the + extension field itself. HasExtension, ClearExtension, GetExtension + and SetExtension are functions for manipulating extensions. + - Oneof field sets are given a single field in their message, + with distinguished wrapper types for each possible field value. + - Marshal and Unmarshal are functions to encode and decode the wire format. + +When the .proto file specifies `syntax="proto3"`, there are some differences: + + - Non-repeated fields of non-message type are values instead of pointers. + - Enum types do not get an Enum method. + +The simplest way to describe this is to see an example. +Given file test.proto, containing + + package example; + + enum FOO { X = 17; } + + message Test { + required string label = 1; + optional int32 type = 2 [default=77]; + repeated int64 reps = 3; + optional group OptionalGroup = 4 { + required string RequiredField = 5; + } + oneof union { + int32 number = 6; + string name = 7; + } + } + +The resulting file, test.pb.go, is: + + package example + + import proto "github.com/gogo/protobuf/proto" + import math "math" + + type FOO int32 + const ( + FOO_X FOO = 17 + ) + var FOO_name = map[int32]string{ + 17: "X", + } + var FOO_value = map[string]int32{ + "X": 17, + } + + func (x FOO) Enum() *FOO { + p := new(FOO) + *p = x + return p + } + func (x FOO) String() string { + return proto.EnumName(FOO_name, int32(x)) + } + func (x *FOO) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(FOO_value, data) + if err != nil { + return err + } + *x = FOO(value) + return nil + } + + type Test struct { + Label *string `protobuf:"bytes,1,req,name=label" json:"label,omitempty"` + Type *int32 `protobuf:"varint,2,opt,name=type,def=77" json:"type,omitempty"` + Reps []int64 `protobuf:"varint,3,rep,name=reps" json:"reps,omitempty"` + Optionalgroup *Test_OptionalGroup `protobuf:"group,4,opt,name=OptionalGroup" json:"optionalgroup,omitempty"` + // Types that are valid to be assigned to Union: + // *Test_Number + // *Test_Name + Union isTest_Union `protobuf_oneof:"union"` + XXX_unrecognized []byte `json:"-"` + } + func (m *Test) Reset() { *m = Test{} } + func (m *Test) String() string { return proto.CompactTextString(m) } + func (*Test) ProtoMessage() {} + + type isTest_Union interface { + isTest_Union() + } + + type Test_Number struct { + Number int32 `protobuf:"varint,6,opt,name=number"` + } + type Test_Name struct { + Name string `protobuf:"bytes,7,opt,name=name"` + } + + func (*Test_Number) isTest_Union() {} + func (*Test_Name) isTest_Union() {} + + func (m *Test) GetUnion() isTest_Union { + if m != nil { + return m.Union + } + return nil + } + const Default_Test_Type int32 = 77 + + func (m *Test) GetLabel() string { + if m != nil && m.Label != nil { + return *m.Label + } + return "" + } + + func (m *Test) GetType() int32 { + if m != nil && m.Type != nil { + return *m.Type + } + return Default_Test_Type + } + + func (m *Test) GetOptionalgroup() *Test_OptionalGroup { + if m != nil { + return m.Optionalgroup + } + return nil + } + + type Test_OptionalGroup struct { + RequiredField *string `protobuf:"bytes,5,req" json:"RequiredField,omitempty"` + } + func (m *Test_OptionalGroup) Reset() { *m = Test_OptionalGroup{} } + func (m *Test_OptionalGroup) String() string { return proto.CompactTextString(m) } + + func (m *Test_OptionalGroup) GetRequiredField() string { + if m != nil && m.RequiredField != nil { + return *m.RequiredField + } + return "" + } + + func (m *Test) GetNumber() int32 { + if x, ok := m.GetUnion().(*Test_Number); ok { + return x.Number + } + return 0 + } + + func (m *Test) GetName() string { + if x, ok := m.GetUnion().(*Test_Name); ok { + return x.Name + } + return "" + } + + func init() { + proto.RegisterEnum("example.FOO", FOO_name, FOO_value) + } + +To create and play with a Test object: + + package main + + import ( + "log" + + "github.com/gogo/protobuf/proto" + pb "./example.pb" + ) + + func main() { + test := &pb.Test{ + Label: proto.String("hello"), + Type: proto.Int32(17), + Reps: []int64{1, 2, 3}, + Optionalgroup: &pb.Test_OptionalGroup{ + RequiredField: proto.String("good bye"), + }, + Union: &pb.Test_Name{"fred"}, + } + data, err := proto.Marshal(test) + if err != nil { + log.Fatal("marshaling error: ", err) + } + newTest := &pb.Test{} + err = proto.Unmarshal(data, newTest) + if err != nil { + log.Fatal("unmarshaling error: ", err) + } + // Now test and newTest contain the same data. + if test.GetLabel() != newTest.GetLabel() { + log.Fatalf("data mismatch %q != %q", test.GetLabel(), newTest.GetLabel()) + } + // Use a type switch to determine which oneof was set. + switch u := test.Union.(type) { + case *pb.Test_Number: // u.Number contains the number. + case *pb.Test_Name: // u.Name contains the string. + } + // etc. + } +*/ +package proto + +import ( + "encoding/json" + "errors" + "fmt" + "log" + "reflect" + "sort" + "strconv" + "sync" +) + +var errInvalidUTF8 = errors.New("proto: invalid UTF-8 string") + +// Message is implemented by generated protocol buffer messages. +type Message interface { + Reset() + String() string + ProtoMessage() +} + +// Stats records allocation details about the protocol buffer encoders +// and decoders. Useful for tuning the library itself. +type Stats struct { + Emalloc uint64 // mallocs in encode + Dmalloc uint64 // mallocs in decode + Encode uint64 // number of encodes + Decode uint64 // number of decodes + Chit uint64 // number of cache hits + Cmiss uint64 // number of cache misses + Size uint64 // number of sizes +} + +// Set to true to enable stats collection. +const collectStats = false + +var stats Stats + +// GetStats returns a copy of the global Stats structure. +func GetStats() Stats { return stats } + +// A Buffer is a buffer manager for marshaling and unmarshaling +// protocol buffers. It may be reused between invocations to +// reduce memory usage. It is not necessary to use a Buffer; +// the global functions Marshal and Unmarshal create a +// temporary Buffer and are fine for most applications. +type Buffer struct { + buf []byte // encode/decode byte stream + index int // read point + + deterministic bool +} + +// NewBuffer allocates a new Buffer and initializes its internal data to +// the contents of the argument slice. +func NewBuffer(e []byte) *Buffer { + return &Buffer{buf: e} +} + +// Reset resets the Buffer, ready for marshaling a new protocol buffer. +func (p *Buffer) Reset() { + p.buf = p.buf[0:0] // for reading/writing + p.index = 0 // for reading +} + +// SetBuf replaces the internal buffer with the slice, +// ready for unmarshaling the contents of the slice. +func (p *Buffer) SetBuf(s []byte) { + p.buf = s + p.index = 0 +} + +// Bytes returns the contents of the Buffer. +func (p *Buffer) Bytes() []byte { return p.buf } + +// SetDeterministic sets whether to use deterministic serialization. +// +// Deterministic serialization guarantees that for a given binary, equal +// messages will always be serialized to the same bytes. This implies: +// +// - Repeated serialization of a message will return the same bytes. +// - Different processes of the same binary (which may be executing on +// different machines) will serialize equal messages to the same bytes. +// +// Note that the deterministic serialization is NOT canonical across +// languages. It is not guaranteed to remain stable over time. It is unstable +// across different builds with schema changes due to unknown fields. +// Users who need canonical serialization (e.g., persistent storage in a +// canonical form, fingerprinting, etc.) should define their own +// canonicalization specification and implement their own serializer rather +// than relying on this API. +// +// If deterministic serialization is requested, map entries will be sorted +// by keys in lexographical order. This is an implementation detail and +// subject to change. +func (p *Buffer) SetDeterministic(deterministic bool) { + p.deterministic = deterministic +} + +/* + * Helper routines for simplifying the creation of optional fields of basic type. + */ + +// Bool is a helper routine that allocates a new bool value +// to store v and returns a pointer to it. +func Bool(v bool) *bool { + return &v +} + +// Int32 is a helper routine that allocates a new int32 value +// to store v and returns a pointer to it. +func Int32(v int32) *int32 { + return &v +} + +// Int is a helper routine that allocates a new int32 value +// to store v and returns a pointer to it, but unlike Int32 +// its argument value is an int. +func Int(v int) *int32 { + p := new(int32) + *p = int32(v) + return p +} + +// Int64 is a helper routine that allocates a new int64 value +// to store v and returns a pointer to it. +func Int64(v int64) *int64 { + return &v +} + +// Float32 is a helper routine that allocates a new float32 value +// to store v and returns a pointer to it. +func Float32(v float32) *float32 { + return &v +} + +// Float64 is a helper routine that allocates a new float64 value +// to store v and returns a pointer to it. +func Float64(v float64) *float64 { + return &v +} + +// Uint32 is a helper routine that allocates a new uint32 value +// to store v and returns a pointer to it. +func Uint32(v uint32) *uint32 { + return &v +} + +// Uint64 is a helper routine that allocates a new uint64 value +// to store v and returns a pointer to it. +func Uint64(v uint64) *uint64 { + return &v +} + +// String is a helper routine that allocates a new string value +// to store v and returns a pointer to it. +func String(v string) *string { + return &v +} + +// EnumName is a helper function to simplify printing protocol buffer enums +// by name. Given an enum map and a value, it returns a useful string. +func EnumName(m map[int32]string, v int32) string { + s, ok := m[v] + if ok { + return s + } + return strconv.Itoa(int(v)) +} + +// UnmarshalJSONEnum is a helper function to simplify recovering enum int values +// from their JSON-encoded representation. Given a map from the enum's symbolic +// names to its int values, and a byte buffer containing the JSON-encoded +// value, it returns an int32 that can be cast to the enum type by the caller. +// +// The function can deal with both JSON representations, numeric and symbolic. +func UnmarshalJSONEnum(m map[string]int32, data []byte, enumName string) (int32, error) { + if data[0] == '"' { + // New style: enums are strings. + var repr string + if err := json.Unmarshal(data, &repr); err != nil { + return -1, err + } + val, ok := m[repr] + if !ok { + return 0, fmt.Errorf("unrecognized enum %s value %q", enumName, repr) + } + return val, nil + } + // Old style: enums are ints. + var val int32 + if err := json.Unmarshal(data, &val); err != nil { + return 0, fmt.Errorf("cannot unmarshal %#q into enum %s", data, enumName) + } + return val, nil +} + +// DebugPrint dumps the encoded data in b in a debugging format with a header +// including the string s. Used in testing but made available for general debugging. +func (p *Buffer) DebugPrint(s string, b []byte) { + var u uint64 + + obuf := p.buf + sindex := p.index + p.buf = b + p.index = 0 + depth := 0 + + fmt.Printf("\n--- %s ---\n", s) + +out: + for { + for i := 0; i < depth; i++ { + fmt.Print(" ") + } + + index := p.index + if index == len(p.buf) { + break + } + + op, err := p.DecodeVarint() + if err != nil { + fmt.Printf("%3d: fetching op err %v\n", index, err) + break out + } + tag := op >> 3 + wire := op & 7 + + switch wire { + default: + fmt.Printf("%3d: t=%3d unknown wire=%d\n", + index, tag, wire) + break out + + case WireBytes: + var r []byte + + r, err = p.DecodeRawBytes(false) + if err != nil { + break out + } + fmt.Printf("%3d: t=%3d bytes [%d]", index, tag, len(r)) + if len(r) <= 6 { + for i := 0; i < len(r); i++ { + fmt.Printf(" %.2x", r[i]) + } + } else { + for i := 0; i < 3; i++ { + fmt.Printf(" %.2x", r[i]) + } + fmt.Printf(" ..") + for i := len(r) - 3; i < len(r); i++ { + fmt.Printf(" %.2x", r[i]) + } + } + fmt.Printf("\n") + + case WireFixed32: + u, err = p.DecodeFixed32() + if err != nil { + fmt.Printf("%3d: t=%3d fix32 err %v\n", index, tag, err) + break out + } + fmt.Printf("%3d: t=%3d fix32 %d\n", index, tag, u) + + case WireFixed64: + u, err = p.DecodeFixed64() + if err != nil { + fmt.Printf("%3d: t=%3d fix64 err %v\n", index, tag, err) + break out + } + fmt.Printf("%3d: t=%3d fix64 %d\n", index, tag, u) + + case WireVarint: + u, err = p.DecodeVarint() + if err != nil { + fmt.Printf("%3d: t=%3d varint err %v\n", index, tag, err) + break out + } + fmt.Printf("%3d: t=%3d varint %d\n", index, tag, u) + + case WireStartGroup: + fmt.Printf("%3d: t=%3d start\n", index, tag) + depth++ + + case WireEndGroup: + depth-- + fmt.Printf("%3d: t=%3d end\n", index, tag) + } + } + + if depth != 0 { + fmt.Printf("%3d: start-end not balanced %d\n", p.index, depth) + } + fmt.Printf("\n") + + p.buf = obuf + p.index = sindex +} + +// SetDefaults sets unset protocol buffer fields to their default values. +// It only modifies fields that are both unset and have defined defaults. +// It recursively sets default values in any non-nil sub-messages. +func SetDefaults(pb Message) { + setDefaults(reflect.ValueOf(pb), true, false) +} + +// v is a struct. +func setDefaults(v reflect.Value, recur, zeros bool) { + if v.Kind() == reflect.Ptr { + v = v.Elem() + } + + defaultMu.RLock() + dm, ok := defaults[v.Type()] + defaultMu.RUnlock() + if !ok { + dm = buildDefaultMessage(v.Type()) + defaultMu.Lock() + defaults[v.Type()] = dm + defaultMu.Unlock() + } + + for _, sf := range dm.scalars { + f := v.Field(sf.index) + if !f.IsNil() { + // field already set + continue + } + dv := sf.value + if dv == nil && !zeros { + // no explicit default, and don't want to set zeros + continue + } + fptr := f.Addr().Interface() // **T + // TODO: Consider batching the allocations we do here. + switch sf.kind { + case reflect.Bool: + b := new(bool) + if dv != nil { + *b = dv.(bool) + } + *(fptr.(**bool)) = b + case reflect.Float32: + f := new(float32) + if dv != nil { + *f = dv.(float32) + } + *(fptr.(**float32)) = f + case reflect.Float64: + f := new(float64) + if dv != nil { + *f = dv.(float64) + } + *(fptr.(**float64)) = f + case reflect.Int32: + // might be an enum + if ft := f.Type(); ft != int32PtrType { + // enum + f.Set(reflect.New(ft.Elem())) + if dv != nil { + f.Elem().SetInt(int64(dv.(int32))) + } + } else { + // int32 field + i := new(int32) + if dv != nil { + *i = dv.(int32) + } + *(fptr.(**int32)) = i + } + case reflect.Int64: + i := new(int64) + if dv != nil { + *i = dv.(int64) + } + *(fptr.(**int64)) = i + case reflect.String: + s := new(string) + if dv != nil { + *s = dv.(string) + } + *(fptr.(**string)) = s + case reflect.Uint8: + // exceptional case: []byte + var b []byte + if dv != nil { + db := dv.([]byte) + b = make([]byte, len(db)) + copy(b, db) + } else { + b = []byte{} + } + *(fptr.(*[]byte)) = b + case reflect.Uint32: + u := new(uint32) + if dv != nil { + *u = dv.(uint32) + } + *(fptr.(**uint32)) = u + case reflect.Uint64: + u := new(uint64) + if dv != nil { + *u = dv.(uint64) + } + *(fptr.(**uint64)) = u + default: + log.Printf("proto: can't set default for field %v (sf.kind=%v)", f, sf.kind) + } + } + + for _, ni := range dm.nested { + f := v.Field(ni) + // f is *T or T or []*T or []T + switch f.Kind() { + case reflect.Struct: + setDefaults(f, recur, zeros) + + case reflect.Ptr: + if f.IsNil() { + continue + } + setDefaults(f, recur, zeros) + + case reflect.Slice: + for i := 0; i < f.Len(); i++ { + e := f.Index(i) + if e.Kind() == reflect.Ptr && e.IsNil() { + continue + } + setDefaults(e, recur, zeros) + } + + case reflect.Map: + for _, k := range f.MapKeys() { + e := f.MapIndex(k) + if e.IsNil() { + continue + } + setDefaults(e, recur, zeros) + } + } + } +} + +var ( + // defaults maps a protocol buffer struct type to a slice of the fields, + // with its scalar fields set to their proto-declared non-zero default values. + defaultMu sync.RWMutex + defaults = make(map[reflect.Type]defaultMessage) + + int32PtrType = reflect.TypeOf((*int32)(nil)) +) + +// defaultMessage represents information about the default values of a message. +type defaultMessage struct { + scalars []scalarField + nested []int // struct field index of nested messages +} + +type scalarField struct { + index int // struct field index + kind reflect.Kind // element type (the T in *T or []T) + value interface{} // the proto-declared default value, or nil +} + +// t is a struct type. +func buildDefaultMessage(t reflect.Type) (dm defaultMessage) { + sprop := GetProperties(t) + for _, prop := range sprop.Prop { + fi, ok := sprop.decoderTags.get(prop.Tag) + if !ok { + // XXX_unrecognized + continue + } + ft := t.Field(fi).Type + + sf, nested, err := fieldDefault(ft, prop) + switch { + case err != nil: + log.Print(err) + case nested: + dm.nested = append(dm.nested, fi) + case sf != nil: + sf.index = fi + dm.scalars = append(dm.scalars, *sf) + } + } + + return dm +} + +// fieldDefault returns the scalarField for field type ft. +// sf will be nil if the field can not have a default. +// nestedMessage will be true if this is a nested message. +// Note that sf.index is not set on return. +func fieldDefault(ft reflect.Type, prop *Properties) (sf *scalarField, nestedMessage bool, err error) { + var canHaveDefault bool + switch ft.Kind() { + case reflect.Struct: + nestedMessage = true // non-nullable + + case reflect.Ptr: + if ft.Elem().Kind() == reflect.Struct { + nestedMessage = true + } else { + canHaveDefault = true // proto2 scalar field + } + + case reflect.Slice: + switch ft.Elem().Kind() { + case reflect.Ptr, reflect.Struct: + nestedMessage = true // repeated message + case reflect.Uint8: + canHaveDefault = true // bytes field + } + + case reflect.Map: + if ft.Elem().Kind() == reflect.Ptr { + nestedMessage = true // map with message values + } + } + + if !canHaveDefault { + if nestedMessage { + return nil, true, nil + } + return nil, false, nil + } + + // We now know that ft is a pointer or slice. + sf = &scalarField{kind: ft.Elem().Kind()} + + // scalar fields without defaults + if !prop.HasDefault { + return sf, false, nil + } + + // a scalar field: either *T or []byte + switch ft.Elem().Kind() { + case reflect.Bool: + x, err := strconv.ParseBool(prop.Default) + if err != nil { + return nil, false, fmt.Errorf("proto: bad default bool %q: %v", prop.Default, err) + } + sf.value = x + case reflect.Float32: + x, err := strconv.ParseFloat(prop.Default, 32) + if err != nil { + return nil, false, fmt.Errorf("proto: bad default float32 %q: %v", prop.Default, err) + } + sf.value = float32(x) + case reflect.Float64: + x, err := strconv.ParseFloat(prop.Default, 64) + if err != nil { + return nil, false, fmt.Errorf("proto: bad default float64 %q: %v", prop.Default, err) + } + sf.value = x + case reflect.Int32: + x, err := strconv.ParseInt(prop.Default, 10, 32) + if err != nil { + return nil, false, fmt.Errorf("proto: bad default int32 %q: %v", prop.Default, err) + } + sf.value = int32(x) + case reflect.Int64: + x, err := strconv.ParseInt(prop.Default, 10, 64) + if err != nil { + return nil, false, fmt.Errorf("proto: bad default int64 %q: %v", prop.Default, err) + } + sf.value = x + case reflect.String: + sf.value = prop.Default + case reflect.Uint8: + // []byte (not *uint8) + sf.value = []byte(prop.Default) + case reflect.Uint32: + x, err := strconv.ParseUint(prop.Default, 10, 32) + if err != nil { + return nil, false, fmt.Errorf("proto: bad default uint32 %q: %v", prop.Default, err) + } + sf.value = uint32(x) + case reflect.Uint64: + x, err := strconv.ParseUint(prop.Default, 10, 64) + if err != nil { + return nil, false, fmt.Errorf("proto: bad default uint64 %q: %v", prop.Default, err) + } + sf.value = x + default: + return nil, false, fmt.Errorf("proto: unhandled def kind %v", ft.Elem().Kind()) + } + + return sf, false, nil +} + +// mapKeys returns a sort.Interface to be used for sorting the map keys. +// Map fields may have key types of non-float scalars, strings and enums. +func mapKeys(vs []reflect.Value) sort.Interface { + s := mapKeySorter{vs: vs} + + // Type specialization per https://developers.google.com/protocol-buffers/docs/proto#maps. + if len(vs) == 0 { + return s + } + switch vs[0].Kind() { + case reflect.Int32, reflect.Int64: + s.less = func(a, b reflect.Value) bool { return a.Int() < b.Int() } + case reflect.Uint32, reflect.Uint64: + s.less = func(a, b reflect.Value) bool { return a.Uint() < b.Uint() } + case reflect.Bool: + s.less = func(a, b reflect.Value) bool { return !a.Bool() && b.Bool() } // false < true + case reflect.String: + s.less = func(a, b reflect.Value) bool { return a.String() < b.String() } + default: + panic(fmt.Sprintf("unsupported map key type: %v", vs[0].Kind())) + } + + return s +} + +type mapKeySorter struct { + vs []reflect.Value + less func(a, b reflect.Value) bool +} + +func (s mapKeySorter) Len() int { return len(s.vs) } +func (s mapKeySorter) Swap(i, j int) { s.vs[i], s.vs[j] = s.vs[j], s.vs[i] } +func (s mapKeySorter) Less(i, j int) bool { + return s.less(s.vs[i], s.vs[j]) +} + +// isProto3Zero reports whether v is a zero proto3 value. +func isProto3Zero(v reflect.Value) bool { + switch v.Kind() { + case reflect.Bool: + return !v.Bool() + case reflect.Int32, reflect.Int64: + return v.Int() == 0 + case reflect.Uint32, reflect.Uint64: + return v.Uint() == 0 + case reflect.Float32, reflect.Float64: + return v.Float() == 0 + case reflect.String: + return v.String() == "" + } + return false +} + +// ProtoPackageIsVersion2 is referenced from generated protocol buffer files +// to assert that that code is compatible with this version of the proto package. +const GoGoProtoPackageIsVersion2 = true + +// ProtoPackageIsVersion1 is referenced from generated protocol buffer files +// to assert that that code is compatible with this version of the proto package. +const GoGoProtoPackageIsVersion1 = true + +// InternalMessageInfo is a type used internally by generated .pb.go files. +// This type is not intended to be used by non-generated code. +// This type is not subject to any compatibility guarantee. +type InternalMessageInfo struct { + marshal *marshalInfo + unmarshal *unmarshalInfo + merge *mergeInfo + discard *discardInfo +} diff --git a/vendor/github.com/gogo/protobuf/proto/lib_gogo.go b/vendor/github.com/gogo/protobuf/proto/lib_gogo.go new file mode 100644 index 000000000000..b3aa39190a13 --- /dev/null +++ b/vendor/github.com/gogo/protobuf/proto/lib_gogo.go @@ -0,0 +1,50 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2013, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +package proto + +import ( + "encoding/json" + "strconv" +) + +type Sizer interface { + Size() int +} + +type ProtoSizer interface { + ProtoSize() int +} + +func MarshalJSONEnum(m map[int32]string, value int32) ([]byte, error) { + s, ok := m[value] + if !ok { + s = strconv.Itoa(int(value)) + } + return json.Marshal(s) +} diff --git a/vendor/github.com/gogo/protobuf/proto/message_set.go b/vendor/github.com/gogo/protobuf/proto/message_set.go new file mode 100644 index 000000000000..3b6ca41d5e55 --- /dev/null +++ b/vendor/github.com/gogo/protobuf/proto/message_set.go @@ -0,0 +1,314 @@ +// Go support for Protocol Buffers - Google's data interchange format +// +// Copyright 2010 The Go Authors. All rights reserved. +// https://github.com/golang/protobuf +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +package proto + +/* + * Support for message sets. + */ + +import ( + "bytes" + "encoding/json" + "errors" + "fmt" + "reflect" + "sort" + "sync" +) + +// errNoMessageTypeID occurs when a protocol buffer does not have a message type ID. +// A message type ID is required for storing a protocol buffer in a message set. +var errNoMessageTypeID = errors.New("proto does not have a message type ID") + +// The first two types (_MessageSet_Item and messageSet) +// model what the protocol compiler produces for the following protocol message: +// message MessageSet { +// repeated group Item = 1 { +// required int32 type_id = 2; +// required string message = 3; +// }; +// } +// That is the MessageSet wire format. We can't use a proto to generate these +// because that would introduce a circular dependency between it and this package. + +type _MessageSet_Item struct { + TypeId *int32 `protobuf:"varint,2,req,name=type_id"` + Message []byte `protobuf:"bytes,3,req,name=message"` +} + +type messageSet struct { + Item []*_MessageSet_Item `protobuf:"group,1,rep"` + XXX_unrecognized []byte + // TODO: caching? +} + +// Make sure messageSet is a Message. +var _ Message = (*messageSet)(nil) + +// messageTypeIder is an interface satisfied by a protocol buffer type +// that may be stored in a MessageSet. +type messageTypeIder interface { + MessageTypeId() int32 +} + +func (ms *messageSet) find(pb Message) *_MessageSet_Item { + mti, ok := pb.(messageTypeIder) + if !ok { + return nil + } + id := mti.MessageTypeId() + for _, item := range ms.Item { + if *item.TypeId == id { + return item + } + } + return nil +} + +func (ms *messageSet) Has(pb Message) bool { + return ms.find(pb) != nil +} + +func (ms *messageSet) Unmarshal(pb Message) error { + if item := ms.find(pb); item != nil { + return Unmarshal(item.Message, pb) + } + if _, ok := pb.(messageTypeIder); !ok { + return errNoMessageTypeID + } + return nil // TODO: return error instead? +} + +func (ms *messageSet) Marshal(pb Message) error { + msg, err := Marshal(pb) + if err != nil { + return err + } + if item := ms.find(pb); item != nil { + // reuse existing item + item.Message = msg + return nil + } + + mti, ok := pb.(messageTypeIder) + if !ok { + return errNoMessageTypeID + } + + mtid := mti.MessageTypeId() + ms.Item = append(ms.Item, &_MessageSet_Item{ + TypeId: &mtid, + Message: msg, + }) + return nil +} + +func (ms *messageSet) Reset() { *ms = messageSet{} } +func (ms *messageSet) String() string { return CompactTextString(ms) } +func (*messageSet) ProtoMessage() {} + +// Support for the message_set_wire_format message option. + +func skipVarint(buf []byte) []byte { + i := 0 + for ; buf[i]&0x80 != 0; i++ { + } + return buf[i+1:] +} + +// MarshalMessageSet encodes the extension map represented by m in the message set wire format. +// It is called by generated Marshal methods on protocol buffer messages with the message_set_wire_format option. +func MarshalMessageSet(exts interface{}) ([]byte, error) { + return marshalMessageSet(exts, false) +} + +// marshaMessageSet implements above function, with the opt to turn on / off deterministic during Marshal. +func marshalMessageSet(exts interface{}, deterministic bool) ([]byte, error) { + switch exts := exts.(type) { + case *XXX_InternalExtensions: + var u marshalInfo + siz := u.sizeMessageSet(exts) + b := make([]byte, 0, siz) + return u.appendMessageSet(b, exts, deterministic) + + case map[int32]Extension: + // This is an old-style extension map. + // Wrap it in a new-style XXX_InternalExtensions. + ie := XXX_InternalExtensions{ + p: &struct { + mu sync.Mutex + extensionMap map[int32]Extension + }{ + extensionMap: exts, + }, + } + + var u marshalInfo + siz := u.sizeMessageSet(&ie) + b := make([]byte, 0, siz) + return u.appendMessageSet(b, &ie, deterministic) + + default: + return nil, errors.New("proto: not an extension map") + } +} + +// UnmarshalMessageSet decodes the extension map encoded in buf in the message set wire format. +// It is called by Unmarshal methods on protocol buffer messages with the message_set_wire_format option. +func UnmarshalMessageSet(buf []byte, exts interface{}) error { + var m map[int32]Extension + switch exts := exts.(type) { + case *XXX_InternalExtensions: + m = exts.extensionsWrite() + case map[int32]Extension: + m = exts + default: + return errors.New("proto: not an extension map") + } + + ms := new(messageSet) + if err := Unmarshal(buf, ms); err != nil { + return err + } + for _, item := range ms.Item { + id := *item.TypeId + msg := item.Message + + // Restore wire type and field number varint, plus length varint. + // Be careful to preserve duplicate items. + b := EncodeVarint(uint64(id)<<3 | WireBytes) + if ext, ok := m[id]; ok { + // Existing data; rip off the tag and length varint + // so we join the new data correctly. + // We can assume that ext.enc is set because we are unmarshaling. + o := ext.enc[len(b):] // skip wire type and field number + _, n := DecodeVarint(o) // calculate length of length varint + o = o[n:] // skip length varint + msg = append(o, msg...) // join old data and new data + } + b = append(b, EncodeVarint(uint64(len(msg)))...) + b = append(b, msg...) + + m[id] = Extension{enc: b} + } + return nil +} + +// MarshalMessageSetJSON encodes the extension map represented by m in JSON format. +// It is called by generated MarshalJSON methods on protocol buffer messages with the message_set_wire_format option. +func MarshalMessageSetJSON(exts interface{}) ([]byte, error) { + var m map[int32]Extension + switch exts := exts.(type) { + case *XXX_InternalExtensions: + var mu sync.Locker + m, mu = exts.extensionsRead() + if m != nil { + // Keep the extensions map locked until we're done marshaling to prevent + // races between marshaling and unmarshaling the lazily-{en,de}coded + // values. + mu.Lock() + defer mu.Unlock() + } + case map[int32]Extension: + m = exts + default: + return nil, errors.New("proto: not an extension map") + } + var b bytes.Buffer + b.WriteByte('{') + + // Process the map in key order for deterministic output. + ids := make([]int32, 0, len(m)) + for id := range m { + ids = append(ids, id) + } + sort.Sort(int32Slice(ids)) // int32Slice defined in text.go + + for i, id := range ids { + ext := m[id] + msd, ok := messageSetMap[id] + if !ok { + // Unknown type; we can't render it, so skip it. + continue + } + + if i > 0 && b.Len() > 1 { + b.WriteByte(',') + } + + fmt.Fprintf(&b, `"[%s]":`, msd.name) + + x := ext.value + if x == nil { + x = reflect.New(msd.t.Elem()).Interface() + if err := Unmarshal(ext.enc, x.(Message)); err != nil { + return nil, err + } + } + d, err := json.Marshal(x) + if err != nil { + return nil, err + } + b.Write(d) + } + b.WriteByte('}') + return b.Bytes(), nil +} + +// UnmarshalMessageSetJSON decodes the extension map encoded in buf in JSON format. +// It is called by generated UnmarshalJSON methods on protocol buffer messages with the message_set_wire_format option. +func UnmarshalMessageSetJSON(buf []byte, exts interface{}) error { + // Common-case fast path. + if len(buf) == 0 || bytes.Equal(buf, []byte("{}")) { + return nil + } + + // This is fairly tricky, and it's not clear that it is needed. + return errors.New("TODO: UnmarshalMessageSetJSON not yet implemented") +} + +// A global registry of types that can be used in a MessageSet. + +var messageSetMap = make(map[int32]messageSetDesc) + +type messageSetDesc struct { + t reflect.Type // pointer to struct + name string +} + +// RegisterMessageSetType is called from the generated code. +func RegisterMessageSetType(m Message, fieldNum int32, name string) { + messageSetMap[fieldNum] = messageSetDesc{ + t: reflect.TypeOf(m), + name: name, + } +} diff --git a/vendor/github.com/gogo/protobuf/proto/pointer_reflect.go b/vendor/github.com/gogo/protobuf/proto/pointer_reflect.go new file mode 100644 index 000000000000..b6cad90834b3 --- /dev/null +++ b/vendor/github.com/gogo/protobuf/proto/pointer_reflect.go @@ -0,0 +1,357 @@ +// Go support for Protocol Buffers - Google's data interchange format +// +// Copyright 2012 The Go Authors. All rights reserved. +// https://github.com/golang/protobuf +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// +build purego appengine js + +// This file contains an implementation of proto field accesses using package reflect. +// It is slower than the code in pointer_unsafe.go but it avoids package unsafe and can +// be used on App Engine. + +package proto + +import ( + "reflect" + "sync" +) + +const unsafeAllowed = false + +// A field identifies a field in a struct, accessible from a pointer. +// In this implementation, a field is identified by the sequence of field indices +// passed to reflect's FieldByIndex. +type field []int + +// toField returns a field equivalent to the given reflect field. +func toField(f *reflect.StructField) field { + return f.Index +} + +// invalidField is an invalid field identifier. +var invalidField = field(nil) + +// zeroField is a noop when calling pointer.offset. +var zeroField = field([]int{}) + +// IsValid reports whether the field identifier is valid. +func (f field) IsValid() bool { return f != nil } + +// The pointer type is for the table-driven decoder. +// The implementation here uses a reflect.Value of pointer type to +// create a generic pointer. In pointer_unsafe.go we use unsafe +// instead of reflect to implement the same (but faster) interface. +type pointer struct { + v reflect.Value +} + +// toPointer converts an interface of pointer type to a pointer +// that points to the same target. +func toPointer(i *Message) pointer { + return pointer{v: reflect.ValueOf(*i)} +} + +// toAddrPointer converts an interface to a pointer that points to +// the interface data. +func toAddrPointer(i *interface{}, isptr bool) pointer { + v := reflect.ValueOf(*i) + u := reflect.New(v.Type()) + u.Elem().Set(v) + return pointer{v: u} +} + +// valToPointer converts v to a pointer. v must be of pointer type. +func valToPointer(v reflect.Value) pointer { + return pointer{v: v} +} + +// offset converts from a pointer to a structure to a pointer to +// one of its fields. +func (p pointer) offset(f field) pointer { + return pointer{v: p.v.Elem().FieldByIndex(f).Addr()} +} + +func (p pointer) isNil() bool { + return p.v.IsNil() +} + +// grow updates the slice s in place to make it one element longer. +// s must be addressable. +// Returns the (addressable) new element. +func grow(s reflect.Value) reflect.Value { + n, m := s.Len(), s.Cap() + if n < m { + s.SetLen(n + 1) + } else { + s.Set(reflect.Append(s, reflect.Zero(s.Type().Elem()))) + } + return s.Index(n) +} + +func (p pointer) toInt64() *int64 { + return p.v.Interface().(*int64) +} +func (p pointer) toInt64Ptr() **int64 { + return p.v.Interface().(**int64) +} +func (p pointer) toInt64Slice() *[]int64 { + return p.v.Interface().(*[]int64) +} + +var int32ptr = reflect.TypeOf((*int32)(nil)) + +func (p pointer) toInt32() *int32 { + return p.v.Convert(int32ptr).Interface().(*int32) +} + +// The toInt32Ptr/Slice methods don't work because of enums. +// Instead, we must use set/get methods for the int32ptr/slice case. +/* + func (p pointer) toInt32Ptr() **int32 { + return p.v.Interface().(**int32) +} + func (p pointer) toInt32Slice() *[]int32 { + return p.v.Interface().(*[]int32) +} +*/ +func (p pointer) getInt32Ptr() *int32 { + if p.v.Type().Elem().Elem() == reflect.TypeOf(int32(0)) { + // raw int32 type + return p.v.Elem().Interface().(*int32) + } + // an enum + return p.v.Elem().Convert(int32PtrType).Interface().(*int32) +} +func (p pointer) setInt32Ptr(v int32) { + // Allocate value in a *int32. Possibly convert that to a *enum. + // Then assign it to a **int32 or **enum. + // Note: we can convert *int32 to *enum, but we can't convert + // **int32 to **enum! + p.v.Elem().Set(reflect.ValueOf(&v).Convert(p.v.Type().Elem())) +} + +// getInt32Slice copies []int32 from p as a new slice. +// This behavior differs from the implementation in pointer_unsafe.go. +func (p pointer) getInt32Slice() []int32 { + if p.v.Type().Elem().Elem() == reflect.TypeOf(int32(0)) { + // raw int32 type + return p.v.Elem().Interface().([]int32) + } + // an enum + // Allocate a []int32, then assign []enum's values into it. + // Note: we can't convert []enum to []int32. + slice := p.v.Elem() + s := make([]int32, slice.Len()) + for i := 0; i < slice.Len(); i++ { + s[i] = int32(slice.Index(i).Int()) + } + return s +} + +// setInt32Slice copies []int32 into p as a new slice. +// This behavior differs from the implementation in pointer_unsafe.go. +func (p pointer) setInt32Slice(v []int32) { + if p.v.Type().Elem().Elem() == reflect.TypeOf(int32(0)) { + // raw int32 type + p.v.Elem().Set(reflect.ValueOf(v)) + return + } + // an enum + // Allocate a []enum, then assign []int32's values into it. + // Note: we can't convert []enum to []int32. + slice := reflect.MakeSlice(p.v.Type().Elem(), len(v), cap(v)) + for i, x := range v { + slice.Index(i).SetInt(int64(x)) + } + p.v.Elem().Set(slice) +} +func (p pointer) appendInt32Slice(v int32) { + grow(p.v.Elem()).SetInt(int64(v)) +} + +func (p pointer) toUint64() *uint64 { + return p.v.Interface().(*uint64) +} +func (p pointer) toUint64Ptr() **uint64 { + return p.v.Interface().(**uint64) +} +func (p pointer) toUint64Slice() *[]uint64 { + return p.v.Interface().(*[]uint64) +} +func (p pointer) toUint32() *uint32 { + return p.v.Interface().(*uint32) +} +func (p pointer) toUint32Ptr() **uint32 { + return p.v.Interface().(**uint32) +} +func (p pointer) toUint32Slice() *[]uint32 { + return p.v.Interface().(*[]uint32) +} +func (p pointer) toBool() *bool { + return p.v.Interface().(*bool) +} +func (p pointer) toBoolPtr() **bool { + return p.v.Interface().(**bool) +} +func (p pointer) toBoolSlice() *[]bool { + return p.v.Interface().(*[]bool) +} +func (p pointer) toFloat64() *float64 { + return p.v.Interface().(*float64) +} +func (p pointer) toFloat64Ptr() **float64 { + return p.v.Interface().(**float64) +} +func (p pointer) toFloat64Slice() *[]float64 { + return p.v.Interface().(*[]float64) +} +func (p pointer) toFloat32() *float32 { + return p.v.Interface().(*float32) +} +func (p pointer) toFloat32Ptr() **float32 { + return p.v.Interface().(**float32) +} +func (p pointer) toFloat32Slice() *[]float32 { + return p.v.Interface().(*[]float32) +} +func (p pointer) toString() *string { + return p.v.Interface().(*string) +} +func (p pointer) toStringPtr() **string { + return p.v.Interface().(**string) +} +func (p pointer) toStringSlice() *[]string { + return p.v.Interface().(*[]string) +} +func (p pointer) toBytes() *[]byte { + return p.v.Interface().(*[]byte) +} +func (p pointer) toBytesSlice() *[][]byte { + return p.v.Interface().(*[][]byte) +} +func (p pointer) toExtensions() *XXX_InternalExtensions { + return p.v.Interface().(*XXX_InternalExtensions) +} +func (p pointer) toOldExtensions() *map[int32]Extension { + return p.v.Interface().(*map[int32]Extension) +} +func (p pointer) getPointer() pointer { + return pointer{v: p.v.Elem()} +} +func (p pointer) setPointer(q pointer) { + p.v.Elem().Set(q.v) +} +func (p pointer) appendPointer(q pointer) { + grow(p.v.Elem()).Set(q.v) +} + +// getPointerSlice copies []*T from p as a new []pointer. +// This behavior differs from the implementation in pointer_unsafe.go. +func (p pointer) getPointerSlice() []pointer { + if p.v.IsNil() { + return nil + } + n := p.v.Elem().Len() + s := make([]pointer, n) + for i := 0; i < n; i++ { + s[i] = pointer{v: p.v.Elem().Index(i)} + } + return s +} + +// setPointerSlice copies []pointer into p as a new []*T. +// This behavior differs from the implementation in pointer_unsafe.go. +func (p pointer) setPointerSlice(v []pointer) { + if v == nil { + p.v.Elem().Set(reflect.New(p.v.Elem().Type()).Elem()) + return + } + s := reflect.MakeSlice(p.v.Elem().Type(), 0, len(v)) + for _, p := range v { + s = reflect.Append(s, p.v) + } + p.v.Elem().Set(s) +} + +// getInterfacePointer returns a pointer that points to the +// interface data of the interface pointed by p. +func (p pointer) getInterfacePointer() pointer { + if p.v.Elem().IsNil() { + return pointer{v: p.v.Elem()} + } + return pointer{v: p.v.Elem().Elem().Elem().Field(0).Addr()} // *interface -> interface -> *struct -> struct +} + +func (p pointer) asPointerTo(t reflect.Type) reflect.Value { + // TODO: check that p.v.Type().Elem() == t? + return p.v +} + +func atomicLoadUnmarshalInfo(p **unmarshalInfo) *unmarshalInfo { + atomicLock.Lock() + defer atomicLock.Unlock() + return *p +} +func atomicStoreUnmarshalInfo(p **unmarshalInfo, v *unmarshalInfo) { + atomicLock.Lock() + defer atomicLock.Unlock() + *p = v +} +func atomicLoadMarshalInfo(p **marshalInfo) *marshalInfo { + atomicLock.Lock() + defer atomicLock.Unlock() + return *p +} +func atomicStoreMarshalInfo(p **marshalInfo, v *marshalInfo) { + atomicLock.Lock() + defer atomicLock.Unlock() + *p = v +} +func atomicLoadMergeInfo(p **mergeInfo) *mergeInfo { + atomicLock.Lock() + defer atomicLock.Unlock() + return *p +} +func atomicStoreMergeInfo(p **mergeInfo, v *mergeInfo) { + atomicLock.Lock() + defer atomicLock.Unlock() + *p = v +} +func atomicLoadDiscardInfo(p **discardInfo) *discardInfo { + atomicLock.Lock() + defer atomicLock.Unlock() + return *p +} +func atomicStoreDiscardInfo(p **discardInfo, v *discardInfo) { + atomicLock.Lock() + defer atomicLock.Unlock() + *p = v +} + +var atomicLock sync.Mutex diff --git a/vendor/github.com/gogo/protobuf/proto/pointer_reflect_gogo.go b/vendor/github.com/gogo/protobuf/proto/pointer_reflect_gogo.go new file mode 100644 index 000000000000..7ffd3c29d90c --- /dev/null +++ b/vendor/github.com/gogo/protobuf/proto/pointer_reflect_gogo.go @@ -0,0 +1,59 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2018, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// +build purego appengine js + +// This file contains an implementation of proto field accesses using package reflect. +// It is slower than the code in pointer_unsafe.go but it avoids package unsafe and can +// be used on App Engine. + +package proto + +import ( + "reflect" +) + +// TODO: untested, so probably incorrect. + +func (p pointer) getRef() pointer { + return pointer{v: p.v.Addr()} +} + +func (p pointer) appendRef(v pointer, typ reflect.Type) { + slice := p.getSlice(typ) + elem := v.asPointerTo(typ).Elem() + newSlice := reflect.Append(slice, elem) + slice.Set(newSlice) +} + +func (p pointer) getSlice(typ reflect.Type) reflect.Value { + sliceTyp := reflect.SliceOf(typ) + slice := p.asPointerTo(sliceTyp) + slice = slice.Elem() + return slice +} diff --git a/vendor/github.com/gogo/protobuf/proto/pointer_unsafe.go b/vendor/github.com/gogo/protobuf/proto/pointer_unsafe.go new file mode 100644 index 000000000000..d55a335d9453 --- /dev/null +++ b/vendor/github.com/gogo/protobuf/proto/pointer_unsafe.go @@ -0,0 +1,308 @@ +// Go support for Protocol Buffers - Google's data interchange format +// +// Copyright 2012 The Go Authors. All rights reserved. +// https://github.com/golang/protobuf +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// +build !purego,!appengine,!js + +// This file contains the implementation of the proto field accesses using package unsafe. + +package proto + +import ( + "reflect" + "sync/atomic" + "unsafe" +) + +const unsafeAllowed = true + +// A field identifies a field in a struct, accessible from a pointer. +// In this implementation, a field is identified by its byte offset from the start of the struct. +type field uintptr + +// toField returns a field equivalent to the given reflect field. +func toField(f *reflect.StructField) field { + return field(f.Offset) +} + +// invalidField is an invalid field identifier. +const invalidField = ^field(0) + +// zeroField is a noop when calling pointer.offset. +const zeroField = field(0) + +// IsValid reports whether the field identifier is valid. +func (f field) IsValid() bool { + return f != invalidField +} + +// The pointer type below is for the new table-driven encoder/decoder. +// The implementation here uses unsafe.Pointer to create a generic pointer. +// In pointer_reflect.go we use reflect instead of unsafe to implement +// the same (but slower) interface. +type pointer struct { + p unsafe.Pointer +} + +// size of pointer +var ptrSize = unsafe.Sizeof(uintptr(0)) + +// toPointer converts an interface of pointer type to a pointer +// that points to the same target. +func toPointer(i *Message) pointer { + // Super-tricky - read pointer out of data word of interface value. + // Saves ~25ns over the equivalent: + // return valToPointer(reflect.ValueOf(*i)) + return pointer{p: (*[2]unsafe.Pointer)(unsafe.Pointer(i))[1]} +} + +// toAddrPointer converts an interface to a pointer that points to +// the interface data. +func toAddrPointer(i *interface{}, isptr bool) pointer { + // Super-tricky - read or get the address of data word of interface value. + if isptr { + // The interface is of pointer type, thus it is a direct interface. + // The data word is the pointer data itself. We take its address. + return pointer{p: unsafe.Pointer(uintptr(unsafe.Pointer(i)) + ptrSize)} + } + // The interface is not of pointer type. The data word is the pointer + // to the data. + return pointer{p: (*[2]unsafe.Pointer)(unsafe.Pointer(i))[1]} +} + +// valToPointer converts v to a pointer. v must be of pointer type. +func valToPointer(v reflect.Value) pointer { + return pointer{p: unsafe.Pointer(v.Pointer())} +} + +// offset converts from a pointer to a structure to a pointer to +// one of its fields. +func (p pointer) offset(f field) pointer { + // For safety, we should panic if !f.IsValid, however calling panic causes + // this to no longer be inlineable, which is a serious performance cost. + /* + if !f.IsValid() { + panic("invalid field") + } + */ + return pointer{p: unsafe.Pointer(uintptr(p.p) + uintptr(f))} +} + +func (p pointer) isNil() bool { + return p.p == nil +} + +func (p pointer) toInt64() *int64 { + return (*int64)(p.p) +} +func (p pointer) toInt64Ptr() **int64 { + return (**int64)(p.p) +} +func (p pointer) toInt64Slice() *[]int64 { + return (*[]int64)(p.p) +} +func (p pointer) toInt32() *int32 { + return (*int32)(p.p) +} + +// See pointer_reflect.go for why toInt32Ptr/Slice doesn't exist. +/* + func (p pointer) toInt32Ptr() **int32 { + return (**int32)(p.p) + } + func (p pointer) toInt32Slice() *[]int32 { + return (*[]int32)(p.p) + } +*/ +func (p pointer) getInt32Ptr() *int32 { + return *(**int32)(p.p) +} +func (p pointer) setInt32Ptr(v int32) { + *(**int32)(p.p) = &v +} + +// getInt32Slice loads a []int32 from p. +// The value returned is aliased with the original slice. +// This behavior differs from the implementation in pointer_reflect.go. +func (p pointer) getInt32Slice() []int32 { + return *(*[]int32)(p.p) +} + +// setInt32Slice stores a []int32 to p. +// The value set is aliased with the input slice. +// This behavior differs from the implementation in pointer_reflect.go. +func (p pointer) setInt32Slice(v []int32) { + *(*[]int32)(p.p) = v +} + +// TODO: Can we get rid of appendInt32Slice and use setInt32Slice instead? +func (p pointer) appendInt32Slice(v int32) { + s := (*[]int32)(p.p) + *s = append(*s, v) +} + +func (p pointer) toUint64() *uint64 { + return (*uint64)(p.p) +} +func (p pointer) toUint64Ptr() **uint64 { + return (**uint64)(p.p) +} +func (p pointer) toUint64Slice() *[]uint64 { + return (*[]uint64)(p.p) +} +func (p pointer) toUint32() *uint32 { + return (*uint32)(p.p) +} +func (p pointer) toUint32Ptr() **uint32 { + return (**uint32)(p.p) +} +func (p pointer) toUint32Slice() *[]uint32 { + return (*[]uint32)(p.p) +} +func (p pointer) toBool() *bool { + return (*bool)(p.p) +} +func (p pointer) toBoolPtr() **bool { + return (**bool)(p.p) +} +func (p pointer) toBoolSlice() *[]bool { + return (*[]bool)(p.p) +} +func (p pointer) toFloat64() *float64 { + return (*float64)(p.p) +} +func (p pointer) toFloat64Ptr() **float64 { + return (**float64)(p.p) +} +func (p pointer) toFloat64Slice() *[]float64 { + return (*[]float64)(p.p) +} +func (p pointer) toFloat32() *float32 { + return (*float32)(p.p) +} +func (p pointer) toFloat32Ptr() **float32 { + return (**float32)(p.p) +} +func (p pointer) toFloat32Slice() *[]float32 { + return (*[]float32)(p.p) +} +func (p pointer) toString() *string { + return (*string)(p.p) +} +func (p pointer) toStringPtr() **string { + return (**string)(p.p) +} +func (p pointer) toStringSlice() *[]string { + return (*[]string)(p.p) +} +func (p pointer) toBytes() *[]byte { + return (*[]byte)(p.p) +} +func (p pointer) toBytesSlice() *[][]byte { + return (*[][]byte)(p.p) +} +func (p pointer) toExtensions() *XXX_InternalExtensions { + return (*XXX_InternalExtensions)(p.p) +} +func (p pointer) toOldExtensions() *map[int32]Extension { + return (*map[int32]Extension)(p.p) +} + +// getPointerSlice loads []*T from p as a []pointer. +// The value returned is aliased with the original slice. +// This behavior differs from the implementation in pointer_reflect.go. +func (p pointer) getPointerSlice() []pointer { + // Super-tricky - p should point to a []*T where T is a + // message type. We load it as []pointer. + return *(*[]pointer)(p.p) +} + +// setPointerSlice stores []pointer into p as a []*T. +// The value set is aliased with the input slice. +// This behavior differs from the implementation in pointer_reflect.go. +func (p pointer) setPointerSlice(v []pointer) { + // Super-tricky - p should point to a []*T where T is a + // message type. We store it as []pointer. + *(*[]pointer)(p.p) = v +} + +// getPointer loads the pointer at p and returns it. +func (p pointer) getPointer() pointer { + return pointer{p: *(*unsafe.Pointer)(p.p)} +} + +// setPointer stores the pointer q at p. +func (p pointer) setPointer(q pointer) { + *(*unsafe.Pointer)(p.p) = q.p +} + +// append q to the slice pointed to by p. +func (p pointer) appendPointer(q pointer) { + s := (*[]unsafe.Pointer)(p.p) + *s = append(*s, q.p) +} + +// getInterfacePointer returns a pointer that points to the +// interface data of the interface pointed by p. +func (p pointer) getInterfacePointer() pointer { + // Super-tricky - read pointer out of data word of interface value. + return pointer{p: (*(*[2]unsafe.Pointer)(p.p))[1]} +} + +// asPointerTo returns a reflect.Value that is a pointer to an +// object of type t stored at p. +func (p pointer) asPointerTo(t reflect.Type) reflect.Value { + return reflect.NewAt(t, p.p) +} + +func atomicLoadUnmarshalInfo(p **unmarshalInfo) *unmarshalInfo { + return (*unmarshalInfo)(atomic.LoadPointer((*unsafe.Pointer)(unsafe.Pointer(p)))) +} +func atomicStoreUnmarshalInfo(p **unmarshalInfo, v *unmarshalInfo) { + atomic.StorePointer((*unsafe.Pointer)(unsafe.Pointer(p)), unsafe.Pointer(v)) +} +func atomicLoadMarshalInfo(p **marshalInfo) *marshalInfo { + return (*marshalInfo)(atomic.LoadPointer((*unsafe.Pointer)(unsafe.Pointer(p)))) +} +func atomicStoreMarshalInfo(p **marshalInfo, v *marshalInfo) { + atomic.StorePointer((*unsafe.Pointer)(unsafe.Pointer(p)), unsafe.Pointer(v)) +} +func atomicLoadMergeInfo(p **mergeInfo) *mergeInfo { + return (*mergeInfo)(atomic.LoadPointer((*unsafe.Pointer)(unsafe.Pointer(p)))) +} +func atomicStoreMergeInfo(p **mergeInfo, v *mergeInfo) { + atomic.StorePointer((*unsafe.Pointer)(unsafe.Pointer(p)), unsafe.Pointer(v)) +} +func atomicLoadDiscardInfo(p **discardInfo) *discardInfo { + return (*discardInfo)(atomic.LoadPointer((*unsafe.Pointer)(unsafe.Pointer(p)))) +} +func atomicStoreDiscardInfo(p **discardInfo, v *discardInfo) { + atomic.StorePointer((*unsafe.Pointer)(unsafe.Pointer(p)), unsafe.Pointer(v)) +} diff --git a/vendor/github.com/gogo/protobuf/proto/pointer_unsafe_gogo.go b/vendor/github.com/gogo/protobuf/proto/pointer_unsafe_gogo.go new file mode 100644 index 000000000000..aca8eed02a11 --- /dev/null +++ b/vendor/github.com/gogo/protobuf/proto/pointer_unsafe_gogo.go @@ -0,0 +1,56 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2018, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// +build !purego,!appengine,!js + +// This file contains the implementation of the proto field accesses using package unsafe. + +package proto + +import ( + "reflect" + "unsafe" +) + +func (p pointer) getRef() pointer { + return pointer{p: (unsafe.Pointer)(&p.p)} +} + +func (p pointer) appendRef(v pointer, typ reflect.Type) { + slice := p.getSlice(typ) + elem := v.asPointerTo(typ).Elem() + newSlice := reflect.Append(slice, elem) + slice.Set(newSlice) +} + +func (p pointer) getSlice(typ reflect.Type) reflect.Value { + sliceTyp := reflect.SliceOf(typ) + slice := p.asPointerTo(sliceTyp) + slice = slice.Elem() + return slice +} diff --git a/vendor/github.com/gogo/protobuf/proto/properties.go b/vendor/github.com/gogo/protobuf/proto/properties.go new file mode 100644 index 000000000000..7a5e28efe519 --- /dev/null +++ b/vendor/github.com/gogo/protobuf/proto/properties.go @@ -0,0 +1,600 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2013, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// Go support for Protocol Buffers - Google's data interchange format +// +// Copyright 2010 The Go Authors. All rights reserved. +// https://github.com/golang/protobuf +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +package proto + +/* + * Routines for encoding data into the wire format for protocol buffers. + */ + +import ( + "fmt" + "log" + "os" + "reflect" + "sort" + "strconv" + "strings" + "sync" +) + +const debug bool = false + +// Constants that identify the encoding of a value on the wire. +const ( + WireVarint = 0 + WireFixed64 = 1 + WireBytes = 2 + WireStartGroup = 3 + WireEndGroup = 4 + WireFixed32 = 5 +) + +// tagMap is an optimization over map[int]int for typical protocol buffer +// use-cases. Encoded protocol buffers are often in tag order with small tag +// numbers. +type tagMap struct { + fastTags []int + slowTags map[int]int +} + +// tagMapFastLimit is the upper bound on the tag number that will be stored in +// the tagMap slice rather than its map. +const tagMapFastLimit = 1024 + +func (p *tagMap) get(t int) (int, bool) { + if t > 0 && t < tagMapFastLimit { + if t >= len(p.fastTags) { + return 0, false + } + fi := p.fastTags[t] + return fi, fi >= 0 + } + fi, ok := p.slowTags[t] + return fi, ok +} + +func (p *tagMap) put(t int, fi int) { + if t > 0 && t < tagMapFastLimit { + for len(p.fastTags) < t+1 { + p.fastTags = append(p.fastTags, -1) + } + p.fastTags[t] = fi + return + } + if p.slowTags == nil { + p.slowTags = make(map[int]int) + } + p.slowTags[t] = fi +} + +// StructProperties represents properties for all the fields of a struct. +// decoderTags and decoderOrigNames should only be used by the decoder. +type StructProperties struct { + Prop []*Properties // properties for each field + reqCount int // required count + decoderTags tagMap // map from proto tag to struct field number + decoderOrigNames map[string]int // map from original name to struct field number + order []int // list of struct field numbers in tag order + + // OneofTypes contains information about the oneof fields in this message. + // It is keyed by the original name of a field. + OneofTypes map[string]*OneofProperties +} + +// OneofProperties represents information about a specific field in a oneof. +type OneofProperties struct { + Type reflect.Type // pointer to generated struct type for this oneof field + Field int // struct field number of the containing oneof in the message + Prop *Properties +} + +// Implement the sorting interface so we can sort the fields in tag order, as recommended by the spec. +// See encode.go, (*Buffer).enc_struct. + +func (sp *StructProperties) Len() int { return len(sp.order) } +func (sp *StructProperties) Less(i, j int) bool { + return sp.Prop[sp.order[i]].Tag < sp.Prop[sp.order[j]].Tag +} +func (sp *StructProperties) Swap(i, j int) { sp.order[i], sp.order[j] = sp.order[j], sp.order[i] } + +// Properties represents the protocol-specific behavior of a single struct field. +type Properties struct { + Name string // name of the field, for error messages + OrigName string // original name before protocol compiler (always set) + JSONName string // name to use for JSON; determined by protoc + Wire string + WireType int + Tag int + Required bool + Optional bool + Repeated bool + Packed bool // relevant for repeated primitives only + Enum string // set for enum types only + proto3 bool // whether this is known to be a proto3 field; set for []byte only + oneof bool // whether this is a oneof field + + Default string // default value + HasDefault bool // whether an explicit default was provided + CustomType string + CastType string + StdTime bool + StdDuration bool + + stype reflect.Type // set for struct types only + ctype reflect.Type // set for custom types only + sprop *StructProperties // set for struct types only + + mtype reflect.Type // set for map types only + mkeyprop *Properties // set for map types only + mvalprop *Properties // set for map types only +} + +// String formats the properties in the protobuf struct field tag style. +func (p *Properties) String() string { + s := p.Wire + s += "," + s += strconv.Itoa(p.Tag) + if p.Required { + s += ",req" + } + if p.Optional { + s += ",opt" + } + if p.Repeated { + s += ",rep" + } + if p.Packed { + s += ",packed" + } + s += ",name=" + p.OrigName + if p.JSONName != p.OrigName { + s += ",json=" + p.JSONName + } + if p.proto3 { + s += ",proto3" + } + if p.oneof { + s += ",oneof" + } + if len(p.Enum) > 0 { + s += ",enum=" + p.Enum + } + if p.HasDefault { + s += ",def=" + p.Default + } + return s +} + +// Parse populates p by parsing a string in the protobuf struct field tag style. +func (p *Properties) Parse(s string) { + // "bytes,49,opt,name=foo,def=hello!" + fields := strings.Split(s, ",") // breaks def=, but handled below. + if len(fields) < 2 { + fmt.Fprintf(os.Stderr, "proto: tag has too few fields: %q\n", s) + return + } + + p.Wire = fields[0] + switch p.Wire { + case "varint": + p.WireType = WireVarint + case "fixed32": + p.WireType = WireFixed32 + case "fixed64": + p.WireType = WireFixed64 + case "zigzag32": + p.WireType = WireVarint + case "zigzag64": + p.WireType = WireVarint + case "bytes", "group": + p.WireType = WireBytes + // no numeric converter for non-numeric types + default: + fmt.Fprintf(os.Stderr, "proto: tag has unknown wire type: %q\n", s) + return + } + + var err error + p.Tag, err = strconv.Atoi(fields[1]) + if err != nil { + return + } + +outer: + for i := 2; i < len(fields); i++ { + f := fields[i] + switch { + case f == "req": + p.Required = true + case f == "opt": + p.Optional = true + case f == "rep": + p.Repeated = true + case f == "packed": + p.Packed = true + case strings.HasPrefix(f, "name="): + p.OrigName = f[5:] + case strings.HasPrefix(f, "json="): + p.JSONName = f[5:] + case strings.HasPrefix(f, "enum="): + p.Enum = f[5:] + case f == "proto3": + p.proto3 = true + case f == "oneof": + p.oneof = true + case strings.HasPrefix(f, "def="): + p.HasDefault = true + p.Default = f[4:] // rest of string + if i+1 < len(fields) { + // Commas aren't escaped, and def is always last. + p.Default += "," + strings.Join(fields[i+1:], ",") + break outer + } + case strings.HasPrefix(f, "embedded="): + p.OrigName = strings.Split(f, "=")[1] + case strings.HasPrefix(f, "customtype="): + p.CustomType = strings.Split(f, "=")[1] + case strings.HasPrefix(f, "casttype="): + p.CastType = strings.Split(f, "=")[1] + case f == "stdtime": + p.StdTime = true + case f == "stdduration": + p.StdDuration = true + } + } +} + +var protoMessageType = reflect.TypeOf((*Message)(nil)).Elem() + +// setFieldProps initializes the field properties for submessages and maps. +func (p *Properties) setFieldProps(typ reflect.Type, f *reflect.StructField, lockGetProp bool) { + isMap := typ.Kind() == reflect.Map + if len(p.CustomType) > 0 && !isMap { + p.ctype = typ + p.setTag(lockGetProp) + return + } + if p.StdTime && !isMap { + p.setTag(lockGetProp) + return + } + if p.StdDuration && !isMap { + p.setTag(lockGetProp) + return + } + switch t1 := typ; t1.Kind() { + case reflect.Struct: + p.stype = typ + case reflect.Ptr: + if t1.Elem().Kind() == reflect.Struct { + p.stype = t1.Elem() + } + case reflect.Slice: + switch t2 := t1.Elem(); t2.Kind() { + case reflect.Ptr: + switch t3 := t2.Elem(); t3.Kind() { + case reflect.Struct: + p.stype = t3 + } + case reflect.Struct: + p.stype = t2 + } + + case reflect.Map: + + p.mtype = t1 + p.mkeyprop = &Properties{} + p.mkeyprop.init(reflect.PtrTo(p.mtype.Key()), "Key", f.Tag.Get("protobuf_key"), nil, lockGetProp) + p.mvalprop = &Properties{} + vtype := p.mtype.Elem() + if vtype.Kind() != reflect.Ptr && vtype.Kind() != reflect.Slice { + // The value type is not a message (*T) or bytes ([]byte), + // so we need encoders for the pointer to this type. + vtype = reflect.PtrTo(vtype) + } + + p.mvalprop.CustomType = p.CustomType + p.mvalprop.StdDuration = p.StdDuration + p.mvalprop.StdTime = p.StdTime + p.mvalprop.init(vtype, "Value", f.Tag.Get("protobuf_val"), nil, lockGetProp) + } + p.setTag(lockGetProp) +} + +func (p *Properties) setTag(lockGetProp bool) { + if p.stype != nil { + if lockGetProp { + p.sprop = GetProperties(p.stype) + } else { + p.sprop = getPropertiesLocked(p.stype) + } + } +} + +var ( + marshalerType = reflect.TypeOf((*Marshaler)(nil)).Elem() +) + +// Init populates the properties from a protocol buffer struct tag. +func (p *Properties) Init(typ reflect.Type, name, tag string, f *reflect.StructField) { + p.init(typ, name, tag, f, true) +} + +func (p *Properties) init(typ reflect.Type, name, tag string, f *reflect.StructField, lockGetProp bool) { + // "bytes,49,opt,def=hello!" + p.Name = name + p.OrigName = name + if tag == "" { + return + } + p.Parse(tag) + p.setFieldProps(typ, f, lockGetProp) +} + +var ( + propertiesMu sync.RWMutex + propertiesMap = make(map[reflect.Type]*StructProperties) +) + +// GetProperties returns the list of properties for the type represented by t. +// t must represent a generated struct type of a protocol message. +func GetProperties(t reflect.Type) *StructProperties { + if t.Kind() != reflect.Struct { + panic("proto: type must have kind struct") + } + + // Most calls to GetProperties in a long-running program will be + // retrieving details for types we have seen before. + propertiesMu.RLock() + sprop, ok := propertiesMap[t] + propertiesMu.RUnlock() + if ok { + if collectStats { + stats.Chit++ + } + return sprop + } + + propertiesMu.Lock() + sprop = getPropertiesLocked(t) + propertiesMu.Unlock() + return sprop +} + +// getPropertiesLocked requires that propertiesMu is held. +func getPropertiesLocked(t reflect.Type) *StructProperties { + if prop, ok := propertiesMap[t]; ok { + if collectStats { + stats.Chit++ + } + return prop + } + if collectStats { + stats.Cmiss++ + } + + prop := new(StructProperties) + // in case of recursive protos, fill this in now. + propertiesMap[t] = prop + + // build properties + prop.Prop = make([]*Properties, t.NumField()) + prop.order = make([]int, t.NumField()) + + isOneofMessage := false + for i := 0; i < t.NumField(); i++ { + f := t.Field(i) + p := new(Properties) + name := f.Name + p.init(f.Type, name, f.Tag.Get("protobuf"), &f, false) + + oneof := f.Tag.Get("protobuf_oneof") // special case + if oneof != "" { + isOneofMessage = true + // Oneof fields don't use the traditional protobuf tag. + p.OrigName = oneof + } + prop.Prop[i] = p + prop.order[i] = i + if debug { + print(i, " ", f.Name, " ", t.String(), " ") + if p.Tag > 0 { + print(p.String()) + } + print("\n") + } + } + + // Re-order prop.order. + sort.Sort(prop) + + type oneofMessage interface { + XXX_OneofFuncs() (func(Message, *Buffer) error, func(Message, int, int, *Buffer) (bool, error), func(Message) int, []interface{}) + } + if om, ok := reflect.Zero(reflect.PtrTo(t)).Interface().(oneofMessage); isOneofMessage && ok { + var oots []interface{} + _, _, _, oots = om.XXX_OneofFuncs() + + // Interpret oneof metadata. + prop.OneofTypes = make(map[string]*OneofProperties) + for _, oot := range oots { + oop := &OneofProperties{ + Type: reflect.ValueOf(oot).Type(), // *T + Prop: new(Properties), + } + sft := oop.Type.Elem().Field(0) + oop.Prop.Name = sft.Name + oop.Prop.Parse(sft.Tag.Get("protobuf")) + // There will be exactly one interface field that + // this new value is assignable to. + for i := 0; i < t.NumField(); i++ { + f := t.Field(i) + if f.Type.Kind() != reflect.Interface { + continue + } + if !oop.Type.AssignableTo(f.Type) { + continue + } + oop.Field = i + break + } + prop.OneofTypes[oop.Prop.OrigName] = oop + } + } + + // build required counts + // build tags + reqCount := 0 + prop.decoderOrigNames = make(map[string]int) + for i, p := range prop.Prop { + if strings.HasPrefix(p.Name, "XXX_") { + // Internal fields should not appear in tags/origNames maps. + // They are handled specially when encoding and decoding. + continue + } + if p.Required { + reqCount++ + } + prop.decoderTags.put(p.Tag, i) + prop.decoderOrigNames[p.OrigName] = i + } + prop.reqCount = reqCount + + return prop +} + +// A global registry of enum types. +// The generated code will register the generated maps by calling RegisterEnum. + +var enumValueMaps = make(map[string]map[string]int32) +var enumStringMaps = make(map[string]map[int32]string) + +// RegisterEnum is called from the generated code to install the enum descriptor +// maps into the global table to aid parsing text format protocol buffers. +func RegisterEnum(typeName string, unusedNameMap map[int32]string, valueMap map[string]int32) { + if _, ok := enumValueMaps[typeName]; ok { + panic("proto: duplicate enum registered: " + typeName) + } + enumValueMaps[typeName] = valueMap + if _, ok := enumStringMaps[typeName]; ok { + panic("proto: duplicate enum registered: " + typeName) + } + enumStringMaps[typeName] = unusedNameMap +} + +// EnumValueMap returns the mapping from names to integers of the +// enum type enumType, or a nil if not found. +func EnumValueMap(enumType string) map[string]int32 { + return enumValueMaps[enumType] +} + +// A registry of all linked message types. +// The string is a fully-qualified proto name ("pkg.Message"). +var ( + protoTypedNils = make(map[string]Message) // a map from proto names to typed nil pointers + protoMapTypes = make(map[string]reflect.Type) // a map from proto names to map types + revProtoTypes = make(map[reflect.Type]string) +) + +// RegisterType is called from generated code and maps from the fully qualified +// proto name to the type (pointer to struct) of the protocol buffer. +func RegisterType(x Message, name string) { + if _, ok := protoTypedNils[name]; ok { + // TODO: Some day, make this a panic. + log.Printf("proto: duplicate proto type registered: %s", name) + return + } + t := reflect.TypeOf(x) + if v := reflect.ValueOf(x); v.Kind() == reflect.Ptr && v.Pointer() == 0 { + // Generated code always calls RegisterType with nil x. + // This check is just for extra safety. + protoTypedNils[name] = x + } else { + protoTypedNils[name] = reflect.Zero(t).Interface().(Message) + } + revProtoTypes[t] = name +} + +// RegisterMapType is called from generated code and maps from the fully qualified +// proto name to the native map type of the proto map definition. +func RegisterMapType(x interface{}, name string) { + if reflect.TypeOf(x).Kind() != reflect.Map { + panic(fmt.Sprintf("RegisterMapType(%T, %q); want map", x, name)) + } + if _, ok := protoMapTypes[name]; ok { + log.Printf("proto: duplicate proto type registered: %s", name) + return + } + t := reflect.TypeOf(x) + protoMapTypes[name] = t + revProtoTypes[t] = name +} + +// MessageName returns the fully-qualified proto name for the given message type. +func MessageName(x Message) string { + type xname interface { + XXX_MessageName() string + } + if m, ok := x.(xname); ok { + return m.XXX_MessageName() + } + return revProtoTypes[reflect.TypeOf(x)] +} + +// MessageType returns the message type (pointer to struct) for a named message. +// The type is not guaranteed to implement proto.Message if the name refers to a +// map entry. +func MessageType(name string) reflect.Type { + if t, ok := protoTypedNils[name]; ok { + return reflect.TypeOf(t) + } + return protoMapTypes[name] +} + +// A registry of all linked proto files. +var ( + protoFiles = make(map[string][]byte) // file name => fileDescriptor +) + +// RegisterFile is called from generated code and maps from the +// full file name of a .proto file to its compressed FileDescriptorProto. +func RegisterFile(filename string, fileDescriptor []byte) { + protoFiles[filename] = fileDescriptor +} + +// FileDescriptor returns the compressed FileDescriptorProto for a .proto file. +func FileDescriptor(filename string) []byte { return protoFiles[filename] } diff --git a/vendor/github.com/gogo/protobuf/proto/properties_gogo.go b/vendor/github.com/gogo/protobuf/proto/properties_gogo.go new file mode 100644 index 000000000000..40ea3dd935c2 --- /dev/null +++ b/vendor/github.com/gogo/protobuf/proto/properties_gogo.go @@ -0,0 +1,36 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2018, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +package proto + +import ( + "reflect" +) + +var sizerType = reflect.TypeOf((*Sizer)(nil)).Elem() +var protosizerType = reflect.TypeOf((*ProtoSizer)(nil)).Elem() diff --git a/vendor/github.com/gogo/protobuf/proto/skip_gogo.go b/vendor/github.com/gogo/protobuf/proto/skip_gogo.go new file mode 100644 index 000000000000..5a5fd93f7c19 --- /dev/null +++ b/vendor/github.com/gogo/protobuf/proto/skip_gogo.go @@ -0,0 +1,119 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2013, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +package proto + +import ( + "fmt" + "io" +) + +func Skip(data []byte) (n int, err error) { + l := len(data) + index := 0 + for index < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if index >= l { + return 0, io.ErrUnexpectedEOF + } + b := data[index] + index++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for { + if index >= l { + return 0, io.ErrUnexpectedEOF + } + index++ + if data[index-1] < 0x80 { + break + } + } + return index, nil + case 1: + index += 8 + return index, nil + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if index >= l { + return 0, io.ErrUnexpectedEOF + } + b := data[index] + index++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + index += length + return index, nil + case 3: + for { + var innerWire uint64 + var start int = index + for shift := uint(0); ; shift += 7 { + if index >= l { + return 0, io.ErrUnexpectedEOF + } + b := data[index] + index++ + innerWire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + innerWireType := int(innerWire & 0x7) + if innerWireType == 4 { + break + } + next, err := Skip(data[start:]) + if err != nil { + return 0, err + } + index = start + next + } + return index, nil + case 4: + return index, nil + case 5: + index += 4 + return index, nil + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + } + panic("unreachable") +} diff --git a/vendor/github.com/gogo/protobuf/proto/table_marshal.go b/vendor/github.com/gogo/protobuf/proto/table_marshal.go new file mode 100644 index 000000000000..b479760a84b5 --- /dev/null +++ b/vendor/github.com/gogo/protobuf/proto/table_marshal.go @@ -0,0 +1,2803 @@ +// Go support for Protocol Buffers - Google's data interchange format +// +// Copyright 2016 The Go Authors. All rights reserved. +// https://github.com/golang/protobuf +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +package proto + +import ( + "errors" + "fmt" + "math" + "reflect" + "sort" + "strconv" + "strings" + "sync" + "sync/atomic" + "unicode/utf8" +) + +// a sizer takes a pointer to a field and the size of its tag, computes the size of +// the encoded data. +type sizer func(pointer, int) int + +// a marshaler takes a byte slice, a pointer to a field, and its tag (in wire format), +// marshals the field to the end of the slice, returns the slice and error (if any). +type marshaler func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) + +// marshalInfo is the information used for marshaling a message. +type marshalInfo struct { + typ reflect.Type + fields []*marshalFieldInfo + unrecognized field // offset of XXX_unrecognized + extensions field // offset of XXX_InternalExtensions + v1extensions field // offset of XXX_extensions + sizecache field // offset of XXX_sizecache + initialized int32 // 0 -- only typ is set, 1 -- fully initialized + messageset bool // uses message set wire format + hasmarshaler bool // has custom marshaler + sync.RWMutex // protect extElems map, also for initialization + extElems map[int32]*marshalElemInfo // info of extension elements + + hassizer bool // has custom sizer + hasprotosizer bool // has custom protosizer + + bytesExtensions field // offset of XXX_extensions where the field type is []byte +} + +// marshalFieldInfo is the information used for marshaling a field of a message. +type marshalFieldInfo struct { + field field + wiretag uint64 // tag in wire format + tagsize int // size of tag in wire format + sizer sizer + marshaler marshaler + isPointer bool + required bool // field is required + name string // name of the field, for error reporting + oneofElems map[reflect.Type]*marshalElemInfo // info of oneof elements +} + +// marshalElemInfo is the information used for marshaling an extension or oneof element. +type marshalElemInfo struct { + wiretag uint64 // tag in wire format + tagsize int // size of tag in wire format + sizer sizer + marshaler marshaler + isptr bool // elem is pointer typed, thus interface of this type is a direct interface (extension only) +} + +var ( + marshalInfoMap = map[reflect.Type]*marshalInfo{} + marshalInfoLock sync.Mutex +) + +// getMarshalInfo returns the information to marshal a given type of message. +// The info it returns may not necessarily initialized. +// t is the type of the message (NOT the pointer to it). +func getMarshalInfo(t reflect.Type) *marshalInfo { + marshalInfoLock.Lock() + u, ok := marshalInfoMap[t] + if !ok { + u = &marshalInfo{typ: t} + marshalInfoMap[t] = u + } + marshalInfoLock.Unlock() + return u +} + +// Size is the entry point from generated code, +// and should be ONLY called by generated code. +// It computes the size of encoded data of msg. +// a is a pointer to a place to store cached marshal info. +func (a *InternalMessageInfo) Size(msg Message) int { + u := getMessageMarshalInfo(msg, a) + ptr := toPointer(&msg) + if ptr.isNil() { + // We get here if msg is a typed nil ((*SomeMessage)(nil)), + // so it satisfies the interface, and msg == nil wouldn't + // catch it. We don't want crash in this case. + return 0 + } + return u.size(ptr) +} + +// Marshal is the entry point from generated code, +// and should be ONLY called by generated code. +// It marshals msg to the end of b. +// a is a pointer to a place to store cached marshal info. +func (a *InternalMessageInfo) Marshal(b []byte, msg Message, deterministic bool) ([]byte, error) { + u := getMessageMarshalInfo(msg, a) + ptr := toPointer(&msg) + if ptr.isNil() { + // We get here if msg is a typed nil ((*SomeMessage)(nil)), + // so it satisfies the interface, and msg == nil wouldn't + // catch it. We don't want crash in this case. + return b, ErrNil + } + return u.marshal(b, ptr, deterministic) +} + +func getMessageMarshalInfo(msg interface{}, a *InternalMessageInfo) *marshalInfo { + // u := a.marshal, but atomically. + // We use an atomic here to ensure memory consistency. + u := atomicLoadMarshalInfo(&a.marshal) + if u == nil { + // Get marshal information from type of message. + t := reflect.ValueOf(msg).Type() + if t.Kind() != reflect.Ptr { + panic(fmt.Sprintf("cannot handle non-pointer message type %v", t)) + } + u = getMarshalInfo(t.Elem()) + // Store it in the cache for later users. + // a.marshal = u, but atomically. + atomicStoreMarshalInfo(&a.marshal, u) + } + return u +} + +// size is the main function to compute the size of the encoded data of a message. +// ptr is the pointer to the message. +func (u *marshalInfo) size(ptr pointer) int { + if atomic.LoadInt32(&u.initialized) == 0 { + u.computeMarshalInfo() + } + + // If the message can marshal itself, let it do it, for compatibility. + // NOTE: This is not efficient. + if u.hasmarshaler { + // Uses the message's Size method if available + if u.hassizer { + s := ptr.asPointerTo(u.typ).Interface().(Sizer) + return s.Size() + } + // Uses the message's ProtoSize method if available + if u.hasprotosizer { + s := ptr.asPointerTo(u.typ).Interface().(ProtoSizer) + return s.ProtoSize() + } + + m := ptr.asPointerTo(u.typ).Interface().(Marshaler) + b, _ := m.Marshal() + return len(b) + } + + n := 0 + for _, f := range u.fields { + if f.isPointer && ptr.offset(f.field).getPointer().isNil() { + // nil pointer always marshals to nothing + continue + } + n += f.sizer(ptr.offset(f.field), f.tagsize) + } + if u.extensions.IsValid() { + e := ptr.offset(u.extensions).toExtensions() + if u.messageset { + n += u.sizeMessageSet(e) + } else { + n += u.sizeExtensions(e) + } + } + if u.v1extensions.IsValid() { + m := *ptr.offset(u.v1extensions).toOldExtensions() + n += u.sizeV1Extensions(m) + } + if u.bytesExtensions.IsValid() { + s := *ptr.offset(u.bytesExtensions).toBytes() + n += len(s) + } + if u.unrecognized.IsValid() { + s := *ptr.offset(u.unrecognized).toBytes() + n += len(s) + } + + // cache the result for use in marshal + if u.sizecache.IsValid() { + atomic.StoreInt32(ptr.offset(u.sizecache).toInt32(), int32(n)) + } + return n +} + +// cachedsize gets the size from cache. If there is no cache (i.e. message is not generated), +// fall back to compute the size. +func (u *marshalInfo) cachedsize(ptr pointer) int { + if u.sizecache.IsValid() { + return int(atomic.LoadInt32(ptr.offset(u.sizecache).toInt32())) + } + return u.size(ptr) +} + +// marshal is the main function to marshal a message. It takes a byte slice and appends +// the encoded data to the end of the slice, returns the slice and error (if any). +// ptr is the pointer to the message. +// If deterministic is true, map is marshaled in deterministic order. +func (u *marshalInfo) marshal(b []byte, ptr pointer, deterministic bool) ([]byte, error) { + if atomic.LoadInt32(&u.initialized) == 0 { + u.computeMarshalInfo() + } + + // If the message can marshal itself, let it do it, for compatibility. + // NOTE: This is not efficient. + if u.hasmarshaler { + if deterministic { + return nil, errors.New("proto: deterministic not supported by the Marshal method of " + u.typ.String()) + } + m := ptr.asPointerTo(u.typ).Interface().(Marshaler) + b1, err := m.Marshal() + b = append(b, b1...) + return b, err + } + + var err, errreq error + // The old marshaler encodes extensions at beginning. + if u.extensions.IsValid() { + e := ptr.offset(u.extensions).toExtensions() + if u.messageset { + b, err = u.appendMessageSet(b, e, deterministic) + } else { + b, err = u.appendExtensions(b, e, deterministic) + } + if err != nil { + return b, err + } + } + if u.v1extensions.IsValid() { + m := *ptr.offset(u.v1extensions).toOldExtensions() + b, err = u.appendV1Extensions(b, m, deterministic) + if err != nil { + return b, err + } + } + if u.bytesExtensions.IsValid() { + s := *ptr.offset(u.bytesExtensions).toBytes() + b = append(b, s...) + } + for _, f := range u.fields { + if f.required && errreq == nil { + if f.isPointer && ptr.offset(f.field).getPointer().isNil() { + // Required field is not set. + // We record the error but keep going, to give a complete marshaling. + errreq = &RequiredNotSetError{f.name} + continue + } + } + if f.isPointer && ptr.offset(f.field).getPointer().isNil() { + // nil pointer always marshals to nothing + continue + } + b, err = f.marshaler(b, ptr.offset(f.field), f.wiretag, deterministic) + if err != nil { + if err1, ok := err.(*RequiredNotSetError); ok { + // Required field in submessage is not set. + // We record the error but keep going, to give a complete marshaling. + if errreq == nil { + errreq = &RequiredNotSetError{f.name + "." + err1.field} + } + continue + } + if err == errRepeatedHasNil { + err = errors.New("proto: repeated field " + f.name + " has nil element") + } + if err == errInvalidUTF8 { + fullName := revProtoTypes[reflect.PtrTo(u.typ)] + "." + f.name + err = fmt.Errorf("proto: string field %q contains invalid UTF-8", fullName) + } + return b, err + } + } + if u.unrecognized.IsValid() { + s := *ptr.offset(u.unrecognized).toBytes() + b = append(b, s...) + } + return b, errreq +} + +// computeMarshalInfo initializes the marshal info. +func (u *marshalInfo) computeMarshalInfo() { + u.Lock() + defer u.Unlock() + if u.initialized != 0 { // non-atomic read is ok as it is protected by the lock + return + } + + t := u.typ + u.unrecognized = invalidField + u.extensions = invalidField + u.v1extensions = invalidField + u.bytesExtensions = invalidField + u.sizecache = invalidField + isOneofMessage := false + + if reflect.PtrTo(t).Implements(sizerType) { + u.hassizer = true + } + if reflect.PtrTo(t).Implements(protosizerType) { + u.hasprotosizer = true + } + // If the message can marshal itself, let it do it, for compatibility. + // NOTE: This is not efficient. + if reflect.PtrTo(t).Implements(marshalerType) { + u.hasmarshaler = true + atomic.StoreInt32(&u.initialized, 1) + return + } + + n := t.NumField() + + // deal with XXX fields first + for i := 0; i < t.NumField(); i++ { + f := t.Field(i) + if f.Tag.Get("protobuf_oneof") != "" { + isOneofMessage = true + } + if !strings.HasPrefix(f.Name, "XXX_") { + continue + } + switch f.Name { + case "XXX_sizecache": + u.sizecache = toField(&f) + case "XXX_unrecognized": + u.unrecognized = toField(&f) + case "XXX_InternalExtensions": + u.extensions = toField(&f) + u.messageset = f.Tag.Get("protobuf_messageset") == "1" + case "XXX_extensions": + if f.Type.Kind() == reflect.Map { + u.v1extensions = toField(&f) + } else { + u.bytesExtensions = toField(&f) + } + case "XXX_NoUnkeyedLiteral": + // nothing to do + default: + panic("unknown XXX field: " + f.Name) + } + n-- + } + + // get oneof implementers + var oneofImplementers []interface{} + // gogo: isOneofMessage is needed for embedded oneof messages, without a marshaler and unmarshaler + if m, ok := reflect.Zero(reflect.PtrTo(t)).Interface().(oneofMessage); ok && isOneofMessage { + _, _, _, oneofImplementers = m.XXX_OneofFuncs() + } + + // normal fields + fields := make([]marshalFieldInfo, n) // batch allocation + u.fields = make([]*marshalFieldInfo, 0, n) + for i, j := 0, 0; i < t.NumField(); i++ { + f := t.Field(i) + + if strings.HasPrefix(f.Name, "XXX_") { + continue + } + field := &fields[j] + j++ + field.name = f.Name + u.fields = append(u.fields, field) + if f.Tag.Get("protobuf_oneof") != "" { + field.computeOneofFieldInfo(&f, oneofImplementers) + continue + } + if f.Tag.Get("protobuf") == "" { + // field has no tag (not in generated message), ignore it + u.fields = u.fields[:len(u.fields)-1] + j-- + continue + } + field.computeMarshalFieldInfo(&f) + } + + // fields are marshaled in tag order on the wire. + sort.Sort(byTag(u.fields)) + + atomic.StoreInt32(&u.initialized, 1) +} + +// helper for sorting fields by tag +type byTag []*marshalFieldInfo + +func (a byTag) Len() int { return len(a) } +func (a byTag) Swap(i, j int) { a[i], a[j] = a[j], a[i] } +func (a byTag) Less(i, j int) bool { return a[i].wiretag < a[j].wiretag } + +// getExtElemInfo returns the information to marshal an extension element. +// The info it returns is initialized. +func (u *marshalInfo) getExtElemInfo(desc *ExtensionDesc) *marshalElemInfo { + // get from cache first + u.RLock() + e, ok := u.extElems[desc.Field] + u.RUnlock() + if ok { + return e + } + + t := reflect.TypeOf(desc.ExtensionType) // pointer or slice to basic type or struct + tags := strings.Split(desc.Tag, ",") + tag, err := strconv.Atoi(tags[1]) + if err != nil { + panic("tag is not an integer") + } + wt := wiretype(tags[0]) + sizr, marshalr := typeMarshaler(t, tags, false, false) + e = &marshalElemInfo{ + wiretag: uint64(tag)<<3 | wt, + tagsize: SizeVarint(uint64(tag) << 3), + sizer: sizr, + marshaler: marshalr, + isptr: t.Kind() == reflect.Ptr, + } + + // update cache + u.Lock() + if u.extElems == nil { + u.extElems = make(map[int32]*marshalElemInfo) + } + u.extElems[desc.Field] = e + u.Unlock() + return e +} + +// computeMarshalFieldInfo fills up the information to marshal a field. +func (fi *marshalFieldInfo) computeMarshalFieldInfo(f *reflect.StructField) { + // parse protobuf tag of the field. + // tag has format of "bytes,49,opt,name=foo,def=hello!" + tags := strings.Split(f.Tag.Get("protobuf"), ",") + if tags[0] == "" { + return + } + tag, err := strconv.Atoi(tags[1]) + if err != nil { + panic("tag is not an integer") + } + wt := wiretype(tags[0]) + if tags[2] == "req" { + fi.required = true + } + fi.setTag(f, tag, wt) + fi.setMarshaler(f, tags) +} + +func (fi *marshalFieldInfo) computeOneofFieldInfo(f *reflect.StructField, oneofImplementers []interface{}) { + fi.field = toField(f) + fi.wiretag = 1<<31 - 1 // Use a large tag number, make oneofs sorted at the end. This tag will not appear on the wire. + fi.isPointer = true + fi.sizer, fi.marshaler = makeOneOfMarshaler(fi, f) + fi.oneofElems = make(map[reflect.Type]*marshalElemInfo) + + ityp := f.Type // interface type + for _, o := range oneofImplementers { + t := reflect.TypeOf(o) + if !t.Implements(ityp) { + continue + } + sf := t.Elem().Field(0) // oneof implementer is a struct with a single field + tags := strings.Split(sf.Tag.Get("protobuf"), ",") + tag, err := strconv.Atoi(tags[1]) + if err != nil { + panic("tag is not an integer") + } + wt := wiretype(tags[0]) + sizr, marshalr := typeMarshaler(sf.Type, tags, false, true) // oneof should not omit any zero value + fi.oneofElems[t.Elem()] = &marshalElemInfo{ + wiretag: uint64(tag)<<3 | wt, + tagsize: SizeVarint(uint64(tag) << 3), + sizer: sizr, + marshaler: marshalr, + } + } +} + +type oneofMessage interface { + XXX_OneofFuncs() (func(Message, *Buffer) error, func(Message, int, int, *Buffer) (bool, error), func(Message) int, []interface{}) +} + +// wiretype returns the wire encoding of the type. +func wiretype(encoding string) uint64 { + switch encoding { + case "fixed32": + return WireFixed32 + case "fixed64": + return WireFixed64 + case "varint", "zigzag32", "zigzag64": + return WireVarint + case "bytes": + return WireBytes + case "group": + return WireStartGroup + } + panic("unknown wire type " + encoding) +} + +// setTag fills up the tag (in wire format) and its size in the info of a field. +func (fi *marshalFieldInfo) setTag(f *reflect.StructField, tag int, wt uint64) { + fi.field = toField(f) + fi.wiretag = uint64(tag)<<3 | wt + fi.tagsize = SizeVarint(uint64(tag) << 3) +} + +// setMarshaler fills up the sizer and marshaler in the info of a field. +func (fi *marshalFieldInfo) setMarshaler(f *reflect.StructField, tags []string) { + switch f.Type.Kind() { + case reflect.Map: + // map field + fi.isPointer = true + fi.sizer, fi.marshaler = makeMapMarshaler(f) + return + case reflect.Ptr, reflect.Slice: + fi.isPointer = true + } + fi.sizer, fi.marshaler = typeMarshaler(f.Type, tags, true, false) +} + +// typeMarshaler returns the sizer and marshaler of a given field. +// t is the type of the field. +// tags is the generated "protobuf" tag of the field. +// If nozero is true, zero value is not marshaled to the wire. +// If oneof is true, it is a oneof field. +func typeMarshaler(t reflect.Type, tags []string, nozero, oneof bool) (sizer, marshaler) { + encoding := tags[0] + + pointer := false + slice := false + if t.Kind() == reflect.Slice && t.Elem().Kind() != reflect.Uint8 { + slice = true + t = t.Elem() + } + if t.Kind() == reflect.Ptr { + pointer = true + t = t.Elem() + } + + packed := false + proto3 := false + ctype := false + isTime := false + isDuration := false + for i := 2; i < len(tags); i++ { + if tags[i] == "packed" { + packed = true + } + if tags[i] == "proto3" { + proto3 = true + } + if strings.HasPrefix(tags[i], "customtype=") { + ctype = true + } + if tags[i] == "stdtime" { + isTime = true + } + if tags[i] == "stdduration" { + isDuration = true + } + } + if !proto3 && !pointer && !slice { + nozero = false + } + + if ctype { + if reflect.PtrTo(t).Implements(customType) { + if slice { + return makeMessageRefSliceMarshaler(getMarshalInfo(t)) + } + if pointer { + return makeCustomPtrMarshaler(getMarshalInfo(t)) + } + return makeCustomMarshaler(getMarshalInfo(t)) + } else { + panic(fmt.Sprintf("custom type: type: %v, does not implement the proto.custom interface", t)) + } + } + + if isTime { + if pointer { + if slice { + return makeTimePtrSliceMarshaler(getMarshalInfo(t)) + } + return makeTimePtrMarshaler(getMarshalInfo(t)) + } + if slice { + return makeTimeSliceMarshaler(getMarshalInfo(t)) + } + return makeTimeMarshaler(getMarshalInfo(t)) + } + + if isDuration { + if pointer { + if slice { + return makeDurationPtrSliceMarshaler(getMarshalInfo(t)) + } + return makeDurationPtrMarshaler(getMarshalInfo(t)) + } + if slice { + return makeDurationSliceMarshaler(getMarshalInfo(t)) + } + return makeDurationMarshaler(getMarshalInfo(t)) + } + + switch t.Kind() { + case reflect.Bool: + if pointer { + return sizeBoolPtr, appendBoolPtr + } + if slice { + if packed { + return sizeBoolPackedSlice, appendBoolPackedSlice + } + return sizeBoolSlice, appendBoolSlice + } + if nozero { + return sizeBoolValueNoZero, appendBoolValueNoZero + } + return sizeBoolValue, appendBoolValue + case reflect.Uint32: + switch encoding { + case "fixed32": + if pointer { + return sizeFixed32Ptr, appendFixed32Ptr + } + if slice { + if packed { + return sizeFixed32PackedSlice, appendFixed32PackedSlice + } + return sizeFixed32Slice, appendFixed32Slice + } + if nozero { + return sizeFixed32ValueNoZero, appendFixed32ValueNoZero + } + return sizeFixed32Value, appendFixed32Value + case "varint": + if pointer { + return sizeVarint32Ptr, appendVarint32Ptr + } + if slice { + if packed { + return sizeVarint32PackedSlice, appendVarint32PackedSlice + } + return sizeVarint32Slice, appendVarint32Slice + } + if nozero { + return sizeVarint32ValueNoZero, appendVarint32ValueNoZero + } + return sizeVarint32Value, appendVarint32Value + } + case reflect.Int32: + switch encoding { + case "fixed32": + if pointer { + return sizeFixedS32Ptr, appendFixedS32Ptr + } + if slice { + if packed { + return sizeFixedS32PackedSlice, appendFixedS32PackedSlice + } + return sizeFixedS32Slice, appendFixedS32Slice + } + if nozero { + return sizeFixedS32ValueNoZero, appendFixedS32ValueNoZero + } + return sizeFixedS32Value, appendFixedS32Value + case "varint": + if pointer { + return sizeVarintS32Ptr, appendVarintS32Ptr + } + if slice { + if packed { + return sizeVarintS32PackedSlice, appendVarintS32PackedSlice + } + return sizeVarintS32Slice, appendVarintS32Slice + } + if nozero { + return sizeVarintS32ValueNoZero, appendVarintS32ValueNoZero + } + return sizeVarintS32Value, appendVarintS32Value + case "zigzag32": + if pointer { + return sizeZigzag32Ptr, appendZigzag32Ptr + } + if slice { + if packed { + return sizeZigzag32PackedSlice, appendZigzag32PackedSlice + } + return sizeZigzag32Slice, appendZigzag32Slice + } + if nozero { + return sizeZigzag32ValueNoZero, appendZigzag32ValueNoZero + } + return sizeZigzag32Value, appendZigzag32Value + } + case reflect.Uint64: + switch encoding { + case "fixed64": + if pointer { + return sizeFixed64Ptr, appendFixed64Ptr + } + if slice { + if packed { + return sizeFixed64PackedSlice, appendFixed64PackedSlice + } + return sizeFixed64Slice, appendFixed64Slice + } + if nozero { + return sizeFixed64ValueNoZero, appendFixed64ValueNoZero + } + return sizeFixed64Value, appendFixed64Value + case "varint": + if pointer { + return sizeVarint64Ptr, appendVarint64Ptr + } + if slice { + if packed { + return sizeVarint64PackedSlice, appendVarint64PackedSlice + } + return sizeVarint64Slice, appendVarint64Slice + } + if nozero { + return sizeVarint64ValueNoZero, appendVarint64ValueNoZero + } + return sizeVarint64Value, appendVarint64Value + } + case reflect.Int64: + switch encoding { + case "fixed64": + if pointer { + return sizeFixedS64Ptr, appendFixedS64Ptr + } + if slice { + if packed { + return sizeFixedS64PackedSlice, appendFixedS64PackedSlice + } + return sizeFixedS64Slice, appendFixedS64Slice + } + if nozero { + return sizeFixedS64ValueNoZero, appendFixedS64ValueNoZero + } + return sizeFixedS64Value, appendFixedS64Value + case "varint": + if pointer { + return sizeVarintS64Ptr, appendVarintS64Ptr + } + if slice { + if packed { + return sizeVarintS64PackedSlice, appendVarintS64PackedSlice + } + return sizeVarintS64Slice, appendVarintS64Slice + } + if nozero { + return sizeVarintS64ValueNoZero, appendVarintS64ValueNoZero + } + return sizeVarintS64Value, appendVarintS64Value + case "zigzag64": + if pointer { + return sizeZigzag64Ptr, appendZigzag64Ptr + } + if slice { + if packed { + return sizeZigzag64PackedSlice, appendZigzag64PackedSlice + } + return sizeZigzag64Slice, appendZigzag64Slice + } + if nozero { + return sizeZigzag64ValueNoZero, appendZigzag64ValueNoZero + } + return sizeZigzag64Value, appendZigzag64Value + } + case reflect.Float32: + if pointer { + return sizeFloat32Ptr, appendFloat32Ptr + } + if slice { + if packed { + return sizeFloat32PackedSlice, appendFloat32PackedSlice + } + return sizeFloat32Slice, appendFloat32Slice + } + if nozero { + return sizeFloat32ValueNoZero, appendFloat32ValueNoZero + } + return sizeFloat32Value, appendFloat32Value + case reflect.Float64: + if pointer { + return sizeFloat64Ptr, appendFloat64Ptr + } + if slice { + if packed { + return sizeFloat64PackedSlice, appendFloat64PackedSlice + } + return sizeFloat64Slice, appendFloat64Slice + } + if nozero { + return sizeFloat64ValueNoZero, appendFloat64ValueNoZero + } + return sizeFloat64Value, appendFloat64Value + case reflect.String: + if pointer { + return sizeStringPtr, appendStringPtr + } + if slice { + return sizeStringSlice, appendStringSlice + } + if nozero { + return sizeStringValueNoZero, appendStringValueNoZero + } + return sizeStringValue, appendStringValue + case reflect.Slice: + if slice { + return sizeBytesSlice, appendBytesSlice + } + if oneof { + // Oneof bytes field may also have "proto3" tag. + // We want to marshal it as a oneof field. Do this + // check before the proto3 check. + return sizeBytesOneof, appendBytesOneof + } + if proto3 { + return sizeBytes3, appendBytes3 + } + return sizeBytes, appendBytes + case reflect.Struct: + switch encoding { + case "group": + if slice { + return makeGroupSliceMarshaler(getMarshalInfo(t)) + } + return makeGroupMarshaler(getMarshalInfo(t)) + case "bytes": + if pointer { + if slice { + return makeMessageSliceMarshaler(getMarshalInfo(t)) + } + return makeMessageMarshaler(getMarshalInfo(t)) + } else { + if slice { + return makeMessageRefSliceMarshaler(getMarshalInfo(t)) + } + return makeMessageRefMarshaler(getMarshalInfo(t)) + } + } + } + panic(fmt.Sprintf("unknown or mismatched type: type: %v, wire type: %v", t, encoding)) +} + +// Below are functions to size/marshal a specific type of a field. +// They are stored in the field's info, and called by function pointers. +// They have type sizer or marshaler. + +func sizeFixed32Value(_ pointer, tagsize int) int { + return 4 + tagsize +} +func sizeFixed32ValueNoZero(ptr pointer, tagsize int) int { + v := *ptr.toUint32() + if v == 0 { + return 0 + } + return 4 + tagsize +} +func sizeFixed32Ptr(ptr pointer, tagsize int) int { + p := *ptr.toUint32Ptr() + if p == nil { + return 0 + } + return 4 + tagsize +} +func sizeFixed32Slice(ptr pointer, tagsize int) int { + s := *ptr.toUint32Slice() + return (4 + tagsize) * len(s) +} +func sizeFixed32PackedSlice(ptr pointer, tagsize int) int { + s := *ptr.toUint32Slice() + if len(s) == 0 { + return 0 + } + return 4*len(s) + SizeVarint(uint64(4*len(s))) + tagsize +} +func sizeFixedS32Value(_ pointer, tagsize int) int { + return 4 + tagsize +} +func sizeFixedS32ValueNoZero(ptr pointer, tagsize int) int { + v := *ptr.toInt32() + if v == 0 { + return 0 + } + return 4 + tagsize +} +func sizeFixedS32Ptr(ptr pointer, tagsize int) int { + p := ptr.getInt32Ptr() + if p == nil { + return 0 + } + return 4 + tagsize +} +func sizeFixedS32Slice(ptr pointer, tagsize int) int { + s := ptr.getInt32Slice() + return (4 + tagsize) * len(s) +} +func sizeFixedS32PackedSlice(ptr pointer, tagsize int) int { + s := ptr.getInt32Slice() + if len(s) == 0 { + return 0 + } + return 4*len(s) + SizeVarint(uint64(4*len(s))) + tagsize +} +func sizeFloat32Value(_ pointer, tagsize int) int { + return 4 + tagsize +} +func sizeFloat32ValueNoZero(ptr pointer, tagsize int) int { + v := math.Float32bits(*ptr.toFloat32()) + if v == 0 { + return 0 + } + return 4 + tagsize +} +func sizeFloat32Ptr(ptr pointer, tagsize int) int { + p := *ptr.toFloat32Ptr() + if p == nil { + return 0 + } + return 4 + tagsize +} +func sizeFloat32Slice(ptr pointer, tagsize int) int { + s := *ptr.toFloat32Slice() + return (4 + tagsize) * len(s) +} +func sizeFloat32PackedSlice(ptr pointer, tagsize int) int { + s := *ptr.toFloat32Slice() + if len(s) == 0 { + return 0 + } + return 4*len(s) + SizeVarint(uint64(4*len(s))) + tagsize +} +func sizeFixed64Value(_ pointer, tagsize int) int { + return 8 + tagsize +} +func sizeFixed64ValueNoZero(ptr pointer, tagsize int) int { + v := *ptr.toUint64() + if v == 0 { + return 0 + } + return 8 + tagsize +} +func sizeFixed64Ptr(ptr pointer, tagsize int) int { + p := *ptr.toUint64Ptr() + if p == nil { + return 0 + } + return 8 + tagsize +} +func sizeFixed64Slice(ptr pointer, tagsize int) int { + s := *ptr.toUint64Slice() + return (8 + tagsize) * len(s) +} +func sizeFixed64PackedSlice(ptr pointer, tagsize int) int { + s := *ptr.toUint64Slice() + if len(s) == 0 { + return 0 + } + return 8*len(s) + SizeVarint(uint64(8*len(s))) + tagsize +} +func sizeFixedS64Value(_ pointer, tagsize int) int { + return 8 + tagsize +} +func sizeFixedS64ValueNoZero(ptr pointer, tagsize int) int { + v := *ptr.toInt64() + if v == 0 { + return 0 + } + return 8 + tagsize +} +func sizeFixedS64Ptr(ptr pointer, tagsize int) int { + p := *ptr.toInt64Ptr() + if p == nil { + return 0 + } + return 8 + tagsize +} +func sizeFixedS64Slice(ptr pointer, tagsize int) int { + s := *ptr.toInt64Slice() + return (8 + tagsize) * len(s) +} +func sizeFixedS64PackedSlice(ptr pointer, tagsize int) int { + s := *ptr.toInt64Slice() + if len(s) == 0 { + return 0 + } + return 8*len(s) + SizeVarint(uint64(8*len(s))) + tagsize +} +func sizeFloat64Value(_ pointer, tagsize int) int { + return 8 + tagsize +} +func sizeFloat64ValueNoZero(ptr pointer, tagsize int) int { + v := math.Float64bits(*ptr.toFloat64()) + if v == 0 { + return 0 + } + return 8 + tagsize +} +func sizeFloat64Ptr(ptr pointer, tagsize int) int { + p := *ptr.toFloat64Ptr() + if p == nil { + return 0 + } + return 8 + tagsize +} +func sizeFloat64Slice(ptr pointer, tagsize int) int { + s := *ptr.toFloat64Slice() + return (8 + tagsize) * len(s) +} +func sizeFloat64PackedSlice(ptr pointer, tagsize int) int { + s := *ptr.toFloat64Slice() + if len(s) == 0 { + return 0 + } + return 8*len(s) + SizeVarint(uint64(8*len(s))) + tagsize +} +func sizeVarint32Value(ptr pointer, tagsize int) int { + v := *ptr.toUint32() + return SizeVarint(uint64(v)) + tagsize +} +func sizeVarint32ValueNoZero(ptr pointer, tagsize int) int { + v := *ptr.toUint32() + if v == 0 { + return 0 + } + return SizeVarint(uint64(v)) + tagsize +} +func sizeVarint32Ptr(ptr pointer, tagsize int) int { + p := *ptr.toUint32Ptr() + if p == nil { + return 0 + } + return SizeVarint(uint64(*p)) + tagsize +} +func sizeVarint32Slice(ptr pointer, tagsize int) int { + s := *ptr.toUint32Slice() + n := 0 + for _, v := range s { + n += SizeVarint(uint64(v)) + tagsize + } + return n +} +func sizeVarint32PackedSlice(ptr pointer, tagsize int) int { + s := *ptr.toUint32Slice() + if len(s) == 0 { + return 0 + } + n := 0 + for _, v := range s { + n += SizeVarint(uint64(v)) + } + return n + SizeVarint(uint64(n)) + tagsize +} +func sizeVarintS32Value(ptr pointer, tagsize int) int { + v := *ptr.toInt32() + return SizeVarint(uint64(v)) + tagsize +} +func sizeVarintS32ValueNoZero(ptr pointer, tagsize int) int { + v := *ptr.toInt32() + if v == 0 { + return 0 + } + return SizeVarint(uint64(v)) + tagsize +} +func sizeVarintS32Ptr(ptr pointer, tagsize int) int { + p := ptr.getInt32Ptr() + if p == nil { + return 0 + } + return SizeVarint(uint64(*p)) + tagsize +} +func sizeVarintS32Slice(ptr pointer, tagsize int) int { + s := ptr.getInt32Slice() + n := 0 + for _, v := range s { + n += SizeVarint(uint64(v)) + tagsize + } + return n +} +func sizeVarintS32PackedSlice(ptr pointer, tagsize int) int { + s := ptr.getInt32Slice() + if len(s) == 0 { + return 0 + } + n := 0 + for _, v := range s { + n += SizeVarint(uint64(v)) + } + return n + SizeVarint(uint64(n)) + tagsize +} +func sizeVarint64Value(ptr pointer, tagsize int) int { + v := *ptr.toUint64() + return SizeVarint(v) + tagsize +} +func sizeVarint64ValueNoZero(ptr pointer, tagsize int) int { + v := *ptr.toUint64() + if v == 0 { + return 0 + } + return SizeVarint(v) + tagsize +} +func sizeVarint64Ptr(ptr pointer, tagsize int) int { + p := *ptr.toUint64Ptr() + if p == nil { + return 0 + } + return SizeVarint(*p) + tagsize +} +func sizeVarint64Slice(ptr pointer, tagsize int) int { + s := *ptr.toUint64Slice() + n := 0 + for _, v := range s { + n += SizeVarint(v) + tagsize + } + return n +} +func sizeVarint64PackedSlice(ptr pointer, tagsize int) int { + s := *ptr.toUint64Slice() + if len(s) == 0 { + return 0 + } + n := 0 + for _, v := range s { + n += SizeVarint(v) + } + return n + SizeVarint(uint64(n)) + tagsize +} +func sizeVarintS64Value(ptr pointer, tagsize int) int { + v := *ptr.toInt64() + return SizeVarint(uint64(v)) + tagsize +} +func sizeVarintS64ValueNoZero(ptr pointer, tagsize int) int { + v := *ptr.toInt64() + if v == 0 { + return 0 + } + return SizeVarint(uint64(v)) + tagsize +} +func sizeVarintS64Ptr(ptr pointer, tagsize int) int { + p := *ptr.toInt64Ptr() + if p == nil { + return 0 + } + return SizeVarint(uint64(*p)) + tagsize +} +func sizeVarintS64Slice(ptr pointer, tagsize int) int { + s := *ptr.toInt64Slice() + n := 0 + for _, v := range s { + n += SizeVarint(uint64(v)) + tagsize + } + return n +} +func sizeVarintS64PackedSlice(ptr pointer, tagsize int) int { + s := *ptr.toInt64Slice() + if len(s) == 0 { + return 0 + } + n := 0 + for _, v := range s { + n += SizeVarint(uint64(v)) + } + return n + SizeVarint(uint64(n)) + tagsize +} +func sizeZigzag32Value(ptr pointer, tagsize int) int { + v := *ptr.toInt32() + return SizeVarint(uint64((uint32(v)<<1)^uint32((int32(v)>>31)))) + tagsize +} +func sizeZigzag32ValueNoZero(ptr pointer, tagsize int) int { + v := *ptr.toInt32() + if v == 0 { + return 0 + } + return SizeVarint(uint64((uint32(v)<<1)^uint32((int32(v)>>31)))) + tagsize +} +func sizeZigzag32Ptr(ptr pointer, tagsize int) int { + p := ptr.getInt32Ptr() + if p == nil { + return 0 + } + v := *p + return SizeVarint(uint64((uint32(v)<<1)^uint32((int32(v)>>31)))) + tagsize +} +func sizeZigzag32Slice(ptr pointer, tagsize int) int { + s := ptr.getInt32Slice() + n := 0 + for _, v := range s { + n += SizeVarint(uint64((uint32(v)<<1)^uint32((int32(v)>>31)))) + tagsize + } + return n +} +func sizeZigzag32PackedSlice(ptr pointer, tagsize int) int { + s := ptr.getInt32Slice() + if len(s) == 0 { + return 0 + } + n := 0 + for _, v := range s { + n += SizeVarint(uint64((uint32(v) << 1) ^ uint32((int32(v) >> 31)))) + } + return n + SizeVarint(uint64(n)) + tagsize +} +func sizeZigzag64Value(ptr pointer, tagsize int) int { + v := *ptr.toInt64() + return SizeVarint(uint64(v<<1)^uint64((int64(v)>>63))) + tagsize +} +func sizeZigzag64ValueNoZero(ptr pointer, tagsize int) int { + v := *ptr.toInt64() + if v == 0 { + return 0 + } + return SizeVarint(uint64(v<<1)^uint64((int64(v)>>63))) + tagsize +} +func sizeZigzag64Ptr(ptr pointer, tagsize int) int { + p := *ptr.toInt64Ptr() + if p == nil { + return 0 + } + v := *p + return SizeVarint(uint64(v<<1)^uint64((int64(v)>>63))) + tagsize +} +func sizeZigzag64Slice(ptr pointer, tagsize int) int { + s := *ptr.toInt64Slice() + n := 0 + for _, v := range s { + n += SizeVarint(uint64(v<<1)^uint64((int64(v)>>63))) + tagsize + } + return n +} +func sizeZigzag64PackedSlice(ptr pointer, tagsize int) int { + s := *ptr.toInt64Slice() + if len(s) == 0 { + return 0 + } + n := 0 + for _, v := range s { + n += SizeVarint(uint64(v<<1) ^ uint64((int64(v) >> 63))) + } + return n + SizeVarint(uint64(n)) + tagsize +} +func sizeBoolValue(_ pointer, tagsize int) int { + return 1 + tagsize +} +func sizeBoolValueNoZero(ptr pointer, tagsize int) int { + v := *ptr.toBool() + if !v { + return 0 + } + return 1 + tagsize +} +func sizeBoolPtr(ptr pointer, tagsize int) int { + p := *ptr.toBoolPtr() + if p == nil { + return 0 + } + return 1 + tagsize +} +func sizeBoolSlice(ptr pointer, tagsize int) int { + s := *ptr.toBoolSlice() + return (1 + tagsize) * len(s) +} +func sizeBoolPackedSlice(ptr pointer, tagsize int) int { + s := *ptr.toBoolSlice() + if len(s) == 0 { + return 0 + } + return len(s) + SizeVarint(uint64(len(s))) + tagsize +} +func sizeStringValue(ptr pointer, tagsize int) int { + v := *ptr.toString() + return len(v) + SizeVarint(uint64(len(v))) + tagsize +} +func sizeStringValueNoZero(ptr pointer, tagsize int) int { + v := *ptr.toString() + if v == "" { + return 0 + } + return len(v) + SizeVarint(uint64(len(v))) + tagsize +} +func sizeStringPtr(ptr pointer, tagsize int) int { + p := *ptr.toStringPtr() + if p == nil { + return 0 + } + v := *p + return len(v) + SizeVarint(uint64(len(v))) + tagsize +} +func sizeStringSlice(ptr pointer, tagsize int) int { + s := *ptr.toStringSlice() + n := 0 + for _, v := range s { + n += len(v) + SizeVarint(uint64(len(v))) + tagsize + } + return n +} +func sizeBytes(ptr pointer, tagsize int) int { + v := *ptr.toBytes() + if v == nil { + return 0 + } + return len(v) + SizeVarint(uint64(len(v))) + tagsize +} +func sizeBytes3(ptr pointer, tagsize int) int { + v := *ptr.toBytes() + if len(v) == 0 { + return 0 + } + return len(v) + SizeVarint(uint64(len(v))) + tagsize +} +func sizeBytesOneof(ptr pointer, tagsize int) int { + v := *ptr.toBytes() + return len(v) + SizeVarint(uint64(len(v))) + tagsize +} +func sizeBytesSlice(ptr pointer, tagsize int) int { + s := *ptr.toBytesSlice() + n := 0 + for _, v := range s { + n += len(v) + SizeVarint(uint64(len(v))) + tagsize + } + return n +} + +// appendFixed32 appends an encoded fixed32 to b. +func appendFixed32(b []byte, v uint32) []byte { + b = append(b, + byte(v), + byte(v>>8), + byte(v>>16), + byte(v>>24)) + return b +} + +// appendFixed64 appends an encoded fixed64 to b. +func appendFixed64(b []byte, v uint64) []byte { + b = append(b, + byte(v), + byte(v>>8), + byte(v>>16), + byte(v>>24), + byte(v>>32), + byte(v>>40), + byte(v>>48), + byte(v>>56)) + return b +} + +// appendVarint appends an encoded varint to b. +func appendVarint(b []byte, v uint64) []byte { + // TODO: make 1-byte (maybe 2-byte) case inline-able, once we + // have non-leaf inliner. + switch { + case v < 1<<7: + b = append(b, byte(v)) + case v < 1<<14: + b = append(b, + byte(v&0x7f|0x80), + byte(v>>7)) + case v < 1<<21: + b = append(b, + byte(v&0x7f|0x80), + byte((v>>7)&0x7f|0x80), + byte(v>>14)) + case v < 1<<28: + b = append(b, + byte(v&0x7f|0x80), + byte((v>>7)&0x7f|0x80), + byte((v>>14)&0x7f|0x80), + byte(v>>21)) + case v < 1<<35: + b = append(b, + byte(v&0x7f|0x80), + byte((v>>7)&0x7f|0x80), + byte((v>>14)&0x7f|0x80), + byte((v>>21)&0x7f|0x80), + byte(v>>28)) + case v < 1<<42: + b = append(b, + byte(v&0x7f|0x80), + byte((v>>7)&0x7f|0x80), + byte((v>>14)&0x7f|0x80), + byte((v>>21)&0x7f|0x80), + byte((v>>28)&0x7f|0x80), + byte(v>>35)) + case v < 1<<49: + b = append(b, + byte(v&0x7f|0x80), + byte((v>>7)&0x7f|0x80), + byte((v>>14)&0x7f|0x80), + byte((v>>21)&0x7f|0x80), + byte((v>>28)&0x7f|0x80), + byte((v>>35)&0x7f|0x80), + byte(v>>42)) + case v < 1<<56: + b = append(b, + byte(v&0x7f|0x80), + byte((v>>7)&0x7f|0x80), + byte((v>>14)&0x7f|0x80), + byte((v>>21)&0x7f|0x80), + byte((v>>28)&0x7f|0x80), + byte((v>>35)&0x7f|0x80), + byte((v>>42)&0x7f|0x80), + byte(v>>49)) + case v < 1<<63: + b = append(b, + byte(v&0x7f|0x80), + byte((v>>7)&0x7f|0x80), + byte((v>>14)&0x7f|0x80), + byte((v>>21)&0x7f|0x80), + byte((v>>28)&0x7f|0x80), + byte((v>>35)&0x7f|0x80), + byte((v>>42)&0x7f|0x80), + byte((v>>49)&0x7f|0x80), + byte(v>>56)) + default: + b = append(b, + byte(v&0x7f|0x80), + byte((v>>7)&0x7f|0x80), + byte((v>>14)&0x7f|0x80), + byte((v>>21)&0x7f|0x80), + byte((v>>28)&0x7f|0x80), + byte((v>>35)&0x7f|0x80), + byte((v>>42)&0x7f|0x80), + byte((v>>49)&0x7f|0x80), + byte((v>>56)&0x7f|0x80), + 1) + } + return b +} + +func appendFixed32Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + v := *ptr.toUint32() + b = appendVarint(b, wiretag) + b = appendFixed32(b, v) + return b, nil +} +func appendFixed32ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + v := *ptr.toUint32() + if v == 0 { + return b, nil + } + b = appendVarint(b, wiretag) + b = appendFixed32(b, v) + return b, nil +} +func appendFixed32Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + p := *ptr.toUint32Ptr() + if p == nil { + return b, nil + } + b = appendVarint(b, wiretag) + b = appendFixed32(b, *p) + return b, nil +} +func appendFixed32Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + s := *ptr.toUint32Slice() + for _, v := range s { + b = appendVarint(b, wiretag) + b = appendFixed32(b, v) + } + return b, nil +} +func appendFixed32PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + s := *ptr.toUint32Slice() + if len(s) == 0 { + return b, nil + } + b = appendVarint(b, wiretag&^7|WireBytes) + b = appendVarint(b, uint64(4*len(s))) + for _, v := range s { + b = appendFixed32(b, v) + } + return b, nil +} +func appendFixedS32Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + v := *ptr.toInt32() + b = appendVarint(b, wiretag) + b = appendFixed32(b, uint32(v)) + return b, nil +} +func appendFixedS32ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + v := *ptr.toInt32() + if v == 0 { + return b, nil + } + b = appendVarint(b, wiretag) + b = appendFixed32(b, uint32(v)) + return b, nil +} +func appendFixedS32Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + p := ptr.getInt32Ptr() + if p == nil { + return b, nil + } + b = appendVarint(b, wiretag) + b = appendFixed32(b, uint32(*p)) + return b, nil +} +func appendFixedS32Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + s := ptr.getInt32Slice() + for _, v := range s { + b = appendVarint(b, wiretag) + b = appendFixed32(b, uint32(v)) + } + return b, nil +} +func appendFixedS32PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + s := ptr.getInt32Slice() + if len(s) == 0 { + return b, nil + } + b = appendVarint(b, wiretag&^7|WireBytes) + b = appendVarint(b, uint64(4*len(s))) + for _, v := range s { + b = appendFixed32(b, uint32(v)) + } + return b, nil +} +func appendFloat32Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + v := math.Float32bits(*ptr.toFloat32()) + b = appendVarint(b, wiretag) + b = appendFixed32(b, v) + return b, nil +} +func appendFloat32ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + v := math.Float32bits(*ptr.toFloat32()) + if v == 0 { + return b, nil + } + b = appendVarint(b, wiretag) + b = appendFixed32(b, v) + return b, nil +} +func appendFloat32Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + p := *ptr.toFloat32Ptr() + if p == nil { + return b, nil + } + b = appendVarint(b, wiretag) + b = appendFixed32(b, math.Float32bits(*p)) + return b, nil +} +func appendFloat32Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + s := *ptr.toFloat32Slice() + for _, v := range s { + b = appendVarint(b, wiretag) + b = appendFixed32(b, math.Float32bits(v)) + } + return b, nil +} +func appendFloat32PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + s := *ptr.toFloat32Slice() + if len(s) == 0 { + return b, nil + } + b = appendVarint(b, wiretag&^7|WireBytes) + b = appendVarint(b, uint64(4*len(s))) + for _, v := range s { + b = appendFixed32(b, math.Float32bits(v)) + } + return b, nil +} +func appendFixed64Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + v := *ptr.toUint64() + b = appendVarint(b, wiretag) + b = appendFixed64(b, v) + return b, nil +} +func appendFixed64ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + v := *ptr.toUint64() + if v == 0 { + return b, nil + } + b = appendVarint(b, wiretag) + b = appendFixed64(b, v) + return b, nil +} +func appendFixed64Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + p := *ptr.toUint64Ptr() + if p == nil { + return b, nil + } + b = appendVarint(b, wiretag) + b = appendFixed64(b, *p) + return b, nil +} +func appendFixed64Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + s := *ptr.toUint64Slice() + for _, v := range s { + b = appendVarint(b, wiretag) + b = appendFixed64(b, v) + } + return b, nil +} +func appendFixed64PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + s := *ptr.toUint64Slice() + if len(s) == 0 { + return b, nil + } + b = appendVarint(b, wiretag&^7|WireBytes) + b = appendVarint(b, uint64(8*len(s))) + for _, v := range s { + b = appendFixed64(b, v) + } + return b, nil +} +func appendFixedS64Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + v := *ptr.toInt64() + b = appendVarint(b, wiretag) + b = appendFixed64(b, uint64(v)) + return b, nil +} +func appendFixedS64ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + v := *ptr.toInt64() + if v == 0 { + return b, nil + } + b = appendVarint(b, wiretag) + b = appendFixed64(b, uint64(v)) + return b, nil +} +func appendFixedS64Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + p := *ptr.toInt64Ptr() + if p == nil { + return b, nil + } + b = appendVarint(b, wiretag) + b = appendFixed64(b, uint64(*p)) + return b, nil +} +func appendFixedS64Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + s := *ptr.toInt64Slice() + for _, v := range s { + b = appendVarint(b, wiretag) + b = appendFixed64(b, uint64(v)) + } + return b, nil +} +func appendFixedS64PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + s := *ptr.toInt64Slice() + if len(s) == 0 { + return b, nil + } + b = appendVarint(b, wiretag&^7|WireBytes) + b = appendVarint(b, uint64(8*len(s))) + for _, v := range s { + b = appendFixed64(b, uint64(v)) + } + return b, nil +} +func appendFloat64Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + v := math.Float64bits(*ptr.toFloat64()) + b = appendVarint(b, wiretag) + b = appendFixed64(b, v) + return b, nil +} +func appendFloat64ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + v := math.Float64bits(*ptr.toFloat64()) + if v == 0 { + return b, nil + } + b = appendVarint(b, wiretag) + b = appendFixed64(b, v) + return b, nil +} +func appendFloat64Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + p := *ptr.toFloat64Ptr() + if p == nil { + return b, nil + } + b = appendVarint(b, wiretag) + b = appendFixed64(b, math.Float64bits(*p)) + return b, nil +} +func appendFloat64Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + s := *ptr.toFloat64Slice() + for _, v := range s { + b = appendVarint(b, wiretag) + b = appendFixed64(b, math.Float64bits(v)) + } + return b, nil +} +func appendFloat64PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + s := *ptr.toFloat64Slice() + if len(s) == 0 { + return b, nil + } + b = appendVarint(b, wiretag&^7|WireBytes) + b = appendVarint(b, uint64(8*len(s))) + for _, v := range s { + b = appendFixed64(b, math.Float64bits(v)) + } + return b, nil +} +func appendVarint32Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + v := *ptr.toUint32() + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(v)) + return b, nil +} +func appendVarint32ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + v := *ptr.toUint32() + if v == 0 { + return b, nil + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(v)) + return b, nil +} +func appendVarint32Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + p := *ptr.toUint32Ptr() + if p == nil { + return b, nil + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(*p)) + return b, nil +} +func appendVarint32Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + s := *ptr.toUint32Slice() + for _, v := range s { + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(v)) + } + return b, nil +} +func appendVarint32PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + s := *ptr.toUint32Slice() + if len(s) == 0 { + return b, nil + } + b = appendVarint(b, wiretag&^7|WireBytes) + // compute size + n := 0 + for _, v := range s { + n += SizeVarint(uint64(v)) + } + b = appendVarint(b, uint64(n)) + for _, v := range s { + b = appendVarint(b, uint64(v)) + } + return b, nil +} +func appendVarintS32Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + v := *ptr.toInt32() + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(v)) + return b, nil +} +func appendVarintS32ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + v := *ptr.toInt32() + if v == 0 { + return b, nil + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(v)) + return b, nil +} +func appendVarintS32Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + p := ptr.getInt32Ptr() + if p == nil { + return b, nil + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(*p)) + return b, nil +} +func appendVarintS32Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + s := ptr.getInt32Slice() + for _, v := range s { + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(v)) + } + return b, nil +} +func appendVarintS32PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + s := ptr.getInt32Slice() + if len(s) == 0 { + return b, nil + } + b = appendVarint(b, wiretag&^7|WireBytes) + // compute size + n := 0 + for _, v := range s { + n += SizeVarint(uint64(v)) + } + b = appendVarint(b, uint64(n)) + for _, v := range s { + b = appendVarint(b, uint64(v)) + } + return b, nil +} +func appendVarint64Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + v := *ptr.toUint64() + b = appendVarint(b, wiretag) + b = appendVarint(b, v) + return b, nil +} +func appendVarint64ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + v := *ptr.toUint64() + if v == 0 { + return b, nil + } + b = appendVarint(b, wiretag) + b = appendVarint(b, v) + return b, nil +} +func appendVarint64Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + p := *ptr.toUint64Ptr() + if p == nil { + return b, nil + } + b = appendVarint(b, wiretag) + b = appendVarint(b, *p) + return b, nil +} +func appendVarint64Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + s := *ptr.toUint64Slice() + for _, v := range s { + b = appendVarint(b, wiretag) + b = appendVarint(b, v) + } + return b, nil +} +func appendVarint64PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + s := *ptr.toUint64Slice() + if len(s) == 0 { + return b, nil + } + b = appendVarint(b, wiretag&^7|WireBytes) + // compute size + n := 0 + for _, v := range s { + n += SizeVarint(v) + } + b = appendVarint(b, uint64(n)) + for _, v := range s { + b = appendVarint(b, v) + } + return b, nil +} +func appendVarintS64Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + v := *ptr.toInt64() + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(v)) + return b, nil +} +func appendVarintS64ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + v := *ptr.toInt64() + if v == 0 { + return b, nil + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(v)) + return b, nil +} +func appendVarintS64Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + p := *ptr.toInt64Ptr() + if p == nil { + return b, nil + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(*p)) + return b, nil +} +func appendVarintS64Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + s := *ptr.toInt64Slice() + for _, v := range s { + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(v)) + } + return b, nil +} +func appendVarintS64PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + s := *ptr.toInt64Slice() + if len(s) == 0 { + return b, nil + } + b = appendVarint(b, wiretag&^7|WireBytes) + // compute size + n := 0 + for _, v := range s { + n += SizeVarint(uint64(v)) + } + b = appendVarint(b, uint64(n)) + for _, v := range s { + b = appendVarint(b, uint64(v)) + } + return b, nil +} +func appendZigzag32Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + v := *ptr.toInt32() + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64((uint32(v)<<1)^uint32((int32(v)>>31)))) + return b, nil +} +func appendZigzag32ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + v := *ptr.toInt32() + if v == 0 { + return b, nil + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64((uint32(v)<<1)^uint32((int32(v)>>31)))) + return b, nil +} +func appendZigzag32Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + p := ptr.getInt32Ptr() + if p == nil { + return b, nil + } + b = appendVarint(b, wiretag) + v := *p + b = appendVarint(b, uint64((uint32(v)<<1)^uint32((int32(v)>>31)))) + return b, nil +} +func appendZigzag32Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + s := ptr.getInt32Slice() + for _, v := range s { + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64((uint32(v)<<1)^uint32((int32(v)>>31)))) + } + return b, nil +} +func appendZigzag32PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + s := ptr.getInt32Slice() + if len(s) == 0 { + return b, nil + } + b = appendVarint(b, wiretag&^7|WireBytes) + // compute size + n := 0 + for _, v := range s { + n += SizeVarint(uint64((uint32(v) << 1) ^ uint32((int32(v) >> 31)))) + } + b = appendVarint(b, uint64(n)) + for _, v := range s { + b = appendVarint(b, uint64((uint32(v)<<1)^uint32((int32(v)>>31)))) + } + return b, nil +} +func appendZigzag64Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + v := *ptr.toInt64() + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(v<<1)^uint64((int64(v)>>63))) + return b, nil +} +func appendZigzag64ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + v := *ptr.toInt64() + if v == 0 { + return b, nil + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(v<<1)^uint64((int64(v)>>63))) + return b, nil +} +func appendZigzag64Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + p := *ptr.toInt64Ptr() + if p == nil { + return b, nil + } + b = appendVarint(b, wiretag) + v := *p + b = appendVarint(b, uint64(v<<1)^uint64((int64(v)>>63))) + return b, nil +} +func appendZigzag64Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + s := *ptr.toInt64Slice() + for _, v := range s { + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(v<<1)^uint64((int64(v)>>63))) + } + return b, nil +} +func appendZigzag64PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + s := *ptr.toInt64Slice() + if len(s) == 0 { + return b, nil + } + b = appendVarint(b, wiretag&^7|WireBytes) + // compute size + n := 0 + for _, v := range s { + n += SizeVarint(uint64(v<<1) ^ uint64((int64(v) >> 63))) + } + b = appendVarint(b, uint64(n)) + for _, v := range s { + b = appendVarint(b, uint64(v<<1)^uint64((int64(v)>>63))) + } + return b, nil +} +func appendBoolValue(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + v := *ptr.toBool() + b = appendVarint(b, wiretag) + if v { + b = append(b, 1) + } else { + b = append(b, 0) + } + return b, nil +} +func appendBoolValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + v := *ptr.toBool() + if !v { + return b, nil + } + b = appendVarint(b, wiretag) + b = append(b, 1) + return b, nil +} + +func appendBoolPtr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + p := *ptr.toBoolPtr() + if p == nil { + return b, nil + } + b = appendVarint(b, wiretag) + if *p { + b = append(b, 1) + } else { + b = append(b, 0) + } + return b, nil +} +func appendBoolSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + s := *ptr.toBoolSlice() + for _, v := range s { + b = appendVarint(b, wiretag) + if v { + b = append(b, 1) + } else { + b = append(b, 0) + } + } + return b, nil +} +func appendBoolPackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + s := *ptr.toBoolSlice() + if len(s) == 0 { + return b, nil + } + b = appendVarint(b, wiretag&^7|WireBytes) + b = appendVarint(b, uint64(len(s))) + for _, v := range s { + if v { + b = append(b, 1) + } else { + b = append(b, 0) + } + } + return b, nil +} +func appendStringValue(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + v := *ptr.toString() + if !utf8.ValidString(v) { + return nil, errInvalidUTF8 + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(len(v))) + b = append(b, v...) + return b, nil +} +func appendStringValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + v := *ptr.toString() + if v == "" { + return b, nil + } + if !utf8.ValidString(v) { + return nil, errInvalidUTF8 + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(len(v))) + b = append(b, v...) + return b, nil +} +func appendStringPtr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + p := *ptr.toStringPtr() + if p == nil { + return b, nil + } + v := *p + if !utf8.ValidString(v) { + return nil, errInvalidUTF8 + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(len(v))) + b = append(b, v...) + return b, nil +} +func appendStringSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + s := *ptr.toStringSlice() + for _, v := range s { + if !utf8.ValidString(v) { + return nil, errInvalidUTF8 + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(len(v))) + b = append(b, v...) + } + return b, nil +} +func appendBytes(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + v := *ptr.toBytes() + if v == nil { + return b, nil + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(len(v))) + b = append(b, v...) + return b, nil +} +func appendBytes3(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + v := *ptr.toBytes() + if len(v) == 0 { + return b, nil + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(len(v))) + b = append(b, v...) + return b, nil +} +func appendBytesOneof(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + v := *ptr.toBytes() + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(len(v))) + b = append(b, v...) + return b, nil +} +func appendBytesSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + s := *ptr.toBytesSlice() + for _, v := range s { + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(len(v))) + b = append(b, v...) + } + return b, nil +} + +// makeGroupMarshaler returns the sizer and marshaler for a group. +// u is the marshal info of the underlying message. +func makeGroupMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + p := ptr.getPointer() + if p.isNil() { + return 0 + } + return u.size(p) + 2*tagsize + }, + func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + p := ptr.getPointer() + if p.isNil() { + return b, nil + } + var err error + b = appendVarint(b, wiretag) // start group + b, err = u.marshal(b, p, deterministic) + b = appendVarint(b, wiretag+(WireEndGroup-WireStartGroup)) // end group + return b, err + } +} + +// makeGroupSliceMarshaler returns the sizer and marshaler for a group slice. +// u is the marshal info of the underlying message. +func makeGroupSliceMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + s := ptr.getPointerSlice() + n := 0 + for _, v := range s { + if v.isNil() { + continue + } + n += u.size(v) + 2*tagsize + } + return n + }, + func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + s := ptr.getPointerSlice() + var err, errreq error + for _, v := range s { + if v.isNil() { + return b, errRepeatedHasNil + } + b = appendVarint(b, wiretag) // start group + b, err = u.marshal(b, v, deterministic) + b = appendVarint(b, wiretag+(WireEndGroup-WireStartGroup)) // end group + if err != nil { + if _, ok := err.(*RequiredNotSetError); ok { + // Required field in submessage is not set. + // We record the error but keep going, to give a complete marshaling. + if errreq == nil { + errreq = err + } + continue + } + if err == ErrNil { + err = errRepeatedHasNil + } + return b, err + } + } + return b, errreq + } +} + +// makeMessageMarshaler returns the sizer and marshaler for a message field. +// u is the marshal info of the message. +func makeMessageMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + p := ptr.getPointer() + if p.isNil() { + return 0 + } + siz := u.size(p) + return siz + SizeVarint(uint64(siz)) + tagsize + }, + func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + p := ptr.getPointer() + if p.isNil() { + return b, nil + } + b = appendVarint(b, wiretag) + siz := u.cachedsize(p) + b = appendVarint(b, uint64(siz)) + return u.marshal(b, p, deterministic) + } +} + +// makeMessageSliceMarshaler returns the sizer and marshaler for a message slice. +// u is the marshal info of the message. +func makeMessageSliceMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + s := ptr.getPointerSlice() + n := 0 + for _, v := range s { + if v.isNil() { + continue + } + siz := u.size(v) + n += siz + SizeVarint(uint64(siz)) + tagsize + } + return n + }, + func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + s := ptr.getPointerSlice() + var err, errreq error + for _, v := range s { + if v.isNil() { + return b, errRepeatedHasNil + } + b = appendVarint(b, wiretag) + siz := u.cachedsize(v) + b = appendVarint(b, uint64(siz)) + b, err = u.marshal(b, v, deterministic) + if err != nil { + if _, ok := err.(*RequiredNotSetError); ok { + // Required field in submessage is not set. + // We record the error but keep going, to give a complete marshaling. + if errreq == nil { + errreq = err + } + continue + } + if err == ErrNil { + err = errRepeatedHasNil + } + return b, err + } + } + return b, errreq + } +} + +// makeMapMarshaler returns the sizer and marshaler for a map field. +// f is the pointer to the reflect data structure of the field. +func makeMapMarshaler(f *reflect.StructField) (sizer, marshaler) { + // figure out key and value type + t := f.Type + keyType := t.Key() + valType := t.Elem() + tags := strings.Split(f.Tag.Get("protobuf"), ",") + keyTags := strings.Split(f.Tag.Get("protobuf_key"), ",") + valTags := strings.Split(f.Tag.Get("protobuf_val"), ",") + for _, t := range tags { + if strings.HasPrefix(t, "customtype=") { + valTags = append(valTags, t) + } + if t == "stdtime" { + valTags = append(valTags, t) + } + if t == "stdduration" { + valTags = append(valTags, t) + } + } + keySizer, keyMarshaler := typeMarshaler(keyType, keyTags, false, false) // don't omit zero value in map + valSizer, valMarshaler := typeMarshaler(valType, valTags, false, false) // don't omit zero value in map + keyWireTag := 1<<3 | wiretype(keyTags[0]) + valWireTag := 2<<3 | wiretype(valTags[0]) + + // We create an interface to get the addresses of the map key and value. + // If value is pointer-typed, the interface is a direct interface, the + // idata itself is the value. Otherwise, the idata is the pointer to the + // value. + // Key cannot be pointer-typed. + valIsPtr := valType.Kind() == reflect.Ptr + return func(ptr pointer, tagsize int) int { + m := ptr.asPointerTo(t).Elem() // the map + n := 0 + for _, k := range m.MapKeys() { + ki := k.Interface() + vi := m.MapIndex(k).Interface() + kaddr := toAddrPointer(&ki, false) // pointer to key + vaddr := toAddrPointer(&vi, valIsPtr) // pointer to value + siz := keySizer(kaddr, 1) + valSizer(vaddr, 1) // tag of key = 1 (size=1), tag of val = 2 (size=1) + n += siz + SizeVarint(uint64(siz)) + tagsize + } + return n + }, + func(b []byte, ptr pointer, tag uint64, deterministic bool) ([]byte, error) { + m := ptr.asPointerTo(t).Elem() // the map + var err error + keys := m.MapKeys() + if len(keys) > 1 && deterministic { + sort.Sort(mapKeys(keys)) + } + for _, k := range keys { + ki := k.Interface() + vi := m.MapIndex(k).Interface() + kaddr := toAddrPointer(&ki, false) // pointer to key + vaddr := toAddrPointer(&vi, valIsPtr) // pointer to value + b = appendVarint(b, tag) + siz := keySizer(kaddr, 1) + valSizer(vaddr, 1) // tag of key = 1 (size=1), tag of val = 2 (size=1) + b = appendVarint(b, uint64(siz)) + b, err = keyMarshaler(b, kaddr, keyWireTag, deterministic) + if err != nil { + return b, err + } + b, err = valMarshaler(b, vaddr, valWireTag, deterministic) + if err != nil && err != ErrNil { // allow nil value in map + return b, err + } + } + return b, nil + } +} + +// makeOneOfMarshaler returns the sizer and marshaler for a oneof field. +// fi is the marshal info of the field. +// f is the pointer to the reflect data structure of the field. +func makeOneOfMarshaler(fi *marshalFieldInfo, f *reflect.StructField) (sizer, marshaler) { + // Oneof field is an interface. We need to get the actual data type on the fly. + t := f.Type + return func(ptr pointer, _ int) int { + p := ptr.getInterfacePointer() + if p.isNil() { + return 0 + } + v := ptr.asPointerTo(t).Elem().Elem().Elem() // *interface -> interface -> *struct -> struct + telem := v.Type() + e := fi.oneofElems[telem] + return e.sizer(p, e.tagsize) + }, + func(b []byte, ptr pointer, _ uint64, deterministic bool) ([]byte, error) { + p := ptr.getInterfacePointer() + if p.isNil() { + return b, nil + } + v := ptr.asPointerTo(t).Elem().Elem().Elem() // *interface -> interface -> *struct -> struct + telem := v.Type() + if telem.Field(0).Type.Kind() == reflect.Ptr && p.getPointer().isNil() { + return b, errOneofHasNil + } + e := fi.oneofElems[telem] + return e.marshaler(b, p, e.wiretag, deterministic) + } +} + +// sizeExtensions computes the size of encoded data for a XXX_InternalExtensions field. +func (u *marshalInfo) sizeExtensions(ext *XXX_InternalExtensions) int { + m, mu := ext.extensionsRead() + if m == nil { + return 0 + } + mu.Lock() + + n := 0 + for _, e := range m { + if e.value == nil || e.desc == nil { + // Extension is only in its encoded form. + n += len(e.enc) + continue + } + + // We don't skip extensions that have an encoded form set, + // because the extension value may have been mutated after + // the last time this function was called. + ei := u.getExtElemInfo(e.desc) + v := e.value + p := toAddrPointer(&v, ei.isptr) + n += ei.sizer(p, ei.tagsize) + } + mu.Unlock() + return n +} + +// appendExtensions marshals a XXX_InternalExtensions field to the end of byte slice b. +func (u *marshalInfo) appendExtensions(b []byte, ext *XXX_InternalExtensions, deterministic bool) ([]byte, error) { + m, mu := ext.extensionsRead() + if m == nil { + return b, nil + } + mu.Lock() + defer mu.Unlock() + + var err error + + // Fast-path for common cases: zero or one extensions. + // Don't bother sorting the keys. + if len(m) <= 1 { + for _, e := range m { + if e.value == nil || e.desc == nil { + // Extension is only in its encoded form. + b = append(b, e.enc...) + continue + } + + // We don't skip extensions that have an encoded form set, + // because the extension value may have been mutated after + // the last time this function was called. + + ei := u.getExtElemInfo(e.desc) + v := e.value + p := toAddrPointer(&v, ei.isptr) + b, err = ei.marshaler(b, p, ei.wiretag, deterministic) + if err != nil { + return b, err + } + } + return b, nil + } + + // Sort the keys to provide a deterministic encoding. + // Not sure this is required, but the old code does it. + keys := make([]int, 0, len(m)) + for k := range m { + keys = append(keys, int(k)) + } + sort.Ints(keys) + + for _, k := range keys { + e := m[int32(k)] + if e.value == nil || e.desc == nil { + // Extension is only in its encoded form. + b = append(b, e.enc...) + continue + } + + // We don't skip extensions that have an encoded form set, + // because the extension value may have been mutated after + // the last time this function was called. + + ei := u.getExtElemInfo(e.desc) + v := e.value + p := toAddrPointer(&v, ei.isptr) + b, err = ei.marshaler(b, p, ei.wiretag, deterministic) + if err != nil { + return b, err + } + } + return b, nil +} + +// message set format is: +// message MessageSet { +// repeated group Item = 1 { +// required int32 type_id = 2; +// required string message = 3; +// }; +// } + +// sizeMessageSet computes the size of encoded data for a XXX_InternalExtensions field +// in message set format (above). +func (u *marshalInfo) sizeMessageSet(ext *XXX_InternalExtensions) int { + m, mu := ext.extensionsRead() + if m == nil { + return 0 + } + mu.Lock() + + n := 0 + for id, e := range m { + n += 2 // start group, end group. tag = 1 (size=1) + n += SizeVarint(uint64(id)) + 1 // type_id, tag = 2 (size=1) + + if e.value == nil || e.desc == nil { + // Extension is only in its encoded form. + msgWithLen := skipVarint(e.enc) // skip old tag, but leave the length varint + siz := len(msgWithLen) + n += siz + 1 // message, tag = 3 (size=1) + continue + } + + // We don't skip extensions that have an encoded form set, + // because the extension value may have been mutated after + // the last time this function was called. + + ei := u.getExtElemInfo(e.desc) + v := e.value + p := toAddrPointer(&v, ei.isptr) + n += ei.sizer(p, 1) // message, tag = 3 (size=1) + } + mu.Unlock() + return n +} + +// appendMessageSet marshals a XXX_InternalExtensions field in message set format (above) +// to the end of byte slice b. +func (u *marshalInfo) appendMessageSet(b []byte, ext *XXX_InternalExtensions, deterministic bool) ([]byte, error) { + m, mu := ext.extensionsRead() + if m == nil { + return b, nil + } + mu.Lock() + defer mu.Unlock() + + var err error + + // Fast-path for common cases: zero or one extensions. + // Don't bother sorting the keys. + if len(m) <= 1 { + for id, e := range m { + b = append(b, 1<<3|WireStartGroup) + b = append(b, 2<<3|WireVarint) + b = appendVarint(b, uint64(id)) + + if e.value == nil || e.desc == nil { + // Extension is only in its encoded form. + msgWithLen := skipVarint(e.enc) // skip old tag, but leave the length varint + b = append(b, 3<<3|WireBytes) + b = append(b, msgWithLen...) + b = append(b, 1<<3|WireEndGroup) + continue + } + + // We don't skip extensions that have an encoded form set, + // because the extension value may have been mutated after + // the last time this function was called. + + ei := u.getExtElemInfo(e.desc) + v := e.value + p := toAddrPointer(&v, ei.isptr) + b, err = ei.marshaler(b, p, 3<<3|WireBytes, deterministic) + if err != nil { + return b, err + } + b = append(b, 1<<3|WireEndGroup) + } + return b, nil + } + + // Sort the keys to provide a deterministic encoding. + keys := make([]int, 0, len(m)) + for k := range m { + keys = append(keys, int(k)) + } + sort.Ints(keys) + + for _, id := range keys { + e := m[int32(id)] + b = append(b, 1<<3|WireStartGroup) + b = append(b, 2<<3|WireVarint) + b = appendVarint(b, uint64(id)) + + if e.value == nil || e.desc == nil { + // Extension is only in its encoded form. + msgWithLen := skipVarint(e.enc) // skip old tag, but leave the length varint + b = append(b, 3<<3|WireBytes) + b = append(b, msgWithLen...) + b = append(b, 1<<3|WireEndGroup) + continue + } + + // We don't skip extensions that have an encoded form set, + // because the extension value may have been mutated after + // the last time this function was called. + + ei := u.getExtElemInfo(e.desc) + v := e.value + p := toAddrPointer(&v, ei.isptr) + b, err = ei.marshaler(b, p, 3<<3|WireBytes, deterministic) + b = append(b, 1<<3|WireEndGroup) + if err != nil { + return b, err + } + } + return b, nil +} + +// sizeV1Extensions computes the size of encoded data for a V1-API extension field. +func (u *marshalInfo) sizeV1Extensions(m map[int32]Extension) int { + if m == nil { + return 0 + } + + n := 0 + for _, e := range m { + if e.value == nil || e.desc == nil { + // Extension is only in its encoded form. + n += len(e.enc) + continue + } + + // We don't skip extensions that have an encoded form set, + // because the extension value may have been mutated after + // the last time this function was called. + + ei := u.getExtElemInfo(e.desc) + v := e.value + p := toAddrPointer(&v, ei.isptr) + n += ei.sizer(p, ei.tagsize) + } + return n +} + +// appendV1Extensions marshals a V1-API extension field to the end of byte slice b. +func (u *marshalInfo) appendV1Extensions(b []byte, m map[int32]Extension, deterministic bool) ([]byte, error) { + if m == nil { + return b, nil + } + + // Sort the keys to provide a deterministic encoding. + keys := make([]int, 0, len(m)) + for k := range m { + keys = append(keys, int(k)) + } + sort.Ints(keys) + + var err error + for _, k := range keys { + e := m[int32(k)] + if e.value == nil || e.desc == nil { + // Extension is only in its encoded form. + b = append(b, e.enc...) + continue + } + + // We don't skip extensions that have an encoded form set, + // because the extension value may have been mutated after + // the last time this function was called. + + ei := u.getExtElemInfo(e.desc) + v := e.value + p := toAddrPointer(&v, ei.isptr) + b, err = ei.marshaler(b, p, ei.wiretag, deterministic) + if err != nil { + return b, err + } + } + return b, nil +} + +// newMarshaler is the interface representing objects that can marshal themselves. +// +// This exists to support protoc-gen-go generated messages. +// The proto package will stop type-asserting to this interface in the future. +// +// DO NOT DEPEND ON THIS. +type newMarshaler interface { + XXX_Size() int + XXX_Marshal(b []byte, deterministic bool) ([]byte, error) +} + +// Size returns the encoded size of a protocol buffer message. +// This is the main entry point. +func Size(pb Message) int { + if m, ok := pb.(newMarshaler); ok { + return m.XXX_Size() + } + if m, ok := pb.(Marshaler); ok { + // If the message can marshal itself, let it do it, for compatibility. + // NOTE: This is not efficient. + b, _ := m.Marshal() + return len(b) + } + // in case somehow we didn't generate the wrapper + if pb == nil { + return 0 + } + var info InternalMessageInfo + return info.Size(pb) +} + +// Marshal takes a protocol buffer message +// and encodes it into the wire format, returning the data. +// This is the main entry point. +func Marshal(pb Message) ([]byte, error) { + if m, ok := pb.(newMarshaler); ok { + siz := m.XXX_Size() + b := make([]byte, 0, siz) + return m.XXX_Marshal(b, false) + } + if m, ok := pb.(Marshaler); ok { + // If the message can marshal itself, let it do it, for compatibility. + // NOTE: This is not efficient. + return m.Marshal() + } + // in case somehow we didn't generate the wrapper + if pb == nil { + return nil, ErrNil + } + var info InternalMessageInfo + siz := info.Size(pb) + b := make([]byte, 0, siz) + return info.Marshal(b, pb, false) +} + +// Marshal takes a protocol buffer message +// and encodes it into the wire format, writing the result to the +// Buffer. +// This is an alternative entry point. It is not necessary to use +// a Buffer for most applications. +func (p *Buffer) Marshal(pb Message) error { + var err error + if m, ok := pb.(newMarshaler); ok { + siz := m.XXX_Size() + p.grow(siz) // make sure buf has enough capacity + p.buf, err = m.XXX_Marshal(p.buf, p.deterministic) + return err + } + if m, ok := pb.(Marshaler); ok { + // If the message can marshal itself, let it do it, for compatibility. + // NOTE: This is not efficient. + var b []byte + b, err = m.Marshal() + p.buf = append(p.buf, b...) + return err + } + // in case somehow we didn't generate the wrapper + if pb == nil { + return ErrNil + } + var info InternalMessageInfo + siz := info.Size(pb) + p.grow(siz) // make sure buf has enough capacity + p.buf, err = info.Marshal(p.buf, pb, p.deterministic) + return err +} + +// grow grows the buffer's capacity, if necessary, to guarantee space for +// another n bytes. After grow(n), at least n bytes can be written to the +// buffer without another allocation. +func (p *Buffer) grow(n int) { + need := len(p.buf) + n + if need <= cap(p.buf) { + return + } + newCap := len(p.buf) * 2 + if newCap < need { + newCap = need + } + p.buf = append(make([]byte, 0, newCap), p.buf...) +} diff --git a/vendor/github.com/gogo/protobuf/proto/table_marshal_gogo.go b/vendor/github.com/gogo/protobuf/proto/table_marshal_gogo.go new file mode 100644 index 000000000000..997f57c1e102 --- /dev/null +++ b/vendor/github.com/gogo/protobuf/proto/table_marshal_gogo.go @@ -0,0 +1,388 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2018, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +package proto + +import ( + "reflect" + "time" +) + +// makeMessageRefMarshaler differs a bit from makeMessageMarshaler +// It marshal a message T instead of a *T +func makeMessageRefMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + siz := u.size(ptr) + return siz + SizeVarint(uint64(siz)) + tagsize + }, + func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + b = appendVarint(b, wiretag) + siz := u.cachedsize(ptr) + b = appendVarint(b, uint64(siz)) + return u.marshal(b, ptr, deterministic) + } +} + +// makeMessageRefSliceMarshaler differs quite a lot from makeMessageSliceMarshaler +// It marshals a slice of messages []T instead of []*T +func makeMessageRefSliceMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + s := ptr.getSlice(u.typ) + n := 0 + for i := 0; i < s.Len(); i++ { + elem := s.Index(i) + e := elem.Interface() + v := toAddrPointer(&e, false) + siz := u.size(v) + n += siz + SizeVarint(uint64(siz)) + tagsize + } + return n + }, + func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + s := ptr.getSlice(u.typ) + var err, errreq error + for i := 0; i < s.Len(); i++ { + elem := s.Index(i) + e := elem.Interface() + v := toAddrPointer(&e, false) + b = appendVarint(b, wiretag) + siz := u.size(v) + b = appendVarint(b, uint64(siz)) + b, err = u.marshal(b, v, deterministic) + + if err != nil { + if _, ok := err.(*RequiredNotSetError); ok { + // Required field in submessage is not set. + // We record the error but keep going, to give a complete marshaling. + if errreq == nil { + errreq = err + } + continue + } + if err == ErrNil { + err = errRepeatedHasNil + } + return b, err + } + } + + return b, errreq + } +} + +func makeCustomPtrMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + if ptr.isNil() { + return 0 + } + m := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(custom) + siz := m.Size() + return tagsize + SizeVarint(uint64(siz)) + siz + }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + if ptr.isNil() { + return b, nil + } + m := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(custom) + siz := m.Size() + buf, err := m.Marshal() + if err != nil { + return nil, err + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(siz)) + b = append(b, buf...) + return b, nil + } +} + +func makeCustomMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + m := ptr.asPointerTo(u.typ).Interface().(custom) + siz := m.Size() + return tagsize + SizeVarint(uint64(siz)) + siz + }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + m := ptr.asPointerTo(u.typ).Interface().(custom) + siz := m.Size() + buf, err := m.Marshal() + if err != nil { + return nil, err + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(siz)) + b = append(b, buf...) + return b, nil + } +} + +func makeTimeMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + t := ptr.asPointerTo(u.typ).Interface().(*time.Time) + ts, err := timestampProto(*t) + if err != nil { + return 0 + } + siz := Size(ts) + return tagsize + SizeVarint(uint64(siz)) + siz + }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + t := ptr.asPointerTo(u.typ).Interface().(*time.Time) + ts, err := timestampProto(*t) + if err != nil { + return nil, err + } + buf, err := Marshal(ts) + if err != nil { + return nil, err + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(len(buf))) + b = append(b, buf...) + return b, nil + } +} + +func makeTimePtrMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + if ptr.isNil() { + return 0 + } + t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*time.Time) + ts, err := timestampProto(*t) + if err != nil { + return 0 + } + siz := Size(ts) + return tagsize + SizeVarint(uint64(siz)) + siz + }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + if ptr.isNil() { + return b, nil + } + t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*time.Time) + ts, err := timestampProto(*t) + if err != nil { + return nil, err + } + buf, err := Marshal(ts) + if err != nil { + return nil, err + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(len(buf))) + b = append(b, buf...) + return b, nil + } +} + +func makeTimeSliceMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + s := ptr.getSlice(u.typ) + n := 0 + for i := 0; i < s.Len(); i++ { + elem := s.Index(i) + t := elem.Interface().(time.Time) + ts, err := timestampProto(t) + if err != nil { + return 0 + } + siz := Size(ts) + n += siz + SizeVarint(uint64(siz)) + tagsize + } + return n + }, + func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + s := ptr.getSlice(u.typ) + for i := 0; i < s.Len(); i++ { + elem := s.Index(i) + t := elem.Interface().(time.Time) + ts, err := timestampProto(t) + if err != nil { + return nil, err + } + siz := Size(ts) + buf, err := Marshal(ts) + if err != nil { + return nil, err + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(siz)) + b = append(b, buf...) + } + + return b, nil + } +} + +func makeTimePtrSliceMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + s := ptr.getSlice(reflect.PtrTo(u.typ)) + n := 0 + for i := 0; i < s.Len(); i++ { + elem := s.Index(i) + t := elem.Interface().(*time.Time) + ts, err := timestampProto(*t) + if err != nil { + return 0 + } + siz := Size(ts) + n += siz + SizeVarint(uint64(siz)) + tagsize + } + return n + }, + func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + s := ptr.getSlice(reflect.PtrTo(u.typ)) + for i := 0; i < s.Len(); i++ { + elem := s.Index(i) + t := elem.Interface().(*time.Time) + ts, err := timestampProto(*t) + if err != nil { + return nil, err + } + siz := Size(ts) + buf, err := Marshal(ts) + if err != nil { + return nil, err + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(siz)) + b = append(b, buf...) + } + + return b, nil + } +} + +func makeDurationMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + d := ptr.asPointerTo(u.typ).Interface().(*time.Duration) + dur := durationProto(*d) + siz := Size(dur) + return tagsize + SizeVarint(uint64(siz)) + siz + }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + d := ptr.asPointerTo(u.typ).Interface().(*time.Duration) + dur := durationProto(*d) + buf, err := Marshal(dur) + if err != nil { + return nil, err + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(len(buf))) + b = append(b, buf...) + return b, nil + } +} + +func makeDurationPtrMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + if ptr.isNil() { + return 0 + } + d := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*time.Duration) + dur := durationProto(*d) + siz := Size(dur) + return tagsize + SizeVarint(uint64(siz)) + siz + }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + if ptr.isNil() { + return b, nil + } + d := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*time.Duration) + dur := durationProto(*d) + buf, err := Marshal(dur) + if err != nil { + return nil, err + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(len(buf))) + b = append(b, buf...) + return b, nil + } +} + +func makeDurationSliceMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + s := ptr.getSlice(u.typ) + n := 0 + for i := 0; i < s.Len(); i++ { + elem := s.Index(i) + d := elem.Interface().(time.Duration) + dur := durationProto(d) + siz := Size(dur) + n += siz + SizeVarint(uint64(siz)) + tagsize + } + return n + }, + func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + s := ptr.getSlice(u.typ) + for i := 0; i < s.Len(); i++ { + elem := s.Index(i) + d := elem.Interface().(time.Duration) + dur := durationProto(d) + siz := Size(dur) + buf, err := Marshal(dur) + if err != nil { + return nil, err + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(siz)) + b = append(b, buf...) + } + + return b, nil + } +} + +func makeDurationPtrSliceMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + s := ptr.getSlice(reflect.PtrTo(u.typ)) + n := 0 + for i := 0; i < s.Len(); i++ { + elem := s.Index(i) + d := elem.Interface().(*time.Duration) + dur := durationProto(*d) + siz := Size(dur) + n += siz + SizeVarint(uint64(siz)) + tagsize + } + return n + }, + func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + s := ptr.getSlice(reflect.PtrTo(u.typ)) + for i := 0; i < s.Len(); i++ { + elem := s.Index(i) + d := elem.Interface().(*time.Duration) + dur := durationProto(*d) + siz := Size(dur) + buf, err := Marshal(dur) + if err != nil { + return nil, err + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(siz)) + b = append(b, buf...) + } + + return b, nil + } +} diff --git a/vendor/github.com/gogo/protobuf/proto/table_merge.go b/vendor/github.com/gogo/protobuf/proto/table_merge.go new file mode 100644 index 000000000000..f520106e09f5 --- /dev/null +++ b/vendor/github.com/gogo/protobuf/proto/table_merge.go @@ -0,0 +1,657 @@ +// Go support for Protocol Buffers - Google's data interchange format +// +// Copyright 2016 The Go Authors. All rights reserved. +// https://github.com/golang/protobuf +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +package proto + +import ( + "fmt" + "reflect" + "strings" + "sync" + "sync/atomic" +) + +// Merge merges the src message into dst. +// This assumes that dst and src of the same type and are non-nil. +func (a *InternalMessageInfo) Merge(dst, src Message) { + mi := atomicLoadMergeInfo(&a.merge) + if mi == nil { + mi = getMergeInfo(reflect.TypeOf(dst).Elem()) + atomicStoreMergeInfo(&a.merge, mi) + } + mi.merge(toPointer(&dst), toPointer(&src)) +} + +type mergeInfo struct { + typ reflect.Type + + initialized int32 // 0: only typ is valid, 1: everything is valid + lock sync.Mutex + + fields []mergeFieldInfo + unrecognized field // Offset of XXX_unrecognized +} + +type mergeFieldInfo struct { + field field // Offset of field, guaranteed to be valid + + // isPointer reports whether the value in the field is a pointer. + // This is true for the following situations: + // * Pointer to struct + // * Pointer to basic type (proto2 only) + // * Slice (first value in slice header is a pointer) + // * String (first value in string header is a pointer) + isPointer bool + + // basicWidth reports the width of the field assuming that it is directly + // embedded in the struct (as is the case for basic types in proto3). + // The possible values are: + // 0: invalid + // 1: bool + // 4: int32, uint32, float32 + // 8: int64, uint64, float64 + basicWidth int + + // Where dst and src are pointers to the types being merged. + merge func(dst, src pointer) +} + +var ( + mergeInfoMap = map[reflect.Type]*mergeInfo{} + mergeInfoLock sync.Mutex +) + +func getMergeInfo(t reflect.Type) *mergeInfo { + mergeInfoLock.Lock() + defer mergeInfoLock.Unlock() + mi := mergeInfoMap[t] + if mi == nil { + mi = &mergeInfo{typ: t} + mergeInfoMap[t] = mi + } + return mi +} + +// merge merges src into dst assuming they are both of type *mi.typ. +func (mi *mergeInfo) merge(dst, src pointer) { + if dst.isNil() { + panic("proto: nil destination") + } + if src.isNil() { + return // Nothing to do. + } + + if atomic.LoadInt32(&mi.initialized) == 0 { + mi.computeMergeInfo() + } + + for _, fi := range mi.fields { + sfp := src.offset(fi.field) + + // As an optimization, we can avoid the merge function call cost + // if we know for sure that the source will have no effect + // by checking if it is the zero value. + if unsafeAllowed { + if fi.isPointer && sfp.getPointer().isNil() { // Could be slice or string + continue + } + if fi.basicWidth > 0 { + switch { + case fi.basicWidth == 1 && !*sfp.toBool(): + continue + case fi.basicWidth == 4 && *sfp.toUint32() == 0: + continue + case fi.basicWidth == 8 && *sfp.toUint64() == 0: + continue + } + } + } + + dfp := dst.offset(fi.field) + fi.merge(dfp, sfp) + } + + // TODO: Make this faster? + out := dst.asPointerTo(mi.typ).Elem() + in := src.asPointerTo(mi.typ).Elem() + if emIn, err := extendable(in.Addr().Interface()); err == nil { + emOut, _ := extendable(out.Addr().Interface()) + mIn, muIn := emIn.extensionsRead() + if mIn != nil { + mOut := emOut.extensionsWrite() + muIn.Lock() + mergeExtension(mOut, mIn) + muIn.Unlock() + } + } + + if mi.unrecognized.IsValid() { + if b := *src.offset(mi.unrecognized).toBytes(); len(b) > 0 { + *dst.offset(mi.unrecognized).toBytes() = append([]byte(nil), b...) + } + } +} + +func (mi *mergeInfo) computeMergeInfo() { + mi.lock.Lock() + defer mi.lock.Unlock() + if mi.initialized != 0 { + return + } + t := mi.typ + n := t.NumField() + + props := GetProperties(t) + for i := 0; i < n; i++ { + f := t.Field(i) + if strings.HasPrefix(f.Name, "XXX_") { + continue + } + + mfi := mergeFieldInfo{field: toField(&f)} + tf := f.Type + + // As an optimization, we can avoid the merge function call cost + // if we know for sure that the source will have no effect + // by checking if it is the zero value. + if unsafeAllowed { + switch tf.Kind() { + case reflect.Ptr, reflect.Slice, reflect.String: + // As a special case, we assume slices and strings are pointers + // since we know that the first field in the SliceSlice or + // StringHeader is a data pointer. + mfi.isPointer = true + case reflect.Bool: + mfi.basicWidth = 1 + case reflect.Int32, reflect.Uint32, reflect.Float32: + mfi.basicWidth = 4 + case reflect.Int64, reflect.Uint64, reflect.Float64: + mfi.basicWidth = 8 + } + } + + // Unwrap tf to get at its most basic type. + var isPointer, isSlice bool + if tf.Kind() == reflect.Slice && tf.Elem().Kind() != reflect.Uint8 { + isSlice = true + tf = tf.Elem() + } + if tf.Kind() == reflect.Ptr { + isPointer = true + tf = tf.Elem() + } + if isPointer && isSlice && tf.Kind() != reflect.Struct { + panic("both pointer and slice for basic type in " + tf.Name()) + } + + switch tf.Kind() { + case reflect.Int32: + switch { + case isSlice: // E.g., []int32 + mfi.merge = func(dst, src pointer) { + // NOTE: toInt32Slice is not defined (see pointer_reflect.go). + /* + sfsp := src.toInt32Slice() + if *sfsp != nil { + dfsp := dst.toInt32Slice() + *dfsp = append(*dfsp, *sfsp...) + if *dfsp == nil { + *dfsp = []int64{} + } + } + */ + sfs := src.getInt32Slice() + if sfs != nil { + dfs := dst.getInt32Slice() + dfs = append(dfs, sfs...) + if dfs == nil { + dfs = []int32{} + } + dst.setInt32Slice(dfs) + } + } + case isPointer: // E.g., *int32 + mfi.merge = func(dst, src pointer) { + // NOTE: toInt32Ptr is not defined (see pointer_reflect.go). + /* + sfpp := src.toInt32Ptr() + if *sfpp != nil { + dfpp := dst.toInt32Ptr() + if *dfpp == nil { + *dfpp = Int32(**sfpp) + } else { + **dfpp = **sfpp + } + } + */ + sfp := src.getInt32Ptr() + if sfp != nil { + dfp := dst.getInt32Ptr() + if dfp == nil { + dst.setInt32Ptr(*sfp) + } else { + *dfp = *sfp + } + } + } + default: // E.g., int32 + mfi.merge = func(dst, src pointer) { + if v := *src.toInt32(); v != 0 { + *dst.toInt32() = v + } + } + } + case reflect.Int64: + switch { + case isSlice: // E.g., []int64 + mfi.merge = func(dst, src pointer) { + sfsp := src.toInt64Slice() + if *sfsp != nil { + dfsp := dst.toInt64Slice() + *dfsp = append(*dfsp, *sfsp...) + if *dfsp == nil { + *dfsp = []int64{} + } + } + } + case isPointer: // E.g., *int64 + mfi.merge = func(dst, src pointer) { + sfpp := src.toInt64Ptr() + if *sfpp != nil { + dfpp := dst.toInt64Ptr() + if *dfpp == nil { + *dfpp = Int64(**sfpp) + } else { + **dfpp = **sfpp + } + } + } + default: // E.g., int64 + mfi.merge = func(dst, src pointer) { + if v := *src.toInt64(); v != 0 { + *dst.toInt64() = v + } + } + } + case reflect.Uint32: + switch { + case isSlice: // E.g., []uint32 + mfi.merge = func(dst, src pointer) { + sfsp := src.toUint32Slice() + if *sfsp != nil { + dfsp := dst.toUint32Slice() + *dfsp = append(*dfsp, *sfsp...) + if *dfsp == nil { + *dfsp = []uint32{} + } + } + } + case isPointer: // E.g., *uint32 + mfi.merge = func(dst, src pointer) { + sfpp := src.toUint32Ptr() + if *sfpp != nil { + dfpp := dst.toUint32Ptr() + if *dfpp == nil { + *dfpp = Uint32(**sfpp) + } else { + **dfpp = **sfpp + } + } + } + default: // E.g., uint32 + mfi.merge = func(dst, src pointer) { + if v := *src.toUint32(); v != 0 { + *dst.toUint32() = v + } + } + } + case reflect.Uint64: + switch { + case isSlice: // E.g., []uint64 + mfi.merge = func(dst, src pointer) { + sfsp := src.toUint64Slice() + if *sfsp != nil { + dfsp := dst.toUint64Slice() + *dfsp = append(*dfsp, *sfsp...) + if *dfsp == nil { + *dfsp = []uint64{} + } + } + } + case isPointer: // E.g., *uint64 + mfi.merge = func(dst, src pointer) { + sfpp := src.toUint64Ptr() + if *sfpp != nil { + dfpp := dst.toUint64Ptr() + if *dfpp == nil { + *dfpp = Uint64(**sfpp) + } else { + **dfpp = **sfpp + } + } + } + default: // E.g., uint64 + mfi.merge = func(dst, src pointer) { + if v := *src.toUint64(); v != 0 { + *dst.toUint64() = v + } + } + } + case reflect.Float32: + switch { + case isSlice: // E.g., []float32 + mfi.merge = func(dst, src pointer) { + sfsp := src.toFloat32Slice() + if *sfsp != nil { + dfsp := dst.toFloat32Slice() + *dfsp = append(*dfsp, *sfsp...) + if *dfsp == nil { + *dfsp = []float32{} + } + } + } + case isPointer: // E.g., *float32 + mfi.merge = func(dst, src pointer) { + sfpp := src.toFloat32Ptr() + if *sfpp != nil { + dfpp := dst.toFloat32Ptr() + if *dfpp == nil { + *dfpp = Float32(**sfpp) + } else { + **dfpp = **sfpp + } + } + } + default: // E.g., float32 + mfi.merge = func(dst, src pointer) { + if v := *src.toFloat32(); v != 0 { + *dst.toFloat32() = v + } + } + } + case reflect.Float64: + switch { + case isSlice: // E.g., []float64 + mfi.merge = func(dst, src pointer) { + sfsp := src.toFloat64Slice() + if *sfsp != nil { + dfsp := dst.toFloat64Slice() + *dfsp = append(*dfsp, *sfsp...) + if *dfsp == nil { + *dfsp = []float64{} + } + } + } + case isPointer: // E.g., *float64 + mfi.merge = func(dst, src pointer) { + sfpp := src.toFloat64Ptr() + if *sfpp != nil { + dfpp := dst.toFloat64Ptr() + if *dfpp == nil { + *dfpp = Float64(**sfpp) + } else { + **dfpp = **sfpp + } + } + } + default: // E.g., float64 + mfi.merge = func(dst, src pointer) { + if v := *src.toFloat64(); v != 0 { + *dst.toFloat64() = v + } + } + } + case reflect.Bool: + switch { + case isSlice: // E.g., []bool + mfi.merge = func(dst, src pointer) { + sfsp := src.toBoolSlice() + if *sfsp != nil { + dfsp := dst.toBoolSlice() + *dfsp = append(*dfsp, *sfsp...) + if *dfsp == nil { + *dfsp = []bool{} + } + } + } + case isPointer: // E.g., *bool + mfi.merge = func(dst, src pointer) { + sfpp := src.toBoolPtr() + if *sfpp != nil { + dfpp := dst.toBoolPtr() + if *dfpp == nil { + *dfpp = Bool(**sfpp) + } else { + **dfpp = **sfpp + } + } + } + default: // E.g., bool + mfi.merge = func(dst, src pointer) { + if v := *src.toBool(); v { + *dst.toBool() = v + } + } + } + case reflect.String: + switch { + case isSlice: // E.g., []string + mfi.merge = func(dst, src pointer) { + sfsp := src.toStringSlice() + if *sfsp != nil { + dfsp := dst.toStringSlice() + *dfsp = append(*dfsp, *sfsp...) + if *dfsp == nil { + *dfsp = []string{} + } + } + } + case isPointer: // E.g., *string + mfi.merge = func(dst, src pointer) { + sfpp := src.toStringPtr() + if *sfpp != nil { + dfpp := dst.toStringPtr() + if *dfpp == nil { + *dfpp = String(**sfpp) + } else { + **dfpp = **sfpp + } + } + } + default: // E.g., string + mfi.merge = func(dst, src pointer) { + if v := *src.toString(); v != "" { + *dst.toString() = v + } + } + } + case reflect.Slice: + isProto3 := props.Prop[i].proto3 + switch { + case isPointer: + panic("bad pointer in byte slice case in " + tf.Name()) + case tf.Elem().Kind() != reflect.Uint8: + panic("bad element kind in byte slice case in " + tf.Name()) + case isSlice: // E.g., [][]byte + mfi.merge = func(dst, src pointer) { + sbsp := src.toBytesSlice() + if *sbsp != nil { + dbsp := dst.toBytesSlice() + for _, sb := range *sbsp { + if sb == nil { + *dbsp = append(*dbsp, nil) + } else { + *dbsp = append(*dbsp, append([]byte{}, sb...)) + } + } + if *dbsp == nil { + *dbsp = [][]byte{} + } + } + } + default: // E.g., []byte + mfi.merge = func(dst, src pointer) { + sbp := src.toBytes() + if *sbp != nil { + dbp := dst.toBytes() + if !isProto3 || len(*sbp) > 0 { + *dbp = append([]byte{}, *sbp...) + } + } + } + } + case reflect.Struct: + switch { + case !isPointer: + mergeInfo := getMergeInfo(tf) + mfi.merge = func(dst, src pointer) { + mergeInfo.merge(dst, src) + } + case isSlice: // E.g., []*pb.T + mergeInfo := getMergeInfo(tf) + mfi.merge = func(dst, src pointer) { + sps := src.getPointerSlice() + if sps != nil { + dps := dst.getPointerSlice() + for _, sp := range sps { + var dp pointer + if !sp.isNil() { + dp = valToPointer(reflect.New(tf)) + mergeInfo.merge(dp, sp) + } + dps = append(dps, dp) + } + if dps == nil { + dps = []pointer{} + } + dst.setPointerSlice(dps) + } + } + default: // E.g., *pb.T + mergeInfo := getMergeInfo(tf) + mfi.merge = func(dst, src pointer) { + sp := src.getPointer() + if !sp.isNil() { + dp := dst.getPointer() + if dp.isNil() { + dp = valToPointer(reflect.New(tf)) + dst.setPointer(dp) + } + mergeInfo.merge(dp, sp) + } + } + } + case reflect.Map: + switch { + case isPointer || isSlice: + panic("bad pointer or slice in map case in " + tf.Name()) + default: // E.g., map[K]V + mfi.merge = func(dst, src pointer) { + sm := src.asPointerTo(tf).Elem() + if sm.Len() == 0 { + return + } + dm := dst.asPointerTo(tf).Elem() + if dm.IsNil() { + dm.Set(reflect.MakeMap(tf)) + } + + switch tf.Elem().Kind() { + case reflect.Ptr: // Proto struct (e.g., *T) + for _, key := range sm.MapKeys() { + val := sm.MapIndex(key) + val = reflect.ValueOf(Clone(val.Interface().(Message))) + dm.SetMapIndex(key, val) + } + case reflect.Slice: // E.g. Bytes type (e.g., []byte) + for _, key := range sm.MapKeys() { + val := sm.MapIndex(key) + val = reflect.ValueOf(append([]byte{}, val.Bytes()...)) + dm.SetMapIndex(key, val) + } + default: // Basic type (e.g., string) + for _, key := range sm.MapKeys() { + val := sm.MapIndex(key) + dm.SetMapIndex(key, val) + } + } + } + } + case reflect.Interface: + // Must be oneof field. + switch { + case isPointer || isSlice: + panic("bad pointer or slice in interface case in " + tf.Name()) + default: // E.g., interface{} + // TODO: Make this faster? + mfi.merge = func(dst, src pointer) { + su := src.asPointerTo(tf).Elem() + if !su.IsNil() { + du := dst.asPointerTo(tf).Elem() + typ := su.Elem().Type() + if du.IsNil() || du.Elem().Type() != typ { + du.Set(reflect.New(typ.Elem())) // Initialize interface if empty + } + sv := su.Elem().Elem().Field(0) + if sv.Kind() == reflect.Ptr && sv.IsNil() { + return + } + dv := du.Elem().Elem().Field(0) + if dv.Kind() == reflect.Ptr && dv.IsNil() { + dv.Set(reflect.New(sv.Type().Elem())) // Initialize proto message if empty + } + switch sv.Type().Kind() { + case reflect.Ptr: // Proto struct (e.g., *T) + Merge(dv.Interface().(Message), sv.Interface().(Message)) + case reflect.Slice: // E.g. Bytes type (e.g., []byte) + dv.Set(reflect.ValueOf(append([]byte{}, sv.Bytes()...))) + default: // Basic type (e.g., string) + dv.Set(sv) + } + } + } + } + default: + panic(fmt.Sprintf("merger not found for type:%s", tf)) + } + mi.fields = append(mi.fields, mfi) + } + + mi.unrecognized = invalidField + if f, ok := t.FieldByName("XXX_unrecognized"); ok { + if f.Type != reflect.TypeOf([]byte{}) { + panic("expected XXX_unrecognized to be of type []byte") + } + mi.unrecognized = toField(&f) + } + + atomic.StoreInt32(&mi.initialized, 1) +} diff --git a/vendor/github.com/gogo/protobuf/proto/table_unmarshal.go b/vendor/github.com/gogo/protobuf/proto/table_unmarshal.go new file mode 100644 index 000000000000..b6371bb56bd4 --- /dev/null +++ b/vendor/github.com/gogo/protobuf/proto/table_unmarshal.go @@ -0,0 +1,2058 @@ +// Go support for Protocol Buffers - Google's data interchange format +// +// Copyright 2016 The Go Authors. All rights reserved. +// https://github.com/golang/protobuf +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +package proto + +import ( + "errors" + "fmt" + "io" + "math" + "reflect" + "strconv" + "strings" + "sync" + "sync/atomic" + "unicode/utf8" +) + +// Unmarshal is the entry point from the generated .pb.go files. +// This function is not intended to be used by non-generated code. +// This function is not subject to any compatibility guarantee. +// msg contains a pointer to a protocol buffer struct. +// b is the data to be unmarshaled into the protocol buffer. +// a is a pointer to a place to store cached unmarshal information. +func (a *InternalMessageInfo) Unmarshal(msg Message, b []byte) error { + // Load the unmarshal information for this message type. + // The atomic load ensures memory consistency. + u := atomicLoadUnmarshalInfo(&a.unmarshal) + if u == nil { + // Slow path: find unmarshal info for msg, update a with it. + u = getUnmarshalInfo(reflect.TypeOf(msg).Elem()) + atomicStoreUnmarshalInfo(&a.unmarshal, u) + } + // Then do the unmarshaling. + err := u.unmarshal(toPointer(&msg), b) + return err +} + +type unmarshalInfo struct { + typ reflect.Type // type of the protobuf struct + + // 0 = only typ field is initialized + // 1 = completely initialized + initialized int32 + lock sync.Mutex // prevents double initialization + dense []unmarshalFieldInfo // fields indexed by tag # + sparse map[uint64]unmarshalFieldInfo // fields indexed by tag # + reqFields []string // names of required fields + reqMask uint64 // 1< 0 { + // Read tag and wire type. + // Special case 1 and 2 byte varints. + var x uint64 + if b[0] < 128 { + x = uint64(b[0]) + b = b[1:] + } else if len(b) >= 2 && b[1] < 128 { + x = uint64(b[0]&0x7f) + uint64(b[1])<<7 + b = b[2:] + } else { + var n int + x, n = decodeVarint(b) + if n == 0 { + return io.ErrUnexpectedEOF + } + b = b[n:] + } + tag := x >> 3 + wire := int(x) & 7 + + // Dispatch on the tag to one of the unmarshal* functions below. + var f unmarshalFieldInfo + if tag < uint64(len(u.dense)) { + f = u.dense[tag] + } else { + f = u.sparse[tag] + } + if fn := f.unmarshal; fn != nil { + var err error + b, err = fn(b, m.offset(f.field), wire) + if err == nil { + reqMask |= f.reqMask + continue + } + if r, ok := err.(*RequiredNotSetError); ok { + // Remember this error, but keep parsing. We need to produce + // a full parse even if a required field is missing. + rnse = r + reqMask |= f.reqMask + continue + } + if err != errInternalBadWireType { + return err + } + // Fragments with bad wire type are treated as unknown fields. + } + + // Unknown tag. + if !u.unrecognized.IsValid() { + // Don't keep unrecognized data; just skip it. + var err error + b, err = skipField(b, wire) + if err != nil { + return err + } + continue + } + // Keep unrecognized data around. + // maybe in extensions, maybe in the unrecognized field. + z := m.offset(u.unrecognized).toBytes() + var emap map[int32]Extension + var e Extension + for _, r := range u.extensionRanges { + if uint64(r.Start) <= tag && tag <= uint64(r.End) { + if u.extensions.IsValid() { + mp := m.offset(u.extensions).toExtensions() + emap = mp.extensionsWrite() + e = emap[int32(tag)] + z = &e.enc + break + } + if u.oldExtensions.IsValid() { + p := m.offset(u.oldExtensions).toOldExtensions() + emap = *p + if emap == nil { + emap = map[int32]Extension{} + *p = emap + } + e = emap[int32(tag)] + z = &e.enc + break + } + if u.bytesExtensions.IsValid() { + z = m.offset(u.bytesExtensions).toBytes() + break + } + panic("no extensions field available") + } + } + // Use wire type to skip data. + var err error + b0 := b + b, err = skipField(b, wire) + if err != nil { + return err + } + *z = encodeVarint(*z, tag<<3|uint64(wire)) + *z = append(*z, b0[:len(b0)-len(b)]...) + + if emap != nil { + emap[int32(tag)] = e + } + } + if rnse != nil { + // A required field of a submessage/group is missing. Return that error. + return rnse + } + if reqMask != u.reqMask { + // A required field of this message is missing. + for _, n := range u.reqFields { + if reqMask&1 == 0 { + return &RequiredNotSetError{n} + } + reqMask >>= 1 + } + } + return nil +} + +// computeUnmarshalInfo fills in u with information for use +// in unmarshaling protocol buffers of type u.typ. +func (u *unmarshalInfo) computeUnmarshalInfo() { + u.lock.Lock() + defer u.lock.Unlock() + if u.initialized != 0 { + return + } + t := u.typ + n := t.NumField() + + // Set up the "not found" value for the unrecognized byte buffer. + // This is the default for proto3. + u.unrecognized = invalidField + u.extensions = invalidField + u.oldExtensions = invalidField + u.bytesExtensions = invalidField + + // List of the generated type and offset for each oneof field. + type oneofField struct { + ityp reflect.Type // interface type of oneof field + field field // offset in containing message + } + var oneofFields []oneofField + + for i := 0; i < n; i++ { + f := t.Field(i) + if f.Name == "XXX_unrecognized" { + // The byte slice used to hold unrecognized input is special. + if f.Type != reflect.TypeOf(([]byte)(nil)) { + panic("bad type for XXX_unrecognized field: " + f.Type.Name()) + } + u.unrecognized = toField(&f) + continue + } + if f.Name == "XXX_InternalExtensions" { + // Ditto here. + if f.Type != reflect.TypeOf(XXX_InternalExtensions{}) { + panic("bad type for XXX_InternalExtensions field: " + f.Type.Name()) + } + u.extensions = toField(&f) + if f.Tag.Get("protobuf_messageset") == "1" { + u.isMessageSet = true + } + continue + } + if f.Name == "XXX_extensions" { + // An older form of the extensions field. + if f.Type == reflect.TypeOf((map[int32]Extension)(nil)) { + u.oldExtensions = toField(&f) + continue + } else if f.Type == reflect.TypeOf(([]byte)(nil)) { + u.bytesExtensions = toField(&f) + continue + } + panic("bad type for XXX_extensions field: " + f.Type.Name()) + } + if f.Name == "XXX_NoUnkeyedLiteral" || f.Name == "XXX_sizecache" { + continue + } + + oneof := f.Tag.Get("protobuf_oneof") + if oneof != "" { + oneofFields = append(oneofFields, oneofField{f.Type, toField(&f)}) + // The rest of oneof processing happens below. + continue + } + + tags := f.Tag.Get("protobuf") + tagArray := strings.Split(tags, ",") + if len(tagArray) < 2 { + panic("protobuf tag not enough fields in " + t.Name() + "." + f.Name + ": " + tags) + } + tag, err := strconv.Atoi(tagArray[1]) + if err != nil { + panic("protobuf tag field not an integer: " + tagArray[1]) + } + + name := "" + for _, tag := range tagArray[3:] { + if strings.HasPrefix(tag, "name=") { + name = tag[5:] + } + } + + // Extract unmarshaling function from the field (its type and tags). + unmarshal := fieldUnmarshaler(&f) + + // Required field? + var reqMask uint64 + if tagArray[2] == "req" { + bit := len(u.reqFields) + u.reqFields = append(u.reqFields, name) + reqMask = uint64(1) << uint(bit) + // TODO: if we have more than 64 required fields, we end up + // not verifying that all required fields are present. + // Fix this, perhaps using a count of required fields? + } + + // Store the info in the correct slot in the message. + u.setTag(tag, toField(&f), unmarshal, reqMask, name) + } + + // Find any types associated with oneof fields. + // TODO: XXX_OneofFuncs returns more info than we need. Get rid of some of it? + fn := reflect.Zero(reflect.PtrTo(t)).MethodByName("XXX_OneofFuncs") + // gogo: len(oneofFields) > 0 is needed for embedded oneof messages, without a marshaler and unmarshaler + if fn.IsValid() && len(oneofFields) > 0 { + res := fn.Call(nil)[3] // last return value from XXX_OneofFuncs: []interface{} + for i := res.Len() - 1; i >= 0; i-- { + v := res.Index(i) // interface{} + tptr := reflect.ValueOf(v.Interface()).Type() // *Msg_X + typ := tptr.Elem() // Msg_X + + f := typ.Field(0) // oneof implementers have one field + baseUnmarshal := fieldUnmarshaler(&f) + tags := strings.Split(f.Tag.Get("protobuf"), ",") + fieldNum, err := strconv.Atoi(tags[1]) + if err != nil { + panic("protobuf tag field not an integer: " + tags[1]) + } + var name string + for _, tag := range tags { + if strings.HasPrefix(tag, "name=") { + name = strings.TrimPrefix(tag, "name=") + break + } + } + + // Find the oneof field that this struct implements. + // Might take O(n^2) to process all of the oneofs, but who cares. + for _, of := range oneofFields { + if tptr.Implements(of.ityp) { + // We have found the corresponding interface for this struct. + // That lets us know where this struct should be stored + // when we encounter it during unmarshaling. + unmarshal := makeUnmarshalOneof(typ, of.ityp, baseUnmarshal) + u.setTag(fieldNum, of.field, unmarshal, 0, name) + } + } + } + } + + // Get extension ranges, if any. + fn = reflect.Zero(reflect.PtrTo(t)).MethodByName("ExtensionRangeArray") + if fn.IsValid() { + if !u.extensions.IsValid() && !u.oldExtensions.IsValid() && !u.bytesExtensions.IsValid() { + panic("a message with extensions, but no extensions field in " + t.Name()) + } + u.extensionRanges = fn.Call(nil)[0].Interface().([]ExtensionRange) + } + + // Explicitly disallow tag 0. This will ensure we flag an error + // when decoding a buffer of all zeros. Without this code, we + // would decode and skip an all-zero buffer of even length. + // [0 0] is [tag=0/wiretype=varint varint-encoded-0]. + u.setTag(0, zeroField, func(b []byte, f pointer, w int) ([]byte, error) { + return nil, fmt.Errorf("proto: %s: illegal tag 0 (wire type %d)", t, w) + }, 0, "") + + // Set mask for required field check. + u.reqMask = uint64(1)<= 0 && (tag < 16 || tag < 2*n) { // TODO: what are the right numbers here? + for len(u.dense) <= tag { + u.dense = append(u.dense, unmarshalFieldInfo{}) + } + u.dense[tag] = i + return + } + if u.sparse == nil { + u.sparse = map[uint64]unmarshalFieldInfo{} + } + u.sparse[uint64(tag)] = i +} + +// fieldUnmarshaler returns an unmarshaler for the given field. +func fieldUnmarshaler(f *reflect.StructField) unmarshaler { + if f.Type.Kind() == reflect.Map { + return makeUnmarshalMap(f) + } + return typeUnmarshaler(f.Type, f.Tag.Get("protobuf")) +} + +// typeUnmarshaler returns an unmarshaler for the given field type / field tag pair. +func typeUnmarshaler(t reflect.Type, tags string) unmarshaler { + tagArray := strings.Split(tags, ",") + encoding := tagArray[0] + name := "unknown" + ctype := false + isTime := false + isDuration := false + for _, tag := range tagArray[3:] { + if strings.HasPrefix(tag, "name=") { + name = tag[5:] + } + if strings.HasPrefix(tag, "customtype=") { + ctype = true + } + if tag == "stdtime" { + isTime = true + } + if tag == "stdduration" { + isDuration = true + } + } + + // Figure out packaging (pointer, slice, or both) + slice := false + pointer := false + if t.Kind() == reflect.Slice && t.Elem().Kind() != reflect.Uint8 { + slice = true + t = t.Elem() + } + if t.Kind() == reflect.Ptr { + pointer = true + t = t.Elem() + } + + if ctype { + if reflect.PtrTo(t).Implements(customType) { + if slice { + return makeUnmarshalCustomSlice(getUnmarshalInfo(t), name) + } + if pointer { + return makeUnmarshalCustomPtr(getUnmarshalInfo(t), name) + } + return makeUnmarshalCustom(getUnmarshalInfo(t), name) + } else { + panic(fmt.Sprintf("custom type: type: %v, does not implement the proto.custom interface", t)) + } + } + + if isTime { + if pointer { + if slice { + return makeUnmarshalTimePtrSlice(getUnmarshalInfo(t), name) + } + return makeUnmarshalTimePtr(getUnmarshalInfo(t), name) + } + if slice { + return makeUnmarshalTimeSlice(getUnmarshalInfo(t), name) + } + return makeUnmarshalTime(getUnmarshalInfo(t), name) + } + + if isDuration { + if pointer { + if slice { + return makeUnmarshalDurationPtrSlice(getUnmarshalInfo(t), name) + } + return makeUnmarshalDurationPtr(getUnmarshalInfo(t), name) + } + if slice { + return makeUnmarshalDurationSlice(getUnmarshalInfo(t), name) + } + return makeUnmarshalDuration(getUnmarshalInfo(t), name) + } + + // We'll never have both pointer and slice for basic types. + if pointer && slice && t.Kind() != reflect.Struct { + panic("both pointer and slice for basic type in " + t.Name()) + } + + switch t.Kind() { + case reflect.Bool: + if pointer { + return unmarshalBoolPtr + } + if slice { + return unmarshalBoolSlice + } + return unmarshalBoolValue + case reflect.Int32: + switch encoding { + case "fixed32": + if pointer { + return unmarshalFixedS32Ptr + } + if slice { + return unmarshalFixedS32Slice + } + return unmarshalFixedS32Value + case "varint": + // this could be int32 or enum + if pointer { + return unmarshalInt32Ptr + } + if slice { + return unmarshalInt32Slice + } + return unmarshalInt32Value + case "zigzag32": + if pointer { + return unmarshalSint32Ptr + } + if slice { + return unmarshalSint32Slice + } + return unmarshalSint32Value + } + case reflect.Int64: + switch encoding { + case "fixed64": + if pointer { + return unmarshalFixedS64Ptr + } + if slice { + return unmarshalFixedS64Slice + } + return unmarshalFixedS64Value + case "varint": + if pointer { + return unmarshalInt64Ptr + } + if slice { + return unmarshalInt64Slice + } + return unmarshalInt64Value + case "zigzag64": + if pointer { + return unmarshalSint64Ptr + } + if slice { + return unmarshalSint64Slice + } + return unmarshalSint64Value + } + case reflect.Uint32: + switch encoding { + case "fixed32": + if pointer { + return unmarshalFixed32Ptr + } + if slice { + return unmarshalFixed32Slice + } + return unmarshalFixed32Value + case "varint": + if pointer { + return unmarshalUint32Ptr + } + if slice { + return unmarshalUint32Slice + } + return unmarshalUint32Value + } + case reflect.Uint64: + switch encoding { + case "fixed64": + if pointer { + return unmarshalFixed64Ptr + } + if slice { + return unmarshalFixed64Slice + } + return unmarshalFixed64Value + case "varint": + if pointer { + return unmarshalUint64Ptr + } + if slice { + return unmarshalUint64Slice + } + return unmarshalUint64Value + } + case reflect.Float32: + if pointer { + return unmarshalFloat32Ptr + } + if slice { + return unmarshalFloat32Slice + } + return unmarshalFloat32Value + case reflect.Float64: + if pointer { + return unmarshalFloat64Ptr + } + if slice { + return unmarshalFloat64Slice + } + return unmarshalFloat64Value + case reflect.Map: + panic("map type in typeUnmarshaler in " + t.Name()) + case reflect.Slice: + if pointer { + panic("bad pointer in slice case in " + t.Name()) + } + if slice { + return unmarshalBytesSlice + } + return unmarshalBytesValue + case reflect.String: + if pointer { + return unmarshalStringPtr + } + if slice { + return unmarshalStringSlice + } + return unmarshalStringValue + case reflect.Struct: + // message or group field + if !pointer { + switch encoding { + case "bytes": + if slice { + return makeUnmarshalMessageSlice(getUnmarshalInfo(t), name) + } + return makeUnmarshalMessage(getUnmarshalInfo(t), name) + } + } + switch encoding { + case "bytes": + if slice { + return makeUnmarshalMessageSlicePtr(getUnmarshalInfo(t), name) + } + return makeUnmarshalMessagePtr(getUnmarshalInfo(t), name) + case "group": + if slice { + return makeUnmarshalGroupSlicePtr(getUnmarshalInfo(t), name) + } + return makeUnmarshalGroupPtr(getUnmarshalInfo(t), name) + } + } + panic(fmt.Sprintf("unmarshaler not found type:%s encoding:%s", t, encoding)) +} + +// Below are all the unmarshalers for individual fields of various types. + +func unmarshalInt64Value(b []byte, f pointer, w int) ([]byte, error) { + if w != WireVarint { + return b, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + v := int64(x) + *f.toInt64() = v + return b, nil +} + +func unmarshalInt64Ptr(b []byte, f pointer, w int) ([]byte, error) { + if w != WireVarint { + return b, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + v := int64(x) + *f.toInt64Ptr() = &v + return b, nil +} + +func unmarshalInt64Slice(b []byte, f pointer, w int) ([]byte, error) { + if w == WireBytes { // packed + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + res := b[x:] + b = b[:x] + for len(b) > 0 { + x, n = decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + v := int64(x) + s := f.toInt64Slice() + *s = append(*s, v) + } + return res, nil + } + if w != WireVarint { + return b, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + v := int64(x) + s := f.toInt64Slice() + *s = append(*s, v) + return b, nil +} + +func unmarshalSint64Value(b []byte, f pointer, w int) ([]byte, error) { + if w != WireVarint { + return b, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + v := int64(x>>1) ^ int64(x)<<63>>63 + *f.toInt64() = v + return b, nil +} + +func unmarshalSint64Ptr(b []byte, f pointer, w int) ([]byte, error) { + if w != WireVarint { + return b, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + v := int64(x>>1) ^ int64(x)<<63>>63 + *f.toInt64Ptr() = &v + return b, nil +} + +func unmarshalSint64Slice(b []byte, f pointer, w int) ([]byte, error) { + if w == WireBytes { // packed + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + res := b[x:] + b = b[:x] + for len(b) > 0 { + x, n = decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + v := int64(x>>1) ^ int64(x)<<63>>63 + s := f.toInt64Slice() + *s = append(*s, v) + } + return res, nil + } + if w != WireVarint { + return b, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + v := int64(x>>1) ^ int64(x)<<63>>63 + s := f.toInt64Slice() + *s = append(*s, v) + return b, nil +} + +func unmarshalUint64Value(b []byte, f pointer, w int) ([]byte, error) { + if w != WireVarint { + return b, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + v := uint64(x) + *f.toUint64() = v + return b, nil +} + +func unmarshalUint64Ptr(b []byte, f pointer, w int) ([]byte, error) { + if w != WireVarint { + return b, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + v := uint64(x) + *f.toUint64Ptr() = &v + return b, nil +} + +func unmarshalUint64Slice(b []byte, f pointer, w int) ([]byte, error) { + if w == WireBytes { // packed + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + res := b[x:] + b = b[:x] + for len(b) > 0 { + x, n = decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + v := uint64(x) + s := f.toUint64Slice() + *s = append(*s, v) + } + return res, nil + } + if w != WireVarint { + return b, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + v := uint64(x) + s := f.toUint64Slice() + *s = append(*s, v) + return b, nil +} + +func unmarshalInt32Value(b []byte, f pointer, w int) ([]byte, error) { + if w != WireVarint { + return b, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + v := int32(x) + *f.toInt32() = v + return b, nil +} + +func unmarshalInt32Ptr(b []byte, f pointer, w int) ([]byte, error) { + if w != WireVarint { + return b, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + v := int32(x) + f.setInt32Ptr(v) + return b, nil +} + +func unmarshalInt32Slice(b []byte, f pointer, w int) ([]byte, error) { + if w == WireBytes { // packed + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + res := b[x:] + b = b[:x] + for len(b) > 0 { + x, n = decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + v := int32(x) + f.appendInt32Slice(v) + } + return res, nil + } + if w != WireVarint { + return b, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + v := int32(x) + f.appendInt32Slice(v) + return b, nil +} + +func unmarshalSint32Value(b []byte, f pointer, w int) ([]byte, error) { + if w != WireVarint { + return b, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + v := int32(x>>1) ^ int32(x)<<31>>31 + *f.toInt32() = v + return b, nil +} + +func unmarshalSint32Ptr(b []byte, f pointer, w int) ([]byte, error) { + if w != WireVarint { + return b, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + v := int32(x>>1) ^ int32(x)<<31>>31 + f.setInt32Ptr(v) + return b, nil +} + +func unmarshalSint32Slice(b []byte, f pointer, w int) ([]byte, error) { + if w == WireBytes { // packed + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + res := b[x:] + b = b[:x] + for len(b) > 0 { + x, n = decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + v := int32(x>>1) ^ int32(x)<<31>>31 + f.appendInt32Slice(v) + } + return res, nil + } + if w != WireVarint { + return b, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + v := int32(x>>1) ^ int32(x)<<31>>31 + f.appendInt32Slice(v) + return b, nil +} + +func unmarshalUint32Value(b []byte, f pointer, w int) ([]byte, error) { + if w != WireVarint { + return b, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + v := uint32(x) + *f.toUint32() = v + return b, nil +} + +func unmarshalUint32Ptr(b []byte, f pointer, w int) ([]byte, error) { + if w != WireVarint { + return b, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + v := uint32(x) + *f.toUint32Ptr() = &v + return b, nil +} + +func unmarshalUint32Slice(b []byte, f pointer, w int) ([]byte, error) { + if w == WireBytes { // packed + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + res := b[x:] + b = b[:x] + for len(b) > 0 { + x, n = decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + v := uint32(x) + s := f.toUint32Slice() + *s = append(*s, v) + } + return res, nil + } + if w != WireVarint { + return b, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + v := uint32(x) + s := f.toUint32Slice() + *s = append(*s, v) + return b, nil +} + +func unmarshalFixed64Value(b []byte, f pointer, w int) ([]byte, error) { + if w != WireFixed64 { + return b, errInternalBadWireType + } + if len(b) < 8 { + return nil, io.ErrUnexpectedEOF + } + v := uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56 + *f.toUint64() = v + return b[8:], nil +} + +func unmarshalFixed64Ptr(b []byte, f pointer, w int) ([]byte, error) { + if w != WireFixed64 { + return b, errInternalBadWireType + } + if len(b) < 8 { + return nil, io.ErrUnexpectedEOF + } + v := uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56 + *f.toUint64Ptr() = &v + return b[8:], nil +} + +func unmarshalFixed64Slice(b []byte, f pointer, w int) ([]byte, error) { + if w == WireBytes { // packed + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + res := b[x:] + b = b[:x] + for len(b) > 0 { + if len(b) < 8 { + return nil, io.ErrUnexpectedEOF + } + v := uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56 + s := f.toUint64Slice() + *s = append(*s, v) + b = b[8:] + } + return res, nil + } + if w != WireFixed64 { + return b, errInternalBadWireType + } + if len(b) < 8 { + return nil, io.ErrUnexpectedEOF + } + v := uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56 + s := f.toUint64Slice() + *s = append(*s, v) + return b[8:], nil +} + +func unmarshalFixedS64Value(b []byte, f pointer, w int) ([]byte, error) { + if w != WireFixed64 { + return b, errInternalBadWireType + } + if len(b) < 8 { + return nil, io.ErrUnexpectedEOF + } + v := int64(b[0]) | int64(b[1])<<8 | int64(b[2])<<16 | int64(b[3])<<24 | int64(b[4])<<32 | int64(b[5])<<40 | int64(b[6])<<48 | int64(b[7])<<56 + *f.toInt64() = v + return b[8:], nil +} + +func unmarshalFixedS64Ptr(b []byte, f pointer, w int) ([]byte, error) { + if w != WireFixed64 { + return b, errInternalBadWireType + } + if len(b) < 8 { + return nil, io.ErrUnexpectedEOF + } + v := int64(b[0]) | int64(b[1])<<8 | int64(b[2])<<16 | int64(b[3])<<24 | int64(b[4])<<32 | int64(b[5])<<40 | int64(b[6])<<48 | int64(b[7])<<56 + *f.toInt64Ptr() = &v + return b[8:], nil +} + +func unmarshalFixedS64Slice(b []byte, f pointer, w int) ([]byte, error) { + if w == WireBytes { // packed + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + res := b[x:] + b = b[:x] + for len(b) > 0 { + if len(b) < 8 { + return nil, io.ErrUnexpectedEOF + } + v := int64(b[0]) | int64(b[1])<<8 | int64(b[2])<<16 | int64(b[3])<<24 | int64(b[4])<<32 | int64(b[5])<<40 | int64(b[6])<<48 | int64(b[7])<<56 + s := f.toInt64Slice() + *s = append(*s, v) + b = b[8:] + } + return res, nil + } + if w != WireFixed64 { + return b, errInternalBadWireType + } + if len(b) < 8 { + return nil, io.ErrUnexpectedEOF + } + v := int64(b[0]) | int64(b[1])<<8 | int64(b[2])<<16 | int64(b[3])<<24 | int64(b[4])<<32 | int64(b[5])<<40 | int64(b[6])<<48 | int64(b[7])<<56 + s := f.toInt64Slice() + *s = append(*s, v) + return b[8:], nil +} + +func unmarshalFixed32Value(b []byte, f pointer, w int) ([]byte, error) { + if w != WireFixed32 { + return b, errInternalBadWireType + } + if len(b) < 4 { + return nil, io.ErrUnexpectedEOF + } + v := uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24 + *f.toUint32() = v + return b[4:], nil +} + +func unmarshalFixed32Ptr(b []byte, f pointer, w int) ([]byte, error) { + if w != WireFixed32 { + return b, errInternalBadWireType + } + if len(b) < 4 { + return nil, io.ErrUnexpectedEOF + } + v := uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24 + *f.toUint32Ptr() = &v + return b[4:], nil +} + +func unmarshalFixed32Slice(b []byte, f pointer, w int) ([]byte, error) { + if w == WireBytes { // packed + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + res := b[x:] + b = b[:x] + for len(b) > 0 { + if len(b) < 4 { + return nil, io.ErrUnexpectedEOF + } + v := uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24 + s := f.toUint32Slice() + *s = append(*s, v) + b = b[4:] + } + return res, nil + } + if w != WireFixed32 { + return b, errInternalBadWireType + } + if len(b) < 4 { + return nil, io.ErrUnexpectedEOF + } + v := uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24 + s := f.toUint32Slice() + *s = append(*s, v) + return b[4:], nil +} + +func unmarshalFixedS32Value(b []byte, f pointer, w int) ([]byte, error) { + if w != WireFixed32 { + return b, errInternalBadWireType + } + if len(b) < 4 { + return nil, io.ErrUnexpectedEOF + } + v := int32(b[0]) | int32(b[1])<<8 | int32(b[2])<<16 | int32(b[3])<<24 + *f.toInt32() = v + return b[4:], nil +} + +func unmarshalFixedS32Ptr(b []byte, f pointer, w int) ([]byte, error) { + if w != WireFixed32 { + return b, errInternalBadWireType + } + if len(b) < 4 { + return nil, io.ErrUnexpectedEOF + } + v := int32(b[0]) | int32(b[1])<<8 | int32(b[2])<<16 | int32(b[3])<<24 + f.setInt32Ptr(v) + return b[4:], nil +} + +func unmarshalFixedS32Slice(b []byte, f pointer, w int) ([]byte, error) { + if w == WireBytes { // packed + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + res := b[x:] + b = b[:x] + for len(b) > 0 { + if len(b) < 4 { + return nil, io.ErrUnexpectedEOF + } + v := int32(b[0]) | int32(b[1])<<8 | int32(b[2])<<16 | int32(b[3])<<24 + f.appendInt32Slice(v) + b = b[4:] + } + return res, nil + } + if w != WireFixed32 { + return b, errInternalBadWireType + } + if len(b) < 4 { + return nil, io.ErrUnexpectedEOF + } + v := int32(b[0]) | int32(b[1])<<8 | int32(b[2])<<16 | int32(b[3])<<24 + f.appendInt32Slice(v) + return b[4:], nil +} + +func unmarshalBoolValue(b []byte, f pointer, w int) ([]byte, error) { + if w != WireVarint { + return b, errInternalBadWireType + } + // Note: any length varint is allowed, even though any sane + // encoder will use one byte. + // See https://github.com/golang/protobuf/issues/76 + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + // TODO: check if x>1? Tests seem to indicate no. + v := x != 0 + *f.toBool() = v + return b[n:], nil +} + +func unmarshalBoolPtr(b []byte, f pointer, w int) ([]byte, error) { + if w != WireVarint { + return b, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + v := x != 0 + *f.toBoolPtr() = &v + return b[n:], nil +} + +func unmarshalBoolSlice(b []byte, f pointer, w int) ([]byte, error) { + if w == WireBytes { // packed + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + res := b[x:] + b = b[:x] + for len(b) > 0 { + x, n = decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + v := x != 0 + s := f.toBoolSlice() + *s = append(*s, v) + b = b[n:] + } + return res, nil + } + if w != WireVarint { + return b, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + v := x != 0 + s := f.toBoolSlice() + *s = append(*s, v) + return b[n:], nil +} + +func unmarshalFloat64Value(b []byte, f pointer, w int) ([]byte, error) { + if w != WireFixed64 { + return b, errInternalBadWireType + } + if len(b) < 8 { + return nil, io.ErrUnexpectedEOF + } + v := math.Float64frombits(uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56) + *f.toFloat64() = v + return b[8:], nil +} + +func unmarshalFloat64Ptr(b []byte, f pointer, w int) ([]byte, error) { + if w != WireFixed64 { + return b, errInternalBadWireType + } + if len(b) < 8 { + return nil, io.ErrUnexpectedEOF + } + v := math.Float64frombits(uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56) + *f.toFloat64Ptr() = &v + return b[8:], nil +} + +func unmarshalFloat64Slice(b []byte, f pointer, w int) ([]byte, error) { + if w == WireBytes { // packed + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + res := b[x:] + b = b[:x] + for len(b) > 0 { + if len(b) < 8 { + return nil, io.ErrUnexpectedEOF + } + v := math.Float64frombits(uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56) + s := f.toFloat64Slice() + *s = append(*s, v) + b = b[8:] + } + return res, nil + } + if w != WireFixed64 { + return b, errInternalBadWireType + } + if len(b) < 8 { + return nil, io.ErrUnexpectedEOF + } + v := math.Float64frombits(uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56) + s := f.toFloat64Slice() + *s = append(*s, v) + return b[8:], nil +} + +func unmarshalFloat32Value(b []byte, f pointer, w int) ([]byte, error) { + if w != WireFixed32 { + return b, errInternalBadWireType + } + if len(b) < 4 { + return nil, io.ErrUnexpectedEOF + } + v := math.Float32frombits(uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24) + *f.toFloat32() = v + return b[4:], nil +} + +func unmarshalFloat32Ptr(b []byte, f pointer, w int) ([]byte, error) { + if w != WireFixed32 { + return b, errInternalBadWireType + } + if len(b) < 4 { + return nil, io.ErrUnexpectedEOF + } + v := math.Float32frombits(uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24) + *f.toFloat32Ptr() = &v + return b[4:], nil +} + +func unmarshalFloat32Slice(b []byte, f pointer, w int) ([]byte, error) { + if w == WireBytes { // packed + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + res := b[x:] + b = b[:x] + for len(b) > 0 { + if len(b) < 4 { + return nil, io.ErrUnexpectedEOF + } + v := math.Float32frombits(uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24) + s := f.toFloat32Slice() + *s = append(*s, v) + b = b[4:] + } + return res, nil + } + if w != WireFixed32 { + return b, errInternalBadWireType + } + if len(b) < 4 { + return nil, io.ErrUnexpectedEOF + } + v := math.Float32frombits(uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24) + s := f.toFloat32Slice() + *s = append(*s, v) + return b[4:], nil +} + +func unmarshalStringValue(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return b, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + v := string(b[:x]) + if !utf8.ValidString(v) { + return nil, errInvalidUTF8 + } + *f.toString() = v + return b[x:], nil +} + +func unmarshalStringPtr(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return b, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + v := string(b[:x]) + if !utf8.ValidString(v) { + return nil, errInvalidUTF8 + } + *f.toStringPtr() = &v + return b[x:], nil +} + +func unmarshalStringSlice(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return b, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + v := string(b[:x]) + if !utf8.ValidString(v) { + return nil, errInvalidUTF8 + } + s := f.toStringSlice() + *s = append(*s, v) + return b[x:], nil +} + +var emptyBuf [0]byte + +func unmarshalBytesValue(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return b, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + // The use of append here is a trick which avoids the zeroing + // that would be required if we used a make/copy pair. + // We append to emptyBuf instead of nil because we want + // a non-nil result even when the length is 0. + v := append(emptyBuf[:], b[:x]...) + *f.toBytes() = v + return b[x:], nil +} + +func unmarshalBytesSlice(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return b, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + v := append(emptyBuf[:], b[:x]...) + s := f.toBytesSlice() + *s = append(*s, v) + return b[x:], nil +} + +func makeUnmarshalMessagePtr(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return b, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + // First read the message field to see if something is there. + // The semantics of multiple submessages are weird. Instead of + // the last one winning (as it is for all other fields), multiple + // submessages are merged. + v := f.getPointer() + if v.isNil() { + v = valToPointer(reflect.New(sub.typ)) + f.setPointer(v) + } + err := sub.unmarshal(v, b[:x]) + if err != nil { + if r, ok := err.(*RequiredNotSetError); ok { + r.field = name + "." + r.field + } else { + return nil, err + } + } + return b[x:], err + } +} + +func makeUnmarshalMessageSlicePtr(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return b, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + v := valToPointer(reflect.New(sub.typ)) + err := sub.unmarshal(v, b[:x]) + if err != nil { + if r, ok := err.(*RequiredNotSetError); ok { + r.field = name + "." + r.field + } else { + return nil, err + } + } + f.appendPointer(v) + return b[x:], err + } +} + +func makeUnmarshalGroupPtr(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireStartGroup { + return b, errInternalBadWireType + } + x, y := findEndGroup(b) + if x < 0 { + return nil, io.ErrUnexpectedEOF + } + v := f.getPointer() + if v.isNil() { + v = valToPointer(reflect.New(sub.typ)) + f.setPointer(v) + } + err := sub.unmarshal(v, b[:x]) + if err != nil { + if r, ok := err.(*RequiredNotSetError); ok { + r.field = name + "." + r.field + } else { + return nil, err + } + } + return b[y:], err + } +} + +func makeUnmarshalGroupSlicePtr(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireStartGroup { + return b, errInternalBadWireType + } + x, y := findEndGroup(b) + if x < 0 { + return nil, io.ErrUnexpectedEOF + } + v := valToPointer(reflect.New(sub.typ)) + err := sub.unmarshal(v, b[:x]) + if err != nil { + if r, ok := err.(*RequiredNotSetError); ok { + r.field = name + "." + r.field + } else { + return nil, err + } + } + f.appendPointer(v) + return b[y:], err + } +} + +func makeUnmarshalMap(f *reflect.StructField) unmarshaler { + t := f.Type + kt := t.Key() + vt := t.Elem() + tagArray := strings.Split(f.Tag.Get("protobuf"), ",") + valTags := strings.Split(f.Tag.Get("protobuf_val"), ",") + for _, t := range tagArray { + if strings.HasPrefix(t, "customtype=") { + valTags = append(valTags, t) + } + if t == "stdtime" { + valTags = append(valTags, t) + } + if t == "stdduration" { + valTags = append(valTags, t) + } + } + unmarshalKey := typeUnmarshaler(kt, f.Tag.Get("protobuf_key")) + unmarshalVal := typeUnmarshaler(vt, strings.Join(valTags, ",")) + return func(b []byte, f pointer, w int) ([]byte, error) { + // The map entry is a submessage. Figure out how big it is. + if w != WireBytes { + return nil, fmt.Errorf("proto: bad wiretype for map field: got %d want %d", w, WireBytes) + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + r := b[x:] // unused data to return + b = b[:x] // data for map entry + + // Note: we could use #keys * #values ~= 200 functions + // to do map decoding without reflection. Probably not worth it. + // Maps will be somewhat slow. Oh well. + + // Read key and value from data. + k := reflect.New(kt) + v := reflect.New(vt) + for len(b) > 0 { + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + wire := int(x) & 7 + b = b[n:] + + var err error + switch x >> 3 { + case 1: + b, err = unmarshalKey(b, valToPointer(k), wire) + case 2: + b, err = unmarshalVal(b, valToPointer(v), wire) + default: + err = errInternalBadWireType // skip unknown tag + } + + if err == nil { + continue + } + if err != errInternalBadWireType { + return nil, err + } + + // Skip past unknown fields. + b, err = skipField(b, wire) + if err != nil { + return nil, err + } + } + + // Get map, allocate if needed. + m := f.asPointerTo(t).Elem() // an addressable map[K]T + if m.IsNil() { + m.Set(reflect.MakeMap(t)) + } + + // Insert into map. + m.SetMapIndex(k.Elem(), v.Elem()) + + return r, nil + } +} + +// makeUnmarshalOneof makes an unmarshaler for oneof fields. +// for: +// message Msg { +// oneof F { +// int64 X = 1; +// float64 Y = 2; +// } +// } +// typ is the type of the concrete entry for a oneof case (e.g. Msg_X). +// ityp is the interface type of the oneof field (e.g. isMsg_F). +// unmarshal is the unmarshaler for the base type of the oneof case (e.g. int64). +// Note that this function will be called once for each case in the oneof. +func makeUnmarshalOneof(typ, ityp reflect.Type, unmarshal unmarshaler) unmarshaler { + sf := typ.Field(0) + field0 := toField(&sf) + return func(b []byte, f pointer, w int) ([]byte, error) { + // Allocate holder for value. + v := reflect.New(typ) + + // Unmarshal data into holder. + // We unmarshal into the first field of the holder object. + var err error + b, err = unmarshal(b, valToPointer(v).offset(field0), w) + if err != nil { + return nil, err + } + + // Write pointer to holder into target field. + f.asPointerTo(ityp).Elem().Set(v) + + return b, nil + } +} + +// Error used by decode internally. +var errInternalBadWireType = errors.New("proto: internal error: bad wiretype") + +// skipField skips past a field of type wire and returns the remaining bytes. +func skipField(b []byte, wire int) ([]byte, error) { + switch wire { + case WireVarint: + _, k := decodeVarint(b) + if k == 0 { + return b, io.ErrUnexpectedEOF + } + b = b[k:] + case WireFixed32: + if len(b) < 4 { + return b, io.ErrUnexpectedEOF + } + b = b[4:] + case WireFixed64: + if len(b) < 8 { + return b, io.ErrUnexpectedEOF + } + b = b[8:] + case WireBytes: + m, k := decodeVarint(b) + if k == 0 || uint64(len(b)-k) < m { + return b, io.ErrUnexpectedEOF + } + b = b[uint64(k)+m:] + case WireStartGroup: + _, i := findEndGroup(b) + if i == -1 { + return b, io.ErrUnexpectedEOF + } + b = b[i:] + default: + return b, fmt.Errorf("proto: can't skip unknown wire type %d", wire) + } + return b, nil +} + +// findEndGroup finds the index of the next EndGroup tag. +// Groups may be nested, so the "next" EndGroup tag is the first +// unpaired EndGroup. +// findEndGroup returns the indexes of the start and end of the EndGroup tag. +// Returns (-1,-1) if it can't find one. +func findEndGroup(b []byte) (int, int) { + depth := 1 + i := 0 + for { + x, n := decodeVarint(b[i:]) + if n == 0 { + return -1, -1 + } + j := i + i += n + switch x & 7 { + case WireVarint: + _, k := decodeVarint(b[i:]) + if k == 0 { + return -1, -1 + } + i += k + case WireFixed32: + if len(b)-4 < i { + return -1, -1 + } + i += 4 + case WireFixed64: + if len(b)-8 < i { + return -1, -1 + } + i += 8 + case WireBytes: + m, k := decodeVarint(b[i:]) + if k == 0 { + return -1, -1 + } + i += k + if uint64(len(b)-i) < m { + return -1, -1 + } + i += int(m) + case WireStartGroup: + depth++ + case WireEndGroup: + depth-- + if depth == 0 { + return j, i + } + default: + return -1, -1 + } + } +} + +// encodeVarint appends a varint-encoded integer to b and returns the result. +func encodeVarint(b []byte, x uint64) []byte { + for x >= 1<<7 { + b = append(b, byte(x&0x7f|0x80)) + x >>= 7 + } + return append(b, byte(x)) +} + +// decodeVarint reads a varint-encoded integer from b. +// Returns the decoded integer and the number of bytes read. +// If there is an error, it returns 0,0. +func decodeVarint(b []byte) (uint64, int) { + var x, y uint64 + if len(b) <= 0 { + goto bad + } + x = uint64(b[0]) + if x < 0x80 { + return x, 1 + } + x -= 0x80 + + if len(b) <= 1 { + goto bad + } + y = uint64(b[1]) + x += y << 7 + if y < 0x80 { + return x, 2 + } + x -= 0x80 << 7 + + if len(b) <= 2 { + goto bad + } + y = uint64(b[2]) + x += y << 14 + if y < 0x80 { + return x, 3 + } + x -= 0x80 << 14 + + if len(b) <= 3 { + goto bad + } + y = uint64(b[3]) + x += y << 21 + if y < 0x80 { + return x, 4 + } + x -= 0x80 << 21 + + if len(b) <= 4 { + goto bad + } + y = uint64(b[4]) + x += y << 28 + if y < 0x80 { + return x, 5 + } + x -= 0x80 << 28 + + if len(b) <= 5 { + goto bad + } + y = uint64(b[5]) + x += y << 35 + if y < 0x80 { + return x, 6 + } + x -= 0x80 << 35 + + if len(b) <= 6 { + goto bad + } + y = uint64(b[6]) + x += y << 42 + if y < 0x80 { + return x, 7 + } + x -= 0x80 << 42 + + if len(b) <= 7 { + goto bad + } + y = uint64(b[7]) + x += y << 49 + if y < 0x80 { + return x, 8 + } + x -= 0x80 << 49 + + if len(b) <= 8 { + goto bad + } + y = uint64(b[8]) + x += y << 56 + if y < 0x80 { + return x, 9 + } + x -= 0x80 << 56 + + if len(b) <= 9 { + goto bad + } + y = uint64(b[9]) + x += y << 63 + if y < 2 { + return x, 10 + } + +bad: + return 0, 0 +} diff --git a/vendor/github.com/gogo/protobuf/proto/table_unmarshal_gogo.go b/vendor/github.com/gogo/protobuf/proto/table_unmarshal_gogo.go new file mode 100644 index 000000000000..00d6c7ad9376 --- /dev/null +++ b/vendor/github.com/gogo/protobuf/proto/table_unmarshal_gogo.go @@ -0,0 +1,385 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2018, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +package proto + +import ( + "io" + "reflect" +) + +func makeUnmarshalMessage(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return nil, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + // First read the message field to see if something is there. + // The semantics of multiple submessages are weird. Instead of + // the last one winning (as it is for all other fields), multiple + // submessages are merged. + v := f // gogo: changed from v := f.getPointer() + if v.isNil() { + v = valToPointer(reflect.New(sub.typ)) + f.setPointer(v) + } + err := sub.unmarshal(v, b[:x]) + if err != nil { + if r, ok := err.(*RequiredNotSetError); ok { + r.field = name + "." + r.field + } else { + return nil, err + } + } + return b[x:], err + } +} + +func makeUnmarshalMessageSlice(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return nil, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + v := valToPointer(reflect.New(sub.typ)) + err := sub.unmarshal(v, b[:x]) + if err != nil { + if r, ok := err.(*RequiredNotSetError); ok { + r.field = name + "." + r.field + } else { + return nil, err + } + } + f.appendRef(v, sub.typ) // gogo: changed from f.appendPointer(v) + return b[x:], err + } +} + +func makeUnmarshalCustomPtr(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return nil, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + + s := f.asPointerTo(reflect.PtrTo(sub.typ)).Elem() + s.Set(reflect.New(sub.typ)) + m := s.Interface().(custom) + if err := m.Unmarshal(b[:x]); err != nil { + return nil, err + } + return b[x:], nil + } +} + +func makeUnmarshalCustomSlice(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return nil, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + m := reflect.New(sub.typ) + c := m.Interface().(custom) + if err := c.Unmarshal(b[:x]); err != nil { + return nil, err + } + v := valToPointer(m) + f.appendRef(v, sub.typ) + return b[x:], nil + } +} + +func makeUnmarshalCustom(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return nil, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + + m := f.asPointerTo(sub.typ).Interface().(custom) + if err := m.Unmarshal(b[:x]); err != nil { + return nil, err + } + return b[x:], nil + } +} + +func makeUnmarshalTime(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return nil, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + m := ×tamp{} + if err := Unmarshal(b[:x], m); err != nil { + return nil, err + } + t, err := timestampFromProto(m) + if err != nil { + return nil, err + } + s := f.asPointerTo(sub.typ).Elem() + s.Set(reflect.ValueOf(t)) + return b[x:], nil + } +} + +func makeUnmarshalTimePtr(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return nil, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + m := ×tamp{} + if err := Unmarshal(b[:x], m); err != nil { + return nil, err + } + t, err := timestampFromProto(m) + if err != nil { + return nil, err + } + s := f.asPointerTo(reflect.PtrTo(sub.typ)).Elem() + s.Set(reflect.ValueOf(&t)) + return b[x:], nil + } +} + +func makeUnmarshalTimePtrSlice(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return nil, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + m := ×tamp{} + if err := Unmarshal(b[:x], m); err != nil { + return nil, err + } + t, err := timestampFromProto(m) + if err != nil { + return nil, err + } + slice := f.getSlice(reflect.PtrTo(sub.typ)) + newSlice := reflect.Append(slice, reflect.ValueOf(&t)) + slice.Set(newSlice) + return b[x:], nil + } +} + +func makeUnmarshalTimeSlice(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return nil, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + m := ×tamp{} + if err := Unmarshal(b[:x], m); err != nil { + return nil, err + } + t, err := timestampFromProto(m) + if err != nil { + return nil, err + } + slice := f.getSlice(sub.typ) + newSlice := reflect.Append(slice, reflect.ValueOf(t)) + slice.Set(newSlice) + return b[x:], nil + } +} + +func makeUnmarshalDurationPtr(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return nil, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + m := &duration{} + if err := Unmarshal(b[:x], m); err != nil { + return nil, err + } + d, err := durationFromProto(m) + if err != nil { + return nil, err + } + s := f.asPointerTo(reflect.PtrTo(sub.typ)).Elem() + s.Set(reflect.ValueOf(&d)) + return b[x:], nil + } +} + +func makeUnmarshalDuration(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return nil, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + m := &duration{} + if err := Unmarshal(b[:x], m); err != nil { + return nil, err + } + d, err := durationFromProto(m) + if err != nil { + return nil, err + } + s := f.asPointerTo(sub.typ).Elem() + s.Set(reflect.ValueOf(d)) + return b[x:], nil + } +} + +func makeUnmarshalDurationPtrSlice(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return nil, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + m := &duration{} + if err := Unmarshal(b[:x], m); err != nil { + return nil, err + } + d, err := durationFromProto(m) + if err != nil { + return nil, err + } + slice := f.getSlice(reflect.PtrTo(sub.typ)) + newSlice := reflect.Append(slice, reflect.ValueOf(&d)) + slice.Set(newSlice) + return b[x:], nil + } +} + +func makeUnmarshalDurationSlice(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return nil, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + m := &duration{} + if err := Unmarshal(b[:x], m); err != nil { + return nil, err + } + d, err := durationFromProto(m) + if err != nil { + return nil, err + } + slice := f.getSlice(sub.typ) + newSlice := reflect.Append(slice, reflect.ValueOf(d)) + slice.Set(newSlice) + return b[x:], nil + } +} diff --git a/vendor/github.com/gogo/protobuf/proto/text.go b/vendor/github.com/gogo/protobuf/proto/text.go new file mode 100644 index 000000000000..4f5706dc5f36 --- /dev/null +++ b/vendor/github.com/gogo/protobuf/proto/text.go @@ -0,0 +1,928 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2013, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// Go support for Protocol Buffers - Google's data interchange format +// +// Copyright 2010 The Go Authors. All rights reserved. +// https://github.com/golang/protobuf +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +package proto + +// Functions for writing the text protocol buffer format. + +import ( + "bufio" + "bytes" + "encoding" + "errors" + "fmt" + "io" + "log" + "math" + "reflect" + "sort" + "strings" + "sync" + "time" +) + +var ( + newline = []byte("\n") + spaces = []byte(" ") + endBraceNewline = []byte("}\n") + backslashN = []byte{'\\', 'n'} + backslashR = []byte{'\\', 'r'} + backslashT = []byte{'\\', 't'} + backslashDQ = []byte{'\\', '"'} + backslashBS = []byte{'\\', '\\'} + posInf = []byte("inf") + negInf = []byte("-inf") + nan = []byte("nan") +) + +type writer interface { + io.Writer + WriteByte(byte) error +} + +// textWriter is an io.Writer that tracks its indentation level. +type textWriter struct { + ind int + complete bool // if the current position is a complete line + compact bool // whether to write out as a one-liner + w writer +} + +func (w *textWriter) WriteString(s string) (n int, err error) { + if !strings.Contains(s, "\n") { + if !w.compact && w.complete { + w.writeIndent() + } + w.complete = false + return io.WriteString(w.w, s) + } + // WriteString is typically called without newlines, so this + // codepath and its copy are rare. We copy to avoid + // duplicating all of Write's logic here. + return w.Write([]byte(s)) +} + +func (w *textWriter) Write(p []byte) (n int, err error) { + newlines := bytes.Count(p, newline) + if newlines == 0 { + if !w.compact && w.complete { + w.writeIndent() + } + n, err = w.w.Write(p) + w.complete = false + return n, err + } + + frags := bytes.SplitN(p, newline, newlines+1) + if w.compact { + for i, frag := range frags { + if i > 0 { + if err := w.w.WriteByte(' '); err != nil { + return n, err + } + n++ + } + nn, err := w.w.Write(frag) + n += nn + if err != nil { + return n, err + } + } + return n, nil + } + + for i, frag := range frags { + if w.complete { + w.writeIndent() + } + nn, err := w.w.Write(frag) + n += nn + if err != nil { + return n, err + } + if i+1 < len(frags) { + if err := w.w.WriteByte('\n'); err != nil { + return n, err + } + n++ + } + } + w.complete = len(frags[len(frags)-1]) == 0 + return n, nil +} + +func (w *textWriter) WriteByte(c byte) error { + if w.compact && c == '\n' { + c = ' ' + } + if !w.compact && w.complete { + w.writeIndent() + } + err := w.w.WriteByte(c) + w.complete = c == '\n' + return err +} + +func (w *textWriter) indent() { w.ind++ } + +func (w *textWriter) unindent() { + if w.ind == 0 { + log.Print("proto: textWriter unindented too far") + return + } + w.ind-- +} + +func writeName(w *textWriter, props *Properties) error { + if _, err := w.WriteString(props.OrigName); err != nil { + return err + } + if props.Wire != "group" { + return w.WriteByte(':') + } + return nil +} + +func requiresQuotes(u string) bool { + // When type URL contains any characters except [0-9A-Za-z./\-]*, it must be quoted. + for _, ch := range u { + switch { + case ch == '.' || ch == '/' || ch == '_': + continue + case '0' <= ch && ch <= '9': + continue + case 'A' <= ch && ch <= 'Z': + continue + case 'a' <= ch && ch <= 'z': + continue + default: + return true + } + } + return false +} + +// isAny reports whether sv is a google.protobuf.Any message +func isAny(sv reflect.Value) bool { + type wkt interface { + XXX_WellKnownType() string + } + t, ok := sv.Addr().Interface().(wkt) + return ok && t.XXX_WellKnownType() == "Any" +} + +// writeProto3Any writes an expanded google.protobuf.Any message. +// +// It returns (false, nil) if sv value can't be unmarshaled (e.g. because +// required messages are not linked in). +// +// It returns (true, error) when sv was written in expanded format or an error +// was encountered. +func (tm *TextMarshaler) writeProto3Any(w *textWriter, sv reflect.Value) (bool, error) { + turl := sv.FieldByName("TypeUrl") + val := sv.FieldByName("Value") + if !turl.IsValid() || !val.IsValid() { + return true, errors.New("proto: invalid google.protobuf.Any message") + } + + b, ok := val.Interface().([]byte) + if !ok { + return true, errors.New("proto: invalid google.protobuf.Any message") + } + + parts := strings.Split(turl.String(), "/") + mt := MessageType(parts[len(parts)-1]) + if mt == nil { + return false, nil + } + m := reflect.New(mt.Elem()) + if err := Unmarshal(b, m.Interface().(Message)); err != nil { + return false, nil + } + w.Write([]byte("[")) + u := turl.String() + if requiresQuotes(u) { + writeString(w, u) + } else { + w.Write([]byte(u)) + } + if w.compact { + w.Write([]byte("]:<")) + } else { + w.Write([]byte("]: <\n")) + w.ind++ + } + if err := tm.writeStruct(w, m.Elem()); err != nil { + return true, err + } + if w.compact { + w.Write([]byte("> ")) + } else { + w.ind-- + w.Write([]byte(">\n")) + } + return true, nil +} + +func (tm *TextMarshaler) writeStruct(w *textWriter, sv reflect.Value) error { + if tm.ExpandAny && isAny(sv) { + if canExpand, err := tm.writeProto3Any(w, sv); canExpand { + return err + } + } + st := sv.Type() + sprops := GetProperties(st) + for i := 0; i < sv.NumField(); i++ { + fv := sv.Field(i) + props := sprops.Prop[i] + name := st.Field(i).Name + + if name == "XXX_NoUnkeyedLiteral" { + continue + } + + if strings.HasPrefix(name, "XXX_") { + // There are two XXX_ fields: + // XXX_unrecognized []byte + // XXX_extensions map[int32]proto.Extension + // The first is handled here; + // the second is handled at the bottom of this function. + if name == "XXX_unrecognized" && !fv.IsNil() { + if err := writeUnknownStruct(w, fv.Interface().([]byte)); err != nil { + return err + } + } + continue + } + if fv.Kind() == reflect.Ptr && fv.IsNil() { + // Field not filled in. This could be an optional field or + // a required field that wasn't filled in. Either way, there + // isn't anything we can show for it. + continue + } + if fv.Kind() == reflect.Slice && fv.IsNil() { + // Repeated field that is empty, or a bytes field that is unused. + continue + } + + if props.Repeated && fv.Kind() == reflect.Slice { + // Repeated field. + for j := 0; j < fv.Len(); j++ { + if err := writeName(w, props); err != nil { + return err + } + if !w.compact { + if err := w.WriteByte(' '); err != nil { + return err + } + } + v := fv.Index(j) + if v.Kind() == reflect.Ptr && v.IsNil() { + // A nil message in a repeated field is not valid, + // but we can handle that more gracefully than panicking. + if _, err := w.Write([]byte("\n")); err != nil { + return err + } + continue + } + if len(props.Enum) > 0 { + if err := tm.writeEnum(w, v, props); err != nil { + return err + } + } else if err := tm.writeAny(w, v, props); err != nil { + return err + } + if err := w.WriteByte('\n'); err != nil { + return err + } + } + continue + } + if fv.Kind() == reflect.Map { + // Map fields are rendered as a repeated struct with key/value fields. + keys := fv.MapKeys() + sort.Sort(mapKeys(keys)) + for _, key := range keys { + val := fv.MapIndex(key) + if err := writeName(w, props); err != nil { + return err + } + if !w.compact { + if err := w.WriteByte(' '); err != nil { + return err + } + } + // open struct + if err := w.WriteByte('<'); err != nil { + return err + } + if !w.compact { + if err := w.WriteByte('\n'); err != nil { + return err + } + } + w.indent() + // key + if _, err := w.WriteString("key:"); err != nil { + return err + } + if !w.compact { + if err := w.WriteByte(' '); err != nil { + return err + } + } + if err := tm.writeAny(w, key, props.mkeyprop); err != nil { + return err + } + if err := w.WriteByte('\n'); err != nil { + return err + } + // nil values aren't legal, but we can avoid panicking because of them. + if val.Kind() != reflect.Ptr || !val.IsNil() { + // value + if _, err := w.WriteString("value:"); err != nil { + return err + } + if !w.compact { + if err := w.WriteByte(' '); err != nil { + return err + } + } + if err := tm.writeAny(w, val, props.mvalprop); err != nil { + return err + } + if err := w.WriteByte('\n'); err != nil { + return err + } + } + // close struct + w.unindent() + if err := w.WriteByte('>'); err != nil { + return err + } + if err := w.WriteByte('\n'); err != nil { + return err + } + } + continue + } + if props.proto3 && fv.Kind() == reflect.Slice && fv.Len() == 0 { + // empty bytes field + continue + } + if props.proto3 && fv.Kind() != reflect.Ptr && fv.Kind() != reflect.Slice { + // proto3 non-repeated scalar field; skip if zero value + if isProto3Zero(fv) { + continue + } + } + + if fv.Kind() == reflect.Interface { + // Check if it is a oneof. + if st.Field(i).Tag.Get("protobuf_oneof") != "" { + // fv is nil, or holds a pointer to generated struct. + // That generated struct has exactly one field, + // which has a protobuf struct tag. + if fv.IsNil() { + continue + } + inner := fv.Elem().Elem() // interface -> *T -> T + tag := inner.Type().Field(0).Tag.Get("protobuf") + props = new(Properties) // Overwrite the outer props var, but not its pointee. + props.Parse(tag) + // Write the value in the oneof, not the oneof itself. + fv = inner.Field(0) + + // Special case to cope with malformed messages gracefully: + // If the value in the oneof is a nil pointer, don't panic + // in writeAny. + if fv.Kind() == reflect.Ptr && fv.IsNil() { + // Use errors.New so writeAny won't render quotes. + msg := errors.New("/* nil */") + fv = reflect.ValueOf(&msg).Elem() + } + } + } + + if err := writeName(w, props); err != nil { + return err + } + if !w.compact { + if err := w.WriteByte(' '); err != nil { + return err + } + } + + if len(props.Enum) > 0 { + if err := tm.writeEnum(w, fv, props); err != nil { + return err + } + } else if err := tm.writeAny(w, fv, props); err != nil { + return err + } + + if err := w.WriteByte('\n'); err != nil { + return err + } + } + + // Extensions (the XXX_extensions field). + pv := sv + if pv.CanAddr() { + pv = sv.Addr() + } else { + pv = reflect.New(sv.Type()) + pv.Elem().Set(sv) + } + if _, err := extendable(pv.Interface()); err == nil { + if err := tm.writeExtensions(w, pv); err != nil { + return err + } + } + + return nil +} + +// writeAny writes an arbitrary field. +func (tm *TextMarshaler) writeAny(w *textWriter, v reflect.Value, props *Properties) error { + v = reflect.Indirect(v) + + if props != nil { + if len(props.CustomType) > 0 { + custom, ok := v.Interface().(Marshaler) + if ok { + data, err := custom.Marshal() + if err != nil { + return err + } + if err := writeString(w, string(data)); err != nil { + return err + } + return nil + } + } else if len(props.CastType) > 0 { + if _, ok := v.Interface().(interface { + String() string + }); ok { + switch v.Kind() { + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, + reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: + _, err := fmt.Fprintf(w, "%d", v.Interface()) + return err + } + } + } else if props.StdTime { + t, ok := v.Interface().(time.Time) + if !ok { + return fmt.Errorf("stdtime is not time.Time, but %T", v.Interface()) + } + tproto, err := timestampProto(t) + if err != nil { + return err + } + propsCopy := *props // Make a copy so that this is goroutine-safe + propsCopy.StdTime = false + err = tm.writeAny(w, reflect.ValueOf(tproto), &propsCopy) + return err + } else if props.StdDuration { + d, ok := v.Interface().(time.Duration) + if !ok { + return fmt.Errorf("stdtime is not time.Duration, but %T", v.Interface()) + } + dproto := durationProto(d) + propsCopy := *props // Make a copy so that this is goroutine-safe + propsCopy.StdDuration = false + err := tm.writeAny(w, reflect.ValueOf(dproto), &propsCopy) + return err + } + } + + // Floats have special cases. + if v.Kind() == reflect.Float32 || v.Kind() == reflect.Float64 { + x := v.Float() + var b []byte + switch { + case math.IsInf(x, 1): + b = posInf + case math.IsInf(x, -1): + b = negInf + case math.IsNaN(x): + b = nan + } + if b != nil { + _, err := w.Write(b) + return err + } + // Other values are handled below. + } + + // We don't attempt to serialise every possible value type; only those + // that can occur in protocol buffers. + switch v.Kind() { + case reflect.Slice: + // Should only be a []byte; repeated fields are handled in writeStruct. + if err := writeString(w, string(v.Bytes())); err != nil { + return err + } + case reflect.String: + if err := writeString(w, v.String()); err != nil { + return err + } + case reflect.Struct: + // Required/optional group/message. + var bra, ket byte = '<', '>' + if props != nil && props.Wire == "group" { + bra, ket = '{', '}' + } + if err := w.WriteByte(bra); err != nil { + return err + } + if !w.compact { + if err := w.WriteByte('\n'); err != nil { + return err + } + } + w.indent() + if v.CanAddr() { + // Calling v.Interface on a struct causes the reflect package to + // copy the entire struct. This is racy with the new Marshaler + // since we atomically update the XXX_sizecache. + // + // Thus, we retrieve a pointer to the struct if possible to avoid + // a race since v.Interface on the pointer doesn't copy the struct. + // + // If v is not addressable, then we are not worried about a race + // since it implies that the binary Marshaler cannot possibly be + // mutating this value. + v = v.Addr() + } + if etm, ok := v.Interface().(encoding.TextMarshaler); ok { + text, err := etm.MarshalText() + if err != nil { + return err + } + if _, err = w.Write(text); err != nil { + return err + } + } else { + if v.Kind() == reflect.Ptr { + v = v.Elem() + } + if err := tm.writeStruct(w, v); err != nil { + return err + } + } + w.unindent() + if err := w.WriteByte(ket); err != nil { + return err + } + default: + _, err := fmt.Fprint(w, v.Interface()) + return err + } + return nil +} + +// equivalent to C's isprint. +func isprint(c byte) bool { + return c >= 0x20 && c < 0x7f +} + +// writeString writes a string in the protocol buffer text format. +// It is similar to strconv.Quote except we don't use Go escape sequences, +// we treat the string as a byte sequence, and we use octal escapes. +// These differences are to maintain interoperability with the other +// languages' implementations of the text format. +func writeString(w *textWriter, s string) error { + // use WriteByte here to get any needed indent + if err := w.WriteByte('"'); err != nil { + return err + } + // Loop over the bytes, not the runes. + for i := 0; i < len(s); i++ { + var err error + // Divergence from C++: we don't escape apostrophes. + // There's no need to escape them, and the C++ parser + // copes with a naked apostrophe. + switch c := s[i]; c { + case '\n': + _, err = w.w.Write(backslashN) + case '\r': + _, err = w.w.Write(backslashR) + case '\t': + _, err = w.w.Write(backslashT) + case '"': + _, err = w.w.Write(backslashDQ) + case '\\': + _, err = w.w.Write(backslashBS) + default: + if isprint(c) { + err = w.w.WriteByte(c) + } else { + _, err = fmt.Fprintf(w.w, "\\%03o", c) + } + } + if err != nil { + return err + } + } + return w.WriteByte('"') +} + +func writeUnknownStruct(w *textWriter, data []byte) (err error) { + if !w.compact { + if _, err := fmt.Fprintf(w, "/* %d unknown bytes */\n", len(data)); err != nil { + return err + } + } + b := NewBuffer(data) + for b.index < len(b.buf) { + x, err := b.DecodeVarint() + if err != nil { + _, ferr := fmt.Fprintf(w, "/* %v */\n", err) + return ferr + } + wire, tag := x&7, x>>3 + if wire == WireEndGroup { + w.unindent() + if _, werr := w.Write(endBraceNewline); werr != nil { + return werr + } + continue + } + if _, ferr := fmt.Fprint(w, tag); ferr != nil { + return ferr + } + if wire != WireStartGroup { + if err = w.WriteByte(':'); err != nil { + return err + } + } + if !w.compact || wire == WireStartGroup { + if err = w.WriteByte(' '); err != nil { + return err + } + } + switch wire { + case WireBytes: + buf, e := b.DecodeRawBytes(false) + if e == nil { + _, err = fmt.Fprintf(w, "%q", buf) + } else { + _, err = fmt.Fprintf(w, "/* %v */", e) + } + case WireFixed32: + x, err = b.DecodeFixed32() + err = writeUnknownInt(w, x, err) + case WireFixed64: + x, err = b.DecodeFixed64() + err = writeUnknownInt(w, x, err) + case WireStartGroup: + err = w.WriteByte('{') + w.indent() + case WireVarint: + x, err = b.DecodeVarint() + err = writeUnknownInt(w, x, err) + default: + _, err = fmt.Fprintf(w, "/* unknown wire type %d */", wire) + } + if err != nil { + return err + } + if err := w.WriteByte('\n'); err != nil { + return err + } + } + return nil +} + +func writeUnknownInt(w *textWriter, x uint64, err error) error { + if err == nil { + _, err = fmt.Fprint(w, x) + } else { + _, err = fmt.Fprintf(w, "/* %v */", err) + } + return err +} + +type int32Slice []int32 + +func (s int32Slice) Len() int { return len(s) } +func (s int32Slice) Less(i, j int) bool { return s[i] < s[j] } +func (s int32Slice) Swap(i, j int) { s[i], s[j] = s[j], s[i] } + +// writeExtensions writes all the extensions in pv. +// pv is assumed to be a pointer to a protocol message struct that is extendable. +func (tm *TextMarshaler) writeExtensions(w *textWriter, pv reflect.Value) error { + emap := extensionMaps[pv.Type().Elem()] + e := pv.Interface().(Message) + + var m map[int32]Extension + var mu sync.Locker + if em, ok := e.(extensionsBytes); ok { + eb := em.GetExtensions() + var err error + m, err = BytesToExtensionsMap(*eb) + if err != nil { + return err + } + mu = notLocker{} + } else if _, ok := e.(extendableProto); ok { + ep, _ := extendable(e) + m, mu = ep.extensionsRead() + if m == nil { + return nil + } + } + + // Order the extensions by ID. + // This isn't strictly necessary, but it will give us + // canonical output, which will also make testing easier. + + mu.Lock() + ids := make([]int32, 0, len(m)) + for id := range m { + ids = append(ids, id) + } + sort.Sort(int32Slice(ids)) + mu.Unlock() + + for _, extNum := range ids { + ext := m[extNum] + var desc *ExtensionDesc + if emap != nil { + desc = emap[extNum] + } + if desc == nil { + // Unknown extension. + if err := writeUnknownStruct(w, ext.enc); err != nil { + return err + } + continue + } + + pb, err := GetExtension(e, desc) + if err != nil { + return fmt.Errorf("failed getting extension: %v", err) + } + + // Repeated extensions will appear as a slice. + if !desc.repeated() { + if err := tm.writeExtension(w, desc.Name, pb); err != nil { + return err + } + } else { + v := reflect.ValueOf(pb) + for i := 0; i < v.Len(); i++ { + if err := tm.writeExtension(w, desc.Name, v.Index(i).Interface()); err != nil { + return err + } + } + } + } + return nil +} + +func (tm *TextMarshaler) writeExtension(w *textWriter, name string, pb interface{}) error { + if _, err := fmt.Fprintf(w, "[%s]:", name); err != nil { + return err + } + if !w.compact { + if err := w.WriteByte(' '); err != nil { + return err + } + } + if err := tm.writeAny(w, reflect.ValueOf(pb), nil); err != nil { + return err + } + if err := w.WriteByte('\n'); err != nil { + return err + } + return nil +} + +func (w *textWriter) writeIndent() { + if !w.complete { + return + } + remain := w.ind * 2 + for remain > 0 { + n := remain + if n > len(spaces) { + n = len(spaces) + } + w.w.Write(spaces[:n]) + remain -= n + } + w.complete = false +} + +// TextMarshaler is a configurable text format marshaler. +type TextMarshaler struct { + Compact bool // use compact text format (one line). + ExpandAny bool // expand google.protobuf.Any messages of known types +} + +// Marshal writes a given protocol buffer in text format. +// The only errors returned are from w. +func (tm *TextMarshaler) Marshal(w io.Writer, pb Message) error { + val := reflect.ValueOf(pb) + if pb == nil || val.IsNil() { + w.Write([]byte("")) + return nil + } + var bw *bufio.Writer + ww, ok := w.(writer) + if !ok { + bw = bufio.NewWriter(w) + ww = bw + } + aw := &textWriter{ + w: ww, + complete: true, + compact: tm.Compact, + } + + if etm, ok := pb.(encoding.TextMarshaler); ok { + text, err := etm.MarshalText() + if err != nil { + return err + } + if _, err = aw.Write(text); err != nil { + return err + } + if bw != nil { + return bw.Flush() + } + return nil + } + // Dereference the received pointer so we don't have outer < and >. + v := reflect.Indirect(val) + if err := tm.writeStruct(aw, v); err != nil { + return err + } + if bw != nil { + return bw.Flush() + } + return nil +} + +// Text is the same as Marshal, but returns the string directly. +func (tm *TextMarshaler) Text(pb Message) string { + var buf bytes.Buffer + tm.Marshal(&buf, pb) + return buf.String() +} + +var ( + defaultTextMarshaler = TextMarshaler{} + compactTextMarshaler = TextMarshaler{Compact: true} +) + +// TODO: consider removing some of the Marshal functions below. + +// MarshalText writes a given protocol buffer in text format. +// The only errors returned are from w. +func MarshalText(w io.Writer, pb Message) error { return defaultTextMarshaler.Marshal(w, pb) } + +// MarshalTextString is the same as MarshalText, but returns the string directly. +func MarshalTextString(pb Message) string { return defaultTextMarshaler.Text(pb) } + +// CompactText writes a given protocol buffer in compact text format (one line). +func CompactText(w io.Writer, pb Message) error { return compactTextMarshaler.Marshal(w, pb) } + +// CompactTextString is the same as CompactText, but returns the string directly. +func CompactTextString(pb Message) string { return compactTextMarshaler.Text(pb) } diff --git a/vendor/github.com/gogo/protobuf/proto/text_gogo.go b/vendor/github.com/gogo/protobuf/proto/text_gogo.go new file mode 100644 index 000000000000..1d6c6aa0e41b --- /dev/null +++ b/vendor/github.com/gogo/protobuf/proto/text_gogo.go @@ -0,0 +1,57 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2013, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +package proto + +import ( + "fmt" + "reflect" +) + +func (tm *TextMarshaler) writeEnum(w *textWriter, v reflect.Value, props *Properties) error { + m, ok := enumStringMaps[props.Enum] + if !ok { + if err := tm.writeAny(w, v, props); err != nil { + return err + } + } + key := int32(0) + if v.Kind() == reflect.Ptr { + key = int32(v.Elem().Int()) + } else { + key = int32(v.Int()) + } + s, ok := m[key] + if !ok { + if err := tm.writeAny(w, v, props); err != nil { + return err + } + } + _, err := fmt.Fprint(w, s) + return err +} diff --git a/vendor/github.com/gogo/protobuf/proto/text_parser.go b/vendor/github.com/gogo/protobuf/proto/text_parser.go new file mode 100644 index 000000000000..fbb000d3742a --- /dev/null +++ b/vendor/github.com/gogo/protobuf/proto/text_parser.go @@ -0,0 +1,998 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2013, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// Go support for Protocol Buffers - Google's data interchange format +// +// Copyright 2010 The Go Authors. All rights reserved. +// https://github.com/golang/protobuf +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +package proto + +// Functions for parsing the Text protocol buffer format. +// TODO: message sets. + +import ( + "encoding" + "errors" + "fmt" + "reflect" + "strconv" + "strings" + "time" + "unicode/utf8" +) + +// Error string emitted when deserializing Any and fields are already set +const anyRepeatedlyUnpacked = "Any message unpacked multiple times, or %q already set" + +type ParseError struct { + Message string + Line int // 1-based line number + Offset int // 0-based byte offset from start of input +} + +func (p *ParseError) Error() string { + if p.Line == 1 { + // show offset only for first line + return fmt.Sprintf("line 1.%d: %v", p.Offset, p.Message) + } + return fmt.Sprintf("line %d: %v", p.Line, p.Message) +} + +type token struct { + value string + err *ParseError + line int // line number + offset int // byte number from start of input, not start of line + unquoted string // the unquoted version of value, if it was a quoted string +} + +func (t *token) String() string { + if t.err == nil { + return fmt.Sprintf("%q (line=%d, offset=%d)", t.value, t.line, t.offset) + } + return fmt.Sprintf("parse error: %v", t.err) +} + +type textParser struct { + s string // remaining input + done bool // whether the parsing is finished (success or error) + backed bool // whether back() was called + offset, line int + cur token +} + +func newTextParser(s string) *textParser { + p := new(textParser) + p.s = s + p.line = 1 + p.cur.line = 1 + return p +} + +func (p *textParser) errorf(format string, a ...interface{}) *ParseError { + pe := &ParseError{fmt.Sprintf(format, a...), p.cur.line, p.cur.offset} + p.cur.err = pe + p.done = true + return pe +} + +// Numbers and identifiers are matched by [-+._A-Za-z0-9] +func isIdentOrNumberChar(c byte) bool { + switch { + case 'A' <= c && c <= 'Z', 'a' <= c && c <= 'z': + return true + case '0' <= c && c <= '9': + return true + } + switch c { + case '-', '+', '.', '_': + return true + } + return false +} + +func isWhitespace(c byte) bool { + switch c { + case ' ', '\t', '\n', '\r': + return true + } + return false +} + +func isQuote(c byte) bool { + switch c { + case '"', '\'': + return true + } + return false +} + +func (p *textParser) skipWhitespace() { + i := 0 + for i < len(p.s) && (isWhitespace(p.s[i]) || p.s[i] == '#') { + if p.s[i] == '#' { + // comment; skip to end of line or input + for i < len(p.s) && p.s[i] != '\n' { + i++ + } + if i == len(p.s) { + break + } + } + if p.s[i] == '\n' { + p.line++ + } + i++ + } + p.offset += i + p.s = p.s[i:len(p.s)] + if len(p.s) == 0 { + p.done = true + } +} + +func (p *textParser) advance() { + // Skip whitespace + p.skipWhitespace() + if p.done { + return + } + + // Start of non-whitespace + p.cur.err = nil + p.cur.offset, p.cur.line = p.offset, p.line + p.cur.unquoted = "" + switch p.s[0] { + case '<', '>', '{', '}', ':', '[', ']', ';', ',', '/': + // Single symbol + p.cur.value, p.s = p.s[0:1], p.s[1:len(p.s)] + case '"', '\'': + // Quoted string + i := 1 + for i < len(p.s) && p.s[i] != p.s[0] && p.s[i] != '\n' { + if p.s[i] == '\\' && i+1 < len(p.s) { + // skip escaped char + i++ + } + i++ + } + if i >= len(p.s) || p.s[i] != p.s[0] { + p.errorf("unmatched quote") + return + } + unq, err := unquoteC(p.s[1:i], rune(p.s[0])) + if err != nil { + p.errorf("invalid quoted string %s: %v", p.s[0:i+1], err) + return + } + p.cur.value, p.s = p.s[0:i+1], p.s[i+1:len(p.s)] + p.cur.unquoted = unq + default: + i := 0 + for i < len(p.s) && isIdentOrNumberChar(p.s[i]) { + i++ + } + if i == 0 { + p.errorf("unexpected byte %#x", p.s[0]) + return + } + p.cur.value, p.s = p.s[0:i], p.s[i:len(p.s)] + } + p.offset += len(p.cur.value) +} + +var ( + errBadUTF8 = errors.New("proto: bad UTF-8") +) + +func unquoteC(s string, quote rune) (string, error) { + // This is based on C++'s tokenizer.cc. + // Despite its name, this is *not* parsing C syntax. + // For instance, "\0" is an invalid quoted string. + + // Avoid allocation in trivial cases. + simple := true + for _, r := range s { + if r == '\\' || r == quote { + simple = false + break + } + } + if simple { + return s, nil + } + + buf := make([]byte, 0, 3*len(s)/2) + for len(s) > 0 { + r, n := utf8.DecodeRuneInString(s) + if r == utf8.RuneError && n == 1 { + return "", errBadUTF8 + } + s = s[n:] + if r != '\\' { + if r < utf8.RuneSelf { + buf = append(buf, byte(r)) + } else { + buf = append(buf, string(r)...) + } + continue + } + + ch, tail, err := unescape(s) + if err != nil { + return "", err + } + buf = append(buf, ch...) + s = tail + } + return string(buf), nil +} + +func unescape(s string) (ch string, tail string, err error) { + r, n := utf8.DecodeRuneInString(s) + if r == utf8.RuneError && n == 1 { + return "", "", errBadUTF8 + } + s = s[n:] + switch r { + case 'a': + return "\a", s, nil + case 'b': + return "\b", s, nil + case 'f': + return "\f", s, nil + case 'n': + return "\n", s, nil + case 'r': + return "\r", s, nil + case 't': + return "\t", s, nil + case 'v': + return "\v", s, nil + case '?': + return "?", s, nil // trigraph workaround + case '\'', '"', '\\': + return string(r), s, nil + case '0', '1', '2', '3', '4', '5', '6', '7': + if len(s) < 2 { + return "", "", fmt.Errorf(`\%c requires 2 following digits`, r) + } + ss := string(r) + s[:2] + s = s[2:] + i, err := strconv.ParseUint(ss, 8, 8) + if err != nil { + return "", "", fmt.Errorf(`\%s contains non-octal digits`, ss) + } + return string([]byte{byte(i)}), s, nil + case 'x', 'X', 'u', 'U': + var n int + switch r { + case 'x', 'X': + n = 2 + case 'u': + n = 4 + case 'U': + n = 8 + } + if len(s) < n { + return "", "", fmt.Errorf(`\%c requires %d following digits`, r, n) + } + ss := s[:n] + s = s[n:] + i, err := strconv.ParseUint(ss, 16, 64) + if err != nil { + return "", "", fmt.Errorf(`\%c%s contains non-hexadecimal digits`, r, ss) + } + if r == 'x' || r == 'X' { + return string([]byte{byte(i)}), s, nil + } + if i > utf8.MaxRune { + return "", "", fmt.Errorf(`\%c%s is not a valid Unicode code point`, r, ss) + } + return string(i), s, nil + } + return "", "", fmt.Errorf(`unknown escape \%c`, r) +} + +// Back off the parser by one token. Can only be done between calls to next(). +// It makes the next advance() a no-op. +func (p *textParser) back() { p.backed = true } + +// Advances the parser and returns the new current token. +func (p *textParser) next() *token { + if p.backed || p.done { + p.backed = false + return &p.cur + } + p.advance() + if p.done { + p.cur.value = "" + } else if len(p.cur.value) > 0 && isQuote(p.cur.value[0]) { + // Look for multiple quoted strings separated by whitespace, + // and concatenate them. + cat := p.cur + for { + p.skipWhitespace() + if p.done || !isQuote(p.s[0]) { + break + } + p.advance() + if p.cur.err != nil { + return &p.cur + } + cat.value += " " + p.cur.value + cat.unquoted += p.cur.unquoted + } + p.done = false // parser may have seen EOF, but we want to return cat + p.cur = cat + } + return &p.cur +} + +func (p *textParser) consumeToken(s string) error { + tok := p.next() + if tok.err != nil { + return tok.err + } + if tok.value != s { + p.back() + return p.errorf("expected %q, found %q", s, tok.value) + } + return nil +} + +// Return a RequiredNotSetError indicating which required field was not set. +func (p *textParser) missingRequiredFieldError(sv reflect.Value) *RequiredNotSetError { + st := sv.Type() + sprops := GetProperties(st) + for i := 0; i < st.NumField(); i++ { + if !isNil(sv.Field(i)) { + continue + } + + props := sprops.Prop[i] + if props.Required { + return &RequiredNotSetError{fmt.Sprintf("%v.%v", st, props.OrigName)} + } + } + return &RequiredNotSetError{fmt.Sprintf("%v.", st)} // should not happen +} + +// Returns the index in the struct for the named field, as well as the parsed tag properties. +func structFieldByName(sprops *StructProperties, name string) (int, *Properties, bool) { + i, ok := sprops.decoderOrigNames[name] + if ok { + return i, sprops.Prop[i], true + } + return -1, nil, false +} + +// Consume a ':' from the input stream (if the next token is a colon), +// returning an error if a colon is needed but not present. +func (p *textParser) checkForColon(props *Properties, typ reflect.Type) *ParseError { + tok := p.next() + if tok.err != nil { + return tok.err + } + if tok.value != ":" { + // Colon is optional when the field is a group or message. + needColon := true + switch props.Wire { + case "group": + needColon = false + case "bytes": + // A "bytes" field is either a message, a string, or a repeated field; + // those three become *T, *string and []T respectively, so we can check for + // this field being a pointer to a non-string. + if typ.Kind() == reflect.Ptr { + // *T or *string + if typ.Elem().Kind() == reflect.String { + break + } + } else if typ.Kind() == reflect.Slice { + // []T or []*T + if typ.Elem().Kind() != reflect.Ptr { + break + } + } else if typ.Kind() == reflect.String { + // The proto3 exception is for a string field, + // which requires a colon. + break + } + needColon = false + } + if needColon { + return p.errorf("expected ':', found %q", tok.value) + } + p.back() + } + return nil +} + +func (p *textParser) readStruct(sv reflect.Value, terminator string) error { + st := sv.Type() + sprops := GetProperties(st) + reqCount := sprops.reqCount + var reqFieldErr error + fieldSet := make(map[string]bool) + // A struct is a sequence of "name: value", terminated by one of + // '>' or '}', or the end of the input. A name may also be + // "[extension]" or "[type/url]". + // + // The whole struct can also be an expanded Any message, like: + // [type/url] < ... struct contents ... > + for { + tok := p.next() + if tok.err != nil { + return tok.err + } + if tok.value == terminator { + break + } + if tok.value == "[" { + // Looks like an extension or an Any. + // + // TODO: Check whether we need to handle + // namespace rooted names (e.g. ".something.Foo"). + extName, err := p.consumeExtName() + if err != nil { + return err + } + + if s := strings.LastIndex(extName, "/"); s >= 0 { + // If it contains a slash, it's an Any type URL. + messageName := extName[s+1:] + mt := MessageType(messageName) + if mt == nil { + return p.errorf("unrecognized message %q in google.protobuf.Any", messageName) + } + tok = p.next() + if tok.err != nil { + return tok.err + } + // consume an optional colon + if tok.value == ":" { + tok = p.next() + if tok.err != nil { + return tok.err + } + } + var terminator string + switch tok.value { + case "<": + terminator = ">" + case "{": + terminator = "}" + default: + return p.errorf("expected '{' or '<', found %q", tok.value) + } + v := reflect.New(mt.Elem()) + if pe := p.readStruct(v.Elem(), terminator); pe != nil { + return pe + } + b, err := Marshal(v.Interface().(Message)) + if err != nil { + return p.errorf("failed to marshal message of type %q: %v", messageName, err) + } + if fieldSet["type_url"] { + return p.errorf(anyRepeatedlyUnpacked, "type_url") + } + if fieldSet["value"] { + return p.errorf(anyRepeatedlyUnpacked, "value") + } + sv.FieldByName("TypeUrl").SetString(extName) + sv.FieldByName("Value").SetBytes(b) + fieldSet["type_url"] = true + fieldSet["value"] = true + continue + } + + var desc *ExtensionDesc + // This could be faster, but it's functional. + // TODO: Do something smarter than a linear scan. + for _, d := range RegisteredExtensions(reflect.New(st).Interface().(Message)) { + if d.Name == extName { + desc = d + break + } + } + if desc == nil { + return p.errorf("unrecognized extension %q", extName) + } + + props := &Properties{} + props.Parse(desc.Tag) + + typ := reflect.TypeOf(desc.ExtensionType) + if err := p.checkForColon(props, typ); err != nil { + return err + } + + rep := desc.repeated() + + // Read the extension structure, and set it in + // the value we're constructing. + var ext reflect.Value + if !rep { + ext = reflect.New(typ).Elem() + } else { + ext = reflect.New(typ.Elem()).Elem() + } + if err := p.readAny(ext, props); err != nil { + if _, ok := err.(*RequiredNotSetError); !ok { + return err + } + reqFieldErr = err + } + ep := sv.Addr().Interface().(Message) + if !rep { + SetExtension(ep, desc, ext.Interface()) + } else { + old, err := GetExtension(ep, desc) + var sl reflect.Value + if err == nil { + sl = reflect.ValueOf(old) // existing slice + } else { + sl = reflect.MakeSlice(typ, 0, 1) + } + sl = reflect.Append(sl, ext) + SetExtension(ep, desc, sl.Interface()) + } + if err := p.consumeOptionalSeparator(); err != nil { + return err + } + continue + } + + // This is a normal, non-extension field. + name := tok.value + var dst reflect.Value + fi, props, ok := structFieldByName(sprops, name) + if ok { + dst = sv.Field(fi) + } else if oop, ok := sprops.OneofTypes[name]; ok { + // It is a oneof. + props = oop.Prop + nv := reflect.New(oop.Type.Elem()) + dst = nv.Elem().Field(0) + field := sv.Field(oop.Field) + if !field.IsNil() { + return p.errorf("field '%s' would overwrite already parsed oneof '%s'", name, sv.Type().Field(oop.Field).Name) + } + field.Set(nv) + } + if !dst.IsValid() { + return p.errorf("unknown field name %q in %v", name, st) + } + + if dst.Kind() == reflect.Map { + // Consume any colon. + if err := p.checkForColon(props, dst.Type()); err != nil { + return err + } + + // Construct the map if it doesn't already exist. + if dst.IsNil() { + dst.Set(reflect.MakeMap(dst.Type())) + } + key := reflect.New(dst.Type().Key()).Elem() + val := reflect.New(dst.Type().Elem()).Elem() + + // The map entry should be this sequence of tokens: + // < key : KEY value : VALUE > + // However, implementations may omit key or value, and technically + // we should support them in any order. See b/28924776 for a time + // this went wrong. + + tok := p.next() + var terminator string + switch tok.value { + case "<": + terminator = ">" + case "{": + terminator = "}" + default: + return p.errorf("expected '{' or '<', found %q", tok.value) + } + for { + tok := p.next() + if tok.err != nil { + return tok.err + } + if tok.value == terminator { + break + } + switch tok.value { + case "key": + if err := p.consumeToken(":"); err != nil { + return err + } + if err := p.readAny(key, props.mkeyprop); err != nil { + return err + } + if err := p.consumeOptionalSeparator(); err != nil { + return err + } + case "value": + if err := p.checkForColon(props.mvalprop, dst.Type().Elem()); err != nil { + return err + } + if err := p.readAny(val, props.mvalprop); err != nil { + return err + } + if err := p.consumeOptionalSeparator(); err != nil { + return err + } + default: + p.back() + return p.errorf(`expected "key", "value", or %q, found %q`, terminator, tok.value) + } + } + + dst.SetMapIndex(key, val) + continue + } + + // Check that it's not already set if it's not a repeated field. + if !props.Repeated && fieldSet[name] { + return p.errorf("non-repeated field %q was repeated", name) + } + + if err := p.checkForColon(props, dst.Type()); err != nil { + return err + } + + // Parse into the field. + fieldSet[name] = true + if err := p.readAny(dst, props); err != nil { + if _, ok := err.(*RequiredNotSetError); !ok { + return err + } + reqFieldErr = err + } + if props.Required { + reqCount-- + } + + if err := p.consumeOptionalSeparator(); err != nil { + return err + } + + } + + if reqCount > 0 { + return p.missingRequiredFieldError(sv) + } + return reqFieldErr +} + +// consumeExtName consumes extension name or expanded Any type URL and the +// following ']'. It returns the name or URL consumed. +func (p *textParser) consumeExtName() (string, error) { + tok := p.next() + if tok.err != nil { + return "", tok.err + } + + // If extension name or type url is quoted, it's a single token. + if len(tok.value) > 2 && isQuote(tok.value[0]) && tok.value[len(tok.value)-1] == tok.value[0] { + name, err := unquoteC(tok.value[1:len(tok.value)-1], rune(tok.value[0])) + if err != nil { + return "", err + } + return name, p.consumeToken("]") + } + + // Consume everything up to "]" + var parts []string + for tok.value != "]" { + parts = append(parts, tok.value) + tok = p.next() + if tok.err != nil { + return "", p.errorf("unrecognized type_url or extension name: %s", tok.err) + } + if p.done && tok.value != "]" { + return "", p.errorf("unclosed type_url or extension name") + } + } + return strings.Join(parts, ""), nil +} + +// consumeOptionalSeparator consumes an optional semicolon or comma. +// It is used in readStruct to provide backward compatibility. +func (p *textParser) consumeOptionalSeparator() error { + tok := p.next() + if tok.err != nil { + return tok.err + } + if tok.value != ";" && tok.value != "," { + p.back() + } + return nil +} + +func (p *textParser) readAny(v reflect.Value, props *Properties) error { + tok := p.next() + if tok.err != nil { + return tok.err + } + if tok.value == "" { + return p.errorf("unexpected EOF") + } + if len(props.CustomType) > 0 { + if props.Repeated { + t := reflect.TypeOf(v.Interface()) + if t.Kind() == reflect.Slice { + tc := reflect.TypeOf(new(Marshaler)) + ok := t.Elem().Implements(tc.Elem()) + if ok { + fv := v + flen := fv.Len() + if flen == fv.Cap() { + nav := reflect.MakeSlice(v.Type(), flen, 2*flen+1) + reflect.Copy(nav, fv) + fv.Set(nav) + } + fv.SetLen(flen + 1) + + // Read one. + p.back() + return p.readAny(fv.Index(flen), props) + } + } + } + if reflect.TypeOf(v.Interface()).Kind() == reflect.Ptr { + custom := reflect.New(props.ctype.Elem()).Interface().(Unmarshaler) + err := custom.Unmarshal([]byte(tok.unquoted)) + if err != nil { + return p.errorf("%v %v: %v", err, v.Type(), tok.value) + } + v.Set(reflect.ValueOf(custom)) + } else { + custom := reflect.New(reflect.TypeOf(v.Interface())).Interface().(Unmarshaler) + err := custom.Unmarshal([]byte(tok.unquoted)) + if err != nil { + return p.errorf("%v %v: %v", err, v.Type(), tok.value) + } + v.Set(reflect.Indirect(reflect.ValueOf(custom))) + } + return nil + } + if props.StdTime { + fv := v + p.back() + props.StdTime = false + tproto := ×tamp{} + err := p.readAny(reflect.ValueOf(tproto).Elem(), props) + props.StdTime = true + if err != nil { + return err + } + tim, err := timestampFromProto(tproto) + if err != nil { + return err + } + if props.Repeated { + t := reflect.TypeOf(v.Interface()) + if t.Kind() == reflect.Slice { + if t.Elem().Kind() == reflect.Ptr { + ts := fv.Interface().([]*time.Time) + ts = append(ts, &tim) + fv.Set(reflect.ValueOf(ts)) + return nil + } else { + ts := fv.Interface().([]time.Time) + ts = append(ts, tim) + fv.Set(reflect.ValueOf(ts)) + return nil + } + } + } + if reflect.TypeOf(v.Interface()).Kind() == reflect.Ptr { + v.Set(reflect.ValueOf(&tim)) + } else { + v.Set(reflect.Indirect(reflect.ValueOf(&tim))) + } + return nil + } + if props.StdDuration { + fv := v + p.back() + props.StdDuration = false + dproto := &duration{} + err := p.readAny(reflect.ValueOf(dproto).Elem(), props) + props.StdDuration = true + if err != nil { + return err + } + dur, err := durationFromProto(dproto) + if err != nil { + return err + } + if props.Repeated { + t := reflect.TypeOf(v.Interface()) + if t.Kind() == reflect.Slice { + if t.Elem().Kind() == reflect.Ptr { + ds := fv.Interface().([]*time.Duration) + ds = append(ds, &dur) + fv.Set(reflect.ValueOf(ds)) + return nil + } else { + ds := fv.Interface().([]time.Duration) + ds = append(ds, dur) + fv.Set(reflect.ValueOf(ds)) + return nil + } + } + } + if reflect.TypeOf(v.Interface()).Kind() == reflect.Ptr { + v.Set(reflect.ValueOf(&dur)) + } else { + v.Set(reflect.Indirect(reflect.ValueOf(&dur))) + } + return nil + } + switch fv := v; fv.Kind() { + case reflect.Slice: + at := v.Type() + if at.Elem().Kind() == reflect.Uint8 { + // Special case for []byte + if tok.value[0] != '"' && tok.value[0] != '\'' { + // Deliberately written out here, as the error after + // this switch statement would write "invalid []byte: ...", + // which is not as user-friendly. + return p.errorf("invalid string: %v", tok.value) + } + bytes := []byte(tok.unquoted) + fv.Set(reflect.ValueOf(bytes)) + return nil + } + // Repeated field. + if tok.value == "[" { + // Repeated field with list notation, like [1,2,3]. + for { + fv.Set(reflect.Append(fv, reflect.New(at.Elem()).Elem())) + err := p.readAny(fv.Index(fv.Len()-1), props) + if err != nil { + return err + } + ntok := p.next() + if ntok.err != nil { + return ntok.err + } + if ntok.value == "]" { + break + } + if ntok.value != "," { + return p.errorf("Expected ']' or ',' found %q", ntok.value) + } + } + return nil + } + // One value of the repeated field. + p.back() + fv.Set(reflect.Append(fv, reflect.New(at.Elem()).Elem())) + return p.readAny(fv.Index(fv.Len()-1), props) + case reflect.Bool: + // true/1/t/True or false/f/0/False. + switch tok.value { + case "true", "1", "t", "True": + fv.SetBool(true) + return nil + case "false", "0", "f", "False": + fv.SetBool(false) + return nil + } + case reflect.Float32, reflect.Float64: + v := tok.value + // Ignore 'f' for compatibility with output generated by C++, but don't + // remove 'f' when the value is "-inf" or "inf". + if strings.HasSuffix(v, "f") && tok.value != "-inf" && tok.value != "inf" { + v = v[:len(v)-1] + } + if f, err := strconv.ParseFloat(v, fv.Type().Bits()); err == nil { + fv.SetFloat(f) + return nil + } + case reflect.Int32: + if x, err := strconv.ParseInt(tok.value, 0, 32); err == nil { + fv.SetInt(x) + return nil + } + + if len(props.Enum) == 0 { + break + } + m, ok := enumValueMaps[props.Enum] + if !ok { + break + } + x, ok := m[tok.value] + if !ok { + break + } + fv.SetInt(int64(x)) + return nil + case reflect.Int64: + if x, err := strconv.ParseInt(tok.value, 0, 64); err == nil { + fv.SetInt(x) + return nil + } + + case reflect.Ptr: + // A basic field (indirected through pointer), or a repeated message/group + p.back() + fv.Set(reflect.New(fv.Type().Elem())) + return p.readAny(fv.Elem(), props) + case reflect.String: + if tok.value[0] == '"' || tok.value[0] == '\'' { + fv.SetString(tok.unquoted) + return nil + } + case reflect.Struct: + var terminator string + switch tok.value { + case "{": + terminator = "}" + case "<": + terminator = ">" + default: + return p.errorf("expected '{' or '<', found %q", tok.value) + } + // TODO: Handle nested messages which implement encoding.TextUnmarshaler. + return p.readStruct(fv, terminator) + case reflect.Uint32: + if x, err := strconv.ParseUint(tok.value, 0, 32); err == nil { + fv.SetUint(uint64(x)) + return nil + } + case reflect.Uint64: + if x, err := strconv.ParseUint(tok.value, 0, 64); err == nil { + fv.SetUint(x) + return nil + } + } + return p.errorf("invalid %v: %v", v.Type(), tok.value) +} + +// UnmarshalText reads a protocol buffer in Text format. UnmarshalText resets pb +// before starting to unmarshal, so any existing data in pb is always removed. +// If a required field is not set and no other error occurs, +// UnmarshalText returns *RequiredNotSetError. +func UnmarshalText(s string, pb Message) error { + if um, ok := pb.(encoding.TextUnmarshaler); ok { + return um.UnmarshalText([]byte(s)) + } + pb.Reset() + v := reflect.ValueOf(pb) + return newTextParser(s).readStruct(v.Elem(), "") +} diff --git a/vendor/github.com/gogo/protobuf/proto/timestamp.go b/vendor/github.com/gogo/protobuf/proto/timestamp.go new file mode 100644 index 000000000000..9324f6542bcf --- /dev/null +++ b/vendor/github.com/gogo/protobuf/proto/timestamp.go @@ -0,0 +1,113 @@ +// Go support for Protocol Buffers - Google's data interchange format +// +// Copyright 2016 The Go Authors. All rights reserved. +// https://github.com/golang/protobuf +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +package proto + +// This file implements operations on google.protobuf.Timestamp. + +import ( + "errors" + "fmt" + "time" +) + +const ( + // Seconds field of the earliest valid Timestamp. + // This is time.Date(1, 1, 1, 0, 0, 0, 0, time.UTC).Unix(). + minValidSeconds = -62135596800 + // Seconds field just after the latest valid Timestamp. + // This is time.Date(10000, 1, 1, 0, 0, 0, 0, time.UTC).Unix(). + maxValidSeconds = 253402300800 +) + +// validateTimestamp determines whether a Timestamp is valid. +// A valid timestamp represents a time in the range +// [0001-01-01, 10000-01-01) and has a Nanos field +// in the range [0, 1e9). +// +// If the Timestamp is valid, validateTimestamp returns nil. +// Otherwise, it returns an error that describes +// the problem. +// +// Every valid Timestamp can be represented by a time.Time, but the converse is not true. +func validateTimestamp(ts *timestamp) error { + if ts == nil { + return errors.New("timestamp: nil Timestamp") + } + if ts.Seconds < minValidSeconds { + return fmt.Errorf("timestamp: %#v before 0001-01-01", ts) + } + if ts.Seconds >= maxValidSeconds { + return fmt.Errorf("timestamp: %#v after 10000-01-01", ts) + } + if ts.Nanos < 0 || ts.Nanos >= 1e9 { + return fmt.Errorf("timestamp: %#v: nanos not in range [0, 1e9)", ts) + } + return nil +} + +// TimestampFromProto converts a google.protobuf.Timestamp proto to a time.Time. +// It returns an error if the argument is invalid. +// +// Unlike most Go functions, if Timestamp returns an error, the first return value +// is not the zero time.Time. Instead, it is the value obtained from the +// time.Unix function when passed the contents of the Timestamp, in the UTC +// locale. This may or may not be a meaningful time; many invalid Timestamps +// do map to valid time.Times. +// +// A nil Timestamp returns an error. The first return value in that case is +// undefined. +func timestampFromProto(ts *timestamp) (time.Time, error) { + // Don't return the zero value on error, because corresponds to a valid + // timestamp. Instead return whatever time.Unix gives us. + var t time.Time + if ts == nil { + t = time.Unix(0, 0).UTC() // treat nil like the empty Timestamp + } else { + t = time.Unix(ts.Seconds, int64(ts.Nanos)).UTC() + } + return t, validateTimestamp(ts) +} + +// TimestampProto converts the time.Time to a google.protobuf.Timestamp proto. +// It returns an error if the resulting Timestamp is invalid. +func timestampProto(t time.Time) (*timestamp, error) { + seconds := t.Unix() + nanos := int32(t.Sub(time.Unix(seconds, 0))) + ts := ×tamp{ + Seconds: seconds, + Nanos: nanos, + } + if err := validateTimestamp(ts); err != nil { + return nil, err + } + return ts, nil +} diff --git a/vendor/github.com/gogo/protobuf/proto/timestamp_gogo.go b/vendor/github.com/gogo/protobuf/proto/timestamp_gogo.go new file mode 100644 index 000000000000..38439fa99013 --- /dev/null +++ b/vendor/github.com/gogo/protobuf/proto/timestamp_gogo.go @@ -0,0 +1,49 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2016, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +package proto + +import ( + "reflect" + "time" +) + +var timeType = reflect.TypeOf((*time.Time)(nil)).Elem() + +type timestamp struct { + Seconds int64 `protobuf:"varint,1,opt,name=seconds,proto3" json:"seconds,omitempty"` + Nanos int32 `protobuf:"varint,2,opt,name=nanos,proto3" json:"nanos,omitempty"` +} + +func (m *timestamp) Reset() { *m = timestamp{} } +func (*timestamp) ProtoMessage() {} +func (*timestamp) String() string { return "timestamp" } + +func init() { + RegisterType((*timestamp)(nil), "gogo.protobuf.proto.timestamp") +} diff --git a/vendor/github.com/gogo/protobuf/protoc-gen-gogo/descriptor/Makefile b/vendor/github.com/gogo/protobuf/protoc-gen-gogo/descriptor/Makefile new file mode 100644 index 000000000000..3496dc99d5a6 --- /dev/null +++ b/vendor/github.com/gogo/protobuf/protoc-gen-gogo/descriptor/Makefile @@ -0,0 +1,36 @@ +# Go support for Protocol Buffers - Google's data interchange format +# +# Copyright 2010 The Go Authors. All rights reserved. +# https://github.com/golang/protobuf +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +regenerate: + go install github.com/gogo/protobuf/protoc-gen-gogo + go install github.com/gogo/protobuf/protoc-gen-gostring + protoc --gogo_out=. -I=../../protobuf/google/protobuf ../../protobuf/google/protobuf/descriptor.proto + protoc --gostring_out=. -I=../../protobuf/google/protobuf ../../protobuf/google/protobuf/descriptor.proto diff --git a/vendor/github.com/gogo/protobuf/protoc-gen-gogo/descriptor/descriptor.go b/vendor/github.com/gogo/protobuf/protoc-gen-gogo/descriptor/descriptor.go new file mode 100644 index 000000000000..a85bf1984c64 --- /dev/null +++ b/vendor/github.com/gogo/protobuf/protoc-gen-gogo/descriptor/descriptor.go @@ -0,0 +1,118 @@ +// Go support for Protocol Buffers - Google's data interchange format +// +// Copyright 2016 The Go Authors. All rights reserved. +// https://github.com/golang/protobuf +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// Package descriptor provides functions for obtaining protocol buffer +// descriptors for generated Go types. +// +// These functions cannot go in package proto because they depend on the +// generated protobuf descriptor messages, which themselves depend on proto. +package descriptor + +import ( + "bytes" + "compress/gzip" + "fmt" + "io/ioutil" + + "github.com/gogo/protobuf/proto" +) + +// extractFile extracts a FileDescriptorProto from a gzip'd buffer. +func extractFile(gz []byte) (*FileDescriptorProto, error) { + r, err := gzip.NewReader(bytes.NewReader(gz)) + if err != nil { + return nil, fmt.Errorf("failed to open gzip reader: %v", err) + } + defer r.Close() + + b, err := ioutil.ReadAll(r) + if err != nil { + return nil, fmt.Errorf("failed to uncompress descriptor: %v", err) + } + + fd := new(FileDescriptorProto) + if err := proto.Unmarshal(b, fd); err != nil { + return nil, fmt.Errorf("malformed FileDescriptorProto: %v", err) + } + + return fd, nil +} + +// Message is a proto.Message with a method to return its descriptor. +// +// Message types generated by the protocol compiler always satisfy +// the Message interface. +type Message interface { + proto.Message + Descriptor() ([]byte, []int) +} + +// ForMessage returns a FileDescriptorProto and a DescriptorProto from within it +// describing the given message. +func ForMessage(msg Message) (fd *FileDescriptorProto, md *DescriptorProto) { + gz, path := msg.Descriptor() + fd, err := extractFile(gz) + if err != nil { + panic(fmt.Sprintf("invalid FileDescriptorProto for %T: %v", msg, err)) + } + + md = fd.MessageType[path[0]] + for _, i := range path[1:] { + md = md.NestedType[i] + } + return fd, md +} + +// Is this field a scalar numeric type? +func (field *FieldDescriptorProto) IsScalar() bool { + if field.Type == nil { + return false + } + switch *field.Type { + case FieldDescriptorProto_TYPE_DOUBLE, + FieldDescriptorProto_TYPE_FLOAT, + FieldDescriptorProto_TYPE_INT64, + FieldDescriptorProto_TYPE_UINT64, + FieldDescriptorProto_TYPE_INT32, + FieldDescriptorProto_TYPE_FIXED64, + FieldDescriptorProto_TYPE_FIXED32, + FieldDescriptorProto_TYPE_BOOL, + FieldDescriptorProto_TYPE_UINT32, + FieldDescriptorProto_TYPE_ENUM, + FieldDescriptorProto_TYPE_SFIXED32, + FieldDescriptorProto_TYPE_SFIXED64, + FieldDescriptorProto_TYPE_SINT32, + FieldDescriptorProto_TYPE_SINT64: + return true + default: + return false + } +} diff --git a/vendor/github.com/gogo/protobuf/protoc-gen-gogo/descriptor/descriptor.pb.go b/vendor/github.com/gogo/protobuf/protoc-gen-gogo/descriptor/descriptor.pb.go new file mode 100644 index 000000000000..44f893b777c4 --- /dev/null +++ b/vendor/github.com/gogo/protobuf/protoc-gen-gogo/descriptor/descriptor.pb.go @@ -0,0 +1,2806 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: descriptor.proto + +package descriptor + +import proto "github.com/gogo/protobuf/proto" +import fmt "fmt" +import math "math" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package + +type FieldDescriptorProto_Type int32 + +const ( + // 0 is reserved for errors. + // Order is weird for historical reasons. + FieldDescriptorProto_TYPE_DOUBLE FieldDescriptorProto_Type = 1 + FieldDescriptorProto_TYPE_FLOAT FieldDescriptorProto_Type = 2 + // Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT64 if + // negative values are likely. + FieldDescriptorProto_TYPE_INT64 FieldDescriptorProto_Type = 3 + FieldDescriptorProto_TYPE_UINT64 FieldDescriptorProto_Type = 4 + // Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT32 if + // negative values are likely. + FieldDescriptorProto_TYPE_INT32 FieldDescriptorProto_Type = 5 + FieldDescriptorProto_TYPE_FIXED64 FieldDescriptorProto_Type = 6 + FieldDescriptorProto_TYPE_FIXED32 FieldDescriptorProto_Type = 7 + FieldDescriptorProto_TYPE_BOOL FieldDescriptorProto_Type = 8 + FieldDescriptorProto_TYPE_STRING FieldDescriptorProto_Type = 9 + // Tag-delimited aggregate. + // Group type is deprecated and not supported in proto3. However, Proto3 + // implementations should still be able to parse the group wire format and + // treat group fields as unknown fields. + FieldDescriptorProto_TYPE_GROUP FieldDescriptorProto_Type = 10 + FieldDescriptorProto_TYPE_MESSAGE FieldDescriptorProto_Type = 11 + // New in version 2. + FieldDescriptorProto_TYPE_BYTES FieldDescriptorProto_Type = 12 + FieldDescriptorProto_TYPE_UINT32 FieldDescriptorProto_Type = 13 + FieldDescriptorProto_TYPE_ENUM FieldDescriptorProto_Type = 14 + FieldDescriptorProto_TYPE_SFIXED32 FieldDescriptorProto_Type = 15 + FieldDescriptorProto_TYPE_SFIXED64 FieldDescriptorProto_Type = 16 + FieldDescriptorProto_TYPE_SINT32 FieldDescriptorProto_Type = 17 + FieldDescriptorProto_TYPE_SINT64 FieldDescriptorProto_Type = 18 +) + +var FieldDescriptorProto_Type_name = map[int32]string{ + 1: "TYPE_DOUBLE", + 2: "TYPE_FLOAT", + 3: "TYPE_INT64", + 4: "TYPE_UINT64", + 5: "TYPE_INT32", + 6: "TYPE_FIXED64", + 7: "TYPE_FIXED32", + 8: "TYPE_BOOL", + 9: "TYPE_STRING", + 10: "TYPE_GROUP", + 11: "TYPE_MESSAGE", + 12: "TYPE_BYTES", + 13: "TYPE_UINT32", + 14: "TYPE_ENUM", + 15: "TYPE_SFIXED32", + 16: "TYPE_SFIXED64", + 17: "TYPE_SINT32", + 18: "TYPE_SINT64", +} +var FieldDescriptorProto_Type_value = map[string]int32{ + "TYPE_DOUBLE": 1, + "TYPE_FLOAT": 2, + "TYPE_INT64": 3, + "TYPE_UINT64": 4, + "TYPE_INT32": 5, + "TYPE_FIXED64": 6, + "TYPE_FIXED32": 7, + "TYPE_BOOL": 8, + "TYPE_STRING": 9, + "TYPE_GROUP": 10, + "TYPE_MESSAGE": 11, + "TYPE_BYTES": 12, + "TYPE_UINT32": 13, + "TYPE_ENUM": 14, + "TYPE_SFIXED32": 15, + "TYPE_SFIXED64": 16, + "TYPE_SINT32": 17, + "TYPE_SINT64": 18, +} + +func (x FieldDescriptorProto_Type) Enum() *FieldDescriptorProto_Type { + p := new(FieldDescriptorProto_Type) + *p = x + return p +} +func (x FieldDescriptorProto_Type) String() string { + return proto.EnumName(FieldDescriptorProto_Type_name, int32(x)) +} +func (x *FieldDescriptorProto_Type) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(FieldDescriptorProto_Type_value, data, "FieldDescriptorProto_Type") + if err != nil { + return err + } + *x = FieldDescriptorProto_Type(value) + return nil +} +func (FieldDescriptorProto_Type) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_descriptor_9588782fb9cbecd6, []int{4, 0} +} + +type FieldDescriptorProto_Label int32 + +const ( + // 0 is reserved for errors + FieldDescriptorProto_LABEL_OPTIONAL FieldDescriptorProto_Label = 1 + FieldDescriptorProto_LABEL_REQUIRED FieldDescriptorProto_Label = 2 + FieldDescriptorProto_LABEL_REPEATED FieldDescriptorProto_Label = 3 +) + +var FieldDescriptorProto_Label_name = map[int32]string{ + 1: "LABEL_OPTIONAL", + 2: "LABEL_REQUIRED", + 3: "LABEL_REPEATED", +} +var FieldDescriptorProto_Label_value = map[string]int32{ + "LABEL_OPTIONAL": 1, + "LABEL_REQUIRED": 2, + "LABEL_REPEATED": 3, +} + +func (x FieldDescriptorProto_Label) Enum() *FieldDescriptorProto_Label { + p := new(FieldDescriptorProto_Label) + *p = x + return p +} +func (x FieldDescriptorProto_Label) String() string { + return proto.EnumName(FieldDescriptorProto_Label_name, int32(x)) +} +func (x *FieldDescriptorProto_Label) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(FieldDescriptorProto_Label_value, data, "FieldDescriptorProto_Label") + if err != nil { + return err + } + *x = FieldDescriptorProto_Label(value) + return nil +} +func (FieldDescriptorProto_Label) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_descriptor_9588782fb9cbecd6, []int{4, 1} +} + +// Generated classes can be optimized for speed or code size. +type FileOptions_OptimizeMode int32 + +const ( + FileOptions_SPEED FileOptions_OptimizeMode = 1 + // etc. + FileOptions_CODE_SIZE FileOptions_OptimizeMode = 2 + FileOptions_LITE_RUNTIME FileOptions_OptimizeMode = 3 +) + +var FileOptions_OptimizeMode_name = map[int32]string{ + 1: "SPEED", + 2: "CODE_SIZE", + 3: "LITE_RUNTIME", +} +var FileOptions_OptimizeMode_value = map[string]int32{ + "SPEED": 1, + "CODE_SIZE": 2, + "LITE_RUNTIME": 3, +} + +func (x FileOptions_OptimizeMode) Enum() *FileOptions_OptimizeMode { + p := new(FileOptions_OptimizeMode) + *p = x + return p +} +func (x FileOptions_OptimizeMode) String() string { + return proto.EnumName(FileOptions_OptimizeMode_name, int32(x)) +} +func (x *FileOptions_OptimizeMode) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(FileOptions_OptimizeMode_value, data, "FileOptions_OptimizeMode") + if err != nil { + return err + } + *x = FileOptions_OptimizeMode(value) + return nil +} +func (FileOptions_OptimizeMode) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_descriptor_9588782fb9cbecd6, []int{10, 0} +} + +type FieldOptions_CType int32 + +const ( + // Default mode. + FieldOptions_STRING FieldOptions_CType = 0 + FieldOptions_CORD FieldOptions_CType = 1 + FieldOptions_STRING_PIECE FieldOptions_CType = 2 +) + +var FieldOptions_CType_name = map[int32]string{ + 0: "STRING", + 1: "CORD", + 2: "STRING_PIECE", +} +var FieldOptions_CType_value = map[string]int32{ + "STRING": 0, + "CORD": 1, + "STRING_PIECE": 2, +} + +func (x FieldOptions_CType) Enum() *FieldOptions_CType { + p := new(FieldOptions_CType) + *p = x + return p +} +func (x FieldOptions_CType) String() string { + return proto.EnumName(FieldOptions_CType_name, int32(x)) +} +func (x *FieldOptions_CType) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(FieldOptions_CType_value, data, "FieldOptions_CType") + if err != nil { + return err + } + *x = FieldOptions_CType(value) + return nil +} +func (FieldOptions_CType) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_descriptor_9588782fb9cbecd6, []int{12, 0} +} + +type FieldOptions_JSType int32 + +const ( + // Use the default type. + FieldOptions_JS_NORMAL FieldOptions_JSType = 0 + // Use JavaScript strings. + FieldOptions_JS_STRING FieldOptions_JSType = 1 + // Use JavaScript numbers. + FieldOptions_JS_NUMBER FieldOptions_JSType = 2 +) + +var FieldOptions_JSType_name = map[int32]string{ + 0: "JS_NORMAL", + 1: "JS_STRING", + 2: "JS_NUMBER", +} +var FieldOptions_JSType_value = map[string]int32{ + "JS_NORMAL": 0, + "JS_STRING": 1, + "JS_NUMBER": 2, +} + +func (x FieldOptions_JSType) Enum() *FieldOptions_JSType { + p := new(FieldOptions_JSType) + *p = x + return p +} +func (x FieldOptions_JSType) String() string { + return proto.EnumName(FieldOptions_JSType_name, int32(x)) +} +func (x *FieldOptions_JSType) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(FieldOptions_JSType_value, data, "FieldOptions_JSType") + if err != nil { + return err + } + *x = FieldOptions_JSType(value) + return nil +} +func (FieldOptions_JSType) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_descriptor_9588782fb9cbecd6, []int{12, 1} +} + +// Is this method side-effect-free (or safe in HTTP parlance), or idempotent, +// or neither? HTTP based RPC implementation may choose GET verb for safe +// methods, and PUT verb for idempotent methods instead of the default POST. +type MethodOptions_IdempotencyLevel int32 + +const ( + MethodOptions_IDEMPOTENCY_UNKNOWN MethodOptions_IdempotencyLevel = 0 + MethodOptions_NO_SIDE_EFFECTS MethodOptions_IdempotencyLevel = 1 + MethodOptions_IDEMPOTENT MethodOptions_IdempotencyLevel = 2 +) + +var MethodOptions_IdempotencyLevel_name = map[int32]string{ + 0: "IDEMPOTENCY_UNKNOWN", + 1: "NO_SIDE_EFFECTS", + 2: "IDEMPOTENT", +} +var MethodOptions_IdempotencyLevel_value = map[string]int32{ + "IDEMPOTENCY_UNKNOWN": 0, + "NO_SIDE_EFFECTS": 1, + "IDEMPOTENT": 2, +} + +func (x MethodOptions_IdempotencyLevel) Enum() *MethodOptions_IdempotencyLevel { + p := new(MethodOptions_IdempotencyLevel) + *p = x + return p +} +func (x MethodOptions_IdempotencyLevel) String() string { + return proto.EnumName(MethodOptions_IdempotencyLevel_name, int32(x)) +} +func (x *MethodOptions_IdempotencyLevel) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(MethodOptions_IdempotencyLevel_value, data, "MethodOptions_IdempotencyLevel") + if err != nil { + return err + } + *x = MethodOptions_IdempotencyLevel(value) + return nil +} +func (MethodOptions_IdempotencyLevel) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_descriptor_9588782fb9cbecd6, []int{17, 0} +} + +// The protocol compiler can output a FileDescriptorSet containing the .proto +// files it parses. +type FileDescriptorSet struct { + File []*FileDescriptorProto `protobuf:"bytes,1,rep,name=file" json:"file,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *FileDescriptorSet) Reset() { *m = FileDescriptorSet{} } +func (m *FileDescriptorSet) String() string { return proto.CompactTextString(m) } +func (*FileDescriptorSet) ProtoMessage() {} +func (*FileDescriptorSet) Descriptor() ([]byte, []int) { + return fileDescriptor_descriptor_9588782fb9cbecd6, []int{0} +} +func (m *FileDescriptorSet) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_FileDescriptorSet.Unmarshal(m, b) +} +func (m *FileDescriptorSet) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_FileDescriptorSet.Marshal(b, m, deterministic) +} +func (dst *FileDescriptorSet) XXX_Merge(src proto.Message) { + xxx_messageInfo_FileDescriptorSet.Merge(dst, src) +} +func (m *FileDescriptorSet) XXX_Size() int { + return xxx_messageInfo_FileDescriptorSet.Size(m) +} +func (m *FileDescriptorSet) XXX_DiscardUnknown() { + xxx_messageInfo_FileDescriptorSet.DiscardUnknown(m) +} + +var xxx_messageInfo_FileDescriptorSet proto.InternalMessageInfo + +func (m *FileDescriptorSet) GetFile() []*FileDescriptorProto { + if m != nil { + return m.File + } + return nil +} + +// Describes a complete .proto file. +type FileDescriptorProto struct { + Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + Package *string `protobuf:"bytes,2,opt,name=package" json:"package,omitempty"` + // Names of files imported by this file. + Dependency []string `protobuf:"bytes,3,rep,name=dependency" json:"dependency,omitempty"` + // Indexes of the public imported files in the dependency list above. + PublicDependency []int32 `protobuf:"varint,10,rep,name=public_dependency,json=publicDependency" json:"public_dependency,omitempty"` + // Indexes of the weak imported files in the dependency list. + // For Google-internal migration only. Do not use. + WeakDependency []int32 `protobuf:"varint,11,rep,name=weak_dependency,json=weakDependency" json:"weak_dependency,omitempty"` + // All top-level definitions in this file. + MessageType []*DescriptorProto `protobuf:"bytes,4,rep,name=message_type,json=messageType" json:"message_type,omitempty"` + EnumType []*EnumDescriptorProto `protobuf:"bytes,5,rep,name=enum_type,json=enumType" json:"enum_type,omitempty"` + Service []*ServiceDescriptorProto `protobuf:"bytes,6,rep,name=service" json:"service,omitempty"` + Extension []*FieldDescriptorProto `protobuf:"bytes,7,rep,name=extension" json:"extension,omitempty"` + Options *FileOptions `protobuf:"bytes,8,opt,name=options" json:"options,omitempty"` + // This field contains optional information about the original source code. + // You may safely remove this entire field without harming runtime + // functionality of the descriptors -- the information is needed only by + // development tools. + SourceCodeInfo *SourceCodeInfo `protobuf:"bytes,9,opt,name=source_code_info,json=sourceCodeInfo" json:"source_code_info,omitempty"` + // The syntax of the proto file. + // The supported values are "proto2" and "proto3". + Syntax *string `protobuf:"bytes,12,opt,name=syntax" json:"syntax,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *FileDescriptorProto) Reset() { *m = FileDescriptorProto{} } +func (m *FileDescriptorProto) String() string { return proto.CompactTextString(m) } +func (*FileDescriptorProto) ProtoMessage() {} +func (*FileDescriptorProto) Descriptor() ([]byte, []int) { + return fileDescriptor_descriptor_9588782fb9cbecd6, []int{1} +} +func (m *FileDescriptorProto) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_FileDescriptorProto.Unmarshal(m, b) +} +func (m *FileDescriptorProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_FileDescriptorProto.Marshal(b, m, deterministic) +} +func (dst *FileDescriptorProto) XXX_Merge(src proto.Message) { + xxx_messageInfo_FileDescriptorProto.Merge(dst, src) +} +func (m *FileDescriptorProto) XXX_Size() int { + return xxx_messageInfo_FileDescriptorProto.Size(m) +} +func (m *FileDescriptorProto) XXX_DiscardUnknown() { + xxx_messageInfo_FileDescriptorProto.DiscardUnknown(m) +} + +var xxx_messageInfo_FileDescriptorProto proto.InternalMessageInfo + +func (m *FileDescriptorProto) GetName() string { + if m != nil && m.Name != nil { + return *m.Name + } + return "" +} + +func (m *FileDescriptorProto) GetPackage() string { + if m != nil && m.Package != nil { + return *m.Package + } + return "" +} + +func (m *FileDescriptorProto) GetDependency() []string { + if m != nil { + return m.Dependency + } + return nil +} + +func (m *FileDescriptorProto) GetPublicDependency() []int32 { + if m != nil { + return m.PublicDependency + } + return nil +} + +func (m *FileDescriptorProto) GetWeakDependency() []int32 { + if m != nil { + return m.WeakDependency + } + return nil +} + +func (m *FileDescriptorProto) GetMessageType() []*DescriptorProto { + if m != nil { + return m.MessageType + } + return nil +} + +func (m *FileDescriptorProto) GetEnumType() []*EnumDescriptorProto { + if m != nil { + return m.EnumType + } + return nil +} + +func (m *FileDescriptorProto) GetService() []*ServiceDescriptorProto { + if m != nil { + return m.Service + } + return nil +} + +func (m *FileDescriptorProto) GetExtension() []*FieldDescriptorProto { + if m != nil { + return m.Extension + } + return nil +} + +func (m *FileDescriptorProto) GetOptions() *FileOptions { + if m != nil { + return m.Options + } + return nil +} + +func (m *FileDescriptorProto) GetSourceCodeInfo() *SourceCodeInfo { + if m != nil { + return m.SourceCodeInfo + } + return nil +} + +func (m *FileDescriptorProto) GetSyntax() string { + if m != nil && m.Syntax != nil { + return *m.Syntax + } + return "" +} + +// Describes a message type. +type DescriptorProto struct { + Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + Field []*FieldDescriptorProto `protobuf:"bytes,2,rep,name=field" json:"field,omitempty"` + Extension []*FieldDescriptorProto `protobuf:"bytes,6,rep,name=extension" json:"extension,omitempty"` + NestedType []*DescriptorProto `protobuf:"bytes,3,rep,name=nested_type,json=nestedType" json:"nested_type,omitempty"` + EnumType []*EnumDescriptorProto `protobuf:"bytes,4,rep,name=enum_type,json=enumType" json:"enum_type,omitempty"` + ExtensionRange []*DescriptorProto_ExtensionRange `protobuf:"bytes,5,rep,name=extension_range,json=extensionRange" json:"extension_range,omitempty"` + OneofDecl []*OneofDescriptorProto `protobuf:"bytes,8,rep,name=oneof_decl,json=oneofDecl" json:"oneof_decl,omitempty"` + Options *MessageOptions `protobuf:"bytes,7,opt,name=options" json:"options,omitempty"` + ReservedRange []*DescriptorProto_ReservedRange `protobuf:"bytes,9,rep,name=reserved_range,json=reservedRange" json:"reserved_range,omitempty"` + // Reserved field names, which may not be used by fields in the same message. + // A given name may only be reserved once. + ReservedName []string `protobuf:"bytes,10,rep,name=reserved_name,json=reservedName" json:"reserved_name,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *DescriptorProto) Reset() { *m = DescriptorProto{} } +func (m *DescriptorProto) String() string { return proto.CompactTextString(m) } +func (*DescriptorProto) ProtoMessage() {} +func (*DescriptorProto) Descriptor() ([]byte, []int) { + return fileDescriptor_descriptor_9588782fb9cbecd6, []int{2} +} +func (m *DescriptorProto) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_DescriptorProto.Unmarshal(m, b) +} +func (m *DescriptorProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_DescriptorProto.Marshal(b, m, deterministic) +} +func (dst *DescriptorProto) XXX_Merge(src proto.Message) { + xxx_messageInfo_DescriptorProto.Merge(dst, src) +} +func (m *DescriptorProto) XXX_Size() int { + return xxx_messageInfo_DescriptorProto.Size(m) +} +func (m *DescriptorProto) XXX_DiscardUnknown() { + xxx_messageInfo_DescriptorProto.DiscardUnknown(m) +} + +var xxx_messageInfo_DescriptorProto proto.InternalMessageInfo + +func (m *DescriptorProto) GetName() string { + if m != nil && m.Name != nil { + return *m.Name + } + return "" +} + +func (m *DescriptorProto) GetField() []*FieldDescriptorProto { + if m != nil { + return m.Field + } + return nil +} + +func (m *DescriptorProto) GetExtension() []*FieldDescriptorProto { + if m != nil { + return m.Extension + } + return nil +} + +func (m *DescriptorProto) GetNestedType() []*DescriptorProto { + if m != nil { + return m.NestedType + } + return nil +} + +func (m *DescriptorProto) GetEnumType() []*EnumDescriptorProto { + if m != nil { + return m.EnumType + } + return nil +} + +func (m *DescriptorProto) GetExtensionRange() []*DescriptorProto_ExtensionRange { + if m != nil { + return m.ExtensionRange + } + return nil +} + +func (m *DescriptorProto) GetOneofDecl() []*OneofDescriptorProto { + if m != nil { + return m.OneofDecl + } + return nil +} + +func (m *DescriptorProto) GetOptions() *MessageOptions { + if m != nil { + return m.Options + } + return nil +} + +func (m *DescriptorProto) GetReservedRange() []*DescriptorProto_ReservedRange { + if m != nil { + return m.ReservedRange + } + return nil +} + +func (m *DescriptorProto) GetReservedName() []string { + if m != nil { + return m.ReservedName + } + return nil +} + +type DescriptorProto_ExtensionRange struct { + Start *int32 `protobuf:"varint,1,opt,name=start" json:"start,omitempty"` + End *int32 `protobuf:"varint,2,opt,name=end" json:"end,omitempty"` + Options *ExtensionRangeOptions `protobuf:"bytes,3,opt,name=options" json:"options,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *DescriptorProto_ExtensionRange) Reset() { *m = DescriptorProto_ExtensionRange{} } +func (m *DescriptorProto_ExtensionRange) String() string { return proto.CompactTextString(m) } +func (*DescriptorProto_ExtensionRange) ProtoMessage() {} +func (*DescriptorProto_ExtensionRange) Descriptor() ([]byte, []int) { + return fileDescriptor_descriptor_9588782fb9cbecd6, []int{2, 0} +} +func (m *DescriptorProto_ExtensionRange) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_DescriptorProto_ExtensionRange.Unmarshal(m, b) +} +func (m *DescriptorProto_ExtensionRange) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_DescriptorProto_ExtensionRange.Marshal(b, m, deterministic) +} +func (dst *DescriptorProto_ExtensionRange) XXX_Merge(src proto.Message) { + xxx_messageInfo_DescriptorProto_ExtensionRange.Merge(dst, src) +} +func (m *DescriptorProto_ExtensionRange) XXX_Size() int { + return xxx_messageInfo_DescriptorProto_ExtensionRange.Size(m) +} +func (m *DescriptorProto_ExtensionRange) XXX_DiscardUnknown() { + xxx_messageInfo_DescriptorProto_ExtensionRange.DiscardUnknown(m) +} + +var xxx_messageInfo_DescriptorProto_ExtensionRange proto.InternalMessageInfo + +func (m *DescriptorProto_ExtensionRange) GetStart() int32 { + if m != nil && m.Start != nil { + return *m.Start + } + return 0 +} + +func (m *DescriptorProto_ExtensionRange) GetEnd() int32 { + if m != nil && m.End != nil { + return *m.End + } + return 0 +} + +func (m *DescriptorProto_ExtensionRange) GetOptions() *ExtensionRangeOptions { + if m != nil { + return m.Options + } + return nil +} + +// Range of reserved tag numbers. Reserved tag numbers may not be used by +// fields or extension ranges in the same message. Reserved ranges may +// not overlap. +type DescriptorProto_ReservedRange struct { + Start *int32 `protobuf:"varint,1,opt,name=start" json:"start,omitempty"` + End *int32 `protobuf:"varint,2,opt,name=end" json:"end,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *DescriptorProto_ReservedRange) Reset() { *m = DescriptorProto_ReservedRange{} } +func (m *DescriptorProto_ReservedRange) String() string { return proto.CompactTextString(m) } +func (*DescriptorProto_ReservedRange) ProtoMessage() {} +func (*DescriptorProto_ReservedRange) Descriptor() ([]byte, []int) { + return fileDescriptor_descriptor_9588782fb9cbecd6, []int{2, 1} +} +func (m *DescriptorProto_ReservedRange) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_DescriptorProto_ReservedRange.Unmarshal(m, b) +} +func (m *DescriptorProto_ReservedRange) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_DescriptorProto_ReservedRange.Marshal(b, m, deterministic) +} +func (dst *DescriptorProto_ReservedRange) XXX_Merge(src proto.Message) { + xxx_messageInfo_DescriptorProto_ReservedRange.Merge(dst, src) +} +func (m *DescriptorProto_ReservedRange) XXX_Size() int { + return xxx_messageInfo_DescriptorProto_ReservedRange.Size(m) +} +func (m *DescriptorProto_ReservedRange) XXX_DiscardUnknown() { + xxx_messageInfo_DescriptorProto_ReservedRange.DiscardUnknown(m) +} + +var xxx_messageInfo_DescriptorProto_ReservedRange proto.InternalMessageInfo + +func (m *DescriptorProto_ReservedRange) GetStart() int32 { + if m != nil && m.Start != nil { + return *m.Start + } + return 0 +} + +func (m *DescriptorProto_ReservedRange) GetEnd() int32 { + if m != nil && m.End != nil { + return *m.End + } + return 0 +} + +type ExtensionRangeOptions struct { + // The parser stores options it doesn't recognize here. See above. + UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + proto.XXX_InternalExtensions `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ExtensionRangeOptions) Reset() { *m = ExtensionRangeOptions{} } +func (m *ExtensionRangeOptions) String() string { return proto.CompactTextString(m) } +func (*ExtensionRangeOptions) ProtoMessage() {} +func (*ExtensionRangeOptions) Descriptor() ([]byte, []int) { + return fileDescriptor_descriptor_9588782fb9cbecd6, []int{3} +} + +var extRange_ExtensionRangeOptions = []proto.ExtensionRange{ + {Start: 1000, End: 536870911}, +} + +func (*ExtensionRangeOptions) ExtensionRangeArray() []proto.ExtensionRange { + return extRange_ExtensionRangeOptions +} +func (m *ExtensionRangeOptions) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ExtensionRangeOptions.Unmarshal(m, b) +} +func (m *ExtensionRangeOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ExtensionRangeOptions.Marshal(b, m, deterministic) +} +func (dst *ExtensionRangeOptions) XXX_Merge(src proto.Message) { + xxx_messageInfo_ExtensionRangeOptions.Merge(dst, src) +} +func (m *ExtensionRangeOptions) XXX_Size() int { + return xxx_messageInfo_ExtensionRangeOptions.Size(m) +} +func (m *ExtensionRangeOptions) XXX_DiscardUnknown() { + xxx_messageInfo_ExtensionRangeOptions.DiscardUnknown(m) +} + +var xxx_messageInfo_ExtensionRangeOptions proto.InternalMessageInfo + +func (m *ExtensionRangeOptions) GetUninterpretedOption() []*UninterpretedOption { + if m != nil { + return m.UninterpretedOption + } + return nil +} + +// Describes a field within a message. +type FieldDescriptorProto struct { + Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + Number *int32 `protobuf:"varint,3,opt,name=number" json:"number,omitempty"` + Label *FieldDescriptorProto_Label `protobuf:"varint,4,opt,name=label,enum=google.protobuf.FieldDescriptorProto_Label" json:"label,omitempty"` + // If type_name is set, this need not be set. If both this and type_name + // are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP. + Type *FieldDescriptorProto_Type `protobuf:"varint,5,opt,name=type,enum=google.protobuf.FieldDescriptorProto_Type" json:"type,omitempty"` + // For message and enum types, this is the name of the type. If the name + // starts with a '.', it is fully-qualified. Otherwise, C++-like scoping + // rules are used to find the type (i.e. first the nested types within this + // message are searched, then within the parent, on up to the root + // namespace). + TypeName *string `protobuf:"bytes,6,opt,name=type_name,json=typeName" json:"type_name,omitempty"` + // For extensions, this is the name of the type being extended. It is + // resolved in the same manner as type_name. + Extendee *string `protobuf:"bytes,2,opt,name=extendee" json:"extendee,omitempty"` + // For numeric types, contains the original text representation of the value. + // For booleans, "true" or "false". + // For strings, contains the default text contents (not escaped in any way). + // For bytes, contains the C escaped value. All bytes >= 128 are escaped. + // TODO(kenton): Base-64 encode? + DefaultValue *string `protobuf:"bytes,7,opt,name=default_value,json=defaultValue" json:"default_value,omitempty"` + // If set, gives the index of a oneof in the containing type's oneof_decl + // list. This field is a member of that oneof. + OneofIndex *int32 `protobuf:"varint,9,opt,name=oneof_index,json=oneofIndex" json:"oneof_index,omitempty"` + // JSON name of this field. The value is set by protocol compiler. If the + // user has set a "json_name" option on this field, that option's value + // will be used. Otherwise, it's deduced from the field's name by converting + // it to camelCase. + JsonName *string `protobuf:"bytes,10,opt,name=json_name,json=jsonName" json:"json_name,omitempty"` + Options *FieldOptions `protobuf:"bytes,8,opt,name=options" json:"options,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *FieldDescriptorProto) Reset() { *m = FieldDescriptorProto{} } +func (m *FieldDescriptorProto) String() string { return proto.CompactTextString(m) } +func (*FieldDescriptorProto) ProtoMessage() {} +func (*FieldDescriptorProto) Descriptor() ([]byte, []int) { + return fileDescriptor_descriptor_9588782fb9cbecd6, []int{4} +} +func (m *FieldDescriptorProto) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_FieldDescriptorProto.Unmarshal(m, b) +} +func (m *FieldDescriptorProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_FieldDescriptorProto.Marshal(b, m, deterministic) +} +func (dst *FieldDescriptorProto) XXX_Merge(src proto.Message) { + xxx_messageInfo_FieldDescriptorProto.Merge(dst, src) +} +func (m *FieldDescriptorProto) XXX_Size() int { + return xxx_messageInfo_FieldDescriptorProto.Size(m) +} +func (m *FieldDescriptorProto) XXX_DiscardUnknown() { + xxx_messageInfo_FieldDescriptorProto.DiscardUnknown(m) +} + +var xxx_messageInfo_FieldDescriptorProto proto.InternalMessageInfo + +func (m *FieldDescriptorProto) GetName() string { + if m != nil && m.Name != nil { + return *m.Name + } + return "" +} + +func (m *FieldDescriptorProto) GetNumber() int32 { + if m != nil && m.Number != nil { + return *m.Number + } + return 0 +} + +func (m *FieldDescriptorProto) GetLabel() FieldDescriptorProto_Label { + if m != nil && m.Label != nil { + return *m.Label + } + return FieldDescriptorProto_LABEL_OPTIONAL +} + +func (m *FieldDescriptorProto) GetType() FieldDescriptorProto_Type { + if m != nil && m.Type != nil { + return *m.Type + } + return FieldDescriptorProto_TYPE_DOUBLE +} + +func (m *FieldDescriptorProto) GetTypeName() string { + if m != nil && m.TypeName != nil { + return *m.TypeName + } + return "" +} + +func (m *FieldDescriptorProto) GetExtendee() string { + if m != nil && m.Extendee != nil { + return *m.Extendee + } + return "" +} + +func (m *FieldDescriptorProto) GetDefaultValue() string { + if m != nil && m.DefaultValue != nil { + return *m.DefaultValue + } + return "" +} + +func (m *FieldDescriptorProto) GetOneofIndex() int32 { + if m != nil && m.OneofIndex != nil { + return *m.OneofIndex + } + return 0 +} + +func (m *FieldDescriptorProto) GetJsonName() string { + if m != nil && m.JsonName != nil { + return *m.JsonName + } + return "" +} + +func (m *FieldDescriptorProto) GetOptions() *FieldOptions { + if m != nil { + return m.Options + } + return nil +} + +// Describes a oneof. +type OneofDescriptorProto struct { + Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + Options *OneofOptions `protobuf:"bytes,2,opt,name=options" json:"options,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *OneofDescriptorProto) Reset() { *m = OneofDescriptorProto{} } +func (m *OneofDescriptorProto) String() string { return proto.CompactTextString(m) } +func (*OneofDescriptorProto) ProtoMessage() {} +func (*OneofDescriptorProto) Descriptor() ([]byte, []int) { + return fileDescriptor_descriptor_9588782fb9cbecd6, []int{5} +} +func (m *OneofDescriptorProto) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_OneofDescriptorProto.Unmarshal(m, b) +} +func (m *OneofDescriptorProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_OneofDescriptorProto.Marshal(b, m, deterministic) +} +func (dst *OneofDescriptorProto) XXX_Merge(src proto.Message) { + xxx_messageInfo_OneofDescriptorProto.Merge(dst, src) +} +func (m *OneofDescriptorProto) XXX_Size() int { + return xxx_messageInfo_OneofDescriptorProto.Size(m) +} +func (m *OneofDescriptorProto) XXX_DiscardUnknown() { + xxx_messageInfo_OneofDescriptorProto.DiscardUnknown(m) +} + +var xxx_messageInfo_OneofDescriptorProto proto.InternalMessageInfo + +func (m *OneofDescriptorProto) GetName() string { + if m != nil && m.Name != nil { + return *m.Name + } + return "" +} + +func (m *OneofDescriptorProto) GetOptions() *OneofOptions { + if m != nil { + return m.Options + } + return nil +} + +// Describes an enum type. +type EnumDescriptorProto struct { + Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + Value []*EnumValueDescriptorProto `protobuf:"bytes,2,rep,name=value" json:"value,omitempty"` + Options *EnumOptions `protobuf:"bytes,3,opt,name=options" json:"options,omitempty"` + // Range of reserved numeric values. Reserved numeric values may not be used + // by enum values in the same enum declaration. Reserved ranges may not + // overlap. + ReservedRange []*EnumDescriptorProto_EnumReservedRange `protobuf:"bytes,4,rep,name=reserved_range,json=reservedRange" json:"reserved_range,omitempty"` + // Reserved enum value names, which may not be reused. A given name may only + // be reserved once. + ReservedName []string `protobuf:"bytes,5,rep,name=reserved_name,json=reservedName" json:"reserved_name,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *EnumDescriptorProto) Reset() { *m = EnumDescriptorProto{} } +func (m *EnumDescriptorProto) String() string { return proto.CompactTextString(m) } +func (*EnumDescriptorProto) ProtoMessage() {} +func (*EnumDescriptorProto) Descriptor() ([]byte, []int) { + return fileDescriptor_descriptor_9588782fb9cbecd6, []int{6} +} +func (m *EnumDescriptorProto) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_EnumDescriptorProto.Unmarshal(m, b) +} +func (m *EnumDescriptorProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_EnumDescriptorProto.Marshal(b, m, deterministic) +} +func (dst *EnumDescriptorProto) XXX_Merge(src proto.Message) { + xxx_messageInfo_EnumDescriptorProto.Merge(dst, src) +} +func (m *EnumDescriptorProto) XXX_Size() int { + return xxx_messageInfo_EnumDescriptorProto.Size(m) +} +func (m *EnumDescriptorProto) XXX_DiscardUnknown() { + xxx_messageInfo_EnumDescriptorProto.DiscardUnknown(m) +} + +var xxx_messageInfo_EnumDescriptorProto proto.InternalMessageInfo + +func (m *EnumDescriptorProto) GetName() string { + if m != nil && m.Name != nil { + return *m.Name + } + return "" +} + +func (m *EnumDescriptorProto) GetValue() []*EnumValueDescriptorProto { + if m != nil { + return m.Value + } + return nil +} + +func (m *EnumDescriptorProto) GetOptions() *EnumOptions { + if m != nil { + return m.Options + } + return nil +} + +func (m *EnumDescriptorProto) GetReservedRange() []*EnumDescriptorProto_EnumReservedRange { + if m != nil { + return m.ReservedRange + } + return nil +} + +func (m *EnumDescriptorProto) GetReservedName() []string { + if m != nil { + return m.ReservedName + } + return nil +} + +// Range of reserved numeric values. Reserved values may not be used by +// entries in the same enum. Reserved ranges may not overlap. +// +// Note that this is distinct from DescriptorProto.ReservedRange in that it +// is inclusive such that it can appropriately represent the entire int32 +// domain. +type EnumDescriptorProto_EnumReservedRange struct { + Start *int32 `protobuf:"varint,1,opt,name=start" json:"start,omitempty"` + End *int32 `protobuf:"varint,2,opt,name=end" json:"end,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *EnumDescriptorProto_EnumReservedRange) Reset() { *m = EnumDescriptorProto_EnumReservedRange{} } +func (m *EnumDescriptorProto_EnumReservedRange) String() string { return proto.CompactTextString(m) } +func (*EnumDescriptorProto_EnumReservedRange) ProtoMessage() {} +func (*EnumDescriptorProto_EnumReservedRange) Descriptor() ([]byte, []int) { + return fileDescriptor_descriptor_9588782fb9cbecd6, []int{6, 0} +} +func (m *EnumDescriptorProto_EnumReservedRange) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_EnumDescriptorProto_EnumReservedRange.Unmarshal(m, b) +} +func (m *EnumDescriptorProto_EnumReservedRange) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_EnumDescriptorProto_EnumReservedRange.Marshal(b, m, deterministic) +} +func (dst *EnumDescriptorProto_EnumReservedRange) XXX_Merge(src proto.Message) { + xxx_messageInfo_EnumDescriptorProto_EnumReservedRange.Merge(dst, src) +} +func (m *EnumDescriptorProto_EnumReservedRange) XXX_Size() int { + return xxx_messageInfo_EnumDescriptorProto_EnumReservedRange.Size(m) +} +func (m *EnumDescriptorProto_EnumReservedRange) XXX_DiscardUnknown() { + xxx_messageInfo_EnumDescriptorProto_EnumReservedRange.DiscardUnknown(m) +} + +var xxx_messageInfo_EnumDescriptorProto_EnumReservedRange proto.InternalMessageInfo + +func (m *EnumDescriptorProto_EnumReservedRange) GetStart() int32 { + if m != nil && m.Start != nil { + return *m.Start + } + return 0 +} + +func (m *EnumDescriptorProto_EnumReservedRange) GetEnd() int32 { + if m != nil && m.End != nil { + return *m.End + } + return 0 +} + +// Describes a value within an enum. +type EnumValueDescriptorProto struct { + Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + Number *int32 `protobuf:"varint,2,opt,name=number" json:"number,omitempty"` + Options *EnumValueOptions `protobuf:"bytes,3,opt,name=options" json:"options,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *EnumValueDescriptorProto) Reset() { *m = EnumValueDescriptorProto{} } +func (m *EnumValueDescriptorProto) String() string { return proto.CompactTextString(m) } +func (*EnumValueDescriptorProto) ProtoMessage() {} +func (*EnumValueDescriptorProto) Descriptor() ([]byte, []int) { + return fileDescriptor_descriptor_9588782fb9cbecd6, []int{7} +} +func (m *EnumValueDescriptorProto) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_EnumValueDescriptorProto.Unmarshal(m, b) +} +func (m *EnumValueDescriptorProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_EnumValueDescriptorProto.Marshal(b, m, deterministic) +} +func (dst *EnumValueDescriptorProto) XXX_Merge(src proto.Message) { + xxx_messageInfo_EnumValueDescriptorProto.Merge(dst, src) +} +func (m *EnumValueDescriptorProto) XXX_Size() int { + return xxx_messageInfo_EnumValueDescriptorProto.Size(m) +} +func (m *EnumValueDescriptorProto) XXX_DiscardUnknown() { + xxx_messageInfo_EnumValueDescriptorProto.DiscardUnknown(m) +} + +var xxx_messageInfo_EnumValueDescriptorProto proto.InternalMessageInfo + +func (m *EnumValueDescriptorProto) GetName() string { + if m != nil && m.Name != nil { + return *m.Name + } + return "" +} + +func (m *EnumValueDescriptorProto) GetNumber() int32 { + if m != nil && m.Number != nil { + return *m.Number + } + return 0 +} + +func (m *EnumValueDescriptorProto) GetOptions() *EnumValueOptions { + if m != nil { + return m.Options + } + return nil +} + +// Describes a service. +type ServiceDescriptorProto struct { + Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + Method []*MethodDescriptorProto `protobuf:"bytes,2,rep,name=method" json:"method,omitempty"` + Options *ServiceOptions `protobuf:"bytes,3,opt,name=options" json:"options,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ServiceDescriptorProto) Reset() { *m = ServiceDescriptorProto{} } +func (m *ServiceDescriptorProto) String() string { return proto.CompactTextString(m) } +func (*ServiceDescriptorProto) ProtoMessage() {} +func (*ServiceDescriptorProto) Descriptor() ([]byte, []int) { + return fileDescriptor_descriptor_9588782fb9cbecd6, []int{8} +} +func (m *ServiceDescriptorProto) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ServiceDescriptorProto.Unmarshal(m, b) +} +func (m *ServiceDescriptorProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ServiceDescriptorProto.Marshal(b, m, deterministic) +} +func (dst *ServiceDescriptorProto) XXX_Merge(src proto.Message) { + xxx_messageInfo_ServiceDescriptorProto.Merge(dst, src) +} +func (m *ServiceDescriptorProto) XXX_Size() int { + return xxx_messageInfo_ServiceDescriptorProto.Size(m) +} +func (m *ServiceDescriptorProto) XXX_DiscardUnknown() { + xxx_messageInfo_ServiceDescriptorProto.DiscardUnknown(m) +} + +var xxx_messageInfo_ServiceDescriptorProto proto.InternalMessageInfo + +func (m *ServiceDescriptorProto) GetName() string { + if m != nil && m.Name != nil { + return *m.Name + } + return "" +} + +func (m *ServiceDescriptorProto) GetMethod() []*MethodDescriptorProto { + if m != nil { + return m.Method + } + return nil +} + +func (m *ServiceDescriptorProto) GetOptions() *ServiceOptions { + if m != nil { + return m.Options + } + return nil +} + +// Describes a method of a service. +type MethodDescriptorProto struct { + Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + // Input and output type names. These are resolved in the same way as + // FieldDescriptorProto.type_name, but must refer to a message type. + InputType *string `protobuf:"bytes,2,opt,name=input_type,json=inputType" json:"input_type,omitempty"` + OutputType *string `protobuf:"bytes,3,opt,name=output_type,json=outputType" json:"output_type,omitempty"` + Options *MethodOptions `protobuf:"bytes,4,opt,name=options" json:"options,omitempty"` + // Identifies if client streams multiple client messages + ClientStreaming *bool `protobuf:"varint,5,opt,name=client_streaming,json=clientStreaming,def=0" json:"client_streaming,omitempty"` + // Identifies if server streams multiple server messages + ServerStreaming *bool `protobuf:"varint,6,opt,name=server_streaming,json=serverStreaming,def=0" json:"server_streaming,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *MethodDescriptorProto) Reset() { *m = MethodDescriptorProto{} } +func (m *MethodDescriptorProto) String() string { return proto.CompactTextString(m) } +func (*MethodDescriptorProto) ProtoMessage() {} +func (*MethodDescriptorProto) Descriptor() ([]byte, []int) { + return fileDescriptor_descriptor_9588782fb9cbecd6, []int{9} +} +func (m *MethodDescriptorProto) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_MethodDescriptorProto.Unmarshal(m, b) +} +func (m *MethodDescriptorProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_MethodDescriptorProto.Marshal(b, m, deterministic) +} +func (dst *MethodDescriptorProto) XXX_Merge(src proto.Message) { + xxx_messageInfo_MethodDescriptorProto.Merge(dst, src) +} +func (m *MethodDescriptorProto) XXX_Size() int { + return xxx_messageInfo_MethodDescriptorProto.Size(m) +} +func (m *MethodDescriptorProto) XXX_DiscardUnknown() { + xxx_messageInfo_MethodDescriptorProto.DiscardUnknown(m) +} + +var xxx_messageInfo_MethodDescriptorProto proto.InternalMessageInfo + +const Default_MethodDescriptorProto_ClientStreaming bool = false +const Default_MethodDescriptorProto_ServerStreaming bool = false + +func (m *MethodDescriptorProto) GetName() string { + if m != nil && m.Name != nil { + return *m.Name + } + return "" +} + +func (m *MethodDescriptorProto) GetInputType() string { + if m != nil && m.InputType != nil { + return *m.InputType + } + return "" +} + +func (m *MethodDescriptorProto) GetOutputType() string { + if m != nil && m.OutputType != nil { + return *m.OutputType + } + return "" +} + +func (m *MethodDescriptorProto) GetOptions() *MethodOptions { + if m != nil { + return m.Options + } + return nil +} + +func (m *MethodDescriptorProto) GetClientStreaming() bool { + if m != nil && m.ClientStreaming != nil { + return *m.ClientStreaming + } + return Default_MethodDescriptorProto_ClientStreaming +} + +func (m *MethodDescriptorProto) GetServerStreaming() bool { + if m != nil && m.ServerStreaming != nil { + return *m.ServerStreaming + } + return Default_MethodDescriptorProto_ServerStreaming +} + +type FileOptions struct { + // Sets the Java package where classes generated from this .proto will be + // placed. By default, the proto package is used, but this is often + // inappropriate because proto packages do not normally start with backwards + // domain names. + JavaPackage *string `protobuf:"bytes,1,opt,name=java_package,json=javaPackage" json:"java_package,omitempty"` + // If set, all the classes from the .proto file are wrapped in a single + // outer class with the given name. This applies to both Proto1 + // (equivalent to the old "--one_java_file" option) and Proto2 (where + // a .proto always translates to a single class, but you may want to + // explicitly choose the class name). + JavaOuterClassname *string `protobuf:"bytes,8,opt,name=java_outer_classname,json=javaOuterClassname" json:"java_outer_classname,omitempty"` + // If set true, then the Java code generator will generate a separate .java + // file for each top-level message, enum, and service defined in the .proto + // file. Thus, these types will *not* be nested inside the outer class + // named by java_outer_classname. However, the outer class will still be + // generated to contain the file's getDescriptor() method as well as any + // top-level extensions defined in the file. + JavaMultipleFiles *bool `protobuf:"varint,10,opt,name=java_multiple_files,json=javaMultipleFiles,def=0" json:"java_multiple_files,omitempty"` + // This option does nothing. + JavaGenerateEqualsAndHash *bool `protobuf:"varint,20,opt,name=java_generate_equals_and_hash,json=javaGenerateEqualsAndHash" json:"java_generate_equals_and_hash,omitempty"` // Deprecated: Do not use. + // If set true, then the Java2 code generator will generate code that + // throws an exception whenever an attempt is made to assign a non-UTF-8 + // byte sequence to a string field. + // Message reflection will do the same. + // However, an extension field still accepts non-UTF-8 byte sequences. + // This option has no effect on when used with the lite runtime. + JavaStringCheckUtf8 *bool `protobuf:"varint,27,opt,name=java_string_check_utf8,json=javaStringCheckUtf8,def=0" json:"java_string_check_utf8,omitempty"` + OptimizeFor *FileOptions_OptimizeMode `protobuf:"varint,9,opt,name=optimize_for,json=optimizeFor,enum=google.protobuf.FileOptions_OptimizeMode,def=1" json:"optimize_for,omitempty"` + // Sets the Go package where structs generated from this .proto will be + // placed. If omitted, the Go package will be derived from the following: + // - The basename of the package import path, if provided. + // - Otherwise, the package statement in the .proto file, if present. + // - Otherwise, the basename of the .proto file, without extension. + GoPackage *string `protobuf:"bytes,11,opt,name=go_package,json=goPackage" json:"go_package,omitempty"` + // Should generic services be generated in each language? "Generic" services + // are not specific to any particular RPC system. They are generated by the + // main code generators in each language (without additional plugins). + // Generic services were the only kind of service generation supported by + // early versions of google.protobuf. + // + // Generic services are now considered deprecated in favor of using plugins + // that generate code specific to your particular RPC system. Therefore, + // these default to false. Old code which depends on generic services should + // explicitly set them to true. + CcGenericServices *bool `protobuf:"varint,16,opt,name=cc_generic_services,json=ccGenericServices,def=0" json:"cc_generic_services,omitempty"` + JavaGenericServices *bool `protobuf:"varint,17,opt,name=java_generic_services,json=javaGenericServices,def=0" json:"java_generic_services,omitempty"` + PyGenericServices *bool `protobuf:"varint,18,opt,name=py_generic_services,json=pyGenericServices,def=0" json:"py_generic_services,omitempty"` + PhpGenericServices *bool `protobuf:"varint,42,opt,name=php_generic_services,json=phpGenericServices,def=0" json:"php_generic_services,omitempty"` + // Is this file deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for everything in the file, or it will be completely ignored; in the very + // least, this is a formalization for deprecating files. + Deprecated *bool `protobuf:"varint,23,opt,name=deprecated,def=0" json:"deprecated,omitempty"` + // Enables the use of arenas for the proto messages in this file. This applies + // only to generated classes for C++. + CcEnableArenas *bool `protobuf:"varint,31,opt,name=cc_enable_arenas,json=ccEnableArenas,def=0" json:"cc_enable_arenas,omitempty"` + // Sets the objective c class prefix which is prepended to all objective c + // generated classes from this .proto. There is no default. + ObjcClassPrefix *string `protobuf:"bytes,36,opt,name=objc_class_prefix,json=objcClassPrefix" json:"objc_class_prefix,omitempty"` + // Namespace for generated classes; defaults to the package. + CsharpNamespace *string `protobuf:"bytes,37,opt,name=csharp_namespace,json=csharpNamespace" json:"csharp_namespace,omitempty"` + // By default Swift generators will take the proto package and CamelCase it + // replacing '.' with underscore and use that to prefix the types/symbols + // defined. When this options is provided, they will use this value instead + // to prefix the types/symbols defined. + SwiftPrefix *string `protobuf:"bytes,39,opt,name=swift_prefix,json=swiftPrefix" json:"swift_prefix,omitempty"` + // Sets the php class prefix which is prepended to all php generated classes + // from this .proto. Default is empty. + PhpClassPrefix *string `protobuf:"bytes,40,opt,name=php_class_prefix,json=phpClassPrefix" json:"php_class_prefix,omitempty"` + // Use this option to change the namespace of php generated classes. Default + // is empty. When this option is empty, the package name will be used for + // determining the namespace. + PhpNamespace *string `protobuf:"bytes,41,opt,name=php_namespace,json=phpNamespace" json:"php_namespace,omitempty"` + // The parser stores options it doesn't recognize here. + // See the documentation for the "Options" section above. + UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + proto.XXX_InternalExtensions `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *FileOptions) Reset() { *m = FileOptions{} } +func (m *FileOptions) String() string { return proto.CompactTextString(m) } +func (*FileOptions) ProtoMessage() {} +func (*FileOptions) Descriptor() ([]byte, []int) { + return fileDescriptor_descriptor_9588782fb9cbecd6, []int{10} +} + +var extRange_FileOptions = []proto.ExtensionRange{ + {Start: 1000, End: 536870911}, +} + +func (*FileOptions) ExtensionRangeArray() []proto.ExtensionRange { + return extRange_FileOptions +} +func (m *FileOptions) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_FileOptions.Unmarshal(m, b) +} +func (m *FileOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_FileOptions.Marshal(b, m, deterministic) +} +func (dst *FileOptions) XXX_Merge(src proto.Message) { + xxx_messageInfo_FileOptions.Merge(dst, src) +} +func (m *FileOptions) XXX_Size() int { + return xxx_messageInfo_FileOptions.Size(m) +} +func (m *FileOptions) XXX_DiscardUnknown() { + xxx_messageInfo_FileOptions.DiscardUnknown(m) +} + +var xxx_messageInfo_FileOptions proto.InternalMessageInfo + +const Default_FileOptions_JavaMultipleFiles bool = false +const Default_FileOptions_JavaStringCheckUtf8 bool = false +const Default_FileOptions_OptimizeFor FileOptions_OptimizeMode = FileOptions_SPEED +const Default_FileOptions_CcGenericServices bool = false +const Default_FileOptions_JavaGenericServices bool = false +const Default_FileOptions_PyGenericServices bool = false +const Default_FileOptions_PhpGenericServices bool = false +const Default_FileOptions_Deprecated bool = false +const Default_FileOptions_CcEnableArenas bool = false + +func (m *FileOptions) GetJavaPackage() string { + if m != nil && m.JavaPackage != nil { + return *m.JavaPackage + } + return "" +} + +func (m *FileOptions) GetJavaOuterClassname() string { + if m != nil && m.JavaOuterClassname != nil { + return *m.JavaOuterClassname + } + return "" +} + +func (m *FileOptions) GetJavaMultipleFiles() bool { + if m != nil && m.JavaMultipleFiles != nil { + return *m.JavaMultipleFiles + } + return Default_FileOptions_JavaMultipleFiles +} + +// Deprecated: Do not use. +func (m *FileOptions) GetJavaGenerateEqualsAndHash() bool { + if m != nil && m.JavaGenerateEqualsAndHash != nil { + return *m.JavaGenerateEqualsAndHash + } + return false +} + +func (m *FileOptions) GetJavaStringCheckUtf8() bool { + if m != nil && m.JavaStringCheckUtf8 != nil { + return *m.JavaStringCheckUtf8 + } + return Default_FileOptions_JavaStringCheckUtf8 +} + +func (m *FileOptions) GetOptimizeFor() FileOptions_OptimizeMode { + if m != nil && m.OptimizeFor != nil { + return *m.OptimizeFor + } + return Default_FileOptions_OptimizeFor +} + +func (m *FileOptions) GetGoPackage() string { + if m != nil && m.GoPackage != nil { + return *m.GoPackage + } + return "" +} + +func (m *FileOptions) GetCcGenericServices() bool { + if m != nil && m.CcGenericServices != nil { + return *m.CcGenericServices + } + return Default_FileOptions_CcGenericServices +} + +func (m *FileOptions) GetJavaGenericServices() bool { + if m != nil && m.JavaGenericServices != nil { + return *m.JavaGenericServices + } + return Default_FileOptions_JavaGenericServices +} + +func (m *FileOptions) GetPyGenericServices() bool { + if m != nil && m.PyGenericServices != nil { + return *m.PyGenericServices + } + return Default_FileOptions_PyGenericServices +} + +func (m *FileOptions) GetPhpGenericServices() bool { + if m != nil && m.PhpGenericServices != nil { + return *m.PhpGenericServices + } + return Default_FileOptions_PhpGenericServices +} + +func (m *FileOptions) GetDeprecated() bool { + if m != nil && m.Deprecated != nil { + return *m.Deprecated + } + return Default_FileOptions_Deprecated +} + +func (m *FileOptions) GetCcEnableArenas() bool { + if m != nil && m.CcEnableArenas != nil { + return *m.CcEnableArenas + } + return Default_FileOptions_CcEnableArenas +} + +func (m *FileOptions) GetObjcClassPrefix() string { + if m != nil && m.ObjcClassPrefix != nil { + return *m.ObjcClassPrefix + } + return "" +} + +func (m *FileOptions) GetCsharpNamespace() string { + if m != nil && m.CsharpNamespace != nil { + return *m.CsharpNamespace + } + return "" +} + +func (m *FileOptions) GetSwiftPrefix() string { + if m != nil && m.SwiftPrefix != nil { + return *m.SwiftPrefix + } + return "" +} + +func (m *FileOptions) GetPhpClassPrefix() string { + if m != nil && m.PhpClassPrefix != nil { + return *m.PhpClassPrefix + } + return "" +} + +func (m *FileOptions) GetPhpNamespace() string { + if m != nil && m.PhpNamespace != nil { + return *m.PhpNamespace + } + return "" +} + +func (m *FileOptions) GetUninterpretedOption() []*UninterpretedOption { + if m != nil { + return m.UninterpretedOption + } + return nil +} + +type MessageOptions struct { + // Set true to use the old proto1 MessageSet wire format for extensions. + // This is provided for backwards-compatibility with the MessageSet wire + // format. You should not use this for any other reason: It's less + // efficient, has fewer features, and is more complicated. + // + // The message must be defined exactly as follows: + // message Foo { + // option message_set_wire_format = true; + // extensions 4 to max; + // } + // Note that the message cannot have any defined fields; MessageSets only + // have extensions. + // + // All extensions of your type must be singular messages; e.g. they cannot + // be int32s, enums, or repeated messages. + // + // Because this is an option, the above two restrictions are not enforced by + // the protocol compiler. + MessageSetWireFormat *bool `protobuf:"varint,1,opt,name=message_set_wire_format,json=messageSetWireFormat,def=0" json:"message_set_wire_format,omitempty"` + // Disables the generation of the standard "descriptor()" accessor, which can + // conflict with a field of the same name. This is meant to make migration + // from proto1 easier; new code should avoid fields named "descriptor". + NoStandardDescriptorAccessor *bool `protobuf:"varint,2,opt,name=no_standard_descriptor_accessor,json=noStandardDescriptorAccessor,def=0" json:"no_standard_descriptor_accessor,omitempty"` + // Is this message deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for the message, or it will be completely ignored; in the very least, + // this is a formalization for deprecating messages. + Deprecated *bool `protobuf:"varint,3,opt,name=deprecated,def=0" json:"deprecated,omitempty"` + // Whether the message is an automatically generated map entry type for the + // maps field. + // + // For maps fields: + // map map_field = 1; + // The parsed descriptor looks like: + // message MapFieldEntry { + // option map_entry = true; + // optional KeyType key = 1; + // optional ValueType value = 2; + // } + // repeated MapFieldEntry map_field = 1; + // + // Implementations may choose not to generate the map_entry=true message, but + // use a native map in the target language to hold the keys and values. + // The reflection APIs in such implementions still need to work as + // if the field is a repeated message field. + // + // NOTE: Do not set the option in .proto files. Always use the maps syntax + // instead. The option should only be implicitly set by the proto compiler + // parser. + MapEntry *bool `protobuf:"varint,7,opt,name=map_entry,json=mapEntry" json:"map_entry,omitempty"` + // The parser stores options it doesn't recognize here. See above. + UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + proto.XXX_InternalExtensions `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *MessageOptions) Reset() { *m = MessageOptions{} } +func (m *MessageOptions) String() string { return proto.CompactTextString(m) } +func (*MessageOptions) ProtoMessage() {} +func (*MessageOptions) Descriptor() ([]byte, []int) { + return fileDescriptor_descriptor_9588782fb9cbecd6, []int{11} +} + +var extRange_MessageOptions = []proto.ExtensionRange{ + {Start: 1000, End: 536870911}, +} + +func (*MessageOptions) ExtensionRangeArray() []proto.ExtensionRange { + return extRange_MessageOptions +} +func (m *MessageOptions) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_MessageOptions.Unmarshal(m, b) +} +func (m *MessageOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_MessageOptions.Marshal(b, m, deterministic) +} +func (dst *MessageOptions) XXX_Merge(src proto.Message) { + xxx_messageInfo_MessageOptions.Merge(dst, src) +} +func (m *MessageOptions) XXX_Size() int { + return xxx_messageInfo_MessageOptions.Size(m) +} +func (m *MessageOptions) XXX_DiscardUnknown() { + xxx_messageInfo_MessageOptions.DiscardUnknown(m) +} + +var xxx_messageInfo_MessageOptions proto.InternalMessageInfo + +const Default_MessageOptions_MessageSetWireFormat bool = false +const Default_MessageOptions_NoStandardDescriptorAccessor bool = false +const Default_MessageOptions_Deprecated bool = false + +func (m *MessageOptions) GetMessageSetWireFormat() bool { + if m != nil && m.MessageSetWireFormat != nil { + return *m.MessageSetWireFormat + } + return Default_MessageOptions_MessageSetWireFormat +} + +func (m *MessageOptions) GetNoStandardDescriptorAccessor() bool { + if m != nil && m.NoStandardDescriptorAccessor != nil { + return *m.NoStandardDescriptorAccessor + } + return Default_MessageOptions_NoStandardDescriptorAccessor +} + +func (m *MessageOptions) GetDeprecated() bool { + if m != nil && m.Deprecated != nil { + return *m.Deprecated + } + return Default_MessageOptions_Deprecated +} + +func (m *MessageOptions) GetMapEntry() bool { + if m != nil && m.MapEntry != nil { + return *m.MapEntry + } + return false +} + +func (m *MessageOptions) GetUninterpretedOption() []*UninterpretedOption { + if m != nil { + return m.UninterpretedOption + } + return nil +} + +type FieldOptions struct { + // The ctype option instructs the C++ code generator to use a different + // representation of the field than it normally would. See the specific + // options below. This option is not yet implemented in the open source + // release -- sorry, we'll try to include it in a future version! + Ctype *FieldOptions_CType `protobuf:"varint,1,opt,name=ctype,enum=google.protobuf.FieldOptions_CType,def=0" json:"ctype,omitempty"` + // The packed option can be enabled for repeated primitive fields to enable + // a more efficient representation on the wire. Rather than repeatedly + // writing the tag and type for each element, the entire array is encoded as + // a single length-delimited blob. In proto3, only explicit setting it to + // false will avoid using packed encoding. + Packed *bool `protobuf:"varint,2,opt,name=packed" json:"packed,omitempty"` + // The jstype option determines the JavaScript type used for values of the + // field. The option is permitted only for 64 bit integral and fixed types + // (int64, uint64, sint64, fixed64, sfixed64). A field with jstype JS_STRING + // is represented as JavaScript string, which avoids loss of precision that + // can happen when a large value is converted to a floating point JavaScript. + // Specifying JS_NUMBER for the jstype causes the generated JavaScript code to + // use the JavaScript "number" type. The behavior of the default option + // JS_NORMAL is implementation dependent. + // + // This option is an enum to permit additional types to be added, e.g. + // goog.math.Integer. + Jstype *FieldOptions_JSType `protobuf:"varint,6,opt,name=jstype,enum=google.protobuf.FieldOptions_JSType,def=0" json:"jstype,omitempty"` + // Should this field be parsed lazily? Lazy applies only to message-type + // fields. It means that when the outer message is initially parsed, the + // inner message's contents will not be parsed but instead stored in encoded + // form. The inner message will actually be parsed when it is first accessed. + // + // This is only a hint. Implementations are free to choose whether to use + // eager or lazy parsing regardless of the value of this option. However, + // setting this option true suggests that the protocol author believes that + // using lazy parsing on this field is worth the additional bookkeeping + // overhead typically needed to implement it. + // + // This option does not affect the public interface of any generated code; + // all method signatures remain the same. Furthermore, thread-safety of the + // interface is not affected by this option; const methods remain safe to + // call from multiple threads concurrently, while non-const methods continue + // to require exclusive access. + // + // + // Note that implementations may choose not to check required fields within + // a lazy sub-message. That is, calling IsInitialized() on the outer message + // may return true even if the inner message has missing required fields. + // This is necessary because otherwise the inner message would have to be + // parsed in order to perform the check, defeating the purpose of lazy + // parsing. An implementation which chooses not to check required fields + // must be consistent about it. That is, for any particular sub-message, the + // implementation must either *always* check its required fields, or *never* + // check its required fields, regardless of whether or not the message has + // been parsed. + Lazy *bool `protobuf:"varint,5,opt,name=lazy,def=0" json:"lazy,omitempty"` + // Is this field deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for accessors, or it will be completely ignored; in the very least, this + // is a formalization for deprecating fields. + Deprecated *bool `protobuf:"varint,3,opt,name=deprecated,def=0" json:"deprecated,omitempty"` + // For Google-internal migration only. Do not use. + Weak *bool `protobuf:"varint,10,opt,name=weak,def=0" json:"weak,omitempty"` + // The parser stores options it doesn't recognize here. See above. + UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + proto.XXX_InternalExtensions `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *FieldOptions) Reset() { *m = FieldOptions{} } +func (m *FieldOptions) String() string { return proto.CompactTextString(m) } +func (*FieldOptions) ProtoMessage() {} +func (*FieldOptions) Descriptor() ([]byte, []int) { + return fileDescriptor_descriptor_9588782fb9cbecd6, []int{12} +} + +var extRange_FieldOptions = []proto.ExtensionRange{ + {Start: 1000, End: 536870911}, +} + +func (*FieldOptions) ExtensionRangeArray() []proto.ExtensionRange { + return extRange_FieldOptions +} +func (m *FieldOptions) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_FieldOptions.Unmarshal(m, b) +} +func (m *FieldOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_FieldOptions.Marshal(b, m, deterministic) +} +func (dst *FieldOptions) XXX_Merge(src proto.Message) { + xxx_messageInfo_FieldOptions.Merge(dst, src) +} +func (m *FieldOptions) XXX_Size() int { + return xxx_messageInfo_FieldOptions.Size(m) +} +func (m *FieldOptions) XXX_DiscardUnknown() { + xxx_messageInfo_FieldOptions.DiscardUnknown(m) +} + +var xxx_messageInfo_FieldOptions proto.InternalMessageInfo + +const Default_FieldOptions_Ctype FieldOptions_CType = FieldOptions_STRING +const Default_FieldOptions_Jstype FieldOptions_JSType = FieldOptions_JS_NORMAL +const Default_FieldOptions_Lazy bool = false +const Default_FieldOptions_Deprecated bool = false +const Default_FieldOptions_Weak bool = false + +func (m *FieldOptions) GetCtype() FieldOptions_CType { + if m != nil && m.Ctype != nil { + return *m.Ctype + } + return Default_FieldOptions_Ctype +} + +func (m *FieldOptions) GetPacked() bool { + if m != nil && m.Packed != nil { + return *m.Packed + } + return false +} + +func (m *FieldOptions) GetJstype() FieldOptions_JSType { + if m != nil && m.Jstype != nil { + return *m.Jstype + } + return Default_FieldOptions_Jstype +} + +func (m *FieldOptions) GetLazy() bool { + if m != nil && m.Lazy != nil { + return *m.Lazy + } + return Default_FieldOptions_Lazy +} + +func (m *FieldOptions) GetDeprecated() bool { + if m != nil && m.Deprecated != nil { + return *m.Deprecated + } + return Default_FieldOptions_Deprecated +} + +func (m *FieldOptions) GetWeak() bool { + if m != nil && m.Weak != nil { + return *m.Weak + } + return Default_FieldOptions_Weak +} + +func (m *FieldOptions) GetUninterpretedOption() []*UninterpretedOption { + if m != nil { + return m.UninterpretedOption + } + return nil +} + +type OneofOptions struct { + // The parser stores options it doesn't recognize here. See above. + UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + proto.XXX_InternalExtensions `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *OneofOptions) Reset() { *m = OneofOptions{} } +func (m *OneofOptions) String() string { return proto.CompactTextString(m) } +func (*OneofOptions) ProtoMessage() {} +func (*OneofOptions) Descriptor() ([]byte, []int) { + return fileDescriptor_descriptor_9588782fb9cbecd6, []int{13} +} + +var extRange_OneofOptions = []proto.ExtensionRange{ + {Start: 1000, End: 536870911}, +} + +func (*OneofOptions) ExtensionRangeArray() []proto.ExtensionRange { + return extRange_OneofOptions +} +func (m *OneofOptions) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_OneofOptions.Unmarshal(m, b) +} +func (m *OneofOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_OneofOptions.Marshal(b, m, deterministic) +} +func (dst *OneofOptions) XXX_Merge(src proto.Message) { + xxx_messageInfo_OneofOptions.Merge(dst, src) +} +func (m *OneofOptions) XXX_Size() int { + return xxx_messageInfo_OneofOptions.Size(m) +} +func (m *OneofOptions) XXX_DiscardUnknown() { + xxx_messageInfo_OneofOptions.DiscardUnknown(m) +} + +var xxx_messageInfo_OneofOptions proto.InternalMessageInfo + +func (m *OneofOptions) GetUninterpretedOption() []*UninterpretedOption { + if m != nil { + return m.UninterpretedOption + } + return nil +} + +type EnumOptions struct { + // Set this option to true to allow mapping different tag names to the same + // value. + AllowAlias *bool `protobuf:"varint,2,opt,name=allow_alias,json=allowAlias" json:"allow_alias,omitempty"` + // Is this enum deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for the enum, or it will be completely ignored; in the very least, this + // is a formalization for deprecating enums. + Deprecated *bool `protobuf:"varint,3,opt,name=deprecated,def=0" json:"deprecated,omitempty"` + // The parser stores options it doesn't recognize here. See above. + UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + proto.XXX_InternalExtensions `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *EnumOptions) Reset() { *m = EnumOptions{} } +func (m *EnumOptions) String() string { return proto.CompactTextString(m) } +func (*EnumOptions) ProtoMessage() {} +func (*EnumOptions) Descriptor() ([]byte, []int) { + return fileDescriptor_descriptor_9588782fb9cbecd6, []int{14} +} + +var extRange_EnumOptions = []proto.ExtensionRange{ + {Start: 1000, End: 536870911}, +} + +func (*EnumOptions) ExtensionRangeArray() []proto.ExtensionRange { + return extRange_EnumOptions +} +func (m *EnumOptions) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_EnumOptions.Unmarshal(m, b) +} +func (m *EnumOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_EnumOptions.Marshal(b, m, deterministic) +} +func (dst *EnumOptions) XXX_Merge(src proto.Message) { + xxx_messageInfo_EnumOptions.Merge(dst, src) +} +func (m *EnumOptions) XXX_Size() int { + return xxx_messageInfo_EnumOptions.Size(m) +} +func (m *EnumOptions) XXX_DiscardUnknown() { + xxx_messageInfo_EnumOptions.DiscardUnknown(m) +} + +var xxx_messageInfo_EnumOptions proto.InternalMessageInfo + +const Default_EnumOptions_Deprecated bool = false + +func (m *EnumOptions) GetAllowAlias() bool { + if m != nil && m.AllowAlias != nil { + return *m.AllowAlias + } + return false +} + +func (m *EnumOptions) GetDeprecated() bool { + if m != nil && m.Deprecated != nil { + return *m.Deprecated + } + return Default_EnumOptions_Deprecated +} + +func (m *EnumOptions) GetUninterpretedOption() []*UninterpretedOption { + if m != nil { + return m.UninterpretedOption + } + return nil +} + +type EnumValueOptions struct { + // Is this enum value deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for the enum value, or it will be completely ignored; in the very least, + // this is a formalization for deprecating enum values. + Deprecated *bool `protobuf:"varint,1,opt,name=deprecated,def=0" json:"deprecated,omitempty"` + // The parser stores options it doesn't recognize here. See above. + UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + proto.XXX_InternalExtensions `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *EnumValueOptions) Reset() { *m = EnumValueOptions{} } +func (m *EnumValueOptions) String() string { return proto.CompactTextString(m) } +func (*EnumValueOptions) ProtoMessage() {} +func (*EnumValueOptions) Descriptor() ([]byte, []int) { + return fileDescriptor_descriptor_9588782fb9cbecd6, []int{15} +} + +var extRange_EnumValueOptions = []proto.ExtensionRange{ + {Start: 1000, End: 536870911}, +} + +func (*EnumValueOptions) ExtensionRangeArray() []proto.ExtensionRange { + return extRange_EnumValueOptions +} +func (m *EnumValueOptions) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_EnumValueOptions.Unmarshal(m, b) +} +func (m *EnumValueOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_EnumValueOptions.Marshal(b, m, deterministic) +} +func (dst *EnumValueOptions) XXX_Merge(src proto.Message) { + xxx_messageInfo_EnumValueOptions.Merge(dst, src) +} +func (m *EnumValueOptions) XXX_Size() int { + return xxx_messageInfo_EnumValueOptions.Size(m) +} +func (m *EnumValueOptions) XXX_DiscardUnknown() { + xxx_messageInfo_EnumValueOptions.DiscardUnknown(m) +} + +var xxx_messageInfo_EnumValueOptions proto.InternalMessageInfo + +const Default_EnumValueOptions_Deprecated bool = false + +func (m *EnumValueOptions) GetDeprecated() bool { + if m != nil && m.Deprecated != nil { + return *m.Deprecated + } + return Default_EnumValueOptions_Deprecated +} + +func (m *EnumValueOptions) GetUninterpretedOption() []*UninterpretedOption { + if m != nil { + return m.UninterpretedOption + } + return nil +} + +type ServiceOptions struct { + // Is this service deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for the service, or it will be completely ignored; in the very least, + // this is a formalization for deprecating services. + Deprecated *bool `protobuf:"varint,33,opt,name=deprecated,def=0" json:"deprecated,omitempty"` + // The parser stores options it doesn't recognize here. See above. + UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + proto.XXX_InternalExtensions `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ServiceOptions) Reset() { *m = ServiceOptions{} } +func (m *ServiceOptions) String() string { return proto.CompactTextString(m) } +func (*ServiceOptions) ProtoMessage() {} +func (*ServiceOptions) Descriptor() ([]byte, []int) { + return fileDescriptor_descriptor_9588782fb9cbecd6, []int{16} +} + +var extRange_ServiceOptions = []proto.ExtensionRange{ + {Start: 1000, End: 536870911}, +} + +func (*ServiceOptions) ExtensionRangeArray() []proto.ExtensionRange { + return extRange_ServiceOptions +} +func (m *ServiceOptions) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ServiceOptions.Unmarshal(m, b) +} +func (m *ServiceOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ServiceOptions.Marshal(b, m, deterministic) +} +func (dst *ServiceOptions) XXX_Merge(src proto.Message) { + xxx_messageInfo_ServiceOptions.Merge(dst, src) +} +func (m *ServiceOptions) XXX_Size() int { + return xxx_messageInfo_ServiceOptions.Size(m) +} +func (m *ServiceOptions) XXX_DiscardUnknown() { + xxx_messageInfo_ServiceOptions.DiscardUnknown(m) +} + +var xxx_messageInfo_ServiceOptions proto.InternalMessageInfo + +const Default_ServiceOptions_Deprecated bool = false + +func (m *ServiceOptions) GetDeprecated() bool { + if m != nil && m.Deprecated != nil { + return *m.Deprecated + } + return Default_ServiceOptions_Deprecated +} + +func (m *ServiceOptions) GetUninterpretedOption() []*UninterpretedOption { + if m != nil { + return m.UninterpretedOption + } + return nil +} + +type MethodOptions struct { + // Is this method deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for the method, or it will be completely ignored; in the very least, + // this is a formalization for deprecating methods. + Deprecated *bool `protobuf:"varint,33,opt,name=deprecated,def=0" json:"deprecated,omitempty"` + IdempotencyLevel *MethodOptions_IdempotencyLevel `protobuf:"varint,34,opt,name=idempotency_level,json=idempotencyLevel,enum=google.protobuf.MethodOptions_IdempotencyLevel,def=0" json:"idempotency_level,omitempty"` + // The parser stores options it doesn't recognize here. See above. + UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + proto.XXX_InternalExtensions `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *MethodOptions) Reset() { *m = MethodOptions{} } +func (m *MethodOptions) String() string { return proto.CompactTextString(m) } +func (*MethodOptions) ProtoMessage() {} +func (*MethodOptions) Descriptor() ([]byte, []int) { + return fileDescriptor_descriptor_9588782fb9cbecd6, []int{17} +} + +var extRange_MethodOptions = []proto.ExtensionRange{ + {Start: 1000, End: 536870911}, +} + +func (*MethodOptions) ExtensionRangeArray() []proto.ExtensionRange { + return extRange_MethodOptions +} +func (m *MethodOptions) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_MethodOptions.Unmarshal(m, b) +} +func (m *MethodOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_MethodOptions.Marshal(b, m, deterministic) +} +func (dst *MethodOptions) XXX_Merge(src proto.Message) { + xxx_messageInfo_MethodOptions.Merge(dst, src) +} +func (m *MethodOptions) XXX_Size() int { + return xxx_messageInfo_MethodOptions.Size(m) +} +func (m *MethodOptions) XXX_DiscardUnknown() { + xxx_messageInfo_MethodOptions.DiscardUnknown(m) +} + +var xxx_messageInfo_MethodOptions proto.InternalMessageInfo + +const Default_MethodOptions_Deprecated bool = false +const Default_MethodOptions_IdempotencyLevel MethodOptions_IdempotencyLevel = MethodOptions_IDEMPOTENCY_UNKNOWN + +func (m *MethodOptions) GetDeprecated() bool { + if m != nil && m.Deprecated != nil { + return *m.Deprecated + } + return Default_MethodOptions_Deprecated +} + +func (m *MethodOptions) GetIdempotencyLevel() MethodOptions_IdempotencyLevel { + if m != nil && m.IdempotencyLevel != nil { + return *m.IdempotencyLevel + } + return Default_MethodOptions_IdempotencyLevel +} + +func (m *MethodOptions) GetUninterpretedOption() []*UninterpretedOption { + if m != nil { + return m.UninterpretedOption + } + return nil +} + +// A message representing a option the parser does not recognize. This only +// appears in options protos created by the compiler::Parser class. +// DescriptorPool resolves these when building Descriptor objects. Therefore, +// options protos in descriptor objects (e.g. returned by Descriptor::options(), +// or produced by Descriptor::CopyTo()) will never have UninterpretedOptions +// in them. +type UninterpretedOption struct { + Name []*UninterpretedOption_NamePart `protobuf:"bytes,2,rep,name=name" json:"name,omitempty"` + // The value of the uninterpreted option, in whatever type the tokenizer + // identified it as during parsing. Exactly one of these should be set. + IdentifierValue *string `protobuf:"bytes,3,opt,name=identifier_value,json=identifierValue" json:"identifier_value,omitempty"` + PositiveIntValue *uint64 `protobuf:"varint,4,opt,name=positive_int_value,json=positiveIntValue" json:"positive_int_value,omitempty"` + NegativeIntValue *int64 `protobuf:"varint,5,opt,name=negative_int_value,json=negativeIntValue" json:"negative_int_value,omitempty"` + DoubleValue *float64 `protobuf:"fixed64,6,opt,name=double_value,json=doubleValue" json:"double_value,omitempty"` + StringValue []byte `protobuf:"bytes,7,opt,name=string_value,json=stringValue" json:"string_value,omitempty"` + AggregateValue *string `protobuf:"bytes,8,opt,name=aggregate_value,json=aggregateValue" json:"aggregate_value,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *UninterpretedOption) Reset() { *m = UninterpretedOption{} } +func (m *UninterpretedOption) String() string { return proto.CompactTextString(m) } +func (*UninterpretedOption) ProtoMessage() {} +func (*UninterpretedOption) Descriptor() ([]byte, []int) { + return fileDescriptor_descriptor_9588782fb9cbecd6, []int{18} +} +func (m *UninterpretedOption) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_UninterpretedOption.Unmarshal(m, b) +} +func (m *UninterpretedOption) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_UninterpretedOption.Marshal(b, m, deterministic) +} +func (dst *UninterpretedOption) XXX_Merge(src proto.Message) { + xxx_messageInfo_UninterpretedOption.Merge(dst, src) +} +func (m *UninterpretedOption) XXX_Size() int { + return xxx_messageInfo_UninterpretedOption.Size(m) +} +func (m *UninterpretedOption) XXX_DiscardUnknown() { + xxx_messageInfo_UninterpretedOption.DiscardUnknown(m) +} + +var xxx_messageInfo_UninterpretedOption proto.InternalMessageInfo + +func (m *UninterpretedOption) GetName() []*UninterpretedOption_NamePart { + if m != nil { + return m.Name + } + return nil +} + +func (m *UninterpretedOption) GetIdentifierValue() string { + if m != nil && m.IdentifierValue != nil { + return *m.IdentifierValue + } + return "" +} + +func (m *UninterpretedOption) GetPositiveIntValue() uint64 { + if m != nil && m.PositiveIntValue != nil { + return *m.PositiveIntValue + } + return 0 +} + +func (m *UninterpretedOption) GetNegativeIntValue() int64 { + if m != nil && m.NegativeIntValue != nil { + return *m.NegativeIntValue + } + return 0 +} + +func (m *UninterpretedOption) GetDoubleValue() float64 { + if m != nil && m.DoubleValue != nil { + return *m.DoubleValue + } + return 0 +} + +func (m *UninterpretedOption) GetStringValue() []byte { + if m != nil { + return m.StringValue + } + return nil +} + +func (m *UninterpretedOption) GetAggregateValue() string { + if m != nil && m.AggregateValue != nil { + return *m.AggregateValue + } + return "" +} + +// The name of the uninterpreted option. Each string represents a segment in +// a dot-separated name. is_extension is true iff a segment represents an +// extension (denoted with parentheses in options specs in .proto files). +// E.g.,{ ["foo", false], ["bar.baz", true], ["qux", false] } represents +// "foo.(bar.baz).qux". +type UninterpretedOption_NamePart struct { + NamePart *string `protobuf:"bytes,1,req,name=name_part,json=namePart" json:"name_part,omitempty"` + IsExtension *bool `protobuf:"varint,2,req,name=is_extension,json=isExtension" json:"is_extension,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *UninterpretedOption_NamePart) Reset() { *m = UninterpretedOption_NamePart{} } +func (m *UninterpretedOption_NamePart) String() string { return proto.CompactTextString(m) } +func (*UninterpretedOption_NamePart) ProtoMessage() {} +func (*UninterpretedOption_NamePart) Descriptor() ([]byte, []int) { + return fileDescriptor_descriptor_9588782fb9cbecd6, []int{18, 0} +} +func (m *UninterpretedOption_NamePart) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_UninterpretedOption_NamePart.Unmarshal(m, b) +} +func (m *UninterpretedOption_NamePart) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_UninterpretedOption_NamePart.Marshal(b, m, deterministic) +} +func (dst *UninterpretedOption_NamePart) XXX_Merge(src proto.Message) { + xxx_messageInfo_UninterpretedOption_NamePart.Merge(dst, src) +} +func (m *UninterpretedOption_NamePart) XXX_Size() int { + return xxx_messageInfo_UninterpretedOption_NamePart.Size(m) +} +func (m *UninterpretedOption_NamePart) XXX_DiscardUnknown() { + xxx_messageInfo_UninterpretedOption_NamePart.DiscardUnknown(m) +} + +var xxx_messageInfo_UninterpretedOption_NamePart proto.InternalMessageInfo + +func (m *UninterpretedOption_NamePart) GetNamePart() string { + if m != nil && m.NamePart != nil { + return *m.NamePart + } + return "" +} + +func (m *UninterpretedOption_NamePart) GetIsExtension() bool { + if m != nil && m.IsExtension != nil { + return *m.IsExtension + } + return false +} + +// Encapsulates information about the original source file from which a +// FileDescriptorProto was generated. +type SourceCodeInfo struct { + // A Location identifies a piece of source code in a .proto file which + // corresponds to a particular definition. This information is intended + // to be useful to IDEs, code indexers, documentation generators, and similar + // tools. + // + // For example, say we have a file like: + // message Foo { + // optional string foo = 1; + // } + // Let's look at just the field definition: + // optional string foo = 1; + // ^ ^^ ^^ ^ ^^^ + // a bc de f ghi + // We have the following locations: + // span path represents + // [a,i) [ 4, 0, 2, 0 ] The whole field definition. + // [a,b) [ 4, 0, 2, 0, 4 ] The label (optional). + // [c,d) [ 4, 0, 2, 0, 5 ] The type (string). + // [e,f) [ 4, 0, 2, 0, 1 ] The name (foo). + // [g,h) [ 4, 0, 2, 0, 3 ] The number (1). + // + // Notes: + // - A location may refer to a repeated field itself (i.e. not to any + // particular index within it). This is used whenever a set of elements are + // logically enclosed in a single code segment. For example, an entire + // extend block (possibly containing multiple extension definitions) will + // have an outer location whose path refers to the "extensions" repeated + // field without an index. + // - Multiple locations may have the same path. This happens when a single + // logical declaration is spread out across multiple places. The most + // obvious example is the "extend" block again -- there may be multiple + // extend blocks in the same scope, each of which will have the same path. + // - A location's span is not always a subset of its parent's span. For + // example, the "extendee" of an extension declaration appears at the + // beginning of the "extend" block and is shared by all extensions within + // the block. + // - Just because a location's span is a subset of some other location's span + // does not mean that it is a descendent. For example, a "group" defines + // both a type and a field in a single declaration. Thus, the locations + // corresponding to the type and field and their components will overlap. + // - Code which tries to interpret locations should probably be designed to + // ignore those that it doesn't understand, as more types of locations could + // be recorded in the future. + Location []*SourceCodeInfo_Location `protobuf:"bytes,1,rep,name=location" json:"location,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SourceCodeInfo) Reset() { *m = SourceCodeInfo{} } +func (m *SourceCodeInfo) String() string { return proto.CompactTextString(m) } +func (*SourceCodeInfo) ProtoMessage() {} +func (*SourceCodeInfo) Descriptor() ([]byte, []int) { + return fileDescriptor_descriptor_9588782fb9cbecd6, []int{19} +} +func (m *SourceCodeInfo) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_SourceCodeInfo.Unmarshal(m, b) +} +func (m *SourceCodeInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_SourceCodeInfo.Marshal(b, m, deterministic) +} +func (dst *SourceCodeInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_SourceCodeInfo.Merge(dst, src) +} +func (m *SourceCodeInfo) XXX_Size() int { + return xxx_messageInfo_SourceCodeInfo.Size(m) +} +func (m *SourceCodeInfo) XXX_DiscardUnknown() { + xxx_messageInfo_SourceCodeInfo.DiscardUnknown(m) +} + +var xxx_messageInfo_SourceCodeInfo proto.InternalMessageInfo + +func (m *SourceCodeInfo) GetLocation() []*SourceCodeInfo_Location { + if m != nil { + return m.Location + } + return nil +} + +type SourceCodeInfo_Location struct { + // Identifies which part of the FileDescriptorProto was defined at this + // location. + // + // Each element is a field number or an index. They form a path from + // the root FileDescriptorProto to the place where the definition. For + // example, this path: + // [ 4, 3, 2, 7, 1 ] + // refers to: + // file.message_type(3) // 4, 3 + // .field(7) // 2, 7 + // .name() // 1 + // This is because FileDescriptorProto.message_type has field number 4: + // repeated DescriptorProto message_type = 4; + // and DescriptorProto.field has field number 2: + // repeated FieldDescriptorProto field = 2; + // and FieldDescriptorProto.name has field number 1: + // optional string name = 1; + // + // Thus, the above path gives the location of a field name. If we removed + // the last element: + // [ 4, 3, 2, 7 ] + // this path refers to the whole field declaration (from the beginning + // of the label to the terminating semicolon). + Path []int32 `protobuf:"varint,1,rep,packed,name=path" json:"path,omitempty"` + // Always has exactly three or four elements: start line, start column, + // end line (optional, otherwise assumed same as start line), end column. + // These are packed into a single field for efficiency. Note that line + // and column numbers are zero-based -- typically you will want to add + // 1 to each before displaying to a user. + Span []int32 `protobuf:"varint,2,rep,packed,name=span" json:"span,omitempty"` + // If this SourceCodeInfo represents a complete declaration, these are any + // comments appearing before and after the declaration which appear to be + // attached to the declaration. + // + // A series of line comments appearing on consecutive lines, with no other + // tokens appearing on those lines, will be treated as a single comment. + // + // leading_detached_comments will keep paragraphs of comments that appear + // before (but not connected to) the current element. Each paragraph, + // separated by empty lines, will be one comment element in the repeated + // field. + // + // Only the comment content is provided; comment markers (e.g. //) are + // stripped out. For block comments, leading whitespace and an asterisk + // will be stripped from the beginning of each line other than the first. + // Newlines are included in the output. + // + // Examples: + // + // optional int32 foo = 1; // Comment attached to foo. + // // Comment attached to bar. + // optional int32 bar = 2; + // + // optional string baz = 3; + // // Comment attached to baz. + // // Another line attached to baz. + // + // // Comment attached to qux. + // // + // // Another line attached to qux. + // optional double qux = 4; + // + // // Detached comment for corge. This is not leading or trailing comments + // // to qux or corge because there are blank lines separating it from + // // both. + // + // // Detached comment for corge paragraph 2. + // + // optional string corge = 5; + // /* Block comment attached + // * to corge. Leading asterisks + // * will be removed. */ + // /* Block comment attached to + // * grault. */ + // optional int32 grault = 6; + // + // // ignored detached comments. + LeadingComments *string `protobuf:"bytes,3,opt,name=leading_comments,json=leadingComments" json:"leading_comments,omitempty"` + TrailingComments *string `protobuf:"bytes,4,opt,name=trailing_comments,json=trailingComments" json:"trailing_comments,omitempty"` + LeadingDetachedComments []string `protobuf:"bytes,6,rep,name=leading_detached_comments,json=leadingDetachedComments" json:"leading_detached_comments,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SourceCodeInfo_Location) Reset() { *m = SourceCodeInfo_Location{} } +func (m *SourceCodeInfo_Location) String() string { return proto.CompactTextString(m) } +func (*SourceCodeInfo_Location) ProtoMessage() {} +func (*SourceCodeInfo_Location) Descriptor() ([]byte, []int) { + return fileDescriptor_descriptor_9588782fb9cbecd6, []int{19, 0} +} +func (m *SourceCodeInfo_Location) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_SourceCodeInfo_Location.Unmarshal(m, b) +} +func (m *SourceCodeInfo_Location) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_SourceCodeInfo_Location.Marshal(b, m, deterministic) +} +func (dst *SourceCodeInfo_Location) XXX_Merge(src proto.Message) { + xxx_messageInfo_SourceCodeInfo_Location.Merge(dst, src) +} +func (m *SourceCodeInfo_Location) XXX_Size() int { + return xxx_messageInfo_SourceCodeInfo_Location.Size(m) +} +func (m *SourceCodeInfo_Location) XXX_DiscardUnknown() { + xxx_messageInfo_SourceCodeInfo_Location.DiscardUnknown(m) +} + +var xxx_messageInfo_SourceCodeInfo_Location proto.InternalMessageInfo + +func (m *SourceCodeInfo_Location) GetPath() []int32 { + if m != nil { + return m.Path + } + return nil +} + +func (m *SourceCodeInfo_Location) GetSpan() []int32 { + if m != nil { + return m.Span + } + return nil +} + +func (m *SourceCodeInfo_Location) GetLeadingComments() string { + if m != nil && m.LeadingComments != nil { + return *m.LeadingComments + } + return "" +} + +func (m *SourceCodeInfo_Location) GetTrailingComments() string { + if m != nil && m.TrailingComments != nil { + return *m.TrailingComments + } + return "" +} + +func (m *SourceCodeInfo_Location) GetLeadingDetachedComments() []string { + if m != nil { + return m.LeadingDetachedComments + } + return nil +} + +// Describes the relationship between generated code and its original source +// file. A GeneratedCodeInfo message is associated with only one generated +// source file, but may contain references to different source .proto files. +type GeneratedCodeInfo struct { + // An Annotation connects some span of text in generated code to an element + // of its generating .proto file. + Annotation []*GeneratedCodeInfo_Annotation `protobuf:"bytes,1,rep,name=annotation" json:"annotation,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GeneratedCodeInfo) Reset() { *m = GeneratedCodeInfo{} } +func (m *GeneratedCodeInfo) String() string { return proto.CompactTextString(m) } +func (*GeneratedCodeInfo) ProtoMessage() {} +func (*GeneratedCodeInfo) Descriptor() ([]byte, []int) { + return fileDescriptor_descriptor_9588782fb9cbecd6, []int{20} +} +func (m *GeneratedCodeInfo) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GeneratedCodeInfo.Unmarshal(m, b) +} +func (m *GeneratedCodeInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GeneratedCodeInfo.Marshal(b, m, deterministic) +} +func (dst *GeneratedCodeInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_GeneratedCodeInfo.Merge(dst, src) +} +func (m *GeneratedCodeInfo) XXX_Size() int { + return xxx_messageInfo_GeneratedCodeInfo.Size(m) +} +func (m *GeneratedCodeInfo) XXX_DiscardUnknown() { + xxx_messageInfo_GeneratedCodeInfo.DiscardUnknown(m) +} + +var xxx_messageInfo_GeneratedCodeInfo proto.InternalMessageInfo + +func (m *GeneratedCodeInfo) GetAnnotation() []*GeneratedCodeInfo_Annotation { + if m != nil { + return m.Annotation + } + return nil +} + +type GeneratedCodeInfo_Annotation struct { + // Identifies the element in the original source .proto file. This field + // is formatted the same as SourceCodeInfo.Location.path. + Path []int32 `protobuf:"varint,1,rep,packed,name=path" json:"path,omitempty"` + // Identifies the filesystem path to the original source .proto. + SourceFile *string `protobuf:"bytes,2,opt,name=source_file,json=sourceFile" json:"source_file,omitempty"` + // Identifies the starting offset in bytes in the generated code + // that relates to the identified object. + Begin *int32 `protobuf:"varint,3,opt,name=begin" json:"begin,omitempty"` + // Identifies the ending offset in bytes in the generated code that + // relates to the identified offset. The end offset should be one past + // the last relevant byte (so the length of the text = end - begin). + End *int32 `protobuf:"varint,4,opt,name=end" json:"end,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GeneratedCodeInfo_Annotation) Reset() { *m = GeneratedCodeInfo_Annotation{} } +func (m *GeneratedCodeInfo_Annotation) String() string { return proto.CompactTextString(m) } +func (*GeneratedCodeInfo_Annotation) ProtoMessage() {} +func (*GeneratedCodeInfo_Annotation) Descriptor() ([]byte, []int) { + return fileDescriptor_descriptor_9588782fb9cbecd6, []int{20, 0} +} +func (m *GeneratedCodeInfo_Annotation) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GeneratedCodeInfo_Annotation.Unmarshal(m, b) +} +func (m *GeneratedCodeInfo_Annotation) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GeneratedCodeInfo_Annotation.Marshal(b, m, deterministic) +} +func (dst *GeneratedCodeInfo_Annotation) XXX_Merge(src proto.Message) { + xxx_messageInfo_GeneratedCodeInfo_Annotation.Merge(dst, src) +} +func (m *GeneratedCodeInfo_Annotation) XXX_Size() int { + return xxx_messageInfo_GeneratedCodeInfo_Annotation.Size(m) +} +func (m *GeneratedCodeInfo_Annotation) XXX_DiscardUnknown() { + xxx_messageInfo_GeneratedCodeInfo_Annotation.DiscardUnknown(m) +} + +var xxx_messageInfo_GeneratedCodeInfo_Annotation proto.InternalMessageInfo + +func (m *GeneratedCodeInfo_Annotation) GetPath() []int32 { + if m != nil { + return m.Path + } + return nil +} + +func (m *GeneratedCodeInfo_Annotation) GetSourceFile() string { + if m != nil && m.SourceFile != nil { + return *m.SourceFile + } + return "" +} + +func (m *GeneratedCodeInfo_Annotation) GetBegin() int32 { + if m != nil && m.Begin != nil { + return *m.Begin + } + return 0 +} + +func (m *GeneratedCodeInfo_Annotation) GetEnd() int32 { + if m != nil && m.End != nil { + return *m.End + } + return 0 +} + +func init() { + proto.RegisterType((*FileDescriptorSet)(nil), "google.protobuf.FileDescriptorSet") + proto.RegisterType((*FileDescriptorProto)(nil), "google.protobuf.FileDescriptorProto") + proto.RegisterType((*DescriptorProto)(nil), "google.protobuf.DescriptorProto") + proto.RegisterType((*DescriptorProto_ExtensionRange)(nil), "google.protobuf.DescriptorProto.ExtensionRange") + proto.RegisterType((*DescriptorProto_ReservedRange)(nil), "google.protobuf.DescriptorProto.ReservedRange") + proto.RegisterType((*ExtensionRangeOptions)(nil), "google.protobuf.ExtensionRangeOptions") + proto.RegisterType((*FieldDescriptorProto)(nil), "google.protobuf.FieldDescriptorProto") + proto.RegisterType((*OneofDescriptorProto)(nil), "google.protobuf.OneofDescriptorProto") + proto.RegisterType((*EnumDescriptorProto)(nil), "google.protobuf.EnumDescriptorProto") + proto.RegisterType((*EnumDescriptorProto_EnumReservedRange)(nil), "google.protobuf.EnumDescriptorProto.EnumReservedRange") + proto.RegisterType((*EnumValueDescriptorProto)(nil), "google.protobuf.EnumValueDescriptorProto") + proto.RegisterType((*ServiceDescriptorProto)(nil), "google.protobuf.ServiceDescriptorProto") + proto.RegisterType((*MethodDescriptorProto)(nil), "google.protobuf.MethodDescriptorProto") + proto.RegisterType((*FileOptions)(nil), "google.protobuf.FileOptions") + proto.RegisterType((*MessageOptions)(nil), "google.protobuf.MessageOptions") + proto.RegisterType((*FieldOptions)(nil), "google.protobuf.FieldOptions") + proto.RegisterType((*OneofOptions)(nil), "google.protobuf.OneofOptions") + proto.RegisterType((*EnumOptions)(nil), "google.protobuf.EnumOptions") + proto.RegisterType((*EnumValueOptions)(nil), "google.protobuf.EnumValueOptions") + proto.RegisterType((*ServiceOptions)(nil), "google.protobuf.ServiceOptions") + proto.RegisterType((*MethodOptions)(nil), "google.protobuf.MethodOptions") + proto.RegisterType((*UninterpretedOption)(nil), "google.protobuf.UninterpretedOption") + proto.RegisterType((*UninterpretedOption_NamePart)(nil), "google.protobuf.UninterpretedOption.NamePart") + proto.RegisterType((*SourceCodeInfo)(nil), "google.protobuf.SourceCodeInfo") + proto.RegisterType((*SourceCodeInfo_Location)(nil), "google.protobuf.SourceCodeInfo.Location") + proto.RegisterType((*GeneratedCodeInfo)(nil), "google.protobuf.GeneratedCodeInfo") + proto.RegisterType((*GeneratedCodeInfo_Annotation)(nil), "google.protobuf.GeneratedCodeInfo.Annotation") + proto.RegisterEnum("google.protobuf.FieldDescriptorProto_Type", FieldDescriptorProto_Type_name, FieldDescriptorProto_Type_value) + proto.RegisterEnum("google.protobuf.FieldDescriptorProto_Label", FieldDescriptorProto_Label_name, FieldDescriptorProto_Label_value) + proto.RegisterEnum("google.protobuf.FileOptions_OptimizeMode", FileOptions_OptimizeMode_name, FileOptions_OptimizeMode_value) + proto.RegisterEnum("google.protobuf.FieldOptions_CType", FieldOptions_CType_name, FieldOptions_CType_value) + proto.RegisterEnum("google.protobuf.FieldOptions_JSType", FieldOptions_JSType_name, FieldOptions_JSType_value) + proto.RegisterEnum("google.protobuf.MethodOptions_IdempotencyLevel", MethodOptions_IdempotencyLevel_name, MethodOptions_IdempotencyLevel_value) +} + +func init() { proto.RegisterFile("descriptor.proto", fileDescriptor_descriptor_9588782fb9cbecd6) } + +var fileDescriptor_descriptor_9588782fb9cbecd6 = []byte{ + // 2487 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x59, 0xcd, 0x6f, 0xdb, 0xc8, + 0x15, 0x5f, 0x7d, 0x5a, 0x7a, 0x92, 0xe5, 0xf1, 0xd8, 0x9b, 0x30, 0xde, 0x8f, 0x38, 0xda, 0x8f, + 0x38, 0x49, 0xab, 0x2c, 0x9c, 0xc4, 0xc9, 0x3a, 0xc5, 0xb6, 0xb2, 0xc4, 0x78, 0x95, 0xca, 0x92, + 0x4a, 0xc9, 0xdd, 0x64, 0x8b, 0x82, 0x18, 0x93, 0x23, 0x89, 0x09, 0x45, 0x72, 0x49, 0x2a, 0x89, + 0x83, 0x1e, 0x02, 0xf4, 0xd4, 0xff, 0xa0, 0x28, 0x8a, 0x1e, 0x7a, 0x59, 0xa0, 0xd7, 0x02, 0x05, + 0xda, 0x7b, 0xaf, 0x05, 0x7a, 0xef, 0xa1, 0x40, 0x0b, 0xb4, 0x7f, 0x42, 0x8f, 0xc5, 0xcc, 0x90, + 0x14, 0xf5, 0x95, 0x78, 0x17, 0x48, 0xf6, 0x64, 0xcf, 0xef, 0xfd, 0xde, 0xe3, 0x9b, 0x37, 0x6f, + 0xde, 0xbc, 0x19, 0x01, 0xd2, 0xa9, 0xa7, 0xb9, 0x86, 0xe3, 0xdb, 0x6e, 0xc5, 0x71, 0x6d, 0xdf, + 0xc6, 0x6b, 0x03, 0xdb, 0x1e, 0x98, 0x54, 0x8c, 0x4e, 0xc6, 0xfd, 0xf2, 0x11, 0xac, 0xdf, 0x33, + 0x4c, 0x5a, 0x8f, 0x88, 0x5d, 0xea, 0xe3, 0x3b, 0x90, 0xee, 0x1b, 0x26, 0x95, 0x12, 0xdb, 0xa9, + 0x9d, 0xc2, 0xee, 0x87, 0x95, 0x19, 0xa5, 0xca, 0xb4, 0x46, 0x87, 0xc1, 0x0a, 0xd7, 0x28, 0xff, + 0x3b, 0x0d, 0x1b, 0x0b, 0xa4, 0x18, 0x43, 0xda, 0x22, 0x23, 0x66, 0x31, 0xb1, 0x93, 0x57, 0xf8, + 0xff, 0x58, 0x82, 0x15, 0x87, 0x68, 0x8f, 0xc9, 0x80, 0x4a, 0x49, 0x0e, 0x87, 0x43, 0xfc, 0x3e, + 0x80, 0x4e, 0x1d, 0x6a, 0xe9, 0xd4, 0xd2, 0x4e, 0xa5, 0xd4, 0x76, 0x6a, 0x27, 0xaf, 0xc4, 0x10, + 0x7c, 0x0d, 0xd6, 0x9d, 0xf1, 0x89, 0x69, 0x68, 0x6a, 0x8c, 0x06, 0xdb, 0xa9, 0x9d, 0x8c, 0x82, + 0x84, 0xa0, 0x3e, 0x21, 0x5f, 0x86, 0xb5, 0xa7, 0x94, 0x3c, 0x8e, 0x53, 0x0b, 0x9c, 0x5a, 0x62, + 0x70, 0x8c, 0x58, 0x83, 0xe2, 0x88, 0x7a, 0x1e, 0x19, 0x50, 0xd5, 0x3f, 0x75, 0xa8, 0x94, 0xe6, + 0xb3, 0xdf, 0x9e, 0x9b, 0xfd, 0xec, 0xcc, 0x0b, 0x81, 0x56, 0xef, 0xd4, 0xa1, 0xb8, 0x0a, 0x79, + 0x6a, 0x8d, 0x47, 0xc2, 0x42, 0x66, 0x49, 0xfc, 0x64, 0x6b, 0x3c, 0x9a, 0xb5, 0x92, 0x63, 0x6a, + 0x81, 0x89, 0x15, 0x8f, 0xba, 0x4f, 0x0c, 0x8d, 0x4a, 0x59, 0x6e, 0xe0, 0xf2, 0x9c, 0x81, 0xae, + 0x90, 0xcf, 0xda, 0x08, 0xf5, 0x70, 0x0d, 0xf2, 0xf4, 0x99, 0x4f, 0x2d, 0xcf, 0xb0, 0x2d, 0x69, + 0x85, 0x1b, 0xf9, 0x68, 0xc1, 0x2a, 0x52, 0x53, 0x9f, 0x35, 0x31, 0xd1, 0xc3, 0x7b, 0xb0, 0x62, + 0x3b, 0xbe, 0x61, 0x5b, 0x9e, 0x94, 0xdb, 0x4e, 0xec, 0x14, 0x76, 0xdf, 0x5d, 0x98, 0x08, 0x6d, + 0xc1, 0x51, 0x42, 0x32, 0x6e, 0x00, 0xf2, 0xec, 0xb1, 0xab, 0x51, 0x55, 0xb3, 0x75, 0xaa, 0x1a, + 0x56, 0xdf, 0x96, 0xf2, 0xdc, 0xc0, 0xc5, 0xf9, 0x89, 0x70, 0x62, 0xcd, 0xd6, 0x69, 0xc3, 0xea, + 0xdb, 0x4a, 0xc9, 0x9b, 0x1a, 0xe3, 0x73, 0x90, 0xf5, 0x4e, 0x2d, 0x9f, 0x3c, 0x93, 0x8a, 0x3c, + 0x43, 0x82, 0x51, 0xf9, 0xcf, 0x59, 0x58, 0x3b, 0x4b, 0x8a, 0xdd, 0x85, 0x4c, 0x9f, 0xcd, 0x52, + 0x4a, 0x7e, 0x93, 0x18, 0x08, 0x9d, 0xe9, 0x20, 0x66, 0xbf, 0x65, 0x10, 0xab, 0x50, 0xb0, 0xa8, + 0xe7, 0x53, 0x5d, 0x64, 0x44, 0xea, 0x8c, 0x39, 0x05, 0x42, 0x69, 0x3e, 0xa5, 0xd2, 0xdf, 0x2a, + 0xa5, 0x1e, 0xc0, 0x5a, 0xe4, 0x92, 0xea, 0x12, 0x6b, 0x10, 0xe6, 0xe6, 0xf5, 0x57, 0x79, 0x52, + 0x91, 0x43, 0x3d, 0x85, 0xa9, 0x29, 0x25, 0x3a, 0x35, 0xc6, 0x75, 0x00, 0xdb, 0xa2, 0x76, 0x5f, + 0xd5, 0xa9, 0x66, 0x4a, 0xb9, 0x25, 0x51, 0x6a, 0x33, 0xca, 0x5c, 0x94, 0x6c, 0x81, 0x6a, 0x26, + 0xfe, 0x74, 0x92, 0x6a, 0x2b, 0x4b, 0x32, 0xe5, 0x48, 0x6c, 0xb2, 0xb9, 0x6c, 0x3b, 0x86, 0x92, + 0x4b, 0x59, 0xde, 0x53, 0x3d, 0x98, 0x59, 0x9e, 0x3b, 0x51, 0x79, 0xe5, 0xcc, 0x94, 0x40, 0x4d, + 0x4c, 0x6c, 0xd5, 0x8d, 0x0f, 0xf1, 0x07, 0x10, 0x01, 0x2a, 0x4f, 0x2b, 0xe0, 0x55, 0xa8, 0x18, + 0x82, 0x2d, 0x32, 0xa2, 0x5b, 0xcf, 0xa1, 0x34, 0x1d, 0x1e, 0xbc, 0x09, 0x19, 0xcf, 0x27, 0xae, + 0xcf, 0xb3, 0x30, 0xa3, 0x88, 0x01, 0x46, 0x90, 0xa2, 0x96, 0xce, 0xab, 0x5c, 0x46, 0x61, 0xff, + 0xe2, 0x1f, 0x4d, 0x26, 0x9c, 0xe2, 0x13, 0xfe, 0x78, 0x7e, 0x45, 0xa7, 0x2c, 0xcf, 0xce, 0x7b, + 0xeb, 0x36, 0xac, 0x4e, 0x4d, 0xe0, 0xac, 0x9f, 0x2e, 0xff, 0x02, 0xde, 0x5e, 0x68, 0x1a, 0x3f, + 0x80, 0xcd, 0xb1, 0x65, 0x58, 0x3e, 0x75, 0x1d, 0x97, 0xb2, 0x8c, 0x15, 0x9f, 0x92, 0xfe, 0xb3, + 0xb2, 0x24, 0xe7, 0x8e, 0xe3, 0x6c, 0x61, 0x45, 0xd9, 0x18, 0xcf, 0x83, 0x57, 0xf3, 0xb9, 0xff, + 0xae, 0xa0, 0x17, 0x2f, 0x5e, 0xbc, 0x48, 0x96, 0x7f, 0x9d, 0x85, 0xcd, 0x45, 0x7b, 0x66, 0xe1, + 0xf6, 0x3d, 0x07, 0x59, 0x6b, 0x3c, 0x3a, 0xa1, 0x2e, 0x0f, 0x52, 0x46, 0x09, 0x46, 0xb8, 0x0a, + 0x19, 0x93, 0x9c, 0x50, 0x53, 0x4a, 0x6f, 0x27, 0x76, 0x4a, 0xbb, 0xd7, 0xce, 0xb4, 0x2b, 0x2b, + 0x4d, 0xa6, 0xa2, 0x08, 0x4d, 0xfc, 0x19, 0xa4, 0x83, 0x12, 0xcd, 0x2c, 0x5c, 0x3d, 0x9b, 0x05, + 0xb6, 0x97, 0x14, 0xae, 0x87, 0xdf, 0x81, 0x3c, 0xfb, 0x2b, 0x72, 0x23, 0xcb, 0x7d, 0xce, 0x31, + 0x80, 0xe5, 0x05, 0xde, 0x82, 0x1c, 0xdf, 0x26, 0x3a, 0x0d, 0x8f, 0xb6, 0x68, 0xcc, 0x12, 0x4b, + 0xa7, 0x7d, 0x32, 0x36, 0x7d, 0xf5, 0x09, 0x31, 0xc7, 0x94, 0x27, 0x7c, 0x5e, 0x29, 0x06, 0xe0, + 0x4f, 0x19, 0x86, 0x2f, 0x42, 0x41, 0xec, 0x2a, 0xc3, 0xd2, 0xe9, 0x33, 0x5e, 0x3d, 0x33, 0x8a, + 0xd8, 0x68, 0x0d, 0x86, 0xb0, 0xcf, 0x3f, 0xf2, 0x6c, 0x2b, 0x4c, 0x4d, 0xfe, 0x09, 0x06, 0xf0, + 0xcf, 0xdf, 0x9e, 0x2d, 0xdc, 0xef, 0x2d, 0x9e, 0xde, 0x6c, 0x4e, 0x95, 0xff, 0x94, 0x84, 0x34, + 0xaf, 0x17, 0x6b, 0x50, 0xe8, 0x3d, 0xec, 0xc8, 0x6a, 0xbd, 0x7d, 0x7c, 0xd0, 0x94, 0x51, 0x02, + 0x97, 0x00, 0x38, 0x70, 0xaf, 0xd9, 0xae, 0xf6, 0x50, 0x32, 0x1a, 0x37, 0x5a, 0xbd, 0xbd, 0x9b, + 0x28, 0x15, 0x29, 0x1c, 0x0b, 0x20, 0x1d, 0x27, 0xdc, 0xd8, 0x45, 0x19, 0x8c, 0xa0, 0x28, 0x0c, + 0x34, 0x1e, 0xc8, 0xf5, 0xbd, 0x9b, 0x28, 0x3b, 0x8d, 0xdc, 0xd8, 0x45, 0x2b, 0x78, 0x15, 0xf2, + 0x1c, 0x39, 0x68, 0xb7, 0x9b, 0x28, 0x17, 0xd9, 0xec, 0xf6, 0x94, 0x46, 0xeb, 0x10, 0xe5, 0x23, + 0x9b, 0x87, 0x4a, 0xfb, 0xb8, 0x83, 0x20, 0xb2, 0x70, 0x24, 0x77, 0xbb, 0xd5, 0x43, 0x19, 0x15, + 0x22, 0xc6, 0xc1, 0xc3, 0x9e, 0xdc, 0x45, 0xc5, 0x29, 0xb7, 0x6e, 0xec, 0xa2, 0xd5, 0xe8, 0x13, + 0x72, 0xeb, 0xf8, 0x08, 0x95, 0xf0, 0x3a, 0xac, 0x8a, 0x4f, 0x84, 0x4e, 0xac, 0xcd, 0x40, 0x7b, + 0x37, 0x11, 0x9a, 0x38, 0x22, 0xac, 0xac, 0x4f, 0x01, 0x7b, 0x37, 0x11, 0x2e, 0xd7, 0x20, 0xc3, + 0xb3, 0x0b, 0x63, 0x28, 0x35, 0xab, 0x07, 0x72, 0x53, 0x6d, 0x77, 0x7a, 0x8d, 0x76, 0xab, 0xda, + 0x44, 0x89, 0x09, 0xa6, 0xc8, 0x3f, 0x39, 0x6e, 0x28, 0x72, 0x1d, 0x25, 0xe3, 0x58, 0x47, 0xae, + 0xf6, 0xe4, 0x3a, 0x4a, 0x95, 0x35, 0xd8, 0x5c, 0x54, 0x27, 0x17, 0xee, 0x8c, 0xd8, 0x12, 0x27, + 0x97, 0x2c, 0x31, 0xb7, 0x35, 0xb7, 0xc4, 0xff, 0x4a, 0xc2, 0xc6, 0x82, 0xb3, 0x62, 0xe1, 0x47, + 0x7e, 0x08, 0x19, 0x91, 0xa2, 0xe2, 0xf4, 0xbc, 0xb2, 0xf0, 0xd0, 0xe1, 0x09, 0x3b, 0x77, 0x82, + 0x72, 0xbd, 0x78, 0x07, 0x91, 0x5a, 0xd2, 0x41, 0x30, 0x13, 0x73, 0x35, 0xfd, 0xe7, 0x73, 0x35, + 0x5d, 0x1c, 0x7b, 0x7b, 0x67, 0x39, 0xf6, 0x38, 0xf6, 0xcd, 0x6a, 0x7b, 0x66, 0x41, 0x6d, 0xbf, + 0x0b, 0xeb, 0x73, 0x86, 0xce, 0x5c, 0x63, 0x7f, 0x99, 0x00, 0x69, 0x59, 0x70, 0x5e, 0x51, 0xe9, + 0x92, 0x53, 0x95, 0xee, 0xee, 0x6c, 0x04, 0x2f, 0x2d, 0x5f, 0x84, 0xb9, 0xb5, 0xfe, 0x3a, 0x01, + 0xe7, 0x16, 0x77, 0x8a, 0x0b, 0x7d, 0xf8, 0x0c, 0xb2, 0x23, 0xea, 0x0f, 0xed, 0xb0, 0x5b, 0xfa, + 0x78, 0xc1, 0x19, 0xcc, 0xc4, 0xb3, 0x8b, 0x1d, 0x68, 0xc5, 0x0f, 0xf1, 0xd4, 0xb2, 0x76, 0x4f, + 0x78, 0x33, 0xe7, 0xe9, 0xaf, 0x92, 0xf0, 0xf6, 0x42, 0xe3, 0x0b, 0x1d, 0x7d, 0x0f, 0xc0, 0xb0, + 0x9c, 0xb1, 0x2f, 0x3a, 0x22, 0x51, 0x60, 0xf3, 0x1c, 0xe1, 0xc5, 0x8b, 0x15, 0xcf, 0xb1, 0x1f, + 0xc9, 0x53, 0x5c, 0x0e, 0x02, 0xe2, 0x84, 0x3b, 0x13, 0x47, 0xd3, 0xdc, 0xd1, 0xf7, 0x97, 0xcc, + 0x74, 0x2e, 0x31, 0x3f, 0x01, 0xa4, 0x99, 0x06, 0xb5, 0x7c, 0xd5, 0xf3, 0x5d, 0x4a, 0x46, 0x86, + 0x35, 0xe0, 0x27, 0x48, 0x6e, 0x3f, 0xd3, 0x27, 0xa6, 0x47, 0x95, 0x35, 0x21, 0xee, 0x86, 0x52, + 0xa6, 0xc1, 0x13, 0xc8, 0x8d, 0x69, 0x64, 0xa7, 0x34, 0x84, 0x38, 0xd2, 0x28, 0xff, 0x31, 0x07, + 0x85, 0x58, 0x5f, 0x8d, 0x2f, 0x41, 0xf1, 0x11, 0x79, 0x42, 0xd4, 0xf0, 0xae, 0x24, 0x22, 0x51, + 0x60, 0x58, 0x27, 0xb8, 0x2f, 0x7d, 0x02, 0x9b, 0x9c, 0x62, 0x8f, 0x7d, 0xea, 0xaa, 0x9a, 0x49, + 0x3c, 0x8f, 0x07, 0x2d, 0xc7, 0xa9, 0x98, 0xc9, 0xda, 0x4c, 0x54, 0x0b, 0x25, 0xf8, 0x16, 0x6c, + 0x70, 0x8d, 0xd1, 0xd8, 0xf4, 0x0d, 0xc7, 0xa4, 0x2a, 0xbb, 0xbd, 0x79, 0xfc, 0x24, 0x89, 0x3c, + 0x5b, 0x67, 0x8c, 0xa3, 0x80, 0xc0, 0x3c, 0xf2, 0x70, 0x1d, 0xde, 0xe3, 0x6a, 0x03, 0x6a, 0x51, + 0x97, 0xf8, 0x54, 0xa5, 0x5f, 0x8d, 0x89, 0xe9, 0xa9, 0xc4, 0xd2, 0xd5, 0x21, 0xf1, 0x86, 0xd2, + 0x26, 0x33, 0x70, 0x90, 0x94, 0x12, 0xca, 0x05, 0x46, 0x3c, 0x0c, 0x78, 0x32, 0xa7, 0x55, 0x2d, + 0xfd, 0x73, 0xe2, 0x0d, 0xf1, 0x3e, 0x9c, 0xe3, 0x56, 0x3c, 0xdf, 0x35, 0xac, 0x81, 0xaa, 0x0d, + 0xa9, 0xf6, 0x58, 0x1d, 0xfb, 0xfd, 0x3b, 0xd2, 0x3b, 0xf1, 0xef, 0x73, 0x0f, 0xbb, 0x9c, 0x53, + 0x63, 0x94, 0x63, 0xbf, 0x7f, 0x07, 0x77, 0xa1, 0xc8, 0x16, 0x63, 0x64, 0x3c, 0xa7, 0x6a, 0xdf, + 0x76, 0xf9, 0xd1, 0x58, 0x5a, 0x50, 0x9a, 0x62, 0x11, 0xac, 0xb4, 0x03, 0x85, 0x23, 0x5b, 0xa7, + 0xfb, 0x99, 0x6e, 0x47, 0x96, 0xeb, 0x4a, 0x21, 0xb4, 0x72, 0xcf, 0x76, 0x59, 0x42, 0x0d, 0xec, + 0x28, 0xc0, 0x05, 0x91, 0x50, 0x03, 0x3b, 0x0c, 0xef, 0x2d, 0xd8, 0xd0, 0x34, 0x31, 0x67, 0x43, + 0x53, 0x83, 0x3b, 0x96, 0x27, 0xa1, 0xa9, 0x60, 0x69, 0xda, 0xa1, 0x20, 0x04, 0x39, 0xee, 0xe1, + 0x4f, 0xe1, 0xed, 0x49, 0xb0, 0xe2, 0x8a, 0xeb, 0x73, 0xb3, 0x9c, 0x55, 0xbd, 0x05, 0x1b, 0xce, + 0xe9, 0xbc, 0x22, 0x9e, 0xfa, 0xa2, 0x73, 0x3a, 0xab, 0x76, 0x1b, 0x36, 0x9d, 0xa1, 0x33, 0xaf, + 0x77, 0x35, 0xae, 0x87, 0x9d, 0xa1, 0x33, 0xab, 0xf8, 0x11, 0xbf, 0x70, 0xbb, 0x54, 0x23, 0x3e, + 0xd5, 0xa5, 0xf3, 0x71, 0x7a, 0x4c, 0x80, 0xaf, 0x03, 0xd2, 0x34, 0x95, 0x5a, 0xe4, 0xc4, 0xa4, + 0x2a, 0x71, 0xa9, 0x45, 0x3c, 0xe9, 0x62, 0x9c, 0x5c, 0xd2, 0x34, 0x99, 0x4b, 0xab, 0x5c, 0x88, + 0xaf, 0xc2, 0xba, 0x7d, 0xf2, 0x48, 0x13, 0x29, 0xa9, 0x3a, 0x2e, 0xed, 0x1b, 0xcf, 0xa4, 0x0f, + 0x79, 0x7c, 0xd7, 0x98, 0x80, 0x27, 0x64, 0x87, 0xc3, 0xf8, 0x0a, 0x20, 0xcd, 0x1b, 0x12, 0xd7, + 0xe1, 0x35, 0xd9, 0x73, 0x88, 0x46, 0xa5, 0x8f, 0x04, 0x55, 0xe0, 0xad, 0x10, 0x66, 0x5b, 0xc2, + 0x7b, 0x6a, 0xf4, 0xfd, 0xd0, 0xe2, 0x65, 0xb1, 0x25, 0x38, 0x16, 0x58, 0xdb, 0x01, 0xc4, 0x42, + 0x31, 0xf5, 0xe1, 0x1d, 0x4e, 0x2b, 0x39, 0x43, 0x27, 0xfe, 0xdd, 0x0f, 0x60, 0x95, 0x31, 0x27, + 0x1f, 0xbd, 0x22, 0x1a, 0x32, 0x67, 0x18, 0xfb, 0xe2, 0x6b, 0xeb, 0x8d, 0xcb, 0xfb, 0x50, 0x8c, + 0xe7, 0x27, 0xce, 0x83, 0xc8, 0x50, 0x94, 0x60, 0xcd, 0x4a, 0xad, 0x5d, 0x67, 0x6d, 0xc6, 0x97, + 0x32, 0x4a, 0xb2, 0x76, 0xa7, 0xd9, 0xe8, 0xc9, 0xaa, 0x72, 0xdc, 0xea, 0x35, 0x8e, 0x64, 0x94, + 0x8a, 0xf7, 0xd5, 0x7f, 0x4d, 0x42, 0x69, 0xfa, 0x8a, 0x84, 0x7f, 0x00, 0xe7, 0xc3, 0xf7, 0x0c, + 0x8f, 0xfa, 0xea, 0x53, 0xc3, 0xe5, 0x5b, 0x66, 0x44, 0xc4, 0xf1, 0x15, 0x2d, 0xda, 0x66, 0xc0, + 0xea, 0x52, 0xff, 0x0b, 0xc3, 0x65, 0x1b, 0x62, 0x44, 0x7c, 0xdc, 0x84, 0x8b, 0x96, 0xad, 0x7a, + 0x3e, 0xb1, 0x74, 0xe2, 0xea, 0xea, 0xe4, 0x25, 0x49, 0x25, 0x9a, 0x46, 0x3d, 0xcf, 0x16, 0x47, + 0x55, 0x64, 0xe5, 0x5d, 0xcb, 0xee, 0x06, 0xe4, 0x49, 0x0d, 0xaf, 0x06, 0xd4, 0x99, 0x04, 0x4b, + 0x2d, 0x4b, 0xb0, 0x77, 0x20, 0x3f, 0x22, 0x8e, 0x4a, 0x2d, 0xdf, 0x3d, 0xe5, 0x8d, 0x71, 0x4e, + 0xc9, 0x8d, 0x88, 0x23, 0xb3, 0xf1, 0x9b, 0xb9, 0x9f, 0xfc, 0x23, 0x05, 0xc5, 0x78, 0x73, 0xcc, + 0xee, 0x1a, 0x1a, 0x3f, 0x47, 0x12, 0xbc, 0xd2, 0x7c, 0xf0, 0xd2, 0x56, 0xba, 0x52, 0x63, 0x07, + 0xcc, 0x7e, 0x56, 0xb4, 0xac, 0x8a, 0xd0, 0x64, 0x87, 0x3b, 0xab, 0x2d, 0x54, 0xb4, 0x08, 0x39, + 0x25, 0x18, 0xe1, 0x43, 0xc8, 0x3e, 0xf2, 0xb8, 0xed, 0x2c, 0xb7, 0xfd, 0xe1, 0xcb, 0x6d, 0xdf, + 0xef, 0x72, 0xe3, 0xf9, 0xfb, 0x5d, 0xb5, 0xd5, 0x56, 0x8e, 0xaa, 0x4d, 0x25, 0x50, 0xc7, 0x17, + 0x20, 0x6d, 0x92, 0xe7, 0xa7, 0xd3, 0x47, 0x11, 0x87, 0xce, 0x1a, 0xf8, 0x0b, 0x90, 0x7e, 0x4a, + 0xc9, 0xe3, 0xe9, 0x03, 0x80, 0x43, 0xaf, 0x31, 0xf5, 0xaf, 0x43, 0x86, 0xc7, 0x0b, 0x03, 0x04, + 0x11, 0x43, 0x6f, 0xe1, 0x1c, 0xa4, 0x6b, 0x6d, 0x85, 0xa5, 0x3f, 0x82, 0xa2, 0x40, 0xd5, 0x4e, + 0x43, 0xae, 0xc9, 0x28, 0x59, 0xbe, 0x05, 0x59, 0x11, 0x04, 0xb6, 0x35, 0xa2, 0x30, 0xa0, 0xb7, + 0x82, 0x61, 0x60, 0x23, 0x11, 0x4a, 0x8f, 0x8f, 0x0e, 0x64, 0x05, 0x25, 0xe3, 0xcb, 0xeb, 0x41, + 0x31, 0xde, 0x17, 0xbf, 0x99, 0x9c, 0xfa, 0x4b, 0x02, 0x0a, 0xb1, 0x3e, 0x97, 0x35, 0x28, 0xc4, + 0x34, 0xed, 0xa7, 0x2a, 0x31, 0x0d, 0xe2, 0x05, 0x49, 0x01, 0x1c, 0xaa, 0x32, 0xe4, 0xac, 0x8b, + 0xf6, 0x46, 0x9c, 0xff, 0x5d, 0x02, 0xd0, 0x6c, 0x8b, 0x39, 0xe3, 0x60, 0xe2, 0x3b, 0x75, 0xf0, + 0xb7, 0x09, 0x28, 0x4d, 0xf7, 0x95, 0x33, 0xee, 0x5d, 0xfa, 0x4e, 0xdd, 0xfb, 0x67, 0x12, 0x56, + 0xa7, 0xba, 0xc9, 0xb3, 0x7a, 0xf7, 0x15, 0xac, 0x1b, 0x3a, 0x1d, 0x39, 0xb6, 0x4f, 0x2d, 0xed, + 0x54, 0x35, 0xe9, 0x13, 0x6a, 0x4a, 0x65, 0x5e, 0x28, 0xae, 0xbf, 0xbc, 0x5f, 0xad, 0x34, 0x26, + 0x7a, 0x4d, 0xa6, 0xb6, 0xbf, 0xd1, 0xa8, 0xcb, 0x47, 0x9d, 0x76, 0x4f, 0x6e, 0xd5, 0x1e, 0xaa, + 0xc7, 0xad, 0x1f, 0xb7, 0xda, 0x5f, 0xb4, 0x14, 0x64, 0xcc, 0xd0, 0x5e, 0xe3, 0x56, 0xef, 0x00, + 0x9a, 0x75, 0x0a, 0x9f, 0x87, 0x45, 0x6e, 0xa1, 0xb7, 0xf0, 0x06, 0xac, 0xb5, 0xda, 0x6a, 0xb7, + 0x51, 0x97, 0x55, 0xf9, 0xde, 0x3d, 0xb9, 0xd6, 0xeb, 0x8a, 0x17, 0x88, 0x88, 0xdd, 0x9b, 0xde, + 0xd4, 0xbf, 0x49, 0xc1, 0xc6, 0x02, 0x4f, 0x70, 0x35, 0xb8, 0x3b, 0x88, 0xeb, 0xcc, 0xf7, 0xcf, + 0xe2, 0x7d, 0x85, 0x1d, 0xf9, 0x1d, 0xe2, 0xfa, 0xc1, 0x55, 0xe3, 0x0a, 0xb0, 0x28, 0x59, 0xbe, + 0xd1, 0x37, 0xa8, 0x1b, 0x3c, 0xd8, 0x88, 0x0b, 0xc5, 0xda, 0x04, 0x17, 0x6f, 0x36, 0xdf, 0x03, + 0xec, 0xd8, 0x9e, 0xe1, 0x1b, 0x4f, 0xa8, 0x6a, 0x58, 0xe1, 0xeb, 0x0e, 0xbb, 0x60, 0xa4, 0x15, + 0x14, 0x4a, 0x1a, 0x96, 0x1f, 0xb1, 0x2d, 0x3a, 0x20, 0x33, 0x6c, 0x56, 0xc0, 0x53, 0x0a, 0x0a, + 0x25, 0x11, 0xfb, 0x12, 0x14, 0x75, 0x7b, 0xcc, 0xba, 0x2e, 0xc1, 0x63, 0xe7, 0x45, 0x42, 0x29, + 0x08, 0x2c, 0xa2, 0x04, 0xfd, 0xf4, 0xe4, 0x59, 0xa9, 0xa8, 0x14, 0x04, 0x26, 0x28, 0x97, 0x61, + 0x8d, 0x0c, 0x06, 0x2e, 0x33, 0x1e, 0x1a, 0x12, 0x37, 0x84, 0x52, 0x04, 0x73, 0xe2, 0xd6, 0x7d, + 0xc8, 0x85, 0x71, 0x60, 0x47, 0x32, 0x8b, 0x84, 0xea, 0x88, 0x6b, 0x6f, 0x72, 0x27, 0xaf, 0xe4, + 0xac, 0x50, 0x78, 0x09, 0x8a, 0x86, 0xa7, 0x4e, 0x5e, 0xc9, 0x93, 0xdb, 0xc9, 0x9d, 0x9c, 0x52, + 0x30, 0xbc, 0xe8, 0x85, 0xb1, 0xfc, 0x75, 0x12, 0x4a, 0xd3, 0xaf, 0xfc, 0xb8, 0x0e, 0x39, 0xd3, + 0xd6, 0x08, 0x4f, 0x2d, 0xf1, 0x13, 0xd3, 0xce, 0x2b, 0x7e, 0x18, 0xa8, 0x34, 0x03, 0xbe, 0x12, + 0x69, 0x6e, 0xfd, 0x2d, 0x01, 0xb9, 0x10, 0xc6, 0xe7, 0x20, 0xed, 0x10, 0x7f, 0xc8, 0xcd, 0x65, + 0x0e, 0x92, 0x28, 0xa1, 0xf0, 0x31, 0xc3, 0x3d, 0x87, 0x58, 0x3c, 0x05, 0x02, 0x9c, 0x8d, 0xd9, + 0xba, 0x9a, 0x94, 0xe8, 0xfc, 0xfa, 0x61, 0x8f, 0x46, 0xd4, 0xf2, 0xbd, 0x70, 0x5d, 0x03, 0xbc, + 0x16, 0xc0, 0xf8, 0x1a, 0xac, 0xfb, 0x2e, 0x31, 0xcc, 0x29, 0x6e, 0x9a, 0x73, 0x51, 0x28, 0x88, + 0xc8, 0xfb, 0x70, 0x21, 0xb4, 0xab, 0x53, 0x9f, 0x68, 0x43, 0xaa, 0x4f, 0x94, 0xb2, 0xfc, 0x99, + 0xe1, 0x7c, 0x40, 0xa8, 0x07, 0xf2, 0x50, 0xb7, 0xfc, 0xf7, 0x04, 0xac, 0x87, 0x17, 0x26, 0x3d, + 0x0a, 0xd6, 0x11, 0x00, 0xb1, 0x2c, 0xdb, 0x8f, 0x87, 0x6b, 0x3e, 0x95, 0xe7, 0xf4, 0x2a, 0xd5, + 0x48, 0x49, 0x89, 0x19, 0xd8, 0x1a, 0x01, 0x4c, 0x24, 0x4b, 0xc3, 0x76, 0x11, 0x0a, 0xc1, 0x4f, + 0x38, 0xfc, 0x77, 0x40, 0x71, 0xc5, 0x06, 0x01, 0xb1, 0x9b, 0x15, 0xde, 0x84, 0xcc, 0x09, 0x1d, + 0x18, 0x56, 0xf0, 0x30, 0x2b, 0x06, 0xe1, 0x43, 0x48, 0x3a, 0x7a, 0x08, 0x39, 0xf8, 0x19, 0x6c, + 0x68, 0xf6, 0x68, 0xd6, 0xdd, 0x03, 0x34, 0x73, 0xcd, 0xf7, 0x3e, 0x4f, 0x7c, 0x09, 0x93, 0x16, + 0xf3, 0x7f, 0x89, 0xc4, 0xef, 0x93, 0xa9, 0xc3, 0xce, 0xc1, 0x1f, 0x92, 0x5b, 0x87, 0x42, 0xb5, + 0x13, 0xce, 0x54, 0xa1, 0x7d, 0x93, 0x6a, 0xcc, 0xfb, 0xff, 0x07, 0x00, 0x00, 0xff, 0xff, 0xa3, + 0x58, 0x22, 0x30, 0xdf, 0x1c, 0x00, 0x00, +} diff --git a/vendor/github.com/gogo/protobuf/protoc-gen-gogo/descriptor/descriptor_gostring.gen.go b/vendor/github.com/gogo/protobuf/protoc-gen-gogo/descriptor/descriptor_gostring.gen.go new file mode 100644 index 000000000000..ec6eb168d6a7 --- /dev/null +++ b/vendor/github.com/gogo/protobuf/protoc-gen-gogo/descriptor/descriptor_gostring.gen.go @@ -0,0 +1,744 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: descriptor.proto + +package descriptor + +import fmt "fmt" +import strings "strings" +import github_com_gogo_protobuf_proto "github.com/gogo/protobuf/proto" +import sort "sort" +import strconv "strconv" +import reflect "reflect" +import proto "github.com/gogo/protobuf/proto" +import math "math" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +func (this *FileDescriptorSet) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 5) + s = append(s, "&descriptor.FileDescriptorSet{") + if this.File != nil { + s = append(s, "File: "+fmt.Sprintf("%#v", this.File)+",\n") + } + if this.XXX_unrecognized != nil { + s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") + } + s = append(s, "}") + return strings.Join(s, "") +} +func (this *FileDescriptorProto) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 16) + s = append(s, "&descriptor.FileDescriptorProto{") + if this.Name != nil { + s = append(s, "Name: "+valueToGoStringDescriptor(this.Name, "string")+",\n") + } + if this.Package != nil { + s = append(s, "Package: "+valueToGoStringDescriptor(this.Package, "string")+",\n") + } + if this.Dependency != nil { + s = append(s, "Dependency: "+fmt.Sprintf("%#v", this.Dependency)+",\n") + } + if this.PublicDependency != nil { + s = append(s, "PublicDependency: "+fmt.Sprintf("%#v", this.PublicDependency)+",\n") + } + if this.WeakDependency != nil { + s = append(s, "WeakDependency: "+fmt.Sprintf("%#v", this.WeakDependency)+",\n") + } + if this.MessageType != nil { + s = append(s, "MessageType: "+fmt.Sprintf("%#v", this.MessageType)+",\n") + } + if this.EnumType != nil { + s = append(s, "EnumType: "+fmt.Sprintf("%#v", this.EnumType)+",\n") + } + if this.Service != nil { + s = append(s, "Service: "+fmt.Sprintf("%#v", this.Service)+",\n") + } + if this.Extension != nil { + s = append(s, "Extension: "+fmt.Sprintf("%#v", this.Extension)+",\n") + } + if this.Options != nil { + s = append(s, "Options: "+fmt.Sprintf("%#v", this.Options)+",\n") + } + if this.SourceCodeInfo != nil { + s = append(s, "SourceCodeInfo: "+fmt.Sprintf("%#v", this.SourceCodeInfo)+",\n") + } + if this.Syntax != nil { + s = append(s, "Syntax: "+valueToGoStringDescriptor(this.Syntax, "string")+",\n") + } + if this.XXX_unrecognized != nil { + s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") + } + s = append(s, "}") + return strings.Join(s, "") +} +func (this *DescriptorProto) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 14) + s = append(s, "&descriptor.DescriptorProto{") + if this.Name != nil { + s = append(s, "Name: "+valueToGoStringDescriptor(this.Name, "string")+",\n") + } + if this.Field != nil { + s = append(s, "Field: "+fmt.Sprintf("%#v", this.Field)+",\n") + } + if this.Extension != nil { + s = append(s, "Extension: "+fmt.Sprintf("%#v", this.Extension)+",\n") + } + if this.NestedType != nil { + s = append(s, "NestedType: "+fmt.Sprintf("%#v", this.NestedType)+",\n") + } + if this.EnumType != nil { + s = append(s, "EnumType: "+fmt.Sprintf("%#v", this.EnumType)+",\n") + } + if this.ExtensionRange != nil { + s = append(s, "ExtensionRange: "+fmt.Sprintf("%#v", this.ExtensionRange)+",\n") + } + if this.OneofDecl != nil { + s = append(s, "OneofDecl: "+fmt.Sprintf("%#v", this.OneofDecl)+",\n") + } + if this.Options != nil { + s = append(s, "Options: "+fmt.Sprintf("%#v", this.Options)+",\n") + } + if this.ReservedRange != nil { + s = append(s, "ReservedRange: "+fmt.Sprintf("%#v", this.ReservedRange)+",\n") + } + if this.ReservedName != nil { + s = append(s, "ReservedName: "+fmt.Sprintf("%#v", this.ReservedName)+",\n") + } + if this.XXX_unrecognized != nil { + s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") + } + s = append(s, "}") + return strings.Join(s, "") +} +func (this *DescriptorProto_ExtensionRange) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 7) + s = append(s, "&descriptor.DescriptorProto_ExtensionRange{") + if this.Start != nil { + s = append(s, "Start: "+valueToGoStringDescriptor(this.Start, "int32")+",\n") + } + if this.End != nil { + s = append(s, "End: "+valueToGoStringDescriptor(this.End, "int32")+",\n") + } + if this.Options != nil { + s = append(s, "Options: "+fmt.Sprintf("%#v", this.Options)+",\n") + } + if this.XXX_unrecognized != nil { + s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") + } + s = append(s, "}") + return strings.Join(s, "") +} +func (this *DescriptorProto_ReservedRange) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 6) + s = append(s, "&descriptor.DescriptorProto_ReservedRange{") + if this.Start != nil { + s = append(s, "Start: "+valueToGoStringDescriptor(this.Start, "int32")+",\n") + } + if this.End != nil { + s = append(s, "End: "+valueToGoStringDescriptor(this.End, "int32")+",\n") + } + if this.XXX_unrecognized != nil { + s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") + } + s = append(s, "}") + return strings.Join(s, "") +} +func (this *ExtensionRangeOptions) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 5) + s = append(s, "&descriptor.ExtensionRangeOptions{") + if this.UninterpretedOption != nil { + s = append(s, "UninterpretedOption: "+fmt.Sprintf("%#v", this.UninterpretedOption)+",\n") + } + s = append(s, "XXX_InternalExtensions: "+extensionToGoStringDescriptor(this)+",\n") + if this.XXX_unrecognized != nil { + s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") + } + s = append(s, "}") + return strings.Join(s, "") +} +func (this *FieldDescriptorProto) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 14) + s = append(s, "&descriptor.FieldDescriptorProto{") + if this.Name != nil { + s = append(s, "Name: "+valueToGoStringDescriptor(this.Name, "string")+",\n") + } + if this.Number != nil { + s = append(s, "Number: "+valueToGoStringDescriptor(this.Number, "int32")+",\n") + } + if this.Label != nil { + s = append(s, "Label: "+valueToGoStringDescriptor(this.Label, "FieldDescriptorProto_Label")+",\n") + } + if this.Type != nil { + s = append(s, "Type: "+valueToGoStringDescriptor(this.Type, "FieldDescriptorProto_Type")+",\n") + } + if this.TypeName != nil { + s = append(s, "TypeName: "+valueToGoStringDescriptor(this.TypeName, "string")+",\n") + } + if this.Extendee != nil { + s = append(s, "Extendee: "+valueToGoStringDescriptor(this.Extendee, "string")+",\n") + } + if this.DefaultValue != nil { + s = append(s, "DefaultValue: "+valueToGoStringDescriptor(this.DefaultValue, "string")+",\n") + } + if this.OneofIndex != nil { + s = append(s, "OneofIndex: "+valueToGoStringDescriptor(this.OneofIndex, "int32")+",\n") + } + if this.JsonName != nil { + s = append(s, "JsonName: "+valueToGoStringDescriptor(this.JsonName, "string")+",\n") + } + if this.Options != nil { + s = append(s, "Options: "+fmt.Sprintf("%#v", this.Options)+",\n") + } + if this.XXX_unrecognized != nil { + s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") + } + s = append(s, "}") + return strings.Join(s, "") +} +func (this *OneofDescriptorProto) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 6) + s = append(s, "&descriptor.OneofDescriptorProto{") + if this.Name != nil { + s = append(s, "Name: "+valueToGoStringDescriptor(this.Name, "string")+",\n") + } + if this.Options != nil { + s = append(s, "Options: "+fmt.Sprintf("%#v", this.Options)+",\n") + } + if this.XXX_unrecognized != nil { + s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") + } + s = append(s, "}") + return strings.Join(s, "") +} +func (this *EnumDescriptorProto) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 9) + s = append(s, "&descriptor.EnumDescriptorProto{") + if this.Name != nil { + s = append(s, "Name: "+valueToGoStringDescriptor(this.Name, "string")+",\n") + } + if this.Value != nil { + s = append(s, "Value: "+fmt.Sprintf("%#v", this.Value)+",\n") + } + if this.Options != nil { + s = append(s, "Options: "+fmt.Sprintf("%#v", this.Options)+",\n") + } + if this.ReservedRange != nil { + s = append(s, "ReservedRange: "+fmt.Sprintf("%#v", this.ReservedRange)+",\n") + } + if this.ReservedName != nil { + s = append(s, "ReservedName: "+fmt.Sprintf("%#v", this.ReservedName)+",\n") + } + if this.XXX_unrecognized != nil { + s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") + } + s = append(s, "}") + return strings.Join(s, "") +} +func (this *EnumDescriptorProto_EnumReservedRange) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 6) + s = append(s, "&descriptor.EnumDescriptorProto_EnumReservedRange{") + if this.Start != nil { + s = append(s, "Start: "+valueToGoStringDescriptor(this.Start, "int32")+",\n") + } + if this.End != nil { + s = append(s, "End: "+valueToGoStringDescriptor(this.End, "int32")+",\n") + } + if this.XXX_unrecognized != nil { + s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") + } + s = append(s, "}") + return strings.Join(s, "") +} +func (this *EnumValueDescriptorProto) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 7) + s = append(s, "&descriptor.EnumValueDescriptorProto{") + if this.Name != nil { + s = append(s, "Name: "+valueToGoStringDescriptor(this.Name, "string")+",\n") + } + if this.Number != nil { + s = append(s, "Number: "+valueToGoStringDescriptor(this.Number, "int32")+",\n") + } + if this.Options != nil { + s = append(s, "Options: "+fmt.Sprintf("%#v", this.Options)+",\n") + } + if this.XXX_unrecognized != nil { + s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") + } + s = append(s, "}") + return strings.Join(s, "") +} +func (this *ServiceDescriptorProto) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 7) + s = append(s, "&descriptor.ServiceDescriptorProto{") + if this.Name != nil { + s = append(s, "Name: "+valueToGoStringDescriptor(this.Name, "string")+",\n") + } + if this.Method != nil { + s = append(s, "Method: "+fmt.Sprintf("%#v", this.Method)+",\n") + } + if this.Options != nil { + s = append(s, "Options: "+fmt.Sprintf("%#v", this.Options)+",\n") + } + if this.XXX_unrecognized != nil { + s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") + } + s = append(s, "}") + return strings.Join(s, "") +} +func (this *MethodDescriptorProto) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 10) + s = append(s, "&descriptor.MethodDescriptorProto{") + if this.Name != nil { + s = append(s, "Name: "+valueToGoStringDescriptor(this.Name, "string")+",\n") + } + if this.InputType != nil { + s = append(s, "InputType: "+valueToGoStringDescriptor(this.InputType, "string")+",\n") + } + if this.OutputType != nil { + s = append(s, "OutputType: "+valueToGoStringDescriptor(this.OutputType, "string")+",\n") + } + if this.Options != nil { + s = append(s, "Options: "+fmt.Sprintf("%#v", this.Options)+",\n") + } + if this.ClientStreaming != nil { + s = append(s, "ClientStreaming: "+valueToGoStringDescriptor(this.ClientStreaming, "bool")+",\n") + } + if this.ServerStreaming != nil { + s = append(s, "ServerStreaming: "+valueToGoStringDescriptor(this.ServerStreaming, "bool")+",\n") + } + if this.XXX_unrecognized != nil { + s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") + } + s = append(s, "}") + return strings.Join(s, "") +} +func (this *FileOptions) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 23) + s = append(s, "&descriptor.FileOptions{") + if this.JavaPackage != nil { + s = append(s, "JavaPackage: "+valueToGoStringDescriptor(this.JavaPackage, "string")+",\n") + } + if this.JavaOuterClassname != nil { + s = append(s, "JavaOuterClassname: "+valueToGoStringDescriptor(this.JavaOuterClassname, "string")+",\n") + } + if this.JavaMultipleFiles != nil { + s = append(s, "JavaMultipleFiles: "+valueToGoStringDescriptor(this.JavaMultipleFiles, "bool")+",\n") + } + if this.JavaGenerateEqualsAndHash != nil { + s = append(s, "JavaGenerateEqualsAndHash: "+valueToGoStringDescriptor(this.JavaGenerateEqualsAndHash, "bool")+",\n") + } + if this.JavaStringCheckUtf8 != nil { + s = append(s, "JavaStringCheckUtf8: "+valueToGoStringDescriptor(this.JavaStringCheckUtf8, "bool")+",\n") + } + if this.OptimizeFor != nil { + s = append(s, "OptimizeFor: "+valueToGoStringDescriptor(this.OptimizeFor, "FileOptions_OptimizeMode")+",\n") + } + if this.GoPackage != nil { + s = append(s, "GoPackage: "+valueToGoStringDescriptor(this.GoPackage, "string")+",\n") + } + if this.CcGenericServices != nil { + s = append(s, "CcGenericServices: "+valueToGoStringDescriptor(this.CcGenericServices, "bool")+",\n") + } + if this.JavaGenericServices != nil { + s = append(s, "JavaGenericServices: "+valueToGoStringDescriptor(this.JavaGenericServices, "bool")+",\n") + } + if this.PyGenericServices != nil { + s = append(s, "PyGenericServices: "+valueToGoStringDescriptor(this.PyGenericServices, "bool")+",\n") + } + if this.PhpGenericServices != nil { + s = append(s, "PhpGenericServices: "+valueToGoStringDescriptor(this.PhpGenericServices, "bool")+",\n") + } + if this.Deprecated != nil { + s = append(s, "Deprecated: "+valueToGoStringDescriptor(this.Deprecated, "bool")+",\n") + } + if this.CcEnableArenas != nil { + s = append(s, "CcEnableArenas: "+valueToGoStringDescriptor(this.CcEnableArenas, "bool")+",\n") + } + if this.ObjcClassPrefix != nil { + s = append(s, "ObjcClassPrefix: "+valueToGoStringDescriptor(this.ObjcClassPrefix, "string")+",\n") + } + if this.CsharpNamespace != nil { + s = append(s, "CsharpNamespace: "+valueToGoStringDescriptor(this.CsharpNamespace, "string")+",\n") + } + if this.SwiftPrefix != nil { + s = append(s, "SwiftPrefix: "+valueToGoStringDescriptor(this.SwiftPrefix, "string")+",\n") + } + if this.PhpClassPrefix != nil { + s = append(s, "PhpClassPrefix: "+valueToGoStringDescriptor(this.PhpClassPrefix, "string")+",\n") + } + if this.PhpNamespace != nil { + s = append(s, "PhpNamespace: "+valueToGoStringDescriptor(this.PhpNamespace, "string")+",\n") + } + if this.UninterpretedOption != nil { + s = append(s, "UninterpretedOption: "+fmt.Sprintf("%#v", this.UninterpretedOption)+",\n") + } + s = append(s, "XXX_InternalExtensions: "+extensionToGoStringDescriptor(this)+",\n") + if this.XXX_unrecognized != nil { + s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") + } + s = append(s, "}") + return strings.Join(s, "") +} +func (this *MessageOptions) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 9) + s = append(s, "&descriptor.MessageOptions{") + if this.MessageSetWireFormat != nil { + s = append(s, "MessageSetWireFormat: "+valueToGoStringDescriptor(this.MessageSetWireFormat, "bool")+",\n") + } + if this.NoStandardDescriptorAccessor != nil { + s = append(s, "NoStandardDescriptorAccessor: "+valueToGoStringDescriptor(this.NoStandardDescriptorAccessor, "bool")+",\n") + } + if this.Deprecated != nil { + s = append(s, "Deprecated: "+valueToGoStringDescriptor(this.Deprecated, "bool")+",\n") + } + if this.MapEntry != nil { + s = append(s, "MapEntry: "+valueToGoStringDescriptor(this.MapEntry, "bool")+",\n") + } + if this.UninterpretedOption != nil { + s = append(s, "UninterpretedOption: "+fmt.Sprintf("%#v", this.UninterpretedOption)+",\n") + } + s = append(s, "XXX_InternalExtensions: "+extensionToGoStringDescriptor(this)+",\n") + if this.XXX_unrecognized != nil { + s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") + } + s = append(s, "}") + return strings.Join(s, "") +} +func (this *FieldOptions) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 11) + s = append(s, "&descriptor.FieldOptions{") + if this.Ctype != nil { + s = append(s, "Ctype: "+valueToGoStringDescriptor(this.Ctype, "FieldOptions_CType")+",\n") + } + if this.Packed != nil { + s = append(s, "Packed: "+valueToGoStringDescriptor(this.Packed, "bool")+",\n") + } + if this.Jstype != nil { + s = append(s, "Jstype: "+valueToGoStringDescriptor(this.Jstype, "FieldOptions_JSType")+",\n") + } + if this.Lazy != nil { + s = append(s, "Lazy: "+valueToGoStringDescriptor(this.Lazy, "bool")+",\n") + } + if this.Deprecated != nil { + s = append(s, "Deprecated: "+valueToGoStringDescriptor(this.Deprecated, "bool")+",\n") + } + if this.Weak != nil { + s = append(s, "Weak: "+valueToGoStringDescriptor(this.Weak, "bool")+",\n") + } + if this.UninterpretedOption != nil { + s = append(s, "UninterpretedOption: "+fmt.Sprintf("%#v", this.UninterpretedOption)+",\n") + } + s = append(s, "XXX_InternalExtensions: "+extensionToGoStringDescriptor(this)+",\n") + if this.XXX_unrecognized != nil { + s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") + } + s = append(s, "}") + return strings.Join(s, "") +} +func (this *OneofOptions) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 5) + s = append(s, "&descriptor.OneofOptions{") + if this.UninterpretedOption != nil { + s = append(s, "UninterpretedOption: "+fmt.Sprintf("%#v", this.UninterpretedOption)+",\n") + } + s = append(s, "XXX_InternalExtensions: "+extensionToGoStringDescriptor(this)+",\n") + if this.XXX_unrecognized != nil { + s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") + } + s = append(s, "}") + return strings.Join(s, "") +} +func (this *EnumOptions) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 7) + s = append(s, "&descriptor.EnumOptions{") + if this.AllowAlias != nil { + s = append(s, "AllowAlias: "+valueToGoStringDescriptor(this.AllowAlias, "bool")+",\n") + } + if this.Deprecated != nil { + s = append(s, "Deprecated: "+valueToGoStringDescriptor(this.Deprecated, "bool")+",\n") + } + if this.UninterpretedOption != nil { + s = append(s, "UninterpretedOption: "+fmt.Sprintf("%#v", this.UninterpretedOption)+",\n") + } + s = append(s, "XXX_InternalExtensions: "+extensionToGoStringDescriptor(this)+",\n") + if this.XXX_unrecognized != nil { + s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") + } + s = append(s, "}") + return strings.Join(s, "") +} +func (this *EnumValueOptions) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 6) + s = append(s, "&descriptor.EnumValueOptions{") + if this.Deprecated != nil { + s = append(s, "Deprecated: "+valueToGoStringDescriptor(this.Deprecated, "bool")+",\n") + } + if this.UninterpretedOption != nil { + s = append(s, "UninterpretedOption: "+fmt.Sprintf("%#v", this.UninterpretedOption)+",\n") + } + s = append(s, "XXX_InternalExtensions: "+extensionToGoStringDescriptor(this)+",\n") + if this.XXX_unrecognized != nil { + s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") + } + s = append(s, "}") + return strings.Join(s, "") +} +func (this *ServiceOptions) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 6) + s = append(s, "&descriptor.ServiceOptions{") + if this.Deprecated != nil { + s = append(s, "Deprecated: "+valueToGoStringDescriptor(this.Deprecated, "bool")+",\n") + } + if this.UninterpretedOption != nil { + s = append(s, "UninterpretedOption: "+fmt.Sprintf("%#v", this.UninterpretedOption)+",\n") + } + s = append(s, "XXX_InternalExtensions: "+extensionToGoStringDescriptor(this)+",\n") + if this.XXX_unrecognized != nil { + s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") + } + s = append(s, "}") + return strings.Join(s, "") +} +func (this *MethodOptions) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 7) + s = append(s, "&descriptor.MethodOptions{") + if this.Deprecated != nil { + s = append(s, "Deprecated: "+valueToGoStringDescriptor(this.Deprecated, "bool")+",\n") + } + if this.IdempotencyLevel != nil { + s = append(s, "IdempotencyLevel: "+valueToGoStringDescriptor(this.IdempotencyLevel, "MethodOptions_IdempotencyLevel")+",\n") + } + if this.UninterpretedOption != nil { + s = append(s, "UninterpretedOption: "+fmt.Sprintf("%#v", this.UninterpretedOption)+",\n") + } + s = append(s, "XXX_InternalExtensions: "+extensionToGoStringDescriptor(this)+",\n") + if this.XXX_unrecognized != nil { + s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") + } + s = append(s, "}") + return strings.Join(s, "") +} +func (this *UninterpretedOption) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 11) + s = append(s, "&descriptor.UninterpretedOption{") + if this.Name != nil { + s = append(s, "Name: "+fmt.Sprintf("%#v", this.Name)+",\n") + } + if this.IdentifierValue != nil { + s = append(s, "IdentifierValue: "+valueToGoStringDescriptor(this.IdentifierValue, "string")+",\n") + } + if this.PositiveIntValue != nil { + s = append(s, "PositiveIntValue: "+valueToGoStringDescriptor(this.PositiveIntValue, "uint64")+",\n") + } + if this.NegativeIntValue != nil { + s = append(s, "NegativeIntValue: "+valueToGoStringDescriptor(this.NegativeIntValue, "int64")+",\n") + } + if this.DoubleValue != nil { + s = append(s, "DoubleValue: "+valueToGoStringDescriptor(this.DoubleValue, "float64")+",\n") + } + if this.StringValue != nil { + s = append(s, "StringValue: "+valueToGoStringDescriptor(this.StringValue, "byte")+",\n") + } + if this.AggregateValue != nil { + s = append(s, "AggregateValue: "+valueToGoStringDescriptor(this.AggregateValue, "string")+",\n") + } + if this.XXX_unrecognized != nil { + s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") + } + s = append(s, "}") + return strings.Join(s, "") +} +func (this *UninterpretedOption_NamePart) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 6) + s = append(s, "&descriptor.UninterpretedOption_NamePart{") + if this.NamePart != nil { + s = append(s, "NamePart: "+valueToGoStringDescriptor(this.NamePart, "string")+",\n") + } + if this.IsExtension != nil { + s = append(s, "IsExtension: "+valueToGoStringDescriptor(this.IsExtension, "bool")+",\n") + } + if this.XXX_unrecognized != nil { + s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") + } + s = append(s, "}") + return strings.Join(s, "") +} +func (this *SourceCodeInfo) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 5) + s = append(s, "&descriptor.SourceCodeInfo{") + if this.Location != nil { + s = append(s, "Location: "+fmt.Sprintf("%#v", this.Location)+",\n") + } + if this.XXX_unrecognized != nil { + s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") + } + s = append(s, "}") + return strings.Join(s, "") +} +func (this *SourceCodeInfo_Location) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 9) + s = append(s, "&descriptor.SourceCodeInfo_Location{") + if this.Path != nil { + s = append(s, "Path: "+fmt.Sprintf("%#v", this.Path)+",\n") + } + if this.Span != nil { + s = append(s, "Span: "+fmt.Sprintf("%#v", this.Span)+",\n") + } + if this.LeadingComments != nil { + s = append(s, "LeadingComments: "+valueToGoStringDescriptor(this.LeadingComments, "string")+",\n") + } + if this.TrailingComments != nil { + s = append(s, "TrailingComments: "+valueToGoStringDescriptor(this.TrailingComments, "string")+",\n") + } + if this.LeadingDetachedComments != nil { + s = append(s, "LeadingDetachedComments: "+fmt.Sprintf("%#v", this.LeadingDetachedComments)+",\n") + } + if this.XXX_unrecognized != nil { + s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") + } + s = append(s, "}") + return strings.Join(s, "") +} +func (this *GeneratedCodeInfo) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 5) + s = append(s, "&descriptor.GeneratedCodeInfo{") + if this.Annotation != nil { + s = append(s, "Annotation: "+fmt.Sprintf("%#v", this.Annotation)+",\n") + } + if this.XXX_unrecognized != nil { + s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") + } + s = append(s, "}") + return strings.Join(s, "") +} +func (this *GeneratedCodeInfo_Annotation) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 8) + s = append(s, "&descriptor.GeneratedCodeInfo_Annotation{") + if this.Path != nil { + s = append(s, "Path: "+fmt.Sprintf("%#v", this.Path)+",\n") + } + if this.SourceFile != nil { + s = append(s, "SourceFile: "+valueToGoStringDescriptor(this.SourceFile, "string")+",\n") + } + if this.Begin != nil { + s = append(s, "Begin: "+valueToGoStringDescriptor(this.Begin, "int32")+",\n") + } + if this.End != nil { + s = append(s, "End: "+valueToGoStringDescriptor(this.End, "int32")+",\n") + } + if this.XXX_unrecognized != nil { + s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") + } + s = append(s, "}") + return strings.Join(s, "") +} +func valueToGoStringDescriptor(v interface{}, typ string) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv) +} +func extensionToGoStringDescriptor(m github_com_gogo_protobuf_proto.Message) string { + e := github_com_gogo_protobuf_proto.GetUnsafeExtensionsMap(m) + if e == nil { + return "nil" + } + s := "proto.NewUnsafeXXX_InternalExtensions(map[int32]proto.Extension{" + keys := make([]int, 0, len(e)) + for k := range e { + keys = append(keys, int(k)) + } + sort.Ints(keys) + ss := []string{} + for _, k := range keys { + ss = append(ss, strconv.Itoa(k)+": "+e[int32(k)].GoString()) + } + s += strings.Join(ss, ",") + "})" + return s +} diff --git a/vendor/github.com/gogo/protobuf/protoc-gen-gogo/descriptor/helper.go b/vendor/github.com/gogo/protobuf/protoc-gen-gogo/descriptor/helper.go new file mode 100644 index 000000000000..e0846a357d59 --- /dev/null +++ b/vendor/github.com/gogo/protobuf/protoc-gen-gogo/descriptor/helper.go @@ -0,0 +1,390 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2013, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +package descriptor + +import ( + "strings" +) + +func (msg *DescriptorProto) GetMapFields() (*FieldDescriptorProto, *FieldDescriptorProto) { + if !msg.GetOptions().GetMapEntry() { + return nil, nil + } + return msg.GetField()[0], msg.GetField()[1] +} + +func dotToUnderscore(r rune) rune { + if r == '.' { + return '_' + } + return r +} + +func (field *FieldDescriptorProto) WireType() (wire int) { + switch *field.Type { + case FieldDescriptorProto_TYPE_DOUBLE: + return 1 + case FieldDescriptorProto_TYPE_FLOAT: + return 5 + case FieldDescriptorProto_TYPE_INT64: + return 0 + case FieldDescriptorProto_TYPE_UINT64: + return 0 + case FieldDescriptorProto_TYPE_INT32: + return 0 + case FieldDescriptorProto_TYPE_UINT32: + return 0 + case FieldDescriptorProto_TYPE_FIXED64: + return 1 + case FieldDescriptorProto_TYPE_FIXED32: + return 5 + case FieldDescriptorProto_TYPE_BOOL: + return 0 + case FieldDescriptorProto_TYPE_STRING: + return 2 + case FieldDescriptorProto_TYPE_GROUP: + return 2 + case FieldDescriptorProto_TYPE_MESSAGE: + return 2 + case FieldDescriptorProto_TYPE_BYTES: + return 2 + case FieldDescriptorProto_TYPE_ENUM: + return 0 + case FieldDescriptorProto_TYPE_SFIXED32: + return 5 + case FieldDescriptorProto_TYPE_SFIXED64: + return 1 + case FieldDescriptorProto_TYPE_SINT32: + return 0 + case FieldDescriptorProto_TYPE_SINT64: + return 0 + } + panic("unreachable") +} + +func (field *FieldDescriptorProto) GetKeyUint64() (x uint64) { + packed := field.IsPacked() + wireType := field.WireType() + fieldNumber := field.GetNumber() + if packed { + wireType = 2 + } + x = uint64(uint32(fieldNumber)<<3 | uint32(wireType)) + return x +} + +func (field *FieldDescriptorProto) GetKey3Uint64() (x uint64) { + packed := field.IsPacked3() + wireType := field.WireType() + fieldNumber := field.GetNumber() + if packed { + wireType = 2 + } + x = uint64(uint32(fieldNumber)<<3 | uint32(wireType)) + return x +} + +func (field *FieldDescriptorProto) GetKey() []byte { + x := field.GetKeyUint64() + i := 0 + keybuf := make([]byte, 0) + for i = 0; x > 127; i++ { + keybuf = append(keybuf, 0x80|uint8(x&0x7F)) + x >>= 7 + } + keybuf = append(keybuf, uint8(x)) + return keybuf +} + +func (field *FieldDescriptorProto) GetKey3() []byte { + x := field.GetKey3Uint64() + i := 0 + keybuf := make([]byte, 0) + for i = 0; x > 127; i++ { + keybuf = append(keybuf, 0x80|uint8(x&0x7F)) + x >>= 7 + } + keybuf = append(keybuf, uint8(x)) + return keybuf +} + +func (desc *FileDescriptorSet) GetField(packageName, messageName, fieldName string) *FieldDescriptorProto { + msg := desc.GetMessage(packageName, messageName) + if msg == nil { + return nil + } + for _, field := range msg.GetField() { + if field.GetName() == fieldName { + return field + } + } + return nil +} + +func (file *FileDescriptorProto) GetMessage(typeName string) *DescriptorProto { + for _, msg := range file.GetMessageType() { + if msg.GetName() == typeName { + return msg + } + nes := file.GetNestedMessage(msg, strings.TrimPrefix(typeName, msg.GetName()+".")) + if nes != nil { + return nes + } + } + return nil +} + +func (file *FileDescriptorProto) GetNestedMessage(msg *DescriptorProto, typeName string) *DescriptorProto { + for _, nes := range msg.GetNestedType() { + if nes.GetName() == typeName { + return nes + } + res := file.GetNestedMessage(nes, strings.TrimPrefix(typeName, nes.GetName()+".")) + if res != nil { + return res + } + } + return nil +} + +func (desc *FileDescriptorSet) GetMessage(packageName string, typeName string) *DescriptorProto { + for _, file := range desc.GetFile() { + if strings.Map(dotToUnderscore, file.GetPackage()) != strings.Map(dotToUnderscore, packageName) { + continue + } + for _, msg := range file.GetMessageType() { + if msg.GetName() == typeName { + return msg + } + } + for _, msg := range file.GetMessageType() { + for _, nes := range msg.GetNestedType() { + if nes.GetName() == typeName { + return nes + } + if msg.GetName()+"."+nes.GetName() == typeName { + return nes + } + } + } + } + return nil +} + +func (desc *FileDescriptorSet) IsProto3(packageName string, typeName string) bool { + for _, file := range desc.GetFile() { + if strings.Map(dotToUnderscore, file.GetPackage()) != strings.Map(dotToUnderscore, packageName) { + continue + } + for _, msg := range file.GetMessageType() { + if msg.GetName() == typeName { + return file.GetSyntax() == "proto3" + } + } + for _, msg := range file.GetMessageType() { + for _, nes := range msg.GetNestedType() { + if nes.GetName() == typeName { + return file.GetSyntax() == "proto3" + } + if msg.GetName()+"."+nes.GetName() == typeName { + return file.GetSyntax() == "proto3" + } + } + } + } + return false +} + +func (msg *DescriptorProto) IsExtendable() bool { + return len(msg.GetExtensionRange()) > 0 +} + +func (desc *FileDescriptorSet) FindExtension(packageName string, typeName string, fieldName string) (extPackageName string, field *FieldDescriptorProto) { + parent := desc.GetMessage(packageName, typeName) + if parent == nil { + return "", nil + } + if !parent.IsExtendable() { + return "", nil + } + extendee := "." + packageName + "." + typeName + for _, file := range desc.GetFile() { + for _, ext := range file.GetExtension() { + if strings.Map(dotToUnderscore, file.GetPackage()) == strings.Map(dotToUnderscore, packageName) { + if !(ext.GetExtendee() == typeName || ext.GetExtendee() == extendee) { + continue + } + } else { + if ext.GetExtendee() != extendee { + continue + } + } + if ext.GetName() == fieldName { + return file.GetPackage(), ext + } + } + } + return "", nil +} + +func (desc *FileDescriptorSet) FindExtensionByFieldNumber(packageName string, typeName string, fieldNum int32) (extPackageName string, field *FieldDescriptorProto) { + parent := desc.GetMessage(packageName, typeName) + if parent == nil { + return "", nil + } + if !parent.IsExtendable() { + return "", nil + } + extendee := "." + packageName + "." + typeName + for _, file := range desc.GetFile() { + for _, ext := range file.GetExtension() { + if strings.Map(dotToUnderscore, file.GetPackage()) == strings.Map(dotToUnderscore, packageName) { + if !(ext.GetExtendee() == typeName || ext.GetExtendee() == extendee) { + continue + } + } else { + if ext.GetExtendee() != extendee { + continue + } + } + if ext.GetNumber() == fieldNum { + return file.GetPackage(), ext + } + } + } + return "", nil +} + +func (desc *FileDescriptorSet) FindMessage(packageName string, typeName string, fieldName string) (msgPackageName string, msgName string) { + parent := desc.GetMessage(packageName, typeName) + if parent == nil { + return "", "" + } + field := parent.GetFieldDescriptor(fieldName) + if field == nil { + var extPackageName string + extPackageName, field = desc.FindExtension(packageName, typeName, fieldName) + if field == nil { + return "", "" + } + packageName = extPackageName + } + typeNames := strings.Split(field.GetTypeName(), ".") + if len(typeNames) == 1 { + msg := desc.GetMessage(packageName, typeName) + if msg == nil { + return "", "" + } + return packageName, msg.GetName() + } + if len(typeNames) > 2 { + for i := 1; i < len(typeNames)-1; i++ { + packageName = strings.Join(typeNames[1:len(typeNames)-i], ".") + typeName = strings.Join(typeNames[len(typeNames)-i:], ".") + msg := desc.GetMessage(packageName, typeName) + if msg != nil { + typeNames := strings.Split(msg.GetName(), ".") + if len(typeNames) == 1 { + return packageName, msg.GetName() + } + return strings.Join(typeNames[1:len(typeNames)-1], "."), typeNames[len(typeNames)-1] + } + } + } + return "", "" +} + +func (msg *DescriptorProto) GetFieldDescriptor(fieldName string) *FieldDescriptorProto { + for _, field := range msg.GetField() { + if field.GetName() == fieldName { + return field + } + } + return nil +} + +func (desc *FileDescriptorSet) GetEnum(packageName string, typeName string) *EnumDescriptorProto { + for _, file := range desc.GetFile() { + if strings.Map(dotToUnderscore, file.GetPackage()) != strings.Map(dotToUnderscore, packageName) { + continue + } + for _, enum := range file.GetEnumType() { + if enum.GetName() == typeName { + return enum + } + } + } + return nil +} + +func (f *FieldDescriptorProto) IsEnum() bool { + return *f.Type == FieldDescriptorProto_TYPE_ENUM +} + +func (f *FieldDescriptorProto) IsMessage() bool { + return *f.Type == FieldDescriptorProto_TYPE_MESSAGE +} + +func (f *FieldDescriptorProto) IsBytes() bool { + return *f.Type == FieldDescriptorProto_TYPE_BYTES +} + +func (f *FieldDescriptorProto) IsRepeated() bool { + return f.Label != nil && *f.Label == FieldDescriptorProto_LABEL_REPEATED +} + +func (f *FieldDescriptorProto) IsString() bool { + return *f.Type == FieldDescriptorProto_TYPE_STRING +} + +func (f *FieldDescriptorProto) IsBool() bool { + return *f.Type == FieldDescriptorProto_TYPE_BOOL +} + +func (f *FieldDescriptorProto) IsRequired() bool { + return f.Label != nil && *f.Label == FieldDescriptorProto_LABEL_REQUIRED +} + +func (f *FieldDescriptorProto) IsPacked() bool { + return f.Options != nil && f.GetOptions().GetPacked() +} + +func (f *FieldDescriptorProto) IsPacked3() bool { + if f.IsRepeated() && f.IsScalar() { + if f.Options == nil || f.GetOptions().Packed == nil { + return true + } + return f.Options != nil && f.GetOptions().GetPacked() + } + return false +} + +func (m *DescriptorProto) HasExtension() bool { + return len(m.ExtensionRange) > 0 +} diff --git a/vendor/github.com/gogo/protobuf/sortkeys/sortkeys.go b/vendor/github.com/gogo/protobuf/sortkeys/sortkeys.go new file mode 100644 index 000000000000..ceadde6a5e10 --- /dev/null +++ b/vendor/github.com/gogo/protobuf/sortkeys/sortkeys.go @@ -0,0 +1,101 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2013, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +package sortkeys + +import ( + "sort" +) + +func Strings(l []string) { + sort.Strings(l) +} + +func Float64s(l []float64) { + sort.Float64s(l) +} + +func Float32s(l []float32) { + sort.Sort(Float32Slice(l)) +} + +func Int64s(l []int64) { + sort.Sort(Int64Slice(l)) +} + +func Int32s(l []int32) { + sort.Sort(Int32Slice(l)) +} + +func Uint64s(l []uint64) { + sort.Sort(Uint64Slice(l)) +} + +func Uint32s(l []uint32) { + sort.Sort(Uint32Slice(l)) +} + +func Bools(l []bool) { + sort.Sort(BoolSlice(l)) +} + +type BoolSlice []bool + +func (p BoolSlice) Len() int { return len(p) } +func (p BoolSlice) Less(i, j int) bool { return p[j] } +func (p BoolSlice) Swap(i, j int) { p[i], p[j] = p[j], p[i] } + +type Int64Slice []int64 + +func (p Int64Slice) Len() int { return len(p) } +func (p Int64Slice) Less(i, j int) bool { return p[i] < p[j] } +func (p Int64Slice) Swap(i, j int) { p[i], p[j] = p[j], p[i] } + +type Int32Slice []int32 + +func (p Int32Slice) Len() int { return len(p) } +func (p Int32Slice) Less(i, j int) bool { return p[i] < p[j] } +func (p Int32Slice) Swap(i, j int) { p[i], p[j] = p[j], p[i] } + +type Uint64Slice []uint64 + +func (p Uint64Slice) Len() int { return len(p) } +func (p Uint64Slice) Less(i, j int) bool { return p[i] < p[j] } +func (p Uint64Slice) Swap(i, j int) { p[i], p[j] = p[j], p[i] } + +type Uint32Slice []uint32 + +func (p Uint32Slice) Len() int { return len(p) } +func (p Uint32Slice) Less(i, j int) bool { return p[i] < p[j] } +func (p Uint32Slice) Swap(i, j int) { p[i], p[j] = p[j], p[i] } + +type Float32Slice []float32 + +func (p Float32Slice) Len() int { return len(p) } +func (p Float32Slice) Less(i, j int) bool { return p[i] < p[j] } +func (p Float32Slice) Swap(i, j int) { p[i], p[j] = p[j], p[i] } diff --git a/vendor/github.com/gogo/protobuf/types/any.go b/vendor/github.com/gogo/protobuf/types/any.go new file mode 100644 index 000000000000..df4787de37c5 --- /dev/null +++ b/vendor/github.com/gogo/protobuf/types/any.go @@ -0,0 +1,140 @@ +// Go support for Protocol Buffers - Google's data interchange format +// +// Copyright 2016 The Go Authors. All rights reserved. +// https://github.com/golang/protobuf +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +package types + +// This file implements functions to marshal proto.Message to/from +// google.protobuf.Any message. + +import ( + "fmt" + "reflect" + "strings" + + "github.com/gogo/protobuf/proto" +) + +const googleApis = "type.googleapis.com/" + +// AnyMessageName returns the name of the message contained in a google.protobuf.Any message. +// +// Note that regular type assertions should be done using the Is +// function. AnyMessageName is provided for less common use cases like filtering a +// sequence of Any messages based on a set of allowed message type names. +func AnyMessageName(any *Any) (string, error) { + if any == nil { + return "", fmt.Errorf("message is nil") + } + slash := strings.LastIndex(any.TypeUrl, "/") + if slash < 0 { + return "", fmt.Errorf("message type url %q is invalid", any.TypeUrl) + } + return any.TypeUrl[slash+1:], nil +} + +// MarshalAny takes the protocol buffer and encodes it into google.protobuf.Any. +func MarshalAny(pb proto.Message) (*Any, error) { + value, err := proto.Marshal(pb) + if err != nil { + return nil, err + } + return &Any{TypeUrl: googleApis + proto.MessageName(pb), Value: value}, nil +} + +// DynamicAny is a value that can be passed to UnmarshalAny to automatically +// allocate a proto.Message for the type specified in a google.protobuf.Any +// message. The allocated message is stored in the embedded proto.Message. +// +// Example: +// +// var x ptypes.DynamicAny +// if err := ptypes.UnmarshalAny(a, &x); err != nil { ... } +// fmt.Printf("unmarshaled message: %v", x.Message) +type DynamicAny struct { + proto.Message +} + +// Empty returns a new proto.Message of the type specified in a +// google.protobuf.Any message. It returns an error if corresponding message +// type isn't linked in. +func EmptyAny(any *Any) (proto.Message, error) { + aname, err := AnyMessageName(any) + if err != nil { + return nil, err + } + + t := proto.MessageType(aname) + if t == nil { + return nil, fmt.Errorf("any: message type %q isn't linked in", aname) + } + return reflect.New(t.Elem()).Interface().(proto.Message), nil +} + +// UnmarshalAny parses the protocol buffer representation in a google.protobuf.Any +// message and places the decoded result in pb. It returns an error if type of +// contents of Any message does not match type of pb message. +// +// pb can be a proto.Message, or a *DynamicAny. +func UnmarshalAny(any *Any, pb proto.Message) error { + if d, ok := pb.(*DynamicAny); ok { + if d.Message == nil { + var err error + d.Message, err = EmptyAny(any) + if err != nil { + return err + } + } + return UnmarshalAny(any, d.Message) + } + + aname, err := AnyMessageName(any) + if err != nil { + return err + } + + mname := proto.MessageName(pb) + if aname != mname { + return fmt.Errorf("mismatched message type: got %q want %q", aname, mname) + } + return proto.Unmarshal(any.Value, pb) +} + +// Is returns true if any value contains a given message type. +func Is(any *Any, pb proto.Message) bool { + // The following is equivalent to AnyMessageName(any) == proto.MessageName(pb), + // but it avoids scanning TypeUrl for the slash. + if any == nil { + return false + } + name := proto.MessageName(pb) + prefix := len(any.TypeUrl) - len(name) + return prefix >= 1 && any.TypeUrl[prefix-1] == '/' && any.TypeUrl[prefix:] == name +} diff --git a/vendor/github.com/gogo/protobuf/types/any.pb.go b/vendor/github.com/gogo/protobuf/types/any.pb.go new file mode 100644 index 000000000000..cb774dbce4a0 --- /dev/null +++ b/vendor/github.com/gogo/protobuf/types/any.pb.go @@ -0,0 +1,703 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: google/protobuf/any.proto + +package types + +import proto "github.com/gogo/protobuf/proto" +import fmt "fmt" +import math "math" + +import bytes "bytes" + +import strings "strings" +import reflect "reflect" + +import io "io" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package + +// `Any` contains an arbitrary serialized protocol buffer message along with a +// URL that describes the type of the serialized message. +// +// Protobuf library provides support to pack/unpack Any values in the form +// of utility functions or additional generated methods of the Any type. +// +// Example 1: Pack and unpack a message in C++. +// +// Foo foo = ...; +// Any any; +// any.PackFrom(foo); +// ... +// if (any.UnpackTo(&foo)) { +// ... +// } +// +// Example 2: Pack and unpack a message in Java. +// +// Foo foo = ...; +// Any any = Any.pack(foo); +// ... +// if (any.is(Foo.class)) { +// foo = any.unpack(Foo.class); +// } +// +// Example 3: Pack and unpack a message in Python. +// +// foo = Foo(...) +// any = Any() +// any.Pack(foo) +// ... +// if any.Is(Foo.DESCRIPTOR): +// any.Unpack(foo) +// ... +// +// Example 4: Pack and unpack a message in Go +// +// foo := &pb.Foo{...} +// any, err := ptypes.MarshalAny(foo) +// ... +// foo := &pb.Foo{} +// if err := ptypes.UnmarshalAny(any, foo); err != nil { +// ... +// } +// +// The pack methods provided by protobuf library will by default use +// 'type.googleapis.com/full.type.name' as the type URL and the unpack +// methods only use the fully qualified type name after the last '/' +// in the type URL, for example "foo.bar.com/x/y.z" will yield type +// name "y.z". +// +// +// JSON +// ==== +// The JSON representation of an `Any` value uses the regular +// representation of the deserialized, embedded message, with an +// additional field `@type` which contains the type URL. Example: +// +// package google.profile; +// message Person { +// string first_name = 1; +// string last_name = 2; +// } +// +// { +// "@type": "type.googleapis.com/google.profile.Person", +// "firstName": , +// "lastName": +// } +// +// If the embedded message type is well-known and has a custom JSON +// representation, that representation will be embedded adding a field +// `value` which holds the custom JSON in addition to the `@type` +// field. Example (for message [google.protobuf.Duration][]): +// +// { +// "@type": "type.googleapis.com/google.protobuf.Duration", +// "value": "1.212s" +// } +// +type Any struct { + // A URL/resource name that uniquely identifies the type of the serialized + // protocol buffer message. The last segment of the URL's path must represent + // the fully qualified name of the type (as in + // `path/google.protobuf.Duration`). The name should be in a canonical form + // (e.g., leading "." is not accepted). + // + // In practice, teams usually precompile into the binary all types that they + // expect it to use in the context of Any. However, for URLs which use the + // scheme `http`, `https`, or no scheme, one can optionally set up a type + // server that maps type URLs to message definitions as follows: + // + // * If no scheme is provided, `https` is assumed. + // * An HTTP GET on the URL must yield a [google.protobuf.Type][] + // value in binary format, or produce an error. + // * Applications are allowed to cache lookup results based on the + // URL, or have them precompiled into a binary to avoid any + // lookup. Therefore, binary compatibility needs to be preserved + // on changes to types. (Use versioned type names to manage + // breaking changes.) + // + // Note: this functionality is not currently available in the official + // protobuf release, and it is not used for type URLs beginning with + // type.googleapis.com. + // + // Schemes other than `http`, `https` (or the empty scheme) might be + // used with implementation specific semantics. + // + TypeUrl string `protobuf:"bytes,1,opt,name=type_url,json=typeUrl,proto3" json:"type_url,omitempty"` + // Must be a valid serialized protocol buffer of the above specified type. + Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Any) Reset() { *m = Any{} } +func (*Any) ProtoMessage() {} +func (*Any) Descriptor() ([]byte, []int) { + return fileDescriptor_any_f098d1a3c592d16a, []int{0} +} +func (*Any) XXX_WellKnownType() string { return "Any" } +func (m *Any) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Any) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Any.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *Any) XXX_Merge(src proto.Message) { + xxx_messageInfo_Any.Merge(dst, src) +} +func (m *Any) XXX_Size() int { + return m.Size() +} +func (m *Any) XXX_DiscardUnknown() { + xxx_messageInfo_Any.DiscardUnknown(m) +} + +var xxx_messageInfo_Any proto.InternalMessageInfo + +func (m *Any) GetTypeUrl() string { + if m != nil { + return m.TypeUrl + } + return "" +} + +func (m *Any) GetValue() []byte { + if m != nil { + return m.Value + } + return nil +} + +func (*Any) XXX_MessageName() string { + return "google.protobuf.Any" +} +func init() { + proto.RegisterType((*Any)(nil), "google.protobuf.Any") +} +func (this *Any) Compare(that interface{}) int { + if that == nil { + if this == nil { + return 0 + } + return 1 + } + + that1, ok := that.(*Any) + if !ok { + that2, ok := that.(Any) + if ok { + that1 = &that2 + } else { + return 1 + } + } + if that1 == nil { + if this == nil { + return 0 + } + return 1 + } else if this == nil { + return -1 + } + if this.TypeUrl != that1.TypeUrl { + if this.TypeUrl < that1.TypeUrl { + return -1 + } + return 1 + } + if c := bytes.Compare(this.Value, that1.Value); c != 0 { + return c + } + if c := bytes.Compare(this.XXX_unrecognized, that1.XXX_unrecognized); c != 0 { + return c + } + return 0 +} +func (this *Any) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Any) + if !ok { + that2, ok := that.(Any) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.TypeUrl != that1.TypeUrl { + return false + } + if !bytes.Equal(this.Value, that1.Value) { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *Any) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 6) + s = append(s, "&types.Any{") + s = append(s, "TypeUrl: "+fmt.Sprintf("%#v", this.TypeUrl)+",\n") + s = append(s, "Value: "+fmt.Sprintf("%#v", this.Value)+",\n") + if this.XXX_unrecognized != nil { + s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") + } + s = append(s, "}") + return strings.Join(s, "") +} +func valueToGoStringAny(v interface{}, typ string) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv) +} +func (m *Any) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Any) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.TypeUrl) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintAny(dAtA, i, uint64(len(m.TypeUrl))) + i += copy(dAtA[i:], m.TypeUrl) + } + if len(m.Value) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintAny(dAtA, i, uint64(len(m.Value))) + i += copy(dAtA[i:], m.Value) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func encodeVarintAny(dAtA []byte, offset int, v uint64) int { + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return offset + 1 +} +func NewPopulatedAny(r randyAny, easy bool) *Any { + this := &Any{} + this.TypeUrl = string(randStringAny(r)) + v1 := r.Intn(100) + this.Value = make([]byte, v1) + for i := 0; i < v1; i++ { + this.Value[i] = byte(r.Intn(256)) + } + if !easy && r.Intn(10) != 0 { + this.XXX_unrecognized = randUnrecognizedAny(r, 3) + } + return this +} + +type randyAny interface { + Float32() float32 + Float64() float64 + Int63() int64 + Int31() int32 + Uint32() uint32 + Intn(n int) int +} + +func randUTF8RuneAny(r randyAny) rune { + ru := r.Intn(62) + if ru < 10 { + return rune(ru + 48) + } else if ru < 36 { + return rune(ru + 55) + } + return rune(ru + 61) +} +func randStringAny(r randyAny) string { + v2 := r.Intn(100) + tmps := make([]rune, v2) + for i := 0; i < v2; i++ { + tmps[i] = randUTF8RuneAny(r) + } + return string(tmps) +} +func randUnrecognizedAny(r randyAny, maxFieldNumber int) (dAtA []byte) { + l := r.Intn(5) + for i := 0; i < l; i++ { + wire := r.Intn(4) + if wire == 3 { + wire = 5 + } + fieldNumber := maxFieldNumber + r.Intn(100) + dAtA = randFieldAny(dAtA, r, fieldNumber, wire) + } + return dAtA +} +func randFieldAny(dAtA []byte, r randyAny, fieldNumber int, wire int) []byte { + key := uint32(fieldNumber)<<3 | uint32(wire) + switch wire { + case 0: + dAtA = encodeVarintPopulateAny(dAtA, uint64(key)) + v3 := r.Int63() + if r.Intn(2) == 0 { + v3 *= -1 + } + dAtA = encodeVarintPopulateAny(dAtA, uint64(v3)) + case 1: + dAtA = encodeVarintPopulateAny(dAtA, uint64(key)) + dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256))) + case 2: + dAtA = encodeVarintPopulateAny(dAtA, uint64(key)) + ll := r.Intn(100) + dAtA = encodeVarintPopulateAny(dAtA, uint64(ll)) + for j := 0; j < ll; j++ { + dAtA = append(dAtA, byte(r.Intn(256))) + } + default: + dAtA = encodeVarintPopulateAny(dAtA, uint64(key)) + dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256))) + } + return dAtA +} +func encodeVarintPopulateAny(dAtA []byte, v uint64) []byte { + for v >= 1<<7 { + dAtA = append(dAtA, uint8(uint64(v)&0x7f|0x80)) + v >>= 7 + } + dAtA = append(dAtA, uint8(v)) + return dAtA +} +func (m *Any) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.TypeUrl) + if l > 0 { + n += 1 + l + sovAny(uint64(l)) + } + l = len(m.Value) + if l > 0 { + n += 1 + l + sovAny(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func sovAny(x uint64) (n int) { + for { + n++ + x >>= 7 + if x == 0 { + break + } + } + return n +} +func sozAny(x uint64) (n int) { + return sovAny(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (this *Any) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&Any{`, + `TypeUrl:` + fmt.Sprintf("%v", this.TypeUrl) + `,`, + `Value:` + fmt.Sprintf("%v", this.Value) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func valueToStringAny(v interface{}) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("*%v", pv) +} +func (m *Any) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAny + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Any: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Any: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TypeUrl", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAny + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthAny + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TypeUrl = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAny + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthAny + } + postIndex := iNdEx + byteLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Value = append(m.Value[:0], dAtA[iNdEx:postIndex]...) + if m.Value == nil { + m.Value = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipAny(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthAny + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipAny(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowAny + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowAny + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + return iNdEx, nil + case 1: + iNdEx += 8 + return iNdEx, nil + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowAny + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + iNdEx += length + if length < 0 { + return 0, ErrInvalidLengthAny + } + return iNdEx, nil + case 3: + for { + var innerWire uint64 + var start int = iNdEx + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowAny + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + innerWire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + innerWireType := int(innerWire & 0x7) + if innerWireType == 4 { + break + } + next, err := skipAny(dAtA[start:]) + if err != nil { + return 0, err + } + iNdEx = start + next + } + return iNdEx, nil + case 4: + return iNdEx, nil + case 5: + iNdEx += 4 + return iNdEx, nil + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + } + panic("unreachable") +} + +var ( + ErrInvalidLengthAny = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowAny = fmt.Errorf("proto: integer overflow") +) + +func init() { proto.RegisterFile("google/protobuf/any.proto", fileDescriptor_any_f098d1a3c592d16a) } + +var fileDescriptor_any_f098d1a3c592d16a = []byte{ + // 211 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4c, 0xcf, 0xcf, 0x4f, + 0xcf, 0x49, 0xd5, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0x4f, 0x2a, 0x4d, 0xd3, 0x4f, 0xcc, 0xab, 0xd4, + 0x03, 0x73, 0x84, 0xf8, 0x21, 0x52, 0x7a, 0x30, 0x29, 0x25, 0x33, 0x2e, 0x66, 0xc7, 0xbc, 0x4a, + 0x21, 0x49, 0x2e, 0x8e, 0x92, 0xca, 0x82, 0xd4, 0xf8, 0xd2, 0xa2, 0x1c, 0x09, 0x46, 0x05, 0x46, + 0x0d, 0xce, 0x20, 0x76, 0x10, 0x3f, 0xb4, 0x28, 0x47, 0x48, 0x84, 0x8b, 0xb5, 0x2c, 0x31, 0xa7, + 0x34, 0x55, 0x82, 0x49, 0x81, 0x51, 0x83, 0x27, 0x08, 0xc2, 0x71, 0xaa, 0xbf, 0xf1, 0x50, 0x8e, + 0xe1, 0xc3, 0x43, 0x39, 0xc6, 0x1f, 0x0f, 0xe5, 0x18, 0x1b, 0x1e, 0xc9, 0x31, 0xae, 0x78, 0x24, + 0xc7, 0x78, 0xe2, 0x91, 0x1c, 0xe3, 0x85, 0x47, 0x72, 0x8c, 0x0f, 0x1e, 0xc9, 0x31, 0xbe, 0x78, + 0x24, 0xc7, 0xf0, 0x01, 0x24, 0xfe, 0x58, 0x8e, 0xf1, 0xc4, 0x63, 0x39, 0x46, 0x2e, 0xe1, 0xe4, + 0xfc, 0x5c, 0x3d, 0x34, 0xeb, 0x9d, 0x38, 0x1c, 0xf3, 0x2a, 0x03, 0x40, 0x9c, 0x00, 0xc6, 0x28, + 0x56, 0x90, 0x8d, 0xc5, 0x8b, 0x98, 0x98, 0xdd, 0x03, 0x9c, 0x56, 0x31, 0xc9, 0xb9, 0x43, 0x94, + 0x06, 0x40, 0x95, 0xea, 0x85, 0xa7, 0xe6, 0xe4, 0x78, 0xe7, 0xe5, 0x97, 0xe7, 0x85, 0x80, 0x94, + 0x25, 0xb1, 0x81, 0xcd, 0x30, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0xb7, 0x81, 0x82, 0xd3, 0xed, + 0x00, 0x00, 0x00, +} diff --git a/vendor/github.com/gogo/protobuf/types/api.pb.go b/vendor/github.com/gogo/protobuf/types/api.pb.go new file mode 100644 index 000000000000..bdc449588516 --- /dev/null +++ b/vendor/github.com/gogo/protobuf/types/api.pb.go @@ -0,0 +1,2067 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: google/protobuf/api.proto + +package types + +import proto "github.com/gogo/protobuf/proto" +import fmt "fmt" +import math "math" + +import bytes "bytes" + +import strings "strings" +import reflect "reflect" + +import io "io" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package + +// Api is a light-weight descriptor for an API Interface. +// +// Interfaces are also described as "protocol buffer services" in some contexts, +// such as by the "service" keyword in a .proto file, but they are different +// from API Services, which represent a concrete implementation of an interface +// as opposed to simply a description of methods and bindings. They are also +// sometimes simply referred to as "APIs" in other contexts, such as the name of +// this message itself. See https://cloud.google.com/apis/design/glossary for +// detailed terminology. +type Api struct { + // The fully qualified name of this interface, including package name + // followed by the interface's simple name. + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // The methods of this interface, in unspecified order. + Methods []*Method `protobuf:"bytes,2,rep,name=methods" json:"methods,omitempty"` + // Any metadata attached to the interface. + Options []*Option `protobuf:"bytes,3,rep,name=options" json:"options,omitempty"` + // A version string for this interface. If specified, must have the form + // `major-version.minor-version`, as in `1.10`. If the minor version is + // omitted, it defaults to zero. If the entire version field is empty, the + // major version is derived from the package name, as outlined below. If the + // field is not empty, the version in the package name will be verified to be + // consistent with what is provided here. + // + // The versioning schema uses [semantic + // versioning](http://semver.org) where the major version number + // indicates a breaking change and the minor version an additive, + // non-breaking change. Both version numbers are signals to users + // what to expect from different versions, and should be carefully + // chosen based on the product plan. + // + // The major version is also reflected in the package name of the + // interface, which must end in `v`, as in + // `google.feature.v1`. For major versions 0 and 1, the suffix can + // be omitted. Zero major versions must only be used for + // experimental, non-GA interfaces. + // + // + Version string `protobuf:"bytes,4,opt,name=version,proto3" json:"version,omitempty"` + // Source context for the protocol buffer service represented by this + // message. + SourceContext *SourceContext `protobuf:"bytes,5,opt,name=source_context,json=sourceContext" json:"source_context,omitempty"` + // Included interfaces. See [Mixin][]. + Mixins []*Mixin `protobuf:"bytes,6,rep,name=mixins" json:"mixins,omitempty"` + // The source syntax of the service. + Syntax Syntax `protobuf:"varint,7,opt,name=syntax,proto3,enum=google.protobuf.Syntax" json:"syntax,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Api) Reset() { *m = Api{} } +func (*Api) ProtoMessage() {} +func (*Api) Descriptor() ([]byte, []int) { + return fileDescriptor_api_a4406062c749da1f, []int{0} +} +func (m *Api) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Api) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Api.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *Api) XXX_Merge(src proto.Message) { + xxx_messageInfo_Api.Merge(dst, src) +} +func (m *Api) XXX_Size() int { + return m.Size() +} +func (m *Api) XXX_DiscardUnknown() { + xxx_messageInfo_Api.DiscardUnknown(m) +} + +var xxx_messageInfo_Api proto.InternalMessageInfo + +func (m *Api) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *Api) GetMethods() []*Method { + if m != nil { + return m.Methods + } + return nil +} + +func (m *Api) GetOptions() []*Option { + if m != nil { + return m.Options + } + return nil +} + +func (m *Api) GetVersion() string { + if m != nil { + return m.Version + } + return "" +} + +func (m *Api) GetSourceContext() *SourceContext { + if m != nil { + return m.SourceContext + } + return nil +} + +func (m *Api) GetMixins() []*Mixin { + if m != nil { + return m.Mixins + } + return nil +} + +func (m *Api) GetSyntax() Syntax { + if m != nil { + return m.Syntax + } + return Syntax_SYNTAX_PROTO2 +} + +func (*Api) XXX_MessageName() string { + return "google.protobuf.Api" +} + +// Method represents a method of an API interface. +type Method struct { + // The simple name of this method. + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // A URL of the input message type. + RequestTypeUrl string `protobuf:"bytes,2,opt,name=request_type_url,json=requestTypeUrl,proto3" json:"request_type_url,omitempty"` + // If true, the request is streamed. + RequestStreaming bool `protobuf:"varint,3,opt,name=request_streaming,json=requestStreaming,proto3" json:"request_streaming,omitempty"` + // The URL of the output message type. + ResponseTypeUrl string `protobuf:"bytes,4,opt,name=response_type_url,json=responseTypeUrl,proto3" json:"response_type_url,omitempty"` + // If true, the response is streamed. + ResponseStreaming bool `protobuf:"varint,5,opt,name=response_streaming,json=responseStreaming,proto3" json:"response_streaming,omitempty"` + // Any metadata attached to the method. + Options []*Option `protobuf:"bytes,6,rep,name=options" json:"options,omitempty"` + // The source syntax of this method. + Syntax Syntax `protobuf:"varint,7,opt,name=syntax,proto3,enum=google.protobuf.Syntax" json:"syntax,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Method) Reset() { *m = Method{} } +func (*Method) ProtoMessage() {} +func (*Method) Descriptor() ([]byte, []int) { + return fileDescriptor_api_a4406062c749da1f, []int{1} +} +func (m *Method) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Method) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Method.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *Method) XXX_Merge(src proto.Message) { + xxx_messageInfo_Method.Merge(dst, src) +} +func (m *Method) XXX_Size() int { + return m.Size() +} +func (m *Method) XXX_DiscardUnknown() { + xxx_messageInfo_Method.DiscardUnknown(m) +} + +var xxx_messageInfo_Method proto.InternalMessageInfo + +func (m *Method) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *Method) GetRequestTypeUrl() string { + if m != nil { + return m.RequestTypeUrl + } + return "" +} + +func (m *Method) GetRequestStreaming() bool { + if m != nil { + return m.RequestStreaming + } + return false +} + +func (m *Method) GetResponseTypeUrl() string { + if m != nil { + return m.ResponseTypeUrl + } + return "" +} + +func (m *Method) GetResponseStreaming() bool { + if m != nil { + return m.ResponseStreaming + } + return false +} + +func (m *Method) GetOptions() []*Option { + if m != nil { + return m.Options + } + return nil +} + +func (m *Method) GetSyntax() Syntax { + if m != nil { + return m.Syntax + } + return Syntax_SYNTAX_PROTO2 +} + +func (*Method) XXX_MessageName() string { + return "google.protobuf.Method" +} + +// Declares an API Interface to be included in this interface. The including +// interface must redeclare all the methods from the included interface, but +// documentation and options are inherited as follows: +// +// - If after comment and whitespace stripping, the documentation +// string of the redeclared method is empty, it will be inherited +// from the original method. +// +// - Each annotation belonging to the service config (http, +// visibility) which is not set in the redeclared method will be +// inherited. +// +// - If an http annotation is inherited, the path pattern will be +// modified as follows. Any version prefix will be replaced by the +// version of the including interface plus the [root][] path if +// specified. +// +// Example of a simple mixin: +// +// package google.acl.v1; +// service AccessControl { +// // Get the underlying ACL object. +// rpc GetAcl(GetAclRequest) returns (Acl) { +// option (google.api.http).get = "/v1/{resource=**}:getAcl"; +// } +// } +// +// package google.storage.v2; +// service Storage { +// rpc GetAcl(GetAclRequest) returns (Acl); +// +// // Get a data record. +// rpc GetData(GetDataRequest) returns (Data) { +// option (google.api.http).get = "/v2/{resource=**}"; +// } +// } +// +// Example of a mixin configuration: +// +// apis: +// - name: google.storage.v2.Storage +// mixins: +// - name: google.acl.v1.AccessControl +// +// The mixin construct implies that all methods in `AccessControl` are +// also declared with same name and request/response types in +// `Storage`. A documentation generator or annotation processor will +// see the effective `Storage.GetAcl` method after inherting +// documentation and annotations as follows: +// +// service Storage { +// // Get the underlying ACL object. +// rpc GetAcl(GetAclRequest) returns (Acl) { +// option (google.api.http).get = "/v2/{resource=**}:getAcl"; +// } +// ... +// } +// +// Note how the version in the path pattern changed from `v1` to `v2`. +// +// If the `root` field in the mixin is specified, it should be a +// relative path under which inherited HTTP paths are placed. Example: +// +// apis: +// - name: google.storage.v2.Storage +// mixins: +// - name: google.acl.v1.AccessControl +// root: acls +// +// This implies the following inherited HTTP annotation: +// +// service Storage { +// // Get the underlying ACL object. +// rpc GetAcl(GetAclRequest) returns (Acl) { +// option (google.api.http).get = "/v2/acls/{resource=**}:getAcl"; +// } +// ... +// } +type Mixin struct { + // The fully qualified name of the interface which is included. + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // If non-empty specifies a path under which inherited HTTP paths + // are rooted. + Root string `protobuf:"bytes,2,opt,name=root,proto3" json:"root,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Mixin) Reset() { *m = Mixin{} } +func (*Mixin) ProtoMessage() {} +func (*Mixin) Descriptor() ([]byte, []int) { + return fileDescriptor_api_a4406062c749da1f, []int{2} +} +func (m *Mixin) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Mixin) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Mixin.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *Mixin) XXX_Merge(src proto.Message) { + xxx_messageInfo_Mixin.Merge(dst, src) +} +func (m *Mixin) XXX_Size() int { + return m.Size() +} +func (m *Mixin) XXX_DiscardUnknown() { + xxx_messageInfo_Mixin.DiscardUnknown(m) +} + +var xxx_messageInfo_Mixin proto.InternalMessageInfo + +func (m *Mixin) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *Mixin) GetRoot() string { + if m != nil { + return m.Root + } + return "" +} + +func (*Mixin) XXX_MessageName() string { + return "google.protobuf.Mixin" +} +func init() { + proto.RegisterType((*Api)(nil), "google.protobuf.Api") + proto.RegisterType((*Method)(nil), "google.protobuf.Method") + proto.RegisterType((*Mixin)(nil), "google.protobuf.Mixin") +} +func (this *Api) Compare(that interface{}) int { + if that == nil { + if this == nil { + return 0 + } + return 1 + } + + that1, ok := that.(*Api) + if !ok { + that2, ok := that.(Api) + if ok { + that1 = &that2 + } else { + return 1 + } + } + if that1 == nil { + if this == nil { + return 0 + } + return 1 + } else if this == nil { + return -1 + } + if this.Name != that1.Name { + if this.Name < that1.Name { + return -1 + } + return 1 + } + if len(this.Methods) != len(that1.Methods) { + if len(this.Methods) < len(that1.Methods) { + return -1 + } + return 1 + } + for i := range this.Methods { + if c := this.Methods[i].Compare(that1.Methods[i]); c != 0 { + return c + } + } + if len(this.Options) != len(that1.Options) { + if len(this.Options) < len(that1.Options) { + return -1 + } + return 1 + } + for i := range this.Options { + if c := this.Options[i].Compare(that1.Options[i]); c != 0 { + return c + } + } + if this.Version != that1.Version { + if this.Version < that1.Version { + return -1 + } + return 1 + } + if c := this.SourceContext.Compare(that1.SourceContext); c != 0 { + return c + } + if len(this.Mixins) != len(that1.Mixins) { + if len(this.Mixins) < len(that1.Mixins) { + return -1 + } + return 1 + } + for i := range this.Mixins { + if c := this.Mixins[i].Compare(that1.Mixins[i]); c != 0 { + return c + } + } + if this.Syntax != that1.Syntax { + if this.Syntax < that1.Syntax { + return -1 + } + return 1 + } + if c := bytes.Compare(this.XXX_unrecognized, that1.XXX_unrecognized); c != 0 { + return c + } + return 0 +} +func (this *Method) Compare(that interface{}) int { + if that == nil { + if this == nil { + return 0 + } + return 1 + } + + that1, ok := that.(*Method) + if !ok { + that2, ok := that.(Method) + if ok { + that1 = &that2 + } else { + return 1 + } + } + if that1 == nil { + if this == nil { + return 0 + } + return 1 + } else if this == nil { + return -1 + } + if this.Name != that1.Name { + if this.Name < that1.Name { + return -1 + } + return 1 + } + if this.RequestTypeUrl != that1.RequestTypeUrl { + if this.RequestTypeUrl < that1.RequestTypeUrl { + return -1 + } + return 1 + } + if this.RequestStreaming != that1.RequestStreaming { + if !this.RequestStreaming { + return -1 + } + return 1 + } + if this.ResponseTypeUrl != that1.ResponseTypeUrl { + if this.ResponseTypeUrl < that1.ResponseTypeUrl { + return -1 + } + return 1 + } + if this.ResponseStreaming != that1.ResponseStreaming { + if !this.ResponseStreaming { + return -1 + } + return 1 + } + if len(this.Options) != len(that1.Options) { + if len(this.Options) < len(that1.Options) { + return -1 + } + return 1 + } + for i := range this.Options { + if c := this.Options[i].Compare(that1.Options[i]); c != 0 { + return c + } + } + if this.Syntax != that1.Syntax { + if this.Syntax < that1.Syntax { + return -1 + } + return 1 + } + if c := bytes.Compare(this.XXX_unrecognized, that1.XXX_unrecognized); c != 0 { + return c + } + return 0 +} +func (this *Mixin) Compare(that interface{}) int { + if that == nil { + if this == nil { + return 0 + } + return 1 + } + + that1, ok := that.(*Mixin) + if !ok { + that2, ok := that.(Mixin) + if ok { + that1 = &that2 + } else { + return 1 + } + } + if that1 == nil { + if this == nil { + return 0 + } + return 1 + } else if this == nil { + return -1 + } + if this.Name != that1.Name { + if this.Name < that1.Name { + return -1 + } + return 1 + } + if this.Root != that1.Root { + if this.Root < that1.Root { + return -1 + } + return 1 + } + if c := bytes.Compare(this.XXX_unrecognized, that1.XXX_unrecognized); c != 0 { + return c + } + return 0 +} +func (this *Api) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Api) + if !ok { + that2, ok := that.(Api) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Name != that1.Name { + return false + } + if len(this.Methods) != len(that1.Methods) { + return false + } + for i := range this.Methods { + if !this.Methods[i].Equal(that1.Methods[i]) { + return false + } + } + if len(this.Options) != len(that1.Options) { + return false + } + for i := range this.Options { + if !this.Options[i].Equal(that1.Options[i]) { + return false + } + } + if this.Version != that1.Version { + return false + } + if !this.SourceContext.Equal(that1.SourceContext) { + return false + } + if len(this.Mixins) != len(that1.Mixins) { + return false + } + for i := range this.Mixins { + if !this.Mixins[i].Equal(that1.Mixins[i]) { + return false + } + } + if this.Syntax != that1.Syntax { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *Method) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Method) + if !ok { + that2, ok := that.(Method) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Name != that1.Name { + return false + } + if this.RequestTypeUrl != that1.RequestTypeUrl { + return false + } + if this.RequestStreaming != that1.RequestStreaming { + return false + } + if this.ResponseTypeUrl != that1.ResponseTypeUrl { + return false + } + if this.ResponseStreaming != that1.ResponseStreaming { + return false + } + if len(this.Options) != len(that1.Options) { + return false + } + for i := range this.Options { + if !this.Options[i].Equal(that1.Options[i]) { + return false + } + } + if this.Syntax != that1.Syntax { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *Mixin) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Mixin) + if !ok { + that2, ok := that.(Mixin) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Name != that1.Name { + return false + } + if this.Root != that1.Root { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *Api) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 11) + s = append(s, "&types.Api{") + s = append(s, "Name: "+fmt.Sprintf("%#v", this.Name)+",\n") + if this.Methods != nil { + s = append(s, "Methods: "+fmt.Sprintf("%#v", this.Methods)+",\n") + } + if this.Options != nil { + s = append(s, "Options: "+fmt.Sprintf("%#v", this.Options)+",\n") + } + s = append(s, "Version: "+fmt.Sprintf("%#v", this.Version)+",\n") + if this.SourceContext != nil { + s = append(s, "SourceContext: "+fmt.Sprintf("%#v", this.SourceContext)+",\n") + } + if this.Mixins != nil { + s = append(s, "Mixins: "+fmt.Sprintf("%#v", this.Mixins)+",\n") + } + s = append(s, "Syntax: "+fmt.Sprintf("%#v", this.Syntax)+",\n") + if this.XXX_unrecognized != nil { + s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") + } + s = append(s, "}") + return strings.Join(s, "") +} +func (this *Method) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 11) + s = append(s, "&types.Method{") + s = append(s, "Name: "+fmt.Sprintf("%#v", this.Name)+",\n") + s = append(s, "RequestTypeUrl: "+fmt.Sprintf("%#v", this.RequestTypeUrl)+",\n") + s = append(s, "RequestStreaming: "+fmt.Sprintf("%#v", this.RequestStreaming)+",\n") + s = append(s, "ResponseTypeUrl: "+fmt.Sprintf("%#v", this.ResponseTypeUrl)+",\n") + s = append(s, "ResponseStreaming: "+fmt.Sprintf("%#v", this.ResponseStreaming)+",\n") + if this.Options != nil { + s = append(s, "Options: "+fmt.Sprintf("%#v", this.Options)+",\n") + } + s = append(s, "Syntax: "+fmt.Sprintf("%#v", this.Syntax)+",\n") + if this.XXX_unrecognized != nil { + s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") + } + s = append(s, "}") + return strings.Join(s, "") +} +func (this *Mixin) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 6) + s = append(s, "&types.Mixin{") + s = append(s, "Name: "+fmt.Sprintf("%#v", this.Name)+",\n") + s = append(s, "Root: "+fmt.Sprintf("%#v", this.Root)+",\n") + if this.XXX_unrecognized != nil { + s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") + } + s = append(s, "}") + return strings.Join(s, "") +} +func valueToGoStringApi(v interface{}, typ string) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv) +} +func (m *Api) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Api) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Name) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintApi(dAtA, i, uint64(len(m.Name))) + i += copy(dAtA[i:], m.Name) + } + if len(m.Methods) > 0 { + for _, msg := range m.Methods { + dAtA[i] = 0x12 + i++ + i = encodeVarintApi(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if len(m.Options) > 0 { + for _, msg := range m.Options { + dAtA[i] = 0x1a + i++ + i = encodeVarintApi(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if len(m.Version) > 0 { + dAtA[i] = 0x22 + i++ + i = encodeVarintApi(dAtA, i, uint64(len(m.Version))) + i += copy(dAtA[i:], m.Version) + } + if m.SourceContext != nil { + dAtA[i] = 0x2a + i++ + i = encodeVarintApi(dAtA, i, uint64(m.SourceContext.Size())) + n1, err := m.SourceContext.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n1 + } + if len(m.Mixins) > 0 { + for _, msg := range m.Mixins { + dAtA[i] = 0x32 + i++ + i = encodeVarintApi(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if m.Syntax != 0 { + dAtA[i] = 0x38 + i++ + i = encodeVarintApi(dAtA, i, uint64(m.Syntax)) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *Method) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Method) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Name) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintApi(dAtA, i, uint64(len(m.Name))) + i += copy(dAtA[i:], m.Name) + } + if len(m.RequestTypeUrl) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintApi(dAtA, i, uint64(len(m.RequestTypeUrl))) + i += copy(dAtA[i:], m.RequestTypeUrl) + } + if m.RequestStreaming { + dAtA[i] = 0x18 + i++ + if m.RequestStreaming { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i++ + } + if len(m.ResponseTypeUrl) > 0 { + dAtA[i] = 0x22 + i++ + i = encodeVarintApi(dAtA, i, uint64(len(m.ResponseTypeUrl))) + i += copy(dAtA[i:], m.ResponseTypeUrl) + } + if m.ResponseStreaming { + dAtA[i] = 0x28 + i++ + if m.ResponseStreaming { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i++ + } + if len(m.Options) > 0 { + for _, msg := range m.Options { + dAtA[i] = 0x32 + i++ + i = encodeVarintApi(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if m.Syntax != 0 { + dAtA[i] = 0x38 + i++ + i = encodeVarintApi(dAtA, i, uint64(m.Syntax)) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *Mixin) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Mixin) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Name) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintApi(dAtA, i, uint64(len(m.Name))) + i += copy(dAtA[i:], m.Name) + } + if len(m.Root) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintApi(dAtA, i, uint64(len(m.Root))) + i += copy(dAtA[i:], m.Root) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func encodeVarintApi(dAtA []byte, offset int, v uint64) int { + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return offset + 1 +} +func NewPopulatedApi(r randyApi, easy bool) *Api { + this := &Api{} + this.Name = string(randStringApi(r)) + if r.Intn(10) != 0 { + v1 := r.Intn(5) + this.Methods = make([]*Method, v1) + for i := 0; i < v1; i++ { + this.Methods[i] = NewPopulatedMethod(r, easy) + } + } + if r.Intn(10) != 0 { + v2 := r.Intn(5) + this.Options = make([]*Option, v2) + for i := 0; i < v2; i++ { + this.Options[i] = NewPopulatedOption(r, easy) + } + } + this.Version = string(randStringApi(r)) + if r.Intn(10) != 0 { + this.SourceContext = NewPopulatedSourceContext(r, easy) + } + if r.Intn(10) != 0 { + v3 := r.Intn(5) + this.Mixins = make([]*Mixin, v3) + for i := 0; i < v3; i++ { + this.Mixins[i] = NewPopulatedMixin(r, easy) + } + } + this.Syntax = Syntax([]int32{0, 1}[r.Intn(2)]) + if !easy && r.Intn(10) != 0 { + this.XXX_unrecognized = randUnrecognizedApi(r, 8) + } + return this +} + +func NewPopulatedMethod(r randyApi, easy bool) *Method { + this := &Method{} + this.Name = string(randStringApi(r)) + this.RequestTypeUrl = string(randStringApi(r)) + this.RequestStreaming = bool(bool(r.Intn(2) == 0)) + this.ResponseTypeUrl = string(randStringApi(r)) + this.ResponseStreaming = bool(bool(r.Intn(2) == 0)) + if r.Intn(10) != 0 { + v4 := r.Intn(5) + this.Options = make([]*Option, v4) + for i := 0; i < v4; i++ { + this.Options[i] = NewPopulatedOption(r, easy) + } + } + this.Syntax = Syntax([]int32{0, 1}[r.Intn(2)]) + if !easy && r.Intn(10) != 0 { + this.XXX_unrecognized = randUnrecognizedApi(r, 8) + } + return this +} + +func NewPopulatedMixin(r randyApi, easy bool) *Mixin { + this := &Mixin{} + this.Name = string(randStringApi(r)) + this.Root = string(randStringApi(r)) + if !easy && r.Intn(10) != 0 { + this.XXX_unrecognized = randUnrecognizedApi(r, 3) + } + return this +} + +type randyApi interface { + Float32() float32 + Float64() float64 + Int63() int64 + Int31() int32 + Uint32() uint32 + Intn(n int) int +} + +func randUTF8RuneApi(r randyApi) rune { + ru := r.Intn(62) + if ru < 10 { + return rune(ru + 48) + } else if ru < 36 { + return rune(ru + 55) + } + return rune(ru + 61) +} +func randStringApi(r randyApi) string { + v5 := r.Intn(100) + tmps := make([]rune, v5) + for i := 0; i < v5; i++ { + tmps[i] = randUTF8RuneApi(r) + } + return string(tmps) +} +func randUnrecognizedApi(r randyApi, maxFieldNumber int) (dAtA []byte) { + l := r.Intn(5) + for i := 0; i < l; i++ { + wire := r.Intn(4) + if wire == 3 { + wire = 5 + } + fieldNumber := maxFieldNumber + r.Intn(100) + dAtA = randFieldApi(dAtA, r, fieldNumber, wire) + } + return dAtA +} +func randFieldApi(dAtA []byte, r randyApi, fieldNumber int, wire int) []byte { + key := uint32(fieldNumber)<<3 | uint32(wire) + switch wire { + case 0: + dAtA = encodeVarintPopulateApi(dAtA, uint64(key)) + v6 := r.Int63() + if r.Intn(2) == 0 { + v6 *= -1 + } + dAtA = encodeVarintPopulateApi(dAtA, uint64(v6)) + case 1: + dAtA = encodeVarintPopulateApi(dAtA, uint64(key)) + dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256))) + case 2: + dAtA = encodeVarintPopulateApi(dAtA, uint64(key)) + ll := r.Intn(100) + dAtA = encodeVarintPopulateApi(dAtA, uint64(ll)) + for j := 0; j < ll; j++ { + dAtA = append(dAtA, byte(r.Intn(256))) + } + default: + dAtA = encodeVarintPopulateApi(dAtA, uint64(key)) + dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256))) + } + return dAtA +} +func encodeVarintPopulateApi(dAtA []byte, v uint64) []byte { + for v >= 1<<7 { + dAtA = append(dAtA, uint8(uint64(v)&0x7f|0x80)) + v >>= 7 + } + dAtA = append(dAtA, uint8(v)) + return dAtA +} +func (m *Api) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Name) + if l > 0 { + n += 1 + l + sovApi(uint64(l)) + } + if len(m.Methods) > 0 { + for _, e := range m.Methods { + l = e.Size() + n += 1 + l + sovApi(uint64(l)) + } + } + if len(m.Options) > 0 { + for _, e := range m.Options { + l = e.Size() + n += 1 + l + sovApi(uint64(l)) + } + } + l = len(m.Version) + if l > 0 { + n += 1 + l + sovApi(uint64(l)) + } + if m.SourceContext != nil { + l = m.SourceContext.Size() + n += 1 + l + sovApi(uint64(l)) + } + if len(m.Mixins) > 0 { + for _, e := range m.Mixins { + l = e.Size() + n += 1 + l + sovApi(uint64(l)) + } + } + if m.Syntax != 0 { + n += 1 + sovApi(uint64(m.Syntax)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *Method) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Name) + if l > 0 { + n += 1 + l + sovApi(uint64(l)) + } + l = len(m.RequestTypeUrl) + if l > 0 { + n += 1 + l + sovApi(uint64(l)) + } + if m.RequestStreaming { + n += 2 + } + l = len(m.ResponseTypeUrl) + if l > 0 { + n += 1 + l + sovApi(uint64(l)) + } + if m.ResponseStreaming { + n += 2 + } + if len(m.Options) > 0 { + for _, e := range m.Options { + l = e.Size() + n += 1 + l + sovApi(uint64(l)) + } + } + if m.Syntax != 0 { + n += 1 + sovApi(uint64(m.Syntax)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *Mixin) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Name) + if l > 0 { + n += 1 + l + sovApi(uint64(l)) + } + l = len(m.Root) + if l > 0 { + n += 1 + l + sovApi(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func sovApi(x uint64) (n int) { + for { + n++ + x >>= 7 + if x == 0 { + break + } + } + return n +} +func sozApi(x uint64) (n int) { + return sovApi(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (this *Api) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&Api{`, + `Name:` + fmt.Sprintf("%v", this.Name) + `,`, + `Methods:` + strings.Replace(fmt.Sprintf("%v", this.Methods), "Method", "Method", 1) + `,`, + `Options:` + strings.Replace(fmt.Sprintf("%v", this.Options), "Option", "Option", 1) + `,`, + `Version:` + fmt.Sprintf("%v", this.Version) + `,`, + `SourceContext:` + strings.Replace(fmt.Sprintf("%v", this.SourceContext), "SourceContext", "SourceContext", 1) + `,`, + `Mixins:` + strings.Replace(fmt.Sprintf("%v", this.Mixins), "Mixin", "Mixin", 1) + `,`, + `Syntax:` + fmt.Sprintf("%v", this.Syntax) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *Method) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&Method{`, + `Name:` + fmt.Sprintf("%v", this.Name) + `,`, + `RequestTypeUrl:` + fmt.Sprintf("%v", this.RequestTypeUrl) + `,`, + `RequestStreaming:` + fmt.Sprintf("%v", this.RequestStreaming) + `,`, + `ResponseTypeUrl:` + fmt.Sprintf("%v", this.ResponseTypeUrl) + `,`, + `ResponseStreaming:` + fmt.Sprintf("%v", this.ResponseStreaming) + `,`, + `Options:` + strings.Replace(fmt.Sprintf("%v", this.Options), "Option", "Option", 1) + `,`, + `Syntax:` + fmt.Sprintf("%v", this.Syntax) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *Mixin) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&Mixin{`, + `Name:` + fmt.Sprintf("%v", this.Name) + `,`, + `Root:` + fmt.Sprintf("%v", this.Root) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func valueToStringApi(v interface{}) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("*%v", pv) +} +func (m *Api) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Api: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Api: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthApi + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Methods", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthApi + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Methods = append(m.Methods, &Method{}) + if err := m.Methods[len(m.Methods)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Options", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthApi + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Options = append(m.Options, &Option{}) + if err := m.Options[len(m.Options)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthApi + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Version = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SourceContext", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthApi + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.SourceContext == nil { + m.SourceContext = &SourceContext{} + } + if err := m.SourceContext.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Mixins", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthApi + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Mixins = append(m.Mixins, &Mixin{}) + if err := m.Mixins[len(m.Mixins)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Syntax", wireType) + } + m.Syntax = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Syntax |= (Syntax(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipApi(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthApi + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Method) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Method: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Method: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthApi + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestTypeUrl", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthApi + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RequestTypeUrl = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestStreaming", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.RequestStreaming = bool(v != 0) + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ResponseTypeUrl", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthApi + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ResponseTypeUrl = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ResponseStreaming", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.ResponseStreaming = bool(v != 0) + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Options", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthApi + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Options = append(m.Options, &Option{}) + if err := m.Options[len(m.Options)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Syntax", wireType) + } + m.Syntax = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Syntax |= (Syntax(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipApi(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthApi + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Mixin) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Mixin: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Mixin: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthApi + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Root", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthApi + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Root = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipApi(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthApi + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipApi(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowApi + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowApi + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + return iNdEx, nil + case 1: + iNdEx += 8 + return iNdEx, nil + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowApi + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + iNdEx += length + if length < 0 { + return 0, ErrInvalidLengthApi + } + return iNdEx, nil + case 3: + for { + var innerWire uint64 + var start int = iNdEx + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowApi + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + innerWire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + innerWireType := int(innerWire & 0x7) + if innerWireType == 4 { + break + } + next, err := skipApi(dAtA[start:]) + if err != nil { + return 0, err + } + iNdEx = start + next + } + return iNdEx, nil + case 4: + return iNdEx, nil + case 5: + iNdEx += 4 + return iNdEx, nil + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + } + panic("unreachable") +} + +var ( + ErrInvalidLengthApi = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowApi = fmt.Errorf("proto: integer overflow") +) + +func init() { proto.RegisterFile("google/protobuf/api.proto", fileDescriptor_api_a4406062c749da1f) } + +var fileDescriptor_api_a4406062c749da1f = []byte{ + // 467 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x91, 0x31, 0x6f, 0x13, 0x31, + 0x14, 0xc7, 0xeb, 0xbb, 0xe4, 0x52, 0x5c, 0x91, 0x82, 0x91, 0xc0, 0x64, 0xb0, 0x4e, 0x15, 0xc3, + 0x09, 0xc4, 0x45, 0x94, 0x4f, 0xd0, 0x20, 0xd4, 0x01, 0x21, 0xa2, 0x0b, 0x08, 0x89, 0x25, 0x4a, + 0x83, 0x09, 0x96, 0xee, 0x6c, 0x63, 0x3b, 0x90, 0x4c, 0xf0, 0x59, 0x98, 0x10, 0x23, 0xdf, 0x80, + 0xad, 0x23, 0x23, 0x23, 0xb9, 0x2e, 0x8c, 0x1d, 0x19, 0x91, 0x7d, 0xe7, 0xa6, 0x5c, 0x83, 0x04, + 0x9b, 0xdf, 0xfb, 0xff, 0xfc, 0xf7, 0x7b, 0x7f, 0xc3, 0x9b, 0x33, 0x21, 0x66, 0x39, 0xed, 0x4b, + 0x25, 0x8c, 0x38, 0x9a, 0xbf, 0xea, 0x4f, 0x24, 0x4b, 0x5d, 0x81, 0x76, 0x2b, 0x29, 0xf5, 0x52, + 0xef, 0x56, 0x93, 0xd5, 0x62, 0xae, 0xa6, 0x74, 0x3c, 0x15, 0xdc, 0xd0, 0x85, 0xa9, 0xc0, 0x5e, + 0xaf, 0x49, 0x99, 0xa5, 0xac, 0x4d, 0xf6, 0xbe, 0x06, 0x30, 0x3c, 0x90, 0x0c, 0x21, 0xd8, 0xe2, + 0x93, 0x82, 0x62, 0x10, 0x83, 0xe4, 0x52, 0xe6, 0xce, 0xe8, 0x1e, 0xec, 0x14, 0xd4, 0xbc, 0x16, + 0x2f, 0x35, 0x0e, 0xe2, 0x30, 0xd9, 0xd9, 0xbf, 0x91, 0x36, 0x06, 0x48, 0x1f, 0x3b, 0x3d, 0xf3, + 0x9c, 0xbd, 0x22, 0xa4, 0x61, 0x82, 0x6b, 0x1c, 0xfe, 0xe5, 0xca, 0x13, 0xa7, 0x67, 0x9e, 0x43, + 0x18, 0x76, 0xde, 0x52, 0xa5, 0x99, 0xe0, 0xb8, 0xe5, 0x1e, 0xf7, 0x25, 0x7a, 0x08, 0xbb, 0x7f, + 0xee, 0x83, 0xdb, 0x31, 0x48, 0x76, 0xf6, 0xc9, 0x05, 0xcf, 0x91, 0xc3, 0x1e, 0x54, 0x54, 0x76, + 0x59, 0x9f, 0x2f, 0x51, 0x0a, 0xa3, 0x82, 0x2d, 0x18, 0xd7, 0x38, 0x72, 0x23, 0x5d, 0xbf, 0xb8, + 0x85, 0x95, 0xb3, 0x9a, 0x42, 0x7d, 0x18, 0xe9, 0x25, 0x37, 0x93, 0x05, 0xee, 0xc4, 0x20, 0xe9, + 0x6e, 0x58, 0x61, 0xe4, 0xe4, 0xac, 0xc6, 0xf6, 0xbe, 0x04, 0x30, 0xaa, 0x82, 0xd8, 0x18, 0x63, + 0x02, 0xaf, 0x28, 0xfa, 0x66, 0x4e, 0xb5, 0x19, 0xdb, 0xe0, 0xc7, 0x73, 0x95, 0xe3, 0xc0, 0xe9, + 0xdd, 0xba, 0xff, 0x74, 0x29, 0xe9, 0x33, 0x95, 0xa3, 0x3b, 0xf0, 0xaa, 0x27, 0xb5, 0x51, 0x74, + 0x52, 0x30, 0x3e, 0xc3, 0x61, 0x0c, 0x92, 0xed, 0xcc, 0x5b, 0x8c, 0x7c, 0x1f, 0xdd, 0xb6, 0xb0, + 0x96, 0x82, 0x6b, 0xba, 0xf6, 0xad, 0x12, 0xdc, 0xf5, 0x82, 0x37, 0xbe, 0x0b, 0xd1, 0x19, 0xbb, + 0x76, 0x6e, 0x3b, 0xe7, 0x33, 0x97, 0xb5, 0xf5, 0xb9, 0x5f, 0x8c, 0xfe, 0xf1, 0x17, 0xff, 0x3b, + 0xb4, 0x3e, 0x6c, 0xbb, 0xd8, 0x37, 0x46, 0x86, 0x60, 0x4b, 0x09, 0x61, 0xea, 0x98, 0xdc, 0x79, + 0xf0, 0xfe, 0xfb, 0x8a, 0x6c, 0x9d, 0xae, 0x08, 0xf8, 0xb5, 0x22, 0xe0, 0x43, 0x49, 0xc0, 0xa7, + 0x92, 0x80, 0xe3, 0x92, 0x80, 0x6f, 0x25, 0x01, 0x3f, 0x4a, 0x02, 0x7e, 0x96, 0x64, 0xeb, 0xd4, + 0xf6, 0x4f, 0x08, 0x38, 0x3e, 0x21, 0x00, 0x5e, 0x9b, 0x8a, 0xa2, 0x39, 0xc6, 0x60, 0xfb, 0x40, + 0xb2, 0xa1, 0x2d, 0x86, 0xe0, 0x45, 0xdb, 0xe6, 0xa6, 0x3f, 0x06, 0xe1, 0xe1, 0x70, 0xf0, 0x39, + 0x20, 0x87, 0x15, 0x3a, 0xf4, 0x13, 0x3f, 0xa7, 0x79, 0xfe, 0x88, 0x8b, 0x77, 0xdc, 0xc6, 0xa8, + 0x8f, 0x22, 0xe7, 0x71, 0xff, 0x77, 0x00, 0x00, 0x00, 0xff, 0xff, 0x2b, 0x64, 0x40, 0x40, 0xa1, + 0x03, 0x00, 0x00, +} diff --git a/vendor/github.com/gogo/protobuf/types/doc.go b/vendor/github.com/gogo/protobuf/types/doc.go new file mode 100644 index 000000000000..ff2810af1ee0 --- /dev/null +++ b/vendor/github.com/gogo/protobuf/types/doc.go @@ -0,0 +1,35 @@ +// Go support for Protocol Buffers - Google's data interchange format +// +// Copyright 2016 The Go Authors. All rights reserved. +// https://github.com/golang/protobuf +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +/* +Package types contains code for interacting with well-known types. +*/ +package types diff --git a/vendor/github.com/gogo/protobuf/types/duration.go b/vendor/github.com/gogo/protobuf/types/duration.go new file mode 100644 index 000000000000..475d61f1db29 --- /dev/null +++ b/vendor/github.com/gogo/protobuf/types/duration.go @@ -0,0 +1,100 @@ +// Go support for Protocol Buffers - Google's data interchange format +// +// Copyright 2016 The Go Authors. All rights reserved. +// https://github.com/golang/protobuf +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +package types + +// This file implements conversions between google.protobuf.Duration +// and time.Duration. + +import ( + "errors" + "fmt" + "time" +) + +const ( + // Range of a Duration in seconds, as specified in + // google/protobuf/duration.proto. This is about 10,000 years in seconds. + maxSeconds = int64(10000 * 365.25 * 24 * 60 * 60) + minSeconds = -maxSeconds +) + +// validateDuration determines whether the Duration is valid according to the +// definition in google/protobuf/duration.proto. A valid Duration +// may still be too large to fit into a time.Duration (the range of Duration +// is about 10,000 years, and the range of time.Duration is about 290). +func validateDuration(d *Duration) error { + if d == nil { + return errors.New("duration: nil Duration") + } + if d.Seconds < minSeconds || d.Seconds > maxSeconds { + return fmt.Errorf("duration: %#v: seconds out of range", d) + } + if d.Nanos <= -1e9 || d.Nanos >= 1e9 { + return fmt.Errorf("duration: %#v: nanos out of range", d) + } + // Seconds and Nanos must have the same sign, unless d.Nanos is zero. + if (d.Seconds < 0 && d.Nanos > 0) || (d.Seconds > 0 && d.Nanos < 0) { + return fmt.Errorf("duration: %#v: seconds and nanos have different signs", d) + } + return nil +} + +// DurationFromProto converts a Duration to a time.Duration. DurationFromProto +// returns an error if the Duration is invalid or is too large to be +// represented in a time.Duration. +func DurationFromProto(p *Duration) (time.Duration, error) { + if err := validateDuration(p); err != nil { + return 0, err + } + d := time.Duration(p.Seconds) * time.Second + if int64(d/time.Second) != p.Seconds { + return 0, fmt.Errorf("duration: %#v is out of range for time.Duration", p) + } + if p.Nanos != 0 { + d += time.Duration(p.Nanos) + if (d < 0) != (p.Nanos < 0) { + return 0, fmt.Errorf("duration: %#v is out of range for time.Duration", p) + } + } + return d, nil +} + +// DurationProto converts a time.Duration to a Duration. +func DurationProto(d time.Duration) *Duration { + nanos := d.Nanoseconds() + secs := nanos / 1e9 + nanos -= secs * 1e9 + return &Duration{ + Seconds: secs, + Nanos: int32(nanos), + } +} diff --git a/vendor/github.com/gogo/protobuf/types/duration.pb.go b/vendor/github.com/gogo/protobuf/types/duration.pb.go new file mode 100644 index 000000000000..545ef962e60d --- /dev/null +++ b/vendor/github.com/gogo/protobuf/types/duration.pb.go @@ -0,0 +1,537 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: google/protobuf/duration.proto + +package types + +import proto "github.com/gogo/protobuf/proto" +import fmt "fmt" +import math "math" + +import bytes "bytes" + +import strings "strings" +import reflect "reflect" + +import io "io" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package + +// A Duration represents a signed, fixed-length span of time represented +// as a count of seconds and fractions of seconds at nanosecond +// resolution. It is independent of any calendar and concepts like "day" +// or "month". It is related to Timestamp in that the difference between +// two Timestamp values is a Duration and it can be added or subtracted +// from a Timestamp. Range is approximately +-10,000 years. +// +// # Examples +// +// Example 1: Compute Duration from two Timestamps in pseudo code. +// +// Timestamp start = ...; +// Timestamp end = ...; +// Duration duration = ...; +// +// duration.seconds = end.seconds - start.seconds; +// duration.nanos = end.nanos - start.nanos; +// +// if (duration.seconds < 0 && duration.nanos > 0) { +// duration.seconds += 1; +// duration.nanos -= 1000000000; +// } else if (durations.seconds > 0 && duration.nanos < 0) { +// duration.seconds -= 1; +// duration.nanos += 1000000000; +// } +// +// Example 2: Compute Timestamp from Timestamp + Duration in pseudo code. +// +// Timestamp start = ...; +// Duration duration = ...; +// Timestamp end = ...; +// +// end.seconds = start.seconds + duration.seconds; +// end.nanos = start.nanos + duration.nanos; +// +// if (end.nanos < 0) { +// end.seconds -= 1; +// end.nanos += 1000000000; +// } else if (end.nanos >= 1000000000) { +// end.seconds += 1; +// end.nanos -= 1000000000; +// } +// +// Example 3: Compute Duration from datetime.timedelta in Python. +// +// td = datetime.timedelta(days=3, minutes=10) +// duration = Duration() +// duration.FromTimedelta(td) +// +// # JSON Mapping +// +// In JSON format, the Duration type is encoded as a string rather than an +// object, where the string ends in the suffix "s" (indicating seconds) and +// is preceded by the number of seconds, with nanoseconds expressed as +// fractional seconds. For example, 3 seconds with 0 nanoseconds should be +// encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should +// be expressed in JSON format as "3.000000001s", and 3 seconds and 1 +// microsecond should be expressed in JSON format as "3.000001s". +// +// +type Duration struct { + // Signed seconds of the span of time. Must be from -315,576,000,000 + // to +315,576,000,000 inclusive. Note: these bounds are computed from: + // 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years + Seconds int64 `protobuf:"varint,1,opt,name=seconds,proto3" json:"seconds,omitempty"` + // Signed fractions of a second at nanosecond resolution of the span + // of time. Durations less than one second are represented with a 0 + // `seconds` field and a positive or negative `nanos` field. For durations + // of one second or more, a non-zero value for the `nanos` field must be + // of the same sign as the `seconds` field. Must be from -999,999,999 + // to +999,999,999 inclusive. + Nanos int32 `protobuf:"varint,2,opt,name=nanos,proto3" json:"nanos,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Duration) Reset() { *m = Duration{} } +func (*Duration) ProtoMessage() {} +func (*Duration) Descriptor() ([]byte, []int) { + return fileDescriptor_duration_187e4d5f80a83848, []int{0} +} +func (*Duration) XXX_WellKnownType() string { return "Duration" } +func (m *Duration) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Duration) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Duration.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *Duration) XXX_Merge(src proto.Message) { + xxx_messageInfo_Duration.Merge(dst, src) +} +func (m *Duration) XXX_Size() int { + return m.Size() +} +func (m *Duration) XXX_DiscardUnknown() { + xxx_messageInfo_Duration.DiscardUnknown(m) +} + +var xxx_messageInfo_Duration proto.InternalMessageInfo + +func (m *Duration) GetSeconds() int64 { + if m != nil { + return m.Seconds + } + return 0 +} + +func (m *Duration) GetNanos() int32 { + if m != nil { + return m.Nanos + } + return 0 +} + +func (*Duration) XXX_MessageName() string { + return "google.protobuf.Duration" +} +func init() { + proto.RegisterType((*Duration)(nil), "google.protobuf.Duration") +} +func (this *Duration) Compare(that interface{}) int { + if that == nil { + if this == nil { + return 0 + } + return 1 + } + + that1, ok := that.(*Duration) + if !ok { + that2, ok := that.(Duration) + if ok { + that1 = &that2 + } else { + return 1 + } + } + if that1 == nil { + if this == nil { + return 0 + } + return 1 + } else if this == nil { + return -1 + } + if this.Seconds != that1.Seconds { + if this.Seconds < that1.Seconds { + return -1 + } + return 1 + } + if this.Nanos != that1.Nanos { + if this.Nanos < that1.Nanos { + return -1 + } + return 1 + } + if c := bytes.Compare(this.XXX_unrecognized, that1.XXX_unrecognized); c != 0 { + return c + } + return 0 +} +func (this *Duration) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Duration) + if !ok { + that2, ok := that.(Duration) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Seconds != that1.Seconds { + return false + } + if this.Nanos != that1.Nanos { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *Duration) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 6) + s = append(s, "&types.Duration{") + s = append(s, "Seconds: "+fmt.Sprintf("%#v", this.Seconds)+",\n") + s = append(s, "Nanos: "+fmt.Sprintf("%#v", this.Nanos)+",\n") + if this.XXX_unrecognized != nil { + s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") + } + s = append(s, "}") + return strings.Join(s, "") +} +func valueToGoStringDuration(v interface{}, typ string) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv) +} +func (m *Duration) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Duration) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Seconds != 0 { + dAtA[i] = 0x8 + i++ + i = encodeVarintDuration(dAtA, i, uint64(m.Seconds)) + } + if m.Nanos != 0 { + dAtA[i] = 0x10 + i++ + i = encodeVarintDuration(dAtA, i, uint64(m.Nanos)) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func encodeVarintDuration(dAtA []byte, offset int, v uint64) int { + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return offset + 1 +} +func (m *Duration) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Seconds != 0 { + n += 1 + sovDuration(uint64(m.Seconds)) + } + if m.Nanos != 0 { + n += 1 + sovDuration(uint64(m.Nanos)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func sovDuration(x uint64) (n int) { + for { + n++ + x >>= 7 + if x == 0 { + break + } + } + return n +} +func sozDuration(x uint64) (n int) { + return sovDuration(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Duration) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDuration + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Duration: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Duration: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Seconds", wireType) + } + m.Seconds = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDuration + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Seconds |= (int64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Nanos", wireType) + } + m.Nanos = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDuration + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Nanos |= (int32(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipDuration(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthDuration + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipDuration(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowDuration + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowDuration + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + return iNdEx, nil + case 1: + iNdEx += 8 + return iNdEx, nil + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowDuration + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + iNdEx += length + if length < 0 { + return 0, ErrInvalidLengthDuration + } + return iNdEx, nil + case 3: + for { + var innerWire uint64 + var start int = iNdEx + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowDuration + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + innerWire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + innerWireType := int(innerWire & 0x7) + if innerWireType == 4 { + break + } + next, err := skipDuration(dAtA[start:]) + if err != nil { + return 0, err + } + iNdEx = start + next + } + return iNdEx, nil + case 4: + return iNdEx, nil + case 5: + iNdEx += 4 + return iNdEx, nil + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + } + panic("unreachable") +} + +var ( + ErrInvalidLengthDuration = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowDuration = fmt.Errorf("proto: integer overflow") +) + +func init() { + proto.RegisterFile("google/protobuf/duration.proto", fileDescriptor_duration_187e4d5f80a83848) +} + +var fileDescriptor_duration_187e4d5f80a83848 = []byte{ + // 209 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4b, 0xcf, 0xcf, 0x4f, + 0xcf, 0x49, 0xd5, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0x4f, 0x2a, 0x4d, 0xd3, 0x4f, 0x29, 0x2d, 0x4a, + 0x2c, 0xc9, 0xcc, 0xcf, 0xd3, 0x03, 0x8b, 0x08, 0xf1, 0x43, 0xe4, 0xf5, 0x60, 0xf2, 0x4a, 0x56, + 0x5c, 0x1c, 0x2e, 0x50, 0x25, 0x42, 0x12, 0x5c, 0xec, 0xc5, 0xa9, 0xc9, 0xf9, 0x79, 0x29, 0xc5, + 0x12, 0x8c, 0x0a, 0x8c, 0x1a, 0xcc, 0x41, 0x30, 0xae, 0x90, 0x08, 0x17, 0x6b, 0x5e, 0x62, 0x5e, + 0x7e, 0xb1, 0x04, 0x93, 0x02, 0xa3, 0x06, 0x6b, 0x10, 0x84, 0xe3, 0x54, 0x7f, 0xe3, 0xa1, 0x1c, + 0xc3, 0x87, 0x87, 0x72, 0x8c, 0x2b, 0x1e, 0xc9, 0x31, 0x9e, 0x78, 0x24, 0xc7, 0x78, 0xe1, 0x91, + 0x1c, 0xe3, 0x83, 0x47, 0x72, 0x8c, 0x2f, 0x1e, 0xc9, 0x31, 0x7c, 0x78, 0x24, 0xc7, 0xb8, 0xe2, + 0xb1, 0x1c, 0xe3, 0x89, 0xc7, 0x72, 0x8c, 0x5c, 0xc2, 0xc9, 0xf9, 0xb9, 0x7a, 0x68, 0x56, 0x3b, + 0xf1, 0xc2, 0x2c, 0x0e, 0x00, 0x89, 0x04, 0x30, 0x46, 0xb1, 0x96, 0x54, 0x16, 0xa4, 0x16, 0xff, + 0x60, 0x64, 0x5c, 0xc4, 0xc4, 0xec, 0x1e, 0xe0, 0xb4, 0x8a, 0x49, 0xce, 0x1d, 0xa2, 0x25, 0x00, + 0xaa, 0x45, 0x2f, 0x3c, 0x35, 0x27, 0xc7, 0x3b, 0x2f, 0xbf, 0x3c, 0x2f, 0x04, 0xa4, 0x32, 0x89, + 0x0d, 0x6c, 0x96, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0x8a, 0x1c, 0x64, 0x4e, 0xf6, 0x00, 0x00, + 0x00, +} diff --git a/vendor/github.com/gogo/protobuf/types/duration_gogo.go b/vendor/github.com/gogo/protobuf/types/duration_gogo.go new file mode 100644 index 000000000000..90e7670e21d1 --- /dev/null +++ b/vendor/github.com/gogo/protobuf/types/duration_gogo.go @@ -0,0 +1,100 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2016, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +package types + +import ( + "fmt" + "time" +) + +func NewPopulatedDuration(r interface { + Int63() int64 +}, easy bool) *Duration { + this := &Duration{} + maxSecs := time.Hour.Nanoseconds() / 1e9 + max := 2 * maxSecs + s := int64(r.Int63()) % max + s -= maxSecs + neg := int64(1) + if s < 0 { + neg = -1 + } + this.Seconds = s + this.Nanos = int32(neg * (r.Int63() % 1e9)) + return this +} + +func (d *Duration) String() string { + td, err := DurationFromProto(d) + if err != nil { + return fmt.Sprintf("(%v)", err) + } + return td.String() +} + +func NewPopulatedStdDuration(r interface { + Int63() int64 +}, easy bool) *time.Duration { + dur := NewPopulatedDuration(r, easy) + d, err := DurationFromProto(dur) + if err != nil { + return nil + } + return &d +} + +func SizeOfStdDuration(d time.Duration) int { + dur := DurationProto(d) + return dur.Size() +} + +func StdDurationMarshal(d time.Duration) ([]byte, error) { + size := SizeOfStdDuration(d) + buf := make([]byte, size) + _, err := StdDurationMarshalTo(d, buf) + return buf, err +} + +func StdDurationMarshalTo(d time.Duration, data []byte) (int, error) { + dur := DurationProto(d) + return dur.MarshalTo(data) +} + +func StdDurationUnmarshal(d *time.Duration, data []byte) error { + dur := &Duration{} + if err := dur.Unmarshal(data); err != nil { + return err + } + dd, err := DurationFromProto(dur) + if err != nil { + return err + } + *d = dd + return nil +} diff --git a/vendor/github.com/gogo/protobuf/types/empty.pb.go b/vendor/github.com/gogo/protobuf/types/empty.pb.go new file mode 100644 index 000000000000..323b246a680f --- /dev/null +++ b/vendor/github.com/gogo/protobuf/types/empty.pb.go @@ -0,0 +1,480 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: google/protobuf/empty.proto + +package types + +import proto "github.com/gogo/protobuf/proto" +import fmt "fmt" +import math "math" + +import bytes "bytes" + +import strings "strings" +import reflect "reflect" + +import io "io" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package + +// A generic empty message that you can re-use to avoid defining duplicated +// empty messages in your APIs. A typical example is to use it as the request +// or the response type of an API method. For instance: +// +// service Foo { +// rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); +// } +// +// The JSON representation for `Empty` is empty JSON object `{}`. +type Empty struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Empty) Reset() { *m = Empty{} } +func (*Empty) ProtoMessage() {} +func (*Empty) Descriptor() ([]byte, []int) { + return fileDescriptor_empty_b366a5cbb7c614df, []int{0} +} +func (*Empty) XXX_WellKnownType() string { return "Empty" } +func (m *Empty) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Empty) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Empty.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *Empty) XXX_Merge(src proto.Message) { + xxx_messageInfo_Empty.Merge(dst, src) +} +func (m *Empty) XXX_Size() int { + return m.Size() +} +func (m *Empty) XXX_DiscardUnknown() { + xxx_messageInfo_Empty.DiscardUnknown(m) +} + +var xxx_messageInfo_Empty proto.InternalMessageInfo + +func (*Empty) XXX_MessageName() string { + return "google.protobuf.Empty" +} +func init() { + proto.RegisterType((*Empty)(nil), "google.protobuf.Empty") +} +func (this *Empty) Compare(that interface{}) int { + if that == nil { + if this == nil { + return 0 + } + return 1 + } + + that1, ok := that.(*Empty) + if !ok { + that2, ok := that.(Empty) + if ok { + that1 = &that2 + } else { + return 1 + } + } + if that1 == nil { + if this == nil { + return 0 + } + return 1 + } else if this == nil { + return -1 + } + if c := bytes.Compare(this.XXX_unrecognized, that1.XXX_unrecognized); c != 0 { + return c + } + return 0 +} +func (this *Empty) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Empty) + if !ok { + that2, ok := that.(Empty) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *Empty) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 4) + s = append(s, "&types.Empty{") + if this.XXX_unrecognized != nil { + s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") + } + s = append(s, "}") + return strings.Join(s, "") +} +func valueToGoStringEmpty(v interface{}, typ string) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv) +} +func (m *Empty) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Empty) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func encodeVarintEmpty(dAtA []byte, offset int, v uint64) int { + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return offset + 1 +} +func NewPopulatedEmpty(r randyEmpty, easy bool) *Empty { + this := &Empty{} + if !easy && r.Intn(10) != 0 { + this.XXX_unrecognized = randUnrecognizedEmpty(r, 1) + } + return this +} + +type randyEmpty interface { + Float32() float32 + Float64() float64 + Int63() int64 + Int31() int32 + Uint32() uint32 + Intn(n int) int +} + +func randUTF8RuneEmpty(r randyEmpty) rune { + ru := r.Intn(62) + if ru < 10 { + return rune(ru + 48) + } else if ru < 36 { + return rune(ru + 55) + } + return rune(ru + 61) +} +func randStringEmpty(r randyEmpty) string { + v1 := r.Intn(100) + tmps := make([]rune, v1) + for i := 0; i < v1; i++ { + tmps[i] = randUTF8RuneEmpty(r) + } + return string(tmps) +} +func randUnrecognizedEmpty(r randyEmpty, maxFieldNumber int) (dAtA []byte) { + l := r.Intn(5) + for i := 0; i < l; i++ { + wire := r.Intn(4) + if wire == 3 { + wire = 5 + } + fieldNumber := maxFieldNumber + r.Intn(100) + dAtA = randFieldEmpty(dAtA, r, fieldNumber, wire) + } + return dAtA +} +func randFieldEmpty(dAtA []byte, r randyEmpty, fieldNumber int, wire int) []byte { + key := uint32(fieldNumber)<<3 | uint32(wire) + switch wire { + case 0: + dAtA = encodeVarintPopulateEmpty(dAtA, uint64(key)) + v2 := r.Int63() + if r.Intn(2) == 0 { + v2 *= -1 + } + dAtA = encodeVarintPopulateEmpty(dAtA, uint64(v2)) + case 1: + dAtA = encodeVarintPopulateEmpty(dAtA, uint64(key)) + dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256))) + case 2: + dAtA = encodeVarintPopulateEmpty(dAtA, uint64(key)) + ll := r.Intn(100) + dAtA = encodeVarintPopulateEmpty(dAtA, uint64(ll)) + for j := 0; j < ll; j++ { + dAtA = append(dAtA, byte(r.Intn(256))) + } + default: + dAtA = encodeVarintPopulateEmpty(dAtA, uint64(key)) + dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256))) + } + return dAtA +} +func encodeVarintPopulateEmpty(dAtA []byte, v uint64) []byte { + for v >= 1<<7 { + dAtA = append(dAtA, uint8(uint64(v)&0x7f|0x80)) + v >>= 7 + } + dAtA = append(dAtA, uint8(v)) + return dAtA +} +func (m *Empty) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func sovEmpty(x uint64) (n int) { + for { + n++ + x >>= 7 + if x == 0 { + break + } + } + return n +} +func sozEmpty(x uint64) (n int) { + return sovEmpty(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (this *Empty) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&Empty{`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func valueToStringEmpty(v interface{}) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("*%v", pv) +} +func (m *Empty) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEmpty + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Empty: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Empty: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipEmpty(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthEmpty + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipEmpty(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowEmpty + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowEmpty + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + return iNdEx, nil + case 1: + iNdEx += 8 + return iNdEx, nil + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowEmpty + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + iNdEx += length + if length < 0 { + return 0, ErrInvalidLengthEmpty + } + return iNdEx, nil + case 3: + for { + var innerWire uint64 + var start int = iNdEx + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowEmpty + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + innerWire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + innerWireType := int(innerWire & 0x7) + if innerWireType == 4 { + break + } + next, err := skipEmpty(dAtA[start:]) + if err != nil { + return 0, err + } + iNdEx = start + next + } + return iNdEx, nil + case 4: + return iNdEx, nil + case 5: + iNdEx += 4 + return iNdEx, nil + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + } + panic("unreachable") +} + +var ( + ErrInvalidLengthEmpty = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowEmpty = fmt.Errorf("proto: integer overflow") +) + +func init() { proto.RegisterFile("google/protobuf/empty.proto", fileDescriptor_empty_b366a5cbb7c614df) } + +var fileDescriptor_empty_b366a5cbb7c614df = []byte{ + // 176 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4e, 0xcf, 0xcf, 0x4f, + 0xcf, 0x49, 0xd5, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0x4f, 0x2a, 0x4d, 0xd3, 0x4f, 0xcd, 0x2d, 0x28, + 0xa9, 0xd4, 0x03, 0x73, 0x85, 0xf8, 0x21, 0x92, 0x7a, 0x30, 0x49, 0x25, 0x76, 0x2e, 0x56, 0x57, + 0x90, 0xbc, 0x53, 0x0b, 0xe3, 0x8d, 0x87, 0x72, 0x0c, 0x1f, 0x1e, 0xca, 0x31, 0xfe, 0x78, 0x28, + 0xc7, 0xd8, 0xf0, 0x48, 0x8e, 0x71, 0xc5, 0x23, 0x39, 0xc6, 0x13, 0x8f, 0xe4, 0x18, 0x2f, 0x3c, + 0x92, 0x63, 0x7c, 0xf0, 0x48, 0x8e, 0xf1, 0xc5, 0x23, 0x39, 0x86, 0x0f, 0x20, 0xf1, 0xc7, 0x72, + 0x8c, 0x27, 0x1e, 0xcb, 0x31, 0x72, 0x09, 0x27, 0xe7, 0xe7, 0xea, 0xa1, 0x19, 0xe8, 0xc4, 0x05, + 0x36, 0x2e, 0x00, 0xc4, 0x0d, 0x60, 0x8c, 0x62, 0x2d, 0xa9, 0x2c, 0x48, 0x2d, 0xfe, 0xc1, 0xc8, + 0xb8, 0x88, 0x89, 0xd9, 0x3d, 0xc0, 0x69, 0x15, 0x93, 0x9c, 0x3b, 0x44, 0x7d, 0x00, 0x54, 0xbd, + 0x5e, 0x78, 0x6a, 0x4e, 0x8e, 0x77, 0x5e, 0x7e, 0x79, 0x5e, 0x08, 0x48, 0x65, 0x12, 0x1b, 0xd8, + 0x20, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0x21, 0xbe, 0xb6, 0x31, 0xc6, 0x00, 0x00, 0x00, +} diff --git a/vendor/github.com/gogo/protobuf/types/field_mask.pb.go b/vendor/github.com/gogo/protobuf/types/field_mask.pb.go new file mode 100644 index 000000000000..78ab41b742e1 --- /dev/null +++ b/vendor/github.com/gogo/protobuf/types/field_mask.pb.go @@ -0,0 +1,769 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: google/protobuf/field_mask.proto + +package types + +import proto "github.com/gogo/protobuf/proto" +import fmt "fmt" +import math "math" + +import bytes "bytes" + +import strings "strings" +import reflect "reflect" + +import io "io" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package + +// `FieldMask` represents a set of symbolic field paths, for example: +// +// paths: "f.a" +// paths: "f.b.d" +// +// Here `f` represents a field in some root message, `a` and `b` +// fields in the message found in `f`, and `d` a field found in the +// message in `f.b`. +// +// Field masks are used to specify a subset of fields that should be +// returned by a get operation or modified by an update operation. +// Field masks also have a custom JSON encoding (see below). +// +// # Field Masks in Projections +// +// When used in the context of a projection, a response message or +// sub-message is filtered by the API to only contain those fields as +// specified in the mask. For example, if the mask in the previous +// example is applied to a response message as follows: +// +// f { +// a : 22 +// b { +// d : 1 +// x : 2 +// } +// y : 13 +// } +// z: 8 +// +// The result will not contain specific values for fields x,y and z +// (their value will be set to the default, and omitted in proto text +// output): +// +// +// f { +// a : 22 +// b { +// d : 1 +// } +// } +// +// A repeated field is not allowed except at the last position of a +// paths string. +// +// If a FieldMask object is not present in a get operation, the +// operation applies to all fields (as if a FieldMask of all fields +// had been specified). +// +// Note that a field mask does not necessarily apply to the +// top-level response message. In case of a REST get operation, the +// field mask applies directly to the response, but in case of a REST +// list operation, the mask instead applies to each individual message +// in the returned resource list. In case of a REST custom method, +// other definitions may be used. Where the mask applies will be +// clearly documented together with its declaration in the API. In +// any case, the effect on the returned resource/resources is required +// behavior for APIs. +// +// # Field Masks in Update Operations +// +// A field mask in update operations specifies which fields of the +// targeted resource are going to be updated. The API is required +// to only change the values of the fields as specified in the mask +// and leave the others untouched. If a resource is passed in to +// describe the updated values, the API ignores the values of all +// fields not covered by the mask. +// +// If a repeated field is specified for an update operation, the existing +// repeated values in the target resource will be overwritten by the new values. +// Note that a repeated field is only allowed in the last position of a `paths` +// string. +// +// If a sub-message is specified in the last position of the field mask for an +// update operation, then the existing sub-message in the target resource is +// overwritten. Given the target message: +// +// f { +// b { +// d : 1 +// x : 2 +// } +// c : 1 +// } +// +// And an update message: +// +// f { +// b { +// d : 10 +// } +// } +// +// then if the field mask is: +// +// paths: "f.b" +// +// then the result will be: +// +// f { +// b { +// d : 10 +// } +// c : 1 +// } +// +// However, if the update mask was: +// +// paths: "f.b.d" +// +// then the result would be: +// +// f { +// b { +// d : 10 +// x : 2 +// } +// c : 1 +// } +// +// In order to reset a field's value to the default, the field must +// be in the mask and set to the default value in the provided resource. +// Hence, in order to reset all fields of a resource, provide a default +// instance of the resource and set all fields in the mask, or do +// not provide a mask as described below. +// +// If a field mask is not present on update, the operation applies to +// all fields (as if a field mask of all fields has been specified). +// Note that in the presence of schema evolution, this may mean that +// fields the client does not know and has therefore not filled into +// the request will be reset to their default. If this is unwanted +// behavior, a specific service may require a client to always specify +// a field mask, producing an error if not. +// +// As with get operations, the location of the resource which +// describes the updated values in the request message depends on the +// operation kind. In any case, the effect of the field mask is +// required to be honored by the API. +// +// ## Considerations for HTTP REST +// +// The HTTP kind of an update operation which uses a field mask must +// be set to PATCH instead of PUT in order to satisfy HTTP semantics +// (PUT must only be used for full updates). +// +// # JSON Encoding of Field Masks +// +// In JSON, a field mask is encoded as a single string where paths are +// separated by a comma. Fields name in each path are converted +// to/from lower-camel naming conventions. +// +// As an example, consider the following message declarations: +// +// message Profile { +// User user = 1; +// Photo photo = 2; +// } +// message User { +// string display_name = 1; +// string address = 2; +// } +// +// In proto a field mask for `Profile` may look as such: +// +// mask { +// paths: "user.display_name" +// paths: "photo" +// } +// +// In JSON, the same mask is represented as below: +// +// { +// mask: "user.displayName,photo" +// } +// +// # Field Masks and Oneof Fields +// +// Field masks treat fields in oneofs just as regular fields. Consider the +// following message: +// +// message SampleMessage { +// oneof test_oneof { +// string name = 4; +// SubMessage sub_message = 9; +// } +// } +// +// The field mask can be: +// +// mask { +// paths: "name" +// } +// +// Or: +// +// mask { +// paths: "sub_message" +// } +// +// Note that oneof type names ("test_oneof" in this case) cannot be used in +// paths. +// +// ## Field Mask Verification +// +// The implementation of the all the API methods, which have any FieldMask type +// field in the request, should verify the included field paths, and return +// `INVALID_ARGUMENT` error if any path is duplicated or unmappable. +type FieldMask struct { + // The set of field mask paths. + Paths []string `protobuf:"bytes,1,rep,name=paths" json:"paths,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *FieldMask) Reset() { *m = FieldMask{} } +func (*FieldMask) ProtoMessage() {} +func (*FieldMask) Descriptor() ([]byte, []int) { + return fileDescriptor_field_mask_f1676d06eb3d88ba, []int{0} +} +func (m *FieldMask) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *FieldMask) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_FieldMask.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *FieldMask) XXX_Merge(src proto.Message) { + xxx_messageInfo_FieldMask.Merge(dst, src) +} +func (m *FieldMask) XXX_Size() int { + return m.Size() +} +func (m *FieldMask) XXX_DiscardUnknown() { + xxx_messageInfo_FieldMask.DiscardUnknown(m) +} + +var xxx_messageInfo_FieldMask proto.InternalMessageInfo + +func (m *FieldMask) GetPaths() []string { + if m != nil { + return m.Paths + } + return nil +} + +func (*FieldMask) XXX_MessageName() string { + return "google.protobuf.FieldMask" +} +func init() { + proto.RegisterType((*FieldMask)(nil), "google.protobuf.FieldMask") +} +func (this *FieldMask) Compare(that interface{}) int { + if that == nil { + if this == nil { + return 0 + } + return 1 + } + + that1, ok := that.(*FieldMask) + if !ok { + that2, ok := that.(FieldMask) + if ok { + that1 = &that2 + } else { + return 1 + } + } + if that1 == nil { + if this == nil { + return 0 + } + return 1 + } else if this == nil { + return -1 + } + if len(this.Paths) != len(that1.Paths) { + if len(this.Paths) < len(that1.Paths) { + return -1 + } + return 1 + } + for i := range this.Paths { + if this.Paths[i] != that1.Paths[i] { + if this.Paths[i] < that1.Paths[i] { + return -1 + } + return 1 + } + } + if c := bytes.Compare(this.XXX_unrecognized, that1.XXX_unrecognized); c != 0 { + return c + } + return 0 +} +func (this *FieldMask) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*FieldMask) + if !ok { + that2, ok := that.(FieldMask) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if len(this.Paths) != len(that1.Paths) { + return false + } + for i := range this.Paths { + if this.Paths[i] != that1.Paths[i] { + return false + } + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *FieldMask) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 5) + s = append(s, "&types.FieldMask{") + s = append(s, "Paths: "+fmt.Sprintf("%#v", this.Paths)+",\n") + if this.XXX_unrecognized != nil { + s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") + } + s = append(s, "}") + return strings.Join(s, "") +} +func valueToGoStringFieldMask(v interface{}, typ string) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv) +} +func (m *FieldMask) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *FieldMask) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Paths) > 0 { + for _, s := range m.Paths { + dAtA[i] = 0xa + i++ + l = len(s) + for l >= 1<<7 { + dAtA[i] = uint8(uint64(l)&0x7f | 0x80) + l >>= 7 + i++ + } + dAtA[i] = uint8(l) + i++ + i += copy(dAtA[i:], s) + } + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func encodeVarintFieldMask(dAtA []byte, offset int, v uint64) int { + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return offset + 1 +} +func NewPopulatedFieldMask(r randyFieldMask, easy bool) *FieldMask { + this := &FieldMask{} + v1 := r.Intn(10) + this.Paths = make([]string, v1) + for i := 0; i < v1; i++ { + this.Paths[i] = string(randStringFieldMask(r)) + } + if !easy && r.Intn(10) != 0 { + this.XXX_unrecognized = randUnrecognizedFieldMask(r, 2) + } + return this +} + +type randyFieldMask interface { + Float32() float32 + Float64() float64 + Int63() int64 + Int31() int32 + Uint32() uint32 + Intn(n int) int +} + +func randUTF8RuneFieldMask(r randyFieldMask) rune { + ru := r.Intn(62) + if ru < 10 { + return rune(ru + 48) + } else if ru < 36 { + return rune(ru + 55) + } + return rune(ru + 61) +} +func randStringFieldMask(r randyFieldMask) string { + v2 := r.Intn(100) + tmps := make([]rune, v2) + for i := 0; i < v2; i++ { + tmps[i] = randUTF8RuneFieldMask(r) + } + return string(tmps) +} +func randUnrecognizedFieldMask(r randyFieldMask, maxFieldNumber int) (dAtA []byte) { + l := r.Intn(5) + for i := 0; i < l; i++ { + wire := r.Intn(4) + if wire == 3 { + wire = 5 + } + fieldNumber := maxFieldNumber + r.Intn(100) + dAtA = randFieldFieldMask(dAtA, r, fieldNumber, wire) + } + return dAtA +} +func randFieldFieldMask(dAtA []byte, r randyFieldMask, fieldNumber int, wire int) []byte { + key := uint32(fieldNumber)<<3 | uint32(wire) + switch wire { + case 0: + dAtA = encodeVarintPopulateFieldMask(dAtA, uint64(key)) + v3 := r.Int63() + if r.Intn(2) == 0 { + v3 *= -1 + } + dAtA = encodeVarintPopulateFieldMask(dAtA, uint64(v3)) + case 1: + dAtA = encodeVarintPopulateFieldMask(dAtA, uint64(key)) + dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256))) + case 2: + dAtA = encodeVarintPopulateFieldMask(dAtA, uint64(key)) + ll := r.Intn(100) + dAtA = encodeVarintPopulateFieldMask(dAtA, uint64(ll)) + for j := 0; j < ll; j++ { + dAtA = append(dAtA, byte(r.Intn(256))) + } + default: + dAtA = encodeVarintPopulateFieldMask(dAtA, uint64(key)) + dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256))) + } + return dAtA +} +func encodeVarintPopulateFieldMask(dAtA []byte, v uint64) []byte { + for v >= 1<<7 { + dAtA = append(dAtA, uint8(uint64(v)&0x7f|0x80)) + v >>= 7 + } + dAtA = append(dAtA, uint8(v)) + return dAtA +} +func (m *FieldMask) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Paths) > 0 { + for _, s := range m.Paths { + l = len(s) + n += 1 + l + sovFieldMask(uint64(l)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func sovFieldMask(x uint64) (n int) { + for { + n++ + x >>= 7 + if x == 0 { + break + } + } + return n +} +func sozFieldMask(x uint64) (n int) { + return sovFieldMask(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (this *FieldMask) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&FieldMask{`, + `Paths:` + fmt.Sprintf("%v", this.Paths) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func valueToStringFieldMask(v interface{}) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("*%v", pv) +} +func (m *FieldMask) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFieldMask + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: FieldMask: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: FieldMask: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Paths", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFieldMask + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthFieldMask + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Paths = append(m.Paths, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipFieldMask(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthFieldMask + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipFieldMask(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowFieldMask + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowFieldMask + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + return iNdEx, nil + case 1: + iNdEx += 8 + return iNdEx, nil + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowFieldMask + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + iNdEx += length + if length < 0 { + return 0, ErrInvalidLengthFieldMask + } + return iNdEx, nil + case 3: + for { + var innerWire uint64 + var start int = iNdEx + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowFieldMask + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + innerWire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + innerWireType := int(innerWire & 0x7) + if innerWireType == 4 { + break + } + next, err := skipFieldMask(dAtA[start:]) + if err != nil { + return 0, err + } + iNdEx = start + next + } + return iNdEx, nil + case 4: + return iNdEx, nil + case 5: + iNdEx += 4 + return iNdEx, nil + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + } + panic("unreachable") +} + +var ( + ErrInvalidLengthFieldMask = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowFieldMask = fmt.Errorf("proto: integer overflow") +) + +func init() { + proto.RegisterFile("google/protobuf/field_mask.proto", fileDescriptor_field_mask_f1676d06eb3d88ba) +} + +var fileDescriptor_field_mask_f1676d06eb3d88ba = []byte{ + // 200 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x48, 0xcf, 0xcf, 0x4f, + 0xcf, 0x49, 0xd5, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0x4f, 0x2a, 0x4d, 0xd3, 0x4f, 0xcb, 0x4c, 0xcd, + 0x49, 0x89, 0xcf, 0x4d, 0x2c, 0xce, 0xd6, 0x03, 0x8b, 0x09, 0xf1, 0x43, 0x54, 0xe8, 0xc1, 0x54, + 0x28, 0x29, 0x72, 0x71, 0xba, 0x81, 0x14, 0xf9, 0x26, 0x16, 0x67, 0x0b, 0x89, 0x70, 0xb1, 0x16, + 0x24, 0x96, 0x64, 0x14, 0x4b, 0x30, 0x2a, 0x30, 0x6b, 0x70, 0x06, 0x41, 0x38, 0x4e, 0xad, 0x8c, + 0x37, 0x1e, 0xca, 0x31, 0x7c, 0x78, 0x28, 0xc7, 0xf8, 0xe3, 0xa1, 0x1c, 0x63, 0xc3, 0x23, 0x39, + 0xc6, 0x15, 0x8f, 0xe4, 0x18, 0x4f, 0x3c, 0x92, 0x63, 0xbc, 0xf0, 0x48, 0x8e, 0xf1, 0xc1, 0x23, + 0x39, 0xc6, 0x17, 0x8f, 0xe4, 0x18, 0x3e, 0x80, 0xc4, 0x1f, 0xcb, 0x31, 0x9e, 0x78, 0x2c, 0xc7, + 0xc8, 0x25, 0x9c, 0x9c, 0x9f, 0xab, 0x87, 0x66, 0x95, 0x13, 0x1f, 0xdc, 0xa2, 0x00, 0x90, 0x50, + 0x00, 0x63, 0x14, 0x6b, 0x49, 0x65, 0x41, 0x6a, 0xf1, 0x22, 0x26, 0x66, 0xf7, 0x00, 0xa7, 0x55, + 0x4c, 0x72, 0xee, 0x10, 0x0d, 0x01, 0x50, 0x0d, 0x7a, 0xe1, 0xa9, 0x39, 0x39, 0xde, 0x79, 0xf9, + 0xe5, 0x79, 0x21, 0x20, 0x65, 0x49, 0x6c, 0x60, 0x93, 0x8c, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, + 0xcf, 0xae, 0x5b, 0xec, 0xe6, 0x00, 0x00, 0x00, +} diff --git a/vendor/github.com/gogo/protobuf/types/protosize.go b/vendor/github.com/gogo/protobuf/types/protosize.go new file mode 100644 index 000000000000..3a2d1b7e1118 --- /dev/null +++ b/vendor/github.com/gogo/protobuf/types/protosize.go @@ -0,0 +1,34 @@ +package types + +func (m *Any) ProtoSize() (n int) { return m.Size() } +func (m *Api) ProtoSize() (n int) { return m.Size() } +func (m *Method) ProtoSize() (n int) { return m.Size() } +func (m *Mixin) ProtoSize() (n int) { return m.Size() } +func (m *Duration) ProtoSize() (n int) { return m.Size() } +func (m *Empty) ProtoSize() (n int) { return m.Size() } +func (m *FieldMask) ProtoSize() (n int) { return m.Size() } +func (m *SourceContext) ProtoSize() (n int) { return m.Size() } +func (m *Struct) ProtoSize() (n int) { return m.Size() } +func (m *Value) ProtoSize() (n int) { return m.Size() } +func (m *Value_NullValue) ProtoSize() (n int) { return m.Size() } +func (m *Value_NumberValue) ProtoSize() (n int) { return m.Size() } +func (m *Value_StringValue) ProtoSize() (n int) { return m.Size() } +func (m *Value_BoolValue) ProtoSize() (n int) { return m.Size() } +func (m *Value_StructValue) ProtoSize() (n int) { return m.Size() } +func (m *Value_ListValue) ProtoSize() (n int) { return m.Size() } +func (m *ListValue) ProtoSize() (n int) { return m.Size() } +func (m *Timestamp) ProtoSize() (n int) { return m.Size() } +func (m *Type) ProtoSize() (n int) { return m.Size() } +func (m *Field) ProtoSize() (n int) { return m.Size() } +func (m *Enum) ProtoSize() (n int) { return m.Size() } +func (m *EnumValue) ProtoSize() (n int) { return m.Size() } +func (m *Option) ProtoSize() (n int) { return m.Size() } +func (m *DoubleValue) ProtoSize() (n int) { return m.Size() } +func (m *FloatValue) ProtoSize() (n int) { return m.Size() } +func (m *Int64Value) ProtoSize() (n int) { return m.Size() } +func (m *UInt64Value) ProtoSize() (n int) { return m.Size() } +func (m *Int32Value) ProtoSize() (n int) { return m.Size() } +func (m *UInt32Value) ProtoSize() (n int) { return m.Size() } +func (m *BoolValue) ProtoSize() (n int) { return m.Size() } +func (m *StringValue) ProtoSize() (n int) { return m.Size() } +func (m *BytesValue) ProtoSize() (n int) { return m.Size() } diff --git a/vendor/github.com/gogo/protobuf/types/source_context.pb.go b/vendor/github.com/gogo/protobuf/types/source_context.pb.go new file mode 100644 index 000000000000..97b6d62abd69 --- /dev/null +++ b/vendor/github.com/gogo/protobuf/types/source_context.pb.go @@ -0,0 +1,538 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: google/protobuf/source_context.proto + +package types + +import proto "github.com/gogo/protobuf/proto" +import fmt "fmt" +import math "math" + +import bytes "bytes" + +import strings "strings" +import reflect "reflect" + +import io "io" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package + +// `SourceContext` represents information about the source of a +// protobuf element, like the file in which it is defined. +type SourceContext struct { + // The path-qualified name of the .proto file that contained the associated + // protobuf element. For example: `"google/protobuf/source_context.proto"`. + FileName string `protobuf:"bytes,1,opt,name=file_name,json=fileName,proto3" json:"file_name,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SourceContext) Reset() { *m = SourceContext{} } +func (*SourceContext) ProtoMessage() {} +func (*SourceContext) Descriptor() ([]byte, []int) { + return fileDescriptor_source_context_b387e69fb08d10e5, []int{0} +} +func (m *SourceContext) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *SourceContext) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_SourceContext.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *SourceContext) XXX_Merge(src proto.Message) { + xxx_messageInfo_SourceContext.Merge(dst, src) +} +func (m *SourceContext) XXX_Size() int { + return m.Size() +} +func (m *SourceContext) XXX_DiscardUnknown() { + xxx_messageInfo_SourceContext.DiscardUnknown(m) +} + +var xxx_messageInfo_SourceContext proto.InternalMessageInfo + +func (m *SourceContext) GetFileName() string { + if m != nil { + return m.FileName + } + return "" +} + +func (*SourceContext) XXX_MessageName() string { + return "google.protobuf.SourceContext" +} +func init() { + proto.RegisterType((*SourceContext)(nil), "google.protobuf.SourceContext") +} +func (this *SourceContext) Compare(that interface{}) int { + if that == nil { + if this == nil { + return 0 + } + return 1 + } + + that1, ok := that.(*SourceContext) + if !ok { + that2, ok := that.(SourceContext) + if ok { + that1 = &that2 + } else { + return 1 + } + } + if that1 == nil { + if this == nil { + return 0 + } + return 1 + } else if this == nil { + return -1 + } + if this.FileName != that1.FileName { + if this.FileName < that1.FileName { + return -1 + } + return 1 + } + if c := bytes.Compare(this.XXX_unrecognized, that1.XXX_unrecognized); c != 0 { + return c + } + return 0 +} +func (this *SourceContext) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*SourceContext) + if !ok { + that2, ok := that.(SourceContext) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.FileName != that1.FileName { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *SourceContext) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 5) + s = append(s, "&types.SourceContext{") + s = append(s, "FileName: "+fmt.Sprintf("%#v", this.FileName)+",\n") + if this.XXX_unrecognized != nil { + s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") + } + s = append(s, "}") + return strings.Join(s, "") +} +func valueToGoStringSourceContext(v interface{}, typ string) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv) +} +func (m *SourceContext) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *SourceContext) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.FileName) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintSourceContext(dAtA, i, uint64(len(m.FileName))) + i += copy(dAtA[i:], m.FileName) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func encodeVarintSourceContext(dAtA []byte, offset int, v uint64) int { + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return offset + 1 +} +func NewPopulatedSourceContext(r randySourceContext, easy bool) *SourceContext { + this := &SourceContext{} + this.FileName = string(randStringSourceContext(r)) + if !easy && r.Intn(10) != 0 { + this.XXX_unrecognized = randUnrecognizedSourceContext(r, 2) + } + return this +} + +type randySourceContext interface { + Float32() float32 + Float64() float64 + Int63() int64 + Int31() int32 + Uint32() uint32 + Intn(n int) int +} + +func randUTF8RuneSourceContext(r randySourceContext) rune { + ru := r.Intn(62) + if ru < 10 { + return rune(ru + 48) + } else if ru < 36 { + return rune(ru + 55) + } + return rune(ru + 61) +} +func randStringSourceContext(r randySourceContext) string { + v1 := r.Intn(100) + tmps := make([]rune, v1) + for i := 0; i < v1; i++ { + tmps[i] = randUTF8RuneSourceContext(r) + } + return string(tmps) +} +func randUnrecognizedSourceContext(r randySourceContext, maxFieldNumber int) (dAtA []byte) { + l := r.Intn(5) + for i := 0; i < l; i++ { + wire := r.Intn(4) + if wire == 3 { + wire = 5 + } + fieldNumber := maxFieldNumber + r.Intn(100) + dAtA = randFieldSourceContext(dAtA, r, fieldNumber, wire) + } + return dAtA +} +func randFieldSourceContext(dAtA []byte, r randySourceContext, fieldNumber int, wire int) []byte { + key := uint32(fieldNumber)<<3 | uint32(wire) + switch wire { + case 0: + dAtA = encodeVarintPopulateSourceContext(dAtA, uint64(key)) + v2 := r.Int63() + if r.Intn(2) == 0 { + v2 *= -1 + } + dAtA = encodeVarintPopulateSourceContext(dAtA, uint64(v2)) + case 1: + dAtA = encodeVarintPopulateSourceContext(dAtA, uint64(key)) + dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256))) + case 2: + dAtA = encodeVarintPopulateSourceContext(dAtA, uint64(key)) + ll := r.Intn(100) + dAtA = encodeVarintPopulateSourceContext(dAtA, uint64(ll)) + for j := 0; j < ll; j++ { + dAtA = append(dAtA, byte(r.Intn(256))) + } + default: + dAtA = encodeVarintPopulateSourceContext(dAtA, uint64(key)) + dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256))) + } + return dAtA +} +func encodeVarintPopulateSourceContext(dAtA []byte, v uint64) []byte { + for v >= 1<<7 { + dAtA = append(dAtA, uint8(uint64(v)&0x7f|0x80)) + v >>= 7 + } + dAtA = append(dAtA, uint8(v)) + return dAtA +} +func (m *SourceContext) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.FileName) + if l > 0 { + n += 1 + l + sovSourceContext(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func sovSourceContext(x uint64) (n int) { + for { + n++ + x >>= 7 + if x == 0 { + break + } + } + return n +} +func sozSourceContext(x uint64) (n int) { + return sovSourceContext(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (this *SourceContext) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&SourceContext{`, + `FileName:` + fmt.Sprintf("%v", this.FileName) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func valueToStringSourceContext(v interface{}) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("*%v", pv) +} +func (m *SourceContext) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSourceContext + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: SourceContext: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SourceContext: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FileName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSourceContext + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthSourceContext + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.FileName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipSourceContext(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthSourceContext + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipSourceContext(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowSourceContext + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowSourceContext + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + return iNdEx, nil + case 1: + iNdEx += 8 + return iNdEx, nil + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowSourceContext + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + iNdEx += length + if length < 0 { + return 0, ErrInvalidLengthSourceContext + } + return iNdEx, nil + case 3: + for { + var innerWire uint64 + var start int = iNdEx + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowSourceContext + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + innerWire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + innerWireType := int(innerWire & 0x7) + if innerWireType == 4 { + break + } + next, err := skipSourceContext(dAtA[start:]) + if err != nil { + return 0, err + } + iNdEx = start + next + } + return iNdEx, nil + case 4: + return iNdEx, nil + case 5: + iNdEx += 4 + return iNdEx, nil + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + } + panic("unreachable") +} + +var ( + ErrInvalidLengthSourceContext = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowSourceContext = fmt.Errorf("proto: integer overflow") +) + +func init() { + proto.RegisterFile("google/protobuf/source_context.proto", fileDescriptor_source_context_b387e69fb08d10e5) +} + +var fileDescriptor_source_context_b387e69fb08d10e5 = []byte{ + // 212 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x49, 0xcf, 0xcf, 0x4f, + 0xcf, 0x49, 0xd5, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0x4f, 0x2a, 0x4d, 0xd3, 0x2f, 0xce, 0x2f, 0x2d, + 0x4a, 0x4e, 0x8d, 0x4f, 0xce, 0xcf, 0x2b, 0x49, 0xad, 0x28, 0xd1, 0x03, 0x8b, 0x0b, 0xf1, 0x43, + 0x54, 0xe9, 0xc1, 0x54, 0x29, 0xe9, 0x70, 0xf1, 0x06, 0x83, 0x15, 0x3a, 0x43, 0xd4, 0x09, 0x49, + 0x73, 0x71, 0xa6, 0x65, 0xe6, 0xa4, 0xc6, 0xe7, 0x25, 0xe6, 0xa6, 0x4a, 0x30, 0x2a, 0x30, 0x6a, + 0x70, 0x06, 0x71, 0x80, 0x04, 0xfc, 0x12, 0x73, 0x53, 0x9d, 0x3a, 0x19, 0x6f, 0x3c, 0x94, 0x63, + 0xf8, 0xf0, 0x50, 0x8e, 0xf1, 0xc7, 0x43, 0x39, 0xc6, 0x86, 0x47, 0x72, 0x8c, 0x2b, 0x1e, 0xc9, + 0x31, 0x9e, 0x78, 0x24, 0xc7, 0x78, 0xe1, 0x91, 0x1c, 0xe3, 0x83, 0x47, 0x72, 0x8c, 0x2f, 0x1e, + 0xc9, 0x31, 0x7c, 0x00, 0x89, 0x3f, 0x96, 0x63, 0x3c, 0xf1, 0x58, 0x8e, 0x91, 0x4b, 0x38, 0x39, + 0x3f, 0x57, 0x0f, 0xcd, 0x56, 0x27, 0x21, 0x14, 0x3b, 0x03, 0x40, 0xc2, 0x01, 0x8c, 0x51, 0xac, + 0x25, 0x95, 0x05, 0xa9, 0xc5, 0x8b, 0x98, 0x98, 0xdd, 0x03, 0x9c, 0x56, 0x31, 0xc9, 0xb9, 0x43, + 0x34, 0x05, 0x40, 0x35, 0xe9, 0x85, 0xa7, 0xe6, 0xe4, 0x78, 0xe7, 0xe5, 0x97, 0xe7, 0x85, 0x80, + 0x94, 0x25, 0xb1, 0x81, 0x4d, 0x33, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0xb8, 0x37, 0x2a, 0xa1, + 0xf9, 0x00, 0x00, 0x00, +} diff --git a/vendor/github.com/gogo/protobuf/types/struct.pb.go b/vendor/github.com/gogo/protobuf/types/struct.pb.go new file mode 100644 index 000000000000..ee7b77a7dbb8 --- /dev/null +++ b/vendor/github.com/gogo/protobuf/types/struct.pb.go @@ -0,0 +1,1986 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: google/protobuf/struct.proto + +package types + +import proto "github.com/gogo/protobuf/proto" +import fmt "fmt" +import math "math" + +import strconv "strconv" + +import bytes "bytes" + +import strings "strings" +import reflect "reflect" +import github_com_gogo_protobuf_sortkeys "github.com/gogo/protobuf/sortkeys" + +import encoding_binary "encoding/binary" + +import io "io" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package + +// `NullValue` is a singleton enumeration to represent the null value for the +// `Value` type union. +// +// The JSON representation for `NullValue` is JSON `null`. +type NullValue int32 + +const ( + // Null value. + NullValue_NULL_VALUE NullValue = 0 +) + +var NullValue_name = map[int32]string{ + 0: "NULL_VALUE", +} +var NullValue_value = map[string]int32{ + "NULL_VALUE": 0, +} + +func (NullValue) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_struct_7f9d36853146434f, []int{0} +} +func (NullValue) XXX_WellKnownType() string { return "NullValue" } + +// `Struct` represents a structured data value, consisting of fields +// which map to dynamically typed values. In some languages, `Struct` +// might be supported by a native representation. For example, in +// scripting languages like JS a struct is represented as an +// object. The details of that representation are described together +// with the proto support for the language. +// +// The JSON representation for `Struct` is JSON object. +type Struct struct { + // Unordered map of dynamically typed values. + Fields map[string]*Value `protobuf:"bytes,1,rep,name=fields" json:"fields,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Struct) Reset() { *m = Struct{} } +func (*Struct) ProtoMessage() {} +func (*Struct) Descriptor() ([]byte, []int) { + return fileDescriptor_struct_7f9d36853146434f, []int{0} +} +func (*Struct) XXX_WellKnownType() string { return "Struct" } +func (m *Struct) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Struct) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Struct.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *Struct) XXX_Merge(src proto.Message) { + xxx_messageInfo_Struct.Merge(dst, src) +} +func (m *Struct) XXX_Size() int { + return m.Size() +} +func (m *Struct) XXX_DiscardUnknown() { + xxx_messageInfo_Struct.DiscardUnknown(m) +} + +var xxx_messageInfo_Struct proto.InternalMessageInfo + +func (m *Struct) GetFields() map[string]*Value { + if m != nil { + return m.Fields + } + return nil +} + +func (*Struct) XXX_MessageName() string { + return "google.protobuf.Struct" +} + +// `Value` represents a dynamically typed value which can be either +// null, a number, a string, a boolean, a recursive struct value, or a +// list of values. A producer of value is expected to set one of that +// variants, absence of any variant indicates an error. +// +// The JSON representation for `Value` is JSON value. +type Value struct { + // The kind of value. + // + // Types that are valid to be assigned to Kind: + // *Value_NullValue + // *Value_NumberValue + // *Value_StringValue + // *Value_BoolValue + // *Value_StructValue + // *Value_ListValue + Kind isValue_Kind `protobuf_oneof:"kind"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Value) Reset() { *m = Value{} } +func (*Value) ProtoMessage() {} +func (*Value) Descriptor() ([]byte, []int) { + return fileDescriptor_struct_7f9d36853146434f, []int{1} +} +func (*Value) XXX_WellKnownType() string { return "Value" } +func (m *Value) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Value) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Value.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *Value) XXX_Merge(src proto.Message) { + xxx_messageInfo_Value.Merge(dst, src) +} +func (m *Value) XXX_Size() int { + return m.Size() +} +func (m *Value) XXX_DiscardUnknown() { + xxx_messageInfo_Value.DiscardUnknown(m) +} + +var xxx_messageInfo_Value proto.InternalMessageInfo + +type isValue_Kind interface { + isValue_Kind() + Equal(interface{}) bool + MarshalTo([]byte) (int, error) + Size() int +} + +type Value_NullValue struct { + NullValue NullValue `protobuf:"varint,1,opt,name=null_value,json=nullValue,proto3,enum=google.protobuf.NullValue,oneof"` +} +type Value_NumberValue struct { + NumberValue float64 `protobuf:"fixed64,2,opt,name=number_value,json=numberValue,proto3,oneof"` +} +type Value_StringValue struct { + StringValue string `protobuf:"bytes,3,opt,name=string_value,json=stringValue,proto3,oneof"` +} +type Value_BoolValue struct { + BoolValue bool `protobuf:"varint,4,opt,name=bool_value,json=boolValue,proto3,oneof"` +} +type Value_StructValue struct { + StructValue *Struct `protobuf:"bytes,5,opt,name=struct_value,json=structValue,oneof"` +} +type Value_ListValue struct { + ListValue *ListValue `protobuf:"bytes,6,opt,name=list_value,json=listValue,oneof"` +} + +func (*Value_NullValue) isValue_Kind() {} +func (*Value_NumberValue) isValue_Kind() {} +func (*Value_StringValue) isValue_Kind() {} +func (*Value_BoolValue) isValue_Kind() {} +func (*Value_StructValue) isValue_Kind() {} +func (*Value_ListValue) isValue_Kind() {} + +func (m *Value) GetKind() isValue_Kind { + if m != nil { + return m.Kind + } + return nil +} + +func (m *Value) GetNullValue() NullValue { + if x, ok := m.GetKind().(*Value_NullValue); ok { + return x.NullValue + } + return NullValue_NULL_VALUE +} + +func (m *Value) GetNumberValue() float64 { + if x, ok := m.GetKind().(*Value_NumberValue); ok { + return x.NumberValue + } + return 0 +} + +func (m *Value) GetStringValue() string { + if x, ok := m.GetKind().(*Value_StringValue); ok { + return x.StringValue + } + return "" +} + +func (m *Value) GetBoolValue() bool { + if x, ok := m.GetKind().(*Value_BoolValue); ok { + return x.BoolValue + } + return false +} + +func (m *Value) GetStructValue() *Struct { + if x, ok := m.GetKind().(*Value_StructValue); ok { + return x.StructValue + } + return nil +} + +func (m *Value) GetListValue() *ListValue { + if x, ok := m.GetKind().(*Value_ListValue); ok { + return x.ListValue + } + return nil +} + +// XXX_OneofFuncs is for the internal use of the proto package. +func (*Value) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { + return _Value_OneofMarshaler, _Value_OneofUnmarshaler, _Value_OneofSizer, []interface{}{ + (*Value_NullValue)(nil), + (*Value_NumberValue)(nil), + (*Value_StringValue)(nil), + (*Value_BoolValue)(nil), + (*Value_StructValue)(nil), + (*Value_ListValue)(nil), + } +} + +func _Value_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { + m := msg.(*Value) + // kind + switch x := m.Kind.(type) { + case *Value_NullValue: + _ = b.EncodeVarint(1<<3 | proto.WireVarint) + _ = b.EncodeVarint(uint64(x.NullValue)) + case *Value_NumberValue: + _ = b.EncodeVarint(2<<3 | proto.WireFixed64) + _ = b.EncodeFixed64(math.Float64bits(x.NumberValue)) + case *Value_StringValue: + _ = b.EncodeVarint(3<<3 | proto.WireBytes) + _ = b.EncodeStringBytes(x.StringValue) + case *Value_BoolValue: + t := uint64(0) + if x.BoolValue { + t = 1 + } + _ = b.EncodeVarint(4<<3 | proto.WireVarint) + _ = b.EncodeVarint(t) + case *Value_StructValue: + _ = b.EncodeVarint(5<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.StructValue); err != nil { + return err + } + case *Value_ListValue: + _ = b.EncodeVarint(6<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.ListValue); err != nil { + return err + } + case nil: + default: + return fmt.Errorf("Value.Kind has unexpected type %T", x) + } + return nil +} + +func _Value_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { + m := msg.(*Value) + switch tag { + case 1: // kind.null_value + if wire != proto.WireVarint { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeVarint() + m.Kind = &Value_NullValue{NullValue(x)} + return true, err + case 2: // kind.number_value + if wire != proto.WireFixed64 { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeFixed64() + m.Kind = &Value_NumberValue{math.Float64frombits(x)} + return true, err + case 3: // kind.string_value + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeStringBytes() + m.Kind = &Value_StringValue{x} + return true, err + case 4: // kind.bool_value + if wire != proto.WireVarint { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeVarint() + m.Kind = &Value_BoolValue{x != 0} + return true, err + case 5: // kind.struct_value + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(Struct) + err := b.DecodeMessage(msg) + m.Kind = &Value_StructValue{msg} + return true, err + case 6: // kind.list_value + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(ListValue) + err := b.DecodeMessage(msg) + m.Kind = &Value_ListValue{msg} + return true, err + default: + return false, nil + } +} + +func _Value_OneofSizer(msg proto.Message) (n int) { + m := msg.(*Value) + // kind + switch x := m.Kind.(type) { + case *Value_NullValue: + n += 1 // tag and wire + n += proto.SizeVarint(uint64(x.NullValue)) + case *Value_NumberValue: + n += 1 // tag and wire + n += 8 + case *Value_StringValue: + n += 1 // tag and wire + n += proto.SizeVarint(uint64(len(x.StringValue))) + n += len(x.StringValue) + case *Value_BoolValue: + n += 1 // tag and wire + n += 1 + case *Value_StructValue: + s := proto.Size(x.StructValue) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case *Value_ListValue: + s := proto.Size(x.ListValue) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case nil: + default: + panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) + } + return n +} + +func (*Value) XXX_MessageName() string { + return "google.protobuf.Value" +} + +// `ListValue` is a wrapper around a repeated field of values. +// +// The JSON representation for `ListValue` is JSON array. +type ListValue struct { + // Repeated field of dynamically typed values. + Values []*Value `protobuf:"bytes,1,rep,name=values" json:"values,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ListValue) Reset() { *m = ListValue{} } +func (*ListValue) ProtoMessage() {} +func (*ListValue) Descriptor() ([]byte, []int) { + return fileDescriptor_struct_7f9d36853146434f, []int{2} +} +func (*ListValue) XXX_WellKnownType() string { return "ListValue" } +func (m *ListValue) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ListValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ListValue.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *ListValue) XXX_Merge(src proto.Message) { + xxx_messageInfo_ListValue.Merge(dst, src) +} +func (m *ListValue) XXX_Size() int { + return m.Size() +} +func (m *ListValue) XXX_DiscardUnknown() { + xxx_messageInfo_ListValue.DiscardUnknown(m) +} + +var xxx_messageInfo_ListValue proto.InternalMessageInfo + +func (m *ListValue) GetValues() []*Value { + if m != nil { + return m.Values + } + return nil +} + +func (*ListValue) XXX_MessageName() string { + return "google.protobuf.ListValue" +} +func init() { + proto.RegisterType((*Struct)(nil), "google.protobuf.Struct") + proto.RegisterMapType((map[string]*Value)(nil), "google.protobuf.Struct.FieldsEntry") + proto.RegisterType((*Value)(nil), "google.protobuf.Value") + proto.RegisterType((*ListValue)(nil), "google.protobuf.ListValue") + proto.RegisterEnum("google.protobuf.NullValue", NullValue_name, NullValue_value) +} +func (x NullValue) String() string { + s, ok := NullValue_name[int32(x)] + if ok { + return s + } + return strconv.Itoa(int(x)) +} +func (this *Struct) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Struct) + if !ok { + that2, ok := that.(Struct) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if len(this.Fields) != len(that1.Fields) { + return false + } + for i := range this.Fields { + if !this.Fields[i].Equal(that1.Fields[i]) { + return false + } + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *Value) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Value) + if !ok { + that2, ok := that.(Value) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if that1.Kind == nil { + if this.Kind != nil { + return false + } + } else if this.Kind == nil { + return false + } else if !this.Kind.Equal(that1.Kind) { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *Value_NullValue) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Value_NullValue) + if !ok { + that2, ok := that.(Value_NullValue) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.NullValue != that1.NullValue { + return false + } + return true +} +func (this *Value_NumberValue) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Value_NumberValue) + if !ok { + that2, ok := that.(Value_NumberValue) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.NumberValue != that1.NumberValue { + return false + } + return true +} +func (this *Value_StringValue) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Value_StringValue) + if !ok { + that2, ok := that.(Value_StringValue) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.StringValue != that1.StringValue { + return false + } + return true +} +func (this *Value_BoolValue) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Value_BoolValue) + if !ok { + that2, ok := that.(Value_BoolValue) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.BoolValue != that1.BoolValue { + return false + } + return true +} +func (this *Value_StructValue) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Value_StructValue) + if !ok { + that2, ok := that.(Value_StructValue) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.StructValue.Equal(that1.StructValue) { + return false + } + return true +} +func (this *Value_ListValue) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Value_ListValue) + if !ok { + that2, ok := that.(Value_ListValue) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.ListValue.Equal(that1.ListValue) { + return false + } + return true +} +func (this *ListValue) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*ListValue) + if !ok { + that2, ok := that.(ListValue) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if len(this.Values) != len(that1.Values) { + return false + } + for i := range this.Values { + if !this.Values[i].Equal(that1.Values[i]) { + return false + } + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *Struct) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 5) + s = append(s, "&types.Struct{") + keysForFields := make([]string, 0, len(this.Fields)) + for k := range this.Fields { + keysForFields = append(keysForFields, k) + } + github_com_gogo_protobuf_sortkeys.Strings(keysForFields) + mapStringForFields := "map[string]*Value{" + for _, k := range keysForFields { + mapStringForFields += fmt.Sprintf("%#v: %#v,", k, this.Fields[k]) + } + mapStringForFields += "}" + if this.Fields != nil { + s = append(s, "Fields: "+mapStringForFields+",\n") + } + if this.XXX_unrecognized != nil { + s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") + } + s = append(s, "}") + return strings.Join(s, "") +} +func (this *Value) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 10) + s = append(s, "&types.Value{") + if this.Kind != nil { + s = append(s, "Kind: "+fmt.Sprintf("%#v", this.Kind)+",\n") + } + if this.XXX_unrecognized != nil { + s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") + } + s = append(s, "}") + return strings.Join(s, "") +} +func (this *Value_NullValue) GoString() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&types.Value_NullValue{` + + `NullValue:` + fmt.Sprintf("%#v", this.NullValue) + `}`}, ", ") + return s +} +func (this *Value_NumberValue) GoString() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&types.Value_NumberValue{` + + `NumberValue:` + fmt.Sprintf("%#v", this.NumberValue) + `}`}, ", ") + return s +} +func (this *Value_StringValue) GoString() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&types.Value_StringValue{` + + `StringValue:` + fmt.Sprintf("%#v", this.StringValue) + `}`}, ", ") + return s +} +func (this *Value_BoolValue) GoString() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&types.Value_BoolValue{` + + `BoolValue:` + fmt.Sprintf("%#v", this.BoolValue) + `}`}, ", ") + return s +} +func (this *Value_StructValue) GoString() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&types.Value_StructValue{` + + `StructValue:` + fmt.Sprintf("%#v", this.StructValue) + `}`}, ", ") + return s +} +func (this *Value_ListValue) GoString() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&types.Value_ListValue{` + + `ListValue:` + fmt.Sprintf("%#v", this.ListValue) + `}`}, ", ") + return s +} +func (this *ListValue) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 5) + s = append(s, "&types.ListValue{") + if this.Values != nil { + s = append(s, "Values: "+fmt.Sprintf("%#v", this.Values)+",\n") + } + if this.XXX_unrecognized != nil { + s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") + } + s = append(s, "}") + return strings.Join(s, "") +} +func valueToGoStringStruct(v interface{}, typ string) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv) +} +func (m *Struct) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Struct) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Fields) > 0 { + for k := range m.Fields { + dAtA[i] = 0xa + i++ + v := m.Fields[k] + msgSize := 0 + if v != nil { + msgSize = v.Size() + msgSize += 1 + sovStruct(uint64(msgSize)) + } + mapSize := 1 + len(k) + sovStruct(uint64(len(k))) + msgSize + i = encodeVarintStruct(dAtA, i, uint64(mapSize)) + dAtA[i] = 0xa + i++ + i = encodeVarintStruct(dAtA, i, uint64(len(k))) + i += copy(dAtA[i:], k) + if v != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintStruct(dAtA, i, uint64(v.Size())) + n1, err := v.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n1 + } + } + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *Value) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Value) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Kind != nil { + nn2, err := m.Kind.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += nn2 + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *Value_NullValue) MarshalTo(dAtA []byte) (int, error) { + i := 0 + dAtA[i] = 0x8 + i++ + i = encodeVarintStruct(dAtA, i, uint64(m.NullValue)) + return i, nil +} +func (m *Value_NumberValue) MarshalTo(dAtA []byte) (int, error) { + i := 0 + dAtA[i] = 0x11 + i++ + encoding_binary.LittleEndian.PutUint64(dAtA[i:], uint64(math.Float64bits(float64(m.NumberValue)))) + i += 8 + return i, nil +} +func (m *Value_StringValue) MarshalTo(dAtA []byte) (int, error) { + i := 0 + dAtA[i] = 0x1a + i++ + i = encodeVarintStruct(dAtA, i, uint64(len(m.StringValue))) + i += copy(dAtA[i:], m.StringValue) + return i, nil +} +func (m *Value_BoolValue) MarshalTo(dAtA []byte) (int, error) { + i := 0 + dAtA[i] = 0x20 + i++ + if m.BoolValue { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i++ + return i, nil +} +func (m *Value_StructValue) MarshalTo(dAtA []byte) (int, error) { + i := 0 + if m.StructValue != nil { + dAtA[i] = 0x2a + i++ + i = encodeVarintStruct(dAtA, i, uint64(m.StructValue.Size())) + n3, err := m.StructValue.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n3 + } + return i, nil +} +func (m *Value_ListValue) MarshalTo(dAtA []byte) (int, error) { + i := 0 + if m.ListValue != nil { + dAtA[i] = 0x32 + i++ + i = encodeVarintStruct(dAtA, i, uint64(m.ListValue.Size())) + n4, err := m.ListValue.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n4 + } + return i, nil +} +func (m *ListValue) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ListValue) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Values) > 0 { + for _, msg := range m.Values { + dAtA[i] = 0xa + i++ + i = encodeVarintStruct(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func encodeVarintStruct(dAtA []byte, offset int, v uint64) int { + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return offset + 1 +} +func NewPopulatedStruct(r randyStruct, easy bool) *Struct { + this := &Struct{} + if r.Intn(10) == 0 { + v1 := r.Intn(10) + this.Fields = make(map[string]*Value) + for i := 0; i < v1; i++ { + this.Fields[randStringStruct(r)] = NewPopulatedValue(r, easy) + } + } + if !easy && r.Intn(10) != 0 { + this.XXX_unrecognized = randUnrecognizedStruct(r, 2) + } + return this +} + +func NewPopulatedValue(r randyStruct, easy bool) *Value { + this := &Value{} + oneofNumber_Kind := []int32{1, 2, 3, 4, 5, 6}[r.Intn(6)] + switch oneofNumber_Kind { + case 1: + this.Kind = NewPopulatedValue_NullValue(r, easy) + case 2: + this.Kind = NewPopulatedValue_NumberValue(r, easy) + case 3: + this.Kind = NewPopulatedValue_StringValue(r, easy) + case 4: + this.Kind = NewPopulatedValue_BoolValue(r, easy) + case 5: + this.Kind = NewPopulatedValue_StructValue(r, easy) + case 6: + this.Kind = NewPopulatedValue_ListValue(r, easy) + } + if !easy && r.Intn(10) != 0 { + this.XXX_unrecognized = randUnrecognizedStruct(r, 7) + } + return this +} + +func NewPopulatedValue_NullValue(r randyStruct, easy bool) *Value_NullValue { + this := &Value_NullValue{} + this.NullValue = NullValue([]int32{0}[r.Intn(1)]) + return this +} +func NewPopulatedValue_NumberValue(r randyStruct, easy bool) *Value_NumberValue { + this := &Value_NumberValue{} + this.NumberValue = float64(r.Float64()) + if r.Intn(2) == 0 { + this.NumberValue *= -1 + } + return this +} +func NewPopulatedValue_StringValue(r randyStruct, easy bool) *Value_StringValue { + this := &Value_StringValue{} + this.StringValue = string(randStringStruct(r)) + return this +} +func NewPopulatedValue_BoolValue(r randyStruct, easy bool) *Value_BoolValue { + this := &Value_BoolValue{} + this.BoolValue = bool(bool(r.Intn(2) == 0)) + return this +} +func NewPopulatedValue_StructValue(r randyStruct, easy bool) *Value_StructValue { + this := &Value_StructValue{} + this.StructValue = NewPopulatedStruct(r, easy) + return this +} +func NewPopulatedValue_ListValue(r randyStruct, easy bool) *Value_ListValue { + this := &Value_ListValue{} + this.ListValue = NewPopulatedListValue(r, easy) + return this +} +func NewPopulatedListValue(r randyStruct, easy bool) *ListValue { + this := &ListValue{} + if r.Intn(10) == 0 { + v2 := r.Intn(5) + this.Values = make([]*Value, v2) + for i := 0; i < v2; i++ { + this.Values[i] = NewPopulatedValue(r, easy) + } + } + if !easy && r.Intn(10) != 0 { + this.XXX_unrecognized = randUnrecognizedStruct(r, 2) + } + return this +} + +type randyStruct interface { + Float32() float32 + Float64() float64 + Int63() int64 + Int31() int32 + Uint32() uint32 + Intn(n int) int +} + +func randUTF8RuneStruct(r randyStruct) rune { + ru := r.Intn(62) + if ru < 10 { + return rune(ru + 48) + } else if ru < 36 { + return rune(ru + 55) + } + return rune(ru + 61) +} +func randStringStruct(r randyStruct) string { + v3 := r.Intn(100) + tmps := make([]rune, v3) + for i := 0; i < v3; i++ { + tmps[i] = randUTF8RuneStruct(r) + } + return string(tmps) +} +func randUnrecognizedStruct(r randyStruct, maxFieldNumber int) (dAtA []byte) { + l := r.Intn(5) + for i := 0; i < l; i++ { + wire := r.Intn(4) + if wire == 3 { + wire = 5 + } + fieldNumber := maxFieldNumber + r.Intn(100) + dAtA = randFieldStruct(dAtA, r, fieldNumber, wire) + } + return dAtA +} +func randFieldStruct(dAtA []byte, r randyStruct, fieldNumber int, wire int) []byte { + key := uint32(fieldNumber)<<3 | uint32(wire) + switch wire { + case 0: + dAtA = encodeVarintPopulateStruct(dAtA, uint64(key)) + v4 := r.Int63() + if r.Intn(2) == 0 { + v4 *= -1 + } + dAtA = encodeVarintPopulateStruct(dAtA, uint64(v4)) + case 1: + dAtA = encodeVarintPopulateStruct(dAtA, uint64(key)) + dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256))) + case 2: + dAtA = encodeVarintPopulateStruct(dAtA, uint64(key)) + ll := r.Intn(100) + dAtA = encodeVarintPopulateStruct(dAtA, uint64(ll)) + for j := 0; j < ll; j++ { + dAtA = append(dAtA, byte(r.Intn(256))) + } + default: + dAtA = encodeVarintPopulateStruct(dAtA, uint64(key)) + dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256))) + } + return dAtA +} +func encodeVarintPopulateStruct(dAtA []byte, v uint64) []byte { + for v >= 1<<7 { + dAtA = append(dAtA, uint8(uint64(v)&0x7f|0x80)) + v >>= 7 + } + dAtA = append(dAtA, uint8(v)) + return dAtA +} +func (m *Struct) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Fields) > 0 { + for k, v := range m.Fields { + _ = k + _ = v + l = 0 + if v != nil { + l = v.Size() + l += 1 + sovStruct(uint64(l)) + } + mapEntrySize := 1 + len(k) + sovStruct(uint64(len(k))) + l + n += mapEntrySize + 1 + sovStruct(uint64(mapEntrySize)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *Value) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Kind != nil { + n += m.Kind.Size() + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *Value_NullValue) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + n += 1 + sovStruct(uint64(m.NullValue)) + return n +} +func (m *Value_NumberValue) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + n += 9 + return n +} +func (m *Value_StringValue) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.StringValue) + n += 1 + l + sovStruct(uint64(l)) + return n +} +func (m *Value_BoolValue) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + n += 2 + return n +} +func (m *Value_StructValue) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.StructValue != nil { + l = m.StructValue.Size() + n += 1 + l + sovStruct(uint64(l)) + } + return n +} +func (m *Value_ListValue) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ListValue != nil { + l = m.ListValue.Size() + n += 1 + l + sovStruct(uint64(l)) + } + return n +} +func (m *ListValue) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Values) > 0 { + for _, e := range m.Values { + l = e.Size() + n += 1 + l + sovStruct(uint64(l)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func sovStruct(x uint64) (n int) { + for { + n++ + x >>= 7 + if x == 0 { + break + } + } + return n +} +func sozStruct(x uint64) (n int) { + return sovStruct(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (this *Struct) String() string { + if this == nil { + return "nil" + } + keysForFields := make([]string, 0, len(this.Fields)) + for k := range this.Fields { + keysForFields = append(keysForFields, k) + } + github_com_gogo_protobuf_sortkeys.Strings(keysForFields) + mapStringForFields := "map[string]*Value{" + for _, k := range keysForFields { + mapStringForFields += fmt.Sprintf("%v: %v,", k, this.Fields[k]) + } + mapStringForFields += "}" + s := strings.Join([]string{`&Struct{`, + `Fields:` + mapStringForFields + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *Value) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&Value{`, + `Kind:` + fmt.Sprintf("%v", this.Kind) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *Value_NullValue) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&Value_NullValue{`, + `NullValue:` + fmt.Sprintf("%v", this.NullValue) + `,`, + `}`, + }, "") + return s +} +func (this *Value_NumberValue) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&Value_NumberValue{`, + `NumberValue:` + fmt.Sprintf("%v", this.NumberValue) + `,`, + `}`, + }, "") + return s +} +func (this *Value_StringValue) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&Value_StringValue{`, + `StringValue:` + fmt.Sprintf("%v", this.StringValue) + `,`, + `}`, + }, "") + return s +} +func (this *Value_BoolValue) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&Value_BoolValue{`, + `BoolValue:` + fmt.Sprintf("%v", this.BoolValue) + `,`, + `}`, + }, "") + return s +} +func (this *Value_StructValue) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&Value_StructValue{`, + `StructValue:` + strings.Replace(fmt.Sprintf("%v", this.StructValue), "Struct", "Struct", 1) + `,`, + `}`, + }, "") + return s +} +func (this *Value_ListValue) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&Value_ListValue{`, + `ListValue:` + strings.Replace(fmt.Sprintf("%v", this.ListValue), "ListValue", "ListValue", 1) + `,`, + `}`, + }, "") + return s +} +func (this *ListValue) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&ListValue{`, + `Values:` + strings.Replace(fmt.Sprintf("%v", this.Values), "Value", "Value", 1) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func valueToStringStruct(v interface{}) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("*%v", pv) +} +func (m *Struct) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStruct + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Struct: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Struct: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Fields", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStruct + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthStruct + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Fields == nil { + m.Fields = make(map[string]*Value) + } + var mapkey string + var mapvalue *Value + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStruct + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + var stringLenmapkey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStruct + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapkey |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return ErrInvalidLengthStruct + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey > l { + return io.ErrUnexpectedEOF + } + mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) + iNdEx = postStringIndexmapkey + } else if fieldNum == 2 { + var mapmsglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStruct + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + mapmsglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if mapmsglen < 0 { + return ErrInvalidLengthStruct + } + postmsgIndex := iNdEx + mapmsglen + if mapmsglen < 0 { + return ErrInvalidLengthStruct + } + if postmsgIndex > l { + return io.ErrUnexpectedEOF + } + mapvalue = &Value{} + if err := mapvalue.Unmarshal(dAtA[iNdEx:postmsgIndex]); err != nil { + return err + } + iNdEx = postmsgIndex + } else { + iNdEx = entryPreIndex + skippy, err := skipStruct(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthStruct + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.Fields[mapkey] = mapvalue + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipStruct(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthStruct + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Value) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStruct + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Value: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Value: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field NullValue", wireType) + } + var v NullValue + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStruct + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (NullValue(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.Kind = &Value_NullValue{v} + case 2: + if wireType != 1 { + return fmt.Errorf("proto: wrong wireType = %d for field NumberValue", wireType) + } + var v uint64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = uint64(encoding_binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + m.Kind = &Value_NumberValue{float64(math.Float64frombits(v))} + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field StringValue", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStruct + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthStruct + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Kind = &Value_StringValue{string(dAtA[iNdEx:postIndex])} + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BoolValue", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStruct + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + b := bool(v != 0) + m.Kind = &Value_BoolValue{b} + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field StructValue", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStruct + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthStruct + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &Struct{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Kind = &Value_StructValue{v} + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ListValue", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStruct + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthStruct + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &ListValue{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Kind = &Value_ListValue{v} + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipStruct(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthStruct + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ListValue) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStruct + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ListValue: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ListValue: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Values", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStruct + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthStruct + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Values = append(m.Values, &Value{}) + if err := m.Values[len(m.Values)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipStruct(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthStruct + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipStruct(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowStruct + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowStruct + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + return iNdEx, nil + case 1: + iNdEx += 8 + return iNdEx, nil + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowStruct + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + iNdEx += length + if length < 0 { + return 0, ErrInvalidLengthStruct + } + return iNdEx, nil + case 3: + for { + var innerWire uint64 + var start int = iNdEx + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowStruct + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + innerWire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + innerWireType := int(innerWire & 0x7) + if innerWireType == 4 { + break + } + next, err := skipStruct(dAtA[start:]) + if err != nil { + return 0, err + } + iNdEx = start + next + } + return iNdEx, nil + case 4: + return iNdEx, nil + case 5: + iNdEx += 4 + return iNdEx, nil + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + } + panic("unreachable") +} + +var ( + ErrInvalidLengthStruct = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowStruct = fmt.Errorf("proto: integer overflow") +) + +func init() { + proto.RegisterFile("google/protobuf/struct.proto", fileDescriptor_struct_7f9d36853146434f) +} + +var fileDescriptor_struct_7f9d36853146434f = []byte{ + // 439 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x91, 0xc1, 0x6b, 0xd4, 0x40, + 0x14, 0xc6, 0xf3, 0xb2, 0xdd, 0xe0, 0xbe, 0x48, 0x2d, 0x23, 0xe8, 0x52, 0x65, 0x5c, 0xb6, 0x97, + 0x45, 0x24, 0x85, 0xf5, 0x22, 0xae, 0x17, 0x17, 0x6a, 0x0b, 0x86, 0x12, 0xa3, 0xad, 0xe0, 0x65, + 0x31, 0x69, 0xba, 0x84, 0x4e, 0x67, 0x4a, 0x32, 0xa3, 0xec, 0x4d, 0xff, 0x0b, 0xcf, 0x9e, 0xc4, + 0xa3, 0x7f, 0x85, 0x47, 0x8f, 0x1e, 0xdd, 0x78, 0xf1, 0xd8, 0x63, 0x8f, 0x32, 0x33, 0x49, 0x94, + 0x2e, 0xbd, 0xe5, 0x7d, 0xf3, 0x7b, 0xdf, 0x7b, 0xdf, 0x0b, 0xde, 0x9d, 0x0b, 0x31, 0x67, 0xd9, + 0xf6, 0x59, 0x21, 0xa4, 0x48, 0xd4, 0xf1, 0x76, 0x29, 0x0b, 0x95, 0xca, 0xc0, 0xd4, 0xe4, 0x86, + 0x7d, 0x0d, 0x9a, 0xd7, 0xe1, 0x27, 0x40, 0xef, 0xa5, 0x21, 0xc8, 0x04, 0xbd, 0xe3, 0x3c, 0x63, + 0x47, 0x65, 0x1f, 0x06, 0x9d, 0x91, 0x3f, 0xde, 0x0a, 0x2e, 0xc1, 0x81, 0x05, 0x83, 0x67, 0x86, + 0xda, 0xe1, 0xb2, 0x58, 0xc4, 0x75, 0xcb, 0xe6, 0x0b, 0xf4, 0xff, 0x93, 0xc9, 0x06, 0x76, 0x4e, + 0xb2, 0x45, 0x1f, 0x06, 0x30, 0xea, 0xc5, 0xfa, 0x93, 0x3c, 0xc0, 0xee, 0xbb, 0xb7, 0x4c, 0x65, + 0x7d, 0x77, 0x00, 0x23, 0x7f, 0x7c, 0x6b, 0xc5, 0xfc, 0x50, 0xbf, 0xc6, 0x16, 0x7a, 0xec, 0x3e, + 0x82, 0xe1, 0x37, 0x17, 0xbb, 0x46, 0x24, 0x13, 0x44, 0xae, 0x18, 0x9b, 0x59, 0x03, 0x6d, 0xba, + 0x3e, 0xde, 0x5c, 0x31, 0xd8, 0x57, 0x8c, 0x19, 0x7e, 0xcf, 0x89, 0x7b, 0xbc, 0x29, 0xc8, 0x16, + 0x5e, 0xe7, 0xea, 0x34, 0xc9, 0x8a, 0xd9, 0xbf, 0xf9, 0xb0, 0xe7, 0xc4, 0xbe, 0x55, 0x5b, 0xa8, + 0x94, 0x45, 0xce, 0xe7, 0x35, 0xd4, 0xd1, 0x8b, 0x6b, 0xc8, 0xaa, 0x16, 0xba, 0x87, 0x98, 0x08, + 0xd1, 0xac, 0xb1, 0x36, 0x80, 0xd1, 0x35, 0x3d, 0x4a, 0x6b, 0x16, 0x78, 0x62, 0x5c, 0x54, 0x2a, + 0x6b, 0xa4, 0x6b, 0xa2, 0xde, 0xbe, 0xe2, 0x8e, 0xb5, 0xbd, 0x4a, 0x65, 0x9b, 0x92, 0xe5, 0x65, + 0xd3, 0xeb, 0x99, 0xde, 0xd5, 0x94, 0x61, 0x5e, 0xca, 0x36, 0x25, 0x6b, 0x8a, 0xa9, 0x87, 0x6b, + 0x27, 0x39, 0x3f, 0x1a, 0x4e, 0xb0, 0xd7, 0x12, 0x24, 0x40, 0xcf, 0x98, 0x35, 0x7f, 0xf4, 0xaa, + 0xa3, 0xd7, 0xd4, 0xfd, 0x3b, 0xd8, 0x6b, 0x8f, 0x48, 0xd6, 0x11, 0xf7, 0x0f, 0xc2, 0x70, 0x76, + 0xf8, 0x34, 0x3c, 0xd8, 0xd9, 0x70, 0xa6, 0x1f, 0xe1, 0xe7, 0x92, 0x3a, 0xe7, 0x4b, 0x0a, 0x17, + 0x4b, 0x0a, 0x1f, 0x2a, 0x0a, 0x5f, 0x2a, 0x0a, 0xdf, 0x2b, 0x0a, 0x3f, 0x2a, 0x0a, 0xbf, 0x2a, + 0x0a, 0x7f, 0x2a, 0xea, 0x9c, 0x6b, 0xed, 0x37, 0x05, 0xbc, 0x99, 0x8a, 0xd3, 0xcb, 0xe3, 0xa6, + 0xbe, 0x4d, 0x1e, 0xe9, 0x3a, 0x82, 0x37, 0x5d, 0xb9, 0x38, 0xcb, 0xca, 0x0b, 0x80, 0xcf, 0x6e, + 0x67, 0x37, 0x9a, 0x7e, 0x75, 0xe9, 0xae, 0x6d, 0x88, 0x9a, 0xfd, 0x5e, 0x67, 0x8c, 0x3d, 0xe7, + 0xe2, 0x3d, 0x7f, 0xa5, 0xc9, 0xc4, 0x33, 0x4e, 0x0f, 0xff, 0x06, 0x00, 0x00, 0xff, 0xff, 0xad, + 0x84, 0x08, 0xae, 0xe5, 0x02, 0x00, 0x00, +} diff --git a/vendor/github.com/gogo/protobuf/types/timestamp.go b/vendor/github.com/gogo/protobuf/types/timestamp.go new file mode 100644 index 000000000000..7ae54d8b3ff6 --- /dev/null +++ b/vendor/github.com/gogo/protobuf/types/timestamp.go @@ -0,0 +1,132 @@ +// Go support for Protocol Buffers - Google's data interchange format +// +// Copyright 2016 The Go Authors. All rights reserved. +// https://github.com/golang/protobuf +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +package types + +// This file implements operations on google.protobuf.Timestamp. + +import ( + "errors" + "fmt" + "time" +) + +const ( + // Seconds field of the earliest valid Timestamp. + // This is time.Date(1, 1, 1, 0, 0, 0, 0, time.UTC).Unix(). + minValidSeconds = -62135596800 + // Seconds field just after the latest valid Timestamp. + // This is time.Date(10000, 1, 1, 0, 0, 0, 0, time.UTC).Unix(). + maxValidSeconds = 253402300800 +) + +// validateTimestamp determines whether a Timestamp is valid. +// A valid timestamp represents a time in the range +// [0001-01-01, 10000-01-01) and has a Nanos field +// in the range [0, 1e9). +// +// If the Timestamp is valid, validateTimestamp returns nil. +// Otherwise, it returns an error that describes +// the problem. +// +// Every valid Timestamp can be represented by a time.Time, but the converse is not true. +func validateTimestamp(ts *Timestamp) error { + if ts == nil { + return errors.New("timestamp: nil Timestamp") + } + if ts.Seconds < minValidSeconds { + return fmt.Errorf("timestamp: %#v before 0001-01-01", ts) + } + if ts.Seconds >= maxValidSeconds { + return fmt.Errorf("timestamp: %#v after 10000-01-01", ts) + } + if ts.Nanos < 0 || ts.Nanos >= 1e9 { + return fmt.Errorf("timestamp: %#v: nanos not in range [0, 1e9)", ts) + } + return nil +} + +// TimestampFromProto converts a google.protobuf.Timestamp proto to a time.Time. +// It returns an error if the argument is invalid. +// +// Unlike most Go functions, if Timestamp returns an error, the first return value +// is not the zero time.Time. Instead, it is the value obtained from the +// time.Unix function when passed the contents of the Timestamp, in the UTC +// locale. This may or may not be a meaningful time; many invalid Timestamps +// do map to valid time.Times. +// +// A nil Timestamp returns an error. The first return value in that case is +// undefined. +func TimestampFromProto(ts *Timestamp) (time.Time, error) { + // Don't return the zero value on error, because corresponds to a valid + // timestamp. Instead return whatever time.Unix gives us. + var t time.Time + if ts == nil { + t = time.Unix(0, 0).UTC() // treat nil like the empty Timestamp + } else { + t = time.Unix(ts.Seconds, int64(ts.Nanos)).UTC() + } + return t, validateTimestamp(ts) +} + +// TimestampNow returns a google.protobuf.Timestamp for the current time. +func TimestampNow() *Timestamp { + ts, err := TimestampProto(time.Now()) + if err != nil { + panic("ptypes: time.Now() out of Timestamp range") + } + return ts +} + +// TimestampProto converts the time.Time to a google.protobuf.Timestamp proto. +// It returns an error if the resulting Timestamp is invalid. +func TimestampProto(t time.Time) (*Timestamp, error) { + seconds := t.Unix() + nanos := int32(t.Sub(time.Unix(seconds, 0))) + ts := &Timestamp{ + Seconds: seconds, + Nanos: nanos, + } + if err := validateTimestamp(ts); err != nil { + return nil, err + } + return ts, nil +} + +// TimestampString returns the RFC 3339 string for valid Timestamps. For invalid +// Timestamps, it returns an error message in parentheses. +func TimestampString(ts *Timestamp) string { + t, err := TimestampFromProto(ts) + if err != nil { + return fmt.Sprintf("(%v)", err) + } + return t.Format(time.RFC3339Nano) +} diff --git a/vendor/github.com/gogo/protobuf/types/timestamp.pb.go b/vendor/github.com/gogo/protobuf/types/timestamp.pb.go new file mode 100644 index 000000000000..b6c9100127d6 --- /dev/null +++ b/vendor/github.com/gogo/protobuf/types/timestamp.pb.go @@ -0,0 +1,555 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: google/protobuf/timestamp.proto + +package types + +import proto "github.com/gogo/protobuf/proto" +import fmt "fmt" +import math "math" + +import bytes "bytes" + +import strings "strings" +import reflect "reflect" + +import io "io" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package + +// A Timestamp represents a point in time independent of any time zone +// or calendar, represented as seconds and fractions of seconds at +// nanosecond resolution in UTC Epoch time. It is encoded using the +// Proleptic Gregorian Calendar which extends the Gregorian calendar +// backwards to year one. It is encoded assuming all minutes are 60 +// seconds long, i.e. leap seconds are "smeared" so that no leap second +// table is needed for interpretation. Range is from +// 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. +// By restricting to that range, we ensure that we can convert to +// and from RFC 3339 date strings. +// See [https://www.ietf.org/rfc/rfc3339.txt](https://www.ietf.org/rfc/rfc3339.txt). +// +// # Examples +// +// Example 1: Compute Timestamp from POSIX `time()`. +// +// Timestamp timestamp; +// timestamp.set_seconds(time(NULL)); +// timestamp.set_nanos(0); +// +// Example 2: Compute Timestamp from POSIX `gettimeofday()`. +// +// struct timeval tv; +// gettimeofday(&tv, NULL); +// +// Timestamp timestamp; +// timestamp.set_seconds(tv.tv_sec); +// timestamp.set_nanos(tv.tv_usec * 1000); +// +// Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. +// +// FILETIME ft; +// GetSystemTimeAsFileTime(&ft); +// UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; +// +// // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z +// // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. +// Timestamp timestamp; +// timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); +// timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); +// +// Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. +// +// long millis = System.currentTimeMillis(); +// +// Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) +// .setNanos((int) ((millis % 1000) * 1000000)).build(); +// +// +// Example 5: Compute Timestamp from current time in Python. +// +// timestamp = Timestamp() +// timestamp.GetCurrentTime() +// +// # JSON Mapping +// +// In JSON format, the Timestamp type is encoded as a string in the +// [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the +// format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" +// where {year} is always expressed using four digits while {month}, {day}, +// {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional +// seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution), +// are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone +// is required. A proto3 JSON serializer should always use UTC (as indicated by +// "Z") when printing the Timestamp type and a proto3 JSON parser should be +// able to accept both UTC and other timezones (as indicated by an offset). +// +// For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past +// 01:30 UTC on January 15, 2017. +// +// In JavaScript, one can convert a Date object to this format using the +// standard [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString] +// method. In Python, a standard `datetime.datetime` object can be converted +// to this format using [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) +// with the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one +// can use the Joda Time's [`ISODateTimeFormat.dateTime()`]( +// http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime-- +// ) to obtain a formatter capable of generating timestamps in this format. +// +// +type Timestamp struct { + // Represents seconds of UTC time since Unix epoch + // 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to + // 9999-12-31T23:59:59Z inclusive. + Seconds int64 `protobuf:"varint,1,opt,name=seconds,proto3" json:"seconds,omitempty"` + // Non-negative fractions of a second at nanosecond resolution. Negative + // second values with fractions must still have non-negative nanos values + // that count forward in time. Must be from 0 to 999,999,999 + // inclusive. + Nanos int32 `protobuf:"varint,2,opt,name=nanos,proto3" json:"nanos,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Timestamp) Reset() { *m = Timestamp{} } +func (*Timestamp) ProtoMessage() {} +func (*Timestamp) Descriptor() ([]byte, []int) { + return fileDescriptor_timestamp_820f61227bd8f1e8, []int{0} +} +func (*Timestamp) XXX_WellKnownType() string { return "Timestamp" } +func (m *Timestamp) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Timestamp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Timestamp.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *Timestamp) XXX_Merge(src proto.Message) { + xxx_messageInfo_Timestamp.Merge(dst, src) +} +func (m *Timestamp) XXX_Size() int { + return m.Size() +} +func (m *Timestamp) XXX_DiscardUnknown() { + xxx_messageInfo_Timestamp.DiscardUnknown(m) +} + +var xxx_messageInfo_Timestamp proto.InternalMessageInfo + +func (m *Timestamp) GetSeconds() int64 { + if m != nil { + return m.Seconds + } + return 0 +} + +func (m *Timestamp) GetNanos() int32 { + if m != nil { + return m.Nanos + } + return 0 +} + +func (*Timestamp) XXX_MessageName() string { + return "google.protobuf.Timestamp" +} +func init() { + proto.RegisterType((*Timestamp)(nil), "google.protobuf.Timestamp") +} +func (this *Timestamp) Compare(that interface{}) int { + if that == nil { + if this == nil { + return 0 + } + return 1 + } + + that1, ok := that.(*Timestamp) + if !ok { + that2, ok := that.(Timestamp) + if ok { + that1 = &that2 + } else { + return 1 + } + } + if that1 == nil { + if this == nil { + return 0 + } + return 1 + } else if this == nil { + return -1 + } + if this.Seconds != that1.Seconds { + if this.Seconds < that1.Seconds { + return -1 + } + return 1 + } + if this.Nanos != that1.Nanos { + if this.Nanos < that1.Nanos { + return -1 + } + return 1 + } + if c := bytes.Compare(this.XXX_unrecognized, that1.XXX_unrecognized); c != 0 { + return c + } + return 0 +} +func (this *Timestamp) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Timestamp) + if !ok { + that2, ok := that.(Timestamp) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Seconds != that1.Seconds { + return false + } + if this.Nanos != that1.Nanos { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *Timestamp) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 6) + s = append(s, "&types.Timestamp{") + s = append(s, "Seconds: "+fmt.Sprintf("%#v", this.Seconds)+",\n") + s = append(s, "Nanos: "+fmt.Sprintf("%#v", this.Nanos)+",\n") + if this.XXX_unrecognized != nil { + s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") + } + s = append(s, "}") + return strings.Join(s, "") +} +func valueToGoStringTimestamp(v interface{}, typ string) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv) +} +func (m *Timestamp) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Timestamp) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Seconds != 0 { + dAtA[i] = 0x8 + i++ + i = encodeVarintTimestamp(dAtA, i, uint64(m.Seconds)) + } + if m.Nanos != 0 { + dAtA[i] = 0x10 + i++ + i = encodeVarintTimestamp(dAtA, i, uint64(m.Nanos)) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func encodeVarintTimestamp(dAtA []byte, offset int, v uint64) int { + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return offset + 1 +} +func (m *Timestamp) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Seconds != 0 { + n += 1 + sovTimestamp(uint64(m.Seconds)) + } + if m.Nanos != 0 { + n += 1 + sovTimestamp(uint64(m.Nanos)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func sovTimestamp(x uint64) (n int) { + for { + n++ + x >>= 7 + if x == 0 { + break + } + } + return n +} +func sozTimestamp(x uint64) (n int) { + return sovTimestamp(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Timestamp) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTimestamp + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Timestamp: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Timestamp: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Seconds", wireType) + } + m.Seconds = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTimestamp + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Seconds |= (int64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Nanos", wireType) + } + m.Nanos = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTimestamp + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Nanos |= (int32(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipTimestamp(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTimestamp + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipTimestamp(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTimestamp + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTimestamp + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + return iNdEx, nil + case 1: + iNdEx += 8 + return iNdEx, nil + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTimestamp + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + iNdEx += length + if length < 0 { + return 0, ErrInvalidLengthTimestamp + } + return iNdEx, nil + case 3: + for { + var innerWire uint64 + var start int = iNdEx + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTimestamp + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + innerWire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + innerWireType := int(innerWire & 0x7) + if innerWireType == 4 { + break + } + next, err := skipTimestamp(dAtA[start:]) + if err != nil { + return 0, err + } + iNdEx = start + next + } + return iNdEx, nil + case 4: + return iNdEx, nil + case 5: + iNdEx += 4 + return iNdEx, nil + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + } + panic("unreachable") +} + +var ( + ErrInvalidLengthTimestamp = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTimestamp = fmt.Errorf("proto: integer overflow") +) + +func init() { + proto.RegisterFile("google/protobuf/timestamp.proto", fileDescriptor_timestamp_820f61227bd8f1e8) +} + +var fileDescriptor_timestamp_820f61227bd8f1e8 = []byte{ + // 212 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4f, 0xcf, 0xcf, 0x4f, + 0xcf, 0x49, 0xd5, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0x4f, 0x2a, 0x4d, 0xd3, 0x2f, 0xc9, 0xcc, 0x4d, + 0x2d, 0x2e, 0x49, 0xcc, 0x2d, 0xd0, 0x03, 0x0b, 0x09, 0xf1, 0x43, 0x14, 0xe8, 0xc1, 0x14, 0x28, + 0x59, 0x73, 0x71, 0x86, 0xc0, 0xd4, 0x08, 0x49, 0x70, 0xb1, 0x17, 0xa7, 0x26, 0xe7, 0xe7, 0xa5, + 0x14, 0x4b, 0x30, 0x2a, 0x30, 0x6a, 0x30, 0x07, 0xc1, 0xb8, 0x42, 0x22, 0x5c, 0xac, 0x79, 0x89, + 0x79, 0xf9, 0xc5, 0x12, 0x4c, 0x0a, 0x8c, 0x1a, 0xac, 0x41, 0x10, 0x8e, 0x53, 0x03, 0xe3, 0x8d, + 0x87, 0x72, 0x0c, 0x1f, 0x1e, 0xca, 0x31, 0xae, 0x78, 0x24, 0xc7, 0x78, 0xe2, 0x91, 0x1c, 0xe3, + 0x85, 0x47, 0x72, 0x8c, 0x0f, 0x1e, 0xc9, 0x31, 0xbe, 0x78, 0x24, 0xc7, 0xf0, 0xe1, 0x91, 0x1c, + 0xe3, 0x8a, 0xc7, 0x72, 0x8c, 0x27, 0x1e, 0xcb, 0x31, 0x72, 0x09, 0x27, 0xe7, 0xe7, 0xea, 0xa1, + 0x59, 0xee, 0xc4, 0x07, 0xb7, 0x3a, 0x00, 0x24, 0x14, 0xc0, 0x18, 0xc5, 0x5a, 0x52, 0x59, 0x90, + 0x5a, 0xfc, 0x83, 0x91, 0x71, 0x11, 0x13, 0xb3, 0x7b, 0x80, 0xd3, 0x2a, 0x26, 0x39, 0x77, 0x88, + 0x9e, 0x00, 0xa8, 0x1e, 0xbd, 0xf0, 0xd4, 0x9c, 0x1c, 0xef, 0xbc, 0xfc, 0xf2, 0xbc, 0x10, 0x90, + 0xca, 0x24, 0x36, 0xb0, 0x61, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0x0b, 0x23, 0x83, 0xdd, + 0xfa, 0x00, 0x00, 0x00, +} diff --git a/vendor/github.com/gogo/protobuf/types/timestamp_gogo.go b/vendor/github.com/gogo/protobuf/types/timestamp_gogo.go new file mode 100644 index 000000000000..e03fa1315830 --- /dev/null +++ b/vendor/github.com/gogo/protobuf/types/timestamp_gogo.go @@ -0,0 +1,94 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2016, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +package types + +import ( + "time" +) + +func NewPopulatedTimestamp(r interface { + Int63() int64 +}, easy bool) *Timestamp { + this := &Timestamp{} + ns := int64(r.Int63()) + this.Seconds = ns / 1e9 + this.Nanos = int32(ns % 1e9) + return this +} + +func (ts *Timestamp) String() string { + return TimestampString(ts) +} + +func NewPopulatedStdTime(r interface { + Int63() int64 +}, easy bool) *time.Time { + timestamp := NewPopulatedTimestamp(r, easy) + t, err := TimestampFromProto(timestamp) + if err != nil { + return nil + } + return &t +} + +func SizeOfStdTime(t time.Time) int { + ts, err := TimestampProto(t) + if err != nil { + return 0 + } + return ts.Size() +} + +func StdTimeMarshal(t time.Time) ([]byte, error) { + size := SizeOfStdTime(t) + buf := make([]byte, size) + _, err := StdTimeMarshalTo(t, buf) + return buf, err +} + +func StdTimeMarshalTo(t time.Time, data []byte) (int, error) { + ts, err := TimestampProto(t) + if err != nil { + return 0, err + } + return ts.MarshalTo(data) +} + +func StdTimeUnmarshal(t *time.Time, data []byte) error { + ts := &Timestamp{} + if err := ts.Unmarshal(data); err != nil { + return err + } + tt, err := TimestampFromProto(ts) + if err != nil { + return err + } + *t = tt + return nil +} diff --git a/vendor/github.com/gogo/protobuf/types/type.pb.go b/vendor/github.com/gogo/protobuf/types/type.pb.go new file mode 100644 index 000000000000..3f057646180f --- /dev/null +++ b/vendor/github.com/gogo/protobuf/types/type.pb.go @@ -0,0 +1,3243 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: google/protobuf/type.proto + +package types + +import proto "github.com/gogo/protobuf/proto" +import fmt "fmt" +import math "math" + +import bytes "bytes" + +import strconv "strconv" + +import strings "strings" +import reflect "reflect" + +import io "io" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package + +// The syntax in which a protocol buffer element is defined. +type Syntax int32 + +const ( + // Syntax `proto2`. + Syntax_SYNTAX_PROTO2 Syntax = 0 + // Syntax `proto3`. + Syntax_SYNTAX_PROTO3 Syntax = 1 +) + +var Syntax_name = map[int32]string{ + 0: "SYNTAX_PROTO2", + 1: "SYNTAX_PROTO3", +} +var Syntax_value = map[string]int32{ + "SYNTAX_PROTO2": 0, + "SYNTAX_PROTO3": 1, +} + +func (Syntax) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_type_0082d870c49329d7, []int{0} +} + +// Basic field types. +type Field_Kind int32 + +const ( + // Field type unknown. + Field_TYPE_UNKNOWN Field_Kind = 0 + // Field type double. + Field_TYPE_DOUBLE Field_Kind = 1 + // Field type float. + Field_TYPE_FLOAT Field_Kind = 2 + // Field type int64. + Field_TYPE_INT64 Field_Kind = 3 + // Field type uint64. + Field_TYPE_UINT64 Field_Kind = 4 + // Field type int32. + Field_TYPE_INT32 Field_Kind = 5 + // Field type fixed64. + Field_TYPE_FIXED64 Field_Kind = 6 + // Field type fixed32. + Field_TYPE_FIXED32 Field_Kind = 7 + // Field type bool. + Field_TYPE_BOOL Field_Kind = 8 + // Field type string. + Field_TYPE_STRING Field_Kind = 9 + // Field type group. Proto2 syntax only, and deprecated. + Field_TYPE_GROUP Field_Kind = 10 + // Field type message. + Field_TYPE_MESSAGE Field_Kind = 11 + // Field type bytes. + Field_TYPE_BYTES Field_Kind = 12 + // Field type uint32. + Field_TYPE_UINT32 Field_Kind = 13 + // Field type enum. + Field_TYPE_ENUM Field_Kind = 14 + // Field type sfixed32. + Field_TYPE_SFIXED32 Field_Kind = 15 + // Field type sfixed64. + Field_TYPE_SFIXED64 Field_Kind = 16 + // Field type sint32. + Field_TYPE_SINT32 Field_Kind = 17 + // Field type sint64. + Field_TYPE_SINT64 Field_Kind = 18 +) + +var Field_Kind_name = map[int32]string{ + 0: "TYPE_UNKNOWN", + 1: "TYPE_DOUBLE", + 2: "TYPE_FLOAT", + 3: "TYPE_INT64", + 4: "TYPE_UINT64", + 5: "TYPE_INT32", + 6: "TYPE_FIXED64", + 7: "TYPE_FIXED32", + 8: "TYPE_BOOL", + 9: "TYPE_STRING", + 10: "TYPE_GROUP", + 11: "TYPE_MESSAGE", + 12: "TYPE_BYTES", + 13: "TYPE_UINT32", + 14: "TYPE_ENUM", + 15: "TYPE_SFIXED32", + 16: "TYPE_SFIXED64", + 17: "TYPE_SINT32", + 18: "TYPE_SINT64", +} +var Field_Kind_value = map[string]int32{ + "TYPE_UNKNOWN": 0, + "TYPE_DOUBLE": 1, + "TYPE_FLOAT": 2, + "TYPE_INT64": 3, + "TYPE_UINT64": 4, + "TYPE_INT32": 5, + "TYPE_FIXED64": 6, + "TYPE_FIXED32": 7, + "TYPE_BOOL": 8, + "TYPE_STRING": 9, + "TYPE_GROUP": 10, + "TYPE_MESSAGE": 11, + "TYPE_BYTES": 12, + "TYPE_UINT32": 13, + "TYPE_ENUM": 14, + "TYPE_SFIXED32": 15, + "TYPE_SFIXED64": 16, + "TYPE_SINT32": 17, + "TYPE_SINT64": 18, +} + +func (Field_Kind) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_type_0082d870c49329d7, []int{1, 0} +} + +// Whether a field is optional, required, or repeated. +type Field_Cardinality int32 + +const ( + // For fields with unknown cardinality. + Field_CARDINALITY_UNKNOWN Field_Cardinality = 0 + // For optional fields. + Field_CARDINALITY_OPTIONAL Field_Cardinality = 1 + // For required fields. Proto2 syntax only. + Field_CARDINALITY_REQUIRED Field_Cardinality = 2 + // For repeated fields. + Field_CARDINALITY_REPEATED Field_Cardinality = 3 +) + +var Field_Cardinality_name = map[int32]string{ + 0: "CARDINALITY_UNKNOWN", + 1: "CARDINALITY_OPTIONAL", + 2: "CARDINALITY_REQUIRED", + 3: "CARDINALITY_REPEATED", +} +var Field_Cardinality_value = map[string]int32{ + "CARDINALITY_UNKNOWN": 0, + "CARDINALITY_OPTIONAL": 1, + "CARDINALITY_REQUIRED": 2, + "CARDINALITY_REPEATED": 3, +} + +func (Field_Cardinality) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_type_0082d870c49329d7, []int{1, 1} +} + +// A protocol buffer message type. +type Type struct { + // The fully qualified message name. + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // The list of fields. + Fields []*Field `protobuf:"bytes,2,rep,name=fields" json:"fields,omitempty"` + // The list of types appearing in `oneof` definitions in this type. + Oneofs []string `protobuf:"bytes,3,rep,name=oneofs" json:"oneofs,omitempty"` + // The protocol buffer options. + Options []*Option `protobuf:"bytes,4,rep,name=options" json:"options,omitempty"` + // The source context. + SourceContext *SourceContext `protobuf:"bytes,5,opt,name=source_context,json=sourceContext" json:"source_context,omitempty"` + // The source syntax. + Syntax Syntax `protobuf:"varint,6,opt,name=syntax,proto3,enum=google.protobuf.Syntax" json:"syntax,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Type) Reset() { *m = Type{} } +func (*Type) ProtoMessage() {} +func (*Type) Descriptor() ([]byte, []int) { + return fileDescriptor_type_0082d870c49329d7, []int{0} +} +func (m *Type) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Type) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Type.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *Type) XXX_Merge(src proto.Message) { + xxx_messageInfo_Type.Merge(dst, src) +} +func (m *Type) XXX_Size() int { + return m.Size() +} +func (m *Type) XXX_DiscardUnknown() { + xxx_messageInfo_Type.DiscardUnknown(m) +} + +var xxx_messageInfo_Type proto.InternalMessageInfo + +func (m *Type) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *Type) GetFields() []*Field { + if m != nil { + return m.Fields + } + return nil +} + +func (m *Type) GetOneofs() []string { + if m != nil { + return m.Oneofs + } + return nil +} + +func (m *Type) GetOptions() []*Option { + if m != nil { + return m.Options + } + return nil +} + +func (m *Type) GetSourceContext() *SourceContext { + if m != nil { + return m.SourceContext + } + return nil +} + +func (m *Type) GetSyntax() Syntax { + if m != nil { + return m.Syntax + } + return Syntax_SYNTAX_PROTO2 +} + +func (*Type) XXX_MessageName() string { + return "google.protobuf.Type" +} + +// A single field of a message type. +type Field struct { + // The field type. + Kind Field_Kind `protobuf:"varint,1,opt,name=kind,proto3,enum=google.protobuf.Field_Kind" json:"kind,omitempty"` + // The field cardinality. + Cardinality Field_Cardinality `protobuf:"varint,2,opt,name=cardinality,proto3,enum=google.protobuf.Field_Cardinality" json:"cardinality,omitempty"` + // The field number. + Number int32 `protobuf:"varint,3,opt,name=number,proto3" json:"number,omitempty"` + // The field name. + Name string `protobuf:"bytes,4,opt,name=name,proto3" json:"name,omitempty"` + // The field type URL, without the scheme, for message or enumeration + // types. Example: `"type.googleapis.com/google.protobuf.Timestamp"`. + TypeUrl string `protobuf:"bytes,6,opt,name=type_url,json=typeUrl,proto3" json:"type_url,omitempty"` + // The index of the field type in `Type.oneofs`, for message or enumeration + // types. The first type has index 1; zero means the type is not in the list. + OneofIndex int32 `protobuf:"varint,7,opt,name=oneof_index,json=oneofIndex,proto3" json:"oneof_index,omitempty"` + // Whether to use alternative packed wire representation. + Packed bool `protobuf:"varint,8,opt,name=packed,proto3" json:"packed,omitempty"` + // The protocol buffer options. + Options []*Option `protobuf:"bytes,9,rep,name=options" json:"options,omitempty"` + // The field JSON name. + JsonName string `protobuf:"bytes,10,opt,name=json_name,json=jsonName,proto3" json:"json_name,omitempty"` + // The string value of the default value of this field. Proto2 syntax only. + DefaultValue string `protobuf:"bytes,11,opt,name=default_value,json=defaultValue,proto3" json:"default_value,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Field) Reset() { *m = Field{} } +func (*Field) ProtoMessage() {} +func (*Field) Descriptor() ([]byte, []int) { + return fileDescriptor_type_0082d870c49329d7, []int{1} +} +func (m *Field) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Field) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Field.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *Field) XXX_Merge(src proto.Message) { + xxx_messageInfo_Field.Merge(dst, src) +} +func (m *Field) XXX_Size() int { + return m.Size() +} +func (m *Field) XXX_DiscardUnknown() { + xxx_messageInfo_Field.DiscardUnknown(m) +} + +var xxx_messageInfo_Field proto.InternalMessageInfo + +func (m *Field) GetKind() Field_Kind { + if m != nil { + return m.Kind + } + return Field_TYPE_UNKNOWN +} + +func (m *Field) GetCardinality() Field_Cardinality { + if m != nil { + return m.Cardinality + } + return Field_CARDINALITY_UNKNOWN +} + +func (m *Field) GetNumber() int32 { + if m != nil { + return m.Number + } + return 0 +} + +func (m *Field) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *Field) GetTypeUrl() string { + if m != nil { + return m.TypeUrl + } + return "" +} + +func (m *Field) GetOneofIndex() int32 { + if m != nil { + return m.OneofIndex + } + return 0 +} + +func (m *Field) GetPacked() bool { + if m != nil { + return m.Packed + } + return false +} + +func (m *Field) GetOptions() []*Option { + if m != nil { + return m.Options + } + return nil +} + +func (m *Field) GetJsonName() string { + if m != nil { + return m.JsonName + } + return "" +} + +func (m *Field) GetDefaultValue() string { + if m != nil { + return m.DefaultValue + } + return "" +} + +func (*Field) XXX_MessageName() string { + return "google.protobuf.Field" +} + +// Enum type definition. +type Enum struct { + // Enum type name. + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // Enum value definitions. + Enumvalue []*EnumValue `protobuf:"bytes,2,rep,name=enumvalue" json:"enumvalue,omitempty"` + // Protocol buffer options. + Options []*Option `protobuf:"bytes,3,rep,name=options" json:"options,omitempty"` + // The source context. + SourceContext *SourceContext `protobuf:"bytes,4,opt,name=source_context,json=sourceContext" json:"source_context,omitempty"` + // The source syntax. + Syntax Syntax `protobuf:"varint,5,opt,name=syntax,proto3,enum=google.protobuf.Syntax" json:"syntax,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Enum) Reset() { *m = Enum{} } +func (*Enum) ProtoMessage() {} +func (*Enum) Descriptor() ([]byte, []int) { + return fileDescriptor_type_0082d870c49329d7, []int{2} +} +func (m *Enum) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Enum) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Enum.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *Enum) XXX_Merge(src proto.Message) { + xxx_messageInfo_Enum.Merge(dst, src) +} +func (m *Enum) XXX_Size() int { + return m.Size() +} +func (m *Enum) XXX_DiscardUnknown() { + xxx_messageInfo_Enum.DiscardUnknown(m) +} + +var xxx_messageInfo_Enum proto.InternalMessageInfo + +func (m *Enum) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *Enum) GetEnumvalue() []*EnumValue { + if m != nil { + return m.Enumvalue + } + return nil +} + +func (m *Enum) GetOptions() []*Option { + if m != nil { + return m.Options + } + return nil +} + +func (m *Enum) GetSourceContext() *SourceContext { + if m != nil { + return m.SourceContext + } + return nil +} + +func (m *Enum) GetSyntax() Syntax { + if m != nil { + return m.Syntax + } + return Syntax_SYNTAX_PROTO2 +} + +func (*Enum) XXX_MessageName() string { + return "google.protobuf.Enum" +} + +// Enum value definition. +type EnumValue struct { + // Enum value name. + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // Enum value number. + Number int32 `protobuf:"varint,2,opt,name=number,proto3" json:"number,omitempty"` + // Protocol buffer options. + Options []*Option `protobuf:"bytes,3,rep,name=options" json:"options,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *EnumValue) Reset() { *m = EnumValue{} } +func (*EnumValue) ProtoMessage() {} +func (*EnumValue) Descriptor() ([]byte, []int) { + return fileDescriptor_type_0082d870c49329d7, []int{3} +} +func (m *EnumValue) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EnumValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EnumValue.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *EnumValue) XXX_Merge(src proto.Message) { + xxx_messageInfo_EnumValue.Merge(dst, src) +} +func (m *EnumValue) XXX_Size() int { + return m.Size() +} +func (m *EnumValue) XXX_DiscardUnknown() { + xxx_messageInfo_EnumValue.DiscardUnknown(m) +} + +var xxx_messageInfo_EnumValue proto.InternalMessageInfo + +func (m *EnumValue) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *EnumValue) GetNumber() int32 { + if m != nil { + return m.Number + } + return 0 +} + +func (m *EnumValue) GetOptions() []*Option { + if m != nil { + return m.Options + } + return nil +} + +func (*EnumValue) XXX_MessageName() string { + return "google.protobuf.EnumValue" +} + +// A protocol buffer option, which can be attached to a message, field, +// enumeration, etc. +type Option struct { + // The option's name. For protobuf built-in options (options defined in + // descriptor.proto), this is the short name. For example, `"map_entry"`. + // For custom options, it should be the fully-qualified name. For example, + // `"google.api.http"`. + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // The option's value packed in an Any message. If the value is a primitive, + // the corresponding wrapper type defined in google/protobuf/wrappers.proto + // should be used. If the value is an enum, it should be stored as an int32 + // value using the google.protobuf.Int32Value type. + Value *Any `protobuf:"bytes,2,opt,name=value" json:"value,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Option) Reset() { *m = Option{} } +func (*Option) ProtoMessage() {} +func (*Option) Descriptor() ([]byte, []int) { + return fileDescriptor_type_0082d870c49329d7, []int{4} +} +func (m *Option) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Option) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Option.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *Option) XXX_Merge(src proto.Message) { + xxx_messageInfo_Option.Merge(dst, src) +} +func (m *Option) XXX_Size() int { + return m.Size() +} +func (m *Option) XXX_DiscardUnknown() { + xxx_messageInfo_Option.DiscardUnknown(m) +} + +var xxx_messageInfo_Option proto.InternalMessageInfo + +func (m *Option) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *Option) GetValue() *Any { + if m != nil { + return m.Value + } + return nil +} + +func (*Option) XXX_MessageName() string { + return "google.protobuf.Option" +} +func init() { + proto.RegisterType((*Type)(nil), "google.protobuf.Type") + proto.RegisterType((*Field)(nil), "google.protobuf.Field") + proto.RegisterType((*Enum)(nil), "google.protobuf.Enum") + proto.RegisterType((*EnumValue)(nil), "google.protobuf.EnumValue") + proto.RegisterType((*Option)(nil), "google.protobuf.Option") + proto.RegisterEnum("google.protobuf.Syntax", Syntax_name, Syntax_value) + proto.RegisterEnum("google.protobuf.Field_Kind", Field_Kind_name, Field_Kind_value) + proto.RegisterEnum("google.protobuf.Field_Cardinality", Field_Cardinality_name, Field_Cardinality_value) +} +func (this *Type) Compare(that interface{}) int { + if that == nil { + if this == nil { + return 0 + } + return 1 + } + + that1, ok := that.(*Type) + if !ok { + that2, ok := that.(Type) + if ok { + that1 = &that2 + } else { + return 1 + } + } + if that1 == nil { + if this == nil { + return 0 + } + return 1 + } else if this == nil { + return -1 + } + if this.Name != that1.Name { + if this.Name < that1.Name { + return -1 + } + return 1 + } + if len(this.Fields) != len(that1.Fields) { + if len(this.Fields) < len(that1.Fields) { + return -1 + } + return 1 + } + for i := range this.Fields { + if c := this.Fields[i].Compare(that1.Fields[i]); c != 0 { + return c + } + } + if len(this.Oneofs) != len(that1.Oneofs) { + if len(this.Oneofs) < len(that1.Oneofs) { + return -1 + } + return 1 + } + for i := range this.Oneofs { + if this.Oneofs[i] != that1.Oneofs[i] { + if this.Oneofs[i] < that1.Oneofs[i] { + return -1 + } + return 1 + } + } + if len(this.Options) != len(that1.Options) { + if len(this.Options) < len(that1.Options) { + return -1 + } + return 1 + } + for i := range this.Options { + if c := this.Options[i].Compare(that1.Options[i]); c != 0 { + return c + } + } + if c := this.SourceContext.Compare(that1.SourceContext); c != 0 { + return c + } + if this.Syntax != that1.Syntax { + if this.Syntax < that1.Syntax { + return -1 + } + return 1 + } + if c := bytes.Compare(this.XXX_unrecognized, that1.XXX_unrecognized); c != 0 { + return c + } + return 0 +} +func (this *Field) Compare(that interface{}) int { + if that == nil { + if this == nil { + return 0 + } + return 1 + } + + that1, ok := that.(*Field) + if !ok { + that2, ok := that.(Field) + if ok { + that1 = &that2 + } else { + return 1 + } + } + if that1 == nil { + if this == nil { + return 0 + } + return 1 + } else if this == nil { + return -1 + } + if this.Kind != that1.Kind { + if this.Kind < that1.Kind { + return -1 + } + return 1 + } + if this.Cardinality != that1.Cardinality { + if this.Cardinality < that1.Cardinality { + return -1 + } + return 1 + } + if this.Number != that1.Number { + if this.Number < that1.Number { + return -1 + } + return 1 + } + if this.Name != that1.Name { + if this.Name < that1.Name { + return -1 + } + return 1 + } + if this.TypeUrl != that1.TypeUrl { + if this.TypeUrl < that1.TypeUrl { + return -1 + } + return 1 + } + if this.OneofIndex != that1.OneofIndex { + if this.OneofIndex < that1.OneofIndex { + return -1 + } + return 1 + } + if this.Packed != that1.Packed { + if !this.Packed { + return -1 + } + return 1 + } + if len(this.Options) != len(that1.Options) { + if len(this.Options) < len(that1.Options) { + return -1 + } + return 1 + } + for i := range this.Options { + if c := this.Options[i].Compare(that1.Options[i]); c != 0 { + return c + } + } + if this.JsonName != that1.JsonName { + if this.JsonName < that1.JsonName { + return -1 + } + return 1 + } + if this.DefaultValue != that1.DefaultValue { + if this.DefaultValue < that1.DefaultValue { + return -1 + } + return 1 + } + if c := bytes.Compare(this.XXX_unrecognized, that1.XXX_unrecognized); c != 0 { + return c + } + return 0 +} +func (this *Enum) Compare(that interface{}) int { + if that == nil { + if this == nil { + return 0 + } + return 1 + } + + that1, ok := that.(*Enum) + if !ok { + that2, ok := that.(Enum) + if ok { + that1 = &that2 + } else { + return 1 + } + } + if that1 == nil { + if this == nil { + return 0 + } + return 1 + } else if this == nil { + return -1 + } + if this.Name != that1.Name { + if this.Name < that1.Name { + return -1 + } + return 1 + } + if len(this.Enumvalue) != len(that1.Enumvalue) { + if len(this.Enumvalue) < len(that1.Enumvalue) { + return -1 + } + return 1 + } + for i := range this.Enumvalue { + if c := this.Enumvalue[i].Compare(that1.Enumvalue[i]); c != 0 { + return c + } + } + if len(this.Options) != len(that1.Options) { + if len(this.Options) < len(that1.Options) { + return -1 + } + return 1 + } + for i := range this.Options { + if c := this.Options[i].Compare(that1.Options[i]); c != 0 { + return c + } + } + if c := this.SourceContext.Compare(that1.SourceContext); c != 0 { + return c + } + if this.Syntax != that1.Syntax { + if this.Syntax < that1.Syntax { + return -1 + } + return 1 + } + if c := bytes.Compare(this.XXX_unrecognized, that1.XXX_unrecognized); c != 0 { + return c + } + return 0 +} +func (this *EnumValue) Compare(that interface{}) int { + if that == nil { + if this == nil { + return 0 + } + return 1 + } + + that1, ok := that.(*EnumValue) + if !ok { + that2, ok := that.(EnumValue) + if ok { + that1 = &that2 + } else { + return 1 + } + } + if that1 == nil { + if this == nil { + return 0 + } + return 1 + } else if this == nil { + return -1 + } + if this.Name != that1.Name { + if this.Name < that1.Name { + return -1 + } + return 1 + } + if this.Number != that1.Number { + if this.Number < that1.Number { + return -1 + } + return 1 + } + if len(this.Options) != len(that1.Options) { + if len(this.Options) < len(that1.Options) { + return -1 + } + return 1 + } + for i := range this.Options { + if c := this.Options[i].Compare(that1.Options[i]); c != 0 { + return c + } + } + if c := bytes.Compare(this.XXX_unrecognized, that1.XXX_unrecognized); c != 0 { + return c + } + return 0 +} +func (this *Option) Compare(that interface{}) int { + if that == nil { + if this == nil { + return 0 + } + return 1 + } + + that1, ok := that.(*Option) + if !ok { + that2, ok := that.(Option) + if ok { + that1 = &that2 + } else { + return 1 + } + } + if that1 == nil { + if this == nil { + return 0 + } + return 1 + } else if this == nil { + return -1 + } + if this.Name != that1.Name { + if this.Name < that1.Name { + return -1 + } + return 1 + } + if c := this.Value.Compare(that1.Value); c != 0 { + return c + } + if c := bytes.Compare(this.XXX_unrecognized, that1.XXX_unrecognized); c != 0 { + return c + } + return 0 +} +func (x Syntax) String() string { + s, ok := Syntax_name[int32(x)] + if ok { + return s + } + return strconv.Itoa(int(x)) +} +func (x Field_Kind) String() string { + s, ok := Field_Kind_name[int32(x)] + if ok { + return s + } + return strconv.Itoa(int(x)) +} +func (x Field_Cardinality) String() string { + s, ok := Field_Cardinality_name[int32(x)] + if ok { + return s + } + return strconv.Itoa(int(x)) +} +func (this *Type) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Type) + if !ok { + that2, ok := that.(Type) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Name != that1.Name { + return false + } + if len(this.Fields) != len(that1.Fields) { + return false + } + for i := range this.Fields { + if !this.Fields[i].Equal(that1.Fields[i]) { + return false + } + } + if len(this.Oneofs) != len(that1.Oneofs) { + return false + } + for i := range this.Oneofs { + if this.Oneofs[i] != that1.Oneofs[i] { + return false + } + } + if len(this.Options) != len(that1.Options) { + return false + } + for i := range this.Options { + if !this.Options[i].Equal(that1.Options[i]) { + return false + } + } + if !this.SourceContext.Equal(that1.SourceContext) { + return false + } + if this.Syntax != that1.Syntax { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *Field) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Field) + if !ok { + that2, ok := that.(Field) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Kind != that1.Kind { + return false + } + if this.Cardinality != that1.Cardinality { + return false + } + if this.Number != that1.Number { + return false + } + if this.Name != that1.Name { + return false + } + if this.TypeUrl != that1.TypeUrl { + return false + } + if this.OneofIndex != that1.OneofIndex { + return false + } + if this.Packed != that1.Packed { + return false + } + if len(this.Options) != len(that1.Options) { + return false + } + for i := range this.Options { + if !this.Options[i].Equal(that1.Options[i]) { + return false + } + } + if this.JsonName != that1.JsonName { + return false + } + if this.DefaultValue != that1.DefaultValue { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *Enum) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Enum) + if !ok { + that2, ok := that.(Enum) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Name != that1.Name { + return false + } + if len(this.Enumvalue) != len(that1.Enumvalue) { + return false + } + for i := range this.Enumvalue { + if !this.Enumvalue[i].Equal(that1.Enumvalue[i]) { + return false + } + } + if len(this.Options) != len(that1.Options) { + return false + } + for i := range this.Options { + if !this.Options[i].Equal(that1.Options[i]) { + return false + } + } + if !this.SourceContext.Equal(that1.SourceContext) { + return false + } + if this.Syntax != that1.Syntax { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *EnumValue) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*EnumValue) + if !ok { + that2, ok := that.(EnumValue) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Name != that1.Name { + return false + } + if this.Number != that1.Number { + return false + } + if len(this.Options) != len(that1.Options) { + return false + } + for i := range this.Options { + if !this.Options[i].Equal(that1.Options[i]) { + return false + } + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *Option) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Option) + if !ok { + that2, ok := that.(Option) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Name != that1.Name { + return false + } + if !this.Value.Equal(that1.Value) { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *Type) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 10) + s = append(s, "&types.Type{") + s = append(s, "Name: "+fmt.Sprintf("%#v", this.Name)+",\n") + if this.Fields != nil { + s = append(s, "Fields: "+fmt.Sprintf("%#v", this.Fields)+",\n") + } + s = append(s, "Oneofs: "+fmt.Sprintf("%#v", this.Oneofs)+",\n") + if this.Options != nil { + s = append(s, "Options: "+fmt.Sprintf("%#v", this.Options)+",\n") + } + if this.SourceContext != nil { + s = append(s, "SourceContext: "+fmt.Sprintf("%#v", this.SourceContext)+",\n") + } + s = append(s, "Syntax: "+fmt.Sprintf("%#v", this.Syntax)+",\n") + if this.XXX_unrecognized != nil { + s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") + } + s = append(s, "}") + return strings.Join(s, "") +} +func (this *Field) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 14) + s = append(s, "&types.Field{") + s = append(s, "Kind: "+fmt.Sprintf("%#v", this.Kind)+",\n") + s = append(s, "Cardinality: "+fmt.Sprintf("%#v", this.Cardinality)+",\n") + s = append(s, "Number: "+fmt.Sprintf("%#v", this.Number)+",\n") + s = append(s, "Name: "+fmt.Sprintf("%#v", this.Name)+",\n") + s = append(s, "TypeUrl: "+fmt.Sprintf("%#v", this.TypeUrl)+",\n") + s = append(s, "OneofIndex: "+fmt.Sprintf("%#v", this.OneofIndex)+",\n") + s = append(s, "Packed: "+fmt.Sprintf("%#v", this.Packed)+",\n") + if this.Options != nil { + s = append(s, "Options: "+fmt.Sprintf("%#v", this.Options)+",\n") + } + s = append(s, "JsonName: "+fmt.Sprintf("%#v", this.JsonName)+",\n") + s = append(s, "DefaultValue: "+fmt.Sprintf("%#v", this.DefaultValue)+",\n") + if this.XXX_unrecognized != nil { + s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") + } + s = append(s, "}") + return strings.Join(s, "") +} +func (this *Enum) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 9) + s = append(s, "&types.Enum{") + s = append(s, "Name: "+fmt.Sprintf("%#v", this.Name)+",\n") + if this.Enumvalue != nil { + s = append(s, "Enumvalue: "+fmt.Sprintf("%#v", this.Enumvalue)+",\n") + } + if this.Options != nil { + s = append(s, "Options: "+fmt.Sprintf("%#v", this.Options)+",\n") + } + if this.SourceContext != nil { + s = append(s, "SourceContext: "+fmt.Sprintf("%#v", this.SourceContext)+",\n") + } + s = append(s, "Syntax: "+fmt.Sprintf("%#v", this.Syntax)+",\n") + if this.XXX_unrecognized != nil { + s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") + } + s = append(s, "}") + return strings.Join(s, "") +} +func (this *EnumValue) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 7) + s = append(s, "&types.EnumValue{") + s = append(s, "Name: "+fmt.Sprintf("%#v", this.Name)+",\n") + s = append(s, "Number: "+fmt.Sprintf("%#v", this.Number)+",\n") + if this.Options != nil { + s = append(s, "Options: "+fmt.Sprintf("%#v", this.Options)+",\n") + } + if this.XXX_unrecognized != nil { + s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") + } + s = append(s, "}") + return strings.Join(s, "") +} +func (this *Option) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 6) + s = append(s, "&types.Option{") + s = append(s, "Name: "+fmt.Sprintf("%#v", this.Name)+",\n") + if this.Value != nil { + s = append(s, "Value: "+fmt.Sprintf("%#v", this.Value)+",\n") + } + if this.XXX_unrecognized != nil { + s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") + } + s = append(s, "}") + return strings.Join(s, "") +} +func valueToGoStringType(v interface{}, typ string) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv) +} +func (m *Type) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Type) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Name) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintType(dAtA, i, uint64(len(m.Name))) + i += copy(dAtA[i:], m.Name) + } + if len(m.Fields) > 0 { + for _, msg := range m.Fields { + dAtA[i] = 0x12 + i++ + i = encodeVarintType(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if len(m.Oneofs) > 0 { + for _, s := range m.Oneofs { + dAtA[i] = 0x1a + i++ + l = len(s) + for l >= 1<<7 { + dAtA[i] = uint8(uint64(l)&0x7f | 0x80) + l >>= 7 + i++ + } + dAtA[i] = uint8(l) + i++ + i += copy(dAtA[i:], s) + } + } + if len(m.Options) > 0 { + for _, msg := range m.Options { + dAtA[i] = 0x22 + i++ + i = encodeVarintType(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if m.SourceContext != nil { + dAtA[i] = 0x2a + i++ + i = encodeVarintType(dAtA, i, uint64(m.SourceContext.Size())) + n1, err := m.SourceContext.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n1 + } + if m.Syntax != 0 { + dAtA[i] = 0x30 + i++ + i = encodeVarintType(dAtA, i, uint64(m.Syntax)) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *Field) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Field) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Kind != 0 { + dAtA[i] = 0x8 + i++ + i = encodeVarintType(dAtA, i, uint64(m.Kind)) + } + if m.Cardinality != 0 { + dAtA[i] = 0x10 + i++ + i = encodeVarintType(dAtA, i, uint64(m.Cardinality)) + } + if m.Number != 0 { + dAtA[i] = 0x18 + i++ + i = encodeVarintType(dAtA, i, uint64(m.Number)) + } + if len(m.Name) > 0 { + dAtA[i] = 0x22 + i++ + i = encodeVarintType(dAtA, i, uint64(len(m.Name))) + i += copy(dAtA[i:], m.Name) + } + if len(m.TypeUrl) > 0 { + dAtA[i] = 0x32 + i++ + i = encodeVarintType(dAtA, i, uint64(len(m.TypeUrl))) + i += copy(dAtA[i:], m.TypeUrl) + } + if m.OneofIndex != 0 { + dAtA[i] = 0x38 + i++ + i = encodeVarintType(dAtA, i, uint64(m.OneofIndex)) + } + if m.Packed { + dAtA[i] = 0x40 + i++ + if m.Packed { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i++ + } + if len(m.Options) > 0 { + for _, msg := range m.Options { + dAtA[i] = 0x4a + i++ + i = encodeVarintType(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if len(m.JsonName) > 0 { + dAtA[i] = 0x52 + i++ + i = encodeVarintType(dAtA, i, uint64(len(m.JsonName))) + i += copy(dAtA[i:], m.JsonName) + } + if len(m.DefaultValue) > 0 { + dAtA[i] = 0x5a + i++ + i = encodeVarintType(dAtA, i, uint64(len(m.DefaultValue))) + i += copy(dAtA[i:], m.DefaultValue) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *Enum) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Enum) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Name) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintType(dAtA, i, uint64(len(m.Name))) + i += copy(dAtA[i:], m.Name) + } + if len(m.Enumvalue) > 0 { + for _, msg := range m.Enumvalue { + dAtA[i] = 0x12 + i++ + i = encodeVarintType(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if len(m.Options) > 0 { + for _, msg := range m.Options { + dAtA[i] = 0x1a + i++ + i = encodeVarintType(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if m.SourceContext != nil { + dAtA[i] = 0x22 + i++ + i = encodeVarintType(dAtA, i, uint64(m.SourceContext.Size())) + n2, err := m.SourceContext.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n2 + } + if m.Syntax != 0 { + dAtA[i] = 0x28 + i++ + i = encodeVarintType(dAtA, i, uint64(m.Syntax)) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *EnumValue) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *EnumValue) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Name) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintType(dAtA, i, uint64(len(m.Name))) + i += copy(dAtA[i:], m.Name) + } + if m.Number != 0 { + dAtA[i] = 0x10 + i++ + i = encodeVarintType(dAtA, i, uint64(m.Number)) + } + if len(m.Options) > 0 { + for _, msg := range m.Options { + dAtA[i] = 0x1a + i++ + i = encodeVarintType(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *Option) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Option) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Name) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintType(dAtA, i, uint64(len(m.Name))) + i += copy(dAtA[i:], m.Name) + } + if m.Value != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintType(dAtA, i, uint64(m.Value.Size())) + n3, err := m.Value.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n3 + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func encodeVarintType(dAtA []byte, offset int, v uint64) int { + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return offset + 1 +} +func NewPopulatedType(r randyType, easy bool) *Type { + this := &Type{} + this.Name = string(randStringType(r)) + if r.Intn(10) != 0 { + v1 := r.Intn(5) + this.Fields = make([]*Field, v1) + for i := 0; i < v1; i++ { + this.Fields[i] = NewPopulatedField(r, easy) + } + } + v2 := r.Intn(10) + this.Oneofs = make([]string, v2) + for i := 0; i < v2; i++ { + this.Oneofs[i] = string(randStringType(r)) + } + if r.Intn(10) != 0 { + v3 := r.Intn(5) + this.Options = make([]*Option, v3) + for i := 0; i < v3; i++ { + this.Options[i] = NewPopulatedOption(r, easy) + } + } + if r.Intn(10) != 0 { + this.SourceContext = NewPopulatedSourceContext(r, easy) + } + this.Syntax = Syntax([]int32{0, 1}[r.Intn(2)]) + if !easy && r.Intn(10) != 0 { + this.XXX_unrecognized = randUnrecognizedType(r, 7) + } + return this +} + +func NewPopulatedField(r randyType, easy bool) *Field { + this := &Field{} + this.Kind = Field_Kind([]int32{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18}[r.Intn(19)]) + this.Cardinality = Field_Cardinality([]int32{0, 1, 2, 3}[r.Intn(4)]) + this.Number = int32(r.Int31()) + if r.Intn(2) == 0 { + this.Number *= -1 + } + this.Name = string(randStringType(r)) + this.TypeUrl = string(randStringType(r)) + this.OneofIndex = int32(r.Int31()) + if r.Intn(2) == 0 { + this.OneofIndex *= -1 + } + this.Packed = bool(bool(r.Intn(2) == 0)) + if r.Intn(10) != 0 { + v4 := r.Intn(5) + this.Options = make([]*Option, v4) + for i := 0; i < v4; i++ { + this.Options[i] = NewPopulatedOption(r, easy) + } + } + this.JsonName = string(randStringType(r)) + this.DefaultValue = string(randStringType(r)) + if !easy && r.Intn(10) != 0 { + this.XXX_unrecognized = randUnrecognizedType(r, 12) + } + return this +} + +func NewPopulatedEnum(r randyType, easy bool) *Enum { + this := &Enum{} + this.Name = string(randStringType(r)) + if r.Intn(10) != 0 { + v5 := r.Intn(5) + this.Enumvalue = make([]*EnumValue, v5) + for i := 0; i < v5; i++ { + this.Enumvalue[i] = NewPopulatedEnumValue(r, easy) + } + } + if r.Intn(10) != 0 { + v6 := r.Intn(5) + this.Options = make([]*Option, v6) + for i := 0; i < v6; i++ { + this.Options[i] = NewPopulatedOption(r, easy) + } + } + if r.Intn(10) != 0 { + this.SourceContext = NewPopulatedSourceContext(r, easy) + } + this.Syntax = Syntax([]int32{0, 1}[r.Intn(2)]) + if !easy && r.Intn(10) != 0 { + this.XXX_unrecognized = randUnrecognizedType(r, 6) + } + return this +} + +func NewPopulatedEnumValue(r randyType, easy bool) *EnumValue { + this := &EnumValue{} + this.Name = string(randStringType(r)) + this.Number = int32(r.Int31()) + if r.Intn(2) == 0 { + this.Number *= -1 + } + if r.Intn(10) != 0 { + v7 := r.Intn(5) + this.Options = make([]*Option, v7) + for i := 0; i < v7; i++ { + this.Options[i] = NewPopulatedOption(r, easy) + } + } + if !easy && r.Intn(10) != 0 { + this.XXX_unrecognized = randUnrecognizedType(r, 4) + } + return this +} + +func NewPopulatedOption(r randyType, easy bool) *Option { + this := &Option{} + this.Name = string(randStringType(r)) + if r.Intn(10) != 0 { + this.Value = NewPopulatedAny(r, easy) + } + if !easy && r.Intn(10) != 0 { + this.XXX_unrecognized = randUnrecognizedType(r, 3) + } + return this +} + +type randyType interface { + Float32() float32 + Float64() float64 + Int63() int64 + Int31() int32 + Uint32() uint32 + Intn(n int) int +} + +func randUTF8RuneType(r randyType) rune { + ru := r.Intn(62) + if ru < 10 { + return rune(ru + 48) + } else if ru < 36 { + return rune(ru + 55) + } + return rune(ru + 61) +} +func randStringType(r randyType) string { + v8 := r.Intn(100) + tmps := make([]rune, v8) + for i := 0; i < v8; i++ { + tmps[i] = randUTF8RuneType(r) + } + return string(tmps) +} +func randUnrecognizedType(r randyType, maxFieldNumber int) (dAtA []byte) { + l := r.Intn(5) + for i := 0; i < l; i++ { + wire := r.Intn(4) + if wire == 3 { + wire = 5 + } + fieldNumber := maxFieldNumber + r.Intn(100) + dAtA = randFieldType(dAtA, r, fieldNumber, wire) + } + return dAtA +} +func randFieldType(dAtA []byte, r randyType, fieldNumber int, wire int) []byte { + key := uint32(fieldNumber)<<3 | uint32(wire) + switch wire { + case 0: + dAtA = encodeVarintPopulateType(dAtA, uint64(key)) + v9 := r.Int63() + if r.Intn(2) == 0 { + v9 *= -1 + } + dAtA = encodeVarintPopulateType(dAtA, uint64(v9)) + case 1: + dAtA = encodeVarintPopulateType(dAtA, uint64(key)) + dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256))) + case 2: + dAtA = encodeVarintPopulateType(dAtA, uint64(key)) + ll := r.Intn(100) + dAtA = encodeVarintPopulateType(dAtA, uint64(ll)) + for j := 0; j < ll; j++ { + dAtA = append(dAtA, byte(r.Intn(256))) + } + default: + dAtA = encodeVarintPopulateType(dAtA, uint64(key)) + dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256))) + } + return dAtA +} +func encodeVarintPopulateType(dAtA []byte, v uint64) []byte { + for v >= 1<<7 { + dAtA = append(dAtA, uint8(uint64(v)&0x7f|0x80)) + v >>= 7 + } + dAtA = append(dAtA, uint8(v)) + return dAtA +} +func (m *Type) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Name) + if l > 0 { + n += 1 + l + sovType(uint64(l)) + } + if len(m.Fields) > 0 { + for _, e := range m.Fields { + l = e.Size() + n += 1 + l + sovType(uint64(l)) + } + } + if len(m.Oneofs) > 0 { + for _, s := range m.Oneofs { + l = len(s) + n += 1 + l + sovType(uint64(l)) + } + } + if len(m.Options) > 0 { + for _, e := range m.Options { + l = e.Size() + n += 1 + l + sovType(uint64(l)) + } + } + if m.SourceContext != nil { + l = m.SourceContext.Size() + n += 1 + l + sovType(uint64(l)) + } + if m.Syntax != 0 { + n += 1 + sovType(uint64(m.Syntax)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *Field) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Kind != 0 { + n += 1 + sovType(uint64(m.Kind)) + } + if m.Cardinality != 0 { + n += 1 + sovType(uint64(m.Cardinality)) + } + if m.Number != 0 { + n += 1 + sovType(uint64(m.Number)) + } + l = len(m.Name) + if l > 0 { + n += 1 + l + sovType(uint64(l)) + } + l = len(m.TypeUrl) + if l > 0 { + n += 1 + l + sovType(uint64(l)) + } + if m.OneofIndex != 0 { + n += 1 + sovType(uint64(m.OneofIndex)) + } + if m.Packed { + n += 2 + } + if len(m.Options) > 0 { + for _, e := range m.Options { + l = e.Size() + n += 1 + l + sovType(uint64(l)) + } + } + l = len(m.JsonName) + if l > 0 { + n += 1 + l + sovType(uint64(l)) + } + l = len(m.DefaultValue) + if l > 0 { + n += 1 + l + sovType(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *Enum) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Name) + if l > 0 { + n += 1 + l + sovType(uint64(l)) + } + if len(m.Enumvalue) > 0 { + for _, e := range m.Enumvalue { + l = e.Size() + n += 1 + l + sovType(uint64(l)) + } + } + if len(m.Options) > 0 { + for _, e := range m.Options { + l = e.Size() + n += 1 + l + sovType(uint64(l)) + } + } + if m.SourceContext != nil { + l = m.SourceContext.Size() + n += 1 + l + sovType(uint64(l)) + } + if m.Syntax != 0 { + n += 1 + sovType(uint64(m.Syntax)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *EnumValue) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Name) + if l > 0 { + n += 1 + l + sovType(uint64(l)) + } + if m.Number != 0 { + n += 1 + sovType(uint64(m.Number)) + } + if len(m.Options) > 0 { + for _, e := range m.Options { + l = e.Size() + n += 1 + l + sovType(uint64(l)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *Option) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Name) + if l > 0 { + n += 1 + l + sovType(uint64(l)) + } + if m.Value != nil { + l = m.Value.Size() + n += 1 + l + sovType(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func sovType(x uint64) (n int) { + for { + n++ + x >>= 7 + if x == 0 { + break + } + } + return n +} +func sozType(x uint64) (n int) { + return sovType(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (this *Type) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&Type{`, + `Name:` + fmt.Sprintf("%v", this.Name) + `,`, + `Fields:` + strings.Replace(fmt.Sprintf("%v", this.Fields), "Field", "Field", 1) + `,`, + `Oneofs:` + fmt.Sprintf("%v", this.Oneofs) + `,`, + `Options:` + strings.Replace(fmt.Sprintf("%v", this.Options), "Option", "Option", 1) + `,`, + `SourceContext:` + strings.Replace(fmt.Sprintf("%v", this.SourceContext), "SourceContext", "SourceContext", 1) + `,`, + `Syntax:` + fmt.Sprintf("%v", this.Syntax) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *Field) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&Field{`, + `Kind:` + fmt.Sprintf("%v", this.Kind) + `,`, + `Cardinality:` + fmt.Sprintf("%v", this.Cardinality) + `,`, + `Number:` + fmt.Sprintf("%v", this.Number) + `,`, + `Name:` + fmt.Sprintf("%v", this.Name) + `,`, + `TypeUrl:` + fmt.Sprintf("%v", this.TypeUrl) + `,`, + `OneofIndex:` + fmt.Sprintf("%v", this.OneofIndex) + `,`, + `Packed:` + fmt.Sprintf("%v", this.Packed) + `,`, + `Options:` + strings.Replace(fmt.Sprintf("%v", this.Options), "Option", "Option", 1) + `,`, + `JsonName:` + fmt.Sprintf("%v", this.JsonName) + `,`, + `DefaultValue:` + fmt.Sprintf("%v", this.DefaultValue) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *Enum) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&Enum{`, + `Name:` + fmt.Sprintf("%v", this.Name) + `,`, + `Enumvalue:` + strings.Replace(fmt.Sprintf("%v", this.Enumvalue), "EnumValue", "EnumValue", 1) + `,`, + `Options:` + strings.Replace(fmt.Sprintf("%v", this.Options), "Option", "Option", 1) + `,`, + `SourceContext:` + strings.Replace(fmt.Sprintf("%v", this.SourceContext), "SourceContext", "SourceContext", 1) + `,`, + `Syntax:` + fmt.Sprintf("%v", this.Syntax) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *EnumValue) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&EnumValue{`, + `Name:` + fmt.Sprintf("%v", this.Name) + `,`, + `Number:` + fmt.Sprintf("%v", this.Number) + `,`, + `Options:` + strings.Replace(fmt.Sprintf("%v", this.Options), "Option", "Option", 1) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *Option) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&Option{`, + `Name:` + fmt.Sprintf("%v", this.Name) + `,`, + `Value:` + strings.Replace(fmt.Sprintf("%v", this.Value), "Any", "Any", 1) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func valueToStringType(v interface{}) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("*%v", pv) +} +func (m *Type) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowType + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Type: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Type: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowType + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthType + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Fields", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowType + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthType + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Fields = append(m.Fields, &Field{}) + if err := m.Fields[len(m.Fields)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Oneofs", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowType + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthType + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Oneofs = append(m.Oneofs, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Options", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowType + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthType + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Options = append(m.Options, &Option{}) + if err := m.Options[len(m.Options)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SourceContext", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowType + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthType + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.SourceContext == nil { + m.SourceContext = &SourceContext{} + } + if err := m.SourceContext.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Syntax", wireType) + } + m.Syntax = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowType + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Syntax |= (Syntax(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipType(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthType + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Field) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowType + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Field: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Field: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Kind", wireType) + } + m.Kind = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowType + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Kind |= (Field_Kind(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Cardinality", wireType) + } + m.Cardinality = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowType + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Cardinality |= (Field_Cardinality(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Number", wireType) + } + m.Number = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowType + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Number |= (int32(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowType + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthType + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TypeUrl", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowType + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthType + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TypeUrl = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 7: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field OneofIndex", wireType) + } + m.OneofIndex = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowType + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.OneofIndex |= (int32(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 8: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Packed", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowType + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.Packed = bool(v != 0) + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Options", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowType + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthType + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Options = append(m.Options, &Option{}) + if err := m.Options[len(m.Options)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 10: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field JsonName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowType + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthType + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.JsonName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 11: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DefaultValue", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowType + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthType + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DefaultValue = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipType(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthType + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Enum) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowType + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Enum: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Enum: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowType + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthType + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Enumvalue", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowType + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthType + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Enumvalue = append(m.Enumvalue, &EnumValue{}) + if err := m.Enumvalue[len(m.Enumvalue)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Options", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowType + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthType + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Options = append(m.Options, &Option{}) + if err := m.Options[len(m.Options)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SourceContext", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowType + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthType + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.SourceContext == nil { + m.SourceContext = &SourceContext{} + } + if err := m.SourceContext.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Syntax", wireType) + } + m.Syntax = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowType + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Syntax |= (Syntax(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipType(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthType + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *EnumValue) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowType + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: EnumValue: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EnumValue: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowType + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthType + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Number", wireType) + } + m.Number = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowType + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Number |= (int32(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Options", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowType + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthType + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Options = append(m.Options, &Option{}) + if err := m.Options[len(m.Options)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipType(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthType + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Option) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowType + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Option: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Option: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowType + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthType + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowType + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthType + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Value == nil { + m.Value = &Any{} + } + if err := m.Value.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipType(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthType + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipType(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowType + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowType + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + return iNdEx, nil + case 1: + iNdEx += 8 + return iNdEx, nil + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowType + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + iNdEx += length + if length < 0 { + return 0, ErrInvalidLengthType + } + return iNdEx, nil + case 3: + for { + var innerWire uint64 + var start int = iNdEx + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowType + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + innerWire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + innerWireType := int(innerWire & 0x7) + if innerWireType == 4 { + break + } + next, err := skipType(dAtA[start:]) + if err != nil { + return 0, err + } + iNdEx = start + next + } + return iNdEx, nil + case 4: + return iNdEx, nil + case 5: + iNdEx += 4 + return iNdEx, nil + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + } + panic("unreachable") +} + +var ( + ErrInvalidLengthType = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowType = fmt.Errorf("proto: integer overflow") +) + +func init() { proto.RegisterFile("google/protobuf/type.proto", fileDescriptor_type_0082d870c49329d7) } + +var fileDescriptor_type_0082d870c49329d7 = []byte{ + // 840 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x55, 0xcf, 0x73, 0xda, 0x46, + 0x14, 0xf6, 0x0a, 0x21, 0xa3, 0x87, 0xc1, 0x9b, 0x4d, 0x26, 0x51, 0x9c, 0x19, 0x95, 0xa1, 0x3d, + 0x30, 0x39, 0xe0, 0x29, 0x78, 0x3c, 0xbd, 0x82, 0x91, 0x29, 0x63, 0x22, 0xa9, 0x8b, 0x68, 0xe2, + 0x5e, 0x18, 0x0c, 0x72, 0x86, 0x44, 0xac, 0x18, 0x24, 0x5a, 0x73, 0xeb, 0x4c, 0xcf, 0xfd, 0x27, + 0x7a, 0xea, 0xf4, 0xdc, 0x3f, 0xc2, 0xc7, 0x1e, 0x7b, 0xac, 0xc9, 0xa5, 0xc7, 0x1c, 0x73, 0x6b, + 0x67, 0x57, 0x20, 0x8b, 0x1f, 0x9d, 0x49, 0xdb, 0x1b, 0xef, 0xfb, 0xbe, 0xf7, 0x73, 0x9f, 0x1e, + 0x70, 0xf4, 0xda, 0xf7, 0x5f, 0x7b, 0xee, 0xf1, 0x64, 0xea, 0x87, 0xfe, 0xd5, 0xec, 0xfa, 0x38, + 0x9c, 0x4f, 0xdc, 0xb2, 0xb0, 0xc8, 0x61, 0xc4, 0x95, 0x57, 0xdc, 0xd1, 0xd3, 0x4d, 0x71, 0x9f, + 0xcd, 0x23, 0xf6, 0xe8, 0xb3, 0x4d, 0x2a, 0xf0, 0x67, 0xd3, 0x81, 0xdb, 0x1b, 0xf8, 0x2c, 0x74, + 0x6f, 0xc2, 0x48, 0x55, 0xfc, 0x51, 0x02, 0xd9, 0x99, 0x4f, 0x5c, 0x42, 0x40, 0x66, 0xfd, 0xb1, + 0xab, 0xa1, 0x02, 0x2a, 0xa9, 0x54, 0xfc, 0x26, 0x65, 0x50, 0xae, 0x47, 0xae, 0x37, 0x0c, 0x34, + 0xa9, 0x90, 0x2a, 0x65, 0x2b, 0x8f, 0xcb, 0x1b, 0xf9, 0xcb, 0xe7, 0x9c, 0xa6, 0x4b, 0x15, 0x79, + 0x0c, 0x8a, 0xcf, 0x5c, 0xff, 0x3a, 0xd0, 0x52, 0x85, 0x54, 0x49, 0xa5, 0x4b, 0x8b, 0x7c, 0x0e, + 0xfb, 0xfe, 0x24, 0x1c, 0xf9, 0x2c, 0xd0, 0x64, 0x11, 0xe8, 0xc9, 0x56, 0x20, 0x4b, 0xf0, 0x74, + 0xa5, 0x23, 0x06, 0xe4, 0xd7, 0xeb, 0xd5, 0xd2, 0x05, 0x54, 0xca, 0x56, 0xf4, 0x2d, 0xcf, 0x8e, + 0x90, 0x9d, 0x45, 0x2a, 0x9a, 0x0b, 0x92, 0x26, 0x39, 0x06, 0x25, 0x98, 0xb3, 0xb0, 0x7f, 0xa3, + 0x29, 0x05, 0x54, 0xca, 0xef, 0x48, 0xdc, 0x11, 0x34, 0x5d, 0xca, 0x8a, 0xbf, 0x2a, 0x90, 0x16, + 0x4d, 0x91, 0x63, 0x90, 0xdf, 0x8e, 0xd8, 0x50, 0x0c, 0x24, 0x5f, 0x79, 0xb6, 0xbb, 0xf5, 0xf2, + 0xc5, 0x88, 0x0d, 0xa9, 0x10, 0x92, 0x06, 0x64, 0x07, 0xfd, 0xe9, 0x70, 0xc4, 0xfa, 0xde, 0x28, + 0x9c, 0x6b, 0x92, 0xf0, 0x2b, 0xfe, 0x83, 0xdf, 0xd9, 0xbd, 0x92, 0x26, 0xdd, 0xf8, 0x0c, 0xd9, + 0x6c, 0x7c, 0xe5, 0x4e, 0xb5, 0x54, 0x01, 0x95, 0xd2, 0x74, 0x69, 0xc5, 0xef, 0x23, 0x27, 0xde, + 0xe7, 0x29, 0x64, 0xf8, 0x72, 0xf4, 0x66, 0x53, 0x4f, 0xf4, 0xa7, 0xd2, 0x7d, 0x6e, 0x77, 0xa7, + 0x1e, 0xf9, 0x04, 0xb2, 0x62, 0xf8, 0xbd, 0x11, 0x1b, 0xba, 0x37, 0xda, 0xbe, 0x88, 0x05, 0x02, + 0x6a, 0x71, 0x84, 0xe7, 0x99, 0xf4, 0x07, 0x6f, 0xdd, 0xa1, 0x96, 0x29, 0xa0, 0x52, 0x86, 0x2e, + 0xad, 0xe4, 0x5b, 0xa9, 0x1f, 0xf9, 0x56, 0xcf, 0x40, 0x7d, 0x13, 0xf8, 0xac, 0x27, 0xea, 0x03, + 0x51, 0x47, 0x86, 0x03, 0x26, 0xaf, 0xf1, 0x53, 0xc8, 0x0d, 0xdd, 0xeb, 0xfe, 0xcc, 0x0b, 0x7b, + 0xdf, 0xf6, 0xbd, 0x99, 0xab, 0x65, 0x85, 0xe0, 0x60, 0x09, 0x7e, 0xcd, 0xb1, 0xe2, 0xad, 0x04, + 0x32, 0x9f, 0x24, 0xc1, 0x70, 0xe0, 0x5c, 0xda, 0x46, 0xaf, 0x6b, 0x5e, 0x98, 0xd6, 0x4b, 0x13, + 0xef, 0x91, 0x43, 0xc8, 0x0a, 0xa4, 0x61, 0x75, 0xeb, 0x6d, 0x03, 0x23, 0x92, 0x07, 0x10, 0xc0, + 0x79, 0xdb, 0xaa, 0x39, 0x58, 0x8a, 0xed, 0x96, 0xe9, 0x9c, 0x9e, 0xe0, 0x54, 0xec, 0xd0, 0x8d, + 0x00, 0x39, 0x29, 0xa8, 0x56, 0x70, 0x3a, 0xce, 0x71, 0xde, 0x7a, 0x65, 0x34, 0x4e, 0x4f, 0xb0, + 0xb2, 0x8e, 0x54, 0x2b, 0x78, 0x9f, 0xe4, 0x40, 0x15, 0x48, 0xdd, 0xb2, 0xda, 0x38, 0x13, 0xc7, + 0xec, 0x38, 0xb4, 0x65, 0x36, 0xb1, 0x1a, 0xc7, 0x6c, 0x52, 0xab, 0x6b, 0x63, 0x88, 0x23, 0xbc, + 0x30, 0x3a, 0x9d, 0x5a, 0xd3, 0xc0, 0xd9, 0x58, 0x51, 0xbf, 0x74, 0x8c, 0x0e, 0x3e, 0x58, 0x2b, + 0xab, 0x5a, 0xc1, 0xb9, 0x38, 0x85, 0x61, 0x76, 0x5f, 0xe0, 0x3c, 0x79, 0x00, 0xb9, 0x28, 0xc5, + 0xaa, 0x88, 0xc3, 0x0d, 0xe8, 0xf4, 0x04, 0xe3, 0xfb, 0x42, 0xa2, 0x28, 0x0f, 0xd6, 0x80, 0xd3, + 0x13, 0x4c, 0x8a, 0x21, 0x64, 0x13, 0xbb, 0x45, 0x9e, 0xc0, 0xc3, 0xb3, 0x1a, 0x6d, 0xb4, 0xcc, + 0x5a, 0xbb, 0xe5, 0x5c, 0x26, 0xe6, 0xaa, 0xc1, 0xa3, 0x24, 0x61, 0xd9, 0x4e, 0xcb, 0x32, 0x6b, + 0x6d, 0x8c, 0x36, 0x19, 0x6a, 0x7c, 0xd5, 0x6d, 0x51, 0xa3, 0x81, 0xa5, 0x6d, 0xc6, 0x36, 0x6a, + 0x8e, 0xd1, 0xc0, 0xa9, 0xe2, 0x5f, 0x08, 0x64, 0x83, 0xcd, 0xc6, 0x3b, 0xcf, 0xc8, 0x17, 0xa0, + 0xba, 0x6c, 0x36, 0x8e, 0x9e, 0x3f, 0xba, 0x24, 0x47, 0x5b, 0x4b, 0xc5, 0xbd, 0xc5, 0x32, 0xd0, + 0x7b, 0x71, 0x72, 0x19, 0x53, 0xff, 0xf9, 0x70, 0xc8, 0xff, 0xef, 0x70, 0xa4, 0x3f, 0xee, 0x70, + 0xbc, 0x01, 0x35, 0x6e, 0x61, 0xe7, 0x14, 0xee, 0x3f, 0x6c, 0x69, 0xed, 0xc3, 0xfe, 0xf7, 0x3d, + 0x16, 0xbf, 0x04, 0x25, 0x82, 0x76, 0x26, 0x7a, 0x0e, 0xe9, 0xd5, 0xa8, 0x79, 0xe3, 0x8f, 0xb6, + 0xc2, 0xd5, 0xd8, 0x9c, 0x46, 0x92, 0xe7, 0x65, 0x50, 0xa2, 0x3e, 0xf8, 0xb2, 0x75, 0x2e, 0x4d, + 0xa7, 0xf6, 0xaa, 0x67, 0x53, 0xcb, 0xb1, 0x2a, 0x78, 0x6f, 0x13, 0xaa, 0x62, 0x54, 0xff, 0x01, + 0xfd, 0x7e, 0xa7, 0xef, 0xbd, 0xbf, 0xd3, 0xd1, 0x87, 0x3b, 0x1d, 0x7d, 0xbf, 0xd0, 0xd1, 0xcf, + 0x0b, 0x1d, 0xdd, 0x2e, 0x74, 0xf4, 0xdb, 0x42, 0x47, 0x7f, 0x2c, 0x74, 0xf4, 0xe7, 0x42, 0xdf, + 0x7b, 0xcf, 0xf1, 0x77, 0x3a, 0xba, 0x7d, 0xa7, 0x23, 0x78, 0x38, 0xf0, 0xc7, 0x9b, 0x25, 0xd4, + 0x55, 0xfe, 0x9f, 0x63, 0x73, 0xcb, 0x46, 0xdf, 0xa4, 0xf9, 0xd1, 0x0a, 0x3e, 0x20, 0xf4, 0x93, + 0x94, 0x6a, 0xda, 0xf5, 0x5f, 0x24, 0xbd, 0x19, 0xc9, 0xed, 0x55, 0xc5, 0x2f, 0x5d, 0xcf, 0xbb, + 0x60, 0xfe, 0x77, 0x8c, 0xbb, 0x05, 0x57, 0x8a, 0x88, 0x53, 0xfd, 0x3b, 0x00, 0x00, 0xff, 0xff, + 0xbc, 0x2a, 0x5e, 0x82, 0x2b, 0x07, 0x00, 0x00, +} diff --git a/vendor/github.com/gogo/protobuf/types/wrappers.pb.go b/vendor/github.com/gogo/protobuf/types/wrappers.pb.go new file mode 100644 index 000000000000..7516cc989600 --- /dev/null +++ b/vendor/github.com/gogo/protobuf/types/wrappers.pb.go @@ -0,0 +1,2668 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: google/protobuf/wrappers.proto + +package types + +import proto "github.com/gogo/protobuf/proto" +import fmt "fmt" +import math "math" + +import bytes "bytes" + +import strings "strings" +import reflect "reflect" + +import encoding_binary "encoding/binary" + +import io "io" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package + +// Wrapper message for `double`. +// +// The JSON representation for `DoubleValue` is JSON number. +type DoubleValue struct { + // The double value. + Value float64 `protobuf:"fixed64,1,opt,name=value,proto3" json:"value,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *DoubleValue) Reset() { *m = DoubleValue{} } +func (*DoubleValue) ProtoMessage() {} +func (*DoubleValue) Descriptor() ([]byte, []int) { + return fileDescriptor_wrappers_c5239a825c7dfb53, []int{0} +} +func (*DoubleValue) XXX_WellKnownType() string { return "DoubleValue" } +func (m *DoubleValue) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DoubleValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_DoubleValue.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *DoubleValue) XXX_Merge(src proto.Message) { + xxx_messageInfo_DoubleValue.Merge(dst, src) +} +func (m *DoubleValue) XXX_Size() int { + return m.Size() +} +func (m *DoubleValue) XXX_DiscardUnknown() { + xxx_messageInfo_DoubleValue.DiscardUnknown(m) +} + +var xxx_messageInfo_DoubleValue proto.InternalMessageInfo + +func (m *DoubleValue) GetValue() float64 { + if m != nil { + return m.Value + } + return 0 +} + +func (*DoubleValue) XXX_MessageName() string { + return "google.protobuf.DoubleValue" +} + +// Wrapper message for `float`. +// +// The JSON representation for `FloatValue` is JSON number. +type FloatValue struct { + // The float value. + Value float32 `protobuf:"fixed32,1,opt,name=value,proto3" json:"value,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *FloatValue) Reset() { *m = FloatValue{} } +func (*FloatValue) ProtoMessage() {} +func (*FloatValue) Descriptor() ([]byte, []int) { + return fileDescriptor_wrappers_c5239a825c7dfb53, []int{1} +} +func (*FloatValue) XXX_WellKnownType() string { return "FloatValue" } +func (m *FloatValue) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *FloatValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_FloatValue.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *FloatValue) XXX_Merge(src proto.Message) { + xxx_messageInfo_FloatValue.Merge(dst, src) +} +func (m *FloatValue) XXX_Size() int { + return m.Size() +} +func (m *FloatValue) XXX_DiscardUnknown() { + xxx_messageInfo_FloatValue.DiscardUnknown(m) +} + +var xxx_messageInfo_FloatValue proto.InternalMessageInfo + +func (m *FloatValue) GetValue() float32 { + if m != nil { + return m.Value + } + return 0 +} + +func (*FloatValue) XXX_MessageName() string { + return "google.protobuf.FloatValue" +} + +// Wrapper message for `int64`. +// +// The JSON representation for `Int64Value` is JSON string. +type Int64Value struct { + // The int64 value. + Value int64 `protobuf:"varint,1,opt,name=value,proto3" json:"value,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Int64Value) Reset() { *m = Int64Value{} } +func (*Int64Value) ProtoMessage() {} +func (*Int64Value) Descriptor() ([]byte, []int) { + return fileDescriptor_wrappers_c5239a825c7dfb53, []int{2} +} +func (*Int64Value) XXX_WellKnownType() string { return "Int64Value" } +func (m *Int64Value) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Int64Value) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Int64Value.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *Int64Value) XXX_Merge(src proto.Message) { + xxx_messageInfo_Int64Value.Merge(dst, src) +} +func (m *Int64Value) XXX_Size() int { + return m.Size() +} +func (m *Int64Value) XXX_DiscardUnknown() { + xxx_messageInfo_Int64Value.DiscardUnknown(m) +} + +var xxx_messageInfo_Int64Value proto.InternalMessageInfo + +func (m *Int64Value) GetValue() int64 { + if m != nil { + return m.Value + } + return 0 +} + +func (*Int64Value) XXX_MessageName() string { + return "google.protobuf.Int64Value" +} + +// Wrapper message for `uint64`. +// +// The JSON representation for `UInt64Value` is JSON string. +type UInt64Value struct { + // The uint64 value. + Value uint64 `protobuf:"varint,1,opt,name=value,proto3" json:"value,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *UInt64Value) Reset() { *m = UInt64Value{} } +func (*UInt64Value) ProtoMessage() {} +func (*UInt64Value) Descriptor() ([]byte, []int) { + return fileDescriptor_wrappers_c5239a825c7dfb53, []int{3} +} +func (*UInt64Value) XXX_WellKnownType() string { return "UInt64Value" } +func (m *UInt64Value) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *UInt64Value) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_UInt64Value.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *UInt64Value) XXX_Merge(src proto.Message) { + xxx_messageInfo_UInt64Value.Merge(dst, src) +} +func (m *UInt64Value) XXX_Size() int { + return m.Size() +} +func (m *UInt64Value) XXX_DiscardUnknown() { + xxx_messageInfo_UInt64Value.DiscardUnknown(m) +} + +var xxx_messageInfo_UInt64Value proto.InternalMessageInfo + +func (m *UInt64Value) GetValue() uint64 { + if m != nil { + return m.Value + } + return 0 +} + +func (*UInt64Value) XXX_MessageName() string { + return "google.protobuf.UInt64Value" +} + +// Wrapper message for `int32`. +// +// The JSON representation for `Int32Value` is JSON number. +type Int32Value struct { + // The int32 value. + Value int32 `protobuf:"varint,1,opt,name=value,proto3" json:"value,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Int32Value) Reset() { *m = Int32Value{} } +func (*Int32Value) ProtoMessage() {} +func (*Int32Value) Descriptor() ([]byte, []int) { + return fileDescriptor_wrappers_c5239a825c7dfb53, []int{4} +} +func (*Int32Value) XXX_WellKnownType() string { return "Int32Value" } +func (m *Int32Value) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Int32Value) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Int32Value.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *Int32Value) XXX_Merge(src proto.Message) { + xxx_messageInfo_Int32Value.Merge(dst, src) +} +func (m *Int32Value) XXX_Size() int { + return m.Size() +} +func (m *Int32Value) XXX_DiscardUnknown() { + xxx_messageInfo_Int32Value.DiscardUnknown(m) +} + +var xxx_messageInfo_Int32Value proto.InternalMessageInfo + +func (m *Int32Value) GetValue() int32 { + if m != nil { + return m.Value + } + return 0 +} + +func (*Int32Value) XXX_MessageName() string { + return "google.protobuf.Int32Value" +} + +// Wrapper message for `uint32`. +// +// The JSON representation for `UInt32Value` is JSON number. +type UInt32Value struct { + // The uint32 value. + Value uint32 `protobuf:"varint,1,opt,name=value,proto3" json:"value,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *UInt32Value) Reset() { *m = UInt32Value{} } +func (*UInt32Value) ProtoMessage() {} +func (*UInt32Value) Descriptor() ([]byte, []int) { + return fileDescriptor_wrappers_c5239a825c7dfb53, []int{5} +} +func (*UInt32Value) XXX_WellKnownType() string { return "UInt32Value" } +func (m *UInt32Value) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *UInt32Value) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_UInt32Value.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *UInt32Value) XXX_Merge(src proto.Message) { + xxx_messageInfo_UInt32Value.Merge(dst, src) +} +func (m *UInt32Value) XXX_Size() int { + return m.Size() +} +func (m *UInt32Value) XXX_DiscardUnknown() { + xxx_messageInfo_UInt32Value.DiscardUnknown(m) +} + +var xxx_messageInfo_UInt32Value proto.InternalMessageInfo + +func (m *UInt32Value) GetValue() uint32 { + if m != nil { + return m.Value + } + return 0 +} + +func (*UInt32Value) XXX_MessageName() string { + return "google.protobuf.UInt32Value" +} + +// Wrapper message for `bool`. +// +// The JSON representation for `BoolValue` is JSON `true` and `false`. +type BoolValue struct { + // The bool value. + Value bool `protobuf:"varint,1,opt,name=value,proto3" json:"value,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *BoolValue) Reset() { *m = BoolValue{} } +func (*BoolValue) ProtoMessage() {} +func (*BoolValue) Descriptor() ([]byte, []int) { + return fileDescriptor_wrappers_c5239a825c7dfb53, []int{6} +} +func (*BoolValue) XXX_WellKnownType() string { return "BoolValue" } +func (m *BoolValue) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *BoolValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_BoolValue.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *BoolValue) XXX_Merge(src proto.Message) { + xxx_messageInfo_BoolValue.Merge(dst, src) +} +func (m *BoolValue) XXX_Size() int { + return m.Size() +} +func (m *BoolValue) XXX_DiscardUnknown() { + xxx_messageInfo_BoolValue.DiscardUnknown(m) +} + +var xxx_messageInfo_BoolValue proto.InternalMessageInfo + +func (m *BoolValue) GetValue() bool { + if m != nil { + return m.Value + } + return false +} + +func (*BoolValue) XXX_MessageName() string { + return "google.protobuf.BoolValue" +} + +// Wrapper message for `string`. +// +// The JSON representation for `StringValue` is JSON string. +type StringValue struct { + // The string value. + Value string `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *StringValue) Reset() { *m = StringValue{} } +func (*StringValue) ProtoMessage() {} +func (*StringValue) Descriptor() ([]byte, []int) { + return fileDescriptor_wrappers_c5239a825c7dfb53, []int{7} +} +func (*StringValue) XXX_WellKnownType() string { return "StringValue" } +func (m *StringValue) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *StringValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_StringValue.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *StringValue) XXX_Merge(src proto.Message) { + xxx_messageInfo_StringValue.Merge(dst, src) +} +func (m *StringValue) XXX_Size() int { + return m.Size() +} +func (m *StringValue) XXX_DiscardUnknown() { + xxx_messageInfo_StringValue.DiscardUnknown(m) +} + +var xxx_messageInfo_StringValue proto.InternalMessageInfo + +func (m *StringValue) GetValue() string { + if m != nil { + return m.Value + } + return "" +} + +func (*StringValue) XXX_MessageName() string { + return "google.protobuf.StringValue" +} + +// Wrapper message for `bytes`. +// +// The JSON representation for `BytesValue` is JSON string. +type BytesValue struct { + // The bytes value. + Value []byte `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *BytesValue) Reset() { *m = BytesValue{} } +func (*BytesValue) ProtoMessage() {} +func (*BytesValue) Descriptor() ([]byte, []int) { + return fileDescriptor_wrappers_c5239a825c7dfb53, []int{8} +} +func (*BytesValue) XXX_WellKnownType() string { return "BytesValue" } +func (m *BytesValue) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *BytesValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_BytesValue.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (dst *BytesValue) XXX_Merge(src proto.Message) { + xxx_messageInfo_BytesValue.Merge(dst, src) +} +func (m *BytesValue) XXX_Size() int { + return m.Size() +} +func (m *BytesValue) XXX_DiscardUnknown() { + xxx_messageInfo_BytesValue.DiscardUnknown(m) +} + +var xxx_messageInfo_BytesValue proto.InternalMessageInfo + +func (m *BytesValue) GetValue() []byte { + if m != nil { + return m.Value + } + return nil +} + +func (*BytesValue) XXX_MessageName() string { + return "google.protobuf.BytesValue" +} +func init() { + proto.RegisterType((*DoubleValue)(nil), "google.protobuf.DoubleValue") + proto.RegisterType((*FloatValue)(nil), "google.protobuf.FloatValue") + proto.RegisterType((*Int64Value)(nil), "google.protobuf.Int64Value") + proto.RegisterType((*UInt64Value)(nil), "google.protobuf.UInt64Value") + proto.RegisterType((*Int32Value)(nil), "google.protobuf.Int32Value") + proto.RegisterType((*UInt32Value)(nil), "google.protobuf.UInt32Value") + proto.RegisterType((*BoolValue)(nil), "google.protobuf.BoolValue") + proto.RegisterType((*StringValue)(nil), "google.protobuf.StringValue") + proto.RegisterType((*BytesValue)(nil), "google.protobuf.BytesValue") +} +func (this *DoubleValue) Compare(that interface{}) int { + if that == nil { + if this == nil { + return 0 + } + return 1 + } + + that1, ok := that.(*DoubleValue) + if !ok { + that2, ok := that.(DoubleValue) + if ok { + that1 = &that2 + } else { + return 1 + } + } + if that1 == nil { + if this == nil { + return 0 + } + return 1 + } else if this == nil { + return -1 + } + if this.Value != that1.Value { + if this.Value < that1.Value { + return -1 + } + return 1 + } + if c := bytes.Compare(this.XXX_unrecognized, that1.XXX_unrecognized); c != 0 { + return c + } + return 0 +} +func (this *FloatValue) Compare(that interface{}) int { + if that == nil { + if this == nil { + return 0 + } + return 1 + } + + that1, ok := that.(*FloatValue) + if !ok { + that2, ok := that.(FloatValue) + if ok { + that1 = &that2 + } else { + return 1 + } + } + if that1 == nil { + if this == nil { + return 0 + } + return 1 + } else if this == nil { + return -1 + } + if this.Value != that1.Value { + if this.Value < that1.Value { + return -1 + } + return 1 + } + if c := bytes.Compare(this.XXX_unrecognized, that1.XXX_unrecognized); c != 0 { + return c + } + return 0 +} +func (this *Int64Value) Compare(that interface{}) int { + if that == nil { + if this == nil { + return 0 + } + return 1 + } + + that1, ok := that.(*Int64Value) + if !ok { + that2, ok := that.(Int64Value) + if ok { + that1 = &that2 + } else { + return 1 + } + } + if that1 == nil { + if this == nil { + return 0 + } + return 1 + } else if this == nil { + return -1 + } + if this.Value != that1.Value { + if this.Value < that1.Value { + return -1 + } + return 1 + } + if c := bytes.Compare(this.XXX_unrecognized, that1.XXX_unrecognized); c != 0 { + return c + } + return 0 +} +func (this *UInt64Value) Compare(that interface{}) int { + if that == nil { + if this == nil { + return 0 + } + return 1 + } + + that1, ok := that.(*UInt64Value) + if !ok { + that2, ok := that.(UInt64Value) + if ok { + that1 = &that2 + } else { + return 1 + } + } + if that1 == nil { + if this == nil { + return 0 + } + return 1 + } else if this == nil { + return -1 + } + if this.Value != that1.Value { + if this.Value < that1.Value { + return -1 + } + return 1 + } + if c := bytes.Compare(this.XXX_unrecognized, that1.XXX_unrecognized); c != 0 { + return c + } + return 0 +} +func (this *Int32Value) Compare(that interface{}) int { + if that == nil { + if this == nil { + return 0 + } + return 1 + } + + that1, ok := that.(*Int32Value) + if !ok { + that2, ok := that.(Int32Value) + if ok { + that1 = &that2 + } else { + return 1 + } + } + if that1 == nil { + if this == nil { + return 0 + } + return 1 + } else if this == nil { + return -1 + } + if this.Value != that1.Value { + if this.Value < that1.Value { + return -1 + } + return 1 + } + if c := bytes.Compare(this.XXX_unrecognized, that1.XXX_unrecognized); c != 0 { + return c + } + return 0 +} +func (this *UInt32Value) Compare(that interface{}) int { + if that == nil { + if this == nil { + return 0 + } + return 1 + } + + that1, ok := that.(*UInt32Value) + if !ok { + that2, ok := that.(UInt32Value) + if ok { + that1 = &that2 + } else { + return 1 + } + } + if that1 == nil { + if this == nil { + return 0 + } + return 1 + } else if this == nil { + return -1 + } + if this.Value != that1.Value { + if this.Value < that1.Value { + return -1 + } + return 1 + } + if c := bytes.Compare(this.XXX_unrecognized, that1.XXX_unrecognized); c != 0 { + return c + } + return 0 +} +func (this *BoolValue) Compare(that interface{}) int { + if that == nil { + if this == nil { + return 0 + } + return 1 + } + + that1, ok := that.(*BoolValue) + if !ok { + that2, ok := that.(BoolValue) + if ok { + that1 = &that2 + } else { + return 1 + } + } + if that1 == nil { + if this == nil { + return 0 + } + return 1 + } else if this == nil { + return -1 + } + if this.Value != that1.Value { + if !this.Value { + return -1 + } + return 1 + } + if c := bytes.Compare(this.XXX_unrecognized, that1.XXX_unrecognized); c != 0 { + return c + } + return 0 +} +func (this *StringValue) Compare(that interface{}) int { + if that == nil { + if this == nil { + return 0 + } + return 1 + } + + that1, ok := that.(*StringValue) + if !ok { + that2, ok := that.(StringValue) + if ok { + that1 = &that2 + } else { + return 1 + } + } + if that1 == nil { + if this == nil { + return 0 + } + return 1 + } else if this == nil { + return -1 + } + if this.Value != that1.Value { + if this.Value < that1.Value { + return -1 + } + return 1 + } + if c := bytes.Compare(this.XXX_unrecognized, that1.XXX_unrecognized); c != 0 { + return c + } + return 0 +} +func (this *BytesValue) Compare(that interface{}) int { + if that == nil { + if this == nil { + return 0 + } + return 1 + } + + that1, ok := that.(*BytesValue) + if !ok { + that2, ok := that.(BytesValue) + if ok { + that1 = &that2 + } else { + return 1 + } + } + if that1 == nil { + if this == nil { + return 0 + } + return 1 + } else if this == nil { + return -1 + } + if c := bytes.Compare(this.Value, that1.Value); c != 0 { + return c + } + if c := bytes.Compare(this.XXX_unrecognized, that1.XXX_unrecognized); c != 0 { + return c + } + return 0 +} +func (this *DoubleValue) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*DoubleValue) + if !ok { + that2, ok := that.(DoubleValue) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Value != that1.Value { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *FloatValue) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*FloatValue) + if !ok { + that2, ok := that.(FloatValue) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Value != that1.Value { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *Int64Value) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Int64Value) + if !ok { + that2, ok := that.(Int64Value) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Value != that1.Value { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *UInt64Value) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*UInt64Value) + if !ok { + that2, ok := that.(UInt64Value) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Value != that1.Value { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *Int32Value) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Int32Value) + if !ok { + that2, ok := that.(Int32Value) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Value != that1.Value { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *UInt32Value) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*UInt32Value) + if !ok { + that2, ok := that.(UInt32Value) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Value != that1.Value { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *BoolValue) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*BoolValue) + if !ok { + that2, ok := that.(BoolValue) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Value != that1.Value { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *StringValue) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*StringValue) + if !ok { + that2, ok := that.(StringValue) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Value != that1.Value { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *BytesValue) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*BytesValue) + if !ok { + that2, ok := that.(BytesValue) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !bytes.Equal(this.Value, that1.Value) { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *DoubleValue) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 5) + s = append(s, "&types.DoubleValue{") + s = append(s, "Value: "+fmt.Sprintf("%#v", this.Value)+",\n") + if this.XXX_unrecognized != nil { + s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") + } + s = append(s, "}") + return strings.Join(s, "") +} +func (this *FloatValue) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 5) + s = append(s, "&types.FloatValue{") + s = append(s, "Value: "+fmt.Sprintf("%#v", this.Value)+",\n") + if this.XXX_unrecognized != nil { + s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") + } + s = append(s, "}") + return strings.Join(s, "") +} +func (this *Int64Value) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 5) + s = append(s, "&types.Int64Value{") + s = append(s, "Value: "+fmt.Sprintf("%#v", this.Value)+",\n") + if this.XXX_unrecognized != nil { + s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") + } + s = append(s, "}") + return strings.Join(s, "") +} +func (this *UInt64Value) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 5) + s = append(s, "&types.UInt64Value{") + s = append(s, "Value: "+fmt.Sprintf("%#v", this.Value)+",\n") + if this.XXX_unrecognized != nil { + s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") + } + s = append(s, "}") + return strings.Join(s, "") +} +func (this *Int32Value) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 5) + s = append(s, "&types.Int32Value{") + s = append(s, "Value: "+fmt.Sprintf("%#v", this.Value)+",\n") + if this.XXX_unrecognized != nil { + s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") + } + s = append(s, "}") + return strings.Join(s, "") +} +func (this *UInt32Value) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 5) + s = append(s, "&types.UInt32Value{") + s = append(s, "Value: "+fmt.Sprintf("%#v", this.Value)+",\n") + if this.XXX_unrecognized != nil { + s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") + } + s = append(s, "}") + return strings.Join(s, "") +} +func (this *BoolValue) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 5) + s = append(s, "&types.BoolValue{") + s = append(s, "Value: "+fmt.Sprintf("%#v", this.Value)+",\n") + if this.XXX_unrecognized != nil { + s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") + } + s = append(s, "}") + return strings.Join(s, "") +} +func (this *StringValue) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 5) + s = append(s, "&types.StringValue{") + s = append(s, "Value: "+fmt.Sprintf("%#v", this.Value)+",\n") + if this.XXX_unrecognized != nil { + s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") + } + s = append(s, "}") + return strings.Join(s, "") +} +func (this *BytesValue) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 5) + s = append(s, "&types.BytesValue{") + s = append(s, "Value: "+fmt.Sprintf("%#v", this.Value)+",\n") + if this.XXX_unrecognized != nil { + s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") + } + s = append(s, "}") + return strings.Join(s, "") +} +func valueToGoStringWrappers(v interface{}, typ string) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv) +} +func (m *DoubleValue) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *DoubleValue) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Value != 0 { + dAtA[i] = 0x9 + i++ + encoding_binary.LittleEndian.PutUint64(dAtA[i:], uint64(math.Float64bits(float64(m.Value)))) + i += 8 + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *FloatValue) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *FloatValue) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Value != 0 { + dAtA[i] = 0xd + i++ + encoding_binary.LittleEndian.PutUint32(dAtA[i:], uint32(math.Float32bits(float32(m.Value)))) + i += 4 + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *Int64Value) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Int64Value) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Value != 0 { + dAtA[i] = 0x8 + i++ + i = encodeVarintWrappers(dAtA, i, uint64(m.Value)) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *UInt64Value) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *UInt64Value) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Value != 0 { + dAtA[i] = 0x8 + i++ + i = encodeVarintWrappers(dAtA, i, uint64(m.Value)) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *Int32Value) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Int32Value) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Value != 0 { + dAtA[i] = 0x8 + i++ + i = encodeVarintWrappers(dAtA, i, uint64(m.Value)) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *UInt32Value) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *UInt32Value) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Value != 0 { + dAtA[i] = 0x8 + i++ + i = encodeVarintWrappers(dAtA, i, uint64(m.Value)) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *BoolValue) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *BoolValue) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Value { + dAtA[i] = 0x8 + i++ + if m.Value { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i++ + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *StringValue) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *StringValue) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Value) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintWrappers(dAtA, i, uint64(len(m.Value))) + i += copy(dAtA[i:], m.Value) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *BytesValue) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *BytesValue) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Value) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintWrappers(dAtA, i, uint64(len(m.Value))) + i += copy(dAtA[i:], m.Value) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func encodeVarintWrappers(dAtA []byte, offset int, v uint64) int { + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return offset + 1 +} +func NewPopulatedDoubleValue(r randyWrappers, easy bool) *DoubleValue { + this := &DoubleValue{} + this.Value = float64(r.Float64()) + if r.Intn(2) == 0 { + this.Value *= -1 + } + if !easy && r.Intn(10) != 0 { + this.XXX_unrecognized = randUnrecognizedWrappers(r, 2) + } + return this +} + +func NewPopulatedFloatValue(r randyWrappers, easy bool) *FloatValue { + this := &FloatValue{} + this.Value = float32(r.Float32()) + if r.Intn(2) == 0 { + this.Value *= -1 + } + if !easy && r.Intn(10) != 0 { + this.XXX_unrecognized = randUnrecognizedWrappers(r, 2) + } + return this +} + +func NewPopulatedInt64Value(r randyWrappers, easy bool) *Int64Value { + this := &Int64Value{} + this.Value = int64(r.Int63()) + if r.Intn(2) == 0 { + this.Value *= -1 + } + if !easy && r.Intn(10) != 0 { + this.XXX_unrecognized = randUnrecognizedWrappers(r, 2) + } + return this +} + +func NewPopulatedUInt64Value(r randyWrappers, easy bool) *UInt64Value { + this := &UInt64Value{} + this.Value = uint64(uint64(r.Uint32())) + if !easy && r.Intn(10) != 0 { + this.XXX_unrecognized = randUnrecognizedWrappers(r, 2) + } + return this +} + +func NewPopulatedInt32Value(r randyWrappers, easy bool) *Int32Value { + this := &Int32Value{} + this.Value = int32(r.Int31()) + if r.Intn(2) == 0 { + this.Value *= -1 + } + if !easy && r.Intn(10) != 0 { + this.XXX_unrecognized = randUnrecognizedWrappers(r, 2) + } + return this +} + +func NewPopulatedUInt32Value(r randyWrappers, easy bool) *UInt32Value { + this := &UInt32Value{} + this.Value = uint32(r.Uint32()) + if !easy && r.Intn(10) != 0 { + this.XXX_unrecognized = randUnrecognizedWrappers(r, 2) + } + return this +} + +func NewPopulatedBoolValue(r randyWrappers, easy bool) *BoolValue { + this := &BoolValue{} + this.Value = bool(bool(r.Intn(2) == 0)) + if !easy && r.Intn(10) != 0 { + this.XXX_unrecognized = randUnrecognizedWrappers(r, 2) + } + return this +} + +func NewPopulatedStringValue(r randyWrappers, easy bool) *StringValue { + this := &StringValue{} + this.Value = string(randStringWrappers(r)) + if !easy && r.Intn(10) != 0 { + this.XXX_unrecognized = randUnrecognizedWrappers(r, 2) + } + return this +} + +func NewPopulatedBytesValue(r randyWrappers, easy bool) *BytesValue { + this := &BytesValue{} + v1 := r.Intn(100) + this.Value = make([]byte, v1) + for i := 0; i < v1; i++ { + this.Value[i] = byte(r.Intn(256)) + } + if !easy && r.Intn(10) != 0 { + this.XXX_unrecognized = randUnrecognizedWrappers(r, 2) + } + return this +} + +type randyWrappers interface { + Float32() float32 + Float64() float64 + Int63() int64 + Int31() int32 + Uint32() uint32 + Intn(n int) int +} + +func randUTF8RuneWrappers(r randyWrappers) rune { + ru := r.Intn(62) + if ru < 10 { + return rune(ru + 48) + } else if ru < 36 { + return rune(ru + 55) + } + return rune(ru + 61) +} +func randStringWrappers(r randyWrappers) string { + v2 := r.Intn(100) + tmps := make([]rune, v2) + for i := 0; i < v2; i++ { + tmps[i] = randUTF8RuneWrappers(r) + } + return string(tmps) +} +func randUnrecognizedWrappers(r randyWrappers, maxFieldNumber int) (dAtA []byte) { + l := r.Intn(5) + for i := 0; i < l; i++ { + wire := r.Intn(4) + if wire == 3 { + wire = 5 + } + fieldNumber := maxFieldNumber + r.Intn(100) + dAtA = randFieldWrappers(dAtA, r, fieldNumber, wire) + } + return dAtA +} +func randFieldWrappers(dAtA []byte, r randyWrappers, fieldNumber int, wire int) []byte { + key := uint32(fieldNumber)<<3 | uint32(wire) + switch wire { + case 0: + dAtA = encodeVarintPopulateWrappers(dAtA, uint64(key)) + v3 := r.Int63() + if r.Intn(2) == 0 { + v3 *= -1 + } + dAtA = encodeVarintPopulateWrappers(dAtA, uint64(v3)) + case 1: + dAtA = encodeVarintPopulateWrappers(dAtA, uint64(key)) + dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256))) + case 2: + dAtA = encodeVarintPopulateWrappers(dAtA, uint64(key)) + ll := r.Intn(100) + dAtA = encodeVarintPopulateWrappers(dAtA, uint64(ll)) + for j := 0; j < ll; j++ { + dAtA = append(dAtA, byte(r.Intn(256))) + } + default: + dAtA = encodeVarintPopulateWrappers(dAtA, uint64(key)) + dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256))) + } + return dAtA +} +func encodeVarintPopulateWrappers(dAtA []byte, v uint64) []byte { + for v >= 1<<7 { + dAtA = append(dAtA, uint8(uint64(v)&0x7f|0x80)) + v >>= 7 + } + dAtA = append(dAtA, uint8(v)) + return dAtA +} +func (m *DoubleValue) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Value != 0 { + n += 9 + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *FloatValue) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Value != 0 { + n += 5 + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *Int64Value) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Value != 0 { + n += 1 + sovWrappers(uint64(m.Value)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *UInt64Value) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Value != 0 { + n += 1 + sovWrappers(uint64(m.Value)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *Int32Value) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Value != 0 { + n += 1 + sovWrappers(uint64(m.Value)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *UInt32Value) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Value != 0 { + n += 1 + sovWrappers(uint64(m.Value)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *BoolValue) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Value { + n += 2 + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *StringValue) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Value) + if l > 0 { + n += 1 + l + sovWrappers(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *BytesValue) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Value) + if l > 0 { + n += 1 + l + sovWrappers(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func sovWrappers(x uint64) (n int) { + for { + n++ + x >>= 7 + if x == 0 { + break + } + } + return n +} +func sozWrappers(x uint64) (n int) { + return sovWrappers(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (this *DoubleValue) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&DoubleValue{`, + `Value:` + fmt.Sprintf("%v", this.Value) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *FloatValue) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&FloatValue{`, + `Value:` + fmt.Sprintf("%v", this.Value) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *Int64Value) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&Int64Value{`, + `Value:` + fmt.Sprintf("%v", this.Value) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *UInt64Value) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&UInt64Value{`, + `Value:` + fmt.Sprintf("%v", this.Value) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *Int32Value) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&Int32Value{`, + `Value:` + fmt.Sprintf("%v", this.Value) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *UInt32Value) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&UInt32Value{`, + `Value:` + fmt.Sprintf("%v", this.Value) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *BoolValue) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&BoolValue{`, + `Value:` + fmt.Sprintf("%v", this.Value) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *StringValue) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&StringValue{`, + `Value:` + fmt.Sprintf("%v", this.Value) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *BytesValue) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&BytesValue{`, + `Value:` + fmt.Sprintf("%v", this.Value) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func valueToStringWrappers(v interface{}) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("*%v", pv) +} +func (m *DoubleValue) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWrappers + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DoubleValue: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DoubleValue: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 1 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + var v uint64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = uint64(encoding_binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + m.Value = float64(math.Float64frombits(v)) + default: + iNdEx = preIndex + skippy, err := skipWrappers(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthWrappers + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *FloatValue) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWrappers + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: FloatValue: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: FloatValue: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 5 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + var v uint32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF + } + v = uint32(encoding_binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + m.Value = float32(math.Float32frombits(v)) + default: + iNdEx = preIndex + skippy, err := skipWrappers(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthWrappers + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Int64Value) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWrappers + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Int64Value: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Int64Value: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + m.Value = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWrappers + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Value |= (int64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipWrappers(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthWrappers + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *UInt64Value) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWrappers + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: UInt64Value: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: UInt64Value: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + m.Value = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWrappers + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Value |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipWrappers(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthWrappers + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Int32Value) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWrappers + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Int32Value: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Int32Value: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + m.Value = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWrappers + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Value |= (int32(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipWrappers(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthWrappers + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *UInt32Value) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWrappers + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: UInt32Value: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: UInt32Value: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + m.Value = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWrappers + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Value |= (uint32(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipWrappers(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthWrappers + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *BoolValue) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWrappers + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: BoolValue: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: BoolValue: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWrappers + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.Value = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skipWrappers(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthWrappers + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *StringValue) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWrappers + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: StringValue: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: StringValue: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWrappers + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthWrappers + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Value = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipWrappers(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthWrappers + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *BytesValue) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWrappers + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: BytesValue: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: BytesValue: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWrappers + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthWrappers + } + postIndex := iNdEx + byteLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Value = append(m.Value[:0], dAtA[iNdEx:postIndex]...) + if m.Value == nil { + m.Value = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipWrappers(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthWrappers + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipWrappers(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowWrappers + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowWrappers + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + return iNdEx, nil + case 1: + iNdEx += 8 + return iNdEx, nil + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowWrappers + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + iNdEx += length + if length < 0 { + return 0, ErrInvalidLengthWrappers + } + return iNdEx, nil + case 3: + for { + var innerWire uint64 + var start int = iNdEx + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowWrappers + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + innerWire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + innerWireType := int(innerWire & 0x7) + if innerWireType == 4 { + break + } + next, err := skipWrappers(dAtA[start:]) + if err != nil { + return 0, err + } + iNdEx = start + next + } + return iNdEx, nil + case 4: + return iNdEx, nil + case 5: + iNdEx += 4 + return iNdEx, nil + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + } + panic("unreachable") +} + +var ( + ErrInvalidLengthWrappers = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowWrappers = fmt.Errorf("proto: integer overflow") +) + +func init() { + proto.RegisterFile("google/protobuf/wrappers.proto", fileDescriptor_wrappers_c5239a825c7dfb53) +} + +var fileDescriptor_wrappers_c5239a825c7dfb53 = []byte{ + // 285 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4b, 0xcf, 0xcf, 0x4f, + 0xcf, 0x49, 0xd5, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0x4f, 0x2a, 0x4d, 0xd3, 0x2f, 0x2f, 0x4a, 0x2c, + 0x28, 0x48, 0x2d, 0x2a, 0xd6, 0x03, 0x8b, 0x08, 0xf1, 0x43, 0xe4, 0xf5, 0x60, 0xf2, 0x4a, 0xca, + 0x5c, 0xdc, 0x2e, 0xf9, 0xa5, 0x49, 0x39, 0xa9, 0x61, 0x89, 0x39, 0xa5, 0xa9, 0x42, 0x22, 0x5c, + 0xac, 0x65, 0x20, 0x86, 0x04, 0xa3, 0x02, 0xa3, 0x06, 0x63, 0x10, 0x84, 0xa3, 0xa4, 0xc4, 0xc5, + 0xe5, 0x96, 0x93, 0x9f, 0x58, 0x82, 0x45, 0x0d, 0x13, 0x92, 0x1a, 0xcf, 0xbc, 0x12, 0x33, 0x13, + 0x2c, 0x6a, 0x98, 0x61, 0x6a, 0x94, 0xb9, 0xb8, 0x43, 0x71, 0x29, 0x62, 0x41, 0x35, 0xc8, 0xd8, + 0x08, 0x8b, 0x1a, 0x56, 0x34, 0x83, 0xb0, 0x2a, 0xe2, 0x85, 0x29, 0x52, 0xe4, 0xe2, 0x74, 0xca, + 0xcf, 0xcf, 0xc1, 0xa2, 0x84, 0x03, 0xc9, 0x9c, 0xe0, 0x92, 0xa2, 0xcc, 0xbc, 0x74, 0x2c, 0x8a, + 0x38, 0x91, 0x1c, 0xe4, 0x54, 0x59, 0x92, 0x5a, 0x8c, 0x45, 0x0d, 0x0f, 0x54, 0x8d, 0x53, 0x3b, + 0xe3, 0x8d, 0x87, 0x72, 0x0c, 0x1f, 0x1e, 0xca, 0x31, 0xfe, 0x78, 0x28, 0xc7, 0xd8, 0xf0, 0x48, + 0x8e, 0x71, 0xc5, 0x23, 0x39, 0xc6, 0x13, 0x8f, 0xe4, 0x18, 0x2f, 0x3c, 0x92, 0x63, 0x7c, 0xf0, + 0x48, 0x8e, 0xf1, 0xc5, 0x23, 0x39, 0x86, 0x0f, 0x20, 0xf1, 0xc7, 0x72, 0x8c, 0x27, 0x1e, 0xcb, + 0x31, 0x72, 0x09, 0x27, 0xe7, 0xe7, 0xea, 0xa1, 0x45, 0x87, 0x13, 0x6f, 0x38, 0x34, 0xbe, 0x02, + 0x40, 0x22, 0x01, 0x8c, 0x51, 0xac, 0x25, 0x95, 0x05, 0xa9, 0xc5, 0x3f, 0x18, 0x19, 0x17, 0x31, + 0x31, 0xbb, 0x07, 0x38, 0xad, 0x62, 0x92, 0x73, 0x87, 0x68, 0x09, 0x80, 0x6a, 0xd1, 0x0b, 0x4f, + 0xcd, 0xc9, 0xf1, 0xce, 0xcb, 0x2f, 0xcf, 0x0b, 0x01, 0xa9, 0x4c, 0x62, 0x03, 0x9b, 0x65, 0x0c, + 0x08, 0x00, 0x00, 0xff, 0xff, 0x31, 0x55, 0x64, 0x90, 0x0a, 0x02, 0x00, 0x00, +} diff --git a/vendor/github.com/golang/protobuf/LICENSE b/vendor/github.com/golang/protobuf/LICENSE index 1b1b1921efa6..0f646931a462 100644 --- a/vendor/github.com/golang/protobuf/LICENSE +++ b/vendor/github.com/golang/protobuf/LICENSE @@ -1,7 +1,4 @@ -Go support for Protocol Buffers - Google's data interchange format - Copyright 2010 The Go Authors. All rights reserved. -https://github.com/golang/protobuf Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are diff --git a/vendor/github.com/golang/protobuf/protoc-gen-go/descriptor/descriptor.pb.go b/vendor/github.com/golang/protobuf/protoc-gen-go/descriptor/descriptor.pb.go new file mode 100644 index 000000000000..a560e9e91bc8 --- /dev/null +++ b/vendor/github.com/golang/protobuf/protoc-gen-go/descriptor/descriptor.pb.go @@ -0,0 +1,2863 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: google/protobuf/descriptor.proto + +package descriptor + +import ( + fmt "fmt" + proto "github.com/golang/protobuf/proto" + math "math" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + +type FieldDescriptorProto_Type int32 + +const ( + // 0 is reserved for errors. + // Order is weird for historical reasons. + FieldDescriptorProto_TYPE_DOUBLE FieldDescriptorProto_Type = 1 + FieldDescriptorProto_TYPE_FLOAT FieldDescriptorProto_Type = 2 + // Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT64 if + // negative values are likely. + FieldDescriptorProto_TYPE_INT64 FieldDescriptorProto_Type = 3 + FieldDescriptorProto_TYPE_UINT64 FieldDescriptorProto_Type = 4 + // Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT32 if + // negative values are likely. + FieldDescriptorProto_TYPE_INT32 FieldDescriptorProto_Type = 5 + FieldDescriptorProto_TYPE_FIXED64 FieldDescriptorProto_Type = 6 + FieldDescriptorProto_TYPE_FIXED32 FieldDescriptorProto_Type = 7 + FieldDescriptorProto_TYPE_BOOL FieldDescriptorProto_Type = 8 + FieldDescriptorProto_TYPE_STRING FieldDescriptorProto_Type = 9 + // Tag-delimited aggregate. + // Group type is deprecated and not supported in proto3. However, Proto3 + // implementations should still be able to parse the group wire format and + // treat group fields as unknown fields. + FieldDescriptorProto_TYPE_GROUP FieldDescriptorProto_Type = 10 + FieldDescriptorProto_TYPE_MESSAGE FieldDescriptorProto_Type = 11 + // New in version 2. + FieldDescriptorProto_TYPE_BYTES FieldDescriptorProto_Type = 12 + FieldDescriptorProto_TYPE_UINT32 FieldDescriptorProto_Type = 13 + FieldDescriptorProto_TYPE_ENUM FieldDescriptorProto_Type = 14 + FieldDescriptorProto_TYPE_SFIXED32 FieldDescriptorProto_Type = 15 + FieldDescriptorProto_TYPE_SFIXED64 FieldDescriptorProto_Type = 16 + FieldDescriptorProto_TYPE_SINT32 FieldDescriptorProto_Type = 17 + FieldDescriptorProto_TYPE_SINT64 FieldDescriptorProto_Type = 18 +) + +var FieldDescriptorProto_Type_name = map[int32]string{ + 1: "TYPE_DOUBLE", + 2: "TYPE_FLOAT", + 3: "TYPE_INT64", + 4: "TYPE_UINT64", + 5: "TYPE_INT32", + 6: "TYPE_FIXED64", + 7: "TYPE_FIXED32", + 8: "TYPE_BOOL", + 9: "TYPE_STRING", + 10: "TYPE_GROUP", + 11: "TYPE_MESSAGE", + 12: "TYPE_BYTES", + 13: "TYPE_UINT32", + 14: "TYPE_ENUM", + 15: "TYPE_SFIXED32", + 16: "TYPE_SFIXED64", + 17: "TYPE_SINT32", + 18: "TYPE_SINT64", +} + +var FieldDescriptorProto_Type_value = map[string]int32{ + "TYPE_DOUBLE": 1, + "TYPE_FLOAT": 2, + "TYPE_INT64": 3, + "TYPE_UINT64": 4, + "TYPE_INT32": 5, + "TYPE_FIXED64": 6, + "TYPE_FIXED32": 7, + "TYPE_BOOL": 8, + "TYPE_STRING": 9, + "TYPE_GROUP": 10, + "TYPE_MESSAGE": 11, + "TYPE_BYTES": 12, + "TYPE_UINT32": 13, + "TYPE_ENUM": 14, + "TYPE_SFIXED32": 15, + "TYPE_SFIXED64": 16, + "TYPE_SINT32": 17, + "TYPE_SINT64": 18, +} + +func (x FieldDescriptorProto_Type) Enum() *FieldDescriptorProto_Type { + p := new(FieldDescriptorProto_Type) + *p = x + return p +} + +func (x FieldDescriptorProto_Type) String() string { + return proto.EnumName(FieldDescriptorProto_Type_name, int32(x)) +} + +func (x *FieldDescriptorProto_Type) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(FieldDescriptorProto_Type_value, data, "FieldDescriptorProto_Type") + if err != nil { + return err + } + *x = FieldDescriptorProto_Type(value) + return nil +} + +func (FieldDescriptorProto_Type) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_e5baabe45344a177, []int{4, 0} +} + +type FieldDescriptorProto_Label int32 + +const ( + // 0 is reserved for errors + FieldDescriptorProto_LABEL_OPTIONAL FieldDescriptorProto_Label = 1 + FieldDescriptorProto_LABEL_REQUIRED FieldDescriptorProto_Label = 2 + FieldDescriptorProto_LABEL_REPEATED FieldDescriptorProto_Label = 3 +) + +var FieldDescriptorProto_Label_name = map[int32]string{ + 1: "LABEL_OPTIONAL", + 2: "LABEL_REQUIRED", + 3: "LABEL_REPEATED", +} + +var FieldDescriptorProto_Label_value = map[string]int32{ + "LABEL_OPTIONAL": 1, + "LABEL_REQUIRED": 2, + "LABEL_REPEATED": 3, +} + +func (x FieldDescriptorProto_Label) Enum() *FieldDescriptorProto_Label { + p := new(FieldDescriptorProto_Label) + *p = x + return p +} + +func (x FieldDescriptorProto_Label) String() string { + return proto.EnumName(FieldDescriptorProto_Label_name, int32(x)) +} + +func (x *FieldDescriptorProto_Label) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(FieldDescriptorProto_Label_value, data, "FieldDescriptorProto_Label") + if err != nil { + return err + } + *x = FieldDescriptorProto_Label(value) + return nil +} + +func (FieldDescriptorProto_Label) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_e5baabe45344a177, []int{4, 1} +} + +// Generated classes can be optimized for speed or code size. +type FileOptions_OptimizeMode int32 + +const ( + FileOptions_SPEED FileOptions_OptimizeMode = 1 + // etc. + FileOptions_CODE_SIZE FileOptions_OptimizeMode = 2 + FileOptions_LITE_RUNTIME FileOptions_OptimizeMode = 3 +) + +var FileOptions_OptimizeMode_name = map[int32]string{ + 1: "SPEED", + 2: "CODE_SIZE", + 3: "LITE_RUNTIME", +} + +var FileOptions_OptimizeMode_value = map[string]int32{ + "SPEED": 1, + "CODE_SIZE": 2, + "LITE_RUNTIME": 3, +} + +func (x FileOptions_OptimizeMode) Enum() *FileOptions_OptimizeMode { + p := new(FileOptions_OptimizeMode) + *p = x + return p +} + +func (x FileOptions_OptimizeMode) String() string { + return proto.EnumName(FileOptions_OptimizeMode_name, int32(x)) +} + +func (x *FileOptions_OptimizeMode) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(FileOptions_OptimizeMode_value, data, "FileOptions_OptimizeMode") + if err != nil { + return err + } + *x = FileOptions_OptimizeMode(value) + return nil +} + +func (FileOptions_OptimizeMode) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_e5baabe45344a177, []int{10, 0} +} + +type FieldOptions_CType int32 + +const ( + // Default mode. + FieldOptions_STRING FieldOptions_CType = 0 + FieldOptions_CORD FieldOptions_CType = 1 + FieldOptions_STRING_PIECE FieldOptions_CType = 2 +) + +var FieldOptions_CType_name = map[int32]string{ + 0: "STRING", + 1: "CORD", + 2: "STRING_PIECE", +} + +var FieldOptions_CType_value = map[string]int32{ + "STRING": 0, + "CORD": 1, + "STRING_PIECE": 2, +} + +func (x FieldOptions_CType) Enum() *FieldOptions_CType { + p := new(FieldOptions_CType) + *p = x + return p +} + +func (x FieldOptions_CType) String() string { + return proto.EnumName(FieldOptions_CType_name, int32(x)) +} + +func (x *FieldOptions_CType) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(FieldOptions_CType_value, data, "FieldOptions_CType") + if err != nil { + return err + } + *x = FieldOptions_CType(value) + return nil +} + +func (FieldOptions_CType) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_e5baabe45344a177, []int{12, 0} +} + +type FieldOptions_JSType int32 + +const ( + // Use the default type. + FieldOptions_JS_NORMAL FieldOptions_JSType = 0 + // Use JavaScript strings. + FieldOptions_JS_STRING FieldOptions_JSType = 1 + // Use JavaScript numbers. + FieldOptions_JS_NUMBER FieldOptions_JSType = 2 +) + +var FieldOptions_JSType_name = map[int32]string{ + 0: "JS_NORMAL", + 1: "JS_STRING", + 2: "JS_NUMBER", +} + +var FieldOptions_JSType_value = map[string]int32{ + "JS_NORMAL": 0, + "JS_STRING": 1, + "JS_NUMBER": 2, +} + +func (x FieldOptions_JSType) Enum() *FieldOptions_JSType { + p := new(FieldOptions_JSType) + *p = x + return p +} + +func (x FieldOptions_JSType) String() string { + return proto.EnumName(FieldOptions_JSType_name, int32(x)) +} + +func (x *FieldOptions_JSType) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(FieldOptions_JSType_value, data, "FieldOptions_JSType") + if err != nil { + return err + } + *x = FieldOptions_JSType(value) + return nil +} + +func (FieldOptions_JSType) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_e5baabe45344a177, []int{12, 1} +} + +// Is this method side-effect-free (or safe in HTTP parlance), or idempotent, +// or neither? HTTP based RPC implementation may choose GET verb for safe +// methods, and PUT verb for idempotent methods instead of the default POST. +type MethodOptions_IdempotencyLevel int32 + +const ( + MethodOptions_IDEMPOTENCY_UNKNOWN MethodOptions_IdempotencyLevel = 0 + MethodOptions_NO_SIDE_EFFECTS MethodOptions_IdempotencyLevel = 1 + MethodOptions_IDEMPOTENT MethodOptions_IdempotencyLevel = 2 +) + +var MethodOptions_IdempotencyLevel_name = map[int32]string{ + 0: "IDEMPOTENCY_UNKNOWN", + 1: "NO_SIDE_EFFECTS", + 2: "IDEMPOTENT", +} + +var MethodOptions_IdempotencyLevel_value = map[string]int32{ + "IDEMPOTENCY_UNKNOWN": 0, + "NO_SIDE_EFFECTS": 1, + "IDEMPOTENT": 2, +} + +func (x MethodOptions_IdempotencyLevel) Enum() *MethodOptions_IdempotencyLevel { + p := new(MethodOptions_IdempotencyLevel) + *p = x + return p +} + +func (x MethodOptions_IdempotencyLevel) String() string { + return proto.EnumName(MethodOptions_IdempotencyLevel_name, int32(x)) +} + +func (x *MethodOptions_IdempotencyLevel) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(MethodOptions_IdempotencyLevel_value, data, "MethodOptions_IdempotencyLevel") + if err != nil { + return err + } + *x = MethodOptions_IdempotencyLevel(value) + return nil +} + +func (MethodOptions_IdempotencyLevel) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_e5baabe45344a177, []int{17, 0} +} + +// The protocol compiler can output a FileDescriptorSet containing the .proto +// files it parses. +type FileDescriptorSet struct { + File []*FileDescriptorProto `protobuf:"bytes,1,rep,name=file" json:"file,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *FileDescriptorSet) Reset() { *m = FileDescriptorSet{} } +func (m *FileDescriptorSet) String() string { return proto.CompactTextString(m) } +func (*FileDescriptorSet) ProtoMessage() {} +func (*FileDescriptorSet) Descriptor() ([]byte, []int) { + return fileDescriptor_e5baabe45344a177, []int{0} +} + +func (m *FileDescriptorSet) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_FileDescriptorSet.Unmarshal(m, b) +} +func (m *FileDescriptorSet) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_FileDescriptorSet.Marshal(b, m, deterministic) +} +func (m *FileDescriptorSet) XXX_Merge(src proto.Message) { + xxx_messageInfo_FileDescriptorSet.Merge(m, src) +} +func (m *FileDescriptorSet) XXX_Size() int { + return xxx_messageInfo_FileDescriptorSet.Size(m) +} +func (m *FileDescriptorSet) XXX_DiscardUnknown() { + xxx_messageInfo_FileDescriptorSet.DiscardUnknown(m) +} + +var xxx_messageInfo_FileDescriptorSet proto.InternalMessageInfo + +func (m *FileDescriptorSet) GetFile() []*FileDescriptorProto { + if m != nil { + return m.File + } + return nil +} + +// Describes a complete .proto file. +type FileDescriptorProto struct { + Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + Package *string `protobuf:"bytes,2,opt,name=package" json:"package,omitempty"` + // Names of files imported by this file. + Dependency []string `protobuf:"bytes,3,rep,name=dependency" json:"dependency,omitempty"` + // Indexes of the public imported files in the dependency list above. + PublicDependency []int32 `protobuf:"varint,10,rep,name=public_dependency,json=publicDependency" json:"public_dependency,omitempty"` + // Indexes of the weak imported files in the dependency list. + // For Google-internal migration only. Do not use. + WeakDependency []int32 `protobuf:"varint,11,rep,name=weak_dependency,json=weakDependency" json:"weak_dependency,omitempty"` + // All top-level definitions in this file. + MessageType []*DescriptorProto `protobuf:"bytes,4,rep,name=message_type,json=messageType" json:"message_type,omitempty"` + EnumType []*EnumDescriptorProto `protobuf:"bytes,5,rep,name=enum_type,json=enumType" json:"enum_type,omitempty"` + Service []*ServiceDescriptorProto `protobuf:"bytes,6,rep,name=service" json:"service,omitempty"` + Extension []*FieldDescriptorProto `protobuf:"bytes,7,rep,name=extension" json:"extension,omitempty"` + Options *FileOptions `protobuf:"bytes,8,opt,name=options" json:"options,omitempty"` + // This field contains optional information about the original source code. + // You may safely remove this entire field without harming runtime + // functionality of the descriptors -- the information is needed only by + // development tools. + SourceCodeInfo *SourceCodeInfo `protobuf:"bytes,9,opt,name=source_code_info,json=sourceCodeInfo" json:"source_code_info,omitempty"` + // The syntax of the proto file. + // The supported values are "proto2" and "proto3". + Syntax *string `protobuf:"bytes,12,opt,name=syntax" json:"syntax,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *FileDescriptorProto) Reset() { *m = FileDescriptorProto{} } +func (m *FileDescriptorProto) String() string { return proto.CompactTextString(m) } +func (*FileDescriptorProto) ProtoMessage() {} +func (*FileDescriptorProto) Descriptor() ([]byte, []int) { + return fileDescriptor_e5baabe45344a177, []int{1} +} + +func (m *FileDescriptorProto) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_FileDescriptorProto.Unmarshal(m, b) +} +func (m *FileDescriptorProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_FileDescriptorProto.Marshal(b, m, deterministic) +} +func (m *FileDescriptorProto) XXX_Merge(src proto.Message) { + xxx_messageInfo_FileDescriptorProto.Merge(m, src) +} +func (m *FileDescriptorProto) XXX_Size() int { + return xxx_messageInfo_FileDescriptorProto.Size(m) +} +func (m *FileDescriptorProto) XXX_DiscardUnknown() { + xxx_messageInfo_FileDescriptorProto.DiscardUnknown(m) +} + +var xxx_messageInfo_FileDescriptorProto proto.InternalMessageInfo + +func (m *FileDescriptorProto) GetName() string { + if m != nil && m.Name != nil { + return *m.Name + } + return "" +} + +func (m *FileDescriptorProto) GetPackage() string { + if m != nil && m.Package != nil { + return *m.Package + } + return "" +} + +func (m *FileDescriptorProto) GetDependency() []string { + if m != nil { + return m.Dependency + } + return nil +} + +func (m *FileDescriptorProto) GetPublicDependency() []int32 { + if m != nil { + return m.PublicDependency + } + return nil +} + +func (m *FileDescriptorProto) GetWeakDependency() []int32 { + if m != nil { + return m.WeakDependency + } + return nil +} + +func (m *FileDescriptorProto) GetMessageType() []*DescriptorProto { + if m != nil { + return m.MessageType + } + return nil +} + +func (m *FileDescriptorProto) GetEnumType() []*EnumDescriptorProto { + if m != nil { + return m.EnumType + } + return nil +} + +func (m *FileDescriptorProto) GetService() []*ServiceDescriptorProto { + if m != nil { + return m.Service + } + return nil +} + +func (m *FileDescriptorProto) GetExtension() []*FieldDescriptorProto { + if m != nil { + return m.Extension + } + return nil +} + +func (m *FileDescriptorProto) GetOptions() *FileOptions { + if m != nil { + return m.Options + } + return nil +} + +func (m *FileDescriptorProto) GetSourceCodeInfo() *SourceCodeInfo { + if m != nil { + return m.SourceCodeInfo + } + return nil +} + +func (m *FileDescriptorProto) GetSyntax() string { + if m != nil && m.Syntax != nil { + return *m.Syntax + } + return "" +} + +// Describes a message type. +type DescriptorProto struct { + Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + Field []*FieldDescriptorProto `protobuf:"bytes,2,rep,name=field" json:"field,omitempty"` + Extension []*FieldDescriptorProto `protobuf:"bytes,6,rep,name=extension" json:"extension,omitempty"` + NestedType []*DescriptorProto `protobuf:"bytes,3,rep,name=nested_type,json=nestedType" json:"nested_type,omitempty"` + EnumType []*EnumDescriptorProto `protobuf:"bytes,4,rep,name=enum_type,json=enumType" json:"enum_type,omitempty"` + ExtensionRange []*DescriptorProto_ExtensionRange `protobuf:"bytes,5,rep,name=extension_range,json=extensionRange" json:"extension_range,omitempty"` + OneofDecl []*OneofDescriptorProto `protobuf:"bytes,8,rep,name=oneof_decl,json=oneofDecl" json:"oneof_decl,omitempty"` + Options *MessageOptions `protobuf:"bytes,7,opt,name=options" json:"options,omitempty"` + ReservedRange []*DescriptorProto_ReservedRange `protobuf:"bytes,9,rep,name=reserved_range,json=reservedRange" json:"reserved_range,omitempty"` + // Reserved field names, which may not be used by fields in the same message. + // A given name may only be reserved once. + ReservedName []string `protobuf:"bytes,10,rep,name=reserved_name,json=reservedName" json:"reserved_name,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *DescriptorProto) Reset() { *m = DescriptorProto{} } +func (m *DescriptorProto) String() string { return proto.CompactTextString(m) } +func (*DescriptorProto) ProtoMessage() {} +func (*DescriptorProto) Descriptor() ([]byte, []int) { + return fileDescriptor_e5baabe45344a177, []int{2} +} + +func (m *DescriptorProto) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_DescriptorProto.Unmarshal(m, b) +} +func (m *DescriptorProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_DescriptorProto.Marshal(b, m, deterministic) +} +func (m *DescriptorProto) XXX_Merge(src proto.Message) { + xxx_messageInfo_DescriptorProto.Merge(m, src) +} +func (m *DescriptorProto) XXX_Size() int { + return xxx_messageInfo_DescriptorProto.Size(m) +} +func (m *DescriptorProto) XXX_DiscardUnknown() { + xxx_messageInfo_DescriptorProto.DiscardUnknown(m) +} + +var xxx_messageInfo_DescriptorProto proto.InternalMessageInfo + +func (m *DescriptorProto) GetName() string { + if m != nil && m.Name != nil { + return *m.Name + } + return "" +} + +func (m *DescriptorProto) GetField() []*FieldDescriptorProto { + if m != nil { + return m.Field + } + return nil +} + +func (m *DescriptorProto) GetExtension() []*FieldDescriptorProto { + if m != nil { + return m.Extension + } + return nil +} + +func (m *DescriptorProto) GetNestedType() []*DescriptorProto { + if m != nil { + return m.NestedType + } + return nil +} + +func (m *DescriptorProto) GetEnumType() []*EnumDescriptorProto { + if m != nil { + return m.EnumType + } + return nil +} + +func (m *DescriptorProto) GetExtensionRange() []*DescriptorProto_ExtensionRange { + if m != nil { + return m.ExtensionRange + } + return nil +} + +func (m *DescriptorProto) GetOneofDecl() []*OneofDescriptorProto { + if m != nil { + return m.OneofDecl + } + return nil +} + +func (m *DescriptorProto) GetOptions() *MessageOptions { + if m != nil { + return m.Options + } + return nil +} + +func (m *DescriptorProto) GetReservedRange() []*DescriptorProto_ReservedRange { + if m != nil { + return m.ReservedRange + } + return nil +} + +func (m *DescriptorProto) GetReservedName() []string { + if m != nil { + return m.ReservedName + } + return nil +} + +type DescriptorProto_ExtensionRange struct { + Start *int32 `protobuf:"varint,1,opt,name=start" json:"start,omitempty"` + End *int32 `protobuf:"varint,2,opt,name=end" json:"end,omitempty"` + Options *ExtensionRangeOptions `protobuf:"bytes,3,opt,name=options" json:"options,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *DescriptorProto_ExtensionRange) Reset() { *m = DescriptorProto_ExtensionRange{} } +func (m *DescriptorProto_ExtensionRange) String() string { return proto.CompactTextString(m) } +func (*DescriptorProto_ExtensionRange) ProtoMessage() {} +func (*DescriptorProto_ExtensionRange) Descriptor() ([]byte, []int) { + return fileDescriptor_e5baabe45344a177, []int{2, 0} +} + +func (m *DescriptorProto_ExtensionRange) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_DescriptorProto_ExtensionRange.Unmarshal(m, b) +} +func (m *DescriptorProto_ExtensionRange) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_DescriptorProto_ExtensionRange.Marshal(b, m, deterministic) +} +func (m *DescriptorProto_ExtensionRange) XXX_Merge(src proto.Message) { + xxx_messageInfo_DescriptorProto_ExtensionRange.Merge(m, src) +} +func (m *DescriptorProto_ExtensionRange) XXX_Size() int { + return xxx_messageInfo_DescriptorProto_ExtensionRange.Size(m) +} +func (m *DescriptorProto_ExtensionRange) XXX_DiscardUnknown() { + xxx_messageInfo_DescriptorProto_ExtensionRange.DiscardUnknown(m) +} + +var xxx_messageInfo_DescriptorProto_ExtensionRange proto.InternalMessageInfo + +func (m *DescriptorProto_ExtensionRange) GetStart() int32 { + if m != nil && m.Start != nil { + return *m.Start + } + return 0 +} + +func (m *DescriptorProto_ExtensionRange) GetEnd() int32 { + if m != nil && m.End != nil { + return *m.End + } + return 0 +} + +func (m *DescriptorProto_ExtensionRange) GetOptions() *ExtensionRangeOptions { + if m != nil { + return m.Options + } + return nil +} + +// Range of reserved tag numbers. Reserved tag numbers may not be used by +// fields or extension ranges in the same message. Reserved ranges may +// not overlap. +type DescriptorProto_ReservedRange struct { + Start *int32 `protobuf:"varint,1,opt,name=start" json:"start,omitempty"` + End *int32 `protobuf:"varint,2,opt,name=end" json:"end,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *DescriptorProto_ReservedRange) Reset() { *m = DescriptorProto_ReservedRange{} } +func (m *DescriptorProto_ReservedRange) String() string { return proto.CompactTextString(m) } +func (*DescriptorProto_ReservedRange) ProtoMessage() {} +func (*DescriptorProto_ReservedRange) Descriptor() ([]byte, []int) { + return fileDescriptor_e5baabe45344a177, []int{2, 1} +} + +func (m *DescriptorProto_ReservedRange) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_DescriptorProto_ReservedRange.Unmarshal(m, b) +} +func (m *DescriptorProto_ReservedRange) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_DescriptorProto_ReservedRange.Marshal(b, m, deterministic) +} +func (m *DescriptorProto_ReservedRange) XXX_Merge(src proto.Message) { + xxx_messageInfo_DescriptorProto_ReservedRange.Merge(m, src) +} +func (m *DescriptorProto_ReservedRange) XXX_Size() int { + return xxx_messageInfo_DescriptorProto_ReservedRange.Size(m) +} +func (m *DescriptorProto_ReservedRange) XXX_DiscardUnknown() { + xxx_messageInfo_DescriptorProto_ReservedRange.DiscardUnknown(m) +} + +var xxx_messageInfo_DescriptorProto_ReservedRange proto.InternalMessageInfo + +func (m *DescriptorProto_ReservedRange) GetStart() int32 { + if m != nil && m.Start != nil { + return *m.Start + } + return 0 +} + +func (m *DescriptorProto_ReservedRange) GetEnd() int32 { + if m != nil && m.End != nil { + return *m.End + } + return 0 +} + +type ExtensionRangeOptions struct { + // The parser stores options it doesn't recognize here. See above. + UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + proto.XXX_InternalExtensions `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ExtensionRangeOptions) Reset() { *m = ExtensionRangeOptions{} } +func (m *ExtensionRangeOptions) String() string { return proto.CompactTextString(m) } +func (*ExtensionRangeOptions) ProtoMessage() {} +func (*ExtensionRangeOptions) Descriptor() ([]byte, []int) { + return fileDescriptor_e5baabe45344a177, []int{3} +} + +var extRange_ExtensionRangeOptions = []proto.ExtensionRange{ + {Start: 1000, End: 536870911}, +} + +func (*ExtensionRangeOptions) ExtensionRangeArray() []proto.ExtensionRange { + return extRange_ExtensionRangeOptions +} + +func (m *ExtensionRangeOptions) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ExtensionRangeOptions.Unmarshal(m, b) +} +func (m *ExtensionRangeOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ExtensionRangeOptions.Marshal(b, m, deterministic) +} +func (m *ExtensionRangeOptions) XXX_Merge(src proto.Message) { + xxx_messageInfo_ExtensionRangeOptions.Merge(m, src) +} +func (m *ExtensionRangeOptions) XXX_Size() int { + return xxx_messageInfo_ExtensionRangeOptions.Size(m) +} +func (m *ExtensionRangeOptions) XXX_DiscardUnknown() { + xxx_messageInfo_ExtensionRangeOptions.DiscardUnknown(m) +} + +var xxx_messageInfo_ExtensionRangeOptions proto.InternalMessageInfo + +func (m *ExtensionRangeOptions) GetUninterpretedOption() []*UninterpretedOption { + if m != nil { + return m.UninterpretedOption + } + return nil +} + +// Describes a field within a message. +type FieldDescriptorProto struct { + Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + Number *int32 `protobuf:"varint,3,opt,name=number" json:"number,omitempty"` + Label *FieldDescriptorProto_Label `protobuf:"varint,4,opt,name=label,enum=google.protobuf.FieldDescriptorProto_Label" json:"label,omitempty"` + // If type_name is set, this need not be set. If both this and type_name + // are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP. + Type *FieldDescriptorProto_Type `protobuf:"varint,5,opt,name=type,enum=google.protobuf.FieldDescriptorProto_Type" json:"type,omitempty"` + // For message and enum types, this is the name of the type. If the name + // starts with a '.', it is fully-qualified. Otherwise, C++-like scoping + // rules are used to find the type (i.e. first the nested types within this + // message are searched, then within the parent, on up to the root + // namespace). + TypeName *string `protobuf:"bytes,6,opt,name=type_name,json=typeName" json:"type_name,omitempty"` + // For extensions, this is the name of the type being extended. It is + // resolved in the same manner as type_name. + Extendee *string `protobuf:"bytes,2,opt,name=extendee" json:"extendee,omitempty"` + // For numeric types, contains the original text representation of the value. + // For booleans, "true" or "false". + // For strings, contains the default text contents (not escaped in any way). + // For bytes, contains the C escaped value. All bytes >= 128 are escaped. + // TODO(kenton): Base-64 encode? + DefaultValue *string `protobuf:"bytes,7,opt,name=default_value,json=defaultValue" json:"default_value,omitempty"` + // If set, gives the index of a oneof in the containing type's oneof_decl + // list. This field is a member of that oneof. + OneofIndex *int32 `protobuf:"varint,9,opt,name=oneof_index,json=oneofIndex" json:"oneof_index,omitempty"` + // JSON name of this field. The value is set by protocol compiler. If the + // user has set a "json_name" option on this field, that option's value + // will be used. Otherwise, it's deduced from the field's name by converting + // it to camelCase. + JsonName *string `protobuf:"bytes,10,opt,name=json_name,json=jsonName" json:"json_name,omitempty"` + Options *FieldOptions `protobuf:"bytes,8,opt,name=options" json:"options,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *FieldDescriptorProto) Reset() { *m = FieldDescriptorProto{} } +func (m *FieldDescriptorProto) String() string { return proto.CompactTextString(m) } +func (*FieldDescriptorProto) ProtoMessage() {} +func (*FieldDescriptorProto) Descriptor() ([]byte, []int) { + return fileDescriptor_e5baabe45344a177, []int{4} +} + +func (m *FieldDescriptorProto) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_FieldDescriptorProto.Unmarshal(m, b) +} +func (m *FieldDescriptorProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_FieldDescriptorProto.Marshal(b, m, deterministic) +} +func (m *FieldDescriptorProto) XXX_Merge(src proto.Message) { + xxx_messageInfo_FieldDescriptorProto.Merge(m, src) +} +func (m *FieldDescriptorProto) XXX_Size() int { + return xxx_messageInfo_FieldDescriptorProto.Size(m) +} +func (m *FieldDescriptorProto) XXX_DiscardUnknown() { + xxx_messageInfo_FieldDescriptorProto.DiscardUnknown(m) +} + +var xxx_messageInfo_FieldDescriptorProto proto.InternalMessageInfo + +func (m *FieldDescriptorProto) GetName() string { + if m != nil && m.Name != nil { + return *m.Name + } + return "" +} + +func (m *FieldDescriptorProto) GetNumber() int32 { + if m != nil && m.Number != nil { + return *m.Number + } + return 0 +} + +func (m *FieldDescriptorProto) GetLabel() FieldDescriptorProto_Label { + if m != nil && m.Label != nil { + return *m.Label + } + return FieldDescriptorProto_LABEL_OPTIONAL +} + +func (m *FieldDescriptorProto) GetType() FieldDescriptorProto_Type { + if m != nil && m.Type != nil { + return *m.Type + } + return FieldDescriptorProto_TYPE_DOUBLE +} + +func (m *FieldDescriptorProto) GetTypeName() string { + if m != nil && m.TypeName != nil { + return *m.TypeName + } + return "" +} + +func (m *FieldDescriptorProto) GetExtendee() string { + if m != nil && m.Extendee != nil { + return *m.Extendee + } + return "" +} + +func (m *FieldDescriptorProto) GetDefaultValue() string { + if m != nil && m.DefaultValue != nil { + return *m.DefaultValue + } + return "" +} + +func (m *FieldDescriptorProto) GetOneofIndex() int32 { + if m != nil && m.OneofIndex != nil { + return *m.OneofIndex + } + return 0 +} + +func (m *FieldDescriptorProto) GetJsonName() string { + if m != nil && m.JsonName != nil { + return *m.JsonName + } + return "" +} + +func (m *FieldDescriptorProto) GetOptions() *FieldOptions { + if m != nil { + return m.Options + } + return nil +} + +// Describes a oneof. +type OneofDescriptorProto struct { + Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + Options *OneofOptions `protobuf:"bytes,2,opt,name=options" json:"options,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *OneofDescriptorProto) Reset() { *m = OneofDescriptorProto{} } +func (m *OneofDescriptorProto) String() string { return proto.CompactTextString(m) } +func (*OneofDescriptorProto) ProtoMessage() {} +func (*OneofDescriptorProto) Descriptor() ([]byte, []int) { + return fileDescriptor_e5baabe45344a177, []int{5} +} + +func (m *OneofDescriptorProto) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_OneofDescriptorProto.Unmarshal(m, b) +} +func (m *OneofDescriptorProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_OneofDescriptorProto.Marshal(b, m, deterministic) +} +func (m *OneofDescriptorProto) XXX_Merge(src proto.Message) { + xxx_messageInfo_OneofDescriptorProto.Merge(m, src) +} +func (m *OneofDescriptorProto) XXX_Size() int { + return xxx_messageInfo_OneofDescriptorProto.Size(m) +} +func (m *OneofDescriptorProto) XXX_DiscardUnknown() { + xxx_messageInfo_OneofDescriptorProto.DiscardUnknown(m) +} + +var xxx_messageInfo_OneofDescriptorProto proto.InternalMessageInfo + +func (m *OneofDescriptorProto) GetName() string { + if m != nil && m.Name != nil { + return *m.Name + } + return "" +} + +func (m *OneofDescriptorProto) GetOptions() *OneofOptions { + if m != nil { + return m.Options + } + return nil +} + +// Describes an enum type. +type EnumDescriptorProto struct { + Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + Value []*EnumValueDescriptorProto `protobuf:"bytes,2,rep,name=value" json:"value,omitempty"` + Options *EnumOptions `protobuf:"bytes,3,opt,name=options" json:"options,omitempty"` + // Range of reserved numeric values. Reserved numeric values may not be used + // by enum values in the same enum declaration. Reserved ranges may not + // overlap. + ReservedRange []*EnumDescriptorProto_EnumReservedRange `protobuf:"bytes,4,rep,name=reserved_range,json=reservedRange" json:"reserved_range,omitempty"` + // Reserved enum value names, which may not be reused. A given name may only + // be reserved once. + ReservedName []string `protobuf:"bytes,5,rep,name=reserved_name,json=reservedName" json:"reserved_name,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *EnumDescriptorProto) Reset() { *m = EnumDescriptorProto{} } +func (m *EnumDescriptorProto) String() string { return proto.CompactTextString(m) } +func (*EnumDescriptorProto) ProtoMessage() {} +func (*EnumDescriptorProto) Descriptor() ([]byte, []int) { + return fileDescriptor_e5baabe45344a177, []int{6} +} + +func (m *EnumDescriptorProto) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_EnumDescriptorProto.Unmarshal(m, b) +} +func (m *EnumDescriptorProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_EnumDescriptorProto.Marshal(b, m, deterministic) +} +func (m *EnumDescriptorProto) XXX_Merge(src proto.Message) { + xxx_messageInfo_EnumDescriptorProto.Merge(m, src) +} +func (m *EnumDescriptorProto) XXX_Size() int { + return xxx_messageInfo_EnumDescriptorProto.Size(m) +} +func (m *EnumDescriptorProto) XXX_DiscardUnknown() { + xxx_messageInfo_EnumDescriptorProto.DiscardUnknown(m) +} + +var xxx_messageInfo_EnumDescriptorProto proto.InternalMessageInfo + +func (m *EnumDescriptorProto) GetName() string { + if m != nil && m.Name != nil { + return *m.Name + } + return "" +} + +func (m *EnumDescriptorProto) GetValue() []*EnumValueDescriptorProto { + if m != nil { + return m.Value + } + return nil +} + +func (m *EnumDescriptorProto) GetOptions() *EnumOptions { + if m != nil { + return m.Options + } + return nil +} + +func (m *EnumDescriptorProto) GetReservedRange() []*EnumDescriptorProto_EnumReservedRange { + if m != nil { + return m.ReservedRange + } + return nil +} + +func (m *EnumDescriptorProto) GetReservedName() []string { + if m != nil { + return m.ReservedName + } + return nil +} + +// Range of reserved numeric values. Reserved values may not be used by +// entries in the same enum. Reserved ranges may not overlap. +// +// Note that this is distinct from DescriptorProto.ReservedRange in that it +// is inclusive such that it can appropriately represent the entire int32 +// domain. +type EnumDescriptorProto_EnumReservedRange struct { + Start *int32 `protobuf:"varint,1,opt,name=start" json:"start,omitempty"` + End *int32 `protobuf:"varint,2,opt,name=end" json:"end,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *EnumDescriptorProto_EnumReservedRange) Reset() { *m = EnumDescriptorProto_EnumReservedRange{} } +func (m *EnumDescriptorProto_EnumReservedRange) String() string { return proto.CompactTextString(m) } +func (*EnumDescriptorProto_EnumReservedRange) ProtoMessage() {} +func (*EnumDescriptorProto_EnumReservedRange) Descriptor() ([]byte, []int) { + return fileDescriptor_e5baabe45344a177, []int{6, 0} +} + +func (m *EnumDescriptorProto_EnumReservedRange) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_EnumDescriptorProto_EnumReservedRange.Unmarshal(m, b) +} +func (m *EnumDescriptorProto_EnumReservedRange) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_EnumDescriptorProto_EnumReservedRange.Marshal(b, m, deterministic) +} +func (m *EnumDescriptorProto_EnumReservedRange) XXX_Merge(src proto.Message) { + xxx_messageInfo_EnumDescriptorProto_EnumReservedRange.Merge(m, src) +} +func (m *EnumDescriptorProto_EnumReservedRange) XXX_Size() int { + return xxx_messageInfo_EnumDescriptorProto_EnumReservedRange.Size(m) +} +func (m *EnumDescriptorProto_EnumReservedRange) XXX_DiscardUnknown() { + xxx_messageInfo_EnumDescriptorProto_EnumReservedRange.DiscardUnknown(m) +} + +var xxx_messageInfo_EnumDescriptorProto_EnumReservedRange proto.InternalMessageInfo + +func (m *EnumDescriptorProto_EnumReservedRange) GetStart() int32 { + if m != nil && m.Start != nil { + return *m.Start + } + return 0 +} + +func (m *EnumDescriptorProto_EnumReservedRange) GetEnd() int32 { + if m != nil && m.End != nil { + return *m.End + } + return 0 +} + +// Describes a value within an enum. +type EnumValueDescriptorProto struct { + Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + Number *int32 `protobuf:"varint,2,opt,name=number" json:"number,omitempty"` + Options *EnumValueOptions `protobuf:"bytes,3,opt,name=options" json:"options,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *EnumValueDescriptorProto) Reset() { *m = EnumValueDescriptorProto{} } +func (m *EnumValueDescriptorProto) String() string { return proto.CompactTextString(m) } +func (*EnumValueDescriptorProto) ProtoMessage() {} +func (*EnumValueDescriptorProto) Descriptor() ([]byte, []int) { + return fileDescriptor_e5baabe45344a177, []int{7} +} + +func (m *EnumValueDescriptorProto) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_EnumValueDescriptorProto.Unmarshal(m, b) +} +func (m *EnumValueDescriptorProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_EnumValueDescriptorProto.Marshal(b, m, deterministic) +} +func (m *EnumValueDescriptorProto) XXX_Merge(src proto.Message) { + xxx_messageInfo_EnumValueDescriptorProto.Merge(m, src) +} +func (m *EnumValueDescriptorProto) XXX_Size() int { + return xxx_messageInfo_EnumValueDescriptorProto.Size(m) +} +func (m *EnumValueDescriptorProto) XXX_DiscardUnknown() { + xxx_messageInfo_EnumValueDescriptorProto.DiscardUnknown(m) +} + +var xxx_messageInfo_EnumValueDescriptorProto proto.InternalMessageInfo + +func (m *EnumValueDescriptorProto) GetName() string { + if m != nil && m.Name != nil { + return *m.Name + } + return "" +} + +func (m *EnumValueDescriptorProto) GetNumber() int32 { + if m != nil && m.Number != nil { + return *m.Number + } + return 0 +} + +func (m *EnumValueDescriptorProto) GetOptions() *EnumValueOptions { + if m != nil { + return m.Options + } + return nil +} + +// Describes a service. +type ServiceDescriptorProto struct { + Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + Method []*MethodDescriptorProto `protobuf:"bytes,2,rep,name=method" json:"method,omitempty"` + Options *ServiceOptions `protobuf:"bytes,3,opt,name=options" json:"options,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ServiceDescriptorProto) Reset() { *m = ServiceDescriptorProto{} } +func (m *ServiceDescriptorProto) String() string { return proto.CompactTextString(m) } +func (*ServiceDescriptorProto) ProtoMessage() {} +func (*ServiceDescriptorProto) Descriptor() ([]byte, []int) { + return fileDescriptor_e5baabe45344a177, []int{8} +} + +func (m *ServiceDescriptorProto) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ServiceDescriptorProto.Unmarshal(m, b) +} +func (m *ServiceDescriptorProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ServiceDescriptorProto.Marshal(b, m, deterministic) +} +func (m *ServiceDescriptorProto) XXX_Merge(src proto.Message) { + xxx_messageInfo_ServiceDescriptorProto.Merge(m, src) +} +func (m *ServiceDescriptorProto) XXX_Size() int { + return xxx_messageInfo_ServiceDescriptorProto.Size(m) +} +func (m *ServiceDescriptorProto) XXX_DiscardUnknown() { + xxx_messageInfo_ServiceDescriptorProto.DiscardUnknown(m) +} + +var xxx_messageInfo_ServiceDescriptorProto proto.InternalMessageInfo + +func (m *ServiceDescriptorProto) GetName() string { + if m != nil && m.Name != nil { + return *m.Name + } + return "" +} + +func (m *ServiceDescriptorProto) GetMethod() []*MethodDescriptorProto { + if m != nil { + return m.Method + } + return nil +} + +func (m *ServiceDescriptorProto) GetOptions() *ServiceOptions { + if m != nil { + return m.Options + } + return nil +} + +// Describes a method of a service. +type MethodDescriptorProto struct { + Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + // Input and output type names. These are resolved in the same way as + // FieldDescriptorProto.type_name, but must refer to a message type. + InputType *string `protobuf:"bytes,2,opt,name=input_type,json=inputType" json:"input_type,omitempty"` + OutputType *string `protobuf:"bytes,3,opt,name=output_type,json=outputType" json:"output_type,omitempty"` + Options *MethodOptions `protobuf:"bytes,4,opt,name=options" json:"options,omitempty"` + // Identifies if client streams multiple client messages + ClientStreaming *bool `protobuf:"varint,5,opt,name=client_streaming,json=clientStreaming,def=0" json:"client_streaming,omitempty"` + // Identifies if server streams multiple server messages + ServerStreaming *bool `protobuf:"varint,6,opt,name=server_streaming,json=serverStreaming,def=0" json:"server_streaming,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *MethodDescriptorProto) Reset() { *m = MethodDescriptorProto{} } +func (m *MethodDescriptorProto) String() string { return proto.CompactTextString(m) } +func (*MethodDescriptorProto) ProtoMessage() {} +func (*MethodDescriptorProto) Descriptor() ([]byte, []int) { + return fileDescriptor_e5baabe45344a177, []int{9} +} + +func (m *MethodDescriptorProto) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_MethodDescriptorProto.Unmarshal(m, b) +} +func (m *MethodDescriptorProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_MethodDescriptorProto.Marshal(b, m, deterministic) +} +func (m *MethodDescriptorProto) XXX_Merge(src proto.Message) { + xxx_messageInfo_MethodDescriptorProto.Merge(m, src) +} +func (m *MethodDescriptorProto) XXX_Size() int { + return xxx_messageInfo_MethodDescriptorProto.Size(m) +} +func (m *MethodDescriptorProto) XXX_DiscardUnknown() { + xxx_messageInfo_MethodDescriptorProto.DiscardUnknown(m) +} + +var xxx_messageInfo_MethodDescriptorProto proto.InternalMessageInfo + +const Default_MethodDescriptorProto_ClientStreaming bool = false +const Default_MethodDescriptorProto_ServerStreaming bool = false + +func (m *MethodDescriptorProto) GetName() string { + if m != nil && m.Name != nil { + return *m.Name + } + return "" +} + +func (m *MethodDescriptorProto) GetInputType() string { + if m != nil && m.InputType != nil { + return *m.InputType + } + return "" +} + +func (m *MethodDescriptorProto) GetOutputType() string { + if m != nil && m.OutputType != nil { + return *m.OutputType + } + return "" +} + +func (m *MethodDescriptorProto) GetOptions() *MethodOptions { + if m != nil { + return m.Options + } + return nil +} + +func (m *MethodDescriptorProto) GetClientStreaming() bool { + if m != nil && m.ClientStreaming != nil { + return *m.ClientStreaming + } + return Default_MethodDescriptorProto_ClientStreaming +} + +func (m *MethodDescriptorProto) GetServerStreaming() bool { + if m != nil && m.ServerStreaming != nil { + return *m.ServerStreaming + } + return Default_MethodDescriptorProto_ServerStreaming +} + +type FileOptions struct { + // Sets the Java package where classes generated from this .proto will be + // placed. By default, the proto package is used, but this is often + // inappropriate because proto packages do not normally start with backwards + // domain names. + JavaPackage *string `protobuf:"bytes,1,opt,name=java_package,json=javaPackage" json:"java_package,omitempty"` + // If set, all the classes from the .proto file are wrapped in a single + // outer class with the given name. This applies to both Proto1 + // (equivalent to the old "--one_java_file" option) and Proto2 (where + // a .proto always translates to a single class, but you may want to + // explicitly choose the class name). + JavaOuterClassname *string `protobuf:"bytes,8,opt,name=java_outer_classname,json=javaOuterClassname" json:"java_outer_classname,omitempty"` + // If set true, then the Java code generator will generate a separate .java + // file for each top-level message, enum, and service defined in the .proto + // file. Thus, these types will *not* be nested inside the outer class + // named by java_outer_classname. However, the outer class will still be + // generated to contain the file's getDescriptor() method as well as any + // top-level extensions defined in the file. + JavaMultipleFiles *bool `protobuf:"varint,10,opt,name=java_multiple_files,json=javaMultipleFiles,def=0" json:"java_multiple_files,omitempty"` + // This option does nothing. + JavaGenerateEqualsAndHash *bool `protobuf:"varint,20,opt,name=java_generate_equals_and_hash,json=javaGenerateEqualsAndHash" json:"java_generate_equals_and_hash,omitempty"` // Deprecated: Do not use. + // If set true, then the Java2 code generator will generate code that + // throws an exception whenever an attempt is made to assign a non-UTF-8 + // byte sequence to a string field. + // Message reflection will do the same. + // However, an extension field still accepts non-UTF-8 byte sequences. + // This option has no effect on when used with the lite runtime. + JavaStringCheckUtf8 *bool `protobuf:"varint,27,opt,name=java_string_check_utf8,json=javaStringCheckUtf8,def=0" json:"java_string_check_utf8,omitempty"` + OptimizeFor *FileOptions_OptimizeMode `protobuf:"varint,9,opt,name=optimize_for,json=optimizeFor,enum=google.protobuf.FileOptions_OptimizeMode,def=1" json:"optimize_for,omitempty"` + // Sets the Go package where structs generated from this .proto will be + // placed. If omitted, the Go package will be derived from the following: + // - The basename of the package import path, if provided. + // - Otherwise, the package statement in the .proto file, if present. + // - Otherwise, the basename of the .proto file, without extension. + GoPackage *string `protobuf:"bytes,11,opt,name=go_package,json=goPackage" json:"go_package,omitempty"` + // Should generic services be generated in each language? "Generic" services + // are not specific to any particular RPC system. They are generated by the + // main code generators in each language (without additional plugins). + // Generic services were the only kind of service generation supported by + // early versions of google.protobuf. + // + // Generic services are now considered deprecated in favor of using plugins + // that generate code specific to your particular RPC system. Therefore, + // these default to false. Old code which depends on generic services should + // explicitly set them to true. + CcGenericServices *bool `protobuf:"varint,16,opt,name=cc_generic_services,json=ccGenericServices,def=0" json:"cc_generic_services,omitempty"` + JavaGenericServices *bool `protobuf:"varint,17,opt,name=java_generic_services,json=javaGenericServices,def=0" json:"java_generic_services,omitempty"` + PyGenericServices *bool `protobuf:"varint,18,opt,name=py_generic_services,json=pyGenericServices,def=0" json:"py_generic_services,omitempty"` + PhpGenericServices *bool `protobuf:"varint,42,opt,name=php_generic_services,json=phpGenericServices,def=0" json:"php_generic_services,omitempty"` + // Is this file deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for everything in the file, or it will be completely ignored; in the very + // least, this is a formalization for deprecating files. + Deprecated *bool `protobuf:"varint,23,opt,name=deprecated,def=0" json:"deprecated,omitempty"` + // Enables the use of arenas for the proto messages in this file. This applies + // only to generated classes for C++. + CcEnableArenas *bool `protobuf:"varint,31,opt,name=cc_enable_arenas,json=ccEnableArenas,def=0" json:"cc_enable_arenas,omitempty"` + // Sets the objective c class prefix which is prepended to all objective c + // generated classes from this .proto. There is no default. + ObjcClassPrefix *string `protobuf:"bytes,36,opt,name=objc_class_prefix,json=objcClassPrefix" json:"objc_class_prefix,omitempty"` + // Namespace for generated classes; defaults to the package. + CsharpNamespace *string `protobuf:"bytes,37,opt,name=csharp_namespace,json=csharpNamespace" json:"csharp_namespace,omitempty"` + // By default Swift generators will take the proto package and CamelCase it + // replacing '.' with underscore and use that to prefix the types/symbols + // defined. When this options is provided, they will use this value instead + // to prefix the types/symbols defined. + SwiftPrefix *string `protobuf:"bytes,39,opt,name=swift_prefix,json=swiftPrefix" json:"swift_prefix,omitempty"` + // Sets the php class prefix which is prepended to all php generated classes + // from this .proto. Default is empty. + PhpClassPrefix *string `protobuf:"bytes,40,opt,name=php_class_prefix,json=phpClassPrefix" json:"php_class_prefix,omitempty"` + // Use this option to change the namespace of php generated classes. Default + // is empty. When this option is empty, the package name will be used for + // determining the namespace. + PhpNamespace *string `protobuf:"bytes,41,opt,name=php_namespace,json=phpNamespace" json:"php_namespace,omitempty"` + // The parser stores options it doesn't recognize here. + // See the documentation for the "Options" section above. + UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + proto.XXX_InternalExtensions `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *FileOptions) Reset() { *m = FileOptions{} } +func (m *FileOptions) String() string { return proto.CompactTextString(m) } +func (*FileOptions) ProtoMessage() {} +func (*FileOptions) Descriptor() ([]byte, []int) { + return fileDescriptor_e5baabe45344a177, []int{10} +} + +var extRange_FileOptions = []proto.ExtensionRange{ + {Start: 1000, End: 536870911}, +} + +func (*FileOptions) ExtensionRangeArray() []proto.ExtensionRange { + return extRange_FileOptions +} + +func (m *FileOptions) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_FileOptions.Unmarshal(m, b) +} +func (m *FileOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_FileOptions.Marshal(b, m, deterministic) +} +func (m *FileOptions) XXX_Merge(src proto.Message) { + xxx_messageInfo_FileOptions.Merge(m, src) +} +func (m *FileOptions) XXX_Size() int { + return xxx_messageInfo_FileOptions.Size(m) +} +func (m *FileOptions) XXX_DiscardUnknown() { + xxx_messageInfo_FileOptions.DiscardUnknown(m) +} + +var xxx_messageInfo_FileOptions proto.InternalMessageInfo + +const Default_FileOptions_JavaMultipleFiles bool = false +const Default_FileOptions_JavaStringCheckUtf8 bool = false +const Default_FileOptions_OptimizeFor FileOptions_OptimizeMode = FileOptions_SPEED +const Default_FileOptions_CcGenericServices bool = false +const Default_FileOptions_JavaGenericServices bool = false +const Default_FileOptions_PyGenericServices bool = false +const Default_FileOptions_PhpGenericServices bool = false +const Default_FileOptions_Deprecated bool = false +const Default_FileOptions_CcEnableArenas bool = false + +func (m *FileOptions) GetJavaPackage() string { + if m != nil && m.JavaPackage != nil { + return *m.JavaPackage + } + return "" +} + +func (m *FileOptions) GetJavaOuterClassname() string { + if m != nil && m.JavaOuterClassname != nil { + return *m.JavaOuterClassname + } + return "" +} + +func (m *FileOptions) GetJavaMultipleFiles() bool { + if m != nil && m.JavaMultipleFiles != nil { + return *m.JavaMultipleFiles + } + return Default_FileOptions_JavaMultipleFiles +} + +// Deprecated: Do not use. +func (m *FileOptions) GetJavaGenerateEqualsAndHash() bool { + if m != nil && m.JavaGenerateEqualsAndHash != nil { + return *m.JavaGenerateEqualsAndHash + } + return false +} + +func (m *FileOptions) GetJavaStringCheckUtf8() bool { + if m != nil && m.JavaStringCheckUtf8 != nil { + return *m.JavaStringCheckUtf8 + } + return Default_FileOptions_JavaStringCheckUtf8 +} + +func (m *FileOptions) GetOptimizeFor() FileOptions_OptimizeMode { + if m != nil && m.OptimizeFor != nil { + return *m.OptimizeFor + } + return Default_FileOptions_OptimizeFor +} + +func (m *FileOptions) GetGoPackage() string { + if m != nil && m.GoPackage != nil { + return *m.GoPackage + } + return "" +} + +func (m *FileOptions) GetCcGenericServices() bool { + if m != nil && m.CcGenericServices != nil { + return *m.CcGenericServices + } + return Default_FileOptions_CcGenericServices +} + +func (m *FileOptions) GetJavaGenericServices() bool { + if m != nil && m.JavaGenericServices != nil { + return *m.JavaGenericServices + } + return Default_FileOptions_JavaGenericServices +} + +func (m *FileOptions) GetPyGenericServices() bool { + if m != nil && m.PyGenericServices != nil { + return *m.PyGenericServices + } + return Default_FileOptions_PyGenericServices +} + +func (m *FileOptions) GetPhpGenericServices() bool { + if m != nil && m.PhpGenericServices != nil { + return *m.PhpGenericServices + } + return Default_FileOptions_PhpGenericServices +} + +func (m *FileOptions) GetDeprecated() bool { + if m != nil && m.Deprecated != nil { + return *m.Deprecated + } + return Default_FileOptions_Deprecated +} + +func (m *FileOptions) GetCcEnableArenas() bool { + if m != nil && m.CcEnableArenas != nil { + return *m.CcEnableArenas + } + return Default_FileOptions_CcEnableArenas +} + +func (m *FileOptions) GetObjcClassPrefix() string { + if m != nil && m.ObjcClassPrefix != nil { + return *m.ObjcClassPrefix + } + return "" +} + +func (m *FileOptions) GetCsharpNamespace() string { + if m != nil && m.CsharpNamespace != nil { + return *m.CsharpNamespace + } + return "" +} + +func (m *FileOptions) GetSwiftPrefix() string { + if m != nil && m.SwiftPrefix != nil { + return *m.SwiftPrefix + } + return "" +} + +func (m *FileOptions) GetPhpClassPrefix() string { + if m != nil && m.PhpClassPrefix != nil { + return *m.PhpClassPrefix + } + return "" +} + +func (m *FileOptions) GetPhpNamespace() string { + if m != nil && m.PhpNamespace != nil { + return *m.PhpNamespace + } + return "" +} + +func (m *FileOptions) GetUninterpretedOption() []*UninterpretedOption { + if m != nil { + return m.UninterpretedOption + } + return nil +} + +type MessageOptions struct { + // Set true to use the old proto1 MessageSet wire format for extensions. + // This is provided for backwards-compatibility with the MessageSet wire + // format. You should not use this for any other reason: It's less + // efficient, has fewer features, and is more complicated. + // + // The message must be defined exactly as follows: + // message Foo { + // option message_set_wire_format = true; + // extensions 4 to max; + // } + // Note that the message cannot have any defined fields; MessageSets only + // have extensions. + // + // All extensions of your type must be singular messages; e.g. they cannot + // be int32s, enums, or repeated messages. + // + // Because this is an option, the above two restrictions are not enforced by + // the protocol compiler. + MessageSetWireFormat *bool `protobuf:"varint,1,opt,name=message_set_wire_format,json=messageSetWireFormat,def=0" json:"message_set_wire_format,omitempty"` + // Disables the generation of the standard "descriptor()" accessor, which can + // conflict with a field of the same name. This is meant to make migration + // from proto1 easier; new code should avoid fields named "descriptor". + NoStandardDescriptorAccessor *bool `protobuf:"varint,2,opt,name=no_standard_descriptor_accessor,json=noStandardDescriptorAccessor,def=0" json:"no_standard_descriptor_accessor,omitempty"` + // Is this message deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for the message, or it will be completely ignored; in the very least, + // this is a formalization for deprecating messages. + Deprecated *bool `protobuf:"varint,3,opt,name=deprecated,def=0" json:"deprecated,omitempty"` + // Whether the message is an automatically generated map entry type for the + // maps field. + // + // For maps fields: + // map map_field = 1; + // The parsed descriptor looks like: + // message MapFieldEntry { + // option map_entry = true; + // optional KeyType key = 1; + // optional ValueType value = 2; + // } + // repeated MapFieldEntry map_field = 1; + // + // Implementations may choose not to generate the map_entry=true message, but + // use a native map in the target language to hold the keys and values. + // The reflection APIs in such implementions still need to work as + // if the field is a repeated message field. + // + // NOTE: Do not set the option in .proto files. Always use the maps syntax + // instead. The option should only be implicitly set by the proto compiler + // parser. + MapEntry *bool `protobuf:"varint,7,opt,name=map_entry,json=mapEntry" json:"map_entry,omitempty"` + // The parser stores options it doesn't recognize here. See above. + UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + proto.XXX_InternalExtensions `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *MessageOptions) Reset() { *m = MessageOptions{} } +func (m *MessageOptions) String() string { return proto.CompactTextString(m) } +func (*MessageOptions) ProtoMessage() {} +func (*MessageOptions) Descriptor() ([]byte, []int) { + return fileDescriptor_e5baabe45344a177, []int{11} +} + +var extRange_MessageOptions = []proto.ExtensionRange{ + {Start: 1000, End: 536870911}, +} + +func (*MessageOptions) ExtensionRangeArray() []proto.ExtensionRange { + return extRange_MessageOptions +} + +func (m *MessageOptions) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_MessageOptions.Unmarshal(m, b) +} +func (m *MessageOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_MessageOptions.Marshal(b, m, deterministic) +} +func (m *MessageOptions) XXX_Merge(src proto.Message) { + xxx_messageInfo_MessageOptions.Merge(m, src) +} +func (m *MessageOptions) XXX_Size() int { + return xxx_messageInfo_MessageOptions.Size(m) +} +func (m *MessageOptions) XXX_DiscardUnknown() { + xxx_messageInfo_MessageOptions.DiscardUnknown(m) +} + +var xxx_messageInfo_MessageOptions proto.InternalMessageInfo + +const Default_MessageOptions_MessageSetWireFormat bool = false +const Default_MessageOptions_NoStandardDescriptorAccessor bool = false +const Default_MessageOptions_Deprecated bool = false + +func (m *MessageOptions) GetMessageSetWireFormat() bool { + if m != nil && m.MessageSetWireFormat != nil { + return *m.MessageSetWireFormat + } + return Default_MessageOptions_MessageSetWireFormat +} + +func (m *MessageOptions) GetNoStandardDescriptorAccessor() bool { + if m != nil && m.NoStandardDescriptorAccessor != nil { + return *m.NoStandardDescriptorAccessor + } + return Default_MessageOptions_NoStandardDescriptorAccessor +} + +func (m *MessageOptions) GetDeprecated() bool { + if m != nil && m.Deprecated != nil { + return *m.Deprecated + } + return Default_MessageOptions_Deprecated +} + +func (m *MessageOptions) GetMapEntry() bool { + if m != nil && m.MapEntry != nil { + return *m.MapEntry + } + return false +} + +func (m *MessageOptions) GetUninterpretedOption() []*UninterpretedOption { + if m != nil { + return m.UninterpretedOption + } + return nil +} + +type FieldOptions struct { + // The ctype option instructs the C++ code generator to use a different + // representation of the field than it normally would. See the specific + // options below. This option is not yet implemented in the open source + // release -- sorry, we'll try to include it in a future version! + Ctype *FieldOptions_CType `protobuf:"varint,1,opt,name=ctype,enum=google.protobuf.FieldOptions_CType,def=0" json:"ctype,omitempty"` + // The packed option can be enabled for repeated primitive fields to enable + // a more efficient representation on the wire. Rather than repeatedly + // writing the tag and type for each element, the entire array is encoded as + // a single length-delimited blob. In proto3, only explicit setting it to + // false will avoid using packed encoding. + Packed *bool `protobuf:"varint,2,opt,name=packed" json:"packed,omitempty"` + // The jstype option determines the JavaScript type used for values of the + // field. The option is permitted only for 64 bit integral and fixed types + // (int64, uint64, sint64, fixed64, sfixed64). A field with jstype JS_STRING + // is represented as JavaScript string, which avoids loss of precision that + // can happen when a large value is converted to a floating point JavaScript. + // Specifying JS_NUMBER for the jstype causes the generated JavaScript code to + // use the JavaScript "number" type. The behavior of the default option + // JS_NORMAL is implementation dependent. + // + // This option is an enum to permit additional types to be added, e.g. + // goog.math.Integer. + Jstype *FieldOptions_JSType `protobuf:"varint,6,opt,name=jstype,enum=google.protobuf.FieldOptions_JSType,def=0" json:"jstype,omitempty"` + // Should this field be parsed lazily? Lazy applies only to message-type + // fields. It means that when the outer message is initially parsed, the + // inner message's contents will not be parsed but instead stored in encoded + // form. The inner message will actually be parsed when it is first accessed. + // + // This is only a hint. Implementations are free to choose whether to use + // eager or lazy parsing regardless of the value of this option. However, + // setting this option true suggests that the protocol author believes that + // using lazy parsing on this field is worth the additional bookkeeping + // overhead typically needed to implement it. + // + // This option does not affect the public interface of any generated code; + // all method signatures remain the same. Furthermore, thread-safety of the + // interface is not affected by this option; const methods remain safe to + // call from multiple threads concurrently, while non-const methods continue + // to require exclusive access. + // + // + // Note that implementations may choose not to check required fields within + // a lazy sub-message. That is, calling IsInitialized() on the outer message + // may return true even if the inner message has missing required fields. + // This is necessary because otherwise the inner message would have to be + // parsed in order to perform the check, defeating the purpose of lazy + // parsing. An implementation which chooses not to check required fields + // must be consistent about it. That is, for any particular sub-message, the + // implementation must either *always* check its required fields, or *never* + // check its required fields, regardless of whether or not the message has + // been parsed. + Lazy *bool `protobuf:"varint,5,opt,name=lazy,def=0" json:"lazy,omitempty"` + // Is this field deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for accessors, or it will be completely ignored; in the very least, this + // is a formalization for deprecating fields. + Deprecated *bool `protobuf:"varint,3,opt,name=deprecated,def=0" json:"deprecated,omitempty"` + // For Google-internal migration only. Do not use. + Weak *bool `protobuf:"varint,10,opt,name=weak,def=0" json:"weak,omitempty"` + // The parser stores options it doesn't recognize here. See above. + UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + proto.XXX_InternalExtensions `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *FieldOptions) Reset() { *m = FieldOptions{} } +func (m *FieldOptions) String() string { return proto.CompactTextString(m) } +func (*FieldOptions) ProtoMessage() {} +func (*FieldOptions) Descriptor() ([]byte, []int) { + return fileDescriptor_e5baabe45344a177, []int{12} +} + +var extRange_FieldOptions = []proto.ExtensionRange{ + {Start: 1000, End: 536870911}, +} + +func (*FieldOptions) ExtensionRangeArray() []proto.ExtensionRange { + return extRange_FieldOptions +} + +func (m *FieldOptions) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_FieldOptions.Unmarshal(m, b) +} +func (m *FieldOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_FieldOptions.Marshal(b, m, deterministic) +} +func (m *FieldOptions) XXX_Merge(src proto.Message) { + xxx_messageInfo_FieldOptions.Merge(m, src) +} +func (m *FieldOptions) XXX_Size() int { + return xxx_messageInfo_FieldOptions.Size(m) +} +func (m *FieldOptions) XXX_DiscardUnknown() { + xxx_messageInfo_FieldOptions.DiscardUnknown(m) +} + +var xxx_messageInfo_FieldOptions proto.InternalMessageInfo + +const Default_FieldOptions_Ctype FieldOptions_CType = FieldOptions_STRING +const Default_FieldOptions_Jstype FieldOptions_JSType = FieldOptions_JS_NORMAL +const Default_FieldOptions_Lazy bool = false +const Default_FieldOptions_Deprecated bool = false +const Default_FieldOptions_Weak bool = false + +func (m *FieldOptions) GetCtype() FieldOptions_CType { + if m != nil && m.Ctype != nil { + return *m.Ctype + } + return Default_FieldOptions_Ctype +} + +func (m *FieldOptions) GetPacked() bool { + if m != nil && m.Packed != nil { + return *m.Packed + } + return false +} + +func (m *FieldOptions) GetJstype() FieldOptions_JSType { + if m != nil && m.Jstype != nil { + return *m.Jstype + } + return Default_FieldOptions_Jstype +} + +func (m *FieldOptions) GetLazy() bool { + if m != nil && m.Lazy != nil { + return *m.Lazy + } + return Default_FieldOptions_Lazy +} + +func (m *FieldOptions) GetDeprecated() bool { + if m != nil && m.Deprecated != nil { + return *m.Deprecated + } + return Default_FieldOptions_Deprecated +} + +func (m *FieldOptions) GetWeak() bool { + if m != nil && m.Weak != nil { + return *m.Weak + } + return Default_FieldOptions_Weak +} + +func (m *FieldOptions) GetUninterpretedOption() []*UninterpretedOption { + if m != nil { + return m.UninterpretedOption + } + return nil +} + +type OneofOptions struct { + // The parser stores options it doesn't recognize here. See above. + UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + proto.XXX_InternalExtensions `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *OneofOptions) Reset() { *m = OneofOptions{} } +func (m *OneofOptions) String() string { return proto.CompactTextString(m) } +func (*OneofOptions) ProtoMessage() {} +func (*OneofOptions) Descriptor() ([]byte, []int) { + return fileDescriptor_e5baabe45344a177, []int{13} +} + +var extRange_OneofOptions = []proto.ExtensionRange{ + {Start: 1000, End: 536870911}, +} + +func (*OneofOptions) ExtensionRangeArray() []proto.ExtensionRange { + return extRange_OneofOptions +} + +func (m *OneofOptions) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_OneofOptions.Unmarshal(m, b) +} +func (m *OneofOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_OneofOptions.Marshal(b, m, deterministic) +} +func (m *OneofOptions) XXX_Merge(src proto.Message) { + xxx_messageInfo_OneofOptions.Merge(m, src) +} +func (m *OneofOptions) XXX_Size() int { + return xxx_messageInfo_OneofOptions.Size(m) +} +func (m *OneofOptions) XXX_DiscardUnknown() { + xxx_messageInfo_OneofOptions.DiscardUnknown(m) +} + +var xxx_messageInfo_OneofOptions proto.InternalMessageInfo + +func (m *OneofOptions) GetUninterpretedOption() []*UninterpretedOption { + if m != nil { + return m.UninterpretedOption + } + return nil +} + +type EnumOptions struct { + // Set this option to true to allow mapping different tag names to the same + // value. + AllowAlias *bool `protobuf:"varint,2,opt,name=allow_alias,json=allowAlias" json:"allow_alias,omitempty"` + // Is this enum deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for the enum, or it will be completely ignored; in the very least, this + // is a formalization for deprecating enums. + Deprecated *bool `protobuf:"varint,3,opt,name=deprecated,def=0" json:"deprecated,omitempty"` + // The parser stores options it doesn't recognize here. See above. + UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + proto.XXX_InternalExtensions `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *EnumOptions) Reset() { *m = EnumOptions{} } +func (m *EnumOptions) String() string { return proto.CompactTextString(m) } +func (*EnumOptions) ProtoMessage() {} +func (*EnumOptions) Descriptor() ([]byte, []int) { + return fileDescriptor_e5baabe45344a177, []int{14} +} + +var extRange_EnumOptions = []proto.ExtensionRange{ + {Start: 1000, End: 536870911}, +} + +func (*EnumOptions) ExtensionRangeArray() []proto.ExtensionRange { + return extRange_EnumOptions +} + +func (m *EnumOptions) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_EnumOptions.Unmarshal(m, b) +} +func (m *EnumOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_EnumOptions.Marshal(b, m, deterministic) +} +func (m *EnumOptions) XXX_Merge(src proto.Message) { + xxx_messageInfo_EnumOptions.Merge(m, src) +} +func (m *EnumOptions) XXX_Size() int { + return xxx_messageInfo_EnumOptions.Size(m) +} +func (m *EnumOptions) XXX_DiscardUnknown() { + xxx_messageInfo_EnumOptions.DiscardUnknown(m) +} + +var xxx_messageInfo_EnumOptions proto.InternalMessageInfo + +const Default_EnumOptions_Deprecated bool = false + +func (m *EnumOptions) GetAllowAlias() bool { + if m != nil && m.AllowAlias != nil { + return *m.AllowAlias + } + return false +} + +func (m *EnumOptions) GetDeprecated() bool { + if m != nil && m.Deprecated != nil { + return *m.Deprecated + } + return Default_EnumOptions_Deprecated +} + +func (m *EnumOptions) GetUninterpretedOption() []*UninterpretedOption { + if m != nil { + return m.UninterpretedOption + } + return nil +} + +type EnumValueOptions struct { + // Is this enum value deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for the enum value, or it will be completely ignored; in the very least, + // this is a formalization for deprecating enum values. + Deprecated *bool `protobuf:"varint,1,opt,name=deprecated,def=0" json:"deprecated,omitempty"` + // The parser stores options it doesn't recognize here. See above. + UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + proto.XXX_InternalExtensions `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *EnumValueOptions) Reset() { *m = EnumValueOptions{} } +func (m *EnumValueOptions) String() string { return proto.CompactTextString(m) } +func (*EnumValueOptions) ProtoMessage() {} +func (*EnumValueOptions) Descriptor() ([]byte, []int) { + return fileDescriptor_e5baabe45344a177, []int{15} +} + +var extRange_EnumValueOptions = []proto.ExtensionRange{ + {Start: 1000, End: 536870911}, +} + +func (*EnumValueOptions) ExtensionRangeArray() []proto.ExtensionRange { + return extRange_EnumValueOptions +} + +func (m *EnumValueOptions) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_EnumValueOptions.Unmarshal(m, b) +} +func (m *EnumValueOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_EnumValueOptions.Marshal(b, m, deterministic) +} +func (m *EnumValueOptions) XXX_Merge(src proto.Message) { + xxx_messageInfo_EnumValueOptions.Merge(m, src) +} +func (m *EnumValueOptions) XXX_Size() int { + return xxx_messageInfo_EnumValueOptions.Size(m) +} +func (m *EnumValueOptions) XXX_DiscardUnknown() { + xxx_messageInfo_EnumValueOptions.DiscardUnknown(m) +} + +var xxx_messageInfo_EnumValueOptions proto.InternalMessageInfo + +const Default_EnumValueOptions_Deprecated bool = false + +func (m *EnumValueOptions) GetDeprecated() bool { + if m != nil && m.Deprecated != nil { + return *m.Deprecated + } + return Default_EnumValueOptions_Deprecated +} + +func (m *EnumValueOptions) GetUninterpretedOption() []*UninterpretedOption { + if m != nil { + return m.UninterpretedOption + } + return nil +} + +type ServiceOptions struct { + // Is this service deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for the service, or it will be completely ignored; in the very least, + // this is a formalization for deprecating services. + Deprecated *bool `protobuf:"varint,33,opt,name=deprecated,def=0" json:"deprecated,omitempty"` + // The parser stores options it doesn't recognize here. See above. + UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + proto.XXX_InternalExtensions `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ServiceOptions) Reset() { *m = ServiceOptions{} } +func (m *ServiceOptions) String() string { return proto.CompactTextString(m) } +func (*ServiceOptions) ProtoMessage() {} +func (*ServiceOptions) Descriptor() ([]byte, []int) { + return fileDescriptor_e5baabe45344a177, []int{16} +} + +var extRange_ServiceOptions = []proto.ExtensionRange{ + {Start: 1000, End: 536870911}, +} + +func (*ServiceOptions) ExtensionRangeArray() []proto.ExtensionRange { + return extRange_ServiceOptions +} + +func (m *ServiceOptions) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ServiceOptions.Unmarshal(m, b) +} +func (m *ServiceOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ServiceOptions.Marshal(b, m, deterministic) +} +func (m *ServiceOptions) XXX_Merge(src proto.Message) { + xxx_messageInfo_ServiceOptions.Merge(m, src) +} +func (m *ServiceOptions) XXX_Size() int { + return xxx_messageInfo_ServiceOptions.Size(m) +} +func (m *ServiceOptions) XXX_DiscardUnknown() { + xxx_messageInfo_ServiceOptions.DiscardUnknown(m) +} + +var xxx_messageInfo_ServiceOptions proto.InternalMessageInfo + +const Default_ServiceOptions_Deprecated bool = false + +func (m *ServiceOptions) GetDeprecated() bool { + if m != nil && m.Deprecated != nil { + return *m.Deprecated + } + return Default_ServiceOptions_Deprecated +} + +func (m *ServiceOptions) GetUninterpretedOption() []*UninterpretedOption { + if m != nil { + return m.UninterpretedOption + } + return nil +} + +type MethodOptions struct { + // Is this method deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for the method, or it will be completely ignored; in the very least, + // this is a formalization for deprecating methods. + Deprecated *bool `protobuf:"varint,33,opt,name=deprecated,def=0" json:"deprecated,omitempty"` + IdempotencyLevel *MethodOptions_IdempotencyLevel `protobuf:"varint,34,opt,name=idempotency_level,json=idempotencyLevel,enum=google.protobuf.MethodOptions_IdempotencyLevel,def=0" json:"idempotency_level,omitempty"` + // The parser stores options it doesn't recognize here. See above. + UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + proto.XXX_InternalExtensions `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *MethodOptions) Reset() { *m = MethodOptions{} } +func (m *MethodOptions) String() string { return proto.CompactTextString(m) } +func (*MethodOptions) ProtoMessage() {} +func (*MethodOptions) Descriptor() ([]byte, []int) { + return fileDescriptor_e5baabe45344a177, []int{17} +} + +var extRange_MethodOptions = []proto.ExtensionRange{ + {Start: 1000, End: 536870911}, +} + +func (*MethodOptions) ExtensionRangeArray() []proto.ExtensionRange { + return extRange_MethodOptions +} + +func (m *MethodOptions) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_MethodOptions.Unmarshal(m, b) +} +func (m *MethodOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_MethodOptions.Marshal(b, m, deterministic) +} +func (m *MethodOptions) XXX_Merge(src proto.Message) { + xxx_messageInfo_MethodOptions.Merge(m, src) +} +func (m *MethodOptions) XXX_Size() int { + return xxx_messageInfo_MethodOptions.Size(m) +} +func (m *MethodOptions) XXX_DiscardUnknown() { + xxx_messageInfo_MethodOptions.DiscardUnknown(m) +} + +var xxx_messageInfo_MethodOptions proto.InternalMessageInfo + +const Default_MethodOptions_Deprecated bool = false +const Default_MethodOptions_IdempotencyLevel MethodOptions_IdempotencyLevel = MethodOptions_IDEMPOTENCY_UNKNOWN + +func (m *MethodOptions) GetDeprecated() bool { + if m != nil && m.Deprecated != nil { + return *m.Deprecated + } + return Default_MethodOptions_Deprecated +} + +func (m *MethodOptions) GetIdempotencyLevel() MethodOptions_IdempotencyLevel { + if m != nil && m.IdempotencyLevel != nil { + return *m.IdempotencyLevel + } + return Default_MethodOptions_IdempotencyLevel +} + +func (m *MethodOptions) GetUninterpretedOption() []*UninterpretedOption { + if m != nil { + return m.UninterpretedOption + } + return nil +} + +// A message representing a option the parser does not recognize. This only +// appears in options protos created by the compiler::Parser class. +// DescriptorPool resolves these when building Descriptor objects. Therefore, +// options protos in descriptor objects (e.g. returned by Descriptor::options(), +// or produced by Descriptor::CopyTo()) will never have UninterpretedOptions +// in them. +type UninterpretedOption struct { + Name []*UninterpretedOption_NamePart `protobuf:"bytes,2,rep,name=name" json:"name,omitempty"` + // The value of the uninterpreted option, in whatever type the tokenizer + // identified it as during parsing. Exactly one of these should be set. + IdentifierValue *string `protobuf:"bytes,3,opt,name=identifier_value,json=identifierValue" json:"identifier_value,omitempty"` + PositiveIntValue *uint64 `protobuf:"varint,4,opt,name=positive_int_value,json=positiveIntValue" json:"positive_int_value,omitempty"` + NegativeIntValue *int64 `protobuf:"varint,5,opt,name=negative_int_value,json=negativeIntValue" json:"negative_int_value,omitempty"` + DoubleValue *float64 `protobuf:"fixed64,6,opt,name=double_value,json=doubleValue" json:"double_value,omitempty"` + StringValue []byte `protobuf:"bytes,7,opt,name=string_value,json=stringValue" json:"string_value,omitempty"` + AggregateValue *string `protobuf:"bytes,8,opt,name=aggregate_value,json=aggregateValue" json:"aggregate_value,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *UninterpretedOption) Reset() { *m = UninterpretedOption{} } +func (m *UninterpretedOption) String() string { return proto.CompactTextString(m) } +func (*UninterpretedOption) ProtoMessage() {} +func (*UninterpretedOption) Descriptor() ([]byte, []int) { + return fileDescriptor_e5baabe45344a177, []int{18} +} + +func (m *UninterpretedOption) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_UninterpretedOption.Unmarshal(m, b) +} +func (m *UninterpretedOption) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_UninterpretedOption.Marshal(b, m, deterministic) +} +func (m *UninterpretedOption) XXX_Merge(src proto.Message) { + xxx_messageInfo_UninterpretedOption.Merge(m, src) +} +func (m *UninterpretedOption) XXX_Size() int { + return xxx_messageInfo_UninterpretedOption.Size(m) +} +func (m *UninterpretedOption) XXX_DiscardUnknown() { + xxx_messageInfo_UninterpretedOption.DiscardUnknown(m) +} + +var xxx_messageInfo_UninterpretedOption proto.InternalMessageInfo + +func (m *UninterpretedOption) GetName() []*UninterpretedOption_NamePart { + if m != nil { + return m.Name + } + return nil +} + +func (m *UninterpretedOption) GetIdentifierValue() string { + if m != nil && m.IdentifierValue != nil { + return *m.IdentifierValue + } + return "" +} + +func (m *UninterpretedOption) GetPositiveIntValue() uint64 { + if m != nil && m.PositiveIntValue != nil { + return *m.PositiveIntValue + } + return 0 +} + +func (m *UninterpretedOption) GetNegativeIntValue() int64 { + if m != nil && m.NegativeIntValue != nil { + return *m.NegativeIntValue + } + return 0 +} + +func (m *UninterpretedOption) GetDoubleValue() float64 { + if m != nil && m.DoubleValue != nil { + return *m.DoubleValue + } + return 0 +} + +func (m *UninterpretedOption) GetStringValue() []byte { + if m != nil { + return m.StringValue + } + return nil +} + +func (m *UninterpretedOption) GetAggregateValue() string { + if m != nil && m.AggregateValue != nil { + return *m.AggregateValue + } + return "" +} + +// The name of the uninterpreted option. Each string represents a segment in +// a dot-separated name. is_extension is true iff a segment represents an +// extension (denoted with parentheses in options specs in .proto files). +// E.g.,{ ["foo", false], ["bar.baz", true], ["qux", false] } represents +// "foo.(bar.baz).qux". +type UninterpretedOption_NamePart struct { + NamePart *string `protobuf:"bytes,1,req,name=name_part,json=namePart" json:"name_part,omitempty"` + IsExtension *bool `protobuf:"varint,2,req,name=is_extension,json=isExtension" json:"is_extension,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *UninterpretedOption_NamePart) Reset() { *m = UninterpretedOption_NamePart{} } +func (m *UninterpretedOption_NamePart) String() string { return proto.CompactTextString(m) } +func (*UninterpretedOption_NamePart) ProtoMessage() {} +func (*UninterpretedOption_NamePart) Descriptor() ([]byte, []int) { + return fileDescriptor_e5baabe45344a177, []int{18, 0} +} + +func (m *UninterpretedOption_NamePart) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_UninterpretedOption_NamePart.Unmarshal(m, b) +} +func (m *UninterpretedOption_NamePart) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_UninterpretedOption_NamePart.Marshal(b, m, deterministic) +} +func (m *UninterpretedOption_NamePart) XXX_Merge(src proto.Message) { + xxx_messageInfo_UninterpretedOption_NamePart.Merge(m, src) +} +func (m *UninterpretedOption_NamePart) XXX_Size() int { + return xxx_messageInfo_UninterpretedOption_NamePart.Size(m) +} +func (m *UninterpretedOption_NamePart) XXX_DiscardUnknown() { + xxx_messageInfo_UninterpretedOption_NamePart.DiscardUnknown(m) +} + +var xxx_messageInfo_UninterpretedOption_NamePart proto.InternalMessageInfo + +func (m *UninterpretedOption_NamePart) GetNamePart() string { + if m != nil && m.NamePart != nil { + return *m.NamePart + } + return "" +} + +func (m *UninterpretedOption_NamePart) GetIsExtension() bool { + if m != nil && m.IsExtension != nil { + return *m.IsExtension + } + return false +} + +// Encapsulates information about the original source file from which a +// FileDescriptorProto was generated. +type SourceCodeInfo struct { + // A Location identifies a piece of source code in a .proto file which + // corresponds to a particular definition. This information is intended + // to be useful to IDEs, code indexers, documentation generators, and similar + // tools. + // + // For example, say we have a file like: + // message Foo { + // optional string foo = 1; + // } + // Let's look at just the field definition: + // optional string foo = 1; + // ^ ^^ ^^ ^ ^^^ + // a bc de f ghi + // We have the following locations: + // span path represents + // [a,i) [ 4, 0, 2, 0 ] The whole field definition. + // [a,b) [ 4, 0, 2, 0, 4 ] The label (optional). + // [c,d) [ 4, 0, 2, 0, 5 ] The type (string). + // [e,f) [ 4, 0, 2, 0, 1 ] The name (foo). + // [g,h) [ 4, 0, 2, 0, 3 ] The number (1). + // + // Notes: + // - A location may refer to a repeated field itself (i.e. not to any + // particular index within it). This is used whenever a set of elements are + // logically enclosed in a single code segment. For example, an entire + // extend block (possibly containing multiple extension definitions) will + // have an outer location whose path refers to the "extensions" repeated + // field without an index. + // - Multiple locations may have the same path. This happens when a single + // logical declaration is spread out across multiple places. The most + // obvious example is the "extend" block again -- there may be multiple + // extend blocks in the same scope, each of which will have the same path. + // - A location's span is not always a subset of its parent's span. For + // example, the "extendee" of an extension declaration appears at the + // beginning of the "extend" block and is shared by all extensions within + // the block. + // - Just because a location's span is a subset of some other location's span + // does not mean that it is a descendent. For example, a "group" defines + // both a type and a field in a single declaration. Thus, the locations + // corresponding to the type and field and their components will overlap. + // - Code which tries to interpret locations should probably be designed to + // ignore those that it doesn't understand, as more types of locations could + // be recorded in the future. + Location []*SourceCodeInfo_Location `protobuf:"bytes,1,rep,name=location" json:"location,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SourceCodeInfo) Reset() { *m = SourceCodeInfo{} } +func (m *SourceCodeInfo) String() string { return proto.CompactTextString(m) } +func (*SourceCodeInfo) ProtoMessage() {} +func (*SourceCodeInfo) Descriptor() ([]byte, []int) { + return fileDescriptor_e5baabe45344a177, []int{19} +} + +func (m *SourceCodeInfo) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_SourceCodeInfo.Unmarshal(m, b) +} +func (m *SourceCodeInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_SourceCodeInfo.Marshal(b, m, deterministic) +} +func (m *SourceCodeInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_SourceCodeInfo.Merge(m, src) +} +func (m *SourceCodeInfo) XXX_Size() int { + return xxx_messageInfo_SourceCodeInfo.Size(m) +} +func (m *SourceCodeInfo) XXX_DiscardUnknown() { + xxx_messageInfo_SourceCodeInfo.DiscardUnknown(m) +} + +var xxx_messageInfo_SourceCodeInfo proto.InternalMessageInfo + +func (m *SourceCodeInfo) GetLocation() []*SourceCodeInfo_Location { + if m != nil { + return m.Location + } + return nil +} + +type SourceCodeInfo_Location struct { + // Identifies which part of the FileDescriptorProto was defined at this + // location. + // + // Each element is a field number or an index. They form a path from + // the root FileDescriptorProto to the place where the definition. For + // example, this path: + // [ 4, 3, 2, 7, 1 ] + // refers to: + // file.message_type(3) // 4, 3 + // .field(7) // 2, 7 + // .name() // 1 + // This is because FileDescriptorProto.message_type has field number 4: + // repeated DescriptorProto message_type = 4; + // and DescriptorProto.field has field number 2: + // repeated FieldDescriptorProto field = 2; + // and FieldDescriptorProto.name has field number 1: + // optional string name = 1; + // + // Thus, the above path gives the location of a field name. If we removed + // the last element: + // [ 4, 3, 2, 7 ] + // this path refers to the whole field declaration (from the beginning + // of the label to the terminating semicolon). + Path []int32 `protobuf:"varint,1,rep,packed,name=path" json:"path,omitempty"` + // Always has exactly three or four elements: start line, start column, + // end line (optional, otherwise assumed same as start line), end column. + // These are packed into a single field for efficiency. Note that line + // and column numbers are zero-based -- typically you will want to add + // 1 to each before displaying to a user. + Span []int32 `protobuf:"varint,2,rep,packed,name=span" json:"span,omitempty"` + // If this SourceCodeInfo represents a complete declaration, these are any + // comments appearing before and after the declaration which appear to be + // attached to the declaration. + // + // A series of line comments appearing on consecutive lines, with no other + // tokens appearing on those lines, will be treated as a single comment. + // + // leading_detached_comments will keep paragraphs of comments that appear + // before (but not connected to) the current element. Each paragraph, + // separated by empty lines, will be one comment element in the repeated + // field. + // + // Only the comment content is provided; comment markers (e.g. //) are + // stripped out. For block comments, leading whitespace and an asterisk + // will be stripped from the beginning of each line other than the first. + // Newlines are included in the output. + // + // Examples: + // + // optional int32 foo = 1; // Comment attached to foo. + // // Comment attached to bar. + // optional int32 bar = 2; + // + // optional string baz = 3; + // // Comment attached to baz. + // // Another line attached to baz. + // + // // Comment attached to qux. + // // + // // Another line attached to qux. + // optional double qux = 4; + // + // // Detached comment for corge. This is not leading or trailing comments + // // to qux or corge because there are blank lines separating it from + // // both. + // + // // Detached comment for corge paragraph 2. + // + // optional string corge = 5; + // /* Block comment attached + // * to corge. Leading asterisks + // * will be removed. */ + // /* Block comment attached to + // * grault. */ + // optional int32 grault = 6; + // + // // ignored detached comments. + LeadingComments *string `protobuf:"bytes,3,opt,name=leading_comments,json=leadingComments" json:"leading_comments,omitempty"` + TrailingComments *string `protobuf:"bytes,4,opt,name=trailing_comments,json=trailingComments" json:"trailing_comments,omitempty"` + LeadingDetachedComments []string `protobuf:"bytes,6,rep,name=leading_detached_comments,json=leadingDetachedComments" json:"leading_detached_comments,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SourceCodeInfo_Location) Reset() { *m = SourceCodeInfo_Location{} } +func (m *SourceCodeInfo_Location) String() string { return proto.CompactTextString(m) } +func (*SourceCodeInfo_Location) ProtoMessage() {} +func (*SourceCodeInfo_Location) Descriptor() ([]byte, []int) { + return fileDescriptor_e5baabe45344a177, []int{19, 0} +} + +func (m *SourceCodeInfo_Location) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_SourceCodeInfo_Location.Unmarshal(m, b) +} +func (m *SourceCodeInfo_Location) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_SourceCodeInfo_Location.Marshal(b, m, deterministic) +} +func (m *SourceCodeInfo_Location) XXX_Merge(src proto.Message) { + xxx_messageInfo_SourceCodeInfo_Location.Merge(m, src) +} +func (m *SourceCodeInfo_Location) XXX_Size() int { + return xxx_messageInfo_SourceCodeInfo_Location.Size(m) +} +func (m *SourceCodeInfo_Location) XXX_DiscardUnknown() { + xxx_messageInfo_SourceCodeInfo_Location.DiscardUnknown(m) +} + +var xxx_messageInfo_SourceCodeInfo_Location proto.InternalMessageInfo + +func (m *SourceCodeInfo_Location) GetPath() []int32 { + if m != nil { + return m.Path + } + return nil +} + +func (m *SourceCodeInfo_Location) GetSpan() []int32 { + if m != nil { + return m.Span + } + return nil +} + +func (m *SourceCodeInfo_Location) GetLeadingComments() string { + if m != nil && m.LeadingComments != nil { + return *m.LeadingComments + } + return "" +} + +func (m *SourceCodeInfo_Location) GetTrailingComments() string { + if m != nil && m.TrailingComments != nil { + return *m.TrailingComments + } + return "" +} + +func (m *SourceCodeInfo_Location) GetLeadingDetachedComments() []string { + if m != nil { + return m.LeadingDetachedComments + } + return nil +} + +// Describes the relationship between generated code and its original source +// file. A GeneratedCodeInfo message is associated with only one generated +// source file, but may contain references to different source .proto files. +type GeneratedCodeInfo struct { + // An Annotation connects some span of text in generated code to an element + // of its generating .proto file. + Annotation []*GeneratedCodeInfo_Annotation `protobuf:"bytes,1,rep,name=annotation" json:"annotation,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GeneratedCodeInfo) Reset() { *m = GeneratedCodeInfo{} } +func (m *GeneratedCodeInfo) String() string { return proto.CompactTextString(m) } +func (*GeneratedCodeInfo) ProtoMessage() {} +func (*GeneratedCodeInfo) Descriptor() ([]byte, []int) { + return fileDescriptor_e5baabe45344a177, []int{20} +} + +func (m *GeneratedCodeInfo) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GeneratedCodeInfo.Unmarshal(m, b) +} +func (m *GeneratedCodeInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GeneratedCodeInfo.Marshal(b, m, deterministic) +} +func (m *GeneratedCodeInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_GeneratedCodeInfo.Merge(m, src) +} +func (m *GeneratedCodeInfo) XXX_Size() int { + return xxx_messageInfo_GeneratedCodeInfo.Size(m) +} +func (m *GeneratedCodeInfo) XXX_DiscardUnknown() { + xxx_messageInfo_GeneratedCodeInfo.DiscardUnknown(m) +} + +var xxx_messageInfo_GeneratedCodeInfo proto.InternalMessageInfo + +func (m *GeneratedCodeInfo) GetAnnotation() []*GeneratedCodeInfo_Annotation { + if m != nil { + return m.Annotation + } + return nil +} + +type GeneratedCodeInfo_Annotation struct { + // Identifies the element in the original source .proto file. This field + // is formatted the same as SourceCodeInfo.Location.path. + Path []int32 `protobuf:"varint,1,rep,packed,name=path" json:"path,omitempty"` + // Identifies the filesystem path to the original source .proto. + SourceFile *string `protobuf:"bytes,2,opt,name=source_file,json=sourceFile" json:"source_file,omitempty"` + // Identifies the starting offset in bytes in the generated code + // that relates to the identified object. + Begin *int32 `protobuf:"varint,3,opt,name=begin" json:"begin,omitempty"` + // Identifies the ending offset in bytes in the generated code that + // relates to the identified offset. The end offset should be one past + // the last relevant byte (so the length of the text = end - begin). + End *int32 `protobuf:"varint,4,opt,name=end" json:"end,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GeneratedCodeInfo_Annotation) Reset() { *m = GeneratedCodeInfo_Annotation{} } +func (m *GeneratedCodeInfo_Annotation) String() string { return proto.CompactTextString(m) } +func (*GeneratedCodeInfo_Annotation) ProtoMessage() {} +func (*GeneratedCodeInfo_Annotation) Descriptor() ([]byte, []int) { + return fileDescriptor_e5baabe45344a177, []int{20, 0} +} + +func (m *GeneratedCodeInfo_Annotation) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GeneratedCodeInfo_Annotation.Unmarshal(m, b) +} +func (m *GeneratedCodeInfo_Annotation) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GeneratedCodeInfo_Annotation.Marshal(b, m, deterministic) +} +func (m *GeneratedCodeInfo_Annotation) XXX_Merge(src proto.Message) { + xxx_messageInfo_GeneratedCodeInfo_Annotation.Merge(m, src) +} +func (m *GeneratedCodeInfo_Annotation) XXX_Size() int { + return xxx_messageInfo_GeneratedCodeInfo_Annotation.Size(m) +} +func (m *GeneratedCodeInfo_Annotation) XXX_DiscardUnknown() { + xxx_messageInfo_GeneratedCodeInfo_Annotation.DiscardUnknown(m) +} + +var xxx_messageInfo_GeneratedCodeInfo_Annotation proto.InternalMessageInfo + +func (m *GeneratedCodeInfo_Annotation) GetPath() []int32 { + if m != nil { + return m.Path + } + return nil +} + +func (m *GeneratedCodeInfo_Annotation) GetSourceFile() string { + if m != nil && m.SourceFile != nil { + return *m.SourceFile + } + return "" +} + +func (m *GeneratedCodeInfo_Annotation) GetBegin() int32 { + if m != nil && m.Begin != nil { + return *m.Begin + } + return 0 +} + +func (m *GeneratedCodeInfo_Annotation) GetEnd() int32 { + if m != nil && m.End != nil { + return *m.End + } + return 0 +} + +func init() { + proto.RegisterEnum("google.protobuf.FieldDescriptorProto_Type", FieldDescriptorProto_Type_name, FieldDescriptorProto_Type_value) + proto.RegisterEnum("google.protobuf.FieldDescriptorProto_Label", FieldDescriptorProto_Label_name, FieldDescriptorProto_Label_value) + proto.RegisterEnum("google.protobuf.FileOptions_OptimizeMode", FileOptions_OptimizeMode_name, FileOptions_OptimizeMode_value) + proto.RegisterEnum("google.protobuf.FieldOptions_CType", FieldOptions_CType_name, FieldOptions_CType_value) + proto.RegisterEnum("google.protobuf.FieldOptions_JSType", FieldOptions_JSType_name, FieldOptions_JSType_value) + proto.RegisterEnum("google.protobuf.MethodOptions_IdempotencyLevel", MethodOptions_IdempotencyLevel_name, MethodOptions_IdempotencyLevel_value) + proto.RegisterType((*FileDescriptorSet)(nil), "google.protobuf.FileDescriptorSet") + proto.RegisterType((*FileDescriptorProto)(nil), "google.protobuf.FileDescriptorProto") + proto.RegisterType((*DescriptorProto)(nil), "google.protobuf.DescriptorProto") + proto.RegisterType((*DescriptorProto_ExtensionRange)(nil), "google.protobuf.DescriptorProto.ExtensionRange") + proto.RegisterType((*DescriptorProto_ReservedRange)(nil), "google.protobuf.DescriptorProto.ReservedRange") + proto.RegisterType((*ExtensionRangeOptions)(nil), "google.protobuf.ExtensionRangeOptions") + proto.RegisterType((*FieldDescriptorProto)(nil), "google.protobuf.FieldDescriptorProto") + proto.RegisterType((*OneofDescriptorProto)(nil), "google.protobuf.OneofDescriptorProto") + proto.RegisterType((*EnumDescriptorProto)(nil), "google.protobuf.EnumDescriptorProto") + proto.RegisterType((*EnumDescriptorProto_EnumReservedRange)(nil), "google.protobuf.EnumDescriptorProto.EnumReservedRange") + proto.RegisterType((*EnumValueDescriptorProto)(nil), "google.protobuf.EnumValueDescriptorProto") + proto.RegisterType((*ServiceDescriptorProto)(nil), "google.protobuf.ServiceDescriptorProto") + proto.RegisterType((*MethodDescriptorProto)(nil), "google.protobuf.MethodDescriptorProto") + proto.RegisterType((*FileOptions)(nil), "google.protobuf.FileOptions") + proto.RegisterType((*MessageOptions)(nil), "google.protobuf.MessageOptions") + proto.RegisterType((*FieldOptions)(nil), "google.protobuf.FieldOptions") + proto.RegisterType((*OneofOptions)(nil), "google.protobuf.OneofOptions") + proto.RegisterType((*EnumOptions)(nil), "google.protobuf.EnumOptions") + proto.RegisterType((*EnumValueOptions)(nil), "google.protobuf.EnumValueOptions") + proto.RegisterType((*ServiceOptions)(nil), "google.protobuf.ServiceOptions") + proto.RegisterType((*MethodOptions)(nil), "google.protobuf.MethodOptions") + proto.RegisterType((*UninterpretedOption)(nil), "google.protobuf.UninterpretedOption") + proto.RegisterType((*UninterpretedOption_NamePart)(nil), "google.protobuf.UninterpretedOption.NamePart") + proto.RegisterType((*SourceCodeInfo)(nil), "google.protobuf.SourceCodeInfo") + proto.RegisterType((*SourceCodeInfo_Location)(nil), "google.protobuf.SourceCodeInfo.Location") + proto.RegisterType((*GeneratedCodeInfo)(nil), "google.protobuf.GeneratedCodeInfo") + proto.RegisterType((*GeneratedCodeInfo_Annotation)(nil), "google.protobuf.GeneratedCodeInfo.Annotation") +} + +func init() { proto.RegisterFile("google/protobuf/descriptor.proto", fileDescriptor_e5baabe45344a177) } + +var fileDescriptor_e5baabe45344a177 = []byte{ + // 2555 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x59, 0xdd, 0x6e, 0x1b, 0xc7, + 0xf5, 0xcf, 0xf2, 0x4b, 0xe4, 0x21, 0x45, 0x8d, 0x46, 0x8a, 0xbd, 0x56, 0x3e, 0x2c, 0x33, 0x1f, + 0x96, 0x9d, 0x7f, 0xa8, 0xc0, 0xb1, 0x1d, 0x47, 0xfe, 0x23, 0x2d, 0x45, 0xae, 0x15, 0xaa, 0x12, + 0xc9, 0x2e, 0xa9, 0xe6, 0x03, 0x28, 0x16, 0xa3, 0xdd, 0x21, 0xb9, 0xf6, 0x72, 0x77, 0xb3, 0xbb, + 0xb4, 0xad, 0xa0, 0x17, 0x06, 0x7a, 0xd5, 0xab, 0xde, 0x16, 0x45, 0xd1, 0x8b, 0xde, 0x04, 0xe8, + 0x03, 0x14, 0xc8, 0x5d, 0x9f, 0xa0, 0x40, 0xde, 0xa0, 0x68, 0x0b, 0xb4, 0x8f, 0xd0, 0xcb, 0x62, + 0x66, 0x76, 0x97, 0xbb, 0x24, 0x15, 0x2b, 0x01, 0xe2, 0x5c, 0x91, 0xf3, 0x9b, 0xdf, 0x39, 0x73, + 0xe6, 0xcc, 0x99, 0x33, 0x67, 0x66, 0x61, 0x7b, 0xe4, 0x38, 0x23, 0x8b, 0xee, 0xba, 0x9e, 0x13, + 0x38, 0xa7, 0xd3, 0xe1, 0xae, 0x41, 0x7d, 0xdd, 0x33, 0xdd, 0xc0, 0xf1, 0xea, 0x1c, 0xc3, 0x6b, + 0x82, 0x51, 0x8f, 0x18, 0xb5, 0x63, 0x58, 0x7f, 0x60, 0x5a, 0xb4, 0x15, 0x13, 0xfb, 0x34, 0xc0, + 0xf7, 0x20, 0x37, 0x34, 0x2d, 0x2a, 0x4b, 0xdb, 0xd9, 0x9d, 0xf2, 0xad, 0x37, 0xeb, 0x73, 0x42, + 0xf5, 0xb4, 0x44, 0x8f, 0xc1, 0x2a, 0x97, 0xa8, 0xfd, 0x2b, 0x07, 0x1b, 0x4b, 0x7a, 0x31, 0x86, + 0x9c, 0x4d, 0x26, 0x4c, 0xa3, 0xb4, 0x53, 0x52, 0xf9, 0x7f, 0x2c, 0xc3, 0x8a, 0x4b, 0xf4, 0x47, + 0x64, 0x44, 0xe5, 0x0c, 0x87, 0xa3, 0x26, 0x7e, 0x1d, 0xc0, 0xa0, 0x2e, 0xb5, 0x0d, 0x6a, 0xeb, + 0x67, 0x72, 0x76, 0x3b, 0xbb, 0x53, 0x52, 0x13, 0x08, 0x7e, 0x07, 0xd6, 0xdd, 0xe9, 0xa9, 0x65, + 0xea, 0x5a, 0x82, 0x06, 0xdb, 0xd9, 0x9d, 0xbc, 0x8a, 0x44, 0x47, 0x6b, 0x46, 0xbe, 0x0e, 0x6b, + 0x4f, 0x28, 0x79, 0x94, 0xa4, 0x96, 0x39, 0xb5, 0xca, 0xe0, 0x04, 0xb1, 0x09, 0x95, 0x09, 0xf5, + 0x7d, 0x32, 0xa2, 0x5a, 0x70, 0xe6, 0x52, 0x39, 0xc7, 0x67, 0xbf, 0xbd, 0x30, 0xfb, 0xf9, 0x99, + 0x97, 0x43, 0xa9, 0xc1, 0x99, 0x4b, 0x71, 0x03, 0x4a, 0xd4, 0x9e, 0x4e, 0x84, 0x86, 0xfc, 0x39, + 0xfe, 0x53, 0xec, 0xe9, 0x64, 0x5e, 0x4b, 0x91, 0x89, 0x85, 0x2a, 0x56, 0x7c, 0xea, 0x3d, 0x36, + 0x75, 0x2a, 0x17, 0xb8, 0x82, 0xeb, 0x0b, 0x0a, 0xfa, 0xa2, 0x7f, 0x5e, 0x47, 0x24, 0x87, 0x9b, + 0x50, 0xa2, 0x4f, 0x03, 0x6a, 0xfb, 0xa6, 0x63, 0xcb, 0x2b, 0x5c, 0xc9, 0x5b, 0x4b, 0x56, 0x91, + 0x5a, 0xc6, 0xbc, 0x8a, 0x99, 0x1c, 0xbe, 0x0b, 0x2b, 0x8e, 0x1b, 0x98, 0x8e, 0xed, 0xcb, 0xc5, + 0x6d, 0x69, 0xa7, 0x7c, 0xeb, 0xd5, 0xa5, 0x81, 0xd0, 0x15, 0x1c, 0x35, 0x22, 0xe3, 0x36, 0x20, + 0xdf, 0x99, 0x7a, 0x3a, 0xd5, 0x74, 0xc7, 0xa0, 0x9a, 0x69, 0x0f, 0x1d, 0xb9, 0xc4, 0x15, 0x5c, + 0x5d, 0x9c, 0x08, 0x27, 0x36, 0x1d, 0x83, 0xb6, 0xed, 0xa1, 0xa3, 0x56, 0xfd, 0x54, 0x1b, 0x5f, + 0x82, 0x82, 0x7f, 0x66, 0x07, 0xe4, 0xa9, 0x5c, 0xe1, 0x11, 0x12, 0xb6, 0x6a, 0x5f, 0x17, 0x60, + 0xed, 0x22, 0x21, 0x76, 0x1f, 0xf2, 0x43, 0x36, 0x4b, 0x39, 0xf3, 0x5d, 0x7c, 0x20, 0x64, 0xd2, + 0x4e, 0x2c, 0x7c, 0x4f, 0x27, 0x36, 0xa0, 0x6c, 0x53, 0x3f, 0xa0, 0x86, 0x88, 0x88, 0xec, 0x05, + 0x63, 0x0a, 0x84, 0xd0, 0x62, 0x48, 0xe5, 0xbe, 0x57, 0x48, 0x7d, 0x0a, 0x6b, 0xb1, 0x49, 0x9a, + 0x47, 0xec, 0x51, 0x14, 0x9b, 0xbb, 0xcf, 0xb3, 0xa4, 0xae, 0x44, 0x72, 0x2a, 0x13, 0x53, 0xab, + 0x34, 0xd5, 0xc6, 0x2d, 0x00, 0xc7, 0xa6, 0xce, 0x50, 0x33, 0xa8, 0x6e, 0xc9, 0xc5, 0x73, 0xbc, + 0xd4, 0x65, 0x94, 0x05, 0x2f, 0x39, 0x02, 0xd5, 0x2d, 0xfc, 0xe1, 0x2c, 0xd4, 0x56, 0xce, 0x89, + 0x94, 0x63, 0xb1, 0xc9, 0x16, 0xa2, 0xed, 0x04, 0xaa, 0x1e, 0x65, 0x71, 0x4f, 0x8d, 0x70, 0x66, + 0x25, 0x6e, 0x44, 0xfd, 0xb9, 0x33, 0x53, 0x43, 0x31, 0x31, 0xb1, 0x55, 0x2f, 0xd9, 0xc4, 0x6f, + 0x40, 0x0c, 0x68, 0x3c, 0xac, 0x80, 0x67, 0xa1, 0x4a, 0x04, 0x76, 0xc8, 0x84, 0x6e, 0x7d, 0x09, + 0xd5, 0xb4, 0x7b, 0xf0, 0x26, 0xe4, 0xfd, 0x80, 0x78, 0x01, 0x8f, 0xc2, 0xbc, 0x2a, 0x1a, 0x18, + 0x41, 0x96, 0xda, 0x06, 0xcf, 0x72, 0x79, 0x95, 0xfd, 0xc5, 0x3f, 0x9d, 0x4d, 0x38, 0xcb, 0x27, + 0xfc, 0xf6, 0xe2, 0x8a, 0xa6, 0x34, 0xcf, 0xcf, 0x7b, 0xeb, 0x03, 0x58, 0x4d, 0x4d, 0xe0, 0xa2, + 0x43, 0xd7, 0x7e, 0x05, 0x2f, 0x2f, 0x55, 0x8d, 0x3f, 0x85, 0xcd, 0xa9, 0x6d, 0xda, 0x01, 0xf5, + 0x5c, 0x8f, 0xb2, 0x88, 0x15, 0x43, 0xc9, 0xff, 0x5e, 0x39, 0x27, 0xe6, 0x4e, 0x92, 0x6c, 0xa1, + 0x45, 0xdd, 0x98, 0x2e, 0x82, 0x37, 0x4b, 0xc5, 0xff, 0xac, 0xa0, 0x67, 0xcf, 0x9e, 0x3d, 0xcb, + 0xd4, 0x7e, 0x57, 0x80, 0xcd, 0x65, 0x7b, 0x66, 0xe9, 0xf6, 0xbd, 0x04, 0x05, 0x7b, 0x3a, 0x39, + 0xa5, 0x1e, 0x77, 0x52, 0x5e, 0x0d, 0x5b, 0xb8, 0x01, 0x79, 0x8b, 0x9c, 0x52, 0x4b, 0xce, 0x6d, + 0x4b, 0x3b, 0xd5, 0x5b, 0xef, 0x5c, 0x68, 0x57, 0xd6, 0x8f, 0x98, 0x88, 0x2a, 0x24, 0xf1, 0x47, + 0x90, 0x0b, 0x53, 0x34, 0xd3, 0x70, 0xf3, 0x62, 0x1a, 0xd8, 0x5e, 0x52, 0xb9, 0x1c, 0x7e, 0x05, + 0x4a, 0xec, 0x57, 0xc4, 0x46, 0x81, 0xdb, 0x5c, 0x64, 0x00, 0x8b, 0x0b, 0xbc, 0x05, 0x45, 0xbe, + 0x4d, 0x0c, 0x1a, 0x1d, 0x6d, 0x71, 0x9b, 0x05, 0x96, 0x41, 0x87, 0x64, 0x6a, 0x05, 0xda, 0x63, + 0x62, 0x4d, 0x29, 0x0f, 0xf8, 0x92, 0x5a, 0x09, 0xc1, 0x5f, 0x30, 0x0c, 0x5f, 0x85, 0xb2, 0xd8, + 0x55, 0xa6, 0x6d, 0xd0, 0xa7, 0x3c, 0x7b, 0xe6, 0x55, 0xb1, 0xd1, 0xda, 0x0c, 0x61, 0xc3, 0x3f, + 0xf4, 0x1d, 0x3b, 0x0a, 0x4d, 0x3e, 0x04, 0x03, 0xf8, 0xf0, 0x1f, 0xcc, 0x27, 0xee, 0xd7, 0x96, + 0x4f, 0x6f, 0x3e, 0xa6, 0x6a, 0x7f, 0xc9, 0x40, 0x8e, 0xe7, 0x8b, 0x35, 0x28, 0x0f, 0x3e, 0xeb, + 0x29, 0x5a, 0xab, 0x7b, 0xb2, 0x7f, 0xa4, 0x20, 0x09, 0x57, 0x01, 0x38, 0xf0, 0xe0, 0xa8, 0xdb, + 0x18, 0xa0, 0x4c, 0xdc, 0x6e, 0x77, 0x06, 0x77, 0x6f, 0xa3, 0x6c, 0x2c, 0x70, 0x22, 0x80, 0x5c, + 0x92, 0xf0, 0xfe, 0x2d, 0x94, 0xc7, 0x08, 0x2a, 0x42, 0x41, 0xfb, 0x53, 0xa5, 0x75, 0xf7, 0x36, + 0x2a, 0xa4, 0x91, 0xf7, 0x6f, 0xa1, 0x15, 0xbc, 0x0a, 0x25, 0x8e, 0xec, 0x77, 0xbb, 0x47, 0xa8, + 0x18, 0xeb, 0xec, 0x0f, 0xd4, 0x76, 0xe7, 0x00, 0x95, 0x62, 0x9d, 0x07, 0x6a, 0xf7, 0xa4, 0x87, + 0x20, 0xd6, 0x70, 0xac, 0xf4, 0xfb, 0x8d, 0x03, 0x05, 0x95, 0x63, 0xc6, 0xfe, 0x67, 0x03, 0xa5, + 0x8f, 0x2a, 0x29, 0xb3, 0xde, 0xbf, 0x85, 0x56, 0xe3, 0x21, 0x94, 0xce, 0xc9, 0x31, 0xaa, 0xe2, + 0x75, 0x58, 0x15, 0x43, 0x44, 0x46, 0xac, 0xcd, 0x41, 0x77, 0x6f, 0x23, 0x34, 0x33, 0x44, 0x68, + 0x59, 0x4f, 0x01, 0x77, 0x6f, 0x23, 0x5c, 0x6b, 0x42, 0x9e, 0x47, 0x17, 0xc6, 0x50, 0x3d, 0x6a, + 0xec, 0x2b, 0x47, 0x5a, 0xb7, 0x37, 0x68, 0x77, 0x3b, 0x8d, 0x23, 0x24, 0xcd, 0x30, 0x55, 0xf9, + 0xf9, 0x49, 0x5b, 0x55, 0x5a, 0x28, 0x93, 0xc4, 0x7a, 0x4a, 0x63, 0xa0, 0xb4, 0x50, 0xb6, 0xa6, + 0xc3, 0xe6, 0xb2, 0x3c, 0xb9, 0x74, 0x67, 0x24, 0x96, 0x38, 0x73, 0xce, 0x12, 0x73, 0x5d, 0x0b, + 0x4b, 0xfc, 0xcf, 0x0c, 0x6c, 0x2c, 0x39, 0x2b, 0x96, 0x0e, 0xf2, 0x13, 0xc8, 0x8b, 0x10, 0x15, + 0xa7, 0xe7, 0x8d, 0xa5, 0x87, 0x0e, 0x0f, 0xd8, 0x85, 0x13, 0x94, 0xcb, 0x25, 0x2b, 0x88, 0xec, + 0x39, 0x15, 0x04, 0x53, 0xb1, 0x90, 0xd3, 0x7f, 0xb9, 0x90, 0xd3, 0xc5, 0xb1, 0x77, 0xf7, 0x22, + 0xc7, 0x1e, 0xc7, 0xbe, 0x5b, 0x6e, 0xcf, 0x2f, 0xc9, 0xed, 0xf7, 0x61, 0x7d, 0x41, 0xd1, 0x85, + 0x73, 0xec, 0xaf, 0x25, 0x90, 0xcf, 0x73, 0xce, 0x73, 0x32, 0x5d, 0x26, 0x95, 0xe9, 0xee, 0xcf, + 0x7b, 0xf0, 0xda, 0xf9, 0x8b, 0xb0, 0xb0, 0xd6, 0x5f, 0x49, 0x70, 0x69, 0x79, 0xa5, 0xb8, 0xd4, + 0x86, 0x8f, 0xa0, 0x30, 0xa1, 0xc1, 0xd8, 0x89, 0xaa, 0xa5, 0xb7, 0x97, 0x9c, 0xc1, 0xac, 0x7b, + 0x7e, 0xb1, 0x43, 0xa9, 0xe4, 0x21, 0x9e, 0x3d, 0xaf, 0xdc, 0x13, 0xd6, 0x2c, 0x58, 0xfa, 0x9b, + 0x0c, 0xbc, 0xbc, 0x54, 0xf9, 0x52, 0x43, 0x5f, 0x03, 0x30, 0x6d, 0x77, 0x1a, 0x88, 0x8a, 0x48, + 0x24, 0xd8, 0x12, 0x47, 0x78, 0xf2, 0x62, 0xc9, 0x73, 0x1a, 0xc4, 0xfd, 0x59, 0xde, 0x0f, 0x02, + 0xe2, 0x84, 0x7b, 0x33, 0x43, 0x73, 0xdc, 0xd0, 0xd7, 0xcf, 0x99, 0xe9, 0x42, 0x60, 0xbe, 0x07, + 0x48, 0xb7, 0x4c, 0x6a, 0x07, 0x9a, 0x1f, 0x78, 0x94, 0x4c, 0x4c, 0x7b, 0xc4, 0x4f, 0x90, 0xe2, + 0x5e, 0x7e, 0x48, 0x2c, 0x9f, 0xaa, 0x6b, 0xa2, 0xbb, 0x1f, 0xf5, 0x32, 0x09, 0x1e, 0x40, 0x5e, + 0x42, 0xa2, 0x90, 0x92, 0x10, 0xdd, 0xb1, 0x44, 0xed, 0xeb, 0x22, 0x94, 0x13, 0x75, 0x35, 0xbe, + 0x06, 0x95, 0x87, 0xe4, 0x31, 0xd1, 0xa2, 0xbb, 0x92, 0xf0, 0x44, 0x99, 0x61, 0xbd, 0xf0, 0xbe, + 0xf4, 0x1e, 0x6c, 0x72, 0x8a, 0x33, 0x0d, 0xa8, 0xa7, 0xe9, 0x16, 0xf1, 0x7d, 0xee, 0xb4, 0x22, + 0xa7, 0x62, 0xd6, 0xd7, 0x65, 0x5d, 0xcd, 0xa8, 0x07, 0xdf, 0x81, 0x0d, 0x2e, 0x31, 0x99, 0x5a, + 0x81, 0xe9, 0x5a, 0x54, 0x63, 0xb7, 0x37, 0x9f, 0x9f, 0x24, 0xb1, 0x65, 0xeb, 0x8c, 0x71, 0x1c, + 0x12, 0x98, 0x45, 0x3e, 0x6e, 0xc1, 0x6b, 0x5c, 0x6c, 0x44, 0x6d, 0xea, 0x91, 0x80, 0x6a, 0xf4, + 0x8b, 0x29, 0xb1, 0x7c, 0x8d, 0xd8, 0x86, 0x36, 0x26, 0xfe, 0x58, 0xde, 0x64, 0x0a, 0xf6, 0x33, + 0xb2, 0xa4, 0x5e, 0x61, 0xc4, 0x83, 0x90, 0xa7, 0x70, 0x5a, 0xc3, 0x36, 0x3e, 0x26, 0xfe, 0x18, + 0xef, 0xc1, 0x25, 0xae, 0xc5, 0x0f, 0x3c, 0xd3, 0x1e, 0x69, 0xfa, 0x98, 0xea, 0x8f, 0xb4, 0x69, + 0x30, 0xbc, 0x27, 0xbf, 0x92, 0x1c, 0x9f, 0x5b, 0xd8, 0xe7, 0x9c, 0x26, 0xa3, 0x9c, 0x04, 0xc3, + 0x7b, 0xb8, 0x0f, 0x15, 0xb6, 0x18, 0x13, 0xf3, 0x4b, 0xaa, 0x0d, 0x1d, 0x8f, 0x1f, 0x8d, 0xd5, + 0x25, 0xa9, 0x29, 0xe1, 0xc1, 0x7a, 0x37, 0x14, 0x38, 0x76, 0x0c, 0xba, 0x97, 0xef, 0xf7, 0x14, + 0xa5, 0xa5, 0x96, 0x23, 0x2d, 0x0f, 0x1c, 0x8f, 0x05, 0xd4, 0xc8, 0x89, 0x1d, 0x5c, 0x16, 0x01, + 0x35, 0x72, 0x22, 0xf7, 0xde, 0x81, 0x0d, 0x5d, 0x17, 0x73, 0x36, 0x75, 0x2d, 0xbc, 0x63, 0xf9, + 0x32, 0x4a, 0x39, 0x4b, 0xd7, 0x0f, 0x04, 0x21, 0x8c, 0x71, 0x1f, 0x7f, 0x08, 0x2f, 0xcf, 0x9c, + 0x95, 0x14, 0x5c, 0x5f, 0x98, 0xe5, 0xbc, 0xe8, 0x1d, 0xd8, 0x70, 0xcf, 0x16, 0x05, 0x71, 0x6a, + 0x44, 0xf7, 0x6c, 0x5e, 0xec, 0x03, 0xd8, 0x74, 0xc7, 0xee, 0xa2, 0xdc, 0xcd, 0xa4, 0x1c, 0x76, + 0xc7, 0xee, 0xbc, 0xe0, 0x5b, 0xfc, 0xc2, 0xed, 0x51, 0x9d, 0x04, 0xd4, 0x90, 0x2f, 0x27, 0xe9, + 0x89, 0x0e, 0xbc, 0x0b, 0x48, 0xd7, 0x35, 0x6a, 0x93, 0x53, 0x8b, 0x6a, 0xc4, 0xa3, 0x36, 0xf1, + 0xe5, 0xab, 0x49, 0x72, 0x55, 0xd7, 0x15, 0xde, 0xdb, 0xe0, 0x9d, 0xf8, 0x26, 0xac, 0x3b, 0xa7, + 0x0f, 0x75, 0x11, 0x92, 0x9a, 0xeb, 0xd1, 0xa1, 0xf9, 0x54, 0x7e, 0x93, 0xfb, 0x77, 0x8d, 0x75, + 0xf0, 0x80, 0xec, 0x71, 0x18, 0xdf, 0x00, 0xa4, 0xfb, 0x63, 0xe2, 0xb9, 0x3c, 0x27, 0xfb, 0x2e, + 0xd1, 0xa9, 0xfc, 0x96, 0xa0, 0x0a, 0xbc, 0x13, 0xc1, 0x6c, 0x4b, 0xf8, 0x4f, 0xcc, 0x61, 0x10, + 0x69, 0xbc, 0x2e, 0xb6, 0x04, 0xc7, 0x42, 0x6d, 0x3b, 0x80, 0x98, 0x2b, 0x52, 0x03, 0xef, 0x70, + 0x5a, 0xd5, 0x1d, 0xbb, 0xc9, 0x71, 0xdf, 0x80, 0x55, 0xc6, 0x9c, 0x0d, 0x7a, 0x43, 0x14, 0x64, + 0xee, 0x38, 0x31, 0xe2, 0x0f, 0x56, 0x1b, 0xd7, 0xf6, 0xa0, 0x92, 0x8c, 0x4f, 0x5c, 0x02, 0x11, + 0xa1, 0x48, 0x62, 0xc5, 0x4a, 0xb3, 0xdb, 0x62, 0x65, 0xc6, 0xe7, 0x0a, 0xca, 0xb0, 0x72, 0xe7, + 0xa8, 0x3d, 0x50, 0x34, 0xf5, 0xa4, 0x33, 0x68, 0x1f, 0x2b, 0x28, 0x9b, 0xa8, 0xab, 0x0f, 0x73, + 0xc5, 0xb7, 0xd1, 0xf5, 0xda, 0x37, 0x19, 0xa8, 0xa6, 0x2f, 0x4a, 0xf8, 0xff, 0xe1, 0x72, 0xf4, + 0xaa, 0xe1, 0xd3, 0x40, 0x7b, 0x62, 0x7a, 0x7c, 0xe3, 0x4c, 0x88, 0x38, 0xc4, 0xe2, 0xa5, 0xdb, + 0x0c, 0x59, 0x7d, 0x1a, 0x7c, 0x62, 0x7a, 0x6c, 0x5b, 0x4c, 0x48, 0x80, 0x8f, 0xe0, 0xaa, 0xed, + 0x68, 0x7e, 0x40, 0x6c, 0x83, 0x78, 0x86, 0x36, 0x7b, 0x4f, 0xd2, 0x88, 0xae, 0x53, 0xdf, 0x77, + 0xc4, 0x81, 0x15, 0x6b, 0x79, 0xd5, 0x76, 0xfa, 0x21, 0x79, 0x96, 0xc9, 0x1b, 0x21, 0x75, 0x2e, + 0xcc, 0xb2, 0xe7, 0x85, 0xd9, 0x2b, 0x50, 0x9a, 0x10, 0x57, 0xa3, 0x76, 0xe0, 0x9d, 0xf1, 0xf2, + 0xb8, 0xa8, 0x16, 0x27, 0xc4, 0x55, 0x58, 0xfb, 0x85, 0xdc, 0x52, 0x0e, 0x73, 0xc5, 0x22, 0x2a, + 0x1d, 0xe6, 0x8a, 0x25, 0x04, 0xb5, 0x7f, 0x64, 0xa1, 0x92, 0x2c, 0x97, 0xd9, 0xed, 0x43, 0xe7, + 0x27, 0x8b, 0xc4, 0x73, 0xcf, 0x1b, 0xdf, 0x5a, 0x5c, 0xd7, 0x9b, 0xec, 0xc8, 0xd9, 0x2b, 0x88, + 0x22, 0x56, 0x15, 0x92, 0xec, 0xb8, 0x67, 0xd9, 0x86, 0x8a, 0xa2, 0xa1, 0xa8, 0x86, 0x2d, 0x7c, + 0x00, 0x85, 0x87, 0x3e, 0xd7, 0x5d, 0xe0, 0xba, 0xdf, 0xfc, 0x76, 0xdd, 0x87, 0x7d, 0xae, 0xbc, + 0x74, 0xd8, 0xd7, 0x3a, 0x5d, 0xf5, 0xb8, 0x71, 0xa4, 0x86, 0xe2, 0xf8, 0x0a, 0xe4, 0x2c, 0xf2, + 0xe5, 0x59, 0xfa, 0x70, 0xe2, 0xd0, 0x45, 0x17, 0xe1, 0x0a, 0xe4, 0x9e, 0x50, 0xf2, 0x28, 0x7d, + 0x24, 0x70, 0xe8, 0x07, 0xdc, 0x0c, 0xbb, 0x90, 0xe7, 0xfe, 0xc2, 0x00, 0xa1, 0xc7, 0xd0, 0x4b, + 0xb8, 0x08, 0xb9, 0x66, 0x57, 0x65, 0x1b, 0x02, 0x41, 0x45, 0xa0, 0x5a, 0xaf, 0xad, 0x34, 0x15, + 0x94, 0xa9, 0xdd, 0x81, 0x82, 0x70, 0x02, 0xdb, 0x2c, 0xb1, 0x1b, 0xd0, 0x4b, 0x61, 0x33, 0xd4, + 0x21, 0x45, 0xbd, 0x27, 0xc7, 0xfb, 0x8a, 0x8a, 0x32, 0xe9, 0xa5, 0xce, 0xa1, 0x7c, 0xcd, 0x87, + 0x4a, 0xb2, 0x5e, 0x7e, 0x31, 0x77, 0xe1, 0xbf, 0x4a, 0x50, 0x4e, 0xd4, 0xbf, 0xac, 0x70, 0x21, + 0x96, 0xe5, 0x3c, 0xd1, 0x88, 0x65, 0x12, 0x3f, 0x0c, 0x0d, 0xe0, 0x50, 0x83, 0x21, 0x17, 0x5d, + 0xba, 0x17, 0xb4, 0x45, 0xf2, 0xa8, 0x50, 0xfb, 0xa3, 0x04, 0x68, 0xbe, 0x00, 0x9d, 0x33, 0x53, + 0xfa, 0x31, 0xcd, 0xac, 0xfd, 0x41, 0x82, 0x6a, 0xba, 0xea, 0x9c, 0x33, 0xef, 0xda, 0x8f, 0x6a, + 0xde, 0xdf, 0x33, 0xb0, 0x9a, 0xaa, 0x35, 0x2f, 0x6a, 0xdd, 0x17, 0xb0, 0x6e, 0x1a, 0x74, 0xe2, + 0x3a, 0x01, 0xb5, 0xf5, 0x33, 0xcd, 0xa2, 0x8f, 0xa9, 0x25, 0xd7, 0x78, 0xd2, 0xd8, 0xfd, 0xf6, + 0x6a, 0xb6, 0xde, 0x9e, 0xc9, 0x1d, 0x31, 0xb1, 0xbd, 0x8d, 0x76, 0x4b, 0x39, 0xee, 0x75, 0x07, + 0x4a, 0xa7, 0xf9, 0x99, 0x76, 0xd2, 0xf9, 0x59, 0xa7, 0xfb, 0x49, 0x47, 0x45, 0xe6, 0x1c, 0xed, + 0x07, 0xdc, 0xf6, 0x3d, 0x40, 0xf3, 0x46, 0xe1, 0xcb, 0xb0, 0xcc, 0x2c, 0xf4, 0x12, 0xde, 0x80, + 0xb5, 0x4e, 0x57, 0xeb, 0xb7, 0x5b, 0x8a, 0xa6, 0x3c, 0x78, 0xa0, 0x34, 0x07, 0x7d, 0xf1, 0x3e, + 0x11, 0xb3, 0x07, 0xa9, 0x0d, 0x5e, 0xfb, 0x7d, 0x16, 0x36, 0x96, 0x58, 0x82, 0x1b, 0xe1, 0xcd, + 0x42, 0x5c, 0x76, 0xde, 0xbd, 0x88, 0xf5, 0x75, 0x56, 0x10, 0xf4, 0x88, 0x17, 0x84, 0x17, 0x91, + 0x1b, 0xc0, 0xbc, 0x64, 0x07, 0xe6, 0xd0, 0xa4, 0x5e, 0xf8, 0x9c, 0x23, 0xae, 0x1b, 0x6b, 0x33, + 0x5c, 0xbc, 0xe8, 0xfc, 0x1f, 0x60, 0xd7, 0xf1, 0xcd, 0xc0, 0x7c, 0x4c, 0x35, 0xd3, 0x8e, 0xde, + 0x7e, 0xd8, 0xf5, 0x23, 0xa7, 0xa2, 0xa8, 0xa7, 0x6d, 0x07, 0x31, 0xdb, 0xa6, 0x23, 0x32, 0xc7, + 0x66, 0xc9, 0x3c, 0xab, 0xa2, 0xa8, 0x27, 0x66, 0x5f, 0x83, 0x8a, 0xe1, 0x4c, 0x59, 0x4d, 0x26, + 0x78, 0xec, 0xec, 0x90, 0xd4, 0xb2, 0xc0, 0x62, 0x4a, 0x58, 0x6d, 0xcf, 0x1e, 0x9d, 0x2a, 0x6a, + 0x59, 0x60, 0x82, 0x72, 0x1d, 0xd6, 0xc8, 0x68, 0xe4, 0x31, 0xe5, 0x91, 0x22, 0x71, 0x7f, 0xa8, + 0xc6, 0x30, 0x27, 0x6e, 0x1d, 0x42, 0x31, 0xf2, 0x03, 0x3b, 0xaa, 0x99, 0x27, 0x34, 0x57, 0x5c, + 0x8a, 0x33, 0x3b, 0x25, 0xb5, 0x68, 0x47, 0x9d, 0xd7, 0xa0, 0x62, 0xfa, 0xda, 0xec, 0x0d, 0x3d, + 0xb3, 0x9d, 0xd9, 0x29, 0xaa, 0x65, 0xd3, 0x8f, 0xdf, 0x1f, 0x6b, 0x5f, 0x65, 0xa0, 0x9a, 0xfe, + 0x06, 0x80, 0x5b, 0x50, 0xb4, 0x1c, 0x9d, 0xf0, 0xd0, 0x12, 0x1f, 0xa0, 0x76, 0x9e, 0xf3, 0xd9, + 0xa0, 0x7e, 0x14, 0xf2, 0xd5, 0x58, 0x72, 0xeb, 0x6f, 0x12, 0x14, 0x23, 0x18, 0x5f, 0x82, 0x9c, + 0x4b, 0x82, 0x31, 0x57, 0x97, 0xdf, 0xcf, 0x20, 0x49, 0xe5, 0x6d, 0x86, 0xfb, 0x2e, 0xb1, 0x79, + 0x08, 0x84, 0x38, 0x6b, 0xb3, 0x75, 0xb5, 0x28, 0x31, 0xf8, 0xe5, 0xc4, 0x99, 0x4c, 0xa8, 0x1d, + 0xf8, 0xd1, 0xba, 0x86, 0x78, 0x33, 0x84, 0xf1, 0x3b, 0xb0, 0x1e, 0x78, 0xc4, 0xb4, 0x52, 0xdc, + 0x1c, 0xe7, 0xa2, 0xa8, 0x23, 0x26, 0xef, 0xc1, 0x95, 0x48, 0xaf, 0x41, 0x03, 0xa2, 0x8f, 0xa9, + 0x31, 0x13, 0x2a, 0xf0, 0x47, 0x88, 0xcb, 0x21, 0xa1, 0x15, 0xf6, 0x47, 0xb2, 0xb5, 0x6f, 0x24, + 0x58, 0x8f, 0xae, 0x53, 0x46, 0xec, 0xac, 0x63, 0x00, 0x62, 0xdb, 0x4e, 0x90, 0x74, 0xd7, 0x62, + 0x28, 0x2f, 0xc8, 0xd5, 0x1b, 0xb1, 0x90, 0x9a, 0x50, 0xb0, 0x35, 0x01, 0x98, 0xf5, 0x9c, 0xeb, + 0xb6, 0xab, 0x50, 0x0e, 0x3f, 0xf0, 0xf0, 0xaf, 0x84, 0xe2, 0x02, 0x0e, 0x02, 0x62, 0xf7, 0x2e, + 0xbc, 0x09, 0xf9, 0x53, 0x3a, 0x32, 0xed, 0xf0, 0xd9, 0x56, 0x34, 0xa2, 0x67, 0x92, 0x5c, 0xfc, + 0x4c, 0xb2, 0xff, 0x5b, 0x09, 0x36, 0x74, 0x67, 0x32, 0x6f, 0xef, 0x3e, 0x9a, 0x7b, 0x05, 0xf0, + 0x3f, 0x96, 0x3e, 0xff, 0x68, 0x64, 0x06, 0xe3, 0xe9, 0x69, 0x5d, 0x77, 0x26, 0xbb, 0x23, 0xc7, + 0x22, 0xf6, 0x68, 0xf6, 0x99, 0x93, 0xff, 0xd1, 0xdf, 0x1d, 0x51, 0xfb, 0xdd, 0x91, 0x93, 0xf8, + 0xe8, 0x79, 0x7f, 0xf6, 0xf7, 0xbf, 0x92, 0xf4, 0xa7, 0x4c, 0xf6, 0xa0, 0xb7, 0xff, 0xe7, 0xcc, + 0xd6, 0x81, 0x18, 0xae, 0x17, 0xb9, 0x47, 0xa5, 0x43, 0x8b, 0xea, 0x6c, 0xca, 0xff, 0x0b, 0x00, + 0x00, 0xff, 0xff, 0x1a, 0x28, 0x25, 0x79, 0x42, 0x1d, 0x00, 0x00, +} diff --git a/vendor/github.com/golang/protobuf/protoc-gen-go/descriptor/descriptor.proto b/vendor/github.com/golang/protobuf/protoc-gen-go/descriptor/descriptor.proto new file mode 100644 index 000000000000..8697a50de4a9 --- /dev/null +++ b/vendor/github.com/golang/protobuf/protoc-gen-go/descriptor/descriptor.proto @@ -0,0 +1,872 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// Author: kenton@google.com (Kenton Varda) +// Based on original Protocol Buffers design by +// Sanjay Ghemawat, Jeff Dean, and others. +// +// The messages in this file describe the definitions found in .proto files. +// A valid .proto file can be translated directly to a FileDescriptorProto +// without any other information (e.g. without reading its imports). + + +syntax = "proto2"; + +package google.protobuf; +option go_package = "github.com/golang/protobuf/protoc-gen-go/descriptor;descriptor"; +option java_package = "com.google.protobuf"; +option java_outer_classname = "DescriptorProtos"; +option csharp_namespace = "Google.Protobuf.Reflection"; +option objc_class_prefix = "GPB"; +option cc_enable_arenas = true; + +// descriptor.proto must be optimized for speed because reflection-based +// algorithms don't work during bootstrapping. +option optimize_for = SPEED; + +// The protocol compiler can output a FileDescriptorSet containing the .proto +// files it parses. +message FileDescriptorSet { + repeated FileDescriptorProto file = 1; +} + +// Describes a complete .proto file. +message FileDescriptorProto { + optional string name = 1; // file name, relative to root of source tree + optional string package = 2; // e.g. "foo", "foo.bar", etc. + + // Names of files imported by this file. + repeated string dependency = 3; + // Indexes of the public imported files in the dependency list above. + repeated int32 public_dependency = 10; + // Indexes of the weak imported files in the dependency list. + // For Google-internal migration only. Do not use. + repeated int32 weak_dependency = 11; + + // All top-level definitions in this file. + repeated DescriptorProto message_type = 4; + repeated EnumDescriptorProto enum_type = 5; + repeated ServiceDescriptorProto service = 6; + repeated FieldDescriptorProto extension = 7; + + optional FileOptions options = 8; + + // This field contains optional information about the original source code. + // You may safely remove this entire field without harming runtime + // functionality of the descriptors -- the information is needed only by + // development tools. + optional SourceCodeInfo source_code_info = 9; + + // The syntax of the proto file. + // The supported values are "proto2" and "proto3". + optional string syntax = 12; +} + +// Describes a message type. +message DescriptorProto { + optional string name = 1; + + repeated FieldDescriptorProto field = 2; + repeated FieldDescriptorProto extension = 6; + + repeated DescriptorProto nested_type = 3; + repeated EnumDescriptorProto enum_type = 4; + + message ExtensionRange { + optional int32 start = 1; + optional int32 end = 2; + + optional ExtensionRangeOptions options = 3; + } + repeated ExtensionRange extension_range = 5; + + repeated OneofDescriptorProto oneof_decl = 8; + + optional MessageOptions options = 7; + + // Range of reserved tag numbers. Reserved tag numbers may not be used by + // fields or extension ranges in the same message. Reserved ranges may + // not overlap. + message ReservedRange { + optional int32 start = 1; // Inclusive. + optional int32 end = 2; // Exclusive. + } + repeated ReservedRange reserved_range = 9; + // Reserved field names, which may not be used by fields in the same message. + // A given name may only be reserved once. + repeated string reserved_name = 10; +} + +message ExtensionRangeOptions { + // The parser stores options it doesn't recognize here. See above. + repeated UninterpretedOption uninterpreted_option = 999; + + // Clients can define custom options in extensions of this message. See above. + extensions 1000 to max; +} + +// Describes a field within a message. +message FieldDescriptorProto { + enum Type { + // 0 is reserved for errors. + // Order is weird for historical reasons. + TYPE_DOUBLE = 1; + TYPE_FLOAT = 2; + // Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT64 if + // negative values are likely. + TYPE_INT64 = 3; + TYPE_UINT64 = 4; + // Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT32 if + // negative values are likely. + TYPE_INT32 = 5; + TYPE_FIXED64 = 6; + TYPE_FIXED32 = 7; + TYPE_BOOL = 8; + TYPE_STRING = 9; + // Tag-delimited aggregate. + // Group type is deprecated and not supported in proto3. However, Proto3 + // implementations should still be able to parse the group wire format and + // treat group fields as unknown fields. + TYPE_GROUP = 10; + TYPE_MESSAGE = 11; // Length-delimited aggregate. + + // New in version 2. + TYPE_BYTES = 12; + TYPE_UINT32 = 13; + TYPE_ENUM = 14; + TYPE_SFIXED32 = 15; + TYPE_SFIXED64 = 16; + TYPE_SINT32 = 17; // Uses ZigZag encoding. + TYPE_SINT64 = 18; // Uses ZigZag encoding. + }; + + enum Label { + // 0 is reserved for errors + LABEL_OPTIONAL = 1; + LABEL_REQUIRED = 2; + LABEL_REPEATED = 3; + }; + + optional string name = 1; + optional int32 number = 3; + optional Label label = 4; + + // If type_name is set, this need not be set. If both this and type_name + // are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP. + optional Type type = 5; + + // For message and enum types, this is the name of the type. If the name + // starts with a '.', it is fully-qualified. Otherwise, C++-like scoping + // rules are used to find the type (i.e. first the nested types within this + // message are searched, then within the parent, on up to the root + // namespace). + optional string type_name = 6; + + // For extensions, this is the name of the type being extended. It is + // resolved in the same manner as type_name. + optional string extendee = 2; + + // For numeric types, contains the original text representation of the value. + // For booleans, "true" or "false". + // For strings, contains the default text contents (not escaped in any way). + // For bytes, contains the C escaped value. All bytes >= 128 are escaped. + // TODO(kenton): Base-64 encode? + optional string default_value = 7; + + // If set, gives the index of a oneof in the containing type's oneof_decl + // list. This field is a member of that oneof. + optional int32 oneof_index = 9; + + // JSON name of this field. The value is set by protocol compiler. If the + // user has set a "json_name" option on this field, that option's value + // will be used. Otherwise, it's deduced from the field's name by converting + // it to camelCase. + optional string json_name = 10; + + optional FieldOptions options = 8; +} + +// Describes a oneof. +message OneofDescriptorProto { + optional string name = 1; + optional OneofOptions options = 2; +} + +// Describes an enum type. +message EnumDescriptorProto { + optional string name = 1; + + repeated EnumValueDescriptorProto value = 2; + + optional EnumOptions options = 3; + + // Range of reserved numeric values. Reserved values may not be used by + // entries in the same enum. Reserved ranges may not overlap. + // + // Note that this is distinct from DescriptorProto.ReservedRange in that it + // is inclusive such that it can appropriately represent the entire int32 + // domain. + message EnumReservedRange { + optional int32 start = 1; // Inclusive. + optional int32 end = 2; // Inclusive. + } + + // Range of reserved numeric values. Reserved numeric values may not be used + // by enum values in the same enum declaration. Reserved ranges may not + // overlap. + repeated EnumReservedRange reserved_range = 4; + + // Reserved enum value names, which may not be reused. A given name may only + // be reserved once. + repeated string reserved_name = 5; +} + +// Describes a value within an enum. +message EnumValueDescriptorProto { + optional string name = 1; + optional int32 number = 2; + + optional EnumValueOptions options = 3; +} + +// Describes a service. +message ServiceDescriptorProto { + optional string name = 1; + repeated MethodDescriptorProto method = 2; + + optional ServiceOptions options = 3; +} + +// Describes a method of a service. +message MethodDescriptorProto { + optional string name = 1; + + // Input and output type names. These are resolved in the same way as + // FieldDescriptorProto.type_name, but must refer to a message type. + optional string input_type = 2; + optional string output_type = 3; + + optional MethodOptions options = 4; + + // Identifies if client streams multiple client messages + optional bool client_streaming = 5 [default=false]; + // Identifies if server streams multiple server messages + optional bool server_streaming = 6 [default=false]; +} + + +// =================================================================== +// Options + +// Each of the definitions above may have "options" attached. These are +// just annotations which may cause code to be generated slightly differently +// or may contain hints for code that manipulates protocol messages. +// +// Clients may define custom options as extensions of the *Options messages. +// These extensions may not yet be known at parsing time, so the parser cannot +// store the values in them. Instead it stores them in a field in the *Options +// message called uninterpreted_option. This field must have the same name +// across all *Options messages. We then use this field to populate the +// extensions when we build a descriptor, at which point all protos have been +// parsed and so all extensions are known. +// +// Extension numbers for custom options may be chosen as follows: +// * For options which will only be used within a single application or +// organization, or for experimental options, use field numbers 50000 +// through 99999. It is up to you to ensure that you do not use the +// same number for multiple options. +// * For options which will be published and used publicly by multiple +// independent entities, e-mail protobuf-global-extension-registry@google.com +// to reserve extension numbers. Simply provide your project name (e.g. +// Objective-C plugin) and your project website (if available) -- there's no +// need to explain how you intend to use them. Usually you only need one +// extension number. You can declare multiple options with only one extension +// number by putting them in a sub-message. See the Custom Options section of +// the docs for examples: +// https://developers.google.com/protocol-buffers/docs/proto#options +// If this turns out to be popular, a web service will be set up +// to automatically assign option numbers. + + +message FileOptions { + + // Sets the Java package where classes generated from this .proto will be + // placed. By default, the proto package is used, but this is often + // inappropriate because proto packages do not normally start with backwards + // domain names. + optional string java_package = 1; + + + // If set, all the classes from the .proto file are wrapped in a single + // outer class with the given name. This applies to both Proto1 + // (equivalent to the old "--one_java_file" option) and Proto2 (where + // a .proto always translates to a single class, but you may want to + // explicitly choose the class name). + optional string java_outer_classname = 8; + + // If set true, then the Java code generator will generate a separate .java + // file for each top-level message, enum, and service defined in the .proto + // file. Thus, these types will *not* be nested inside the outer class + // named by java_outer_classname. However, the outer class will still be + // generated to contain the file's getDescriptor() method as well as any + // top-level extensions defined in the file. + optional bool java_multiple_files = 10 [default=false]; + + // This option does nothing. + optional bool java_generate_equals_and_hash = 20 [deprecated=true]; + + // If set true, then the Java2 code generator will generate code that + // throws an exception whenever an attempt is made to assign a non-UTF-8 + // byte sequence to a string field. + // Message reflection will do the same. + // However, an extension field still accepts non-UTF-8 byte sequences. + // This option has no effect on when used with the lite runtime. + optional bool java_string_check_utf8 = 27 [default=false]; + + + // Generated classes can be optimized for speed or code size. + enum OptimizeMode { + SPEED = 1; // Generate complete code for parsing, serialization, + // etc. + CODE_SIZE = 2; // Use ReflectionOps to implement these methods. + LITE_RUNTIME = 3; // Generate code using MessageLite and the lite runtime. + } + optional OptimizeMode optimize_for = 9 [default=SPEED]; + + // Sets the Go package where structs generated from this .proto will be + // placed. If omitted, the Go package will be derived from the following: + // - The basename of the package import path, if provided. + // - Otherwise, the package statement in the .proto file, if present. + // - Otherwise, the basename of the .proto file, without extension. + optional string go_package = 11; + + + + // Should generic services be generated in each language? "Generic" services + // are not specific to any particular RPC system. They are generated by the + // main code generators in each language (without additional plugins). + // Generic services were the only kind of service generation supported by + // early versions of google.protobuf. + // + // Generic services are now considered deprecated in favor of using plugins + // that generate code specific to your particular RPC system. Therefore, + // these default to false. Old code which depends on generic services should + // explicitly set them to true. + optional bool cc_generic_services = 16 [default=false]; + optional bool java_generic_services = 17 [default=false]; + optional bool py_generic_services = 18 [default=false]; + optional bool php_generic_services = 42 [default=false]; + + // Is this file deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for everything in the file, or it will be completely ignored; in the very + // least, this is a formalization for deprecating files. + optional bool deprecated = 23 [default=false]; + + // Enables the use of arenas for the proto messages in this file. This applies + // only to generated classes for C++. + optional bool cc_enable_arenas = 31 [default=false]; + + + // Sets the objective c class prefix which is prepended to all objective c + // generated classes from this .proto. There is no default. + optional string objc_class_prefix = 36; + + // Namespace for generated classes; defaults to the package. + optional string csharp_namespace = 37; + + // By default Swift generators will take the proto package and CamelCase it + // replacing '.' with underscore and use that to prefix the types/symbols + // defined. When this options is provided, they will use this value instead + // to prefix the types/symbols defined. + optional string swift_prefix = 39; + + // Sets the php class prefix which is prepended to all php generated classes + // from this .proto. Default is empty. + optional string php_class_prefix = 40; + + // Use this option to change the namespace of php generated classes. Default + // is empty. When this option is empty, the package name will be used for + // determining the namespace. + optional string php_namespace = 41; + + // The parser stores options it doesn't recognize here. + // See the documentation for the "Options" section above. + repeated UninterpretedOption uninterpreted_option = 999; + + // Clients can define custom options in extensions of this message. + // See the documentation for the "Options" section above. + extensions 1000 to max; + + reserved 38; +} + +message MessageOptions { + // Set true to use the old proto1 MessageSet wire format for extensions. + // This is provided for backwards-compatibility with the MessageSet wire + // format. You should not use this for any other reason: It's less + // efficient, has fewer features, and is more complicated. + // + // The message must be defined exactly as follows: + // message Foo { + // option message_set_wire_format = true; + // extensions 4 to max; + // } + // Note that the message cannot have any defined fields; MessageSets only + // have extensions. + // + // All extensions of your type must be singular messages; e.g. they cannot + // be int32s, enums, or repeated messages. + // + // Because this is an option, the above two restrictions are not enforced by + // the protocol compiler. + optional bool message_set_wire_format = 1 [default=false]; + + // Disables the generation of the standard "descriptor()" accessor, which can + // conflict with a field of the same name. This is meant to make migration + // from proto1 easier; new code should avoid fields named "descriptor". + optional bool no_standard_descriptor_accessor = 2 [default=false]; + + // Is this message deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for the message, or it will be completely ignored; in the very least, + // this is a formalization for deprecating messages. + optional bool deprecated = 3 [default=false]; + + // Whether the message is an automatically generated map entry type for the + // maps field. + // + // For maps fields: + // map map_field = 1; + // The parsed descriptor looks like: + // message MapFieldEntry { + // option map_entry = true; + // optional KeyType key = 1; + // optional ValueType value = 2; + // } + // repeated MapFieldEntry map_field = 1; + // + // Implementations may choose not to generate the map_entry=true message, but + // use a native map in the target language to hold the keys and values. + // The reflection APIs in such implementions still need to work as + // if the field is a repeated message field. + // + // NOTE: Do not set the option in .proto files. Always use the maps syntax + // instead. The option should only be implicitly set by the proto compiler + // parser. + optional bool map_entry = 7; + + reserved 8; // javalite_serializable + reserved 9; // javanano_as_lite + + // The parser stores options it doesn't recognize here. See above. + repeated UninterpretedOption uninterpreted_option = 999; + + // Clients can define custom options in extensions of this message. See above. + extensions 1000 to max; +} + +message FieldOptions { + // The ctype option instructs the C++ code generator to use a different + // representation of the field than it normally would. See the specific + // options below. This option is not yet implemented in the open source + // release -- sorry, we'll try to include it in a future version! + optional CType ctype = 1 [default = STRING]; + enum CType { + // Default mode. + STRING = 0; + + CORD = 1; + + STRING_PIECE = 2; + } + // The packed option can be enabled for repeated primitive fields to enable + // a more efficient representation on the wire. Rather than repeatedly + // writing the tag and type for each element, the entire array is encoded as + // a single length-delimited blob. In proto3, only explicit setting it to + // false will avoid using packed encoding. + optional bool packed = 2; + + // The jstype option determines the JavaScript type used for values of the + // field. The option is permitted only for 64 bit integral and fixed types + // (int64, uint64, sint64, fixed64, sfixed64). A field with jstype JS_STRING + // is represented as JavaScript string, which avoids loss of precision that + // can happen when a large value is converted to a floating point JavaScript. + // Specifying JS_NUMBER for the jstype causes the generated JavaScript code to + // use the JavaScript "number" type. The behavior of the default option + // JS_NORMAL is implementation dependent. + // + // This option is an enum to permit additional types to be added, e.g. + // goog.math.Integer. + optional JSType jstype = 6 [default = JS_NORMAL]; + enum JSType { + // Use the default type. + JS_NORMAL = 0; + + // Use JavaScript strings. + JS_STRING = 1; + + // Use JavaScript numbers. + JS_NUMBER = 2; + } + + // Should this field be parsed lazily? Lazy applies only to message-type + // fields. It means that when the outer message is initially parsed, the + // inner message's contents will not be parsed but instead stored in encoded + // form. The inner message will actually be parsed when it is first accessed. + // + // This is only a hint. Implementations are free to choose whether to use + // eager or lazy parsing regardless of the value of this option. However, + // setting this option true suggests that the protocol author believes that + // using lazy parsing on this field is worth the additional bookkeeping + // overhead typically needed to implement it. + // + // This option does not affect the public interface of any generated code; + // all method signatures remain the same. Furthermore, thread-safety of the + // interface is not affected by this option; const methods remain safe to + // call from multiple threads concurrently, while non-const methods continue + // to require exclusive access. + // + // + // Note that implementations may choose not to check required fields within + // a lazy sub-message. That is, calling IsInitialized() on the outer message + // may return true even if the inner message has missing required fields. + // This is necessary because otherwise the inner message would have to be + // parsed in order to perform the check, defeating the purpose of lazy + // parsing. An implementation which chooses not to check required fields + // must be consistent about it. That is, for any particular sub-message, the + // implementation must either *always* check its required fields, or *never* + // check its required fields, regardless of whether or not the message has + // been parsed. + optional bool lazy = 5 [default=false]; + + // Is this field deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for accessors, or it will be completely ignored; in the very least, this + // is a formalization for deprecating fields. + optional bool deprecated = 3 [default=false]; + + // For Google-internal migration only. Do not use. + optional bool weak = 10 [default=false]; + + + // The parser stores options it doesn't recognize here. See above. + repeated UninterpretedOption uninterpreted_option = 999; + + // Clients can define custom options in extensions of this message. See above. + extensions 1000 to max; + + reserved 4; // removed jtype +} + +message OneofOptions { + // The parser stores options it doesn't recognize here. See above. + repeated UninterpretedOption uninterpreted_option = 999; + + // Clients can define custom options in extensions of this message. See above. + extensions 1000 to max; +} + +message EnumOptions { + + // Set this option to true to allow mapping different tag names to the same + // value. + optional bool allow_alias = 2; + + // Is this enum deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for the enum, or it will be completely ignored; in the very least, this + // is a formalization for deprecating enums. + optional bool deprecated = 3 [default=false]; + + reserved 5; // javanano_as_lite + + // The parser stores options it doesn't recognize here. See above. + repeated UninterpretedOption uninterpreted_option = 999; + + // Clients can define custom options in extensions of this message. See above. + extensions 1000 to max; +} + +message EnumValueOptions { + // Is this enum value deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for the enum value, or it will be completely ignored; in the very least, + // this is a formalization for deprecating enum values. + optional bool deprecated = 1 [default=false]; + + // The parser stores options it doesn't recognize here. See above. + repeated UninterpretedOption uninterpreted_option = 999; + + // Clients can define custom options in extensions of this message. See above. + extensions 1000 to max; +} + +message ServiceOptions { + + // Note: Field numbers 1 through 32 are reserved for Google's internal RPC + // framework. We apologize for hoarding these numbers to ourselves, but + // we were already using them long before we decided to release Protocol + // Buffers. + + // Is this service deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for the service, or it will be completely ignored; in the very least, + // this is a formalization for deprecating services. + optional bool deprecated = 33 [default=false]; + + // The parser stores options it doesn't recognize here. See above. + repeated UninterpretedOption uninterpreted_option = 999; + + // Clients can define custom options in extensions of this message. See above. + extensions 1000 to max; +} + +message MethodOptions { + + // Note: Field numbers 1 through 32 are reserved for Google's internal RPC + // framework. We apologize for hoarding these numbers to ourselves, but + // we were already using them long before we decided to release Protocol + // Buffers. + + // Is this method deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for the method, or it will be completely ignored; in the very least, + // this is a formalization for deprecating methods. + optional bool deprecated = 33 [default=false]; + + // Is this method side-effect-free (or safe in HTTP parlance), or idempotent, + // or neither? HTTP based RPC implementation may choose GET verb for safe + // methods, and PUT verb for idempotent methods instead of the default POST. + enum IdempotencyLevel { + IDEMPOTENCY_UNKNOWN = 0; + NO_SIDE_EFFECTS = 1; // implies idempotent + IDEMPOTENT = 2; // idempotent, but may have side effects + } + optional IdempotencyLevel idempotency_level = + 34 [default=IDEMPOTENCY_UNKNOWN]; + + // The parser stores options it doesn't recognize here. See above. + repeated UninterpretedOption uninterpreted_option = 999; + + // Clients can define custom options in extensions of this message. See above. + extensions 1000 to max; +} + + +// A message representing a option the parser does not recognize. This only +// appears in options protos created by the compiler::Parser class. +// DescriptorPool resolves these when building Descriptor objects. Therefore, +// options protos in descriptor objects (e.g. returned by Descriptor::options(), +// or produced by Descriptor::CopyTo()) will never have UninterpretedOptions +// in them. +message UninterpretedOption { + // The name of the uninterpreted option. Each string represents a segment in + // a dot-separated name. is_extension is true iff a segment represents an + // extension (denoted with parentheses in options specs in .proto files). + // E.g.,{ ["foo", false], ["bar.baz", true], ["qux", false] } represents + // "foo.(bar.baz).qux". + message NamePart { + required string name_part = 1; + required bool is_extension = 2; + } + repeated NamePart name = 2; + + // The value of the uninterpreted option, in whatever type the tokenizer + // identified it as during parsing. Exactly one of these should be set. + optional string identifier_value = 3; + optional uint64 positive_int_value = 4; + optional int64 negative_int_value = 5; + optional double double_value = 6; + optional bytes string_value = 7; + optional string aggregate_value = 8; +} + +// =================================================================== +// Optional source code info + +// Encapsulates information about the original source file from which a +// FileDescriptorProto was generated. +message SourceCodeInfo { + // A Location identifies a piece of source code in a .proto file which + // corresponds to a particular definition. This information is intended + // to be useful to IDEs, code indexers, documentation generators, and similar + // tools. + // + // For example, say we have a file like: + // message Foo { + // optional string foo = 1; + // } + // Let's look at just the field definition: + // optional string foo = 1; + // ^ ^^ ^^ ^ ^^^ + // a bc de f ghi + // We have the following locations: + // span path represents + // [a,i) [ 4, 0, 2, 0 ] The whole field definition. + // [a,b) [ 4, 0, 2, 0, 4 ] The label (optional). + // [c,d) [ 4, 0, 2, 0, 5 ] The type (string). + // [e,f) [ 4, 0, 2, 0, 1 ] The name (foo). + // [g,h) [ 4, 0, 2, 0, 3 ] The number (1). + // + // Notes: + // - A location may refer to a repeated field itself (i.e. not to any + // particular index within it). This is used whenever a set of elements are + // logically enclosed in a single code segment. For example, an entire + // extend block (possibly containing multiple extension definitions) will + // have an outer location whose path refers to the "extensions" repeated + // field without an index. + // - Multiple locations may have the same path. This happens when a single + // logical declaration is spread out across multiple places. The most + // obvious example is the "extend" block again -- there may be multiple + // extend blocks in the same scope, each of which will have the same path. + // - A location's span is not always a subset of its parent's span. For + // example, the "extendee" of an extension declaration appears at the + // beginning of the "extend" block and is shared by all extensions within + // the block. + // - Just because a location's span is a subset of some other location's span + // does not mean that it is a descendent. For example, a "group" defines + // both a type and a field in a single declaration. Thus, the locations + // corresponding to the type and field and their components will overlap. + // - Code which tries to interpret locations should probably be designed to + // ignore those that it doesn't understand, as more types of locations could + // be recorded in the future. + repeated Location location = 1; + message Location { + // Identifies which part of the FileDescriptorProto was defined at this + // location. + // + // Each element is a field number or an index. They form a path from + // the root FileDescriptorProto to the place where the definition. For + // example, this path: + // [ 4, 3, 2, 7, 1 ] + // refers to: + // file.message_type(3) // 4, 3 + // .field(7) // 2, 7 + // .name() // 1 + // This is because FileDescriptorProto.message_type has field number 4: + // repeated DescriptorProto message_type = 4; + // and DescriptorProto.field has field number 2: + // repeated FieldDescriptorProto field = 2; + // and FieldDescriptorProto.name has field number 1: + // optional string name = 1; + // + // Thus, the above path gives the location of a field name. If we removed + // the last element: + // [ 4, 3, 2, 7 ] + // this path refers to the whole field declaration (from the beginning + // of the label to the terminating semicolon). + repeated int32 path = 1 [packed=true]; + + // Always has exactly three or four elements: start line, start column, + // end line (optional, otherwise assumed same as start line), end column. + // These are packed into a single field for efficiency. Note that line + // and column numbers are zero-based -- typically you will want to add + // 1 to each before displaying to a user. + repeated int32 span = 2 [packed=true]; + + // If this SourceCodeInfo represents a complete declaration, these are any + // comments appearing before and after the declaration which appear to be + // attached to the declaration. + // + // A series of line comments appearing on consecutive lines, with no other + // tokens appearing on those lines, will be treated as a single comment. + // + // leading_detached_comments will keep paragraphs of comments that appear + // before (but not connected to) the current element. Each paragraph, + // separated by empty lines, will be one comment element in the repeated + // field. + // + // Only the comment content is provided; comment markers (e.g. //) are + // stripped out. For block comments, leading whitespace and an asterisk + // will be stripped from the beginning of each line other than the first. + // Newlines are included in the output. + // + // Examples: + // + // optional int32 foo = 1; // Comment attached to foo. + // // Comment attached to bar. + // optional int32 bar = 2; + // + // optional string baz = 3; + // // Comment attached to baz. + // // Another line attached to baz. + // + // // Comment attached to qux. + // // + // // Another line attached to qux. + // optional double qux = 4; + // + // // Detached comment for corge. This is not leading or trailing comments + // // to qux or corge because there are blank lines separating it from + // // both. + // + // // Detached comment for corge paragraph 2. + // + // optional string corge = 5; + // /* Block comment attached + // * to corge. Leading asterisks + // * will be removed. */ + // /* Block comment attached to + // * grault. */ + // optional int32 grault = 6; + // + // // ignored detached comments. + optional string leading_comments = 3; + optional string trailing_comments = 4; + repeated string leading_detached_comments = 6; + } +} + +// Describes the relationship between generated code and its original source +// file. A GeneratedCodeInfo message is associated with only one generated +// source file, but may contain references to different source .proto files. +message GeneratedCodeInfo { + // An Annotation connects some span of text in generated code to an element + // of its generating .proto file. + repeated Annotation annotation = 1; + message Annotation { + // Identifies the element in the original source .proto file. This field + // is formatted the same as SourceCodeInfo.Location.path. + repeated int32 path = 1 [packed=true]; + + // Identifies the filesystem path to the original source .proto. + optional string source_file = 2; + + // Identifies the starting offset in bytes in the generated code + // that relates to the identified object. + optional int32 begin = 3; + + // Identifies the ending offset in bytes in the generated code that + // relates to the identified offset. The end offset should be one past + // the last relevant byte (so the length of the text = end - begin). + optional int32 end = 4; + } +} diff --git a/vendor/github.com/lyft/protoc-gen-validate/LICENSE b/vendor/github.com/lyft/protoc-gen-validate/LICENSE new file mode 100644 index 000000000000..d64569567334 --- /dev/null +++ b/vendor/github.com/lyft/protoc-gen-validate/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/vendor/github.com/lyft/protoc-gen-validate/validate/BUILD b/vendor/github.com/lyft/protoc-gen-validate/validate/BUILD new file mode 100644 index 000000000000..9493d1dc21c2 --- /dev/null +++ b/vendor/github.com/lyft/protoc-gen-validate/validate/BUILD @@ -0,0 +1,48 @@ +# gazelle:exclude validate.pb.go + +load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") +load("@com_google_protobuf//:protobuf.bzl", "py_proto_library") + +proto_library( + name = "validate_proto", + srcs = ["validate.proto"], + deps = [ + "@com_google_protobuf//:descriptor_proto", + "@com_google_protobuf//:duration_proto", + "@com_google_protobuf//:timestamp_proto", + ], + visibility = ["//visibility:public"], +) + +cc_proto_library( + name = "validate_cc", + deps = [":validate_proto"], + visibility = ["//visibility:public"], +) + +py_proto_library( + name = "validate_py", + srcs = ["validate.proto"], + protoc = "@com_google_protobuf//:protoc", + default_runtime = "@com_google_protobuf//:protobuf_python", + deps = ["@com_google_protobuf//:protobuf_python"], + visibility = ["//visibility:public"], +) + +go_proto_library( + name = "go_default_library", + proto = ":validate_proto", + deps = [ + "@com_github_golang_protobuf//ptypes/duration:go_default_library", + "@com_github_golang_protobuf//ptypes/timestamp:go_default_library", + "@io_bazel_rules_go//proto/wkt:descriptor_go_proto", + ], + importpath = "github.com/lyft/protoc-gen-validate/validate", + visibility = ["//visibility:public"], +) + +cc_library( + name = "cc_validate", + hdrs = ["validate.h"], + visibility = ["//visibility:public"], +) diff --git a/vendor/github.com/lyft/protoc-gen-validate/validate/validate.h b/vendor/github.com/lyft/protoc-gen-validate/validate/validate.h new file mode 100644 index 000000000000..80a48eba55f5 --- /dev/null +++ b/vendor/github.com/lyft/protoc-gen-validate/validate/validate.h @@ -0,0 +1,87 @@ +#ifndef _VALIDATE_H +#define _VALIDATE_H + +#include +#include +#include +#include + +#include +#include + +// It looks like one of the above protobuf headers includes windows.h. This +// causes GetMessage to be defined to GetMessageA or GetMessageW, interfering +// with the protobuf code +#if defined(WIN32) && defined(GetMessage) +#undef GetMessage +#endif + +namespace pgv { +using std::string; + +namespace protobuf = google::protobuf; +namespace protobuf_wkt = google::protobuf; + +class UnimplementedException : public std::runtime_error { +public: + UnimplementedException() : std::runtime_error("not yet implemented") {} + // Thrown by C++ validation code that is not yet implemented. +}; + +using ValidationMsg = std::string; + +class BaseValidator { +protected: + static std::map validators; +}; + +#if !defined(WIN32) +std::map __attribute__((weak)) BaseValidator::validators; +#else +__declspec(selectany) std::map BaseValidator::validators; +#endif + +template +class Validator : public BaseValidator { +public: + Validator(std::function check) : check_(check) + { + validators[typeid(T).hash_code()] = this; + } + + static bool CheckMessage(const T& m, ValidationMsg* err) + { + auto val = static_cast*>(validators[typeid(T).hash_code()]); + if (val) { + return val->check_(m, err); + } + return true; + } + +private: + std::function check_; +}; + +static inline std::string String(const ValidationMsg& msg) +{ + return std::string(msg); +} + +static inline bool IsPrefix(const string& maybe_prefix, const string& search_in) +{ + return search_in.compare(0, maybe_prefix.size(), maybe_prefix) == 0; +} + +static inline bool IsSuffix(const string& maybe_suffix, const string& search_in) +{ + return maybe_suffix.size() <= search_in.size() && search_in.compare(search_in.size() - maybe_suffix.size(), maybe_suffix.size(), maybe_suffix) == 0; +} + +static inline bool Contains(const string& search_in, const string& to_find) +{ + return search_in.find(to_find) != string::npos; +} + +} // namespace pgv + +#endif // _VALIDATE_H diff --git a/vendor/github.com/lyft/protoc-gen-validate/validate/validate.pb.go b/vendor/github.com/lyft/protoc-gen-validate/validate/validate.pb.go new file mode 100644 index 000000000000..ef5938c83198 --- /dev/null +++ b/vendor/github.com/lyft/protoc-gen-validate/validate/validate.pb.go @@ -0,0 +1,3154 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: validate/validate.proto + +package validate // import "github.com/lyft/protoc-gen-validate/validate" + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" +import descriptor "github.com/golang/protobuf/protoc-gen-go/descriptor" +import duration "github.com/golang/protobuf/ptypes/duration" +import timestamp "github.com/golang/protobuf/ptypes/timestamp" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + +type FieldRules struct { + // Types that are valid to be assigned to Type: + // *FieldRules_Float + // *FieldRules_Double + // *FieldRules_Int32 + // *FieldRules_Int64 + // *FieldRules_Uint32 + // *FieldRules_Uint64 + // *FieldRules_Sint32 + // *FieldRules_Sint64 + // *FieldRules_Fixed32 + // *FieldRules_Fixed64 + // *FieldRules_Sfixed32 + // *FieldRules_Sfixed64 + // *FieldRules_Bool + // *FieldRules_String_ + // *FieldRules_Bytes + // *FieldRules_Enum + // *FieldRules_Message + // *FieldRules_Repeated + // *FieldRules_Map + // *FieldRules_Any + // *FieldRules_Duration + // *FieldRules_Timestamp + Type isFieldRules_Type `protobuf_oneof:"type"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *FieldRules) Reset() { *m = FieldRules{} } +func (m *FieldRules) String() string { return proto.CompactTextString(m) } +func (*FieldRules) ProtoMessage() {} +func (*FieldRules) Descriptor() ([]byte, []int) { + return fileDescriptor_validate_42a9c75c83428773, []int{0} +} +func (m *FieldRules) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_FieldRules.Unmarshal(m, b) +} +func (m *FieldRules) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_FieldRules.Marshal(b, m, deterministic) +} +func (dst *FieldRules) XXX_Merge(src proto.Message) { + xxx_messageInfo_FieldRules.Merge(dst, src) +} +func (m *FieldRules) XXX_Size() int { + return xxx_messageInfo_FieldRules.Size(m) +} +func (m *FieldRules) XXX_DiscardUnknown() { + xxx_messageInfo_FieldRules.DiscardUnknown(m) +} + +var xxx_messageInfo_FieldRules proto.InternalMessageInfo + +type isFieldRules_Type interface { + isFieldRules_Type() +} + +type FieldRules_Float struct { + Float *FloatRules `protobuf:"bytes,1,opt,name=float,oneof"` +} +type FieldRules_Double struct { + Double *DoubleRules `protobuf:"bytes,2,opt,name=double,oneof"` +} +type FieldRules_Int32 struct { + Int32 *Int32Rules `protobuf:"bytes,3,opt,name=int32,oneof"` +} +type FieldRules_Int64 struct { + Int64 *Int64Rules `protobuf:"bytes,4,opt,name=int64,oneof"` +} +type FieldRules_Uint32 struct { + Uint32 *UInt32Rules `protobuf:"bytes,5,opt,name=uint32,oneof"` +} +type FieldRules_Uint64 struct { + Uint64 *UInt64Rules `protobuf:"bytes,6,opt,name=uint64,oneof"` +} +type FieldRules_Sint32 struct { + Sint32 *SInt32Rules `protobuf:"bytes,7,opt,name=sint32,oneof"` +} +type FieldRules_Sint64 struct { + Sint64 *SInt64Rules `protobuf:"bytes,8,opt,name=sint64,oneof"` +} +type FieldRules_Fixed32 struct { + Fixed32 *Fixed32Rules `protobuf:"bytes,9,opt,name=fixed32,oneof"` +} +type FieldRules_Fixed64 struct { + Fixed64 *Fixed64Rules `protobuf:"bytes,10,opt,name=fixed64,oneof"` +} +type FieldRules_Sfixed32 struct { + Sfixed32 *SFixed32Rules `protobuf:"bytes,11,opt,name=sfixed32,oneof"` +} +type FieldRules_Sfixed64 struct { + Sfixed64 *SFixed64Rules `protobuf:"bytes,12,opt,name=sfixed64,oneof"` +} +type FieldRules_Bool struct { + Bool *BoolRules `protobuf:"bytes,13,opt,name=bool,oneof"` +} +type FieldRules_String_ struct { + String_ *StringRules `protobuf:"bytes,14,opt,name=string,oneof"` +} +type FieldRules_Bytes struct { + Bytes *BytesRules `protobuf:"bytes,15,opt,name=bytes,oneof"` +} +type FieldRules_Enum struct { + Enum *EnumRules `protobuf:"bytes,16,opt,name=enum,oneof"` +} +type FieldRules_Message struct { + Message *MessageRules `protobuf:"bytes,17,opt,name=message,oneof"` +} +type FieldRules_Repeated struct { + Repeated *RepeatedRules `protobuf:"bytes,18,opt,name=repeated,oneof"` +} +type FieldRules_Map struct { + Map *MapRules `protobuf:"bytes,19,opt,name=map,oneof"` +} +type FieldRules_Any struct { + Any *AnyRules `protobuf:"bytes,20,opt,name=any,oneof"` +} +type FieldRules_Duration struct { + Duration *DurationRules `protobuf:"bytes,21,opt,name=duration,oneof"` +} +type FieldRules_Timestamp struct { + Timestamp *TimestampRules `protobuf:"bytes,22,opt,name=timestamp,oneof"` +} + +func (*FieldRules_Float) isFieldRules_Type() {} +func (*FieldRules_Double) isFieldRules_Type() {} +func (*FieldRules_Int32) isFieldRules_Type() {} +func (*FieldRules_Int64) isFieldRules_Type() {} +func (*FieldRules_Uint32) isFieldRules_Type() {} +func (*FieldRules_Uint64) isFieldRules_Type() {} +func (*FieldRules_Sint32) isFieldRules_Type() {} +func (*FieldRules_Sint64) isFieldRules_Type() {} +func (*FieldRules_Fixed32) isFieldRules_Type() {} +func (*FieldRules_Fixed64) isFieldRules_Type() {} +func (*FieldRules_Sfixed32) isFieldRules_Type() {} +func (*FieldRules_Sfixed64) isFieldRules_Type() {} +func (*FieldRules_Bool) isFieldRules_Type() {} +func (*FieldRules_String_) isFieldRules_Type() {} +func (*FieldRules_Bytes) isFieldRules_Type() {} +func (*FieldRules_Enum) isFieldRules_Type() {} +func (*FieldRules_Message) isFieldRules_Type() {} +func (*FieldRules_Repeated) isFieldRules_Type() {} +func (*FieldRules_Map) isFieldRules_Type() {} +func (*FieldRules_Any) isFieldRules_Type() {} +func (*FieldRules_Duration) isFieldRules_Type() {} +func (*FieldRules_Timestamp) isFieldRules_Type() {} + +func (m *FieldRules) GetType() isFieldRules_Type { + if m != nil { + return m.Type + } + return nil +} + +func (m *FieldRules) GetFloat() *FloatRules { + if x, ok := m.GetType().(*FieldRules_Float); ok { + return x.Float + } + return nil +} + +func (m *FieldRules) GetDouble() *DoubleRules { + if x, ok := m.GetType().(*FieldRules_Double); ok { + return x.Double + } + return nil +} + +func (m *FieldRules) GetInt32() *Int32Rules { + if x, ok := m.GetType().(*FieldRules_Int32); ok { + return x.Int32 + } + return nil +} + +func (m *FieldRules) GetInt64() *Int64Rules { + if x, ok := m.GetType().(*FieldRules_Int64); ok { + return x.Int64 + } + return nil +} + +func (m *FieldRules) GetUint32() *UInt32Rules { + if x, ok := m.GetType().(*FieldRules_Uint32); ok { + return x.Uint32 + } + return nil +} + +func (m *FieldRules) GetUint64() *UInt64Rules { + if x, ok := m.GetType().(*FieldRules_Uint64); ok { + return x.Uint64 + } + return nil +} + +func (m *FieldRules) GetSint32() *SInt32Rules { + if x, ok := m.GetType().(*FieldRules_Sint32); ok { + return x.Sint32 + } + return nil +} + +func (m *FieldRules) GetSint64() *SInt64Rules { + if x, ok := m.GetType().(*FieldRules_Sint64); ok { + return x.Sint64 + } + return nil +} + +func (m *FieldRules) GetFixed32() *Fixed32Rules { + if x, ok := m.GetType().(*FieldRules_Fixed32); ok { + return x.Fixed32 + } + return nil +} + +func (m *FieldRules) GetFixed64() *Fixed64Rules { + if x, ok := m.GetType().(*FieldRules_Fixed64); ok { + return x.Fixed64 + } + return nil +} + +func (m *FieldRules) GetSfixed32() *SFixed32Rules { + if x, ok := m.GetType().(*FieldRules_Sfixed32); ok { + return x.Sfixed32 + } + return nil +} + +func (m *FieldRules) GetSfixed64() *SFixed64Rules { + if x, ok := m.GetType().(*FieldRules_Sfixed64); ok { + return x.Sfixed64 + } + return nil +} + +func (m *FieldRules) GetBool() *BoolRules { + if x, ok := m.GetType().(*FieldRules_Bool); ok { + return x.Bool + } + return nil +} + +func (m *FieldRules) GetString_() *StringRules { + if x, ok := m.GetType().(*FieldRules_String_); ok { + return x.String_ + } + return nil +} + +func (m *FieldRules) GetBytes() *BytesRules { + if x, ok := m.GetType().(*FieldRules_Bytes); ok { + return x.Bytes + } + return nil +} + +func (m *FieldRules) GetEnum() *EnumRules { + if x, ok := m.GetType().(*FieldRules_Enum); ok { + return x.Enum + } + return nil +} + +func (m *FieldRules) GetMessage() *MessageRules { + if x, ok := m.GetType().(*FieldRules_Message); ok { + return x.Message + } + return nil +} + +func (m *FieldRules) GetRepeated() *RepeatedRules { + if x, ok := m.GetType().(*FieldRules_Repeated); ok { + return x.Repeated + } + return nil +} + +func (m *FieldRules) GetMap() *MapRules { + if x, ok := m.GetType().(*FieldRules_Map); ok { + return x.Map + } + return nil +} + +func (m *FieldRules) GetAny() *AnyRules { + if x, ok := m.GetType().(*FieldRules_Any); ok { + return x.Any + } + return nil +} + +func (m *FieldRules) GetDuration() *DurationRules { + if x, ok := m.GetType().(*FieldRules_Duration); ok { + return x.Duration + } + return nil +} + +func (m *FieldRules) GetTimestamp() *TimestampRules { + if x, ok := m.GetType().(*FieldRules_Timestamp); ok { + return x.Timestamp + } + return nil +} + +// XXX_OneofFuncs is for the internal use of the proto package. +func (*FieldRules) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { + return _FieldRules_OneofMarshaler, _FieldRules_OneofUnmarshaler, _FieldRules_OneofSizer, []interface{}{ + (*FieldRules_Float)(nil), + (*FieldRules_Double)(nil), + (*FieldRules_Int32)(nil), + (*FieldRules_Int64)(nil), + (*FieldRules_Uint32)(nil), + (*FieldRules_Uint64)(nil), + (*FieldRules_Sint32)(nil), + (*FieldRules_Sint64)(nil), + (*FieldRules_Fixed32)(nil), + (*FieldRules_Fixed64)(nil), + (*FieldRules_Sfixed32)(nil), + (*FieldRules_Sfixed64)(nil), + (*FieldRules_Bool)(nil), + (*FieldRules_String_)(nil), + (*FieldRules_Bytes)(nil), + (*FieldRules_Enum)(nil), + (*FieldRules_Message)(nil), + (*FieldRules_Repeated)(nil), + (*FieldRules_Map)(nil), + (*FieldRules_Any)(nil), + (*FieldRules_Duration)(nil), + (*FieldRules_Timestamp)(nil), + } +} + +func _FieldRules_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { + m := msg.(*FieldRules) + // type + switch x := m.Type.(type) { + case *FieldRules_Float: + b.EncodeVarint(1<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.Float); err != nil { + return err + } + case *FieldRules_Double: + b.EncodeVarint(2<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.Double); err != nil { + return err + } + case *FieldRules_Int32: + b.EncodeVarint(3<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.Int32); err != nil { + return err + } + case *FieldRules_Int64: + b.EncodeVarint(4<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.Int64); err != nil { + return err + } + case *FieldRules_Uint32: + b.EncodeVarint(5<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.Uint32); err != nil { + return err + } + case *FieldRules_Uint64: + b.EncodeVarint(6<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.Uint64); err != nil { + return err + } + case *FieldRules_Sint32: + b.EncodeVarint(7<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.Sint32); err != nil { + return err + } + case *FieldRules_Sint64: + b.EncodeVarint(8<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.Sint64); err != nil { + return err + } + case *FieldRules_Fixed32: + b.EncodeVarint(9<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.Fixed32); err != nil { + return err + } + case *FieldRules_Fixed64: + b.EncodeVarint(10<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.Fixed64); err != nil { + return err + } + case *FieldRules_Sfixed32: + b.EncodeVarint(11<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.Sfixed32); err != nil { + return err + } + case *FieldRules_Sfixed64: + b.EncodeVarint(12<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.Sfixed64); err != nil { + return err + } + case *FieldRules_Bool: + b.EncodeVarint(13<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.Bool); err != nil { + return err + } + case *FieldRules_String_: + b.EncodeVarint(14<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.String_); err != nil { + return err + } + case *FieldRules_Bytes: + b.EncodeVarint(15<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.Bytes); err != nil { + return err + } + case *FieldRules_Enum: + b.EncodeVarint(16<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.Enum); err != nil { + return err + } + case *FieldRules_Message: + b.EncodeVarint(17<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.Message); err != nil { + return err + } + case *FieldRules_Repeated: + b.EncodeVarint(18<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.Repeated); err != nil { + return err + } + case *FieldRules_Map: + b.EncodeVarint(19<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.Map); err != nil { + return err + } + case *FieldRules_Any: + b.EncodeVarint(20<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.Any); err != nil { + return err + } + case *FieldRules_Duration: + b.EncodeVarint(21<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.Duration); err != nil { + return err + } + case *FieldRules_Timestamp: + b.EncodeVarint(22<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.Timestamp); err != nil { + return err + } + case nil: + default: + return fmt.Errorf("FieldRules.Type has unexpected type %T", x) + } + return nil +} + +func _FieldRules_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { + m := msg.(*FieldRules) + switch tag { + case 1: // type.float + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(FloatRules) + err := b.DecodeMessage(msg) + m.Type = &FieldRules_Float{msg} + return true, err + case 2: // type.double + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(DoubleRules) + err := b.DecodeMessage(msg) + m.Type = &FieldRules_Double{msg} + return true, err + case 3: // type.int32 + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(Int32Rules) + err := b.DecodeMessage(msg) + m.Type = &FieldRules_Int32{msg} + return true, err + case 4: // type.int64 + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(Int64Rules) + err := b.DecodeMessage(msg) + m.Type = &FieldRules_Int64{msg} + return true, err + case 5: // type.uint32 + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(UInt32Rules) + err := b.DecodeMessage(msg) + m.Type = &FieldRules_Uint32{msg} + return true, err + case 6: // type.uint64 + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(UInt64Rules) + err := b.DecodeMessage(msg) + m.Type = &FieldRules_Uint64{msg} + return true, err + case 7: // type.sint32 + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(SInt32Rules) + err := b.DecodeMessage(msg) + m.Type = &FieldRules_Sint32{msg} + return true, err + case 8: // type.sint64 + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(SInt64Rules) + err := b.DecodeMessage(msg) + m.Type = &FieldRules_Sint64{msg} + return true, err + case 9: // type.fixed32 + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(Fixed32Rules) + err := b.DecodeMessage(msg) + m.Type = &FieldRules_Fixed32{msg} + return true, err + case 10: // type.fixed64 + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(Fixed64Rules) + err := b.DecodeMessage(msg) + m.Type = &FieldRules_Fixed64{msg} + return true, err + case 11: // type.sfixed32 + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(SFixed32Rules) + err := b.DecodeMessage(msg) + m.Type = &FieldRules_Sfixed32{msg} + return true, err + case 12: // type.sfixed64 + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(SFixed64Rules) + err := b.DecodeMessage(msg) + m.Type = &FieldRules_Sfixed64{msg} + return true, err + case 13: // type.bool + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(BoolRules) + err := b.DecodeMessage(msg) + m.Type = &FieldRules_Bool{msg} + return true, err + case 14: // type.string + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(StringRules) + err := b.DecodeMessage(msg) + m.Type = &FieldRules_String_{msg} + return true, err + case 15: // type.bytes + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(BytesRules) + err := b.DecodeMessage(msg) + m.Type = &FieldRules_Bytes{msg} + return true, err + case 16: // type.enum + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(EnumRules) + err := b.DecodeMessage(msg) + m.Type = &FieldRules_Enum{msg} + return true, err + case 17: // type.message + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(MessageRules) + err := b.DecodeMessage(msg) + m.Type = &FieldRules_Message{msg} + return true, err + case 18: // type.repeated + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(RepeatedRules) + err := b.DecodeMessage(msg) + m.Type = &FieldRules_Repeated{msg} + return true, err + case 19: // type.map + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(MapRules) + err := b.DecodeMessage(msg) + m.Type = &FieldRules_Map{msg} + return true, err + case 20: // type.any + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(AnyRules) + err := b.DecodeMessage(msg) + m.Type = &FieldRules_Any{msg} + return true, err + case 21: // type.duration + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(DurationRules) + err := b.DecodeMessage(msg) + m.Type = &FieldRules_Duration{msg} + return true, err + case 22: // type.timestamp + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(TimestampRules) + err := b.DecodeMessage(msg) + m.Type = &FieldRules_Timestamp{msg} + return true, err + default: + return false, nil + } +} + +func _FieldRules_OneofSizer(msg proto.Message) (n int) { + m := msg.(*FieldRules) + // type + switch x := m.Type.(type) { + case *FieldRules_Float: + s := proto.Size(x.Float) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case *FieldRules_Double: + s := proto.Size(x.Double) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case *FieldRules_Int32: + s := proto.Size(x.Int32) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case *FieldRules_Int64: + s := proto.Size(x.Int64) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case *FieldRules_Uint32: + s := proto.Size(x.Uint32) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case *FieldRules_Uint64: + s := proto.Size(x.Uint64) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case *FieldRules_Sint32: + s := proto.Size(x.Sint32) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case *FieldRules_Sint64: + s := proto.Size(x.Sint64) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case *FieldRules_Fixed32: + s := proto.Size(x.Fixed32) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case *FieldRules_Fixed64: + s := proto.Size(x.Fixed64) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case *FieldRules_Sfixed32: + s := proto.Size(x.Sfixed32) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case *FieldRules_Sfixed64: + s := proto.Size(x.Sfixed64) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case *FieldRules_Bool: + s := proto.Size(x.Bool) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case *FieldRules_String_: + s := proto.Size(x.String_) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case *FieldRules_Bytes: + s := proto.Size(x.Bytes) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case *FieldRules_Enum: + s := proto.Size(x.Enum) + n += 2 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case *FieldRules_Message: + s := proto.Size(x.Message) + n += 2 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case *FieldRules_Repeated: + s := proto.Size(x.Repeated) + n += 2 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case *FieldRules_Map: + s := proto.Size(x.Map) + n += 2 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case *FieldRules_Any: + s := proto.Size(x.Any) + n += 2 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case *FieldRules_Duration: + s := proto.Size(x.Duration) + n += 2 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case *FieldRules_Timestamp: + s := proto.Size(x.Timestamp) + n += 2 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case nil: + default: + panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) + } + return n +} + +type FloatRules struct { + Const *float32 `protobuf:"fixed32,1,opt,name=const" json:"const,omitempty"` + Lt *float32 `protobuf:"fixed32,2,opt,name=lt" json:"lt,omitempty"` + Lte *float32 `protobuf:"fixed32,3,opt,name=lte" json:"lte,omitempty"` + Gt *float32 `protobuf:"fixed32,4,opt,name=gt" json:"gt,omitempty"` + Gte *float32 `protobuf:"fixed32,5,opt,name=gte" json:"gte,omitempty"` + In []float32 `protobuf:"fixed32,6,rep,name=in" json:"in,omitempty"` + NotIn []float32 `protobuf:"fixed32,7,rep,name=not_in,json=notIn" json:"not_in,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *FloatRules) Reset() { *m = FloatRules{} } +func (m *FloatRules) String() string { return proto.CompactTextString(m) } +func (*FloatRules) ProtoMessage() {} +func (*FloatRules) Descriptor() ([]byte, []int) { + return fileDescriptor_validate_42a9c75c83428773, []int{1} +} +func (m *FloatRules) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_FloatRules.Unmarshal(m, b) +} +func (m *FloatRules) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_FloatRules.Marshal(b, m, deterministic) +} +func (dst *FloatRules) XXX_Merge(src proto.Message) { + xxx_messageInfo_FloatRules.Merge(dst, src) +} +func (m *FloatRules) XXX_Size() int { + return xxx_messageInfo_FloatRules.Size(m) +} +func (m *FloatRules) XXX_DiscardUnknown() { + xxx_messageInfo_FloatRules.DiscardUnknown(m) +} + +var xxx_messageInfo_FloatRules proto.InternalMessageInfo + +func (m *FloatRules) GetConst() float32 { + if m != nil && m.Const != nil { + return *m.Const + } + return 0 +} + +func (m *FloatRules) GetLt() float32 { + if m != nil && m.Lt != nil { + return *m.Lt + } + return 0 +} + +func (m *FloatRules) GetLte() float32 { + if m != nil && m.Lte != nil { + return *m.Lte + } + return 0 +} + +func (m *FloatRules) GetGt() float32 { + if m != nil && m.Gt != nil { + return *m.Gt + } + return 0 +} + +func (m *FloatRules) GetGte() float32 { + if m != nil && m.Gte != nil { + return *m.Gte + } + return 0 +} + +func (m *FloatRules) GetIn() []float32 { + if m != nil { + return m.In + } + return nil +} + +func (m *FloatRules) GetNotIn() []float32 { + if m != nil { + return m.NotIn + } + return nil +} + +type DoubleRules struct { + Const *float64 `protobuf:"fixed64,1,opt,name=const" json:"const,omitempty"` + Lt *float64 `protobuf:"fixed64,2,opt,name=lt" json:"lt,omitempty"` + Lte *float64 `protobuf:"fixed64,3,opt,name=lte" json:"lte,omitempty"` + Gt *float64 `protobuf:"fixed64,4,opt,name=gt" json:"gt,omitempty"` + Gte *float64 `protobuf:"fixed64,5,opt,name=gte" json:"gte,omitempty"` + In []float64 `protobuf:"fixed64,6,rep,name=in" json:"in,omitempty"` + NotIn []float64 `protobuf:"fixed64,7,rep,name=not_in,json=notIn" json:"not_in,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *DoubleRules) Reset() { *m = DoubleRules{} } +func (m *DoubleRules) String() string { return proto.CompactTextString(m) } +func (*DoubleRules) ProtoMessage() {} +func (*DoubleRules) Descriptor() ([]byte, []int) { + return fileDescriptor_validate_42a9c75c83428773, []int{2} +} +func (m *DoubleRules) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_DoubleRules.Unmarshal(m, b) +} +func (m *DoubleRules) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_DoubleRules.Marshal(b, m, deterministic) +} +func (dst *DoubleRules) XXX_Merge(src proto.Message) { + xxx_messageInfo_DoubleRules.Merge(dst, src) +} +func (m *DoubleRules) XXX_Size() int { + return xxx_messageInfo_DoubleRules.Size(m) +} +func (m *DoubleRules) XXX_DiscardUnknown() { + xxx_messageInfo_DoubleRules.DiscardUnknown(m) +} + +var xxx_messageInfo_DoubleRules proto.InternalMessageInfo + +func (m *DoubleRules) GetConst() float64 { + if m != nil && m.Const != nil { + return *m.Const + } + return 0 +} + +func (m *DoubleRules) GetLt() float64 { + if m != nil && m.Lt != nil { + return *m.Lt + } + return 0 +} + +func (m *DoubleRules) GetLte() float64 { + if m != nil && m.Lte != nil { + return *m.Lte + } + return 0 +} + +func (m *DoubleRules) GetGt() float64 { + if m != nil && m.Gt != nil { + return *m.Gt + } + return 0 +} + +func (m *DoubleRules) GetGte() float64 { + if m != nil && m.Gte != nil { + return *m.Gte + } + return 0 +} + +func (m *DoubleRules) GetIn() []float64 { + if m != nil { + return m.In + } + return nil +} + +func (m *DoubleRules) GetNotIn() []float64 { + if m != nil { + return m.NotIn + } + return nil +} + +type Int32Rules struct { + Const *int32 `protobuf:"varint,1,opt,name=const" json:"const,omitempty"` + Lt *int32 `protobuf:"varint,2,opt,name=lt" json:"lt,omitempty"` + Lte *int32 `protobuf:"varint,3,opt,name=lte" json:"lte,omitempty"` + Gt *int32 `protobuf:"varint,4,opt,name=gt" json:"gt,omitempty"` + Gte *int32 `protobuf:"varint,5,opt,name=gte" json:"gte,omitempty"` + In []int32 `protobuf:"varint,6,rep,name=in" json:"in,omitempty"` + NotIn []int32 `protobuf:"varint,7,rep,name=not_in,json=notIn" json:"not_in,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Int32Rules) Reset() { *m = Int32Rules{} } +func (m *Int32Rules) String() string { return proto.CompactTextString(m) } +func (*Int32Rules) ProtoMessage() {} +func (*Int32Rules) Descriptor() ([]byte, []int) { + return fileDescriptor_validate_42a9c75c83428773, []int{3} +} +func (m *Int32Rules) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Int32Rules.Unmarshal(m, b) +} +func (m *Int32Rules) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Int32Rules.Marshal(b, m, deterministic) +} +func (dst *Int32Rules) XXX_Merge(src proto.Message) { + xxx_messageInfo_Int32Rules.Merge(dst, src) +} +func (m *Int32Rules) XXX_Size() int { + return xxx_messageInfo_Int32Rules.Size(m) +} +func (m *Int32Rules) XXX_DiscardUnknown() { + xxx_messageInfo_Int32Rules.DiscardUnknown(m) +} + +var xxx_messageInfo_Int32Rules proto.InternalMessageInfo + +func (m *Int32Rules) GetConst() int32 { + if m != nil && m.Const != nil { + return *m.Const + } + return 0 +} + +func (m *Int32Rules) GetLt() int32 { + if m != nil && m.Lt != nil { + return *m.Lt + } + return 0 +} + +func (m *Int32Rules) GetLte() int32 { + if m != nil && m.Lte != nil { + return *m.Lte + } + return 0 +} + +func (m *Int32Rules) GetGt() int32 { + if m != nil && m.Gt != nil { + return *m.Gt + } + return 0 +} + +func (m *Int32Rules) GetGte() int32 { + if m != nil && m.Gte != nil { + return *m.Gte + } + return 0 +} + +func (m *Int32Rules) GetIn() []int32 { + if m != nil { + return m.In + } + return nil +} + +func (m *Int32Rules) GetNotIn() []int32 { + if m != nil { + return m.NotIn + } + return nil +} + +type Int64Rules struct { + Const *int64 `protobuf:"varint,1,opt,name=const" json:"const,omitempty"` + Lt *int64 `protobuf:"varint,2,opt,name=lt" json:"lt,omitempty"` + Lte *int64 `protobuf:"varint,3,opt,name=lte" json:"lte,omitempty"` + Gt *int64 `protobuf:"varint,4,opt,name=gt" json:"gt,omitempty"` + Gte *int64 `protobuf:"varint,5,opt,name=gte" json:"gte,omitempty"` + In []int64 `protobuf:"varint,6,rep,name=in" json:"in,omitempty"` + NotIn []int64 `protobuf:"varint,7,rep,name=not_in,json=notIn" json:"not_in,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Int64Rules) Reset() { *m = Int64Rules{} } +func (m *Int64Rules) String() string { return proto.CompactTextString(m) } +func (*Int64Rules) ProtoMessage() {} +func (*Int64Rules) Descriptor() ([]byte, []int) { + return fileDescriptor_validate_42a9c75c83428773, []int{4} +} +func (m *Int64Rules) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Int64Rules.Unmarshal(m, b) +} +func (m *Int64Rules) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Int64Rules.Marshal(b, m, deterministic) +} +func (dst *Int64Rules) XXX_Merge(src proto.Message) { + xxx_messageInfo_Int64Rules.Merge(dst, src) +} +func (m *Int64Rules) XXX_Size() int { + return xxx_messageInfo_Int64Rules.Size(m) +} +func (m *Int64Rules) XXX_DiscardUnknown() { + xxx_messageInfo_Int64Rules.DiscardUnknown(m) +} + +var xxx_messageInfo_Int64Rules proto.InternalMessageInfo + +func (m *Int64Rules) GetConst() int64 { + if m != nil && m.Const != nil { + return *m.Const + } + return 0 +} + +func (m *Int64Rules) GetLt() int64 { + if m != nil && m.Lt != nil { + return *m.Lt + } + return 0 +} + +func (m *Int64Rules) GetLte() int64 { + if m != nil && m.Lte != nil { + return *m.Lte + } + return 0 +} + +func (m *Int64Rules) GetGt() int64 { + if m != nil && m.Gt != nil { + return *m.Gt + } + return 0 +} + +func (m *Int64Rules) GetGte() int64 { + if m != nil && m.Gte != nil { + return *m.Gte + } + return 0 +} + +func (m *Int64Rules) GetIn() []int64 { + if m != nil { + return m.In + } + return nil +} + +func (m *Int64Rules) GetNotIn() []int64 { + if m != nil { + return m.NotIn + } + return nil +} + +type UInt32Rules struct { + Const *uint32 `protobuf:"varint,1,opt,name=const" json:"const,omitempty"` + Lt *uint32 `protobuf:"varint,2,opt,name=lt" json:"lt,omitempty"` + Lte *uint32 `protobuf:"varint,3,opt,name=lte" json:"lte,omitempty"` + Gt *uint32 `protobuf:"varint,4,opt,name=gt" json:"gt,omitempty"` + Gte *uint32 `protobuf:"varint,5,opt,name=gte" json:"gte,omitempty"` + In []uint32 `protobuf:"varint,6,rep,name=in" json:"in,omitempty"` + NotIn []uint32 `protobuf:"varint,7,rep,name=not_in,json=notIn" json:"not_in,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *UInt32Rules) Reset() { *m = UInt32Rules{} } +func (m *UInt32Rules) String() string { return proto.CompactTextString(m) } +func (*UInt32Rules) ProtoMessage() {} +func (*UInt32Rules) Descriptor() ([]byte, []int) { + return fileDescriptor_validate_42a9c75c83428773, []int{5} +} +func (m *UInt32Rules) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_UInt32Rules.Unmarshal(m, b) +} +func (m *UInt32Rules) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_UInt32Rules.Marshal(b, m, deterministic) +} +func (dst *UInt32Rules) XXX_Merge(src proto.Message) { + xxx_messageInfo_UInt32Rules.Merge(dst, src) +} +func (m *UInt32Rules) XXX_Size() int { + return xxx_messageInfo_UInt32Rules.Size(m) +} +func (m *UInt32Rules) XXX_DiscardUnknown() { + xxx_messageInfo_UInt32Rules.DiscardUnknown(m) +} + +var xxx_messageInfo_UInt32Rules proto.InternalMessageInfo + +func (m *UInt32Rules) GetConst() uint32 { + if m != nil && m.Const != nil { + return *m.Const + } + return 0 +} + +func (m *UInt32Rules) GetLt() uint32 { + if m != nil && m.Lt != nil { + return *m.Lt + } + return 0 +} + +func (m *UInt32Rules) GetLte() uint32 { + if m != nil && m.Lte != nil { + return *m.Lte + } + return 0 +} + +func (m *UInt32Rules) GetGt() uint32 { + if m != nil && m.Gt != nil { + return *m.Gt + } + return 0 +} + +func (m *UInt32Rules) GetGte() uint32 { + if m != nil && m.Gte != nil { + return *m.Gte + } + return 0 +} + +func (m *UInt32Rules) GetIn() []uint32 { + if m != nil { + return m.In + } + return nil +} + +func (m *UInt32Rules) GetNotIn() []uint32 { + if m != nil { + return m.NotIn + } + return nil +} + +type UInt64Rules struct { + Const *uint64 `protobuf:"varint,1,opt,name=const" json:"const,omitempty"` + Lt *uint64 `protobuf:"varint,2,opt,name=lt" json:"lt,omitempty"` + Lte *uint64 `protobuf:"varint,3,opt,name=lte" json:"lte,omitempty"` + Gt *uint64 `protobuf:"varint,4,opt,name=gt" json:"gt,omitempty"` + Gte *uint64 `protobuf:"varint,5,opt,name=gte" json:"gte,omitempty"` + In []uint64 `protobuf:"varint,6,rep,name=in" json:"in,omitempty"` + NotIn []uint64 `protobuf:"varint,7,rep,name=not_in,json=notIn" json:"not_in,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *UInt64Rules) Reset() { *m = UInt64Rules{} } +func (m *UInt64Rules) String() string { return proto.CompactTextString(m) } +func (*UInt64Rules) ProtoMessage() {} +func (*UInt64Rules) Descriptor() ([]byte, []int) { + return fileDescriptor_validate_42a9c75c83428773, []int{6} +} +func (m *UInt64Rules) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_UInt64Rules.Unmarshal(m, b) +} +func (m *UInt64Rules) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_UInt64Rules.Marshal(b, m, deterministic) +} +func (dst *UInt64Rules) XXX_Merge(src proto.Message) { + xxx_messageInfo_UInt64Rules.Merge(dst, src) +} +func (m *UInt64Rules) XXX_Size() int { + return xxx_messageInfo_UInt64Rules.Size(m) +} +func (m *UInt64Rules) XXX_DiscardUnknown() { + xxx_messageInfo_UInt64Rules.DiscardUnknown(m) +} + +var xxx_messageInfo_UInt64Rules proto.InternalMessageInfo + +func (m *UInt64Rules) GetConst() uint64 { + if m != nil && m.Const != nil { + return *m.Const + } + return 0 +} + +func (m *UInt64Rules) GetLt() uint64 { + if m != nil && m.Lt != nil { + return *m.Lt + } + return 0 +} + +func (m *UInt64Rules) GetLte() uint64 { + if m != nil && m.Lte != nil { + return *m.Lte + } + return 0 +} + +func (m *UInt64Rules) GetGt() uint64 { + if m != nil && m.Gt != nil { + return *m.Gt + } + return 0 +} + +func (m *UInt64Rules) GetGte() uint64 { + if m != nil && m.Gte != nil { + return *m.Gte + } + return 0 +} + +func (m *UInt64Rules) GetIn() []uint64 { + if m != nil { + return m.In + } + return nil +} + +func (m *UInt64Rules) GetNotIn() []uint64 { + if m != nil { + return m.NotIn + } + return nil +} + +type SInt32Rules struct { + Const *int32 `protobuf:"zigzag32,1,opt,name=const" json:"const,omitempty"` + Lt *int32 `protobuf:"zigzag32,2,opt,name=lt" json:"lt,omitempty"` + Lte *int32 `protobuf:"zigzag32,3,opt,name=lte" json:"lte,omitempty"` + Gt *int32 `protobuf:"zigzag32,4,opt,name=gt" json:"gt,omitempty"` + Gte *int32 `protobuf:"zigzag32,5,opt,name=gte" json:"gte,omitempty"` + In []int32 `protobuf:"zigzag32,6,rep,name=in" json:"in,omitempty"` + NotIn []int32 `protobuf:"zigzag32,7,rep,name=not_in,json=notIn" json:"not_in,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SInt32Rules) Reset() { *m = SInt32Rules{} } +func (m *SInt32Rules) String() string { return proto.CompactTextString(m) } +func (*SInt32Rules) ProtoMessage() {} +func (*SInt32Rules) Descriptor() ([]byte, []int) { + return fileDescriptor_validate_42a9c75c83428773, []int{7} +} +func (m *SInt32Rules) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_SInt32Rules.Unmarshal(m, b) +} +func (m *SInt32Rules) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_SInt32Rules.Marshal(b, m, deterministic) +} +func (dst *SInt32Rules) XXX_Merge(src proto.Message) { + xxx_messageInfo_SInt32Rules.Merge(dst, src) +} +func (m *SInt32Rules) XXX_Size() int { + return xxx_messageInfo_SInt32Rules.Size(m) +} +func (m *SInt32Rules) XXX_DiscardUnknown() { + xxx_messageInfo_SInt32Rules.DiscardUnknown(m) +} + +var xxx_messageInfo_SInt32Rules proto.InternalMessageInfo + +func (m *SInt32Rules) GetConst() int32 { + if m != nil && m.Const != nil { + return *m.Const + } + return 0 +} + +func (m *SInt32Rules) GetLt() int32 { + if m != nil && m.Lt != nil { + return *m.Lt + } + return 0 +} + +func (m *SInt32Rules) GetLte() int32 { + if m != nil && m.Lte != nil { + return *m.Lte + } + return 0 +} + +func (m *SInt32Rules) GetGt() int32 { + if m != nil && m.Gt != nil { + return *m.Gt + } + return 0 +} + +func (m *SInt32Rules) GetGte() int32 { + if m != nil && m.Gte != nil { + return *m.Gte + } + return 0 +} + +func (m *SInt32Rules) GetIn() []int32 { + if m != nil { + return m.In + } + return nil +} + +func (m *SInt32Rules) GetNotIn() []int32 { + if m != nil { + return m.NotIn + } + return nil +} + +type SInt64Rules struct { + Const *int64 `protobuf:"zigzag64,1,opt,name=const" json:"const,omitempty"` + Lt *int64 `protobuf:"zigzag64,2,opt,name=lt" json:"lt,omitempty"` + Lte *int64 `protobuf:"zigzag64,3,opt,name=lte" json:"lte,omitempty"` + Gt *int64 `protobuf:"zigzag64,4,opt,name=gt" json:"gt,omitempty"` + Gte *int64 `protobuf:"zigzag64,5,opt,name=gte" json:"gte,omitempty"` + In []int64 `protobuf:"zigzag64,6,rep,name=in" json:"in,omitempty"` + NotIn []int64 `protobuf:"zigzag64,7,rep,name=not_in,json=notIn" json:"not_in,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SInt64Rules) Reset() { *m = SInt64Rules{} } +func (m *SInt64Rules) String() string { return proto.CompactTextString(m) } +func (*SInt64Rules) ProtoMessage() {} +func (*SInt64Rules) Descriptor() ([]byte, []int) { + return fileDescriptor_validate_42a9c75c83428773, []int{8} +} +func (m *SInt64Rules) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_SInt64Rules.Unmarshal(m, b) +} +func (m *SInt64Rules) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_SInt64Rules.Marshal(b, m, deterministic) +} +func (dst *SInt64Rules) XXX_Merge(src proto.Message) { + xxx_messageInfo_SInt64Rules.Merge(dst, src) +} +func (m *SInt64Rules) XXX_Size() int { + return xxx_messageInfo_SInt64Rules.Size(m) +} +func (m *SInt64Rules) XXX_DiscardUnknown() { + xxx_messageInfo_SInt64Rules.DiscardUnknown(m) +} + +var xxx_messageInfo_SInt64Rules proto.InternalMessageInfo + +func (m *SInt64Rules) GetConst() int64 { + if m != nil && m.Const != nil { + return *m.Const + } + return 0 +} + +func (m *SInt64Rules) GetLt() int64 { + if m != nil && m.Lt != nil { + return *m.Lt + } + return 0 +} + +func (m *SInt64Rules) GetLte() int64 { + if m != nil && m.Lte != nil { + return *m.Lte + } + return 0 +} + +func (m *SInt64Rules) GetGt() int64 { + if m != nil && m.Gt != nil { + return *m.Gt + } + return 0 +} + +func (m *SInt64Rules) GetGte() int64 { + if m != nil && m.Gte != nil { + return *m.Gte + } + return 0 +} + +func (m *SInt64Rules) GetIn() []int64 { + if m != nil { + return m.In + } + return nil +} + +func (m *SInt64Rules) GetNotIn() []int64 { + if m != nil { + return m.NotIn + } + return nil +} + +type Fixed32Rules struct { + Const *uint32 `protobuf:"fixed32,1,opt,name=const" json:"const,omitempty"` + Lt *uint32 `protobuf:"fixed32,2,opt,name=lt" json:"lt,omitempty"` + Lte *uint32 `protobuf:"fixed32,3,opt,name=lte" json:"lte,omitempty"` + Gt *uint32 `protobuf:"fixed32,4,opt,name=gt" json:"gt,omitempty"` + Gte *uint32 `protobuf:"fixed32,5,opt,name=gte" json:"gte,omitempty"` + In []uint32 `protobuf:"fixed32,6,rep,name=in" json:"in,omitempty"` + NotIn []uint32 `protobuf:"fixed32,7,rep,name=not_in,json=notIn" json:"not_in,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Fixed32Rules) Reset() { *m = Fixed32Rules{} } +func (m *Fixed32Rules) String() string { return proto.CompactTextString(m) } +func (*Fixed32Rules) ProtoMessage() {} +func (*Fixed32Rules) Descriptor() ([]byte, []int) { + return fileDescriptor_validate_42a9c75c83428773, []int{9} +} +func (m *Fixed32Rules) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Fixed32Rules.Unmarshal(m, b) +} +func (m *Fixed32Rules) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Fixed32Rules.Marshal(b, m, deterministic) +} +func (dst *Fixed32Rules) XXX_Merge(src proto.Message) { + xxx_messageInfo_Fixed32Rules.Merge(dst, src) +} +func (m *Fixed32Rules) XXX_Size() int { + return xxx_messageInfo_Fixed32Rules.Size(m) +} +func (m *Fixed32Rules) XXX_DiscardUnknown() { + xxx_messageInfo_Fixed32Rules.DiscardUnknown(m) +} + +var xxx_messageInfo_Fixed32Rules proto.InternalMessageInfo + +func (m *Fixed32Rules) GetConst() uint32 { + if m != nil && m.Const != nil { + return *m.Const + } + return 0 +} + +func (m *Fixed32Rules) GetLt() uint32 { + if m != nil && m.Lt != nil { + return *m.Lt + } + return 0 +} + +func (m *Fixed32Rules) GetLte() uint32 { + if m != nil && m.Lte != nil { + return *m.Lte + } + return 0 +} + +func (m *Fixed32Rules) GetGt() uint32 { + if m != nil && m.Gt != nil { + return *m.Gt + } + return 0 +} + +func (m *Fixed32Rules) GetGte() uint32 { + if m != nil && m.Gte != nil { + return *m.Gte + } + return 0 +} + +func (m *Fixed32Rules) GetIn() []uint32 { + if m != nil { + return m.In + } + return nil +} + +func (m *Fixed32Rules) GetNotIn() []uint32 { + if m != nil { + return m.NotIn + } + return nil +} + +type Fixed64Rules struct { + Const *uint64 `protobuf:"fixed64,1,opt,name=const" json:"const,omitempty"` + Lt *uint64 `protobuf:"fixed64,2,opt,name=lt" json:"lt,omitempty"` + Lte *uint64 `protobuf:"fixed64,3,opt,name=lte" json:"lte,omitempty"` + Gt *uint64 `protobuf:"fixed64,4,opt,name=gt" json:"gt,omitempty"` + Gte *uint64 `protobuf:"fixed64,5,opt,name=gte" json:"gte,omitempty"` + In []uint64 `protobuf:"fixed64,6,rep,name=in" json:"in,omitempty"` + NotIn []uint64 `protobuf:"fixed64,7,rep,name=not_in,json=notIn" json:"not_in,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Fixed64Rules) Reset() { *m = Fixed64Rules{} } +func (m *Fixed64Rules) String() string { return proto.CompactTextString(m) } +func (*Fixed64Rules) ProtoMessage() {} +func (*Fixed64Rules) Descriptor() ([]byte, []int) { + return fileDescriptor_validate_42a9c75c83428773, []int{10} +} +func (m *Fixed64Rules) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Fixed64Rules.Unmarshal(m, b) +} +func (m *Fixed64Rules) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Fixed64Rules.Marshal(b, m, deterministic) +} +func (dst *Fixed64Rules) XXX_Merge(src proto.Message) { + xxx_messageInfo_Fixed64Rules.Merge(dst, src) +} +func (m *Fixed64Rules) XXX_Size() int { + return xxx_messageInfo_Fixed64Rules.Size(m) +} +func (m *Fixed64Rules) XXX_DiscardUnknown() { + xxx_messageInfo_Fixed64Rules.DiscardUnknown(m) +} + +var xxx_messageInfo_Fixed64Rules proto.InternalMessageInfo + +func (m *Fixed64Rules) GetConst() uint64 { + if m != nil && m.Const != nil { + return *m.Const + } + return 0 +} + +func (m *Fixed64Rules) GetLt() uint64 { + if m != nil && m.Lt != nil { + return *m.Lt + } + return 0 +} + +func (m *Fixed64Rules) GetLte() uint64 { + if m != nil && m.Lte != nil { + return *m.Lte + } + return 0 +} + +func (m *Fixed64Rules) GetGt() uint64 { + if m != nil && m.Gt != nil { + return *m.Gt + } + return 0 +} + +func (m *Fixed64Rules) GetGte() uint64 { + if m != nil && m.Gte != nil { + return *m.Gte + } + return 0 +} + +func (m *Fixed64Rules) GetIn() []uint64 { + if m != nil { + return m.In + } + return nil +} + +func (m *Fixed64Rules) GetNotIn() []uint64 { + if m != nil { + return m.NotIn + } + return nil +} + +type SFixed32Rules struct { + Const *int32 `protobuf:"fixed32,1,opt,name=const" json:"const,omitempty"` + Lt *int32 `protobuf:"fixed32,2,opt,name=lt" json:"lt,omitempty"` + Lte *int32 `protobuf:"fixed32,3,opt,name=lte" json:"lte,omitempty"` + Gt *int32 `protobuf:"fixed32,4,opt,name=gt" json:"gt,omitempty"` + Gte *int32 `protobuf:"fixed32,5,opt,name=gte" json:"gte,omitempty"` + In []int32 `protobuf:"fixed32,6,rep,name=in" json:"in,omitempty"` + NotIn []int32 `protobuf:"fixed32,7,rep,name=not_in,json=notIn" json:"not_in,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SFixed32Rules) Reset() { *m = SFixed32Rules{} } +func (m *SFixed32Rules) String() string { return proto.CompactTextString(m) } +func (*SFixed32Rules) ProtoMessage() {} +func (*SFixed32Rules) Descriptor() ([]byte, []int) { + return fileDescriptor_validate_42a9c75c83428773, []int{11} +} +func (m *SFixed32Rules) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_SFixed32Rules.Unmarshal(m, b) +} +func (m *SFixed32Rules) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_SFixed32Rules.Marshal(b, m, deterministic) +} +func (dst *SFixed32Rules) XXX_Merge(src proto.Message) { + xxx_messageInfo_SFixed32Rules.Merge(dst, src) +} +func (m *SFixed32Rules) XXX_Size() int { + return xxx_messageInfo_SFixed32Rules.Size(m) +} +func (m *SFixed32Rules) XXX_DiscardUnknown() { + xxx_messageInfo_SFixed32Rules.DiscardUnknown(m) +} + +var xxx_messageInfo_SFixed32Rules proto.InternalMessageInfo + +func (m *SFixed32Rules) GetConst() int32 { + if m != nil && m.Const != nil { + return *m.Const + } + return 0 +} + +func (m *SFixed32Rules) GetLt() int32 { + if m != nil && m.Lt != nil { + return *m.Lt + } + return 0 +} + +func (m *SFixed32Rules) GetLte() int32 { + if m != nil && m.Lte != nil { + return *m.Lte + } + return 0 +} + +func (m *SFixed32Rules) GetGt() int32 { + if m != nil && m.Gt != nil { + return *m.Gt + } + return 0 +} + +func (m *SFixed32Rules) GetGte() int32 { + if m != nil && m.Gte != nil { + return *m.Gte + } + return 0 +} + +func (m *SFixed32Rules) GetIn() []int32 { + if m != nil { + return m.In + } + return nil +} + +func (m *SFixed32Rules) GetNotIn() []int32 { + if m != nil { + return m.NotIn + } + return nil +} + +type SFixed64Rules struct { + Const *int64 `protobuf:"fixed64,1,opt,name=const" json:"const,omitempty"` + Lt *int64 `protobuf:"fixed64,2,opt,name=lt" json:"lt,omitempty"` + Lte *int64 `protobuf:"fixed64,3,opt,name=lte" json:"lte,omitempty"` + Gt *int64 `protobuf:"fixed64,4,opt,name=gt" json:"gt,omitempty"` + Gte *int64 `protobuf:"fixed64,5,opt,name=gte" json:"gte,omitempty"` + In []int64 `protobuf:"fixed64,6,rep,name=in" json:"in,omitempty"` + NotIn []int64 `protobuf:"fixed64,7,rep,name=not_in,json=notIn" json:"not_in,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SFixed64Rules) Reset() { *m = SFixed64Rules{} } +func (m *SFixed64Rules) String() string { return proto.CompactTextString(m) } +func (*SFixed64Rules) ProtoMessage() {} +func (*SFixed64Rules) Descriptor() ([]byte, []int) { + return fileDescriptor_validate_42a9c75c83428773, []int{12} +} +func (m *SFixed64Rules) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_SFixed64Rules.Unmarshal(m, b) +} +func (m *SFixed64Rules) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_SFixed64Rules.Marshal(b, m, deterministic) +} +func (dst *SFixed64Rules) XXX_Merge(src proto.Message) { + xxx_messageInfo_SFixed64Rules.Merge(dst, src) +} +func (m *SFixed64Rules) XXX_Size() int { + return xxx_messageInfo_SFixed64Rules.Size(m) +} +func (m *SFixed64Rules) XXX_DiscardUnknown() { + xxx_messageInfo_SFixed64Rules.DiscardUnknown(m) +} + +var xxx_messageInfo_SFixed64Rules proto.InternalMessageInfo + +func (m *SFixed64Rules) GetConst() int64 { + if m != nil && m.Const != nil { + return *m.Const + } + return 0 +} + +func (m *SFixed64Rules) GetLt() int64 { + if m != nil && m.Lt != nil { + return *m.Lt + } + return 0 +} + +func (m *SFixed64Rules) GetLte() int64 { + if m != nil && m.Lte != nil { + return *m.Lte + } + return 0 +} + +func (m *SFixed64Rules) GetGt() int64 { + if m != nil && m.Gt != nil { + return *m.Gt + } + return 0 +} + +func (m *SFixed64Rules) GetGte() int64 { + if m != nil && m.Gte != nil { + return *m.Gte + } + return 0 +} + +func (m *SFixed64Rules) GetIn() []int64 { + if m != nil { + return m.In + } + return nil +} + +func (m *SFixed64Rules) GetNotIn() []int64 { + if m != nil { + return m.NotIn + } + return nil +} + +type BoolRules struct { + Const *bool `protobuf:"varint,1,opt,name=const" json:"const,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *BoolRules) Reset() { *m = BoolRules{} } +func (m *BoolRules) String() string { return proto.CompactTextString(m) } +func (*BoolRules) ProtoMessage() {} +func (*BoolRules) Descriptor() ([]byte, []int) { + return fileDescriptor_validate_42a9c75c83428773, []int{13} +} +func (m *BoolRules) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_BoolRules.Unmarshal(m, b) +} +func (m *BoolRules) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_BoolRules.Marshal(b, m, deterministic) +} +func (dst *BoolRules) XXX_Merge(src proto.Message) { + xxx_messageInfo_BoolRules.Merge(dst, src) +} +func (m *BoolRules) XXX_Size() int { + return xxx_messageInfo_BoolRules.Size(m) +} +func (m *BoolRules) XXX_DiscardUnknown() { + xxx_messageInfo_BoolRules.DiscardUnknown(m) +} + +var xxx_messageInfo_BoolRules proto.InternalMessageInfo + +func (m *BoolRules) GetConst() bool { + if m != nil && m.Const != nil { + return *m.Const + } + return false +} + +type StringRules struct { + Const *string `protobuf:"bytes,1,opt,name=const" json:"const,omitempty"` + Len *uint64 `protobuf:"varint,19,opt,name=len" json:"len,omitempty"` + MinLen *uint64 `protobuf:"varint,2,opt,name=min_len,json=minLen" json:"min_len,omitempty"` + MaxLen *uint64 `protobuf:"varint,3,opt,name=max_len,json=maxLen" json:"max_len,omitempty"` + LenBytes *uint64 `protobuf:"varint,20,opt,name=len_bytes,json=lenBytes" json:"len_bytes,omitempty"` + MinBytes *uint64 `protobuf:"varint,4,opt,name=min_bytes,json=minBytes" json:"min_bytes,omitempty"` + MaxBytes *uint64 `protobuf:"varint,5,opt,name=max_bytes,json=maxBytes" json:"max_bytes,omitempty"` + Pattern *string `protobuf:"bytes,6,opt,name=pattern" json:"pattern,omitempty"` + Prefix *string `protobuf:"bytes,7,opt,name=prefix" json:"prefix,omitempty"` + Suffix *string `protobuf:"bytes,8,opt,name=suffix" json:"suffix,omitempty"` + Contains *string `protobuf:"bytes,9,opt,name=contains" json:"contains,omitempty"` + In []string `protobuf:"bytes,10,rep,name=in" json:"in,omitempty"` + NotIn []string `protobuf:"bytes,11,rep,name=not_in,json=notIn" json:"not_in,omitempty"` + // Types that are valid to be assigned to WellKnown: + // *StringRules_Email + // *StringRules_Hostname + // *StringRules_Ip + // *StringRules_Ipv4 + // *StringRules_Ipv6 + // *StringRules_Uri + // *StringRules_UriRef + WellKnown isStringRules_WellKnown `protobuf_oneof:"well_known"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *StringRules) Reset() { *m = StringRules{} } +func (m *StringRules) String() string { return proto.CompactTextString(m) } +func (*StringRules) ProtoMessage() {} +func (*StringRules) Descriptor() ([]byte, []int) { + return fileDescriptor_validate_42a9c75c83428773, []int{14} +} +func (m *StringRules) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_StringRules.Unmarshal(m, b) +} +func (m *StringRules) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_StringRules.Marshal(b, m, deterministic) +} +func (dst *StringRules) XXX_Merge(src proto.Message) { + xxx_messageInfo_StringRules.Merge(dst, src) +} +func (m *StringRules) XXX_Size() int { + return xxx_messageInfo_StringRules.Size(m) +} +func (m *StringRules) XXX_DiscardUnknown() { + xxx_messageInfo_StringRules.DiscardUnknown(m) +} + +var xxx_messageInfo_StringRules proto.InternalMessageInfo + +type isStringRules_WellKnown interface { + isStringRules_WellKnown() +} + +type StringRules_Email struct { + Email bool `protobuf:"varint,12,opt,name=email,oneof"` +} +type StringRules_Hostname struct { + Hostname bool `protobuf:"varint,13,opt,name=hostname,oneof"` +} +type StringRules_Ip struct { + Ip bool `protobuf:"varint,14,opt,name=ip,oneof"` +} +type StringRules_Ipv4 struct { + Ipv4 bool `protobuf:"varint,15,opt,name=ipv4,oneof"` +} +type StringRules_Ipv6 struct { + Ipv6 bool `protobuf:"varint,16,opt,name=ipv6,oneof"` +} +type StringRules_Uri struct { + Uri bool `protobuf:"varint,17,opt,name=uri,oneof"` +} +type StringRules_UriRef struct { + UriRef bool `protobuf:"varint,18,opt,name=uri_ref,json=uriRef,oneof"` +} + +func (*StringRules_Email) isStringRules_WellKnown() {} +func (*StringRules_Hostname) isStringRules_WellKnown() {} +func (*StringRules_Ip) isStringRules_WellKnown() {} +func (*StringRules_Ipv4) isStringRules_WellKnown() {} +func (*StringRules_Ipv6) isStringRules_WellKnown() {} +func (*StringRules_Uri) isStringRules_WellKnown() {} +func (*StringRules_UriRef) isStringRules_WellKnown() {} + +func (m *StringRules) GetWellKnown() isStringRules_WellKnown { + if m != nil { + return m.WellKnown + } + return nil +} + +func (m *StringRules) GetConst() string { + if m != nil && m.Const != nil { + return *m.Const + } + return "" +} + +func (m *StringRules) GetLen() uint64 { + if m != nil && m.Len != nil { + return *m.Len + } + return 0 +} + +func (m *StringRules) GetMinLen() uint64 { + if m != nil && m.MinLen != nil { + return *m.MinLen + } + return 0 +} + +func (m *StringRules) GetMaxLen() uint64 { + if m != nil && m.MaxLen != nil { + return *m.MaxLen + } + return 0 +} + +func (m *StringRules) GetLenBytes() uint64 { + if m != nil && m.LenBytes != nil { + return *m.LenBytes + } + return 0 +} + +func (m *StringRules) GetMinBytes() uint64 { + if m != nil && m.MinBytes != nil { + return *m.MinBytes + } + return 0 +} + +func (m *StringRules) GetMaxBytes() uint64 { + if m != nil && m.MaxBytes != nil { + return *m.MaxBytes + } + return 0 +} + +func (m *StringRules) GetPattern() string { + if m != nil && m.Pattern != nil { + return *m.Pattern + } + return "" +} + +func (m *StringRules) GetPrefix() string { + if m != nil && m.Prefix != nil { + return *m.Prefix + } + return "" +} + +func (m *StringRules) GetSuffix() string { + if m != nil && m.Suffix != nil { + return *m.Suffix + } + return "" +} + +func (m *StringRules) GetContains() string { + if m != nil && m.Contains != nil { + return *m.Contains + } + return "" +} + +func (m *StringRules) GetIn() []string { + if m != nil { + return m.In + } + return nil +} + +func (m *StringRules) GetNotIn() []string { + if m != nil { + return m.NotIn + } + return nil +} + +func (m *StringRules) GetEmail() bool { + if x, ok := m.GetWellKnown().(*StringRules_Email); ok { + return x.Email + } + return false +} + +func (m *StringRules) GetHostname() bool { + if x, ok := m.GetWellKnown().(*StringRules_Hostname); ok { + return x.Hostname + } + return false +} + +func (m *StringRules) GetIp() bool { + if x, ok := m.GetWellKnown().(*StringRules_Ip); ok { + return x.Ip + } + return false +} + +func (m *StringRules) GetIpv4() bool { + if x, ok := m.GetWellKnown().(*StringRules_Ipv4); ok { + return x.Ipv4 + } + return false +} + +func (m *StringRules) GetIpv6() bool { + if x, ok := m.GetWellKnown().(*StringRules_Ipv6); ok { + return x.Ipv6 + } + return false +} + +func (m *StringRules) GetUri() bool { + if x, ok := m.GetWellKnown().(*StringRules_Uri); ok { + return x.Uri + } + return false +} + +func (m *StringRules) GetUriRef() bool { + if x, ok := m.GetWellKnown().(*StringRules_UriRef); ok { + return x.UriRef + } + return false +} + +// XXX_OneofFuncs is for the internal use of the proto package. +func (*StringRules) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { + return _StringRules_OneofMarshaler, _StringRules_OneofUnmarshaler, _StringRules_OneofSizer, []interface{}{ + (*StringRules_Email)(nil), + (*StringRules_Hostname)(nil), + (*StringRules_Ip)(nil), + (*StringRules_Ipv4)(nil), + (*StringRules_Ipv6)(nil), + (*StringRules_Uri)(nil), + (*StringRules_UriRef)(nil), + } +} + +func _StringRules_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { + m := msg.(*StringRules) + // well_known + switch x := m.WellKnown.(type) { + case *StringRules_Email: + t := uint64(0) + if x.Email { + t = 1 + } + b.EncodeVarint(12<<3 | proto.WireVarint) + b.EncodeVarint(t) + case *StringRules_Hostname: + t := uint64(0) + if x.Hostname { + t = 1 + } + b.EncodeVarint(13<<3 | proto.WireVarint) + b.EncodeVarint(t) + case *StringRules_Ip: + t := uint64(0) + if x.Ip { + t = 1 + } + b.EncodeVarint(14<<3 | proto.WireVarint) + b.EncodeVarint(t) + case *StringRules_Ipv4: + t := uint64(0) + if x.Ipv4 { + t = 1 + } + b.EncodeVarint(15<<3 | proto.WireVarint) + b.EncodeVarint(t) + case *StringRules_Ipv6: + t := uint64(0) + if x.Ipv6 { + t = 1 + } + b.EncodeVarint(16<<3 | proto.WireVarint) + b.EncodeVarint(t) + case *StringRules_Uri: + t := uint64(0) + if x.Uri { + t = 1 + } + b.EncodeVarint(17<<3 | proto.WireVarint) + b.EncodeVarint(t) + case *StringRules_UriRef: + t := uint64(0) + if x.UriRef { + t = 1 + } + b.EncodeVarint(18<<3 | proto.WireVarint) + b.EncodeVarint(t) + case nil: + default: + return fmt.Errorf("StringRules.WellKnown has unexpected type %T", x) + } + return nil +} + +func _StringRules_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { + m := msg.(*StringRules) + switch tag { + case 12: // well_known.email + if wire != proto.WireVarint { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeVarint() + m.WellKnown = &StringRules_Email{x != 0} + return true, err + case 13: // well_known.hostname + if wire != proto.WireVarint { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeVarint() + m.WellKnown = &StringRules_Hostname{x != 0} + return true, err + case 14: // well_known.ip + if wire != proto.WireVarint { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeVarint() + m.WellKnown = &StringRules_Ip{x != 0} + return true, err + case 15: // well_known.ipv4 + if wire != proto.WireVarint { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeVarint() + m.WellKnown = &StringRules_Ipv4{x != 0} + return true, err + case 16: // well_known.ipv6 + if wire != proto.WireVarint { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeVarint() + m.WellKnown = &StringRules_Ipv6{x != 0} + return true, err + case 17: // well_known.uri + if wire != proto.WireVarint { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeVarint() + m.WellKnown = &StringRules_Uri{x != 0} + return true, err + case 18: // well_known.uri_ref + if wire != proto.WireVarint { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeVarint() + m.WellKnown = &StringRules_UriRef{x != 0} + return true, err + default: + return false, nil + } +} + +func _StringRules_OneofSizer(msg proto.Message) (n int) { + m := msg.(*StringRules) + // well_known + switch x := m.WellKnown.(type) { + case *StringRules_Email: + n += 1 // tag and wire + n += 1 + case *StringRules_Hostname: + n += 1 // tag and wire + n += 1 + case *StringRules_Ip: + n += 1 // tag and wire + n += 1 + case *StringRules_Ipv4: + n += 1 // tag and wire + n += 1 + case *StringRules_Ipv6: + n += 2 // tag and wire + n += 1 + case *StringRules_Uri: + n += 2 // tag and wire + n += 1 + case *StringRules_UriRef: + n += 2 // tag and wire + n += 1 + case nil: + default: + panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) + } + return n +} + +type BytesRules struct { + Const []byte `protobuf:"bytes,1,opt,name=const" json:"const,omitempty"` + Len *uint64 `protobuf:"varint,13,opt,name=len" json:"len,omitempty"` + MinLen *uint64 `protobuf:"varint,2,opt,name=min_len,json=minLen" json:"min_len,omitempty"` + MaxLen *uint64 `protobuf:"varint,3,opt,name=max_len,json=maxLen" json:"max_len,omitempty"` + Pattern *string `protobuf:"bytes,4,opt,name=pattern" json:"pattern,omitempty"` + Prefix []byte `protobuf:"bytes,5,opt,name=prefix" json:"prefix,omitempty"` + Suffix []byte `protobuf:"bytes,6,opt,name=suffix" json:"suffix,omitempty"` + Contains []byte `protobuf:"bytes,7,opt,name=contains" json:"contains,omitempty"` + In [][]byte `protobuf:"bytes,8,rep,name=in" json:"in,omitempty"` + NotIn [][]byte `protobuf:"bytes,9,rep,name=not_in,json=notIn" json:"not_in,omitempty"` + // Types that are valid to be assigned to WellKnown: + // *BytesRules_Ip + // *BytesRules_Ipv4 + // *BytesRules_Ipv6 + WellKnown isBytesRules_WellKnown `protobuf_oneof:"well_known"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *BytesRules) Reset() { *m = BytesRules{} } +func (m *BytesRules) String() string { return proto.CompactTextString(m) } +func (*BytesRules) ProtoMessage() {} +func (*BytesRules) Descriptor() ([]byte, []int) { + return fileDescriptor_validate_42a9c75c83428773, []int{15} +} +func (m *BytesRules) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_BytesRules.Unmarshal(m, b) +} +func (m *BytesRules) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_BytesRules.Marshal(b, m, deterministic) +} +func (dst *BytesRules) XXX_Merge(src proto.Message) { + xxx_messageInfo_BytesRules.Merge(dst, src) +} +func (m *BytesRules) XXX_Size() int { + return xxx_messageInfo_BytesRules.Size(m) +} +func (m *BytesRules) XXX_DiscardUnknown() { + xxx_messageInfo_BytesRules.DiscardUnknown(m) +} + +var xxx_messageInfo_BytesRules proto.InternalMessageInfo + +type isBytesRules_WellKnown interface { + isBytesRules_WellKnown() +} + +type BytesRules_Ip struct { + Ip bool `protobuf:"varint,10,opt,name=ip,oneof"` +} +type BytesRules_Ipv4 struct { + Ipv4 bool `protobuf:"varint,11,opt,name=ipv4,oneof"` +} +type BytesRules_Ipv6 struct { + Ipv6 bool `protobuf:"varint,12,opt,name=ipv6,oneof"` +} + +func (*BytesRules_Ip) isBytesRules_WellKnown() {} +func (*BytesRules_Ipv4) isBytesRules_WellKnown() {} +func (*BytesRules_Ipv6) isBytesRules_WellKnown() {} + +func (m *BytesRules) GetWellKnown() isBytesRules_WellKnown { + if m != nil { + return m.WellKnown + } + return nil +} + +func (m *BytesRules) GetConst() []byte { + if m != nil { + return m.Const + } + return nil +} + +func (m *BytesRules) GetLen() uint64 { + if m != nil && m.Len != nil { + return *m.Len + } + return 0 +} + +func (m *BytesRules) GetMinLen() uint64 { + if m != nil && m.MinLen != nil { + return *m.MinLen + } + return 0 +} + +func (m *BytesRules) GetMaxLen() uint64 { + if m != nil && m.MaxLen != nil { + return *m.MaxLen + } + return 0 +} + +func (m *BytesRules) GetPattern() string { + if m != nil && m.Pattern != nil { + return *m.Pattern + } + return "" +} + +func (m *BytesRules) GetPrefix() []byte { + if m != nil { + return m.Prefix + } + return nil +} + +func (m *BytesRules) GetSuffix() []byte { + if m != nil { + return m.Suffix + } + return nil +} + +func (m *BytesRules) GetContains() []byte { + if m != nil { + return m.Contains + } + return nil +} + +func (m *BytesRules) GetIn() [][]byte { + if m != nil { + return m.In + } + return nil +} + +func (m *BytesRules) GetNotIn() [][]byte { + if m != nil { + return m.NotIn + } + return nil +} + +func (m *BytesRules) GetIp() bool { + if x, ok := m.GetWellKnown().(*BytesRules_Ip); ok { + return x.Ip + } + return false +} + +func (m *BytesRules) GetIpv4() bool { + if x, ok := m.GetWellKnown().(*BytesRules_Ipv4); ok { + return x.Ipv4 + } + return false +} + +func (m *BytesRules) GetIpv6() bool { + if x, ok := m.GetWellKnown().(*BytesRules_Ipv6); ok { + return x.Ipv6 + } + return false +} + +// XXX_OneofFuncs is for the internal use of the proto package. +func (*BytesRules) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { + return _BytesRules_OneofMarshaler, _BytesRules_OneofUnmarshaler, _BytesRules_OneofSizer, []interface{}{ + (*BytesRules_Ip)(nil), + (*BytesRules_Ipv4)(nil), + (*BytesRules_Ipv6)(nil), + } +} + +func _BytesRules_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { + m := msg.(*BytesRules) + // well_known + switch x := m.WellKnown.(type) { + case *BytesRules_Ip: + t := uint64(0) + if x.Ip { + t = 1 + } + b.EncodeVarint(10<<3 | proto.WireVarint) + b.EncodeVarint(t) + case *BytesRules_Ipv4: + t := uint64(0) + if x.Ipv4 { + t = 1 + } + b.EncodeVarint(11<<3 | proto.WireVarint) + b.EncodeVarint(t) + case *BytesRules_Ipv6: + t := uint64(0) + if x.Ipv6 { + t = 1 + } + b.EncodeVarint(12<<3 | proto.WireVarint) + b.EncodeVarint(t) + case nil: + default: + return fmt.Errorf("BytesRules.WellKnown has unexpected type %T", x) + } + return nil +} + +func _BytesRules_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { + m := msg.(*BytesRules) + switch tag { + case 10: // well_known.ip + if wire != proto.WireVarint { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeVarint() + m.WellKnown = &BytesRules_Ip{x != 0} + return true, err + case 11: // well_known.ipv4 + if wire != proto.WireVarint { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeVarint() + m.WellKnown = &BytesRules_Ipv4{x != 0} + return true, err + case 12: // well_known.ipv6 + if wire != proto.WireVarint { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeVarint() + m.WellKnown = &BytesRules_Ipv6{x != 0} + return true, err + default: + return false, nil + } +} + +func _BytesRules_OneofSizer(msg proto.Message) (n int) { + m := msg.(*BytesRules) + // well_known + switch x := m.WellKnown.(type) { + case *BytesRules_Ip: + n += 1 // tag and wire + n += 1 + case *BytesRules_Ipv4: + n += 1 // tag and wire + n += 1 + case *BytesRules_Ipv6: + n += 1 // tag and wire + n += 1 + case nil: + default: + panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) + } + return n +} + +type EnumRules struct { + Const *int32 `protobuf:"varint,1,opt,name=const" json:"const,omitempty"` + DefinedOnly *bool `protobuf:"varint,2,opt,name=defined_only,json=definedOnly" json:"defined_only,omitempty"` + In []int32 `protobuf:"varint,3,rep,name=in" json:"in,omitempty"` + NotIn []int32 `protobuf:"varint,4,rep,name=not_in,json=notIn" json:"not_in,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *EnumRules) Reset() { *m = EnumRules{} } +func (m *EnumRules) String() string { return proto.CompactTextString(m) } +func (*EnumRules) ProtoMessage() {} +func (*EnumRules) Descriptor() ([]byte, []int) { + return fileDescriptor_validate_42a9c75c83428773, []int{16} +} +func (m *EnumRules) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_EnumRules.Unmarshal(m, b) +} +func (m *EnumRules) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_EnumRules.Marshal(b, m, deterministic) +} +func (dst *EnumRules) XXX_Merge(src proto.Message) { + xxx_messageInfo_EnumRules.Merge(dst, src) +} +func (m *EnumRules) XXX_Size() int { + return xxx_messageInfo_EnumRules.Size(m) +} +func (m *EnumRules) XXX_DiscardUnknown() { + xxx_messageInfo_EnumRules.DiscardUnknown(m) +} + +var xxx_messageInfo_EnumRules proto.InternalMessageInfo + +func (m *EnumRules) GetConst() int32 { + if m != nil && m.Const != nil { + return *m.Const + } + return 0 +} + +func (m *EnumRules) GetDefinedOnly() bool { + if m != nil && m.DefinedOnly != nil { + return *m.DefinedOnly + } + return false +} + +func (m *EnumRules) GetIn() []int32 { + if m != nil { + return m.In + } + return nil +} + +func (m *EnumRules) GetNotIn() []int32 { + if m != nil { + return m.NotIn + } + return nil +} + +type MessageRules struct { + Skip *bool `protobuf:"varint,1,opt,name=skip" json:"skip,omitempty"` + Required *bool `protobuf:"varint,2,opt,name=required" json:"required,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *MessageRules) Reset() { *m = MessageRules{} } +func (m *MessageRules) String() string { return proto.CompactTextString(m) } +func (*MessageRules) ProtoMessage() {} +func (*MessageRules) Descriptor() ([]byte, []int) { + return fileDescriptor_validate_42a9c75c83428773, []int{17} +} +func (m *MessageRules) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_MessageRules.Unmarshal(m, b) +} +func (m *MessageRules) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_MessageRules.Marshal(b, m, deterministic) +} +func (dst *MessageRules) XXX_Merge(src proto.Message) { + xxx_messageInfo_MessageRules.Merge(dst, src) +} +func (m *MessageRules) XXX_Size() int { + return xxx_messageInfo_MessageRules.Size(m) +} +func (m *MessageRules) XXX_DiscardUnknown() { + xxx_messageInfo_MessageRules.DiscardUnknown(m) +} + +var xxx_messageInfo_MessageRules proto.InternalMessageInfo + +func (m *MessageRules) GetSkip() bool { + if m != nil && m.Skip != nil { + return *m.Skip + } + return false +} + +func (m *MessageRules) GetRequired() bool { + if m != nil && m.Required != nil { + return *m.Required + } + return false +} + +type RepeatedRules struct { + MinItems *uint64 `protobuf:"varint,1,opt,name=min_items,json=minItems" json:"min_items,omitempty"` + MaxItems *uint64 `protobuf:"varint,2,opt,name=max_items,json=maxItems" json:"max_items,omitempty"` + Unique *bool `protobuf:"varint,3,opt,name=unique" json:"unique,omitempty"` + Items *FieldRules `protobuf:"bytes,4,opt,name=items" json:"items,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *RepeatedRules) Reset() { *m = RepeatedRules{} } +func (m *RepeatedRules) String() string { return proto.CompactTextString(m) } +func (*RepeatedRules) ProtoMessage() {} +func (*RepeatedRules) Descriptor() ([]byte, []int) { + return fileDescriptor_validate_42a9c75c83428773, []int{18} +} +func (m *RepeatedRules) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_RepeatedRules.Unmarshal(m, b) +} +func (m *RepeatedRules) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_RepeatedRules.Marshal(b, m, deterministic) +} +func (dst *RepeatedRules) XXX_Merge(src proto.Message) { + xxx_messageInfo_RepeatedRules.Merge(dst, src) +} +func (m *RepeatedRules) XXX_Size() int { + return xxx_messageInfo_RepeatedRules.Size(m) +} +func (m *RepeatedRules) XXX_DiscardUnknown() { + xxx_messageInfo_RepeatedRules.DiscardUnknown(m) +} + +var xxx_messageInfo_RepeatedRules proto.InternalMessageInfo + +func (m *RepeatedRules) GetMinItems() uint64 { + if m != nil && m.MinItems != nil { + return *m.MinItems + } + return 0 +} + +func (m *RepeatedRules) GetMaxItems() uint64 { + if m != nil && m.MaxItems != nil { + return *m.MaxItems + } + return 0 +} + +func (m *RepeatedRules) GetUnique() bool { + if m != nil && m.Unique != nil { + return *m.Unique + } + return false +} + +func (m *RepeatedRules) GetItems() *FieldRules { + if m != nil { + return m.Items + } + return nil +} + +type MapRules struct { + MinPairs *uint64 `protobuf:"varint,1,opt,name=min_pairs,json=minPairs" json:"min_pairs,omitempty"` + MaxPairs *uint64 `protobuf:"varint,2,opt,name=max_pairs,json=maxPairs" json:"max_pairs,omitempty"` + NoSparse *bool `protobuf:"varint,3,opt,name=no_sparse,json=noSparse" json:"no_sparse,omitempty"` + Keys *FieldRules `protobuf:"bytes,4,opt,name=keys" json:"keys,omitempty"` + Values *FieldRules `protobuf:"bytes,5,opt,name=values" json:"values,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *MapRules) Reset() { *m = MapRules{} } +func (m *MapRules) String() string { return proto.CompactTextString(m) } +func (*MapRules) ProtoMessage() {} +func (*MapRules) Descriptor() ([]byte, []int) { + return fileDescriptor_validate_42a9c75c83428773, []int{19} +} +func (m *MapRules) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_MapRules.Unmarshal(m, b) +} +func (m *MapRules) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_MapRules.Marshal(b, m, deterministic) +} +func (dst *MapRules) XXX_Merge(src proto.Message) { + xxx_messageInfo_MapRules.Merge(dst, src) +} +func (m *MapRules) XXX_Size() int { + return xxx_messageInfo_MapRules.Size(m) +} +func (m *MapRules) XXX_DiscardUnknown() { + xxx_messageInfo_MapRules.DiscardUnknown(m) +} + +var xxx_messageInfo_MapRules proto.InternalMessageInfo + +func (m *MapRules) GetMinPairs() uint64 { + if m != nil && m.MinPairs != nil { + return *m.MinPairs + } + return 0 +} + +func (m *MapRules) GetMaxPairs() uint64 { + if m != nil && m.MaxPairs != nil { + return *m.MaxPairs + } + return 0 +} + +func (m *MapRules) GetNoSparse() bool { + if m != nil && m.NoSparse != nil { + return *m.NoSparse + } + return false +} + +func (m *MapRules) GetKeys() *FieldRules { + if m != nil { + return m.Keys + } + return nil +} + +func (m *MapRules) GetValues() *FieldRules { + if m != nil { + return m.Values + } + return nil +} + +type AnyRules struct { + Required *bool `protobuf:"varint,1,opt,name=required" json:"required,omitempty"` + In []string `protobuf:"bytes,2,rep,name=in" json:"in,omitempty"` + NotIn []string `protobuf:"bytes,3,rep,name=not_in,json=notIn" json:"not_in,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *AnyRules) Reset() { *m = AnyRules{} } +func (m *AnyRules) String() string { return proto.CompactTextString(m) } +func (*AnyRules) ProtoMessage() {} +func (*AnyRules) Descriptor() ([]byte, []int) { + return fileDescriptor_validate_42a9c75c83428773, []int{20} +} +func (m *AnyRules) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_AnyRules.Unmarshal(m, b) +} +func (m *AnyRules) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_AnyRules.Marshal(b, m, deterministic) +} +func (dst *AnyRules) XXX_Merge(src proto.Message) { + xxx_messageInfo_AnyRules.Merge(dst, src) +} +func (m *AnyRules) XXX_Size() int { + return xxx_messageInfo_AnyRules.Size(m) +} +func (m *AnyRules) XXX_DiscardUnknown() { + xxx_messageInfo_AnyRules.DiscardUnknown(m) +} + +var xxx_messageInfo_AnyRules proto.InternalMessageInfo + +func (m *AnyRules) GetRequired() bool { + if m != nil && m.Required != nil { + return *m.Required + } + return false +} + +func (m *AnyRules) GetIn() []string { + if m != nil { + return m.In + } + return nil +} + +func (m *AnyRules) GetNotIn() []string { + if m != nil { + return m.NotIn + } + return nil +} + +type DurationRules struct { + Required *bool `protobuf:"varint,1,opt,name=required" json:"required,omitempty"` + Const *duration.Duration `protobuf:"bytes,2,opt,name=const" json:"const,omitempty"` + Lt *duration.Duration `protobuf:"bytes,3,opt,name=lt" json:"lt,omitempty"` + Lte *duration.Duration `protobuf:"bytes,4,opt,name=lte" json:"lte,omitempty"` + Gt *duration.Duration `protobuf:"bytes,5,opt,name=gt" json:"gt,omitempty"` + Gte *duration.Duration `protobuf:"bytes,6,opt,name=gte" json:"gte,omitempty"` + In []*duration.Duration `protobuf:"bytes,7,rep,name=in" json:"in,omitempty"` + NotIn []*duration.Duration `protobuf:"bytes,8,rep,name=not_in,json=notIn" json:"not_in,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *DurationRules) Reset() { *m = DurationRules{} } +func (m *DurationRules) String() string { return proto.CompactTextString(m) } +func (*DurationRules) ProtoMessage() {} +func (*DurationRules) Descriptor() ([]byte, []int) { + return fileDescriptor_validate_42a9c75c83428773, []int{21} +} +func (m *DurationRules) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_DurationRules.Unmarshal(m, b) +} +func (m *DurationRules) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_DurationRules.Marshal(b, m, deterministic) +} +func (dst *DurationRules) XXX_Merge(src proto.Message) { + xxx_messageInfo_DurationRules.Merge(dst, src) +} +func (m *DurationRules) XXX_Size() int { + return xxx_messageInfo_DurationRules.Size(m) +} +func (m *DurationRules) XXX_DiscardUnknown() { + xxx_messageInfo_DurationRules.DiscardUnknown(m) +} + +var xxx_messageInfo_DurationRules proto.InternalMessageInfo + +func (m *DurationRules) GetRequired() bool { + if m != nil && m.Required != nil { + return *m.Required + } + return false +} + +func (m *DurationRules) GetConst() *duration.Duration { + if m != nil { + return m.Const + } + return nil +} + +func (m *DurationRules) GetLt() *duration.Duration { + if m != nil { + return m.Lt + } + return nil +} + +func (m *DurationRules) GetLte() *duration.Duration { + if m != nil { + return m.Lte + } + return nil +} + +func (m *DurationRules) GetGt() *duration.Duration { + if m != nil { + return m.Gt + } + return nil +} + +func (m *DurationRules) GetGte() *duration.Duration { + if m != nil { + return m.Gte + } + return nil +} + +func (m *DurationRules) GetIn() []*duration.Duration { + if m != nil { + return m.In + } + return nil +} + +func (m *DurationRules) GetNotIn() []*duration.Duration { + if m != nil { + return m.NotIn + } + return nil +} + +type TimestampRules struct { + Required *bool `protobuf:"varint,1,opt,name=required" json:"required,omitempty"` + Const *timestamp.Timestamp `protobuf:"bytes,2,opt,name=const" json:"const,omitempty"` + Lt *timestamp.Timestamp `protobuf:"bytes,3,opt,name=lt" json:"lt,omitempty"` + Lte *timestamp.Timestamp `protobuf:"bytes,4,opt,name=lte" json:"lte,omitempty"` + Gt *timestamp.Timestamp `protobuf:"bytes,5,opt,name=gt" json:"gt,omitempty"` + Gte *timestamp.Timestamp `protobuf:"bytes,6,opt,name=gte" json:"gte,omitempty"` + LtNow *bool `protobuf:"varint,7,opt,name=lt_now,json=ltNow" json:"lt_now,omitempty"` + GtNow *bool `protobuf:"varint,8,opt,name=gt_now,json=gtNow" json:"gt_now,omitempty"` + Within *duration.Duration `protobuf:"bytes,9,opt,name=within" json:"within,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *TimestampRules) Reset() { *m = TimestampRules{} } +func (m *TimestampRules) String() string { return proto.CompactTextString(m) } +func (*TimestampRules) ProtoMessage() {} +func (*TimestampRules) Descriptor() ([]byte, []int) { + return fileDescriptor_validate_42a9c75c83428773, []int{22} +} +func (m *TimestampRules) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_TimestampRules.Unmarshal(m, b) +} +func (m *TimestampRules) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_TimestampRules.Marshal(b, m, deterministic) +} +func (dst *TimestampRules) XXX_Merge(src proto.Message) { + xxx_messageInfo_TimestampRules.Merge(dst, src) +} +func (m *TimestampRules) XXX_Size() int { + return xxx_messageInfo_TimestampRules.Size(m) +} +func (m *TimestampRules) XXX_DiscardUnknown() { + xxx_messageInfo_TimestampRules.DiscardUnknown(m) +} + +var xxx_messageInfo_TimestampRules proto.InternalMessageInfo + +func (m *TimestampRules) GetRequired() bool { + if m != nil && m.Required != nil { + return *m.Required + } + return false +} + +func (m *TimestampRules) GetConst() *timestamp.Timestamp { + if m != nil { + return m.Const + } + return nil +} + +func (m *TimestampRules) GetLt() *timestamp.Timestamp { + if m != nil { + return m.Lt + } + return nil +} + +func (m *TimestampRules) GetLte() *timestamp.Timestamp { + if m != nil { + return m.Lte + } + return nil +} + +func (m *TimestampRules) GetGt() *timestamp.Timestamp { + if m != nil { + return m.Gt + } + return nil +} + +func (m *TimestampRules) GetGte() *timestamp.Timestamp { + if m != nil { + return m.Gte + } + return nil +} + +func (m *TimestampRules) GetLtNow() bool { + if m != nil && m.LtNow != nil { + return *m.LtNow + } + return false +} + +func (m *TimestampRules) GetGtNow() bool { + if m != nil && m.GtNow != nil { + return *m.GtNow + } + return false +} + +func (m *TimestampRules) GetWithin() *duration.Duration { + if m != nil { + return m.Within + } + return nil +} + +var E_Disabled = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.MessageOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 919191, + Name: "validate.disabled", + Tag: "varint,919191,opt,name=disabled", + Filename: "validate/validate.proto", +} + +var E_Required = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.OneofOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 919191, + Name: "validate.required", + Tag: "varint,919191,opt,name=required", + Filename: "validate/validate.proto", +} + +var E_Rules = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.FieldOptions)(nil), + ExtensionType: (*FieldRules)(nil), + Field: 919191, + Name: "validate.rules", + Tag: "bytes,919191,opt,name=rules", + Filename: "validate/validate.proto", +} + +func init() { + proto.RegisterType((*FieldRules)(nil), "validate.FieldRules") + proto.RegisterType((*FloatRules)(nil), "validate.FloatRules") + proto.RegisterType((*DoubleRules)(nil), "validate.DoubleRules") + proto.RegisterType((*Int32Rules)(nil), "validate.Int32Rules") + proto.RegisterType((*Int64Rules)(nil), "validate.Int64Rules") + proto.RegisterType((*UInt32Rules)(nil), "validate.UInt32Rules") + proto.RegisterType((*UInt64Rules)(nil), "validate.UInt64Rules") + proto.RegisterType((*SInt32Rules)(nil), "validate.SInt32Rules") + proto.RegisterType((*SInt64Rules)(nil), "validate.SInt64Rules") + proto.RegisterType((*Fixed32Rules)(nil), "validate.Fixed32Rules") + proto.RegisterType((*Fixed64Rules)(nil), "validate.Fixed64Rules") + proto.RegisterType((*SFixed32Rules)(nil), "validate.SFixed32Rules") + proto.RegisterType((*SFixed64Rules)(nil), "validate.SFixed64Rules") + proto.RegisterType((*BoolRules)(nil), "validate.BoolRules") + proto.RegisterType((*StringRules)(nil), "validate.StringRules") + proto.RegisterType((*BytesRules)(nil), "validate.BytesRules") + proto.RegisterType((*EnumRules)(nil), "validate.EnumRules") + proto.RegisterType((*MessageRules)(nil), "validate.MessageRules") + proto.RegisterType((*RepeatedRules)(nil), "validate.RepeatedRules") + proto.RegisterType((*MapRules)(nil), "validate.MapRules") + proto.RegisterType((*AnyRules)(nil), "validate.AnyRules") + proto.RegisterType((*DurationRules)(nil), "validate.DurationRules") + proto.RegisterType((*TimestampRules)(nil), "validate.TimestampRules") + proto.RegisterExtension(E_Disabled) + proto.RegisterExtension(E_Required) + proto.RegisterExtension(E_Rules) +} + +func init() { proto.RegisterFile("validate/validate.proto", fileDescriptor_validate_42a9c75c83428773) } + +var fileDescriptor_validate_42a9c75c83428773 = []byte{ + // 1609 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x98, 0xcb, 0x6e, 0xdb, 0x46, + 0x17, 0xc7, 0x3f, 0xf1, 0x26, 0x6a, 0x2c, 0x45, 0xd2, 0xc4, 0x76, 0x18, 0x7f, 0x97, 0x38, 0x5a, + 0x7c, 0x70, 0x52, 0xc7, 0x4e, 0x1d, 0x57, 0x08, 0x52, 0xb4, 0x40, 0x8d, 0x34, 0x68, 0xd0, 0xa6, + 0x29, 0xe8, 0x66, 0xd3, 0x8d, 0x40, 0x5b, 0x23, 0x65, 0x60, 0x6a, 0xc8, 0x90, 0x54, 0x6c, 0x3d, + 0x44, 0xda, 0xee, 0xfa, 0x2c, 0x5d, 0x75, 0xdf, 0x37, 0xe9, 0xba, 0xdb, 0x2e, 0x8a, 0xb9, 0xf1, + 0x72, 0x48, 0xcb, 0x8b, 0xee, 0x34, 0xe7, 0xfc, 0xcf, 0xcc, 0x0f, 0xff, 0x11, 0x67, 0x0e, 0x89, + 0xee, 0xbc, 0x0f, 0x42, 0x3a, 0x0d, 0x32, 0x72, 0xa8, 0x7f, 0x1c, 0xc4, 0x49, 0x94, 0x45, 0xd8, + 0xd5, 0xe3, 0x9d, 0xdd, 0x79, 0x14, 0xcd, 0x43, 0x72, 0x28, 0xe2, 0x67, 0xcb, 0xd9, 0xe1, 0x94, + 0xa4, 0xe7, 0x09, 0x8d, 0xb3, 0x28, 0x91, 0xda, 0x9d, 0xff, 0xd5, 0x14, 0xcb, 0x24, 0xc8, 0x68, + 0xc4, 0x54, 0xfe, 0x1e, 0xcc, 0x67, 0x74, 0x41, 0xd2, 0x2c, 0x58, 0xc4, 0x52, 0x30, 0xfa, 0xdd, + 0x45, 0xe8, 0x05, 0x25, 0xe1, 0xd4, 0x5f, 0x86, 0x24, 0xc5, 0xfb, 0xc8, 0x9e, 0x85, 0x51, 0x90, + 0x79, 0xad, 0xdd, 0xd6, 0xde, 0xc6, 0xd1, 0xe6, 0x41, 0xce, 0xf6, 0x82, 0x87, 0x85, 0xe8, 0xab, + 0x7f, 0xf9, 0x52, 0x84, 0x0f, 0x91, 0x33, 0x8d, 0x96, 0x67, 0x21, 0xf1, 0x0c, 0x21, 0xdf, 0x2a, + 0xe4, 0xcf, 0x45, 0x5c, 0xeb, 0x95, 0x8c, 0x4f, 0x4f, 0x59, 0xf6, 0xe4, 0xc8, 0x33, 0xe1, 0xf4, + 0x2f, 0x79, 0x38, 0x9f, 0x5e, 0x88, 0x94, 0x7a, 0x7c, 0xec, 0x59, 0x0d, 0xea, 0xf1, 0x71, 0x59, + 0x3d, 0x3e, 0xe6, 0x30, 0x4b, 0x39, 0xb9, 0x0d, 0x61, 0xde, 0x54, 0x66, 0x57, 0x32, 0x5d, 0x30, + 0x3e, 0xf6, 0x9c, 0xa6, 0x82, 0x62, 0x01, 0x25, 0xe3, 0x05, 0xa9, 0x5c, 0xa1, 0x0d, 0x0b, 0x4e, + 0xab, 0x2b, 0xa4, 0xf9, 0x0a, 0xa9, 0x5c, 0xc1, 0x6d, 0x2a, 0x28, 0xad, 0x20, 0x65, 0xf8, 0x08, + 0xb5, 0x67, 0xf4, 0x8a, 0x4c, 0x9f, 0x1c, 0x79, 0x1d, 0x51, 0xb1, 0x5d, 0xda, 0x00, 0x99, 0xd0, + 0x25, 0x5a, 0x98, 0xd7, 0x8c, 0x8f, 0x3d, 0xd4, 0x58, 0x53, 0x2c, 0xa3, 0x85, 0xf8, 0x13, 0xe4, + 0xa6, 0x7a, 0xa1, 0x0d, 0x51, 0x74, 0xa7, 0x84, 0x06, 0x56, 0xca, 0xa5, 0x45, 0xd9, 0xf8, 0xd8, + 0xeb, 0x36, 0x97, 0x15, 0x8b, 0xe5, 0x52, 0xfc, 0x00, 0x59, 0x67, 0x51, 0x14, 0x7a, 0x3d, 0x51, + 0x72, 0xbb, 0x28, 0x39, 0x89, 0xa2, 0x50, 0xcb, 0x85, 0x44, 0x38, 0x96, 0x25, 0x94, 0xcd, 0xbd, + 0x5b, 0x35, 0xc7, 0x44, 0xbc, 0x70, 0x4c, 0x0c, 0xf9, 0x7f, 0xe4, 0x6c, 0x95, 0x91, 0xd4, 0xeb, + 0xc3, 0xff, 0xc8, 0x09, 0x0f, 0xe7, 0xff, 0x11, 0x21, 0xe2, 0x24, 0x84, 0x2d, 0x17, 0xde, 0x00, + 0x92, 0x7c, 0xc9, 0x96, 0x8b, 0x9c, 0x84, 0x4b, 0xb8, 0xad, 0x0b, 0x92, 0xa6, 0xc1, 0x9c, 0x78, + 0x43, 0x68, 0xeb, 0x2b, 0x99, 0xc8, 0x6d, 0x55, 0x42, 0xee, 0x4f, 0x42, 0x62, 0x12, 0x64, 0x64, + 0xea, 0x61, 0xe8, 0x8f, 0xaf, 0x32, 0xb9, 0x3f, 0x5a, 0x8a, 0xff, 0x8f, 0xcc, 0x45, 0x10, 0x7b, + 0xb7, 0x45, 0x05, 0x2e, 0x2d, 0x13, 0xc4, 0x5a, 0xcc, 0x05, 0x5c, 0x17, 0xb0, 0x95, 0xb7, 0x09, + 0x75, 0x5f, 0xb0, 0x55, 0xae, 0x0b, 0xd8, 0x8a, 0x63, 0xe8, 0x63, 0xc0, 0xdb, 0x82, 0x18, 0xcf, + 0x55, 0x26, 0xc7, 0xd0, 0x52, 0xfc, 0x14, 0x75, 0xf2, 0xd3, 0xc1, 0xdb, 0x16, 0x75, 0x5e, 0x51, + 0xf7, 0xbd, 0x4e, 0xe9, 0xc2, 0x42, 0x7c, 0xe2, 0x20, 0x2b, 0x5b, 0xc5, 0x64, 0xf4, 0xa1, 0x85, + 0x50, 0x71, 0x4e, 0xe0, 0x4d, 0x64, 0x9f, 0x47, 0x2c, 0x95, 0x87, 0x89, 0xe1, 0xcb, 0x01, 0xbe, + 0x85, 0x8c, 0x30, 0x13, 0x07, 0x86, 0xe1, 0x1b, 0x61, 0x86, 0x07, 0xc8, 0x0c, 0x33, 0x22, 0x4e, + 0x04, 0xc3, 0xe7, 0x3f, 0xb9, 0x62, 0x9e, 0x89, 0x87, 0xde, 0xf0, 0x8d, 0xb9, 0x50, 0xcc, 0x33, + 0x22, 0x1e, 0x6b, 0xc3, 0xe7, 0x3f, 0xb9, 0x82, 0x32, 0xcf, 0xd9, 0x35, 0xb9, 0x82, 0x32, 0xbc, + 0x85, 0x1c, 0x16, 0x65, 0x13, 0xca, 0xbc, 0xb6, 0x88, 0xd9, 0x2c, 0xca, 0x5e, 0xb2, 0xd1, 0x8f, + 0x2d, 0xb4, 0x51, 0x3a, 0x88, 0xaa, 0x40, 0xad, 0x3a, 0x50, 0x0b, 0x02, 0xb5, 0x20, 0x50, 0x0b, + 0x02, 0xb5, 0x20, 0x50, 0xab, 0x01, 0xa8, 0xa5, 0x81, 0xb8, 0x41, 0xc5, 0x49, 0x51, 0xe5, 0xb1, + 0xeb, 0x3c, 0x36, 0xe4, 0xb1, 0x21, 0x8f, 0x0d, 0x79, 0x6c, 0xc8, 0x63, 0x37, 0xf0, 0xd8, 0x80, + 0x47, 0x3d, 0xb4, 0x55, 0x1e, 0xb3, 0xce, 0x63, 0x42, 0x1e, 0x13, 0xf2, 0x98, 0x90, 0xc7, 0x84, + 0x3c, 0x66, 0x03, 0x8f, 0x59, 0xde, 0xb0, 0x37, 0xd7, 0x19, 0xd4, 0xab, 0x03, 0xf5, 0x20, 0x50, + 0x0f, 0x02, 0xf5, 0x20, 0x50, 0x0f, 0x02, 0xf5, 0x1a, 0x80, 0x7a, 0x10, 0xa8, 0xd1, 0x21, 0xab, + 0x0e, 0x64, 0x41, 0x20, 0x0b, 0x02, 0x59, 0x10, 0xc8, 0x82, 0x40, 0x56, 0x03, 0x90, 0x55, 0x06, + 0x3a, 0xbd, 0xce, 0xa1, 0x61, 0x1d, 0x68, 0x08, 0x81, 0x86, 0x10, 0x68, 0x08, 0x81, 0x86, 0x10, + 0x68, 0xd8, 0x00, 0x34, 0x84, 0x40, 0x8d, 0x0e, 0xe1, 0x3a, 0x10, 0x86, 0x40, 0x18, 0x02, 0x61, + 0x08, 0x84, 0x21, 0x10, 0x6e, 0x00, 0xc2, 0x1a, 0xe8, 0xa7, 0x16, 0xea, 0x96, 0x6f, 0xb0, 0x2a, + 0x51, 0xbb, 0x4e, 0xd4, 0x86, 0x44, 0x6d, 0x48, 0xd4, 0x86, 0x44, 0x6d, 0x48, 0xd4, 0x6e, 0x20, + 0x6a, 0xd7, 0x88, 0x1a, 0x3d, 0x72, 0xea, 0x44, 0x0e, 0x24, 0x72, 0x20, 0x91, 0x03, 0x89, 0x1c, + 0x48, 0xe4, 0x34, 0x10, 0x39, 0x9a, 0xe8, 0xe7, 0x16, 0xea, 0x9d, 0x5e, 0x6f, 0x52, 0xbf, 0x8e, + 0xd4, 0x87, 0x48, 0x7d, 0x88, 0xd4, 0x87, 0x48, 0x7d, 0x88, 0xd4, 0x6f, 0x40, 0xea, 0xd7, 0x91, + 0x1a, 0x5d, 0x1a, 0xd4, 0x91, 0x06, 0x10, 0x69, 0x00, 0x91, 0x06, 0x10, 0x69, 0x00, 0x91, 0x06, + 0x0d, 0x48, 0x03, 0x8d, 0x74, 0x1f, 0x75, 0xf2, 0x0e, 0xa5, 0x4a, 0xe3, 0x2a, 0x9a, 0xd1, 0x5f, + 0x26, 0xda, 0x28, 0x35, 0x26, 0x55, 0x55, 0x47, 0x33, 0x73, 0x46, 0xc2, 0xc4, 0x05, 0xcf, 0xcf, + 0x03, 0xc2, 0xf0, 0x1d, 0xd4, 0x5e, 0x50, 0x36, 0xe1, 0x51, 0x79, 0x6c, 0x38, 0x0b, 0xca, 0xbe, + 0x51, 0x89, 0xe0, 0x4a, 0x24, 0x4c, 0x95, 0x08, 0xae, 0x78, 0xe2, 0xdf, 0xa8, 0x13, 0x12, 0x36, + 0x91, 0xcd, 0xce, 0xa6, 0x48, 0xb9, 0x21, 0x61, 0xa2, 0xcb, 0xe1, 0x49, 0x3e, 0x9d, 0x4c, 0xca, + 0x53, 0xc6, 0x5d, 0xd0, 0x52, 0x32, 0xb8, 0x52, 0x49, 0x5b, 0x25, 0x83, 0x2b, 0x99, 0xf4, 0x50, + 0x3b, 0x0e, 0xb2, 0x8c, 0x24, 0x4c, 0x74, 0xc1, 0x1d, 0x5f, 0x0f, 0xf1, 0x36, 0x72, 0xe2, 0x84, + 0xcc, 0xe8, 0x95, 0xe8, 0x76, 0x3b, 0xbe, 0x1a, 0xf1, 0x78, 0xba, 0x9c, 0xf1, 0xb8, 0x2b, 0xe3, + 0x72, 0x84, 0x77, 0x90, 0x7b, 0x1e, 0xb1, 0x2c, 0xa0, 0x2c, 0x15, 0xcd, 0x6b, 0xc7, 0xcf, 0xc7, + 0xca, 0x70, 0xb4, 0x6b, 0xee, 0x75, 0x80, 0xe1, 0x1b, 0x22, 0x26, 0x0d, 0xc7, 0xdb, 0xc8, 0x26, + 0x8b, 0x80, 0x86, 0xa2, 0xb9, 0x74, 0x79, 0xdb, 0x26, 0x86, 0xf8, 0x3f, 0xc8, 0x7d, 0x1b, 0xa5, + 0x19, 0x0b, 0x16, 0x44, 0x34, 0x91, 0x3c, 0x95, 0x47, 0xf0, 0x00, 0x19, 0x34, 0x16, 0xfd, 0x22, + 0x8f, 0x1b, 0x34, 0xc6, 0x9b, 0xc8, 0xa2, 0xf1, 0xfb, 0x63, 0xd1, 0x13, 0xf2, 0x98, 0x18, 0xa9, + 0xe8, 0x58, 0x34, 0x7f, 0x3a, 0x3a, 0xc6, 0x18, 0x99, 0xcb, 0x84, 0x8a, 0x1e, 0x8f, 0x07, 0xf9, + 0x00, 0xdf, 0x45, 0xed, 0x65, 0x42, 0x27, 0x09, 0x99, 0x89, 0x36, 0xce, 0x15, 0xef, 0x00, 0x09, + 0xf5, 0xc9, 0xec, 0xa4, 0x8b, 0xd0, 0x25, 0x09, 0xc3, 0xc9, 0x05, 0x8b, 0x2e, 0xd9, 0xe8, 0x37, + 0x03, 0xa1, 0xa2, 0xcf, 0xac, 0xee, 0x7e, 0x17, 0xec, 0x7e, 0xef, 0x9f, 0xec, 0x7e, 0x69, 0x9b, + 0xac, 0xeb, 0xb6, 0xc9, 0x16, 0x8b, 0xd6, 0xb7, 0xc9, 0x91, 0xf1, 0x86, 0x6d, 0x6a, 0x8b, 0x0c, + 0xdc, 0x26, 0x77, 0xd7, 0xdc, 0xeb, 0x82, 0x6d, 0xea, 0x88, 0x98, 0xda, 0x26, 0x69, 0x38, 0x6a, + 0x30, 0x7c, 0xa3, 0xd1, 0xf0, 0x6e, 0xd9, 0x70, 0xe0, 0xe0, 0x05, 0xea, 0xe4, 0xbd, 0xf7, 0x35, + 0xfd, 0xd0, 0x7d, 0xd4, 0x9d, 0x92, 0x19, 0x65, 0x64, 0x3a, 0x89, 0x58, 0xb8, 0x12, 0x96, 0xb9, + 0xfe, 0x86, 0x8a, 0xbd, 0x66, 0xe1, 0x4a, 0x81, 0x9b, 0x0d, 0xed, 0x8e, 0x55, 0x6e, 0x77, 0x3e, + 0x47, 0xdd, 0x72, 0xeb, 0x8e, 0x31, 0xb2, 0xd2, 0x0b, 0x1a, 0xab, 0x47, 0x5a, 0xfc, 0xe6, 0xfe, + 0x24, 0xe4, 0xdd, 0x92, 0x26, 0x64, 0xaa, 0x56, 0xca, 0xc7, 0xbc, 0x5d, 0xea, 0x55, 0xda, 0x78, + 0xfd, 0xe0, 0xd1, 0x8c, 0x2c, 0x52, 0xd5, 0x13, 0xf0, 0x07, 0xef, 0x25, 0x1f, 0xeb, 0x07, 0x4f, + 0x26, 0x8d, 0xfc, 0xc1, 0x93, 0xc9, 0x6d, 0xe4, 0x2c, 0x19, 0x7d, 0xb7, 0x94, 0x47, 0x97, 0xeb, + 0xab, 0x11, 0x7e, 0x88, 0x6c, 0x59, 0x50, 0x7b, 0xe9, 0x2d, 0x5e, 0xd3, 0x7d, 0x29, 0x19, 0xfd, + 0xda, 0x42, 0xae, 0x7e, 0x49, 0xd0, 0x28, 0x71, 0x40, 0x93, 0x32, 0xca, 0x77, 0x7c, 0xac, 0x51, + 0x64, 0xb2, 0x40, 0xc9, 0x93, 0x2c, 0x9a, 0xa4, 0x71, 0x90, 0xa4, 0x9a, 0xc6, 0x65, 0xd1, 0xa9, + 0x18, 0xe3, 0x3d, 0x64, 0x5d, 0x90, 0xd5, 0x7a, 0x1c, 0xa1, 0xc0, 0xfb, 0xc8, 0x79, 0x1f, 0x84, + 0x4b, 0x75, 0xc8, 0x5c, 0xa7, 0x55, 0x9a, 0xd1, 0x2b, 0xe4, 0xea, 0xf7, 0x96, 0x8a, 0xe7, 0xad, + 0xaa, 0xe7, 0x6a, 0x6b, 0x8d, 0x86, 0xa3, 0xc3, 0x2c, 0x1d, 0x1d, 0xa3, 0x3f, 0x0c, 0xd4, 0xab, + 0xbc, 0xda, 0xac, 0x9d, 0xf4, 0x50, 0xff, 0xd1, 0xe4, 0x77, 0x8b, 0xbb, 0x07, 0xf2, 0x33, 0xc9, + 0x81, 0xfe, 0x4c, 0x52, 0xbc, 0x25, 0xa9, 0xff, 0xe0, 0x03, 0x71, 0xeb, 0x98, 0x37, 0xa9, 0xf9, + 0x85, 0xf4, 0x91, 0xbc, 0x90, 0xac, 0x9b, 0xb4, 0xe2, 0xae, 0x7a, 0x20, 0xee, 0x2a, 0xfb, 0xc6, + 0x79, 0xe7, 0x62, 0x5e, 0x7e, 0x8d, 0x39, 0x37, 0xce, 0x3b, 0x97, 0xf3, 0xaa, 0xdb, 0x6c, 0xfd, + 0xbc, 0x94, 0xe1, 0xc7, 0xb9, 0xa1, 0xee, 0x4d, 0x72, 0xe5, 0xf5, 0x9f, 0x06, 0xba, 0x55, 0x7d, + 0x1d, 0x5c, 0x6b, 0xf6, 0xe3, 0xaa, 0xd9, 0x3b, 0xb5, 0xf9, 0x8b, 0xb9, 0x94, 0xdb, 0x0f, 0x4b, + 0x6e, 0xaf, 0x93, 0x73, 0xbb, 0xf7, 0xcb, 0x76, 0xaf, 0x13, 0x0b, 0xbf, 0x1f, 0x96, 0xfc, 0x5e, + 0x3b, 0xf3, 0x5c, 0xcc, 0x5c, 0x18, 0xbe, 0x76, 0x66, 0xee, 0xf8, 0x16, 0x72, 0xc2, 0x6c, 0xc2, + 0xa2, 0x4b, 0x71, 0xaa, 0xba, 0xbe, 0x1d, 0x66, 0xdf, 0x46, 0x97, 0x3c, 0x3c, 0x97, 0x61, 0x57, + 0x86, 0xe7, 0x22, 0xfc, 0x31, 0x72, 0x2e, 0x69, 0xf6, 0x56, 0x9c, 0xac, 0x37, 0xec, 0xa7, 0x12, + 0x3e, 0xfb, 0x0c, 0xb9, 0x53, 0x9a, 0x06, 0x67, 0x21, 0x99, 0xe2, 0x7b, 0x35, 0xb9, 0x3a, 0xd7, + 0x5e, 0xc7, 0xbc, 0x26, 0xf5, 0x7e, 0xf9, 0xf0, 0x54, 0xee, 0x82, 0x2e, 0x79, 0xf6, 0x69, 0xb1, + 0x43, 0xf8, 0xbf, 0xb5, 0xf2, 0xd7, 0x8c, 0x44, 0xb3, 0x5a, 0xb1, 0x2e, 0x78, 0xf6, 0x35, 0xb2, + 0x13, 0xb1, 0xcf, 0xf5, 0x4a, 0xf1, 0x68, 0x57, 0x2b, 0xaf, 0x3d, 0xb5, 0xc4, 0x1c, 0x27, 0x07, + 0x3f, 0xec, 0xcf, 0x69, 0xf6, 0x76, 0x79, 0x76, 0x70, 0x1e, 0x2d, 0x0e, 0xc3, 0xd5, 0x2c, 0x93, + 0x9f, 0x27, 0xcf, 0x1f, 0xcd, 0x09, 0x7b, 0x54, 0xfb, 0x2a, 0xfa, 0x77, 0x00, 0x00, 0x00, 0xff, + 0xff, 0xe1, 0xd8, 0xec, 0xea, 0x29, 0x15, 0x00, 0x00, +} diff --git a/vendor/github.com/lyft/protoc-gen-validate/validate/validate.proto b/vendor/github.com/lyft/protoc-gen-validate/validate/validate.proto new file mode 100644 index 000000000000..84ca6f67d6a8 --- /dev/null +++ b/vendor/github.com/lyft/protoc-gen-validate/validate/validate.proto @@ -0,0 +1,762 @@ +syntax = "proto2"; +package validate; + +option go_package = "github.com/lyft/protoc-gen-validate/validate"; + +import "google/protobuf/descriptor.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/timestamp.proto"; + +// Validation rules applied at the message level +extend google.protobuf.MessageOptions { + // Disabled nullifies any validation rules for this message, including any + // message fields associated with it that do support validation. + optional bool disabled = 919191; +} + +// Validation rules applied at the oneof level +extend google.protobuf.OneofOptions { + // Required ensures that exactly one the field options in a oneof is set; + // validation fails if no fields in the oneof are set. + optional bool required = 919191; +} + +// Validation rules applied at the field level +extend google.protobuf.FieldOptions { + // Rules specify the validations to be performed on this field. By default, + // no validation is performed against a field. + optional FieldRules rules = 919191; +} + +// FieldRules encapsulates the rules for each type of field. Depending on the +// field, the correct set should be used to ensure proper validations. +message FieldRules { + oneof type { + // Scalar Field Types + FloatRules float = 1; + DoubleRules double = 2; + Int32Rules int32 = 3; + Int64Rules int64 = 4; + UInt32Rules uint32 = 5; + UInt64Rules uint64 = 6; + SInt32Rules sint32 = 7; + SInt64Rules sint64 = 8; + Fixed32Rules fixed32 = 9; + Fixed64Rules fixed64 = 10; + SFixed32Rules sfixed32 = 11; + SFixed64Rules sfixed64 = 12; + BoolRules bool = 13; + StringRules string = 14; + BytesRules bytes = 15; + + // Complex Field Types + EnumRules enum = 16; + MessageRules message = 17; + RepeatedRules repeated = 18; + MapRules map = 19; + + // Well-Known Field Types + AnyRules any = 20; + DurationRules duration = 21; + TimestampRules timestamp = 22; + } +} + +// FloatRules describes the constraints applied to `float` values +message FloatRules { + // Const specifies that this field must be exactly the specified value + optional float const = 1; + + // Lt specifies that this field must be less than the specified value, + // exclusive + optional float lt = 2; + + // Lte specifies that this field must be less than or equal to the + // specified value, inclusive + optional float lte = 3; + + // Gt specifies that this field must be greater than the specified value, + // exclusive. If the value of Gt is larger than a specified Lt or Lte, the + // range is reversed. + optional float gt = 4; + + // Gte specifies that this field must be greater than or equal to the + // specified value, inclusive. If the value of Gte is larger than a + // specified Lt or Lte, the range is reversed. + optional float gte = 5; + + // In specifies that this field must be equal to one of the specified + // values + repeated float in = 6; + + // NotIn specifies that this field cannot be equal to one of the specified + // values + repeated float not_in = 7; +} + +// DoubleRules describes the constraints applied to `double` values +message DoubleRules { + // Const specifies that this field must be exactly the specified value + optional double const = 1; + + // Lt specifies that this field must be less than the specified value, + // exclusive + optional double lt = 2; + + // Lte specifies that this field must be less than or equal to the + // specified value, inclusive + optional double lte = 3; + + // Gt specifies that this field must be greater than the specified value, + // exclusive. If the value of Gt is larger than a specified Lt or Lte, the + // range is reversed. + optional double gt = 4; + + // Gte specifies that this field must be greater than or equal to the + // specified value, inclusive. If the value of Gte is larger than a + // specified Lt or Lte, the range is reversed. + optional double gte = 5; + + // In specifies that this field must be equal to one of the specified + // values + repeated double in = 6; + + // NotIn specifies that this field cannot be equal to one of the specified + // values + repeated double not_in = 7; +} + +// Int32Rules describes the constraints applied to `int32` values +message Int32Rules { + // Const specifies that this field must be exactly the specified value + optional int32 const = 1; + + // Lt specifies that this field must be less than the specified value, + // exclusive + optional int32 lt = 2; + + // Lte specifies that this field must be less than or equal to the + // specified value, inclusive + optional int32 lte = 3; + + // Gt specifies that this field must be greater than the specified value, + // exclusive. If the value of Gt is larger than a specified Lt or Lte, the + // range is reversed. + optional int32 gt = 4; + + // Gte specifies that this field must be greater than or equal to the + // specified value, inclusive. If the value of Gte is larger than a + // specified Lt or Lte, the range is reversed. + optional int32 gte = 5; + + // In specifies that this field must be equal to one of the specified + // values + repeated int32 in = 6; + + // NotIn specifies that this field cannot be equal to one of the specified + // values + repeated int32 not_in = 7; +} + +// Int64Rules describes the constraints applied to `int64` values +message Int64Rules { + // Const specifies that this field must be exactly the specified value + optional int64 const = 1; + + // Lt specifies that this field must be less than the specified value, + // exclusive + optional int64 lt = 2; + + // Lte specifies that this field must be less than or equal to the + // specified value, inclusive + optional int64 lte = 3; + + // Gt specifies that this field must be greater than the specified value, + // exclusive. If the value of Gt is larger than a specified Lt or Lte, the + // range is reversed. + optional int64 gt = 4; + + // Gte specifies that this field must be greater than or equal to the + // specified value, inclusive. If the value of Gte is larger than a + // specified Lt or Lte, the range is reversed. + optional int64 gte = 5; + + // In specifies that this field must be equal to one of the specified + // values + repeated int64 in = 6; + + // NotIn specifies that this field cannot be equal to one of the specified + // values + repeated int64 not_in = 7; +} + +// UInt32Rules describes the constraints applied to `uint32` values +message UInt32Rules { + // Const specifies that this field must be exactly the specified value + optional uint32 const = 1; + + // Lt specifies that this field must be less than the specified value, + // exclusive + optional uint32 lt = 2; + + // Lte specifies that this field must be less than or equal to the + // specified value, inclusive + optional uint32 lte = 3; + + // Gt specifies that this field must be greater than the specified value, + // exclusive. If the value of Gt is larger than a specified Lt or Lte, the + // range is reversed. + optional uint32 gt = 4; + + // Gte specifies that this field must be greater than or equal to the + // specified value, inclusive. If the value of Gte is larger than a + // specified Lt or Lte, the range is reversed. + optional uint32 gte = 5; + + // In specifies that this field must be equal to one of the specified + // values + repeated uint32 in = 6; + + // NotIn specifies that this field cannot be equal to one of the specified + // values + repeated uint32 not_in = 7; +} + +// UInt64Rules describes the constraints applied to `uint64` values +message UInt64Rules { + // Const specifies that this field must be exactly the specified value + optional uint64 const = 1; + + // Lt specifies that this field must be less than the specified value, + // exclusive + optional uint64 lt = 2; + + // Lte specifies that this field must be less than or equal to the + // specified value, inclusive + optional uint64 lte = 3; + + // Gt specifies that this field must be greater than the specified value, + // exclusive. If the value of Gt is larger than a specified Lt or Lte, the + // range is reversed. + optional uint64 gt = 4; + + // Gte specifies that this field must be greater than or equal to the + // specified value, inclusive. If the value of Gte is larger than a + // specified Lt or Lte, the range is reversed. + optional uint64 gte = 5; + + // In specifies that this field must be equal to one of the specified + // values + repeated uint64 in = 6; + + // NotIn specifies that this field cannot be equal to one of the specified + // values + repeated uint64 not_in = 7; +} + +// SInt32Rules describes the constraints applied to `sint32` values +message SInt32Rules { + // Const specifies that this field must be exactly the specified value + optional sint32 const = 1; + + // Lt specifies that this field must be less than the specified value, + // exclusive + optional sint32 lt = 2; + + // Lte specifies that this field must be less than or equal to the + // specified value, inclusive + optional sint32 lte = 3; + + // Gt specifies that this field must be greater than the specified value, + // exclusive. If the value of Gt is larger than a specified Lt or Lte, the + // range is reversed. + optional sint32 gt = 4; + + // Gte specifies that this field must be greater than or equal to the + // specified value, inclusive. If the value of Gte is larger than a + // specified Lt or Lte, the range is reversed. + optional sint32 gte = 5; + + // In specifies that this field must be equal to one of the specified + // values + repeated sint32 in = 6; + + // NotIn specifies that this field cannot be equal to one of the specified + // values + repeated sint32 not_in = 7; +} + +// SInt64Rules describes the constraints applied to `sint64` values +message SInt64Rules { + // Const specifies that this field must be exactly the specified value + optional sint64 const = 1; + + // Lt specifies that this field must be less than the specified value, + // exclusive + optional sint64 lt = 2; + + // Lte specifies that this field must be less than or equal to the + // specified value, inclusive + optional sint64 lte = 3; + + // Gt specifies that this field must be greater than the specified value, + // exclusive. If the value of Gt is larger than a specified Lt or Lte, the + // range is reversed. + optional sint64 gt = 4; + + // Gte specifies that this field must be greater than or equal to the + // specified value, inclusive. If the value of Gte is larger than a + // specified Lt or Lte, the range is reversed. + optional sint64 gte = 5; + + // In specifies that this field must be equal to one of the specified + // values + repeated sint64 in = 6; + + // NotIn specifies that this field cannot be equal to one of the specified + // values + repeated sint64 not_in = 7; +} + +// Fixed32Rules describes the constraints applied to `fixed32` values +message Fixed32Rules { + // Const specifies that this field must be exactly the specified value + optional fixed32 const = 1; + + // Lt specifies that this field must be less than the specified value, + // exclusive + optional fixed32 lt = 2; + + // Lte specifies that this field must be less than or equal to the + // specified value, inclusive + optional fixed32 lte = 3; + + // Gt specifies that this field must be greater than the specified value, + // exclusive. If the value of Gt is larger than a specified Lt or Lte, the + // range is reversed. + optional fixed32 gt = 4; + + // Gte specifies that this field must be greater than or equal to the + // specified value, inclusive. If the value of Gte is larger than a + // specified Lt or Lte, the range is reversed. + optional fixed32 gte = 5; + + // In specifies that this field must be equal to one of the specified + // values + repeated fixed32 in = 6; + + // NotIn specifies that this field cannot be equal to one of the specified + // values + repeated fixed32 not_in = 7; +} + +// Fixed64Rules describes the constraints applied to `fixed64` values +message Fixed64Rules { + // Const specifies that this field must be exactly the specified value + optional fixed64 const = 1; + + // Lt specifies that this field must be less than the specified value, + // exclusive + optional fixed64 lt = 2; + + // Lte specifies that this field must be less than or equal to the + // specified value, inclusive + optional fixed64 lte = 3; + + // Gt specifies that this field must be greater than the specified value, + // exclusive. If the value of Gt is larger than a specified Lt or Lte, the + // range is reversed. + optional fixed64 gt = 4; + + // Gte specifies that this field must be greater than or equal to the + // specified value, inclusive. If the value of Gte is larger than a + // specified Lt or Lte, the range is reversed. + optional fixed64 gte = 5; + + // In specifies that this field must be equal to one of the specified + // values + repeated fixed64 in = 6; + + // NotIn specifies that this field cannot be equal to one of the specified + // values + repeated fixed64 not_in = 7; +} + +// SFixed32Rules describes the constraints applied to `sfixed32` values +message SFixed32Rules { + // Const specifies that this field must be exactly the specified value + optional sfixed32 const = 1; + + // Lt specifies that this field must be less than the specified value, + // exclusive + optional sfixed32 lt = 2; + + // Lte specifies that this field must be less than or equal to the + // specified value, inclusive + optional sfixed32 lte = 3; + + // Gt specifies that this field must be greater than the specified value, + // exclusive. If the value of Gt is larger than a specified Lt or Lte, the + // range is reversed. + optional sfixed32 gt = 4; + + // Gte specifies that this field must be greater than or equal to the + // specified value, inclusive. If the value of Gte is larger than a + // specified Lt or Lte, the range is reversed. + optional sfixed32 gte = 5; + + // In specifies that this field must be equal to one of the specified + // values + repeated sfixed32 in = 6; + + // NotIn specifies that this field cannot be equal to one of the specified + // values + repeated sfixed32 not_in = 7; +} + +// SFixed64Rules describes the constraints applied to `sfixed64` values +message SFixed64Rules { + // Const specifies that this field must be exactly the specified value + optional sfixed64 const = 1; + + // Lt specifies that this field must be less than the specified value, + // exclusive + optional sfixed64 lt = 2; + + // Lte specifies that this field must be less than or equal to the + // specified value, inclusive + optional sfixed64 lte = 3; + + // Gt specifies that this field must be greater than the specified value, + // exclusive. If the value of Gt is larger than a specified Lt or Lte, the + // range is reversed. + optional sfixed64 gt = 4; + + // Gte specifies that this field must be greater than or equal to the + // specified value, inclusive. If the value of Gte is larger than a + // specified Lt or Lte, the range is reversed. + optional sfixed64 gte = 5; + + // In specifies that this field must be equal to one of the specified + // values + repeated sfixed64 in = 6; + + // NotIn specifies that this field cannot be equal to one of the specified + // values + repeated sfixed64 not_in = 7; +} + +// BoolRules describes the constraints applied to `bool` values +message BoolRules { + // Const specifies that this field must be exactly the specified value + optional bool const = 1; +} + +// StringRules describe the constraints applied to `string` values +message StringRules { + // Const specifies that this field must be exactly the specified value + optional string const = 1; + + // Len specifies that this field must be the specified number of + // characters (Unicode code points). Note that the number of + // characters may differ from the number of bytes in the string. + optional uint64 len = 19; + + // MinLen specifies that this field must be the specified number of + // characters (Unicode code points) at a minimum. Note that the number of + // characters may differ from the number of bytes in the string. + optional uint64 min_len = 2; + + // MaxLen specifies that this field must be the specified number of + // characters (Unicode code points) at a maximum. Note that the number of + // characters may differ from the number of bytes in the string. + optional uint64 max_len = 3; + + // LenBytes specifies that this field must be the specified number of bytes + // at a minimum + optional uint64 len_bytes = 20; + + // MinBytes specifies that this field must be the specified number of bytes + // at a minimum + optional uint64 min_bytes = 4; + + // MaxBytes specifies that this field must be the specified number of bytes + // at a maximum + optional uint64 max_bytes = 5; + + // Pattern specifes that this field must match against the specified + // regular expression (RE2 syntax). The included expression should elide + // any delimiters. + optional string pattern = 6; + + // Prefix specifies that this field must have the specified substring at + // the beginning of the string. + optional string prefix = 7; + + // Suffix specifies that this field must have the specified substring at + // the end of the string. + optional string suffix = 8; + + // Contains specifies that this field must have the specified substring + // anywhere in the string. + optional string contains = 9; + + // In specifies that this field must be equal to one of the specified + // values + repeated string in = 10; + + // NotIn specifies that this field cannot be equal to one of the specified + // values + repeated string not_in = 11; + + // WellKnown rules provide advanced constraints against common string + // patterns + oneof well_known { + // Email specifies that the field must be a valid email address as + // defined by RFC 5322 + bool email = 12; + + // Hostname specifies that the field must be a valid hostname as + // defined by RFC 1034. This constraint does not support + // internationalized domain names (IDNs). + bool hostname = 13; + + // Ip specifies that the field must be a valid IP (v4 or v6) address. + // Valid IPv6 addresses should not include surrounding square brackets. + bool ip = 14; + + // Ipv4 specifies that the field must be a valid IPv4 address. + bool ipv4 = 15; + + // Ipv6 specifies that the field must be a valid IPv6 address. Valid + // IPv6 addresses should not include surrounding square brackets. + bool ipv6 = 16; + + // Uri specifies that the field must be a valid, absolute URI as defined + // by RFC 3986 + bool uri = 17; + + // UriRef specifies that the field must be a valid URI as defined by RFC + // 3986 and may be relative or absolute. + bool uri_ref = 18; + } +} + +// BytesRules describe the constraints applied to `bytes` values +message BytesRules { + // Const specifies that this field must be exactly the specified value + optional bytes const = 1; + + // Len specifies that this field must be the specified number of bytes + optional uint64 len = 13; + + // MinLen specifies that this field must be the specified number of bytes + // at a minimum + optional uint64 min_len = 2; + + // MaxLen specifies that this field must be the specified number of bytes + // at a maximum + optional uint64 max_len = 3; + + // Pattern specifes that this field must match against the specified + // regular expression (RE2 syntax). The included expression should elide + // any delimiters. + optional string pattern = 4; + + // Prefix specifies that this field must have the specified bytes at the + // beginning of the string. + optional bytes prefix = 5; + + // Suffix specifies that this field must have the specified bytes at the + // end of the string. + optional bytes suffix = 6; + + // Contains specifies that this field must have the specified bytes + // anywhere in the string. + optional bytes contains = 7; + + // In specifies that this field must be equal to one of the specified + // values + repeated bytes in = 8; + + // NotIn specifies that this field cannot be equal to one of the specified + // values + repeated bytes not_in = 9; + + // WellKnown rules provide advanced constraints against common byte + // patterns + oneof well_known { + // Ip specifies that the field must be a valid IP (v4 or v6) address in + // byte format + bool ip = 10; + + // Ipv4 specifies that the field must be a valid IPv4 address in byte + // format + bool ipv4 = 11; + + // Ipv6 specifies that the field must be a valid IPv6 address in byte + // format + bool ipv6 = 12; + } +} + +// EnumRules describe the constraints applied to enum values +message EnumRules { + // Const specifies that this field must be exactly the specified value + optional int32 const = 1; + + // DefinedOnly specifies that this field must be only one of the defined + // values for this enum, failing on any undefined value. + optional bool defined_only = 2; + + // In specifies that this field must be equal to one of the specified + // values + repeated int32 in = 3; + + // NotIn specifies that this field cannot be equal to one of the specified + // values + repeated int32 not_in = 4; +} + +// MessageRules describe the constraints applied to embedded message values. +// For message-type fields, validation is performed recursively. +message MessageRules { + // Skip specifies that the validation rules of this field should not be + // evaluated + optional bool skip = 1; + + // Required specifies that this field must be set + optional bool required = 2; +} + +// RepeatedRules describe the constraints applied to `repeated` values +message RepeatedRules { + // MinItems specifies that this field must have the specified number of + // items at a minimum + optional uint64 min_items = 1; + + // MaxItems specifies that this field must have the specified number of + // items at a maximum + optional uint64 max_items = 2; + + // Unique specifies that all elements in this field must be unique. This + // contraint is only applicable to scalar and enum types (messages are not + // supported). + optional bool unique = 3; + + // Items specifies the contraints to be applied to each item in the field. + // Repeated message fields will still execute validation against each item + // unless skip is specified here. + optional FieldRules items = 4; +} + +// MapRules describe the constraints applied to `map` values +message MapRules { + // MinPairs specifies that this field must have the specified number of + // KVs at a minimum + optional uint64 min_pairs = 1; + + // MaxPairs specifies that this field must have the specified number of + // KVs at a maximum + optional uint64 max_pairs = 2; + + // NoSparse specifies values in this field cannot be unset. This only + // applies to map's with message value types. + optional bool no_sparse = 3; + + // Keys specifies the constraints to be applied to each key in the field. + optional FieldRules keys = 4; + + // Values specifies the constraints to be applied to the value of each key + // in the field. Message values will still have their validations evaluated + // unless skip is specified here. + optional FieldRules values = 5; +} + +// AnyRules describe constraints applied exclusively to the +// `google.protobuf.Any` well-known type +message AnyRules { + // Required specifies that this field must be set + optional bool required = 1; + + // In specifies that this field's `type_url` must be equal to one of the + // specified values. + repeated string in = 2; + + // NotIn specifies that this field's `type_url` must not be equal to any of + // the specified values. + repeated string not_in = 3; +} + +// DurationRules describe the constraints applied exclusively to the +// `google.protobuf.Duration` well-known type +message DurationRules { + // Required specifies that this field must be set + optional bool required = 1; + + // Const specifies that this field must be exactly the specified value + optional google.protobuf.Duration const = 2; + + // Lt specifies that this field must be less than the specified value, + // exclusive + optional google.protobuf.Duration lt = 3; + + // Lt specifies that this field must be less than the specified value, + // inclusive + optional google.protobuf.Duration lte = 4; + + // Gt specifies that this field must be greater than the specified value, + // exclusive + optional google.protobuf.Duration gt = 5; + + // Gte specifies that this field must be greater than the specified value, + // inclusive + optional google.protobuf.Duration gte = 6; + + // In specifies that this field must be equal to one of the specified + // values + repeated google.protobuf.Duration in = 7; + + // NotIn specifies that this field cannot be equal to one of the specified + // values + repeated google.protobuf.Duration not_in = 8; +} + +// TimestampRules describe the constraints applied exclusively to the +// `google.protobuf.Timestamp` well-known type +message TimestampRules { + // Required specifies that this field must be set + optional bool required = 1; + + // Const specifies that this field must be exactly the specified value + optional google.protobuf.Timestamp const = 2; + + // Lt specifies that this field must be less than the specified value, + // exclusive + optional google.protobuf.Timestamp lt = 3; + + // Lte specifies that this field must be less than the specified value, + // inclusive + optional google.protobuf.Timestamp lte = 4; + + // Gt specifies that this field must be greater than the specified value, + // exclusive + optional google.protobuf.Timestamp gt = 5; + + // Gte specifies that this field must be greater than the specified value, + // inclusive + optional google.protobuf.Timestamp gte = 6; + + // LtNow specifies that this must be less than the current time. LtNow + // can only be used with the Within rule. + optional bool lt_now = 7; + + // GtNow specifies that this must be greater than the current time. GtNow + // can only be used with the Within rule. + optional bool gt_now = 8; + + // Within specifies that this field must be within this duration of the + // current time. This constraint can be used alone or with the LtNow and + // GtNow rules. + optional google.protobuf.Duration within = 9; +} diff --git a/vendor/google.golang.org/grpc/CONTRIBUTING.md b/vendor/google.golang.org/grpc/CONTRIBUTING.md index 8ec6c95747b3..0863eb26b602 100644 --- a/vendor/google.golang.org/grpc/CONTRIBUTING.md +++ b/vendor/google.golang.org/grpc/CONTRIBUTING.md @@ -27,6 +27,10 @@ How to get your contributions merged smoothly and quickly. - Keep your PR up to date with upstream/master (if there are merge conflicts, we can't really merge your change). - **All tests need to be passing** before your change can be merged. We recommend you **run tests locally** before creating your PR to catch breakages early on. + - `make all` to test everything, OR + - `make vet` to catch vet errors + - `make test` to run the tests + - `make testrace` to run tests in race mode - Exceptions to the rules can be made if there's a compelling reason for doing so. diff --git a/vendor/google.golang.org/grpc/LICENSE b/vendor/google.golang.org/grpc/LICENSE index f4988b450799..d64569567334 100644 --- a/vendor/google.golang.org/grpc/LICENSE +++ b/vendor/google.golang.org/grpc/LICENSE @@ -1,28 +1,202 @@ -Copyright 2014, Google Inc. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/vendor/google.golang.org/grpc/Makefile b/vendor/google.golang.org/grpc/Makefile index c44534376afd..41a754f97728 100644 --- a/vendor/google.golang.org/grpc/Makefile +++ b/vendor/google.golang.org/grpc/Makefile @@ -1,20 +1,14 @@ -all: test testrace - -deps: - go get -d -v google.golang.org/grpc/... - -updatedeps: - go get -d -v -u -f google.golang.org/grpc/... - -testdeps: - go get -d -v -t google.golang.org/grpc/... - -updatetestdeps: - go get -d -v -t -u -f google.golang.org/grpc/... +all: vet test testrace testappengine build: deps go build google.golang.org/grpc/... +clean: + go clean -i google.golang.org/grpc/... + +deps: + go get -d -v google.golang.org/grpc/... + proto: @ if ! which protoc > /dev/null; then \ echo "error: protoc not installed" >&2; \ @@ -23,23 +17,44 @@ proto: go generate google.golang.org/grpc/... test: testdeps - go test -cpu 1,4 -timeout 5m google.golang.org/grpc/... + go test -cpu 1,4 -timeout 7m google.golang.org/grpc/... + +testappengine: testappenginedeps + goapp test -cpu 1,4 -timeout 7m google.golang.org/grpc/... + +testappenginedeps: + goapp get -d -v -t -tags 'appengine appenginevm' google.golang.org/grpc/... + +testdeps: + go get -d -v -t google.golang.org/grpc/... testrace: testdeps go test -race -cpu 1,4 -timeout 7m google.golang.org/grpc/... -clean: - go clean -i google.golang.org/grpc/... +updatedeps: + go get -d -v -u -f google.golang.org/grpc/... + +updatetestdeps: + go get -d -v -t -u -f google.golang.org/grpc/... + +vet: vetdeps + ./vet.sh + +vetdeps: + ./vet.sh -install .PHONY: \ all \ - deps \ - updatedeps \ - testdeps \ - updatetestdeps \ build \ + clean \ + deps \ proto \ test \ + testappengine \ + testappenginedeps \ + testdeps \ testrace \ - clean \ - coverage + updatedeps \ + updatetestdeps \ + vet \ + vetdeps diff --git a/vendor/google.golang.org/grpc/PATENTS b/vendor/google.golang.org/grpc/PATENTS deleted file mode 100644 index 69b47959faba..000000000000 --- a/vendor/google.golang.org/grpc/PATENTS +++ /dev/null @@ -1,22 +0,0 @@ -Additional IP Rights Grant (Patents) - -"This implementation" means the copyrightable works distributed by -Google as part of the gRPC project. - -Google hereby grants to You a perpetual, worldwide, non-exclusive, -no-charge, royalty-free, irrevocable (except as stated in this section) -patent license to make, have made, use, offer to sell, sell, import, -transfer and otherwise run, modify and propagate the contents of this -implementation of gRPC, where such license applies only to those patent -claims, both currently owned or controlled by Google and acquired in -the future, licensable by Google that are necessarily infringed by this -implementation of gRPC. This grant does not include claims that would be -infringed only as a consequence of further modification of this -implementation. If you or your agent or exclusive licensee institute or -order or agree to the institution of patent litigation against any -entity (including a cross-claim or counterclaim in a lawsuit) alleging -that this implementation of gRPC or any code incorporated within this -implementation of gRPC constitutes direct or contributory patent -infringement, or inducement of patent infringement, then any patent -rights granted to you under this License for this implementation of gRPC -shall terminate as of the date such litigation is filed. diff --git a/vendor/google.golang.org/grpc/README.md b/vendor/google.golang.org/grpc/README.md index 118327bb17a2..789adfd65362 100644 --- a/vendor/google.golang.org/grpc/README.md +++ b/vendor/google.golang.org/grpc/README.md @@ -16,8 +16,7 @@ $ go get -u google.golang.org/grpc Prerequisites ------------- -This requires Go 1.6 or later. Go 1.7 will be required as of the next gRPC-Go -release (1.8). +This requires Go 1.6 or later. Go 1.7 will be required soon. Constraints ----------- diff --git a/vendor/google.golang.org/grpc/backoff.go b/vendor/google.golang.org/grpc/backoff.go index c40facce5103..fa31565fd283 100644 --- a/vendor/google.golang.org/grpc/backoff.go +++ b/vendor/google.golang.org/grpc/backoff.go @@ -16,81 +16,23 @@ * */ +// See internal/backoff package for the backoff implementation. This file is +// kept for the exported types and API backward compatility. + package grpc import ( - "math/rand" "time" ) // DefaultBackoffConfig uses values specified for backoff in // https://github.com/grpc/grpc/blob/master/doc/connection-backoff.md. var DefaultBackoffConfig = BackoffConfig{ - MaxDelay: 120 * time.Second, - baseDelay: 1.0 * time.Second, - factor: 1.6, - jitter: 0.2, -} - -// backoffStrategy defines the methodology for backing off after a grpc -// connection failure. -// -// This is unexported until the gRPC project decides whether or not to allow -// alternative backoff strategies. Once a decision is made, this type and its -// method may be exported. -type backoffStrategy interface { - // backoff returns the amount of time to wait before the next retry given - // the number of consecutive failures. - backoff(retries int) time.Duration + MaxDelay: 120 * time.Second, } // BackoffConfig defines the parameters for the default gRPC backoff strategy. type BackoffConfig struct { // MaxDelay is the upper bound of backoff delay. MaxDelay time.Duration - - // TODO(stevvooe): The following fields are not exported, as allowing - // changes would violate the current gRPC specification for backoff. If - // gRPC decides to allow more interesting backoff strategies, these fields - // may be opened up in the future. - - // baseDelay is the amount of time to wait before retrying after the first - // failure. - baseDelay time.Duration - - // factor is applied to the backoff after each retry. - factor float64 - - // jitter provides a range to randomize backoff delays. - jitter float64 -} - -func setDefaults(bc *BackoffConfig) { - md := bc.MaxDelay - *bc = DefaultBackoffConfig - - if md > 0 { - bc.MaxDelay = md - } -} - -func (bc BackoffConfig) backoff(retries int) time.Duration { - if retries == 0 { - return bc.baseDelay - } - backoff, max := float64(bc.baseDelay), float64(bc.MaxDelay) - for backoff < max && retries > 0 { - backoff *= bc.factor - retries-- - } - if backoff > max { - backoff = max - } - // Randomize backoff delays so that if a cluster of requests start at - // the same time, they won't operate in lockstep. - backoff *= 1 + bc.jitter*(rand.Float64()*2-1) - if backoff < 0 { - return 0 - } - return time.Duration(backoff) } diff --git a/vendor/google.golang.org/grpc/balancer.go b/vendor/google.golang.org/grpc/balancer.go index 300da6c5e871..5aeb646d1740 100644 --- a/vendor/google.golang.org/grpc/balancer.go +++ b/vendor/google.golang.org/grpc/balancer.go @@ -19,7 +19,6 @@ package grpc import ( - "fmt" "net" "sync" @@ -32,7 +31,8 @@ import ( ) // Address represents a server the client connects to. -// This is the EXPERIMENTAL API and may be changed or extended in the future. +// +// Deprecated: please use package balancer. type Address struct { // Addr is the server address on which a connection will be established. Addr string @@ -42,6 +42,8 @@ type Address struct { } // BalancerConfig specifies the configurations for Balancer. +// +// Deprecated: please use package balancer. type BalancerConfig struct { // DialCreds is the transport credential the Balancer implementation can // use to dial to a remote load balancer server. The Balancer implementations @@ -54,7 +56,8 @@ type BalancerConfig struct { } // BalancerGetOptions configures a Get call. -// This is the EXPERIMENTAL API and may be changed or extended in the future. +// +// Deprecated: please use package balancer. type BalancerGetOptions struct { // BlockingWait specifies whether Get should block when there is no // connected address. @@ -62,7 +65,8 @@ type BalancerGetOptions struct { } // Balancer chooses network addresses for RPCs. -// This is the EXPERIMENTAL API and may be changed or extended in the future. +// +// Deprecated: please use package balancer. type Balancer interface { // Start does the initialization work to bootstrap a Balancer. For example, // this function may start the name resolution and watch the updates. It will @@ -113,28 +117,10 @@ type Balancer interface { Close() error } -// downErr implements net.Error. It is constructed by gRPC internals and passed to the down -// call of Balancer. -type downErr struct { - timeout bool - temporary bool - desc string -} - -func (e downErr) Error() string { return e.desc } -func (e downErr) Timeout() bool { return e.timeout } -func (e downErr) Temporary() bool { return e.temporary } - -func downErrorf(timeout, temporary bool, format string, a ...interface{}) downErr { - return downErr{ - timeout: timeout, - temporary: temporary, - desc: fmt.Sprintf(format, a...), - } -} - // RoundRobin returns a Balancer that selects addresses round-robin. It uses r to watch // the name resolution updates and updates the addresses available correspondingly. +// +// Deprecated: please use package balancer/roundrobin. func RoundRobin(r naming.Resolver) Balancer { return &roundRobin{r: r} } @@ -403,7 +389,3 @@ func (rr *roundRobin) Close() error { type pickFirst struct { *roundRobin } - -func pickFirstBalancerV1(r naming.Resolver) Balancer { - return &pickFirst{&roundRobin{r: r}} -} diff --git a/vendor/google.golang.org/grpc/balancer/balancer.go b/vendor/google.golang.org/grpc/balancer/balancer.go index 219a2940c65e..069feb1e723a 100644 --- a/vendor/google.golang.org/grpc/balancer/balancer.go +++ b/vendor/google.golang.org/grpc/balancer/balancer.go @@ -36,9 +36,12 @@ var ( m = make(map[string]Builder) ) -// Register registers the balancer builder to the balancer map. -// b.Name (lowercased) will be used as the name registered with -// this builder. +// Register registers the balancer builder to the balancer map. b.Name +// (lowercased) will be used as the name registered with this builder. +// +// NOTE: this function must only be called during initialization time (i.e. in +// an init() function), and is not thread-safe. If multiple Balancers are +// registered with the same name, the one registered last will take effect. func Register(b Builder) { m[strings.ToLower(b.Name())] = b } @@ -126,6 +129,8 @@ type BuildOptions struct { // to a remote load balancer server. The Balancer implementations // can ignore this if it doesn't need to talk to remote balancer. Dialer func(context.Context, string) (net.Conn, error) + // ChannelzParentID is the entity parent's channelz unique identification number. + ChannelzParentID int64 } // Builder creates a balancer. @@ -138,7 +143,11 @@ type Builder interface { } // PickOptions contains addition information for the Pick operation. -type PickOptions struct{} +type PickOptions struct { + // FullMethodName is the method name that NewClientStream() is called + // with. The canonical format is /service/Method. + FullMethodName string +} // DoneInfo contains additional information for done. type DoneInfo struct { @@ -160,7 +169,7 @@ var ( ) // Picker is used by gRPC to pick a SubConn to send an RPC. -// Balancer is expected to generate a new picker from its snapshot everytime its +// Balancer is expected to generate a new picker from its snapshot every time its // internal state has changed. // // The pickers used by gRPC can be updated by ClientConn.UpdateBalancerState(). @@ -221,3 +230,45 @@ type Balancer interface { // ClientConn.RemoveSubConn for its existing SubConns. Close() } + +// ConnectivityStateEvaluator takes the connectivity states of multiple SubConns +// and returns one aggregated connectivity state. +// +// It's not thread safe. +type ConnectivityStateEvaluator struct { + numReady uint64 // Number of addrConns in ready state. + numConnecting uint64 // Number of addrConns in connecting state. + numTransientFailure uint64 // Number of addrConns in transientFailure. +} + +// RecordTransition records state change happening in subConn and based on that +// it evaluates what aggregated state should be. +// +// - If at least one SubConn in Ready, the aggregated state is Ready; +// - Else if at least one SubConn in Connecting, the aggregated state is Connecting; +// - Else the aggregated state is TransientFailure. +// +// Idle and Shutdown are not considered. +func (cse *ConnectivityStateEvaluator) RecordTransition(oldState, newState connectivity.State) connectivity.State { + // Update counters. + for idx, state := range []connectivity.State{oldState, newState} { + updateVal := 2*uint64(idx) - 1 // -1 for oldState and +1 for new. + switch state { + case connectivity.Ready: + cse.numReady += updateVal + case connectivity.Connecting: + cse.numConnecting += updateVal + case connectivity.TransientFailure: + cse.numTransientFailure += updateVal + } + } + + // Evaluate. + if cse.numReady > 0 { + return connectivity.Ready + } + if cse.numConnecting > 0 { + return connectivity.Connecting + } + return connectivity.TransientFailure +} diff --git a/vendor/google.golang.org/grpc/balancer/base/balancer.go b/vendor/google.golang.org/grpc/balancer/base/balancer.go index 1e962b72403e..23d13511bb2f 100644 --- a/vendor/google.golang.org/grpc/balancer/base/balancer.go +++ b/vendor/google.golang.org/grpc/balancer/base/balancer.go @@ -146,7 +146,6 @@ func (b *baseBalancer) HandleSubConnStateChange(sc balancer.SubConn, s connectiv } b.cc.UpdateBalancerState(b.state, b.picker) - return } // Close is a nop because base balancer doesn't have internal state to clean up, diff --git a/vendor/google.golang.org/grpc/balancer_conn_wrappers.go b/vendor/google.golang.org/grpc/balancer_conn_wrappers.go index db6f0ae3f092..c23f81706fba 100644 --- a/vendor/google.golang.org/grpc/balancer_conn_wrappers.go +++ b/vendor/google.golang.org/grpc/balancer_conn_wrappers.go @@ -115,7 +115,7 @@ func newCCBalancerWrapper(cc *ClientConn, b balancer.Builder, bopts balancer.Bui return ccb } -// watcher balancer functions sequencially, so the balancer can be implemeneted +// watcher balancer functions sequentially, so the balancer can be implemented // lock-free. func (ccb *ccBalancerWrapper) watcher() { for { diff --git a/vendor/google.golang.org/grpc/balancer_v1_wrapper.go b/vendor/google.golang.org/grpc/balancer_v1_wrapper.go index faabf87d0018..e0ce32cfb6d4 100644 --- a/vendor/google.golang.org/grpc/balancer_v1_wrapper.go +++ b/vendor/google.golang.org/grpc/balancer_v1_wrapper.go @@ -55,7 +55,7 @@ func (bwb *balancerWrapperBuilder) Build(cc balancer.ClientConn, opts balancer.B startCh: make(chan struct{}), conns: make(map[resolver.Address]balancer.SubConn), connSt: make(map[balancer.SubConn]*scState), - csEvltr: &connectivityStateEvaluator{}, + csEvltr: &balancer.ConnectivityStateEvaluator{}, state: connectivity.Idle, } cc.UpdateBalancerState(connectivity.Idle, bw) @@ -80,10 +80,6 @@ type balancerWrapper struct { cc balancer.ClientConn targetAddr string // Target without the scheme. - // To aggregate the connectivity state. - csEvltr *connectivityStateEvaluator - state connectivity.State - mu sync.Mutex conns map[resolver.Address]balancer.SubConn connSt map[balancer.SubConn]*scState @@ -92,6 +88,10 @@ type balancerWrapper struct { // - NewSubConn is created, cc wants to notify balancer of state changes; // - Build hasn't return, cc doesn't have access to balancer. startCh chan struct{} + + // To aggregate the connectivity state. + csEvltr *balancer.ConnectivityStateEvaluator + state connectivity.State } // lbWatcher watches the Notify channel of the balancer and manages @@ -248,7 +248,7 @@ func (bw *balancerWrapper) HandleSubConnStateChange(sc balancer.SubConn, s conne scSt.down(errConnClosing) } } - sa := bw.csEvltr.recordTransition(oldS, s) + sa := bw.csEvltr.RecordTransition(oldS, s) if bw.state != sa { bw.state = sa } @@ -257,7 +257,6 @@ func (bw *balancerWrapper) HandleSubConnStateChange(sc balancer.SubConn, s conne // Remove state for this sc. delete(bw.connSt, sc) } - return } func (bw *balancerWrapper) HandleResolvedAddrs([]resolver.Address, error) { @@ -270,7 +269,6 @@ func (bw *balancerWrapper) HandleResolvedAddrs([]resolver.Address, error) { } // There should be a resolver inside the balancer. // All updates here, if any, are ignored. - return } func (bw *balancerWrapper) Close() { @@ -282,7 +280,6 @@ func (bw *balancerWrapper) Close() { close(bw.startCh) } bw.balancer.Close() - return } // The picker is the balancerWrapper itself. @@ -329,47 +326,3 @@ func (bw *balancerWrapper) Pick(ctx context.Context, opts balancer.PickOptions) return sc, done, nil } - -// connectivityStateEvaluator gets updated by addrConns when their -// states transition, based on which it evaluates the state of -// ClientConn. -type connectivityStateEvaluator struct { - mu sync.Mutex - numReady uint64 // Number of addrConns in ready state. - numConnecting uint64 // Number of addrConns in connecting state. - numTransientFailure uint64 // Number of addrConns in transientFailure. -} - -// recordTransition records state change happening in every subConn and based on -// that it evaluates what aggregated state should be. -// It can only transition between Ready, Connecting and TransientFailure. Other states, -// Idle and Shutdown are transitioned into by ClientConn; in the beginning of the connection -// before any subConn is created ClientConn is in idle state. In the end when ClientConn -// closes it is in Shutdown state. -// TODO Note that in later releases, a ClientConn with no activity will be put into an Idle state. -func (cse *connectivityStateEvaluator) recordTransition(oldState, newState connectivity.State) connectivity.State { - cse.mu.Lock() - defer cse.mu.Unlock() - - // Update counters. - for idx, state := range []connectivity.State{oldState, newState} { - updateVal := 2*uint64(idx) - 1 // -1 for oldState and +1 for new. - switch state { - case connectivity.Ready: - cse.numReady += updateVal - case connectivity.Connecting: - cse.numConnecting += updateVal - case connectivity.TransientFailure: - cse.numTransientFailure += updateVal - } - } - - // Evaluate. - if cse.numReady > 0 { - return connectivity.Ready - } - if cse.numConnecting > 0 { - return connectivity.Connecting - } - return connectivity.TransientFailure -} diff --git a/vendor/google.golang.org/grpc/call.go b/vendor/google.golang.org/grpc/call.go index 154e2d6599fd..180d79d06565 100644 --- a/vendor/google.golang.org/grpc/call.go +++ b/vendor/google.golang.org/grpc/call.go @@ -19,132 +19,39 @@ package grpc import ( - "io" - "time" - "golang.org/x/net/context" - "golang.org/x/net/trace" - "google.golang.org/grpc/balancer" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/encoding" - "google.golang.org/grpc/stats" - "google.golang.org/grpc/status" - "google.golang.org/grpc/transport" ) -// recvResponse receives and parses an RPC response. -// On error, it returns the error and indicates whether the call should be retried. -// -// TODO(zhaoq): Check whether the received message sequence is valid. -// TODO ctx is used for stats collection and processing. It is the context passed from the application. -func recvResponse(ctx context.Context, dopts dialOptions, t transport.ClientTransport, c *callInfo, stream *transport.Stream, reply interface{}) (err error) { - // Try to acquire header metadata from the server if there is any. - defer func() { - if err != nil { - if _, ok := err.(transport.ConnectionError); !ok { - t.CloseStream(stream, err) - } - } - }() - p := &parser{r: stream} - var inPayload *stats.InPayload - if dopts.copts.StatsHandler != nil { - inPayload = &stats.InPayload{ - Client: true, - } - } - for { - if c.maxReceiveMessageSize == nil { - return status.Errorf(codes.Internal, "callInfo maxReceiveMessageSize field uninitialized(nil)") - } - - // Set dc if it exists and matches the message compression type used, - // otherwise set comp if a registered compressor exists for it. - var comp encoding.Compressor - var dc Decompressor - if rc := stream.RecvCompress(); dopts.dc != nil && dopts.dc.Type() == rc { - dc = dopts.dc - } else if rc != "" && rc != encoding.Identity { - comp = encoding.GetCompressor(rc) - } - if err = recv(p, dopts.codec, stream, dc, reply, *c.maxReceiveMessageSize, inPayload, comp); err != nil { - if err == io.EOF { - break - } - return - } - } - if inPayload != nil && err == io.EOF && stream.Status().Code() == codes.OK { - // TODO in the current implementation, inTrailer may be handled before inPayload in some cases. - // Fix the order if necessary. - dopts.copts.StatsHandler.HandleRPC(ctx, inPayload) - } - return nil -} - -// sendRequest writes out various information of an RPC such as Context and Message. -func sendRequest(ctx context.Context, dopts dialOptions, compressor Compressor, c *callInfo, callHdr *transport.CallHdr, stream *transport.Stream, t transport.ClientTransport, args interface{}, opts *transport.Options) (err error) { - defer func() { - if err != nil { - // If err is connection error, t will be closed, no need to close stream here. - if _, ok := err.(transport.ConnectionError); !ok { - t.CloseStream(stream, err) - } - } - }() - var ( - outPayload *stats.OutPayload - ) - if dopts.copts.StatsHandler != nil { - outPayload = &stats.OutPayload{ - Client: true, - } - } - // Set comp and clear compressor if a registered compressor matches the type - // specified via UseCompressor. (And error if a matching compressor is not - // registered.) - var comp encoding.Compressor - if ct := c.compressorType; ct != "" && ct != encoding.Identity { - compressor = nil // Disable the legacy compressor. - comp = encoding.GetCompressor(ct) - if comp == nil { - return status.Errorf(codes.Internal, "grpc: Compressor is not installed for grpc-encoding %q", ct) - } - } - hdr, data, err := encode(dopts.codec, args, compressor, outPayload, comp) - if err != nil { - return err - } - if c.maxSendMessageSize == nil { - return status.Errorf(codes.Internal, "callInfo maxSendMessageSize field uninitialized(nil)") - } - if len(data) > *c.maxSendMessageSize { - return status.Errorf(codes.ResourceExhausted, "grpc: trying to send message larger than max (%d vs. %d)", len(data), *c.maxSendMessageSize) - } - err = t.Write(stream, hdr, data, opts) - if err == nil && outPayload != nil { - outPayload.SentTime = time.Now() - dopts.copts.StatsHandler.HandleRPC(ctx, outPayload) - } - // t.NewStream(...) could lead to an early rejection of the RPC (e.g., the service/method - // does not exist.) so that t.Write could get io.EOF from wait(...). Leave the following - // recvResponse to get the final status. - if err != nil && err != io.EOF { - return err - } - // Sent successfully. - return nil -} - // Invoke sends the RPC request on the wire and returns after response is // received. This is typically called by generated code. +// +// All errors returned by Invoke are compatible with the status package. func (cc *ClientConn) Invoke(ctx context.Context, method string, args, reply interface{}, opts ...CallOption) error { + // allow interceptor to see all applicable call options, which means those + // configured as defaults from dial option as well as per-call options + opts = combine(cc.dopts.callOptions, opts) + if cc.dopts.unaryInt != nil { return cc.dopts.unaryInt(ctx, method, args, reply, cc, invoke, opts...) } return invoke(ctx, method, args, reply, cc, opts...) } +func combine(o1 []CallOption, o2 []CallOption) []CallOption { + // we don't use append because o1 could have extra capacity whose + // elements would be overwritten, which could cause inadvertent + // sharing (and race connditions) between concurrent calls + if len(o1) == 0 { + return o2 + } else if len(o2) == 0 { + return o1 + } + ret := make([]CallOption, len(o1)+len(o2)) + copy(ret, o1) + copy(ret[len(o1):], o2) + return ret +} + // Invoke sends the RPC request on the wire and returns after response is // received. This is typically called by generated code. // @@ -153,186 +60,15 @@ func Invoke(ctx context.Context, method string, args, reply interface{}, cc *Cli return cc.Invoke(ctx, method, args, reply, opts...) } -func invoke(ctx context.Context, method string, args, reply interface{}, cc *ClientConn, opts ...CallOption) (e error) { - c := defaultCallInfo() - mc := cc.GetMethodConfig(method) - if mc.WaitForReady != nil { - c.failFast = !*mc.WaitForReady - } - - if mc.Timeout != nil && *mc.Timeout >= 0 { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *mc.Timeout) - defer cancel() - } - - opts = append(cc.dopts.callOptions, opts...) - for _, o := range opts { - if err := o.before(c); err != nil { - return toRPCErr(err) - } - } - defer func() { - for _, o := range opts { - o.after(c) - } - }() - - c.maxSendMessageSize = getMaxSize(mc.MaxReqSize, c.maxSendMessageSize, defaultClientMaxSendMessageSize) - c.maxReceiveMessageSize = getMaxSize(mc.MaxRespSize, c.maxReceiveMessageSize, defaultClientMaxReceiveMessageSize) +var unaryStreamDesc = &StreamDesc{ServerStreams: false, ClientStreams: false} - if EnableTracing { - c.traceInfo.tr = trace.New("grpc.Sent."+methodFamily(method), method) - defer c.traceInfo.tr.Finish() - c.traceInfo.firstLine.client = true - if deadline, ok := ctx.Deadline(); ok { - c.traceInfo.firstLine.deadline = deadline.Sub(time.Now()) - } - c.traceInfo.tr.LazyLog(&c.traceInfo.firstLine, false) - // TODO(dsymonds): Arrange for c.traceInfo.firstLine.remoteAddr to be set. - defer func() { - if e != nil { - c.traceInfo.tr.LazyLog(&fmtStringer{"%v", []interface{}{e}}, true) - c.traceInfo.tr.SetError() - } - }() - } - ctx = newContextWithRPCInfo(ctx, c.failFast) - sh := cc.dopts.copts.StatsHandler - if sh != nil { - ctx = sh.TagRPC(ctx, &stats.RPCTagInfo{FullMethodName: method, FailFast: c.failFast}) - begin := &stats.Begin{ - Client: true, - BeginTime: time.Now(), - FailFast: c.failFast, - } - sh.HandleRPC(ctx, begin) - defer func() { - end := &stats.End{ - Client: true, - EndTime: time.Now(), - Error: e, - } - sh.HandleRPC(ctx, end) - }() - } - topts := &transport.Options{ - Last: true, - Delay: false, - } - callHdr := &transport.CallHdr{ - Host: cc.authority, - Method: method, - } - if c.creds != nil { - callHdr.Creds = c.creds - } - if c.compressorType != "" { - callHdr.SendCompress = c.compressorType - } else if cc.dopts.cp != nil { - callHdr.SendCompress = cc.dopts.cp.Type() +func invoke(ctx context.Context, method string, req, reply interface{}, cc *ClientConn, opts ...CallOption) error { + cs, err := newClientStream(ctx, unaryStreamDesc, cc, method, opts...) + if err != nil { + return err } - firstAttempt := true - - for { - // Check to make sure the context has expired. This will prevent us from - // looping forever if an error occurs for wait-for-ready RPCs where no data - // is sent on the wire. - select { - case <-ctx.Done(): - return toRPCErr(ctx.Err()) - default: - } - - // Record the done handler from Balancer.Get(...). It is called once the - // RPC has completed or failed. - t, done, err := cc.getTransport(ctx, c.failFast) - if err != nil { - return err - } - stream, err := t.NewStream(ctx, callHdr) - if err != nil { - if done != nil { - done(balancer.DoneInfo{Err: err}) - } - // In the event of any error from NewStream, we never attempted to write - // anything to the wire, so we can retry indefinitely for non-fail-fast - // RPCs. - if !c.failFast { - continue - } - return toRPCErr(err) - } - c.stream = stream - if c.traceInfo.tr != nil { - c.traceInfo.tr.LazyLog(&payload{sent: true, msg: args}, true) - } - err = sendRequest(ctx, cc.dopts, cc.dopts.cp, c, callHdr, stream, t, args, topts) - if err != nil { - if done != nil { - done(balancer.DoneInfo{ - Err: err, - BytesSent: true, - BytesReceived: stream.BytesReceived(), - }) - } - // Retry a non-failfast RPC when - // i) the server started to drain before this RPC was initiated. - // ii) the server refused the stream. - if !c.failFast && stream.Unprocessed() { - // In this case, the server did not receive the data, but we still - // created wire traffic, so we should not retry indefinitely. - if firstAttempt { - // TODO: Add a field to header for grpc-transparent-retry-attempts - firstAttempt = false - continue - } - // Otherwise, give up and return an error anyway. - } - return toRPCErr(err) - } - err = recvResponse(ctx, cc.dopts, t, c, stream, reply) - if err != nil { - if done != nil { - done(balancer.DoneInfo{ - Err: err, - BytesSent: true, - BytesReceived: stream.BytesReceived(), - }) - } - if !c.failFast && stream.Unprocessed() { - // In these cases, the server did not receive the data, but we still - // created wire traffic, so we should not retry indefinitely. - if firstAttempt { - // TODO: Add a field to header for grpc-transparent-retry-attempts - firstAttempt = false - continue - } - // Otherwise, give up and return an error anyway. - } - return toRPCErr(err) - } - if c.traceInfo.tr != nil { - c.traceInfo.tr.LazyLog(&payload{sent: false, msg: reply}, true) - } - t.CloseStream(stream, nil) - err = stream.Status().Err() - if done != nil { - done(balancer.DoneInfo{ - Err: err, - BytesSent: true, - BytesReceived: stream.BytesReceived(), - }) - } - if !c.failFast && stream.Unprocessed() { - // In these cases, the server did not receive the data, but we still - // created wire traffic, so we should not retry indefinitely. - if firstAttempt { - // TODO: Add a field to header for grpc-transparent-retry-attempts - firstAttempt = false - continue - } - } + if err := cs.SendMsg(req); err != nil { return err } + return cs.RecvMsg(reply) } diff --git a/vendor/google.golang.org/grpc/clientconn.go b/vendor/google.golang.org/grpc/clientconn.go index bfbef362138f..13d21c8af404 100644 --- a/vendor/google.golang.org/grpc/clientconn.go +++ b/vendor/google.golang.org/grpc/clientconn.go @@ -26,41 +26,52 @@ import ( "reflect" "strings" "sync" + "sync/atomic" "time" "golang.org/x/net/context" "golang.org/x/net/trace" "google.golang.org/grpc/balancer" _ "google.golang.org/grpc/balancer/roundrobin" // To register roundrobin. + "google.golang.org/grpc/codes" "google.golang.org/grpc/connectivity" "google.golang.org/grpc/credentials" "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/internal/backoff" + "google.golang.org/grpc/internal/channelz" + "google.golang.org/grpc/internal/transport" "google.golang.org/grpc/keepalive" "google.golang.org/grpc/resolver" _ "google.golang.org/grpc/resolver/dns" // To register dns resolver. _ "google.golang.org/grpc/resolver/passthrough" // To register passthrough resolver. - "google.golang.org/grpc/stats" - "google.golang.org/grpc/transport" + "google.golang.org/grpc/status" +) + +const ( + // minimum time to give a connection to complete + minConnectTimeout = 20 * time.Second + // must match grpclbName in grpclb/grpclb.go + grpclbName = "grpclb" ) var ( // ErrClientConnClosing indicates that the operation is illegal because // the ClientConn is closing. - ErrClientConnClosing = errors.New("grpc: the client connection is closing") - // ErrClientConnTimeout indicates that the ClientConn cannot establish the - // underlying connections within the specified timeout. - // DEPRECATED: Please use context.DeadlineExceeded instead. - ErrClientConnTimeout = errors.New("grpc: timed out when dialing") + // + // Deprecated: this error should not be relied upon by users; use the status + // code of Canceled instead. + ErrClientConnClosing = status.Error(codes.Canceled, "grpc: the client connection is closing") // errConnDrain indicates that the connection starts to be drained and does not accept any new RPCs. errConnDrain = errors.New("grpc: the connection is drained") // errConnClosing indicates that the connection is closing. errConnClosing = errors.New("grpc: the connection is closing") - // errConnUnavailable indicates that the connection is unavailable. - errConnUnavailable = errors.New("grpc: the connection is unavailable") // errBalancerClosed indicates that the balancer is closed. errBalancerClosed = errors.New("grpc: balancer is closed") - // minimum time to give a connection to complete - minConnectTimeout = 20 * time.Second + // We use an accessor so that minConnectTimeout can be + // atomically read and updated while testing. + getMinConnectTimeout = func() time.Duration { + return minConnectTimeout + } ) // The following errors are returned from Dial and DialContext @@ -76,349 +87,72 @@ var ( // errCredentialsConflict indicates that grpc.WithTransportCredentials() // and grpc.WithInsecure() are both called for a connection. errCredentialsConflict = errors.New("grpc: transport credentials are set for an insecure connection (grpc.WithTransportCredentials() and grpc.WithInsecure() are both called)") - // errNetworkIO indicates that the connection is down due to some network I/O error. - errNetworkIO = errors.New("grpc: failed with network I/O error") ) -// dialOptions configure a Dial call. dialOptions are set by the DialOption -// values passed to Dial. -type dialOptions struct { - unaryInt UnaryClientInterceptor - streamInt StreamClientInterceptor - codec Codec - cp Compressor - dc Decompressor - bs backoffStrategy - block bool - insecure bool - timeout time.Duration - scChan <-chan ServiceConfig - copts transport.ConnectOptions - callOptions []CallOption - // This is used by v1 balancer dial option WithBalancer to support v1 - // balancer, and also by WithBalancerName dial option. - balancerBuilder balancer.Builder - // This is to support grpclb. - resolverBuilder resolver.Builder - // Custom user options for resolver.Build. - resolverBuildUserOptions interface{} - waitForHandshake bool -} - const ( defaultClientMaxReceiveMessageSize = 1024 * 1024 * 4 defaultClientMaxSendMessageSize = math.MaxInt32 + // http2IOBufSize specifies the buffer size for sending frames. + defaultWriteBufSize = 32 * 1024 + defaultReadBufSize = 32 * 1024 ) -// DialOption configures how we set up the connection. -type DialOption func(*dialOptions) - -// WithWaitForHandshake blocks until the initial settings frame is received from the -// server before assigning RPCs to the connection. -// Experimental API. -func WithWaitForHandshake() DialOption { - return func(o *dialOptions) { - o.waitForHandshake = true - } -} - -// WithWriteBufferSize lets you set the size of write buffer, this determines how much data can be batched -// before doing a write on the wire. -func WithWriteBufferSize(s int) DialOption { - return func(o *dialOptions) { - o.copts.WriteBufferSize = s - } -} - -// WithReadBufferSize lets you set the size of read buffer, this determines how much data can be read at most -// for each read syscall. -func WithReadBufferSize(s int) DialOption { - return func(o *dialOptions) { - o.copts.ReadBufferSize = s - } -} - -// WithInitialWindowSize returns a DialOption which sets the value for initial window size on a stream. -// The lower bound for window size is 64K and any value smaller than that will be ignored. -func WithInitialWindowSize(s int32) DialOption { - return func(o *dialOptions) { - o.copts.InitialWindowSize = s - } -} - -// WithInitialConnWindowSize returns a DialOption which sets the value for initial window size on a connection. -// The lower bound for window size is 64K and any value smaller than that will be ignored. -func WithInitialConnWindowSize(s int32) DialOption { - return func(o *dialOptions) { - o.copts.InitialConnWindowSize = s - } -} - -// WithMaxMsgSize returns a DialOption which sets the maximum message size the client can receive. Deprecated: use WithDefaultCallOptions(MaxCallRecvMsgSize(s)) instead. -func WithMaxMsgSize(s int) DialOption { - return WithDefaultCallOptions(MaxCallRecvMsgSize(s)) -} - -// WithDefaultCallOptions returns a DialOption which sets the default CallOptions for calls over the connection. -func WithDefaultCallOptions(cos ...CallOption) DialOption { - return func(o *dialOptions) { - o.callOptions = append(o.callOptions, cos...) - } -} - -// WithCodec returns a DialOption which sets a codec for message marshaling and unmarshaling. -func WithCodec(c Codec) DialOption { - return func(o *dialOptions) { - o.codec = c - } -} - -// WithCompressor returns a DialOption which sets a Compressor to use for -// message compression. It has lower priority than the compressor set by -// the UseCompressor CallOption. -// -// Deprecated: use UseCompressor instead. -func WithCompressor(cp Compressor) DialOption { - return func(o *dialOptions) { - o.cp = cp - } -} - -// WithDecompressor returns a DialOption which sets a Decompressor to use for -// incoming message decompression. If incoming response messages are encoded -// using the decompressor's Type(), it will be used. Otherwise, the message -// encoding will be used to look up the compressor registered via -// encoding.RegisterCompressor, which will then be used to decompress the -// message. If no compressor is registered for the encoding, an Unimplemented -// status error will be returned. -// -// Deprecated: use encoding.RegisterCompressor instead. -func WithDecompressor(dc Decompressor) DialOption { - return func(o *dialOptions) { - o.dc = dc - } -} - -// WithBalancer returns a DialOption which sets a load balancer with the v1 API. -// Name resolver will be ignored if this DialOption is specified. -// -// Deprecated: use the new balancer APIs in balancer package and WithBalancerName. -func WithBalancer(b Balancer) DialOption { - return func(o *dialOptions) { - o.balancerBuilder = &balancerWrapperBuilder{ - b: b, - } - } -} - -// WithBalancerName sets the balancer that the ClientConn will be initialized -// with. Balancer registered with balancerName will be used. This function -// panics if no balancer was registered by balancerName. -// -// The balancer cannot be overridden by balancer option specified by service -// config. -// -// This is an EXPERIMENTAL API. -func WithBalancerName(balancerName string) DialOption { - builder := balancer.Get(balancerName) - if builder == nil { - panic(fmt.Sprintf("grpc.WithBalancerName: no balancer is registered for name %v", balancerName)) - } - return func(o *dialOptions) { - o.balancerBuilder = builder - } -} - -// withResolverBuilder is only for grpclb. -func withResolverBuilder(b resolver.Builder) DialOption { - return func(o *dialOptions) { - o.resolverBuilder = b - } -} - -// WithResolverUserOptions returns a DialOption which sets the UserOptions -// field of resolver's BuildOption. -func WithResolverUserOptions(userOpt interface{}) DialOption { - return func(o *dialOptions) { - o.resolverBuildUserOptions = userOpt - } -} - -// WithServiceConfig returns a DialOption which has a channel to read the service configuration. -// DEPRECATED: service config should be received through name resolver, as specified here. -// https://github.com/grpc/grpc/blob/master/doc/service_config.md -func WithServiceConfig(c <-chan ServiceConfig) DialOption { - return func(o *dialOptions) { - o.scChan = c - } -} - -// WithBackoffMaxDelay configures the dialer to use the provided maximum delay -// when backing off after failed connection attempts. -func WithBackoffMaxDelay(md time.Duration) DialOption { - return WithBackoffConfig(BackoffConfig{MaxDelay: md}) -} - -// WithBackoffConfig configures the dialer to use the provided backoff -// parameters after connection failures. -// -// Use WithBackoffMaxDelay until more parameters on BackoffConfig are opened up -// for use. -func WithBackoffConfig(b BackoffConfig) DialOption { - // Set defaults to ensure that provided BackoffConfig is valid and - // unexported fields get default values. - setDefaults(&b) - return withBackoff(b) -} - -// withBackoff sets the backoff strategy used for connectRetryNum after a -// failed connection attempt. -// -// This can be exported if arbitrary backoff strategies are allowed by gRPC. -func withBackoff(bs backoffStrategy) DialOption { - return func(o *dialOptions) { - o.bs = bs - } -} - -// WithBlock returns a DialOption which makes caller of Dial blocks until the underlying -// connection is up. Without this, Dial returns immediately and connecting the server -// happens in background. -func WithBlock() DialOption { - return func(o *dialOptions) { - o.block = true - } -} - -// WithInsecure returns a DialOption which disables transport security for this ClientConn. -// Note that transport security is required unless WithInsecure is set. -func WithInsecure() DialOption { - return func(o *dialOptions) { - o.insecure = true - } -} - -// WithTransportCredentials returns a DialOption which configures a -// connection level security credentials (e.g., TLS/SSL). -func WithTransportCredentials(creds credentials.TransportCredentials) DialOption { - return func(o *dialOptions) { - o.copts.TransportCredentials = creds - } -} - -// WithPerRPCCredentials returns a DialOption which sets -// credentials and places auth state on each outbound RPC. -func WithPerRPCCredentials(creds credentials.PerRPCCredentials) DialOption { - return func(o *dialOptions) { - o.copts.PerRPCCredentials = append(o.copts.PerRPCCredentials, creds) - } -} - -// WithTimeout returns a DialOption that configures a timeout for dialing a ClientConn -// initially. This is valid if and only if WithBlock() is present. -// Deprecated: use DialContext and context.WithTimeout instead. -func WithTimeout(d time.Duration) DialOption { - return func(o *dialOptions) { - o.timeout = d - } -} - -func withContextDialer(f func(context.Context, string) (net.Conn, error)) DialOption { - return func(o *dialOptions) { - o.copts.Dialer = f - } -} - -// WithDialer returns a DialOption that specifies a function to use for dialing network addresses. -// If FailOnNonTempDialError() is set to true, and an error is returned by f, gRPC checks the error's -// Temporary() method to decide if it should try to reconnect to the network address. -func WithDialer(f func(string, time.Duration) (net.Conn, error)) DialOption { - return withContextDialer( - func(ctx context.Context, addr string) (net.Conn, error) { - if deadline, ok := ctx.Deadline(); ok { - return f(addr, deadline.Sub(time.Now())) - } - return f(addr, 0) - }) -} - -// WithStatsHandler returns a DialOption that specifies the stats handler -// for all the RPCs and underlying network connections in this ClientConn. -func WithStatsHandler(h stats.Handler) DialOption { - return func(o *dialOptions) { - o.copts.StatsHandler = h - } -} - -// FailOnNonTempDialError returns a DialOption that specifies if gRPC fails on non-temporary dial errors. -// If f is true, and dialer returns a non-temporary error, gRPC will fail the connection to the network -// address and won't try to reconnect. -// The default value of FailOnNonTempDialError is false. -// This is an EXPERIMENTAL API. -func FailOnNonTempDialError(f bool) DialOption { - return func(o *dialOptions) { - o.copts.FailOnNonTempDialError = f - } -} - -// WithUserAgent returns a DialOption that specifies a user agent string for all the RPCs. -func WithUserAgent(s string) DialOption { - return func(o *dialOptions) { - o.copts.UserAgent = s - } -} - -// WithKeepaliveParams returns a DialOption that specifies keepalive parameters for the client transport. -func WithKeepaliveParams(kp keepalive.ClientParameters) DialOption { - return func(o *dialOptions) { - o.copts.KeepaliveParams = kp - } -} - -// WithUnaryInterceptor returns a DialOption that specifies the interceptor for unary RPCs. -func WithUnaryInterceptor(f UnaryClientInterceptor) DialOption { - return func(o *dialOptions) { - o.unaryInt = f - } -} - -// WithStreamInterceptor returns a DialOption that specifies the interceptor for streaming RPCs. -func WithStreamInterceptor(f StreamClientInterceptor) DialOption { - return func(o *dialOptions) { - o.streamInt = f - } -} - -// WithAuthority returns a DialOption that specifies the value to be used as -// the :authority pseudo-header. This value only works with WithInsecure and -// has no effect if TransportCredentials are present. -func WithAuthority(a string) DialOption { - return func(o *dialOptions) { - o.copts.Authority = a - } -} - // Dial creates a client connection to the given target. func Dial(target string, opts ...DialOption) (*ClientConn, error) { return DialContext(context.Background(), target, opts...) } -// DialContext creates a client connection to the given target. ctx can be used to -// cancel or expire the pending connection. Once this function returns, the -// cancellation and expiration of ctx will be noop. Users should call ClientConn.Close -// to terminate all the pending operations after this function returns. +// DialContext creates a client connection to the given target. By default, it's +// a non-blocking dial (the function won't wait for connections to be +// established, and connecting happens in the background). To make it a blocking +// dial, use WithBlock() dial option. +// +// In the non-blocking case, the ctx does not act against the connection. It +// only controls the setup steps. +// +// In the blocking case, ctx can be used to cancel or expire the pending +// connection. Once this function returns, the cancellation and expiration of +// ctx will be noop. Users should call ClientConn.Close to terminate all the +// pending operations after this function returns. +// +// The target name syntax is defined in +// https://github.com/grpc/grpc/blob/master/doc/naming.md. +// e.g. to use dns resolver, a "dns:///" prefix should be applied to the target. func DialContext(ctx context.Context, target string, opts ...DialOption) (conn *ClientConn, err error) { cc := &ClientConn{ - target: target, - csMgr: &connectivityStateManager{}, - conns: make(map[*addrConn]struct{}), - + target: target, + csMgr: &connectivityStateManager{}, + conns: make(map[*addrConn]struct{}), + dopts: defaultDialOptions(), blockingpicker: newPickerWrapper(), + czData: new(channelzData), } + cc.retryThrottler.Store((*retryThrottler)(nil)) cc.ctx, cc.cancel = context.WithCancel(context.Background()) for _, opt := range opts { - opt(&cc.dopts) + opt.apply(&cc.dopts) + } + + if channelz.IsOn() { + if cc.dopts.channelzParentID != 0 { + cc.channelzID = channelz.RegisterChannel(&channelzChannel{cc}, cc.dopts.channelzParentID, target) + channelz.AddTraceEvent(cc.channelzID, &channelz.TraceEventDesc{ + Desc: "Channel Created", + Severity: channelz.CtINFO, + Parent: &channelz.TraceEventDesc{ + Desc: fmt.Sprintf("Nested Channel(id:%d) created", cc.channelzID), + Severity: channelz.CtINFO, + }, + }) + } else { + cc.channelzID = channelz.RegisterChannel(&channelzChannel{cc}, 0, target) + channelz.AddTraceEvent(cc.channelzID, &channelz.TraceEventDesc{ + Desc: "Channel Created", + Severity: channelz.CtINFO, + }) + } + cc.csMgr.channelzID = cc.channelzID } if !cc.dopts.insecure { @@ -441,7 +175,8 @@ func DialContext(ctx context.Context, target string, opts ...DialOption) (conn * if cc.dopts.copts.Dialer == nil { cc.dopts.copts.Dialer = newProxyDialer( func(ctx context.Context, addr string) (net.Conn, error) { - return dialContext(ctx, "tcp", addr) + network, addr := parseDialTarget(addr) + return dialContext(ctx, network, addr) }, ) } @@ -482,19 +217,35 @@ func DialContext(ctx context.Context, target string, opts ...DialOption) (conn * default: } } - // Set defaults. - if cc.dopts.codec == nil { - cc.dopts.codec = protoCodec{} - } if cc.dopts.bs == nil { - cc.dopts.bs = DefaultBackoffConfig + cc.dopts.bs = backoff.Exponential{ + MaxDelay: DefaultBackoffConfig.MaxDelay, + } + } + if cc.dopts.resolverBuilder == nil { + // Only try to parse target when resolver builder is not already set. + cc.parsedTarget = parseTarget(cc.target) + grpclog.Infof("parsed scheme: %q", cc.parsedTarget.Scheme) + cc.dopts.resolverBuilder = resolver.Get(cc.parsedTarget.Scheme) + if cc.dopts.resolverBuilder == nil { + // If resolver builder is still nil, the parse target's scheme is + // not registered. Fallback to default resolver and set Endpoint to + // the original unparsed target. + grpclog.Infof("scheme %q not registered, fallback to default scheme", cc.parsedTarget.Scheme) + cc.parsedTarget = resolver.Target{ + Scheme: resolver.GetDefaultScheme(), + Endpoint: target, + } + cc.dopts.resolverBuilder = resolver.Get(cc.parsedTarget.Scheme) + } + } else { + cc.parsedTarget = resolver.Target{Endpoint: target} } - cc.parsedTarget = parseTarget(cc.target) creds := cc.dopts.copts.TransportCredentials if creds != nil && creds.Info().ServerName != "" { cc.authority = creds.Info().ServerName - } else if cc.dopts.insecure && cc.dopts.copts.Authority != "" { - cc.authority = cc.dopts.copts.Authority + } else if cc.dopts.insecure && cc.dopts.authority != "" { + cc.authority = cc.dopts.authority } else { // Use endpoint from "scheme://authority/endpoint" as the default // authority for ClientConn. @@ -521,8 +272,9 @@ func DialContext(ctx context.Context, target string, opts ...DialOption) (conn * credsClone = creds.Clone() } cc.balancerBuildOpts = balancer.BuildOptions{ - DialCreds: credsClone, - Dialer: cc.dopts.copts.Dialer, + DialCreds: credsClone, + Dialer: cc.dopts.copts.Dialer, + ChannelzParentID: cc.channelzID, } // Build the resolver. @@ -545,6 +297,13 @@ func DialContext(ctx context.Context, target string, opts ...DialOption) (conn * s := cc.GetState() if s == connectivity.Ready { break + } else if cc.dopts.copts.FailOnNonTempDialError && s == connectivity.TransientFailure { + if err = cc.blockingpicker.connectionError(); err != nil { + terr, ok := err.(interface{ Temporary() bool }) + if ok && !terr.Temporary() { + return nil, err + } + } } if !cc.WaitForStateChange(ctx, s) { // ctx got timeout or canceled. @@ -562,6 +321,7 @@ type connectivityStateManager struct { mu sync.Mutex state connectivity.State notifyChan chan struct{} + channelzID int64 } // updateState updates the connectivity.State of ClientConn. @@ -577,6 +337,12 @@ func (csm *connectivityStateManager) updateState(state connectivity.State) { return } csm.state = state + if channelz.IsOn() { + channelz.AddTraceEvent(csm.channelzID, &channelz.TraceEventDesc{ + Desc: fmt.Sprintf("Channel Connectivity change to %v", state), + Severity: channelz.CtINFO, + }) + } if csm.notifyChan != nil { // There are other goroutines waiting on this channel. close(csm.notifyChan) @@ -624,6 +390,10 @@ type ClientConn struct { preBalancerName string // previous balancer name. curAddresses []resolver.Address balancerWrapper *ccBalancerWrapper + retryThrottler atomic.Value + + channelzID int64 // channelz unique identification number + czData *channelzData } // WaitForStateChange waits until the connectivity.State of ClientConn changes from sourceState or @@ -750,10 +520,26 @@ func (cc *ClientConn) switchBalancer(name string) { } builder := balancer.Get(name) + // TODO(yuxuanli): If user send a service config that does not contain a valid balancer name, should + // we reuse previous one? + if channelz.IsOn() { + if builder == nil { + channelz.AddTraceEvent(cc.channelzID, &channelz.TraceEventDesc{ + Desc: fmt.Sprintf("Channel switches to new LB policy %q due to fallback from invalid balancer name", PickFirstBalancerName), + Severity: channelz.CtWarning, + }) + } else { + channelz.AddTraceEvent(cc.channelzID, &channelz.TraceEventDesc{ + Desc: fmt.Sprintf("Channel switches to new LB policy %q", name), + Severity: channelz.CtINFO, + }) + } + } if builder == nil { grpclog.Infof("failed to get balancer builder for: %v, using pick_first instead", name) builder = newPickfirstBuilder() } + cc.preBalancerName = cc.curBalancerName cc.curBalancerName = builder.Name() cc.balancerWrapper = newCCBalancerWrapper(cc, builder, cc.balancerBuildOpts) @@ -776,9 +562,12 @@ func (cc *ClientConn) handleSubConnStateChange(sc balancer.SubConn, s connectivi // Caller needs to make sure len(addrs) > 0. func (cc *ClientConn) newAddrConn(addrs []resolver.Address) (*addrConn, error) { ac := &addrConn{ - cc: cc, - addrs: addrs, - dopts: cc.dopts, + cc: cc, + addrs: addrs, + dopts: cc.dopts, + czData: new(channelzData), + successfulHandshake: true, // make the first nextAddr() call _not_ move addrIdx up by 1 + resetBackoff: make(chan struct{}), } ac.ctx, ac.cancel = context.WithCancel(cc.ctx) // Track ac in cc. This needs to be done before any getTransport(...) is called. @@ -787,6 +576,17 @@ func (cc *ClientConn) newAddrConn(addrs []resolver.Address) (*addrConn, error) { cc.mu.Unlock() return nil, ErrClientConnClosing } + if channelz.IsOn() { + ac.channelzID = channelz.RegisterSubChannel(ac, cc.channelzID, "") + channelz.AddTraceEvent(ac.channelzID, &channelz.TraceEventDesc{ + Desc: "Subchannel Created", + Severity: channelz.CtINFO, + Parent: &channelz.TraceEventDesc{ + Desc: fmt.Sprintf("Subchannel(id:%d) created", ac.channelzID), + Severity: channelz.CtINFO, + }, + }) + } cc.conns[ac] = struct{}{} cc.mu.Unlock() return ac, nil @@ -805,6 +605,36 @@ func (cc *ClientConn) removeAddrConn(ac *addrConn, err error) { ac.tearDown(err) } +func (cc *ClientConn) channelzMetric() *channelz.ChannelInternalMetric { + return &channelz.ChannelInternalMetric{ + State: cc.GetState(), + Target: cc.target, + CallsStarted: atomic.LoadInt64(&cc.czData.callsStarted), + CallsSucceeded: atomic.LoadInt64(&cc.czData.callsSucceeded), + CallsFailed: atomic.LoadInt64(&cc.czData.callsFailed), + LastCallStartedTimestamp: time.Unix(0, atomic.LoadInt64(&cc.czData.lastCallStartedTime)), + } +} + +// Target returns the target string of the ClientConn. +// This is an EXPERIMENTAL API. +func (cc *ClientConn) Target() string { + return cc.target +} + +func (cc *ClientConn) incrCallsStarted() { + atomic.AddInt64(&cc.czData.callsStarted, 1) + atomic.StoreInt64(&cc.czData.lastCallStartedTime, time.Now().UnixNano()) +} + +func (cc *ClientConn) incrCallsSucceeded() { + atomic.AddInt64(&cc.czData.callsSucceeded, 1) +} + +func (cc *ClientConn) incrCallsFailed() { + atomic.AddInt64(&cc.czData.callsFailed, 1) +} + // connect starts to creating transport and also starts the transport monitor // goroutine for this ac. // It does nothing if the ac is not IDLE. @@ -820,22 +650,12 @@ func (ac *addrConn) connect() error { ac.mu.Unlock() return nil } - ac.state = connectivity.Connecting + ac.updateConnectivityState(connectivity.Connecting) ac.cc.handleSubConnStateChange(ac.acbw, ac.state) ac.mu.Unlock() // Start a goroutine connecting to the server asynchronously. - go func() { - if err := ac.resetTransport(); err != nil { - grpclog.Warningf("Failed to dial %s: %v; please retry.", ac.addrs[0].Addr, err) - if err != errConnClosing { - // Keep this ac in cc.conns, to get the reason it's torn down. - ac.tearDown(err) - } - return - } - ac.transportMonitor() - }() + go ac.resetTransport(false) return nil } @@ -864,7 +684,7 @@ func (ac *addrConn) tryUpdateAddrs(addrs []resolver.Address) bool { grpclog.Infof("addrConn: tryUpdateAddrs curAddrFound: %v", curAddrFound) if curAddrFound { ac.addrs = addrs - ac.reconnectIdx = 0 // Start reconnecting from beginning in the new list. + ac.addrIdx = 0 // Start reconnecting from beginning in the new list. } return curAddrFound @@ -875,7 +695,7 @@ func (ac *addrConn) tryUpdateAddrs(addrs []resolver.Address) bool { // the corresponding MethodConfig. // If there isn't an exact match for the input method, we look for the default config // under the service (i.e /service/). If there is a default MethodConfig for -// the serivce, we return it. +// the service, we return it. // Otherwise, we return an empty MethodConfig. func (cc *ClientConn) GetMethodConfig(method string) MethodConfig { // TODO: Avoid the locking here. @@ -884,13 +704,15 @@ func (cc *ClientConn) GetMethodConfig(method string) MethodConfig { m, ok := cc.sc.Methods[method] if !ok { i := strings.LastIndex(method, "/") - m, _ = cc.sc.Methods[method[:i+1]] + m = cc.sc.Methods[method[:i+1]] } return m } -func (cc *ClientConn) getTransport(ctx context.Context, failfast bool) (transport.ClientTransport, func(balancer.DoneInfo), error) { - t, done, err := cc.blockingpicker.pick(ctx, failfast, balancer.PickOptions{}) +func (cc *ClientConn) getTransport(ctx context.Context, failfast bool, method string) (transport.ClientTransport, func(balancer.DoneInfo), error) { + t, done, err := cc.blockingpicker.pick(ctx, failfast, balancer.PickOptions{ + FullMethodName: method, + }) if err != nil { return nil, nil, toRPCErr(err) } @@ -900,6 +722,20 @@ func (cc *ClientConn) getTransport(ctx context.Context, failfast bool) (transpor // handleServiceConfig parses the service config string in JSON format to Go native // struct ServiceConfig, and store both the struct and the JSON string in ClientConn. func (cc *ClientConn) handleServiceConfig(js string) error { + if cc.dopts.disableServiceConfig { + return nil + } + if cc.scRaw == js { + return nil + } + if channelz.IsOn() { + channelz.AddTraceEvent(cc.channelzID, &channelz.TraceEventDesc{ + // The special formatting of \"%s\" instead of %q is to provide nice printing of service config + // for human consumption. + Desc: fmt.Sprintf("Channel has a new service config \"%s\"", js), + Severity: channelz.CtINFO, + }) + } sc, err := parseServiceConfig(js) if err != nil { return err @@ -907,6 +743,19 @@ func (cc *ClientConn) handleServiceConfig(js string) error { cc.mu.Lock() cc.scRaw = js cc.sc = sc + + if sc.retryThrottling != nil { + newThrottler := &retryThrottler{ + tokens: sc.retryThrottling.MaxTokens, + max: sc.retryThrottling.MaxTokens, + thresh: sc.retryThrottling.MaxTokens / 2, + ratio: sc.retryThrottling.TokenRatio, + } + cc.retryThrottler.Store(newThrottler) + } else { + cc.retryThrottler.Store((*retryThrottler)(nil)) + } + if sc.LB != nil && *sc.LB != grpclbName { // "grpclb" is not a valid balancer option in service config. if cc.curBalancerName == grpclbName { // If current balancer is grpclb, there's at least one grpclb @@ -920,23 +769,42 @@ func (cc *ClientConn) handleServiceConfig(js string) error { cc.balancerWrapper.handleResolvedAddrs(cc.curAddresses, nil) } } + cc.mu.Unlock() return nil } func (cc *ClientConn) resolveNow(o resolver.ResolveNowOption) { - cc.mu.Lock() + cc.mu.RLock() r := cc.resolverWrapper - cc.mu.Unlock() + cc.mu.RUnlock() if r == nil { return } go r.resolveNow(o) } +// ResetConnectBackoff wakes up all subchannels in transient failure and causes +// them to attempt another connection immediately. It also resets the backoff +// times used for subsequent attempts regardless of the current state. +// +// In general, this function should not be used. Typical service or network +// outages result in a reasonable client reconnection strategy by default. +// However, if a previously unavailable network becomes available, this may be +// used to trigger an immediate reconnect. +// +// This API is EXPERIMENTAL. +func (cc *ClientConn) ResetConnectBackoff() { + cc.mu.Lock() + defer cc.mu.Unlock() + for ac := range cc.conns { + ac.resetConnectBackoff() + } +} + // Close tears down the ClientConn and all underlying connections. func (cc *ClientConn) Close() error { - cc.cancel() + defer cc.cancel() cc.mu.Lock() if cc.conns == nil { @@ -952,16 +820,35 @@ func (cc *ClientConn) Close() error { bWrapper := cc.balancerWrapper cc.balancerWrapper = nil cc.mu.Unlock() + cc.blockingpicker.close() + if rWrapper != nil { rWrapper.close() } if bWrapper != nil { bWrapper.close() } + for ac := range conns { ac.tearDown(ErrClientConnClosing) } + if channelz.IsOn() { + ted := &channelz.TraceEventDesc{ + Desc: "Channel Deleted", + Severity: channelz.CtINFO, + } + if cc.dopts.channelzParentID != 0 { + ted.Parent = &channelz.TraceEventDesc{ + Desc: fmt.Sprintf("Nested channel(id:%d) deleted", cc.channelzID), + Severity: channelz.CtINFO, + } + } + channelz.AddTraceEvent(cc.channelzID, ted) + // TraceEvent needs to be called before RemoveEntry, as TraceEvent may add trace reference to + // the entity beng deleted, and thus prevent it from being deleted right away. + channelz.RemoveEntry(cc.channelzID) + } return nil } @@ -971,30 +858,50 @@ type addrConn struct { cancel context.CancelFunc cc *ClientConn - addrs []resolver.Address dopts dialOptions events trace.EventLog acbw balancer.SubConn - mu sync.Mutex - curAddr resolver.Address - reconnectIdx int // The index in addrs list to start reconnecting from. - state connectivity.State + transport transport.ClientTransport // The current transport. + + mu sync.Mutex + addrIdx int // The index in addrs list to start reconnecting from. + curAddr resolver.Address // The current address. + addrs []resolver.Address // All addresses that the resolver resolved to. + + // Use updateConnectivityState for updating addrConn's connectivity state. + state connectivity.State // ready is closed and becomes nil when a new transport is up or failed // due to timeout. - ready chan struct{} - transport transport.ClientTransport + ready chan struct{} - // The reason this addrConn is torn down. - tearDownErr error + tearDownErr error // The reason this addrConn is torn down. - connectRetryNum int + backoffIdx int // backoffDeadline is the time until which resetTransport needs to - // wait before increasing connectRetryNum count. + // wait before increasing backoffIdx count. backoffDeadline time.Time // connectDeadline is the time by which all connection // negotiations must complete. connectDeadline time.Time + + resetBackoff chan struct{} + + channelzID int64 // channelz unique identification number + czData *channelzData + + successfulHandshake bool +} + +// Note: this requires a lock on ac.mu. +func (ac *addrConn) updateConnectivityState(s connectivity.State) { + ac.state = s + if channelz.IsOn() { + channelz.AddTraceEvent(ac.channelzID, &channelz.TraceEventDesc{ + Desc: fmt.Sprintf("Subchannel Connectivity change to %v", s), + Severity: channelz.CtINFO, + }) + } } // adjustParams updates parameters used to create transports upon @@ -1027,301 +934,301 @@ func (ac *addrConn) errorf(format string, a ...interface{}) { } } -// resetTransport recreates a transport to the address for ac. The old -// transport will close itself on error or when the clientconn is closed. -// The created transport must receive initial settings frame from the server. -// In case that doesnt happen, transportMonitor will kill the newly created -// transport after connectDeadline has expired. -// In case there was an error on the transport before the settings frame was -// received, resetTransport resumes connecting to backends after the one that -// was previously connected to. In case end of the list is reached, resetTransport -// backs off until the original deadline. -// If the DialOption WithWaitForHandshake was set, resetTrasport returns -// successfully only after server settings are received. +// resetTransport makes sure that a healthy ac.transport exists. // -// TODO(bar) make sure all state transitions are valid. -func (ac *addrConn) resetTransport() error { - ac.mu.Lock() - if ac.state == connectivity.Shutdown { - ac.mu.Unlock() - return errConnClosing - } - if ac.ready != nil { - close(ac.ready) - ac.ready = nil - } - ac.transport = nil - ridx := ac.reconnectIdx - ac.mu.Unlock() - ac.cc.mu.RLock() - ac.dopts.copts.KeepaliveParams = ac.cc.mkp - ac.cc.mu.RUnlock() - var backoffDeadline, connectDeadline time.Time - for connectRetryNum := 0; ; connectRetryNum++ { +// The transport will close itself when it encounters an error, or on GOAWAY, or on deadline waiting for handshake, or +// when the clientconn is closed. Each iteration creating a new transport will try a different address that the balancer +// assigned to the addrConn, until it has tried all addresses. Once it has tried all addresses, it will re-resolve to +// get a new address list. If an error is received, the list is re-resolved and the next reset attempt will try from the +// beginning. This method has backoff built in. The backoff amount starts at 0 and increases each time resolution occurs +// (addresses are exhausted). The backoff amount is reset to 0 each time a handshake is received. +// +// If the DialOption WithWaitForHandshake was set, resetTransport returns successfully only after handshake is received. +func (ac *addrConn) resetTransport(resolveNow bool) { + for { + // If this is the first in a line of resets, we want to resolve immediately. The only other time we + // want to reset is if we have tried all the addresses handed to us. + if resolveNow { + ac.mu.Lock() + ac.cc.resolveNow(resolver.ResolveNowOption{}) + ac.mu.Unlock() + } + + if err := ac.nextAddr(); err != nil { + grpclog.Warningf("resetTransport: error from nextAddr: %v", err) + } + ac.mu.Lock() - if ac.backoffDeadline.IsZero() { - // This means either a successful HTTP2 connection was established - // or this is the first time this addrConn is trying to establish a - // connection. - backoffFor := ac.dopts.bs.backoff(connectRetryNum) // time.Duration. - // This will be the duration that dial gets to finish. - dialDuration := minConnectTimeout - if backoffFor > dialDuration { - // Give dial more time as we keep failing to connect. - dialDuration = backoffFor - } - start := time.Now() - backoffDeadline = start.Add(backoffFor) - connectDeadline = start.Add(dialDuration) - ridx = 0 // Start connecting from the beginning. - } else { - // Continue trying to conect with the same deadlines. - connectRetryNum = ac.connectRetryNum - backoffDeadline = ac.backoffDeadline - connectDeadline = ac.connectDeadline - ac.backoffDeadline = time.Time{} - ac.connectDeadline = time.Time{} - ac.connectRetryNum = 0 + if ac.state == connectivity.Shutdown { + ac.mu.Unlock() + return } + if ac.ready != nil { + close(ac.ready) + ac.ready = nil + } + ac.transport = nil + + backoffIdx := ac.backoffIdx + backoffFor := ac.dopts.bs.Backoff(backoffIdx) + + // This will be the duration that dial gets to finish. + dialDuration := getMinConnectTimeout() + if backoffFor > dialDuration { + // Give dial more time as we keep failing to connect. + dialDuration = backoffFor + } + start := time.Now() + connectDeadline := start.Add(dialDuration) + ac.backoffDeadline = start.Add(backoffFor) + ac.connectDeadline = connectDeadline + + ac.mu.Unlock() + + ac.cc.mu.RLock() + ac.dopts.copts.KeepaliveParams = ac.cc.mkp + ac.cc.mu.RUnlock() + + ac.mu.Lock() + if ac.state == connectivity.Shutdown { ac.mu.Unlock() - return errConnClosing + return } + ac.printf("connecting") if ac.state != connectivity.Connecting { - ac.state = connectivity.Connecting + ac.updateConnectivityState(connectivity.Connecting) ac.cc.handleSubConnStateChange(ac.acbw, ac.state) } - // copy ac.addrs in case of race - addrsIter := make([]resolver.Address, len(ac.addrs)) - copy(addrsIter, ac.addrs) + + addr := ac.addrs[ac.addrIdx] copts := ac.dopts.copts ac.mu.Unlock() - connected, err := ac.createTransport(connectRetryNum, ridx, backoffDeadline, connectDeadline, addrsIter, copts) - if err != nil { - return err + + if channelz.IsOn() { + channelz.AddTraceEvent(ac.channelzID, &channelz.TraceEventDesc{ + Desc: fmt.Sprintf("Subchannel picks a new address %q to connect", addr.Addr), + Severity: channelz.CtINFO, + }) } - if connected { - return nil + + if err := ac.createTransport(backoffIdx, addr, copts, connectDeadline); err != nil { + continue } + + return } } // createTransport creates a connection to one of the backends in addrs. -// It returns true if a connection was established. -func (ac *addrConn) createTransport(connectRetryNum, ridx int, backoffDeadline, connectDeadline time.Time, addrs []resolver.Address, copts transport.ConnectOptions) (bool, error) { - for i := ridx; i < len(addrs); i++ { - addr := addrs[i] - target := transport.TargetInfo{ - Addr: addr.Addr, - Metadata: addr.Metadata, - Authority: ac.cc.authority, +func (ac *addrConn) createTransport(backoffNum int, addr resolver.Address, copts transport.ConnectOptions, connectDeadline time.Time) error { + oneReset := sync.Once{} + skipReset := make(chan struct{}) + allowedToReset := make(chan struct{}) + prefaceReceived := make(chan struct{}) + onCloseCalled := make(chan struct{}) + + onGoAway := func(r transport.GoAwayReason) { + ac.mu.Lock() + ac.adjustParams(r) + ac.mu.Unlock() + select { + case <-skipReset: // The outer resetTransport loop will handle reconnection. + return + case <-allowedToReset: // We're in the clear to reset. + go oneReset.Do(func() { ac.resetTransport(false) }) } - done := make(chan struct{}) - onPrefaceReceipt := func() { + } + + onClose := func() { + close(onCloseCalled) + + select { + case <-skipReset: // The outer resetTransport loop will handle reconnection. + return + case <-allowedToReset: // We're in the clear to reset. ac.mu.Lock() - close(done) - if !ac.backoffDeadline.IsZero() { - // If we haven't already started reconnecting to - // other backends. - // Note, this can happen when writer notices an error - // and triggers resetTransport while at the same time - // reader receives the preface and invokes this closure. - ac.backoffDeadline = time.Time{} - ac.connectDeadline = time.Time{} - ac.connectRetryNum = 0 - } + ac.transport = nil ac.mu.Unlock() + oneReset.Do(func() { ac.resetTransport(false) }) } - // Do not cancel in the success path because of - // this issue in Go1.6: https://github.com/golang/go/issues/15078. - connectCtx, cancel := context.WithDeadline(ac.ctx, connectDeadline) - newTr, err := transport.NewClientTransport(connectCtx, ac.cc.ctx, target, copts, onPrefaceReceipt) - if err != nil { - cancel() - if e, ok := err.(transport.ConnectionError); ok && !e.Temporary() { - ac.mu.Lock() - if ac.state != connectivity.Shutdown { - ac.state = connectivity.TransientFailure - ac.cc.handleSubConnStateChange(ac.acbw, ac.state) - } - ac.mu.Unlock() - return false, err - } + } + + target := transport.TargetInfo{ + Addr: addr.Addr, + Metadata: addr.Metadata, + Authority: ac.cc.authority, + } + + onPrefaceReceipt := func() { + close(prefaceReceived) + + // TODO(deklerk): optimization; does anyone else actually use this lock? maybe we can just remove it for this scope + ac.mu.Lock() + ac.successfulHandshake = true + ac.backoffDeadline = time.Time{} + ac.connectDeadline = time.Time{} + ac.addrIdx = 0 + ac.backoffIdx = 0 + ac.mu.Unlock() + } + + // Do not cancel in the success path because of this issue in Go1.6: https://github.com/golang/go/issues/15078. + connectCtx, cancel := context.WithDeadline(ac.ctx, connectDeadline) + if channelz.IsOn() { + copts.ChannelzParentID = ac.channelzID + } + + newTr, err := transport.NewClientTransport(connectCtx, ac.cc.ctx, target, copts, onPrefaceReceipt, onGoAway, onClose) + + if err == nil { + prefaceTimer := time.AfterFunc(connectDeadline.Sub(time.Now()), func() { ac.mu.Lock() - if ac.state == connectivity.Shutdown { - // ac.tearDown(...) has been invoked. + select { + case <-onCloseCalled: + // The transport has already closed - noop. + ac.mu.Unlock() + case <-prefaceReceived: + // We got the preface just in the nick of time - huzzah! + ac.mu.Unlock() + default: + // We didn't get the preface in time. ac.mu.Unlock() - return false, errConnClosing + newTr.Close() } - ac.mu.Unlock() - grpclog.Warningf("grpc: addrConn.createTransport failed to connect to %v. Err :%v. Reconnecting...", addr, err) - continue - } + }) if ac.dopts.waitForHandshake { select { - case <-done: - case <-connectCtx.Done(): - // Didn't receive server preface, must kill this new transport now. - grpclog.Warningf("grpc: addrConn.createTransport failed to receive server preface before deadline.") + case <-prefaceTimer.C: + // We want to close but _not_ reset, because we're going into the transient-failure-and-return flow + // and go into the next cycle of the resetTransport loop. + close(skipReset) newTr.Close() - break - case <-ac.ctx.Done(): + err = errors.New("timed out") + case <-prefaceReceived: + // We got the preface - huzzah! things are good. + case <-onCloseCalled: + // The transport has already closed - noop. } } + } + + if err != nil { + // newTr is either nil, or closed. + + cancel() + ac.cc.blockingpicker.updateConnectionError(err) ac.mu.Lock() if ac.state == connectivity.Shutdown { + // ac.tearDown(...) has been invoked. ac.mu.Unlock() - // ac.tearDonn(...) has been invoked. - newTr.Close() - return false, errConnClosing + + // We don't want to reset during this close because we prefer to kick out of this function and let the loop + // in resetTransport take care of reconnecting. + close(skipReset) + + return errConnClosing } - ac.printf("ready") - ac.state = connectivity.Ready + ac.updateConnectivityState(connectivity.TransientFailure) ac.cc.handleSubConnStateChange(ac.acbw, ac.state) - ac.transport = newTr - ac.curAddr = addr - if ac.ready != nil { - close(ac.ready) - ac.ready = nil - } - select { - case <-done: - // If the server has responded back with preface already, - // don't set the reconnect parameters. - default: - ac.connectRetryNum = connectRetryNum - ac.backoffDeadline = backoffDeadline - ac.connectDeadline = connectDeadline - ac.reconnectIdx = i + 1 // Start reconnecting from the next backend in the list. - } ac.mu.Unlock() - return true, nil + grpclog.Warningf("grpc: addrConn.createTransport failed to connect to %v. Err :%v. Reconnecting...", addr, err) + + // We don't want to reset during this close because we prefer to kick out of this function and let the loop + // in resetTransport take care of reconnecting. + close(skipReset) + + return err } + ac.mu.Lock() - ac.state = connectivity.TransientFailure + + if ac.state == connectivity.Shutdown { + ac.mu.Unlock() + + // We don't want to reset during this close because we prefer to kick out of this function and let the loop + // in resetTransport take care of reconnecting. + close(skipReset) + + newTr.Close() + return errConnClosing + } + + ac.printf("ready") + ac.updateConnectivityState(connectivity.Ready) + ac.cc.handleSubConnStateChange(ac.acbw, ac.state) + ac.transport = newTr + ac.curAddr = addr + if ac.ready != nil { + close(ac.ready) + ac.ready = nil + } + + ac.mu.Unlock() + + // Ok, _now_ we will finally let the transport reset if it encounters a closable error. Without this, the reader + // goroutine failing races with all the code in this method that sets the connection to "ready". + close(allowedToReset) + return nil +} + +// nextAddr increments the addrIdx if there are more addresses to try. If +// there are no more addrs to try it will re-resolve, set addrIdx to 0, and +// increment the backoffIdx. +func (ac *addrConn) nextAddr() error { + ac.mu.Lock() + + // If a handshake has been observed, we expect the counters to have manually + // been reset so we'll just return, since we want the next usage to start + // at index 0. + if ac.successfulHandshake { + ac.successfulHandshake = false + ac.mu.Unlock() + return nil + } + + if ac.addrIdx < len(ac.addrs)-1 { + ac.addrIdx++ + ac.mu.Unlock() + return nil + } + + ac.addrIdx = 0 + ac.backoffIdx++ + + if ac.state == connectivity.Shutdown { + ac.mu.Unlock() + return errConnClosing + } + ac.updateConnectivityState(connectivity.TransientFailure) ac.cc.handleSubConnStateChange(ac.acbw, ac.state) ac.cc.resolveNow(resolver.ResolveNowOption{}) if ac.ready != nil { close(ac.ready) ac.ready = nil } + backoffDeadline := ac.backoffDeadline + b := ac.resetBackoff ac.mu.Unlock() timer := time.NewTimer(backoffDeadline.Sub(time.Now())) select { case <-timer.C: + case <-b: + timer.Stop() case <-ac.ctx.Done(): timer.Stop() - return false, ac.ctx.Err() - } - return false, nil -} - -// Run in a goroutine to track the error in transport and create the -// new transport if an error happens. It returns when the channel is closing. -func (ac *addrConn) transportMonitor() { - for { - var timer *time.Timer - var cdeadline <-chan time.Time - ac.mu.Lock() - t := ac.transport - if !ac.connectDeadline.IsZero() { - timer = time.NewTimer(ac.connectDeadline.Sub(time.Now())) - cdeadline = timer.C - } - ac.mu.Unlock() - // Block until we receive a goaway or an error occurs. - select { - case <-t.GoAway(): - case <-t.Error(): - case <-cdeadline: - ac.mu.Lock() - // This implies that client received server preface. - if ac.backoffDeadline.IsZero() { - ac.mu.Unlock() - continue - } - ac.mu.Unlock() - timer = nil - // No server preface received until deadline. - // Kill the connection. - grpclog.Warningf("grpc: addrConn.transportMonitor didn't get server preface after waiting. Closing the new transport now.") - t.Close() - } - if timer != nil { - timer.Stop() - } - // If a GoAway happened, regardless of error, adjust our keepalive - // parameters as appropriate. - select { - case <-t.GoAway(): - ac.adjustParams(t.GetGoAwayReason()) - default: - } - ac.mu.Lock() - if ac.state == connectivity.Shutdown { - ac.mu.Unlock() - return - } - // Set connectivity state to TransientFailure before calling - // resetTransport. Transition READY->CONNECTING is not valid. - ac.state = connectivity.TransientFailure - ac.cc.handleSubConnStateChange(ac.acbw, ac.state) - ac.cc.resolveNow(resolver.ResolveNowOption{}) - ac.curAddr = resolver.Address{} - ac.mu.Unlock() - if err := ac.resetTransport(); err != nil { - ac.mu.Lock() - ac.printf("transport exiting: %v", err) - ac.mu.Unlock() - grpclog.Warningf("grpc: addrConn.transportMonitor exits due to: %v", err) - if err != errConnClosing { - // Keep this ac in cc.conns, to get the reason it's torn down. - ac.tearDown(err) - } - return - } + return ac.ctx.Err() } + return nil } -// wait blocks until i) the new transport is up or ii) ctx is done or iii) ac is closed or -// iv) transport is in connectivity.TransientFailure and there is a balancer/failfast is true. -func (ac *addrConn) wait(ctx context.Context, hasBalancer, failfast bool) (transport.ClientTransport, error) { - for { - ac.mu.Lock() - switch { - case ac.state == connectivity.Shutdown: - if failfast || !hasBalancer { - // RPC is failfast or balancer is nil. This RPC should fail with ac.tearDownErr. - err := ac.tearDownErr - ac.mu.Unlock() - return nil, err - } - ac.mu.Unlock() - return nil, errConnClosing - case ac.state == connectivity.Ready: - ct := ac.transport - ac.mu.Unlock() - return ct, nil - case ac.state == connectivity.TransientFailure: - if failfast || hasBalancer { - ac.mu.Unlock() - return nil, errConnUnavailable - } - } - ready := ac.ready - if ready == nil { - ready = make(chan struct{}) - ac.ready = ready - } - ac.mu.Unlock() - select { - case <-ctx.Done(): - return nil, toRPCErr(ctx.Err()) - // Wait until the new transport is ready or failed. - case <-ready: - } - } +func (ac *addrConn) resetConnectBackoff() { + ac.mu.Lock() + close(ac.resetBackoff) + ac.backoffIdx = 0 + ac.resetBackoff = make(chan struct{}) + ac.mu.Unlock() } // getReadyTransport returns the transport if ac's state is READY. @@ -1329,7 +1236,7 @@ func (ac *addrConn) wait(ctx context.Context, hasBalancer, failfast bool) (trans // If ac's state is IDLE, it will trigger ac to connect. func (ac *addrConn) getReadyTransport() (transport.ClientTransport, bool) { ac.mu.Lock() - if ac.state == connectivity.Ready { + if ac.state == connectivity.Ready && ac.transport != nil { t := ac.transport ac.mu.Unlock() return t, true @@ -1354,21 +1261,26 @@ func (ac *addrConn) getReadyTransport() (transport.ClientTransport, bool) { func (ac *addrConn) tearDown(err error) { ac.cancel() ac.mu.Lock() - defer ac.mu.Unlock() if ac.state == connectivity.Shutdown { + ac.mu.Unlock() return } + // We have to set the state to Shutdown before we call ac.transports.GracefulClose, because it signals to + // onClose not to try reconnecting the transport. + ac.updateConnectivityState(connectivity.Shutdown) + ac.tearDownErr = err + ac.cc.handleSubConnStateChange(ac.acbw, ac.state) ac.curAddr = resolver.Address{} if err == errConnDrain && ac.transport != nil { // GracefulClose(...) may be executed multiple times when // i) receiving multiple GoAway frames from the server; or // ii) there are concurrent name resolver/Balancer triggered // address removal and GoAway. + // We have to unlock and re-lock here because GracefulClose => Close => onClose, which requires locking ac.mu. + ac.mu.Unlock() ac.transport.GracefulClose() + ac.mu.Lock() } - ac.state = connectivity.Shutdown - ac.tearDownErr = err - ac.cc.handleSubConnStateChange(ac.acbw, ac.state) if ac.events != nil { ac.events.Finish() ac.events = nil @@ -1377,7 +1289,20 @@ func (ac *addrConn) tearDown(err error) { close(ac.ready) ac.ready = nil } - return + if channelz.IsOn() { + channelz.AddTraceEvent(ac.channelzID, &channelz.TraceEventDesc{ + Desc: "Subchannel Deleted", + Severity: channelz.CtINFO, + Parent: &channelz.TraceEventDesc{ + Desc: fmt.Sprintf("Subchanel(id:%d) deleted", ac.channelzID), + Severity: channelz.CtINFO, + }, + }) + // TraceEvent needs to be called before RemoveEntry, as TraceEvent may add trace reference to + // the entity beng deleted, and thus prevent it from being deleted right away. + channelz.RemoveEntry(ac.channelzID) + } + ac.mu.Unlock() } func (ac *addrConn) getState() connectivity.State { @@ -1385,3 +1310,82 @@ func (ac *addrConn) getState() connectivity.State { defer ac.mu.Unlock() return ac.state } + +func (ac *addrConn) ChannelzMetric() *channelz.ChannelInternalMetric { + ac.mu.Lock() + addr := ac.curAddr.Addr + ac.mu.Unlock() + return &channelz.ChannelInternalMetric{ + State: ac.getState(), + Target: addr, + CallsStarted: atomic.LoadInt64(&ac.czData.callsStarted), + CallsSucceeded: atomic.LoadInt64(&ac.czData.callsSucceeded), + CallsFailed: atomic.LoadInt64(&ac.czData.callsFailed), + LastCallStartedTimestamp: time.Unix(0, atomic.LoadInt64(&ac.czData.lastCallStartedTime)), + } +} + +func (ac *addrConn) incrCallsStarted() { + atomic.AddInt64(&ac.czData.callsStarted, 1) + atomic.StoreInt64(&ac.czData.lastCallStartedTime, time.Now().UnixNano()) +} + +func (ac *addrConn) incrCallsSucceeded() { + atomic.AddInt64(&ac.czData.callsSucceeded, 1) +} + +func (ac *addrConn) incrCallsFailed() { + atomic.AddInt64(&ac.czData.callsFailed, 1) +} + +type retryThrottler struct { + max float64 + thresh float64 + ratio float64 + + mu sync.Mutex + tokens float64 // TODO(dfawley): replace with atomic and remove lock. +} + +// throttle subtracts a retry token from the pool and returns whether a retry +// should be throttled (disallowed) based upon the retry throttling policy in +// the service config. +func (rt *retryThrottler) throttle() bool { + if rt == nil { + return false + } + rt.mu.Lock() + defer rt.mu.Unlock() + rt.tokens-- + if rt.tokens < 0 { + rt.tokens = 0 + } + return rt.tokens <= rt.thresh +} + +func (rt *retryThrottler) successfulRPC() { + if rt == nil { + return + } + rt.mu.Lock() + defer rt.mu.Unlock() + rt.tokens += rt.ratio + if rt.tokens > rt.max { + rt.tokens = rt.max + } +} + +type channelzChannel struct { + cc *ClientConn +} + +func (c *channelzChannel) ChannelzMetric() *channelz.ChannelInternalMetric { + return c.cc.channelzMetric() +} + +// ErrClientConnTimeout indicates that the ClientConn cannot establish the +// underlying connections within the specified timeout. +// +// Deprecated: This error is never returned by grpc and should not be +// referenced by users. +var ErrClientConnTimeout = errors.New("grpc: timed out when dialing") diff --git a/vendor/google.golang.org/grpc/codec.go b/vendor/google.golang.org/grpc/codec.go index 43d81ed2ab48..129776547811 100644 --- a/vendor/google.golang.org/grpc/codec.go +++ b/vendor/google.golang.org/grpc/codec.go @@ -19,96 +19,32 @@ package grpc import ( - "math" - "sync" - - "github.com/golang/protobuf/proto" + "google.golang.org/grpc/encoding" + _ "google.golang.org/grpc/encoding/proto" // to register the Codec for "proto" ) +// baseCodec contains the functionality of both Codec and encoding.Codec, but +// omits the name/string, which vary between the two and are not needed for +// anything besides the registry in the encoding package. +type baseCodec interface { + Marshal(v interface{}) ([]byte, error) + Unmarshal(data []byte, v interface{}) error +} + +var _ baseCodec = Codec(nil) +var _ baseCodec = encoding.Codec(nil) + // Codec defines the interface gRPC uses to encode and decode messages. // Note that implementations of this interface must be thread safe; // a Codec's methods can be called from concurrent goroutines. +// +// Deprecated: use encoding.Codec instead. type Codec interface { // Marshal returns the wire format of v. Marshal(v interface{}) ([]byte, error) // Unmarshal parses the wire format into v. Unmarshal(data []byte, v interface{}) error - // String returns the name of the Codec implementation. The returned - // string will be used as part of content type in transmission. + // String returns the name of the Codec implementation. This is unused by + // gRPC. String() string } - -// protoCodec is a Codec implementation with protobuf. It is the default codec for gRPC. -type protoCodec struct { -} - -type cachedProtoBuffer struct { - lastMarshaledSize uint32 - proto.Buffer -} - -func capToMaxInt32(val int) uint32 { - if val > math.MaxInt32 { - return uint32(math.MaxInt32) - } - return uint32(val) -} - -func (p protoCodec) marshal(v interface{}, cb *cachedProtoBuffer) ([]byte, error) { - protoMsg := v.(proto.Message) - newSlice := make([]byte, 0, cb.lastMarshaledSize) - - cb.SetBuf(newSlice) - cb.Reset() - if err := cb.Marshal(protoMsg); err != nil { - return nil, err - } - out := cb.Bytes() - cb.lastMarshaledSize = capToMaxInt32(len(out)) - return out, nil -} - -func (p protoCodec) Marshal(v interface{}) ([]byte, error) { - if pm, ok := v.(proto.Marshaler); ok { - // object can marshal itself, no need for buffer - return pm.Marshal() - } - - cb := protoBufferPool.Get().(*cachedProtoBuffer) - out, err := p.marshal(v, cb) - - // put back buffer and lose the ref to the slice - cb.SetBuf(nil) - protoBufferPool.Put(cb) - return out, err -} - -func (p protoCodec) Unmarshal(data []byte, v interface{}) error { - protoMsg := v.(proto.Message) - protoMsg.Reset() - - if pu, ok := protoMsg.(proto.Unmarshaler); ok { - // object can unmarshal itself, no need for buffer - return pu.Unmarshal(data) - } - - cb := protoBufferPool.Get().(*cachedProtoBuffer) - cb.SetBuf(data) - err := cb.Unmarshal(protoMsg) - cb.SetBuf(nil) - protoBufferPool.Put(cb) - return err -} - -func (protoCodec) String() string { - return "proto" -} - -var protoBufferPool = &sync.Pool{ - New: func() interface{} { - return &cachedProtoBuffer{ - Buffer: proto.Buffer{}, - lastMarshaledSize: 16, - } - }, -} diff --git a/vendor/google.golang.org/grpc/codes/codes.go b/vendor/google.golang.org/grpc/codes/codes.go index f3719d562801..d9b9d5782e08 100644 --- a/vendor/google.golang.org/grpc/codes/codes.go +++ b/vendor/google.golang.org/grpc/codes/codes.go @@ -19,8 +19,10 @@ // Package codes defines the canonical error codes used by gRPC. It is // consistent across various languages. package codes // import "google.golang.org/grpc/codes" + import ( "fmt" + "strconv" ) // A Code is an unsigned 32-bit error code as defined in the gRPC spec. @@ -33,9 +35,9 @@ const ( // Canceled indicates the operation was canceled (typically by the caller). Canceled Code = 1 - // Unknown error. An example of where this error may be returned is + // Unknown error. An example of where this error may be returned is // if a Status value received from another address space belongs to - // an error-space that is not known in this address space. Also + // an error-space that is not known in this address space. Also // errors raised by APIs that do not return enough error information // may be converted to this error. Unknown Code = 2 @@ -64,15 +66,11 @@ const ( // PermissionDenied indicates the caller does not have permission to // execute the specified operation. It must not be used for rejections // caused by exhausting some resource (use ResourceExhausted - // instead for those errors). It must not be + // instead for those errors). It must not be // used if the caller cannot be identified (use Unauthenticated // instead for those errors). PermissionDenied Code = 7 - // Unauthenticated indicates the request does not have valid - // authentication credentials for the operation. - Unauthenticated Code = 16 - // ResourceExhausted indicates some resource has been exhausted, perhaps // a per-user quota, or perhaps the entire file system is out of space. ResourceExhausted Code = 8 @@ -88,7 +86,7 @@ const ( // (b) Use Aborted if the client should retry at a higher-level // (e.g., restarting a read-modify-write sequence). // (c) Use FailedPrecondition if the client should not retry until - // the system state has been explicitly fixed. E.g., if an "rmdir" + // the system state has been explicitly fixed. E.g., if an "rmdir" // fails because the directory is non-empty, FailedPrecondition // should be returned since the client should not retry unless // they have first fixed up the directory by deleting files from it. @@ -117,7 +115,7 @@ const ( // file size. // // There is a fair bit of overlap between FailedPrecondition and - // OutOfRange. We recommend using OutOfRange (the more specific + // OutOfRange. We recommend using OutOfRange (the more specific // error) when it applies so that callers who are iterating through // a space can easily look for an OutOfRange error to detect when // they are done. @@ -127,8 +125,8 @@ const ( // supported/enabled in this service. Unimplemented Code = 12 - // Internal errors. Means some invariants expected by underlying - // system has been broken. If you see one of these errors, + // Internal errors. Means some invariants expected by underlying + // system has been broken. If you see one of these errors, // something is very broken. Internal Code = 13 @@ -142,6 +140,12 @@ const ( // DataLoss indicates unrecoverable data loss or corruption. DataLoss Code = 15 + + // Unauthenticated indicates the request does not have valid + // authentication credentials for the operation. + Unauthenticated Code = 16 + + _maxCode = 17 ) var strToCode = map[string]Code{ @@ -175,6 +179,16 @@ func (c *Code) UnmarshalJSON(b []byte) error { if c == nil { return fmt.Errorf("nil receiver passed to UnmarshalJSON") } + + if ci, err := strconv.ParseUint(string(b), 10, 32); err == nil { + if ci >= _maxCode { + return fmt.Errorf("invalid code: %q", ci) + } + + *c = Code(ci) + return nil + } + if jc, ok := strToCode[string(b)]; ok { *c = jc return nil diff --git a/vendor/google.golang.org/grpc/credentials/credentials.go b/vendor/google.golang.org/grpc/credentials/credentials.go index 3351bf0ee5f8..1dae57ab1881 100644 --- a/vendor/google.golang.org/grpc/credentials/credentials.go +++ b/vendor/google.golang.org/grpc/credentials/credentials.go @@ -31,6 +31,7 @@ import ( "net" "strings" + "github.com/golang/protobuf/proto" "golang.org/x/net/context" ) @@ -118,6 +119,18 @@ func (t TLSInfo) AuthType() string { return "tls" } +// GetChannelzSecurityValue returns security info requested by channelz. +func (t TLSInfo) GetChannelzSecurityValue() ChannelzSecurityValue { + v := &TLSChannelzSecurityValue{ + StandardName: cipherSuiteLookup[t.State.CipherSuite], + } + // Currently there's no way to get LocalCertificate info from tls package. + if len(t.State.PeerCertificates) > 0 { + v.RemoteCertificate = t.State.PeerCertificates[0].Raw + } + return v +} + // tlsCreds is the credentials required for authenticating a connection using TLS. type tlsCreds struct { // TLS configuration @@ -155,7 +168,7 @@ func (c *tlsCreds) ClientHandshake(ctx context.Context, authority string, rawCon case <-ctx.Done(): return nil, nil, ctx.Err() } - return conn, TLSInfo{conn.ConnectionState()}, nil + return tlsConn{Conn: conn, rawConn: rawConn}, TLSInfo{conn.ConnectionState()}, nil } func (c *tlsCreds) ServerHandshake(rawConn net.Conn) (net.Conn, AuthInfo, error) { @@ -163,7 +176,7 @@ func (c *tlsCreds) ServerHandshake(rawConn net.Conn) (net.Conn, AuthInfo, error) if err := conn.Handshake(); err != nil { return nil, nil, err } - return conn, TLSInfo{conn.ConnectionState()}, nil + return tlsConn{Conn: conn, rawConn: rawConn}, TLSInfo{conn.ConnectionState()}, nil } func (c *tlsCreds) Clone() TransportCredentials { @@ -218,3 +231,63 @@ func NewServerTLSFromFile(certFile, keyFile string) (TransportCredentials, error } return NewTLS(&tls.Config{Certificates: []tls.Certificate{cert}}), nil } + +// ChannelzSecurityInfo defines the interface that security protocols should implement +// in order to provide security info to channelz. +type ChannelzSecurityInfo interface { + GetSecurityValue() ChannelzSecurityValue +} + +// ChannelzSecurityValue defines the interface that GetSecurityValue() return value +// should satisfy. This interface should only be satisfied by *TLSChannelzSecurityValue +// and *OtherChannelzSecurityValue. +type ChannelzSecurityValue interface { + isChannelzSecurityValue() +} + +// TLSChannelzSecurityValue defines the struct that TLS protocol should return +// from GetSecurityValue(), containing security info like cipher and certificate used. +type TLSChannelzSecurityValue struct { + StandardName string + LocalCertificate []byte + RemoteCertificate []byte +} + +func (*TLSChannelzSecurityValue) isChannelzSecurityValue() {} + +// OtherChannelzSecurityValue defines the struct that non-TLS protocol should return +// from GetSecurityValue(), which contains protocol specific security info. Note +// the Value field will be sent to users of channelz requesting channel info, and +// thus sensitive info should better be avoided. +type OtherChannelzSecurityValue struct { + Name string + Value proto.Message +} + +func (*OtherChannelzSecurityValue) isChannelzSecurityValue() {} + +type tlsConn struct { + *tls.Conn + rawConn net.Conn +} + +var cipherSuiteLookup = map[uint16]string{ + tls.TLS_RSA_WITH_RC4_128_SHA: "TLS_RSA_WITH_RC4_128_SHA", + tls.TLS_RSA_WITH_3DES_EDE_CBC_SHA: "TLS_RSA_WITH_3DES_EDE_CBC_SHA", + tls.TLS_RSA_WITH_AES_128_CBC_SHA: "TLS_RSA_WITH_AES_128_CBC_SHA", + tls.TLS_RSA_WITH_AES_256_CBC_SHA: "TLS_RSA_WITH_AES_256_CBC_SHA", + tls.TLS_RSA_WITH_AES_128_GCM_SHA256: "TLS_RSA_WITH_AES_128_GCM_SHA256", + tls.TLS_RSA_WITH_AES_256_GCM_SHA384: "TLS_RSA_WITH_AES_256_GCM_SHA384", + tls.TLS_ECDHE_ECDSA_WITH_RC4_128_SHA: "TLS_ECDHE_ECDSA_WITH_RC4_128_SHA", + tls.TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA: "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA", + tls.TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA: "TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA", + tls.TLS_ECDHE_RSA_WITH_RC4_128_SHA: "TLS_ECDHE_RSA_WITH_RC4_128_SHA", + tls.TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA: "TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA", + tls.TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA: "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA", + tls.TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA: "TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA", + tls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256: "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256", + tls.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256: "TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256", + tls.TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384: "TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384", + tls.TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384: "TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384", + tls.TLS_FALLBACK_SCSV: "TLS_FALLBACK_SCSV", +} diff --git a/vendor/google.golang.org/grpc/credentials/credentials_util_pre_go17.go b/vendor/google.golang.org/grpc/credentials/go16.go similarity index 100% rename from vendor/google.golang.org/grpc/credentials/credentials_util_pre_go17.go rename to vendor/google.golang.org/grpc/credentials/go16.go diff --git a/vendor/google.golang.org/grpc/credentials/credentials_util_go17.go b/vendor/google.golang.org/grpc/credentials/go17.go similarity index 98% rename from vendor/google.golang.org/grpc/credentials/credentials_util_go17.go rename to vendor/google.golang.org/grpc/credentials/go17.go index 60409aac0fbc..fbd500002008 100644 --- a/vendor/google.golang.org/grpc/credentials/credentials_util_go17.go +++ b/vendor/google.golang.org/grpc/credentials/go17.go @@ -1,5 +1,4 @@ -// +build go1.7 -// +build !go1.8 +// +build go1.7,!go1.8 /* * diff --git a/vendor/google.golang.org/grpc/credentials/credentials_util_go18.go b/vendor/google.golang.org/grpc/credentials/go18.go similarity index 65% rename from vendor/google.golang.org/grpc/credentials/credentials_util_go18.go rename to vendor/google.golang.org/grpc/credentials/go18.go index 93f0e1d8de23..db30d46cc57d 100644 --- a/vendor/google.golang.org/grpc/credentials/credentials_util_go18.go +++ b/vendor/google.golang.org/grpc/credentials/go18.go @@ -24,6 +24,14 @@ import ( "crypto/tls" ) +func init() { + cipherSuiteLookup[tls.TLS_RSA_WITH_AES_128_CBC_SHA256] = "TLS_RSA_WITH_AES_128_CBC_SHA256" + cipherSuiteLookup[tls.TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256] = "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256" + cipherSuiteLookup[tls.TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256] = "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256" + cipherSuiteLookup[tls.TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305] = "TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305" + cipherSuiteLookup[tls.TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305] = "TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305" +} + // cloneTLSConfig returns a shallow clone of the exported // fields of cfg, ignoring the unexported sync.Once, which // contains a mutex and must not be copied. diff --git a/vendor/google.golang.org/grpc/credentials/go19.go b/vendor/google.golang.org/grpc/credentials/go19.go new file mode 100644 index 000000000000..2a4ca1a57d66 --- /dev/null +++ b/vendor/google.golang.org/grpc/credentials/go19.go @@ -0,0 +1,35 @@ +// +build go1.9,!appengine + +/* + * + * Copyright 2018 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package credentials + +import ( + "errors" + "syscall" +) + +// implements the syscall.Conn interface +func (c tlsConn) SyscallConn() (syscall.RawConn, error) { + conn, ok := c.rawConn.(syscall.Conn) + if !ok { + return nil, errors.New("RawConn does not implement syscall.Conn") + } + return conn.SyscallConn() +} diff --git a/vendor/google.golang.org/grpc/dialoptions.go b/vendor/google.golang.org/grpc/dialoptions.go new file mode 100644 index 000000000000..3d3c9e231dae --- /dev/null +++ b/vendor/google.golang.org/grpc/dialoptions.go @@ -0,0 +1,453 @@ +/* + * + * Copyright 2018 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package grpc + +import ( + "fmt" + "net" + "time" + + "golang.org/x/net/context" + "google.golang.org/grpc/balancer" + "google.golang.org/grpc/credentials" + "google.golang.org/grpc/internal" + "google.golang.org/grpc/internal/backoff" + "google.golang.org/grpc/internal/envconfig" + "google.golang.org/grpc/internal/transport" + "google.golang.org/grpc/keepalive" + "google.golang.org/grpc/resolver" + "google.golang.org/grpc/stats" +) + +// dialOptions configure a Dial call. dialOptions are set by the DialOption +// values passed to Dial. +type dialOptions struct { + unaryInt UnaryClientInterceptor + streamInt StreamClientInterceptor + cp Compressor + dc Decompressor + bs backoff.Strategy + block bool + insecure bool + timeout time.Duration + scChan <-chan ServiceConfig + authority string + copts transport.ConnectOptions + callOptions []CallOption + // This is used by v1 balancer dial option WithBalancer to support v1 + // balancer, and also by WithBalancerName dial option. + balancerBuilder balancer.Builder + // This is to support grpclb. + resolverBuilder resolver.Builder + waitForHandshake bool + channelzParentID int64 + disableServiceConfig bool + disableRetry bool +} + +// DialOption configures how we set up the connection. +type DialOption interface { + apply(*dialOptions) +} + +// EmptyDialOption does not alter the dial configuration. It can be embedded in +// another structure to build custom dial options. +// +// This API is EXPERIMENTAL. +type EmptyDialOption struct{} + +func (EmptyDialOption) apply(*dialOptions) {} + +// funcDialOption wraps a function that modifies dialOptions into an +// implementation of the DialOption interface. +type funcDialOption struct { + f func(*dialOptions) +} + +func (fdo *funcDialOption) apply(do *dialOptions) { + fdo.f(do) +} + +func newFuncDialOption(f func(*dialOptions)) *funcDialOption { + return &funcDialOption{ + f: f, + } +} + +// WithWaitForHandshake blocks until the initial settings frame is received from +// the server before assigning RPCs to the connection. Experimental API. +func WithWaitForHandshake() DialOption { + return newFuncDialOption(func(o *dialOptions) { + o.waitForHandshake = true + }) +} + +// WithWriteBufferSize determines how much data can be batched before doing a +// write on the wire. The corresponding memory allocation for this buffer will +// be twice the size to keep syscalls low. The default value for this buffer is +// 32KB. +// +// Zero will disable the write buffer such that each write will be on underlying +// connection. Note: A Send call may not directly translate to a write. +func WithWriteBufferSize(s int) DialOption { + return newFuncDialOption(func(o *dialOptions) { + o.copts.WriteBufferSize = s + }) +} + +// WithReadBufferSize lets you set the size of read buffer, this determines how +// much data can be read at most for each read syscall. +// +// The default value for this buffer is 32KB. Zero will disable read buffer for +// a connection so data framer can access the underlying conn directly. +func WithReadBufferSize(s int) DialOption { + return newFuncDialOption(func(o *dialOptions) { + o.copts.ReadBufferSize = s + }) +} + +// WithInitialWindowSize returns a DialOption which sets the value for initial +// window size on a stream. The lower bound for window size is 64K and any value +// smaller than that will be ignored. +func WithInitialWindowSize(s int32) DialOption { + return newFuncDialOption(func(o *dialOptions) { + o.copts.InitialWindowSize = s + }) +} + +// WithInitialConnWindowSize returns a DialOption which sets the value for +// initial window size on a connection. The lower bound for window size is 64K +// and any value smaller than that will be ignored. +func WithInitialConnWindowSize(s int32) DialOption { + return newFuncDialOption(func(o *dialOptions) { + o.copts.InitialConnWindowSize = s + }) +} + +// WithMaxMsgSize returns a DialOption which sets the maximum message size the +// client can receive. +// +// Deprecated: use WithDefaultCallOptions(MaxCallRecvMsgSize(s)) instead. +func WithMaxMsgSize(s int) DialOption { + return WithDefaultCallOptions(MaxCallRecvMsgSize(s)) +} + +// WithDefaultCallOptions returns a DialOption which sets the default +// CallOptions for calls over the connection. +func WithDefaultCallOptions(cos ...CallOption) DialOption { + return newFuncDialOption(func(o *dialOptions) { + o.callOptions = append(o.callOptions, cos...) + }) +} + +// WithCodec returns a DialOption which sets a codec for message marshaling and +// unmarshaling. +// +// Deprecated: use WithDefaultCallOptions(CallCustomCodec(c)) instead. +func WithCodec(c Codec) DialOption { + return WithDefaultCallOptions(CallCustomCodec(c)) +} + +// WithCompressor returns a DialOption which sets a Compressor to use for +// message compression. It has lower priority than the compressor set by the +// UseCompressor CallOption. +// +// Deprecated: use UseCompressor instead. +func WithCompressor(cp Compressor) DialOption { + return newFuncDialOption(func(o *dialOptions) { + o.cp = cp + }) +} + +// WithDecompressor returns a DialOption which sets a Decompressor to use for +// incoming message decompression. If incoming response messages are encoded +// using the decompressor's Type(), it will be used. Otherwise, the message +// encoding will be used to look up the compressor registered via +// encoding.RegisterCompressor, which will then be used to decompress the +// message. If no compressor is registered for the encoding, an Unimplemented +// status error will be returned. +// +// Deprecated: use encoding.RegisterCompressor instead. +func WithDecompressor(dc Decompressor) DialOption { + return newFuncDialOption(func(o *dialOptions) { + o.dc = dc + }) +} + +// WithBalancer returns a DialOption which sets a load balancer with the v1 API. +// Name resolver will be ignored if this DialOption is specified. +// +// Deprecated: use the new balancer APIs in balancer package and +// WithBalancerName. +func WithBalancer(b Balancer) DialOption { + return newFuncDialOption(func(o *dialOptions) { + o.balancerBuilder = &balancerWrapperBuilder{ + b: b, + } + }) +} + +// WithBalancerName sets the balancer that the ClientConn will be initialized +// with. Balancer registered with balancerName will be used. This function +// panics if no balancer was registered by balancerName. +// +// The balancer cannot be overridden by balancer option specified by service +// config. +// +// This is an EXPERIMENTAL API. +func WithBalancerName(balancerName string) DialOption { + builder := balancer.Get(balancerName) + if builder == nil { + panic(fmt.Sprintf("grpc.WithBalancerName: no balancer is registered for name %v", balancerName)) + } + return newFuncDialOption(func(o *dialOptions) { + o.balancerBuilder = builder + }) +} + +// withResolverBuilder is only for grpclb. +func withResolverBuilder(b resolver.Builder) DialOption { + return newFuncDialOption(func(o *dialOptions) { + o.resolverBuilder = b + }) +} + +// WithServiceConfig returns a DialOption which has a channel to read the +// service configuration. +// +// Deprecated: service config should be received through name resolver, as +// specified here. +// https://github.com/grpc/grpc/blob/master/doc/service_config.md +func WithServiceConfig(c <-chan ServiceConfig) DialOption { + return newFuncDialOption(func(o *dialOptions) { + o.scChan = c + }) +} + +// WithBackoffMaxDelay configures the dialer to use the provided maximum delay +// when backing off after failed connection attempts. +func WithBackoffMaxDelay(md time.Duration) DialOption { + return WithBackoffConfig(BackoffConfig{MaxDelay: md}) +} + +// WithBackoffConfig configures the dialer to use the provided backoff +// parameters after connection failures. +// +// Use WithBackoffMaxDelay until more parameters on BackoffConfig are opened up +// for use. +func WithBackoffConfig(b BackoffConfig) DialOption { + return withBackoff(backoff.Exponential{ + MaxDelay: b.MaxDelay, + }) +} + +// withBackoff sets the backoff strategy used for connectRetryNum after a failed +// connection attempt. +// +// This can be exported if arbitrary backoff strategies are allowed by gRPC. +func withBackoff(bs backoff.Strategy) DialOption { + return newFuncDialOption(func(o *dialOptions) { + o.bs = bs + }) +} + +// WithBlock returns a DialOption which makes caller of Dial blocks until the +// underlying connection is up. Without this, Dial returns immediately and +// connecting the server happens in background. +func WithBlock() DialOption { + return newFuncDialOption(func(o *dialOptions) { + o.block = true + }) +} + +// WithInsecure returns a DialOption which disables transport security for this +// ClientConn. Note that transport security is required unless WithInsecure is +// set. +func WithInsecure() DialOption { + return newFuncDialOption(func(o *dialOptions) { + o.insecure = true + }) +} + +// WithTransportCredentials returns a DialOption which configures a connection +// level security credentials (e.g., TLS/SSL). +func WithTransportCredentials(creds credentials.TransportCredentials) DialOption { + return newFuncDialOption(func(o *dialOptions) { + o.copts.TransportCredentials = creds + }) +} + +// WithPerRPCCredentials returns a DialOption which sets credentials and places +// auth state on each outbound RPC. +func WithPerRPCCredentials(creds credentials.PerRPCCredentials) DialOption { + return newFuncDialOption(func(o *dialOptions) { + o.copts.PerRPCCredentials = append(o.copts.PerRPCCredentials, creds) + }) +} + +// WithTimeout returns a DialOption that configures a timeout for dialing a +// ClientConn initially. This is valid if and only if WithBlock() is present. +// +// Deprecated: use DialContext and context.WithTimeout instead. +func WithTimeout(d time.Duration) DialOption { + return newFuncDialOption(func(o *dialOptions) { + o.timeout = d + }) +} + +func withContextDialer(f func(context.Context, string) (net.Conn, error)) DialOption { + return newFuncDialOption(func(o *dialOptions) { + o.copts.Dialer = f + }) +} + +func init() { + internal.WithContextDialer = withContextDialer + internal.WithResolverBuilder = withResolverBuilder +} + +// WithDialer returns a DialOption that specifies a function to use for dialing +// network addresses. If FailOnNonTempDialError() is set to true, and an error +// is returned by f, gRPC checks the error's Temporary() method to decide if it +// should try to reconnect to the network address. +func WithDialer(f func(string, time.Duration) (net.Conn, error)) DialOption { + return withContextDialer( + func(ctx context.Context, addr string) (net.Conn, error) { + if deadline, ok := ctx.Deadline(); ok { + return f(addr, deadline.Sub(time.Now())) + } + return f(addr, 0) + }) +} + +// WithStatsHandler returns a DialOption that specifies the stats handler for +// all the RPCs and underlying network connections in this ClientConn. +func WithStatsHandler(h stats.Handler) DialOption { + return newFuncDialOption(func(o *dialOptions) { + o.copts.StatsHandler = h + }) +} + +// FailOnNonTempDialError returns a DialOption that specifies if gRPC fails on +// non-temporary dial errors. If f is true, and dialer returns a non-temporary +// error, gRPC will fail the connection to the network address and won't try to +// reconnect. The default value of FailOnNonTempDialError is false. +// +// FailOnNonTempDialError only affects the initial dial, and does not do +// anything useful unless you are also using WithBlock(). +// +// This is an EXPERIMENTAL API. +func FailOnNonTempDialError(f bool) DialOption { + return newFuncDialOption(func(o *dialOptions) { + o.copts.FailOnNonTempDialError = f + }) +} + +// WithUserAgent returns a DialOption that specifies a user agent string for all +// the RPCs. +func WithUserAgent(s string) DialOption { + return newFuncDialOption(func(o *dialOptions) { + o.copts.UserAgent = s + }) +} + +// WithKeepaliveParams returns a DialOption that specifies keepalive parameters +// for the client transport. +func WithKeepaliveParams(kp keepalive.ClientParameters) DialOption { + return newFuncDialOption(func(o *dialOptions) { + o.copts.KeepaliveParams = kp + }) +} + +// WithUnaryInterceptor returns a DialOption that specifies the interceptor for +// unary RPCs. +func WithUnaryInterceptor(f UnaryClientInterceptor) DialOption { + return newFuncDialOption(func(o *dialOptions) { + o.unaryInt = f + }) +} + +// WithStreamInterceptor returns a DialOption that specifies the interceptor for +// streaming RPCs. +func WithStreamInterceptor(f StreamClientInterceptor) DialOption { + return newFuncDialOption(func(o *dialOptions) { + o.streamInt = f + }) +} + +// WithAuthority returns a DialOption that specifies the value to be used as the +// :authority pseudo-header. This value only works with WithInsecure and has no +// effect if TransportCredentials are present. +func WithAuthority(a string) DialOption { + return newFuncDialOption(func(o *dialOptions) { + o.authority = a + }) +} + +// WithChannelzParentID returns a DialOption that specifies the channelz ID of +// current ClientConn's parent. This function is used in nested channel creation +// (e.g. grpclb dial). +func WithChannelzParentID(id int64) DialOption { + return newFuncDialOption(func(o *dialOptions) { + o.channelzParentID = id + }) +} + +// WithDisableServiceConfig returns a DialOption that causes grpc to ignore any +// service config provided by the resolver and provides a hint to the resolver +// to not fetch service configs. +func WithDisableServiceConfig() DialOption { + return newFuncDialOption(func(o *dialOptions) { + o.disableServiceConfig = true + }) +} + +// WithDisableRetry returns a DialOption that disables retries, even if the +// service config enables them. This does not impact transparent retries, which +// will happen automatically if no data is written to the wire or if the RPC is +// unprocessed by the remote server. +// +// Retry support is currently disabled by default, but will be enabled by +// default in the future. Until then, it may be enabled by setting the +// environment variable "GRPC_GO_RETRY" to "on". +// +// This API is EXPERIMENTAL. +func WithDisableRetry() DialOption { + return newFuncDialOption(func(o *dialOptions) { + o.disableRetry = true + }) +} + +// WithMaxHeaderListSize returns a DialOption that specifies the maximum +// (uncompressed) size of header list that the client is prepared to accept. +func WithMaxHeaderListSize(s uint32) DialOption { + return newFuncDialOption(func(o *dialOptions) { + o.copts.MaxHeaderListSize = &s + }) +} + +func defaultDialOptions() dialOptions { + return dialOptions{ + disableRetry: !envconfig.Retry, + copts: transport.ConnectOptions{ + WriteBufferSize: defaultWriteBufSize, + ReadBufferSize: defaultReadBufSize, + }, + } +} diff --git a/vendor/google.golang.org/grpc/encoding/encoding.go b/vendor/google.golang.org/grpc/encoding/encoding.go index 47d10b07666d..ade8b7cec73a 100644 --- a/vendor/google.golang.org/grpc/encoding/encoding.go +++ b/vendor/google.golang.org/grpc/encoding/encoding.go @@ -16,46 +16,103 @@ * */ -// Package encoding defines the interface for the compressor and the functions -// to register and get the compossor. +// Package encoding defines the interface for the compressor and codec, and +// functions to register and retrieve compressors and codecs. +// // This package is EXPERIMENTAL. package encoding import ( "io" + "strings" ) -var registerCompressor = make(map[string]Compressor) +// Identity specifies the optional encoding for uncompressed streams. +// It is intended for grpc internal use only. +const Identity = "identity" -// Compressor is used for compressing and decompressing when sending or receiving messages. +// Compressor is used for compressing and decompressing when sending or +// receiving messages. type Compressor interface { - // Compress writes the data written to wc to w after compressing it. If an error - // occurs while initializing the compressor, that error is returned instead. + // Compress writes the data written to wc to w after compressing it. If an + // error occurs while initializing the compressor, that error is returned + // instead. Compress(w io.Writer) (io.WriteCloser, error) - // Decompress reads data from r, decompresses it, and provides the uncompressed data - // via the returned io.Reader. If an error occurs while initializing the decompressor, that error - // is returned instead. + // Decompress reads data from r, decompresses it, and provides the + // uncompressed data via the returned io.Reader. If an error occurs while + // initializing the decompressor, that error is returned instead. Decompress(r io.Reader) (io.Reader, error) - // Name is the name of the compression codec and is used to set the content coding header. + // Name is the name of the compression codec and is used to set the content + // coding header. The result must be static; the result cannot change + // between calls. Name() string } -// RegisterCompressor registers the compressor with gRPC by its name. It can be activated when -// sending an RPC via grpc.UseCompressor(). It will be automatically accessed when receiving a -// message based on the content coding header. Servers also use it to send a response with the -// same encoding as the request. +var registeredCompressor = make(map[string]Compressor) + +// RegisterCompressor registers the compressor with gRPC by its name. It can +// be activated when sending an RPC via grpc.UseCompressor(). It will be +// automatically accessed when receiving a message based on the content coding +// header. Servers also use it to send a response with the same encoding as +// the request. // -// NOTE: this function must only be called during initialization time (i.e. in an init() function). If -// multiple Compressors are registered with the same name, the one registered last will take effect. +// NOTE: this function must only be called during initialization time (i.e. in +// an init() function), and is not thread-safe. If multiple Compressors are +// registered with the same name, the one registered last will take effect. func RegisterCompressor(c Compressor) { - registerCompressor[c.Name()] = c + registeredCompressor[c.Name()] = c } // GetCompressor returns Compressor for the given compressor name. func GetCompressor(name string) Compressor { - return registerCompressor[name] + return registeredCompressor[name] } -// Identity specifies the optional encoding for uncompressed streams. -// It is intended for grpc internal use only. -const Identity = "identity" +// Codec defines the interface gRPC uses to encode and decode messages. Note +// that implementations of this interface must be thread safe; a Codec's +// methods can be called from concurrent goroutines. +type Codec interface { + // Marshal returns the wire format of v. + Marshal(v interface{}) ([]byte, error) + // Unmarshal parses the wire format into v. + Unmarshal(data []byte, v interface{}) error + // Name returns the name of the Codec implementation. The returned string + // will be used as part of content type in transmission. The result must be + // static; the result cannot change between calls. + Name() string +} + +var registeredCodecs = make(map[string]Codec) + +// RegisterCodec registers the provided Codec for use with all gRPC clients and +// servers. +// +// The Codec will be stored and looked up by result of its Name() method, which +// should match the content-subtype of the encoding handled by the Codec. This +// is case-insensitive, and is stored and looked up as lowercase. If the +// result of calling Name() is an empty string, RegisterCodec will panic. See +// Content-Type on +// https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md#requests for +// more details. +// +// NOTE: this function must only be called during initialization time (i.e. in +// an init() function), and is not thread-safe. If multiple Compressors are +// registered with the same name, the one registered last will take effect. +func RegisterCodec(codec Codec) { + if codec == nil { + panic("cannot register a nil Codec") + } + contentSubtype := strings.ToLower(codec.Name()) + if contentSubtype == "" { + panic("cannot register Codec with empty string result for String()") + } + registeredCodecs[contentSubtype] = codec +} + +// GetCodec gets a registered Codec by content-subtype, or nil if no Codec is +// registered for the content-subtype. +// +// The content-subtype is expected to be lowercase. +func GetCodec(contentSubtype string) Codec { + return registeredCodecs[contentSubtype] +} diff --git a/vendor/google.golang.org/grpc/encoding/proto/proto.go b/vendor/google.golang.org/grpc/encoding/proto/proto.go new file mode 100644 index 000000000000..66b97a6f692a --- /dev/null +++ b/vendor/google.golang.org/grpc/encoding/proto/proto.go @@ -0,0 +1,110 @@ +/* + * + * Copyright 2018 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +// Package proto defines the protobuf codec. Importing this package will +// register the codec. +package proto + +import ( + "math" + "sync" + + "github.com/golang/protobuf/proto" + "google.golang.org/grpc/encoding" +) + +// Name is the name registered for the proto compressor. +const Name = "proto" + +func init() { + encoding.RegisterCodec(codec{}) +} + +// codec is a Codec implementation with protobuf. It is the default codec for gRPC. +type codec struct{} + +type cachedProtoBuffer struct { + lastMarshaledSize uint32 + proto.Buffer +} + +func capToMaxInt32(val int) uint32 { + if val > math.MaxInt32 { + return uint32(math.MaxInt32) + } + return uint32(val) +} + +func marshal(v interface{}, cb *cachedProtoBuffer) ([]byte, error) { + protoMsg := v.(proto.Message) + newSlice := make([]byte, 0, cb.lastMarshaledSize) + + cb.SetBuf(newSlice) + cb.Reset() + if err := cb.Marshal(protoMsg); err != nil { + return nil, err + } + out := cb.Bytes() + cb.lastMarshaledSize = capToMaxInt32(len(out)) + return out, nil +} + +func (codec) Marshal(v interface{}) ([]byte, error) { + if pm, ok := v.(proto.Marshaler); ok { + // object can marshal itself, no need for buffer + return pm.Marshal() + } + + cb := protoBufferPool.Get().(*cachedProtoBuffer) + out, err := marshal(v, cb) + + // put back buffer and lose the ref to the slice + cb.SetBuf(nil) + protoBufferPool.Put(cb) + return out, err +} + +func (codec) Unmarshal(data []byte, v interface{}) error { + protoMsg := v.(proto.Message) + protoMsg.Reset() + + if pu, ok := protoMsg.(proto.Unmarshaler); ok { + // object can unmarshal itself, no need for buffer + return pu.Unmarshal(data) + } + + cb := protoBufferPool.Get().(*cachedProtoBuffer) + cb.SetBuf(data) + err := cb.Unmarshal(protoMsg) + cb.SetBuf(nil) + protoBufferPool.Put(cb) + return err +} + +func (codec) Name() string { + return Name +} + +var protoBufferPool = &sync.Pool{ + New: func() interface{} { + return &cachedProtoBuffer{ + Buffer: proto.Buffer{}, + lastMarshaledSize: 16, + } + }, +} diff --git a/vendor/google.golang.org/grpc/go.mod b/vendor/google.golang.org/grpc/go.mod new file mode 100644 index 000000000000..1d16f5d4d0d7 --- /dev/null +++ b/vendor/google.golang.org/grpc/go.mod @@ -0,0 +1,21 @@ +module google.golang.org/grpc + +require ( + cloud.google.com/go v0.26.0 // indirect + github.com/client9/misspell v0.3.4 + github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b + github.com/golang/lint v0.0.0-20180702182130-06c8688daad7 + github.com/golang/mock v1.1.1 + github.com/golang/protobuf v1.2.0 + github.com/kisielk/gotool v1.0.0 // indirect + golang.org/x/lint v0.0.0-20180702182130-06c8688daad7 // indirect + golang.org/x/net v0.0.0-20180826012351-8a410e7b638d + golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be + golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f // indirect + golang.org/x/sys v0.0.0-20180830151530-49385e6e1522 + golang.org/x/text v0.3.0 // indirect + golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52 + google.golang.org/appengine v1.1.0 // indirect + google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8 + honnef.co/go/tools v0.0.0-20180728063816-88497007e858 +) diff --git a/vendor/google.golang.org/grpc/go.sum b/vendor/google.golang.org/grpc/go.sum new file mode 100644 index 000000000000..6b70e58e5812 --- /dev/null +++ b/vendor/google.golang.org/grpc/go.sum @@ -0,0 +1,34 @@ +cloud.google.com/go v0.26.0 h1:e0WKqKTd5BnrG8aKH3J3h+QvEIQtSUcf2n5UZ5ZgLtQ= +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +github.com/client9/misspell v0.3.4 h1:ta993UF76GwbvJcIo3Y68y/M3WxlpEHPWIGDkJYwzJI= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/lint v0.0.0-20180702182130-06c8688daad7 h1:2hRPrmiwPrp3fQX967rNJIhQPtiGXdlQWAxKbKw3VHA= +github.com/golang/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:tluoj9z5200jBnyusfRPU2LqT6J+DAorxEvtC7LHB+E= +github.com/golang/mock v1.1.1 h1:G5FRp8JnTd7RQH5kemVNlMeyXQAztQ3mOWV95KxsXH8= +github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/kisielk/gotool v1.0.0 h1:AV2c/EiW3KqPNT9ZKl07ehoAGi4C5/01Cfbblndcapg= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +golang.org/x/lint v0.0.0-20180702182130-06c8688daad7 h1:00BeQWmeaGazuOrq8Q5K5d3/cHaGuFrZzpaHBXfrsUA= +golang.org/x/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/net v0.0.0-20180826012351-8a410e7b638d h1:g9qWBGx4puODJTMVyoPrpoxPFgVGd+z1DZwjfRu4d0I= +golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be h1:vEDujvNQGv4jgYKudGeI/+DAX4Jffq6hpD55MmoEvKs= +golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f h1:wMNYb4v58l5UBM7MYRLPG6ZhfOqbKu7X5eyFl8ZhKvA= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180830151530-49385e6e1522 h1:Ve1ORMCxvRmSXBwJK+t3Oy+V2vRW2OetUQBq4rJIkZE= +golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52 h1:JG/0uqcGdTNgq7FdU+61l5Pdmb8putNZlXb65bJBROs= +golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +google.golang.org/appengine v1.1.0 h1:igQkv0AAhEIvTEpD5LIpAfav2eeVO9HBTjvKHVJPRSs= +google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8 h1:Nw54tB0rB7hY/N0NQvRW8DG4Yk3Q6T9cu9RcFQDu1tc= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +honnef.co/go/tools v0.0.0-20180728063816-88497007e858 h1:wN+eVZ7U+gqdqkec6C6VXR1OFf9a5Ul9ETzeYsYv20g= +honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/vendor/google.golang.org/grpc/go16.go b/vendor/google.golang.org/grpc/go16.go index f3dbf21700fd..b1db21af6f4d 100644 --- a/vendor/google.golang.org/grpc/go16.go +++ b/vendor/google.golang.org/grpc/go16.go @@ -25,12 +25,11 @@ import ( "io" "net" "net/http" - "os" "golang.org/x/net/context" "google.golang.org/grpc/codes" + "google.golang.org/grpc/internal/transport" "google.golang.org/grpc/status" - "google.golang.org/grpc/transport" ) // dialContext connects to the address on the named network. @@ -48,12 +47,16 @@ func sendHTTPRequest(ctx context.Context, req *http.Request, conn net.Conn) erro // toRPCErr converts an error into an error from the status package. func toRPCErr(err error) error { + if err == nil || err == io.EOF { + return err + } + if err == io.ErrUnexpectedEOF { + return status.Error(codes.Internal, err.Error()) + } if _, ok := status.FromError(err); ok { return err } switch e := err.(type) { - case transport.StreamError: - return status.Error(e.Code, e.Desc) case transport.ConnectionError: return status.Error(codes.Unavailable, e.Desc) default: @@ -62,37 +65,7 @@ func toRPCErr(err error) error { return status.Error(codes.DeadlineExceeded, err.Error()) case context.Canceled: return status.Error(codes.Canceled, err.Error()) - case ErrClientConnClosing: - return status.Error(codes.FailedPrecondition, err.Error()) } } return status.Error(codes.Unknown, err.Error()) } - -// convertCode converts a standard Go error into its canonical code. Note that -// this is only used to translate the error returned by the server applications. -func convertCode(err error) codes.Code { - switch err { - case nil: - return codes.OK - case io.EOF: - return codes.OutOfRange - case io.ErrClosedPipe, io.ErrNoProgress, io.ErrShortBuffer, io.ErrShortWrite, io.ErrUnexpectedEOF: - return codes.FailedPrecondition - case os.ErrInvalid: - return codes.InvalidArgument - case context.Canceled: - return codes.Canceled - case context.DeadlineExceeded: - return codes.DeadlineExceeded - } - switch { - case os.IsExist(err): - return codes.AlreadyExists - case os.IsNotExist(err): - return codes.NotFound - case os.IsPermission(err): - return codes.PermissionDenied - } - return codes.Unknown -} diff --git a/vendor/google.golang.org/grpc/go17.go b/vendor/google.golang.org/grpc/go17.go index de23098eb9a1..71a72e8fe15e 100644 --- a/vendor/google.golang.org/grpc/go17.go +++ b/vendor/google.golang.org/grpc/go17.go @@ -26,12 +26,11 @@ import ( "io" "net" "net/http" - "os" netctx "golang.org/x/net/context" "google.golang.org/grpc/codes" + "google.golang.org/grpc/internal/transport" "google.golang.org/grpc/status" - "google.golang.org/grpc/transport" ) // dialContext connects to the address on the named network. @@ -49,12 +48,16 @@ func sendHTTPRequest(ctx context.Context, req *http.Request, conn net.Conn) erro // toRPCErr converts an error into an error from the status package. func toRPCErr(err error) error { + if err == nil || err == io.EOF { + return err + } + if err == io.ErrUnexpectedEOF { + return status.Error(codes.Internal, err.Error()) + } if _, ok := status.FromError(err); ok { return err } switch e := err.(type) { - case transport.StreamError: - return status.Error(e.Code, e.Desc) case transport.ConnectionError: return status.Error(codes.Unavailable, e.Desc) default: @@ -63,37 +66,7 @@ func toRPCErr(err error) error { return status.Error(codes.DeadlineExceeded, err.Error()) case context.Canceled, netctx.Canceled: return status.Error(codes.Canceled, err.Error()) - case ErrClientConnClosing: - return status.Error(codes.FailedPrecondition, err.Error()) } } return status.Error(codes.Unknown, err.Error()) } - -// convertCode converts a standard Go error into its canonical code. Note that -// this is only used to translate the error returned by the server applications. -func convertCode(err error) codes.Code { - switch err { - case nil: - return codes.OK - case io.EOF: - return codes.OutOfRange - case io.ErrClosedPipe, io.ErrNoProgress, io.ErrShortBuffer, io.ErrShortWrite, io.ErrUnexpectedEOF: - return codes.FailedPrecondition - case os.ErrInvalid: - return codes.InvalidArgument - case context.Canceled, netctx.Canceled: - return codes.Canceled - case context.DeadlineExceeded, netctx.DeadlineExceeded: - return codes.DeadlineExceeded - } - switch { - case os.IsExist(err): - return codes.AlreadyExists - case os.IsNotExist(err): - return codes.NotFound - case os.IsPermission(err): - return codes.PermissionDenied - } - return codes.Unknown -} diff --git a/vendor/google.golang.org/grpc/grpclb.go b/vendor/google.golang.org/grpc/grpclb.go deleted file mode 100644 index d14a5d4090f2..000000000000 --- a/vendor/google.golang.org/grpc/grpclb.go +++ /dev/null @@ -1,342 +0,0 @@ -/* - * - * Copyright 2016 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package grpc - -import ( - "strconv" - "strings" - "sync" - "time" - - "golang.org/x/net/context" - "google.golang.org/grpc/balancer" - "google.golang.org/grpc/connectivity" - lbpb "google.golang.org/grpc/grpclb/grpc_lb_v1/messages" - "google.golang.org/grpc/grpclog" - "google.golang.org/grpc/resolver" -) - -const ( - lbTokeyKey = "lb-token" - defaultFallbackTimeout = 10 * time.Second - grpclbName = "grpclb" -) - -func convertDuration(d *lbpb.Duration) time.Duration { - if d == nil { - return 0 - } - return time.Duration(d.Seconds)*time.Second + time.Duration(d.Nanos)*time.Nanosecond -} - -// Client API for LoadBalancer service. -// Mostly copied from generated pb.go file. -// To avoid circular dependency. -type loadBalancerClient struct { - cc *ClientConn -} - -func (c *loadBalancerClient) BalanceLoad(ctx context.Context, opts ...CallOption) (*balanceLoadClientStream, error) { - desc := &StreamDesc{ - StreamName: "BalanceLoad", - ServerStreams: true, - ClientStreams: true, - } - stream, err := NewClientStream(ctx, desc, c.cc, "/grpc.lb.v1.LoadBalancer/BalanceLoad", opts...) - if err != nil { - return nil, err - } - x := &balanceLoadClientStream{stream} - return x, nil -} - -type balanceLoadClientStream struct { - ClientStream -} - -func (x *balanceLoadClientStream) Send(m *lbpb.LoadBalanceRequest) error { - return x.ClientStream.SendMsg(m) -} - -func (x *balanceLoadClientStream) Recv() (*lbpb.LoadBalanceResponse, error) { - m := new(lbpb.LoadBalanceResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func init() { - balancer.Register(newLBBuilder()) -} - -// newLBBuilder creates a builder for grpclb. -func newLBBuilder() balancer.Builder { - return NewLBBuilderWithFallbackTimeout(defaultFallbackTimeout) -} - -// NewLBBuilderWithFallbackTimeout creates a grpclb builder with the given -// fallbackTimeout. If no response is received from the remote balancer within -// fallbackTimeout, the backend addresses from the resolved address list will be -// used. -// -// Only call this function when a non-default fallback timeout is needed. -func NewLBBuilderWithFallbackTimeout(fallbackTimeout time.Duration) balancer.Builder { - return &lbBuilder{ - fallbackTimeout: fallbackTimeout, - } -} - -type lbBuilder struct { - fallbackTimeout time.Duration -} - -func (b *lbBuilder) Name() string { - return grpclbName -} - -func (b *lbBuilder) Build(cc balancer.ClientConn, opt balancer.BuildOptions) balancer.Balancer { - // This generates a manual resolver builder with a random scheme. This - // scheme will be used to dial to remote LB, so we can send filtered address - // updates to remote LB ClientConn using this manual resolver. - scheme := "grpclb_internal_" + strconv.FormatInt(time.Now().UnixNano(), 36) - r := &lbManualResolver{scheme: scheme, ccb: cc} - - var target string - targetSplitted := strings.Split(cc.Target(), ":///") - if len(targetSplitted) < 2 { - target = cc.Target() - } else { - target = targetSplitted[1] - } - - lb := &lbBalancer{ - cc: cc, - target: target, - opt: opt, - fallbackTimeout: b.fallbackTimeout, - doneCh: make(chan struct{}), - - manualResolver: r, - csEvltr: &connectivityStateEvaluator{}, - subConns: make(map[resolver.Address]balancer.SubConn), - scStates: make(map[balancer.SubConn]connectivity.State), - picker: &errPicker{err: balancer.ErrNoSubConnAvailable}, - clientStats: &rpcStats{}, - } - - return lb -} - -type lbBalancer struct { - cc balancer.ClientConn - target string - opt balancer.BuildOptions - fallbackTimeout time.Duration - doneCh chan struct{} - - // manualResolver is used in the remote LB ClientConn inside grpclb. When - // resolved address updates are received by grpclb, filtered updates will be - // send to remote LB ClientConn through this resolver. - manualResolver *lbManualResolver - // The ClientConn to talk to the remote balancer. - ccRemoteLB *ClientConn - - // Support client side load reporting. Each picker gets a reference to this, - // and will update its content. - clientStats *rpcStats - - mu sync.Mutex // guards everything following. - // The full server list including drops, used to check if the newly received - // serverList contains anything new. Each generate picker will also have - // reference to this list to do the first layer pick. - fullServerList []*lbpb.Server - // All backends addresses, with metadata set to nil. This list contains all - // backend addresses in the same order and with the same duplicates as in - // serverlist. When generating picker, a SubConn slice with the same order - // but with only READY SCs will be gerenated. - backendAddrs []resolver.Address - // Roundrobin functionalities. - csEvltr *connectivityStateEvaluator - state connectivity.State - subConns map[resolver.Address]balancer.SubConn // Used to new/remove SubConn. - scStates map[balancer.SubConn]connectivity.State // Used to filter READY SubConns. - picker balancer.Picker - // Support fallback to resolved backend addresses if there's no response - // from remote balancer within fallbackTimeout. - fallbackTimerExpired bool - serverListReceived bool - // resolvedBackendAddrs is resolvedAddrs minus remote balancers. It's set - // when resolved address updates are received, and read in the goroutine - // handling fallback. - resolvedBackendAddrs []resolver.Address -} - -// regeneratePicker takes a snapshot of the balancer, and generates a picker from -// it. The picker -// - always returns ErrTransientFailure if the balancer is in TransientFailure, -// - does two layer roundrobin pick otherwise. -// Caller must hold lb.mu. -func (lb *lbBalancer) regeneratePicker() { - if lb.state == connectivity.TransientFailure { - lb.picker = &errPicker{err: balancer.ErrTransientFailure} - return - } - var readySCs []balancer.SubConn - for _, a := range lb.backendAddrs { - if sc, ok := lb.subConns[a]; ok { - if st, ok := lb.scStates[sc]; ok && st == connectivity.Ready { - readySCs = append(readySCs, sc) - } - } - } - - if len(lb.fullServerList) <= 0 { - if len(readySCs) <= 0 { - lb.picker = &errPicker{err: balancer.ErrNoSubConnAvailable} - return - } - lb.picker = &rrPicker{subConns: readySCs} - return - } - lb.picker = &lbPicker{ - serverList: lb.fullServerList, - subConns: readySCs, - stats: lb.clientStats, - } - return -} - -func (lb *lbBalancer) HandleSubConnStateChange(sc balancer.SubConn, s connectivity.State) { - grpclog.Infof("lbBalancer: handle SubConn state change: %p, %v", sc, s) - lb.mu.Lock() - defer lb.mu.Unlock() - - oldS, ok := lb.scStates[sc] - if !ok { - grpclog.Infof("lbBalancer: got state changes for an unknown SubConn: %p, %v", sc, s) - return - } - lb.scStates[sc] = s - switch s { - case connectivity.Idle: - sc.Connect() - case connectivity.Shutdown: - // When an address was removed by resolver, b called RemoveSubConn but - // kept the sc's state in scStates. Remove state for this sc here. - delete(lb.scStates, sc) - } - - oldAggrState := lb.state - lb.state = lb.csEvltr.recordTransition(oldS, s) - - // Regenerate picker when one of the following happens: - // - this sc became ready from not-ready - // - this sc became not-ready from ready - // - the aggregated state of balancer became TransientFailure from non-TransientFailure - // - the aggregated state of balancer became non-TransientFailure from TransientFailure - if (oldS == connectivity.Ready) != (s == connectivity.Ready) || - (lb.state == connectivity.TransientFailure) != (oldAggrState == connectivity.TransientFailure) { - lb.regeneratePicker() - } - - lb.cc.UpdateBalancerState(lb.state, lb.picker) - return -} - -// fallbackToBackendsAfter blocks for fallbackTimeout and falls back to use -// resolved backends (backends received from resolver, not from remote balancer) -// if no connection to remote balancers was successful. -func (lb *lbBalancer) fallbackToBackendsAfter(fallbackTimeout time.Duration) { - timer := time.NewTimer(fallbackTimeout) - defer timer.Stop() - select { - case <-timer.C: - case <-lb.doneCh: - return - } - lb.mu.Lock() - if lb.serverListReceived { - lb.mu.Unlock() - return - } - lb.fallbackTimerExpired = true - lb.refreshSubConns(lb.resolvedBackendAddrs) - lb.mu.Unlock() -} - -// HandleResolvedAddrs sends the updated remoteLB addresses to remoteLB -// clientConn. The remoteLB clientConn will handle creating/removing remoteLB -// connections. -func (lb *lbBalancer) HandleResolvedAddrs(addrs []resolver.Address, err error) { - grpclog.Infof("lbBalancer: handleResolvedResult: %+v", addrs) - if len(addrs) <= 0 { - return - } - - var remoteBalancerAddrs, backendAddrs []resolver.Address - for _, a := range addrs { - if a.Type == resolver.GRPCLB { - remoteBalancerAddrs = append(remoteBalancerAddrs, a) - } else { - backendAddrs = append(backendAddrs, a) - } - } - - if lb.ccRemoteLB == nil { - if len(remoteBalancerAddrs) <= 0 { - grpclog.Errorf("grpclb: no remote balancer address is available, should never happen") - return - } - // First time receiving resolved addresses, create a cc to remote - // balancers. - lb.dialRemoteLB(remoteBalancerAddrs[0].ServerName) - // Start the fallback goroutine. - go lb.fallbackToBackendsAfter(lb.fallbackTimeout) - } - - // cc to remote balancers uses lb.manualResolver. Send the updated remote - // balancer addresses to it through manualResolver. - lb.manualResolver.NewAddress(remoteBalancerAddrs) - - lb.mu.Lock() - lb.resolvedBackendAddrs = backendAddrs - // If serverListReceived is true, connection to remote balancer was - // successful and there's no need to do fallback anymore. - // If fallbackTimerExpired is false, fallback hasn't happened yet. - if !lb.serverListReceived && lb.fallbackTimerExpired { - // This means we received a new list of resolved backends, and we are - // still in fallback mode. Need to update the list of backends we are - // using to the new list of backends. - lb.refreshSubConns(lb.resolvedBackendAddrs) - } - lb.mu.Unlock() -} - -func (lb *lbBalancer) Close() { - select { - case <-lb.doneCh: - return - default: - } - close(lb.doneCh) - if lb.ccRemoteLB != nil { - lb.ccRemoteLB.Close() - } -} diff --git a/vendor/google.golang.org/grpc/grpclb/grpc_lb_v1/messages/messages.pb.go b/vendor/google.golang.org/grpc/grpclb/grpc_lb_v1/messages/messages.pb.go deleted file mode 100644 index f4a27125a4fb..000000000000 --- a/vendor/google.golang.org/grpc/grpclb/grpc_lb_v1/messages/messages.pb.go +++ /dev/null @@ -1,615 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: grpc_lb_v1/messages/messages.proto - -/* -Package messages is a generated protocol buffer package. - -It is generated from these files: - grpc_lb_v1/messages/messages.proto - -It has these top-level messages: - Duration - Timestamp - LoadBalanceRequest - InitialLoadBalanceRequest - ClientStats - LoadBalanceResponse - InitialLoadBalanceResponse - ServerList - Server -*/ -package messages - -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package - -type Duration struct { - // Signed seconds of the span of time. Must be from -315,576,000,000 - // to +315,576,000,000 inclusive. - Seconds int64 `protobuf:"varint,1,opt,name=seconds" json:"seconds,omitempty"` - // Signed fractions of a second at nanosecond resolution of the span - // of time. Durations less than one second are represented with a 0 - // `seconds` field and a positive or negative `nanos` field. For durations - // of one second or more, a non-zero value for the `nanos` field must be - // of the same sign as the `seconds` field. Must be from -999,999,999 - // to +999,999,999 inclusive. - Nanos int32 `protobuf:"varint,2,opt,name=nanos" json:"nanos,omitempty"` -} - -func (m *Duration) Reset() { *m = Duration{} } -func (m *Duration) String() string { return proto.CompactTextString(m) } -func (*Duration) ProtoMessage() {} -func (*Duration) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } - -func (m *Duration) GetSeconds() int64 { - if m != nil { - return m.Seconds - } - return 0 -} - -func (m *Duration) GetNanos() int32 { - if m != nil { - return m.Nanos - } - return 0 -} - -type Timestamp struct { - // Represents seconds of UTC time since Unix epoch - // 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to - // 9999-12-31T23:59:59Z inclusive. - Seconds int64 `protobuf:"varint,1,opt,name=seconds" json:"seconds,omitempty"` - // Non-negative fractions of a second at nanosecond resolution. Negative - // second values with fractions must still have non-negative nanos values - // that count forward in time. Must be from 0 to 999,999,999 - // inclusive. - Nanos int32 `protobuf:"varint,2,opt,name=nanos" json:"nanos,omitempty"` -} - -func (m *Timestamp) Reset() { *m = Timestamp{} } -func (m *Timestamp) String() string { return proto.CompactTextString(m) } -func (*Timestamp) ProtoMessage() {} -func (*Timestamp) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} } - -func (m *Timestamp) GetSeconds() int64 { - if m != nil { - return m.Seconds - } - return 0 -} - -func (m *Timestamp) GetNanos() int32 { - if m != nil { - return m.Nanos - } - return 0 -} - -type LoadBalanceRequest struct { - // Types that are valid to be assigned to LoadBalanceRequestType: - // *LoadBalanceRequest_InitialRequest - // *LoadBalanceRequest_ClientStats - LoadBalanceRequestType isLoadBalanceRequest_LoadBalanceRequestType `protobuf_oneof:"load_balance_request_type"` -} - -func (m *LoadBalanceRequest) Reset() { *m = LoadBalanceRequest{} } -func (m *LoadBalanceRequest) String() string { return proto.CompactTextString(m) } -func (*LoadBalanceRequest) ProtoMessage() {} -func (*LoadBalanceRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} } - -type isLoadBalanceRequest_LoadBalanceRequestType interface { - isLoadBalanceRequest_LoadBalanceRequestType() -} - -type LoadBalanceRequest_InitialRequest struct { - InitialRequest *InitialLoadBalanceRequest `protobuf:"bytes,1,opt,name=initial_request,json=initialRequest,oneof"` -} -type LoadBalanceRequest_ClientStats struct { - ClientStats *ClientStats `protobuf:"bytes,2,opt,name=client_stats,json=clientStats,oneof"` -} - -func (*LoadBalanceRequest_InitialRequest) isLoadBalanceRequest_LoadBalanceRequestType() {} -func (*LoadBalanceRequest_ClientStats) isLoadBalanceRequest_LoadBalanceRequestType() {} - -func (m *LoadBalanceRequest) GetLoadBalanceRequestType() isLoadBalanceRequest_LoadBalanceRequestType { - if m != nil { - return m.LoadBalanceRequestType - } - return nil -} - -func (m *LoadBalanceRequest) GetInitialRequest() *InitialLoadBalanceRequest { - if x, ok := m.GetLoadBalanceRequestType().(*LoadBalanceRequest_InitialRequest); ok { - return x.InitialRequest - } - return nil -} - -func (m *LoadBalanceRequest) GetClientStats() *ClientStats { - if x, ok := m.GetLoadBalanceRequestType().(*LoadBalanceRequest_ClientStats); ok { - return x.ClientStats - } - return nil -} - -// XXX_OneofFuncs is for the internal use of the proto package. -func (*LoadBalanceRequest) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { - return _LoadBalanceRequest_OneofMarshaler, _LoadBalanceRequest_OneofUnmarshaler, _LoadBalanceRequest_OneofSizer, []interface{}{ - (*LoadBalanceRequest_InitialRequest)(nil), - (*LoadBalanceRequest_ClientStats)(nil), - } -} - -func _LoadBalanceRequest_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { - m := msg.(*LoadBalanceRequest) - // load_balance_request_type - switch x := m.LoadBalanceRequestType.(type) { - case *LoadBalanceRequest_InitialRequest: - b.EncodeVarint(1<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.InitialRequest); err != nil { - return err - } - case *LoadBalanceRequest_ClientStats: - b.EncodeVarint(2<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.ClientStats); err != nil { - return err - } - case nil: - default: - return fmt.Errorf("LoadBalanceRequest.LoadBalanceRequestType has unexpected type %T", x) - } - return nil -} - -func _LoadBalanceRequest_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { - m := msg.(*LoadBalanceRequest) - switch tag { - case 1: // load_balance_request_type.initial_request - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(InitialLoadBalanceRequest) - err := b.DecodeMessage(msg) - m.LoadBalanceRequestType = &LoadBalanceRequest_InitialRequest{msg} - return true, err - case 2: // load_balance_request_type.client_stats - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(ClientStats) - err := b.DecodeMessage(msg) - m.LoadBalanceRequestType = &LoadBalanceRequest_ClientStats{msg} - return true, err - default: - return false, nil - } -} - -func _LoadBalanceRequest_OneofSizer(msg proto.Message) (n int) { - m := msg.(*LoadBalanceRequest) - // load_balance_request_type - switch x := m.LoadBalanceRequestType.(type) { - case *LoadBalanceRequest_InitialRequest: - s := proto.Size(x.InitialRequest) - n += proto.SizeVarint(1<<3 | proto.WireBytes) - n += proto.SizeVarint(uint64(s)) - n += s - case *LoadBalanceRequest_ClientStats: - s := proto.Size(x.ClientStats) - n += proto.SizeVarint(2<<3 | proto.WireBytes) - n += proto.SizeVarint(uint64(s)) - n += s - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - return n -} - -type InitialLoadBalanceRequest struct { - // Name of load balanced service (IE, balancer.service.com) - // length should be less than 256 bytes. - Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` -} - -func (m *InitialLoadBalanceRequest) Reset() { *m = InitialLoadBalanceRequest{} } -func (m *InitialLoadBalanceRequest) String() string { return proto.CompactTextString(m) } -func (*InitialLoadBalanceRequest) ProtoMessage() {} -func (*InitialLoadBalanceRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} } - -func (m *InitialLoadBalanceRequest) GetName() string { - if m != nil { - return m.Name - } - return "" -} - -// Contains client level statistics that are useful to load balancing. Each -// count except the timestamp should be reset to zero after reporting the stats. -type ClientStats struct { - // The timestamp of generating the report. - Timestamp *Timestamp `protobuf:"bytes,1,opt,name=timestamp" json:"timestamp,omitempty"` - // The total number of RPCs that started. - NumCallsStarted int64 `protobuf:"varint,2,opt,name=num_calls_started,json=numCallsStarted" json:"num_calls_started,omitempty"` - // The total number of RPCs that finished. - NumCallsFinished int64 `protobuf:"varint,3,opt,name=num_calls_finished,json=numCallsFinished" json:"num_calls_finished,omitempty"` - // The total number of RPCs that were dropped by the client because of rate - // limiting. - NumCallsFinishedWithDropForRateLimiting int64 `protobuf:"varint,4,opt,name=num_calls_finished_with_drop_for_rate_limiting,json=numCallsFinishedWithDropForRateLimiting" json:"num_calls_finished_with_drop_for_rate_limiting,omitempty"` - // The total number of RPCs that were dropped by the client because of load - // balancing. - NumCallsFinishedWithDropForLoadBalancing int64 `protobuf:"varint,5,opt,name=num_calls_finished_with_drop_for_load_balancing,json=numCallsFinishedWithDropForLoadBalancing" json:"num_calls_finished_with_drop_for_load_balancing,omitempty"` - // The total number of RPCs that failed to reach a server except dropped RPCs. - NumCallsFinishedWithClientFailedToSend int64 `protobuf:"varint,6,opt,name=num_calls_finished_with_client_failed_to_send,json=numCallsFinishedWithClientFailedToSend" json:"num_calls_finished_with_client_failed_to_send,omitempty"` - // The total number of RPCs that finished and are known to have been received - // by a server. - NumCallsFinishedKnownReceived int64 `protobuf:"varint,7,opt,name=num_calls_finished_known_received,json=numCallsFinishedKnownReceived" json:"num_calls_finished_known_received,omitempty"` -} - -func (m *ClientStats) Reset() { *m = ClientStats{} } -func (m *ClientStats) String() string { return proto.CompactTextString(m) } -func (*ClientStats) ProtoMessage() {} -func (*ClientStats) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4} } - -func (m *ClientStats) GetTimestamp() *Timestamp { - if m != nil { - return m.Timestamp - } - return nil -} - -func (m *ClientStats) GetNumCallsStarted() int64 { - if m != nil { - return m.NumCallsStarted - } - return 0 -} - -func (m *ClientStats) GetNumCallsFinished() int64 { - if m != nil { - return m.NumCallsFinished - } - return 0 -} - -func (m *ClientStats) GetNumCallsFinishedWithDropForRateLimiting() int64 { - if m != nil { - return m.NumCallsFinishedWithDropForRateLimiting - } - return 0 -} - -func (m *ClientStats) GetNumCallsFinishedWithDropForLoadBalancing() int64 { - if m != nil { - return m.NumCallsFinishedWithDropForLoadBalancing - } - return 0 -} - -func (m *ClientStats) GetNumCallsFinishedWithClientFailedToSend() int64 { - if m != nil { - return m.NumCallsFinishedWithClientFailedToSend - } - return 0 -} - -func (m *ClientStats) GetNumCallsFinishedKnownReceived() int64 { - if m != nil { - return m.NumCallsFinishedKnownReceived - } - return 0 -} - -type LoadBalanceResponse struct { - // Types that are valid to be assigned to LoadBalanceResponseType: - // *LoadBalanceResponse_InitialResponse - // *LoadBalanceResponse_ServerList - LoadBalanceResponseType isLoadBalanceResponse_LoadBalanceResponseType `protobuf_oneof:"load_balance_response_type"` -} - -func (m *LoadBalanceResponse) Reset() { *m = LoadBalanceResponse{} } -func (m *LoadBalanceResponse) String() string { return proto.CompactTextString(m) } -func (*LoadBalanceResponse) ProtoMessage() {} -func (*LoadBalanceResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{5} } - -type isLoadBalanceResponse_LoadBalanceResponseType interface { - isLoadBalanceResponse_LoadBalanceResponseType() -} - -type LoadBalanceResponse_InitialResponse struct { - InitialResponse *InitialLoadBalanceResponse `protobuf:"bytes,1,opt,name=initial_response,json=initialResponse,oneof"` -} -type LoadBalanceResponse_ServerList struct { - ServerList *ServerList `protobuf:"bytes,2,opt,name=server_list,json=serverList,oneof"` -} - -func (*LoadBalanceResponse_InitialResponse) isLoadBalanceResponse_LoadBalanceResponseType() {} -func (*LoadBalanceResponse_ServerList) isLoadBalanceResponse_LoadBalanceResponseType() {} - -func (m *LoadBalanceResponse) GetLoadBalanceResponseType() isLoadBalanceResponse_LoadBalanceResponseType { - if m != nil { - return m.LoadBalanceResponseType - } - return nil -} - -func (m *LoadBalanceResponse) GetInitialResponse() *InitialLoadBalanceResponse { - if x, ok := m.GetLoadBalanceResponseType().(*LoadBalanceResponse_InitialResponse); ok { - return x.InitialResponse - } - return nil -} - -func (m *LoadBalanceResponse) GetServerList() *ServerList { - if x, ok := m.GetLoadBalanceResponseType().(*LoadBalanceResponse_ServerList); ok { - return x.ServerList - } - return nil -} - -// XXX_OneofFuncs is for the internal use of the proto package. -func (*LoadBalanceResponse) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { - return _LoadBalanceResponse_OneofMarshaler, _LoadBalanceResponse_OneofUnmarshaler, _LoadBalanceResponse_OneofSizer, []interface{}{ - (*LoadBalanceResponse_InitialResponse)(nil), - (*LoadBalanceResponse_ServerList)(nil), - } -} - -func _LoadBalanceResponse_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { - m := msg.(*LoadBalanceResponse) - // load_balance_response_type - switch x := m.LoadBalanceResponseType.(type) { - case *LoadBalanceResponse_InitialResponse: - b.EncodeVarint(1<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.InitialResponse); err != nil { - return err - } - case *LoadBalanceResponse_ServerList: - b.EncodeVarint(2<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.ServerList); err != nil { - return err - } - case nil: - default: - return fmt.Errorf("LoadBalanceResponse.LoadBalanceResponseType has unexpected type %T", x) - } - return nil -} - -func _LoadBalanceResponse_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { - m := msg.(*LoadBalanceResponse) - switch tag { - case 1: // load_balance_response_type.initial_response - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(InitialLoadBalanceResponse) - err := b.DecodeMessage(msg) - m.LoadBalanceResponseType = &LoadBalanceResponse_InitialResponse{msg} - return true, err - case 2: // load_balance_response_type.server_list - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(ServerList) - err := b.DecodeMessage(msg) - m.LoadBalanceResponseType = &LoadBalanceResponse_ServerList{msg} - return true, err - default: - return false, nil - } -} - -func _LoadBalanceResponse_OneofSizer(msg proto.Message) (n int) { - m := msg.(*LoadBalanceResponse) - // load_balance_response_type - switch x := m.LoadBalanceResponseType.(type) { - case *LoadBalanceResponse_InitialResponse: - s := proto.Size(x.InitialResponse) - n += proto.SizeVarint(1<<3 | proto.WireBytes) - n += proto.SizeVarint(uint64(s)) - n += s - case *LoadBalanceResponse_ServerList: - s := proto.Size(x.ServerList) - n += proto.SizeVarint(2<<3 | proto.WireBytes) - n += proto.SizeVarint(uint64(s)) - n += s - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - return n -} - -type InitialLoadBalanceResponse struct { - // This is an application layer redirect that indicates the client should use - // the specified server for load balancing. When this field is non-empty in - // the response, the client should open a separate connection to the - // load_balancer_delegate and call the BalanceLoad method. Its length should - // be less than 64 bytes. - LoadBalancerDelegate string `protobuf:"bytes,1,opt,name=load_balancer_delegate,json=loadBalancerDelegate" json:"load_balancer_delegate,omitempty"` - // This interval defines how often the client should send the client stats - // to the load balancer. Stats should only be reported when the duration is - // positive. - ClientStatsReportInterval *Duration `protobuf:"bytes,2,opt,name=client_stats_report_interval,json=clientStatsReportInterval" json:"client_stats_report_interval,omitempty"` -} - -func (m *InitialLoadBalanceResponse) Reset() { *m = InitialLoadBalanceResponse{} } -func (m *InitialLoadBalanceResponse) String() string { return proto.CompactTextString(m) } -func (*InitialLoadBalanceResponse) ProtoMessage() {} -func (*InitialLoadBalanceResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{6} } - -func (m *InitialLoadBalanceResponse) GetLoadBalancerDelegate() string { - if m != nil { - return m.LoadBalancerDelegate - } - return "" -} - -func (m *InitialLoadBalanceResponse) GetClientStatsReportInterval() *Duration { - if m != nil { - return m.ClientStatsReportInterval - } - return nil -} - -type ServerList struct { - // Contains a list of servers selected by the load balancer. The list will - // be updated when server resolutions change or as needed to balance load - // across more servers. The client should consume the server list in order - // unless instructed otherwise via the client_config. - Servers []*Server `protobuf:"bytes,1,rep,name=servers" json:"servers,omitempty"` -} - -func (m *ServerList) Reset() { *m = ServerList{} } -func (m *ServerList) String() string { return proto.CompactTextString(m) } -func (*ServerList) ProtoMessage() {} -func (*ServerList) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{7} } - -func (m *ServerList) GetServers() []*Server { - if m != nil { - return m.Servers - } - return nil -} - -// Contains server information. When none of the [drop_for_*] fields are true, -// use the other fields. When drop_for_rate_limiting is true, ignore all other -// fields. Use drop_for_load_balancing only when it is true and -// drop_for_rate_limiting is false. -type Server struct { - // A resolved address for the server, serialized in network-byte-order. It may - // either be an IPv4 or IPv6 address. - IpAddress []byte `protobuf:"bytes,1,opt,name=ip_address,json=ipAddress,proto3" json:"ip_address,omitempty"` - // A resolved port number for the server. - Port int32 `protobuf:"varint,2,opt,name=port" json:"port,omitempty"` - // An opaque but printable token given to the frontend for each pick. All - // frontend requests for that pick must include the token in its initial - // metadata. The token is used by the backend to verify the request and to - // allow the backend to report load to the gRPC LB system. - // - // Its length is variable but less than 50 bytes. - LoadBalanceToken string `protobuf:"bytes,3,opt,name=load_balance_token,json=loadBalanceToken" json:"load_balance_token,omitempty"` - // Indicates whether this particular request should be dropped by the client - // for rate limiting. - DropForRateLimiting bool `protobuf:"varint,4,opt,name=drop_for_rate_limiting,json=dropForRateLimiting" json:"drop_for_rate_limiting,omitempty"` - // Indicates whether this particular request should be dropped by the client - // for load balancing. - DropForLoadBalancing bool `protobuf:"varint,5,opt,name=drop_for_load_balancing,json=dropForLoadBalancing" json:"drop_for_load_balancing,omitempty"` -} - -func (m *Server) Reset() { *m = Server{} } -func (m *Server) String() string { return proto.CompactTextString(m) } -func (*Server) ProtoMessage() {} -func (*Server) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{8} } - -func (m *Server) GetIpAddress() []byte { - if m != nil { - return m.IpAddress - } - return nil -} - -func (m *Server) GetPort() int32 { - if m != nil { - return m.Port - } - return 0 -} - -func (m *Server) GetLoadBalanceToken() string { - if m != nil { - return m.LoadBalanceToken - } - return "" -} - -func (m *Server) GetDropForRateLimiting() bool { - if m != nil { - return m.DropForRateLimiting - } - return false -} - -func (m *Server) GetDropForLoadBalancing() bool { - if m != nil { - return m.DropForLoadBalancing - } - return false -} - -func init() { - proto.RegisterType((*Duration)(nil), "grpc.lb.v1.Duration") - proto.RegisterType((*Timestamp)(nil), "grpc.lb.v1.Timestamp") - proto.RegisterType((*LoadBalanceRequest)(nil), "grpc.lb.v1.LoadBalanceRequest") - proto.RegisterType((*InitialLoadBalanceRequest)(nil), "grpc.lb.v1.InitialLoadBalanceRequest") - proto.RegisterType((*ClientStats)(nil), "grpc.lb.v1.ClientStats") - proto.RegisterType((*LoadBalanceResponse)(nil), "grpc.lb.v1.LoadBalanceResponse") - proto.RegisterType((*InitialLoadBalanceResponse)(nil), "grpc.lb.v1.InitialLoadBalanceResponse") - proto.RegisterType((*ServerList)(nil), "grpc.lb.v1.ServerList") - proto.RegisterType((*Server)(nil), "grpc.lb.v1.Server") -} - -func init() { proto.RegisterFile("grpc_lb_v1/messages/messages.proto", fileDescriptor0) } - -var fileDescriptor0 = []byte{ - // 709 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x55, 0xdd, 0x4e, 0x1b, 0x3b, - 0x10, 0x26, 0x27, 0x01, 0x92, 0x09, 0x3a, 0xe4, 0x98, 0x1c, 0x08, 0x14, 0x24, 0xba, 0x52, 0x69, - 0x54, 0xd1, 0x20, 0xa0, 0xbd, 0xe8, 0xcf, 0x45, 0x1b, 0x10, 0x0a, 0x2d, 0x17, 0x95, 0x43, 0x55, - 0xa9, 0x52, 0x65, 0x39, 0xd9, 0x21, 0x58, 0x6c, 0xec, 0xad, 0xed, 0x04, 0xf5, 0x11, 0xfa, 0x28, - 0x7d, 0x8c, 0xaa, 0xcf, 0xd0, 0xf7, 0xa9, 0xd6, 0xbb, 0x9b, 0x5d, 0x20, 0x80, 0x7a, 0x67, 0x8f, - 0xbf, 0xf9, 0xbe, 0xf1, 0xac, 0xbf, 0x59, 0xf0, 0x06, 0x3a, 0xec, 0xb3, 0xa0, 0xc7, 0xc6, 0xbb, - 0x3b, 0x43, 0x34, 0x86, 0x0f, 0xd0, 0x4c, 0x16, 0xad, 0x50, 0x2b, 0xab, 0x08, 0x44, 0x98, 0x56, - 0xd0, 0x6b, 0x8d, 0x77, 0xbd, 0x97, 0x50, 0x3e, 0x1c, 0x69, 0x6e, 0x85, 0x92, 0xa4, 0x01, 0xf3, - 0x06, 0xfb, 0x4a, 0xfa, 0xa6, 0x51, 0xd8, 0x2c, 0x34, 0x8b, 0x34, 0xdd, 0x92, 0x3a, 0xcc, 0x4a, - 0x2e, 0x95, 0x69, 0xfc, 0xb3, 0x59, 0x68, 0xce, 0xd2, 0x78, 0xe3, 0xbd, 0x82, 0xca, 0xa9, 0x18, - 0xa2, 0xb1, 0x7c, 0x18, 0xfe, 0x75, 0xf2, 0xcf, 0x02, 0x90, 0x13, 0xc5, 0xfd, 0x36, 0x0f, 0xb8, - 0xec, 0x23, 0xc5, 0xaf, 0x23, 0x34, 0x96, 0x7c, 0x80, 0x45, 0x21, 0x85, 0x15, 0x3c, 0x60, 0x3a, - 0x0e, 0x39, 0xba, 0xea, 0xde, 0xa3, 0x56, 0x56, 0x75, 0xeb, 0x38, 0x86, 0xdc, 0xcc, 0xef, 0xcc, - 0xd0, 0x7f, 0x93, 0xfc, 0x94, 0xf1, 0x35, 0x2c, 0xf4, 0x03, 0x81, 0xd2, 0x32, 0x63, 0xb9, 0x8d, - 0xab, 0xa8, 0xee, 0xad, 0xe4, 0xe9, 0x0e, 0xdc, 0x79, 0x37, 0x3a, 0xee, 0xcc, 0xd0, 0x6a, 0x3f, - 0xdb, 0xb6, 0x1f, 0xc0, 0x6a, 0xa0, 0xb8, 0xcf, 0x7a, 0xb1, 0x4c, 0x5a, 0x14, 0xb3, 0xdf, 0x42, - 0xf4, 0x76, 0x60, 0xf5, 0xd6, 0x4a, 0x08, 0x81, 0x92, 0xe4, 0x43, 0x74, 0xe5, 0x57, 0xa8, 0x5b, - 0x7b, 0xdf, 0x4b, 0x50, 0xcd, 0x89, 0x91, 0x7d, 0xa8, 0xd8, 0xb4, 0x83, 0xc9, 0x3d, 0xff, 0xcf, - 0x17, 0x36, 0x69, 0x2f, 0xcd, 0x70, 0xe4, 0x09, 0xfc, 0x27, 0x47, 0x43, 0xd6, 0xe7, 0x41, 0x60, - 0xa2, 0x3b, 0x69, 0x8b, 0xbe, 0xbb, 0x55, 0x91, 0x2e, 0xca, 0xd1, 0xf0, 0x20, 0x8a, 0x77, 0xe3, - 0x30, 0xd9, 0x06, 0x92, 0x61, 0xcf, 0x84, 0x14, 0xe6, 0x1c, 0xfd, 0x46, 0xd1, 0x81, 0x6b, 0x29, - 0xf8, 0x28, 0x89, 0x13, 0x06, 0xad, 0x9b, 0x68, 0x76, 0x29, 0xec, 0x39, 0xf3, 0xb5, 0x0a, 0xd9, - 0x99, 0xd2, 0x4c, 0x73, 0x8b, 0x2c, 0x10, 0x43, 0x61, 0x85, 0x1c, 0x34, 0x4a, 0x8e, 0xe9, 0xf1, - 0x75, 0xa6, 0x4f, 0xc2, 0x9e, 0x1f, 0x6a, 0x15, 0x1e, 0x29, 0x4d, 0xb9, 0xc5, 0x93, 0x04, 0x4e, - 0x38, 0xec, 0xdc, 0x2b, 0x90, 0x6b, 0x77, 0xa4, 0x30, 0xeb, 0x14, 0x9a, 0x77, 0x28, 0x64, 0xbd, - 0x8f, 0x24, 0xbe, 0xc0, 0xd3, 0xdb, 0x24, 0x92, 0x67, 0x70, 0xc6, 0x45, 0x80, 0x3e, 0xb3, 0x8a, - 0x19, 0x94, 0x7e, 0x63, 0xce, 0x09, 0x6c, 0x4d, 0x13, 0x88, 0x3f, 0xd5, 0x91, 0xc3, 0x9f, 0xaa, - 0x2e, 0x4a, 0x9f, 0x74, 0xe0, 0xe1, 0x14, 0xfa, 0x0b, 0xa9, 0x2e, 0x25, 0xd3, 0xd8, 0x47, 0x31, - 0x46, 0xbf, 0x31, 0xef, 0x28, 0x37, 0xae, 0x53, 0xbe, 0x8f, 0x50, 0x34, 0x01, 0x79, 0xbf, 0x0a, - 0xb0, 0x74, 0xe5, 0xd9, 0x98, 0x50, 0x49, 0x83, 0xa4, 0x0b, 0xb5, 0xcc, 0x01, 0x71, 0x2c, 0x79, - 0x1a, 0x5b, 0xf7, 0x59, 0x20, 0x46, 0x77, 0x66, 0xe8, 0xe2, 0xc4, 0x03, 0x09, 0xe9, 0x0b, 0xa8, - 0x1a, 0xd4, 0x63, 0xd4, 0x2c, 0x10, 0xc6, 0x26, 0x1e, 0x58, 0xce, 0xf3, 0x75, 0xdd, 0xf1, 0x89, - 0x70, 0x1e, 0x02, 0x33, 0xd9, 0xb5, 0xd7, 0x61, 0xed, 0x9a, 0x03, 0x62, 0xce, 0xd8, 0x02, 0x3f, - 0x0a, 0xb0, 0x76, 0x7b, 0x29, 0xe4, 0x19, 0x2c, 0xe7, 0x93, 0x35, 0xf3, 0x31, 0xc0, 0x01, 0xb7, - 0xa9, 0x2d, 0xea, 0x41, 0x96, 0xa4, 0x0f, 0x93, 0x33, 0xf2, 0x11, 0xd6, 0xf3, 0x96, 0x65, 0x1a, - 0x43, 0xa5, 0x2d, 0x13, 0xd2, 0xa2, 0x1e, 0xf3, 0x20, 0x29, 0xbf, 0x9e, 0x2f, 0x3f, 0x1d, 0x62, - 0x74, 0x35, 0xe7, 0x5e, 0xea, 0xf2, 0x8e, 0x93, 0x34, 0xef, 0x0d, 0x40, 0x76, 0x4b, 0xb2, 0x1d, - 0x0d, 0xac, 0x68, 0x17, 0x0d, 0xac, 0x62, 0xb3, 0xba, 0x47, 0x6e, 0xb6, 0x83, 0xa6, 0x90, 0x77, - 0xa5, 0x72, 0xb1, 0x56, 0xf2, 0x7e, 0x17, 0x60, 0x2e, 0x3e, 0x21, 0x1b, 0x00, 0x22, 0x64, 0xdc, - 0xf7, 0x35, 0x9a, 0x78, 0xe4, 0x2d, 0xd0, 0x8a, 0x08, 0xdf, 0xc6, 0x81, 0xc8, 0xfd, 0x91, 0x76, - 0x32, 0xf3, 0xdc, 0x3a, 0x32, 0xe3, 0x95, 0x4e, 0x5a, 0x75, 0x81, 0xd2, 0x99, 0xb1, 0x42, 0x6b, - 0xb9, 0x46, 0x9c, 0x46, 0x71, 0xb2, 0x0f, 0xcb, 0x77, 0x98, 0xae, 0x4c, 0x97, 0xfc, 0x29, 0x06, - 0x7b, 0x0e, 0x2b, 0x77, 0x19, 0xa9, 0x4c, 0xeb, 0xfe, 0x14, 0xd3, 0xb4, 0xe1, 0x73, 0x39, 0xfd, - 0x47, 0xf4, 0xe6, 0xdc, 0x4f, 0x62, 0xff, 0x4f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xa3, 0x36, 0x86, - 0xa6, 0x4a, 0x06, 0x00, 0x00, -} diff --git a/vendor/google.golang.org/grpc/grpclb/grpc_lb_v1/messages/messages.proto b/vendor/google.golang.org/grpc/grpclb/grpc_lb_v1/messages/messages.proto deleted file mode 100644 index 42d99c109fe6..000000000000 --- a/vendor/google.golang.org/grpc/grpclb/grpc_lb_v1/messages/messages.proto +++ /dev/null @@ -1,155 +0,0 @@ -// Copyright 2016 gRPC authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package grpc.lb.v1; -option go_package = "google.golang.org/grpc/grpclb/grpc_lb_v1/messages"; - -message Duration { - // Signed seconds of the span of time. Must be from -315,576,000,000 - // to +315,576,000,000 inclusive. - int64 seconds = 1; - - // Signed fractions of a second at nanosecond resolution of the span - // of time. Durations less than one second are represented with a 0 - // `seconds` field and a positive or negative `nanos` field. For durations - // of one second or more, a non-zero value for the `nanos` field must be - // of the same sign as the `seconds` field. Must be from -999,999,999 - // to +999,999,999 inclusive. - int32 nanos = 2; -} - -message Timestamp { - // Represents seconds of UTC time since Unix epoch - // 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to - // 9999-12-31T23:59:59Z inclusive. - int64 seconds = 1; - - // Non-negative fractions of a second at nanosecond resolution. Negative - // second values with fractions must still have non-negative nanos values - // that count forward in time. Must be from 0 to 999,999,999 - // inclusive. - int32 nanos = 2; -} - -message LoadBalanceRequest { - oneof load_balance_request_type { - // This message should be sent on the first request to the load balancer. - InitialLoadBalanceRequest initial_request = 1; - - // The client stats should be periodically reported to the load balancer - // based on the duration defined in the InitialLoadBalanceResponse. - ClientStats client_stats = 2; - } -} - -message InitialLoadBalanceRequest { - // Name of load balanced service (IE, balancer.service.com) - // length should be less than 256 bytes. - string name = 1; -} - -// Contains client level statistics that are useful to load balancing. Each -// count except the timestamp should be reset to zero after reporting the stats. -message ClientStats { - // The timestamp of generating the report. - Timestamp timestamp = 1; - - // The total number of RPCs that started. - int64 num_calls_started = 2; - - // The total number of RPCs that finished. - int64 num_calls_finished = 3; - - // The total number of RPCs that were dropped by the client because of rate - // limiting. - int64 num_calls_finished_with_drop_for_rate_limiting = 4; - - // The total number of RPCs that were dropped by the client because of load - // balancing. - int64 num_calls_finished_with_drop_for_load_balancing = 5; - - // The total number of RPCs that failed to reach a server except dropped RPCs. - int64 num_calls_finished_with_client_failed_to_send = 6; - - // The total number of RPCs that finished and are known to have been received - // by a server. - int64 num_calls_finished_known_received = 7; -} - -message LoadBalanceResponse { - oneof load_balance_response_type { - // This message should be sent on the first response to the client. - InitialLoadBalanceResponse initial_response = 1; - - // Contains the list of servers selected by the load balancer. The client - // should send requests to these servers in the specified order. - ServerList server_list = 2; - } -} - -message InitialLoadBalanceResponse { - // This is an application layer redirect that indicates the client should use - // the specified server for load balancing. When this field is non-empty in - // the response, the client should open a separate connection to the - // load_balancer_delegate and call the BalanceLoad method. Its length should - // be less than 64 bytes. - string load_balancer_delegate = 1; - - // This interval defines how often the client should send the client stats - // to the load balancer. Stats should only be reported when the duration is - // positive. - Duration client_stats_report_interval = 2; -} - -message ServerList { - // Contains a list of servers selected by the load balancer. The list will - // be updated when server resolutions change or as needed to balance load - // across more servers. The client should consume the server list in order - // unless instructed otherwise via the client_config. - repeated Server servers = 1; - - // Was google.protobuf.Duration expiration_interval. - reserved 3; -} - -// Contains server information. When none of the [drop_for_*] fields are true, -// use the other fields. When drop_for_rate_limiting is true, ignore all other -// fields. Use drop_for_load_balancing only when it is true and -// drop_for_rate_limiting is false. -message Server { - // A resolved address for the server, serialized in network-byte-order. It may - // either be an IPv4 or IPv6 address. - bytes ip_address = 1; - - // A resolved port number for the server. - int32 port = 2; - - // An opaque but printable token given to the frontend for each pick. All - // frontend requests for that pick must include the token in its initial - // metadata. The token is used by the backend to verify the request and to - // allow the backend to report load to the gRPC LB system. - // - // Its length is variable but less than 50 bytes. - string load_balance_token = 3; - - // Indicates whether this particular request should be dropped by the client - // for rate limiting. - bool drop_for_rate_limiting = 4; - - // Indicates whether this particular request should be dropped by the client - // for load balancing. - bool drop_for_load_balancing = 5; -} diff --git a/vendor/google.golang.org/grpc/grpclb_picker.go b/vendor/google.golang.org/grpc/grpclb_picker.go deleted file mode 100644 index 872c7ccea0e8..000000000000 --- a/vendor/google.golang.org/grpc/grpclb_picker.go +++ /dev/null @@ -1,159 +0,0 @@ -/* - * - * Copyright 2017 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package grpc - -import ( - "sync" - "sync/atomic" - - "golang.org/x/net/context" - "google.golang.org/grpc/balancer" - "google.golang.org/grpc/codes" - lbpb "google.golang.org/grpc/grpclb/grpc_lb_v1/messages" - "google.golang.org/grpc/status" -) - -type rpcStats struct { - NumCallsStarted int64 - NumCallsFinished int64 - NumCallsFinishedWithDropForRateLimiting int64 - NumCallsFinishedWithDropForLoadBalancing int64 - NumCallsFinishedWithClientFailedToSend int64 - NumCallsFinishedKnownReceived int64 -} - -// toClientStats converts rpcStats to lbpb.ClientStats, and clears rpcStats. -func (s *rpcStats) toClientStats() *lbpb.ClientStats { - stats := &lbpb.ClientStats{ - NumCallsStarted: atomic.SwapInt64(&s.NumCallsStarted, 0), - NumCallsFinished: atomic.SwapInt64(&s.NumCallsFinished, 0), - NumCallsFinishedWithDropForRateLimiting: atomic.SwapInt64(&s.NumCallsFinishedWithDropForRateLimiting, 0), - NumCallsFinishedWithDropForLoadBalancing: atomic.SwapInt64(&s.NumCallsFinishedWithDropForLoadBalancing, 0), - NumCallsFinishedWithClientFailedToSend: atomic.SwapInt64(&s.NumCallsFinishedWithClientFailedToSend, 0), - NumCallsFinishedKnownReceived: atomic.SwapInt64(&s.NumCallsFinishedKnownReceived, 0), - } - return stats -} - -func (s *rpcStats) dropForRateLimiting() { - atomic.AddInt64(&s.NumCallsStarted, 1) - atomic.AddInt64(&s.NumCallsFinishedWithDropForRateLimiting, 1) - atomic.AddInt64(&s.NumCallsFinished, 1) -} - -func (s *rpcStats) dropForLoadBalancing() { - atomic.AddInt64(&s.NumCallsStarted, 1) - atomic.AddInt64(&s.NumCallsFinishedWithDropForLoadBalancing, 1) - atomic.AddInt64(&s.NumCallsFinished, 1) -} - -func (s *rpcStats) failedToSend() { - atomic.AddInt64(&s.NumCallsStarted, 1) - atomic.AddInt64(&s.NumCallsFinishedWithClientFailedToSend, 1) - atomic.AddInt64(&s.NumCallsFinished, 1) -} - -func (s *rpcStats) knownReceived() { - atomic.AddInt64(&s.NumCallsStarted, 1) - atomic.AddInt64(&s.NumCallsFinishedKnownReceived, 1) - atomic.AddInt64(&s.NumCallsFinished, 1) -} - -type errPicker struct { - // Pick always returns this err. - err error -} - -func (p *errPicker) Pick(ctx context.Context, opts balancer.PickOptions) (balancer.SubConn, func(balancer.DoneInfo), error) { - return nil, nil, p.err -} - -// rrPicker does roundrobin on subConns. It's typically used when there's no -// response from remote balancer, and grpclb falls back to the resolved -// backends. -// -// It guaranteed that len(subConns) > 0. -type rrPicker struct { - mu sync.Mutex - subConns []balancer.SubConn // The subConns that were READY when taking the snapshot. - subConnsNext int -} - -func (p *rrPicker) Pick(ctx context.Context, opts balancer.PickOptions) (balancer.SubConn, func(balancer.DoneInfo), error) { - p.mu.Lock() - defer p.mu.Unlock() - sc := p.subConns[p.subConnsNext] - p.subConnsNext = (p.subConnsNext + 1) % len(p.subConns) - return sc, nil, nil -} - -// lbPicker does two layers of picks: -// -// First layer: roundrobin on all servers in serverList, including drops and backends. -// - If it picks a drop, the RPC will fail as being dropped. -// - If it picks a backend, do a second layer pick to pick the real backend. -// -// Second layer: roundrobin on all READY backends. -// -// It's guaranteed that len(serverList) > 0. -type lbPicker struct { - mu sync.Mutex - serverList []*lbpb.Server - serverListNext int - subConns []balancer.SubConn // The subConns that were READY when taking the snapshot. - subConnsNext int - - stats *rpcStats -} - -func (p *lbPicker) Pick(ctx context.Context, opts balancer.PickOptions) (balancer.SubConn, func(balancer.DoneInfo), error) { - p.mu.Lock() - defer p.mu.Unlock() - - // Layer one roundrobin on serverList. - s := p.serverList[p.serverListNext] - p.serverListNext = (p.serverListNext + 1) % len(p.serverList) - - // If it's a drop, return an error and fail the RPC. - if s.DropForRateLimiting { - p.stats.dropForRateLimiting() - return nil, nil, status.Errorf(codes.Unavailable, "request dropped by grpclb") - } - if s.DropForLoadBalancing { - p.stats.dropForLoadBalancing() - return nil, nil, status.Errorf(codes.Unavailable, "request dropped by grpclb") - } - - // If not a drop but there's no ready subConns. - if len(p.subConns) <= 0 { - return nil, nil, balancer.ErrNoSubConnAvailable - } - - // Return the next ready subConn in the list, also collect rpc stats. - sc := p.subConns[p.subConnsNext] - p.subConnsNext = (p.subConnsNext + 1) % len(p.subConns) - done := func(info balancer.DoneInfo) { - if !info.BytesSent { - p.stats.failedToSend() - } else if info.BytesReceived { - p.stats.knownReceived() - } - } - return sc, done, nil -} diff --git a/vendor/google.golang.org/grpc/grpclb_remote_balancer.go b/vendor/google.golang.org/grpc/grpclb_remote_balancer.go deleted file mode 100644 index 1b580df26dd1..000000000000 --- a/vendor/google.golang.org/grpc/grpclb_remote_balancer.go +++ /dev/null @@ -1,254 +0,0 @@ -/* - * - * Copyright 2017 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package grpc - -import ( - "fmt" - "net" - "reflect" - "time" - - "golang.org/x/net/context" - "google.golang.org/grpc/balancer" - "google.golang.org/grpc/connectivity" - lbpb "google.golang.org/grpc/grpclb/grpc_lb_v1/messages" - "google.golang.org/grpc/grpclog" - "google.golang.org/grpc/metadata" - "google.golang.org/grpc/resolver" -) - -// processServerList updates balaner's internal state, create/remove SubConns -// and regenerates picker using the received serverList. -func (lb *lbBalancer) processServerList(l *lbpb.ServerList) { - grpclog.Infof("lbBalancer: processing server list: %+v", l) - lb.mu.Lock() - defer lb.mu.Unlock() - - // Set serverListReceived to true so fallback will not take effect if it has - // not hit timeout. - lb.serverListReceived = true - - // If the new server list == old server list, do nothing. - if reflect.DeepEqual(lb.fullServerList, l.Servers) { - grpclog.Infof("lbBalancer: new serverlist same as the previous one, ignoring") - return - } - lb.fullServerList = l.Servers - - var backendAddrs []resolver.Address - for _, s := range l.Servers { - if s.DropForLoadBalancing || s.DropForRateLimiting { - continue - } - - md := metadata.Pairs(lbTokeyKey, s.LoadBalanceToken) - ip := net.IP(s.IpAddress) - ipStr := ip.String() - if ip.To4() == nil { - // Add square brackets to ipv6 addresses, otherwise net.Dial() and - // net.SplitHostPort() will return too many colons error. - ipStr = fmt.Sprintf("[%s]", ipStr) - } - addr := resolver.Address{ - Addr: fmt.Sprintf("%s:%d", ipStr, s.Port), - Metadata: &md, - } - - backendAddrs = append(backendAddrs, addr) - } - - // Call refreshSubConns to create/remove SubConns. - backendsUpdated := lb.refreshSubConns(backendAddrs) - // If no backend was updated, no SubConn will be newed/removed. But since - // the full serverList was different, there might be updates in drops or - // pick weights(different number of duplicates). We need to update picker - // with the fulllist. - if !backendsUpdated { - lb.regeneratePicker() - lb.cc.UpdateBalancerState(lb.state, lb.picker) - } -} - -// refreshSubConns creates/removes SubConns with backendAddrs. It returns a bool -// indicating whether the backendAddrs are different from the cached -// backendAddrs (whether any SubConn was newed/removed). -// Caller must hold lb.mu. -func (lb *lbBalancer) refreshSubConns(backendAddrs []resolver.Address) bool { - lb.backendAddrs = nil - var backendsUpdated bool - // addrsSet is the set converted from backendAddrs, it's used to quick - // lookup for an address. - addrsSet := make(map[resolver.Address]struct{}) - // Create new SubConns. - for _, addr := range backendAddrs { - addrWithoutMD := addr - addrWithoutMD.Metadata = nil - addrsSet[addrWithoutMD] = struct{}{} - lb.backendAddrs = append(lb.backendAddrs, addrWithoutMD) - - if _, ok := lb.subConns[addrWithoutMD]; !ok { - backendsUpdated = true - - // Use addrWithMD to create the SubConn. - sc, err := lb.cc.NewSubConn([]resolver.Address{addr}, balancer.NewSubConnOptions{}) - if err != nil { - grpclog.Warningf("roundrobinBalancer: failed to create new SubConn: %v", err) - continue - } - lb.subConns[addrWithoutMD] = sc // Use the addr without MD as key for the map. - lb.scStates[sc] = connectivity.Idle - sc.Connect() - } - } - - for a, sc := range lb.subConns { - // a was removed by resolver. - if _, ok := addrsSet[a]; !ok { - backendsUpdated = true - - lb.cc.RemoveSubConn(sc) - delete(lb.subConns, a) - // Keep the state of this sc in b.scStates until sc's state becomes Shutdown. - // The entry will be deleted in HandleSubConnStateChange. - } - } - - return backendsUpdated -} - -func (lb *lbBalancer) readServerList(s *balanceLoadClientStream) error { - for { - reply, err := s.Recv() - if err != nil { - return fmt.Errorf("grpclb: failed to recv server list: %v", err) - } - if serverList := reply.GetServerList(); serverList != nil { - lb.processServerList(serverList) - } - } -} - -func (lb *lbBalancer) sendLoadReport(s *balanceLoadClientStream, interval time.Duration) { - ticker := time.NewTicker(interval) - defer ticker.Stop() - for { - select { - case <-ticker.C: - case <-s.Context().Done(): - return - } - stats := lb.clientStats.toClientStats() - t := time.Now() - stats.Timestamp = &lbpb.Timestamp{ - Seconds: t.Unix(), - Nanos: int32(t.Nanosecond()), - } - if err := s.Send(&lbpb.LoadBalanceRequest{ - LoadBalanceRequestType: &lbpb.LoadBalanceRequest_ClientStats{ - ClientStats: stats, - }, - }); err != nil { - return - } - } -} -func (lb *lbBalancer) callRemoteBalancer() error { - lbClient := &loadBalancerClient{cc: lb.ccRemoteLB} - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() - stream, err := lbClient.BalanceLoad(ctx, FailFast(false)) - if err != nil { - return fmt.Errorf("grpclb: failed to perform RPC to the remote balancer %v", err) - } - - // grpclb handshake on the stream. - initReq := &lbpb.LoadBalanceRequest{ - LoadBalanceRequestType: &lbpb.LoadBalanceRequest_InitialRequest{ - InitialRequest: &lbpb.InitialLoadBalanceRequest{ - Name: lb.target, - }, - }, - } - if err := stream.Send(initReq); err != nil { - return fmt.Errorf("grpclb: failed to send init request: %v", err) - } - reply, err := stream.Recv() - if err != nil { - return fmt.Errorf("grpclb: failed to recv init response: %v", err) - } - initResp := reply.GetInitialResponse() - if initResp == nil { - return fmt.Errorf("grpclb: reply from remote balancer did not include initial response") - } - if initResp.LoadBalancerDelegate != "" { - return fmt.Errorf("grpclb: Delegation is not supported") - } - - go func() { - if d := convertDuration(initResp.ClientStatsReportInterval); d > 0 { - lb.sendLoadReport(stream, d) - } - }() - return lb.readServerList(stream) -} - -func (lb *lbBalancer) watchRemoteBalancer() { - for { - err := lb.callRemoteBalancer() - select { - case <-lb.doneCh: - return - default: - if err != nil { - grpclog.Error(err) - } - } - - } -} - -func (lb *lbBalancer) dialRemoteLB(remoteLBName string) { - var dopts []DialOption - if creds := lb.opt.DialCreds; creds != nil { - if err := creds.OverrideServerName(remoteLBName); err == nil { - dopts = append(dopts, WithTransportCredentials(creds)) - } else { - grpclog.Warningf("grpclb: failed to override the server name in the credentials: %v, using Insecure", err) - dopts = append(dopts, WithInsecure()) - } - } else { - dopts = append(dopts, WithInsecure()) - } - if lb.opt.Dialer != nil { - // WithDialer takes a different type of function, so we instead use a - // special DialOption here. - dopts = append(dopts, withContextDialer(lb.opt.Dialer)) - } - // Explicitly set pickfirst as the balancer. - dopts = append(dopts, WithBalancerName(PickFirstBalancerName)) - dopts = append(dopts, withResolverBuilder(lb.manualResolver)) - // Dial using manualResolver.Scheme, which is a random scheme generated - // when init grpclb. The target name is not important. - cc, err := Dial("grpclb:///grpclb.server", dopts...) - if err != nil { - grpclog.Fatalf("failed to dial: %v", err) - } - lb.ccRemoteLB = cc - go lb.watchRemoteBalancer() -} diff --git a/vendor/google.golang.org/grpc/grpclb_util.go b/vendor/google.golang.org/grpc/grpclb_util.go deleted file mode 100644 index 93ab2db3234b..000000000000 --- a/vendor/google.golang.org/grpc/grpclb_util.go +++ /dev/null @@ -1,90 +0,0 @@ -/* - * - * Copyright 2016 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package grpc - -import ( - "google.golang.org/grpc/balancer" - "google.golang.org/grpc/resolver" -) - -// The parent ClientConn should re-resolve when grpclb loses connection to the -// remote balancer. When the ClientConn inside grpclb gets a TransientFailure, -// it calls lbManualResolver.ResolveNow(), which calls parent ClientConn's -// ResolveNow, and eventually results in re-resolve happening in parent -// ClientConn's resolver (DNS for example). -// -// parent -// ClientConn -// +-----------------------------------------------------------------+ -// | parent +---------------------------------+ | -// | DNS ClientConn | grpclb | | -// | resolver balancerWrapper | | | -// | + + | grpclb grpclb | | -// | | | | ManualResolver ClientConn | | -// | | | | + + | | -// | | | | | | Transient | | -// | | | | | | Failure | | -// | | | | | <--------- | | | -// | | | <--------------- | ResolveNow | | | -// | | <--------- | ResolveNow | | | | | -// | | ResolveNow | | | | | | -// | | | | | | | | -// | + + | + + | | -// | +---------------------------------+ | -// +-----------------------------------------------------------------+ - -// lbManualResolver is used by the ClientConn inside grpclb. It's a manual -// resolver with a special ResolveNow() function. -// -// When ResolveNow() is called, it calls ResolveNow() on the parent ClientConn, -// so when grpclb client lose contact with remote balancers, the parent -// ClientConn's resolver will re-resolve. -type lbManualResolver struct { - scheme string - ccr resolver.ClientConn - - ccb balancer.ClientConn -} - -func (r *lbManualResolver) Build(_ resolver.Target, cc resolver.ClientConn, _ resolver.BuildOption) (resolver.Resolver, error) { - r.ccr = cc - return r, nil -} - -func (r *lbManualResolver) Scheme() string { - return r.scheme -} - -// ResolveNow calls resolveNow on the parent ClientConn. -func (r *lbManualResolver) ResolveNow(o resolver.ResolveNowOption) { - r.ccb.ResolveNow(o) -} - -// Close is a noop for Resolver. -func (*lbManualResolver) Close() {} - -// NewAddress calls cc.NewAddress. -func (r *lbManualResolver) NewAddress(addrs []resolver.Address) { - r.ccr.NewAddress(addrs) -} - -// NewServiceConfig calls cc.NewServiceConfig. -func (r *lbManualResolver) NewServiceConfig(sc string) { - r.ccr.NewServiceConfig(sc) -} diff --git a/vendor/google.golang.org/grpc/grpclog/grpclog.go b/vendor/google.golang.org/grpc/grpclog/grpclog.go index 16a7d88867e2..1fabb11e1bab 100644 --- a/vendor/google.golang.org/grpc/grpclog/grpclog.go +++ b/vendor/google.golang.org/grpc/grpclog/grpclog.go @@ -105,18 +105,21 @@ func Fatalln(args ...interface{}) { } // Print prints to the logger. Arguments are handled in the manner of fmt.Print. +// // Deprecated: use Info. func Print(args ...interface{}) { logger.Info(args...) } // Printf prints to the logger. Arguments are handled in the manner of fmt.Printf. +// // Deprecated: use Infof. func Printf(format string, args ...interface{}) { logger.Infof(format, args...) } // Println prints to the logger. Arguments are handled in the manner of fmt.Println. +// // Deprecated: use Infoln. func Println(args ...interface{}) { logger.Infoln(args...) diff --git a/vendor/google.golang.org/grpc/grpclog/logger.go b/vendor/google.golang.org/grpc/grpclog/logger.go index d03b2397bfab..097494f710f5 100644 --- a/vendor/google.golang.org/grpc/grpclog/logger.go +++ b/vendor/google.golang.org/grpc/grpclog/logger.go @@ -19,6 +19,7 @@ package grpclog // Logger mimics golang's standard Logger as an interface. +// // Deprecated: use LoggerV2. type Logger interface { Fatal(args ...interface{}) @@ -31,6 +32,7 @@ type Logger interface { // SetLogger sets the logger that is used in grpc. Call only from // init() functions. +// // Deprecated: use SetLoggerV2. func SetLogger(l Logger) { logger = &loggerWrapper{Logger: l} diff --git a/vendor/google.golang.org/grpc/health/grpc_health_v1/health.pb.go b/vendor/google.golang.org/grpc/health/grpc_health_v1/health.pb.go index fdcbb9e0b7db..c2f2c7729d05 100644 --- a/vendor/google.golang.org/grpc/health/grpc_health_v1/health.pb.go +++ b/vendor/google.golang.org/grpc/health/grpc_health_v1/health.pb.go @@ -1,17 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. -// source: grpc_health_v1/health.proto +// source: grpc/health/v1/health.proto -/* -Package grpc_health_v1 is a generated protocol buffer package. - -It is generated from these files: - grpc_health_v1/health.proto - -It has these top-level messages: - HealthCheckRequest - HealthCheckResponse -*/ -package grpc_health_v1 +package grpc_health_v1 // import "google.golang.org/grpc/health/grpc_health_v1" import proto "github.com/golang/protobuf/proto" import fmt "fmt" @@ -36,37 +26,62 @@ const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package type HealthCheckResponse_ServingStatus int32 const ( - HealthCheckResponse_UNKNOWN HealthCheckResponse_ServingStatus = 0 - HealthCheckResponse_SERVING HealthCheckResponse_ServingStatus = 1 - HealthCheckResponse_NOT_SERVING HealthCheckResponse_ServingStatus = 2 + HealthCheckResponse_UNKNOWN HealthCheckResponse_ServingStatus = 0 + HealthCheckResponse_SERVING HealthCheckResponse_ServingStatus = 1 + HealthCheckResponse_NOT_SERVING HealthCheckResponse_ServingStatus = 2 + HealthCheckResponse_SERVICE_UNKNOWN HealthCheckResponse_ServingStatus = 3 ) var HealthCheckResponse_ServingStatus_name = map[int32]string{ 0: "UNKNOWN", 1: "SERVING", 2: "NOT_SERVING", + 3: "SERVICE_UNKNOWN", } var HealthCheckResponse_ServingStatus_value = map[string]int32{ - "UNKNOWN": 0, - "SERVING": 1, - "NOT_SERVING": 2, + "UNKNOWN": 0, + "SERVING": 1, + "NOT_SERVING": 2, + "SERVICE_UNKNOWN": 3, } func (x HealthCheckResponse_ServingStatus) String() string { return proto.EnumName(HealthCheckResponse_ServingStatus_name, int32(x)) } func (HealthCheckResponse_ServingStatus) EnumDescriptor() ([]byte, []int) { - return fileDescriptor0, []int{1, 0} + return fileDescriptor_health_6b1a06aa67f91efd, []int{1, 0} } type HealthCheckRequest struct { - Service string `protobuf:"bytes,1,opt,name=service" json:"service,omitempty"` + Service string `protobuf:"bytes,1,opt,name=service,proto3" json:"service,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *HealthCheckRequest) Reset() { *m = HealthCheckRequest{} } +func (m *HealthCheckRequest) String() string { return proto.CompactTextString(m) } +func (*HealthCheckRequest) ProtoMessage() {} +func (*HealthCheckRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_health_6b1a06aa67f91efd, []int{0} +} +func (m *HealthCheckRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_HealthCheckRequest.Unmarshal(m, b) +} +func (m *HealthCheckRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_HealthCheckRequest.Marshal(b, m, deterministic) +} +func (dst *HealthCheckRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_HealthCheckRequest.Merge(dst, src) +} +func (m *HealthCheckRequest) XXX_Size() int { + return xxx_messageInfo_HealthCheckRequest.Size(m) +} +func (m *HealthCheckRequest) XXX_DiscardUnknown() { + xxx_messageInfo_HealthCheckRequest.DiscardUnknown(m) } -func (m *HealthCheckRequest) Reset() { *m = HealthCheckRequest{} } -func (m *HealthCheckRequest) String() string { return proto.CompactTextString(m) } -func (*HealthCheckRequest) ProtoMessage() {} -func (*HealthCheckRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } +var xxx_messageInfo_HealthCheckRequest proto.InternalMessageInfo func (m *HealthCheckRequest) GetService() string { if m != nil { @@ -76,13 +91,35 @@ func (m *HealthCheckRequest) GetService() string { } type HealthCheckResponse struct { - Status HealthCheckResponse_ServingStatus `protobuf:"varint,1,opt,name=status,enum=grpc.health.v1.HealthCheckResponse_ServingStatus" json:"status,omitempty"` + Status HealthCheckResponse_ServingStatus `protobuf:"varint,1,opt,name=status,proto3,enum=grpc.health.v1.HealthCheckResponse_ServingStatus" json:"status,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *HealthCheckResponse) Reset() { *m = HealthCheckResponse{} } -func (m *HealthCheckResponse) String() string { return proto.CompactTextString(m) } -func (*HealthCheckResponse) ProtoMessage() {} -func (*HealthCheckResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} } +func (m *HealthCheckResponse) Reset() { *m = HealthCheckResponse{} } +func (m *HealthCheckResponse) String() string { return proto.CompactTextString(m) } +func (*HealthCheckResponse) ProtoMessage() {} +func (*HealthCheckResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_health_6b1a06aa67f91efd, []int{1} +} +func (m *HealthCheckResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_HealthCheckResponse.Unmarshal(m, b) +} +func (m *HealthCheckResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_HealthCheckResponse.Marshal(b, m, deterministic) +} +func (dst *HealthCheckResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_HealthCheckResponse.Merge(dst, src) +} +func (m *HealthCheckResponse) XXX_Size() int { + return xxx_messageInfo_HealthCheckResponse.Size(m) +} +func (m *HealthCheckResponse) XXX_DiscardUnknown() { + xxx_messageInfo_HealthCheckResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_HealthCheckResponse proto.InternalMessageInfo func (m *HealthCheckResponse) GetStatus() HealthCheckResponse_ServingStatus { if m != nil { @@ -105,10 +142,29 @@ var _ grpc.ClientConn // is compatible with the grpc package it is being compiled against. const _ = grpc.SupportPackageIsVersion4 -// Client API for Health service - +// HealthClient is the client API for Health service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type HealthClient interface { + // If the requested service is unknown, the call will fail with status + // NOT_FOUND. Check(ctx context.Context, in *HealthCheckRequest, opts ...grpc.CallOption) (*HealthCheckResponse, error) + // Performs a watch for the serving status of the requested service. + // The server will immediately send back a message indicating the current + // serving status. It will then subsequently send a new message whenever + // the service's serving status changes. + // + // If the requested service is unknown when the call is received, the + // server will send a message setting the serving status to + // SERVICE_UNKNOWN but will *not* terminate the call. If at some + // future point, the serving status of the service becomes known, the + // server will send a new message with the service's serving status. + // + // If the call terminates with status UNIMPLEMENTED, then clients + // should assume this method is not supported and should not retry the + // call. If the call terminates with any other status (including OK), + // clients should retry the call with appropriate exponential backoff. + Watch(ctx context.Context, in *HealthCheckRequest, opts ...grpc.CallOption) (Health_WatchClient, error) } type healthClient struct { @@ -121,17 +177,66 @@ func NewHealthClient(cc *grpc.ClientConn) HealthClient { func (c *healthClient) Check(ctx context.Context, in *HealthCheckRequest, opts ...grpc.CallOption) (*HealthCheckResponse, error) { out := new(HealthCheckResponse) - err := grpc.Invoke(ctx, "/grpc.health.v1.Health/Check", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/grpc.health.v1.Health/Check", in, out, opts...) if err != nil { return nil, err } return out, nil } -// Server API for Health service +func (c *healthClient) Watch(ctx context.Context, in *HealthCheckRequest, opts ...grpc.CallOption) (Health_WatchClient, error) { + stream, err := c.cc.NewStream(ctx, &_Health_serviceDesc.Streams[0], "/grpc.health.v1.Health/Watch", opts...) + if err != nil { + return nil, err + } + x := &healthWatchClient{stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +type Health_WatchClient interface { + Recv() (*HealthCheckResponse, error) + grpc.ClientStream +} + +type healthWatchClient struct { + grpc.ClientStream +} +func (x *healthWatchClient) Recv() (*HealthCheckResponse, error) { + m := new(HealthCheckResponse) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +// HealthServer is the server API for Health service. type HealthServer interface { + // If the requested service is unknown, the call will fail with status + // NOT_FOUND. Check(context.Context, *HealthCheckRequest) (*HealthCheckResponse, error) + // Performs a watch for the serving status of the requested service. + // The server will immediately send back a message indicating the current + // serving status. It will then subsequently send a new message whenever + // the service's serving status changes. + // + // If the requested service is unknown when the call is received, the + // server will send a message setting the serving status to + // SERVICE_UNKNOWN but will *not* terminate the call. If at some + // future point, the serving status of the service becomes known, the + // server will send a new message with the service's serving status. + // + // If the call terminates with status UNIMPLEMENTED, then clients + // should assume this method is not supported and should not retry the + // call. If the call terminates with any other status (including OK), + // clients should retry the call with appropriate exponential backoff. + Watch(*HealthCheckRequest, Health_WatchServer) error } func RegisterHealthServer(s *grpc.Server, srv HealthServer) { @@ -156,6 +261,27 @@ func _Health_Check_Handler(srv interface{}, ctx context.Context, dec func(interf return interceptor(ctx, in, info, handler) } +func _Health_Watch_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(HealthCheckRequest) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(HealthServer).Watch(m, &healthWatchServer{stream}) +} + +type Health_WatchServer interface { + Send(*HealthCheckResponse) error + grpc.ServerStream +} + +type healthWatchServer struct { + grpc.ServerStream +} + +func (x *healthWatchServer) Send(m *HealthCheckResponse) error { + return x.ServerStream.SendMsg(m) +} + var _Health_serviceDesc = grpc.ServiceDesc{ ServiceName: "grpc.health.v1.Health", HandlerType: (*HealthServer)(nil), @@ -165,26 +291,37 @@ var _Health_serviceDesc = grpc.ServiceDesc{ Handler: _Health_Check_Handler, }, }, - Streams: []grpc.StreamDesc{}, - Metadata: "grpc_health_v1/health.proto", + Streams: []grpc.StreamDesc{ + { + StreamName: "Watch", + Handler: _Health_Watch_Handler, + ServerStreams: true, + }, + }, + Metadata: "grpc/health/v1/health.proto", } -func init() { proto.RegisterFile("grpc_health_v1/health.proto", fileDescriptor0) } +func init() { proto.RegisterFile("grpc/health/v1/health.proto", fileDescriptor_health_6b1a06aa67f91efd) } -var fileDescriptor0 = []byte{ - // 213 bytes of a gzipped FileDescriptorProto +var fileDescriptor_health_6b1a06aa67f91efd = []byte{ + // 297 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4e, 0x2f, 0x2a, 0x48, - 0x8e, 0xcf, 0x48, 0x4d, 0xcc, 0x29, 0xc9, 0x88, 0x2f, 0x33, 0xd4, 0x87, 0xb0, 0xf4, 0x0a, 0x8a, - 0xf2, 0x4b, 0xf2, 0x85, 0xf8, 0x40, 0x92, 0x7a, 0x50, 0xa1, 0x32, 0x43, 0x25, 0x3d, 0x2e, 0x21, - 0x0f, 0x30, 0xc7, 0x39, 0x23, 0x35, 0x39, 0x3b, 0x28, 0xb5, 0xb0, 0x34, 0xb5, 0xb8, 0x44, 0x48, - 0x82, 0x8b, 0xbd, 0x38, 0xb5, 0xa8, 0x2c, 0x33, 0x39, 0x55, 0x82, 0x51, 0x81, 0x51, 0x83, 0x33, - 0x08, 0xc6, 0x55, 0x9a, 0xc3, 0xc8, 0x25, 0x8c, 0xa2, 0xa1, 0xb8, 0x20, 0x3f, 0xaf, 0x38, 0x55, - 0xc8, 0x93, 0x8b, 0xad, 0xb8, 0x24, 0xb1, 0xa4, 0xb4, 0x18, 0xac, 0x81, 0xcf, 0xc8, 0x50, 0x0f, - 0xd5, 0x22, 0x3d, 0x2c, 0x9a, 0xf4, 0x82, 0x41, 0x86, 0xe6, 0xa5, 0x07, 0x83, 0x35, 0x06, 0x41, - 0x0d, 0x50, 0xb2, 0xe2, 0xe2, 0x45, 0x91, 0x10, 0xe2, 0xe6, 0x62, 0x0f, 0xf5, 0xf3, 0xf6, 0xf3, - 0x0f, 0xf7, 0x13, 0x60, 0x00, 0x71, 0x82, 0x5d, 0x83, 0xc2, 0x3c, 0xfd, 0xdc, 0x05, 0x18, 0x85, - 0xf8, 0xb9, 0xb8, 0xfd, 0xfc, 0x43, 0xe2, 0x61, 0x02, 0x4c, 0x46, 0x51, 0x5c, 0x6c, 0x10, 0x8b, - 0x84, 0x02, 0xb8, 0x58, 0xc1, 0x96, 0x09, 0x29, 0xe1, 0x75, 0x09, 0xd8, 0xbf, 0x52, 0xca, 0x44, - 0xb8, 0x36, 0x89, 0x0d, 0x1c, 0x82, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0x53, 0x2b, 0x65, - 0x20, 0x60, 0x01, 0x00, 0x00, + 0xd6, 0xcf, 0x48, 0x4d, 0xcc, 0x29, 0xc9, 0xd0, 0x2f, 0x33, 0x84, 0xb2, 0xf4, 0x0a, 0x8a, 0xf2, + 0x4b, 0xf2, 0x85, 0xf8, 0x40, 0x92, 0x7a, 0x50, 0xa1, 0x32, 0x43, 0x25, 0x3d, 0x2e, 0x21, 0x0f, + 0x30, 0xc7, 0x39, 0x23, 0x35, 0x39, 0x3b, 0x28, 0xb5, 0xb0, 0x34, 0xb5, 0xb8, 0x44, 0x48, 0x82, + 0x8b, 0xbd, 0x38, 0xb5, 0xa8, 0x2c, 0x33, 0x39, 0x55, 0x82, 0x51, 0x81, 0x51, 0x83, 0x33, 0x08, + 0xc6, 0x55, 0xda, 0xc8, 0xc8, 0x25, 0x8c, 0xa2, 0xa1, 0xb8, 0x20, 0x3f, 0xaf, 0x38, 0x55, 0xc8, + 0x93, 0x8b, 0xad, 0xb8, 0x24, 0xb1, 0xa4, 0xb4, 0x18, 0xac, 0x81, 0xcf, 0xc8, 0x50, 0x0f, 0xd5, + 0x22, 0x3d, 0x2c, 0x9a, 0xf4, 0x82, 0x41, 0x86, 0xe6, 0xa5, 0x07, 0x83, 0x35, 0x06, 0x41, 0x0d, + 0x50, 0xf2, 0xe7, 0xe2, 0x45, 0x91, 0x10, 0xe2, 0xe6, 0x62, 0x0f, 0xf5, 0xf3, 0xf6, 0xf3, 0x0f, + 0xf7, 0x13, 0x60, 0x00, 0x71, 0x82, 0x5d, 0x83, 0xc2, 0x3c, 0xfd, 0xdc, 0x05, 0x18, 0x85, 0xf8, + 0xb9, 0xb8, 0xfd, 0xfc, 0x43, 0xe2, 0x61, 0x02, 0x4c, 0x42, 0xc2, 0x5c, 0xfc, 0x60, 0x8e, 0xb3, + 0x6b, 0x3c, 0x4c, 0x0b, 0xb3, 0xd1, 0x3a, 0x46, 0x2e, 0x36, 0x88, 0xf5, 0x42, 0x01, 0x5c, 0xac, + 0x60, 0x27, 0x08, 0x29, 0xe1, 0x75, 0x1f, 0x38, 0x14, 0xa4, 0x94, 0x89, 0xf0, 0x83, 0x50, 0x10, + 0x17, 0x6b, 0x78, 0x62, 0x49, 0x72, 0x06, 0xd5, 0x4c, 0x34, 0x60, 0x74, 0x4a, 0xe4, 0x12, 0xcc, + 0xcc, 0x47, 0x53, 0xea, 0xc4, 0x0d, 0x51, 0x1b, 0x00, 0x8a, 0xc6, 0x00, 0xc6, 0x28, 0x9d, 0xf4, + 0xfc, 0xfc, 0xf4, 0x9c, 0x54, 0xbd, 0xf4, 0xfc, 0x9c, 0xc4, 0xbc, 0x74, 0xbd, 0xfc, 0xa2, 0x74, + 0x7d, 0xe4, 0x78, 0x07, 0xb1, 0xe3, 0x21, 0xec, 0xf8, 0x32, 0xc3, 0x55, 0x4c, 0x7c, 0xee, 0x20, + 0xd3, 0x20, 0x46, 0xe8, 0x85, 0x19, 0x26, 0xb1, 0x81, 0x93, 0x83, 0x31, 0x20, 0x00, 0x00, 0xff, + 0xff, 0x12, 0x7d, 0x96, 0xcb, 0x2d, 0x02, 0x00, 0x00, } diff --git a/vendor/google.golang.org/grpc/health/health.go b/vendor/google.golang.org/grpc/health/health.go index 30a78667e60c..4c671f6a325d 100644 --- a/vendor/google.golang.org/grpc/health/health.go +++ b/vendor/google.golang.org/grpc/health/health.go @@ -16,7 +16,7 @@ * */ -//go:generate protoc --go_out=plugins=grpc:. grpc_health_v1/health.proto +//go:generate ./regenerate.sh // Package health provides some utility functions to health-check a server. The implementation // is based on protobuf. Users need to write their own implementations if other IDLs are used. @@ -63,6 +63,11 @@ func (s *Server) Check(ctx context.Context, in *healthpb.HealthCheckRequest) (*h return nil, status.Error(codes.NotFound, "unknown service") } +// Watch implements `service Health`. +func (s *Server) Watch(in *healthpb.HealthCheckRequest, stream healthpb.Health_WatchServer) error { + return status.Error(codes.Unimplemented, "Watching is not supported") +} + // SetServingStatus is called when need to reset the serving status of a service // or insert a new service entry into the statusMap. func (s *Server) SetServingStatus(service string, status healthpb.HealthCheckResponse_ServingStatus) { diff --git a/vendor/google.golang.org/grpc/health/regenerate.sh b/vendor/google.golang.org/grpc/health/regenerate.sh new file mode 100755 index 000000000000..b11eccb295b2 --- /dev/null +++ b/vendor/google.golang.org/grpc/health/regenerate.sh @@ -0,0 +1,33 @@ +#!/bin/bash +# Copyright 2018 gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -eux -o pipefail + +TMP=$(mktemp -d) + +function finish { + rm -rf "$TMP" +} +trap finish EXIT + +pushd "$TMP" +mkdir -p grpc/health/v1 +curl https://raw.githubusercontent.com/grpc/grpc-proto/master/grpc/health/v1/health.proto > grpc/health/v1/health.proto + +protoc --go_out=plugins=grpc,paths=source_relative:. -I. grpc/health/v1/*.proto +popd +rm -f grpc_health_v1/*.pb.go +cp "$TMP"/grpc/health/v1/*.pb.go grpc_health_v1/ + diff --git a/vendor/google.golang.org/grpc/install_gae.sh b/vendor/google.golang.org/grpc/install_gae.sh new file mode 100755 index 000000000000..7c7bcada5044 --- /dev/null +++ b/vendor/google.golang.org/grpc/install_gae.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +TMP=$(mktemp -d /tmp/sdk.XXX) \ +&& curl -o $TMP.zip "https://storage.googleapis.com/appengine-sdks/featured/go_appengine_sdk_linux_amd64-1.9.68.zip" \ +&& unzip -q $TMP.zip -d $TMP \ +&& export PATH="$PATH:$TMP/go_appengine" diff --git a/vendor/google.golang.org/grpc/interceptor.go b/vendor/google.golang.org/grpc/interceptor.go index 06dc825b9fba..1f6ef678035b 100644 --- a/vendor/google.golang.org/grpc/interceptor.go +++ b/vendor/google.golang.org/grpc/interceptor.go @@ -48,7 +48,9 @@ type UnaryServerInfo struct { } // UnaryHandler defines the handler invoked by UnaryServerInterceptor to complete the normal -// execution of a unary RPC. +// execution of a unary RPC. If a UnaryHandler returns an error, it should be produced by the +// status package, or else gRPC will use codes.Unknown as the status code and err.Error() as +// the status message of the RPC. type UnaryHandler func(ctx context.Context, req interface{}) (interface{}, error) // UnaryServerInterceptor provides a hook to intercept the execution of a unary RPC on the server. info diff --git a/vendor/google.golang.org/grpc/internal/backoff/backoff.go b/vendor/google.golang.org/grpc/internal/backoff/backoff.go new file mode 100644 index 000000000000..1bd0cce5abdf --- /dev/null +++ b/vendor/google.golang.org/grpc/internal/backoff/backoff.go @@ -0,0 +1,78 @@ +/* + * + * Copyright 2017 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +// Package backoff implement the backoff strategy for gRPC. +// +// This is kept in internal until the gRPC project decides whether or not to +// allow alternative backoff strategies. +package backoff + +import ( + "time" + + "google.golang.org/grpc/internal/grpcrand" +) + +// Strategy defines the methodology for backing off after a grpc connection +// failure. +// +type Strategy interface { + // Backoff returns the amount of time to wait before the next retry given + // the number of consecutive failures. + Backoff(retries int) time.Duration +} + +const ( + // baseDelay is the amount of time to wait before retrying after the first + // failure. + baseDelay = 1.0 * time.Second + // factor is applied to the backoff after each retry. + factor = 1.6 + // jitter provides a range to randomize backoff delays. + jitter = 0.2 +) + +// Exponential implements exponential backoff algorithm as defined in +// https://github.com/grpc/grpc/blob/master/doc/connection-backoff.md. +type Exponential struct { + // MaxDelay is the upper bound of backoff delay. + MaxDelay time.Duration +} + +// Backoff returns the amount of time to wait before the next retry given the +// number of retries. +func (bc Exponential) Backoff(retries int) time.Duration { + if retries == 0 { + return baseDelay + } + backoff, max := float64(baseDelay), float64(bc.MaxDelay) + for backoff < max && retries > 0 { + backoff *= factor + retries-- + } + if backoff > max { + backoff = max + } + // Randomize backoff delays so that if a cluster of requests start at + // the same time, they won't operate in lockstep. + backoff *= 1 + jitter*(grpcrand.Float64()*2-1) + if backoff < 0 { + return 0 + } + return time.Duration(backoff) +} diff --git a/vendor/google.golang.org/grpc/internal/channelz/funcs.go b/vendor/google.golang.org/grpc/internal/channelz/funcs.go new file mode 100644 index 000000000000..6e729fa631a5 --- /dev/null +++ b/vendor/google.golang.org/grpc/internal/channelz/funcs.go @@ -0,0 +1,662 @@ +/* + * + * Copyright 2018 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +// Package channelz defines APIs for enabling channelz service, entry +// registration/deletion, and accessing channelz data. It also defines channelz +// metric struct formats. +// +// All APIs in this package are experimental. +package channelz + +import ( + "sort" + "sync" + "sync/atomic" + "time" + + "google.golang.org/grpc/grpclog" +) + +const ( + defaultMaxTraceEntry int32 = 30 +) + +var ( + db dbWrapper + idGen idGenerator + // EntryPerPage defines the number of channelz entries to be shown on a web page. + EntryPerPage = 50 + curState int32 + maxTraceEntry = defaultMaxTraceEntry +) + +// TurnOn turns on channelz data collection. +func TurnOn() { + if !IsOn() { + NewChannelzStorage() + atomic.StoreInt32(&curState, 1) + } +} + +// IsOn returns whether channelz data collection is on. +func IsOn() bool { + return atomic.CompareAndSwapInt32(&curState, 1, 1) +} + +// SetMaxTraceEntry sets maximum number of trace entry per entity (i.e. channel/subchannel). +// Setting it to 0 will disable channel tracing. +func SetMaxTraceEntry(i int32) { + atomic.StoreInt32(&maxTraceEntry, i) +} + +// ResetMaxTraceEntryToDefault resets the maximum number of trace entry per entity to default. +func ResetMaxTraceEntryToDefault() { + atomic.StoreInt32(&maxTraceEntry, defaultMaxTraceEntry) +} + +func getMaxTraceEntry() int { + i := atomic.LoadInt32(&maxTraceEntry) + return int(i) +} + +// dbWarpper wraps around a reference to internal channelz data storage, and +// provide synchronized functionality to set and get the reference. +type dbWrapper struct { + mu sync.RWMutex + DB *channelMap +} + +func (d *dbWrapper) set(db *channelMap) { + d.mu.Lock() + d.DB = db + d.mu.Unlock() +} + +func (d *dbWrapper) get() *channelMap { + d.mu.RLock() + defer d.mu.RUnlock() + return d.DB +} + +// NewChannelzStorage initializes channelz data storage and id generator. +// +// Note: This function is exported for testing purpose only. User should not call +// it in most cases. +func NewChannelzStorage() { + db.set(&channelMap{ + topLevelChannels: make(map[int64]struct{}), + channels: make(map[int64]*channel), + listenSockets: make(map[int64]*listenSocket), + normalSockets: make(map[int64]*normalSocket), + servers: make(map[int64]*server), + subChannels: make(map[int64]*subChannel), + }) + idGen.reset() +} + +// GetTopChannels returns a slice of top channel's ChannelMetric, along with a +// boolean indicating whether there's more top channels to be queried for. +// +// The arg id specifies that only top channel with id at or above it will be included +// in the result. The returned slice is up to a length of EntryPerPage, and is +// sorted in ascending id order. +func GetTopChannels(id int64) ([]*ChannelMetric, bool) { + return db.get().GetTopChannels(id) +} + +// GetServers returns a slice of server's ServerMetric, along with a +// boolean indicating whether there's more servers to be queried for. +// +// The arg id specifies that only server with id at or above it will be included +// in the result. The returned slice is up to a length of EntryPerPage, and is +// sorted in ascending id order. +func GetServers(id int64) ([]*ServerMetric, bool) { + return db.get().GetServers(id) +} + +// GetServerSockets returns a slice of server's (identified by id) normal socket's +// SocketMetric, along with a boolean indicating whether there's more sockets to +// be queried for. +// +// The arg startID specifies that only sockets with id at or above it will be +// included in the result. The returned slice is up to a length of EntryPerPage, +// and is sorted in ascending id order. +func GetServerSockets(id int64, startID int64) ([]*SocketMetric, bool) { + return db.get().GetServerSockets(id, startID) +} + +// GetChannel returns the ChannelMetric for the channel (identified by id). +func GetChannel(id int64) *ChannelMetric { + return db.get().GetChannel(id) +} + +// GetSubChannel returns the SubChannelMetric for the subchannel (identified by id). +func GetSubChannel(id int64) *SubChannelMetric { + return db.get().GetSubChannel(id) +} + +// GetSocket returns the SocketInternalMetric for the socket (identified by id). +func GetSocket(id int64) *SocketMetric { + return db.get().GetSocket(id) +} + +// RegisterChannel registers the given channel c in channelz database with ref +// as its reference name, and add it to the child list of its parent (identified +// by pid). pid = 0 means no parent. It returns the unique channelz tracking id +// assigned to this channel. +func RegisterChannel(c Channel, pid int64, ref string) int64 { + id := idGen.genID() + cn := &channel{ + refName: ref, + c: c, + subChans: make(map[int64]string), + nestedChans: make(map[int64]string), + id: id, + pid: pid, + trace: &channelTrace{createdTime: time.Now(), events: make([]*TraceEvent, 0, getMaxTraceEntry())}, + } + if pid == 0 { + db.get().addChannel(id, cn, true, pid, ref) + } else { + db.get().addChannel(id, cn, false, pid, ref) + } + return id +} + +// RegisterSubChannel registers the given channel c in channelz database with ref +// as its reference name, and add it to the child list of its parent (identified +// by pid). It returns the unique channelz tracking id assigned to this subchannel. +func RegisterSubChannel(c Channel, pid int64, ref string) int64 { + if pid == 0 { + grpclog.Error("a SubChannel's parent id cannot be 0") + return 0 + } + id := idGen.genID() + sc := &subChannel{ + refName: ref, + c: c, + sockets: make(map[int64]string), + id: id, + pid: pid, + trace: &channelTrace{createdTime: time.Now(), events: make([]*TraceEvent, 0, getMaxTraceEntry())}, + } + db.get().addSubChannel(id, sc, pid, ref) + return id +} + +// RegisterServer registers the given server s in channelz database. It returns +// the unique channelz tracking id assigned to this server. +func RegisterServer(s Server, ref string) int64 { + id := idGen.genID() + svr := &server{ + refName: ref, + s: s, + sockets: make(map[int64]string), + listenSockets: make(map[int64]string), + id: id, + } + db.get().addServer(id, svr) + return id +} + +// RegisterListenSocket registers the given listen socket s in channelz database +// with ref as its reference name, and add it to the child list of its parent +// (identified by pid). It returns the unique channelz tracking id assigned to +// this listen socket. +func RegisterListenSocket(s Socket, pid int64, ref string) int64 { + if pid == 0 { + grpclog.Error("a ListenSocket's parent id cannot be 0") + return 0 + } + id := idGen.genID() + ls := &listenSocket{refName: ref, s: s, id: id, pid: pid} + db.get().addListenSocket(id, ls, pid, ref) + return id +} + +// RegisterNormalSocket registers the given normal socket s in channelz database +// with ref as its reference name, and add it to the child list of its parent +// (identified by pid). It returns the unique channelz tracking id assigned to +// this normal socket. +func RegisterNormalSocket(s Socket, pid int64, ref string) int64 { + if pid == 0 { + grpclog.Error("a NormalSocket's parent id cannot be 0") + return 0 + } + id := idGen.genID() + ns := &normalSocket{refName: ref, s: s, id: id, pid: pid} + db.get().addNormalSocket(id, ns, pid, ref) + return id +} + +// RemoveEntry removes an entry with unique channelz trakcing id to be id from +// channelz database. +func RemoveEntry(id int64) { + db.get().removeEntry(id) +} + +// TraceEventDesc is what the caller of AddTraceEvent should provide to describe the event to be added +// to the channel trace. +// The Parent field is optional. It is used for event that will be recorded in the entity's parent +// trace also. +type TraceEventDesc struct { + Desc string + Severity Severity + Parent *TraceEventDesc +} + +// AddTraceEvent adds trace related to the entity with specified id, using the provided TraceEventDesc. +func AddTraceEvent(id int64, desc *TraceEventDesc) { + if getMaxTraceEntry() == 0 { + return + } + db.get().traceEvent(id, desc) +} + +// channelMap is the storage data structure for channelz. +// Methods of channelMap can be divided in two two categories with respect to locking. +// 1. Methods acquire the global lock. +// 2. Methods that can only be called when global lock is held. +// A second type of method need always to be called inside a first type of method. +type channelMap struct { + mu sync.RWMutex + topLevelChannels map[int64]struct{} + servers map[int64]*server + channels map[int64]*channel + subChannels map[int64]*subChannel + listenSockets map[int64]*listenSocket + normalSockets map[int64]*normalSocket +} + +func (c *channelMap) addServer(id int64, s *server) { + c.mu.Lock() + s.cm = c + c.servers[id] = s + c.mu.Unlock() +} + +func (c *channelMap) addChannel(id int64, cn *channel, isTopChannel bool, pid int64, ref string) { + c.mu.Lock() + cn.cm = c + cn.trace.cm = c + c.channels[id] = cn + if isTopChannel { + c.topLevelChannels[id] = struct{}{} + } else { + c.findEntry(pid).addChild(id, cn) + } + c.mu.Unlock() +} + +func (c *channelMap) addSubChannel(id int64, sc *subChannel, pid int64, ref string) { + c.mu.Lock() + sc.cm = c + sc.trace.cm = c + c.subChannels[id] = sc + c.findEntry(pid).addChild(id, sc) + c.mu.Unlock() +} + +func (c *channelMap) addListenSocket(id int64, ls *listenSocket, pid int64, ref string) { + c.mu.Lock() + ls.cm = c + c.listenSockets[id] = ls + c.findEntry(pid).addChild(id, ls) + c.mu.Unlock() +} + +func (c *channelMap) addNormalSocket(id int64, ns *normalSocket, pid int64, ref string) { + c.mu.Lock() + ns.cm = c + c.normalSockets[id] = ns + c.findEntry(pid).addChild(id, ns) + c.mu.Unlock() +} + +// removeEntry triggers the removal of an entry, which may not indeed delete the entry, if it has to +// wait on the deletion of its children and until no other entity's channel trace references it. +// It may lead to a chain of entry deletion. For example, deleting the last socket of a gracefully +// shutting down server will lead to the server being also deleted. +func (c *channelMap) removeEntry(id int64) { + c.mu.Lock() + c.findEntry(id).triggerDelete() + c.mu.Unlock() +} + +// c.mu must be held by the caller +func (c *channelMap) decrTraceRefCount(id int64) { + e := c.findEntry(id) + if v, ok := e.(tracedChannel); ok { + v.decrTraceRefCount() + e.deleteSelfIfReady() + } +} + +// c.mu must be held by the caller. +func (c *channelMap) findEntry(id int64) entry { + var v entry + var ok bool + if v, ok = c.channels[id]; ok { + return v + } + if v, ok = c.subChannels[id]; ok { + return v + } + if v, ok = c.servers[id]; ok { + return v + } + if v, ok = c.listenSockets[id]; ok { + return v + } + if v, ok = c.normalSockets[id]; ok { + return v + } + return &dummyEntry{idNotFound: id} +} + +// c.mu must be held by the caller +// deleteEntry simply deletes an entry from the channelMap. Before calling this +// method, caller must check this entry is ready to be deleted, i.e removeEntry() +// has been called on it, and no children still exist. +// Conditionals are ordered by the expected frequency of deletion of each entity +// type, in order to optimize performance. +func (c *channelMap) deleteEntry(id int64) { + var ok bool + if _, ok = c.normalSockets[id]; ok { + delete(c.normalSockets, id) + return + } + if _, ok = c.subChannels[id]; ok { + delete(c.subChannels, id) + return + } + if _, ok = c.channels[id]; ok { + delete(c.channels, id) + delete(c.topLevelChannels, id) + return + } + if _, ok = c.listenSockets[id]; ok { + delete(c.listenSockets, id) + return + } + if _, ok = c.servers[id]; ok { + delete(c.servers, id) + return + } +} + +func (c *channelMap) traceEvent(id int64, desc *TraceEventDesc) { + c.mu.Lock() + child := c.findEntry(id) + childTC, ok := child.(tracedChannel) + if !ok { + c.mu.Unlock() + return + } + childTC.getChannelTrace().append(&TraceEvent{Desc: desc.Desc, Severity: desc.Severity, Timestamp: time.Now()}) + if desc.Parent != nil { + parent := c.findEntry(child.getParentID()) + var chanType RefChannelType + switch child.(type) { + case *channel: + chanType = RefChannel + case *subChannel: + chanType = RefSubChannel + } + if parentTC, ok := parent.(tracedChannel); ok { + parentTC.getChannelTrace().append(&TraceEvent{ + Desc: desc.Parent.Desc, + Severity: desc.Parent.Severity, + Timestamp: time.Now(), + RefID: id, + RefName: childTC.getRefName(), + RefType: chanType, + }) + childTC.incrTraceRefCount() + } + } + c.mu.Unlock() +} + +type int64Slice []int64 + +func (s int64Slice) Len() int { return len(s) } +func (s int64Slice) Swap(i, j int) { s[i], s[j] = s[j], s[i] } +func (s int64Slice) Less(i, j int) bool { return s[i] < s[j] } + +func copyMap(m map[int64]string) map[int64]string { + n := make(map[int64]string) + for k, v := range m { + n[k] = v + } + return n +} + +func min(a, b int) int { + if a < b { + return a + } + return b +} + +func (c *channelMap) GetTopChannels(id int64) ([]*ChannelMetric, bool) { + c.mu.RLock() + l := len(c.topLevelChannels) + ids := make([]int64, 0, l) + cns := make([]*channel, 0, min(l, EntryPerPage)) + + for k := range c.topLevelChannels { + ids = append(ids, k) + } + sort.Sort(int64Slice(ids)) + idx := sort.Search(len(ids), func(i int) bool { return ids[i] >= id }) + count := 0 + var end bool + var t []*ChannelMetric + for i, v := range ids[idx:] { + if count == EntryPerPage { + break + } + if cn, ok := c.channels[v]; ok { + cns = append(cns, cn) + t = append(t, &ChannelMetric{ + NestedChans: copyMap(cn.nestedChans), + SubChans: copyMap(cn.subChans), + }) + count++ + } + if i == len(ids[idx:])-1 { + end = true + break + } + } + c.mu.RUnlock() + if count == 0 { + end = true + } + + for i, cn := range cns { + t[i].ChannelData = cn.c.ChannelzMetric() + t[i].ID = cn.id + t[i].RefName = cn.refName + t[i].Trace = cn.trace.dumpData() + } + return t, end +} + +func (c *channelMap) GetServers(id int64) ([]*ServerMetric, bool) { + c.mu.RLock() + l := len(c.servers) + ids := make([]int64, 0, l) + ss := make([]*server, 0, min(l, EntryPerPage)) + for k := range c.servers { + ids = append(ids, k) + } + sort.Sort(int64Slice(ids)) + idx := sort.Search(len(ids), func(i int) bool { return ids[i] >= id }) + count := 0 + var end bool + var s []*ServerMetric + for i, v := range ids[idx:] { + if count == EntryPerPage { + break + } + if svr, ok := c.servers[v]; ok { + ss = append(ss, svr) + s = append(s, &ServerMetric{ + ListenSockets: copyMap(svr.listenSockets), + }) + count++ + } + if i == len(ids[idx:])-1 { + end = true + break + } + } + c.mu.RUnlock() + if count == 0 { + end = true + } + + for i, svr := range ss { + s[i].ServerData = svr.s.ChannelzMetric() + s[i].ID = svr.id + s[i].RefName = svr.refName + } + return s, end +} + +func (c *channelMap) GetServerSockets(id int64, startID int64) ([]*SocketMetric, bool) { + var svr *server + var ok bool + c.mu.RLock() + if svr, ok = c.servers[id]; !ok { + // server with id doesn't exist. + c.mu.RUnlock() + return nil, true + } + svrskts := svr.sockets + l := len(svrskts) + ids := make([]int64, 0, l) + sks := make([]*normalSocket, 0, min(l, EntryPerPage)) + for k := range svrskts { + ids = append(ids, k) + } + sort.Sort(int64Slice(ids)) + idx := sort.Search(len(ids), func(i int) bool { return ids[i] >= id }) + count := 0 + var end bool + for i, v := range ids[idx:] { + if count == EntryPerPage { + break + } + if ns, ok := c.normalSockets[v]; ok { + sks = append(sks, ns) + count++ + } + if i == len(ids[idx:])-1 { + end = true + break + } + } + c.mu.RUnlock() + if count == 0 { + end = true + } + var s []*SocketMetric + for _, ns := range sks { + sm := &SocketMetric{} + sm.SocketData = ns.s.ChannelzMetric() + sm.ID = ns.id + sm.RefName = ns.refName + s = append(s, sm) + } + return s, end +} + +func (c *channelMap) GetChannel(id int64) *ChannelMetric { + cm := &ChannelMetric{} + var cn *channel + var ok bool + c.mu.RLock() + if cn, ok = c.channels[id]; !ok { + // channel with id doesn't exist. + c.mu.RUnlock() + return nil + } + cm.NestedChans = copyMap(cn.nestedChans) + cm.SubChans = copyMap(cn.subChans) + c.mu.RUnlock() + cm.ChannelData = cn.c.ChannelzMetric() + cm.ID = cn.id + cm.RefName = cn.refName + cm.Trace = cn.trace.dumpData() + return cm +} + +func (c *channelMap) GetSubChannel(id int64) *SubChannelMetric { + cm := &SubChannelMetric{} + var sc *subChannel + var ok bool + c.mu.RLock() + if sc, ok = c.subChannels[id]; !ok { + // subchannel with id doesn't exist. + c.mu.RUnlock() + return nil + } + cm.Sockets = copyMap(sc.sockets) + c.mu.RUnlock() + cm.ChannelData = sc.c.ChannelzMetric() + cm.ID = sc.id + cm.RefName = sc.refName + cm.Trace = sc.trace.dumpData() + return cm +} + +func (c *channelMap) GetSocket(id int64) *SocketMetric { + sm := &SocketMetric{} + c.mu.RLock() + if ls, ok := c.listenSockets[id]; ok { + c.mu.RUnlock() + sm.SocketData = ls.s.ChannelzMetric() + sm.ID = ls.id + sm.RefName = ls.refName + return sm + } + if ns, ok := c.normalSockets[id]; ok { + c.mu.RUnlock() + sm.SocketData = ns.s.ChannelzMetric() + sm.ID = ns.id + sm.RefName = ns.refName + return sm + } + c.mu.RUnlock() + return nil +} + +type idGenerator struct { + id int64 +} + +func (i *idGenerator) reset() { + atomic.StoreInt64(&i.id, 0) +} + +func (i *idGenerator) genID() int64 { + return atomic.AddInt64(&i.id, 1) +} diff --git a/vendor/google.golang.org/grpc/internal/channelz/types.go b/vendor/google.golang.org/grpc/internal/channelz/types.go new file mode 100644 index 000000000000..17c2274cb3de --- /dev/null +++ b/vendor/google.golang.org/grpc/internal/channelz/types.go @@ -0,0 +1,702 @@ +/* + * + * Copyright 2018 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package channelz + +import ( + "net" + "sync" + "sync/atomic" + "time" + + "google.golang.org/grpc/connectivity" + "google.golang.org/grpc/credentials" + "google.golang.org/grpc/grpclog" +) + +// entry represents a node in the channelz database. +type entry interface { + // addChild adds a child e, whose channelz id is id to child list + addChild(id int64, e entry) + // deleteChild deletes a child with channelz id to be id from child list + deleteChild(id int64) + // triggerDelete tries to delete self from channelz database. However, if child + // list is not empty, then deletion from the database is on hold until the last + // child is deleted from database. + triggerDelete() + // deleteSelfIfReady check whether triggerDelete() has been called before, and whether child + // list is now empty. If both conditions are met, then delete self from database. + deleteSelfIfReady() + // getParentID returns parent ID of the entry. 0 value parent ID means no parent. + getParentID() int64 +} + +// dummyEntry is a fake entry to handle entry not found case. +type dummyEntry struct { + idNotFound int64 +} + +func (d *dummyEntry) addChild(id int64, e entry) { + // Note: It is possible for a normal program to reach here under race condition. + // For example, there could be a race between ClientConn.Close() info being propagated + // to addrConn and http2Client. ClientConn.Close() cancel the context and result + // in http2Client to error. The error info is then caught by transport monitor + // and before addrConn.tearDown() is called in side ClientConn.Close(). Therefore, + // the addrConn will create a new transport. And when registering the new transport in + // channelz, its parent addrConn could have already been torn down and deleted + // from channelz tracking, and thus reach the code here. + grpclog.Infof("attempt to add child of type %T with id %d to a parent (id=%d) that doesn't currently exist", e, id, d.idNotFound) +} + +func (d *dummyEntry) deleteChild(id int64) { + // It is possible for a normal program to reach here under race condition. + // Refer to the example described in addChild(). + grpclog.Infof("attempt to delete child with id %d from a parent (id=%d) that doesn't currently exist", id, d.idNotFound) +} + +func (d *dummyEntry) triggerDelete() { + grpclog.Warningf("attempt to delete an entry (id=%d) that doesn't currently exist", d.idNotFound) +} + +func (*dummyEntry) deleteSelfIfReady() { + // code should not reach here. deleteSelfIfReady is always called on an existing entry. +} + +func (*dummyEntry) getParentID() int64 { + return 0 +} + +// ChannelMetric defines the info channelz provides for a specific Channel, which +// includes ChannelInternalMetric and channelz-specific data, such as channelz id, +// child list, etc. +type ChannelMetric struct { + // ID is the channelz id of this channel. + ID int64 + // RefName is the human readable reference string of this channel. + RefName string + // ChannelData contains channel internal metric reported by the channel through + // ChannelzMetric(). + ChannelData *ChannelInternalMetric + // NestedChans tracks the nested channel type children of this channel in the format of + // a map from nested channel channelz id to corresponding reference string. + NestedChans map[int64]string + // SubChans tracks the subchannel type children of this channel in the format of a + // map from subchannel channelz id to corresponding reference string. + SubChans map[int64]string + // Sockets tracks the socket type children of this channel in the format of a map + // from socket channelz id to corresponding reference string. + // Note current grpc implementation doesn't allow channel having sockets directly, + // therefore, this is field is unused. + Sockets map[int64]string + // Trace contains the most recent traced events. + Trace *ChannelTrace +} + +// SubChannelMetric defines the info channelz provides for a specific SubChannel, +// which includes ChannelInternalMetric and channelz-specific data, such as +// channelz id, child list, etc. +type SubChannelMetric struct { + // ID is the channelz id of this subchannel. + ID int64 + // RefName is the human readable reference string of this subchannel. + RefName string + // ChannelData contains subchannel internal metric reported by the subchannel + // through ChannelzMetric(). + ChannelData *ChannelInternalMetric + // NestedChans tracks the nested channel type children of this subchannel in the format of + // a map from nested channel channelz id to corresponding reference string. + // Note current grpc implementation doesn't allow subchannel to have nested channels + // as children, therefore, this field is unused. + NestedChans map[int64]string + // SubChans tracks the subchannel type children of this subchannel in the format of a + // map from subchannel channelz id to corresponding reference string. + // Note current grpc implementation doesn't allow subchannel to have subchannels + // as children, therefore, this field is unused. + SubChans map[int64]string + // Sockets tracks the socket type children of this subchannel in the format of a map + // from socket channelz id to corresponding reference string. + Sockets map[int64]string + // Trace contains the most recent traced events. + Trace *ChannelTrace +} + +// ChannelInternalMetric defines the struct that the implementor of Channel interface +// should return from ChannelzMetric(). +type ChannelInternalMetric struct { + // current connectivity state of the channel. + State connectivity.State + // The target this channel originally tried to connect to. May be absent + Target string + // The number of calls started on the channel. + CallsStarted int64 + // The number of calls that have completed with an OK status. + CallsSucceeded int64 + // The number of calls that have a completed with a non-OK status. + CallsFailed int64 + // The last time a call was started on the channel. + LastCallStartedTimestamp time.Time +} + +// ChannelTrace stores traced events on a channel/subchannel and related info. +type ChannelTrace struct { + // EventNum is the number of events that ever got traced (i.e. including those that have been deleted) + EventNum int64 + // CreationTime is the creation time of the trace. + CreationTime time.Time + // Events stores the most recent trace events (up to $maxTraceEntry, newer event will overwrite the + // oldest one) + Events []*TraceEvent +} + +// TraceEvent represent a single trace event +type TraceEvent struct { + // Desc is a simple description of the trace event. + Desc string + // Severity states the severity of this trace event. + Severity Severity + // Timestamp is the event time. + Timestamp time.Time + // RefID is the id of the entity that gets referenced in the event. RefID is 0 if no other entity is + // involved in this event. + // e.g. SubChannel (id: 4[]) Created. --> RefID = 4, RefName = "" (inside []) + RefID int64 + // RefName is the reference name for the entity that gets referenced in the event. + RefName string + // RefType indicates the referenced entity type, i.e Channel or SubChannel. + RefType RefChannelType +} + +// Channel is the interface that should be satisfied in order to be tracked by +// channelz as Channel or SubChannel. +type Channel interface { + ChannelzMetric() *ChannelInternalMetric +} + +type dummyChannel struct{} + +func (d *dummyChannel) ChannelzMetric() *ChannelInternalMetric { + return &ChannelInternalMetric{} +} + +type channel struct { + refName string + c Channel + closeCalled bool + nestedChans map[int64]string + subChans map[int64]string + id int64 + pid int64 + cm *channelMap + trace *channelTrace + // traceRefCount is the number of trace events that reference this channel. + // Non-zero traceRefCount means the trace of this channel cannot be deleted. + traceRefCount int32 +} + +func (c *channel) addChild(id int64, e entry) { + switch v := e.(type) { + case *subChannel: + c.subChans[id] = v.refName + case *channel: + c.nestedChans[id] = v.refName + default: + grpclog.Errorf("cannot add a child (id = %d) of type %T to a channel", id, e) + } +} + +func (c *channel) deleteChild(id int64) { + delete(c.subChans, id) + delete(c.nestedChans, id) + c.deleteSelfIfReady() +} + +func (c *channel) triggerDelete() { + c.closeCalled = true + c.deleteSelfIfReady() +} + +func (c *channel) getParentID() int64 { + return c.pid +} + +// deleteSelfFromTree tries to delete the channel from the channelz entry relation tree, which means +// deleting the channel reference from its parent's child list. +// +// In order for a channel to be deleted from the tree, it must meet the criteria that, removal of the +// corresponding grpc object has been invoked, and the channel does not have any children left. +// +// The returned boolean value indicates whether the channel has been successfully deleted from tree. +func (c *channel) deleteSelfFromTree() (deleted bool) { + if !c.closeCalled || len(c.subChans)+len(c.nestedChans) != 0 { + return false + } + // not top channel + if c.pid != 0 { + c.cm.findEntry(c.pid).deleteChild(c.id) + } + return true +} + +// deleteSelfFromMap checks whether it is valid to delete the channel from the map, which means +// deleting the channel from channelz's tracking entirely. Users can no longer use id to query the +// channel, and its memory will be garbage collected. +// +// The trace reference count of the channel must be 0 in order to be deleted from the map. This is +// specified in the channel tracing gRFC that as long as some other trace has reference to an entity, +// the trace of the referenced entity must not be deleted. In order to release the resource allocated +// by grpc, the reference to the grpc object is reset to a dummy object. +// +// deleteSelfFromMap must be called after deleteSelfFromTree returns true. +// +// It returns a bool to indicate whether the channel can be safely deleted from map. +func (c *channel) deleteSelfFromMap() (delete bool) { + if c.getTraceRefCount() != 0 { + c.c = &dummyChannel{} + return false + } + return true +} + +// deleteSelfIfReady tries to delete the channel itself from the channelz database. +// The delete process includes two steps: +// 1. delete the channel from the entry relation tree, i.e. delete the channel reference from its +// parent's child list. +// 2. delete the channel from the map, i.e. delete the channel entirely from channelz. Lookup by id +// will return entry not found error. +func (c *channel) deleteSelfIfReady() { + if !c.deleteSelfFromTree() { + return + } + if !c.deleteSelfFromMap() { + return + } + c.cm.deleteEntry(c.id) + c.trace.clear() +} + +func (c *channel) getChannelTrace() *channelTrace { + return c.trace +} + +func (c *channel) incrTraceRefCount() { + atomic.AddInt32(&c.traceRefCount, 1) +} + +func (c *channel) decrTraceRefCount() { + atomic.AddInt32(&c.traceRefCount, -1) +} + +func (c *channel) getTraceRefCount() int { + i := atomic.LoadInt32(&c.traceRefCount) + return int(i) +} + +func (c *channel) getRefName() string { + return c.refName +} + +type subChannel struct { + refName string + c Channel + closeCalled bool + sockets map[int64]string + id int64 + pid int64 + cm *channelMap + trace *channelTrace + traceRefCount int32 +} + +func (sc *subChannel) addChild(id int64, e entry) { + if v, ok := e.(*normalSocket); ok { + sc.sockets[id] = v.refName + } else { + grpclog.Errorf("cannot add a child (id = %d) of type %T to a subChannel", id, e) + } +} + +func (sc *subChannel) deleteChild(id int64) { + delete(sc.sockets, id) + sc.deleteSelfIfReady() +} + +func (sc *subChannel) triggerDelete() { + sc.closeCalled = true + sc.deleteSelfIfReady() +} + +func (sc *subChannel) getParentID() int64 { + return sc.pid +} + +// deleteSelfFromTree tries to delete the subchannel from the channelz entry relation tree, which +// means deleting the subchannel reference from its parent's child list. +// +// In order for a subchannel to be deleted from the tree, it must meet the criteria that, removal of +// the corresponding grpc object has been invoked, and the subchannel does not have any children left. +// +// The returned boolean value indicates whether the channel has been successfully deleted from tree. +func (sc *subChannel) deleteSelfFromTree() (deleted bool) { + if !sc.closeCalled || len(sc.sockets) != 0 { + return false + } + sc.cm.findEntry(sc.pid).deleteChild(sc.id) + return true +} + +// deleteSelfFromMap checks whether it is valid to delete the subchannel from the map, which means +// deleting the subchannel from channelz's tracking entirely. Users can no longer use id to query +// the subchannel, and its memory will be garbage collected. +// +// The trace reference count of the subchannel must be 0 in order to be deleted from the map. This is +// specified in the channel tracing gRFC that as long as some other trace has reference to an entity, +// the trace of the referenced entity must not be deleted. In order to release the resource allocated +// by grpc, the reference to the grpc object is reset to a dummy object. +// +// deleteSelfFromMap must be called after deleteSelfFromTree returns true. +// +// It returns a bool to indicate whether the channel can be safely deleted from map. +func (sc *subChannel) deleteSelfFromMap() (delete bool) { + if sc.getTraceRefCount() != 0 { + // free the grpc struct (i.e. addrConn) + sc.c = &dummyChannel{} + return false + } + return true +} + +// deleteSelfIfReady tries to delete the subchannel itself from the channelz database. +// The delete process includes two steps: +// 1. delete the subchannel from the entry relation tree, i.e. delete the subchannel reference from +// its parent's child list. +// 2. delete the subchannel from the map, i.e. delete the subchannel entirely from channelz. Lookup +// by id will return entry not found error. +func (sc *subChannel) deleteSelfIfReady() { + if !sc.deleteSelfFromTree() { + return + } + if !sc.deleteSelfFromMap() { + return + } + sc.cm.deleteEntry(sc.id) + sc.trace.clear() +} + +func (sc *subChannel) getChannelTrace() *channelTrace { + return sc.trace +} + +func (sc *subChannel) incrTraceRefCount() { + atomic.AddInt32(&sc.traceRefCount, 1) +} + +func (sc *subChannel) decrTraceRefCount() { + atomic.AddInt32(&sc.traceRefCount, -1) +} + +func (sc *subChannel) getTraceRefCount() int { + i := atomic.LoadInt32(&sc.traceRefCount) + return int(i) +} + +func (sc *subChannel) getRefName() string { + return sc.refName +} + +// SocketMetric defines the info channelz provides for a specific Socket, which +// includes SocketInternalMetric and channelz-specific data, such as channelz id, etc. +type SocketMetric struct { + // ID is the channelz id of this socket. + ID int64 + // RefName is the human readable reference string of this socket. + RefName string + // SocketData contains socket internal metric reported by the socket through + // ChannelzMetric(). + SocketData *SocketInternalMetric +} + +// SocketInternalMetric defines the struct that the implementor of Socket interface +// should return from ChannelzMetric(). +type SocketInternalMetric struct { + // The number of streams that have been started. + StreamsStarted int64 + // The number of streams that have ended successfully: + // On client side, receiving frame with eos bit set. + // On server side, sending frame with eos bit set. + StreamsSucceeded int64 + // The number of streams that have ended unsuccessfully: + // On client side, termination without receiving frame with eos bit set. + // On server side, termination without sending frame with eos bit set. + StreamsFailed int64 + // The number of messages successfully sent on this socket. + MessagesSent int64 + MessagesReceived int64 + // The number of keep alives sent. This is typically implemented with HTTP/2 + // ping messages. + KeepAlivesSent int64 + // The last time a stream was created by this endpoint. Usually unset for + // servers. + LastLocalStreamCreatedTimestamp time.Time + // The last time a stream was created by the remote endpoint. Usually unset + // for clients. + LastRemoteStreamCreatedTimestamp time.Time + // The last time a message was sent by this endpoint. + LastMessageSentTimestamp time.Time + // The last time a message was received by this endpoint. + LastMessageReceivedTimestamp time.Time + // The amount of window, granted to the local endpoint by the remote endpoint. + // This may be slightly out of date due to network latency. This does NOT + // include stream level or TCP level flow control info. + LocalFlowControlWindow int64 + // The amount of window, granted to the remote endpoint by the local endpoint. + // This may be slightly out of date due to network latency. This does NOT + // include stream level or TCP level flow control info. + RemoteFlowControlWindow int64 + // The locally bound address. + LocalAddr net.Addr + // The remote bound address. May be absent. + RemoteAddr net.Addr + // Optional, represents the name of the remote endpoint, if different than + // the original target name. + RemoteName string + SocketOptions *SocketOptionData + Security credentials.ChannelzSecurityValue +} + +// Socket is the interface that should be satisfied in order to be tracked by +// channelz as Socket. +type Socket interface { + ChannelzMetric() *SocketInternalMetric +} + +type listenSocket struct { + refName string + s Socket + id int64 + pid int64 + cm *channelMap +} + +func (ls *listenSocket) addChild(id int64, e entry) { + grpclog.Errorf("cannot add a child (id = %d) of type %T to a listen socket", id, e) +} + +func (ls *listenSocket) deleteChild(id int64) { + grpclog.Errorf("cannot delete a child (id = %d) from a listen socket", id) +} + +func (ls *listenSocket) triggerDelete() { + ls.cm.deleteEntry(ls.id) + ls.cm.findEntry(ls.pid).deleteChild(ls.id) +} + +func (ls *listenSocket) deleteSelfIfReady() { + grpclog.Errorf("cannot call deleteSelfIfReady on a listen socket") +} + +func (ls *listenSocket) getParentID() int64 { + return ls.pid +} + +type normalSocket struct { + refName string + s Socket + id int64 + pid int64 + cm *channelMap +} + +func (ns *normalSocket) addChild(id int64, e entry) { + grpclog.Errorf("cannot add a child (id = %d) of type %T to a normal socket", id, e) +} + +func (ns *normalSocket) deleteChild(id int64) { + grpclog.Errorf("cannot delete a child (id = %d) from a normal socket", id) +} + +func (ns *normalSocket) triggerDelete() { + ns.cm.deleteEntry(ns.id) + ns.cm.findEntry(ns.pid).deleteChild(ns.id) +} + +func (ns *normalSocket) deleteSelfIfReady() { + grpclog.Errorf("cannot call deleteSelfIfReady on a normal socket") +} + +func (ns *normalSocket) getParentID() int64 { + return ns.pid +} + +// ServerMetric defines the info channelz provides for a specific Server, which +// includes ServerInternalMetric and channelz-specific data, such as channelz id, +// child list, etc. +type ServerMetric struct { + // ID is the channelz id of this server. + ID int64 + // RefName is the human readable reference string of this server. + RefName string + // ServerData contains server internal metric reported by the server through + // ChannelzMetric(). + ServerData *ServerInternalMetric + // ListenSockets tracks the listener socket type children of this server in the + // format of a map from socket channelz id to corresponding reference string. + ListenSockets map[int64]string +} + +// ServerInternalMetric defines the struct that the implementor of Server interface +// should return from ChannelzMetric(). +type ServerInternalMetric struct { + // The number of incoming calls started on the server. + CallsStarted int64 + // The number of incoming calls that have completed with an OK status. + CallsSucceeded int64 + // The number of incoming calls that have a completed with a non-OK status. + CallsFailed int64 + // The last time a call was started on the server. + LastCallStartedTimestamp time.Time +} + +// Server is the interface to be satisfied in order to be tracked by channelz as +// Server. +type Server interface { + ChannelzMetric() *ServerInternalMetric +} + +type server struct { + refName string + s Server + closeCalled bool + sockets map[int64]string + listenSockets map[int64]string + id int64 + cm *channelMap +} + +func (s *server) addChild(id int64, e entry) { + switch v := e.(type) { + case *normalSocket: + s.sockets[id] = v.refName + case *listenSocket: + s.listenSockets[id] = v.refName + default: + grpclog.Errorf("cannot add a child (id = %d) of type %T to a server", id, e) + } +} + +func (s *server) deleteChild(id int64) { + delete(s.sockets, id) + delete(s.listenSockets, id) + s.deleteSelfIfReady() +} + +func (s *server) triggerDelete() { + s.closeCalled = true + s.deleteSelfIfReady() +} + +func (s *server) deleteSelfIfReady() { + if !s.closeCalled || len(s.sockets)+len(s.listenSockets) != 0 { + return + } + s.cm.deleteEntry(s.id) +} + +func (s *server) getParentID() int64 { + return 0 +} + +type tracedChannel interface { + getChannelTrace() *channelTrace + incrTraceRefCount() + decrTraceRefCount() + getRefName() string +} + +type channelTrace struct { + cm *channelMap + createdTime time.Time + eventCount int64 + mu sync.Mutex + events []*TraceEvent +} + +func (c *channelTrace) append(e *TraceEvent) { + c.mu.Lock() + if len(c.events) == getMaxTraceEntry() { + del := c.events[0] + c.events = c.events[1:] + if del.RefID != 0 { + // start recursive cleanup in a goroutine to not block the call originated from grpc. + go func() { + // need to acquire c.cm.mu lock to call the unlocked attemptCleanup func. + c.cm.mu.Lock() + c.cm.decrTraceRefCount(del.RefID) + c.cm.mu.Unlock() + }() + } + } + e.Timestamp = time.Now() + c.events = append(c.events, e) + c.eventCount++ + c.mu.Unlock() +} + +func (c *channelTrace) clear() { + c.mu.Lock() + for _, e := range c.events { + if e.RefID != 0 { + // caller should have already held the c.cm.mu lock. + c.cm.decrTraceRefCount(e.RefID) + } + } + c.mu.Unlock() +} + +// Severity is the severity level of a trace event. +// The canonical enumeration of all valid values is here: +// https://github.com/grpc/grpc-proto/blob/9b13d199cc0d4703c7ea26c9c330ba695866eb23/grpc/channelz/v1/channelz.proto#L126. +type Severity int + +const ( + // CtUNKNOWN indicates unknown severity of a trace event. + CtUNKNOWN Severity = iota + // CtINFO indicates info level severity of a trace event. + CtINFO + // CtWarning indicates warning level severity of a trace event. + CtWarning + // CtError indicates error level severity of a trace event. + CtError +) + +// RefChannelType is the type of the entity being referenced in a trace event. +type RefChannelType int + +const ( + // RefChannel indicates the referenced entity is a Channel. + RefChannel RefChannelType = iota + // RefSubChannel indicates the referenced entity is a SubChannel. + RefSubChannel +) + +func (c *channelTrace) dumpData() *ChannelTrace { + c.mu.Lock() + ct := &ChannelTrace{EventNum: c.eventCount, CreationTime: c.createdTime} + ct.Events = c.events[:len(c.events)] + c.mu.Unlock() + return ct +} diff --git a/vendor/google.golang.org/grpc/internal/channelz/types_linux.go b/vendor/google.golang.org/grpc/internal/channelz/types_linux.go new file mode 100644 index 000000000000..07215396d64a --- /dev/null +++ b/vendor/google.golang.org/grpc/internal/channelz/types_linux.go @@ -0,0 +1,53 @@ +// +build !appengine,go1.7 + +/* + * + * Copyright 2018 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package channelz + +import ( + "syscall" + + "golang.org/x/sys/unix" +) + +// SocketOptionData defines the struct to hold socket option data, and related +// getter function to obtain info from fd. +type SocketOptionData struct { + Linger *unix.Linger + RecvTimeout *unix.Timeval + SendTimeout *unix.Timeval + TCPInfo *unix.TCPInfo +} + +// Getsockopt defines the function to get socket options requested by channelz. +// It is to be passed to syscall.RawConn.Control(). +func (s *SocketOptionData) Getsockopt(fd uintptr) { + if v, err := unix.GetsockoptLinger(int(fd), syscall.SOL_SOCKET, syscall.SO_LINGER); err == nil { + s.Linger = v + } + if v, err := unix.GetsockoptTimeval(int(fd), syscall.SOL_SOCKET, syscall.SO_RCVTIMEO); err == nil { + s.RecvTimeout = v + } + if v, err := unix.GetsockoptTimeval(int(fd), syscall.SOL_SOCKET, syscall.SO_SNDTIMEO); err == nil { + s.SendTimeout = v + } + if v, err := unix.GetsockoptTCPInfo(int(fd), syscall.SOL_TCP, syscall.TCP_INFO); err == nil { + s.TCPInfo = v + } +} diff --git a/vendor/google.golang.org/grpc/internal/channelz/types_nonlinux.go b/vendor/google.golang.org/grpc/internal/channelz/types_nonlinux.go new file mode 100644 index 000000000000..884910c4e02c --- /dev/null +++ b/vendor/google.golang.org/grpc/internal/channelz/types_nonlinux.go @@ -0,0 +1,38 @@ +// +build !linux appengine !go1.7 + +/* + * + * Copyright 2018 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package channelz + +import "google.golang.org/grpc/grpclog" + +func init() { + grpclog.Infof("Channelz: socket options are not supported on non-linux os and appengine.") +} + +// SocketOptionData defines the struct to hold socket option data, and related +// getter function to obtain info from fd. +// Windows OS doesn't support Socket Option +type SocketOptionData struct { +} + +// Getsockopt defines the function to get socket options requested by channelz. +// It is to be passed to syscall.RawConn.Control(). +// Windows OS doesn't support Socket Option +func (s *SocketOptionData) Getsockopt(fd uintptr) {} diff --git a/vendor/google.golang.org/grpc/internal/channelz/util_linux_go19.go b/vendor/google.golang.org/grpc/internal/channelz/util_linux_go19.go new file mode 100644 index 000000000000..e1e9e32d7397 --- /dev/null +++ b/vendor/google.golang.org/grpc/internal/channelz/util_linux_go19.go @@ -0,0 +1,39 @@ +// +build linux,go1.9,!appengine + +/* + * + * Copyright 2018 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package channelz + +import ( + "syscall" +) + +// GetSocketOption gets the socket option info of the conn. +func GetSocketOption(socket interface{}) *SocketOptionData { + c, ok := socket.(syscall.Conn) + if !ok { + return nil + } + data := &SocketOptionData{} + if rawConn, err := c.SyscallConn(); err == nil { + rawConn.Control(data.Getsockopt) + return data + } + return nil +} diff --git a/vendor/google.golang.org/grpc/internal/channelz/util_nonlinux_pre_go19.go b/vendor/google.golang.org/grpc/internal/channelz/util_nonlinux_pre_go19.go new file mode 100644 index 000000000000..1d4da952d85e --- /dev/null +++ b/vendor/google.golang.org/grpc/internal/channelz/util_nonlinux_pre_go19.go @@ -0,0 +1,26 @@ +// +build !linux !go1.9 appengine + +/* + * + * Copyright 2018 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package channelz + +// GetSocketOption gets the socket option info of the conn. +func GetSocketOption(c interface{}) *SocketOptionData { + return nil +} diff --git a/vendor/google.golang.org/grpc/internal/envconfig/envconfig.go b/vendor/google.golang.org/grpc/internal/envconfig/envconfig.go new file mode 100644 index 000000000000..3ee8740f1f93 --- /dev/null +++ b/vendor/google.golang.org/grpc/internal/envconfig/envconfig.go @@ -0,0 +1,35 @@ +/* + * + * Copyright 2018 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +// Package envconfig contains grpc settings configured by environment variables. +package envconfig + +import ( + "os" + "strings" +) + +const ( + prefix = "GRPC_GO_" + retryStr = prefix + "RETRY" +) + +var ( + // Retry is set if retry is explicitly enabled via "GRPC_GO_RETRY=on". + Retry = strings.EqualFold(os.Getenv(retryStr), "on") +) diff --git a/vendor/google.golang.org/grpc/internal/grpcrand/grpcrand.go b/vendor/google.golang.org/grpc/internal/grpcrand/grpcrand.go new file mode 100644 index 000000000000..200b115ca209 --- /dev/null +++ b/vendor/google.golang.org/grpc/internal/grpcrand/grpcrand.go @@ -0,0 +1,56 @@ +/* + * + * Copyright 2018 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +// Package grpcrand implements math/rand functions in a concurrent-safe way +// with a global random source, independent of math/rand's global source. +package grpcrand + +import ( + "math/rand" + "sync" + "time" +) + +var ( + r = rand.New(rand.NewSource(time.Now().UnixNano())) + mu sync.Mutex +) + +// Int63n implements rand.Int63n on the grpcrand global source. +func Int63n(n int64) int64 { + mu.Lock() + res := r.Int63n(n) + mu.Unlock() + return res +} + +// Intn implements rand.Intn on the grpcrand global source. +func Intn(n int) int { + mu.Lock() + res := r.Intn(n) + mu.Unlock() + return res +} + +// Float64 implements rand.Float64 on the grpcrand global source. +func Float64() float64 { + mu.Lock() + res := r.Float64() + mu.Unlock() + return res +} diff --git a/vendor/google.golang.org/grpc/internal/internal.go b/vendor/google.golang.org/grpc/internal/internal.go index 53f1775201ce..c35afb05ee24 100644 --- a/vendor/google.golang.org/grpc/internal/internal.go +++ b/vendor/google.golang.org/grpc/internal/internal.go @@ -15,13 +15,14 @@ * */ -// Package internal contains gRPC-internal code for testing, to avoid polluting -// the godoc of the top-level grpc package. +// Package internal contains gRPC-internal code, to avoid polluting +// the godoc of the top-level grpc package. It must not import any grpc +// symbols to avoid circular dependencies. package internal -// TestingUseHandlerImpl enables the http.Handler-based server implementation. -// It must be called before Serve and requires TLS credentials. -// -// The provided grpcServer must be of type *grpc.Server. It is untyped -// for circular dependency reasons. -var TestingUseHandlerImpl func(grpcServer interface{}) +var ( + // WithContextDialer is exported by clientconn.go + WithContextDialer interface{} // func(context.Context, string) (net.Conn, error) grpc.DialOption + // WithResolverBuilder is exported by clientconn.go + WithResolverBuilder interface{} // func (resolver.Builder) grpc.DialOption +) diff --git a/vendor/google.golang.org/grpc/transport/bdp_estimator.go b/vendor/google.golang.org/grpc/internal/transport/bdp_estimator.go similarity index 100% rename from vendor/google.golang.org/grpc/transport/bdp_estimator.go rename to vendor/google.golang.org/grpc/internal/transport/bdp_estimator.go diff --git a/vendor/google.golang.org/grpc/internal/transport/controlbuf.go b/vendor/google.golang.org/grpc/internal/transport/controlbuf.go new file mode 100644 index 000000000000..204ba1588bbf --- /dev/null +++ b/vendor/google.golang.org/grpc/internal/transport/controlbuf.go @@ -0,0 +1,852 @@ +/* + * + * Copyright 2014 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package transport + +import ( + "bytes" + "fmt" + "runtime" + "sync" + + "golang.org/x/net/http2" + "golang.org/x/net/http2/hpack" +) + +var updateHeaderTblSize = func(e *hpack.Encoder, v uint32) { + e.SetMaxDynamicTableSizeLimit(v) +} + +type itemNode struct { + it interface{} + next *itemNode +} + +type itemList struct { + head *itemNode + tail *itemNode +} + +func (il *itemList) enqueue(i interface{}) { + n := &itemNode{it: i} + if il.tail == nil { + il.head, il.tail = n, n + return + } + il.tail.next = n + il.tail = n +} + +// peek returns the first item in the list without removing it from the +// list. +func (il *itemList) peek() interface{} { + return il.head.it +} + +func (il *itemList) dequeue() interface{} { + if il.head == nil { + return nil + } + i := il.head.it + il.head = il.head.next + if il.head == nil { + il.tail = nil + } + return i +} + +func (il *itemList) dequeueAll() *itemNode { + h := il.head + il.head, il.tail = nil, nil + return h +} + +func (il *itemList) isEmpty() bool { + return il.head == nil +} + +// The following defines various control items which could flow through +// the control buffer of transport. They represent different aspects of +// control tasks, e.g., flow control, settings, streaming resetting, etc. + +// registerStream is used to register an incoming stream with loopy writer. +type registerStream struct { + streamID uint32 + wq *writeQuota +} + +// headerFrame is also used to register stream on the client-side. +type headerFrame struct { + streamID uint32 + hf []hpack.HeaderField + endStream bool // Valid on server side. + initStream func(uint32) (bool, error) // Used only on the client side. + onWrite func() + wq *writeQuota // write quota for the stream created. + cleanup *cleanupStream // Valid on the server side. + onOrphaned func(error) // Valid on client-side +} + +type cleanupStream struct { + streamID uint32 + rst bool + rstCode http2.ErrCode + onWrite func() +} + +type dataFrame struct { + streamID uint32 + endStream bool + h []byte + d []byte + // onEachWrite is called every time + // a part of d is written out. + onEachWrite func() +} + +type incomingWindowUpdate struct { + streamID uint32 + increment uint32 +} + +type outgoingWindowUpdate struct { + streamID uint32 + increment uint32 +} + +type incomingSettings struct { + ss []http2.Setting +} + +type outgoingSettings struct { + ss []http2.Setting +} + +type incomingGoAway struct { +} + +type goAway struct { + code http2.ErrCode + debugData []byte + headsUp bool + closeConn bool +} + +type ping struct { + ack bool + data [8]byte +} + +type outFlowControlSizeRequest struct { + resp chan uint32 +} + +type outStreamState int + +const ( + active outStreamState = iota + empty + waitingOnStreamQuota +) + +type outStream struct { + id uint32 + state outStreamState + itl *itemList + bytesOutStanding int + wq *writeQuota + + next *outStream + prev *outStream +} + +func (s *outStream) deleteSelf() { + if s.prev != nil { + s.prev.next = s.next + } + if s.next != nil { + s.next.prev = s.prev + } + s.next, s.prev = nil, nil +} + +type outStreamList struct { + // Following are sentinel objects that mark the + // beginning and end of the list. They do not + // contain any item lists. All valid objects are + // inserted in between them. + // This is needed so that an outStream object can + // deleteSelf() in O(1) time without knowing which + // list it belongs to. + head *outStream + tail *outStream +} + +func newOutStreamList() *outStreamList { + head, tail := new(outStream), new(outStream) + head.next = tail + tail.prev = head + return &outStreamList{ + head: head, + tail: tail, + } +} + +func (l *outStreamList) enqueue(s *outStream) { + e := l.tail.prev + e.next = s + s.prev = e + s.next = l.tail + l.tail.prev = s +} + +// remove from the beginning of the list. +func (l *outStreamList) dequeue() *outStream { + b := l.head.next + if b == l.tail { + return nil + } + b.deleteSelf() + return b +} + +// controlBuffer is a way to pass information to loopy. +// Information is passed as specific struct types called control frames. +// A control frame not only represents data, messages or headers to be sent out +// but can also be used to instruct loopy to update its internal state. +// It shouldn't be confused with an HTTP2 frame, although some of the control frames +// like dataFrame and headerFrame do go out on wire as HTTP2 frames. +type controlBuffer struct { + ch chan struct{} + done <-chan struct{} + mu sync.Mutex + consumerWaiting bool + list *itemList + err error +} + +func newControlBuffer(done <-chan struct{}) *controlBuffer { + return &controlBuffer{ + ch: make(chan struct{}, 1), + list: &itemList{}, + done: done, + } +} + +func (c *controlBuffer) put(it interface{}) error { + _, err := c.executeAndPut(nil, it) + return err +} + +func (c *controlBuffer) executeAndPut(f func(it interface{}) bool, it interface{}) (bool, error) { + var wakeUp bool + c.mu.Lock() + if c.err != nil { + c.mu.Unlock() + return false, c.err + } + if f != nil { + if !f(it) { // f wasn't successful + c.mu.Unlock() + return false, nil + } + } + if c.consumerWaiting { + wakeUp = true + c.consumerWaiting = false + } + c.list.enqueue(it) + c.mu.Unlock() + if wakeUp { + select { + case c.ch <- struct{}{}: + default: + } + } + return true, nil +} + +// Note argument f should never be nil. +func (c *controlBuffer) execute(f func(it interface{}) bool, it interface{}) (bool, error) { + c.mu.Lock() + if c.err != nil { + c.mu.Unlock() + return false, c.err + } + if !f(it) { // f wasn't successful + c.mu.Unlock() + return false, nil + } + c.mu.Unlock() + return true, nil +} + +func (c *controlBuffer) get(block bool) (interface{}, error) { + for { + c.mu.Lock() + if c.err != nil { + c.mu.Unlock() + return nil, c.err + } + if !c.list.isEmpty() { + h := c.list.dequeue() + c.mu.Unlock() + return h, nil + } + if !block { + c.mu.Unlock() + return nil, nil + } + c.consumerWaiting = true + c.mu.Unlock() + select { + case <-c.ch: + case <-c.done: + c.finish() + return nil, ErrConnClosing + } + } +} + +func (c *controlBuffer) finish() { + c.mu.Lock() + if c.err != nil { + c.mu.Unlock() + return + } + c.err = ErrConnClosing + // There may be headers for streams in the control buffer. + // These streams need to be cleaned out since the transport + // is still not aware of these yet. + for head := c.list.dequeueAll(); head != nil; head = head.next { + hdr, ok := head.it.(*headerFrame) + if !ok { + continue + } + if hdr.onOrphaned != nil { // It will be nil on the server-side. + hdr.onOrphaned(ErrConnClosing) + } + } + c.mu.Unlock() +} + +type side int + +const ( + clientSide side = iota + serverSide +) + +// Loopy receives frames from the control buffer. +// Each frame is handled individually; most of the work done by loopy goes +// into handling data frames. Loopy maintains a queue of active streams, and each +// stream maintains a queue of data frames; as loopy receives data frames +// it gets added to the queue of the relevant stream. +// Loopy goes over this list of active streams by processing one node every iteration, +// thereby closely resemebling to a round-robin scheduling over all streams. While +// processing a stream, loopy writes out data bytes from this stream capped by the min +// of http2MaxFrameLen, connection-level flow control and stream-level flow control. +type loopyWriter struct { + side side + cbuf *controlBuffer + sendQuota uint32 + oiws uint32 // outbound initial window size. + // estdStreams is map of all established streams that are not cleaned-up yet. + // On client-side, this is all streams whose headers were sent out. + // On server-side, this is all streams whose headers were received. + estdStreams map[uint32]*outStream // Established streams. + // activeStreams is a linked-list of all streams that have data to send and some + // stream-level flow control quota. + // Each of these streams internally have a list of data items(and perhaps trailers + // on the server-side) to be sent out. + activeStreams *outStreamList + framer *framer + hBuf *bytes.Buffer // The buffer for HPACK encoding. + hEnc *hpack.Encoder // HPACK encoder. + bdpEst *bdpEstimator + draining bool + + // Side-specific handlers + ssGoAwayHandler func(*goAway) (bool, error) +} + +func newLoopyWriter(s side, fr *framer, cbuf *controlBuffer, bdpEst *bdpEstimator) *loopyWriter { + var buf bytes.Buffer + l := &loopyWriter{ + side: s, + cbuf: cbuf, + sendQuota: defaultWindowSize, + oiws: defaultWindowSize, + estdStreams: make(map[uint32]*outStream), + activeStreams: newOutStreamList(), + framer: fr, + hBuf: &buf, + hEnc: hpack.NewEncoder(&buf), + bdpEst: bdpEst, + } + return l +} + +const minBatchSize = 1000 + +// run should be run in a separate goroutine. +// It reads control frames from controlBuf and processes them by: +// 1. Updating loopy's internal state, or/and +// 2. Writing out HTTP2 frames on the wire. +// +// Loopy keeps all active streams with data to send in a linked-list. +// All streams in the activeStreams linked-list must have both: +// 1. Data to send, and +// 2. Stream level flow control quota available. +// +// In each iteration of run loop, other than processing the incoming control +// frame, loopy calls processData, which processes one node from the activeStreams linked-list. +// This results in writing of HTTP2 frames into an underlying write buffer. +// When there's no more control frames to read from controlBuf, loopy flushes the write buffer. +// As an optimization, to increase the batch size for each flush, loopy yields the processor, once +// if the batch size is too low to give stream goroutines a chance to fill it up. +func (l *loopyWriter) run() (err error) { + defer func() { + if err == ErrConnClosing { + // Don't log ErrConnClosing as error since it happens + // 1. When the connection is closed by some other known issue. + // 2. User closed the connection. + // 3. A graceful close of connection. + infof("transport: loopyWriter.run returning. %v", err) + err = nil + } + }() + for { + it, err := l.cbuf.get(true) + if err != nil { + return err + } + if err = l.handle(it); err != nil { + return err + } + if _, err = l.processData(); err != nil { + return err + } + gosched := true + hasdata: + for { + it, err := l.cbuf.get(false) + if err != nil { + return err + } + if it != nil { + if err = l.handle(it); err != nil { + return err + } + if _, err = l.processData(); err != nil { + return err + } + continue hasdata + } + isEmpty, err := l.processData() + if err != nil { + return err + } + if !isEmpty { + continue hasdata + } + if gosched { + gosched = false + if l.framer.writer.offset < minBatchSize { + runtime.Gosched() + continue hasdata + } + } + l.framer.writer.Flush() + break hasdata + + } + } +} + +func (l *loopyWriter) outgoingWindowUpdateHandler(w *outgoingWindowUpdate) error { + return l.framer.fr.WriteWindowUpdate(w.streamID, w.increment) +} + +func (l *loopyWriter) incomingWindowUpdateHandler(w *incomingWindowUpdate) error { + // Otherwise update the quota. + if w.streamID == 0 { + l.sendQuota += w.increment + return nil + } + // Find the stream and update it. + if str, ok := l.estdStreams[w.streamID]; ok { + str.bytesOutStanding -= int(w.increment) + if strQuota := int(l.oiws) - str.bytesOutStanding; strQuota > 0 && str.state == waitingOnStreamQuota { + str.state = active + l.activeStreams.enqueue(str) + return nil + } + } + return nil +} + +func (l *loopyWriter) outgoingSettingsHandler(s *outgoingSettings) error { + return l.framer.fr.WriteSettings(s.ss...) +} + +func (l *loopyWriter) incomingSettingsHandler(s *incomingSettings) error { + if err := l.applySettings(s.ss); err != nil { + return err + } + return l.framer.fr.WriteSettingsAck() +} + +func (l *loopyWriter) registerStreamHandler(h *registerStream) error { + str := &outStream{ + id: h.streamID, + state: empty, + itl: &itemList{}, + wq: h.wq, + } + l.estdStreams[h.streamID] = str + return nil +} + +func (l *loopyWriter) headerHandler(h *headerFrame) error { + if l.side == serverSide { + str, ok := l.estdStreams[h.streamID] + if !ok { + warningf("transport: loopy doesn't recognize the stream: %d", h.streamID) + return nil + } + // Case 1.A: Server is responding back with headers. + if !h.endStream { + return l.writeHeader(h.streamID, h.endStream, h.hf, h.onWrite) + } + // else: Case 1.B: Server wants to close stream. + + if str.state != empty { // either active or waiting on stream quota. + // add it str's list of items. + str.itl.enqueue(h) + return nil + } + if err := l.writeHeader(h.streamID, h.endStream, h.hf, h.onWrite); err != nil { + return err + } + return l.cleanupStreamHandler(h.cleanup) + } + // Case 2: Client wants to originate stream. + str := &outStream{ + id: h.streamID, + state: empty, + itl: &itemList{}, + wq: h.wq, + } + str.itl.enqueue(h) + return l.originateStream(str) +} + +func (l *loopyWriter) originateStream(str *outStream) error { + hdr := str.itl.dequeue().(*headerFrame) + sendPing, err := hdr.initStream(str.id) + if err != nil { + if err == ErrConnClosing { + return err + } + // Other errors(errStreamDrain) need not close transport. + return nil + } + if err = l.writeHeader(str.id, hdr.endStream, hdr.hf, hdr.onWrite); err != nil { + return err + } + l.estdStreams[str.id] = str + if sendPing { + return l.pingHandler(&ping{data: [8]byte{}}) + } + return nil +} + +func (l *loopyWriter) writeHeader(streamID uint32, endStream bool, hf []hpack.HeaderField, onWrite func()) error { + if onWrite != nil { + onWrite() + } + l.hBuf.Reset() + for _, f := range hf { + if err := l.hEnc.WriteField(f); err != nil { + warningf("transport: loopyWriter.writeHeader encountered error while encoding headers:", err) + } + } + var ( + err error + endHeaders, first bool + ) + first = true + for !endHeaders { + size := l.hBuf.Len() + if size > http2MaxFrameLen { + size = http2MaxFrameLen + } else { + endHeaders = true + } + if first { + first = false + err = l.framer.fr.WriteHeaders(http2.HeadersFrameParam{ + StreamID: streamID, + BlockFragment: l.hBuf.Next(size), + EndStream: endStream, + EndHeaders: endHeaders, + }) + } else { + err = l.framer.fr.WriteContinuation( + streamID, + endHeaders, + l.hBuf.Next(size), + ) + } + if err != nil { + return err + } + } + return nil +} + +func (l *loopyWriter) preprocessData(df *dataFrame) error { + str, ok := l.estdStreams[df.streamID] + if !ok { + return nil + } + // If we got data for a stream it means that + // stream was originated and the headers were sent out. + str.itl.enqueue(df) + if str.state == empty { + str.state = active + l.activeStreams.enqueue(str) + } + return nil +} + +func (l *loopyWriter) pingHandler(p *ping) error { + if !p.ack { + l.bdpEst.timesnap(p.data) + } + return l.framer.fr.WritePing(p.ack, p.data) + +} + +func (l *loopyWriter) outFlowControlSizeRequestHandler(o *outFlowControlSizeRequest) error { + o.resp <- l.sendQuota + return nil +} + +func (l *loopyWriter) cleanupStreamHandler(c *cleanupStream) error { + c.onWrite() + if str, ok := l.estdStreams[c.streamID]; ok { + // On the server side it could be a trailers-only response or + // a RST_STREAM before stream initialization thus the stream might + // not be established yet. + delete(l.estdStreams, c.streamID) + str.deleteSelf() + } + if c.rst { // If RST_STREAM needs to be sent. + if err := l.framer.fr.WriteRSTStream(c.streamID, c.rstCode); err != nil { + return err + } + } + if l.side == clientSide && l.draining && len(l.estdStreams) == 0 { + return ErrConnClosing + } + return nil +} + +func (l *loopyWriter) incomingGoAwayHandler(*incomingGoAway) error { + if l.side == clientSide { + l.draining = true + if len(l.estdStreams) == 0 { + return ErrConnClosing + } + } + return nil +} + +func (l *loopyWriter) goAwayHandler(g *goAway) error { + // Handling of outgoing GoAway is very specific to side. + if l.ssGoAwayHandler != nil { + draining, err := l.ssGoAwayHandler(g) + if err != nil { + return err + } + l.draining = draining + } + return nil +} + +func (l *loopyWriter) handle(i interface{}) error { + switch i := i.(type) { + case *incomingWindowUpdate: + return l.incomingWindowUpdateHandler(i) + case *outgoingWindowUpdate: + return l.outgoingWindowUpdateHandler(i) + case *incomingSettings: + return l.incomingSettingsHandler(i) + case *outgoingSettings: + return l.outgoingSettingsHandler(i) + case *headerFrame: + return l.headerHandler(i) + case *registerStream: + return l.registerStreamHandler(i) + case *cleanupStream: + return l.cleanupStreamHandler(i) + case *incomingGoAway: + return l.incomingGoAwayHandler(i) + case *dataFrame: + return l.preprocessData(i) + case *ping: + return l.pingHandler(i) + case *goAway: + return l.goAwayHandler(i) + case *outFlowControlSizeRequest: + return l.outFlowControlSizeRequestHandler(i) + default: + return fmt.Errorf("transport: unknown control message type %T", i) + } +} + +func (l *loopyWriter) applySettings(ss []http2.Setting) error { + for _, s := range ss { + switch s.ID { + case http2.SettingInitialWindowSize: + o := l.oiws + l.oiws = s.Val + if o < l.oiws { + // If the new limit is greater make all depleted streams active. + for _, stream := range l.estdStreams { + if stream.state == waitingOnStreamQuota { + stream.state = active + l.activeStreams.enqueue(stream) + } + } + } + case http2.SettingHeaderTableSize: + updateHeaderTblSize(l.hEnc, s.Val) + } + } + return nil +} + +// processData removes the first stream from active streams, writes out at most 16KB +// of its data and then puts it at the end of activeStreams if there's still more data +// to be sent and stream has some stream-level flow control. +func (l *loopyWriter) processData() (bool, error) { + if l.sendQuota == 0 { + return true, nil + } + str := l.activeStreams.dequeue() // Remove the first stream. + if str == nil { + return true, nil + } + dataItem := str.itl.peek().(*dataFrame) // Peek at the first data item this stream. + // A data item is represented by a dataFrame, since it later translates into + // multiple HTTP2 data frames. + // Every dataFrame has two buffers; h that keeps grpc-message header and d that is acutal data. + // As an optimization to keep wire traffic low, data from d is copied to h to make as big as the + // maximum possilbe HTTP2 frame size. + + if len(dataItem.h) == 0 && len(dataItem.d) == 0 { // Empty data frame + // Client sends out empty data frame with endStream = true + if err := l.framer.fr.WriteData(dataItem.streamID, dataItem.endStream, nil); err != nil { + return false, err + } + str.itl.dequeue() // remove the empty data item from stream + if str.itl.isEmpty() { + str.state = empty + } else if trailer, ok := str.itl.peek().(*headerFrame); ok { // the next item is trailers. + if err := l.writeHeader(trailer.streamID, trailer.endStream, trailer.hf, trailer.onWrite); err != nil { + return false, err + } + if err := l.cleanupStreamHandler(trailer.cleanup); err != nil { + return false, nil + } + } else { + l.activeStreams.enqueue(str) + } + return false, nil + } + var ( + idx int + buf []byte + ) + if len(dataItem.h) != 0 { // data header has not been written out yet. + buf = dataItem.h + } else { + idx = 1 + buf = dataItem.d + } + size := http2MaxFrameLen + if len(buf) < size { + size = len(buf) + } + if strQuota := int(l.oiws) - str.bytesOutStanding; strQuota <= 0 { // stream-level flow control. + str.state = waitingOnStreamQuota + return false, nil + } else if strQuota < size { + size = strQuota + } + + if l.sendQuota < uint32(size) { // connection-level flow control. + size = int(l.sendQuota) + } + // Now that outgoing flow controls are checked we can replenish str's write quota + str.wq.replenish(size) + var endStream bool + // If this is the last data message on this stream and all of it can be written in this iteration. + if dataItem.endStream && size == len(buf) { + // buf contains either data or it contains header but data is empty. + if idx == 1 || len(dataItem.d) == 0 { + endStream = true + } + } + if dataItem.onEachWrite != nil { + dataItem.onEachWrite() + } + if err := l.framer.fr.WriteData(dataItem.streamID, endStream, buf[:size]); err != nil { + return false, err + } + buf = buf[size:] + str.bytesOutStanding += size + l.sendQuota -= uint32(size) + if idx == 0 { + dataItem.h = buf + } else { + dataItem.d = buf + } + + if len(dataItem.h) == 0 && len(dataItem.d) == 0 { // All the data from that message was written out. + str.itl.dequeue() + } + if str.itl.isEmpty() { + str.state = empty + } else if trailer, ok := str.itl.peek().(*headerFrame); ok { // The next item is trailers. + if err := l.writeHeader(trailer.streamID, trailer.endStream, trailer.hf, trailer.onWrite); err != nil { + return false, err + } + if err := l.cleanupStreamHandler(trailer.cleanup); err != nil { + return false, err + } + } else if int(l.oiws)-str.bytesOutStanding <= 0 { // Ran out of stream quota. + str.state = waitingOnStreamQuota + } else { // Otherwise add it back to the list of active streams. + l.activeStreams.enqueue(str) + } + return false, nil +} diff --git a/vendor/google.golang.org/grpc/internal/transport/defaults.go b/vendor/google.golang.org/grpc/internal/transport/defaults.go new file mode 100644 index 000000000000..9fa306b2e07a --- /dev/null +++ b/vendor/google.golang.org/grpc/internal/transport/defaults.go @@ -0,0 +1,49 @@ +/* + * + * Copyright 2018 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package transport + +import ( + "math" + "time" +) + +const ( + // The default value of flow control window size in HTTP2 spec. + defaultWindowSize = 65535 + // The initial window size for flow control. + initialWindowSize = defaultWindowSize // for an RPC + infinity = time.Duration(math.MaxInt64) + defaultClientKeepaliveTime = infinity + defaultClientKeepaliveTimeout = 20 * time.Second + defaultMaxStreamsClient = 100 + defaultMaxConnectionIdle = infinity + defaultMaxConnectionAge = infinity + defaultMaxConnectionAgeGrace = infinity + defaultServerKeepaliveTime = 2 * time.Hour + defaultServerKeepaliveTimeout = 20 * time.Second + defaultKeepalivePolicyMinTime = 5 * time.Minute + // max window limit set by HTTP2 Specs. + maxWindowSize = math.MaxInt32 + // defaultWriteQuota is the default value for number of data + // bytes that each stream can schedule before some of it being + // flushed out. + defaultWriteQuota = 64 * 1024 + defaultClientMaxHeaderListSize = uint32(16 << 20) + defaultServerMaxHeaderListSize = uint32(16 << 20) +) diff --git a/vendor/google.golang.org/grpc/internal/transport/flowcontrol.go b/vendor/google.golang.org/grpc/internal/transport/flowcontrol.go new file mode 100644 index 000000000000..5ea997a7e45b --- /dev/null +++ b/vendor/google.golang.org/grpc/internal/transport/flowcontrol.go @@ -0,0 +1,218 @@ +/* + * + * Copyright 2014 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package transport + +import ( + "fmt" + "math" + "sync" + "sync/atomic" +) + +// writeQuota is a soft limit on the amount of data a stream can +// schedule before some of it is written out. +type writeQuota struct { + quota int32 + // get waits on read from when quota goes less than or equal to zero. + // replenish writes on it when quota goes positive again. + ch chan struct{} + // done is triggered in error case. + done <-chan struct{} + // replenish is called by loopyWriter to give quota back to. + // It is implemented as a field so that it can be updated + // by tests. + replenish func(n int) +} + +func newWriteQuota(sz int32, done <-chan struct{}) *writeQuota { + w := &writeQuota{ + quota: sz, + ch: make(chan struct{}, 1), + done: done, + } + w.replenish = w.realReplenish + return w +} + +func (w *writeQuota) get(sz int32) error { + for { + if atomic.LoadInt32(&w.quota) > 0 { + atomic.AddInt32(&w.quota, -sz) + return nil + } + select { + case <-w.ch: + continue + case <-w.done: + return errStreamDone + } + } +} + +func (w *writeQuota) realReplenish(n int) { + sz := int32(n) + a := atomic.AddInt32(&w.quota, sz) + b := a - sz + if b <= 0 && a > 0 { + select { + case w.ch <- struct{}{}: + default: + } + } +} + +type trInFlow struct { + limit uint32 + unacked uint32 + effectiveWindowSize uint32 +} + +func (f *trInFlow) newLimit(n uint32) uint32 { + d := n - f.limit + f.limit = n + f.updateEffectiveWindowSize() + return d +} + +func (f *trInFlow) onData(n uint32) uint32 { + f.unacked += n + if f.unacked >= f.limit/4 { + w := f.unacked + f.unacked = 0 + f.updateEffectiveWindowSize() + return w + } + f.updateEffectiveWindowSize() + return 0 +} + +func (f *trInFlow) reset() uint32 { + w := f.unacked + f.unacked = 0 + f.updateEffectiveWindowSize() + return w +} + +func (f *trInFlow) updateEffectiveWindowSize() { + atomic.StoreUint32(&f.effectiveWindowSize, f.limit-f.unacked) +} + +func (f *trInFlow) getSize() uint32 { + return atomic.LoadUint32(&f.effectiveWindowSize) +} + +// TODO(mmukhi): Simplify this code. +// inFlow deals with inbound flow control +type inFlow struct { + mu sync.Mutex + // The inbound flow control limit for pending data. + limit uint32 + // pendingData is the overall data which have been received but not been + // consumed by applications. + pendingData uint32 + // The amount of data the application has consumed but grpc has not sent + // window update for them. Used to reduce window update frequency. + pendingUpdate uint32 + // delta is the extra window update given by receiver when an application + // is reading data bigger in size than the inFlow limit. + delta uint32 +} + +// newLimit updates the inflow window to a new value n. +// It assumes that n is always greater than the old limit. +func (f *inFlow) newLimit(n uint32) uint32 { + f.mu.Lock() + d := n - f.limit + f.limit = n + f.mu.Unlock() + return d +} + +func (f *inFlow) maybeAdjust(n uint32) uint32 { + if n > uint32(math.MaxInt32) { + n = uint32(math.MaxInt32) + } + f.mu.Lock() + // estSenderQuota is the receiver's view of the maximum number of bytes the sender + // can send without a window update. + estSenderQuota := int32(f.limit - (f.pendingData + f.pendingUpdate)) + // estUntransmittedData is the maximum number of bytes the sends might not have put + // on the wire yet. A value of 0 or less means that we have already received all or + // more bytes than the application is requesting to read. + estUntransmittedData := int32(n - f.pendingData) // Casting into int32 since it could be negative. + // This implies that unless we send a window update, the sender won't be able to send all the bytes + // for this message. Therefore we must send an update over the limit since there's an active read + // request from the application. + if estUntransmittedData > estSenderQuota { + // Sender's window shouldn't go more than 2^31 - 1 as specified in the HTTP spec. + if f.limit+n > maxWindowSize { + f.delta = maxWindowSize - f.limit + } else { + // Send a window update for the whole message and not just the difference between + // estUntransmittedData and estSenderQuota. This will be helpful in case the message + // is padded; We will fallback on the current available window(at least a 1/4th of the limit). + f.delta = n + } + f.mu.Unlock() + return f.delta + } + f.mu.Unlock() + return 0 +} + +// onData is invoked when some data frame is received. It updates pendingData. +func (f *inFlow) onData(n uint32) error { + f.mu.Lock() + f.pendingData += n + if f.pendingData+f.pendingUpdate > f.limit+f.delta { + limit := f.limit + rcvd := f.pendingData + f.pendingUpdate + f.mu.Unlock() + return fmt.Errorf("received %d-bytes data exceeding the limit %d bytes", rcvd, limit) + } + f.mu.Unlock() + return nil +} + +// onRead is invoked when the application reads the data. It returns the window size +// to be sent to the peer. +func (f *inFlow) onRead(n uint32) uint32 { + f.mu.Lock() + if f.pendingData == 0 { + f.mu.Unlock() + return 0 + } + f.pendingData -= n + if n > f.delta { + n -= f.delta + f.delta = 0 + } else { + f.delta -= n + n = 0 + } + f.pendingUpdate += n + if f.pendingUpdate >= f.limit/4 { + wu := f.pendingUpdate + f.pendingUpdate = 0 + f.mu.Unlock() + return wu + } + f.mu.Unlock() + return 0 +} diff --git a/vendor/google.golang.org/grpc/transport/go16.go b/vendor/google.golang.org/grpc/internal/transport/go16.go similarity index 77% rename from vendor/google.golang.org/grpc/transport/go16.go rename to vendor/google.golang.org/grpc/internal/transport/go16.go index 5babcf9b8770..e0d00115d8e4 100644 --- a/vendor/google.golang.org/grpc/transport/go16.go +++ b/vendor/google.golang.org/grpc/internal/transport/go16.go @@ -25,6 +25,7 @@ import ( "net/http" "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" "golang.org/x/net/context" ) @@ -34,15 +35,15 @@ func dialContext(ctx context.Context, network, address string) (net.Conn, error) return (&net.Dialer{Cancel: ctx.Done()}).Dial(network, address) } -// ContextErr converts the error from context package into a StreamError. -func ContextErr(err error) StreamError { +// ContextErr converts the error from context package into a status error. +func ContextErr(err error) error { switch err { case context.DeadlineExceeded: - return streamErrorf(codes.DeadlineExceeded, "%v", err) + return status.Error(codes.DeadlineExceeded, err.Error()) case context.Canceled: - return streamErrorf(codes.Canceled, "%v", err) + return status.Error(codes.Canceled, err.Error()) } - return streamErrorf(codes.Internal, "Unexpected error from context packet: %v", err) + return status.Errorf(codes.Internal, "Unexpected error from context packet: %v", err) } // contextFromRequest returns a background context. diff --git a/vendor/google.golang.org/grpc/transport/go17.go b/vendor/google.golang.org/grpc/internal/transport/go17.go similarity index 78% rename from vendor/google.golang.org/grpc/transport/go17.go rename to vendor/google.golang.org/grpc/internal/transport/go17.go index b7fa6bdb9ca2..4d515b00dcf5 100644 --- a/vendor/google.golang.org/grpc/transport/go17.go +++ b/vendor/google.golang.org/grpc/internal/transport/go17.go @@ -26,6 +26,7 @@ import ( "net/http" "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" netctx "golang.org/x/net/context" ) @@ -35,15 +36,15 @@ func dialContext(ctx context.Context, network, address string) (net.Conn, error) return (&net.Dialer{}).DialContext(ctx, network, address) } -// ContextErr converts the error from context package into a StreamError. -func ContextErr(err error) StreamError { +// ContextErr converts the error from context package into a status error. +func ContextErr(err error) error { switch err { case context.DeadlineExceeded, netctx.DeadlineExceeded: - return streamErrorf(codes.DeadlineExceeded, "%v", err) + return status.Error(codes.DeadlineExceeded, err.Error()) case context.Canceled, netctx.Canceled: - return streamErrorf(codes.Canceled, "%v", err) + return status.Error(codes.Canceled, err.Error()) } - return streamErrorf(codes.Internal, "Unexpected error from context packet: %v", err) + return status.Errorf(codes.Internal, "Unexpected error from context packet: %v", err) } // contextFromRequest returns a context from the HTTP Request. diff --git a/vendor/google.golang.org/grpc/transport/handler_server.go b/vendor/google.golang.org/grpc/internal/transport/handler_server.go similarity index 81% rename from vendor/google.golang.org/grpc/transport/handler_server.go rename to vendor/google.golang.org/grpc/internal/transport/handler_server.go index 27c4ebb5f100..c6fb4b9c13b2 100644 --- a/vendor/google.golang.org/grpc/transport/handler_server.go +++ b/vendor/google.golang.org/grpc/internal/transport/handler_server.go @@ -40,20 +40,24 @@ import ( "google.golang.org/grpc/credentials" "google.golang.org/grpc/metadata" "google.golang.org/grpc/peer" + "google.golang.org/grpc/stats" "google.golang.org/grpc/status" ) // NewServerHandlerTransport returns a ServerTransport handling gRPC // from inside an http.Handler. It requires that the http Server // supports HTTP/2. -func NewServerHandlerTransport(w http.ResponseWriter, r *http.Request) (ServerTransport, error) { +func NewServerHandlerTransport(w http.ResponseWriter, r *http.Request, stats stats.Handler) (ServerTransport, error) { if r.ProtoMajor != 2 { return nil, errors.New("gRPC requires HTTP/2") } if r.Method != "POST" { return nil, errors.New("invalid gRPC request method") } - if !validContentType(r.Header.Get("Content-Type")) { + contentType := r.Header.Get("Content-Type") + // TODO: do we assume contentType is lowercase? we did before + contentSubtype, validContentType := contentSubtype(contentType) + if !validContentType { return nil, errors.New("invalid gRPC request content-type") } if _, ok := w.(http.Flusher); !ok { @@ -64,34 +68,37 @@ func NewServerHandlerTransport(w http.ResponseWriter, r *http.Request) (ServerTr } st := &serverHandlerTransport{ - rw: w, - req: r, - closedCh: make(chan struct{}), - writes: make(chan func()), + rw: w, + req: r, + closedCh: make(chan struct{}), + writes: make(chan func()), + contentType: contentType, + contentSubtype: contentSubtype, + stats: stats, } if v := r.Header.Get("grpc-timeout"); v != "" { to, err := decodeTimeout(v) if err != nil { - return nil, streamErrorf(codes.Internal, "malformed time-out: %v", err) + return nil, status.Errorf(codes.Internal, "malformed time-out: %v", err) } st.timeoutSet = true st.timeout = to } - var metakv []string + metakv := []string{"content-type", contentType} if r.Host != "" { metakv = append(metakv, ":authority", r.Host) } for k, vv := range r.Header { k = strings.ToLower(k) - if isReservedHeader(k) && !isWhitelistedPseudoHeader(k) { + if isReservedHeader(k) && !isWhitelistedHeader(k) { continue } for _, v := range vv { v, err := decodeMetadataHeader(k, v) if err != nil { - return nil, streamErrorf(codes.InvalidArgument, "malformed binary metadata: %v", err) + return nil, status.Errorf(codes.Internal, "malformed binary metadata: %v", err) } metakv = append(metakv, k, v) } @@ -126,6 +133,14 @@ type serverHandlerTransport struct { // block concurrent WriteStatus calls // e.g. grpc/(*serverStream).SendMsg/RecvMsg writeStatusMu sync.Mutex + + // we just mirror the request content-type + contentType string + // we store both contentType and contentSubtype so we don't keep recreating them + // TODO make sure this is consistent across handler_server and http2_server + contentSubtype string + + stats stats.Handler } func (ht *serverHandlerTransport) Close() error { @@ -219,9 +234,12 @@ func (ht *serverHandlerTransport) WriteStatus(s *Stream, st *status.Status) erro }) if err == nil { // transport has not been closed - ht.Close() + if ht.stats != nil { + ht.stats.HandleRPC(s.Context(), &stats.OutTrailer{}) + } close(ht.writes) } + ht.Close() return err } @@ -235,7 +253,7 @@ func (ht *serverHandlerTransport) writeCommonHeaders(s *Stream) { h := ht.rw.Header() h["Date"] = nil // suppress Date to make tests happy; TODO: restore - h.Set("Content-Type", "application/grpc") + h.Set("Content-Type", ht.contentType) // Predeclare trailers we'll set later in WriteStatus (after the body). // This is a SHOULD in the HTTP RFC, and the way you add (known) @@ -256,14 +274,12 @@ func (ht *serverHandlerTransport) Write(s *Stream, hdr []byte, data []byte, opts ht.writeCommonHeaders(s) ht.rw.Write(hdr) ht.rw.Write(data) - if !opts.Delay { - ht.rw.(http.Flusher).Flush() - } + ht.rw.(http.Flusher).Flush() }) } func (ht *serverHandlerTransport) WriteHeader(s *Stream, md metadata.MD) error { - return ht.do(func() { + err := ht.do(func() { ht.writeCommonHeaders(s) h := ht.rw.Header() for k, vv := range md { @@ -279,6 +295,13 @@ func (ht *serverHandlerTransport) WriteHeader(s *Stream, md metadata.MD) error { ht.rw.WriteHeader(200) ht.rw.(http.Flusher).Flush() }) + + if err == nil { + if ht.stats != nil { + ht.stats.HandleRPC(s.Context(), &stats.OutHeader{}) + } + } + return err } func (ht *serverHandlerTransport) HandleStreams(startStream func(*Stream), traceCtx func(context.Context, string) context.Context) { @@ -303,23 +326,24 @@ func (ht *serverHandlerTransport) HandleStreams(startStream func(*Stream), trace go func() { select { case <-requestOver: - return case <-ht.closedCh: case <-clientGone: } cancel() + ht.Close() }() req := ht.req s := &Stream{ - id: 0, // irrelevant - requestRead: func(int) {}, - cancel: cancel, - buf: newRecvBuffer(), - st: ht, - method: req.URL.Path, - recvCompress: req.Header.Get("grpc-encoding"), + id: 0, // irrelevant + requestRead: func(int) {}, + cancel: cancel, + buf: newRecvBuffer(), + st: ht, + method: req.URL.Path, + recvCompress: req.Header.Get("grpc-encoding"), + contentSubtype: ht.contentSubtype, } pr := &peer.Peer{ Addr: ht.RemoteAddr(), @@ -328,10 +352,18 @@ func (ht *serverHandlerTransport) HandleStreams(startStream func(*Stream), trace pr.AuthInfo = credentials.TLSInfo{State: *req.TLS} } ctx = metadata.NewIncomingContext(ctx, ht.headerMD) - ctx = peer.NewContext(ctx, pr) - s.ctx = newContextWithStream(ctx, s) + s.ctx = peer.NewContext(ctx, pr) + if ht.stats != nil { + s.ctx = ht.stats.TagRPC(s.ctx, &stats.RPCTagInfo{FullMethodName: s.method}) + inHeader := &stats.InHeader{ + FullMethod: s.method, + RemoteAddr: ht.RemoteAddr(), + Compression: s.recvCompress, + } + ht.stats.HandleRPC(s.ctx, inHeader) + } s.trReader = &transportReader{ - reader: &recvBufferReader{ctx: s.ctx, recv: s.buf}, + reader: &recvBufferReader{ctx: s.ctx, ctxDone: s.ctx.Done(), recv: s.buf}, windowHandler: func(int) {}, } @@ -386,6 +418,10 @@ func (ht *serverHandlerTransport) runStream() { } } +func (ht *serverHandlerTransport) IncrMsgSent() {} + +func (ht *serverHandlerTransport) IncrMsgRecv() {} + func (ht *serverHandlerTransport) Drain() { panic("Drain() is not implemented") } @@ -396,18 +432,18 @@ func (ht *serverHandlerTransport) Drain() { // * io.EOF // * io.ErrUnexpectedEOF // * of type transport.ConnectionError -// * of type transport.StreamError +// * an error from the status package func mapRecvMsgError(err error) error { if err == io.EOF || err == io.ErrUnexpectedEOF { return err } if se, ok := err.(http2.StreamError); ok { if code, ok := http2ErrConvTab[se.Code]; ok { - return StreamError{ - Code: code, - Desc: se.Error(), - } + return status.Error(code, se.Error()) } } + if strings.Contains(err.Error(), "body closed by handler") { + return status.Error(codes.Canceled, err.Error()) + } return connectionErrorf(true, err, err.Error()) } diff --git a/vendor/google.golang.org/grpc/transport/http2_client.go b/vendor/google.golang.org/grpc/internal/transport/http2_client.go similarity index 55% rename from vendor/google.golang.org/grpc/transport/http2_client.go rename to vendor/google.golang.org/grpc/internal/transport/http2_client.go index 18fc41f08110..0787d6237294 100644 --- a/vendor/google.golang.org/grpc/transport/http2_client.go +++ b/vendor/google.golang.org/grpc/internal/transport/http2_client.go @@ -19,11 +19,10 @@ package transport import ( - "bytes" - "fmt" "io" "math" "net" + "strconv" "strings" "sync" "sync/atomic" @@ -32,8 +31,10 @@ import ( "golang.org/x/net/context" "golang.org/x/net/http2" "golang.org/x/net/http2/hpack" + "google.golang.org/grpc/codes" "google.golang.org/grpc/credentials" + "google.golang.org/grpc/internal/channelz" "google.golang.org/grpc/keepalive" "google.golang.org/grpc/metadata" "google.golang.org/grpc/peer" @@ -45,14 +46,17 @@ import ( type http2Client struct { ctx context.Context cancel context.CancelFunc + ctxDone <-chan struct{} // Cache the ctx.Done() chan. userAgent string md interface{} conn net.Conn // underlying communication channel + loopy *loopyWriter remoteAddr net.Addr localAddr net.Addr authInfo credentials.AuthInfo // auth info about the connection - nextID uint32 // the next stream ID to be used + readerDone chan struct{} // sync point to enable testing. + writerDone chan struct{} // sync point to enable testing. // goAway is closed to notify the upper layer (i.e., addrConn.transportMonitor) // that the server sent GoAway on this transport. goAway chan struct{} @@ -60,21 +64,10 @@ type http2Client struct { awakenKeepalive chan struct{} framer *framer - hBuf *bytes.Buffer // the buffer for HPACK encoding - hEnc *hpack.Encoder // HPACK encoder - // controlBuf delivers all the control related tasks (e.g., window // updates, reset streams, and various settings) to the controller. controlBuf *controlBuffer - fc *inFlow - // sendQuotaPool provides flow control to outbound message. - sendQuotaPool *quotaPool - // localSendQuota limits the amount of data that can be scheduled - // for writing before it is actually written out. - localSendQuota *quotaPool - // streamsQuota limits the max number of concurrent streams. - streamsQuota *quotaPool - + fc *trInFlow // The scheme used: https if TLS is on, http otherwise. scheme string @@ -84,33 +77,44 @@ type http2Client struct { // Boolean to keep track of reading activity on transport. // 1 is true and 0 is false. - activity uint32 // Accessed atomically. - kp keepalive.ClientParameters + activity uint32 // Accessed atomically. + kp keepalive.ClientParameters + keepaliveEnabled bool statsHandler stats.Handler initialWindowSize int32 - bdpEst *bdpEstimator - outQuotaVersion uint32 + // configured by peer through SETTINGS_MAX_HEADER_LIST_SIZE + maxSendHeaderListSize *uint32 + bdpEst *bdpEstimator // onSuccess is a callback that client transport calls upon // receiving server preface to signal that a succefull HTTP2 // connection was established. onSuccess func() - mu sync.Mutex // guard the following variables - state transportState // the state of underlying connection + maxConcurrentStreams uint32 + streamQuota int64 + streamsQuotaAvailable chan struct{} + waitingStreams uint32 + nextID uint32 + + mu sync.Mutex // guard the following variables + state transportState activeStreams map[uint32]*Stream - // The max number of concurrent streams - maxStreams int - // the per-stream outbound flow control window size set by the peer. - streamSendQuota uint32 // prevGoAway ID records the Last-Stream-ID in the previous GOAway frame. prevGoAwayID uint32 // goAwayReason records the http2.ErrCode and debug data received with the // GoAway frame. goAwayReason GoAwayReason + + // Fields below are for channelz metric collection. + channelzID int64 // channelz unique identification number + czData *channelzData + + onGoAway func(GoAwayReason) + onClose func() } func dial(ctx context.Context, fn func(context.Context, string) (net.Conn, error), addr string) (net.Conn, error) { @@ -121,18 +125,6 @@ func dial(ctx context.Context, fn func(context.Context, string) (net.Conn, error } func isTemporary(err error) bool { - switch err { - case io.EOF: - // Connection closures may be resolved upon retry, and are thus - // treated as temporary. - return true - case context.DeadlineExceeded: - // In Go 1.7, context.DeadlineExceeded implements Timeout(), and this - // special case is not needed. Until then, we need to keep this - // clause. - return true - } - switch err := err.(type) { case interface { Temporary() bool @@ -145,13 +137,13 @@ func isTemporary(err error) bool { // temporary. return err.Timeout() } - return false + return true } // newHTTP2Client constructs a connected ClientTransport to addr based on HTTP2 // and starts to receive messages on it. Non-nil error returns if construction // fails. -func newHTTP2Client(connectCtx, ctx context.Context, addr TargetInfo, opts ConnectOptions, onSuccess func()) (_ ClientTransport, err error) { +func newHTTP2Client(connectCtx, ctx context.Context, addr TargetInfo, opts ConnectOptions, onSuccess func(), onGoAway func(GoAwayReason), onClose func()) (_ *http2Client, err error) { scheme := "http" ctx, cancel := context.WithCancel(ctx) defer func() { @@ -181,10 +173,7 @@ func newHTTP2Client(connectCtx, ctx context.Context, addr TargetInfo, opts Conne scheme = "https" conn, authInfo, err = creds.ClientHandshake(connectCtx, addr.Authority, conn) if err != nil { - // Credentials handshake errors are typically considered permanent - // to avoid retrying on e.g. bad certificates. - temp := isTemporary(err) - return nil, connectionErrorf(temp, err, "transport: authentication handshake failed: %v", err) + return nil, connectionErrorf(isTemporary(err), err, "transport: authentication handshake failed: %v", err) } isSecure = true } @@ -202,48 +191,45 @@ func newHTTP2Client(connectCtx, ctx context.Context, addr TargetInfo, opts Conne icwz = opts.InitialConnWindowSize dynamicWindow = false } - var buf bytes.Buffer - writeBufSize := defaultWriteBufSize - if opts.WriteBufferSize > 0 { - writeBufSize = opts.WriteBufferSize - } - readBufSize := defaultReadBufSize - if opts.ReadBufferSize > 0 { - readBufSize = opts.ReadBufferSize + writeBufSize := opts.WriteBufferSize + readBufSize := opts.ReadBufferSize + maxHeaderListSize := defaultClientMaxHeaderListSize + if opts.MaxHeaderListSize != nil { + maxHeaderListSize = *opts.MaxHeaderListSize } t := &http2Client{ - ctx: ctx, - cancel: cancel, - userAgent: opts.UserAgent, - md: addr.Metadata, - conn: conn, - remoteAddr: conn.RemoteAddr(), - localAddr: conn.LocalAddr(), - authInfo: authInfo, - // The client initiated stream id is odd starting from 1. - nextID: 1, - goAway: make(chan struct{}), - awakenKeepalive: make(chan struct{}, 1), - hBuf: &buf, - hEnc: hpack.NewEncoder(&buf), - framer: newFramer(conn, writeBufSize, readBufSize), - controlBuf: newControlBuffer(), - fc: &inFlow{limit: uint32(icwz)}, - sendQuotaPool: newQuotaPool(defaultWindowSize), - localSendQuota: newQuotaPool(defaultLocalSendQuota), - scheme: scheme, - state: reachable, - activeStreams: make(map[uint32]*Stream), - isSecure: isSecure, - creds: opts.PerRPCCredentials, - maxStreams: defaultMaxStreamsClient, - streamsQuota: newQuotaPool(defaultMaxStreamsClient), - streamSendQuota: defaultWindowSize, - kp: kp, - statsHandler: opts.StatsHandler, - initialWindowSize: initialWindowSize, - onSuccess: onSuccess, - } + ctx: ctx, + ctxDone: ctx.Done(), // Cache Done chan. + cancel: cancel, + userAgent: opts.UserAgent, + md: addr.Metadata, + conn: conn, + remoteAddr: conn.RemoteAddr(), + localAddr: conn.LocalAddr(), + authInfo: authInfo, + readerDone: make(chan struct{}), + writerDone: make(chan struct{}), + goAway: make(chan struct{}), + awakenKeepalive: make(chan struct{}, 1), + framer: newFramer(conn, writeBufSize, readBufSize, maxHeaderListSize), + fc: &trInFlow{limit: uint32(icwz)}, + scheme: scheme, + activeStreams: make(map[uint32]*Stream), + isSecure: isSecure, + creds: opts.PerRPCCredentials, + kp: kp, + statsHandler: opts.StatsHandler, + initialWindowSize: initialWindowSize, + onSuccess: onSuccess, + nextID: 1, + maxConcurrentStreams: defaultMaxStreamsClient, + streamQuota: defaultMaxStreamsClient, + streamsQuotaAvailable: make(chan struct{}, 1), + czData: new(channelzData), + onGoAway: onGoAway, + onClose: func() {}, + } + t.controlBuf = newControlBuffer(t.ctxDone) if opts.InitialWindowSize >= defaultWindowSize { t.initialWindowSize = opts.InitialWindowSize dynamicWindow = false @@ -267,10 +253,13 @@ func newHTTP2Client(connectCtx, ctx context.Context, addr TargetInfo, opts Conne } t.statsHandler.HandleConn(t.ctx, connBegin) } - // Start the reader goroutine for incoming message. Each transport has - // a dedicated goroutine which reads HTTP2 frame from network. Then it - // dispatches the frame to the corresponding stream entity. - go t.reader() + if channelz.IsOn() { + t.channelzID = channelz.RegisterNormalSocket(t, opts.ChannelzParentID, "") + } + if t.kp.Time != infinity { + t.keepaliveEnabled = true + go t.keepalive() + } // Send connection preface to server. n, err := t.conn.Write(clientPreface) if err != nil { @@ -281,14 +270,21 @@ func newHTTP2Client(connectCtx, ctx context.Context, addr TargetInfo, opts Conne t.Close() return nil, connectionErrorf(true, err, "transport: preface mismatch, wrote %d bytes; want %d", n, len(clientPreface)) } + var ss []http2.Setting + if t.initialWindowSize != defaultWindowSize { - err = t.framer.fr.WriteSettings(http2.Setting{ + ss = append(ss, http2.Setting{ ID: http2.SettingInitialWindowSize, Val: uint32(t.initialWindowSize), }) - } else { - err = t.framer.fr.WriteSettings() } + if opts.MaxHeaderListSize != nil { + ss = append(ss, http2.Setting{ + ID: http2.SettingMaxHeaderListSize, + Val: *opts.MaxHeaderListSize, + }) + } + err = t.framer.fr.WriteSettings(ss...) if err != nil { t.Close() return nil, connectionErrorf(true, err, "transport: failed to write initial settings frame: %v", err) @@ -300,31 +296,43 @@ func newHTTP2Client(connectCtx, ctx context.Context, addr TargetInfo, opts Conne return nil, connectionErrorf(true, err, "transport: failed to write window update: %v", err) } } + + // We only assign onClose after we're sure there can not be any more t.Close calls in this goroutine, because + // onClose may (frequently does) block. + t.onClose = onClose + + // Start the reader goroutine for incoming message. Each transport has + // a dedicated goroutine which reads HTTP2 frame from network. Then it + // dispatches the frame to the corresponding stream entity. + go t.reader() t.framer.writer.Flush() go func() { - loopyWriter(t.ctx, t.controlBuf, t.itemHandler) - t.conn.Close() + t.loopy = newLoopyWriter(clientSide, t.framer, t.controlBuf, t.bdpEst) + err := t.loopy.run() + if err != nil { + errorf("transport: loopyWriter.run returning. Err: %v", err) + } + // If it's a connection error, let reader goroutine handle it + // since there might be data in the buffers. + if _, ok := err.(net.Error); !ok { + t.conn.Close() + } + close(t.writerDone) }() - if t.kp.Time != infinity { - go t.keepalive() - } return t, nil } func (t *http2Client) newStream(ctx context.Context, callHdr *CallHdr) *Stream { // TODO(zhaoq): Handle uint32 overflow of Stream.id. s := &Stream{ - id: t.nextID, - done: make(chan struct{}), - goAway: make(chan struct{}), - method: callHdr.Method, - sendCompress: callHdr.SendCompress, - buf: newRecvBuffer(), - fc: &inFlow{limit: uint32(t.initialWindowSize)}, - sendQuotaPool: newQuotaPool(int(t.streamSendQuota)), - headerChan: make(chan struct{}), - } - t.nextID += 2 + done: make(chan struct{}), + method: callHdr.Method, + sendCompress: callHdr.SendCompress, + buf: newRecvBuffer(), + headerChan: make(chan struct{}), + contentSubtype: callHdr.ContentSubtype, + } + s.wq = newWriteQuota(defaultWriteQuota, s.done) s.requestRead = func(n int) { t.adjustWindow(s, uint32(n)) } @@ -334,26 +342,18 @@ func (t *http2Client) newStream(ctx context.Context, callHdr *CallHdr) *Stream { s.ctx = ctx s.trReader = &transportReader{ reader: &recvBufferReader{ - ctx: s.ctx, - goAway: s.goAway, - recv: s.buf, + ctx: s.ctx, + ctxDone: s.ctx.Done(), + recv: s.buf, }, windowHandler: func(n int) { t.updateWindow(s, uint32(n)) }, } - s.waiters = waiters{ - ctx: s.ctx, - tctx: t.ctx, - done: s.done, - goAway: s.goAway, - } return s } -// NewStream creates a stream and registers it into the transport as "active" -// streams. -func (t *http2Client) NewStream(ctx context.Context, callHdr *CallHdr) (_ *Stream, err error) { +func (t *http2Client) getPeer() *peer.Peer { pr := &peer.Peer{ Addr: t.remoteAddr, } @@ -361,71 +361,17 @@ func (t *http2Client) NewStream(ctx context.Context, callHdr *CallHdr) (_ *Strea if t.authInfo != nil { pr.AuthInfo = t.authInfo } - ctx = peer.NewContext(ctx, pr) - var ( - authData = make(map[string]string) - audience string - ) - // Create an audience string only if needed. - if len(t.creds) > 0 || callHdr.Creds != nil { - // Construct URI required to get auth request metadata. - // Omit port if it is the default one. - host := strings.TrimSuffix(callHdr.Host, ":443") - pos := strings.LastIndex(callHdr.Method, "/") - if pos == -1 { - pos = len(callHdr.Method) - } - audience = "https://" + host + callHdr.Method[:pos] - } - for _, c := range t.creds { - data, err := c.GetRequestMetadata(ctx, audience) - if err != nil { - if _, ok := status.FromError(err); ok { - return nil, err - } + return pr +} - return nil, streamErrorf(codes.Unauthenticated, "transport: %v", err) - } - for k, v := range data { - // Capital header names are illegal in HTTP/2. - k = strings.ToLower(k) - authData[k] = v - } - } - callAuthData := map[string]string{} - // Check if credentials.PerRPCCredentials were provided via call options. - // Note: if these credentials are provided both via dial options and call - // options, then both sets of credentials will be applied. - if callCreds := callHdr.Creds; callCreds != nil { - if !t.isSecure && callCreds.RequireTransportSecurity() { - return nil, streamErrorf(codes.Unauthenticated, "transport: cannot send secure credentials on an insecure connection") - } - data, err := callCreds.GetRequestMetadata(ctx, audience) - if err != nil { - return nil, streamErrorf(codes.Internal, "transport: %v", err) - } - for k, v := range data { - // Capital header names are illegal in HTTP/2 - k = strings.ToLower(k) - callAuthData[k] = v - } - } - t.mu.Lock() - if t.activeStreams == nil { - t.mu.Unlock() - return nil, ErrConnClosing - } - if t.state == draining { - t.mu.Unlock() - return nil, errStreamDrain - } - if t.state != reachable { - t.mu.Unlock() - return nil, ErrConnClosing +func (t *http2Client) createHeaderFields(ctx context.Context, callHdr *CallHdr) ([]hpack.HeaderField, error) { + aud := t.createAudience(callHdr) + authData, err := t.getTrAuthData(ctx, aud) + if err != nil { + return nil, err } - t.mu.Unlock() - // Get a quota of 1 from streamsQuota. - if _, _, err := t.streamsQuota.get(1, waiters{ctx: ctx, tctx: t.ctx}); err != nil { + callAuthData, err := t.getCallAuthData(ctx, aud, callHdr) + if err != nil { return nil, err } // TODO(mmukhi): Benchmark if the performance gets better if count the metadata and other header fields @@ -438,9 +384,12 @@ func (t *http2Client) NewStream(ctx context.Context, callHdr *CallHdr) (_ *Strea headerFields = append(headerFields, hpack.HeaderField{Name: ":scheme", Value: t.scheme}) headerFields = append(headerFields, hpack.HeaderField{Name: ":path", Value: callHdr.Method}) headerFields = append(headerFields, hpack.HeaderField{Name: ":authority", Value: callHdr.Host}) - headerFields = append(headerFields, hpack.HeaderField{Name: "content-type", Value: "application/grpc"}) + headerFields = append(headerFields, hpack.HeaderField{Name: "content-type", Value: contentType(callHdr.ContentSubtype)}) headerFields = append(headerFields, hpack.HeaderField{Name: "user-agent", Value: t.userAgent}) headerFields = append(headerFields, hpack.HeaderField{Name: "te", Value: "trailers"}) + if callHdr.PreviousAttempts > 0 { + headerFields = append(headerFields, hpack.HeaderField{Name: "grpc-previous-rpc-attempts", Value: strconv.Itoa(callHdr.PreviousAttempts)}) + } if callHdr.SendCompress != "" { headerFields = append(headerFields, hpack.HeaderField{Name: "grpc-encoding", Value: callHdr.SendCompress}) @@ -463,7 +412,22 @@ func (t *http2Client) NewStream(ctx context.Context, callHdr *CallHdr) (_ *Strea if b := stats.OutgoingTrace(ctx); b != nil { headerFields = append(headerFields, hpack.HeaderField{Name: "grpc-trace-bin", Value: encodeBinHeader(b)}) } - if md, ok := metadata.FromOutgoingContext(ctx); ok { + + if md, added, ok := metadata.FromOutgoingContextRaw(ctx); ok { + var k string + for _, vv := range added { + for i, v := range vv { + if i%2 == 0 { + k = v + continue + } + // HTTP doesn't allow you to set pseudoheaders after non pseudoheaders were set. + if isReservedHeader(k) { + continue + } + headerFields = append(headerFields, hpack.HeaderField{Name: strings.ToLower(k), Value: encodeMetadataHeader(k, v)}) + } + } for k, vv := range md { // HTTP doesn't allow you to set pseudoheaders after non pseudoheaders were set. if isReservedHeader(k) { @@ -484,38 +448,202 @@ func (t *http2Client) NewStream(ctx context.Context, callHdr *CallHdr) (_ *Strea } } } - t.mu.Lock() - if t.state == draining { - t.mu.Unlock() - t.streamsQuota.add(1) - return nil, errStreamDrain + return headerFields, nil +} + +func (t *http2Client) createAudience(callHdr *CallHdr) string { + // Create an audience string only if needed. + if len(t.creds) == 0 && callHdr.Creds == nil { + return "" } - if t.state != reachable { - t.mu.Unlock() - return nil, ErrConnClosing + // Construct URI required to get auth request metadata. + // Omit port if it is the default one. + host := strings.TrimSuffix(callHdr.Host, ":443") + pos := strings.LastIndex(callHdr.Method, "/") + if pos == -1 { + pos = len(callHdr.Method) + } + return "https://" + host + callHdr.Method[:pos] +} + +func (t *http2Client) getTrAuthData(ctx context.Context, audience string) (map[string]string, error) { + authData := map[string]string{} + for _, c := range t.creds { + data, err := c.GetRequestMetadata(ctx, audience) + if err != nil { + if _, ok := status.FromError(err); ok { + return nil, err + } + + return nil, status.Errorf(codes.Unauthenticated, "transport: %v", err) + } + for k, v := range data { + // Capital header names are illegal in HTTP/2. + k = strings.ToLower(k) + authData[k] = v + } + } + return authData, nil +} + +func (t *http2Client) getCallAuthData(ctx context.Context, audience string, callHdr *CallHdr) (map[string]string, error) { + callAuthData := map[string]string{} + // Check if credentials.PerRPCCredentials were provided via call options. + // Note: if these credentials are provided both via dial options and call + // options, then both sets of credentials will be applied. + if callCreds := callHdr.Creds; callCreds != nil { + if !t.isSecure && callCreds.RequireTransportSecurity() { + return nil, status.Error(codes.Unauthenticated, "transport: cannot send secure credentials on an insecure connection") + } + data, err := callCreds.GetRequestMetadata(ctx, audience) + if err != nil { + return nil, status.Errorf(codes.Internal, "transport: %v", err) + } + for k, v := range data { + // Capital header names are illegal in HTTP/2 + k = strings.ToLower(k) + callAuthData[k] = v + } + } + return callAuthData, nil +} + +// NewStream creates a stream and registers it into the transport as "active" +// streams. +func (t *http2Client) NewStream(ctx context.Context, callHdr *CallHdr) (_ *Stream, err error) { + ctx = peer.NewContext(ctx, t.getPeer()) + headerFields, err := t.createHeaderFields(ctx, callHdr) + if err != nil { + return nil, err } s := t.newStream(ctx, callHdr) - t.activeStreams[s.id] = s - // If the number of active streams change from 0 to 1, then check if keepalive - // has gone dormant. If so, wake it up. - if len(t.activeStreams) == 1 { - select { - case t.awakenKeepalive <- struct{}{}: - t.controlBuf.put(&ping{data: [8]byte{}}) - // Fill the awakenKeepalive channel again as this channel must be - // kept non-writable except at the point that the keepalive() - // goroutine is waiting either to be awaken or shutdown. - t.awakenKeepalive <- struct{}{} - default: + cleanup := func(err error) { + if s.swapState(streamDone) == streamDone { + // If it was already done, return. + return } + // The stream was unprocessed by the server. + atomic.StoreUint32(&s.unprocessed, 1) + s.write(recvMsg{err: err}) + close(s.done) + // If headerChan isn't closed, then close it. + if atomic.SwapUint32(&s.headerDone, 1) == 0 { + close(s.headerChan) + } + } - t.controlBuf.put(&headerFrame{ - streamID: s.id, + hdr := &headerFrame{ hf: headerFields, endStream: false, - }) - t.mu.Unlock() - + initStream: func(id uint32) (bool, error) { + t.mu.Lock() + if state := t.state; state != reachable { + t.mu.Unlock() + // Do a quick cleanup. + err := error(errStreamDrain) + if state == closing { + err = ErrConnClosing + } + cleanup(err) + return false, err + } + t.activeStreams[id] = s + if channelz.IsOn() { + atomic.AddInt64(&t.czData.streamsStarted, 1) + atomic.StoreInt64(&t.czData.lastStreamCreatedTime, time.Now().UnixNano()) + } + var sendPing bool + // If the number of active streams change from 0 to 1, then check if keepalive + // has gone dormant. If so, wake it up. + if len(t.activeStreams) == 1 && t.keepaliveEnabled { + select { + case t.awakenKeepalive <- struct{}{}: + sendPing = true + // Fill the awakenKeepalive channel again as this channel must be + // kept non-writable except at the point that the keepalive() + // goroutine is waiting either to be awaken or shutdown. + t.awakenKeepalive <- struct{}{} + default: + } + } + t.mu.Unlock() + return sendPing, nil + }, + onOrphaned: cleanup, + wq: s.wq, + } + firstTry := true + var ch chan struct{} + checkForStreamQuota := func(it interface{}) bool { + if t.streamQuota <= 0 { // Can go negative if server decreases it. + if firstTry { + t.waitingStreams++ + } + ch = t.streamsQuotaAvailable + return false + } + if !firstTry { + t.waitingStreams-- + } + t.streamQuota-- + h := it.(*headerFrame) + h.streamID = t.nextID + t.nextID += 2 + s.id = h.streamID + s.fc = &inFlow{limit: uint32(t.initialWindowSize)} + if t.streamQuota > 0 && t.waitingStreams > 0 { + select { + case t.streamsQuotaAvailable <- struct{}{}: + default: + } + } + return true + } + var hdrListSizeErr error + checkForHeaderListSize := func(it interface{}) bool { + if t.maxSendHeaderListSize == nil { + return true + } + hdrFrame := it.(*headerFrame) + var sz int64 + for _, f := range hdrFrame.hf { + if sz += int64(f.Size()); sz > int64(*t.maxSendHeaderListSize) { + hdrListSizeErr = status.Errorf(codes.Internal, "header list size to send violates the maximum size (%d bytes) set by server", *t.maxSendHeaderListSize) + return false + } + } + return true + } + for { + success, err := t.controlBuf.executeAndPut(func(it interface{}) bool { + if !checkForStreamQuota(it) { + return false + } + if !checkForHeaderListSize(it) { + return false + } + return true + }, hdr) + if err != nil { + return nil, err + } + if success { + break + } + if hdrListSizeErr != nil { + return nil, hdrListSizeErr + } + firstTry = false + select { + case <-ch: + case <-s.ctx.Done(): + return nil, ContextErr(s.ctx.Err()) + case <-t.goAway: + return nil, errStreamDrain + case <-t.ctx.Done(): + return nil, ErrConnClosing + } + } if t.statsHandler != nil { outHeader := &stats.OutHeader{ Client: true, @@ -532,86 +660,100 @@ func (t *http2Client) NewStream(ctx context.Context, callHdr *CallHdr) (_ *Strea // CloseStream clears the footprint of a stream when the stream is not needed any more. // This must not be executed in reader's goroutine. func (t *http2Client) CloseStream(s *Stream, err error) { - t.mu.Lock() - if t.activeStreams == nil { - t.mu.Unlock() - return - } + var ( + rst bool + rstCode http2.ErrCode + ) if err != nil { - // notify in-flight streams, before the deletion - s.write(recvMsg{err: err}) + rst = true + rstCode = http2.ErrCodeCancel } - delete(t.activeStreams, s.id) - if t.state == draining && len(t.activeStreams) == 0 { - // The transport is draining and s is the last live stream on t. - t.mu.Unlock() - t.Close() + t.closeStream(s, err, rst, rstCode, status.Convert(err), nil, false) +} + +func (t *http2Client) closeStream(s *Stream, err error, rst bool, rstCode http2.ErrCode, st *status.Status, mdata map[string][]string, eosReceived bool) { + // Set stream status to done. + if s.swapState(streamDone) == streamDone { + // If it was already done, return. return } - t.mu.Unlock() - // rstStream is true in case the stream is being closed at the client-side - // and the server needs to be intimated about it by sending a RST_STREAM - // frame. - // To make sure this frame is written to the wire before the headers of the - // next stream waiting for streamsQuota, we add to streamsQuota pool only - // after having acquired the writableChan to send RST_STREAM out (look at - // the controller() routine). - var rstStream bool - var rstError http2.ErrCode - defer func() { - // In case, the client doesn't have to send RST_STREAM to server - // we can safely add back to streamsQuota pool now. - if !rstStream { - t.streamsQuota.add(1) - return - } - t.controlBuf.put(&resetStream{s.id, rstError}) - }() - s.mu.Lock() - rstStream = s.rstStream - rstError = s.rstError - if s.state == streamDone { - s.mu.Unlock() - return + // status and trailers can be updated here without any synchronization because the stream goroutine will + // only read it after it sees an io.EOF error from read or write and we'll write those errors + // only after updating this. + s.status = st + if len(mdata) > 0 { + s.trailer = mdata + } + if err != nil { + // This will unblock reads eventually. + s.write(recvMsg{err: err}) } - if !s.headerDone { + // This will unblock write. + close(s.done) + // If headerChan isn't closed, then close it. + if atomic.SwapUint32(&s.headerDone, 1) == 0 { + s.noHeaders = true close(s.headerChan) - s.headerDone = true } - s.state = streamDone - s.mu.Unlock() - if _, ok := err.(StreamError); ok { - rstStream = true - rstError = http2.ErrCodeCancel + cleanup := &cleanupStream{ + streamID: s.id, + onWrite: func() { + t.mu.Lock() + if t.activeStreams != nil { + delete(t.activeStreams, s.id) + } + t.mu.Unlock() + if channelz.IsOn() { + if eosReceived { + atomic.AddInt64(&t.czData.streamsSucceeded, 1) + } else { + atomic.AddInt64(&t.czData.streamsFailed, 1) + } + } + }, + rst: rst, + rstCode: rstCode, + } + addBackStreamQuota := func(interface{}) bool { + t.streamQuota++ + if t.streamQuota > 0 && t.waitingStreams > 0 { + select { + case t.streamsQuotaAvailable <- struct{}{}: + default: + } + } + return true } + t.controlBuf.executeAndPut(addBackStreamQuota, cleanup) } // Close kicks off the shutdown process of the transport. This should be called // only once on a transport. Once it is called, the transport should not be // accessed any more. +// +// This method blocks until the addrConn that initiated this transport is +// re-connected. This happens because t.onClose() begins reconnect logic at the +// addrConn level and blocks until the addrConn is successfully connected. func (t *http2Client) Close() error { t.mu.Lock() + // Make sure we only Close once. if t.state == closing { t.mu.Unlock() return nil } t.state = closing - t.mu.Unlock() - t.cancel() - err := t.conn.Close() - t.mu.Lock() streams := t.activeStreams t.activeStreams = nil t.mu.Unlock() + t.controlBuf.finish() + t.cancel() + err := t.conn.Close() + if channelz.IsOn() { + channelz.RemoveEntry(t.channelzID) + } // Notify all active streams. for _, s := range streams { - s.mu.Lock() - if !s.headerDone { - close(s.headerChan) - s.headerDone = true - } - s.mu.Unlock() - s.write(recvMsg{err: ErrConnClosing}) + t.closeStream(s, ErrConnClosing, false, http2.ErrCodeNo, status.New(codes.Unavailable, ErrConnClosing.Desc), nil, false) } if t.statsHandler != nil { connEnd := &stats.ConnEnd{ @@ -619,6 +761,7 @@ func (t *http2Client) Close() error { } t.statsHandler.HandleConn(t.ctx, connEnd) } + t.onClose() return err } @@ -629,8 +772,8 @@ func (t *http2Client) Close() error { // closing. func (t *http2Client) GracefulClose() error { t.mu.Lock() - switch t.state { - case closing, draining: + // Make sure we move to draining only from active. + if t.state == draining || t.state == closing { t.mu.Unlock() return nil } @@ -640,112 +783,41 @@ func (t *http2Client) GracefulClose() error { if active == 0 { return t.Close() } + t.controlBuf.put(&incomingGoAway{}) return nil } // Write formats the data into HTTP2 data frame(s) and sends it out. The caller // should proceed only if Write returns nil. func (t *http2Client) Write(s *Stream, hdr []byte, data []byte, opts *Options) error { - select { - case <-s.ctx.Done(): - return ContextErr(s.ctx.Err()) - case <-t.ctx.Done(): - return ErrConnClosing - default: - } - - if hdr == nil && data == nil && opts.Last { - // stream.CloseSend uses this to send an empty frame with endStream=True - t.controlBuf.put(&dataFrame{streamID: s.id, endStream: true, f: func() {}}) - return nil - } - // Add data to header frame so that we can equally distribute data across frames. - emptyLen := http2MaxFrameLen - len(hdr) - if emptyLen > len(data) { - emptyLen = len(data) - } - hdr = append(hdr, data[:emptyLen]...) - data = data[emptyLen:] - var ( - streamQuota int - streamQuotaVer uint32 - err error - ) - for idx, r := range [][]byte{hdr, data} { - for len(r) > 0 { - size := http2MaxFrameLen - if size > len(r) { - size = len(r) - } - if streamQuota == 0 { // Used up all the locally cached stream quota. - // Get all the stream quota there is. - streamQuota, streamQuotaVer, err = s.sendQuotaPool.get(math.MaxInt32, s.waiters) - if err != nil { - return err - } - } - if size > streamQuota { - size = streamQuota - } - - // Get size worth quota from transport. - tq, _, err := t.sendQuotaPool.get(size, s.waiters) - if err != nil { - return err - } - if tq < size { - size = tq - } - ltq, _, err := t.localSendQuota.get(size, s.waiters) - if err != nil { - return err - } - // even if ltq is smaller than size we don't adjust size since - // ltq is only a soft limit. - streamQuota -= size - p := r[:size] - var endStream bool - // See if this is the last frame to be written. - if opts.Last { - if len(r)-size == 0 { // No more data in r after this iteration. - if idx == 0 { // We're writing data header. - if len(data) == 0 { // There's no data to follow. - endStream = true - } - } else { // We're writing data. - endStream = true - } - } - } - success := func() { - ltq := ltq - t.controlBuf.put(&dataFrame{streamID: s.id, endStream: endStream, d: p, f: func() { t.localSendQuota.add(ltq) }}) - r = r[size:] - } - failure := func() { // The stream quota version must have changed. - // Our streamQuota cache is invalidated now, so give it back. - s.sendQuotaPool.lockedAdd(streamQuota + size) - } - if !s.sendQuotaPool.compareAndExecute(streamQuotaVer, success, failure) { - // Couldn't send this chunk out. - t.sendQuotaPool.add(size) - t.localSendQuota.add(ltq) - streamQuota = 0 - } + if opts.Last { + // If it's the last message, update stream state. + if !s.compareAndSwapState(streamActive, streamWriteDone) { + return errStreamDone } + } else if s.getState() != streamActive { + return errStreamDone } - if streamQuota > 0 { // Add the left over quota back to stream. - s.sendQuotaPool.add(streamQuota) - } - if !opts.Last { - return nil - } - s.mu.Lock() - if s.state != streamDone { - s.state = streamWriteDone + df := &dataFrame{ + streamID: s.id, + endStream: opts.Last, + } + if hdr != nil || data != nil { // If it's not an empty data frame. + // Add some data to grpc message header so that we can equally + // distribute bytes across frames. + emptyLen := http2MaxFrameLen - len(hdr) + if emptyLen > len(data) { + emptyLen = len(data) + } + hdr = append(hdr, data[:emptyLen]...) + data = data[emptyLen:] + df.h, df.d = hdr, data + // TODO(mmukhi): The above logic in this if can be moved to loopyWriter's data handler. + if err := s.wq.get(int32(len(hdr) + len(data))); err != nil { + return err + } } - s.mu.Unlock() - return nil + return t.controlBuf.put(df) } func (t *http2Client) getStream(f http2.Frame) (*Stream, bool) { @@ -759,34 +831,17 @@ func (t *http2Client) getStream(f http2.Frame) (*Stream, bool) { // of stream if the application is requesting data larger in size than // the window. func (t *http2Client) adjustWindow(s *Stream, n uint32) { - s.mu.Lock() - defer s.mu.Unlock() - if s.state == streamDone { - return - } if w := s.fc.maybeAdjust(n); w > 0 { - // Piggyback connection's window update along. - if cw := t.fc.resetPendingUpdate(); cw > 0 { - t.controlBuf.put(&windowUpdate{0, cw}) - } - t.controlBuf.put(&windowUpdate{s.id, w}) + t.controlBuf.put(&outgoingWindowUpdate{streamID: s.id, increment: w}) } } -// updateWindow adjusts the inbound quota for the stream and the transport. -// Window updates will deliver to the controller for sending when -// the cumulative quota exceeds the corresponding threshold. +// updateWindow adjusts the inbound quota for the stream. +// Window updates will be sent out when the cumulative quota +// exceeds the corresponding threshold. func (t *http2Client) updateWindow(s *Stream, n uint32) { - s.mu.Lock() - defer s.mu.Unlock() - if s.state == streamDone { - return - } if w := s.fc.onRead(n); w > 0 { - if cw := t.fc.resetPendingUpdate(); cw > 0 { - t.controlBuf.put(&windowUpdate{0, cw}) - } - t.controlBuf.put(&windowUpdate{s.id, w}) + t.controlBuf.put(&outgoingWindowUpdate{streamID: s.id, increment: w}) } } @@ -798,14 +853,17 @@ func (t *http2Client) updateFlowControl(n uint32) { for _, s := range t.activeStreams { s.fc.newLimit(n) } - t.initialWindowSize = int32(n) t.mu.Unlock() - t.controlBuf.put(&windowUpdate{0, t.fc.newLimit(n)}) - t.controlBuf.put(&settings{ + updateIWS := func(interface{}) bool { + t.initialWindowSize = int32(n) + return true + } + t.controlBuf.executeAndPut(updateIWS, &outgoingWindowUpdate{streamID: 0, increment: t.fc.newLimit(n)}) + t.controlBuf.put(&outgoingSettings{ ss: []http2.Setting{ { ID: http2.SettingInitialWindowSize, - Val: uint32(n), + Val: n, }, }, }) @@ -815,7 +873,7 @@ func (t *http2Client) handleData(f *http2.DataFrame) { size := f.Header().Length var sendBDPPing bool if t.bdpEst != nil { - sendBDPPing = t.bdpEst.add(uint32(size)) + sendBDPPing = t.bdpEst.add(size) } // Decouple connection's flow control from application's read. // An update on connection's flow control should not depend on @@ -826,21 +884,24 @@ func (t *http2Client) handleData(f *http2.DataFrame) { // active(fast) streams from starving in presence of slow or // inactive streams. // - // Furthermore, if a bdpPing is being sent out we can piggyback - // connection's window update for the bytes we just received. + if w := t.fc.onData(size); w > 0 { + t.controlBuf.put(&outgoingWindowUpdate{ + streamID: 0, + increment: w, + }) + } if sendBDPPing { - if size != 0 { // Could've been an empty data frame. - t.controlBuf.put(&windowUpdate{0, uint32(size)}) + // Avoid excessive ping detection (e.g. in an L7 proxy) + // by sending a window update prior to the BDP ping. + + if w := t.fc.reset(); w > 0 { + t.controlBuf.put(&outgoingWindowUpdate{ + streamID: 0, + increment: w, + }) } + t.controlBuf.put(bdpPing) - } else { - if err := t.fc.onData(uint32(size)); err != nil { - t.Close() - return - } - if w := t.fc.onRead(uint32(size)); w > 0 { - t.controlBuf.put(&windowUpdate{0, w}) - } } // Select the right stream to dispatch. s, ok := t.getStream(f) @@ -848,25 +909,15 @@ func (t *http2Client) handleData(f *http2.DataFrame) { return } if size > 0 { - s.mu.Lock() - if s.state == streamDone { - s.mu.Unlock() - return - } - if err := s.fc.onData(uint32(size)); err != nil { - s.rstStream = true - s.rstError = http2.ErrCodeFlowControl - s.finish(status.New(codes.Internal, err.Error())) - s.mu.Unlock() - s.write(recvMsg{err: io.EOF}) + if err := s.fc.onData(size); err != nil { + t.closeStream(s, io.EOF, true, http2.ErrCodeFlowControl, status.New(codes.Internal, err.Error()), nil, false) return } if f.Header().Flags.Has(http2.FlagDataPadded) { - if w := s.fc.onRead(uint32(size) - uint32(len(f.Data()))); w > 0 { - t.controlBuf.put(&windowUpdate{s.id, w}) + if w := s.fc.onRead(size - uint32(len(f.Data()))); w > 0 { + t.controlBuf.put(&outgoingWindowUpdate{s.id, w}) } } - s.mu.Unlock() // TODO(bradfitz, zhaoq): A copy is required here because there is no // guarantee f.Data() is consumed before the arrival of next frame. // Can this copy be eliminated? @@ -879,14 +930,7 @@ func (t *http2Client) handleData(f *http2.DataFrame) { // The server has closed the stream without sending trailers. Record that // the read direction is closed, and set the status appropriately. if f.FrameHeader.Flags.Has(http2.FlagDataEndStream) { - s.mu.Lock() - if s.state == streamDone { - s.mu.Unlock() - return - } - s.finish(status.New(codes.Internal, "server closed the stream without sending trailers")) - s.mu.Unlock() - s.write(recvMsg{err: io.EOF}) + t.closeStream(s, io.EOF, false, http2.ErrCodeNo, status.New(codes.Internal, "server closed the stream without sending trailers"), nil, true) } } @@ -895,73 +939,72 @@ func (t *http2Client) handleRSTStream(f *http2.RSTStreamFrame) { if !ok { return } - s.mu.Lock() - if s.state == streamDone { - s.mu.Unlock() - return - } - if !s.headerDone { - close(s.headerChan) - s.headerDone = true - } - - code := http2.ErrCode(f.ErrCode) - if code == http2.ErrCodeRefusedStream { + if f.ErrCode == http2.ErrCodeRefusedStream { // The stream was unprocessed by the server. - s.unprocessed = true + atomic.StoreUint32(&s.unprocessed, 1) } - statusCode, ok := http2ErrConvTab[code] + statusCode, ok := http2ErrConvTab[f.ErrCode] if !ok { warningf("transport: http2Client.handleRSTStream found no mapped gRPC status for the received http2 error %v", f.ErrCode) statusCode = codes.Unknown } - s.finish(status.Newf(statusCode, "stream terminated by RST_STREAM with error code: %v", f.ErrCode)) - s.mu.Unlock() - s.write(recvMsg{err: io.EOF}) + if statusCode == codes.Canceled { + // Our deadline was already exceeded, and that was likely the cause of + // this cancelation. Alter the status code accordingly. + if d, ok := s.ctx.Deadline(); ok && d.After(time.Now()) { + statusCode = codes.DeadlineExceeded + } + } + t.closeStream(s, io.EOF, false, http2.ErrCodeNo, status.Newf(statusCode, "stream terminated by RST_STREAM with error code: %v", f.ErrCode), nil, false) } func (t *http2Client) handleSettings(f *http2.SettingsFrame, isFirst bool) { if f.IsAck() { return } - var rs []http2.Setting - var ps []http2.Setting - isMaxConcurrentStreamsMissing := true + var maxStreams *uint32 + var ss []http2.Setting + var updateFuncs []func() f.ForeachSetting(func(s http2.Setting) error { - if s.ID == http2.SettingMaxConcurrentStreams { - isMaxConcurrentStreamsMissing = false - } - if t.isRestrictive(s) { - rs = append(rs, s) - } else { - ps = append(ps, s) + switch s.ID { + case http2.SettingMaxConcurrentStreams: + maxStreams = new(uint32) + *maxStreams = s.Val + case http2.SettingMaxHeaderListSize: + updateFuncs = append(updateFuncs, func() { + t.maxSendHeaderListSize = new(uint32) + *t.maxSendHeaderListSize = s.Val + }) + default: + ss = append(ss, s) } return nil }) - if isFirst && isMaxConcurrentStreamsMissing { - // This means server is imposing no limits on - // maximum number of concurrent streams initiated by client. - // So we must remove our self-imposed limit. - ps = append(ps, http2.Setting{ - ID: http2.SettingMaxConcurrentStreams, - Val: math.MaxUint32, - }) - } - t.applySettings(rs) - t.controlBuf.put(&settingsAck{}) - t.applySettings(ps) -} - -func (t *http2Client) isRestrictive(s http2.Setting) bool { - switch s.ID { - case http2.SettingMaxConcurrentStreams: - return int(s.Val) < t.maxStreams - case http2.SettingInitialWindowSize: - // Note: we don't acquire a lock here to read streamSendQuota - // because the same goroutine updates it later. - return s.Val < t.streamSendQuota + if isFirst && maxStreams == nil { + maxStreams = new(uint32) + *maxStreams = math.MaxUint32 + } + sf := &incomingSettings{ + ss: ss, + } + if maxStreams != nil { + updateStreamQuota := func() { + delta := int64(*maxStreams) - int64(t.maxConcurrentStreams) + t.maxConcurrentStreams = *maxStreams + t.streamQuota += delta + if delta > 0 && t.waitingStreams > 0 { + close(t.streamsQuotaAvailable) // wake all of them up. + t.streamsQuotaAvailable = make(chan struct{}, 1) + } + } + updateFuncs = append(updateFuncs, updateStreamQuota) } - return false + t.controlBuf.executeAndPut(func(interface{}) bool { + for _, f := range updateFuncs { + f() + } + return true + }, sf) } func (t *http2Client) handlePing(f *http2.PingFrame) { @@ -979,7 +1022,7 @@ func (t *http2Client) handlePing(f *http2.PingFrame) { func (t *http2Client) handleGoAway(f *http2.GoAwayFrame) { t.mu.Lock() - if t.state != reachable && t.state != draining { + if t.state == closing { t.mu.Unlock() return } @@ -1014,6 +1057,10 @@ func (t *http2Client) handleGoAway(f *http2.GoAwayFrame) { t.setGoAwayReason(f) close(t.goAway) t.state = draining + t.controlBuf.put(&incomingGoAway{}) + + // This has to be a new goroutine because we're still using the current goroutine to read in the transport. + t.onGoAway(t.goAwayReason) } // All streams with IDs greater than the GoAwayId // and smaller than the previous GoAway ID should be killed. @@ -1024,11 +1071,8 @@ func (t *http2Client) handleGoAway(f *http2.GoAwayFrame) { for streamID, stream := range t.activeStreams { if streamID > id && streamID <= upperLimit { // The stream was unprocessed by the server. - stream.mu.Lock() - stream.unprocessed = true - stream.finish(statusGoAway) - stream.mu.Unlock() - close(stream.goAway) + atomic.StoreUint32(&stream.unprocessed, 1) + t.closeStream(stream, errStreamDrain, false, http2.ErrCodeNo, statusGoAway, nil, false) } } t.prevGoAwayID = id @@ -1060,15 +1104,10 @@ func (t *http2Client) GetGoAwayReason() GoAwayReason { } func (t *http2Client) handleWindowUpdate(f *http2.WindowUpdateFrame) { - id := f.Header().StreamID - incr := f.Increment - if id == 0 { - t.sendQuotaPool.add(int(incr)) - return - } - if s, ok := t.getStream(f); ok { - s.sendQuotaPool.add(int(incr)) - } + t.controlBuf.put(&incomingWindowUpdate{ + streamID: f.Header().StreamID, + increment: f.Increment, + }) } // operateHeaders takes action on the decoded headers. @@ -1077,18 +1116,10 @@ func (t *http2Client) operateHeaders(frame *http2.MetaHeadersFrame) { if !ok { return } - s.mu.Lock() - s.bytesReceived = true - s.mu.Unlock() + atomic.StoreUint32(&s.bytesReceived, 1) var state decodeState - if err := state.decodeResponseHeader(frame); err != nil { - s.mu.Lock() - if !s.headerDone { - close(s.headerChan) - s.headerDone = true - } - s.mu.Unlock() - s.write(recvMsg{err: err}) + if err := state.decodeHeader(frame); err != nil { + t.closeStream(s, err, true, http2.ErrCodeProtocol, status.New(codes.Internal, err.Error()), nil, false) // Something wrong. Stops reading even when there is remaining. return } @@ -1112,39 +1143,27 @@ func (t *http2Client) operateHeaders(frame *http2.MetaHeadersFrame) { } } }() - - s.mu.Lock() - if !endStream { - s.recvCompress = state.encoding - } - if !s.headerDone { - if !endStream && len(state.mdata) > 0 { - s.header = state.mdata + // If headers haven't been received yet. + if atomic.SwapUint32(&s.headerDone, 1) == 0 { + if !endStream { + // Headers frame is not actually a trailers-only frame. + isHeader = true + // These values can be set without any synchronization because + // stream goroutine will read it only after seeing a closed + // headerChan which we'll close after setting this. + s.recvCompress = state.encoding + if len(state.mdata) > 0 { + s.header = state.mdata + } + } else { + s.noHeaders = true } close(s.headerChan) - s.headerDone = true - isHeader = true } - if !endStream || s.state == streamDone { - s.mu.Unlock() + if !endStream { return } - if len(state.mdata) > 0 { - s.trailer = state.mdata - } - s.finish(state.status()) - s.mu.Unlock() - s.write(recvMsg{err: io.EOF}) -} - -func handleMalformedHTTP2(s *Stream, err error) { - s.mu.Lock() - if !s.headerDone { - close(s.headerChan) - s.headerDone = true - } - s.mu.Unlock() - s.write(recvMsg{err: err}) + t.closeStream(s, io.EOF, false, http2.ErrCodeNo, state.status(), state.mdata, true) } // reader runs as a separate goroutine in charge of reading data from network @@ -1154,16 +1173,20 @@ func handleMalformedHTTP2(s *Stream, err error) { // optimal. // TODO(zhaoq): Check the validity of the incoming frame sequence. func (t *http2Client) reader() { + defer close(t.readerDone) // Check the validity of server preface. frame, err := t.framer.fr.ReadFrame() if err != nil { - t.Close() + t.Close() // this kicks off resetTransport, so must be last before return return } - atomic.CompareAndSwapUint32(&t.activity, 0, 1) + t.conn.SetReadDeadline(time.Time{}) // reset deadline once we get the settings frame (we didn't time out, yay!) + if t.keepaliveEnabled { + atomic.CompareAndSwapUint32(&t.activity, 0, 1) + } sf, ok := frame.(*http2.SettingsFrame) if !ok { - t.Close() + t.Close() // this kicks off resetTransport, so must be last before return return } t.onSuccess() @@ -1172,7 +1195,9 @@ func (t *http2Client) reader() { // loop to keep reading incoming messages on this transport. for { frame, err := t.framer.fr.ReadFrame() - atomic.CompareAndSwapUint32(&t.activity, 0, 1) + if t.keepaliveEnabled { + atomic.CompareAndSwapUint32(&t.activity, 0, 1) + } if err != nil { // Abort an active stream if the http2.Framer returns a // http2.StreamError. This can happen only if the server's response @@ -1183,7 +1208,9 @@ func (t *http2Client) reader() { t.mu.Unlock() if s != nil { // use error detail to provide better err message - handleMalformedHTTP2(s, streamErrorf(http2ErrConvTab[se.Code], "%v", t.framer.fr.ErrorDetail())) + code := http2ErrConvTab[se.Code] + msg := t.framer.fr.ErrorDetail().Error() + t.closeStream(s, status.Error(code, msg), true, http2.ErrCodeProtocol, status.New(code, msg), nil, false) } continue } else { @@ -1213,109 +1240,6 @@ func (t *http2Client) reader() { } } -func (t *http2Client) applySettings(ss []http2.Setting) { - for _, s := range ss { - switch s.ID { - case http2.SettingMaxConcurrentStreams: - // TODO(zhaoq): This is a hack to avoid significant refactoring of the - // code to deal with the unrealistic int32 overflow. Probably will try - // to find a better way to handle this later. - if s.Val > math.MaxInt32 { - s.Val = math.MaxInt32 - } - ms := t.maxStreams - t.maxStreams = int(s.Val) - t.streamsQuota.add(int(s.Val) - ms) - case http2.SettingInitialWindowSize: - t.mu.Lock() - for _, stream := range t.activeStreams { - // Adjust the sending quota for each stream. - stream.sendQuotaPool.addAndUpdate(int(s.Val) - int(t.streamSendQuota)) - } - t.streamSendQuota = s.Val - t.mu.Unlock() - } - } -} - -// TODO(mmukhi): A lot of this code(and code in other places in the tranpsort layer) -// is duplicated between the client and the server. -// The transport layer needs to be refactored to take care of this. -func (t *http2Client) itemHandler(i item) (err error) { - defer func() { - if err != nil { - errorf(" error in itemHandler: %v", err) - } - }() - switch i := i.(type) { - case *dataFrame: - if err := t.framer.fr.WriteData(i.streamID, i.endStream, i.d); err != nil { - return err - } - i.f() - return nil - case *headerFrame: - t.hBuf.Reset() - for _, f := range i.hf { - t.hEnc.WriteField(f) - } - endHeaders := false - first := true - for !endHeaders { - size := t.hBuf.Len() - if size > http2MaxFrameLen { - size = http2MaxFrameLen - } else { - endHeaders = true - } - if first { - first = false - err = t.framer.fr.WriteHeaders(http2.HeadersFrameParam{ - StreamID: i.streamID, - BlockFragment: t.hBuf.Next(size), - EndStream: i.endStream, - EndHeaders: endHeaders, - }) - } else { - err = t.framer.fr.WriteContinuation( - i.streamID, - endHeaders, - t.hBuf.Next(size), - ) - } - if err != nil { - return err - } - } - return nil - case *windowUpdate: - return t.framer.fr.WriteWindowUpdate(i.streamID, i.increment) - case *settings: - return t.framer.fr.WriteSettings(i.ss...) - case *settingsAck: - return t.framer.fr.WriteSettingsAck() - case *resetStream: - // If the server needs to be to intimated about stream closing, - // then we need to make sure the RST_STREAM frame is written to - // the wire before the headers of the next stream waiting on - // streamQuota. We ensure this by adding to the streamsQuota pool - // only after having acquired the writableChan to send RST_STREAM. - err := t.framer.fr.WriteRSTStream(i.streamID, i.code) - t.streamsQuota.add(1) - return err - case *flushIO: - return t.framer.writer.Flush() - case *ping: - if !i.ack { - t.bdpEst.timesnap(i.data) - } - return t.framer.fr.WritePing(i.ack, i.data) - default: - errorf("transport: http2Client.controller got unexpected item type %v", i) - return fmt.Errorf("transport: http2Client.controller got unexpected item type %v", i) - } -} - // keepalive running in a separate goroutune makes sure the connection is alive by sending pings. func (t *http2Client) keepalive() { p := &ping{data: [8]byte{}} @@ -1342,6 +1266,9 @@ func (t *http2Client) keepalive() { } } else { t.mu.Unlock() + if channelz.IsOn() { + atomic.AddInt64(&t.czData.kpCount, 1) + } // Send ping. t.controlBuf.put(p) } @@ -1378,3 +1305,52 @@ func (t *http2Client) Error() <-chan struct{} { func (t *http2Client) GoAway() <-chan struct{} { return t.goAway } + +func (t *http2Client) ChannelzMetric() *channelz.SocketInternalMetric { + s := channelz.SocketInternalMetric{ + StreamsStarted: atomic.LoadInt64(&t.czData.streamsStarted), + StreamsSucceeded: atomic.LoadInt64(&t.czData.streamsSucceeded), + StreamsFailed: atomic.LoadInt64(&t.czData.streamsFailed), + MessagesSent: atomic.LoadInt64(&t.czData.msgSent), + MessagesReceived: atomic.LoadInt64(&t.czData.msgRecv), + KeepAlivesSent: atomic.LoadInt64(&t.czData.kpCount), + LastLocalStreamCreatedTimestamp: time.Unix(0, atomic.LoadInt64(&t.czData.lastStreamCreatedTime)), + LastMessageSentTimestamp: time.Unix(0, atomic.LoadInt64(&t.czData.lastMsgSentTime)), + LastMessageReceivedTimestamp: time.Unix(0, atomic.LoadInt64(&t.czData.lastMsgRecvTime)), + LocalFlowControlWindow: int64(t.fc.getSize()), + SocketOptions: channelz.GetSocketOption(t.conn), + LocalAddr: t.localAddr, + RemoteAddr: t.remoteAddr, + // RemoteName : + } + if au, ok := t.authInfo.(credentials.ChannelzSecurityInfo); ok { + s.Security = au.GetSecurityValue() + } + s.RemoteFlowControlWindow = t.getOutFlowWindow() + return &s +} + +func (t *http2Client) IncrMsgSent() { + atomic.AddInt64(&t.czData.msgSent, 1) + atomic.StoreInt64(&t.czData.lastMsgSentTime, time.Now().UnixNano()) +} + +func (t *http2Client) IncrMsgRecv() { + atomic.AddInt64(&t.czData.msgRecv, 1) + atomic.StoreInt64(&t.czData.lastMsgRecvTime, time.Now().UnixNano()) +} + +func (t *http2Client) getOutFlowWindow() int64 { + resp := make(chan uint32, 1) + timer := time.NewTimer(time.Second) + defer timer.Stop() + t.controlBuf.put(&outFlowControlSizeRequest{resp}) + select { + case sz := <-resp: + return int64(sz) + case <-t.ctxDone: + return -1 + case <-timer.C: + return -2 + } +} diff --git a/vendor/google.golang.org/grpc/transport/http2_server.go b/vendor/google.golang.org/grpc/internal/transport/http2_server.go similarity index 63% rename from vendor/google.golang.org/grpc/transport/http2_server.go rename to vendor/google.golang.org/grpc/internal/transport/http2_server.go index 6d252c53a67d..efb7f53ffc32 100644 --- a/vendor/google.golang.org/grpc/transport/http2_server.go +++ b/vendor/google.golang.org/grpc/internal/transport/http2_server.go @@ -24,7 +24,6 @@ import ( "fmt" "io" "math" - "math/rand" "net" "strconv" "sync" @@ -35,8 +34,12 @@ import ( "golang.org/x/net/context" "golang.org/x/net/http2" "golang.org/x/net/http2/hpack" + "google.golang.org/grpc/codes" "google.golang.org/grpc/credentials" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/internal/channelz" + "google.golang.org/grpc/internal/grpcrand" "google.golang.org/grpc/keepalive" "google.golang.org/grpc/metadata" "google.golang.org/grpc/peer" @@ -45,35 +48,37 @@ import ( "google.golang.org/grpc/tap" ) -// ErrIllegalHeaderWrite indicates that setting header is illegal because of -// the stream's state. -var ErrIllegalHeaderWrite = errors.New("transport: the stream is done or WriteHeader was already called") +var ( + // ErrIllegalHeaderWrite indicates that setting header is illegal because of + // the stream's state. + ErrIllegalHeaderWrite = errors.New("transport: the stream is done or WriteHeader was already called") + // ErrHeaderListSizeLimitViolation indicates that the header list size is larger + // than the limit set by peer. + ErrHeaderListSizeLimitViolation = errors.New("transport: trying to send header list size larger than the limit set by peer") +) // http2Server implements the ServerTransport interface with HTTP2. type http2Server struct { ctx context.Context + ctxDone <-chan struct{} // Cache the context.Done() chan cancel context.CancelFunc conn net.Conn + loopy *loopyWriter + readerDone chan struct{} // sync point to enable testing. + writerDone chan struct{} // sync point to enable testing. remoteAddr net.Addr localAddr net.Addr maxStreamID uint32 // max stream ID ever seen authInfo credentials.AuthInfo // auth info about the connection inTapHandle tap.ServerInHandle framer *framer - hBuf *bytes.Buffer // the buffer for HPACK encoding - hEnc *hpack.Encoder // HPACK encoder // The max number of concurrent streams. maxStreams uint32 // controlBuf delivers all the control related tasks (e.g., window // updates, reset streams, and various settings) to the controller. controlBuf *controlBuffer - fc *inFlow - // sendQuotaPool provides flow control to outbound message. - sendQuotaPool *quotaPool - // localSendQuota limits the amount of data that can be scheduled - // for writing before it is actually written out. - localSendQuota *quotaPool - stats stats.Handler + fc *trInFlow + stats stats.Handler // Flag to keep track of reading activity on transport. // 1 is true and 0 is false. activity uint32 // Accessed atomically. @@ -89,9 +94,10 @@ type http2Server struct { // Flag to signify that number of ping strikes should be reset to 0. // This is set whenever data or header frames are sent. // 1 means yes. - resetPingStrikes uint32 // Accessed atomically. - initialWindowSize int32 - bdpEst *bdpEstimator + resetPingStrikes uint32 // Accessed atomically. + initialWindowSize int32 + bdpEst *bdpEstimator + maxSendHeaderListSize *uint32 mu sync.Mutex // guard the following @@ -104,27 +110,27 @@ type http2Server struct { drainChan chan struct{} state transportState activeStreams map[uint32]*Stream - // the per-stream outbound flow control window size set by the peer. - streamSendQuota uint32 // idle is the time instant when the connection went idle. // This is either the beginning of the connection or when the number of // RPCs go down to 0. // When the connection is busy, this value is set to 0. idle time.Time + + // Fields below are for channelz metric collection. + channelzID int64 // channelz unique identification number + czData *channelzData } // newHTTP2Server constructs a ServerTransport based on HTTP2. ConnectionError is // returned if something goes wrong. func newHTTP2Server(conn net.Conn, config *ServerConfig) (_ ServerTransport, err error) { - writeBufSize := defaultWriteBufSize - if config.WriteBufferSize > 0 { - writeBufSize = config.WriteBufferSize - } - readBufSize := defaultReadBufSize - if config.ReadBufferSize > 0 { - readBufSize = config.ReadBufferSize + writeBufSize := config.WriteBufferSize + readBufSize := config.ReadBufferSize + maxHeaderListSize := defaultServerMaxHeaderListSize + if config.MaxHeaderListSize != nil { + maxHeaderListSize = *config.MaxHeaderListSize } - framer := newFramer(conn, writeBufSize, readBufSize) + framer := newFramer(conn, writeBufSize, readBufSize, maxHeaderListSize) // Send initial settings as connection preface to client. var isettings []http2.Setting // TODO(zhaoq): Have a better way to signal "no limit" because 0 is @@ -154,6 +160,12 @@ func newHTTP2Server(conn net.Conn, config *ServerConfig) (_ ServerTransport, err ID: http2.SettingInitialWindowSize, Val: uint32(iwz)}) } + if config.MaxHeaderListSize != nil { + isettings = append(isettings, http2.Setting{ + ID: http2.SettingMaxHeaderListSize, + Val: *config.MaxHeaderListSize, + }) + } if err := framer.fr.WriteSettings(isettings...); err != nil { return nil, connectionErrorf(false, err, "transport: %v", err) } @@ -185,33 +197,31 @@ func newHTTP2Server(conn net.Conn, config *ServerConfig) (_ ServerTransport, err if kep.MinTime == 0 { kep.MinTime = defaultKeepalivePolicyMinTime } - var buf bytes.Buffer ctx, cancel := context.WithCancel(context.Background()) t := &http2Server{ ctx: ctx, cancel: cancel, + ctxDone: ctx.Done(), conn: conn, remoteAddr: conn.RemoteAddr(), localAddr: conn.LocalAddr(), authInfo: config.AuthInfo, framer: framer, - hBuf: &buf, - hEnc: hpack.NewEncoder(&buf), + readerDone: make(chan struct{}), + writerDone: make(chan struct{}), maxStreams: maxStreams, inTapHandle: config.InTapHandle, - controlBuf: newControlBuffer(), - fc: &inFlow{limit: uint32(icwz)}, - sendQuotaPool: newQuotaPool(defaultWindowSize), - localSendQuota: newQuotaPool(defaultLocalSendQuota), + fc: &trInFlow{limit: uint32(icwz)}, state: reachable, activeStreams: make(map[uint32]*Stream), - streamSendQuota: defaultWindowSize, stats: config.StatsHandler, kp: kp, idle: time.Now(), kep: kep, initialWindowSize: iwz, + czData: new(channelzData), } + t.controlBuf = newControlBuffer(t.ctxDone) if dynamicWindow { t.bdpEst = &bdpEstimator{ bdp: initialWindowSize, @@ -226,6 +236,9 @@ func newHTTP2Server(conn net.Conn, config *ServerConfig) (_ ServerTransport, err connBegin := &stats.ConnBegin{} t.stats.HandleConn(t.ctx, connBegin) } + if channelz.IsOn() { + t.channelzID = channelz.RegisterNormalSocket(t, config.ChannelzParentID, "") + } t.framer.writer.Flush() defer func() { @@ -258,37 +271,44 @@ func newHTTP2Server(conn net.Conn, config *ServerConfig) (_ ServerTransport, err t.handleSettings(sf) go func() { - loopyWriter(t.ctx, t.controlBuf, t.itemHandler) + t.loopy = newLoopyWriter(serverSide, t.framer, t.controlBuf, t.bdpEst) + t.loopy.ssGoAwayHandler = t.outgoingGoAwayHandler + if err := t.loopy.run(); err != nil { + errorf("transport: loopyWriter.run returning. Err: %v", err) + } t.conn.Close() + close(t.writerDone) }() go t.keepalive() return t, nil } // operateHeader takes action on the decoded headers. -func (t *http2Server) operateHeaders(frame *http2.MetaHeadersFrame, handle func(*Stream), traceCtx func(context.Context, string) context.Context) (close bool) { +func (t *http2Server) operateHeaders(frame *http2.MetaHeadersFrame, handle func(*Stream), traceCtx func(context.Context, string) context.Context) (fatal bool) { streamID := frame.Header().StreamID - - var state decodeState - for _, hf := range frame.Fields { - if err := state.processHeaderField(hf); err != nil { - if se, ok := err.(StreamError); ok { - t.controlBuf.put(&resetStream{streamID, statusCodeConvTab[se.Code]}) - } - return + state := decodeState{serverSide: true} + if err := state.decodeHeader(frame); err != nil { + if se, ok := status.FromError(err); ok { + t.controlBuf.put(&cleanupStream{ + streamID: streamID, + rst: true, + rstCode: statusCodeConvTab[se.Code()], + onWrite: func() {}, + }) } + return false } buf := newRecvBuffer() s := &Stream{ - id: streamID, - st: t, - buf: buf, - fc: &inFlow{limit: uint32(t.initialWindowSize)}, - recvCompress: state.encoding, - method: state.method, + id: streamID, + st: t, + buf: buf, + fc: &inFlow{limit: uint32(t.initialWindowSize)}, + recvCompress: state.encoding, + method: state.method, + contentSubtype: state.contentSubtype, } - if frame.StreamEnded() { // s is just created by the caller. No lock needed. s.state = streamReadDone @@ -306,10 +326,6 @@ func (t *http2Server) operateHeaders(frame *http2.MetaHeadersFrame, handle func( pr.AuthInfo = t.authInfo } s.ctx = peer.NewContext(s.ctx, pr) - // Cache the current stream to the context so that the server application - // can find out. Required when the server wants to send some metadata - // back to the client (unary call only). - s.ctx = newContextWithStream(s.ctx, s) // Attach the received metadata to the context. if len(state.mdata) > 0 { s.ctx = metadata.NewIncomingContext(s.ctx, state.mdata) @@ -328,19 +344,29 @@ func (t *http2Server) operateHeaders(frame *http2.MetaHeadersFrame, handle func( s.ctx, err = t.inTapHandle(s.ctx, info) if err != nil { warningf("transport: http2Server.operateHeaders got an error from InTapHandle: %v", err) - t.controlBuf.put(&resetStream{s.id, http2.ErrCodeRefusedStream}) - return + t.controlBuf.put(&cleanupStream{ + streamID: s.id, + rst: true, + rstCode: http2.ErrCodeRefusedStream, + onWrite: func() {}, + }) + return false } } t.mu.Lock() if t.state != reachable { t.mu.Unlock() - return + return false } if uint32(len(t.activeStreams)) >= t.maxStreams { t.mu.Unlock() - t.controlBuf.put(&resetStream{streamID, http2.ErrCodeRefusedStream}) - return + t.controlBuf.put(&cleanupStream{ + streamID: streamID, + rst: true, + rstCode: http2.ErrCodeRefusedStream, + onWrite: func() {}, + }) + return false } if streamID%2 != 1 || streamID <= t.maxStreamID { t.mu.Unlock() @@ -349,12 +375,15 @@ func (t *http2Server) operateHeaders(frame *http2.MetaHeadersFrame, handle func( return true } t.maxStreamID = streamID - s.sendQuotaPool = newQuotaPool(int(t.streamSendQuota)) t.activeStreams[streamID] = s if len(t.activeStreams) == 1 { t.idle = time.Time{} } t.mu.Unlock() + if channelz.IsOn() { + atomic.AddInt64(&t.czData.streamsStarted, 1) + atomic.StoreInt64(&t.czData.lastStreamCreatedTime, time.Now().UnixNano()) + } s.requestRead = func(n int) { t.adjustWindow(s, uint32(n)) } @@ -370,39 +399,51 @@ func (t *http2Server) operateHeaders(frame *http2.MetaHeadersFrame, handle func( } t.stats.HandleRPC(s.ctx, inHeader) } + s.ctxDone = s.ctx.Done() + s.wq = newWriteQuota(defaultWriteQuota, s.ctxDone) s.trReader = &transportReader{ reader: &recvBufferReader{ - ctx: s.ctx, - recv: s.buf, + ctx: s.ctx, + ctxDone: s.ctxDone, + recv: s.buf, }, windowHandler: func(n int) { t.updateWindow(s, uint32(n)) }, } - s.waiters = waiters{ - ctx: s.ctx, - tctx: t.ctx, - } + // Register the stream with loopy. + t.controlBuf.put(®isterStream{ + streamID: s.id, + wq: s.wq, + }) handle(s) - return + return false } // HandleStreams receives incoming streams using the given handler. This is // typically run in a separate goroutine. // traceCtx attaches trace to ctx and returns the new context. func (t *http2Server) HandleStreams(handle func(*Stream), traceCtx func(context.Context, string) context.Context) { + defer close(t.readerDone) for { frame, err := t.framer.fr.ReadFrame() atomic.StoreUint32(&t.activity, 1) if err != nil { if se, ok := err.(http2.StreamError); ok { + warningf("transport: http2Server.HandleStreams encountered http2.StreamError: %v", se) t.mu.Lock() s := t.activeStreams[se.StreamID] t.mu.Unlock() if s != nil { - t.closeStream(s) + t.closeStream(s, true, se.Code, nil, false) + } else { + t.controlBuf.put(&cleanupStream{ + streamID: se.StreamID, + rst: true, + rstCode: se.Code, + onWrite: func() {}, + }) } - t.controlBuf.put(&resetStream{se.StreamID, se.Code}) continue } if err == io.EOF || err == io.ErrUnexpectedEOF { @@ -456,33 +497,20 @@ func (t *http2Server) getStream(f http2.Frame) (*Stream, bool) { // of stream if the application is requesting data larger in size than // the window. func (t *http2Server) adjustWindow(s *Stream, n uint32) { - s.mu.Lock() - defer s.mu.Unlock() - if s.state == streamDone { - return - } if w := s.fc.maybeAdjust(n); w > 0 { - if cw := t.fc.resetPendingUpdate(); cw > 0 { - t.controlBuf.put(&windowUpdate{0, cw}) - } - t.controlBuf.put(&windowUpdate{s.id, w}) + t.controlBuf.put(&outgoingWindowUpdate{streamID: s.id, increment: w}) } + } // updateWindow adjusts the inbound quota for the stream and the transport. // Window updates will deliver to the controller for sending when // the cumulative quota exceeds the corresponding threshold. func (t *http2Server) updateWindow(s *Stream, n uint32) { - s.mu.Lock() - defer s.mu.Unlock() - if s.state == streamDone { - return - } if w := s.fc.onRead(n); w > 0 { - if cw := t.fc.resetPendingUpdate(); cw > 0 { - t.controlBuf.put(&windowUpdate{0, cw}) - } - t.controlBuf.put(&windowUpdate{s.id, w}) + t.controlBuf.put(&outgoingWindowUpdate{streamID: s.id, + increment: w, + }) } } @@ -496,12 +524,15 @@ func (t *http2Server) updateFlowControl(n uint32) { } t.initialWindowSize = int32(n) t.mu.Unlock() - t.controlBuf.put(&windowUpdate{0, t.fc.newLimit(n)}) - t.controlBuf.put(&settings{ + t.controlBuf.put(&outgoingWindowUpdate{ + streamID: 0, + increment: t.fc.newLimit(n), + }) + t.controlBuf.put(&outgoingSettings{ ss: []http2.Setting{ { ID: http2.SettingInitialWindowSize, - Val: uint32(n), + Val: n, }, }, }) @@ -512,7 +543,7 @@ func (t *http2Server) handleData(f *http2.DataFrame) { size := f.Header().Length var sendBDPPing bool if t.bdpEst != nil { - sendBDPPing = t.bdpEst.add(uint32(size)) + sendBDPPing = t.bdpEst.add(size) } // Decouple connection's flow control from application's read. // An update on connection's flow control should not depend on @@ -522,23 +553,22 @@ func (t *http2Server) handleData(f *http2.DataFrame) { // Decoupling the connection flow control will prevent other // active(fast) streams from starving in presence of slow or // inactive streams. - // - // Furthermore, if a bdpPing is being sent out we can piggyback - // connection's window update for the bytes we just received. + if w := t.fc.onData(size); w > 0 { + t.controlBuf.put(&outgoingWindowUpdate{ + streamID: 0, + increment: w, + }) + } if sendBDPPing { - if size != 0 { // Could be an empty frame. - t.controlBuf.put(&windowUpdate{0, uint32(size)}) + // Avoid excessive ping detection (e.g. in an L7 proxy) + // by sending a window update prior to the BDP ping. + if w := t.fc.reset(); w > 0 { + t.controlBuf.put(&outgoingWindowUpdate{ + streamID: 0, + increment: w, + }) } t.controlBuf.put(bdpPing) - } else { - if err := t.fc.onData(uint32(size)); err != nil { - errorf("transport: http2Server %v", err) - t.Close() - return - } - if w := t.fc.onRead(uint32(size)); w > 0 { - t.controlBuf.put(&windowUpdate{0, w}) - } } // Select the right stream to dispatch. s, ok := t.getStream(f) @@ -546,23 +576,15 @@ func (t *http2Server) handleData(f *http2.DataFrame) { return } if size > 0 { - s.mu.Lock() - if s.state == streamDone { - s.mu.Unlock() - return - } - if err := s.fc.onData(uint32(size)); err != nil { - s.mu.Unlock() - t.closeStream(s) - t.controlBuf.put(&resetStream{s.id, http2.ErrCodeFlowControl}) + if err := s.fc.onData(size); err != nil { + t.closeStream(s, true, http2.ErrCodeFlowControl, nil, false) return } if f.Header().Flags.Has(http2.FlagDataPadded) { - if w := s.fc.onRead(uint32(size) - uint32(len(f.Data()))); w > 0 { - t.controlBuf.put(&windowUpdate{s.id, w}) + if w := s.fc.onRead(size - uint32(len(f.Data()))); w > 0 { + t.controlBuf.put(&outgoingWindowUpdate{s.id, w}) } } - s.mu.Unlock() // TODO(bradfitz, zhaoq): A copy is required here because there is no // guarantee f.Data() is consumed before the arrival of next frame. // Can this copy be eliminated? @@ -574,11 +596,7 @@ func (t *http2Server) handleData(f *http2.DataFrame) { } if f.Header().Flags.Has(http2.FlagDataEndStream) { // Received the end of stream from the client. - s.mu.Lock() - if s.state != streamDone { - s.state = streamReadDone - } - s.mu.Unlock() + s.compareAndSwapState(streamActive, streamReadDone) s.write(recvMsg{err: io.EOF}) } } @@ -588,50 +606,35 @@ func (t *http2Server) handleRSTStream(f *http2.RSTStreamFrame) { if !ok { return } - t.closeStream(s) + t.closeStream(s, false, 0, nil, false) } func (t *http2Server) handleSettings(f *http2.SettingsFrame) { if f.IsAck() { return } - var rs []http2.Setting - var ps []http2.Setting + var ss []http2.Setting + var updateFuncs []func() f.ForeachSetting(func(s http2.Setting) error { - if t.isRestrictive(s) { - rs = append(rs, s) - } else { - ps = append(ps, s) + switch s.ID { + case http2.SettingMaxHeaderListSize: + updateFuncs = append(updateFuncs, func() { + t.maxSendHeaderListSize = new(uint32) + *t.maxSendHeaderListSize = s.Val + }) + default: + ss = append(ss, s) } return nil }) - t.applySettings(rs) - t.controlBuf.put(&settingsAck{}) - t.applySettings(ps) -} - -func (t *http2Server) isRestrictive(s http2.Setting) bool { - switch s.ID { - case http2.SettingInitialWindowSize: - // Note: we don't acquire a lock here to read streamSendQuota - // because the same goroutine updates it later. - return s.Val < t.streamSendQuota - } - return false -} - -func (t *http2Server) applySettings(ss []http2.Setting) { - for _, s := range ss { - if s.ID == http2.SettingInitialWindowSize { - t.mu.Lock() - for _, stream := range t.activeStreams { - stream.sendQuotaPool.addAndUpdate(int(s.Val) - int(t.streamSendQuota)) - } - t.streamSendQuota = s.Val - t.mu.Unlock() + t.controlBuf.executeAndPut(func(interface{}) bool { + for _, f := range updateFuncs { + f() } - - } + return true + }, &incomingSettings{ + ss: ss, + }) } const ( @@ -690,33 +693,46 @@ func (t *http2Server) handlePing(f *http2.PingFrame) { } func (t *http2Server) handleWindowUpdate(f *http2.WindowUpdateFrame) { - id := f.Header().StreamID - incr := f.Increment - if id == 0 { - t.sendQuotaPool.add(int(incr)) - return + t.controlBuf.put(&incomingWindowUpdate{ + streamID: f.Header().StreamID, + increment: f.Increment, + }) +} + +func appendHeaderFieldsFromMD(headerFields []hpack.HeaderField, md metadata.MD) []hpack.HeaderField { + for k, vv := range md { + if isReservedHeader(k) { + // Clients don't tolerate reading restricted headers after some non restricted ones were sent. + continue + } + for _, v := range vv { + headerFields = append(headerFields, hpack.HeaderField{Name: k, Value: encodeMetadataHeader(k, v)}) + } + } + return headerFields +} + +func (t *http2Server) checkForHeaderListSize(it interface{}) bool { + if t.maxSendHeaderListSize == nil { + return true } - if s, ok := t.getStream(f); ok { - s.sendQuotaPool.add(int(incr)) + hdrFrame := it.(*headerFrame) + var sz int64 + for _, f := range hdrFrame.hf { + if sz += int64(f.Size()); sz > int64(*t.maxSendHeaderListSize) { + errorf("header list size to send violates the maximum size (%d bytes) set by client", *t.maxSendHeaderListSize) + return false + } } + return true } // WriteHeader sends the header metedata md back to the client. func (t *http2Server) WriteHeader(s *Stream, md metadata.MD) error { - select { - case <-s.ctx.Done(): - return ContextErr(s.ctx.Err()) - case <-t.ctx.Done(): - return ErrConnClosing - default: - } - - s.mu.Lock() - if s.headerOk || s.state == streamDone { - s.mu.Unlock() + if s.updateHeaderSent() || s.getState() == streamDone { return ErrIllegalHeaderWrite } - s.headerOk = true + s.hdrMu.Lock() if md.Len() > 0 { if s.header.Len() > 0 { s.header = metadata.Join(s.header, md) @@ -724,34 +740,43 @@ func (t *http2Server) WriteHeader(s *Stream, md metadata.MD) error { s.header = md } } - md = s.header - s.mu.Unlock() + if err := t.writeHeaderLocked(s); err != nil { + s.hdrMu.Unlock() + return err + } + s.hdrMu.Unlock() + return nil +} + +func (t *http2Server) writeHeaderLocked(s *Stream) error { // TODO(mmukhi): Benchmark if the performance gets better if count the metadata and other header fields // first and create a slice of that exact size. headerFields := make([]hpack.HeaderField, 0, 2) // at least :status, content-type will be there if none else. headerFields = append(headerFields, hpack.HeaderField{Name: ":status", Value: "200"}) - headerFields = append(headerFields, hpack.HeaderField{Name: "content-type", Value: "application/grpc"}) + headerFields = append(headerFields, hpack.HeaderField{Name: "content-type", Value: contentType(s.contentSubtype)}) if s.sendCompress != "" { headerFields = append(headerFields, hpack.HeaderField{Name: "grpc-encoding", Value: s.sendCompress}) } - for k, vv := range md { - if isReservedHeader(k) { - // Clients don't tolerate reading restricted headers after some non restricted ones were sent. - continue - } - for _, v := range vv { - headerFields = append(headerFields, hpack.HeaderField{Name: k, Value: encodeMetadataHeader(k, v)}) - } - } - t.controlBuf.put(&headerFrame{ + headerFields = appendHeaderFieldsFromMD(headerFields, s.header) + success, err := t.controlBuf.executeAndPut(t.checkForHeaderListSize, &headerFrame{ streamID: s.id, hf: headerFields, endStream: false, + onWrite: func() { + atomic.StoreUint32(&t.resetPingStrikes, 1) + }, }) - if t.stats != nil { - outHeader := &stats.OutHeader{ - //WireLength: // TODO(mmukhi): Revisit this later, if needed. + if !success { + if err != nil { + return err } + t.closeStream(s, true, http2.ErrCodeInternal, nil, false) + return ErrHeaderListSizeLimitViolation + } + if t.stats != nil { + // Note: WireLength is not set in outHeader. + // TODO(mmukhi): Revisit this later, if needed. + outHeader := &stats.OutHeader{} t.stats.HandleRPC(s.Context(), outHeader) } return nil @@ -762,37 +787,23 @@ func (t *http2Server) WriteHeader(s *Stream, md metadata.MD) error { // TODO(zhaoq): Now it indicates the end of entire stream. Revisit if early // OK is adopted. func (t *http2Server) WriteStatus(s *Stream, st *status.Status) error { - select { - case <-t.ctx.Done(): - return ErrConnClosing - default: - } - - var headersSent, hasHeader bool - s.mu.Lock() - if s.state == streamDone { - s.mu.Unlock() + if s.getState() == streamDone { return nil } - if s.headerOk { - headersSent = true - } - if s.header.Len() > 0 { - hasHeader = true - } - s.mu.Unlock() - - if !headersSent && hasHeader { - t.WriteHeader(s, nil) - headersSent = true - } - + s.hdrMu.Lock() // TODO(mmukhi): Benchmark if the performance gets better if count the metadata and other header fields // first and create a slice of that exact size. headerFields := make([]hpack.HeaderField, 0, 2) // grpc-status and grpc-message will be there if none else. - if !headersSent { - headerFields = append(headerFields, hpack.HeaderField{Name: ":status", Value: "200"}) - headerFields = append(headerFields, hpack.HeaderField{Name: "content-type", Value: "application/grpc"}) + if !s.updateHeaderSent() { // No headers have been sent. + if len(s.header) > 0 { // Send a separate header frame. + if err := t.writeHeaderLocked(s); err != nil { + s.hdrMu.Unlock() + return err + } + } else { // Send a trailer only response. + headerFields = append(headerFields, hpack.HeaderField{Name: ":status", Value: "200"}) + headerFields = append(headerFields, hpack.HeaderField{Name: "content-type", Value: contentType(s.contentSubtype)}) + } } headerFields = append(headerFields, hpack.HeaderField{Name: "grpc-status", Value: strconv.Itoa(int(st.Code()))}) headerFields = append(headerFields, hpack.HeaderField{Name: "grpc-message", Value: encodeGrpcMessage(st.Message())}) @@ -801,129 +812,83 @@ func (t *http2Server) WriteStatus(s *Stream, st *status.Status) error { stBytes, err := proto.Marshal(p) if err != nil { // TODO: return error instead, when callers are able to handle it. - panic(err) + grpclog.Errorf("transport: failed to marshal rpc status: %v, error: %v", p, err) + } else { + headerFields = append(headerFields, hpack.HeaderField{Name: "grpc-status-details-bin", Value: encodeBinHeader(stBytes)}) } - - headerFields = append(headerFields, hpack.HeaderField{Name: "grpc-status-details-bin", Value: encodeBinHeader(stBytes)}) } // Attach the trailer metadata. - for k, vv := range s.trailer { - // Clients don't tolerate reading restricted headers after some non restricted ones were sent. - if isReservedHeader(k) { - continue - } - for _, v := range vv { - headerFields = append(headerFields, hpack.HeaderField{Name: k, Value: encodeMetadataHeader(k, v)}) - } - } - t.controlBuf.put(&headerFrame{ + headerFields = appendHeaderFieldsFromMD(headerFields, s.trailer) + trailingHeader := &headerFrame{ streamID: s.id, hf: headerFields, endStream: true, - }) + onWrite: func() { + atomic.StoreUint32(&t.resetPingStrikes, 1) + }, + } + s.hdrMu.Unlock() + success, err := t.controlBuf.execute(t.checkForHeaderListSize, trailingHeader) + if !success { + if err != nil { + return err + } + t.closeStream(s, true, http2.ErrCodeInternal, nil, false) + return ErrHeaderListSizeLimitViolation + } + t.closeStream(s, false, 0, trailingHeader, true) if t.stats != nil { t.stats.HandleRPC(s.Context(), &stats.OutTrailer{}) } - t.closeStream(s) return nil } // Write converts the data into HTTP2 data frame and sends it out. Non-nil error // is returns if it fails (e.g., framing error, transport error). func (t *http2Server) Write(s *Stream, hdr []byte, data []byte, opts *Options) error { - select { - case <-s.ctx.Done(): - return ContextErr(s.ctx.Err()) - case <-t.ctx.Done(): - return ErrConnClosing - default: - } - - var writeHeaderFrame bool - s.mu.Lock() - if s.state == streamDone { - s.mu.Unlock() - return streamErrorf(codes.Unknown, "the stream has been done") - } - if !s.headerOk { - writeHeaderFrame = true - } - s.mu.Unlock() - if writeHeaderFrame { - t.WriteHeader(s, nil) + if !s.isHeaderSent() { // Headers haven't been written yet. + if err := t.WriteHeader(s, nil); err != nil { + // TODO(mmukhi, dfawley): Make sure this is the right code to return. + return status.Errorf(codes.Internal, "transport: %v", err) + } + } else { + // Writing headers checks for this condition. + if s.getState() == streamDone { + // TODO(mmukhi, dfawley): Should the server write also return io.EOF? + s.cancel() + select { + case <-t.ctx.Done(): + return ErrConnClosing + default: + } + return ContextErr(s.ctx.Err()) + } } - // Add data to header frame so that we can equally distribute data across frames. + // Add some data to header frame so that we can equally distribute bytes across frames. emptyLen := http2MaxFrameLen - len(hdr) if emptyLen > len(data) { emptyLen = len(data) } hdr = append(hdr, data[:emptyLen]...) data = data[emptyLen:] - var ( - streamQuota int - streamQuotaVer uint32 - err error - ) - for _, r := range [][]byte{hdr, data} { - for len(r) > 0 { - size := http2MaxFrameLen - if size > len(r) { - size = len(r) - } - if streamQuota == 0 { // Used up all the locally cached stream quota. - // Get all the stream quota there is. - streamQuota, streamQuotaVer, err = s.sendQuotaPool.get(math.MaxInt32, s.waiters) - if err != nil { - return err - } - } - if size > streamQuota { - size = streamQuota - } - // Get size worth quota from transport. - tq, _, err := t.sendQuotaPool.get(size, s.waiters) - if err != nil { - return err - } - if tq < size { - size = tq - } - ltq, _, err := t.localSendQuota.get(size, s.waiters) - if err != nil { - return err - } - // even if ltq is smaller than size we don't adjust size since, - // ltq is only a soft limit. - streamQuota -= size - p := r[:size] - // Reset ping strikes when sending data since this might cause - // the peer to send ping. + df := &dataFrame{ + streamID: s.id, + h: hdr, + d: data, + onEachWrite: func() { atomic.StoreUint32(&t.resetPingStrikes, 1) - success := func() { - ltq := ltq - t.controlBuf.put(&dataFrame{streamID: s.id, endStream: false, d: p, f: func() { - t.localSendQuota.add(ltq) - }}) - r = r[size:] - } - failure := func() { // The stream quota version must have changed. - // Our streamQuota cache is invalidated now, so give it back. - s.sendQuotaPool.lockedAdd(streamQuota + size) - } - if !s.sendQuotaPool.compareAndExecute(streamQuotaVer, success, failure) { - // Couldn't send this chunk out. - t.sendQuotaPool.add(size) - t.localSendQuota.add(ltq) - streamQuota = 0 - } - } + }, } - if streamQuota > 0 { - // ADd the left over quota back to stream. - s.sendQuotaPool.add(streamQuota) + if err := s.wq.get(int32(len(hdr) + len(data))); err != nil { + select { + case <-t.ctx.Done(): + return ErrConnClosing + default: + } + return ContextErr(s.ctx.Err()) } - return nil + return t.controlBuf.put(df) } // keepalive running in a separate goroutine does the following: @@ -968,7 +933,7 @@ func (t *http2Server) keepalive() { // The connection has been idle for a duration of keepalive.MaxConnectionIdle or more. // Gracefully close the connection. t.drain(http2.ErrCodeNo, []byte{}) - // Reseting the timer so that the clean-up doesn't deadlock. + // Resetting the timer so that the clean-up doesn't deadlock. maxIdle.Reset(infinity) return } @@ -980,7 +945,7 @@ func (t *http2Server) keepalive() { case <-maxAge.C: // Close the connection after grace period. t.Close() - // Reseting the timer so that the clean-up doesn't deadlock. + // Resetting the timer so that the clean-up doesn't deadlock. maxAge.Reset(infinity) case <-t.ctx.Done(): } @@ -993,11 +958,14 @@ func (t *http2Server) keepalive() { } if pingSent { t.Close() - // Reseting the timer so that the clean-up doesn't deadlock. + // Resetting the timer so that the clean-up doesn't deadlock. keepalive.Reset(infinity) return } pingSent = true + if channelz.IsOn() { + atomic.AddInt64(&t.czData.kpCount, 1) + } t.controlBuf.put(p) keepalive.Reset(t.kp.Timeout) case <-t.ctx.Done(): @@ -1006,133 +974,6 @@ func (t *http2Server) keepalive() { } } -var goAwayPing = &ping{data: [8]byte{1, 6, 1, 8, 0, 3, 3, 9}} - -// TODO(mmukhi): A lot of this code(and code in other places in the tranpsort layer) -// is duplicated between the client and the server. -// The transport layer needs to be refactored to take care of this. -func (t *http2Server) itemHandler(i item) error { - switch i := i.(type) { - case *dataFrame: - if err := t.framer.fr.WriteData(i.streamID, i.endStream, i.d); err != nil { - return err - } - i.f() - return nil - case *headerFrame: - t.hBuf.Reset() - for _, f := range i.hf { - t.hEnc.WriteField(f) - } - first := true - endHeaders := false - for !endHeaders { - size := t.hBuf.Len() - if size > http2MaxFrameLen { - size = http2MaxFrameLen - } else { - endHeaders = true - } - var err error - if first { - first = false - err = t.framer.fr.WriteHeaders(http2.HeadersFrameParam{ - StreamID: i.streamID, - BlockFragment: t.hBuf.Next(size), - EndStream: i.endStream, - EndHeaders: endHeaders, - }) - } else { - err = t.framer.fr.WriteContinuation( - i.streamID, - endHeaders, - t.hBuf.Next(size), - ) - } - if err != nil { - return err - } - } - atomic.StoreUint32(&t.resetPingStrikes, 1) - return nil - case *windowUpdate: - return t.framer.fr.WriteWindowUpdate(i.streamID, i.increment) - case *settings: - return t.framer.fr.WriteSettings(i.ss...) - case *settingsAck: - return t.framer.fr.WriteSettingsAck() - case *resetStream: - return t.framer.fr.WriteRSTStream(i.streamID, i.code) - case *goAway: - t.mu.Lock() - if t.state == closing { - t.mu.Unlock() - // The transport is closing. - return fmt.Errorf("transport: Connection closing") - } - sid := t.maxStreamID - if !i.headsUp { - // Stop accepting more streams now. - t.state = draining - if len(t.activeStreams) == 0 { - i.closeConn = true - } - t.mu.Unlock() - if err := t.framer.fr.WriteGoAway(sid, i.code, i.debugData); err != nil { - return err - } - if i.closeConn { - // Abruptly close the connection following the GoAway (via - // loopywriter). But flush out what's inside the buffer first. - t.controlBuf.put(&flushIO{closeTr: true}) - } - return nil - } - t.mu.Unlock() - // For a graceful close, send out a GoAway with stream ID of MaxUInt32, - // Follow that with a ping and wait for the ack to come back or a timer - // to expire. During this time accept new streams since they might have - // originated before the GoAway reaches the client. - // After getting the ack or timer expiration send out another GoAway this - // time with an ID of the max stream server intends to process. - if err := t.framer.fr.WriteGoAway(math.MaxUint32, http2.ErrCodeNo, []byte{}); err != nil { - return err - } - if err := t.framer.fr.WritePing(false, goAwayPing.data); err != nil { - return err - } - go func() { - timer := time.NewTimer(time.Minute) - defer timer.Stop() - select { - case <-t.drainChan: - case <-timer.C: - case <-t.ctx.Done(): - return - } - t.controlBuf.put(&goAway{code: i.code, debugData: i.debugData}) - }() - return nil - case *flushIO: - if err := t.framer.writer.Flush(); err != nil { - return err - } - if i.closeTr { - return ErrConnClosing - } - return nil - case *ping: - if !i.ack { - t.bdpEst.timesnap(i.data) - } - return t.framer.fr.WritePing(i.ack, i.data) - default: - err := status.Errorf(codes.Internal, "transport: http2Server.controller got unexpected item type %t", i) - errorf("%v", err) - return err - } -} - // Close starts shutting down the http2Server transport. // TODO(zhaoq): Now the destruction is not blocked on any pending streams. This // could cause some resource issue. Revisit this later. @@ -1146,8 +987,12 @@ func (t *http2Server) Close() error { streams := t.activeStreams t.activeStreams = nil t.mu.Unlock() + t.controlBuf.finish() t.cancel() err := t.conn.Close() + if channelz.IsOn() { + channelz.RemoveEntry(t.channelzID) + } // Cancel all active streams. for _, s := range streams { s.cancel() @@ -1161,27 +1006,43 @@ func (t *http2Server) Close() error { // closeStream clears the footprint of a stream when the stream is not needed // any more. -func (t *http2Server) closeStream(s *Stream) { - t.mu.Lock() - delete(t.activeStreams, s.id) - if len(t.activeStreams) == 0 { - t.idle = time.Now() - } - if t.state == draining && len(t.activeStreams) == 0 { - defer t.controlBuf.put(&flushIO{closeTr: true}) +func (t *http2Server) closeStream(s *Stream, rst bool, rstCode http2.ErrCode, hdr *headerFrame, eosReceived bool) { + if s.swapState(streamDone) == streamDone { + // If the stream was already done, return. + return } - t.mu.Unlock() // In case stream sending and receiving are invoked in separate // goroutines (e.g., bi-directional streaming), cancel needs to be // called to interrupt the potential blocking on other goroutines. s.cancel() - s.mu.Lock() - if s.state == streamDone { - s.mu.Unlock() - return + cleanup := &cleanupStream{ + streamID: s.id, + rst: rst, + rstCode: rstCode, + onWrite: func() { + t.mu.Lock() + if t.activeStreams != nil { + delete(t.activeStreams, s.id) + if len(t.activeStreams) == 0 { + t.idle = time.Now() + } + } + t.mu.Unlock() + if channelz.IsOn() { + if eosReceived { + atomic.AddInt64(&t.czData.streamsSucceeded, 1) + } else { + atomic.AddInt64(&t.czData.streamsFailed, 1) + } + } + }, + } + if hdr != nil { + hdr.cleanup = cleanup + t.controlBuf.put(hdr) + } else { + t.controlBuf.put(cleanup) } - s.state = streamDone - s.mu.Unlock() } func (t *http2Server) RemoteAddr() net.Addr { @@ -1202,7 +1063,111 @@ func (t *http2Server) drain(code http2.ErrCode, debugData []byte) { t.controlBuf.put(&goAway{code: code, debugData: debugData, headsUp: true}) } -var rgen = rand.New(rand.NewSource(time.Now().UnixNano())) +var goAwayPing = &ping{data: [8]byte{1, 6, 1, 8, 0, 3, 3, 9}} + +// Handles outgoing GoAway and returns true if loopy needs to put itself +// in draining mode. +func (t *http2Server) outgoingGoAwayHandler(g *goAway) (bool, error) { + t.mu.Lock() + if t.state == closing { // TODO(mmukhi): This seems unnecessary. + t.mu.Unlock() + // The transport is closing. + return false, ErrConnClosing + } + sid := t.maxStreamID + if !g.headsUp { + // Stop accepting more streams now. + t.state = draining + if len(t.activeStreams) == 0 { + g.closeConn = true + } + t.mu.Unlock() + if err := t.framer.fr.WriteGoAway(sid, g.code, g.debugData); err != nil { + return false, err + } + if g.closeConn { + // Abruptly close the connection following the GoAway (via + // loopywriter). But flush out what's inside the buffer first. + t.framer.writer.Flush() + return false, fmt.Errorf("transport: Connection closing") + } + return true, nil + } + t.mu.Unlock() + // For a graceful close, send out a GoAway with stream ID of MaxUInt32, + // Follow that with a ping and wait for the ack to come back or a timer + // to expire. During this time accept new streams since they might have + // originated before the GoAway reaches the client. + // After getting the ack or timer expiration send out another GoAway this + // time with an ID of the max stream server intends to process. + if err := t.framer.fr.WriteGoAway(math.MaxUint32, http2.ErrCodeNo, []byte{}); err != nil { + return false, err + } + if err := t.framer.fr.WritePing(false, goAwayPing.data); err != nil { + return false, err + } + go func() { + timer := time.NewTimer(time.Minute) + defer timer.Stop() + select { + case <-t.drainChan: + case <-timer.C: + case <-t.ctx.Done(): + return + } + t.controlBuf.put(&goAway{code: g.code, debugData: g.debugData}) + }() + return false, nil +} + +func (t *http2Server) ChannelzMetric() *channelz.SocketInternalMetric { + s := channelz.SocketInternalMetric{ + StreamsStarted: atomic.LoadInt64(&t.czData.streamsStarted), + StreamsSucceeded: atomic.LoadInt64(&t.czData.streamsSucceeded), + StreamsFailed: atomic.LoadInt64(&t.czData.streamsFailed), + MessagesSent: atomic.LoadInt64(&t.czData.msgSent), + MessagesReceived: atomic.LoadInt64(&t.czData.msgRecv), + KeepAlivesSent: atomic.LoadInt64(&t.czData.kpCount), + LastRemoteStreamCreatedTimestamp: time.Unix(0, atomic.LoadInt64(&t.czData.lastStreamCreatedTime)), + LastMessageSentTimestamp: time.Unix(0, atomic.LoadInt64(&t.czData.lastMsgSentTime)), + LastMessageReceivedTimestamp: time.Unix(0, atomic.LoadInt64(&t.czData.lastMsgRecvTime)), + LocalFlowControlWindow: int64(t.fc.getSize()), + SocketOptions: channelz.GetSocketOption(t.conn), + LocalAddr: t.localAddr, + RemoteAddr: t.remoteAddr, + // RemoteName : + } + if au, ok := t.authInfo.(credentials.ChannelzSecurityInfo); ok { + s.Security = au.GetSecurityValue() + } + s.RemoteFlowControlWindow = t.getOutFlowWindow() + return &s +} + +func (t *http2Server) IncrMsgSent() { + atomic.AddInt64(&t.czData.msgSent, 1) + atomic.StoreInt64(&t.czData.lastMsgSentTime, time.Now().UnixNano()) +} + +func (t *http2Server) IncrMsgRecv() { + atomic.AddInt64(&t.czData.msgRecv, 1) + atomic.StoreInt64(&t.czData.lastMsgRecvTime, time.Now().UnixNano()) +} + +func (t *http2Server) getOutFlowWindow() int64 { + resp := make(chan uint32) + timer := time.NewTimer(time.Second) + defer timer.Stop() + t.controlBuf.put(&outFlowControlSizeRequest{resp}) + select { + case sz := <-resp: + return int64(sz) + case <-t.ctxDone: + return -1 + case <-timer.C: + return -2 + } +} func getJitter(v time.Duration) time.Duration { if v == infinity { @@ -1210,6 +1175,6 @@ func getJitter(v time.Duration) time.Duration { } // Generate a jitter between +/- 10% of the value. r := int64(v / 10) - j := rgen.Int63n(2*r) - r + j := grpcrand.Int63n(2*r) - r return time.Duration(j) } diff --git a/vendor/google.golang.org/grpc/transport/http_util.go b/vendor/google.golang.org/grpc/internal/transport/http_util.go similarity index 62% rename from vendor/google.golang.org/grpc/transport/http_util.go rename to vendor/google.golang.org/grpc/internal/transport/http_util.go index 39f878cfd5bf..21da6e80b3b3 100644 --- a/vendor/google.golang.org/grpc/transport/http_util.go +++ b/vendor/google.golang.org/grpc/internal/transport/http_util.go @@ -29,6 +29,7 @@ import ( "strconv" "strings" "time" + "unicode/utf8" "github.com/golang/protobuf/proto" "golang.org/x/net/http2" @@ -43,9 +44,12 @@ const ( http2MaxFrameLen = 16384 // 16KB frame // http://http2.github.io/http2-spec/#SettingValues http2InitHeaderTableSize = 4096 - // http2IOBufSize specifies the buffer size for sending frames. - defaultWriteBufSize = 32 * 1024 - defaultReadBufSize = 32 * 1024 + // baseContentType is the base content-type for gRPC. This is a valid + // content-type on it's own, but can also include a content-subtype such as + // "proto" as a suffix after "+" or ";". See + // https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md#requests + // for more details. + baseContentType = "application/grpc" ) var ( @@ -64,7 +68,7 @@ var ( http2.ErrCodeConnect: codes.Internal, http2.ErrCodeEnhanceYourCalm: codes.ResourceExhausted, http2.ErrCodeInadequateSecurity: codes.PermissionDenied, - http2.ErrCodeHTTP11Required: codes.FailedPrecondition, + http2.ErrCodeHTTP11Required: codes.Internal, } statusCodeConvTab = map[codes.Code]http2.ErrCode{ codes.Internal: http2.ErrCodeInternal, @@ -111,9 +115,12 @@ type decodeState struct { timeout time.Duration method string // key-value metadata map from the peer. - mdata map[string][]string - statsTags []byte - statsTrace []byte + mdata map[string][]string + statsTags []byte + statsTrace []byte + contentSubtype string + // whether decoding on server side or not + serverSide bool } // isReservedHeader checks whether hdr belongs to HTTP2 headers @@ -125,12 +132,16 @@ func isReservedHeader(hdr string) bool { } switch hdr { case "content-type", + "user-agent", "grpc-message-type", "grpc-encoding", "grpc-message", "grpc-status", "grpc-timeout", "grpc-status-details-bin", + // Intentionally exclude grpc-previous-rpc-attempts and + // grpc-retry-pushback-ms, which are "reserved", but their API + // intentionally works via metadata. "te": return true default: @@ -138,28 +149,55 @@ func isReservedHeader(hdr string) bool { } } -// isWhitelistedPseudoHeader checks whether hdr belongs to HTTP2 pseudoheaders -// that should be propagated into metadata visible to users. -func isWhitelistedPseudoHeader(hdr string) bool { +// isWhitelistedHeader checks whether hdr should be propagated into metadata +// visible to users, even though it is classified as "reserved", above. +func isWhitelistedHeader(hdr string) bool { switch hdr { - case ":authority": + case ":authority", "user-agent": return true default: return false } } -func validContentType(t string) bool { - e := "application/grpc" - if !strings.HasPrefix(t, e) { - return false +// contentSubtype returns the content-subtype for the given content-type. The +// given content-type must be a valid content-type that starts with +// "application/grpc". A content-subtype will follow "application/grpc" after a +// "+" or ";". See +// https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md#requests for +// more details. +// +// If contentType is not a valid content-type for gRPC, the boolean +// will be false, otherwise true. If content-type == "application/grpc", +// "application/grpc+", or "application/grpc;", the boolean will be true, +// but no content-subtype will be returned. +// +// contentType is assumed to be lowercase already. +func contentSubtype(contentType string) (string, bool) { + if contentType == baseContentType { + return "", true + } + if !strings.HasPrefix(contentType, baseContentType) { + return "", false + } + // guaranteed since != baseContentType and has baseContentType prefix + switch contentType[len(baseContentType)] { + case '+', ';': + // this will return true for "application/grpc+" or "application/grpc;" + // which the previous validContentType function tested to be valid, so we + // just say that no content-subtype is specified in this case + return contentType[len(baseContentType)+1:], true + default: + return "", false } - // Support variations on the content-type - // (e.g. "application/grpc+blah", "application/grpc;blah"). - if len(t) > len(e) && t[len(e)] != '+' && t[len(e)] != ';' { - return false +} + +// contentSubtype is assumed to be lowercase +func contentType(contentSubtype string) string { + if contentSubtype == "" { + return baseContentType } - return true + return baseContentType + "+" + contentSubtype } func (d *decodeState) status() *status.Status { @@ -199,13 +237,22 @@ func decodeMetadataHeader(k, v string) (string, error) { return v, nil } -func (d *decodeState) decodeResponseHeader(frame *http2.MetaHeadersFrame) error { +func (d *decodeState) decodeHeader(frame *http2.MetaHeadersFrame) error { + // frame.Truncated is set to true when framer detects that the current header + // list size hits MaxHeaderListSize limit. + if frame.Truncated { + return status.Error(codes.Internal, "peer header list size exceeded limit") + } for _, hf := range frame.Fields { if err := d.processHeaderField(hf); err != nil { return err } } + if d.serverSide { + return nil + } + // If grpc status exists, no need to check further. if d.rawStatusCode != nil || d.statusGen != nil { return nil @@ -214,7 +261,7 @@ func (d *decodeState) decodeResponseHeader(frame *http2.MetaHeadersFrame) error // If grpc status doesn't exist and http status doesn't exist, // then it's a malformed header. if d.httpStatus == nil { - return streamErrorf(codes.Internal, "malformed header: doesn't contain status(gRPC or HTTP)") + return status.Error(codes.Internal, "malformed header: doesn't contain status(gRPC or HTTP)") } if *(d.httpStatus) != http.StatusOK { @@ -222,19 +269,18 @@ func (d *decodeState) decodeResponseHeader(frame *http2.MetaHeadersFrame) error if !ok { code = codes.Unknown } - return streamErrorf(code, http.StatusText(*(d.httpStatus))) + return status.Error(code, http.StatusText(*(d.httpStatus))) } // gRPC status doesn't exist and http status is OK. // Set rawStatusCode to be unknown and return nil error. // So that, if the stream has ended this Unknown status - // will be propogated to the user. + // will be propagated to the user. // Otherwise, it will be ignored. In which case, status from - // a later trailer, that has StreamEnded flag set, is propogated. + // a later trailer, that has StreamEnded flag set, is propagated. code := int(codes.Unknown) d.rawStatusCode = &code return nil - } func (d *decodeState) addMetadata(k, v string) { @@ -247,15 +293,22 @@ func (d *decodeState) addMetadata(k, v string) { func (d *decodeState) processHeaderField(f hpack.HeaderField) error { switch f.Name { case "content-type": - if !validContentType(f.Value) { - return streamErrorf(codes.FailedPrecondition, "transport: received the unexpected content-type %q", f.Value) + contentSubtype, validContentType := contentSubtype(f.Value) + if !validContentType { + return status.Errorf(codes.Internal, "transport: received the unexpected content-type %q", f.Value) } + d.contentSubtype = contentSubtype + // TODO: do we want to propagate the whole content-type in the metadata, + // or come up with a way to just propagate the content-subtype if it was set? + // ie {"content-type": "application/grpc+proto"} or {"content-subtype": "proto"} + // in the metadata? + d.addMetadata(f.Name, f.Value) case "grpc-encoding": d.encoding = f.Value case "grpc-status": code, err := strconv.Atoi(f.Value) if err != nil { - return streamErrorf(codes.Internal, "transport: malformed grpc-status: %v", err) + return status.Errorf(codes.Internal, "transport: malformed grpc-status: %v", err) } d.rawStatusCode = &code case "grpc-message": @@ -263,43 +316,43 @@ func (d *decodeState) processHeaderField(f hpack.HeaderField) error { case "grpc-status-details-bin": v, err := decodeBinHeader(f.Value) if err != nil { - return streamErrorf(codes.Internal, "transport: malformed grpc-status-details-bin: %v", err) + return status.Errorf(codes.Internal, "transport: malformed grpc-status-details-bin: %v", err) } s := &spb.Status{} if err := proto.Unmarshal(v, s); err != nil { - return streamErrorf(codes.Internal, "transport: malformed grpc-status-details-bin: %v", err) + return status.Errorf(codes.Internal, "transport: malformed grpc-status-details-bin: %v", err) } d.statusGen = status.FromProto(s) case "grpc-timeout": d.timeoutSet = true var err error if d.timeout, err = decodeTimeout(f.Value); err != nil { - return streamErrorf(codes.Internal, "transport: malformed time-out: %v", err) + return status.Errorf(codes.Internal, "transport: malformed time-out: %v", err) } case ":path": d.method = f.Value case ":status": code, err := strconv.Atoi(f.Value) if err != nil { - return streamErrorf(codes.Internal, "transport: malformed http-status: %v", err) + return status.Errorf(codes.Internal, "transport: malformed http-status: %v", err) } d.httpStatus = &code case "grpc-tags-bin": v, err := decodeBinHeader(f.Value) if err != nil { - return streamErrorf(codes.Internal, "transport: malformed grpc-tags-bin: %v", err) + return status.Errorf(codes.Internal, "transport: malformed grpc-tags-bin: %v", err) } d.statsTags = v d.addMetadata(f.Name, string(v)) case "grpc-trace-bin": v, err := decodeBinHeader(f.Value) if err != nil { - return streamErrorf(codes.Internal, "transport: malformed grpc-trace-bin: %v", err) + return status.Errorf(codes.Internal, "transport: malformed grpc-trace-bin: %v", err) } d.statsTrace = v d.addMetadata(f.Name, string(v)) default: - if isReservedHeader(f.Name) && !isWhitelistedPseudoHeader(f.Name) { + if isReservedHeader(f.Name) && !isWhitelistedHeader(f.Name) { break } v, err := decodeMetadataHeader(f.Name, f.Value) @@ -307,7 +360,7 @@ func (d *decodeState) processHeaderField(f hpack.HeaderField) error { errorf("Failed to decode metadata header (%q, %q): %v", f.Name, f.Value, err) return nil } - d.addMetadata(f.Name, string(v)) + d.addMetadata(f.Name, v) } return nil } @@ -396,16 +449,17 @@ func decodeTimeout(s string) (time.Duration, error) { const ( spaceByte = ' ' - tildaByte = '~' + tildeByte = '~' percentByte = '%' ) // encodeGrpcMessage is used to encode status code in header field -// "grpc-message". -// It checks to see if each individual byte in msg is an -// allowable byte, and then either percent encoding or passing it through. -// When percent encoding, the byte is converted into hexadecimal notation -// with a '%' prepended. +// "grpc-message". It does percent encoding and also replaces invalid utf-8 +// characters with Unicode replacement character. +// +// It checks to see if each individual byte in msg is an allowable byte, and +// then either percent encoding or passing it through. When percent encoding, +// the byte is converted into hexadecimal notation with a '%' prepended. func encodeGrpcMessage(msg string) string { if msg == "" { return "" @@ -413,7 +467,7 @@ func encodeGrpcMessage(msg string) string { lenMsg := len(msg) for i := 0; i < lenMsg; i++ { c := msg[i] - if !(c >= spaceByte && c < tildaByte && c != percentByte) { + if !(c >= spaceByte && c <= tildeByte && c != percentByte) { return encodeGrpcMessageUnchecked(msg) } } @@ -422,14 +476,26 @@ func encodeGrpcMessage(msg string) string { func encodeGrpcMessageUnchecked(msg string) string { var buf bytes.Buffer - lenMsg := len(msg) - for i := 0; i < lenMsg; i++ { - c := msg[i] - if c >= spaceByte && c < tildaByte && c != percentByte { - buf.WriteByte(c) - } else { - buf.WriteString(fmt.Sprintf("%%%02X", c)) + for len(msg) > 0 { + r, size := utf8.DecodeRuneInString(msg) + for _, b := range []byte(string(r)) { + if size > 1 { + // If size > 1, r is not ascii. Always do percent encoding. + buf.WriteString(fmt.Sprintf("%%%02X", b)) + continue + } + + // The for loop is necessary even if size == 1. r could be + // utf8.RuneError. + // + // fmt.Sprintf("%%%02X", utf8.RuneError) gives "%FFFD". + if b >= spaceByte && b <= tildeByte && b != percentByte { + buf.WriteByte(b) + } else { + buf.WriteString(fmt.Sprintf("%%%02X", b)) + } } + msg = msg[size:] } return buf.String() } @@ -468,22 +534,80 @@ func decodeGrpcMessageUnchecked(msg string) string { return buf.String() } +type bufWriter struct { + buf []byte + offset int + batchSize int + conn net.Conn + err error + + onFlush func() +} + +func newBufWriter(conn net.Conn, batchSize int) *bufWriter { + return &bufWriter{ + buf: make([]byte, batchSize*2), + batchSize: batchSize, + conn: conn, + } +} + +func (w *bufWriter) Write(b []byte) (n int, err error) { + if w.err != nil { + return 0, w.err + } + if w.batchSize == 0 { // Buffer has been disabled. + return w.conn.Write(b) + } + for len(b) > 0 { + nn := copy(w.buf[w.offset:], b) + b = b[nn:] + w.offset += nn + n += nn + if w.offset >= w.batchSize { + err = w.Flush() + } + } + return n, err +} + +func (w *bufWriter) Flush() error { + if w.err != nil { + return w.err + } + if w.offset == 0 { + return nil + } + if w.onFlush != nil { + w.onFlush() + } + _, w.err = w.conn.Write(w.buf[:w.offset]) + w.offset = 0 + return w.err +} + type framer struct { - numWriters int32 - reader io.Reader - writer *bufio.Writer - fr *http2.Framer + writer *bufWriter + fr *http2.Framer } -func newFramer(conn net.Conn, writeBufferSize, readBufferSize int) *framer { +func newFramer(conn net.Conn, writeBufferSize, readBufferSize int, maxHeaderListSize uint32) *framer { + if writeBufferSize < 0 { + writeBufferSize = 0 + } + var r io.Reader = conn + if readBufferSize > 0 { + r = bufio.NewReaderSize(r, readBufferSize) + } + w := newBufWriter(conn, writeBufferSize) f := &framer{ - reader: bufio.NewReaderSize(conn, readBufferSize), - writer: bufio.NewWriterSize(conn, writeBufferSize), + writer: w, + fr: http2.NewFramer(w, r), } - f.fr = http2.NewFramer(f.writer, f.reader) // Opt-in to Frame reuse API on framer to reduce garbage. // Frames aren't safe to read from after a subsequent call to ReadFrame. f.fr.SetReuseFrames() + f.fr.MaxHeaderListSize = maxHeaderListSize f.fr.ReadMetaHeaders = hpack.NewDecoder(http2InitHeaderTableSize, nil) return f } diff --git a/vendor/google.golang.org/grpc/transport/log.go b/vendor/google.golang.org/grpc/internal/transport/log.go similarity index 90% rename from vendor/google.golang.org/grpc/transport/log.go rename to vendor/google.golang.org/grpc/internal/transport/log.go index ac8e358c5c8c..879df80c4de7 100644 --- a/vendor/google.golang.org/grpc/transport/log.go +++ b/vendor/google.golang.org/grpc/internal/transport/log.go @@ -42,9 +42,3 @@ func errorf(format string, args ...interface{}) { grpclog.Errorf(format, args...) } } - -func fatalf(format string, args ...interface{}) { - if grpclog.V(logLevel) { - grpclog.Fatalf(format, args...) - } -} diff --git a/vendor/google.golang.org/grpc/transport/transport.go b/vendor/google.golang.org/grpc/internal/transport/transport.go similarity index 68% rename from vendor/google.golang.org/grpc/transport/transport.go rename to vendor/google.golang.org/grpc/internal/transport/transport.go index 2e7bcaeaa27c..2608c5e5c9d2 100644 --- a/vendor/google.golang.org/grpc/transport/transport.go +++ b/vendor/google.golang.org/grpc/internal/transport/transport.go @@ -19,16 +19,17 @@ // Package transport defines and implements message oriented communication // channel to complete various transactions (e.g., an RPC). It is meant for // grpc-internal usage and is not intended to be imported directly by users. -package transport // import "google.golang.org/grpc/transport" +package transport import ( + "errors" "fmt" "io" "net" "sync" + "sync/atomic" "golang.org/x/net/context" - "golang.org/x/net/http2" "google.golang.org/grpc/codes" "google.golang.org/grpc/credentials" "google.golang.org/grpc/keepalive" @@ -57,6 +58,7 @@ type recvBuffer struct { c chan recvMsg mu sync.Mutex backlog []recvMsg + err error } func newRecvBuffer() *recvBuffer { @@ -68,6 +70,13 @@ func newRecvBuffer() *recvBuffer { func (b *recvBuffer) put(r recvMsg) { b.mu.Lock() + if b.err != nil { + b.mu.Unlock() + // An error had occurred earlier, don't accept more + // data or errors. + return + } + b.err = r.err if len(b.backlog) == 0 { select { case b.c <- r: @@ -101,14 +110,15 @@ func (b *recvBuffer) get() <-chan recvMsg { return b.c } +// // recvBufferReader implements io.Reader interface to read the data from // recvBuffer. type recvBufferReader struct { - ctx context.Context - goAway chan struct{} - recv *recvBuffer - last []byte // Stores the remaining data in the previous calls. - err error + ctx context.Context + ctxDone <-chan struct{} // cache of ctx.Done() (for performance). + recv *recvBuffer + last []byte // Stores the remaining data in the previous calls. + err error } // Read reads the next len(p) bytes from last. If last is drained, it tries to @@ -130,10 +140,8 @@ func (r *recvBufferReader) read(p []byte) (n int, err error) { return copied, nil } select { - case <-r.ctx.Done(): + case <-r.ctxDone: return 0, ContextErr(r.ctx.Err()) - case <-r.goAway: - return 0, errStreamDrain case m := <-r.recv.get(): r.recv.load() if m.err != nil { @@ -145,61 +153,7 @@ func (r *recvBufferReader) read(p []byte) (n int, err error) { } } -// All items in an out of a controlBuffer should be the same type. -type item interface { - item() -} - -// controlBuffer is an unbounded channel of item. -type controlBuffer struct { - c chan item - mu sync.Mutex - backlog []item -} - -func newControlBuffer() *controlBuffer { - b := &controlBuffer{ - c: make(chan item, 1), - } - return b -} - -func (b *controlBuffer) put(r item) { - b.mu.Lock() - if len(b.backlog) == 0 { - select { - case b.c <- r: - b.mu.Unlock() - return - default: - } - } - b.backlog = append(b.backlog, r) - b.mu.Unlock() -} - -func (b *controlBuffer) load() { - b.mu.Lock() - if len(b.backlog) > 0 { - select { - case b.c <- b.backlog[0]: - b.backlog[0] = nil - b.backlog = b.backlog[1:] - default: - } - } - b.mu.Unlock() -} - -// get returns the channel that receives an item in the buffer. -// -// Upon receipt of an item, the caller should call load to send another -// item onto the channel if there is any. -func (b *controlBuffer) get() <-chan item { - return b.c -} - -type streamState uint8 +type streamState uint32 const ( streamActive streamState = iota @@ -214,38 +168,68 @@ type Stream struct { st ServerTransport // nil for client side Stream ctx context.Context // the associated context of the stream cancel context.CancelFunc // always nil for client side Stream - done chan struct{} // closed when the final status arrives - goAway chan struct{} // closed when a GOAWAY control message is received + done chan struct{} // closed at the end of stream to unblock writers. On the client side. + ctxDone <-chan struct{} // same as done chan but for server side. Cache of ctx.Done() (for performance) method string // the associated RPC method of the stream recvCompress string sendCompress string buf *recvBuffer trReader io.Reader fc *inFlow - recvQuota uint32 - waiters waiters + wq *writeQuota // Callback to state application's intentions to read data. This // is used to adjust flow control, if needed. requestRead func(int) - sendQuotaPool *quotaPool - headerChan chan struct{} // closed to indicate the end of header metadata. - headerDone bool // set when headerChan is closed. Used to avoid closing headerChan multiple times. - header metadata.MD // the received header metadata. - trailer metadata.MD // the key-value map of trailer metadata. + headerChan chan struct{} // closed to indicate the end of header metadata. + headerDone uint32 // set when headerChan is closed. Used to avoid closing headerChan multiple times. + + // hdrMu protects header and trailer metadata on the server-side. + hdrMu sync.Mutex + header metadata.MD // the received header metadata. + trailer metadata.MD // the key-value map of trailer metadata. + + noHeaders bool // set if the client never received headers (set only after the stream is done). + + // On the server-side, headerSent is atomically set to 1 when the headers are sent out. + headerSent uint32 + + state streamState - mu sync.RWMutex // guard the following - headerOk bool // becomes true from the first header is about to send - state streamState + // On client-side it is the status error received from the server. + // On server-side it is unused. + status *status.Status - status *status.Status // the status error received from the server + bytesReceived uint32 // indicates whether any bytes have been received on this stream + unprocessed uint32 // set if the server sends a refused stream or GOAWAY including this stream - rstStream bool // indicates whether a RST_STREAM frame needs to be sent - rstError http2.ErrCode // the error that needs to be sent along with the RST_STREAM frame + // contentSubtype is the content-subtype for requests. + // this must be lowercase or the behavior is undefined. + contentSubtype string +} + +// isHeaderSent is only valid on the server-side. +func (s *Stream) isHeaderSent() bool { + return atomic.LoadUint32(&s.headerSent) == 1 +} - bytesReceived bool // indicates whether any bytes have been received on this stream - unprocessed bool // set if the server sends a refused stream or GOAWAY including this stream +// updateHeaderSent updates headerSent and returns true +// if it was alreay set. It is valid only on server-side. +func (s *Stream) updateHeaderSent() bool { + return atomic.SwapUint32(&s.headerSent, 1) == 1 +} + +func (s *Stream) swapState(st streamState) streamState { + return streamState(atomic.SwapUint32((*uint32)(&s.state), uint32(st))) +} + +func (s *Stream) compareAndSwapState(oldState, newState streamState) bool { + return atomic.CompareAndSwapUint32((*uint32)(&s.state), uint32(oldState), uint32(newState)) +} + +func (s *Stream) getState() streamState { + return streamState(atomic.LoadUint32((*uint32)(&s.state))) } func (s *Stream) waitOnHeader() error { @@ -254,12 +238,9 @@ func (s *Stream) waitOnHeader() error { // only after having received headers. return nil } - wc := s.waiters select { - case <-wc.ctx.Done(): - return ContextErr(wc.ctx.Err()) - case <-wc.goAway: - return errStreamDrain + case <-s.ctx.Done(): + return ContextErr(s.ctx.Err()) case <-s.headerChan: return nil } @@ -279,18 +260,12 @@ func (s *Stream) SetSendCompress(str string) { s.sendCompress = str } -// Done returns a chanel which is closed when it receives the final status +// Done returns a channel which is closed when it receives the final status // from the server. func (s *Stream) Done() <-chan struct{} { return s.done } -// GoAway returns a channel which is closed when the server sent GoAways signal -// before this stream was initiated. -func (s *Stream) GoAway() <-chan struct{} { - return s.goAway -} - // Header acquires the key-value pairs of header metadata once it // is available. It blocks until i) the metadata is ready or ii) there is no // header metadata or iii) the stream is canceled/expired. @@ -299,26 +274,45 @@ func (s *Stream) Header() (metadata.MD, error) { // Even if the stream is closed, header is returned if available. select { case <-s.headerChan: + if s.header == nil { + return nil, nil + } return s.header.Copy(), nil default: } return nil, err } +// TrailersOnly blocks until a header or trailers-only frame is received and +// then returns true if the stream was trailers-only. If the stream ends +// before headers are received, returns true, nil. If a context error happens +// first, returns it as a status error. Client-side only. +func (s *Stream) TrailersOnly() (bool, error) { + err := s.waitOnHeader() + if err != nil { + return false, err + } + // if !headerDone, some other connection error occurred. + return s.noHeaders && atomic.LoadUint32(&s.headerDone) == 1, nil +} + // Trailer returns the cached trailer metedata. Note that if it is not called // after the entire stream is done, it could return an empty MD. Client // side only. +// It can be safely read only after stream has ended that is either read +// or write have returned io.EOF. func (s *Stream) Trailer() metadata.MD { - s.mu.RLock() c := s.trailer.Copy() - s.mu.RUnlock() return c } -// ServerTransport returns the underlying ServerTransport for the stream. -// The client side stream always returns nil. -func (s *Stream) ServerTransport() ServerTransport { - return s.st +// ContentSubtype returns the content-subtype for a request. For example, a +// content-subtype of "proto" will result in a content-type of +// "application/grpc+proto". This will always be lowercase. See +// https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md#requests for +// more details. +func (s *Stream) ContentSubtype() string { + return s.contentSubtype } // Context returns the context of the stream. @@ -332,36 +326,48 @@ func (s *Stream) Method() string { } // Status returns the status received from the server. +// Status can be read safely only after the stream has ended, +// that is, after Done() is closed. func (s *Stream) Status() *status.Status { return s.status } // SetHeader sets the header metadata. This can be called multiple times. // Server side only. +// This should not be called in parallel to other data writes. func (s *Stream) SetHeader(md metadata.MD) error { - s.mu.Lock() - if s.headerOk || s.state == streamDone { - s.mu.Unlock() - return ErrIllegalHeaderWrite - } if md.Len() == 0 { - s.mu.Unlock() return nil } + if s.isHeaderSent() || s.getState() == streamDone { + return ErrIllegalHeaderWrite + } + s.hdrMu.Lock() s.header = metadata.Join(s.header, md) - s.mu.Unlock() + s.hdrMu.Unlock() return nil } +// SendHeader sends the given header metadata. The given metadata is +// combined with any metadata set by previous calls to SetHeader and +// then written to the transport stream. +func (s *Stream) SendHeader(md metadata.MD) error { + return s.st.WriteHeader(s, md) +} + // SetTrailer sets the trailer metadata which will be sent with the RPC status // by the server. This can be called multiple times. Server side only. +// This should not be called parallel to other data writes. func (s *Stream) SetTrailer(md metadata.MD) error { if md.Len() == 0 { return nil } - s.mu.Lock() + if s.getState() == streamDone { + return ErrIllegalHeaderWrite + } + s.hdrMu.Lock() s.trailer = metadata.Join(s.trailer, md) - s.mu.Unlock() + s.hdrMu.Unlock() return nil } @@ -401,29 +407,15 @@ func (t *transportReader) Read(p []byte) (n int, err error) { return } -// finish sets the stream's state and status, and closes the done channel. -// s.mu must be held by the caller. st must always be non-nil. -func (s *Stream) finish(st *status.Status) { - s.status = st - s.state = streamDone - close(s.done) -} - // BytesReceived indicates whether any bytes have been received on this stream. func (s *Stream) BytesReceived() bool { - s.mu.Lock() - br := s.bytesReceived - s.mu.Unlock() - return br + return atomic.LoadUint32(&s.bytesReceived) == 1 } // Unprocessed indicates whether the server did not process this stream -- // i.e. it sent a refused stream or GOAWAY including this stream ID. func (s *Stream) Unprocessed() bool { - s.mu.Lock() - br := s.unprocessed - s.mu.Unlock() - return br + return atomic.LoadUint32(&s.unprocessed) == 1 } // GoString is implemented by Stream so context.String() won't @@ -432,21 +424,6 @@ func (s *Stream) GoString() string { return fmt.Sprintf("", s, s.method) } -// The key to save transport.Stream in the context. -type streamKey struct{} - -// newContextWithStream creates a new context from ctx and attaches stream -// to it. -func newContextWithStream(ctx context.Context, stream *Stream) context.Context { - return context.WithValue(ctx, streamKey{}, stream) -} - -// StreamFromContext returns the stream saved in ctx. -func StreamFromContext(ctx context.Context) (s *Stream, ok bool) { - s, ok = ctx.Value(streamKey{}).(*Stream) - return -} - // state of transport type transportState int @@ -468,6 +445,8 @@ type ServerConfig struct { InitialConnWindowSize int32 WriteBufferSize int ReadBufferSize int + ChannelzParentID int64 + MaxHeaderListSize *uint32 } // NewServerTransport creates a ServerTransport with conn or non-nil error @@ -480,9 +459,6 @@ func NewServerTransport(protocol string, conn net.Conn, config *ServerConfig) (S type ConnectOptions struct { // UserAgent is the application user agent. UserAgent string - // Authority is the :authority pseudo-header to use. This field has no effect if - // TransportCredentials is set. - Authority string // Dialer specifies how to dial a network address. Dialer func(context.Context, string) (net.Conn, error) // FailOnNonTempDialError specifies if gRPC fails on non-temporary dial errors. @@ -503,6 +479,10 @@ type ConnectOptions struct { WriteBufferSize int // ReadBufferSize sets the size of read buffer, which in turn determines how much data can be read at most for one read syscall. ReadBufferSize int + // ChannelzParentID sets the addrConn id which initiate the creation of this client transport. + ChannelzParentID int64 + // MaxHeaderListSize sets the max (uncompressed) size of header list that is prepared to be received. + MaxHeaderListSize *uint32 } // TargetInfo contains the information of the target such as network address and metadata. @@ -514,8 +494,8 @@ type TargetInfo struct { // NewClientTransport establishes the transport with the required ConnectOptions // and returns it to the caller. -func NewClientTransport(connectCtx, ctx context.Context, target TargetInfo, opts ConnectOptions, onSuccess func()) (ClientTransport, error) { - return newHTTP2Client(connectCtx, ctx, target, opts, onSuccess) +func NewClientTransport(connectCtx, ctx context.Context, target TargetInfo, opts ConnectOptions, onSuccess func(), onGoAway func(GoAwayReason), onClose func()) (ClientTransport, error) { + return newHTTP2Client(connectCtx, ctx, target, opts, onSuccess, onGoAway, onClose) } // Options provides additional hints and information for message @@ -524,11 +504,6 @@ type Options struct { // Last indicates whether this write is the last piece for // this stream. Last bool - - // Delay is a hint to the transport implementation for whether - // the data could be buffered for a batching write. The - // transport implementation may ignore the hint. - Delay bool } // CallHdr carries the information of a particular RPC. @@ -546,13 +521,15 @@ type CallHdr struct { // Creds specifies credentials.PerRPCCredentials for a call. Creds credentials.PerRPCCredentials - // Flush indicates whether a new stream command should be sent - // to the peer without waiting for the first data. This is - // only a hint. - // If it's true, the transport may modify the flush decision - // for performance purposes. - // If it's false, new stream will never be flushed. - Flush bool + // ContentSubtype specifies the content-subtype for a request. For example, a + // content-subtype of "proto" will result in a content-type of + // "application/grpc+proto". The value of ContentSubtype must be all + // lowercase, otherwise the behavior is undefined. See + // https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md#requests + // for more details. + ContentSubtype string + + PreviousAttempts int // value of grpc-previous-rpc-attempts header to set } // ClientTransport is the common interface for all gRPC client-side transport @@ -594,6 +571,12 @@ type ClientTransport interface { // GetGoAwayReason returns the reason why GoAway frame was received. GetGoAwayReason() GoAwayReason + + // IncrMsgSent increments the number of message sent through this transport. + IncrMsgSent() + + // IncrMsgRecv increments the number of message received through this transport. + IncrMsgRecv() } // ServerTransport is the common interface for all gRPC server-side transport @@ -627,14 +610,12 @@ type ServerTransport interface { // Drain notifies the client this ServerTransport stops accepting new RPCs. Drain() -} -// streamErrorf creates an StreamError with the specified error code and description. -func streamErrorf(c codes.Code, format string, a ...interface{}) StreamError { - return StreamError{ - Code: c, - Desc: fmt.Sprintf(format, a...), - } + // IncrMsgSent increments the number of message sent through this transport. + IncrMsgSent() + + // IncrMsgRecv increments the number of message received through this transport. + IncrMsgRecv() } // connectionErrorf creates an ConnectionError with the specified error description. @@ -676,36 +657,18 @@ func (e ConnectionError) Origin() error { var ( // ErrConnClosing indicates that the transport is closing. ErrConnClosing = connectionErrorf(true, nil, "transport is closing") - // errStreamDrain indicates that the stream is rejected by the server because - // the server stops accepting new RPCs. - // TODO: delete this error; it is no longer necessary. - errStreamDrain = streamErrorf(codes.Unavailable, "the server stops accepting new RPCs") + // errStreamDrain indicates that the stream is rejected because the + // connection is draining. This could be caused by goaway or balancer + // removing the address. + errStreamDrain = status.Error(codes.Unavailable, "the connection is draining") + // errStreamDone is returned from write at the client side to indiacte application + // layer of an error. + errStreamDone = errors.New("the stream is done") // StatusGoAway indicates that the server sent a GOAWAY that included this // stream's ID in unprocessed RPCs. - statusGoAway = status.New(codes.Unavailable, "the server stopped accepting new RPCs") + statusGoAway = status.New(codes.Unavailable, "the stream is rejected because server is draining the connection") ) -// TODO: See if we can replace StreamError with status package errors. - -// StreamError is an error that only affects one stream within a connection. -type StreamError struct { - Code codes.Code - Desc string -} - -func (e StreamError) Error() string { - return fmt.Sprintf("stream error: code = %s desc = %q", e.Code, e.Desc) -} - -// waiters are passed to quotaPool get methods to -// wait on in addition to waiting on quota. -type waiters struct { - ctx context.Context - tctx context.Context - done chan struct{} - goAway chan struct{} -} - // GoAwayReason contains the reason for the GoAway frame received. type GoAwayReason uint8 @@ -720,38 +683,26 @@ const ( GoAwayTooManyPings GoAwayReason = 2 ) -// loopyWriter is run in a separate go routine. It is the single code path that will -// write data on wire. -func loopyWriter(ctx context.Context, cbuf *controlBuffer, handler func(item) error) { - for { - select { - case i := <-cbuf.get(): - cbuf.load() - if err := handler(i); err != nil { - errorf("transport: Error while handling item. Err: %v", err) - return - } - case <-ctx.Done(): - return - } - hasData: - for { - select { - case i := <-cbuf.get(): - cbuf.load() - if err := handler(i); err != nil { - errorf("transport: Error while handling item. Err: %v", err) - return - } - case <-ctx.Done(): - return - default: - if err := handler(&flushIO{}); err != nil { - errorf("transport: Error while flushing. Err: %v", err) - return - } - break hasData - } - } - } +// channelzData is used to store channelz related data for http2Client and http2Server. +// These fields cannot be embedded in the original structs (e.g. http2Client), since to do atomic +// operation on int64 variable on 32-bit machine, user is responsible to enforce memory alignment. +// Here, by grouping those int64 fields inside a struct, we are enforcing the alignment. +type channelzData struct { + kpCount int64 + // The number of streams that have started, including already finished ones. + streamsStarted int64 + // Client side: The number of streams that have ended successfully by receiving + // EoS bit set frame from server. + // Server side: The number of streams that have ended successfully by sending + // frame with EoS bit set. + streamsSucceeded int64 + streamsFailed int64 + // lastStreamCreatedTime stores the timestamp that the last stream gets created. It is of int64 type + // instead of time.Time since it's more costly to atomically update time.Time variable than int64 + // variable. The same goes for lastMsgSentTime and lastMsgRecvTime. + lastStreamCreatedTime int64 + msgSent int64 + msgRecv int64 + lastMsgSentTime int64 + lastMsgRecvTime int64 } diff --git a/vendor/google.golang.org/grpc/metadata/metadata.go b/vendor/google.golang.org/grpc/metadata/metadata.go index ccfea5d4530e..bd2eaf408376 100644 --- a/vendor/google.golang.org/grpc/metadata/metadata.go +++ b/vendor/google.golang.org/grpc/metadata/metadata.go @@ -17,7 +17,8 @@ */ // Package metadata define the structure of the metadata supported by gRPC library. -// Please refer to https://grpc.io/docs/guides/wire.html for more information about custom-metadata. +// Please refer to https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md +// for more information about custom-metadata. package metadata // import "google.golang.org/grpc/metadata" import ( @@ -27,7 +28,9 @@ import ( "golang.org/x/net/context" ) -// DecodeKeyValue returns k, v, nil. It is deprecated and should not be used. +// DecodeKeyValue returns k, v, nil. +// +// Deprecated: use k and v directly instead. func DecodeKeyValue(k, v string) (string, string, error) { return k, v, nil } @@ -94,6 +97,30 @@ func (md MD) Copy() MD { return Join(md) } +// Get obtains the values for a given key. +func (md MD) Get(k string) []string { + k = strings.ToLower(k) + return md[k] +} + +// Set sets the value of a given key with a slice of values. +func (md MD) Set(k string, vals ...string) { + if len(vals) == 0 { + return + } + k = strings.ToLower(k) + md[k] = vals +} + +// Append adds the values to key k, not overwriting what was already stored at that key. +func (md MD) Append(k string, vals ...string) { + if len(vals) == 0 { + return + } + k = strings.ToLower(k) + md[k] = append(md[k], vals...) +} + // Join joins any number of mds into a single MD. // The order of values for each key is determined by the order in which // the mds containing those values are presented to Join. @@ -115,9 +142,26 @@ func NewIncomingContext(ctx context.Context, md MD) context.Context { return context.WithValue(ctx, mdIncomingKey{}, md) } -// NewOutgoingContext creates a new context with outgoing md attached. +// NewOutgoingContext creates a new context with outgoing md attached. If used +// in conjunction with AppendToOutgoingContext, NewOutgoingContext will +// overwrite any previously-appended metadata. func NewOutgoingContext(ctx context.Context, md MD) context.Context { - return context.WithValue(ctx, mdOutgoingKey{}, md) + return context.WithValue(ctx, mdOutgoingKey{}, rawMD{md: md}) +} + +// AppendToOutgoingContext returns a new context with the provided kv merged +// with any existing metadata in the context. Please refer to the +// documentation of Pairs for a description of kv. +func AppendToOutgoingContext(ctx context.Context, kv ...string) context.Context { + if len(kv)%2 == 1 { + panic(fmt.Sprintf("metadata: AppendToOutgoingContext got an odd number of input pairs for metadata: %d", len(kv))) + } + md, _ := ctx.Value(mdOutgoingKey{}).(rawMD) + added := make([][]string, len(md.added)+1) + copy(added, md.added) + added[len(added)-1] = make([]string, len(kv)) + copy(added[len(added)-1], kv) + return context.WithValue(ctx, mdOutgoingKey{}, rawMD{md: md.md, added: added}) } // FromIncomingContext returns the incoming metadata in ctx if it exists. The @@ -128,10 +172,39 @@ func FromIncomingContext(ctx context.Context) (md MD, ok bool) { return } +// FromOutgoingContextRaw returns the un-merged, intermediary contents +// of rawMD. Remember to perform strings.ToLower on the keys. The returned +// MD should not be modified. Writing to it may cause races. Modification +// should be made to copies of the returned MD. +// +// This is intended for gRPC-internal use ONLY. +func FromOutgoingContextRaw(ctx context.Context) (MD, [][]string, bool) { + raw, ok := ctx.Value(mdOutgoingKey{}).(rawMD) + if !ok { + return nil, nil, false + } + + return raw.md, raw.added, true +} + // FromOutgoingContext returns the outgoing metadata in ctx if it exists. The // returned MD should not be modified. Writing to it may cause races. -// Modification should be made to the copies of the returned MD. -func FromOutgoingContext(ctx context.Context) (md MD, ok bool) { - md, ok = ctx.Value(mdOutgoingKey{}).(MD) - return +// Modification should be made to copies of the returned MD. +func FromOutgoingContext(ctx context.Context) (MD, bool) { + raw, ok := ctx.Value(mdOutgoingKey{}).(rawMD) + if !ok { + return nil, false + } + + mds := make([]MD, 0, len(raw.added)+1) + mds = append(mds, raw.md) + for _, vv := range raw.added { + mds = append(mds, Pairs(vv...)) + } + return Join(mds...), ok +} + +type rawMD struct { + md MD + added [][]string } diff --git a/vendor/google.golang.org/grpc/naming/dns_resolver.go b/vendor/google.golang.org/grpc/naming/dns_resolver.go index 7e69a2ca0a66..0f8a908ea9c1 100644 --- a/vendor/google.golang.org/grpc/naming/dns_resolver.go +++ b/vendor/google.golang.org/grpc/naming/dns_resolver.go @@ -153,10 +153,10 @@ type ipWatcher struct { updateChan chan *Update } -// Next returns the adrress resolution Update for the target. For IP address, -// the resolution is itself, thus polling name server is unncessary. Therefore, +// Next returns the address resolution Update for the target. For IP address, +// the resolution is itself, thus polling name server is unnecessary. Therefore, // Next() will return an Update the first time it is called, and will be blocked -// for all following calls as no Update exisits until watcher is closed. +// for all following calls as no Update exists until watcher is closed. func (i *ipWatcher) Next() ([]*Update, error) { u, ok := <-i.updateChan if !ok { diff --git a/vendor/google.golang.org/grpc/naming/naming.go b/vendor/google.golang.org/grpc/naming/naming.go index 1af7e32f86d0..8cc39e93758f 100644 --- a/vendor/google.golang.org/grpc/naming/naming.go +++ b/vendor/google.golang.org/grpc/naming/naming.go @@ -18,20 +18,26 @@ // Package naming defines the naming API and related data structures for gRPC. // The interface is EXPERIMENTAL and may be suject to change. +// +// Deprecated: please use package resolver. package naming // Operation defines the corresponding operations for a name resolution change. +// +// Deprecated: please use package resolver. type Operation uint8 const ( // Add indicates a new address is added. Add Operation = iota - // Delete indicates an exisiting address is deleted. + // Delete indicates an existing address is deleted. Delete ) // Update defines a name resolution update. Notice that it is not valid having both // empty string Addr and nil Metadata in an Update. +// +// Deprecated: please use package resolver. type Update struct { // Op indicates the operation of the update. Op Operation @@ -43,12 +49,16 @@ type Update struct { } // Resolver creates a Watcher for a target to track its resolution changes. +// +// Deprecated: please use package resolver. type Resolver interface { // Resolve creates a Watcher for target. Resolve(target string) (Watcher, error) } // Watcher watches for the updates on the specified target. +// +// Deprecated: please use package resolver. type Watcher interface { // Next blocks until an update or error happens. It may return one or more // updates. The first call should get the full set of the results. It should diff --git a/vendor/google.golang.org/grpc/picker_wrapper.go b/vendor/google.golang.org/grpc/picker_wrapper.go index db82bfb3a0f3..76cc456aa7e9 100644 --- a/vendor/google.golang.org/grpc/picker_wrapper.go +++ b/vendor/google.golang.org/grpc/picker_wrapper.go @@ -19,14 +19,16 @@ package grpc import ( + "io" "sync" "golang.org/x/net/context" "google.golang.org/grpc/balancer" "google.golang.org/grpc/codes" "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/internal/channelz" + "google.golang.org/grpc/internal/transport" "google.golang.org/grpc/status" - "google.golang.org/grpc/transport" ) // pickerWrapper is a wrapper of balancer.Picker. It blocks on certain pick @@ -36,6 +38,10 @@ type pickerWrapper struct { done bool blockingCh chan struct{} picker balancer.Picker + + // The latest connection happened. + connErrMu sync.Mutex + connErr error } func newPickerWrapper() *pickerWrapper { @@ -43,6 +49,19 @@ func newPickerWrapper() *pickerWrapper { return bp } +func (bp *pickerWrapper) updateConnectionError(err error) { + bp.connErrMu.Lock() + bp.connErr = err + bp.connErrMu.Unlock() +} + +func (bp *pickerWrapper) connectionError() error { + bp.connErrMu.Lock() + err := bp.connErr + bp.connErrMu.Unlock() + return err +} + // updatePicker is called by UpdateBalancerState. It unblocks all blocked pick. func (bp *pickerWrapper) updatePicker(p balancer.Picker) { bp.mu.Lock() @@ -57,6 +76,23 @@ func (bp *pickerWrapper) updatePicker(p balancer.Picker) { bp.mu.Unlock() } +func doneChannelzWrapper(acw *acBalancerWrapper, done func(balancer.DoneInfo)) func(balancer.DoneInfo) { + acw.mu.Lock() + ac := acw.ac + acw.mu.Unlock() + ac.incrCallsStarted() + return func(b balancer.DoneInfo) { + if b.Err != nil && b.Err != io.EOF { + ac.incrCallsFailed() + } else { + ac.incrCallsSucceeded() + } + if done != nil { + done(b) + } + } +} + // pick returns the transport that will be used for the RPC. // It may block in the following cases: // - there's no picker @@ -107,7 +143,7 @@ func (bp *pickerWrapper) pick(ctx context.Context, failfast bool, opts balancer. if !failfast { continue } - return nil, nil, status.Errorf(codes.Unavailable, "%v", err) + return nil, nil, status.Errorf(codes.Unavailable, "%v, latest connection error: %v", err, bp.connectionError()) default: // err is some other error. return nil, nil, toRPCErr(err) @@ -120,6 +156,9 @@ func (bp *pickerWrapper) pick(ctx context.Context, failfast bool, opts balancer. continue } if t, ok := acw.getAddrConn().getReadyTransport(); ok { + if channelz.IsOn() { + return t, doneChannelzWrapper(acw, done), nil + } return t, done, nil } grpclog.Infof("blockingPicker: the picked transport is not ready, loop back to repick") diff --git a/vendor/google.golang.org/grpc/pickfirst.go b/vendor/google.golang.org/grpc/pickfirst.go index bf659d49d2f1..bda4309c03a5 100644 --- a/vendor/google.golang.org/grpc/pickfirst.go +++ b/vendor/google.golang.org/grpc/pickfirst.go @@ -56,6 +56,7 @@ func (b *pickfirstBalancer) HandleResolvedAddrs(addrs []resolver.Address, err er if b.sc == nil { b.sc, err = b.cc.NewSubConn(addrs, balancer.NewSubConnOptions{}) if err != nil { + //TODO(yuxuanli): why not change the cc state to Idle? grpclog.Errorf("pickfirstBalancer: failed to NewSubConn: %v", err) return } diff --git a/vendor/google.golang.org/grpc/resolver/dns/dns_resolver.go b/vendor/google.golang.org/grpc/resolver/dns/dns_resolver.go index a543a709a623..4ce81671d59f 100644 --- a/vendor/google.golang.org/grpc/resolver/dns/dns_resolver.go +++ b/vendor/google.golang.org/grpc/resolver/dns/dns_resolver.go @@ -24,7 +24,6 @@ import ( "encoding/json" "errors" "fmt" - "math/rand" "net" "os" "strconv" @@ -34,6 +33,8 @@ import ( "golang.org/x/net/context" "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/internal/backoff" + "google.golang.org/grpc/internal/grpcrand" "google.golang.org/grpc/resolver" ) @@ -50,20 +51,31 @@ const ( txtAttribute = "grpc_config=" ) -var errMissingAddr = errors.New("missing address") +var ( + errMissingAddr = errors.New("dns resolver: missing address") + + // Addresses ending with a colon that is supposed to be the separator + // between host and port is not allowed. E.g. "::" is a valid address as + // it is an IPv6 address (host only) and "[::]:" is invalid as it ends with + // a colon as the host and port separator + errEndsWithColon = errors.New("dns resolver: missing port after port-separator colon") +) // NewBuilder creates a dnsBuilder which is used to factory DNS resolvers. func NewBuilder() resolver.Builder { - return &dnsBuilder{freq: defaultFreq} + return &dnsBuilder{minFreq: defaultFreq} } type dnsBuilder struct { - // frequency of polling the DNS server. - freq time.Duration + // minimum frequency of polling the DNS server. + minFreq time.Duration } // Build creates and starts a DNS resolver that watches the name resolution of the target. func (b *dnsBuilder) Build(target resolver.Target, cc resolver.ClientConn, opts resolver.BuildOption) (resolver.Resolver, error) { + if target.Authority != "" { + return nil, fmt.Errorf("default DNS resolver does not support custom DNS server") + } host, port, err := parseTarget(target.Endpoint) if err != nil { return nil, err @@ -87,14 +99,16 @@ func (b *dnsBuilder) Build(target resolver.Target, cc resolver.ClientConn, opts // DNS address (non-IP). ctx, cancel := context.WithCancel(context.Background()) d := &dnsResolver{ - freq: b.freq, - host: host, - port: port, - ctx: ctx, - cancel: cancel, - cc: cc, - t: time.NewTimer(0), - rn: make(chan struct{}, 1), + freq: b.minFreq, + backoff: backoff.Exponential{MaxDelay: b.minFreq}, + host: host, + port: port, + ctx: ctx, + cancel: cancel, + cc: cc, + t: time.NewTimer(0), + rn: make(chan struct{}, 1), + disableServiceConfig: opts.DisableServiceConfig, } d.wg.Add(1) @@ -142,12 +156,14 @@ func (i *ipResolver) watcher() { // dnsResolver watches for the name resolution update for a non-IP target. type dnsResolver struct { - freq time.Duration - host string - port string - ctx context.Context - cancel context.CancelFunc - cc resolver.ClientConn + freq time.Duration + backoff backoff.Exponential + retryCount int + host string + port string + ctx context.Context + cancel context.CancelFunc + cc resolver.ClientConn // rn channel is used by ResolveNow() to force an immediate resolution of the target. rn chan struct{} t *time.Timer @@ -157,7 +173,8 @@ type dnsResolver struct { // If Close() doesn't wait for watcher() goroutine finishes, race detector sometimes // will warns lookup (READ the lookup function pointers) inside watcher() goroutine // has data race with replaceNetFunc (WRITE the lookup function pointers). - wg sync.WaitGroup + wg sync.WaitGroup + disableServiceConfig bool } // ResolveNow invoke an immediate resolution of the target that this dnsResolver watches. @@ -185,9 +202,16 @@ func (d *dnsResolver) watcher() { case <-d.rn: } result, sc := d.lookup() - // Next lookup should happen after an interval defined by d.freq. - d.t.Reset(d.freq) - d.cc.NewServiceConfig(string(sc)) + // Next lookup should happen within an interval defined by d.freq. It may be + // more often due to exponential retry on empty address list. + if len(result) == 0 { + d.retryCount++ + d.t.Reset(d.backoff.Backoff(d.retryCount)) + } else { + d.retryCount = 0 + d.t.Reset(d.freq) + } + d.cc.NewServiceConfig(sc) d.cc.NewAddress(result) } } @@ -202,7 +226,7 @@ func (d *dnsResolver) lookupSRV() []resolver.Address { for _, s := range srvs { lbAddrs, err := lookupHost(d.ctx, s.Target) if err != nil { - grpclog.Warningf("grpc: failed load banlacer address dns lookup due to %v.\n", err) + grpclog.Infof("grpc: failed load balancer address dns lookup due to %v.\n", err) continue } for _, a := range lbAddrs { @@ -221,7 +245,7 @@ func (d *dnsResolver) lookupSRV() []resolver.Address { func (d *dnsResolver) lookupTXT() string { ss, err := lookupTXT(d.ctx, d.host) if err != nil { - grpclog.Warningf("grpc: failed dns TXT record lookup due to %v.\n", err) + grpclog.Infof("grpc: failed dns TXT record lookup due to %v.\n", err) return "" } var res string @@ -257,10 +281,12 @@ func (d *dnsResolver) lookupHost() []resolver.Address { } func (d *dnsResolver) lookup() ([]resolver.Address, string) { - var newAddrs []resolver.Address - newAddrs = d.lookupSRV() + newAddrs := d.lookupSRV() // Support fallback to non-balancer address. newAddrs = append(newAddrs, d.lookupHost()...) + if d.disableServiceConfig { + return newAddrs, "" + } sc := d.lookupTXT() return newAddrs, canaryingSC(sc) } @@ -288,7 +314,6 @@ func formatIP(addr string) (addrIP string, ok bool) { // target: "ipv4-host:80" returns host: "ipv4-host", port: "80" // target: "[ipv6-host]" returns host: "ipv6-host", port: "443" // target: ":80" returns host: "localhost", port: "80" -// target: ":" returns host: "localhost", port: "443" func parseTarget(target string) (host, port string, err error) { if target == "" { return "", "", errMissingAddr @@ -298,15 +323,15 @@ func parseTarget(target string) (host, port string, err error) { return target, defaultPort, nil } if host, port, err = net.SplitHostPort(target); err == nil { + if port == "" { + // If the port field is empty (target ends with colon), e.g. "[::1]:", this is an error. + return "", "", errEndsWithColon + } // target has port, i.e ipv4-host:port, [ipv6-host]:port, host-name:port if host == "" { // Keep consistent with net.Dial(): If the host is empty, as in ":80", the local system is assumed. host = "localhost" } - if port == "" { - // If the port field is empty(target ends with colon), e.g. "[::1]:", defaultPort is used. - port = defaultPort - } return host, port, nil } if host, port, err = net.SplitHostPort(target + ":" + defaultPort); err == nil { @@ -339,12 +364,7 @@ func chosenByPercentage(a *int) bool { if a == nil { return true } - s := rand.NewSource(time.Now().UnixNano()) - r := rand.New(s) - if r.Intn(100)+1 > *a { - return false - } - return true + return grpcrand.Intn(100)+1 <= *a } func canaryingSC(js string) string { diff --git a/vendor/google.golang.org/grpc/resolver/resolver.go b/vendor/google.golang.org/grpc/resolver/resolver.go index df097eedf79a..145cf477edb0 100644 --- a/vendor/google.golang.org/grpc/resolver/resolver.go +++ b/vendor/google.golang.org/grpc/resolver/resolver.go @@ -29,37 +29,41 @@ var ( // TODO(bar) install dns resolver in init(){}. -// Register registers the resolver builder to the resolver map. -// b.Scheme will be used as the scheme registered with this builder. +// Register registers the resolver builder to the resolver map. b.Scheme will be +// used as the scheme registered with this builder. +// +// NOTE: this function must only be called during initialization time (i.e. in +// an init() function), and is not thread-safe. If multiple Resolvers are +// registered with the same name, the one registered last will take effect. func Register(b Builder) { m[b.Scheme()] = b } // Get returns the resolver builder registered with the given scheme. -// If no builder is register with the scheme, the default scheme will -// be used. -// If the default scheme is not modified, "passthrough" will be the default -// scheme, and the preinstalled dns resolver will be used. -// If the default scheme is modified, and a resolver is registered with -// the scheme, that resolver will be returned. -// If the default scheme is modified, and no resolver is registered with -// the scheme, nil will be returned. +// +// If no builder is register with the scheme, nil will be returned. func Get(scheme string) Builder { if b, ok := m[scheme]; ok { return b } - if b, ok := m[defaultScheme]; ok { - return b - } return nil } -// SetDefaultScheme sets the default scheme that will be used. -// The default default scheme is "passthrough". +// SetDefaultScheme sets the default scheme that will be used. The default +// default scheme is "passthrough". +// +// NOTE: this function must only be called during initialization time (i.e. in +// an init() function), and is not thread-safe. The scheme set last overrides +// previously set values. func SetDefaultScheme(scheme string) { defaultScheme = scheme } +// GetDefaultScheme gets the default scheme that will be used. +func GetDefaultScheme() string { + return defaultScheme +} + // AddressType indicates the address type returned by name resolution. type AddressType uint8 @@ -90,9 +94,8 @@ type Address struct { // BuildOption includes additional information for the builder to create // the resolver. type BuildOption struct { - // UserOptions can be used to pass configuration between DialOptions and the - // resolver. - UserOptions interface{} + // DisableServiceConfig indicates whether resolver should fetch service config data. + DisableServiceConfig bool } // ClientConn contains the callbacks for resolver to notify any updates diff --git a/vendor/google.golang.org/grpc/resolver_conn_wrapper.go b/vendor/google.golang.org/grpc/resolver_conn_wrapper.go index ef5d4c286926..a6c02ac9ede0 100644 --- a/vendor/google.golang.org/grpc/resolver_conn_wrapper.go +++ b/vendor/google.golang.org/grpc/resolver_conn_wrapper.go @@ -23,17 +23,19 @@ import ( "strings" "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/internal/channelz" "google.golang.org/grpc/resolver" ) // ccResolverWrapper is a wrapper on top of cc for resolvers. // It implements resolver.ClientConnection interface. type ccResolverWrapper struct { - cc *ClientConn - resolver resolver.Resolver - addrCh chan []resolver.Address - scCh chan string - done chan struct{} + cc *ClientConn + resolver resolver.Resolver + addrCh chan []resolver.Address + scCh chan string + done chan struct{} + lastAddressesCount int } // split2 returns the values from strings.SplitN(s, sep, 2). @@ -48,31 +50,32 @@ func split2(s, sep string) (string, string, bool) { // parseTarget splits target into a struct containing scheme, authority and // endpoint. +// +// If target is not a valid scheme://authority/endpoint, it returns {Endpoint: +// target}. func parseTarget(target string) (ret resolver.Target) { var ok bool ret.Scheme, ret.Endpoint, ok = split2(target, "://") if !ok { return resolver.Target{Endpoint: target} } - ret.Authority, ret.Endpoint, _ = split2(ret.Endpoint, "/") + ret.Authority, ret.Endpoint, ok = split2(ret.Endpoint, "/") + if !ok { + return resolver.Target{Endpoint: target} + } return ret } // newCCResolverWrapper parses cc.target for scheme and gets the resolver -// builder for this scheme. It then builds the resolver and starts the -// monitoring goroutine for it. +// builder for this scheme and builds the resolver. The monitoring goroutine +// for it is not started yet and can be created by calling start(). // // If withResolverBuilder dial option is set, the specified resolver will be // used instead. func newCCResolverWrapper(cc *ClientConn) (*ccResolverWrapper, error) { - grpclog.Infof("dialing to target with scheme: %q", cc.parsedTarget.Scheme) - rb := cc.dopts.resolverBuilder if rb == nil { - rb = resolver.Get(cc.parsedTarget.Scheme) - if rb == nil { - return nil, fmt.Errorf("could not get resolver for scheme: %q", cc.parsedTarget.Scheme) - } + return nil, fmt.Errorf("could not get resolver for scheme: %q", cc.parsedTarget.Scheme) } ccr := &ccResolverWrapper{ @@ -83,9 +86,7 @@ func newCCResolverWrapper(cc *ClientConn) (*ccResolverWrapper, error) { } var err error - ccr.resolver, err = rb.Build(cc.parsedTarget, ccr, resolver.BuildOption{ - UserOptions: cc.dopts.resolverBuildUserOptions, - }) + ccr.resolver, err = rb.Build(cc.parsedTarget, ccr, resolver.BuildOption{DisableServiceConfig: cc.dopts.disableServiceConfig}) if err != nil { return nil, err } @@ -96,7 +97,7 @@ func (ccr *ccResolverWrapper) start() { go ccr.watcher() } -// watcher processes address updates and service config updates sequencially. +// watcher processes address updates and service config updates sequentially. // Otherwise, we need to resolve possible races between address and service // config (e.g. they specify different balancer types). func (ccr *ccResolverWrapper) watcher() { @@ -115,6 +116,9 @@ func (ccr *ccResolverWrapper) watcher() { default: } grpclog.Infof("ccResolverWrapper: sending new addresses to cc: %v", addrs) + if channelz.IsOn() { + ccr.addChannelzTraceEvent(addrs) + } ccr.cc.handleResolvedAddrs(addrs, nil) case sc := <-ccr.scCh: select { @@ -149,7 +153,7 @@ func (ccr *ccResolverWrapper) NewAddress(addrs []resolver.Address) { } // NewServiceConfig is called by the resolver implemenetion to send service -// configs to gPRC. +// configs to gRPC. func (ccr *ccResolverWrapper) NewServiceConfig(sc string) { select { case <-ccr.scCh: @@ -157,3 +161,29 @@ func (ccr *ccResolverWrapper) NewServiceConfig(sc string) { } ccr.scCh <- sc } + +func (ccr *ccResolverWrapper) addChannelzTraceEvent(addrs []resolver.Address) { + if len(addrs) == 0 && ccr.lastAddressesCount != 0 { + channelz.AddTraceEvent(ccr.cc.channelzID, &channelz.TraceEventDesc{ + Desc: "Resolver returns an empty address list", + Severity: channelz.CtWarning, + }) + } else if len(addrs) != 0 && ccr.lastAddressesCount == 0 { + var s string + for i, a := range addrs { + if a.ServerName != "" { + s += a.Addr + "(" + a.ServerName + ")" + } else { + s += a.Addr + } + if i != len(addrs)-1 { + s += " " + } + } + channelz.AddTraceEvent(ccr.cc.channelzID, &channelz.TraceEventDesc{ + Desc: fmt.Sprintf("Resolver returns a non-empty address list (previous one was empty) %q", s), + Severity: channelz.CtINFO, + }) + } + ccr.lastAddressesCount = len(addrs) +} diff --git a/vendor/google.golang.org/grpc/rpc_util.go b/vendor/google.golang.org/grpc/rpc_util.go index ea673834299b..d076af691cfc 100644 --- a/vendor/google.golang.org/grpc/rpc_util.go +++ b/vendor/google.golang.org/grpc/rpc_util.go @@ -22,9 +22,12 @@ import ( "bytes" "compress/gzip" "encoding/binary" + "fmt" "io" "io/ioutil" "math" + "net/url" + "strings" "sync" "time" @@ -32,14 +35,17 @@ import ( "google.golang.org/grpc/codes" "google.golang.org/grpc/credentials" "google.golang.org/grpc/encoding" + "google.golang.org/grpc/encoding/proto" + "google.golang.org/grpc/internal/transport" "google.golang.org/grpc/metadata" "google.golang.org/grpc/peer" "google.golang.org/grpc/stats" "google.golang.org/grpc/status" - "google.golang.org/grpc/transport" ) // Compressor defines the interface gRPC uses to compress a message. +// +// Deprecated: use package encoding. type Compressor interface { // Do compresses p into w. Do(w io.Writer, p []byte) error @@ -52,14 +58,34 @@ type gzipCompressor struct { } // NewGZIPCompressor creates a Compressor based on GZIP. +// +// Deprecated: use package encoding/gzip. func NewGZIPCompressor() Compressor { + c, _ := NewGZIPCompressorWithLevel(gzip.DefaultCompression) + return c +} + +// NewGZIPCompressorWithLevel is like NewGZIPCompressor but specifies the gzip compression level instead +// of assuming DefaultCompression. +// +// The error returned will be nil if the level is valid. +// +// Deprecated: use package encoding/gzip. +func NewGZIPCompressorWithLevel(level int) (Compressor, error) { + if level < gzip.DefaultCompression || level > gzip.BestCompression { + return nil, fmt.Errorf("grpc: invalid compression level: %d", level) + } return &gzipCompressor{ pool: sync.Pool{ New: func() interface{} { - return gzip.NewWriter(ioutil.Discard) + w, err := gzip.NewWriterLevel(ioutil.Discard, level) + if err != nil { + panic(err) + } + return w }, }, - } + }, nil } func (c *gzipCompressor) Do(w io.Writer, p []byte) error { @@ -77,6 +103,8 @@ func (c *gzipCompressor) Type() string { } // Decompressor defines the interface gRPC uses to decompress a message. +// +// Deprecated: use package encoding. type Decompressor interface { // Do reads the data from r and uncompress them. Do(r io.Reader) ([]byte, error) @@ -89,6 +117,8 @@ type gzipDecompressor struct { } // NewGZIPDecompressor creates a Decompressor based on GZIP. +// +// Deprecated: use package encoding/gzip. func NewGZIPDecompressor() Decompressor { return &gzipDecompressor{} } @@ -125,15 +155,20 @@ func (d *gzipDecompressor) Type() string { type callInfo struct { compressorType string failFast bool - stream *transport.Stream - traceInfo traceInfo // in trace.go + stream *clientStream maxReceiveMessageSize *int maxSendMessageSize *int creds credentials.PerRPCCredentials + contentSubtype string + codec baseCodec + maxRetryRPCBufferSize int } func defaultCallInfo() *callInfo { - return &callInfo{failFast: true} + return &callInfo{ + failFast: true, + maxRetryRPCBufferSize: 256 * 1024, // 256KB + } } // CallOption configures a Call before it starts or extracts information from @@ -156,46 +191,66 @@ type EmptyCallOption struct{} func (EmptyCallOption) before(*callInfo) error { return nil } func (EmptyCallOption) after(*callInfo) {} -type beforeCall func(c *callInfo) error - -func (o beforeCall) before(c *callInfo) error { return o(c) } -func (o beforeCall) after(c *callInfo) {} - -type afterCall func(c *callInfo) - -func (o afterCall) before(c *callInfo) error { return nil } -func (o afterCall) after(c *callInfo) { o(c) } - // Header returns a CallOptions that retrieves the header metadata // for a unary RPC. func Header(md *metadata.MD) CallOption { - return afterCall(func(c *callInfo) { - if c.stream != nil { - *md, _ = c.stream.Header() - } - }) + return HeaderCallOption{HeaderAddr: md} +} + +// HeaderCallOption is a CallOption for collecting response header metadata. +// The metadata field will be populated *after* the RPC completes. +// This is an EXPERIMENTAL API. +type HeaderCallOption struct { + HeaderAddr *metadata.MD +} + +func (o HeaderCallOption) before(c *callInfo) error { return nil } +func (o HeaderCallOption) after(c *callInfo) { + if c.stream != nil { + *o.HeaderAddr, _ = c.stream.Header() + } } // Trailer returns a CallOptions that retrieves the trailer metadata // for a unary RPC. func Trailer(md *metadata.MD) CallOption { - return afterCall(func(c *callInfo) { - if c.stream != nil { - *md = c.stream.Trailer() - } - }) + return TrailerCallOption{TrailerAddr: md} } -// Peer returns a CallOption that retrieves peer information for a -// unary RPC. +// TrailerCallOption is a CallOption for collecting response trailer metadata. +// The metadata field will be populated *after* the RPC completes. +// This is an EXPERIMENTAL API. +type TrailerCallOption struct { + TrailerAddr *metadata.MD +} + +func (o TrailerCallOption) before(c *callInfo) error { return nil } +func (o TrailerCallOption) after(c *callInfo) { + if c.stream != nil { + *o.TrailerAddr = c.stream.Trailer() + } +} + +// Peer returns a CallOption that retrieves peer information for a unary RPC. +// The peer field will be populated *after* the RPC completes. func Peer(p *peer.Peer) CallOption { - return afterCall(func(c *callInfo) { - if c.stream != nil { - if x, ok := peer.FromContext(c.stream.Context()); ok { - *p = *x - } + return PeerCallOption{PeerAddr: p} +} + +// PeerCallOption is a CallOption for collecting the identity of the remote +// peer. The peer field will be populated *after* the RPC completes. +// This is an EXPERIMENTAL API. +type PeerCallOption struct { + PeerAddr *peer.Peer +} + +func (o PeerCallOption) before(c *callInfo) error { return nil } +func (o PeerCallOption) after(c *callInfo) { + if c.stream != nil { + if x, ok := peer.FromContext(c.stream.Context()); ok { + *o.PeerAddr = *x } - }) + } } // FailFast configures the action to take when an RPC is attempted on broken @@ -209,55 +264,187 @@ func Peer(p *peer.Peer) CallOption { // // By default, RPCs are "Fail Fast". func FailFast(failFast bool) CallOption { - return beforeCall(func(c *callInfo) error { - c.failFast = failFast - return nil - }) + return FailFastCallOption{FailFast: failFast} } +// FailFastCallOption is a CallOption for indicating whether an RPC should fail +// fast or not. +// This is an EXPERIMENTAL API. +type FailFastCallOption struct { + FailFast bool +} + +func (o FailFastCallOption) before(c *callInfo) error { + c.failFast = o.FailFast + return nil +} +func (o FailFastCallOption) after(c *callInfo) {} + // MaxCallRecvMsgSize returns a CallOption which sets the maximum message size the client can receive. func MaxCallRecvMsgSize(s int) CallOption { - return beforeCall(func(o *callInfo) error { - o.maxReceiveMessageSize = &s - return nil - }) + return MaxRecvMsgSizeCallOption{MaxRecvMsgSize: s} +} + +// MaxRecvMsgSizeCallOption is a CallOption that indicates the maximum message +// size the client can receive. +// This is an EXPERIMENTAL API. +type MaxRecvMsgSizeCallOption struct { + MaxRecvMsgSize int +} + +func (o MaxRecvMsgSizeCallOption) before(c *callInfo) error { + c.maxReceiveMessageSize = &o.MaxRecvMsgSize + return nil } +func (o MaxRecvMsgSizeCallOption) after(c *callInfo) {} // MaxCallSendMsgSize returns a CallOption which sets the maximum message size the client can send. func MaxCallSendMsgSize(s int) CallOption { - return beforeCall(func(o *callInfo) error { - o.maxSendMessageSize = &s - return nil - }) + return MaxSendMsgSizeCallOption{MaxSendMsgSize: s} +} + +// MaxSendMsgSizeCallOption is a CallOption that indicates the maximum message +// size the client can send. +// This is an EXPERIMENTAL API. +type MaxSendMsgSizeCallOption struct { + MaxSendMsgSize int } +func (o MaxSendMsgSizeCallOption) before(c *callInfo) error { + c.maxSendMessageSize = &o.MaxSendMsgSize + return nil +} +func (o MaxSendMsgSizeCallOption) after(c *callInfo) {} + // PerRPCCredentials returns a CallOption that sets credentials.PerRPCCredentials // for a call. func PerRPCCredentials(creds credentials.PerRPCCredentials) CallOption { - return beforeCall(func(c *callInfo) error { - c.creds = creds - return nil - }) + return PerRPCCredsCallOption{Creds: creds} } +// PerRPCCredsCallOption is a CallOption that indicates the per-RPC +// credentials to use for the call. +// This is an EXPERIMENTAL API. +type PerRPCCredsCallOption struct { + Creds credentials.PerRPCCredentials +} + +func (o PerRPCCredsCallOption) before(c *callInfo) error { + c.creds = o.Creds + return nil +} +func (o PerRPCCredsCallOption) after(c *callInfo) {} + // UseCompressor returns a CallOption which sets the compressor used when // sending the request. If WithCompressor is also set, UseCompressor has // higher priority. // // This API is EXPERIMENTAL. func UseCompressor(name string) CallOption { - return beforeCall(func(c *callInfo) error { - c.compressorType = name - return nil - }) + return CompressorCallOption{CompressorType: name} +} + +// CompressorCallOption is a CallOption that indicates the compressor to use. +// This is an EXPERIMENTAL API. +type CompressorCallOption struct { + CompressorType string +} + +func (o CompressorCallOption) before(c *callInfo) error { + c.compressorType = o.CompressorType + return nil +} +func (o CompressorCallOption) after(c *callInfo) {} + +// CallContentSubtype returns a CallOption that will set the content-subtype +// for a call. For example, if content-subtype is "json", the Content-Type over +// the wire will be "application/grpc+json". The content-subtype is converted +// to lowercase before being included in Content-Type. See Content-Type on +// https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md#requests for +// more details. +// +// If CallCustomCodec is not also used, the content-subtype will be used to +// look up the Codec to use in the registry controlled by RegisterCodec. See +// the documentation on RegisterCodec for details on registration. The lookup +// of content-subtype is case-insensitive. If no such Codec is found, the call +// will result in an error with code codes.Internal. +// +// If CallCustomCodec is also used, that Codec will be used for all request and +// response messages, with the content-subtype set to the given contentSubtype +// here for requests. +func CallContentSubtype(contentSubtype string) CallOption { + return ContentSubtypeCallOption{ContentSubtype: strings.ToLower(contentSubtype)} +} + +// ContentSubtypeCallOption is a CallOption that indicates the content-subtype +// used for marshaling messages. +// This is an EXPERIMENTAL API. +type ContentSubtypeCallOption struct { + ContentSubtype string } +func (o ContentSubtypeCallOption) before(c *callInfo) error { + c.contentSubtype = o.ContentSubtype + return nil +} +func (o ContentSubtypeCallOption) after(c *callInfo) {} + +// CallCustomCodec returns a CallOption that will set the given Codec to be +// used for all request and response messages for a call. The result of calling +// String() will be used as the content-subtype in a case-insensitive manner. +// +// See Content-Type on +// https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md#requests for +// more details. Also see the documentation on RegisterCodec and +// CallContentSubtype for more details on the interaction between Codec and +// content-subtype. +// +// This function is provided for advanced users; prefer to use only +// CallContentSubtype to select a registered codec instead. +func CallCustomCodec(codec Codec) CallOption { + return CustomCodecCallOption{Codec: codec} +} + +// CustomCodecCallOption is a CallOption that indicates the codec used for +// marshaling messages. +// This is an EXPERIMENTAL API. +type CustomCodecCallOption struct { + Codec Codec +} + +func (o CustomCodecCallOption) before(c *callInfo) error { + c.codec = o.Codec + return nil +} +func (o CustomCodecCallOption) after(c *callInfo) {} + +// MaxRetryRPCBufferSize returns a CallOption that limits the amount of memory +// used for buffering this RPC's requests for retry purposes. +// +// This API is EXPERIMENTAL. +func MaxRetryRPCBufferSize(bytes int) CallOption { + return MaxRetryRPCBufferSizeCallOption{bytes} +} + +// MaxRetryRPCBufferSizeCallOption is a CallOption indicating the amount of +// memory to be used for caching this RPC for retry purposes. +// This is an EXPERIMENTAL API. +type MaxRetryRPCBufferSizeCallOption struct { + MaxRetryRPCBufferSize int +} + +func (o MaxRetryRPCBufferSizeCallOption) before(c *callInfo) error { + c.maxRetryRPCBufferSize = o.MaxRetryRPCBufferSize + return nil +} +func (o MaxRetryRPCBufferSizeCallOption) after(c *callInfo) {} + // The format of the payload: compressed or not? type payloadFormat uint8 const ( - compressionNone payloadFormat = iota // no compression - compressionMade + compressionNone payloadFormat = 0 // no compression + compressionMade payloadFormat = 1 // compressed ) // parser reads complete gRPC messages from the underlying reader. @@ -267,8 +454,8 @@ type parser struct { // error types. r io.Reader - // The header of a gRPC message. Find more detail - // at https://grpc.io/docs/guides/wire.html. + // The header of a gRPC message. Find more detail at + // https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md header [5]byte } @@ -281,7 +468,7 @@ type parser struct { // * io.EOF, when no messages remain // * io.ErrUnexpectedEOF // * of type transport.ConnectionError -// * of type transport.StreamError +// * an error from the status package // No other error values or types must be returned, which also means // that the underlying io.Reader must not return an incompatible // error. @@ -314,65 +501,85 @@ func (p *parser) recvMsg(maxReceiveMessageSize int) (pf payloadFormat, msg []byt return pf, msg, nil } -// encode serializes msg and returns a buffer of message header and a buffer of msg. -// If msg is nil, it generates the message header and an empty msg buffer. -// TODO(ddyihai): eliminate extra Compressor parameter. -func encode(c Codec, msg interface{}, cp Compressor, outPayload *stats.OutPayload, compressor encoding.Compressor) ([]byte, []byte, error) { - var ( - b []byte - cbuf *bytes.Buffer - ) - const ( - payloadLen = 1 - sizeLen = 4 - ) - if msg != nil { - var err error - b, err = c.Marshal(msg) +// encode serializes msg and returns a buffer containing the message, or an +// error if it is too large to be transmitted by grpc. If msg is nil, it +// generates an empty message. +func encode(c baseCodec, msg interface{}) ([]byte, error) { + if msg == nil { // NOTE: typed nils will not be caught by this check + return nil, nil + } + b, err := c.Marshal(msg) + if err != nil { + return nil, status.Errorf(codes.Internal, "grpc: error while marshaling: %v", err.Error()) + } + if uint(len(b)) > math.MaxUint32 { + return nil, status.Errorf(codes.ResourceExhausted, "grpc: message too large (%d bytes)", len(b)) + } + return b, nil +} + +// compress returns the input bytes compressed by compressor or cp. If both +// compressors are nil, returns nil. +// +// TODO(dfawley): eliminate cp parameter by wrapping Compressor in an encoding.Compressor. +func compress(in []byte, cp Compressor, compressor encoding.Compressor) ([]byte, error) { + if compressor == nil && cp == nil { + return nil, nil + } + wrapErr := func(err error) error { + return status.Errorf(codes.Internal, "grpc: error while compressing: %v", err.Error()) + } + cbuf := &bytes.Buffer{} + if compressor != nil { + z, err := compressor.Compress(cbuf) if err != nil { - return nil, nil, status.Errorf(codes.Internal, "grpc: error while marshaling: %v", err.Error()) + return nil, wrapErr(err) } - if outPayload != nil { - outPayload.Payload = msg - // TODO truncate large payload. - outPayload.Data = b - outPayload.Length = len(b) + if _, err := z.Write(in); err != nil { + return nil, wrapErr(err) } - if compressor != nil || cp != nil { - cbuf = new(bytes.Buffer) - // Has compressor, check Compressor is set by UseCompressor first. - if compressor != nil { - z, _ := compressor.Compress(cbuf) - if _, err := z.Write(b); err != nil { - return nil, nil, status.Errorf(codes.Internal, "grpc: error while compressing: %v", err.Error()) - } - z.Close() - } else { - // If Compressor is not set by UseCompressor, use default Compressor - if err := cp.Do(cbuf, b); err != nil { - return nil, nil, status.Errorf(codes.Internal, "grpc: error while compressing: %v", err.Error()) - } - } - b = cbuf.Bytes() + if err := z.Close(); err != nil { + return nil, wrapErr(err) + } + } else { + if err := cp.Do(cbuf, in); err != nil { + return nil, wrapErr(err) } } - if uint(len(b)) > math.MaxUint32 { - return nil, nil, status.Errorf(codes.ResourceExhausted, "grpc: message too large (%d bytes)", len(b)) - } + return cbuf.Bytes(), nil +} - bufHeader := make([]byte, payloadLen+sizeLen) - if compressor != nil || cp != nil { - bufHeader[0] = byte(compressionMade) +const ( + payloadLen = 1 + sizeLen = 4 + headerLen = payloadLen + sizeLen +) + +// msgHeader returns a 5-byte header for the message being transmitted and the +// payload, which is compData if non-nil or data otherwise. +func msgHeader(data, compData []byte) (hdr []byte, payload []byte) { + hdr = make([]byte, headerLen) + if compData != nil { + hdr[0] = byte(compressionMade) + data = compData } else { - bufHeader[0] = byte(compressionNone) + hdr[0] = byte(compressionNone) } - // Write length of b into buf - binary.BigEndian.PutUint32(bufHeader[payloadLen:], uint32(len(b))) - if outPayload != nil { - outPayload.WireLength = payloadLen + sizeLen + len(b) + // Write length of payload into buf + binary.BigEndian.PutUint32(hdr[payloadLen:], uint32(len(data))) + return hdr, data +} + +func outPayload(client bool, msg interface{}, data, payload []byte, t time.Time) *stats.OutPayload { + return &stats.OutPayload{ + Client: client, + Payload: msg, + Data: data, + Length: len(data), + WireLength: len(payload) + headerLen, + SentTime: t, } - return bufHeader, b, nil } func checkRecvPayload(pf payloadFormat, recvCompress string, haveCompressor bool) *status.Status { @@ -394,7 +601,7 @@ func checkRecvPayload(pf payloadFormat, recvCompress string, haveCompressor bool // For the two compressor parameters, both should not be set, but if they are, // dc takes precedence over compressor. // TODO(dfawley): wrap the old compressor/decompressor using the new API? -func recv(p *parser, c Codec, s *transport.Stream, dc Decompressor, m interface{}, maxReceiveMessageSize int, inPayload *stats.InPayload, compressor encoding.Compressor) error { +func recv(p *parser, c baseCodec, s *transport.Stream, dc Decompressor, m interface{}, maxReceiveMessageSize int, inPayload *stats.InPayload, compressor encoding.Compressor) error { pf, d, err := p.recvMsg(maxReceiveMessageSize) if err != nil { return err @@ -489,6 +696,74 @@ func Errorf(c codes.Code, format string, a ...interface{}) error { return status.Errorf(c, format, a...) } +// setCallInfoCodec should only be called after CallOptions have been applied. +func setCallInfoCodec(c *callInfo) error { + if c.codec != nil { + // codec was already set by a CallOption; use it. + return nil + } + + if c.contentSubtype == "" { + // No codec specified in CallOptions; use proto by default. + c.codec = encoding.GetCodec(proto.Name) + return nil + } + + // c.contentSubtype is already lowercased in CallContentSubtype + c.codec = encoding.GetCodec(c.contentSubtype) + if c.codec == nil { + return status.Errorf(codes.Internal, "no codec registered for content-subtype %s", c.contentSubtype) + } + return nil +} + +// parseDialTarget returns the network and address to pass to dialer +func parseDialTarget(target string) (net string, addr string) { + net = "tcp" + + m1 := strings.Index(target, ":") + m2 := strings.Index(target, ":/") + + // handle unix:addr which will fail with url.Parse + if m1 >= 0 && m2 < 0 { + if n := target[0:m1]; n == "unix" { + net = n + addr = target[m1+1:] + return net, addr + } + } + if m2 >= 0 { + t, err := url.Parse(target) + if err != nil { + return net, target + } + scheme := t.Scheme + addr = t.Path + if scheme == "unix" { + net = scheme + if addr == "" { + addr = t.Host + } + return net, addr + } + } + + return net, target +} + +// channelzData is used to store channelz related data for ClientConn, addrConn and Server. +// These fields cannot be embedded in the original structs (e.g. ClientConn), since to do atomic +// operation on int64 variable on 32-bit machine, user is responsible to enforce memory alignment. +// Here, by grouping those int64 fields inside a struct, we are enforcing the alignment. +type channelzData struct { + callsStarted int64 + callsFailed int64 + callsSucceeded int64 + // lastCallStartedTime stores the timestamp that last call starts. It is of int64 type instead of + // time.Time since it's more costly to atomically update time.Time variable than int64 variable. + lastCallStartedTime int64 +} + // The SupportPackageIsVersion variables are referenced from generated protocol // buffer files to ensure compatibility with the gRPC version used. The latest // support package version is 5. @@ -503,7 +778,4 @@ const ( SupportPackageIsVersion5 = true ) -// Version is the current grpc version. -const Version = "1.10.0-dev" - const grpcUA = "grpc-go/" + Version diff --git a/vendor/google.golang.org/grpc/server.go b/vendor/google.golang.org/grpc/server.go index f651621685e5..5c7d5b635372 100644 --- a/vendor/google.golang.org/grpc/server.go +++ b/vendor/google.golang.org/grpc/server.go @@ -30,24 +30,26 @@ import ( "runtime" "strings" "sync" + "sync/atomic" "time" "io/ioutil" "golang.org/x/net/context" - "golang.org/x/net/http2" "golang.org/x/net/trace" + "google.golang.org/grpc/codes" "google.golang.org/grpc/credentials" "google.golang.org/grpc/encoding" + "google.golang.org/grpc/encoding/proto" "google.golang.org/grpc/grpclog" - "google.golang.org/grpc/internal" + "google.golang.org/grpc/internal/channelz" + "google.golang.org/grpc/internal/transport" "google.golang.org/grpc/keepalive" "google.golang.org/grpc/metadata" "google.golang.org/grpc/stats" "google.golang.org/grpc/status" "google.golang.org/grpc/tap" - "google.golang.org/grpc/transport" ) const ( @@ -96,16 +98,20 @@ type Server struct { m map[string]*service // service name -> service info events trace.EventLog - quit chan struct{} - done chan struct{} - quitOnce sync.Once - doneOnce sync.Once - serveWG sync.WaitGroup // counts active Serve goroutines for GracefulStop + quit chan struct{} + done chan struct{} + quitOnce sync.Once + doneOnce sync.Once + channelzRemoveOnce sync.Once + serveWG sync.WaitGroup // counts active Serve goroutines for GracefulStop + + channelzID int64 // channelz unique identification number + czData *channelzData } type options struct { creds credentials.TransportCredentials - codec Codec + codec baseCodec cp Compressor dc Decompressor unaryInt UnaryServerInterceptor @@ -115,7 +121,6 @@ type options struct { maxConcurrentStreams uint32 maxReceiveMessageSize int maxSendMessageSize int - useHandlerImpl bool // use http.Handler-based server unknownStreamDesc *StreamDesc keepaliveParams keepalive.ServerParameters keepalivePolicy keepalive.EnforcementPolicy @@ -124,19 +129,25 @@ type options struct { writeBufferSize int readBufferSize int connectionTimeout time.Duration + maxHeaderListSize *uint32 } var defaultServerOptions = options{ maxReceiveMessageSize: defaultServerMaxReceiveMessageSize, maxSendMessageSize: defaultServerMaxSendMessageSize, connectionTimeout: 120 * time.Second, + writeBufferSize: defaultWriteBufSize, + readBufferSize: defaultReadBufSize, } // A ServerOption sets options such as credentials, codec and keepalive parameters, etc. type ServerOption func(*options) -// WriteBufferSize lets you set the size of write buffer, this determines how much data can be batched -// before doing a write on the wire. +// WriteBufferSize determines how much data can be batched before doing a write on the wire. +// The corresponding memory allocation for this buffer will be twice the size to keep syscalls low. +// The default value for this buffer is 32KB. +// Zero will disable the write buffer such that each write will be on underlying connection. +// Note: A Send call may not directly translate to a write. func WriteBufferSize(s int) ServerOption { return func(o *options) { o.writeBufferSize = s @@ -145,6 +156,9 @@ func WriteBufferSize(s int) ServerOption { // ReadBufferSize lets you set the size of read buffer, this determines how much data can be read at most // for one read syscall. +// The default value for this buffer is 32KB. +// Zero will disable read buffer for a connection so data framer can access the underlying +// conn directly. func ReadBufferSize(s int) ServerOption { return func(o *options) { o.readBufferSize = s @@ -182,6 +196,8 @@ func KeepaliveEnforcementPolicy(kep keepalive.EnforcementPolicy) ServerOption { } // CustomCodec returns a ServerOption that sets a codec for message marshaling and unmarshaling. +// +// This will override any lookups by content-subtype for Codecs registered with RegisterCodec. func CustomCodec(codec Codec) ServerOption { return func(o *options) { o.codec = codec @@ -213,7 +229,9 @@ func RPCDecompressor(dc Decompressor) ServerOption { } // MaxMsgSize returns a ServerOption to set the max message size in bytes the server can receive. -// If this is not set, gRPC uses the default limit. Deprecated: use MaxRecvMsgSize instead. +// If this is not set, gRPC uses the default limit. +// +// Deprecated: use MaxRecvMsgSize instead. func MaxMsgSize(m int) ServerOption { return MaxRecvMsgSize(m) } @@ -320,6 +338,14 @@ func ConnectionTimeout(d time.Duration) ServerOption { } } +// MaxHeaderListSize returns a ServerOption that sets the max (uncompressed) size +// of header list that the server is prepared to accept. +func MaxHeaderListSize(s uint32) ServerOption { + return func(o *options) { + o.maxHeaderListSize = &s + } +} + // NewServer creates a gRPC server which has no service registered and has not // started to accept requests yet. func NewServer(opt ...ServerOption) *Server { @@ -327,23 +353,24 @@ func NewServer(opt ...ServerOption) *Server { for _, o := range opt { o(&opts) } - if opts.codec == nil { - // Set the default codec. - opts.codec = protoCodec{} - } s := &Server{ - lis: make(map[net.Listener]bool), - opts: opts, - conns: make(map[io.Closer]bool), - m: make(map[string]*service), - quit: make(chan struct{}), - done: make(chan struct{}), + lis: make(map[net.Listener]bool), + opts: opts, + conns: make(map[io.Closer]bool), + m: make(map[string]*service), + quit: make(chan struct{}), + done: make(chan struct{}), + czData: new(channelzData), } s.cv = sync.NewCond(&s.mu) if EnableTracing { _, file, line, _ := runtime.Caller(1) s.events = trace.NewEventLog("grpc.Server", fmt.Sprintf("%s:%d", file, line)) } + + if channelz.IsOn() { + s.channelzID = channelz.RegisterServer(&channelzServer{s}, "") + } return s } @@ -459,6 +486,26 @@ func (s *Server) useTransportAuthenticator(rawConn net.Conn) (net.Conn, credenti return s.opts.creds.ServerHandshake(rawConn) } +type listenSocket struct { + net.Listener + channelzID int64 +} + +func (l *listenSocket) ChannelzMetric() *channelz.SocketInternalMetric { + return &channelz.SocketInternalMetric{ + SocketOptions: channelz.GetSocketOption(l.Listener), + LocalAddr: l.Listener.Addr(), + } +} + +func (l *listenSocket) Close() error { + err := l.Listener.Close() + if channelz.IsOn() { + channelz.RemoveEntry(l.channelzID) + } + return err +} + // Serve accepts incoming connections on the listener lis, creating a new // ServerTransport and service goroutine for each. The service goroutines // read gRPC requests and then call the registered handlers to reply to them. @@ -487,13 +534,19 @@ func (s *Server) Serve(lis net.Listener) error { } }() - s.lis[lis] = true + ls := &listenSocket{Listener: lis} + s.lis[ls] = true + + if channelz.IsOn() { + ls.channelzID = channelz.RegisterListenSocket(ls, s.channelzID, "") + } s.mu.Unlock() + defer func() { s.mu.Lock() - if s.lis != nil && s.lis[lis] { - lis.Close() - delete(s.lis, lis) + if s.lis != nil && s.lis[ls] { + ls.Close() + delete(s.lis, ls) } s.mu.Unlock() }() @@ -577,27 +630,19 @@ func (s *Server) handleRawConn(rawConn net.Conn) { } s.mu.Unlock() - var serve func() - c := conn.(io.Closer) - if s.opts.useHandlerImpl { - serve = func() { s.serveUsingHandler(conn) } - } else { - // Finish handshaking (HTTP2) - st := s.newHTTP2Transport(conn, authInfo) - if st == nil { - return - } - c = st - serve = func() { s.serveStreams(st) } + // Finish handshaking (HTTP2) + st := s.newHTTP2Transport(conn, authInfo) + if st == nil { + return } rawConn.SetDeadline(time.Time{}) - if !s.addConn(c) { + if !s.addConn(st) { return } go func() { - serve() - s.removeConn(c) + s.serveStreams(st) + s.removeConn(st) }() } @@ -615,6 +660,8 @@ func (s *Server) newHTTP2Transport(c net.Conn, authInfo credentials.AuthInfo) tr InitialConnWindowSize: s.opts.initialConnWindowSize, WriteBufferSize: s.opts.writeBufferSize, ReadBufferSize: s.opts.readBufferSize, + ChannelzParentID: s.channelzID, + MaxHeaderListSize: s.opts.maxHeaderListSize, } st, err := transport.NewServerTransport("http2", c, config) if err != nil { @@ -625,6 +672,7 @@ func (s *Server) newHTTP2Transport(c net.Conn, authInfo credentials.AuthInfo) tr grpclog.Warningln("grpc: Server.Serve failed to create ServerTransport: ", err) return nil } + return st } @@ -649,27 +697,6 @@ func (s *Server) serveStreams(st transport.ServerTransport) { var _ http.Handler = (*Server)(nil) -// serveUsingHandler is called from handleRawConn when s is configured -// to handle requests via the http.Handler interface. It sets up a -// net/http.Server to handle the just-accepted conn. The http.Server -// is configured to route all incoming requests (all HTTP/2 streams) -// to ServeHTTP, which creates a new ServerTransport for each stream. -// serveUsingHandler blocks until conn closes. -// -// This codepath is only used when Server.TestingUseHandlerImpl has -// been configured. This lets the end2end tests exercise the ServeHTTP -// method as one of the environment types. -// -// conn is the *tls.Conn that's already been authenticated. -func (s *Server) serveUsingHandler(conn net.Conn) { - h2s := &http2.Server{ - MaxConcurrentStreams: s.opts.maxConcurrentStreams, - } - h2s.ServeConn(conn, &http2.ServeConnOpts{ - Handler: s, - }) -} - // ServeHTTP implements the Go standard library's http.Handler // interface by responding to the gRPC request r, by looking up // the requested gRPC method in the gRPC server s. @@ -695,7 +722,7 @@ func (s *Server) serveUsingHandler(conn net.Conn) { // available through grpc-go's HTTP/2 server, and it is currently EXPERIMENTAL // and subject to change. func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { - st, err := transport.NewServerHandlerTransport(w, r) + st, err := transport.NewServerHandlerTransport(w, r, s.opts.statsHandler) if err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) return @@ -752,39 +779,73 @@ func (s *Server) removeConn(c io.Closer) { } } -func (s *Server) sendResponse(t transport.ServerTransport, stream *transport.Stream, msg interface{}, cp Compressor, opts *transport.Options, comp encoding.Compressor) error { - var ( - outPayload *stats.OutPayload - ) - if s.opts.statsHandler != nil { - outPayload = &stats.OutPayload{} +func (s *Server) channelzMetric() *channelz.ServerInternalMetric { + return &channelz.ServerInternalMetric{ + CallsStarted: atomic.LoadInt64(&s.czData.callsStarted), + CallsSucceeded: atomic.LoadInt64(&s.czData.callsSucceeded), + CallsFailed: atomic.LoadInt64(&s.czData.callsFailed), + LastCallStartedTimestamp: time.Unix(0, atomic.LoadInt64(&s.czData.lastCallStartedTime)), } - hdr, data, err := encode(s.opts.codec, msg, cp, outPayload, comp) +} + +func (s *Server) incrCallsStarted() { + atomic.AddInt64(&s.czData.callsStarted, 1) + atomic.StoreInt64(&s.czData.lastCallStartedTime, time.Now().UnixNano()) +} + +func (s *Server) incrCallsSucceeded() { + atomic.AddInt64(&s.czData.callsSucceeded, 1) +} + +func (s *Server) incrCallsFailed() { + atomic.AddInt64(&s.czData.callsFailed, 1) +} + +func (s *Server) sendResponse(t transport.ServerTransport, stream *transport.Stream, msg interface{}, cp Compressor, opts *transport.Options, comp encoding.Compressor) error { + data, err := encode(s.getCodec(stream.ContentSubtype()), msg) if err != nil { grpclog.Errorln("grpc: server failed to encode response: ", err) return err } - if len(data) > s.opts.maxSendMessageSize { - return status.Errorf(codes.ResourceExhausted, "grpc: trying to send message larger than max (%d vs. %d)", len(data), s.opts.maxSendMessageSize) + compData, err := compress(data, cp, comp) + if err != nil { + grpclog.Errorln("grpc: server failed to compress response: ", err) + return err + } + hdr, payload := msgHeader(data, compData) + // TODO(dfawley): should we be checking len(data) instead? + if len(payload) > s.opts.maxSendMessageSize { + return status.Errorf(codes.ResourceExhausted, "grpc: trying to send message larger than max (%d vs. %d)", len(payload), s.opts.maxSendMessageSize) } - err = t.Write(stream, hdr, data, opts) - if err == nil && outPayload != nil { - outPayload.SentTime = time.Now() - s.opts.statsHandler.HandleRPC(stream.Context(), outPayload) + err = t.Write(stream, hdr, payload, opts) + if err == nil && s.opts.statsHandler != nil { + s.opts.statsHandler.HandleRPC(stream.Context(), outPayload(false, msg, data, payload, time.Now())) } return err } func (s *Server) processUnaryRPC(t transport.ServerTransport, stream *transport.Stream, srv *service, md *MethodDesc, trInfo *traceInfo) (err error) { + if channelz.IsOn() { + s.incrCallsStarted() + defer func() { + if err != nil && err != io.EOF { + s.incrCallsFailed() + } else { + s.incrCallsSucceeded() + } + }() + } sh := s.opts.statsHandler if sh != nil { + beginTime := time.Now() begin := &stats.Begin{ - BeginTime: time.Now(), + BeginTime: beginTime, } sh.HandleRPC(stream.Context(), begin) defer func() { end := &stats.End{ - EndTime: time.Now(), + BeginTime: beginTime, + EndTime: time.Now(), } if err != nil && err != io.EOF { end.Error = toRPCErr(err) @@ -858,16 +919,15 @@ func (s *Server) processUnaryRPC(t transport.ServerTransport, stream *transport. switch st := err.(type) { case transport.ConnectionError: // Nothing to do here. - case transport.StreamError: - if e := t.WriteStatus(stream, status.New(st.Code, st.Desc)); e != nil { - grpclog.Warningf("grpc: Server.processUnaryRPC failed to write status %v", e) - } default: panic(fmt.Sprintf("grpc: Unexpected error (%T) from recvMsg: %v", st, st)) } } return err } + if channelz.IsOn() { + t.IncrMsgRecv() + } if st := checkRecvPayload(pf, stream.RecvCompress(), dc != nil || decomp != nil); st != nil { if e := t.WriteStatus(stream, st); e != nil { grpclog.Warningf("grpc: Server.processUnaryRPC failed to write status %v", e) @@ -904,7 +964,7 @@ func (s *Server) processUnaryRPC(t transport.ServerTransport, stream *transport. // java implementation. return status.Errorf(codes.ResourceExhausted, "grpc: received message larger than max (%d vs. %d)", len(req), s.opts.maxReceiveMessageSize) } - if err := s.opts.codec.Unmarshal(req, v); err != nil { + if err := s.getCodec(stream.ContentSubtype()).Unmarshal(req, v); err != nil { return status.Errorf(codes.Internal, "grpc: error unmarshalling request: %v", err) } if inPayload != nil { @@ -918,12 +978,13 @@ func (s *Server) processUnaryRPC(t transport.ServerTransport, stream *transport. } return nil } - reply, appErr := md.Handler(srv.server, stream.Context(), df, s.opts.unaryInt) + ctx := NewContextWithServerTransportStream(stream.Context(), stream) + reply, appErr := md.Handler(srv.server, ctx, df, s.opts.unaryInt) if appErr != nil { appStatus, ok := status.FromError(appErr) if !ok { // Convert appErr if it is not a grpc status error. - appErr = status.Error(convertCode(appErr), appErr.Error()) + appErr = status.Error(codes.Unknown, appErr.Error()) appStatus, _ = status.FromError(appErr) } if trInfo != nil { @@ -938,10 +999,7 @@ func (s *Server) processUnaryRPC(t transport.ServerTransport, stream *transport. if trInfo != nil { trInfo.tr.LazyLog(stringer("OK"), false) } - opts := &transport.Options{ - Last: true, - Delay: false, - } + opts := &transport.Options{Last: true} if err := s.sendResponse(t, stream, reply, cp, opts, comp); err != nil { if err == io.EOF { @@ -956,16 +1014,15 @@ func (s *Server) processUnaryRPC(t transport.ServerTransport, stream *transport. switch st := err.(type) { case transport.ConnectionError: // Nothing to do here. - case transport.StreamError: - if e := t.WriteStatus(stream, status.New(st.Code, st.Desc)); e != nil { - grpclog.Warningf("grpc: Server.processUnaryRPC failed to write status %v", e) - } default: panic(fmt.Sprintf("grpc: Unexpected error (%T) from sendResponse: %v", st, st)) } } return err } + if channelz.IsOn() { + t.IncrMsgSent() + } if trInfo != nil { trInfo.tr.LazyLog(&payload{sent: true, msg: reply}, true) } @@ -976,15 +1033,27 @@ func (s *Server) processUnaryRPC(t transport.ServerTransport, stream *transport. } func (s *Server) processStreamingRPC(t transport.ServerTransport, stream *transport.Stream, srv *service, sd *StreamDesc, trInfo *traceInfo) (err error) { + if channelz.IsOn() { + s.incrCallsStarted() + defer func() { + if err != nil && err != io.EOF { + s.incrCallsFailed() + } else { + s.incrCallsSucceeded() + } + }() + } sh := s.opts.statsHandler if sh != nil { + beginTime := time.Now() begin := &stats.Begin{ - BeginTime: time.Now(), + BeginTime: beginTime, } sh.HandleRPC(stream.Context(), begin) defer func() { end := &stats.End{ - EndTime: time.Now(), + BeginTime: beginTime, + EndTime: time.Now(), } if err != nil && err != io.EOF { end.Error = toRPCErr(err) @@ -992,11 +1061,13 @@ func (s *Server) processStreamingRPC(t transport.ServerTransport, stream *transp sh.HandleRPC(stream.Context(), end) }() } + ctx := NewContextWithServerTransportStream(stream.Context(), stream) ss := &serverStream{ - t: t, - s: stream, - p: &parser{r: stream}, - codec: s.opts.codec, + ctx: ctx, + t: t, + s: stream, + p: &parser{r: stream}, + codec: s.getCodec(stream.ContentSubtype()), maxReceiveMessageSize: s.opts.maxReceiveMessageSize, maxSendMessageSize: s.opts.maxSendMessageSize, trInfo: trInfo, @@ -1062,12 +1133,7 @@ func (s *Server) processStreamingRPC(t transport.ServerTransport, stream *transp if appErr != nil { appStatus, ok := status.FromError(appErr) if !ok { - switch err := appErr.(type) { - case transport.StreamError: - appStatus = status.New(err.Code, err.Desc) - default: - appStatus = status.New(convertCode(appErr), appErr.Error()) - } + appStatus = status.New(codes.Unknown, appErr.Error()) appErr = appStatus.Err() } if trInfo != nil { @@ -1086,7 +1152,6 @@ func (s *Server) processStreamingRPC(t transport.ServerTransport, stream *transp ss.mu.Unlock() } return t.WriteStatus(ss.s, status.New(codes.OK, "")) - } func (s *Server) handleStream(t transport.ServerTransport, stream *transport.Stream, trInfo *traceInfo) { @@ -1168,6 +1233,42 @@ func (s *Server) handleStream(t transport.ServerTransport, stream *transport.Str } } +// The key to save ServerTransportStream in the context. +type streamKey struct{} + +// NewContextWithServerTransportStream creates a new context from ctx and +// attaches stream to it. +// +// This API is EXPERIMENTAL. +func NewContextWithServerTransportStream(ctx context.Context, stream ServerTransportStream) context.Context { + return context.WithValue(ctx, streamKey{}, stream) +} + +// ServerTransportStream is a minimal interface that a transport stream must +// implement. This can be used to mock an actual transport stream for tests of +// handler code that use, for example, grpc.SetHeader (which requires some +// stream to be in context). +// +// See also NewContextWithServerTransportStream. +// +// This API is EXPERIMENTAL. +type ServerTransportStream interface { + Method() string + SetHeader(md metadata.MD) error + SendHeader(md metadata.MD) error + SetTrailer(md metadata.MD) error +} + +// ServerTransportStreamFromContext returns the ServerTransportStream saved in +// ctx. Returns nil if the given context has no stream associated with it +// (which implies it is not an RPC invocation context). +// +// This API is EXPERIMENTAL. +func ServerTransportStreamFromContext(ctx context.Context) ServerTransportStream { + s, _ := ctx.Value(streamKey{}).(ServerTransportStream) + return s +} + // Stop stops the gRPC server. It immediately closes all open // connections and listeners. // It cancels all active RPCs on the server side and the corresponding @@ -1185,6 +1286,12 @@ func (s *Server) Stop() { }) }() + s.channelzRemoveOnce.Do(func() { + if channelz.IsOn() { + channelz.RemoveEntry(s.channelzID) + } + }) + s.mu.Lock() listeners := s.lis s.lis = nil @@ -1223,11 +1330,17 @@ func (s *Server) GracefulStop() { }) }() + s.channelzRemoveOnce.Do(func() { + if channelz.IsOn() { + channelz.RemoveEntry(s.channelzID) + } + }) s.mu.Lock() if s.conns == nil { s.mu.Unlock() return } + for lis := range s.lis { lis.Close() } @@ -1256,10 +1369,20 @@ func (s *Server) GracefulStop() { s.mu.Unlock() } -func init() { - internal.TestingUseHandlerImpl = func(arg interface{}) { - arg.(*Server).opts.useHandlerImpl = true +// contentSubtype must be lowercase +// cannot return nil +func (s *Server) getCodec(contentSubtype string) baseCodec { + if s.opts.codec != nil { + return s.opts.codec + } + if contentSubtype == "" { + return encoding.GetCodec(proto.Name) } + codec := encoding.GetCodec(contentSubtype) + if codec == nil { + return encoding.GetCodec(proto.Name) + } + return codec } // SetHeader sets the header metadata. @@ -1272,8 +1395,8 @@ func SetHeader(ctx context.Context, md metadata.MD) error { if md.Len() == 0 { return nil } - stream, ok := transport.StreamFromContext(ctx) - if !ok { + stream := ServerTransportStreamFromContext(ctx) + if stream == nil { return status.Errorf(codes.Internal, "grpc: failed to fetch the stream from the context %v", ctx) } return stream.SetHeader(md) @@ -1282,15 +1405,11 @@ func SetHeader(ctx context.Context, md metadata.MD) error { // SendHeader sends header metadata. It may be called at most once. // The provided md and headers set by SetHeader() will be sent. func SendHeader(ctx context.Context, md metadata.MD) error { - stream, ok := transport.StreamFromContext(ctx) - if !ok { + stream := ServerTransportStreamFromContext(ctx) + if stream == nil { return status.Errorf(codes.Internal, "grpc: failed to fetch the stream from the context %v", ctx) } - t := stream.ServerTransport() - if t == nil { - grpclog.Fatalf("grpc: SendHeader: %v has no ServerTransport to send header metadata.", stream) - } - if err := t.WriteHeader(stream, md); err != nil { + if err := stream.SendHeader(md); err != nil { return toRPCErr(err) } return nil @@ -1302,9 +1421,27 @@ func SetTrailer(ctx context.Context, md metadata.MD) error { if md.Len() == 0 { return nil } - stream, ok := transport.StreamFromContext(ctx) - if !ok { + stream := ServerTransportStreamFromContext(ctx) + if stream == nil { return status.Errorf(codes.Internal, "grpc: failed to fetch the stream from the context %v", ctx) } return stream.SetTrailer(md) } + +// Method returns the method string for the server context. The returned +// string is in the format of "/service/method". +func Method(ctx context.Context) (string, bool) { + s := ServerTransportStreamFromContext(ctx) + if s == nil { + return "", false + } + return s.Method(), true +} + +type channelzServer struct { + s *Server +} + +func (c *channelzServer) ChannelzMetric() *channelz.ServerInternalMetric { + return c.s.channelzMetric() +} diff --git a/vendor/google.golang.org/grpc/service_config.go b/vendor/google.golang.org/grpc/service_config.go index 53fa88f37936..e0d735265f4a 100644 --- a/vendor/google.golang.org/grpc/service_config.go +++ b/vendor/google.golang.org/grpc/service_config.go @@ -25,6 +25,7 @@ import ( "strings" "time" + "google.golang.org/grpc/codes" "google.golang.org/grpc/grpclog" ) @@ -32,7 +33,8 @@ const maxInt = int(^uint(0) >> 1) // MethodConfig defines the configuration recommended by the service providers for a // particular method. -// DEPRECATED: Users should not use this struct. Service config should be received +// +// Deprecated: Users should not use this struct. Service config should be received // through name resolver, as specified here // https://github.com/grpc/grpc/blob/master/doc/service_config.md type MethodConfig struct { @@ -55,22 +57,98 @@ type MethodConfig struct { // MaxRespSize is the maximum allowed payload size for an individual response in a // stream (server->client) in bytes. MaxRespSize *int + // RetryPolicy configures retry options for the method. + retryPolicy *retryPolicy } // ServiceConfig is provided by the service provider and contains parameters for how // clients that connect to the service should behave. -// DEPRECATED: Users should not use this struct. Service config should be received +// +// Deprecated: Users should not use this struct. Service config should be received // through name resolver, as specified here // https://github.com/grpc/grpc/blob/master/doc/service_config.md type ServiceConfig struct { // LB is the load balancer the service providers recommends. The balancer specified // via grpc.WithBalancer will override this. LB *string - // Methods contains a map for the methods in this service. - // If there is an exact match for a method (i.e. /service/method) in the map, use the corresponding MethodConfig. - // If there's no exact match, look for the default config for the service (/service/) and use the corresponding MethodConfig if it exists. - // Otherwise, the method has no MethodConfig to use. + + // Methods contains a map for the methods in this service. If there is an + // exact match for a method (i.e. /service/method) in the map, use the + // corresponding MethodConfig. If there's no exact match, look for the + // default config for the service (/service/) and use the corresponding + // MethodConfig if it exists. Otherwise, the method has no MethodConfig to + // use. Methods map[string]MethodConfig + + // If a retryThrottlingPolicy is provided, gRPC will automatically throttle + // retry attempts and hedged RPCs when the client’s ratio of failures to + // successes exceeds a threshold. + // + // For each server name, the gRPC client will maintain a token_count which is + // initially set to maxTokens, and can take values between 0 and maxTokens. + // + // Every outgoing RPC (regardless of service or method invoked) will change + // token_count as follows: + // + // - Every failed RPC will decrement the token_count by 1. + // - Every successful RPC will increment the token_count by tokenRatio. + // + // If token_count is less than or equal to maxTokens / 2, then RPCs will not + // be retried and hedged RPCs will not be sent. + retryThrottling *retryThrottlingPolicy +} + +// retryPolicy defines the go-native version of the retry policy defined by the +// service config here: +// https://github.com/grpc/proposal/blob/master/A6-client-retries.md#integration-with-service-config +type retryPolicy struct { + // MaxAttempts is the maximum number of attempts, including the original RPC. + // + // This field is required and must be two or greater. + maxAttempts int + + // Exponential backoff parameters. The initial retry attempt will occur at + // random(0, initialBackoffMS). In general, the nth attempt will occur at + // random(0, + // min(initialBackoffMS*backoffMultiplier**(n-1), maxBackoffMS)). + // + // These fields are required and must be greater than zero. + initialBackoff time.Duration + maxBackoff time.Duration + backoffMultiplier float64 + + // The set of status codes which may be retried. + // + // Status codes are specified as strings, e.g., "UNAVAILABLE". + // + // This field is required and must be non-empty. + // Note: a set is used to store this for easy lookup. + retryableStatusCodes map[codes.Code]bool +} + +type jsonRetryPolicy struct { + MaxAttempts int + InitialBackoff string + MaxBackoff string + BackoffMultiplier float64 + RetryableStatusCodes []codes.Code +} + +// retryThrottlingPolicy defines the go-native version of the retry throttling +// policy defined by the service config here: +// https://github.com/grpc/proposal/blob/master/A6-client-retries.md#integration-with-service-config +type retryThrottlingPolicy struct { + // The number of tokens starts at maxTokens. The token_count will always be + // between 0 and maxTokens. + // + // This field is required and must be greater than zero. + MaxTokens float64 + // The amount of tokens to add on each successful RPC. Typically this will + // be some number between 0 and 1, e.g., 0.1. + // + // This field is required and must be greater than zero. Up to 3 decimal + // places are supported. + TokenRatio float64 } func parseDuration(s *string) (*time.Duration, error) { @@ -140,12 +218,14 @@ type jsonMC struct { Timeout *string MaxRequestMessageBytes *int64 MaxResponseMessageBytes *int64 + RetryPolicy *jsonRetryPolicy } // TODO(lyuxuan): delete this struct after cleaning up old service config implementation. type jsonSC struct { LoadBalancingPolicy *string MethodConfig *[]jsonMC + RetryThrottling *retryThrottlingPolicy } func parseServiceConfig(js string) (ServiceConfig, error) { @@ -156,8 +236,9 @@ func parseServiceConfig(js string) (ServiceConfig, error) { return ServiceConfig{}, err } sc := ServiceConfig{ - LB: rsc.LoadBalancingPolicy, - Methods: make(map[string]MethodConfig), + LB: rsc.LoadBalancingPolicy, + Methods: make(map[string]MethodConfig), + retryThrottling: rsc.RetryThrottling, } if rsc.MethodConfig == nil { return sc, nil @@ -177,6 +258,10 @@ func parseServiceConfig(js string) (ServiceConfig, error) { WaitForReady: m.WaitForReady, Timeout: d, } + if mc.retryPolicy, err = convertRetryPolicy(m.RetryPolicy); err != nil { + grpclog.Warningf("grpc: parseServiceConfig error unmarshaling %s due to %v", js, err) + return ServiceConfig{}, err + } if m.MaxRequestMessageBytes != nil { if *m.MaxRequestMessageBytes > int64(maxInt) { mc.MaxReqSize = newInt(maxInt) @@ -198,9 +283,56 @@ func parseServiceConfig(js string) (ServiceConfig, error) { } } + if sc.retryThrottling != nil { + if sc.retryThrottling.MaxTokens <= 0 || + sc.retryThrottling.MaxTokens >= 1000 || + sc.retryThrottling.TokenRatio <= 0 { + // Illegal throttling config; disable throttling. + sc.retryThrottling = nil + } + } return sc, nil } +func convertRetryPolicy(jrp *jsonRetryPolicy) (p *retryPolicy, err error) { + if jrp == nil { + return nil, nil + } + ib, err := parseDuration(&jrp.InitialBackoff) + if err != nil { + return nil, err + } + mb, err := parseDuration(&jrp.MaxBackoff) + if err != nil { + return nil, err + } + + if jrp.MaxAttempts <= 1 || + *ib <= 0 || + *mb <= 0 || + jrp.BackoffMultiplier <= 0 || + len(jrp.RetryableStatusCodes) == 0 { + grpclog.Warningf("grpc: ignoring retry policy %v due to illegal configuration", jrp) + return nil, nil + } + + rp := &retryPolicy{ + maxAttempts: jrp.MaxAttempts, + initialBackoff: *ib, + maxBackoff: *mb, + backoffMultiplier: jrp.BackoffMultiplier, + retryableStatusCodes: make(map[codes.Code]bool), + } + if rp.maxAttempts > 5 { + // TODO(retry): Make the max maxAttempts configurable. + rp.maxAttempts = 5 + } + for _, code := range jrp.RetryableStatusCodes { + rp.retryableStatusCodes[code] = true + } + return rp, nil +} + func min(a, b *int) *int { if *a < *b { return a diff --git a/vendor/google.golang.org/grpc/stats/stats.go b/vendor/google.golang.org/grpc/stats/stats.go index d5aa2f793bf3..3f13190a0ac6 100644 --- a/vendor/google.golang.org/grpc/stats/stats.go +++ b/vendor/google.golang.org/grpc/stats/stats.go @@ -169,6 +169,8 @@ func (s *OutTrailer) isRPCStats() {} type End struct { // Client is true if this End is from client side. Client bool + // BeginTime is the time when the RPC began. + BeginTime time.Time // EndTime is the time when the RPC ends. EndTime time.Time // Error is the error the RPC ended with. It is an error generated from diff --git a/vendor/google.golang.org/grpc/status/go16.go b/vendor/google.golang.org/grpc/status/go16.go new file mode 100644 index 000000000000..e59b53e82be7 --- /dev/null +++ b/vendor/google.golang.org/grpc/status/go16.go @@ -0,0 +1,42 @@ +// +build go1.6,!go1.7 + +/* + * + * Copyright 2018 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package status + +import ( + "golang.org/x/net/context" + "google.golang.org/grpc/codes" +) + +// FromContextError converts a context error into a Status. It returns a +// Status with codes.OK if err is nil, or a Status with codes.Unknown if err is +// non-nil and not a context error. +func FromContextError(err error) *Status { + switch err { + case nil: + return New(codes.OK, "") + case context.DeadlineExceeded: + return New(codes.DeadlineExceeded, err.Error()) + case context.Canceled: + return New(codes.Canceled, err.Error()) + default: + return New(codes.Unknown, err.Error()) + } +} diff --git a/vendor/google.golang.org/grpc/status/go17.go b/vendor/google.golang.org/grpc/status/go17.go new file mode 100644 index 000000000000..090215149cfb --- /dev/null +++ b/vendor/google.golang.org/grpc/status/go17.go @@ -0,0 +1,44 @@ +// +build go1.7 + +/* + * + * Copyright 2018 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package status + +import ( + "context" + + netctx "golang.org/x/net/context" + "google.golang.org/grpc/codes" +) + +// FromContextError converts a context error into a Status. It returns a +// Status with codes.OK if err is nil, or a Status with codes.Unknown if err is +// non-nil and not a context error. +func FromContextError(err error) *Status { + switch err { + case nil: + return New(codes.OK, "") + case context.DeadlineExceeded, netctx.DeadlineExceeded: + return New(codes.DeadlineExceeded, err.Error()) + case context.Canceled, netctx.Canceled: + return New(codes.Canceled, err.Error()) + default: + return New(codes.Unknown, err.Error()) + } +} diff --git a/vendor/google.golang.org/grpc/status/status.go b/vendor/google.golang.org/grpc/status/status.go index d9defaebcf54..897321babffd 100644 --- a/vendor/google.golang.org/grpc/status/status.go +++ b/vendor/google.golang.org/grpc/status/status.go @@ -46,7 +46,7 @@ func (se *statusError) Error() string { return fmt.Sprintf("rpc error: code = %s desc = %s", codes.Code(p.GetCode()), p.GetMessage()) } -func (se *statusError) status() *Status { +func (se *statusError) GRPCStatus() *Status { return &Status{s: (*spb.Status)(se)} } @@ -120,15 +120,25 @@ func FromProto(s *spb.Status) *Status { } // FromError returns a Status representing err if it was produced from this -// package, otherwise it returns nil, false. +// package or has a method `GRPCStatus() *Status`. Otherwise, ok is false and a +// Status is returned with codes.Unknown and the original error message. func FromError(err error) (s *Status, ok bool) { if err == nil { return &Status{s: &spb.Status{Code: int32(codes.OK)}}, true } - if se, ok := err.(*statusError); ok { - return se.status(), true + if se, ok := err.(interface { + GRPCStatus() *Status + }); ok { + return se.GRPCStatus(), true } - return nil, false + return New(codes.Unknown, err.Error()), false +} + +// Convert is a convenience function which removes the need to handle the +// boolean return value from FromError. +func Convert(err error) *Status { + s, _ := FromError(err) + return s } // WithDetails returns a new status with the provided details messages appended to the status. @@ -174,8 +184,10 @@ func Code(err error) codes.Code { if err == nil { return codes.OK } - if se, ok := err.(*statusError); ok { - return se.status().Code() + if se, ok := err.(interface { + GRPCStatus() *Status + }); ok { + return se.GRPCStatus().Code() } return codes.Unknown } diff --git a/vendor/google.golang.org/grpc/stream.go b/vendor/google.golang.org/grpc/stream.go index 7d65b29c3772..492b650d59d0 100644 --- a/vendor/google.golang.org/grpc/stream.go +++ b/vendor/google.golang.org/grpc/stream.go @@ -21,6 +21,8 @@ package grpc import ( "errors" "io" + "math" + "strconv" "sync" "time" @@ -29,14 +31,20 @@ import ( "google.golang.org/grpc/balancer" "google.golang.org/grpc/codes" "google.golang.org/grpc/encoding" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/internal/channelz" + "google.golang.org/grpc/internal/grpcrand" + "google.golang.org/grpc/internal/transport" "google.golang.org/grpc/metadata" "google.golang.org/grpc/stats" "google.golang.org/grpc/status" - "google.golang.org/grpc/transport" ) // StreamHandler defines the handler called by gRPC server to complete the -// execution of a streaming RPC. +// execution of a streaming RPC. If a StreamHandler returns an error, it +// should be produced by the status package, or else gRPC will use +// codes.Unknown as the status code and err.Error() as the status message +// of the RPC. type StreamHandler func(srv interface{}, stream ServerStream) error // StreamDesc represents a streaming RPC service's method specification. @@ -50,30 +58,21 @@ type StreamDesc struct { } // Stream defines the common interface a client or server stream has to satisfy. +// +// Deprecated: See ClientStream and ServerStream documentation instead. type Stream interface { - // Context returns the context for this stream. + // Deprecated: See ClientStream and ServerStream documentation instead. Context() context.Context - // SendMsg blocks until it sends m, the stream is done or the stream - // breaks. - // On error, it aborts the stream and returns an RPC status on client - // side. On server side, it simply returns the error to the caller. - // SendMsg is called by generated code. Also Users can call SendMsg - // directly when it is really needed in their use cases. - // It's safe to have a goroutine calling SendMsg and another goroutine calling - // recvMsg on the same stream at the same time. - // But it is not safe to call SendMsg on the same stream in different goroutines. + // Deprecated: See ClientStream and ServerStream documentation instead. SendMsg(m interface{}) error - // RecvMsg blocks until it receives a message or the stream is - // done. On client side, it returns io.EOF when the stream is done. On - // any other error, it aborts the stream and returns an RPC status. On - // server side, it simply returns the error to the caller. - // It's safe to have a goroutine calling SendMsg and another goroutine calling - // recvMsg on the same stream at the same time. - // But it is not safe to call RecvMsg on the same stream in different goroutines. + // Deprecated: See ClientStream and ServerStream documentation instead. RecvMsg(m interface{}) error } -// ClientStream defines the interface a client stream has to satisfy. +// ClientStream defines the client-side behavior of a streaming RPC. +// +// All errors returned from ClientStream methods are compatible with the +// status package. type ClientStream interface { // Header returns the header metadata received from the server if there // is any. It blocks if the metadata is not ready to read. @@ -85,54 +84,104 @@ type ClientStream interface { // CloseSend closes the send direction of the stream. It closes the stream // when non-nil error is met. CloseSend() error - // Stream.SendMsg() may return a non-nil error when something wrong happens sending - // the request. The returned error indicates the status of this sending, not the final - // status of the RPC. - // Always call Stream.RecvMsg() to get the final status if you care about the status of - // the RPC. - Stream + // Context returns the context for this stream. + // + // It should not be called until after Header or RecvMsg has returned. Once + // called, subsequent client-side retries are disabled. + Context() context.Context + // SendMsg is generally called by generated code. On error, SendMsg aborts + // the stream. If the error was generated by the client, the status is + // returned directly; otherwise, io.EOF is returned and the status of + // the stream may be discovered using RecvMsg. + // + // SendMsg blocks until: + // - There is sufficient flow control to schedule m with the transport, or + // - The stream is done, or + // - The stream breaks. + // + // SendMsg does not wait until the message is received by the server. An + // untimely stream closure may result in lost messages. To ensure delivery, + // users should ensure the RPC completed successfully using RecvMsg. + // + // It is safe to have a goroutine calling SendMsg and another goroutine + // calling RecvMsg on the same stream at the same time, but it is not safe + // to call SendMsg on the same stream in different goroutines. + SendMsg(m interface{}) error + // RecvMsg blocks until it receives a message into m or the stream is + // done. It returns io.EOF when the stream completes successfully. On + // any other error, the stream is aborted and the error contains the RPC + // status. + // + // It is safe to have a goroutine calling SendMsg and another goroutine + // calling RecvMsg on the same stream at the same time, but it is not + // safe to call RecvMsg on the same stream in different goroutines. + RecvMsg(m interface{}) error } // NewStream creates a new Stream for the client side. This is typically -// called by generated code. +// called by generated code. ctx is used for the lifetime of the stream. +// +// To ensure resources are not leaked due to the stream returned, one of the following +// actions must be performed: +// +// 1. Call Close on the ClientConn. +// 2. Cancel the context provided. +// 3. Call RecvMsg until a non-nil error is returned. A protobuf-generated +// client-streaming RPC, for instance, might use the helper function +// CloseAndRecv (note that CloseSend does not Recv, therefore is not +// guaranteed to release all resources). +// 4. Receive a non-nil, non-io.EOF error from Header or SendMsg. +// +// If none of the above happen, a goroutine and a context will be leaked, and grpc +// will not call the optionally-configured stats handler with a stats.End message. func (cc *ClientConn) NewStream(ctx context.Context, desc *StreamDesc, method string, opts ...CallOption) (ClientStream, error) { + // allow interceptor to see all applicable call options, which means those + // configured as defaults from dial option as well as per-call options + opts = combine(cc.dopts.callOptions, opts) + if cc.dopts.streamInt != nil { return cc.dopts.streamInt(ctx, desc, cc, method, newClientStream, opts...) } return newClientStream(ctx, desc, cc, method, opts...) } -// NewClientStream creates a new Stream for the client side. This is typically -// called by generated code. -// -// DEPRECATED: Use ClientConn.NewStream instead. +// NewClientStream is a wrapper for ClientConn.NewStream. func NewClientStream(ctx context.Context, desc *StreamDesc, cc *ClientConn, method string, opts ...CallOption) (ClientStream, error) { return cc.NewStream(ctx, desc, method, opts...) } func newClientStream(ctx context.Context, desc *StreamDesc, cc *ClientConn, method string, opts ...CallOption) (_ ClientStream, err error) { - var ( - t transport.ClientTransport - s *transport.Stream - done func(balancer.DoneInfo) - cancel context.CancelFunc - ) + if channelz.IsOn() { + cc.incrCallsStarted() + defer func() { + if err != nil { + cc.incrCallsFailed() + } + }() + } c := defaultCallInfo() mc := cc.GetMethodConfig(method) if mc.WaitForReady != nil { c.failFast = !*mc.WaitForReady } + // Possible context leak: + // The cancel function for the child context we create will only be called + // when RecvMsg returns a non-nil error, if the ClientConn is closed, or if + // an error is generated by SendMsg. + // https://github.com/grpc/grpc-go/issues/1818. + var cancel context.CancelFunc if mc.Timeout != nil && *mc.Timeout >= 0 { ctx, cancel = context.WithTimeout(ctx, *mc.Timeout) - defer func() { - if err != nil { - cancel() - } - }() + } else { + ctx, cancel = context.WithCancel(ctx) } + defer func() { + if err != nil { + cancel() + } + }() - opts = append(cc.dopts.callOptions, opts...) for _, o := range opts { if err := o.before(c); err != nil { return nil, toRPCErr(err) @@ -140,15 +189,14 @@ func newClientStream(ctx context.Context, desc *StreamDesc, cc *ClientConn, meth } c.maxSendMessageSize = getMaxSize(mc.MaxReqSize, c.maxSendMessageSize, defaultClientMaxSendMessageSize) c.maxReceiveMessageSize = getMaxSize(mc.MaxRespSize, c.maxReceiveMessageSize, defaultClientMaxReceiveMessageSize) + if err := setCallInfoCodec(c); err != nil { + return nil, err + } callHdr := &transport.CallHdr{ - Host: cc.authority, - Method: method, - // If it's not client streaming, we should already have the request to be sent, - // so we don't flush the header. - // If it's client streaming, the user may never send a request or send it any - // time soon, so we ask the transport to flush the header. - Flush: desc.ClientStreams, + Host: cc.authority, + Method: method, + ContentSubtype: c.contentSubtype, } // Set our outgoing compression according to the UseCompressor CallOption, if @@ -181,391 +229,628 @@ func newClientStream(ctx context.Context, desc *StreamDesc, cc *ClientConn, meth } trInfo.tr.LazyLog(&trInfo.firstLine, false) ctx = trace.NewContext(ctx, trInfo.tr) - defer func() { - if err != nil { - // Need to call tr.finish() if error is returned. - // Because tr will not be returned to caller. - trInfo.tr.LazyPrintf("RPC: [%v]", err) - trInfo.tr.SetError() - trInfo.tr.Finish() - } - }() } ctx = newContextWithRPCInfo(ctx, c.failFast) sh := cc.dopts.copts.StatsHandler + var beginTime time.Time if sh != nil { ctx = sh.TagRPC(ctx, &stats.RPCTagInfo{FullMethodName: method, FailFast: c.failFast}) + beginTime = time.Now() begin := &stats.Begin{ Client: true, - BeginTime: time.Now(), + BeginTime: beginTime, FailFast: c.failFast, } sh.HandleRPC(ctx, begin) - defer func() { - if err != nil { - // Only handle end stats if err != nil. - end := &stats.End{ - Client: true, - Error: err, - } - sh.HandleRPC(ctx, end) - } - }() } - for { - // Check to make sure the context has expired. This will prevent us from - // looping forever if an error occurs for wait-for-ready RPCs where no data - // is sent on the wire. - select { - case <-ctx.Done(): - return nil, toRPCErr(ctx.Err()) - default: - } + cs := &clientStream{ + callHdr: callHdr, + ctx: ctx, + methodConfig: &mc, + opts: opts, + callInfo: c, + cc: cc, + desc: desc, + codec: c.codec, + cp: cp, + comp: comp, + cancel: cancel, + beginTime: beginTime, + firstAttempt: true, + } + if !cc.dopts.disableRetry { + cs.retryThrottler = cc.retryThrottler.Load().(*retryThrottler) + } - t, done, err = cc.getTransport(ctx, c.failFast) - if err != nil { - return nil, err - } + cs.callInfo.stream = cs + // Only this initial attempt has stats/tracing. + // TODO(dfawley): move to newAttempt when per-attempt stats are implemented. + if err := cs.newAttemptLocked(sh, trInfo); err != nil { + cs.finish(err) + return nil, err + } - s, err = t.NewStream(ctx, callHdr) - if err != nil { - if done != nil { - doneInfo := balancer.DoneInfo{Err: err} - if _, ok := err.(transport.ConnectionError); ok { - // If error is connection error, transport was sending data on wire, - // and we are not sure if anything has been sent on wire. - // If error is not connection error, we are sure nothing has been sent. - doneInfo.BytesSent = true - } - done(doneInfo) - done = nil - } - // In the event of any error from NewStream, we never attempted to write - // anything to the wire, so we can retry indefinitely for non-fail-fast - // RPCs. - if !c.failFast { - continue - } - return nil, toRPCErr(err) - } - break + op := func(a *csAttempt) error { return a.newStream() } + if err := cs.withRetry(op, func() { cs.bufferForRetryLocked(0, op) }); err != nil { + cs.finish(err) + return nil, err } - c.stream = s - cs := &clientStream{ - opts: opts, - c: c, - desc: desc, - codec: cc.dopts.codec, - cp: cp, - dc: cc.dopts.dc, - comp: comp, - cancel: cancel, - - done: done, - t: t, - s: s, - p: &parser{r: s}, - - tracing: EnableTracing, - trInfo: trInfo, - - statsCtx: ctx, - statsHandler: cc.dopts.copts.StatsHandler, - } - // Listen on s.Context().Done() to detect cancellation and s.Done() to detect - // normal termination when there is no pending I/O operations on this stream. - go func() { - select { - case <-t.Error(): - // Incur transport error, simply exit. - case <-cc.ctx.Done(): - cs.finish(ErrClientConnClosing) - cs.closeTransportStream(ErrClientConnClosing) - case <-s.Done(): - // TODO: The trace of the RPC is terminated here when there is no pending - // I/O, which is probably not the optimal solution. - cs.finish(s.Status().Err()) - cs.closeTransportStream(nil) - case <-s.GoAway(): - cs.finish(errConnDrain) - cs.closeTransportStream(errConnDrain) - case <-s.Context().Done(): - err := s.Context().Err() - cs.finish(err) - cs.closeTransportStream(transport.ContextErr(err)) - } - }() + if desc != unaryStreamDesc { + // Listen on cc and stream contexts to cleanup when the user closes the + // ClientConn or cancels the stream context. In all other cases, an error + // should already be injected into the recv buffer by the transport, which + // the client will eventually receive, and then we will cancel the stream's + // context in clientStream.finish. + go func() { + select { + case <-cc.ctx.Done(): + cs.finish(ErrClientConnClosing) + case <-ctx.Done(): + cs.finish(toRPCErr(ctx.Err())) + } + }() + } return cs, nil } +func (cs *clientStream) newAttemptLocked(sh stats.Handler, trInfo traceInfo) error { + cs.attempt = &csAttempt{ + cs: cs, + dc: cs.cc.dopts.dc, + statsHandler: sh, + trInfo: trInfo, + } + + if err := cs.ctx.Err(); err != nil { + return toRPCErr(err) + } + t, done, err := cs.cc.getTransport(cs.ctx, cs.callInfo.failFast, cs.callHdr.Method) + if err != nil { + return err + } + cs.attempt.t = t + cs.attempt.done = done + return nil +} + +func (a *csAttempt) newStream() error { + cs := a.cs + cs.callHdr.PreviousAttempts = cs.numRetries + s, err := a.t.NewStream(cs.ctx, cs.callHdr) + if err != nil { + return toRPCErr(err) + } + cs.attempt.s = s + cs.attempt.p = &parser{r: s} + return nil +} + // clientStream implements a client side Stream. type clientStream struct { - opts []CallOption - c *callInfo + callHdr *transport.CallHdr + opts []CallOption + callInfo *callInfo + cc *ClientConn + desc *StreamDesc + + codec baseCodec + cp Compressor + comp encoding.Compressor + + cancel context.CancelFunc // cancels all attempts + + sentLast bool // sent an end stream + beginTime time.Time + + methodConfig *MethodConfig + + ctx context.Context // the application's context, wrapped by stats/tracing + + retryThrottler *retryThrottler // The throttler active when the RPC began. + + mu sync.Mutex + firstAttempt bool // if true, transparent retry is valid + numRetries int // exclusive of transparent retry attempt(s) + numRetriesSincePushback int // retries since pushback; to reset backoff + finished bool // TODO: replace with atomic cmpxchg or sync.Once? + attempt *csAttempt // the active client stream attempt + // TODO(hedging): hedging will have multiple attempts simultaneously. + committed bool // active attempt committed for retry? + buffer []func(a *csAttempt) error // operations to replay on retry + bufferSize int // current size of buffer +} + +// csAttempt implements a single transport stream attempt within a +// clientStream. +type csAttempt struct { + cs *clientStream t transport.ClientTransport s *transport.Stream p *parser - desc *StreamDesc + done func(balancer.DoneInfo) - codec Codec - cp Compressor + finished bool dc Decompressor - comp encoding.Compressor decomp encoding.Compressor decompSet bool - cancel context.CancelFunc - - tracing bool // set to EnableTracing when the clientStream is created. - - mu sync.Mutex - done func(balancer.DoneInfo) - closed bool - finished bool - // trInfo.tr is set when the clientStream is created (if EnableTracing is true), - // and is set to nil when the clientStream's finish method is called. + mu sync.Mutex // guards trInfo.tr + // trInfo.tr is set when created (if EnableTracing is true), + // and cleared when the finish method is called. trInfo traceInfo - // statsCtx keeps the user context for stats handling. - // All stats collection should use the statsCtx (instead of the stream context) - // so that all the generated stats for a particular RPC can be associated in the processing phase. - statsCtx context.Context statsHandler stats.Handler } +func (cs *clientStream) commitAttemptLocked() { + cs.committed = true + cs.buffer = nil +} + +func (cs *clientStream) commitAttempt() { + cs.mu.Lock() + cs.commitAttemptLocked() + cs.mu.Unlock() +} + +// shouldRetry returns nil if the RPC should be retried; otherwise it returns +// the error that should be returned by the operation. +func (cs *clientStream) shouldRetry(err error) error { + if cs.attempt.s == nil && !cs.callInfo.failFast { + // In the event of any error from NewStream (attempt.s == nil), we + // never attempted to write anything to the wire, so we can retry + // indefinitely for non-fail-fast RPCs. + return nil + } + if cs.finished || cs.committed { + // RPC is finished or committed; cannot retry. + return err + } + // Wait for the trailers. + if cs.attempt.s != nil { + <-cs.attempt.s.Done() + } + if cs.firstAttempt && !cs.callInfo.failFast && (cs.attempt.s == nil || cs.attempt.s.Unprocessed()) { + // First attempt, wait-for-ready, stream unprocessed: transparently retry. + cs.firstAttempt = false + return nil + } + cs.firstAttempt = false + if cs.cc.dopts.disableRetry { + return err + } + + pushback := 0 + hasPushback := false + if cs.attempt.s != nil { + if to, toErr := cs.attempt.s.TrailersOnly(); toErr != nil { + // Context error; stop now. + return toErr + } else if !to { + return err + } + + // TODO(retry): Move down if the spec changes to not check server pushback + // before considering this a failure for throttling. + sps := cs.attempt.s.Trailer()["grpc-retry-pushback-ms"] + if len(sps) == 1 { + var e error + if pushback, e = strconv.Atoi(sps[0]); e != nil || pushback < 0 { + grpclog.Infof("Server retry pushback specified to abort (%q).", sps[0]) + cs.retryThrottler.throttle() // This counts as a failure for throttling. + return err + } + hasPushback = true + } else if len(sps) > 1 { + grpclog.Warningf("Server retry pushback specified multiple values (%q); not retrying.", sps) + cs.retryThrottler.throttle() // This counts as a failure for throttling. + return err + } + } + + var code codes.Code + if cs.attempt.s != nil { + code = cs.attempt.s.Status().Code() + } else { + code = status.Convert(err).Code() + } + + rp := cs.methodConfig.retryPolicy + if rp == nil || !rp.retryableStatusCodes[code] { + return err + } + + // Note: the ordering here is important; we count this as a failure + // only if the code matched a retryable code. + if cs.retryThrottler.throttle() { + return err + } + if cs.numRetries+1 >= rp.maxAttempts { + return err + } + + var dur time.Duration + if hasPushback { + dur = time.Millisecond * time.Duration(pushback) + cs.numRetriesSincePushback = 0 + } else { + fact := math.Pow(rp.backoffMultiplier, float64(cs.numRetriesSincePushback)) + cur := float64(rp.initialBackoff) * fact + if max := float64(rp.maxBackoff); cur > max { + cur = max + } + dur = time.Duration(grpcrand.Int63n(int64(cur))) + cs.numRetriesSincePushback++ + } + + // TODO(dfawley): we could eagerly fail here if dur puts us past the + // deadline, but unsure if it is worth doing. + t := time.NewTimer(dur) + select { + case <-t.C: + cs.numRetries++ + return nil + case <-cs.ctx.Done(): + t.Stop() + return status.FromContextError(cs.ctx.Err()).Err() + } +} + +// Returns nil if a retry was performed and succeeded; error otherwise. +func (cs *clientStream) retryLocked(lastErr error) error { + for { + cs.attempt.finish(lastErr) + if err := cs.shouldRetry(lastErr); err != nil { + cs.commitAttemptLocked() + return err + } + if err := cs.newAttemptLocked(nil, traceInfo{}); err != nil { + return err + } + if lastErr = cs.replayBufferLocked(); lastErr == nil { + return nil + } + } +} + func (cs *clientStream) Context() context.Context { - return cs.s.Context() + cs.commitAttempt() + // No need to lock before using attempt, since we know it is committed and + // cannot change. + return cs.attempt.s.Context() +} + +func (cs *clientStream) withRetry(op func(a *csAttempt) error, onSuccess func()) error { + cs.mu.Lock() + for { + if cs.committed { + cs.mu.Unlock() + return op(cs.attempt) + } + a := cs.attempt + cs.mu.Unlock() + err := op(a) + cs.mu.Lock() + if a != cs.attempt { + // We started another attempt already. + continue + } + if err == io.EOF { + <-a.s.Done() + } + if err == nil || (err == io.EOF && a.s.Status().Code() == codes.OK) { + onSuccess() + cs.mu.Unlock() + return err + } + if err := cs.retryLocked(err); err != nil { + cs.mu.Unlock() + return err + } + } } func (cs *clientStream) Header() (metadata.MD, error) { - m, err := cs.s.Header() + var m metadata.MD + err := cs.withRetry(func(a *csAttempt) error { + var err error + m, err = a.s.Header() + return toRPCErr(err) + }, cs.commitAttemptLocked) if err != nil { - if _, ok := err.(transport.ConnectionError); !ok { - cs.closeTransportStream(err) - } + cs.finish(err) } return m, err } func (cs *clientStream) Trailer() metadata.MD { - return cs.s.Trailer() + // On RPC failure, we never need to retry, because usage requires that + // RecvMsg() returned a non-nil error before calling this function is valid. + // We would have retried earlier if necessary. + // + // Commit the attempt anyway, just in case users are not following those + // directions -- it will prevent races and should not meaningfully impact + // performance. + cs.commitAttempt() + if cs.attempt.s == nil { + return nil + } + return cs.attempt.s.Trailer() } -func (cs *clientStream) SendMsg(m interface{}) (err error) { - if cs.tracing { - cs.mu.Lock() - if cs.trInfo.tr != nil { - cs.trInfo.tr.LazyLog(&payload{sent: true, msg: m}, true) +func (cs *clientStream) replayBufferLocked() error { + a := cs.attempt + for _, f := range cs.buffer { + if err := f(a); err != nil { + return err } - cs.mu.Unlock() } - // TODO Investigate how to signal the stats handling party. - // generate error stats if err != nil && err != io.EOF? + return nil +} + +func (cs *clientStream) bufferForRetryLocked(sz int, op func(a *csAttempt) error) { + // Note: we still will buffer if retry is disabled (for transparent retries). + if cs.committed { + return + } + cs.bufferSize += sz + if cs.bufferSize > cs.callInfo.maxRetryRPCBufferSize { + cs.commitAttemptLocked() + return + } + cs.buffer = append(cs.buffer, op) +} + +func (cs *clientStream) SendMsg(m interface{}) (err error) { defer func() { - if err != nil { + if err != nil && err != io.EOF { + // Call finish on the client stream for errors generated by this SendMsg + // call, as these indicate problems created by this client. (Transport + // errors are converted to an io.EOF error in csAttempt.sendMsg; the real + // error will be returned from RecvMsg eventually in that case, or be + // retried.) cs.finish(err) } - if err == nil { - return - } - if err == io.EOF { - // Specialize the process for server streaming. SendMsg is only called - // once when creating the stream object. io.EOF needs to be skipped when - // the rpc is early finished (before the stream object is created.). - // TODO: It is probably better to move this into the generated code. - if !cs.desc.ClientStreams && cs.desc.ServerStreams { - err = nil - } - return - } - if _, ok := err.(transport.ConnectionError); !ok { - cs.closeTransportStream(err) - } - err = toRPCErr(err) }() - var outPayload *stats.OutPayload - if cs.statsHandler != nil { - outPayload = &stats.OutPayload{ - Client: true, - } + if cs.sentLast { + return status.Errorf(codes.Internal, "SendMsg called after CloseSend") } - hdr, data, err := encode(cs.codec, m, cs.cp, outPayload, cs.comp) + if !cs.desc.ClientStreams { + cs.sentLast = true + } + data, err := encode(cs.codec, m) if err != nil { return err } - if cs.c.maxSendMessageSize == nil { - return status.Errorf(codes.Internal, "callInfo maxSendMessageSize field uninitialized(nil)") + compData, err := compress(data, cs.cp, cs.comp) + if err != nil { + return err + } + hdr, payload := msgHeader(data, compData) + // TODO(dfawley): should we be checking len(data) instead? + if len(payload) > *cs.callInfo.maxSendMessageSize { + return status.Errorf(codes.ResourceExhausted, "trying to send message larger than max (%d vs. %d)", len(payload), *cs.callInfo.maxSendMessageSize) } - if len(data) > *cs.c.maxSendMessageSize { - return status.Errorf(codes.ResourceExhausted, "trying to send message larger than max (%d vs. %d)", len(data), *cs.c.maxSendMessageSize) + op := func(a *csAttempt) error { + err := a.sendMsg(m, hdr, payload, data) + // nil out the message and uncomp when replaying; they are only needed for + // stats which is disabled for subsequent attempts. + m, data = nil, nil + return err } - err = cs.t.Write(cs.s, hdr, data, &transport.Options{Last: false}) - if err == nil && outPayload != nil { - outPayload.SentTime = time.Now() - cs.statsHandler.HandleRPC(cs.statsCtx, outPayload) + return cs.withRetry(op, func() { cs.bufferForRetryLocked(len(hdr)+len(payload), op) }) +} + +func (cs *clientStream) RecvMsg(m interface{}) error { + err := cs.withRetry(func(a *csAttempt) error { + return a.recvMsg(m) + }, cs.commitAttemptLocked) + if err != nil || !cs.desc.ServerStreams { + // err != nil or non-server-streaming indicates end of stream. + cs.finish(err) } return err } -func (cs *clientStream) RecvMsg(m interface{}) (err error) { +func (cs *clientStream) CloseSend() error { + if cs.sentLast { + // TODO: return an error and finish the stream instead, due to API misuse? + return nil + } + cs.sentLast = true + op := func(a *csAttempt) error { + a.t.Write(a.s, nil, nil, &transport.Options{Last: true}) + // Always return nil; io.EOF is the only error that might make sense + // instead, but there is no need to signal the client to call RecvMsg + // as the only use left for the stream after CloseSend is to call + // RecvMsg. This also matches historical behavior. + return nil + } + cs.withRetry(op, func() { cs.bufferForRetryLocked(0, op) }) + // We never returned an error here for reasons. + return nil +} + +func (cs *clientStream) finish(err error) { + if err == io.EOF { + // Ending a stream with EOF indicates a success. + err = nil + } + cs.mu.Lock() + if cs.finished { + cs.mu.Unlock() + return + } + cs.finished = true + cs.commitAttemptLocked() + cs.mu.Unlock() + if err == nil { + cs.retryThrottler.successfulRPC() + } + if channelz.IsOn() { + if err != nil { + cs.cc.incrCallsFailed() + } else { + cs.cc.incrCallsSucceeded() + } + } + if cs.attempt != nil { + cs.attempt.finish(err) + } + // after functions all rely upon having a stream. + if cs.attempt.s != nil { + for _, o := range cs.opts { + o.after(cs.callInfo) + } + } + cs.cancel() +} + +func (a *csAttempt) sendMsg(m interface{}, hdr, payld, data []byte) error { + cs := a.cs + if EnableTracing { + a.mu.Lock() + if a.trInfo.tr != nil { + a.trInfo.tr.LazyLog(&payload{sent: true, msg: m}, true) + } + a.mu.Unlock() + } + if err := a.t.Write(a.s, hdr, payld, &transport.Options{Last: !cs.desc.ClientStreams}); err != nil { + if !cs.desc.ClientStreams { + // For non-client-streaming RPCs, we return nil instead of EOF on error + // because the generated code requires it. finish is not called; RecvMsg() + // will call it with the stream's status independently. + return nil + } + return io.EOF + } + if a.statsHandler != nil { + a.statsHandler.HandleRPC(cs.ctx, outPayload(true, m, data, payld, time.Now())) + } + if channelz.IsOn() { + a.t.IncrMsgSent() + } + return nil +} + +func (a *csAttempt) recvMsg(m interface{}) (err error) { + cs := a.cs var inPayload *stats.InPayload - if cs.statsHandler != nil { + if a.statsHandler != nil { inPayload = &stats.InPayload{ Client: true, } } - if cs.c.maxReceiveMessageSize == nil { - return status.Errorf(codes.Internal, "callInfo maxReceiveMessageSize field uninitialized(nil)") - } - if !cs.decompSet { + if !a.decompSet { // Block until we receive headers containing received message encoding. - if ct := cs.s.RecvCompress(); ct != "" && ct != encoding.Identity { - if cs.dc == nil || cs.dc.Type() != ct { + if ct := a.s.RecvCompress(); ct != "" && ct != encoding.Identity { + if a.dc == nil || a.dc.Type() != ct { // No configured decompressor, or it does not match the incoming // message encoding; attempt to find a registered compressor that does. - cs.dc = nil - cs.decomp = encoding.GetCompressor(ct) + a.dc = nil + a.decomp = encoding.GetCompressor(ct) } } else { // No compression is used; disable our decompressor. - cs.dc = nil + a.dc = nil } // Only initialize this state once per stream. - cs.decompSet = true + a.decompSet = true } - err = recv(cs.p, cs.codec, cs.s, cs.dc, m, *cs.c.maxReceiveMessageSize, inPayload, cs.decomp) - defer func() { - // err != nil indicates the termination of the stream. - if err != nil { - cs.finish(err) - } - }() - if err == nil { - if cs.tracing { - cs.mu.Lock() - if cs.trInfo.tr != nil { - cs.trInfo.tr.LazyLog(&payload{sent: false, msg: m}, true) - } - cs.mu.Unlock() - } - if inPayload != nil { - cs.statsHandler.HandleRPC(cs.statsCtx, inPayload) - } - if !cs.desc.ClientStreams || cs.desc.ServerStreams { - return - } - // Special handling for client streaming rpc. - // This recv expects EOF or errors, so we don't collect inPayload. - if cs.c.maxReceiveMessageSize == nil { - return status.Errorf(codes.Internal, "callInfo maxReceiveMessageSize field uninitialized(nil)") - } - err = recv(cs.p, cs.codec, cs.s, cs.dc, m, *cs.c.maxReceiveMessageSize, nil, cs.decomp) - cs.closeTransportStream(err) - if err == nil { - return toRPCErr(errors.New("grpc: client streaming protocol violation: get , want ")) - } + err = recv(a.p, cs.codec, a.s, a.dc, m, *cs.callInfo.maxReceiveMessageSize, inPayload, a.decomp) + if err != nil { if err == io.EOF { - if se := cs.s.Status().Err(); se != nil { - return se + if statusErr := a.s.Status().Err(); statusErr != nil { + return statusErr } - cs.finish(err) - return nil + return io.EOF // indicates successful end of stream. } return toRPCErr(err) } - if _, ok := err.(transport.ConnectionError); !ok { - cs.closeTransportStream(err) - } - if err == io.EOF { - if statusErr := cs.s.Status().Err(); statusErr != nil { - return statusErr + if EnableTracing { + a.mu.Lock() + if a.trInfo.tr != nil { + a.trInfo.tr.LazyLog(&payload{sent: false, msg: m}, true) } - // Returns io.EOF to indicate the end of the stream. - return + a.mu.Unlock() } - return toRPCErr(err) -} - -func (cs *clientStream) CloseSend() (err error) { - err = cs.t.Write(cs.s, nil, nil, &transport.Options{Last: true}) - defer func() { - if err != nil { - cs.finish(err) - } - }() - if err == nil || err == io.EOF { - return nil + if inPayload != nil { + a.statsHandler.HandleRPC(cs.ctx, inPayload) } - if _, ok := err.(transport.ConnectionError); !ok { - cs.closeTransportStream(err) + if channelz.IsOn() { + a.t.IncrMsgRecv() + } + if cs.desc.ServerStreams { + // Subsequent messages should be received by subsequent RecvMsg calls. + return nil } - err = toRPCErr(err) - return -} -func (cs *clientStream) closeTransportStream(err error) { - cs.mu.Lock() - if cs.closed { - cs.mu.Unlock() - return + // Special handling for non-server-stream rpcs. + // This recv expects EOF or errors, so we don't collect inPayload. + err = recv(a.p, cs.codec, a.s, a.dc, m, *cs.callInfo.maxReceiveMessageSize, nil, a.decomp) + if err == nil { + return toRPCErr(errors.New("grpc: client streaming protocol violation: get , want ")) } - cs.closed = true - cs.mu.Unlock() - cs.t.CloseStream(cs.s, err) + if err == io.EOF { + return a.s.Status().Err() // non-server streaming Recv returns nil on success + } + return toRPCErr(err) } -func (cs *clientStream) finish(err error) { - cs.mu.Lock() - defer cs.mu.Unlock() - if cs.finished { +func (a *csAttempt) finish(err error) { + a.mu.Lock() + if a.finished { + a.mu.Unlock() return } - cs.finished = true - defer func() { - if cs.cancel != nil { - cs.cancel() - } - }() - for _, o := range cs.opts { - o.after(cs.c) + a.finished = true + if err == io.EOF { + // Ending a stream with EOF indicates a success. + err = nil } - if cs.done != nil { - cs.done(balancer.DoneInfo{ + if a.s != nil { + a.t.CloseStream(a.s, err) + } + + if a.done != nil { + br := false + if a.s != nil { + br = a.s.BytesReceived() + } + a.done(balancer.DoneInfo{ Err: err, - BytesSent: true, - BytesReceived: cs.s.BytesReceived(), + BytesSent: a.s != nil, + BytesReceived: br, }) - cs.done = nil } - if cs.statsHandler != nil { + if a.statsHandler != nil { end := &stats.End{ - Client: true, - EndTime: time.Now(), - } - if err != io.EOF { - // end.Error is nil if the RPC finished successfully. - end.Error = toRPCErr(err) + Client: true, + BeginTime: a.cs.beginTime, + EndTime: time.Now(), + Error: err, } - cs.statsHandler.HandleRPC(cs.statsCtx, end) - } - if !cs.tracing { - return + a.statsHandler.HandleRPC(a.cs.ctx, end) } - if cs.trInfo.tr != nil { - if err == nil || err == io.EOF { - cs.trInfo.tr.LazyPrintf("RPC: [OK]") + if a.trInfo.tr != nil { + if err == nil { + a.trInfo.tr.LazyPrintf("RPC: [OK]") } else { - cs.trInfo.tr.LazyPrintf("RPC: [%v]", err) - cs.trInfo.tr.SetError() + a.trInfo.tr.LazyPrintf("RPC: [%v]", err) + a.trInfo.tr.SetError() } - cs.trInfo.tr.Finish() - cs.trInfo.tr = nil + a.trInfo.tr.Finish() + a.trInfo.tr = nil } + a.mu.Unlock() } -// ServerStream defines the interface a server stream has to satisfy. +// ServerStream defines the server-side behavior of a streaming RPC. +// +// All errors returned from ServerStream methods are compatible with the +// status package. type ServerStream interface { // SetHeader sets the header metadata. It may be called multiple times. // When call multiple times, all the provided metadata will be merged. @@ -581,15 +866,41 @@ type ServerStream interface { // SetTrailer sets the trailer metadata which will be sent with the RPC status. // When called more than once, all the provided metadata will be merged. SetTrailer(metadata.MD) - Stream + // Context returns the context for this stream. + Context() context.Context + // SendMsg sends a message. On error, SendMsg aborts the stream and the + // error is returned directly. + // + // SendMsg blocks until: + // - There is sufficient flow control to schedule m with the transport, or + // - The stream is done, or + // - The stream breaks. + // + // SendMsg does not wait until the message is received by the client. An + // untimely stream closure may result in lost messages. + // + // It is safe to have a goroutine calling SendMsg and another goroutine + // calling RecvMsg on the same stream at the same time, but it is not safe + // to call SendMsg on the same stream in different goroutines. + SendMsg(m interface{}) error + // RecvMsg blocks until it receives a message into m or the stream is + // done. It returns io.EOF when the client has performed a CloseSend. On + // any non-EOF error, the stream is aborted and the error contains the + // RPC status. + // + // It is safe to have a goroutine calling SendMsg and another goroutine + // calling RecvMsg on the same stream at the same time, but it is not + // safe to call RecvMsg on the same stream in different goroutines. + RecvMsg(m interface{}) error } // serverStream implements a server side Stream. type serverStream struct { + ctx context.Context t transport.ServerTransport s *transport.Stream p *parser - codec Codec + codec baseCodec cp Compressor dc Decompressor @@ -606,7 +917,7 @@ type serverStream struct { } func (ss *serverStream) Context() context.Context { - return ss.s.Context() + return ss.ctx } func (ss *serverStream) SetHeader(md metadata.MD) error { @@ -625,7 +936,6 @@ func (ss *serverStream) SetTrailer(md metadata.MD) { return } ss.s.SetTrailer(md) - return } func (ss *serverStream) SendMsg(m interface{}) (err error) { @@ -646,24 +956,28 @@ func (ss *serverStream) SendMsg(m interface{}) (err error) { st, _ := status.FromError(toRPCErr(err)) ss.t.WriteStatus(ss.s, st) } + if channelz.IsOn() && err == nil { + ss.t.IncrMsgSent() + } }() - var outPayload *stats.OutPayload - if ss.statsHandler != nil { - outPayload = &stats.OutPayload{} + data, err := encode(ss.codec, m) + if err != nil { + return err } - hdr, data, err := encode(ss.codec, m, ss.cp, outPayload, ss.comp) + compData, err := compress(data, ss.cp, ss.comp) if err != nil { return err } - if len(data) > ss.maxSendMessageSize { - return status.Errorf(codes.ResourceExhausted, "trying to send message larger than max (%d vs. %d)", len(data), ss.maxSendMessageSize) + hdr, payload := msgHeader(data, compData) + // TODO(dfawley): should we be checking len(data) instead? + if len(payload) > ss.maxSendMessageSize { + return status.Errorf(codes.ResourceExhausted, "trying to send message larger than max (%d vs. %d)", len(payload), ss.maxSendMessageSize) } - if err := ss.t.Write(ss.s, hdr, data, &transport.Options{Last: false}); err != nil { + if err := ss.t.Write(ss.s, hdr, payload, &transport.Options{Last: false}); err != nil { return toRPCErr(err) } - if outPayload != nil { - outPayload.SentTime = time.Now() - ss.statsHandler.HandleRPC(ss.s.Context(), outPayload) + if ss.statsHandler != nil { + ss.statsHandler.HandleRPC(ss.s.Context(), outPayload(false, m, data, payload, time.Now())) } return nil } @@ -686,6 +1000,9 @@ func (ss *serverStream) RecvMsg(m interface{}) (err error) { st, _ := status.FromError(toRPCErr(err)) ss.t.WriteStatus(ss.s, st) } + if channelz.IsOn() && err == nil { + ss.t.IncrMsgRecv() + } }() var inPayload *stats.InPayload if ss.statsHandler != nil { @@ -709,9 +1026,5 @@ func (ss *serverStream) RecvMsg(m interface{}) (err error) { // MethodFromServerStream returns the method string for the input stream. // The returned string is in the format of "/service/method". func MethodFromServerStream(stream ServerStream) (string, bool) { - s, ok := transport.StreamFromContext(stream.Context()) - if !ok { - return "", ok - } - return s.Method(), ok + return Method(stream.Context()) } diff --git a/vendor/google.golang.org/grpc/transport/control.go b/vendor/google.golang.org/grpc/transport/control.go deleted file mode 100644 index 0474b09074ba..000000000000 --- a/vendor/google.golang.org/grpc/transport/control.go +++ /dev/null @@ -1,334 +0,0 @@ -/* - * - * Copyright 2014 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package transport - -import ( - "fmt" - "io" - "math" - "sync" - "time" - - "golang.org/x/net/http2" - "golang.org/x/net/http2/hpack" -) - -const ( - // The default value of flow control window size in HTTP2 spec. - defaultWindowSize = 65535 - // The initial window size for flow control. - initialWindowSize = defaultWindowSize // for an RPC - infinity = time.Duration(math.MaxInt64) - defaultClientKeepaliveTime = infinity - defaultClientKeepaliveTimeout = time.Duration(20 * time.Second) - defaultMaxStreamsClient = 100 - defaultMaxConnectionIdle = infinity - defaultMaxConnectionAge = infinity - defaultMaxConnectionAgeGrace = infinity - defaultServerKeepaliveTime = time.Duration(2 * time.Hour) - defaultServerKeepaliveTimeout = time.Duration(20 * time.Second) - defaultKeepalivePolicyMinTime = time.Duration(5 * time.Minute) - // max window limit set by HTTP2 Specs. - maxWindowSize = math.MaxInt32 - // defaultLocalSendQuota sets is default value for number of data - // bytes that each stream can schedule before some of it being - // flushed out. - defaultLocalSendQuota = 128 * 1024 -) - -// The following defines various control items which could flow through -// the control buffer of transport. They represent different aspects of -// control tasks, e.g., flow control, settings, streaming resetting, etc. - -type headerFrame struct { - streamID uint32 - hf []hpack.HeaderField - endStream bool -} - -func (*headerFrame) item() {} - -type continuationFrame struct { - streamID uint32 - endHeaders bool - headerBlockFragment []byte -} - -type dataFrame struct { - streamID uint32 - endStream bool - d []byte - f func() -} - -func (*dataFrame) item() {} - -func (*continuationFrame) item() {} - -type windowUpdate struct { - streamID uint32 - increment uint32 -} - -func (*windowUpdate) item() {} - -type settings struct { - ss []http2.Setting -} - -func (*settings) item() {} - -type settingsAck struct { -} - -func (*settingsAck) item() {} - -type resetStream struct { - streamID uint32 - code http2.ErrCode -} - -func (*resetStream) item() {} - -type goAway struct { - code http2.ErrCode - debugData []byte - headsUp bool - closeConn bool -} - -func (*goAway) item() {} - -type flushIO struct { - closeTr bool -} - -func (*flushIO) item() {} - -type ping struct { - ack bool - data [8]byte -} - -func (*ping) item() {} - -// quotaPool is a pool which accumulates the quota and sends it to acquire() -// when it is available. -type quotaPool struct { - mu sync.Mutex - c chan struct{} - version uint32 - quota int -} - -// newQuotaPool creates a quotaPool which has quota q available to consume. -func newQuotaPool(q int) *quotaPool { - qb := "aPool{ - quota: q, - c: make(chan struct{}, 1), - } - return qb -} - -// add cancels the pending quota sent on acquired, incremented by v and sends -// it back on acquire. -func (qb *quotaPool) add(v int) { - qb.mu.Lock() - defer qb.mu.Unlock() - qb.lockedAdd(v) -} - -func (qb *quotaPool) lockedAdd(v int) { - var wakeUp bool - if qb.quota <= 0 { - wakeUp = true // Wake up potential waiters. - } - qb.quota += v - if wakeUp && qb.quota > 0 { - select { - case qb.c <- struct{}{}: - default: - } - } -} - -func (qb *quotaPool) addAndUpdate(v int) { - qb.mu.Lock() - qb.lockedAdd(v) - qb.version++ - qb.mu.Unlock() -} - -func (qb *quotaPool) get(v int, wc waiters) (int, uint32, error) { - qb.mu.Lock() - if qb.quota > 0 { - if v > qb.quota { - v = qb.quota - } - qb.quota -= v - ver := qb.version - qb.mu.Unlock() - return v, ver, nil - } - qb.mu.Unlock() - for { - select { - case <-wc.ctx.Done(): - return 0, 0, ContextErr(wc.ctx.Err()) - case <-wc.tctx.Done(): - return 0, 0, ErrConnClosing - case <-wc.done: - return 0, 0, io.EOF - case <-wc.goAway: - return 0, 0, errStreamDrain - case <-qb.c: - qb.mu.Lock() - if qb.quota > 0 { - if v > qb.quota { - v = qb.quota - } - qb.quota -= v - ver := qb.version - if qb.quota > 0 { - select { - case qb.c <- struct{}{}: - default: - } - } - qb.mu.Unlock() - return v, ver, nil - - } - qb.mu.Unlock() - } - } -} - -func (qb *quotaPool) compareAndExecute(version uint32, success, failure func()) bool { - qb.mu.Lock() - if version == qb.version { - success() - qb.mu.Unlock() - return true - } - failure() - qb.mu.Unlock() - return false -} - -// inFlow deals with inbound flow control -type inFlow struct { - mu sync.Mutex - // The inbound flow control limit for pending data. - limit uint32 - // pendingData is the overall data which have been received but not been - // consumed by applications. - pendingData uint32 - // The amount of data the application has consumed but grpc has not sent - // window update for them. Used to reduce window update frequency. - pendingUpdate uint32 - // delta is the extra window update given by receiver when an application - // is reading data bigger in size than the inFlow limit. - delta uint32 -} - -// newLimit updates the inflow window to a new value n. -// It assumes that n is always greater than the old limit. -func (f *inFlow) newLimit(n uint32) uint32 { - f.mu.Lock() - defer f.mu.Unlock() - d := n - f.limit - f.limit = n - return d -} - -func (f *inFlow) maybeAdjust(n uint32) uint32 { - if n > uint32(math.MaxInt32) { - n = uint32(math.MaxInt32) - } - f.mu.Lock() - defer f.mu.Unlock() - // estSenderQuota is the receiver's view of the maximum number of bytes the sender - // can send without a window update. - estSenderQuota := int32(f.limit - (f.pendingData + f.pendingUpdate)) - // estUntransmittedData is the maximum number of bytes the sends might not have put - // on the wire yet. A value of 0 or less means that we have already received all or - // more bytes than the application is requesting to read. - estUntransmittedData := int32(n - f.pendingData) // Casting into int32 since it could be negative. - // This implies that unless we send a window update, the sender won't be able to send all the bytes - // for this message. Therefore we must send an update over the limit since there's an active read - // request from the application. - if estUntransmittedData > estSenderQuota { - // Sender's window shouldn't go more than 2^31 - 1 as speecified in the HTTP spec. - if f.limit+n > maxWindowSize { - f.delta = maxWindowSize - f.limit - } else { - // Send a window update for the whole message and not just the difference between - // estUntransmittedData and estSenderQuota. This will be helpful in case the message - // is padded; We will fallback on the current available window(at least a 1/4th of the limit). - f.delta = n - } - return f.delta - } - return 0 -} - -// onData is invoked when some data frame is received. It updates pendingData. -func (f *inFlow) onData(n uint32) error { - f.mu.Lock() - defer f.mu.Unlock() - f.pendingData += n - if f.pendingData+f.pendingUpdate > f.limit+f.delta { - return fmt.Errorf("received %d-bytes data exceeding the limit %d bytes", f.pendingData+f.pendingUpdate, f.limit) - } - return nil -} - -// onRead is invoked when the application reads the data. It returns the window size -// to be sent to the peer. -func (f *inFlow) onRead(n uint32) uint32 { - f.mu.Lock() - defer f.mu.Unlock() - if f.pendingData == 0 { - return 0 - } - f.pendingData -= n - if n > f.delta { - n -= f.delta - f.delta = 0 - } else { - f.delta -= n - n = 0 - } - f.pendingUpdate += n - if f.pendingUpdate >= f.limit/4 { - wu := f.pendingUpdate - f.pendingUpdate = 0 - return wu - } - return 0 -} - -func (f *inFlow) resetPendingUpdate() uint32 { - f.mu.Lock() - defer f.mu.Unlock() - n := f.pendingUpdate - f.pendingUpdate = 0 - return n -} diff --git a/vendor/google.golang.org/grpc/version.go b/vendor/google.golang.org/grpc/version.go new file mode 100644 index 000000000000..a13beb044607 --- /dev/null +++ b/vendor/google.golang.org/grpc/version.go @@ -0,0 +1,22 @@ +/* + * + * Copyright 2018 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package grpc + +// Version is the current grpc version. +const Version = "1.16.0-dev" diff --git a/vendor/google.golang.org/grpc/vet.sh b/vendor/google.golang.org/grpc/vet.sh index 2ad94fed9ccc..4049e27b4528 100755 --- a/vendor/google.golang.org/grpc/vet.sh +++ b/vendor/google.golang.org/grpc/vet.sh @@ -1,5 +1,10 @@ #!/bin/bash +if [[ `uname -a` = *"Darwin"* ]]; then + echo "It seems you are running on Mac. This script does not work on Mac. See https://github.com/grpc/grpc-go/issues/2047" + exit 1 +fi + set -ex # Exit on error; debugging enabled. set -o pipefail # Fail a pipe if any sub-command fails. @@ -8,24 +13,46 @@ die() { exit 1 } -PATH="$GOPATH/bin:$GOROOT/bin:$PATH" +# Check to make sure it's safe to modify the user's git repo. +if git status --porcelain | read; then + die "Uncommitted or untracked files found; commit changes first" +fi -# Check proto in manual runs or cron runs. -if [[ "$TRAVIS" != "true" || "$TRAVIS_EVENT_TYPE" = "cron" ]]; then - check_proto="true" +if [[ -d "${GOPATH}/src" ]]; then + die "\${GOPATH}/src (${GOPATH}/src) exists; this script will delete it." fi -if [ "$1" = "-install" ]; then - go get -d \ - google.golang.org/grpc/... - go get -u \ - github.com/golang/lint/golint \ - golang.org/x/tools/cmd/goimports \ - honnef.co/go/tools/cmd/staticcheck \ - github.com/client9/misspell/cmd/misspell \ - github.com/golang/protobuf/protoc-gen-go - if [[ "$check_proto" = "true" ]]; then - if [[ "$TRAVIS" = "true" ]]; then +# Undo any edits made by this script. +cleanup() { + rm -rf "${GOPATH}/src" + git reset --hard HEAD +} +trap cleanup EXIT + +PATH="${GOPATH}/bin:${GOROOT}/bin:${PATH}" + +if [[ "$1" = "-install" ]]; then + # Check for module support + if go help mod >& /dev/null; then + go install \ + github.com/golang/lint/golint \ + golang.org/x/tools/cmd/goimports \ + honnef.co/go/tools/cmd/staticcheck \ + github.com/client9/misspell/cmd/misspell \ + github.com/golang/protobuf/protoc-gen-go + else + # Ye olde `go get` incantation. + # Note: this gets the latest version of all tools (vs. the pinned versions + # with Go modules). + go get -u \ + github.com/golang/lint/golint \ + golang.org/x/tools/cmd/goimports \ + honnef.co/go/tools/cmd/staticcheck \ + github.com/client9/misspell/cmd/misspell \ + github.com/golang/protobuf/protoc-gen-go + fi + if [[ -z "${VET_SKIP_PROTO}" ]]; then + if [[ "${TRAVIS}" = "true" ]]; then PROTOBUF_VERSION=3.3.0 PROTOC_FILENAME=protoc-${PROTOBUF_VERSION}-linux-x86_64.zip pushd /home/travis @@ -42,43 +69,54 @@ elif [[ "$#" -ne 0 ]]; then die "Unknown argument(s): $*" fi -# TODO: Remove this check and the mangling below once "context" is imported -# directly. -if git status --porcelain | read; then - die "Uncommitted or untracked files found; commit changes first" -fi - git ls-files "*.go" | xargs grep -L "\(Copyright [0-9]\{4,\} gRPC authors\)\|DO NOT EDIT" 2>&1 | tee /dev/stderr | (! read) +git ls-files "*.go" | xargs grep -l '"math/rand"' 2>&1 | (! grep -v '^examples\|^stress\|grpcrand') | tee /dev/stderr | (! read) +git ls-files | xargs dirname | sort | uniq | xargs go run test/go_vet/vet.go | tee /dev/stderr | (! read) gofmt -s -d -l . 2>&1 | tee /dev/stderr | (! read) goimports -l . 2>&1 | tee /dev/stderr | (! read) golint ./... 2>&1 | (grep -vE "(_mock|\.pb)\.go:" || true) | tee /dev/stderr | (! read) -# Undo any edits made by this script. -cleanup() { - git reset --hard HEAD -} -trap cleanup EXIT - # Rewrite golang.org/x/net/context -> context imports (see grpc/grpc-go#1484). # TODO: Remove this mangling once "context" is imported directly (grpc/grpc-go#711). git ls-files "*.go" | xargs sed -i 's:"golang.org/x/net/context":"context":' -set +o pipefail -# TODO: Stop filtering pb.go files once golang/protobuf#214 is fixed. -go tool vet -all . 2>&1 | grep -vE '(clientconn|transport\/transport_test).go:.*cancel (function|var)' | grep -vF '.pb.go:' | tee /dev/stderr | (! read) +set +o pipefail # vet exits with non-zero error if issues are found +go tool vet -all . 2>&1 | grep -vE 'clientconn.go:.*cancel (function|var)' | tee /dev/stderr | (! read) set -o pipefail git reset --hard HEAD -if [[ "$check_proto" = "true" ]]; then - PATH="/home/travis/bin:$PATH" make proto && \ +if [[ -z "${VET_SKIP_PROTO}" ]]; then + PATH="/home/travis/bin:${PATH}" make proto && \ git status --porcelain 2>&1 | (! read) || \ (git status; git --no-pager diff; exit 1) fi +if go help mod >& /dev/null; then + go mod tidy && \ + git status --porcelain 2>&1 | (! read) || \ + (git status; git --no-pager diff; exit 1) +fi + +### HACK HACK HACK: Remove once staticcheck works with modules. +# Make a symlink in ${GOPATH}/src to its ${GOPATH}/pkg/mod equivalent for every package we use. +for x in $(find "${GOPATH}/pkg/mod" -name '*@*' | grep -v \/mod\/cache\/); do + pkg="$(echo ${x#"${GOPATH}/pkg/mod/"} | cut -f1 -d@)"; + # If multiple versions exist, just use the existing one. + if [[ -L "${GOPATH}/src/${pkg}" ]]; then continue; fi + mkdir -p "$(dirname "${GOPATH}/src/${pkg}")"; + ln -s $x "${GOPATH}/src/${pkg}"; +done +### END HACK HACK HACK + # TODO(menghanl): fix errors in transport_test. staticcheck -ignore ' -google.golang.org/grpc/transport/transport_test.go:SA2002 -google.golang.org/grpc/benchmark/benchmain/main.go:SA1019 -google.golang.org/grpc/stats/stats_test.go:SA1019 -google.golang.org/grpc/test/end2end_test.go:SA1019 +internal/transport/transport_test.go:SA2002 +benchmark/benchmain/main.go:SA1019 +stats/stats_test.go:SA1019 +test/end2end_test.go:SA1019 +balancer_test.go:SA1019 +balancer.go:SA1019 +clientconn_test.go:SA1019 +internal/transport/handler_server_test.go:SA1019 +internal/transport/handler_server.go:SA1019 ' ./... misspell -error . diff --git a/vendor/vendor.json b/vendor/vendor.json index df2226742498..f272eaba15da 100644 --- a/vendor/vendor.json +++ b/vendor/vendor.json @@ -41,6 +41,24 @@ {"path":"github.com/docker/go-connections/sockets","checksumSHA1":"jUfDG3VQsA2UZHvvIXncgiddpYA=","revision":"3ede32e2033de7505e6500d6c868c2b9ed9f169d","revisionTime":"2017-06-23T20:36:43Z"}, {"path":"github.com/elazarl/go-bindata-assetfs","checksumSHA1":"5ftkjfUwI9A6xCQ1PwIAd5+qlo0=","revision":"e1a2a7ec64b07d04ac9ebb072404fe8b7b60de1b","revisionTime":"2016-08-03T19:23:04Z"}, {"path":"github.com/elazarl/go-bindata-assetfs/go-bindata-assetfs","checksumSHA1":"CaThXbumVxZtNlItiXma5B78PwQ=","revision":"e1a2a7ec64b07d04ac9ebb072404fe8b7b60de1b","revisionTime":"2016-08-03T19:23:04Z"}, + {"path":"github.com/envoyproxy/go-control-plane/envoy/api/v2","checksumSHA1":"FSibauI37HqkJE62OqfFK3A9Ih0=","revision":"2137d919632883e52e7786f55f0f84e52a44fbf3","revisionTime":"2018-09-19T00:28:55Z"}, + {"path":"github.com/envoyproxy/go-control-plane/envoy/api/v2/auth","checksumSHA1":"MxMRiqLMQ6tZc2DXaFk8RpzZJ1k=","revision":"2137d919632883e52e7786f55f0f84e52a44fbf3","revisionTime":"2018-09-19T00:28:55Z"}, + {"path":"github.com/envoyproxy/go-control-plane/envoy/api/v2/cluster","checksumSHA1":"ktA2ACmea64sl2j4C7ROuDjxwhs=","revision":"2137d919632883e52e7786f55f0f84e52a44fbf3","revisionTime":"2018-09-19T00:28:55Z"}, + {"path":"github.com/envoyproxy/go-control-plane/envoy/api/v2/core","checksumSHA1":"CS7onQ+gKubxzzFNrv2vsnpeg6o=","revision":"2137d919632883e52e7786f55f0f84e52a44fbf3","revisionTime":"2018-09-19T00:28:55Z"}, + {"path":"github.com/envoyproxy/go-control-plane/envoy/api/v2/endpoint","checksumSHA1":"XXTFdEmQ4Z87HD4AM1JRCGAEfmU=","revision":"2137d919632883e52e7786f55f0f84e52a44fbf3","revisionTime":"2018-09-19T00:28:55Z"}, + {"path":"github.com/envoyproxy/go-control-plane/envoy/api/v2/listener","checksumSHA1":"y9mv2tvEpzDmB3VJkwNpaNlRBmU=","revision":"2137d919632883e52e7786f55f0f84e52a44fbf3","revisionTime":"2018-09-19T00:28:55Z"}, + {"path":"github.com/envoyproxy/go-control-plane/envoy/api/v2/route","checksumSHA1":"6rAy2/Yv/q73ZKyowBkNwekOyq4=","revision":"2137d919632883e52e7786f55f0f84e52a44fbf3","revisionTime":"2018-09-19T00:28:55Z"}, + {"path":"github.com/envoyproxy/go-control-plane/envoy/config/filter/accesslog/v2","checksumSHA1":"wic3APn/uIE4QJ4T2VLrik4Dp74=","revision":"2137d919632883e52e7786f55f0f84e52a44fbf3","revisionTime":"2018-09-19T00:28:55Z"}, + {"path":"github.com/envoyproxy/go-control-plane/envoy/config/filter/network/ext_authz/v2","checksumSHA1":"xMDMWQ3xIuECIxAtMtejMCQb2h4=","revision":"2137d919632883e52e7786f55f0f84e52a44fbf3","revisionTime":"2018-09-19T00:28:55Z"}, + {"path":"github.com/envoyproxy/go-control-plane/envoy/config/filter/network/http_connection_manager/v2","checksumSHA1":"aOroSRMbYtLr7X2MpiQi4p+6NBw=","revision":"2137d919632883e52e7786f55f0f84e52a44fbf3","revisionTime":"2018-09-19T00:28:55Z"}, + {"path":"github.com/envoyproxy/go-control-plane/envoy/config/filter/network/tcp_proxy/v2","checksumSHA1":"TTgpFT45GfVXcGje4qGCssF+LxI=","revision":"2137d919632883e52e7786f55f0f84e52a44fbf3","revisionTime":"2018-09-19T00:28:55Z"}, + {"path":"github.com/envoyproxy/go-control-plane/envoy/service/auth/v2alpha","checksumSHA1":"2J3zPDTsC3HtOc6RDCWf2TALvfc=","revision":"2137d919632883e52e7786f55f0f84e52a44fbf3","revisionTime":"2018-09-19T00:28:55Z"}, + {"path":"github.com/envoyproxy/go-control-plane/envoy/service/discovery/v2","checksumSHA1":"3DwfQPZMC1i4ZrvpB2mMZRZ7SHI=","revision":"2137d919632883e52e7786f55f0f84e52a44fbf3","revisionTime":"2018-09-19T00:28:55Z"}, + {"path":"github.com/envoyproxy/go-control-plane/envoy/type","checksumSHA1":"8DtGIr6Z3Alnd5s+htx1MgDZVoo=","revision":"2137d919632883e52e7786f55f0f84e52a44fbf3","revisionTime":"2018-09-19T00:28:55Z"}, + {"path":"github.com/envoyproxy/go-control-plane/pkg/cache","checksumSHA1":"hAUeY2SDlc1qkYBal5DtrlKkPyM=","revision":"2137d919632883e52e7786f55f0f84e52a44fbf3","revisionTime":"2018-09-19T00:28:55Z"}, + {"path":"github.com/envoyproxy/go-control-plane/pkg/log","checksumSHA1":"dS2Ygpy2UCR0+3pDbQ044t/Bzew=","revision":"2137d919632883e52e7786f55f0f84e52a44fbf3","revisionTime":"2018-09-19T00:28:55Z"}, + {"path":"github.com/envoyproxy/go-control-plane/pkg/server","checksumSHA1":"V0F+pAe0C96OntiM4PC+nL4ff8o=","revision":"2137d919632883e52e7786f55f0f84e52a44fbf3","revisionTime":"2018-09-19T00:28:55Z"}, + {"path":"github.com/envoyproxy/go-control-plane/pkg/util","checksumSHA1":"wSN1NcSo9HdIigbVddGZ5xVxnzo=","revision":"2137d919632883e52e7786f55f0f84e52a44fbf3","revisionTime":"2018-09-19T00:28:55Z"}, {"path":"github.com/fatih/structs","checksumSHA1":"5BP5xofo0GoFi6FtgqFFbmHyUKI=","revision":"ebf56d35bba727c68ac77f56f2fcf90b181851aa","revisionTime":"2018-01-23T06:50:59Z"}, {"path":"github.com/go-ole/go-ole","checksumSHA1":"oyULO1B/l2OLy2xereo+2w3hYk4=","revision":"02d3668a0cf01f58411cc85cd37c174c257ec7c2","revisionTime":"2017-06-01T13:56:11Z"}, {"path":"github.com/go-ole/go-ole/oleutil","checksumSHA1":"IvdiJE1NIogRmGi3WmteEKZQJB8=","revision":"5e9c030faf78847db7aa77e3661b9cc449de29b7","revisionTime":"2016-11-16T06:46:58Z"}, @@ -49,7 +67,16 @@ {"path":"github.com/gocql/gocql/internal/lru","checksumSHA1":"7RlYIbPYgPkxDDCSEuE6bvYEEeU=","revision":"e06f8c1bcd787e6bf0608288b314522f08cc7848","revisionTime":"2018-06-17T11:57:10Z"}, {"path":"github.com/gocql/gocql/internal/murmur","checksumSHA1":"1D3fnN8dRoLJxWKxKGGCfz6cJXg=","revision":"e06f8c1bcd787e6bf0608288b314522f08cc7848","revisionTime":"2018-06-17T11:57:10Z"}, {"path":"github.com/gocql/gocql/internal/streams","checksumSHA1":"5GTGKm0C5aLdu9tynZQWQEQqRes=","revision":"e06f8c1bcd787e6bf0608288b314522f08cc7848","revisionTime":"2018-06-17T11:57:10Z"}, + {"path":"github.com/gogo/googleapis/google/api","checksumSHA1":"Dkuhvi5lEltaq1PmJmDTSi+09nU=","revision":"8558fb44d2f1fc223118afc694129d2c2d2924d1","revisionTime":"2018-08-13T11:20:41Z"}, + {"path":"github.com/gogo/googleapis/google/rpc","checksumSHA1":"fjbiOYNq9Dmp9Bx3xMoQFWuoKaM=","revision":"8558fb44d2f1fc223118afc694129d2c2d2924d1","revisionTime":"2018-08-13T11:20:41Z"}, + {"path":"github.com/gogo/protobuf/gogoproto","checksumSHA1":"FhEC1RwKSm/8jvTI2MKlzDVz+Vs=","revision":"e14cafb6a2c249986e51c4b65c3206bf18578715","revisionTime":"2018-09-14T05:40:05Z"}, + {"path":"github.com/gogo/protobuf/jsonpb","checksumSHA1":"ElpAMJyh/b5cUiFCJ+MjtKYfFAo=","revision":"e14cafb6a2c249986e51c4b65c3206bf18578715","revisionTime":"2018-09-14T05:40:05Z"}, + {"path":"github.com/gogo/protobuf/proto","checksumSHA1":"47nJ3iu1bVvK9jPXwAinFYr4mBU=","revision":"e14cafb6a2c249986e51c4b65c3206bf18578715","revisionTime":"2018-09-14T05:40:05Z"}, + {"path":"github.com/gogo/protobuf/protoc-gen-gogo/descriptor","checksumSHA1":"4R7X2wRYYOxdXsoXOEcyBoCakb8=","revision":"e14cafb6a2c249986e51c4b65c3206bf18578715","revisionTime":"2018-09-14T05:40:05Z"}, + {"path":"github.com/gogo/protobuf/sortkeys","checksumSHA1":"HPVQZu059/Rfw2bAWM538bVTcUc=","revision":"e14cafb6a2c249986e51c4b65c3206bf18578715","revisionTime":"2018-09-14T05:40:05Z"}, + {"path":"github.com/gogo/protobuf/types","checksumSHA1":"yK31P3hm7p5eA5PczMByhK0Tj2U=","revision":"e14cafb6a2c249986e51c4b65c3206bf18578715","revisionTime":"2018-09-14T05:40:05Z"}, {"path":"github.com/golang/protobuf/proto","checksumSHA1":"Pyou8mceOASSFxc7GeXZuVdSMi0=","revision":"b4deda0973fb4c70b50d226b1af49f3da59f5265","revisionTime":"2018-04-30T18:52:41Z","version":"v1.1.0","versionExact":"v1.1.0"}, + {"path":"github.com/golang/protobuf/protoc-gen-go/descriptor","checksumSHA1":"fXNL9CT3MIlkdLUCn83Aon7QVAU=","revision":"7716a980bceefe9a0213654823d9ea62d23b87a2","revisionTime":"2018-09-19T22:46:59Z"}, {"path":"github.com/golang/protobuf/ptypes","checksumSHA1":"VfkiItDBFFkZluaAMAzJipDXNBY=","revision":"1e59b77b52bf8e4b449a57e6f79f21226d571845","revisionTime":"2017-11-13T18:07:20Z"}, {"path":"github.com/golang/protobuf/ptypes/any","checksumSHA1":"UB9scpDxeFjQe5tEthuR4zCLRu4=","revision":"1e59b77b52bf8e4b449a57e6f79f21226d571845","revisionTime":"2017-11-13T18:07:20Z"}, {"path":"github.com/golang/protobuf/ptypes/duration","checksumSHA1":"hUjAj0dheFVDl84BAnSWj9qy2iY=","revision":"1e59b77b52bf8e4b449a57e6f79f21226d571845","revisionTime":"2017-11-13T18:07:20Z"}, @@ -177,6 +204,7 @@ {"path":"github.com/kr/text","checksumSHA1":"SbguDK5lY8uhaHNrmJmNbiWIGM0=","revision":"e2ffdb16a802fe2bb95e2e35ff34f0e53aeef34f","revisionTime":"2018-05-06T08:24:08Z"}, {"path":"github.com/lib/pq","checksumSHA1":"s6eyIXpJ7VAU06FM27GcEBM/5lo=","revision":"90697d60dd844d5ef6ff15135d0203f65d2f53b8","revisionTime":"2018-05-23T17:54:26Z"}, {"path":"github.com/lib/pq/oid","checksumSHA1":"AU3fA8Sm33Vj9PBoRPSeYfxLRuE=","revision":"90697d60dd844d5ef6ff15135d0203f65d2f53b8","revisionTime":"2018-05-23T17:54:26Z"}, + {"path":"github.com/lyft/protoc-gen-validate/validate","checksumSHA1":"+03cu5aBuyzbu0O/eArpD+DptPU=","revision":"64fcb82c878efbfe3240e4f164490eefaf6b3c4b","revisionTime":"2018-09-11T18:09:27Z"}, {"path":"github.com/mattn/go-isatty","checksumSHA1":"xZuhljnmBysJPta/lMyYmJdujCg=","revision":"66b8e73f3f5cda9f96b69efd03dd3d7fc4a5cdb8","revisionTime":"2016-08-06T12:27:52Z"}, {"path":"github.com/matttproud/golang_protobuf_extensions/pbutil","checksumSHA1":"bKMZjd2wPw13VwoE7mBeSv5djFA=","revision":"c12348ce28de40eed0136aa2b644d0ee0650e56c","revisionTime":"2016-04-24T11:30:07Z"}, {"path":"github.com/miekg/dns","checksumSHA1":"ybBd9oDdeJEZj9YmIKGqaBVqZok=","revision":"e57bf427e68187a27e22adceac868350d7a7079b","revisionTime":"2018-05-16T07:59:02Z","version":"v1.0.7","versionExact":"v1.0.7"}, @@ -271,34 +299,35 @@ {"path":"golang.org/x/text/unicode/norm","checksumSHA1":"BwRNKgzIMUxk56OScxyr43BV6IE=","revision":"88f656faf3f37f690df1a32515b479415e1a6769","revisionTime":"2017-10-26T07:52:28Z"}, {"path":"golang.org/x/time/rate","checksumSHA1":"vGfePfr0+weQUeTM/71mu+LCFuE=","revision":"8be79e1e0910c292df4e79c241bb7e8f7e725959","revisionTime":"2017-04-24T23:28:54Z"}, {"path":"google.golang.org/genproto/googleapis/rpc/status","checksumSHA1":"Tc3BU26zThLzcyqbVtiSEp7EpU8=","revision":"a8101f21cf983e773d0c1133ebc5424792003214","revisionTime":"2017-12-12T23:19:43Z"}, - {"path":"google.golang.org/grpc","checksumSHA1":"3DafCRUFJRbm/1tIMpqgdd8pAkg=","revision":"b519e3d28d377e55a0d44c9b83e6aee4d02d731d","revisionTime":"2018-06-20T19:19:01Z"}, - {"path":"google.golang.org/grpc/balancer","checksumSHA1":"xBhmO0Vn4kzbmySioX+2gBImrkk=","revision":"e975017b473bd9b2a3d5b23428a8549fe20b1153","revisionTime":"2018-01-04T19:16:47Z"}, - {"path":"google.golang.org/grpc/balancer/base","checksumSHA1":"CPWX/IgaQSR3+78j4sPrvHNkW+U=","revision":"e975017b473bd9b2a3d5b23428a8549fe20b1153","revisionTime":"2018-01-04T19:16:47Z"}, - {"path":"google.golang.org/grpc/balancer/roundrobin","checksumSHA1":"DJ1AtOk4Pu7bqtUMob95Hw8HPNw=","revision":"e975017b473bd9b2a3d5b23428a8549fe20b1153","revisionTime":"2018-01-04T19:16:47Z"}, - {"path":"google.golang.org/grpc/codes","checksumSHA1":"bfmh2m3qW8bb6qpfS/D4Wcl4hZE=","revision":"e975017b473bd9b2a3d5b23428a8549fe20b1153","revisionTime":"2018-01-04T19:16:47Z"}, - {"path":"google.golang.org/grpc/connectivity","checksumSHA1":"XH2WYcDNwVO47zYShREJjcYXm0Y=","revision":"e975017b473bd9b2a3d5b23428a8549fe20b1153","revisionTime":"2018-01-04T19:16:47Z"}, - {"path":"google.golang.org/grpc/credentials","checksumSHA1":"KthiDKNPHMeIu967enqtE4NaZzI=","revision":"e975017b473bd9b2a3d5b23428a8549fe20b1153","revisionTime":"2018-01-04T19:16:47Z"}, - {"path":"google.golang.org/grpc/encoding","checksumSHA1":"9DImIDqmAMPO24loHJ77UVJTDxQ=","revision":"e975017b473bd9b2a3d5b23428a8549fe20b1153","revisionTime":"2018-01-04T19:16:47Z"}, - {"path":"google.golang.org/grpc/encoding/proto","checksumSHA1":"LKKkn7EYA+Do9Qwb2/SUKLFNxoo=","revision":"b519e3d28d377e55a0d44c9b83e6aee4d02d731d","revisionTime":"2018-06-20T19:19:01Z"}, - {"path":"google.golang.org/grpc/grpclb/grpc_lb_v1/messages","checksumSHA1":"H7SuPUqbPcdbNqgl+k3ohuwMAwE=","revision":"e975017b473bd9b2a3d5b23428a8549fe20b1153","revisionTime":"2018-01-04T19:16:47Z"}, - {"path":"google.golang.org/grpc/grpclog","checksumSHA1":"ntHev01vgZgeIh5VFRmbLx/BSTo=","revision":"e975017b473bd9b2a3d5b23428a8549fe20b1153","revisionTime":"2018-01-04T19:16:47Z"}, - {"path":"google.golang.org/grpc/health","checksumSHA1":"DyM0uqLtknaI4THSc3spn9XlL+g=","revision":"e975017b473bd9b2a3d5b23428a8549fe20b1153","revisionTime":"2018-01-04T19:16:47Z"}, - {"path":"google.golang.org/grpc/health/grpc_health_v1","checksumSHA1":"6vY7tYjV84pnr3sDctzx53Bs8b0=","revision":"e975017b473bd9b2a3d5b23428a8549fe20b1153","revisionTime":"2018-01-04T19:16:47Z"}, - {"path":"google.golang.org/grpc/internal","checksumSHA1":"Qvf3zdmRCSsiM/VoBv0qB/naHtU=","revision":"e975017b473bd9b2a3d5b23428a8549fe20b1153","revisionTime":"2018-01-04T19:16:47Z"}, - {"path":"google.golang.org/grpc/internal/backoff","checksumSHA1":"uDJA7QK2iGnEwbd9TPqkLaM+xuU=","revision":"b519e3d28d377e55a0d44c9b83e6aee4d02d731d","revisionTime":"2018-06-20T19:19:01Z"}, - {"path":"google.golang.org/grpc/internal/channelz","checksumSHA1":"DpRAlo/UzTvErgcJ9SUQ+lmTxws=","revision":"b519e3d28d377e55a0d44c9b83e6aee4d02d731d","revisionTime":"2018-06-20T19:19:01Z"}, - {"path":"google.golang.org/grpc/internal/grpcrand","checksumSHA1":"70gndc/uHwyAl3D45zqp7vyHWlo=","revision":"b519e3d28d377e55a0d44c9b83e6aee4d02d731d","revisionTime":"2018-06-20T19:19:01Z"}, - {"path":"google.golang.org/grpc/keepalive","checksumSHA1":"hcuHgKp8W0wIzoCnNfKI8NUss5o=","revision":"e975017b473bd9b2a3d5b23428a8549fe20b1153","revisionTime":"2018-01-04T19:16:47Z"}, - {"path":"google.golang.org/grpc/metadata","checksumSHA1":"KeUmTZV+2X46C49cKyjp+xM7fvw=","revision":"e975017b473bd9b2a3d5b23428a8549fe20b1153","revisionTime":"2018-01-04T19:16:47Z"}, - {"path":"google.golang.org/grpc/naming","checksumSHA1":"5dwF592DPvhF2Wcex3m7iV6aGRQ=","revision":"e975017b473bd9b2a3d5b23428a8549fe20b1153","revisionTime":"2018-01-04T19:16:47Z"}, - {"path":"google.golang.org/grpc/peer","checksumSHA1":"n5EgDdBqFMa2KQFhtl+FF/4gIFo=","revision":"e975017b473bd9b2a3d5b23428a8549fe20b1153","revisionTime":"2018-01-04T19:16:47Z"}, - {"path":"google.golang.org/grpc/resolver","checksumSHA1":"y8Ta+ctMP9CUTiPyPyxiD154d8w=","revision":"e975017b473bd9b2a3d5b23428a8549fe20b1153","revisionTime":"2018-01-04T19:16:47Z"}, - {"path":"google.golang.org/grpc/resolver/dns","checksumSHA1":"WpWF+bDzObsHf+bjoGpb/abeFxo=","revision":"e975017b473bd9b2a3d5b23428a8549fe20b1153","revisionTime":"2018-01-04T19:16:47Z"}, - {"path":"google.golang.org/grpc/resolver/passthrough","checksumSHA1":"zs9M4xE8Lyg4wvuYvR00XoBxmuw=","revision":"e975017b473bd9b2a3d5b23428a8549fe20b1153","revisionTime":"2018-01-04T19:16:47Z"}, - {"path":"google.golang.org/grpc/stats","checksumSHA1":"G9lgXNi7qClo5sM2s6TbTHLFR3g=","revision":"e975017b473bd9b2a3d5b23428a8549fe20b1153","revisionTime":"2018-01-04T19:16:47Z"}, - {"path":"google.golang.org/grpc/status","checksumSHA1":"tUo+M0Cb0W9ZEIt5BH30wJz/Kjc=","revision":"e975017b473bd9b2a3d5b23428a8549fe20b1153","revisionTime":"2018-01-04T19:16:47Z"}, - {"path":"google.golang.org/grpc/tap","checksumSHA1":"qvArRhlrww5WvRmbyMF2mUfbJew=","revision":"e975017b473bd9b2a3d5b23428a8549fe20b1153","revisionTime":"2018-01-04T19:16:47Z"}, - {"path":"google.golang.org/grpc/transport","checksumSHA1":"iV2B3kx0Ifym+zumJt+9jLgwqK8=","revision":"e975017b473bd9b2a3d5b23428a8549fe20b1153","revisionTime":"2018-01-04T19:16:47Z"}, + {"path":"google.golang.org/grpc","checksumSHA1":"38oYmvI4bUVd0ciabO8Kk+cuK2c=","revision":"8997b5fa08730b06a4b589dba174c115796fbb7b","revisionTime":"2018-09-20T23:48:47Z"}, + {"path":"google.golang.org/grpc/balancer","checksumSHA1":"B+kZFVP8zRiQMpoEb39Mp2oSmqg=","revision":"8997b5fa08730b06a4b589dba174c115796fbb7b","revisionTime":"2018-09-20T23:48:47Z"}, + {"path":"google.golang.org/grpc/balancer/base","checksumSHA1":"lw+L836hLeH8+//le+C+ycddCCU=","revision":"8997b5fa08730b06a4b589dba174c115796fbb7b","revisionTime":"2018-09-20T23:48:47Z"}, + {"path":"google.golang.org/grpc/balancer/roundrobin","checksumSHA1":"DJ1AtOk4Pu7bqtUMob95Hw8HPNw=","revision":"8997b5fa08730b06a4b589dba174c115796fbb7b","revisionTime":"2018-09-20T23:48:47Z"}, + {"path":"google.golang.org/grpc/codes","checksumSHA1":"R3tuACGAPyK4lr+oSNt1saUzC0M=","revision":"8997b5fa08730b06a4b589dba174c115796fbb7b","revisionTime":"2018-09-20T23:48:47Z"}, + {"path":"google.golang.org/grpc/connectivity","checksumSHA1":"XH2WYcDNwVO47zYShREJjcYXm0Y=","revision":"8997b5fa08730b06a4b589dba174c115796fbb7b","revisionTime":"2018-09-20T23:48:47Z"}, + {"path":"google.golang.org/grpc/credentials","checksumSHA1":"wA6y5rkH1v4bWBe5M1r/Hdtgma4=","revision":"8997b5fa08730b06a4b589dba174c115796fbb7b","revisionTime":"2018-09-20T23:48:47Z"}, + {"path":"google.golang.org/grpc/encoding","checksumSHA1":"cfLb+pzWB+Glwp82rgfcEST1mv8=","revision":"8997b5fa08730b06a4b589dba174c115796fbb7b","revisionTime":"2018-09-20T23:48:47Z"}, + {"path":"google.golang.org/grpc/encoding/proto","checksumSHA1":"LKKkn7EYA+Do9Qwb2/SUKLFNxoo=","revision":"8997b5fa08730b06a4b589dba174c115796fbb7b","revisionTime":"2018-09-20T23:48:47Z"}, + {"path":"google.golang.org/grpc/grpclog","checksumSHA1":"ZPPSFisPDz2ANO4FBZIft+fRxyk=","revision":"8997b5fa08730b06a4b589dba174c115796fbb7b","revisionTime":"2018-09-20T23:48:47Z"}, + {"path":"google.golang.org/grpc/health","checksumSHA1":"5f4iDmBsp267R75UdXD6s01l+hk=","revision":"8997b5fa08730b06a4b589dba174c115796fbb7b","revisionTime":"2018-09-20T23:48:47Z"}, + {"path":"google.golang.org/grpc/health/grpc_health_v1","checksumSHA1":"KfgIKMqGJ8FdFbWlGDsnmrCY7eE=","revision":"8997b5fa08730b06a4b589dba174c115796fbb7b","revisionTime":"2018-09-20T23:48:47Z"}, + {"path":"google.golang.org/grpc/internal","checksumSHA1":"8uLpHZuwD6Ug/QlvN94QyHaOack=","revision":"8997b5fa08730b06a4b589dba174c115796fbb7b","revisionTime":"2018-09-20T23:48:47Z"}, + {"path":"google.golang.org/grpc/internal/backoff","checksumSHA1":"uDJA7QK2iGnEwbd9TPqkLaM+xuU=","revision":"8997b5fa08730b06a4b589dba174c115796fbb7b","revisionTime":"2018-09-20T23:48:47Z"}, + {"path":"google.golang.org/grpc/internal/channelz","checksumSHA1":"KCnkjqO49gNTv2JmnBdJqxQ7JT0=","revision":"8997b5fa08730b06a4b589dba174c115796fbb7b","revisionTime":"2018-09-20T23:48:47Z"}, + {"path":"google.golang.org/grpc/internal/envconfig","checksumSHA1":"5dFUCEaPjKwza9kwKqgljp8ckU4=","revision":"8997b5fa08730b06a4b589dba174c115796fbb7b","revisionTime":"2018-09-20T23:48:47Z"}, + {"path":"google.golang.org/grpc/internal/grpcrand","checksumSHA1":"70gndc/uHwyAl3D45zqp7vyHWlo=","revision":"8997b5fa08730b06a4b589dba174c115796fbb7b","revisionTime":"2018-09-20T23:48:47Z"}, + {"path":"google.golang.org/grpc/internal/transport","checksumSHA1":"ZJ3AWjJzHj33TjFnwFLCQbg6oZQ=","revision":"8997b5fa08730b06a4b589dba174c115796fbb7b","revisionTime":"2018-09-20T23:48:47Z"}, + {"path":"google.golang.org/grpc/keepalive","checksumSHA1":"hcuHgKp8W0wIzoCnNfKI8NUss5o=","revision":"8997b5fa08730b06a4b589dba174c115796fbb7b","revisionTime":"2018-09-20T23:48:47Z"}, + {"path":"google.golang.org/grpc/metadata","checksumSHA1":"OjIAi5AzqlQ7kLtdAyjvdgMf6hc=","revision":"8997b5fa08730b06a4b589dba174c115796fbb7b","revisionTime":"2018-09-20T23:48:47Z"}, + {"path":"google.golang.org/grpc/naming","checksumSHA1":"VvGBoawND0urmYDy11FT+U1IHtU=","revision":"8997b5fa08730b06a4b589dba174c115796fbb7b","revisionTime":"2018-09-20T23:48:47Z"}, + {"path":"google.golang.org/grpc/peer","checksumSHA1":"n5EgDdBqFMa2KQFhtl+FF/4gIFo=","revision":"8997b5fa08730b06a4b589dba174c115796fbb7b","revisionTime":"2018-09-20T23:48:47Z"}, + {"path":"google.golang.org/grpc/resolver","checksumSHA1":"GEq6wwE1qWLmkaM02SjxBmmnHDo=","revision":"8997b5fa08730b06a4b589dba174c115796fbb7b","revisionTime":"2018-09-20T23:48:47Z"}, + {"path":"google.golang.org/grpc/resolver/dns","checksumSHA1":"90rwIeFK1zLW8M57MfzmejpCwP4=","revision":"8997b5fa08730b06a4b589dba174c115796fbb7b","revisionTime":"2018-09-20T23:48:47Z"}, + {"path":"google.golang.org/grpc/resolver/passthrough","checksumSHA1":"zs9M4xE8Lyg4wvuYvR00XoBxmuw=","revision":"8997b5fa08730b06a4b589dba174c115796fbb7b","revisionTime":"2018-09-20T23:48:47Z"}, + {"path":"google.golang.org/grpc/stats","checksumSHA1":"YclPgme2gT3S0hTkHVdE1zAxJdo=","revision":"8997b5fa08730b06a4b589dba174c115796fbb7b","revisionTime":"2018-09-20T23:48:47Z"}, + {"path":"google.golang.org/grpc/status","checksumSHA1":"hFyBO5vgsMamKhUOSyPCqROk1vo=","revision":"8997b5fa08730b06a4b589dba174c115796fbb7b","revisionTime":"2018-09-20T23:48:47Z"}, + {"path":"google.golang.org/grpc/tap","checksumSHA1":"qvArRhlrww5WvRmbyMF2mUfbJew=","revision":"8997b5fa08730b06a4b589dba174c115796fbb7b","revisionTime":"2018-09-20T23:48:47Z"}, + {"path":"google.golang.org/grpc/transport","revision":""}, {"path":"gopkg.in/inf.v0","checksumSHA1":"COfXAfInbcFT/YRsvLUQnNKHzF0=","revision":"d2d2541c53f18d2a059457998ce2876cc8e67cbf","revisionTime":"2018-03-26T17:23:32Z"}, {"path":"gopkg.in/mgo.v2","checksumSHA1":"1D8GzeoFGUs5FZOoyC2DpQg8c5Y=","revision":"3f83fa5005286a7fe593b055f0d7771a7dce4655","revisionTime":"2016-08-18T02:01:20Z"}, {"path":"gopkg.in/mgo.v2/bson","checksumSHA1":"YsB2DChSV9HxdzHaKATllAUKWSI=","revision":"3f83fa5005286a7fe593b055f0d7771a7dce4655","revisionTime":"2016-08-18T02:01:20Z"},