mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-04-11 18:13:00 +00:00
rebase: bump the github-dependencies group with 2 updates
Bumps the github-dependencies group with 2 updates: [github.com/aws/aws-sdk-go-v2/service/sts](https://github.com/aws/aws-sdk-go-v2) and [github.com/prometheus/client_golang](https://github.com/prometheus/client_golang). Updates `github.com/aws/aws-sdk-go-v2/service/sts` from 1.33.16 to 1.33.17 - [Release notes](https://github.com/aws/aws-sdk-go-v2/releases) - [Changelog](https://github.com/aws/aws-sdk-go-v2/blob/main/changelog-template.json) - [Commits](https://github.com/aws/aws-sdk-go-v2/compare/service/sns/v1.33.16...service/sns/v1.33.17) Updates `github.com/prometheus/client_golang` from 1.21.0 to 1.21.1 - [Release notes](https://github.com/prometheus/client_golang/releases) - [Changelog](https://github.com/prometheus/client_golang/blob/main/CHANGELOG.md) - [Commits](https://github.com/prometheus/client_golang/compare/v1.21.0...v1.21.1) --- updated-dependencies: - dependency-name: github.com/aws/aws-sdk-go-v2/service/sts dependency-type: direct:production update-type: version-update:semver-patch dependency-group: github-dependencies - dependency-name: github.com/prometheus/client_golang dependency-type: direct:production update-type: version-update:semver-patch dependency-group: github-dependencies ... Signed-off-by: dependabot[bot] <support@github.com>
This commit is contained in:
parent
6e8cd27b99
commit
874124c26d
12
go.mod
12
go.mod
@ -32,7 +32,7 @@ require (
|
|||||||
golang.org/x/crypto v0.36.0
|
golang.org/x/crypto v0.36.0
|
||||||
golang.org/x/net v0.37.0
|
golang.org/x/net v0.37.0
|
||||||
golang.org/x/sys v0.31.0
|
golang.org/x/sys v0.31.0
|
||||||
google.golang.org/grpc v1.70.0
|
google.golang.org/grpc v1.71.0
|
||||||
google.golang.org/protobuf v1.36.5
|
google.golang.org/protobuf v1.36.5
|
||||||
k8s.io/api v0.32.2
|
k8s.io/api v0.32.2
|
||||||
k8s.io/apimachinery v0.32.2
|
k8s.io/apimachinery v0.32.2
|
||||||
@ -146,18 +146,18 @@ require (
|
|||||||
github.com/x448/float16 v0.8.4 // indirect
|
github.com/x448/float16 v0.8.4 // indirect
|
||||||
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
|
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
|
||||||
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.58.0 // indirect
|
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.58.0 // indirect
|
||||||
go.opentelemetry.io/otel v1.33.0 // indirect
|
go.opentelemetry.io/otel v1.34.0 // indirect
|
||||||
go.opentelemetry.io/otel/metric v1.33.0 // indirect
|
go.opentelemetry.io/otel/metric v1.34.0 // indirect
|
||||||
go.opentelemetry.io/otel/trace v1.33.0 // indirect
|
go.opentelemetry.io/otel/trace v1.34.0 // indirect
|
||||||
go.uber.org/multierr v1.11.0 // indirect
|
go.uber.org/multierr v1.11.0 // indirect
|
||||||
go.uber.org/zap v1.27.0 // indirect
|
go.uber.org/zap v1.27.0 // indirect
|
||||||
golang.org/x/oauth2 v0.24.0 // indirect
|
golang.org/x/oauth2 v0.25.0 // indirect
|
||||||
golang.org/x/sync v0.12.0 // indirect
|
golang.org/x/sync v0.12.0 // indirect
|
||||||
golang.org/x/term v0.30.0 // indirect
|
golang.org/x/term v0.30.0 // indirect
|
||||||
golang.org/x/text v0.23.0 // indirect
|
golang.org/x/text v0.23.0 // indirect
|
||||||
golang.org/x/time v0.8.0 // indirect
|
golang.org/x/time v0.8.0 // indirect
|
||||||
gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect
|
gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect
|
||||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20241216192217-9240e9c98484 // indirect
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20250115164207-1a7da9e5054f // indirect
|
||||||
gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect
|
gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect
|
||||||
gopkg.in/inf.v0 v0.9.1 // indirect
|
gopkg.in/inf.v0 v0.9.1 // indirect
|
||||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||||
|
32
go.sum
32
go.sum
@ -667,16 +667,16 @@ go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJyS
|
|||||||
go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A=
|
go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A=
|
||||||
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.58.0 h1:PS8wXpbyaDJQ2VDHHncMe9Vct0Zn1fEjpsjrLxGJoSc=
|
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.58.0 h1:PS8wXpbyaDJQ2VDHHncMe9Vct0Zn1fEjpsjrLxGJoSc=
|
||||||
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.58.0/go.mod h1:HDBUsEjOuRC0EzKZ1bSaRGZWUBAzo+MhAcUUORSr4D0=
|
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.58.0/go.mod h1:HDBUsEjOuRC0EzKZ1bSaRGZWUBAzo+MhAcUUORSr4D0=
|
||||||
go.opentelemetry.io/otel v1.33.0 h1:/FerN9bax5LoK51X/sI0SVYrjSE0/yUL7DpxW4K3FWw=
|
go.opentelemetry.io/otel v1.34.0 h1:zRLXxLCgL1WyKsPVrgbSdMN4c0FMkDAskSTQP+0hdUY=
|
||||||
go.opentelemetry.io/otel v1.33.0/go.mod h1:SUUkR6csvUQl+yjReHu5uM3EtVV7MBm5FHKRlNx4I8I=
|
go.opentelemetry.io/otel v1.34.0/go.mod h1:OWFPOQ+h4G8xpyjgqo4SxJYdDQ/qmRH+wivy7zzx9oI=
|
||||||
go.opentelemetry.io/otel/metric v1.33.0 h1:r+JOocAyeRVXD8lZpjdQjzMadVZp2M4WmQ+5WtEnklQ=
|
go.opentelemetry.io/otel/metric v1.34.0 h1:+eTR3U0MyfWjRDhmFMxe2SsW64QrZ84AOhvqS7Y+PoQ=
|
||||||
go.opentelemetry.io/otel/metric v1.33.0/go.mod h1:L9+Fyctbp6HFTddIxClbQkjtubW6O9QS3Ann/M82u6M=
|
go.opentelemetry.io/otel/metric v1.34.0/go.mod h1:CEDrp0fy2D0MvkXE+dPV7cMi8tWZwX3dmaIhwPOaqHE=
|
||||||
go.opentelemetry.io/otel/sdk v1.32.0 h1:RNxepc9vK59A8XsgZQouW8ue8Gkb4jpWtJm9ge5lEG4=
|
go.opentelemetry.io/otel/sdk v1.34.0 h1:95zS4k/2GOy069d321O8jWgYsW3MzVV+KuSPKp7Wr1A=
|
||||||
go.opentelemetry.io/otel/sdk v1.32.0/go.mod h1:LqgegDBjKMmb2GC6/PrTnteJG39I8/vJCAP9LlJXEjU=
|
go.opentelemetry.io/otel/sdk v1.34.0/go.mod h1:0e/pNiaMAqaykJGKbi+tSjWfNNHMTxoC9qANsCzbyxU=
|
||||||
go.opentelemetry.io/otel/sdk/metric v1.32.0 h1:rZvFnvmvawYb0alrYkjraqJq0Z4ZUJAiyYCU9snn1CU=
|
go.opentelemetry.io/otel/sdk/metric v1.34.0 h1:5CeK9ujjbFVL5c1PhLuStg1wxA7vQv7ce1EK0Gyvahk=
|
||||||
go.opentelemetry.io/otel/sdk/metric v1.32.0/go.mod h1:PWeZlq0zt9YkYAp3gjKZ0eicRYvOh1Gd+X99x6GHpCQ=
|
go.opentelemetry.io/otel/sdk/metric v1.34.0/go.mod h1:jQ/r8Ze28zRKoNRdkjCZxfs6YvBTG1+YIqyFVFYec5w=
|
||||||
go.opentelemetry.io/otel/trace v1.33.0 h1:cCJuF7LRjUFso9LPnEAHJDB2pqzp+hbO8eu1qqW2d/s=
|
go.opentelemetry.io/otel/trace v1.34.0 h1:+ouXS2V8Rd4hp4580a8q23bg0azF2nI8cqLYnC8mh/k=
|
||||||
go.opentelemetry.io/otel/trace v1.33.0/go.mod h1:uIcdVUZMpTAmz0tI1z04GoVSezK37CbGV4fr1f2nBck=
|
go.opentelemetry.io/otel/trace v1.34.0/go.mod h1:Svm7lSjQD7kG7KJ/MUHPVXSDGz2OX4h0M2jHBhmSfRE=
|
||||||
go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI=
|
go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI=
|
||||||
go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
|
go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
|
||||||
go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
|
go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
|
||||||
@ -858,8 +858,8 @@ golang.org/x/oauth2 v0.0.0-20220309155454-6242fa91716a/go.mod h1:DAh4E804XQdzx2j
|
|||||||
golang.org/x/oauth2 v0.0.0-20220411215720-9780585627b5/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc=
|
golang.org/x/oauth2 v0.0.0-20220411215720-9780585627b5/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc=
|
||||||
golang.org/x/oauth2 v0.0.0-20220524215830-622c5d57e401/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc=
|
golang.org/x/oauth2 v0.0.0-20220524215830-622c5d57e401/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc=
|
||||||
golang.org/x/oauth2 v0.23.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI=
|
golang.org/x/oauth2 v0.23.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI=
|
||||||
golang.org/x/oauth2 v0.24.0 h1:KTBBxWqUa0ykRPLtV69rRto9TLXcqYkeswu48x/gvNE=
|
golang.org/x/oauth2 v0.25.0 h1:CY4y7XT9v0cRI9oupztF8AgiIu99L/ksR/Xp/6jrZ70=
|
||||||
golang.org/x/oauth2 v0.24.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI=
|
golang.org/x/oauth2 v0.25.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI=
|
||||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
@ -1251,8 +1251,8 @@ google.golang.org/genproto v0.0.0-20220421151946-72621c1f0bd3/go.mod h1:8w6bsBMX
|
|||||||
google.golang.org/genproto v0.0.0-20220429170224-98d788798c3e/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo=
|
google.golang.org/genproto v0.0.0-20220429170224-98d788798c3e/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo=
|
||||||
google.golang.org/genproto v0.0.0-20220505152158-f39f71e6c8f3/go.mod h1:RAyBrSAP7Fh3Nc84ghnVLDPuV51xc9agzmm4Ph6i0Q4=
|
google.golang.org/genproto v0.0.0-20220505152158-f39f71e6c8f3/go.mod h1:RAyBrSAP7Fh3Nc84ghnVLDPuV51xc9agzmm4Ph6i0Q4=
|
||||||
google.golang.org/genproto v0.0.0-20220602131408-e326c6e8e9c8/go.mod h1:yKyY4AMRwFiC8yMMNaMi+RkCnjZJt9LoWuvhXjMs+To=
|
google.golang.org/genproto v0.0.0-20220602131408-e326c6e8e9c8/go.mod h1:yKyY4AMRwFiC8yMMNaMi+RkCnjZJt9LoWuvhXjMs+To=
|
||||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20241216192217-9240e9c98484 h1:Z7FRVJPSMaHQxD0uXU8WdgFh8PseLM8Q8NzhnpMrBhQ=
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20250115164207-1a7da9e5054f h1:OxYkA3wjPsZyBylwymxSHa7ViiW1Sml4ToBrncvFehI=
|
||||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20241216192217-9240e9c98484/go.mod h1:lcTa1sDdWEIHMWlITnIczmw5w60CF9ffkb8Z+DVmmjA=
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20250115164207-1a7da9e5054f/go.mod h1:+2Yz8+CLJbIfL9z73EW45avw8Lmge3xVElCP9zEKi50=
|
||||||
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
|
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
|
||||||
google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38=
|
google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38=
|
||||||
google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM=
|
google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM=
|
||||||
@ -1284,8 +1284,8 @@ google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11
|
|||||||
google.golang.org/grpc v1.46.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk=
|
google.golang.org/grpc v1.46.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk=
|
||||||
google.golang.org/grpc v1.46.2/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk=
|
google.golang.org/grpc v1.46.2/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk=
|
||||||
google.golang.org/grpc v1.47.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk=
|
google.golang.org/grpc v1.47.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk=
|
||||||
google.golang.org/grpc v1.70.0 h1:pWFv03aZoHzlRKHWicjsZytKAiYCtNS0dHbXnIdq7jQ=
|
google.golang.org/grpc v1.71.0 h1:kF77BGdPTQ4/JZWMlb9VpJ5pa25aqvVqogsxNHHdeBg=
|
||||||
google.golang.org/grpc v1.70.0/go.mod h1:ofIJqVKDXx/JiXrwr2IG4/zwdH9txy3IlF40RmcJSQw=
|
google.golang.org/grpc v1.71.0/go.mod h1:H0GRtasmQOh9LkFoCPDu3ZrwUtD1YGE+b2vYBYd/8Ec=
|
||||||
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw=
|
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw=
|
||||||
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
|
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
|
||||||
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
|
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
|
||||||
|
21
vendor/go.opentelemetry.io/otel/CHANGELOG.md
generated
vendored
21
vendor/go.opentelemetry.io/otel/CHANGELOG.md
generated
vendored
@ -8,6 +8,21 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
|
|||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
<!-- Released section -->
|
||||||
|
<!-- Don't change this section unless doing release -->
|
||||||
|
|
||||||
|
## [1.34.0/0.56.0/0.10.0] 2025-01-17
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Remove the notices from `Logger` to make the whole Logs API user-facing in `go.opentelemetry.io/otel/log`. (#6167)
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Relax minimum Go version to 1.22.0 in various modules. (#6073)
|
||||||
|
- The `Type` name logged for the `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc` client is corrected from `otlphttpgrpc` to `otlptracegrpc`. (#6143)
|
||||||
|
- The `Type` name logged for the `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlphttpgrpc` client is corrected from `otlphttphttp` to `otlptracehttp`. (#6143)
|
||||||
|
|
||||||
## [1.33.0/0.55.0/0.9.0/0.0.12] 2024-12-12
|
## [1.33.0/0.55.0/0.9.0/0.0.12] 2024-12-12
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
@ -37,9 +52,6 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
|
|||||||
- Fix attribute value truncation in `go.opentelemetry.io/otel/sdk/trace`. (#5997)
|
- Fix attribute value truncation in `go.opentelemetry.io/otel/sdk/trace`. (#5997)
|
||||||
- Fix attribute value truncation in `go.opentelemetry.io/otel/sdk/log`. (#6032)
|
- Fix attribute value truncation in `go.opentelemetry.io/otel/sdk/log`. (#6032)
|
||||||
|
|
||||||
<!-- Released section -->
|
|
||||||
<!-- Don't change this section unless doing release -->
|
|
||||||
|
|
||||||
## [1.32.0/0.54.0/0.8.0/0.0.11] 2024-11-08
|
## [1.32.0/0.54.0/0.8.0/0.0.11] 2024-11-08
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
@ -3185,7 +3197,8 @@ It contains api and sdk for trace and meter.
|
|||||||
- CircleCI build CI manifest files.
|
- CircleCI build CI manifest files.
|
||||||
- CODEOWNERS file to track owners of this project.
|
- CODEOWNERS file to track owners of this project.
|
||||||
|
|
||||||
[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/v1.33.0...HEAD
|
[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/v1.34.0...HEAD
|
||||||
|
[1.34.0/0.56.0/0.10.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.34.0
|
||||||
[1.33.0/0.55.0/0.9.0/0.0.12]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.33.0
|
[1.33.0/0.55.0/0.9.0/0.0.12]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.33.0
|
||||||
[1.32.0/0.54.0/0.8.0/0.0.11]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.32.0
|
[1.32.0/0.54.0/0.8.0/0.0.11]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.32.0
|
||||||
[1.31.0/0.53.0/0.7.0/0.0.10]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.31.0
|
[1.31.0/0.53.0/0.7.0/0.0.10]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.31.0
|
||||||
|
2
vendor/go.opentelemetry.io/otel/README.md
generated
vendored
2
vendor/go.opentelemetry.io/otel/README.md
generated
vendored
@ -1,6 +1,6 @@
|
|||||||
# OpenTelemetry-Go
|
# OpenTelemetry-Go
|
||||||
|
|
||||||
[](https://github.com/open-telemetry/opentelemetry-go/actions?query=workflow%3Aci+branch%3Amain)
|
[](https://github.com/open-telemetry/opentelemetry-go/actions/workflows/ci.yml)
|
||||||
[](https://app.codecov.io/gh/open-telemetry/opentelemetry-go?branch=main)
|
[](https://app.codecov.io/gh/open-telemetry/opentelemetry-go?branch=main)
|
||||||
[](https://pkg.go.dev/go.opentelemetry.io/otel)
|
[](https://pkg.go.dev/go.opentelemetry.io/otel)
|
||||||
[](https://goreportcard.com/report/go.opentelemetry.io/otel)
|
[](https://goreportcard.com/report/go.opentelemetry.io/otel)
|
||||||
|
6
vendor/go.opentelemetry.io/otel/RELEASING.md
generated
vendored
6
vendor/go.opentelemetry.io/otel/RELEASING.md
generated
vendored
@ -130,6 +130,6 @@ Importantly, bump any package versions referenced to be the latest one you just
|
|||||||
|
|
||||||
Bump the dependencies in the following Go services:
|
Bump the dependencies in the following Go services:
|
||||||
|
|
||||||
- [`accountingservice`](https://github.com/open-telemetry/opentelemetry-demo/tree/main/src/accountingservice)
|
- [`accounting`](https://github.com/open-telemetry/opentelemetry-demo/tree/main/src/accounting)
|
||||||
- [`checkoutservice`](https://github.com/open-telemetry/opentelemetry-demo/tree/main/src/checkoutservice)
|
- [`checkoutservice`](https://github.com/open-telemetry/opentelemetry-demo/tree/main/src/checkout)
|
||||||
- [`productcatalogservice`](https://github.com/open-telemetry/opentelemetry-demo/tree/main/src/productcatalogservice)
|
- [`productcatalogservice`](https://github.com/open-telemetry/opentelemetry-demo/tree/main/src/product-catalog)
|
||||||
|
6
vendor/go.opentelemetry.io/otel/renovate.json
generated
vendored
6
vendor/go.opentelemetry.io/otel/renovate.json
generated
vendored
@ -14,12 +14,6 @@
|
|||||||
"matchDepTypes": ["indirect"],
|
"matchDepTypes": ["indirect"],
|
||||||
"enabled": true
|
"enabled": true
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"matchFileNames": ["internal/tools/**"],
|
|
||||||
"matchManagers": ["gomod"],
|
|
||||||
"matchDepTypes": ["indirect"],
|
|
||||||
"enabled": false
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"matchPackageNames": ["google.golang.org/genproto/googleapis/**"],
|
"matchPackageNames": ["google.golang.org/genproto/googleapis/**"],
|
||||||
"groupName": "googleapis"
|
"groupName": "googleapis"
|
||||||
|
2
vendor/go.opentelemetry.io/otel/version.go
generated
vendored
2
vendor/go.opentelemetry.io/otel/version.go
generated
vendored
@ -5,5 +5,5 @@ package otel // import "go.opentelemetry.io/otel"
|
|||||||
|
|
||||||
// Version is the current release version of OpenTelemetry in use.
|
// Version is the current release version of OpenTelemetry in use.
|
||||||
func Version() string {
|
func Version() string {
|
||||||
return "1.33.0"
|
return "1.34.0"
|
||||||
}
|
}
|
||||||
|
6
vendor/go.opentelemetry.io/otel/versions.yaml
generated
vendored
6
vendor/go.opentelemetry.io/otel/versions.yaml
generated
vendored
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
module-sets:
|
module-sets:
|
||||||
stable-v1:
|
stable-v1:
|
||||||
version: v1.33.0
|
version: v1.34.0
|
||||||
modules:
|
modules:
|
||||||
- go.opentelemetry.io/otel
|
- go.opentelemetry.io/otel
|
||||||
- go.opentelemetry.io/otel/bridge/opencensus
|
- go.opentelemetry.io/otel/bridge/opencensus
|
||||||
@ -23,11 +23,11 @@ module-sets:
|
|||||||
- go.opentelemetry.io/otel/sdk/metric
|
- go.opentelemetry.io/otel/sdk/metric
|
||||||
- go.opentelemetry.io/otel/trace
|
- go.opentelemetry.io/otel/trace
|
||||||
experimental-metrics:
|
experimental-metrics:
|
||||||
version: v0.55.0
|
version: v0.56.0
|
||||||
modules:
|
modules:
|
||||||
- go.opentelemetry.io/otel/exporters/prometheus
|
- go.opentelemetry.io/otel/exporters/prometheus
|
||||||
experimental-logs:
|
experimental-logs:
|
||||||
version: v0.9.0
|
version: v0.10.0
|
||||||
modules:
|
modules:
|
||||||
- go.opentelemetry.io/otel/log
|
- go.opentelemetry.io/otel/log
|
||||||
- go.opentelemetry.io/otel/sdk/log
|
- go.opentelemetry.io/otel/sdk/log
|
||||||
|
2
vendor/golang.org/x/oauth2/oauth2.go
generated
vendored
2
vendor/golang.org/x/oauth2/oauth2.go
generated
vendored
@ -56,7 +56,7 @@ type Config struct {
|
|||||||
// the OAuth flow, after the resource owner's URLs.
|
// the OAuth flow, after the resource owner's URLs.
|
||||||
RedirectURL string
|
RedirectURL string
|
||||||
|
|
||||||
// Scope specifies optional requested permissions.
|
// Scopes specifies optional requested permissions.
|
||||||
Scopes []string
|
Scopes []string
|
||||||
|
|
||||||
// authStyleCache caches which auth style to use when Endpoint.AuthStyle is
|
// authStyleCache caches which auth style to use when Endpoint.AuthStyle is
|
||||||
|
22
vendor/google.golang.org/grpc/balancer/balancer.go
generated
vendored
22
vendor/google.golang.org/grpc/balancer/balancer.go
generated
vendored
@ -129,6 +129,13 @@ type State struct {
|
|||||||
// brand new implementation of this interface. For the situations like
|
// brand new implementation of this interface. For the situations like
|
||||||
// testing, the new implementation should embed this interface. This allows
|
// testing, the new implementation should embed this interface. This allows
|
||||||
// gRPC to add new methods to this interface.
|
// gRPC to add new methods to this interface.
|
||||||
|
//
|
||||||
|
// NOTICE: This interface is intended to be implemented by gRPC, or intercepted
|
||||||
|
// by custom load balancing polices. Users should not need their own complete
|
||||||
|
// implementation of this interface -- they should always delegate to a
|
||||||
|
// ClientConn passed to Builder.Build() by embedding it in their
|
||||||
|
// implementations. An embedded ClientConn must never be nil, or runtime panics
|
||||||
|
// will occur.
|
||||||
type ClientConn interface {
|
type ClientConn interface {
|
||||||
// NewSubConn is called by balancer to create a new SubConn.
|
// NewSubConn is called by balancer to create a new SubConn.
|
||||||
// It doesn't block and wait for the connections to be established.
|
// It doesn't block and wait for the connections to be established.
|
||||||
@ -167,6 +174,17 @@ type ClientConn interface {
|
|||||||
//
|
//
|
||||||
// Deprecated: Use the Target field in the BuildOptions instead.
|
// Deprecated: Use the Target field in the BuildOptions instead.
|
||||||
Target() string
|
Target() string
|
||||||
|
|
||||||
|
// MetricsRecorder provides the metrics recorder that balancers can use to
|
||||||
|
// record metrics. Balancer implementations which do not register metrics on
|
||||||
|
// metrics registry and record on them can ignore this method. The returned
|
||||||
|
// MetricsRecorder is guaranteed to never be nil.
|
||||||
|
MetricsRecorder() estats.MetricsRecorder
|
||||||
|
|
||||||
|
// EnforceClientConnEmbedding is included to force implementers to embed
|
||||||
|
// another implementation of this interface, allowing gRPC to add methods
|
||||||
|
// without breaking users.
|
||||||
|
internal.EnforceClientConnEmbedding
|
||||||
}
|
}
|
||||||
|
|
||||||
// BuildOptions contains additional information for Build.
|
// BuildOptions contains additional information for Build.
|
||||||
@ -198,10 +216,6 @@ type BuildOptions struct {
|
|||||||
// same resolver.Target as passed to the resolver. See the documentation for
|
// same resolver.Target as passed to the resolver. See the documentation for
|
||||||
// the resolver.Target type for details about what it contains.
|
// the resolver.Target type for details about what it contains.
|
||||||
Target resolver.Target
|
Target resolver.Target
|
||||||
// MetricsRecorder is the metrics recorder that balancers can use to record
|
|
||||||
// metrics. Balancer implementations which do not register metrics on
|
|
||||||
// metrics registry and record on them can ignore this field.
|
|
||||||
MetricsRecorder estats.MetricsRecorder
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Builder creates a balancer.
|
// Builder creates a balancer.
|
||||||
|
358
vendor/google.golang.org/grpc/balancer/endpointsharding/endpointsharding.go
generated
vendored
Normal file
358
vendor/google.golang.org/grpc/balancer/endpointsharding/endpointsharding.go
generated
vendored
Normal file
@ -0,0 +1,358 @@
|
|||||||
|
/*
|
||||||
|
*
|
||||||
|
* Copyright 2024 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 endpointsharding implements a load balancing policy that manages
|
||||||
|
// homogeneous child policies each owning a single endpoint.
|
||||||
|
//
|
||||||
|
// # Experimental
|
||||||
|
//
|
||||||
|
// Notice: This package is EXPERIMENTAL and may be changed or removed in a
|
||||||
|
// later release.
|
||||||
|
package endpointsharding
|
||||||
|
|
||||||
|
import (
|
||||||
|
"errors"
|
||||||
|
rand "math/rand/v2"
|
||||||
|
"sync"
|
||||||
|
"sync/atomic"
|
||||||
|
|
||||||
|
"google.golang.org/grpc/balancer"
|
||||||
|
"google.golang.org/grpc/balancer/base"
|
||||||
|
"google.golang.org/grpc/connectivity"
|
||||||
|
"google.golang.org/grpc/resolver"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ChildState is the balancer state of a child along with the endpoint which
|
||||||
|
// identifies the child balancer.
|
||||||
|
type ChildState struct {
|
||||||
|
Endpoint resolver.Endpoint
|
||||||
|
State balancer.State
|
||||||
|
|
||||||
|
// Balancer exposes only the ExitIdler interface of the child LB policy.
|
||||||
|
// Other methods of the child policy are called only by endpointsharding.
|
||||||
|
Balancer balancer.ExitIdler
|
||||||
|
}
|
||||||
|
|
||||||
|
// Options are the options to configure the behaviour of the
|
||||||
|
// endpointsharding balancer.
|
||||||
|
type Options struct {
|
||||||
|
// DisableAutoReconnect allows the balancer to keep child balancer in the
|
||||||
|
// IDLE state until they are explicitly triggered to exit using the
|
||||||
|
// ChildState obtained from the endpointsharding picker. When set to false,
|
||||||
|
// the endpointsharding balancer will automatically call ExitIdle on child
|
||||||
|
// connections that report IDLE.
|
||||||
|
DisableAutoReconnect bool
|
||||||
|
}
|
||||||
|
|
||||||
|
// ChildBuilderFunc creates a new balancer with the ClientConn. It has the same
|
||||||
|
// type as the balancer.Builder.Build method.
|
||||||
|
type ChildBuilderFunc func(cc balancer.ClientConn, opts balancer.BuildOptions) balancer.Balancer
|
||||||
|
|
||||||
|
// NewBalancer returns a load balancing policy that manages homogeneous child
|
||||||
|
// policies each owning a single endpoint. The endpointsharding balancer
|
||||||
|
// forwards the LoadBalancingConfig in ClientConn state updates to its children.
|
||||||
|
func NewBalancer(cc balancer.ClientConn, opts balancer.BuildOptions, childBuilder ChildBuilderFunc, esOpts Options) balancer.Balancer {
|
||||||
|
es := &endpointSharding{
|
||||||
|
cc: cc,
|
||||||
|
bOpts: opts,
|
||||||
|
esOpts: esOpts,
|
||||||
|
childBuilder: childBuilder,
|
||||||
|
}
|
||||||
|
es.children.Store(resolver.NewEndpointMap())
|
||||||
|
return es
|
||||||
|
}
|
||||||
|
|
||||||
|
// endpointSharding is a balancer that wraps child balancers. It creates a child
|
||||||
|
// balancer with child config for every unique Endpoint received. It updates the
|
||||||
|
// child states on any update from parent or child.
|
||||||
|
type endpointSharding struct {
|
||||||
|
cc balancer.ClientConn
|
||||||
|
bOpts balancer.BuildOptions
|
||||||
|
esOpts Options
|
||||||
|
childBuilder ChildBuilderFunc
|
||||||
|
|
||||||
|
// childMu synchronizes calls to any single child. It must be held for all
|
||||||
|
// calls into a child. To avoid deadlocks, do not acquire childMu while
|
||||||
|
// holding mu.
|
||||||
|
childMu sync.Mutex
|
||||||
|
children atomic.Pointer[resolver.EndpointMap] // endpoint -> *balancerWrapper
|
||||||
|
|
||||||
|
// inhibitChildUpdates is set during UpdateClientConnState/ResolverError
|
||||||
|
// calls (calls to children will each produce an update, only want one
|
||||||
|
// update).
|
||||||
|
inhibitChildUpdates atomic.Bool
|
||||||
|
|
||||||
|
// mu synchronizes access to the state stored in balancerWrappers in the
|
||||||
|
// children field. mu must not be held during calls into a child since
|
||||||
|
// synchronous calls back from the child may require taking mu, causing a
|
||||||
|
// deadlock. To avoid deadlocks, do not acquire childMu while holding mu.
|
||||||
|
mu sync.Mutex
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpdateClientConnState creates a child for new endpoints and deletes children
|
||||||
|
// for endpoints that are no longer present. It also updates all the children,
|
||||||
|
// and sends a single synchronous update of the childrens' aggregated state at
|
||||||
|
// the end of the UpdateClientConnState operation. If any endpoint has no
|
||||||
|
// addresses it will ignore that endpoint. Otherwise, returns first error found
|
||||||
|
// from a child, but fully processes the new update.
|
||||||
|
func (es *endpointSharding) UpdateClientConnState(state balancer.ClientConnState) error {
|
||||||
|
es.childMu.Lock()
|
||||||
|
defer es.childMu.Unlock()
|
||||||
|
|
||||||
|
es.inhibitChildUpdates.Store(true)
|
||||||
|
defer func() {
|
||||||
|
es.inhibitChildUpdates.Store(false)
|
||||||
|
es.updateState()
|
||||||
|
}()
|
||||||
|
var ret error
|
||||||
|
|
||||||
|
children := es.children.Load()
|
||||||
|
newChildren := resolver.NewEndpointMap()
|
||||||
|
|
||||||
|
// Update/Create new children.
|
||||||
|
for _, endpoint := range state.ResolverState.Endpoints {
|
||||||
|
if _, ok := newChildren.Get(endpoint); ok {
|
||||||
|
// Endpoint child was already created, continue to avoid duplicate
|
||||||
|
// update.
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
var childBalancer *balancerWrapper
|
||||||
|
if val, ok := children.Get(endpoint); ok {
|
||||||
|
childBalancer = val.(*balancerWrapper)
|
||||||
|
// Endpoint attributes may have changed, update the stored endpoint.
|
||||||
|
es.mu.Lock()
|
||||||
|
childBalancer.childState.Endpoint = endpoint
|
||||||
|
es.mu.Unlock()
|
||||||
|
} else {
|
||||||
|
childBalancer = &balancerWrapper{
|
||||||
|
childState: ChildState{Endpoint: endpoint},
|
||||||
|
ClientConn: es.cc,
|
||||||
|
es: es,
|
||||||
|
}
|
||||||
|
childBalancer.childState.Balancer = childBalancer
|
||||||
|
childBalancer.child = es.childBuilder(childBalancer, es.bOpts)
|
||||||
|
}
|
||||||
|
newChildren.Set(endpoint, childBalancer)
|
||||||
|
if err := childBalancer.updateClientConnStateLocked(balancer.ClientConnState{
|
||||||
|
BalancerConfig: state.BalancerConfig,
|
||||||
|
ResolverState: resolver.State{
|
||||||
|
Endpoints: []resolver.Endpoint{endpoint},
|
||||||
|
Attributes: state.ResolverState.Attributes,
|
||||||
|
},
|
||||||
|
}); err != nil && ret == nil {
|
||||||
|
// Return first error found, and always commit full processing of
|
||||||
|
// updating children. If desired to process more specific errors
|
||||||
|
// across all endpoints, caller should make these specific
|
||||||
|
// validations, this is a current limitation for simplicity sake.
|
||||||
|
ret = err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Delete old children that are no longer present.
|
||||||
|
for _, e := range children.Keys() {
|
||||||
|
child, _ := children.Get(e)
|
||||||
|
if _, ok := newChildren.Get(e); !ok {
|
||||||
|
child.(*balancerWrapper).closeLocked()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
es.children.Store(newChildren)
|
||||||
|
if newChildren.Len() == 0 {
|
||||||
|
return balancer.ErrBadResolverState
|
||||||
|
}
|
||||||
|
return ret
|
||||||
|
}
|
||||||
|
|
||||||
|
// ResolverError forwards the resolver error to all of the endpointSharding's
|
||||||
|
// children and sends a single synchronous update of the childStates at the end
|
||||||
|
// of the ResolverError operation.
|
||||||
|
func (es *endpointSharding) ResolverError(err error) {
|
||||||
|
es.childMu.Lock()
|
||||||
|
defer es.childMu.Unlock()
|
||||||
|
es.inhibitChildUpdates.Store(true)
|
||||||
|
defer func() {
|
||||||
|
es.inhibitChildUpdates.Store(false)
|
||||||
|
es.updateState()
|
||||||
|
}()
|
||||||
|
children := es.children.Load()
|
||||||
|
for _, child := range children.Values() {
|
||||||
|
child.(*balancerWrapper).resolverErrorLocked(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (es *endpointSharding) UpdateSubConnState(balancer.SubConn, balancer.SubConnState) {
|
||||||
|
// UpdateSubConnState is deprecated.
|
||||||
|
}
|
||||||
|
|
||||||
|
func (es *endpointSharding) Close() {
|
||||||
|
es.childMu.Lock()
|
||||||
|
defer es.childMu.Unlock()
|
||||||
|
children := es.children.Load()
|
||||||
|
for _, child := range children.Values() {
|
||||||
|
child.(*balancerWrapper).closeLocked()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// updateState updates this component's state. It sends the aggregated state,
|
||||||
|
// and a picker with round robin behavior with all the child states present if
|
||||||
|
// needed.
|
||||||
|
func (es *endpointSharding) updateState() {
|
||||||
|
if es.inhibitChildUpdates.Load() {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
var readyPickers, connectingPickers, idlePickers, transientFailurePickers []balancer.Picker
|
||||||
|
|
||||||
|
es.mu.Lock()
|
||||||
|
defer es.mu.Unlock()
|
||||||
|
|
||||||
|
children := es.children.Load()
|
||||||
|
childStates := make([]ChildState, 0, children.Len())
|
||||||
|
|
||||||
|
for _, child := range children.Values() {
|
||||||
|
bw := child.(*balancerWrapper)
|
||||||
|
childState := bw.childState
|
||||||
|
childStates = append(childStates, childState)
|
||||||
|
childPicker := childState.State.Picker
|
||||||
|
switch childState.State.ConnectivityState {
|
||||||
|
case connectivity.Ready:
|
||||||
|
readyPickers = append(readyPickers, childPicker)
|
||||||
|
case connectivity.Connecting:
|
||||||
|
connectingPickers = append(connectingPickers, childPicker)
|
||||||
|
case connectivity.Idle:
|
||||||
|
idlePickers = append(idlePickers, childPicker)
|
||||||
|
case connectivity.TransientFailure:
|
||||||
|
transientFailurePickers = append(transientFailurePickers, childPicker)
|
||||||
|
// connectivity.Shutdown shouldn't appear.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Construct the round robin picker based off the aggregated state. Whatever
|
||||||
|
// the aggregated state, use the pickers present that are currently in that
|
||||||
|
// state only.
|
||||||
|
var aggState connectivity.State
|
||||||
|
var pickers []balancer.Picker
|
||||||
|
if len(readyPickers) >= 1 {
|
||||||
|
aggState = connectivity.Ready
|
||||||
|
pickers = readyPickers
|
||||||
|
} else if len(connectingPickers) >= 1 {
|
||||||
|
aggState = connectivity.Connecting
|
||||||
|
pickers = connectingPickers
|
||||||
|
} else if len(idlePickers) >= 1 {
|
||||||
|
aggState = connectivity.Idle
|
||||||
|
pickers = idlePickers
|
||||||
|
} else if len(transientFailurePickers) >= 1 {
|
||||||
|
aggState = connectivity.TransientFailure
|
||||||
|
pickers = transientFailurePickers
|
||||||
|
} else {
|
||||||
|
aggState = connectivity.TransientFailure
|
||||||
|
pickers = []balancer.Picker{base.NewErrPicker(errors.New("no children to pick from"))}
|
||||||
|
} // No children (resolver error before valid update).
|
||||||
|
p := &pickerWithChildStates{
|
||||||
|
pickers: pickers,
|
||||||
|
childStates: childStates,
|
||||||
|
next: uint32(rand.IntN(len(pickers))),
|
||||||
|
}
|
||||||
|
es.cc.UpdateState(balancer.State{
|
||||||
|
ConnectivityState: aggState,
|
||||||
|
Picker: p,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// pickerWithChildStates delegates to the pickers it holds in a round robin
|
||||||
|
// fashion. It also contains the childStates of all the endpointSharding's
|
||||||
|
// children.
|
||||||
|
type pickerWithChildStates struct {
|
||||||
|
pickers []balancer.Picker
|
||||||
|
childStates []ChildState
|
||||||
|
next uint32
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *pickerWithChildStates) Pick(info balancer.PickInfo) (balancer.PickResult, error) {
|
||||||
|
nextIndex := atomic.AddUint32(&p.next, 1)
|
||||||
|
picker := p.pickers[nextIndex%uint32(len(p.pickers))]
|
||||||
|
return picker.Pick(info)
|
||||||
|
}
|
||||||
|
|
||||||
|
// ChildStatesFromPicker returns the state of all the children managed by the
|
||||||
|
// endpoint sharding balancer that created this picker.
|
||||||
|
func ChildStatesFromPicker(picker balancer.Picker) []ChildState {
|
||||||
|
p, ok := picker.(*pickerWithChildStates)
|
||||||
|
if !ok {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return p.childStates
|
||||||
|
}
|
||||||
|
|
||||||
|
// balancerWrapper is a wrapper of a balancer. It ID's a child balancer by
|
||||||
|
// endpoint, and persists recent child balancer state.
|
||||||
|
type balancerWrapper struct {
|
||||||
|
// The following fields are initialized at build time and read-only after
|
||||||
|
// that and therefore do not need to be guarded by a mutex.
|
||||||
|
|
||||||
|
// child contains the wrapped balancer. Access its methods only through
|
||||||
|
// methods on balancerWrapper to ensure proper synchronization
|
||||||
|
child balancer.Balancer
|
||||||
|
balancer.ClientConn // embed to intercept UpdateState, doesn't deal with SubConns
|
||||||
|
|
||||||
|
es *endpointSharding
|
||||||
|
|
||||||
|
// Access to the following fields is guarded by es.mu.
|
||||||
|
|
||||||
|
childState ChildState
|
||||||
|
isClosed bool
|
||||||
|
}
|
||||||
|
|
||||||
|
func (bw *balancerWrapper) UpdateState(state balancer.State) {
|
||||||
|
bw.es.mu.Lock()
|
||||||
|
bw.childState.State = state
|
||||||
|
bw.es.mu.Unlock()
|
||||||
|
if state.ConnectivityState == connectivity.Idle && !bw.es.esOpts.DisableAutoReconnect {
|
||||||
|
bw.ExitIdle()
|
||||||
|
}
|
||||||
|
bw.es.updateState()
|
||||||
|
}
|
||||||
|
|
||||||
|
// ExitIdle pings an IDLE child balancer to exit idle in a new goroutine to
|
||||||
|
// avoid deadlocks due to synchronous balancer state updates.
|
||||||
|
func (bw *balancerWrapper) ExitIdle() {
|
||||||
|
if ei, ok := bw.child.(balancer.ExitIdler); ok {
|
||||||
|
go func() {
|
||||||
|
bw.es.childMu.Lock()
|
||||||
|
if !bw.isClosed {
|
||||||
|
ei.ExitIdle()
|
||||||
|
}
|
||||||
|
bw.es.childMu.Unlock()
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// updateClientConnStateLocked delivers the ClientConnState to the child
|
||||||
|
// balancer. Callers must hold the child mutex of the parent endpointsharding
|
||||||
|
// balancer.
|
||||||
|
func (bw *balancerWrapper) updateClientConnStateLocked(ccs balancer.ClientConnState) error {
|
||||||
|
return bw.child.UpdateClientConnState(ccs)
|
||||||
|
}
|
||||||
|
|
||||||
|
// closeLocked closes the child balancer. Callers must hold the child mutext of
|
||||||
|
// the parent endpointsharding balancer.
|
||||||
|
func (bw *balancerWrapper) closeLocked() {
|
||||||
|
bw.child.Close()
|
||||||
|
bw.isClosed = true
|
||||||
|
}
|
||||||
|
|
||||||
|
func (bw *balancerWrapper) resolverErrorLocked(err error) {
|
||||||
|
bw.child.ResolverError(err)
|
||||||
|
}
|
2
vendor/google.golang.org/grpc/balancer/pickfirst/pickfirstleaf/pickfirstleaf.go
generated
vendored
2
vendor/google.golang.org/grpc/balancer/pickfirst/pickfirstleaf/pickfirstleaf.go
generated
vendored
@ -120,7 +120,7 @@ func (pickfirstBuilder) Build(cc balancer.ClientConn, bo balancer.BuildOptions)
|
|||||||
b := &pickfirstBalancer{
|
b := &pickfirstBalancer{
|
||||||
cc: cc,
|
cc: cc,
|
||||||
target: bo.Target.String(),
|
target: bo.Target.String(),
|
||||||
metricsRecorder: bo.MetricsRecorder, // ClientConn will always create a Metrics Recorder.
|
metricsRecorder: cc.MetricsRecorder(),
|
||||||
|
|
||||||
subConns: resolver.NewAddressMap(),
|
subConns: resolver.NewAddressMap(),
|
||||||
state: connectivity.Connecting,
|
state: connectivity.Connecting,
|
||||||
|
78
vendor/google.golang.org/grpc/balancer/roundrobin/roundrobin.go
generated
vendored
78
vendor/google.golang.org/grpc/balancer/roundrobin/roundrobin.go
generated
vendored
@ -22,12 +22,13 @@
|
|||||||
package roundrobin
|
package roundrobin
|
||||||
|
|
||||||
import (
|
import (
|
||||||
rand "math/rand/v2"
|
"fmt"
|
||||||
"sync/atomic"
|
|
||||||
|
|
||||||
"google.golang.org/grpc/balancer"
|
"google.golang.org/grpc/balancer"
|
||||||
"google.golang.org/grpc/balancer/base"
|
"google.golang.org/grpc/balancer/endpointsharding"
|
||||||
|
"google.golang.org/grpc/balancer/pickfirst/pickfirstleaf"
|
||||||
"google.golang.org/grpc/grpclog"
|
"google.golang.org/grpc/grpclog"
|
||||||
|
internalgrpclog "google.golang.org/grpc/internal/grpclog"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Name is the name of round_robin balancer.
|
// Name is the name of round_robin balancer.
|
||||||
@ -35,47 +36,44 @@ const Name = "round_robin"
|
|||||||
|
|
||||||
var logger = grpclog.Component("roundrobin")
|
var logger = grpclog.Component("roundrobin")
|
||||||
|
|
||||||
// newBuilder creates a new roundrobin balancer builder.
|
|
||||||
func newBuilder() balancer.Builder {
|
|
||||||
return base.NewBalancerBuilder(Name, &rrPickerBuilder{}, base.Config{HealthCheck: true})
|
|
||||||
}
|
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
balancer.Register(newBuilder())
|
balancer.Register(builder{})
|
||||||
}
|
}
|
||||||
|
|
||||||
type rrPickerBuilder struct{}
|
type builder struct{}
|
||||||
|
|
||||||
func (*rrPickerBuilder) Build(info base.PickerBuildInfo) balancer.Picker {
|
func (bb builder) Name() string {
|
||||||
logger.Infof("roundrobinPicker: Build called with info: %v", info)
|
return Name
|
||||||
if len(info.ReadySCs) == 0 {
|
}
|
||||||
return base.NewErrPicker(balancer.ErrNoSubConnAvailable)
|
|
||||||
|
func (bb builder) Build(cc balancer.ClientConn, opts balancer.BuildOptions) balancer.Balancer {
|
||||||
|
childBuilder := balancer.Get(pickfirstleaf.Name).Build
|
||||||
|
bal := &rrBalancer{
|
||||||
|
cc: cc,
|
||||||
|
Balancer: endpointsharding.NewBalancer(cc, opts, childBuilder, endpointsharding.Options{}),
|
||||||
}
|
}
|
||||||
scs := make([]balancer.SubConn, 0, len(info.ReadySCs))
|
bal.logger = internalgrpclog.NewPrefixLogger(logger, fmt.Sprintf("[%p] ", bal))
|
||||||
for sc := range info.ReadySCs {
|
bal.logger.Infof("Created")
|
||||||
scs = append(scs, sc)
|
return bal
|
||||||
}
|
}
|
||||||
return &rrPicker{
|
|
||||||
subConns: scs,
|
type rrBalancer struct {
|
||||||
// Start at a random index, as the same RR balancer rebuilds a new
|
balancer.Balancer
|
||||||
// picker when SubConn states change, and we don't want to apply excess
|
cc balancer.ClientConn
|
||||||
// load to the first server in the list.
|
logger *internalgrpclog.PrefixLogger
|
||||||
next: uint32(rand.IntN(len(scs))),
|
}
|
||||||
|
|
||||||
|
func (b *rrBalancer) UpdateClientConnState(ccs balancer.ClientConnState) error {
|
||||||
|
return b.Balancer.UpdateClientConnState(balancer.ClientConnState{
|
||||||
|
// Enable the health listener in pickfirst children for client side health
|
||||||
|
// checks and outlier detection, if configured.
|
||||||
|
ResolverState: pickfirstleaf.EnableHealthListener(ccs.ResolverState),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func (b *rrBalancer) ExitIdle() {
|
||||||
|
// Should always be ok, as child is endpoint sharding.
|
||||||
|
if ei, ok := b.Balancer.(balancer.ExitIdler); ok {
|
||||||
|
ei.ExitIdle()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
type rrPicker struct {
|
|
||||||
// subConns is the snapshot of the roundrobin balancer when this picker was
|
|
||||||
// created. The slice is immutable. Each Get() will do a round robin
|
|
||||||
// selection from it and return the selected SubConn.
|
|
||||||
subConns []balancer.SubConn
|
|
||||||
next uint32
|
|
||||||
}
|
|
||||||
|
|
||||||
func (p *rrPicker) Pick(balancer.PickInfo) (balancer.PickResult, error) {
|
|
||||||
subConnsLen := uint32(len(p.subConns))
|
|
||||||
nextIndex := atomic.AddUint32(&p.next, 1)
|
|
||||||
|
|
||||||
sc := p.subConns[nextIndex%subConnsLen]
|
|
||||||
return balancer.PickResult{SubConn: sc}, nil
|
|
||||||
}
|
|
||||||
|
2
vendor/google.golang.org/grpc/balancer/subconn.go
generated
vendored
2
vendor/google.golang.org/grpc/balancer/subconn.go
generated
vendored
@ -44,7 +44,7 @@ import (
|
|||||||
// should only use a single address.
|
// should only use a single address.
|
||||||
//
|
//
|
||||||
// NOTICE: This interface is intended to be implemented by gRPC, or intercepted
|
// NOTICE: This interface is intended to be implemented by gRPC, or intercepted
|
||||||
// by custom load balancing poilices. Users should not need their own complete
|
// by custom load balancing polices. Users should not need their own complete
|
||||||
// implementation of this interface -- they should always delegate to a SubConn
|
// implementation of this interface -- they should always delegate to a SubConn
|
||||||
// returned by ClientConn.NewSubConn() by embedding it in their implementations.
|
// returned by ClientConn.NewSubConn() by embedding it in their implementations.
|
||||||
// An embedded SubConn must never be nil, or runtime panics will occur.
|
// An embedded SubConn must never be nil, or runtime panics will occur.
|
||||||
|
9
vendor/google.golang.org/grpc/balancer_wrapper.go
generated
vendored
9
vendor/google.golang.org/grpc/balancer_wrapper.go
generated
vendored
@ -26,6 +26,7 @@ import (
|
|||||||
"google.golang.org/grpc/balancer"
|
"google.golang.org/grpc/balancer"
|
||||||
"google.golang.org/grpc/codes"
|
"google.golang.org/grpc/codes"
|
||||||
"google.golang.org/grpc/connectivity"
|
"google.golang.org/grpc/connectivity"
|
||||||
|
"google.golang.org/grpc/experimental/stats"
|
||||||
"google.golang.org/grpc/internal"
|
"google.golang.org/grpc/internal"
|
||||||
"google.golang.org/grpc/internal/balancer/gracefulswitch"
|
"google.golang.org/grpc/internal/balancer/gracefulswitch"
|
||||||
"google.golang.org/grpc/internal/channelz"
|
"google.golang.org/grpc/internal/channelz"
|
||||||
@ -59,6 +60,7 @@ var (
|
|||||||
// It uses the gracefulswitch.Balancer internally to ensure that balancer
|
// It uses the gracefulswitch.Balancer internally to ensure that balancer
|
||||||
// switches happen in a graceful manner.
|
// switches happen in a graceful manner.
|
||||||
type ccBalancerWrapper struct {
|
type ccBalancerWrapper struct {
|
||||||
|
internal.EnforceClientConnEmbedding
|
||||||
// The following fields are initialized when the wrapper is created and are
|
// The following fields are initialized when the wrapper is created and are
|
||||||
// read-only afterwards, and therefore can be accessed without a mutex.
|
// read-only afterwards, and therefore can be accessed without a mutex.
|
||||||
cc *ClientConn
|
cc *ClientConn
|
||||||
@ -92,7 +94,6 @@ func newCCBalancerWrapper(cc *ClientConn) *ccBalancerWrapper {
|
|||||||
CustomUserAgent: cc.dopts.copts.UserAgent,
|
CustomUserAgent: cc.dopts.copts.UserAgent,
|
||||||
ChannelzParent: cc.channelz,
|
ChannelzParent: cc.channelz,
|
||||||
Target: cc.parsedTarget,
|
Target: cc.parsedTarget,
|
||||||
MetricsRecorder: cc.metricsRecorderList,
|
|
||||||
},
|
},
|
||||||
serializer: grpcsync.NewCallbackSerializer(ctx),
|
serializer: grpcsync.NewCallbackSerializer(ctx),
|
||||||
serializerCancel: cancel,
|
serializerCancel: cancel,
|
||||||
@ -101,6 +102,10 @@ func newCCBalancerWrapper(cc *ClientConn) *ccBalancerWrapper {
|
|||||||
return ccb
|
return ccb
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (ccb *ccBalancerWrapper) MetricsRecorder() stats.MetricsRecorder {
|
||||||
|
return ccb.cc.metricsRecorderList
|
||||||
|
}
|
||||||
|
|
||||||
// updateClientConnState is invoked by grpc to push a ClientConnState update to
|
// updateClientConnState is invoked by grpc to push a ClientConnState update to
|
||||||
// the underlying balancer. This is always executed from the serializer, so
|
// the underlying balancer. This is always executed from the serializer, so
|
||||||
// it is safe to call into the balancer here.
|
// it is safe to call into the balancer here.
|
||||||
@ -415,7 +420,7 @@ func (acbw *acBalancerWrapper) GetOrBuildProducer(pb balancer.ProducerBuilder) (
|
|||||||
}
|
}
|
||||||
acbw.producersMu.Unlock()
|
acbw.producersMu.Unlock()
|
||||||
}
|
}
|
||||||
return pData.producer, grpcsync.OnceFunc(unref)
|
return pData.producer, sync.OnceFunc(unref)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (acbw *acBalancerWrapper) closeProducers() {
|
func (acbw *acBalancerWrapper) closeProducers() {
|
||||||
|
118
vendor/google.golang.org/grpc/binarylog/grpc_binarylog_v1/binarylog.pb.go
generated
vendored
118
vendor/google.golang.org/grpc/binarylog/grpc_binarylog_v1/binarylog.pb.go
generated
vendored
@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
// versions:
|
// versions:
|
||||||
// protoc-gen-go v1.35.2
|
// protoc-gen-go v1.36.4
|
||||||
// protoc v5.27.1
|
// protoc v5.27.1
|
||||||
// source: grpc/binlog/v1/binarylog.proto
|
// source: grpc/binlog/v1/binarylog.proto
|
||||||
|
|
||||||
@ -31,6 +31,7 @@ import (
|
|||||||
timestamppb "google.golang.org/protobuf/types/known/timestamppb"
|
timestamppb "google.golang.org/protobuf/types/known/timestamppb"
|
||||||
reflect "reflect"
|
reflect "reflect"
|
||||||
sync "sync"
|
sync "sync"
|
||||||
|
unsafe "unsafe"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -233,10 +234,7 @@ func (Address_Type) EnumDescriptor() ([]byte, []int) {
|
|||||||
|
|
||||||
// Log entry we store in binary logs
|
// Log entry we store in binary logs
|
||||||
type GrpcLogEntry struct {
|
type GrpcLogEntry struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
|
||||||
unknownFields protoimpl.UnknownFields
|
|
||||||
|
|
||||||
// The timestamp of the binary log message
|
// The timestamp of the binary log message
|
||||||
Timestamp *timestamppb.Timestamp `protobuf:"bytes,1,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
|
Timestamp *timestamppb.Timestamp `protobuf:"bytes,1,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
|
||||||
// Uniquely identifies a call. The value must not be 0 in order to disambiguate
|
// Uniquely identifies a call. The value must not be 0 in order to disambiguate
|
||||||
@ -255,7 +253,7 @@ type GrpcLogEntry struct {
|
|||||||
// The logger uses one of the following fields to record the payload,
|
// The logger uses one of the following fields to record the payload,
|
||||||
// according to the type of the log entry.
|
// according to the type of the log entry.
|
||||||
//
|
//
|
||||||
// Types that are assignable to Payload:
|
// Types that are valid to be assigned to Payload:
|
||||||
//
|
//
|
||||||
// *GrpcLogEntry_ClientHeader
|
// *GrpcLogEntry_ClientHeader
|
||||||
// *GrpcLogEntry_ServerHeader
|
// *GrpcLogEntry_ServerHeader
|
||||||
@ -269,7 +267,9 @@ type GrpcLogEntry struct {
|
|||||||
// EVENT_TYPE_SERVER_HEADER normally or EVENT_TYPE_SERVER_TRAILER in
|
// EVENT_TYPE_SERVER_HEADER normally or EVENT_TYPE_SERVER_TRAILER in
|
||||||
// the case of trailers-only. On server side, peer is always
|
// the case of trailers-only. On server side, peer is always
|
||||||
// logged on EVENT_TYPE_CLIENT_HEADER.
|
// logged on EVENT_TYPE_CLIENT_HEADER.
|
||||||
Peer *Address `protobuf:"bytes,11,opt,name=peer,proto3" json:"peer,omitempty"`
|
Peer *Address `protobuf:"bytes,11,opt,name=peer,proto3" json:"peer,omitempty"`
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *GrpcLogEntry) Reset() {
|
func (x *GrpcLogEntry) Reset() {
|
||||||
@ -337,37 +337,45 @@ func (x *GrpcLogEntry) GetLogger() GrpcLogEntry_Logger {
|
|||||||
return GrpcLogEntry_LOGGER_UNKNOWN
|
return GrpcLogEntry_LOGGER_UNKNOWN
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *GrpcLogEntry) GetPayload() isGrpcLogEntry_Payload {
|
func (x *GrpcLogEntry) GetPayload() isGrpcLogEntry_Payload {
|
||||||
if m != nil {
|
if x != nil {
|
||||||
return m.Payload
|
return x.Payload
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *GrpcLogEntry) GetClientHeader() *ClientHeader {
|
func (x *GrpcLogEntry) GetClientHeader() *ClientHeader {
|
||||||
if x, ok := x.GetPayload().(*GrpcLogEntry_ClientHeader); ok {
|
if x != nil {
|
||||||
return x.ClientHeader
|
if x, ok := x.Payload.(*GrpcLogEntry_ClientHeader); ok {
|
||||||
|
return x.ClientHeader
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *GrpcLogEntry) GetServerHeader() *ServerHeader {
|
func (x *GrpcLogEntry) GetServerHeader() *ServerHeader {
|
||||||
if x, ok := x.GetPayload().(*GrpcLogEntry_ServerHeader); ok {
|
if x != nil {
|
||||||
return x.ServerHeader
|
if x, ok := x.Payload.(*GrpcLogEntry_ServerHeader); ok {
|
||||||
|
return x.ServerHeader
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *GrpcLogEntry) GetMessage() *Message {
|
func (x *GrpcLogEntry) GetMessage() *Message {
|
||||||
if x, ok := x.GetPayload().(*GrpcLogEntry_Message); ok {
|
if x != nil {
|
||||||
return x.Message
|
if x, ok := x.Payload.(*GrpcLogEntry_Message); ok {
|
||||||
|
return x.Message
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *GrpcLogEntry) GetTrailer() *Trailer {
|
func (x *GrpcLogEntry) GetTrailer() *Trailer {
|
||||||
if x, ok := x.GetPayload().(*GrpcLogEntry_Trailer); ok {
|
if x != nil {
|
||||||
return x.Trailer
|
if x, ok := x.Payload.(*GrpcLogEntry_Trailer); ok {
|
||||||
|
return x.Trailer
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -416,10 +424,7 @@ func (*GrpcLogEntry_Message) isGrpcLogEntry_Payload() {}
|
|||||||
func (*GrpcLogEntry_Trailer) isGrpcLogEntry_Payload() {}
|
func (*GrpcLogEntry_Trailer) isGrpcLogEntry_Payload() {}
|
||||||
|
|
||||||
type ClientHeader struct {
|
type ClientHeader struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
|
||||||
unknownFields protoimpl.UnknownFields
|
|
||||||
|
|
||||||
// This contains only the metadata from the application.
|
// This contains only the metadata from the application.
|
||||||
Metadata *Metadata `protobuf:"bytes,1,opt,name=metadata,proto3" json:"metadata,omitempty"`
|
Metadata *Metadata `protobuf:"bytes,1,opt,name=metadata,proto3" json:"metadata,omitempty"`
|
||||||
// The name of the RPC method, which looks something like:
|
// The name of the RPC method, which looks something like:
|
||||||
@ -433,7 +438,9 @@ type ClientHeader struct {
|
|||||||
// <host> or <host>:<port> .
|
// <host> or <host>:<port> .
|
||||||
Authority string `protobuf:"bytes,3,opt,name=authority,proto3" json:"authority,omitempty"`
|
Authority string `protobuf:"bytes,3,opt,name=authority,proto3" json:"authority,omitempty"`
|
||||||
// the RPC timeout
|
// the RPC timeout
|
||||||
Timeout *durationpb.Duration `protobuf:"bytes,4,opt,name=timeout,proto3" json:"timeout,omitempty"`
|
Timeout *durationpb.Duration `protobuf:"bytes,4,opt,name=timeout,proto3" json:"timeout,omitempty"`
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *ClientHeader) Reset() {
|
func (x *ClientHeader) Reset() {
|
||||||
@ -495,12 +502,11 @@ func (x *ClientHeader) GetTimeout() *durationpb.Duration {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type ServerHeader struct {
|
type ServerHeader struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
|
||||||
unknownFields protoimpl.UnknownFields
|
|
||||||
|
|
||||||
// This contains only the metadata from the application.
|
// This contains only the metadata from the application.
|
||||||
Metadata *Metadata `protobuf:"bytes,1,opt,name=metadata,proto3" json:"metadata,omitempty"`
|
Metadata *Metadata `protobuf:"bytes,1,opt,name=metadata,proto3" json:"metadata,omitempty"`
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *ServerHeader) Reset() {
|
func (x *ServerHeader) Reset() {
|
||||||
@ -541,10 +547,7 @@ func (x *ServerHeader) GetMetadata() *Metadata {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type Trailer struct {
|
type Trailer struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
|
||||||
unknownFields protoimpl.UnknownFields
|
|
||||||
|
|
||||||
// This contains only the metadata from the application.
|
// This contains only the metadata from the application.
|
||||||
Metadata *Metadata `protobuf:"bytes,1,opt,name=metadata,proto3" json:"metadata,omitempty"`
|
Metadata *Metadata `protobuf:"bytes,1,opt,name=metadata,proto3" json:"metadata,omitempty"`
|
||||||
// The gRPC status code.
|
// The gRPC status code.
|
||||||
@ -555,6 +558,8 @@ type Trailer struct {
|
|||||||
// The value of the 'grpc-status-details-bin' metadata key. If
|
// The value of the 'grpc-status-details-bin' metadata key. If
|
||||||
// present, this is always an encoded 'google.rpc.Status' message.
|
// present, this is always an encoded 'google.rpc.Status' message.
|
||||||
StatusDetails []byte `protobuf:"bytes,4,opt,name=status_details,json=statusDetails,proto3" json:"status_details,omitempty"`
|
StatusDetails []byte `protobuf:"bytes,4,opt,name=status_details,json=statusDetails,proto3" json:"status_details,omitempty"`
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *Trailer) Reset() {
|
func (x *Trailer) Reset() {
|
||||||
@ -617,15 +622,14 @@ func (x *Trailer) GetStatusDetails() []byte {
|
|||||||
|
|
||||||
// Message payload, used by CLIENT_MESSAGE and SERVER_MESSAGE
|
// Message payload, used by CLIENT_MESSAGE and SERVER_MESSAGE
|
||||||
type Message struct {
|
type Message struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
|
||||||
unknownFields protoimpl.UnknownFields
|
|
||||||
|
|
||||||
// Length of the message. It may not be the same as the length of the
|
// Length of the message. It may not be the same as the length of the
|
||||||
// data field, as the logging payload can be truncated or omitted.
|
// data field, as the logging payload can be truncated or omitted.
|
||||||
Length uint32 `protobuf:"varint,1,opt,name=length,proto3" json:"length,omitempty"`
|
Length uint32 `protobuf:"varint,1,opt,name=length,proto3" json:"length,omitempty"`
|
||||||
// May be truncated or omitted.
|
// May be truncated or omitted.
|
||||||
Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"`
|
Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"`
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *Message) Reset() {
|
func (x *Message) Reset() {
|
||||||
@ -694,11 +698,10 @@ func (x *Message) GetData() []byte {
|
|||||||
// header is just a normal metadata key.
|
// header is just a normal metadata key.
|
||||||
// The pair will not count towards the size limit.
|
// The pair will not count towards the size limit.
|
||||||
type Metadata struct {
|
type Metadata struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
Entry []*MetadataEntry `protobuf:"bytes,1,rep,name=entry,proto3" json:"entry,omitempty"`
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
Entry []*MetadataEntry `protobuf:"bytes,1,rep,name=entry,proto3" json:"entry,omitempty"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *Metadata) Reset() {
|
func (x *Metadata) Reset() {
|
||||||
@ -740,12 +743,11 @@ func (x *Metadata) GetEntry() []*MetadataEntry {
|
|||||||
|
|
||||||
// A metadata key value pair
|
// A metadata key value pair
|
||||||
type MetadataEntry struct {
|
type MetadataEntry struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
|
||||||
|
Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
|
|
||||||
Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *MetadataEntry) Reset() {
|
func (x *MetadataEntry) Reset() {
|
||||||
@ -794,14 +796,13 @@ func (x *MetadataEntry) GetValue() []byte {
|
|||||||
|
|
||||||
// Address information
|
// Address information
|
||||||
type Address struct {
|
type Address struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
Type Address_Type `protobuf:"varint,1,opt,name=type,proto3,enum=grpc.binarylog.v1.Address_Type" json:"type,omitempty"`
|
||||||
unknownFields protoimpl.UnknownFields
|
Address string `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty"`
|
||||||
|
|
||||||
Type Address_Type `protobuf:"varint,1,opt,name=type,proto3,enum=grpc.binarylog.v1.Address_Type" json:"type,omitempty"`
|
|
||||||
Address string `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty"`
|
|
||||||
// only for TYPE_IPV4 and TYPE_IPV6
|
// only for TYPE_IPV4 and TYPE_IPV6
|
||||||
IpPort uint32 `protobuf:"varint,3,opt,name=ip_port,json=ipPort,proto3" json:"ip_port,omitempty"`
|
IpPort uint32 `protobuf:"varint,3,opt,name=ip_port,json=ipPort,proto3" json:"ip_port,omitempty"`
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *Address) Reset() {
|
func (x *Address) Reset() {
|
||||||
@ -857,7 +858,7 @@ func (x *Address) GetIpPort() uint32 {
|
|||||||
|
|
||||||
var File_grpc_binlog_v1_binarylog_proto protoreflect.FileDescriptor
|
var File_grpc_binlog_v1_binarylog_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
var file_grpc_binlog_v1_binarylog_proto_rawDesc = []byte{
|
var file_grpc_binlog_v1_binarylog_proto_rawDesc = string([]byte{
|
||||||
0x0a, 0x1e, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x62, 0x69, 0x6e, 0x6c, 0x6f, 0x67, 0x2f, 0x76, 0x31,
|
0x0a, 0x1e, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x62, 0x69, 0x6e, 0x6c, 0x6f, 0x67, 0x2f, 0x76, 0x31,
|
||||||
0x2f, 0x62, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x6c, 0x6f, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
0x2f, 0x62, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x6c, 0x6f, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
||||||
0x12, 0x11, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x62, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x6c, 0x6f, 0x67,
|
0x12, 0x11, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x62, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x6c, 0x6f, 0x67,
|
||||||
@ -983,16 +984,16 @@ var file_grpc_binlog_v1_binarylog_proto_rawDesc = []byte{
|
|||||||
0x69, 0x6e, 0x61, 0x72, 0x79, 0x6c, 0x6f, 0x67, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x5f, 0x62, 0x69,
|
0x69, 0x6e, 0x61, 0x72, 0x79, 0x6c, 0x6f, 0x67, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x5f, 0x62, 0x69,
|
||||||
0x6e, 0x61, 0x72, 0x79, 0x6c, 0x6f, 0x67, 0x5f, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74,
|
0x6e, 0x61, 0x72, 0x79, 0x6c, 0x6f, 0x67, 0x5f, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74,
|
||||||
0x6f, 0x33,
|
0x6f, 0x33,
|
||||||
}
|
})
|
||||||
|
|
||||||
var (
|
var (
|
||||||
file_grpc_binlog_v1_binarylog_proto_rawDescOnce sync.Once
|
file_grpc_binlog_v1_binarylog_proto_rawDescOnce sync.Once
|
||||||
file_grpc_binlog_v1_binarylog_proto_rawDescData = file_grpc_binlog_v1_binarylog_proto_rawDesc
|
file_grpc_binlog_v1_binarylog_proto_rawDescData []byte
|
||||||
)
|
)
|
||||||
|
|
||||||
func file_grpc_binlog_v1_binarylog_proto_rawDescGZIP() []byte {
|
func file_grpc_binlog_v1_binarylog_proto_rawDescGZIP() []byte {
|
||||||
file_grpc_binlog_v1_binarylog_proto_rawDescOnce.Do(func() {
|
file_grpc_binlog_v1_binarylog_proto_rawDescOnce.Do(func() {
|
||||||
file_grpc_binlog_v1_binarylog_proto_rawDescData = protoimpl.X.CompressGZIP(file_grpc_binlog_v1_binarylog_proto_rawDescData)
|
file_grpc_binlog_v1_binarylog_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_grpc_binlog_v1_binarylog_proto_rawDesc), len(file_grpc_binlog_v1_binarylog_proto_rawDesc)))
|
||||||
})
|
})
|
||||||
return file_grpc_binlog_v1_binarylog_proto_rawDescData
|
return file_grpc_binlog_v1_binarylog_proto_rawDescData
|
||||||
}
|
}
|
||||||
@ -1051,7 +1052,7 @@ func file_grpc_binlog_v1_binarylog_proto_init() {
|
|||||||
out := protoimpl.TypeBuilder{
|
out := protoimpl.TypeBuilder{
|
||||||
File: protoimpl.DescBuilder{
|
File: protoimpl.DescBuilder{
|
||||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||||
RawDescriptor: file_grpc_binlog_v1_binarylog_proto_rawDesc,
|
RawDescriptor: unsafe.Slice(unsafe.StringData(file_grpc_binlog_v1_binarylog_proto_rawDesc), len(file_grpc_binlog_v1_binarylog_proto_rawDesc)),
|
||||||
NumEnums: 3,
|
NumEnums: 3,
|
||||||
NumMessages: 8,
|
NumMessages: 8,
|
||||||
NumExtensions: 0,
|
NumExtensions: 0,
|
||||||
@ -1063,7 +1064,6 @@ func file_grpc_binlog_v1_binarylog_proto_init() {
|
|||||||
MessageInfos: file_grpc_binlog_v1_binarylog_proto_msgTypes,
|
MessageInfos: file_grpc_binlog_v1_binarylog_proto_msgTypes,
|
||||||
}.Build()
|
}.Build()
|
||||||
File_grpc_binlog_v1_binarylog_proto = out.File
|
File_grpc_binlog_v1_binarylog_proto = out.File
|
||||||
file_grpc_binlog_v1_binarylog_proto_rawDesc = nil
|
|
||||||
file_grpc_binlog_v1_binarylog_proto_goTypes = nil
|
file_grpc_binlog_v1_binarylog_proto_goTypes = nil
|
||||||
file_grpc_binlog_v1_binarylog_proto_depIdxs = nil
|
file_grpc_binlog_v1_binarylog_proto_depIdxs = nil
|
||||||
}
|
}
|
||||||
|
47
vendor/google.golang.org/grpc/clientconn.go
generated
vendored
47
vendor/google.golang.org/grpc/clientconn.go
generated
vendored
@ -118,12 +118,26 @@ func (dcs *defaultConfigSelector) SelectConfig(rpcInfo iresolver.RPCInfo) (*ires
|
|||||||
|
|
||||||
// NewClient creates a new gRPC "channel" for the target URI provided. No I/O
|
// NewClient creates a new gRPC "channel" for the target URI provided. No I/O
|
||||||
// is performed. Use of the ClientConn for RPCs will automatically cause it to
|
// is performed. Use of the ClientConn for RPCs will automatically cause it to
|
||||||
// connect. Connect may be used to manually create a connection, but for most
|
// connect. The Connect method may be called to manually create a connection,
|
||||||
// users this is unnecessary.
|
// but for most users this should be unnecessary.
|
||||||
//
|
//
|
||||||
// The target name syntax is defined in
|
// The target name syntax is defined in
|
||||||
// https://github.com/grpc/grpc/blob/master/doc/naming.md. e.g. to use dns
|
// https://github.com/grpc/grpc/blob/master/doc/naming.md. E.g. to use the dns
|
||||||
// resolver, a "dns:///" prefix should be applied to the target.
|
// name resolver, a "dns:///" prefix may be applied to the target. The default
|
||||||
|
// name resolver will be used if no scheme is detected, or if the parsed scheme
|
||||||
|
// is not a registered name resolver. The default resolver is "dns" but can be
|
||||||
|
// overridden using the resolver package's SetDefaultScheme.
|
||||||
|
//
|
||||||
|
// Examples:
|
||||||
|
//
|
||||||
|
// - "foo.googleapis.com:8080"
|
||||||
|
// - "dns:///foo.googleapis.com:8080"
|
||||||
|
// - "dns:///foo.googleapis.com"
|
||||||
|
// - "dns:///10.0.0.213:8080"
|
||||||
|
// - "dns:///%5B2001:db8:85a3:8d3:1319:8a2e:370:7348%5D:443"
|
||||||
|
// - "dns://8.8.8.8/foo.googleapis.com:8080"
|
||||||
|
// - "dns://8.8.8.8/foo.googleapis.com"
|
||||||
|
// - "zookeeper://zk.example.com:9900/example_service"
|
||||||
//
|
//
|
||||||
// The DialOptions returned by WithBlock, WithTimeout,
|
// The DialOptions returned by WithBlock, WithTimeout,
|
||||||
// WithReturnConnectionError, and FailOnNonTempDialError are ignored by this
|
// WithReturnConnectionError, and FailOnNonTempDialError are ignored by this
|
||||||
@ -181,7 +195,7 @@ func NewClient(target string, opts ...DialOption) (conn *ClientConn, err error)
|
|||||||
}
|
}
|
||||||
cc.dopts.defaultServiceConfig, _ = scpr.Config.(*ServiceConfig)
|
cc.dopts.defaultServiceConfig, _ = scpr.Config.(*ServiceConfig)
|
||||||
}
|
}
|
||||||
cc.mkp = cc.dopts.copts.KeepaliveParams
|
cc.keepaliveParams = cc.dopts.copts.KeepaliveParams
|
||||||
|
|
||||||
if err = cc.initAuthority(); err != nil {
|
if err = cc.initAuthority(); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -225,7 +239,12 @@ func Dial(target string, opts ...DialOption) (*ClientConn, error) {
|
|||||||
func DialContext(ctx context.Context, target string, opts ...DialOption) (conn *ClientConn, err error) {
|
func DialContext(ctx context.Context, target string, opts ...DialOption) (conn *ClientConn, err error) {
|
||||||
// At the end of this method, we kick the channel out of idle, rather than
|
// At the end of this method, we kick the channel out of idle, rather than
|
||||||
// waiting for the first rpc.
|
// waiting for the first rpc.
|
||||||
opts = append([]DialOption{withDefaultScheme("passthrough")}, opts...)
|
//
|
||||||
|
// WithLocalDNSResolution dial option in `grpc.Dial` ensures that it
|
||||||
|
// preserves behavior: when default scheme passthrough is used, skip
|
||||||
|
// hostname resolution, when "dns" is used for resolution, perform
|
||||||
|
// resolution on the client.
|
||||||
|
opts = append([]DialOption{withDefaultScheme("passthrough"), WithLocalDNSResolution()}, opts...)
|
||||||
cc, err := NewClient(target, opts...)
|
cc, err := NewClient(target, opts...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -618,7 +637,7 @@ type ClientConn struct {
|
|||||||
balancerWrapper *ccBalancerWrapper // Always recreated whenever entering idle to simplify Close.
|
balancerWrapper *ccBalancerWrapper // Always recreated whenever entering idle to simplify Close.
|
||||||
sc *ServiceConfig // Latest service config received from the resolver.
|
sc *ServiceConfig // Latest service config received from the resolver.
|
||||||
conns map[*addrConn]struct{} // Set to nil on close.
|
conns map[*addrConn]struct{} // Set to nil on close.
|
||||||
mkp keepalive.ClientParameters // May be updated upon receipt of a GoAway.
|
keepaliveParams keepalive.ClientParameters // May be updated upon receipt of a GoAway.
|
||||||
// firstResolveEvent is used to track whether the name resolver sent us at
|
// firstResolveEvent is used to track whether the name resolver sent us at
|
||||||
// least one update. RPCs block on this event. May be accessed without mu
|
// least one update. RPCs block on this event. May be accessed without mu
|
||||||
// if we know we cannot be asked to enter idle mode while accessing it (e.g.
|
// if we know we cannot be asked to enter idle mode while accessing it (e.g.
|
||||||
@ -867,7 +886,13 @@ func (cc *ClientConn) Target() string {
|
|||||||
return cc.target
|
return cc.target
|
||||||
}
|
}
|
||||||
|
|
||||||
// CanonicalTarget returns the canonical target string of the ClientConn.
|
// CanonicalTarget returns the canonical target string used when creating cc.
|
||||||
|
//
|
||||||
|
// This always has the form "<scheme>://[authority]/<endpoint>". For example:
|
||||||
|
//
|
||||||
|
// - "dns:///example.com:42"
|
||||||
|
// - "dns://8.8.8.8/example.com:42"
|
||||||
|
// - "unix:///path/to/socket"
|
||||||
func (cc *ClientConn) CanonicalTarget() string {
|
func (cc *ClientConn) CanonicalTarget() string {
|
||||||
return cc.parsedTarget.String()
|
return cc.parsedTarget.String()
|
||||||
}
|
}
|
||||||
@ -1210,8 +1235,8 @@ func (ac *addrConn) adjustParams(r transport.GoAwayReason) {
|
|||||||
case transport.GoAwayTooManyPings:
|
case transport.GoAwayTooManyPings:
|
||||||
v := 2 * ac.dopts.copts.KeepaliveParams.Time
|
v := 2 * ac.dopts.copts.KeepaliveParams.Time
|
||||||
ac.cc.mu.Lock()
|
ac.cc.mu.Lock()
|
||||||
if v > ac.cc.mkp.Time {
|
if v > ac.cc.keepaliveParams.Time {
|
||||||
ac.cc.mkp.Time = v
|
ac.cc.keepaliveParams.Time = v
|
||||||
}
|
}
|
||||||
ac.cc.mu.Unlock()
|
ac.cc.mu.Unlock()
|
||||||
}
|
}
|
||||||
@ -1307,7 +1332,7 @@ func (ac *addrConn) tryAllAddrs(ctx context.Context, addrs []resolver.Address, c
|
|||||||
ac.mu.Lock()
|
ac.mu.Lock()
|
||||||
|
|
||||||
ac.cc.mu.RLock()
|
ac.cc.mu.RLock()
|
||||||
ac.dopts.copts.KeepaliveParams = ac.cc.mkp
|
ac.dopts.copts.KeepaliveParams = ac.cc.keepaliveParams
|
||||||
ac.cc.mu.RUnlock()
|
ac.cc.mu.RUnlock()
|
||||||
|
|
||||||
copts := ac.dopts.copts
|
copts := ac.dopts.copts
|
||||||
|
34
vendor/google.golang.org/grpc/dialoptions.go
generated
vendored
34
vendor/google.golang.org/grpc/dialoptions.go
generated
vendored
@ -73,7 +73,7 @@ type dialOptions struct {
|
|||||||
chainUnaryInts []UnaryClientInterceptor
|
chainUnaryInts []UnaryClientInterceptor
|
||||||
chainStreamInts []StreamClientInterceptor
|
chainStreamInts []StreamClientInterceptor
|
||||||
|
|
||||||
cp Compressor
|
compressorV0 Compressor
|
||||||
dc Decompressor
|
dc Decompressor
|
||||||
bs internalbackoff.Strategy
|
bs internalbackoff.Strategy
|
||||||
block bool
|
block bool
|
||||||
@ -94,6 +94,8 @@ type dialOptions struct {
|
|||||||
idleTimeout time.Duration
|
idleTimeout time.Duration
|
||||||
defaultScheme string
|
defaultScheme string
|
||||||
maxCallAttempts int
|
maxCallAttempts int
|
||||||
|
enableLocalDNSResolution bool // Specifies if target hostnames should be resolved when proxying is enabled.
|
||||||
|
useProxy bool // Specifies if a server should be connected via proxy.
|
||||||
}
|
}
|
||||||
|
|
||||||
// DialOption configures how we set up the connection.
|
// DialOption configures how we set up the connection.
|
||||||
@ -256,7 +258,7 @@ func WithCodec(c Codec) DialOption {
|
|||||||
// Deprecated: use UseCompressor instead. Will be supported throughout 1.x.
|
// Deprecated: use UseCompressor instead. Will be supported throughout 1.x.
|
||||||
func WithCompressor(cp Compressor) DialOption {
|
func WithCompressor(cp Compressor) DialOption {
|
||||||
return newFuncDialOption(func(o *dialOptions) {
|
return newFuncDialOption(func(o *dialOptions) {
|
||||||
o.cp = cp
|
o.compressorV0 = cp
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -377,7 +379,22 @@ func WithInsecure() DialOption {
|
|||||||
// later release.
|
// later release.
|
||||||
func WithNoProxy() DialOption {
|
func WithNoProxy() DialOption {
|
||||||
return newFuncDialOption(func(o *dialOptions) {
|
return newFuncDialOption(func(o *dialOptions) {
|
||||||
o.copts.UseProxy = false
|
o.useProxy = false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithLocalDNSResolution forces local DNS name resolution even when a proxy is
|
||||||
|
// specified in the environment. By default, the server name is provided
|
||||||
|
// directly to the proxy as part of the CONNECT handshake. This is ignored if
|
||||||
|
// WithNoProxy is used.
|
||||||
|
//
|
||||||
|
// # Experimental
|
||||||
|
//
|
||||||
|
// Notice: This API is EXPERIMENTAL and may be changed or removed in a
|
||||||
|
// later release.
|
||||||
|
func WithLocalDNSResolution() DialOption {
|
||||||
|
return newFuncDialOption(func(o *dialOptions) {
|
||||||
|
o.enableLocalDNSResolution = true
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -667,14 +684,15 @@ func defaultDialOptions() dialOptions {
|
|||||||
copts: transport.ConnectOptions{
|
copts: transport.ConnectOptions{
|
||||||
ReadBufferSize: defaultReadBufSize,
|
ReadBufferSize: defaultReadBufSize,
|
||||||
WriteBufferSize: defaultWriteBufSize,
|
WriteBufferSize: defaultWriteBufSize,
|
||||||
UseProxy: true,
|
|
||||||
UserAgent: grpcUA,
|
UserAgent: grpcUA,
|
||||||
BufferPool: mem.DefaultBufferPool(),
|
BufferPool: mem.DefaultBufferPool(),
|
||||||
},
|
},
|
||||||
bs: internalbackoff.DefaultExponential,
|
bs: internalbackoff.DefaultExponential,
|
||||||
idleTimeout: 30 * time.Minute,
|
idleTimeout: 30 * time.Minute,
|
||||||
defaultScheme: "dns",
|
defaultScheme: "dns",
|
||||||
maxCallAttempts: defaultMaxCallAttempts,
|
maxCallAttempts: defaultMaxCallAttempts,
|
||||||
|
useProxy: true,
|
||||||
|
enableLocalDNSResolution: false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
10
vendor/google.golang.org/grpc/internal/balancer/gracefulswitch/gracefulswitch.go
generated
vendored
10
vendor/google.golang.org/grpc/internal/balancer/gracefulswitch/gracefulswitch.go
generated
vendored
@ -109,8 +109,9 @@ func (gsb *Balancer) switchTo(builder balancer.Builder) (*balancerWrapper, error
|
|||||||
return nil, errBalancerClosed
|
return nil, errBalancerClosed
|
||||||
}
|
}
|
||||||
bw := &balancerWrapper{
|
bw := &balancerWrapper{
|
||||||
builder: builder,
|
ClientConn: gsb.cc,
|
||||||
gsb: gsb,
|
builder: builder,
|
||||||
|
gsb: gsb,
|
||||||
lastState: balancer.State{
|
lastState: balancer.State{
|
||||||
ConnectivityState: connectivity.Connecting,
|
ConnectivityState: connectivity.Connecting,
|
||||||
Picker: base.NewErrPicker(balancer.ErrNoSubConnAvailable),
|
Picker: base.NewErrPicker(balancer.ErrNoSubConnAvailable),
|
||||||
@ -293,6 +294,7 @@ func (gsb *Balancer) Close() {
|
|||||||
// State updates from the wrapped balancer can result in invocation of the
|
// State updates from the wrapped balancer can result in invocation of the
|
||||||
// graceful switch logic.
|
// graceful switch logic.
|
||||||
type balancerWrapper struct {
|
type balancerWrapper struct {
|
||||||
|
balancer.ClientConn
|
||||||
balancer.Balancer
|
balancer.Balancer
|
||||||
gsb *Balancer
|
gsb *Balancer
|
||||||
builder balancer.Builder
|
builder balancer.Builder
|
||||||
@ -413,7 +415,3 @@ func (bw *balancerWrapper) UpdateAddresses(sc balancer.SubConn, addrs []resolver
|
|||||||
bw.gsb.mu.Unlock()
|
bw.gsb.mu.Unlock()
|
||||||
bw.gsb.cc.UpdateAddresses(sc, addrs)
|
bw.gsb.cc.UpdateAddresses(sc, addrs)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (bw *balancerWrapper) Target() string {
|
|
||||||
return bw.gsb.cc.Target()
|
|
||||||
}
|
|
||||||
|
10
vendor/google.golang.org/grpc/internal/envconfig/xds.go
generated
vendored
10
vendor/google.golang.org/grpc/internal/envconfig/xds.go
generated
vendored
@ -56,7 +56,11 @@ var (
|
|||||||
|
|
||||||
// XDSDualstackEndpointsEnabled is true if gRPC should read the
|
// XDSDualstackEndpointsEnabled is true if gRPC should read the
|
||||||
// "additional addresses" in the xDS endpoint resource.
|
// "additional addresses" in the xDS endpoint resource.
|
||||||
// TODO: https://github.com/grpc/grpc-go/issues/7866 - Control this using
|
XDSDualstackEndpointsEnabled = boolFromEnv("GRPC_EXPERIMENTAL_XDS_DUALSTACK_ENDPOINTS", true)
|
||||||
// an env variable when all LB policies handle endpoints.
|
|
||||||
XDSDualstackEndpointsEnabled = false
|
// XDSSystemRootCertsEnabled is true when xDS enabled gRPC clients can use
|
||||||
|
// the system's default root certificates for TLS certificate validation.
|
||||||
|
// For more details, see:
|
||||||
|
// https://github.com/grpc/proposal/blob/master/A82-xds-system-root-certs.md.
|
||||||
|
XDSSystemRootCertsEnabled = boolFromEnv("GRPC_EXPERIMENTAL_XDS_SYSTEM_ROOT_CERTS", false)
|
||||||
)
|
)
|
||||||
|
32
vendor/google.golang.org/grpc/internal/grpcsync/oncefunc.go
generated
vendored
32
vendor/google.golang.org/grpc/internal/grpcsync/oncefunc.go
generated
vendored
@ -1,32 +0,0 @@
|
|||||||
/*
|
|
||||||
*
|
|
||||||
* Copyright 2022 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 grpcsync
|
|
||||||
|
|
||||||
import (
|
|
||||||
"sync"
|
|
||||||
)
|
|
||||||
|
|
||||||
// OnceFunc returns a function wrapping f which ensures f is only executed
|
|
||||||
// once even if the returned function is executed multiple times.
|
|
||||||
func OnceFunc(f func()) func() {
|
|
||||||
var once sync.Once
|
|
||||||
return func() {
|
|
||||||
once.Do(f)
|
|
||||||
}
|
|
||||||
}
|
|
23
vendor/google.golang.org/grpc/internal/internal.go
generated
vendored
23
vendor/google.golang.org/grpc/internal/internal.go
generated
vendored
@ -64,6 +64,9 @@ var (
|
|||||||
// gRPC server. An xDS-enabled server needs to know what type of credentials
|
// gRPC server. An xDS-enabled server needs to know what type of credentials
|
||||||
// is configured on the underlying gRPC server. This is set by server.go.
|
// is configured on the underlying gRPC server. This is set by server.go.
|
||||||
GetServerCredentials any // func (*grpc.Server) credentials.TransportCredentials
|
GetServerCredentials any // func (*grpc.Server) credentials.TransportCredentials
|
||||||
|
// MetricsRecorderForServer returns the MetricsRecorderList derived from a
|
||||||
|
// server's stats handlers.
|
||||||
|
MetricsRecorderForServer any // func (*grpc.Server) estats.MetricsRecorder
|
||||||
// CanonicalString returns the canonical string of the code defined here:
|
// CanonicalString returns the canonical string of the code defined here:
|
||||||
// https://github.com/grpc/grpc/blob/master/doc/statuscodes.md.
|
// https://github.com/grpc/grpc/blob/master/doc/statuscodes.md.
|
||||||
//
|
//
|
||||||
@ -151,6 +154,20 @@ var (
|
|||||||
// other features, including the CSDS service.
|
// other features, including the CSDS service.
|
||||||
NewXDSResolverWithConfigForTesting any // func([]byte) (resolver.Builder, error)
|
NewXDSResolverWithConfigForTesting any // func([]byte) (resolver.Builder, error)
|
||||||
|
|
||||||
|
// NewXDSResolverWithPoolForTesting creates a new xDS resolver builder
|
||||||
|
// using the provided xDS pool instead of creating a new one using the
|
||||||
|
// bootstrap configuration specified by the supported environment variables.
|
||||||
|
// The resolver.Builder is meant to be used in conjunction with the
|
||||||
|
// grpc.WithResolvers DialOption. The resolver.Builder does not take
|
||||||
|
// ownership of the provided xDS client and it is the responsibility of the
|
||||||
|
// caller to close the client when no longer required.
|
||||||
|
//
|
||||||
|
// Testing Only
|
||||||
|
//
|
||||||
|
// This function should ONLY be used for testing and may not work with some
|
||||||
|
// other features, including the CSDS service.
|
||||||
|
NewXDSResolverWithPoolForTesting any // func(*xdsclient.Pool) (resolver.Builder, error)
|
||||||
|
|
||||||
// NewXDSResolverWithClientForTesting creates a new xDS resolver builder
|
// NewXDSResolverWithClientForTesting creates a new xDS resolver builder
|
||||||
// using the provided xDS client instead of creating a new one using the
|
// using the provided xDS client instead of creating a new one using the
|
||||||
// bootstrap configuration specified by the supported environment variables.
|
// bootstrap configuration specified by the supported environment variables.
|
||||||
@ -277,3 +294,9 @@ const RLSLoadBalancingPolicyName = "rls_experimental"
|
|||||||
type EnforceSubConnEmbedding interface {
|
type EnforceSubConnEmbedding interface {
|
||||||
enforceSubConnEmbedding()
|
enforceSubConnEmbedding()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// EnforceClientConnEmbedding is used to enforce proper ClientConn implementation
|
||||||
|
// embedding.
|
||||||
|
type EnforceClientConnEmbedding interface {
|
||||||
|
enforceClientConnEmbedding()
|
||||||
|
}
|
||||||
|
54
vendor/google.golang.org/grpc/internal/proxyattributes/proxyattributes.go
generated
vendored
Normal file
54
vendor/google.golang.org/grpc/internal/proxyattributes/proxyattributes.go
generated
vendored
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
/*
|
||||||
|
*
|
||||||
|
* Copyright 2024 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 proxyattributes contains functions for getting and setting proxy
|
||||||
|
// attributes like the CONNECT address and user info.
|
||||||
|
package proxyattributes
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/url"
|
||||||
|
|
||||||
|
"google.golang.org/grpc/resolver"
|
||||||
|
)
|
||||||
|
|
||||||
|
type keyType string
|
||||||
|
|
||||||
|
const proxyOptionsKey = keyType("grpc.resolver.delegatingresolver.proxyOptions")
|
||||||
|
|
||||||
|
// Options holds the proxy connection details needed during the CONNECT
|
||||||
|
// handshake.
|
||||||
|
type Options struct {
|
||||||
|
User *url.Userinfo
|
||||||
|
ConnectAddr string
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set returns a copy of addr with opts set in its attributes.
|
||||||
|
func Set(addr resolver.Address, opts Options) resolver.Address {
|
||||||
|
addr.Attributes = addr.Attributes.WithValue(proxyOptionsKey, opts)
|
||||||
|
return addr
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get returns the Options for the proxy [resolver.Address] and a boolean
|
||||||
|
// value representing if the attribute is present or not. The returned data
|
||||||
|
// should not be mutated.
|
||||||
|
func Get(addr resolver.Address) (Options, bool) {
|
||||||
|
if a := addr.Attributes.Value(proxyOptionsKey); a != nil {
|
||||||
|
return a.(Options), true
|
||||||
|
}
|
||||||
|
return Options{}, false
|
||||||
|
}
|
329
vendor/google.golang.org/grpc/internal/resolver/delegatingresolver/delegatingresolver.go
generated
vendored
Normal file
329
vendor/google.golang.org/grpc/internal/resolver/delegatingresolver/delegatingresolver.go
generated
vendored
Normal file
@ -0,0 +1,329 @@
|
|||||||
|
/*
|
||||||
|
*
|
||||||
|
* Copyright 2024 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 delegatingresolver implements a resolver capable of resolving both
|
||||||
|
// target URIs and proxy addresses.
|
||||||
|
package delegatingresolver
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"net/http"
|
||||||
|
"net/url"
|
||||||
|
"sync"
|
||||||
|
|
||||||
|
"google.golang.org/grpc/grpclog"
|
||||||
|
"google.golang.org/grpc/internal/proxyattributes"
|
||||||
|
"google.golang.org/grpc/resolver"
|
||||||
|
"google.golang.org/grpc/serviceconfig"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
logger = grpclog.Component("delegating-resolver")
|
||||||
|
// HTTPSProxyFromEnvironment will be overwritten in the tests
|
||||||
|
HTTPSProxyFromEnvironment = http.ProxyFromEnvironment
|
||||||
|
)
|
||||||
|
|
||||||
|
// delegatingResolver manages both target URI and proxy address resolution by
|
||||||
|
// delegating these tasks to separate child resolvers. Essentially, it acts as
|
||||||
|
// a intermediary between the gRPC ClientConn and the child resolvers.
|
||||||
|
//
|
||||||
|
// It implements the [resolver.Resolver] interface.
|
||||||
|
type delegatingResolver struct {
|
||||||
|
target resolver.Target // parsed target URI to be resolved
|
||||||
|
cc resolver.ClientConn // gRPC ClientConn
|
||||||
|
targetResolver resolver.Resolver // resolver for the target URI, based on its scheme
|
||||||
|
proxyResolver resolver.Resolver // resolver for the proxy URI; nil if no proxy is configured
|
||||||
|
proxyURL *url.URL // proxy URL, derived from proxy environment and target
|
||||||
|
|
||||||
|
mu sync.Mutex // protects all the fields below
|
||||||
|
targetResolverState *resolver.State // state of the target resolver
|
||||||
|
proxyAddrs []resolver.Address // resolved proxy addresses; empty if no proxy is configured
|
||||||
|
}
|
||||||
|
|
||||||
|
// nopResolver is a resolver that does nothing.
|
||||||
|
type nopResolver struct{}
|
||||||
|
|
||||||
|
func (nopResolver) ResolveNow(resolver.ResolveNowOptions) {}
|
||||||
|
|
||||||
|
func (nopResolver) Close() {}
|
||||||
|
|
||||||
|
// proxyURLForTarget determines the proxy URL for the given address based on
|
||||||
|
// the environment. It can return the following:
|
||||||
|
// - nil URL, nil error: No proxy is configured or the address is excluded
|
||||||
|
// using the `NO_PROXY` environment variable or if req.URL.Host is
|
||||||
|
// "localhost" (with or without // a port number)
|
||||||
|
// - nil URL, non-nil error: An error occurred while retrieving the proxy URL.
|
||||||
|
// - non-nil URL, nil error: A proxy is configured, and the proxy URL was
|
||||||
|
// retrieved successfully without any errors.
|
||||||
|
func proxyURLForTarget(address string) (*url.URL, error) {
|
||||||
|
req := &http.Request{URL: &url.URL{
|
||||||
|
Scheme: "https",
|
||||||
|
Host: address,
|
||||||
|
}}
|
||||||
|
return HTTPSProxyFromEnvironment(req)
|
||||||
|
}
|
||||||
|
|
||||||
|
// New creates a new delegating resolver that can create up to two child
|
||||||
|
// resolvers:
|
||||||
|
// - one to resolve the proxy address specified using the supported
|
||||||
|
// environment variables. This uses the registered resolver for the "dns"
|
||||||
|
// scheme.
|
||||||
|
// - one to resolve the target URI using the resolver specified by the scheme
|
||||||
|
// in the target URI or specified by the user using the WithResolvers dial
|
||||||
|
// option. As a special case, if the target URI's scheme is "dns" and a
|
||||||
|
// proxy is specified using the supported environment variables, the target
|
||||||
|
// URI's path portion is used as the resolved address unless target
|
||||||
|
// resolution is enabled using the dial option.
|
||||||
|
func New(target resolver.Target, cc resolver.ClientConn, opts resolver.BuildOptions, targetResolverBuilder resolver.Builder, targetResolutionEnabled bool) (resolver.Resolver, error) {
|
||||||
|
r := &delegatingResolver{
|
||||||
|
target: target,
|
||||||
|
cc: cc,
|
||||||
|
}
|
||||||
|
|
||||||
|
var err error
|
||||||
|
r.proxyURL, err = proxyURLForTarget(target.Endpoint())
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("delegating_resolver: failed to determine proxy URL for target %s: %v", target, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
// proxy is not configured or proxy address excluded using `NO_PROXY` env
|
||||||
|
// var, so only target resolver is used.
|
||||||
|
if r.proxyURL == nil {
|
||||||
|
return targetResolverBuilder.Build(target, cc, opts)
|
||||||
|
}
|
||||||
|
|
||||||
|
if logger.V(2) {
|
||||||
|
logger.Infof("Proxy URL detected : %s", r.proxyURL)
|
||||||
|
}
|
||||||
|
|
||||||
|
// When the scheme is 'dns' and target resolution on client is not enabled,
|
||||||
|
// resolution should be handled by the proxy, not the client. Therefore, we
|
||||||
|
// bypass the target resolver and store the unresolved target address.
|
||||||
|
if target.URL.Scheme == "dns" && !targetResolutionEnabled {
|
||||||
|
state := resolver.State{
|
||||||
|
Addresses: []resolver.Address{{Addr: target.Endpoint()}},
|
||||||
|
Endpoints: []resolver.Endpoint{{Addresses: []resolver.Address{{Addr: target.Endpoint()}}}},
|
||||||
|
}
|
||||||
|
r.targetResolverState = &state
|
||||||
|
} else {
|
||||||
|
wcc := &wrappingClientConn{
|
||||||
|
stateListener: r.updateTargetResolverState,
|
||||||
|
parent: r,
|
||||||
|
}
|
||||||
|
if r.targetResolver, err = targetResolverBuilder.Build(target, wcc, opts); err != nil {
|
||||||
|
return nil, fmt.Errorf("delegating_resolver: unable to build the resolver for target %s: %v", target, err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if r.proxyResolver, err = r.proxyURIResolver(opts); err != nil {
|
||||||
|
return nil, fmt.Errorf("delegating_resolver: failed to build resolver for proxy URL %q: %v", r.proxyURL, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if r.targetResolver == nil {
|
||||||
|
r.targetResolver = nopResolver{}
|
||||||
|
}
|
||||||
|
if r.proxyResolver == nil {
|
||||||
|
r.proxyResolver = nopResolver{}
|
||||||
|
}
|
||||||
|
return r, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// proxyURIResolver creates a resolver for resolving proxy URIs using the
|
||||||
|
// "dns" scheme. It adjusts the proxyURL to conform to the "dns:///" format and
|
||||||
|
// builds a resolver with a wrappingClientConn to capture resolved addresses.
|
||||||
|
func (r *delegatingResolver) proxyURIResolver(opts resolver.BuildOptions) (resolver.Resolver, error) {
|
||||||
|
proxyBuilder := resolver.Get("dns")
|
||||||
|
if proxyBuilder == nil {
|
||||||
|
panic("delegating_resolver: resolver for proxy not found for scheme dns")
|
||||||
|
}
|
||||||
|
url := *r.proxyURL
|
||||||
|
url.Scheme = "dns"
|
||||||
|
url.Path = "/" + r.proxyURL.Host
|
||||||
|
url.Host = "" // Clear the Host field to conform to the "dns:///" format
|
||||||
|
|
||||||
|
proxyTarget := resolver.Target{URL: url}
|
||||||
|
wcc := &wrappingClientConn{
|
||||||
|
stateListener: r.updateProxyResolverState,
|
||||||
|
parent: r,
|
||||||
|
}
|
||||||
|
return proxyBuilder.Build(proxyTarget, wcc, opts)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *delegatingResolver) ResolveNow(o resolver.ResolveNowOptions) {
|
||||||
|
r.targetResolver.ResolveNow(o)
|
||||||
|
r.proxyResolver.ResolveNow(o)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *delegatingResolver) Close() {
|
||||||
|
r.targetResolver.Close()
|
||||||
|
r.targetResolver = nil
|
||||||
|
|
||||||
|
r.proxyResolver.Close()
|
||||||
|
r.proxyResolver = nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// updateClientConnStateLocked creates a list of combined addresses by
|
||||||
|
// pairing each proxy address with every target address. For each pair, it
|
||||||
|
// generates a new [resolver.Address] using the proxy address, and adding the
|
||||||
|
// target address as the attribute along with user info. It returns nil if
|
||||||
|
// either resolver has not sent update even once and returns the error from
|
||||||
|
// ClientConn update once both resolvers have sent update atleast once.
|
||||||
|
func (r *delegatingResolver) updateClientConnStateLocked() error {
|
||||||
|
if r.targetResolverState == nil || r.proxyAddrs == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
curState := *r.targetResolverState
|
||||||
|
// If multiple resolved proxy addresses are present, we send only the
|
||||||
|
// unresolved proxy host and let net.Dial handle the proxy host name
|
||||||
|
// resolution when creating the transport. Sending all resolved addresses
|
||||||
|
// would increase the number of addresses passed to the ClientConn and
|
||||||
|
// subsequently to load balancing (LB) policies like Round Robin, leading
|
||||||
|
// to additional TCP connections. However, if there's only one resolved
|
||||||
|
// proxy address, we send it directly, as it doesn't affect the address
|
||||||
|
// count returned by the target resolver and the address count sent to the
|
||||||
|
// ClientConn.
|
||||||
|
var proxyAddr resolver.Address
|
||||||
|
if len(r.proxyAddrs) == 1 {
|
||||||
|
proxyAddr = r.proxyAddrs[0]
|
||||||
|
} else {
|
||||||
|
proxyAddr = resolver.Address{Addr: r.proxyURL.Host}
|
||||||
|
}
|
||||||
|
var addresses []resolver.Address
|
||||||
|
for _, targetAddr := range (*r.targetResolverState).Addresses {
|
||||||
|
addresses = append(addresses, proxyattributes.Set(proxyAddr, proxyattributes.Options{
|
||||||
|
User: r.proxyURL.User,
|
||||||
|
ConnectAddr: targetAddr.Addr,
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create a list of combined endpoints by pairing all proxy endpoints
|
||||||
|
// with every target endpoint. Each time, it constructs a new
|
||||||
|
// [resolver.Endpoint] using the all addresses from all the proxy endpoint
|
||||||
|
// and the target addresses from one endpoint. The target address and user
|
||||||
|
// information from the proxy URL are added as attributes to the proxy
|
||||||
|
// address.The resulting list of addresses is then grouped into endpoints,
|
||||||
|
// covering all combinations of proxy and target endpoints.
|
||||||
|
var endpoints []resolver.Endpoint
|
||||||
|
for _, endpt := range (*r.targetResolverState).Endpoints {
|
||||||
|
var addrs []resolver.Address
|
||||||
|
for _, proxyAddr := range r.proxyAddrs {
|
||||||
|
for _, targetAddr := range endpt.Addresses {
|
||||||
|
addrs = append(addrs, proxyattributes.Set(proxyAddr, proxyattributes.Options{
|
||||||
|
User: r.proxyURL.User,
|
||||||
|
ConnectAddr: targetAddr.Addr,
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
endpoints = append(endpoints, resolver.Endpoint{Addresses: addrs})
|
||||||
|
}
|
||||||
|
// Use the targetResolverState for its service config and attributes
|
||||||
|
// contents. The state update is only sent after both the target and proxy
|
||||||
|
// resolvers have sent their updates, and curState has been updated with
|
||||||
|
// the combined addresses.
|
||||||
|
curState.Addresses = addresses
|
||||||
|
curState.Endpoints = endpoints
|
||||||
|
return r.cc.UpdateState(curState)
|
||||||
|
}
|
||||||
|
|
||||||
|
// updateProxyResolverState updates the proxy resolver state by storing proxy
|
||||||
|
// addresses and endpoints, marking the resolver as ready, and triggering a
|
||||||
|
// state update if both proxy and target resolvers are ready. If the ClientConn
|
||||||
|
// returns a non-nil error, it calls `ResolveNow()` on the target resolver. It
|
||||||
|
// is a StateListener function of wrappingClientConn passed to the proxy resolver.
|
||||||
|
func (r *delegatingResolver) updateProxyResolverState(state resolver.State) error {
|
||||||
|
r.mu.Lock()
|
||||||
|
defer r.mu.Unlock()
|
||||||
|
if logger.V(2) {
|
||||||
|
logger.Infof("Addresses received from proxy resolver: %s", state.Addresses)
|
||||||
|
}
|
||||||
|
if len(state.Endpoints) > 0 {
|
||||||
|
// We expect exactly one address per endpoint because the proxy
|
||||||
|
// resolver uses "dns" resolution.
|
||||||
|
r.proxyAddrs = make([]resolver.Address, 0, len(state.Endpoints))
|
||||||
|
for _, endpoint := range state.Endpoints {
|
||||||
|
r.proxyAddrs = append(r.proxyAddrs, endpoint.Addresses...)
|
||||||
|
}
|
||||||
|
} else if state.Addresses != nil {
|
||||||
|
r.proxyAddrs = state.Addresses
|
||||||
|
} else {
|
||||||
|
r.proxyAddrs = []resolver.Address{} // ensure proxyAddrs is non-nil to indicate an update has been received
|
||||||
|
}
|
||||||
|
err := r.updateClientConnStateLocked()
|
||||||
|
// Another possible approach was to block until updates are received from
|
||||||
|
// both resolvers. But this is not used because calling `New()` triggers
|
||||||
|
// `Build()` for the first resolver, which calls `UpdateState()`. And the
|
||||||
|
// second resolver hasn't sent an update yet, so it would cause `New()` to
|
||||||
|
// block indefinitely.
|
||||||
|
if err != nil {
|
||||||
|
r.targetResolver.ResolveNow(resolver.ResolveNowOptions{})
|
||||||
|
}
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// updateTargetResolverState updates the target resolver state by storing target
|
||||||
|
// addresses, endpoints, and service config, marking the resolver as ready, and
|
||||||
|
// triggering a state update if both resolvers are ready. If the ClientConn
|
||||||
|
// returns a non-nil error, it calls `ResolveNow()` on the proxy resolver. It
|
||||||
|
// is a StateListener function of wrappingClientConn passed to the target resolver.
|
||||||
|
func (r *delegatingResolver) updateTargetResolverState(state resolver.State) error {
|
||||||
|
r.mu.Lock()
|
||||||
|
defer r.mu.Unlock()
|
||||||
|
|
||||||
|
if logger.V(2) {
|
||||||
|
logger.Infof("Addresses received from target resolver: %v", state.Addresses)
|
||||||
|
}
|
||||||
|
r.targetResolverState = &state
|
||||||
|
err := r.updateClientConnStateLocked()
|
||||||
|
if err != nil {
|
||||||
|
r.proxyResolver.ResolveNow(resolver.ResolveNowOptions{})
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// wrappingClientConn serves as an intermediary between the parent ClientConn
|
||||||
|
// and the child resolvers created here. It implements the resolver.ClientConn
|
||||||
|
// interface and is passed in that capacity to the child resolvers.
|
||||||
|
type wrappingClientConn struct {
|
||||||
|
// Callback to deliver resolver state updates
|
||||||
|
stateListener func(state resolver.State) error
|
||||||
|
parent *delegatingResolver
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpdateState receives resolver state updates and forwards them to the
|
||||||
|
// appropriate listener function (either for the proxy or target resolver).
|
||||||
|
func (wcc *wrappingClientConn) UpdateState(state resolver.State) error {
|
||||||
|
return wcc.stateListener(state)
|
||||||
|
}
|
||||||
|
|
||||||
|
// ReportError intercepts errors from the child resolvers and passes them to ClientConn.
|
||||||
|
func (wcc *wrappingClientConn) ReportError(err error) {
|
||||||
|
wcc.parent.cc.ReportError(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewAddress intercepts the new resolved address from the child resolvers and
|
||||||
|
// passes them to ClientConn.
|
||||||
|
func (wcc *wrappingClientConn) NewAddress(addrs []resolver.Address) {
|
||||||
|
wcc.UpdateState(resolver.State{Addresses: addrs})
|
||||||
|
}
|
||||||
|
|
||||||
|
// ParseServiceConfig parses the provided service config and returns an
|
||||||
|
// object that provides the parsed config.
|
||||||
|
func (wcc *wrappingClientConn) ParseServiceConfig(serviceConfigJSON string) *serviceconfig.ParseResult {
|
||||||
|
return wcc.parent.cc.ParseServiceConfig(serviceConfigJSON)
|
||||||
|
}
|
9
vendor/google.golang.org/grpc/internal/transport/http2_client.go
generated
vendored
9
vendor/google.golang.org/grpc/internal/transport/http2_client.go
generated
vendored
@ -43,6 +43,7 @@ import (
|
|||||||
"google.golang.org/grpc/internal/grpcsync"
|
"google.golang.org/grpc/internal/grpcsync"
|
||||||
"google.golang.org/grpc/internal/grpcutil"
|
"google.golang.org/grpc/internal/grpcutil"
|
||||||
imetadata "google.golang.org/grpc/internal/metadata"
|
imetadata "google.golang.org/grpc/internal/metadata"
|
||||||
|
"google.golang.org/grpc/internal/proxyattributes"
|
||||||
istatus "google.golang.org/grpc/internal/status"
|
istatus "google.golang.org/grpc/internal/status"
|
||||||
isyscall "google.golang.org/grpc/internal/syscall"
|
isyscall "google.golang.org/grpc/internal/syscall"
|
||||||
"google.golang.org/grpc/internal/transport/networktype"
|
"google.golang.org/grpc/internal/transport/networktype"
|
||||||
@ -153,7 +154,7 @@ type http2Client struct {
|
|||||||
logger *grpclog.PrefixLogger
|
logger *grpclog.PrefixLogger
|
||||||
}
|
}
|
||||||
|
|
||||||
func dial(ctx context.Context, fn func(context.Context, string) (net.Conn, error), addr resolver.Address, useProxy bool, grpcUA string) (net.Conn, error) {
|
func dial(ctx context.Context, fn func(context.Context, string) (net.Conn, error), addr resolver.Address, grpcUA string) (net.Conn, error) {
|
||||||
address := addr.Addr
|
address := addr.Addr
|
||||||
networkType, ok := networktype.Get(addr)
|
networkType, ok := networktype.Get(addr)
|
||||||
if fn != nil {
|
if fn != nil {
|
||||||
@ -177,8 +178,8 @@ func dial(ctx context.Context, fn func(context.Context, string) (net.Conn, error
|
|||||||
if !ok {
|
if !ok {
|
||||||
networkType, address = parseDialTarget(address)
|
networkType, address = parseDialTarget(address)
|
||||||
}
|
}
|
||||||
if networkType == "tcp" && useProxy {
|
if opts, present := proxyattributes.Get(addr); present {
|
||||||
return proxyDial(ctx, address, grpcUA)
|
return proxyDial(ctx, addr, grpcUA, opts)
|
||||||
}
|
}
|
||||||
return internal.NetDialerWithTCPKeepalive().DialContext(ctx, networkType, address)
|
return internal.NetDialerWithTCPKeepalive().DialContext(ctx, networkType, address)
|
||||||
}
|
}
|
||||||
@ -217,7 +218,7 @@ func NewHTTP2Client(connectCtx, ctx context.Context, addr resolver.Address, opts
|
|||||||
// address specific arbitrary data to reach custom dialers and credential handshakers.
|
// address specific arbitrary data to reach custom dialers and credential handshakers.
|
||||||
connectCtx = icredentials.NewClientHandshakeInfoContext(connectCtx, credentials.ClientHandshakeInfo{Attributes: addr.Attributes})
|
connectCtx = icredentials.NewClientHandshakeInfoContext(connectCtx, credentials.ClientHandshakeInfo{Attributes: addr.Attributes})
|
||||||
|
|
||||||
conn, err := dial(connectCtx, opts.Dialer, addr, opts.UseProxy, opts.UserAgent)
|
conn, err := dial(connectCtx, opts.Dialer, addr, opts.UserAgent)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if opts.FailOnNonTempDialError {
|
if opts.FailOnNonTempDialError {
|
||||||
return nil, connectionErrorf(isTemporary(err), err, "transport: error while dialing: %v", err)
|
return nil, connectionErrorf(isTemporary(err), err, "transport: error while dialing: %v", err)
|
||||||
|
62
vendor/google.golang.org/grpc/internal/transport/proxy.go
generated
vendored
62
vendor/google.golang.org/grpc/internal/transport/proxy.go
generated
vendored
@ -30,34 +30,16 @@ import (
|
|||||||
"net/url"
|
"net/url"
|
||||||
|
|
||||||
"google.golang.org/grpc/internal"
|
"google.golang.org/grpc/internal"
|
||||||
|
"google.golang.org/grpc/internal/proxyattributes"
|
||||||
|
"google.golang.org/grpc/resolver"
|
||||||
)
|
)
|
||||||
|
|
||||||
const proxyAuthHeaderKey = "Proxy-Authorization"
|
const proxyAuthHeaderKey = "Proxy-Authorization"
|
||||||
|
|
||||||
var (
|
|
||||||
// The following variable will be overwritten in the tests.
|
|
||||||
httpProxyFromEnvironment = http.ProxyFromEnvironment
|
|
||||||
)
|
|
||||||
|
|
||||||
func mapAddress(address string) (*url.URL, error) {
|
|
||||||
req := &http.Request{
|
|
||||||
URL: &url.URL{
|
|
||||||
Scheme: "https",
|
|
||||||
Host: address,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
url, err := httpProxyFromEnvironment(req)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return url, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// To read a response from a net.Conn, http.ReadResponse() takes a bufio.Reader.
|
// To read a response from a net.Conn, http.ReadResponse() takes a bufio.Reader.
|
||||||
// It's possible that this reader reads more than what's need for the response and stores
|
// It's possible that this reader reads more than what's need for the response
|
||||||
// those bytes in the buffer.
|
// and stores those bytes in the buffer. bufConn wraps the original net.Conn
|
||||||
// bufConn wraps the original net.Conn and the bufio.Reader to make sure we don't lose the
|
// and the bufio.Reader to make sure we don't lose the bytes in the buffer.
|
||||||
// bytes in the buffer.
|
|
||||||
type bufConn struct {
|
type bufConn struct {
|
||||||
net.Conn
|
net.Conn
|
||||||
r io.Reader
|
r io.Reader
|
||||||
@ -72,7 +54,7 @@ func basicAuth(username, password string) string {
|
|||||||
return base64.StdEncoding.EncodeToString([]byte(auth))
|
return base64.StdEncoding.EncodeToString([]byte(auth))
|
||||||
}
|
}
|
||||||
|
|
||||||
func doHTTPConnectHandshake(ctx context.Context, conn net.Conn, backendAddr string, proxyURL *url.URL, grpcUA string) (_ net.Conn, err error) {
|
func doHTTPConnectHandshake(ctx context.Context, conn net.Conn, grpcUA string, opts proxyattributes.Options) (_ net.Conn, err error) {
|
||||||
defer func() {
|
defer func() {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
conn.Close()
|
conn.Close()
|
||||||
@ -81,15 +63,14 @@ func doHTTPConnectHandshake(ctx context.Context, conn net.Conn, backendAddr stri
|
|||||||
|
|
||||||
req := &http.Request{
|
req := &http.Request{
|
||||||
Method: http.MethodConnect,
|
Method: http.MethodConnect,
|
||||||
URL: &url.URL{Host: backendAddr},
|
URL: &url.URL{Host: opts.ConnectAddr},
|
||||||
Header: map[string][]string{"User-Agent": {grpcUA}},
|
Header: map[string][]string{"User-Agent": {grpcUA}},
|
||||||
}
|
}
|
||||||
if t := proxyURL.User; t != nil {
|
if user := opts.User; user != nil {
|
||||||
u := t.Username()
|
u := user.Username()
|
||||||
p, _ := t.Password()
|
p, _ := user.Password()
|
||||||
req.Header.Add(proxyAuthHeaderKey, "Basic "+basicAuth(u, p))
|
req.Header.Add(proxyAuthHeaderKey, "Basic "+basicAuth(u, p))
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := sendHTTPRequest(ctx, req, conn); err != nil {
|
if err := sendHTTPRequest(ctx, req, conn); err != nil {
|
||||||
return nil, fmt.Errorf("failed to write the HTTP request: %v", err)
|
return nil, fmt.Errorf("failed to write the HTTP request: %v", err)
|
||||||
}
|
}
|
||||||
@ -117,28 +98,13 @@ func doHTTPConnectHandshake(ctx context.Context, conn net.Conn, backendAddr stri
|
|||||||
return conn, nil
|
return conn, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// proxyDial dials, connecting to a proxy first if necessary. Checks if a proxy
|
// proxyDial establishes a TCP connection to the specified address and performs an HTTP CONNECT handshake.
|
||||||
// is necessary, dials, does the HTTP CONNECT handshake, and returns the
|
func proxyDial(ctx context.Context, addr resolver.Address, grpcUA string, opts proxyattributes.Options) (net.Conn, error) {
|
||||||
// connection.
|
conn, err := internal.NetDialerWithTCPKeepalive().DialContext(ctx, "tcp", addr.Addr)
|
||||||
func proxyDial(ctx context.Context, addr string, grpcUA string) (net.Conn, error) {
|
|
||||||
newAddr := addr
|
|
||||||
proxyURL, err := mapAddress(addr)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if proxyURL != nil {
|
return doHTTPConnectHandshake(ctx, conn, grpcUA, opts)
|
||||||
newAddr = proxyURL.Host
|
|
||||||
}
|
|
||||||
|
|
||||||
conn, err := internal.NetDialerWithTCPKeepalive().DialContext(ctx, "tcp", newAddr)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
if proxyURL == nil {
|
|
||||||
// proxy is disabled if proxyURL is nil.
|
|
||||||
return conn, err
|
|
||||||
}
|
|
||||||
return doHTTPConnectHandshake(ctx, conn, addr, proxyURL, grpcUA)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func sendHTTPRequest(ctx context.Context, req *http.Request, conn net.Conn) error {
|
func sendHTTPRequest(ctx context.Context, req *http.Request, conn net.Conn) error {
|
||||||
|
2
vendor/google.golang.org/grpc/internal/transport/transport.go
generated
vendored
2
vendor/google.golang.org/grpc/internal/transport/transport.go
generated
vendored
@ -502,8 +502,6 @@ type ConnectOptions struct {
|
|||||||
ChannelzParent *channelz.SubChannel
|
ChannelzParent *channelz.SubChannel
|
||||||
// MaxHeaderListSize sets the max (uncompressed) size of header list that is prepared to be received.
|
// MaxHeaderListSize sets the max (uncompressed) size of header list that is prepared to be received.
|
||||||
MaxHeaderListSize *uint32
|
MaxHeaderListSize *uint32
|
||||||
// UseProxy specifies if a proxy should be used.
|
|
||||||
UseProxy bool
|
|
||||||
// The mem.BufferPool to use when reading/writing to the wire.
|
// The mem.BufferPool to use when reading/writing to the wire.
|
||||||
BufferPool mem.BufferPool
|
BufferPool mem.BufferPool
|
||||||
}
|
}
|
||||||
|
2
vendor/google.golang.org/grpc/picker_wrapper.go
generated
vendored
2
vendor/google.golang.org/grpc/picker_wrapper.go
generated
vendored
@ -123,7 +123,7 @@ func (pw *pickerWrapper) pick(ctx context.Context, failfast bool, info balancer.
|
|||||||
if lastPickErr != nil {
|
if lastPickErr != nil {
|
||||||
errStr = "latest balancer error: " + lastPickErr.Error()
|
errStr = "latest balancer error: " + lastPickErr.Error()
|
||||||
} else {
|
} else {
|
||||||
errStr = fmt.Sprintf("received context error while waiting for new LB policy update: %s", ctx.Err().Error())
|
errStr = fmt.Sprintf("%v while waiting for connections to become ready", ctx.Err())
|
||||||
}
|
}
|
||||||
switch ctx.Err() {
|
switch ctx.Err() {
|
||||||
case context.DeadlineExceeded:
|
case context.DeadlineExceeded:
|
||||||
|
3
vendor/google.golang.org/grpc/resolver/resolver.go
generated
vendored
3
vendor/google.golang.org/grpc/resolver/resolver.go
generated
vendored
@ -30,6 +30,7 @@ import (
|
|||||||
|
|
||||||
"google.golang.org/grpc/attributes"
|
"google.golang.org/grpc/attributes"
|
||||||
"google.golang.org/grpc/credentials"
|
"google.golang.org/grpc/credentials"
|
||||||
|
"google.golang.org/grpc/experimental/stats"
|
||||||
"google.golang.org/grpc/internal"
|
"google.golang.org/grpc/internal"
|
||||||
"google.golang.org/grpc/serviceconfig"
|
"google.golang.org/grpc/serviceconfig"
|
||||||
)
|
)
|
||||||
@ -175,6 +176,8 @@ type BuildOptions struct {
|
|||||||
// Authority is the effective authority of the clientconn for which the
|
// Authority is the effective authority of the clientconn for which the
|
||||||
// resolver is built.
|
// resolver is built.
|
||||||
Authority string
|
Authority string
|
||||||
|
// MetricsRecorder is the metrics recorder to do recording.
|
||||||
|
MetricsRecorder stats.MetricsRecorder
|
||||||
}
|
}
|
||||||
|
|
||||||
// An Endpoint is one network endpoint, or server, which may have multiple
|
// An Endpoint is one network endpoint, or server, which may have multiple
|
||||||
|
13
vendor/google.golang.org/grpc/resolver_wrapper.go
generated
vendored
13
vendor/google.golang.org/grpc/resolver_wrapper.go
generated
vendored
@ -26,6 +26,7 @@ import (
|
|||||||
"google.golang.org/grpc/internal/channelz"
|
"google.golang.org/grpc/internal/channelz"
|
||||||
"google.golang.org/grpc/internal/grpcsync"
|
"google.golang.org/grpc/internal/grpcsync"
|
||||||
"google.golang.org/grpc/internal/pretty"
|
"google.golang.org/grpc/internal/pretty"
|
||||||
|
"google.golang.org/grpc/internal/resolver/delegatingresolver"
|
||||||
"google.golang.org/grpc/resolver"
|
"google.golang.org/grpc/resolver"
|
||||||
"google.golang.org/grpc/serviceconfig"
|
"google.golang.org/grpc/serviceconfig"
|
||||||
)
|
)
|
||||||
@ -76,9 +77,19 @@ func (ccr *ccResolverWrapper) start() error {
|
|||||||
CredsBundle: ccr.cc.dopts.copts.CredsBundle,
|
CredsBundle: ccr.cc.dopts.copts.CredsBundle,
|
||||||
Dialer: ccr.cc.dopts.copts.Dialer,
|
Dialer: ccr.cc.dopts.copts.Dialer,
|
||||||
Authority: ccr.cc.authority,
|
Authority: ccr.cc.authority,
|
||||||
|
MetricsRecorder: ccr.cc.metricsRecorderList,
|
||||||
}
|
}
|
||||||
var err error
|
var err error
|
||||||
ccr.resolver, err = ccr.cc.resolverBuilder.Build(ccr.cc.parsedTarget, ccr, opts)
|
// The delegating resolver is used unless:
|
||||||
|
// - A custom dialer is provided via WithContextDialer dialoption or
|
||||||
|
// - Proxy usage is disabled through WithNoProxy dialoption.
|
||||||
|
// In these cases, the resolver is built based on the scheme of target,
|
||||||
|
// using the appropriate resolver builder.
|
||||||
|
if ccr.cc.dopts.copts.Dialer != nil || !ccr.cc.dopts.useProxy {
|
||||||
|
ccr.resolver, err = ccr.cc.resolverBuilder.Build(ccr.cc.parsedTarget, ccr, opts)
|
||||||
|
} else {
|
||||||
|
ccr.resolver, err = delegatingresolver.New(ccr.cc.parsedTarget, ccr, opts, ccr.cc.resolverBuilder, ccr.cc.dopts.enableLocalDNSResolution)
|
||||||
|
}
|
||||||
errCh <- err
|
errCh <- err
|
||||||
})
|
})
|
||||||
return <-errCh
|
return <-errCh
|
||||||
|
83
vendor/google.golang.org/grpc/rpc_util.go
generated
vendored
83
vendor/google.golang.org/grpc/rpc_util.go
generated
vendored
@ -151,7 +151,7 @@ func (d *gzipDecompressor) Type() string {
|
|||||||
|
|
||||||
// callInfo contains all related configuration and information about an RPC.
|
// callInfo contains all related configuration and information about an RPC.
|
||||||
type callInfo struct {
|
type callInfo struct {
|
||||||
compressorType string
|
compressorName string
|
||||||
failFast bool
|
failFast bool
|
||||||
maxReceiveMessageSize *int
|
maxReceiveMessageSize *int
|
||||||
maxSendMessageSize *int
|
maxSendMessageSize *int
|
||||||
@ -222,7 +222,7 @@ type HeaderCallOption struct {
|
|||||||
|
|
||||||
func (o HeaderCallOption) before(*callInfo) error { return nil }
|
func (o HeaderCallOption) before(*callInfo) error { return nil }
|
||||||
func (o HeaderCallOption) after(_ *callInfo, attempt *csAttempt) {
|
func (o HeaderCallOption) after(_ *callInfo, attempt *csAttempt) {
|
||||||
*o.HeaderAddr, _ = attempt.s.Header()
|
*o.HeaderAddr, _ = attempt.transportStream.Header()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Trailer returns a CallOptions that retrieves the trailer metadata
|
// Trailer returns a CallOptions that retrieves the trailer metadata
|
||||||
@ -244,7 +244,7 @@ type TrailerCallOption struct {
|
|||||||
|
|
||||||
func (o TrailerCallOption) before(*callInfo) error { return nil }
|
func (o TrailerCallOption) before(*callInfo) error { return nil }
|
||||||
func (o TrailerCallOption) after(_ *callInfo, attempt *csAttempt) {
|
func (o TrailerCallOption) after(_ *callInfo, attempt *csAttempt) {
|
||||||
*o.TrailerAddr = attempt.s.Trailer()
|
*o.TrailerAddr = attempt.transportStream.Trailer()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Peer returns a CallOption that retrieves peer information for a unary RPC.
|
// Peer returns a CallOption that retrieves peer information for a unary RPC.
|
||||||
@ -266,7 +266,7 @@ type PeerCallOption struct {
|
|||||||
|
|
||||||
func (o PeerCallOption) before(*callInfo) error { return nil }
|
func (o PeerCallOption) before(*callInfo) error { return nil }
|
||||||
func (o PeerCallOption) after(_ *callInfo, attempt *csAttempt) {
|
func (o PeerCallOption) after(_ *callInfo, attempt *csAttempt) {
|
||||||
if x, ok := peer.FromContext(attempt.s.Context()); ok {
|
if x, ok := peer.FromContext(attempt.transportStream.Context()); ok {
|
||||||
*o.PeerAddr = *x
|
*o.PeerAddr = *x
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -435,7 +435,7 @@ type CompressorCallOption struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (o CompressorCallOption) before(c *callInfo) error {
|
func (o CompressorCallOption) before(c *callInfo) error {
|
||||||
c.compressorType = o.CompressorType
|
c.compressorName = o.CompressorType
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
func (o CompressorCallOption) after(*callInfo, *csAttempt) {}
|
func (o CompressorCallOption) after(*callInfo, *csAttempt) {}
|
||||||
@ -692,9 +692,9 @@ func encode(c baseCodec, msg any) (mem.BufferSlice, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, status.Errorf(codes.Internal, "grpc: error while marshaling: %v", err.Error())
|
return nil, status.Errorf(codes.Internal, "grpc: error while marshaling: %v", err.Error())
|
||||||
}
|
}
|
||||||
if uint(b.Len()) > math.MaxUint32 {
|
if bufSize := uint(b.Len()); bufSize > math.MaxUint32 {
|
||||||
b.Free()
|
b.Free()
|
||||||
return nil, status.Errorf(codes.ResourceExhausted, "grpc: message too large (%d bytes)", len(b))
|
return nil, status.Errorf(codes.ResourceExhausted, "grpc: message too large (%d bytes)", bufSize)
|
||||||
}
|
}
|
||||||
return b, nil
|
return b, nil
|
||||||
}
|
}
|
||||||
@ -828,30 +828,13 @@ func recvAndDecompress(p *parser, s recvCompressor, dc Decompressor, maxReceiveM
|
|||||||
return nil, st.Err()
|
return nil, st.Err()
|
||||||
}
|
}
|
||||||
|
|
||||||
var size int
|
|
||||||
if pf.isCompressed() {
|
if pf.isCompressed() {
|
||||||
defer compressed.Free()
|
defer compressed.Free()
|
||||||
|
|
||||||
// To match legacy behavior, if the decompressor is set by WithDecompressor or RPCDecompressor,
|
// To match legacy behavior, if the decompressor is set by WithDecompressor or RPCDecompressor,
|
||||||
// use this decompressor as the default.
|
// use this decompressor as the default.
|
||||||
if dc != nil {
|
out, err = decompress(compressor, compressed, dc, maxReceiveMessageSize, p.bufferPool)
|
||||||
var uncompressedBuf []byte
|
|
||||||
uncompressedBuf, err = dc.Do(compressed.Reader())
|
|
||||||
if err == nil {
|
|
||||||
out = mem.BufferSlice{mem.SliceBuffer(uncompressedBuf)}
|
|
||||||
}
|
|
||||||
size = len(uncompressedBuf)
|
|
||||||
} else {
|
|
||||||
out, size, err = decompress(compressor, compressed, maxReceiveMessageSize, p.bufferPool)
|
|
||||||
}
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, status.Errorf(codes.Internal, "grpc: failed to decompress the received message: %v", err)
|
return nil, err
|
||||||
}
|
|
||||||
if size > maxReceiveMessageSize {
|
|
||||||
out.Free()
|
|
||||||
// TODO: Revisit the error code. Currently keep it consistent with java
|
|
||||||
// implementation.
|
|
||||||
return nil, status.Errorf(codes.ResourceExhausted, "grpc: received message after decompression larger than max (%d vs. %d)", size, maxReceiveMessageSize)
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
out = compressed
|
out = compressed
|
||||||
@ -866,20 +849,46 @@ func recvAndDecompress(p *parser, s recvCompressor, dc Decompressor, maxReceiveM
|
|||||||
return out, nil
|
return out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Using compressor, decompress d, returning data and size.
|
// decompress processes the given data by decompressing it using either a custom decompressor or a standard compressor.
|
||||||
// Optionally, if data will be over maxReceiveMessageSize, just return the size.
|
// If a custom decompressor is provided, it takes precedence. The function validates that the decompressed data
|
||||||
func decompress(compressor encoding.Compressor, d mem.BufferSlice, maxReceiveMessageSize int, pool mem.BufferPool) (mem.BufferSlice, int, error) {
|
// does not exceed the specified maximum size and returns an error if this limit is exceeded.
|
||||||
dcReader, err := compressor.Decompress(d.Reader())
|
// On success, it returns the decompressed data. Otherwise, it returns an error if decompression fails or the data exceeds the size limit.
|
||||||
if err != nil {
|
func decompress(compressor encoding.Compressor, d mem.BufferSlice, dc Decompressor, maxReceiveMessageSize int, pool mem.BufferPool) (mem.BufferSlice, error) {
|
||||||
return nil, 0, err
|
if dc != nil {
|
||||||
|
uncompressed, err := dc.Do(d.Reader())
|
||||||
|
if err != nil {
|
||||||
|
return nil, status.Errorf(codes.Internal, "grpc: failed to decompress the received message: %v", err)
|
||||||
|
}
|
||||||
|
if len(uncompressed) > maxReceiveMessageSize {
|
||||||
|
return nil, status.Errorf(codes.ResourceExhausted, "grpc: message after decompression larger than max (%d vs. %d)", len(uncompressed), maxReceiveMessageSize)
|
||||||
|
}
|
||||||
|
return mem.BufferSlice{mem.SliceBuffer(uncompressed)}, nil
|
||||||
}
|
}
|
||||||
|
if compressor != nil {
|
||||||
|
dcReader, err := compressor.Decompress(d.Reader())
|
||||||
|
if err != nil {
|
||||||
|
return nil, status.Errorf(codes.Internal, "grpc: failed to decompress the message: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
out, err := mem.ReadAll(io.LimitReader(dcReader, int64(maxReceiveMessageSize)+1), pool)
|
out, err := mem.ReadAll(io.LimitReader(dcReader, int64(maxReceiveMessageSize)), pool)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
out.Free()
|
out.Free()
|
||||||
return nil, 0, err
|
return nil, status.Errorf(codes.Internal, "grpc: failed to read decompressed data: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if out.Len() == maxReceiveMessageSize && !atEOF(dcReader) {
|
||||||
|
out.Free()
|
||||||
|
return nil, status.Errorf(codes.ResourceExhausted, "grpc: received message after decompression larger than max %d", maxReceiveMessageSize)
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
}
|
}
|
||||||
return out, out.Len(), nil
|
return nil, status.Errorf(codes.Internal, "grpc: no decompressor available for compressed payload")
|
||||||
|
}
|
||||||
|
|
||||||
|
// atEOF reads data from r and returns true if zero bytes could be read and r.Read returns EOF.
|
||||||
|
func atEOF(dcReader io.Reader) bool {
|
||||||
|
n, err := dcReader.Read(make([]byte, 1))
|
||||||
|
return n == 0 && err == io.EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
type recvCompressor interface {
|
type recvCompressor interface {
|
||||||
|
23
vendor/google.golang.org/grpc/server.go
generated
vendored
23
vendor/google.golang.org/grpc/server.go
generated
vendored
@ -37,12 +37,14 @@ import (
|
|||||||
"google.golang.org/grpc/credentials"
|
"google.golang.org/grpc/credentials"
|
||||||
"google.golang.org/grpc/encoding"
|
"google.golang.org/grpc/encoding"
|
||||||
"google.golang.org/grpc/encoding/proto"
|
"google.golang.org/grpc/encoding/proto"
|
||||||
|
estats "google.golang.org/grpc/experimental/stats"
|
||||||
"google.golang.org/grpc/grpclog"
|
"google.golang.org/grpc/grpclog"
|
||||||
"google.golang.org/grpc/internal"
|
"google.golang.org/grpc/internal"
|
||||||
"google.golang.org/grpc/internal/binarylog"
|
"google.golang.org/grpc/internal/binarylog"
|
||||||
"google.golang.org/grpc/internal/channelz"
|
"google.golang.org/grpc/internal/channelz"
|
||||||
"google.golang.org/grpc/internal/grpcsync"
|
"google.golang.org/grpc/internal/grpcsync"
|
||||||
"google.golang.org/grpc/internal/grpcutil"
|
"google.golang.org/grpc/internal/grpcutil"
|
||||||
|
istats "google.golang.org/grpc/internal/stats"
|
||||||
"google.golang.org/grpc/internal/transport"
|
"google.golang.org/grpc/internal/transport"
|
||||||
"google.golang.org/grpc/keepalive"
|
"google.golang.org/grpc/keepalive"
|
||||||
"google.golang.org/grpc/mem"
|
"google.golang.org/grpc/mem"
|
||||||
@ -82,6 +84,9 @@ func init() {
|
|||||||
internal.BinaryLogger = binaryLogger
|
internal.BinaryLogger = binaryLogger
|
||||||
internal.JoinServerOptions = newJoinServerOption
|
internal.JoinServerOptions = newJoinServerOption
|
||||||
internal.BufferPool = bufferPool
|
internal.BufferPool = bufferPool
|
||||||
|
internal.MetricsRecorderForServer = func(srv *Server) estats.MetricsRecorder {
|
||||||
|
return istats.NewMetricsRecorderList(srv.opts.statsHandlers)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var statusOK = status.New(codes.OK, "")
|
var statusOK = status.New(codes.OK, "")
|
||||||
@ -643,7 +648,7 @@ func (s *Server) serverWorker() {
|
|||||||
// connections to reduce the time spent overall on runtime.morestack.
|
// connections to reduce the time spent overall on runtime.morestack.
|
||||||
func (s *Server) initServerWorkers() {
|
func (s *Server) initServerWorkers() {
|
||||||
s.serverWorkerChannel = make(chan func())
|
s.serverWorkerChannel = make(chan func())
|
||||||
s.serverWorkerChannelClose = grpcsync.OnceFunc(func() {
|
s.serverWorkerChannelClose = sync.OnceFunc(func() {
|
||||||
close(s.serverWorkerChannel)
|
close(s.serverWorkerChannel)
|
||||||
})
|
})
|
||||||
for i := uint32(0); i < s.opts.numServerWorkers; i++ {
|
for i := uint32(0); i < s.opts.numServerWorkers; i++ {
|
||||||
@ -1645,10 +1650,10 @@ func (s *Server) processStreamingRPC(ctx context.Context, stream *transport.Serv
|
|||||||
// If dc is set and matches the stream's compression, use it. Otherwise, try
|
// If dc is set and matches the stream's compression, use it. Otherwise, try
|
||||||
// to find a matching registered compressor for decomp.
|
// to find a matching registered compressor for decomp.
|
||||||
if rc := stream.RecvCompress(); s.opts.dc != nil && s.opts.dc.Type() == rc {
|
if rc := stream.RecvCompress(); s.opts.dc != nil && s.opts.dc.Type() == rc {
|
||||||
ss.dc = s.opts.dc
|
ss.decompressorV0 = s.opts.dc
|
||||||
} else if rc != "" && rc != encoding.Identity {
|
} else if rc != "" && rc != encoding.Identity {
|
||||||
ss.decomp = encoding.GetCompressor(rc)
|
ss.decompressorV1 = encoding.GetCompressor(rc)
|
||||||
if ss.decomp == nil {
|
if ss.decompressorV1 == nil {
|
||||||
st := status.Newf(codes.Unimplemented, "grpc: Decompressor is not installed for grpc-encoding %q", rc)
|
st := status.Newf(codes.Unimplemented, "grpc: Decompressor is not installed for grpc-encoding %q", rc)
|
||||||
ss.s.WriteStatus(st)
|
ss.s.WriteStatus(st)
|
||||||
return st.Err()
|
return st.Err()
|
||||||
@ -1660,12 +1665,12 @@ func (s *Server) processStreamingRPC(ctx context.Context, stream *transport.Serv
|
|||||||
//
|
//
|
||||||
// NOTE: this needs to be ahead of all handling, https://github.com/grpc/grpc-go/issues/686.
|
// NOTE: this needs to be ahead of all handling, https://github.com/grpc/grpc-go/issues/686.
|
||||||
if s.opts.cp != nil {
|
if s.opts.cp != nil {
|
||||||
ss.cp = s.opts.cp
|
ss.compressorV0 = s.opts.cp
|
||||||
ss.sendCompressorName = s.opts.cp.Type()
|
ss.sendCompressorName = s.opts.cp.Type()
|
||||||
} else if rc := stream.RecvCompress(); rc != "" && rc != encoding.Identity {
|
} else if rc := stream.RecvCompress(); rc != "" && rc != encoding.Identity {
|
||||||
// Legacy compressor not specified; attempt to respond with same encoding.
|
// Legacy compressor not specified; attempt to respond with same encoding.
|
||||||
ss.comp = encoding.GetCompressor(rc)
|
ss.compressorV1 = encoding.GetCompressor(rc)
|
||||||
if ss.comp != nil {
|
if ss.compressorV1 != nil {
|
||||||
ss.sendCompressorName = rc
|
ss.sendCompressorName = rc
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1676,7 +1681,7 @@ func (s *Server) processStreamingRPC(ctx context.Context, stream *transport.Serv
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ss.ctx = newContextWithRPCInfo(ss.ctx, false, ss.codec, ss.cp, ss.comp)
|
ss.ctx = newContextWithRPCInfo(ss.ctx, false, ss.codec, ss.compressorV0, ss.compressorV1)
|
||||||
|
|
||||||
if trInfo != nil {
|
if trInfo != nil {
|
||||||
trInfo.tr.LazyLog(&trInfo.firstLine, false)
|
trInfo.tr.LazyLog(&trInfo.firstLine, false)
|
||||||
@ -1930,7 +1935,7 @@ func (s *Server) stop(graceful bool) {
|
|||||||
s.conns = nil
|
s.conns = nil
|
||||||
|
|
||||||
if s.opts.numServerWorkers > 0 {
|
if s.opts.numServerWorkers > 0 {
|
||||||
// Closing the channel (only once, via grpcsync.OnceFunc) after all the
|
// Closing the channel (only once, via sync.OnceFunc) after all the
|
||||||
// connections have been closed above ensures that there are no
|
// connections have been closed above ensures that there are no
|
||||||
// goroutines executing the callback passed to st.HandleStreams (where
|
// goroutines executing the callback passed to st.HandleStreams (where
|
||||||
// the channel is written to).
|
// the channel is written to).
|
||||||
|
294
vendor/google.golang.org/grpc/stream.go
generated
vendored
294
vendor/google.golang.org/grpc/stream.go
generated
vendored
@ -258,9 +258,9 @@ func newClientStream(ctx context.Context, desc *StreamDesc, cc *ClientConn, meth
|
|||||||
}
|
}
|
||||||
|
|
||||||
func newClientStreamWithParams(ctx context.Context, desc *StreamDesc, cc *ClientConn, method string, mc serviceconfig.MethodConfig, onCommit, doneFunc func(), opts ...CallOption) (_ iresolver.ClientStream, err error) {
|
func newClientStreamWithParams(ctx context.Context, desc *StreamDesc, cc *ClientConn, method string, mc serviceconfig.MethodConfig, onCommit, doneFunc func(), opts ...CallOption) (_ iresolver.ClientStream, err error) {
|
||||||
c := defaultCallInfo()
|
callInfo := defaultCallInfo()
|
||||||
if mc.WaitForReady != nil {
|
if mc.WaitForReady != nil {
|
||||||
c.failFast = !*mc.WaitForReady
|
callInfo.failFast = !*mc.WaitForReady
|
||||||
}
|
}
|
||||||
|
|
||||||
// Possible context leak:
|
// Possible context leak:
|
||||||
@ -281,20 +281,20 @@ func newClientStreamWithParams(ctx context.Context, desc *StreamDesc, cc *Client
|
|||||||
}()
|
}()
|
||||||
|
|
||||||
for _, o := range opts {
|
for _, o := range opts {
|
||||||
if err := o.before(c); err != nil {
|
if err := o.before(callInfo); err != nil {
|
||||||
return nil, toRPCErr(err)
|
return nil, toRPCErr(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
c.maxSendMessageSize = getMaxSize(mc.MaxReqSize, c.maxSendMessageSize, defaultClientMaxSendMessageSize)
|
callInfo.maxSendMessageSize = getMaxSize(mc.MaxReqSize, callInfo.maxSendMessageSize, defaultClientMaxSendMessageSize)
|
||||||
c.maxReceiveMessageSize = getMaxSize(mc.MaxRespSize, c.maxReceiveMessageSize, defaultClientMaxReceiveMessageSize)
|
callInfo.maxReceiveMessageSize = getMaxSize(mc.MaxRespSize, callInfo.maxReceiveMessageSize, defaultClientMaxReceiveMessageSize)
|
||||||
if err := setCallInfoCodec(c); err != nil {
|
if err := setCallInfoCodec(callInfo); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
callHdr := &transport.CallHdr{
|
callHdr := &transport.CallHdr{
|
||||||
Host: cc.authority,
|
Host: cc.authority,
|
||||||
Method: method,
|
Method: method,
|
||||||
ContentSubtype: c.contentSubtype,
|
ContentSubtype: callInfo.contentSubtype,
|
||||||
DoneFunc: doneFunc,
|
DoneFunc: doneFunc,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -302,22 +302,22 @@ func newClientStreamWithParams(ctx context.Context, desc *StreamDesc, cc *Client
|
|||||||
// set. In that case, also find the compressor from the encoding package.
|
// set. In that case, also find the compressor from the encoding package.
|
||||||
// Otherwise, use the compressor configured by the WithCompressor DialOption,
|
// Otherwise, use the compressor configured by the WithCompressor DialOption,
|
||||||
// if set.
|
// if set.
|
||||||
var cp Compressor
|
var compressorV0 Compressor
|
||||||
var comp encoding.Compressor
|
var compressorV1 encoding.Compressor
|
||||||
if ct := c.compressorType; ct != "" {
|
if ct := callInfo.compressorName; ct != "" {
|
||||||
callHdr.SendCompress = ct
|
callHdr.SendCompress = ct
|
||||||
if ct != encoding.Identity {
|
if ct != encoding.Identity {
|
||||||
comp = encoding.GetCompressor(ct)
|
compressorV1 = encoding.GetCompressor(ct)
|
||||||
if comp == nil {
|
if compressorV1 == nil {
|
||||||
return nil, status.Errorf(codes.Internal, "grpc: Compressor is not installed for requested grpc-encoding %q", ct)
|
return nil, status.Errorf(codes.Internal, "grpc: Compressor is not installed for requested grpc-encoding %q", ct)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if cc.dopts.cp != nil {
|
} else if cc.dopts.compressorV0 != nil {
|
||||||
callHdr.SendCompress = cc.dopts.cp.Type()
|
callHdr.SendCompress = cc.dopts.compressorV0.Type()
|
||||||
cp = cc.dopts.cp
|
compressorV0 = cc.dopts.compressorV0
|
||||||
}
|
}
|
||||||
if c.creds != nil {
|
if callInfo.creds != nil {
|
||||||
callHdr.Creds = c.creds
|
callHdr.Creds = callInfo.creds
|
||||||
}
|
}
|
||||||
|
|
||||||
cs := &clientStream{
|
cs := &clientStream{
|
||||||
@ -325,12 +325,12 @@ func newClientStreamWithParams(ctx context.Context, desc *StreamDesc, cc *Client
|
|||||||
ctx: ctx,
|
ctx: ctx,
|
||||||
methodConfig: &mc,
|
methodConfig: &mc,
|
||||||
opts: opts,
|
opts: opts,
|
||||||
callInfo: c,
|
callInfo: callInfo,
|
||||||
cc: cc,
|
cc: cc,
|
||||||
desc: desc,
|
desc: desc,
|
||||||
codec: c.codec,
|
codec: callInfo.codec,
|
||||||
cp: cp,
|
compressorV0: compressorV0,
|
||||||
comp: comp,
|
compressorV1: compressorV1,
|
||||||
cancel: cancel,
|
cancel: cancel,
|
||||||
firstAttempt: true,
|
firstAttempt: true,
|
||||||
onCommit: onCommit,
|
onCommit: onCommit,
|
||||||
@ -412,7 +412,7 @@ func (cs *clientStream) newAttemptLocked(isTransparent bool) (*csAttempt, error)
|
|||||||
return nil, ErrClientConnClosing
|
return nil, ErrClientConnClosing
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx := newContextWithRPCInfo(cs.ctx, cs.callInfo.failFast, cs.callInfo.codec, cs.cp, cs.comp)
|
ctx := newContextWithRPCInfo(cs.ctx, cs.callInfo.failFast, cs.callInfo.codec, cs.compressorV0, cs.compressorV1)
|
||||||
method := cs.callHdr.Method
|
method := cs.callHdr.Method
|
||||||
var beginTime time.Time
|
var beginTime time.Time
|
||||||
shs := cs.cc.dopts.copts.StatsHandlers
|
shs := cs.cc.dopts.copts.StatsHandlers
|
||||||
@ -454,12 +454,12 @@ func (cs *clientStream) newAttemptLocked(isTransparent bool) (*csAttempt, error)
|
|||||||
}
|
}
|
||||||
|
|
||||||
return &csAttempt{
|
return &csAttempt{
|
||||||
ctx: ctx,
|
ctx: ctx,
|
||||||
beginTime: beginTime,
|
beginTime: beginTime,
|
||||||
cs: cs,
|
cs: cs,
|
||||||
dc: cs.cc.dopts.dc,
|
decompressorV0: cs.cc.dopts.dc,
|
||||||
statsHandlers: shs,
|
statsHandlers: shs,
|
||||||
trInfo: trInfo,
|
trInfo: trInfo,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -467,7 +467,7 @@ func (a *csAttempt) getTransport() error {
|
|||||||
cs := a.cs
|
cs := a.cs
|
||||||
|
|
||||||
var err error
|
var err error
|
||||||
a.t, a.pickResult, err = cs.cc.getTransport(a.ctx, cs.callInfo.failFast, cs.callHdr.Method)
|
a.transport, a.pickResult, err = cs.cc.getTransport(a.ctx, cs.callInfo.failFast, cs.callHdr.Method)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if de, ok := err.(dropError); ok {
|
if de, ok := err.(dropError); ok {
|
||||||
err = de.error
|
err = de.error
|
||||||
@ -476,7 +476,7 @@ func (a *csAttempt) getTransport() error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if a.trInfo != nil {
|
if a.trInfo != nil {
|
||||||
a.trInfo.firstLine.SetRemoteAddr(a.t.RemoteAddr())
|
a.trInfo.firstLine.SetRemoteAddr(a.transport.RemoteAddr())
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -503,7 +503,7 @@ func (a *csAttempt) newStream() error {
|
|||||||
a.ctx = metadata.NewOutgoingContext(a.ctx, md)
|
a.ctx = metadata.NewOutgoingContext(a.ctx, md)
|
||||||
}
|
}
|
||||||
|
|
||||||
s, err := a.t.NewStream(a.ctx, cs.callHdr)
|
s, err := a.transport.NewStream(a.ctx, cs.callHdr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
nse, ok := err.(*transport.NewStreamError)
|
nse, ok := err.(*transport.NewStreamError)
|
||||||
if !ok {
|
if !ok {
|
||||||
@ -518,9 +518,9 @@ func (a *csAttempt) newStream() error {
|
|||||||
// Unwrap and convert error.
|
// Unwrap and convert error.
|
||||||
return toRPCErr(nse.Err)
|
return toRPCErr(nse.Err)
|
||||||
}
|
}
|
||||||
a.s = s
|
a.transportStream = s
|
||||||
a.ctx = s.Context()
|
a.ctx = s.Context()
|
||||||
a.p = &parser{r: s, bufferPool: a.cs.cc.dopts.copts.BufferPool}
|
a.parser = &parser{r: s, bufferPool: a.cs.cc.dopts.copts.BufferPool}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -532,9 +532,9 @@ type clientStream struct {
|
|||||||
cc *ClientConn
|
cc *ClientConn
|
||||||
desc *StreamDesc
|
desc *StreamDesc
|
||||||
|
|
||||||
codec baseCodec
|
codec baseCodec
|
||||||
cp Compressor
|
compressorV0 Compressor
|
||||||
comp encoding.Compressor
|
compressorV1 encoding.Compressor
|
||||||
|
|
||||||
cancel context.CancelFunc // cancels all attempts
|
cancel context.CancelFunc // cancels all attempts
|
||||||
|
|
||||||
@ -583,17 +583,17 @@ type replayOp struct {
|
|||||||
// csAttempt implements a single transport stream attempt within a
|
// csAttempt implements a single transport stream attempt within a
|
||||||
// clientStream.
|
// clientStream.
|
||||||
type csAttempt struct {
|
type csAttempt struct {
|
||||||
ctx context.Context
|
ctx context.Context
|
||||||
cs *clientStream
|
cs *clientStream
|
||||||
t transport.ClientTransport
|
transport transport.ClientTransport
|
||||||
s *transport.ClientStream
|
transportStream *transport.ClientStream
|
||||||
p *parser
|
parser *parser
|
||||||
pickResult balancer.PickResult
|
pickResult balancer.PickResult
|
||||||
|
|
||||||
finished bool
|
finished bool
|
||||||
dc Decompressor
|
decompressorV0 Decompressor
|
||||||
decomp encoding.Compressor
|
decompressorV1 encoding.Compressor
|
||||||
decompSet bool
|
decompressorSet bool
|
||||||
|
|
||||||
mu sync.Mutex // guards trInfo.tr
|
mu sync.Mutex // guards trInfo.tr
|
||||||
// trInfo may be nil (if EnableTracing is false).
|
// trInfo may be nil (if EnableTracing is false).
|
||||||
@ -639,14 +639,14 @@ func (a *csAttempt) shouldRetry(err error) (bool, error) {
|
|||||||
// RPC is finished or committed or was dropped by the picker; cannot retry.
|
// RPC is finished or committed or was dropped by the picker; cannot retry.
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
if a.s == nil && a.allowTransparentRetry {
|
if a.transportStream == nil && a.allowTransparentRetry {
|
||||||
return true, nil
|
return true, nil
|
||||||
}
|
}
|
||||||
// Wait for the trailers.
|
// Wait for the trailers.
|
||||||
unprocessed := false
|
unprocessed := false
|
||||||
if a.s != nil {
|
if a.transportStream != nil {
|
||||||
<-a.s.Done()
|
<-a.transportStream.Done()
|
||||||
unprocessed = a.s.Unprocessed()
|
unprocessed = a.transportStream.Unprocessed()
|
||||||
}
|
}
|
||||||
if cs.firstAttempt && unprocessed {
|
if cs.firstAttempt && unprocessed {
|
||||||
// First attempt, stream unprocessed: transparently retry.
|
// First attempt, stream unprocessed: transparently retry.
|
||||||
@ -658,14 +658,14 @@ func (a *csAttempt) shouldRetry(err error) (bool, error) {
|
|||||||
|
|
||||||
pushback := 0
|
pushback := 0
|
||||||
hasPushback := false
|
hasPushback := false
|
||||||
if a.s != nil {
|
if a.transportStream != nil {
|
||||||
if !a.s.TrailersOnly() {
|
if !a.transportStream.TrailersOnly() {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(retry): Move down if the spec changes to not check server pushback
|
// TODO(retry): Move down if the spec changes to not check server pushback
|
||||||
// before considering this a failure for throttling.
|
// before considering this a failure for throttling.
|
||||||
sps := a.s.Trailer()["grpc-retry-pushback-ms"]
|
sps := a.transportStream.Trailer()["grpc-retry-pushback-ms"]
|
||||||
if len(sps) == 1 {
|
if len(sps) == 1 {
|
||||||
var e error
|
var e error
|
||||||
if pushback, e = strconv.Atoi(sps[0]); e != nil || pushback < 0 {
|
if pushback, e = strconv.Atoi(sps[0]); e != nil || pushback < 0 {
|
||||||
@ -682,8 +682,8 @@ func (a *csAttempt) shouldRetry(err error) (bool, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var code codes.Code
|
var code codes.Code
|
||||||
if a.s != nil {
|
if a.transportStream != nil {
|
||||||
code = a.s.Status().Code()
|
code = a.transportStream.Status().Code()
|
||||||
} else {
|
} else {
|
||||||
code = status.Code(err)
|
code = status.Code(err)
|
||||||
}
|
}
|
||||||
@ -756,8 +756,8 @@ func (cs *clientStream) Context() context.Context {
|
|||||||
cs.commitAttempt()
|
cs.commitAttempt()
|
||||||
// No need to lock before using attempt, since we know it is committed and
|
// No need to lock before using attempt, since we know it is committed and
|
||||||
// cannot change.
|
// cannot change.
|
||||||
if cs.attempt.s != nil {
|
if cs.attempt.transportStream != nil {
|
||||||
return cs.attempt.s.Context()
|
return cs.attempt.transportStream.Context()
|
||||||
}
|
}
|
||||||
return cs.ctx
|
return cs.ctx
|
||||||
}
|
}
|
||||||
@ -794,9 +794,9 @@ func (cs *clientStream) withRetry(op func(a *csAttempt) error, onSuccess func())
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if err == io.EOF {
|
if err == io.EOF {
|
||||||
<-a.s.Done()
|
<-a.transportStream.Done()
|
||||||
}
|
}
|
||||||
if err == nil || (err == io.EOF && a.s.Status().Code() == codes.OK) {
|
if err == nil || (err == io.EOF && a.transportStream.Status().Code() == codes.OK) {
|
||||||
onSuccess()
|
onSuccess()
|
||||||
cs.mu.Unlock()
|
cs.mu.Unlock()
|
||||||
return err
|
return err
|
||||||
@ -812,7 +812,7 @@ func (cs *clientStream) Header() (metadata.MD, error) {
|
|||||||
var m metadata.MD
|
var m metadata.MD
|
||||||
err := cs.withRetry(func(a *csAttempt) error {
|
err := cs.withRetry(func(a *csAttempt) error {
|
||||||
var err error
|
var err error
|
||||||
m, err = a.s.Header()
|
m, err = a.transportStream.Header()
|
||||||
return toRPCErr(err)
|
return toRPCErr(err)
|
||||||
}, cs.commitAttemptLocked)
|
}, cs.commitAttemptLocked)
|
||||||
|
|
||||||
@ -856,10 +856,10 @@ func (cs *clientStream) Trailer() metadata.MD {
|
|||||||
// directions -- it will prevent races and should not meaningfully impact
|
// directions -- it will prevent races and should not meaningfully impact
|
||||||
// performance.
|
// performance.
|
||||||
cs.commitAttempt()
|
cs.commitAttempt()
|
||||||
if cs.attempt.s == nil {
|
if cs.attempt.transportStream == nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
return cs.attempt.s.Trailer()
|
return cs.attempt.transportStream.Trailer()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cs *clientStream) replayBufferLocked(attempt *csAttempt) error {
|
func (cs *clientStream) replayBufferLocked(attempt *csAttempt) error {
|
||||||
@ -904,7 +904,7 @@ func (cs *clientStream) SendMsg(m any) (err error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// load hdr, payload, data
|
// load hdr, payload, data
|
||||||
hdr, data, payload, pf, err := prepareMsg(m, cs.codec, cs.cp, cs.comp, cs.cc.dopts.copts.BufferPool)
|
hdr, data, payload, pf, err := prepareMsg(m, cs.codec, cs.compressorV0, cs.compressorV1, cs.cc.dopts.copts.BufferPool)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -992,7 +992,7 @@ func (cs *clientStream) CloseSend() error {
|
|||||||
}
|
}
|
||||||
cs.sentLast = true
|
cs.sentLast = true
|
||||||
op := func(a *csAttempt) error {
|
op := func(a *csAttempt) error {
|
||||||
a.s.Write(nil, nil, &transport.WriteOptions{Last: true})
|
a.transportStream.Write(nil, nil, &transport.WriteOptions{Last: true})
|
||||||
// Always return nil; io.EOF is the only error that might make sense
|
// 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
|
// 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
|
// as the only use left for the stream after CloseSend is to call
|
||||||
@ -1030,7 +1030,7 @@ func (cs *clientStream) finish(err error) {
|
|||||||
if cs.attempt != nil {
|
if cs.attempt != nil {
|
||||||
cs.attempt.finish(err)
|
cs.attempt.finish(err)
|
||||||
// after functions all rely upon having a stream.
|
// after functions all rely upon having a stream.
|
||||||
if cs.attempt.s != nil {
|
if cs.attempt.transportStream != nil {
|
||||||
for _, o := range cs.opts {
|
for _, o := range cs.opts {
|
||||||
o.after(cs.callInfo, cs.attempt)
|
o.after(cs.callInfo, cs.attempt)
|
||||||
}
|
}
|
||||||
@ -1084,7 +1084,7 @@ func (a *csAttempt) sendMsg(m any, hdr []byte, payld mem.BufferSlice, dataLength
|
|||||||
}
|
}
|
||||||
a.mu.Unlock()
|
a.mu.Unlock()
|
||||||
}
|
}
|
||||||
if err := a.s.Write(hdr, payld, &transport.WriteOptions{Last: !cs.desc.ClientStreams}); err != nil {
|
if err := a.transportStream.Write(hdr, payld, &transport.WriteOptions{Last: !cs.desc.ClientStreams}); err != nil {
|
||||||
if !cs.desc.ClientStreams {
|
if !cs.desc.ClientStreams {
|
||||||
// For non-client-streaming RPCs, we return nil instead of EOF on error
|
// For non-client-streaming RPCs, we return nil instead of EOF on error
|
||||||
// because the generated code requires it. finish is not called; RecvMsg()
|
// because the generated code requires it. finish is not called; RecvMsg()
|
||||||
@ -1108,25 +1108,25 @@ func (a *csAttempt) recvMsg(m any, payInfo *payloadInfo) (err error) {
|
|||||||
defer payInfo.free()
|
defer payInfo.free()
|
||||||
}
|
}
|
||||||
|
|
||||||
if !a.decompSet {
|
if !a.decompressorSet {
|
||||||
// Block until we receive headers containing received message encoding.
|
// Block until we receive headers containing received message encoding.
|
||||||
if ct := a.s.RecvCompress(); ct != "" && ct != encoding.Identity {
|
if ct := a.transportStream.RecvCompress(); ct != "" && ct != encoding.Identity {
|
||||||
if a.dc == nil || a.dc.Type() != ct {
|
if a.decompressorV0 == nil || a.decompressorV0.Type() != ct {
|
||||||
// No configured decompressor, or it does not match the incoming
|
// No configured decompressor, or it does not match the incoming
|
||||||
// message encoding; attempt to find a registered compressor that does.
|
// message encoding; attempt to find a registered compressor that does.
|
||||||
a.dc = nil
|
a.decompressorV0 = nil
|
||||||
a.decomp = encoding.GetCompressor(ct)
|
a.decompressorV1 = encoding.GetCompressor(ct)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// No compression is used; disable our decompressor.
|
// No compression is used; disable our decompressor.
|
||||||
a.dc = nil
|
a.decompressorV0 = nil
|
||||||
}
|
}
|
||||||
// Only initialize this state once per stream.
|
// Only initialize this state once per stream.
|
||||||
a.decompSet = true
|
a.decompressorSet = true
|
||||||
}
|
}
|
||||||
if err := recv(a.p, cs.codec, a.s, a.dc, m, *cs.callInfo.maxReceiveMessageSize, payInfo, a.decomp, false); err != nil {
|
if err := recv(a.parser, cs.codec, a.transportStream, a.decompressorV0, m, *cs.callInfo.maxReceiveMessageSize, payInfo, a.decompressorV1, false); err != nil {
|
||||||
if err == io.EOF {
|
if err == io.EOF {
|
||||||
if statusErr := a.s.Status().Err(); statusErr != nil {
|
if statusErr := a.transportStream.Status().Err(); statusErr != nil {
|
||||||
return statusErr
|
return statusErr
|
||||||
}
|
}
|
||||||
return io.EOF // indicates successful end of stream.
|
return io.EOF // indicates successful end of stream.
|
||||||
@ -1157,8 +1157,8 @@ func (a *csAttempt) recvMsg(m any, payInfo *payloadInfo) (err error) {
|
|||||||
}
|
}
|
||||||
// Special handling for non-server-stream rpcs.
|
// Special handling for non-server-stream rpcs.
|
||||||
// This recv expects EOF or errors, so we don't collect inPayload.
|
// This recv expects EOF or errors, so we don't collect inPayload.
|
||||||
if err := recv(a.p, cs.codec, a.s, a.dc, m, *cs.callInfo.maxReceiveMessageSize, nil, a.decomp, false); err == io.EOF {
|
if err := recv(a.parser, cs.codec, a.transportStream, a.decompressorV0, m, *cs.callInfo.maxReceiveMessageSize, nil, a.decompressorV1, false); err == io.EOF {
|
||||||
return a.s.Status().Err() // non-server streaming Recv returns nil on success
|
return a.transportStream.Status().Err() // non-server streaming Recv returns nil on success
|
||||||
} else if err != nil {
|
} else if err != nil {
|
||||||
return toRPCErr(err)
|
return toRPCErr(err)
|
||||||
}
|
}
|
||||||
@ -1177,20 +1177,20 @@ func (a *csAttempt) finish(err error) {
|
|||||||
err = nil
|
err = nil
|
||||||
}
|
}
|
||||||
var tr metadata.MD
|
var tr metadata.MD
|
||||||
if a.s != nil {
|
if a.transportStream != nil {
|
||||||
a.s.Close(err)
|
a.transportStream.Close(err)
|
||||||
tr = a.s.Trailer()
|
tr = a.transportStream.Trailer()
|
||||||
}
|
}
|
||||||
|
|
||||||
if a.pickResult.Done != nil {
|
if a.pickResult.Done != nil {
|
||||||
br := false
|
br := false
|
||||||
if a.s != nil {
|
if a.transportStream != nil {
|
||||||
br = a.s.BytesReceived()
|
br = a.transportStream.BytesReceived()
|
||||||
}
|
}
|
||||||
a.pickResult.Done(balancer.DoneInfo{
|
a.pickResult.Done(balancer.DoneInfo{
|
||||||
Err: err,
|
Err: err,
|
||||||
Trailer: tr,
|
Trailer: tr,
|
||||||
BytesSent: a.s != nil,
|
BytesSent: a.transportStream != nil,
|
||||||
BytesReceived: br,
|
BytesReceived: br,
|
||||||
ServerLoad: balancerload.Parse(tr),
|
ServerLoad: balancerload.Parse(tr),
|
||||||
})
|
})
|
||||||
@ -1272,7 +1272,7 @@ func newNonRetryClientStream(ctx context.Context, desc *StreamDesc, method strin
|
|||||||
// if set.
|
// if set.
|
||||||
var cp Compressor
|
var cp Compressor
|
||||||
var comp encoding.Compressor
|
var comp encoding.Compressor
|
||||||
if ct := c.compressorType; ct != "" {
|
if ct := c.compressorName; ct != "" {
|
||||||
callHdr.SendCompress = ct
|
callHdr.SendCompress = ct
|
||||||
if ct != encoding.Identity {
|
if ct != encoding.Identity {
|
||||||
comp = encoding.GetCompressor(ct)
|
comp = encoding.GetCompressor(ct)
|
||||||
@ -1280,9 +1280,9 @@ func newNonRetryClientStream(ctx context.Context, desc *StreamDesc, method strin
|
|||||||
return nil, status.Errorf(codes.Internal, "grpc: Compressor is not installed for requested grpc-encoding %q", ct)
|
return nil, status.Errorf(codes.Internal, "grpc: Compressor is not installed for requested grpc-encoding %q", ct)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if ac.cc.dopts.cp != nil {
|
} else if ac.cc.dopts.compressorV0 != nil {
|
||||||
callHdr.SendCompress = ac.cc.dopts.cp.Type()
|
callHdr.SendCompress = ac.cc.dopts.compressorV0.Type()
|
||||||
cp = ac.cc.dopts.cp
|
cp = ac.cc.dopts.compressorV0
|
||||||
}
|
}
|
||||||
if c.creds != nil {
|
if c.creds != nil {
|
||||||
callHdr.Creds = c.creds
|
callHdr.Creds = c.creds
|
||||||
@ -1290,26 +1290,26 @@ func newNonRetryClientStream(ctx context.Context, desc *StreamDesc, method strin
|
|||||||
|
|
||||||
// Use a special addrConnStream to avoid retry.
|
// Use a special addrConnStream to avoid retry.
|
||||||
as := &addrConnStream{
|
as := &addrConnStream{
|
||||||
callHdr: callHdr,
|
callHdr: callHdr,
|
||||||
ac: ac,
|
ac: ac,
|
||||||
ctx: ctx,
|
ctx: ctx,
|
||||||
cancel: cancel,
|
cancel: cancel,
|
||||||
opts: opts,
|
opts: opts,
|
||||||
callInfo: c,
|
callInfo: c,
|
||||||
desc: desc,
|
desc: desc,
|
||||||
codec: c.codec,
|
codec: c.codec,
|
||||||
cp: cp,
|
sendCompressorV0: cp,
|
||||||
comp: comp,
|
sendCompressorV1: comp,
|
||||||
t: t,
|
transport: t,
|
||||||
}
|
}
|
||||||
|
|
||||||
s, err := as.t.NewStream(as.ctx, as.callHdr)
|
s, err := as.transport.NewStream(as.ctx, as.callHdr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err = toRPCErr(err)
|
err = toRPCErr(err)
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
as.s = s
|
as.transportStream = s
|
||||||
as.p = &parser{r: s, bufferPool: ac.dopts.copts.BufferPool}
|
as.parser = &parser{r: s, bufferPool: ac.dopts.copts.BufferPool}
|
||||||
ac.incrCallsStarted()
|
ac.incrCallsStarted()
|
||||||
if desc != unaryStreamDesc {
|
if desc != unaryStreamDesc {
|
||||||
// Listen on stream context to cleanup when the stream context is
|
// Listen on stream context to cleanup when the stream context is
|
||||||
@ -1335,29 +1335,31 @@ func newNonRetryClientStream(ctx context.Context, desc *StreamDesc, method strin
|
|||||||
}
|
}
|
||||||
|
|
||||||
type addrConnStream struct {
|
type addrConnStream struct {
|
||||||
s *transport.ClientStream
|
transportStream *transport.ClientStream
|
||||||
ac *addrConn
|
ac *addrConn
|
||||||
callHdr *transport.CallHdr
|
callHdr *transport.CallHdr
|
||||||
cancel context.CancelFunc
|
cancel context.CancelFunc
|
||||||
opts []CallOption
|
opts []CallOption
|
||||||
callInfo *callInfo
|
callInfo *callInfo
|
||||||
t transport.ClientTransport
|
transport transport.ClientTransport
|
||||||
ctx context.Context
|
ctx context.Context
|
||||||
sentLast bool
|
sentLast bool
|
||||||
desc *StreamDesc
|
desc *StreamDesc
|
||||||
codec baseCodec
|
codec baseCodec
|
||||||
cp Compressor
|
sendCompressorV0 Compressor
|
||||||
comp encoding.Compressor
|
sendCompressorV1 encoding.Compressor
|
||||||
decompSet bool
|
decompressorSet bool
|
||||||
dc Decompressor
|
decompressorV0 Decompressor
|
||||||
decomp encoding.Compressor
|
decompressorV1 encoding.Compressor
|
||||||
p *parser
|
parser *parser
|
||||||
mu sync.Mutex
|
|
||||||
finished bool
|
// mu guards finished and is held for the entire finish method.
|
||||||
|
mu sync.Mutex
|
||||||
|
finished bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func (as *addrConnStream) Header() (metadata.MD, error) {
|
func (as *addrConnStream) Header() (metadata.MD, error) {
|
||||||
m, err := as.s.Header()
|
m, err := as.transportStream.Header()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
as.finish(toRPCErr(err))
|
as.finish(toRPCErr(err))
|
||||||
}
|
}
|
||||||
@ -1365,7 +1367,7 @@ func (as *addrConnStream) Header() (metadata.MD, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (as *addrConnStream) Trailer() metadata.MD {
|
func (as *addrConnStream) Trailer() metadata.MD {
|
||||||
return as.s.Trailer()
|
return as.transportStream.Trailer()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (as *addrConnStream) CloseSend() error {
|
func (as *addrConnStream) CloseSend() error {
|
||||||
@ -1375,7 +1377,7 @@ func (as *addrConnStream) CloseSend() error {
|
|||||||
}
|
}
|
||||||
as.sentLast = true
|
as.sentLast = true
|
||||||
|
|
||||||
as.s.Write(nil, nil, &transport.WriteOptions{Last: true})
|
as.transportStream.Write(nil, nil, &transport.WriteOptions{Last: true})
|
||||||
// Always return nil; io.EOF is the only error that might make sense
|
// 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
|
// 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
|
// as the only use left for the stream after CloseSend is to call
|
||||||
@ -1384,7 +1386,7 @@ func (as *addrConnStream) CloseSend() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (as *addrConnStream) Context() context.Context {
|
func (as *addrConnStream) Context() context.Context {
|
||||||
return as.s.Context()
|
return as.transportStream.Context()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (as *addrConnStream) SendMsg(m any) (err error) {
|
func (as *addrConnStream) SendMsg(m any) (err error) {
|
||||||
@ -1406,7 +1408,7 @@ func (as *addrConnStream) SendMsg(m any) (err error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// load hdr, payload, data
|
// load hdr, payload, data
|
||||||
hdr, data, payload, pf, err := prepareMsg(m, as.codec, as.cp, as.comp, as.ac.dopts.copts.BufferPool)
|
hdr, data, payload, pf, err := prepareMsg(m, as.codec, as.sendCompressorV0, as.sendCompressorV1, as.ac.dopts.copts.BufferPool)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -1425,7 +1427,7 @@ func (as *addrConnStream) SendMsg(m any) (err error) {
|
|||||||
return status.Errorf(codes.ResourceExhausted, "trying to send message larger than max (%d vs. %d)", payload.Len(), *as.callInfo.maxSendMessageSize)
|
return status.Errorf(codes.ResourceExhausted, "trying to send message larger than max (%d vs. %d)", payload.Len(), *as.callInfo.maxSendMessageSize)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := as.s.Write(hdr, payload, &transport.WriteOptions{Last: !as.desc.ClientStreams}); err != nil {
|
if err := as.transportStream.Write(hdr, payload, &transport.WriteOptions{Last: !as.desc.ClientStreams}); err != nil {
|
||||||
if !as.desc.ClientStreams {
|
if !as.desc.ClientStreams {
|
||||||
// For non-client-streaming RPCs, we return nil instead of EOF on error
|
// For non-client-streaming RPCs, we return nil instead of EOF on error
|
||||||
// because the generated code requires it. finish is not called; RecvMsg()
|
// because the generated code requires it. finish is not called; RecvMsg()
|
||||||
@ -1446,25 +1448,25 @@ func (as *addrConnStream) RecvMsg(m any) (err error) {
|
|||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
if !as.decompSet {
|
if !as.decompressorSet {
|
||||||
// Block until we receive headers containing received message encoding.
|
// Block until we receive headers containing received message encoding.
|
||||||
if ct := as.s.RecvCompress(); ct != "" && ct != encoding.Identity {
|
if ct := as.transportStream.RecvCompress(); ct != "" && ct != encoding.Identity {
|
||||||
if as.dc == nil || as.dc.Type() != ct {
|
if as.decompressorV0 == nil || as.decompressorV0.Type() != ct {
|
||||||
// No configured decompressor, or it does not match the incoming
|
// No configured decompressor, or it does not match the incoming
|
||||||
// message encoding; attempt to find a registered compressor that does.
|
// message encoding; attempt to find a registered compressor that does.
|
||||||
as.dc = nil
|
as.decompressorV0 = nil
|
||||||
as.decomp = encoding.GetCompressor(ct)
|
as.decompressorV1 = encoding.GetCompressor(ct)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// No compression is used; disable our decompressor.
|
// No compression is used; disable our decompressor.
|
||||||
as.dc = nil
|
as.decompressorV0 = nil
|
||||||
}
|
}
|
||||||
// Only initialize this state once per stream.
|
// Only initialize this state once per stream.
|
||||||
as.decompSet = true
|
as.decompressorSet = true
|
||||||
}
|
}
|
||||||
if err := recv(as.p, as.codec, as.s, as.dc, m, *as.callInfo.maxReceiveMessageSize, nil, as.decomp, false); err != nil {
|
if err := recv(as.parser, as.codec, as.transportStream, as.decompressorV0, m, *as.callInfo.maxReceiveMessageSize, nil, as.decompressorV1, false); err != nil {
|
||||||
if err == io.EOF {
|
if err == io.EOF {
|
||||||
if statusErr := as.s.Status().Err(); statusErr != nil {
|
if statusErr := as.transportStream.Status().Err(); statusErr != nil {
|
||||||
return statusErr
|
return statusErr
|
||||||
}
|
}
|
||||||
return io.EOF // indicates successful end of stream.
|
return io.EOF // indicates successful end of stream.
|
||||||
@ -1479,8 +1481,8 @@ func (as *addrConnStream) RecvMsg(m any) (err error) {
|
|||||||
|
|
||||||
// Special handling for non-server-stream rpcs.
|
// Special handling for non-server-stream rpcs.
|
||||||
// This recv expects EOF or errors, so we don't collect inPayload.
|
// This recv expects EOF or errors, so we don't collect inPayload.
|
||||||
if err := recv(as.p, as.codec, as.s, as.dc, m, *as.callInfo.maxReceiveMessageSize, nil, as.decomp, false); err == io.EOF {
|
if err := recv(as.parser, as.codec, as.transportStream, as.decompressorV0, m, *as.callInfo.maxReceiveMessageSize, nil, as.decompressorV1, false); err == io.EOF {
|
||||||
return as.s.Status().Err() // non-server streaming Recv returns nil on success
|
return as.transportStream.Status().Err() // non-server streaming Recv returns nil on success
|
||||||
} else if err != nil {
|
} else if err != nil {
|
||||||
return toRPCErr(err)
|
return toRPCErr(err)
|
||||||
}
|
}
|
||||||
@ -1498,8 +1500,8 @@ func (as *addrConnStream) finish(err error) {
|
|||||||
// Ending a stream with EOF indicates a success.
|
// Ending a stream with EOF indicates a success.
|
||||||
err = nil
|
err = nil
|
||||||
}
|
}
|
||||||
if as.s != nil {
|
if as.transportStream != nil {
|
||||||
as.s.Close(err)
|
as.transportStream.Close(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -1570,10 +1572,10 @@ type serverStream struct {
|
|||||||
p *parser
|
p *parser
|
||||||
codec baseCodec
|
codec baseCodec
|
||||||
|
|
||||||
cp Compressor
|
compressorV0 Compressor
|
||||||
dc Decompressor
|
compressorV1 encoding.Compressor
|
||||||
comp encoding.Compressor
|
decompressorV0 Decompressor
|
||||||
decomp encoding.Compressor
|
decompressorV1 encoding.Compressor
|
||||||
|
|
||||||
sendCompressorName string
|
sendCompressorName string
|
||||||
|
|
||||||
@ -1669,12 +1671,12 @@ func (ss *serverStream) SendMsg(m any) (err error) {
|
|||||||
// Server handler could have set new compressor by calling SetSendCompressor.
|
// Server handler could have set new compressor by calling SetSendCompressor.
|
||||||
// In case it is set, we need to use it for compressing outbound message.
|
// In case it is set, we need to use it for compressing outbound message.
|
||||||
if sendCompressorsName := ss.s.SendCompress(); sendCompressorsName != ss.sendCompressorName {
|
if sendCompressorsName := ss.s.SendCompress(); sendCompressorsName != ss.sendCompressorName {
|
||||||
ss.comp = encoding.GetCompressor(sendCompressorsName)
|
ss.compressorV1 = encoding.GetCompressor(sendCompressorsName)
|
||||||
ss.sendCompressorName = sendCompressorsName
|
ss.sendCompressorName = sendCompressorsName
|
||||||
}
|
}
|
||||||
|
|
||||||
// load hdr, payload, data
|
// load hdr, payload, data
|
||||||
hdr, data, payload, pf, err := prepareMsg(m, ss.codec, ss.cp, ss.comp, ss.p.bufferPool)
|
hdr, data, payload, pf, err := prepareMsg(m, ss.codec, ss.compressorV0, ss.compressorV1, ss.p.bufferPool)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -1755,7 +1757,7 @@ func (ss *serverStream) RecvMsg(m any) (err error) {
|
|||||||
payInfo = &payloadInfo{}
|
payInfo = &payloadInfo{}
|
||||||
defer payInfo.free()
|
defer payInfo.free()
|
||||||
}
|
}
|
||||||
if err := recv(ss.p, ss.codec, ss.s, ss.dc, m, ss.maxReceiveMessageSize, payInfo, ss.decomp, true); err != nil {
|
if err := recv(ss.p, ss.codec, ss.s, ss.decompressorV0, m, ss.maxReceiveMessageSize, payInfo, ss.decompressorV1, true); err != nil {
|
||||||
if err == io.EOF {
|
if err == io.EOF {
|
||||||
if len(ss.binlogs) != 0 {
|
if len(ss.binlogs) != 0 {
|
||||||
chc := &binarylog.ClientHalfClose{}
|
chc := &binarylog.ClientHalfClose{}
|
||||||
|
2
vendor/google.golang.org/grpc/version.go
generated
vendored
2
vendor/google.golang.org/grpc/version.go
generated
vendored
@ -19,4 +19,4 @@
|
|||||||
package grpc
|
package grpc
|
||||||
|
|
||||||
// Version is the current grpc version.
|
// Version is the current grpc version.
|
||||||
const Version = "1.70.0"
|
const Version = "1.71.0"
|
||||||
|
19
vendor/modules.txt
vendored
19
vendor/modules.txt
vendored
@ -512,7 +512,7 @@ go.opentelemetry.io/auto/sdk/internal/telemetry
|
|||||||
## explicit; go 1.22.7
|
## explicit; go 1.22.7
|
||||||
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc
|
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc
|
||||||
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/internal
|
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/internal
|
||||||
# go.opentelemetry.io/otel v1.33.0
|
# go.opentelemetry.io/otel v1.34.0
|
||||||
## explicit; go 1.22.0
|
## explicit; go 1.22.0
|
||||||
go.opentelemetry.io/otel
|
go.opentelemetry.io/otel
|
||||||
go.opentelemetry.io/otel/attribute
|
go.opentelemetry.io/otel/attribute
|
||||||
@ -525,12 +525,12 @@ go.opentelemetry.io/otel/internal/global
|
|||||||
go.opentelemetry.io/otel/propagation
|
go.opentelemetry.io/otel/propagation
|
||||||
go.opentelemetry.io/otel/semconv/v1.17.0
|
go.opentelemetry.io/otel/semconv/v1.17.0
|
||||||
go.opentelemetry.io/otel/semconv/v1.26.0
|
go.opentelemetry.io/otel/semconv/v1.26.0
|
||||||
# go.opentelemetry.io/otel/metric v1.33.0
|
# go.opentelemetry.io/otel/metric v1.34.0
|
||||||
## explicit; go 1.22.0
|
## explicit; go 1.22.0
|
||||||
go.opentelemetry.io/otel/metric
|
go.opentelemetry.io/otel/metric
|
||||||
go.opentelemetry.io/otel/metric/embedded
|
go.opentelemetry.io/otel/metric/embedded
|
||||||
go.opentelemetry.io/otel/metric/noop
|
go.opentelemetry.io/otel/metric/noop
|
||||||
# go.opentelemetry.io/otel/trace v1.33.0
|
# go.opentelemetry.io/otel/trace v1.34.0
|
||||||
## explicit; go 1.22.0
|
## explicit; go 1.22.0
|
||||||
go.opentelemetry.io/otel/trace
|
go.opentelemetry.io/otel/trace
|
||||||
go.opentelemetry.io/otel/trace/embedded
|
go.opentelemetry.io/otel/trace/embedded
|
||||||
@ -568,7 +568,7 @@ golang.org/x/net/idna
|
|||||||
golang.org/x/net/internal/httpcommon
|
golang.org/x/net/internal/httpcommon
|
||||||
golang.org/x/net/internal/timeseries
|
golang.org/x/net/internal/timeseries
|
||||||
golang.org/x/net/trace
|
golang.org/x/net/trace
|
||||||
# golang.org/x/oauth2 v0.24.0
|
# golang.org/x/oauth2 v0.25.0
|
||||||
## explicit; go 1.18
|
## explicit; go 1.18
|
||||||
golang.org/x/oauth2
|
golang.org/x/oauth2
|
||||||
golang.org/x/oauth2/internal
|
golang.org/x/oauth2/internal
|
||||||
@ -602,16 +602,17 @@ golang.org/x/time/rate
|
|||||||
# gomodules.xyz/jsonpatch/v2 v2.4.0
|
# gomodules.xyz/jsonpatch/v2 v2.4.0
|
||||||
## explicit; go 1.20
|
## explicit; go 1.20
|
||||||
gomodules.xyz/jsonpatch/v2
|
gomodules.xyz/jsonpatch/v2
|
||||||
# google.golang.org/genproto/googleapis/rpc v0.0.0-20241216192217-9240e9c98484
|
# google.golang.org/genproto/googleapis/rpc v0.0.0-20250115164207-1a7da9e5054f
|
||||||
## explicit; go 1.21
|
|
||||||
google.golang.org/genproto/googleapis/rpc/status
|
|
||||||
# google.golang.org/grpc v1.70.0
|
|
||||||
## explicit; go 1.22
|
## explicit; go 1.22
|
||||||
|
google.golang.org/genproto/googleapis/rpc/status
|
||||||
|
# google.golang.org/grpc v1.71.0
|
||||||
|
## explicit; go 1.22.0
|
||||||
google.golang.org/grpc
|
google.golang.org/grpc
|
||||||
google.golang.org/grpc/attributes
|
google.golang.org/grpc/attributes
|
||||||
google.golang.org/grpc/backoff
|
google.golang.org/grpc/backoff
|
||||||
google.golang.org/grpc/balancer
|
google.golang.org/grpc/balancer
|
||||||
google.golang.org/grpc/balancer/base
|
google.golang.org/grpc/balancer/base
|
||||||
|
google.golang.org/grpc/balancer/endpointsharding
|
||||||
google.golang.org/grpc/balancer/grpclb/state
|
google.golang.org/grpc/balancer/grpclb/state
|
||||||
google.golang.org/grpc/balancer/pickfirst
|
google.golang.org/grpc/balancer/pickfirst
|
||||||
google.golang.org/grpc/balancer/pickfirst/internal
|
google.golang.org/grpc/balancer/pickfirst/internal
|
||||||
@ -643,7 +644,9 @@ google.golang.org/grpc/internal/grpcutil
|
|||||||
google.golang.org/grpc/internal/idle
|
google.golang.org/grpc/internal/idle
|
||||||
google.golang.org/grpc/internal/metadata
|
google.golang.org/grpc/internal/metadata
|
||||||
google.golang.org/grpc/internal/pretty
|
google.golang.org/grpc/internal/pretty
|
||||||
|
google.golang.org/grpc/internal/proxyattributes
|
||||||
google.golang.org/grpc/internal/resolver
|
google.golang.org/grpc/internal/resolver
|
||||||
|
google.golang.org/grpc/internal/resolver/delegatingresolver
|
||||||
google.golang.org/grpc/internal/resolver/dns
|
google.golang.org/grpc/internal/resolver/dns
|
||||||
google.golang.org/grpc/internal/resolver/dns/internal
|
google.golang.org/grpc/internal/resolver/dns/internal
|
||||||
google.golang.org/grpc/internal/resolver/passthrough
|
google.golang.org/grpc/internal/resolver/passthrough
|
||||||
|
Loading…
Reference in New Issue
Block a user