mirror of
https://github.com/fullstorydev/grpcurl.git
synced 2026-09-05 18:16:08 +03:00
Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| cf21d4aca5 | |||
| 8568146e02 | |||
| 7884ecb9c6 | |||
| aba598c119 | |||
| 4bb0f337c7 | |||
| 5f2d0c2dfc | |||
| 6be36ba632 | |||
| 353acfef45 | |||
| 04bf23be33 | |||
| 1a48043e8a | |||
| afea969b8a | |||
| 4ea1554ec7 | |||
| 0521a49a6a |
@@ -0,0 +1,26 @@
|
|||||||
|
# Controls how GitHub groups merged PRs in the auto-generated release notes.
|
||||||
|
# goreleaser delegates to GitHub's generator (changelog.use: github-native in
|
||||||
|
# .goreleaser.yml), so this file is what shapes the notes for a release.
|
||||||
|
#
|
||||||
|
# Labels are optional: anything unlabeled lands in "Changes". Labeling a PR
|
||||||
|
# `bug` or `enhancement` just sorts it into a nicer bucket, and dependabot
|
||||||
|
# applies `dependencies` on its own, which keeps version bumps out of the way
|
||||||
|
# at the bottom.
|
||||||
|
changelog:
|
||||||
|
exclude:
|
||||||
|
labels:
|
||||||
|
- ignore-for-release
|
||||||
|
categories:
|
||||||
|
- title: Enhancements
|
||||||
|
labels:
|
||||||
|
- enhancement
|
||||||
|
- title: Bug Fixes
|
||||||
|
labels:
|
||||||
|
- bug
|
||||||
|
- title: Dependencies
|
||||||
|
labels:
|
||||||
|
- dependencies
|
||||||
|
# Catch-all. Must stay last: a PR lands in the first category it matches.
|
||||||
|
- title: Changes
|
||||||
|
labels:
|
||||||
|
- "*"
|
||||||
@@ -0,0 +1,184 @@
|
|||||||
|
name: Release
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
version:
|
||||||
|
description: "Release version, sem-ver format: vM.N.P"
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
dry_run:
|
||||||
|
description: "Build everything, publish nothing (aka DRY-RUN... no tag, no GitHub release, no image push, no brew PR)"
|
||||||
|
type: boolean
|
||||||
|
default: false
|
||||||
|
|
||||||
|
# Only one release may be in flight at a time.
|
||||||
|
concurrency:
|
||||||
|
group: release
|
||||||
|
cancel-in-progress: false
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
release:
|
||||||
|
name: Tag, build binaries, and create the GitHub release
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: write # create the tag and the release
|
||||||
|
steps:
|
||||||
|
- name: Validate version
|
||||||
|
run: |
|
||||||
|
if [[ ! "${{ inputs.version }}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
||||||
|
echo "::error::'${{ inputs.version }}' is not a sem-ver version of the form vM.N.P" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
- uses: actions/checkout@v7
|
||||||
|
with:
|
||||||
|
# goreleaser needs full history (and existing tags) to compute the change log
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Check that the tag does not already exist
|
||||||
|
run: |
|
||||||
|
if git rev-parse -q --verify "refs/tags/${{ inputs.version }}" >/dev/null; then
|
||||||
|
echo "::error::tag ${{ inputs.version }} already exists" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
- uses: actions/setup-go@v7
|
||||||
|
with:
|
||||||
|
go-version-file: go.mod
|
||||||
|
check-latest: true
|
||||||
|
|
||||||
|
# Releases are effectively immutable, so make sure we aren't shipping a broken build.
|
||||||
|
- name: Run tests
|
||||||
|
run: go test ./...
|
||||||
|
|
||||||
|
- name: Create tag
|
||||||
|
run: |
|
||||||
|
git config user.name "github-actions[bot]"
|
||||||
|
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||||
|
git tag -a "${{ inputs.version }}" -m "Release ${{ inputs.version }}"
|
||||||
|
|
||||||
|
- name: Push tag
|
||||||
|
if: ${{ !inputs.dry_run }}
|
||||||
|
run: git push origin "${{ inputs.version }}"
|
||||||
|
|
||||||
|
# Cross-compiles for every platform in .goreleaser.yml, then creates the
|
||||||
|
# GitHub release with generated notes and uploads the archives.
|
||||||
|
- name: Build and release
|
||||||
|
run: make release GORELEASER_ARGS="${{ inputs.dry_run && '--skip=publish,announce' || '' }}"
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
# CHANGELOG.md is the release notes that *would* have been published,
|
||||||
|
# which is worth eyeballing before a real release.
|
||||||
|
- name: Upload artifacts for inspection
|
||||||
|
if: ${{ inputs.dry_run }}
|
||||||
|
uses: actions/upload-artifact@v7
|
||||||
|
with:
|
||||||
|
name: dry-run-dist
|
||||||
|
path: |
|
||||||
|
dist/*.tar.gz
|
||||||
|
dist/*.zip
|
||||||
|
dist/*.txt
|
||||||
|
dist/*.deb
|
||||||
|
dist/*.rpm
|
||||||
|
dist/CHANGELOG.md
|
||||||
|
if-no-files-found: error
|
||||||
|
|
||||||
|
docker:
|
||||||
|
name: Build and push the Docker image
|
||||||
|
needs: release
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
packages: write # push to ghcr.io
|
||||||
|
outputs:
|
||||||
|
image: ${{ steps.image.outputs.name }}
|
||||||
|
env:
|
||||||
|
# Matches what releasing/do-release.sh has always published.
|
||||||
|
PLATFORMS: linux/amd64,linux/arm64,linux/s390x,linux/ppc64le
|
||||||
|
steps:
|
||||||
|
# Derived from the repo rather than hardcoded, so this works the same on a
|
||||||
|
# fork: `packages: write` only grants access to packages owned by the repo
|
||||||
|
# owner. GHCR also rejects uppercase, and GitHub expressions have no
|
||||||
|
# lowercase function, hence the shell parameter expansion.
|
||||||
|
- name: Compute image name
|
||||||
|
id: image
|
||||||
|
run: echo "name=ghcr.io/${GITHUB_REPOSITORY,,}" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
|
- uses: actions/checkout@v7
|
||||||
|
with:
|
||||||
|
# the release job just created this tag; build the image from exactly that source
|
||||||
|
ref: ${{ inputs.dry_run && github.sha || inputs.version }}
|
||||||
|
|
||||||
|
# The Dockerfile stamps the binary with the contents of this file. It is
|
||||||
|
# gitignored, and produced by `make docker` during local builds.
|
||||||
|
- name: Write VERSION file
|
||||||
|
run: echo "${{ inputs.version }}" > VERSION
|
||||||
|
|
||||||
|
- uses: docker/setup-qemu-action@v4
|
||||||
|
- uses: docker/setup-buildx-action@v4
|
||||||
|
|
||||||
|
- name: Log in to GitHub Container Registry
|
||||||
|
if: ${{ !inputs.dry_run }}
|
||||||
|
uses: docker/login-action@v4
|
||||||
|
with:
|
||||||
|
registry: ghcr.io
|
||||||
|
username: ${{ github.actor }}
|
||||||
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
# The Dockerfile has two final stages: the default `scratch` image and an
|
||||||
|
# `alpine` one. Both are published, as do-release.sh does.
|
||||||
|
- name: Build and push
|
||||||
|
uses: docker/build-push-action@v7
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
platforms: ${{ env.PLATFORMS }}
|
||||||
|
push: ${{ !inputs.dry_run }}
|
||||||
|
no-cache: true
|
||||||
|
tags: |
|
||||||
|
${{ steps.image.outputs.name }}:${{ inputs.version }}
|
||||||
|
${{ steps.image.outputs.name }}:latest
|
||||||
|
|
||||||
|
- name: Build and push (alpine)
|
||||||
|
uses: docker/build-push-action@v7
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
target: alpine
|
||||||
|
platforms: ${{ env.PLATFORMS }}
|
||||||
|
push: ${{ !inputs.dry_run }}
|
||||||
|
no-cache: true
|
||||||
|
tags: |
|
||||||
|
${{ steps.image.outputs.name }}:${{ inputs.version }}-alpine
|
||||||
|
${{ steps.image.outputs.name }}:latest-alpine
|
||||||
|
|
||||||
|
summary:
|
||||||
|
name: Summarize
|
||||||
|
needs: [release, docker]
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Dry run summary
|
||||||
|
if: ${{ inputs.dry_run }}
|
||||||
|
run: |
|
||||||
|
{
|
||||||
|
echo "## Dry run of ${{ inputs.version }} succeeded"
|
||||||
|
echo
|
||||||
|
echo "Nothing was published. The binaries are attached to this run as the \`dry-run-dist\` artifact."
|
||||||
|
echo "Re-run with **dry_run** unchecked to publish."
|
||||||
|
} >> "$GITHUB_STEP_SUMMARY"
|
||||||
|
|
||||||
|
- name: Release summary
|
||||||
|
if: ${{ !inputs.dry_run }}
|
||||||
|
run: |
|
||||||
|
{
|
||||||
|
echo "## Released ${{ inputs.version }}"
|
||||||
|
echo
|
||||||
|
echo "* [GitHub release](${{ github.server_url }}/${{ github.repository }}/releases/tag/${{ inputs.version }})"
|
||||||
|
echo "* Image \`${{ needs.docker.outputs.image }}:${{ inputs.version }}\` (and \`:latest\`)"
|
||||||
|
echo "* Image \`${{ needs.docker.outputs.image }}:${{ inputs.version }}-alpine\` (and \`:latest-alpine\`)"
|
||||||
|
echo
|
||||||
|
echo "Release notes were generated from the merged PRs. Nothing else to do."
|
||||||
|
} >> "$GITHUB_STEP_SUMMARY"
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
dist/
|
dist/
|
||||||
|
.claude/
|
||||||
.idea/
|
.idea/
|
||||||
VERSION
|
VERSION
|
||||||
.tmp/
|
.tmp/
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
version: 2
|
||||||
|
|
||||||
builds:
|
builds:
|
||||||
- binary: grpcurl
|
- binary: grpcurl
|
||||||
main: ./cmd/grpcurl
|
main: ./cmd/grpcurl
|
||||||
@@ -59,3 +61,6 @@ nfpms:
|
|||||||
formats:
|
formats:
|
||||||
- deb
|
- deb
|
||||||
- rpm
|
- rpm
|
||||||
|
|
||||||
|
changelog:
|
||||||
|
use: github-native
|
||||||
|
|||||||
@@ -29,10 +29,14 @@ updatedeps:
|
|||||||
install:
|
install:
|
||||||
go install -ldflags '-X "main.version=dev build $(dev_build_version)"' ./...
|
go install -ldflags '-X "main.version=dev build $(dev_build_version)"' ./...
|
||||||
|
|
||||||
|
GORELEASER_VERSION := v2.5.0
|
||||||
|
# Extra flags for goreleaser, e.g. "--skip=publish" for a dry run.
|
||||||
|
GORELEASER_ARGS ?=
|
||||||
|
|
||||||
.PHONY: release
|
.PHONY: release
|
||||||
release:
|
release:
|
||||||
@go install github.com/goreleaser/goreleaser@v1.21.0
|
@go install github.com/goreleaser/goreleaser/v2@$(GORELEASER_VERSION)
|
||||||
goreleaser release --clean
|
goreleaser release --clean $(GORELEASER_ARGS)
|
||||||
|
|
||||||
.PHONY: docker
|
.PHONY: docker
|
||||||
docker:
|
docker:
|
||||||
|
|||||||
@@ -62,9 +62,9 @@ brew install grpcurl
|
|||||||
For platforms that support Docker, you can download an image that lets you run `grpcurl`:
|
For platforms that support Docker, you can download an image that lets you run `grpcurl`:
|
||||||
```shell
|
```shell
|
||||||
# Download image
|
# Download image
|
||||||
docker pull fullstorydev/grpcurl:latest
|
docker pull ghcr.io/fullstorydev/grpcurl:latest
|
||||||
# Run the tool
|
# Run the tool
|
||||||
docker run fullstorydev/grpcurl api.grpc.me:443 list
|
docker run ghcr.io/fullstorydev/grpcurl api.grpc.me:443 list
|
||||||
```
|
```
|
||||||
Note that there are some pitfalls when using docker:
|
Note that there are some pitfalls when using docker:
|
||||||
- If you need to interact with a server listening on the host's loopback network, you must specify the host as `host.docker.internal` instead of `localhost` (for Mac or Windows) _OR_ have the container use the host network with `-network="host"` (Linux only).
|
- If you need to interact with a server listening on the host's loopback network, you must specify the host as `host.docker.internal` instead of `localhost` (for Mac or Windows) _OR_ have the container use the host network with `-network="host"` (Linux only).
|
||||||
@@ -146,7 +146,7 @@ grpcurl -d @ grpc.server.com:443 my.custom.server.Service/Method <<EOM
|
|||||||
{
|
{
|
||||||
"id": 1234,
|
"id": 1234,
|
||||||
"tags": [
|
"tags": [
|
||||||
"foor",
|
"foo",
|
||||||
"bar"
|
"bar"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/jhump/protoreflect/desc" //lint:ignore SA1019 required to use APIs in other grpcurl package
|
"github.com/jhump/protoreflect/desc"
|
||||||
"github.com/jhump/protoreflect/grpcreflect"
|
"github.com/jhump/protoreflect/grpcreflect"
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
"google.golang.org/grpc/codes"
|
"google.golang.org/grpc/codes"
|
||||||
|
|||||||
+24
-11
@@ -9,11 +9,11 @@ import (
|
|||||||
"path/filepath"
|
"path/filepath"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/golang/protobuf/proto" //lint:ignore SA1019 we have to import these because some of their types appear in exported API
|
"github.com/golang/protobuf/proto"
|
||||||
"github.com/jhump/protoreflect/desc" //lint:ignore SA1019 same as above
|
"github.com/jhump/protoreflect/desc"
|
||||||
"github.com/jhump/protoreflect/desc/protoparse" //lint:ignore SA1019 same as above
|
"github.com/jhump/protoreflect/desc/protoparse"
|
||||||
"github.com/jhump/protoreflect/desc/protoprint"
|
"github.com/jhump/protoreflect/desc/protoprint"
|
||||||
"github.com/jhump/protoreflect/dynamic" //lint:ignore SA1019 same as above
|
"github.com/jhump/protoreflect/dynamic"
|
||||||
"github.com/jhump/protoreflect/grpcreflect"
|
"github.com/jhump/protoreflect/grpcreflect"
|
||||||
"google.golang.org/grpc/codes"
|
"google.golang.org/grpc/codes"
|
||||||
"google.golang.org/grpc/status"
|
"google.golang.org/grpc/status"
|
||||||
@@ -309,24 +309,37 @@ func WriteProtoFiles(outProtoDirPath string, descSource DescriptorSource, symbol
|
|||||||
for _, filename := range filenames {
|
for _, filename := range filenames {
|
||||||
allFileDescriptors = addFilesToFileDescriptorList(allFileDescriptors, expandedFiles, fds[filename])
|
allFileDescriptors = addFilesToFileDescriptorList(allFileDescriptors, expandedFiles, fds[filename])
|
||||||
}
|
}
|
||||||
|
return writeProtoFiles(outProtoDirPath, allFileDescriptors)
|
||||||
|
}
|
||||||
|
|
||||||
|
func writeProtoFiles(outProtoDirPath string, allFileDescriptors []*desc.FileDescriptor) error {
|
||||||
|
if err := os.MkdirAll(outProtoDirPath, 0755); err != nil {
|
||||||
|
return fmt.Errorf("failed to create output directory %q: %w", outProtoDirPath, err)
|
||||||
|
}
|
||||||
|
root, err := os.OpenRoot(outProtoDirPath)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("failed to open output directory %q: %w", outProtoDirPath, err)
|
||||||
|
}
|
||||||
|
defer root.Close()
|
||||||
pr := protoprint.Printer{}
|
pr := protoprint.Printer{}
|
||||||
// now we can serialize to files
|
// now we can serialize to files
|
||||||
for i := range allFileDescriptors {
|
for i := range allFileDescriptors {
|
||||||
if err := writeProtoFile(outProtoDirPath, allFileDescriptors[i], &pr); err != nil {
|
if err := writeProtoFile(root, allFileDescriptors[i], &pr); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func writeProtoFile(outProtoDirPath string, fd *desc.FileDescriptor, pr *protoprint.Printer) error {
|
func writeProtoFile(root *os.Root, fd *desc.FileDescriptor, pr *protoprint.Printer) error {
|
||||||
outFile := filepath.Join(outProtoDirPath, fd.GetFullyQualifiedName())
|
// root confines all path operations to the output directory, so a
|
||||||
outDir := filepath.Dir(outFile)
|
// malicious file name (e.g. "../escape.proto") cannot write outside it
|
||||||
if err := os.MkdirAll(outDir, 0777); err != nil {
|
outFile := fd.GetFullyQualifiedName()
|
||||||
return fmt.Errorf("failed to create directory %q: %w", outDir, err)
|
if err := root.MkdirAll(filepath.Dir(outFile), 0755); err != nil {
|
||||||
|
return fmt.Errorf("failed to create directory for %q: %w", outFile, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
f, err := os.Create(outFile)
|
f, err := root.Create(outFile)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to create proto file %q: %w", outFile, err)
|
return fmt.Errorf("failed to create proto file %q: %w", outFile, err)
|
||||||
}
|
}
|
||||||
|
|||||||
+47
-1
@@ -3,9 +3,11 @@ package grpcurl
|
|||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"os"
|
"os"
|
||||||
|
"path/filepath"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/golang/protobuf/proto" //lint:ignore SA1019 we have to import this because it appears in exported API
|
"github.com/golang/protobuf/proto"
|
||||||
|
"github.com/jhump/protoreflect/desc"
|
||||||
"google.golang.org/protobuf/types/descriptorpb"
|
"google.golang.org/protobuf/types/descriptorpb"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -60,3 +62,47 @@ func checkWriteProtoset(t *testing.T, descSrc DescriptorSource, protoset *descri
|
|||||||
t.Fatalf("written protoset not equal to input:\nExpecting: %s\nActual: %s", protoset, &result)
|
t.Fatalf("written protoset not equal to input:\nExpecting: %s\nActual: %s", protoset, &result)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func writeProtoFileForTest(t *testing.T, dir, fdName string) error {
|
||||||
|
t.Helper()
|
||||||
|
fd, err := desc.CreateFileDescriptor(&descriptorpb.FileDescriptorProto{
|
||||||
|
Name: proto.String(fdName),
|
||||||
|
Syntax: proto.String("proto3"),
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("failed to create file descriptor: %v", err)
|
||||||
|
}
|
||||||
|
return writeProtoFiles(dir, []*desc.FileDescriptor{fd})
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestWriteProtoFile_NormalPath(t *testing.T) {
|
||||||
|
dir := t.TempDir()
|
||||||
|
if err := writeProtoFileForTest(t, dir, "foo/bar.proto"); err != nil {
|
||||||
|
t.Fatalf("unexpected error: %v", err)
|
||||||
|
}
|
||||||
|
if _, err := os.Stat(filepath.Join(dir, "foo", "bar.proto")); err != nil {
|
||||||
|
t.Fatalf("expected output file not created: %v", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestWriteProtoFile_RejectsPathTraversal(t *testing.T) {
|
||||||
|
dir := t.TempDir()
|
||||||
|
if err := writeProtoFileForTest(t, dir, "../escape.proto"); err == nil {
|
||||||
|
t.Fatal("expected error for path-traversing descriptor name, got nil")
|
||||||
|
}
|
||||||
|
escapePath := filepath.Join(dir, "..", "escape.proto")
|
||||||
|
if _, err := os.Stat(escapePath); err == nil {
|
||||||
|
t.Fatalf("file was created outside output directory at %q", escapePath)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestWriteProtoFile_RejectsDeepPathTraversal(t *testing.T) {
|
||||||
|
dir := t.TempDir()
|
||||||
|
if err := writeProtoFileForTest(t, dir, "foo/../../../escape.proto"); err == nil {
|
||||||
|
t.Fatal("expected error for path-traversing descriptor name, got nil")
|
||||||
|
}
|
||||||
|
escapePath := filepath.Join(dir, "foo", "..", "..", "..", "escape.proto")
|
||||||
|
if _, err := os.Stat(escapePath); err == nil {
|
||||||
|
t.Fatalf("file was created outside output directory at %q", escapePath)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -11,10 +11,10 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/golang/protobuf/jsonpb" //lint:ignore SA1019 we have to import these because some of their types appear in exported API
|
"github.com/golang/protobuf/jsonpb"
|
||||||
"github.com/golang/protobuf/proto" //lint:ignore SA1019 same as above
|
"github.com/golang/protobuf/proto"
|
||||||
"github.com/jhump/protoreflect/desc" //lint:ignore SA1019 same as above
|
"github.com/jhump/protoreflect/desc"
|
||||||
"github.com/jhump/protoreflect/dynamic" //lint:ignore SA1019 same as above
|
"github.com/jhump/protoreflect/dynamic"
|
||||||
"google.golang.org/grpc/codes"
|
"google.golang.org/grpc/codes"
|
||||||
"google.golang.org/grpc/metadata"
|
"google.golang.org/grpc/metadata"
|
||||||
"google.golang.org/grpc/status"
|
"google.golang.org/grpc/status"
|
||||||
@@ -330,7 +330,6 @@ func (r anyResolverWithFallback) Resolve(typeUrl string) (proto.Message, error)
|
|||||||
if slash := strings.LastIndex(mname, "/"); slash >= 0 {
|
if slash := strings.LastIndex(mname, "/"); slash >= 0 {
|
||||||
mname = mname[slash+1:]
|
mname = mname[slash+1:]
|
||||||
}
|
}
|
||||||
//lint:ignore SA1019 new non-deprecated API requires other code changes; deferring...
|
|
||||||
mt := proto.MessageType(mname)
|
mt := proto.MessageType(mname)
|
||||||
if mt != nil {
|
if mt != nil {
|
||||||
return reflect.New(mt.Elem()).Interface().(proto.Message), nil
|
return reflect.New(mt.Elem()).Interface().(proto.Message), nil
|
||||||
|
|||||||
+3
-3
@@ -7,9 +7,9 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/golang/protobuf/jsonpb" //lint:ignore SA1019 we have to import these because some of their types appear in exported API
|
"github.com/golang/protobuf/jsonpb"
|
||||||
"github.com/golang/protobuf/proto" //lint:ignore SA1019 same as above
|
"github.com/golang/protobuf/proto"
|
||||||
"github.com/jhump/protoreflect/desc" //lint:ignore SA1019 same as above
|
"github.com/jhump/protoreflect/desc"
|
||||||
"google.golang.org/grpc/metadata"
|
"google.golang.org/grpc/metadata"
|
||||||
"google.golang.org/protobuf/types/known/structpb"
|
"google.golang.org/protobuf/types/known/structpb"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,34 +1,44 @@
|
|||||||
module github.com/fullstorydev/grpcurl
|
module github.com/fullstorydev/grpcurl
|
||||||
|
|
||||||
go 1.24.0
|
go 1.25.0
|
||||||
|
|
||||||
toolchain go1.24.1
|
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/golang/protobuf v1.5.4
|
github.com/golang/protobuf v1.5.4
|
||||||
github.com/jhump/protoreflect v1.18.0
|
github.com/jhump/protoreflect v1.18.1
|
||||||
google.golang.org/grpc v1.80.0
|
google.golang.org/grpc v1.83.2
|
||||||
google.golang.org/protobuf v1.36.11
|
google.golang.org/protobuf v1.36.12
|
||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
cel.dev/expr v0.25.1 // indirect
|
cel.dev/expr v0.25.2 // indirect
|
||||||
|
cloud.google.com/go/auth v0.18.2 // indirect
|
||||||
cloud.google.com/go/compute/metadata v0.9.0 // indirect
|
cloud.google.com/go/compute/metadata v0.9.0 // indirect
|
||||||
github.com/cespare/xxhash/v2 v2.3.0 // indirect
|
github.com/cespare/xxhash/v2 v2.3.0 // indirect
|
||||||
github.com/cncf/xds/go v0.0.0-20251210132809-ee656c7534f5 // indirect
|
github.com/cncf/xds/go v0.0.0-20260202195803-dba9d589def2 // indirect
|
||||||
github.com/envoyproxy/go-control-plane/envoy v1.36.0 // indirect
|
github.com/envoyproxy/go-control-plane/envoy v1.37.0 // indirect
|
||||||
github.com/envoyproxy/protoc-gen-validate v1.3.0 // indirect
|
github.com/envoyproxy/protoc-gen-validate v1.3.3 // indirect
|
||||||
|
github.com/felixge/httpsnoop v1.0.4 // indirect
|
||||||
github.com/go-jose/go-jose/v4 v4.1.4 // indirect
|
github.com/go-jose/go-jose/v4 v4.1.4 // indirect
|
||||||
|
github.com/go-logr/logr v1.4.3 // indirect
|
||||||
|
github.com/go-logr/stdr v1.2.2 // indirect
|
||||||
|
github.com/google/s2a-go v0.1.9 // indirect
|
||||||
|
github.com/googleapis/enterprise-certificate-proxy v0.3.11 // indirect
|
||||||
|
github.com/googleapis/gax-go/v2 v2.17.0 // indirect
|
||||||
github.com/jhump/protoreflect/v2 v2.0.0-beta.1 // indirect
|
github.com/jhump/protoreflect/v2 v2.0.0-beta.1 // indirect
|
||||||
github.com/petermattis/goid v0.0.0-20260113132338-7c7de50cc741 // indirect
|
github.com/petermattis/goid v0.0.0-20260113132338-7c7de50cc741 // indirect
|
||||||
github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 // indirect
|
github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 // indirect
|
||||||
github.com/spiffe/go-spiffe/v2 v2.6.0 // indirect
|
github.com/spiffe/go-spiffe/v2 v2.7.0 // indirect
|
||||||
github.com/stretchr/testify v1.11.1 // indirect
|
go.opentelemetry.io/auto/sdk v1.2.1 // indirect
|
||||||
golang.org/x/net v0.49.0 // indirect
|
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.61.0 // indirect
|
||||||
golang.org/x/oauth2 v0.34.0 // indirect
|
go.opentelemetry.io/otel v1.44.0 // indirect
|
||||||
golang.org/x/sync v0.19.0 // indirect
|
go.opentelemetry.io/otel/metric v1.44.0 // indirect
|
||||||
golang.org/x/sys v0.40.0 // indirect
|
go.opentelemetry.io/otel/trace v1.44.0 // indirect
|
||||||
golang.org/x/text v0.33.0 // indirect
|
golang.org/x/crypto v0.55.0 // indirect
|
||||||
google.golang.org/genproto/googleapis/api v0.0.0-20260120221211-b8f7ae30c516 // indirect
|
golang.org/x/net v0.58.0 // indirect
|
||||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20260120221211-b8f7ae30c516 // indirect
|
golang.org/x/oauth2 v0.36.0 // indirect
|
||||||
|
golang.org/x/sync v0.22.0 // indirect
|
||||||
|
golang.org/x/sys v0.47.0 // indirect
|
||||||
|
golang.org/x/text v0.41.0 // indirect
|
||||||
|
google.golang.org/genproto/googleapis/api v0.0.0-20260526163538-3dc84a4a5aaa // indirect
|
||||||
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20260825221802-da73d73af1c5 // indirect
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,25 +1,30 @@
|
|||||||
cel.dev/expr v0.25.1 h1:1KrZg61W6TWSxuNZ37Xy49ps13NUovb66QLprthtwi4=
|
cel.dev/expr v0.25.2 h1:K6j46C81hXtZQfuX60cVWQFBJahKSE2gfRbNuvr5bFs=
|
||||||
cel.dev/expr v0.25.1/go.mod h1:hrXvqGP6G6gyx8UAHSHJ5RGk//1Oj5nXQ2NI02Nrsg4=
|
cel.dev/expr v0.25.2/go.mod h1:hrXvqGP6G6gyx8UAHSHJ5RGk//1Oj5nXQ2NI02Nrsg4=
|
||||||
|
cloud.google.com/go/auth v0.18.2 h1:+Nbt5Ev0xEqxlNjd6c+yYUeosQ5TtEUaNcN/3FozlaM=
|
||||||
|
cloud.google.com/go/auth v0.18.2/go.mod h1:xD+oY7gcahcu7G2SG2DsBerfFxgPAJz17zz2joOFF3M=
|
||||||
cloud.google.com/go/compute/metadata v0.9.0 h1:pDUj4QMoPejqq20dK0Pg2N4yG9zIkYGdBtwLoEkH9Zs=
|
cloud.google.com/go/compute/metadata v0.9.0 h1:pDUj4QMoPejqq20dK0Pg2N4yG9zIkYGdBtwLoEkH9Zs=
|
||||||
cloud.google.com/go/compute/metadata v0.9.0/go.mod h1:E0bWwX5wTnLPedCKqk3pJmVgCBSM6qQI1yTBdEb3C10=
|
cloud.google.com/go/compute/metadata v0.9.0/go.mod h1:E0bWwX5wTnLPedCKqk3pJmVgCBSM6qQI1yTBdEb3C10=
|
||||||
github.com/bufbuild/protocompile v0.14.1 h1:iA73zAf/fyljNjQKwYzUHD6AD4R8KMasmwa/FBatYVw=
|
github.com/bufbuild/protocompile v0.14.1 h1:iA73zAf/fyljNjQKwYzUHD6AD4R8KMasmwa/FBatYVw=
|
||||||
github.com/bufbuild/protocompile v0.14.1/go.mod h1:ppVdAIhbr2H8asPk6k4pY7t9zB1OU5DoEw9xY/FUi1c=
|
github.com/bufbuild/protocompile v0.14.1/go.mod h1:ppVdAIhbr2H8asPk6k4pY7t9zB1OU5DoEw9xY/FUi1c=
|
||||||
github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
|
github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
|
||||||
github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
||||||
github.com/cncf/xds/go v0.0.0-20251210132809-ee656c7534f5 h1:6xNmx7iTtyBRev0+D/Tv1FZd4SCg8axKApyNyRsAt/w=
|
github.com/cncf/xds/go v0.0.0-20260202195803-dba9d589def2 h1:aBangftG7EVZoUb69Os8IaYg++6uMOdKK83QtkkvJik=
|
||||||
github.com/cncf/xds/go v0.0.0-20251210132809-ee656c7534f5/go.mod h1:KdCmV+x/BuvyMxRnYBlmVaq4OLiKW6iRQfvC62cvdkI=
|
github.com/cncf/xds/go v0.0.0-20260202195803-dba9d589def2/go.mod h1:qwXFYgsP6T7XnJtbKlf1HP8AjxZZyzxMmc+Lq5GjlU4=
|
||||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/envoyproxy/go-control-plane v0.14.0 h1:hbG2kr4RuFj222B6+7T83thSPqLjwBIfQawTkC++2HA=
|
github.com/envoyproxy/go-control-plane v0.14.0 h1:hbG2kr4RuFj222B6+7T83thSPqLjwBIfQawTkC++2HA=
|
||||||
github.com/envoyproxy/go-control-plane v0.14.0/go.mod h1:NcS5X47pLl/hfqxU70yPwL9ZMkUlwlKxtAohpi2wBEU=
|
github.com/envoyproxy/go-control-plane v0.14.0/go.mod h1:NcS5X47pLl/hfqxU70yPwL9ZMkUlwlKxtAohpi2wBEU=
|
||||||
github.com/envoyproxy/go-control-plane/envoy v1.36.0 h1:yg/JjO5E7ubRyKX3m07GF3reDNEnfOboJ0QySbH736g=
|
github.com/envoyproxy/go-control-plane/envoy v1.37.0 h1:u3riX6BoYRfF4Dr7dwSOroNfdSbEPe9Yyl09/B6wBrQ=
|
||||||
github.com/envoyproxy/go-control-plane/envoy v1.36.0/go.mod h1:ty89S1YCCVruQAm9OtKeEkQLTb+Lkz0k8v9W0Oxsv98=
|
github.com/envoyproxy/go-control-plane/envoy v1.37.0/go.mod h1:DReE9MMrmecPy+YvQOAOHNYMALuowAnbjjEMkkWOi6A=
|
||||||
github.com/envoyproxy/go-control-plane/ratelimit v0.1.0 h1:/G9QYbddjL25KvtKTv3an9lx6VBE2cnb8wp1vEGNYGI=
|
github.com/envoyproxy/go-control-plane/ratelimit v0.1.0 h1:/G9QYbddjL25KvtKTv3an9lx6VBE2cnb8wp1vEGNYGI=
|
||||||
github.com/envoyproxy/go-control-plane/ratelimit v0.1.0/go.mod h1:Wk+tMFAFbCXaJPzVVHnPgRKdUdwW/KdbRt94AzgRee4=
|
github.com/envoyproxy/go-control-plane/ratelimit v0.1.0/go.mod h1:Wk+tMFAFbCXaJPzVVHnPgRKdUdwW/KdbRt94AzgRee4=
|
||||||
github.com/envoyproxy/protoc-gen-validate v1.3.0 h1:TvGH1wof4H33rezVKWSpqKz5NXWg5VPuZ0uONDT6eb4=
|
github.com/envoyproxy/protoc-gen-validate v1.3.3 h1:MVQghNeW+LZcmXe7SY1V36Z+WFMDjpqGAGacLe2T0ds=
|
||||||
github.com/envoyproxy/protoc-gen-validate v1.3.0/go.mod h1:HvYl7zwPa5mffgyeTUHA9zHIH36nmrm7oCbo4YKoSWA=
|
github.com/envoyproxy/protoc-gen-validate v1.3.3/go.mod h1:TsndJ/ngyIdQRhMcVVGDDHINPLWB7C82oDArY51KfB0=
|
||||||
|
github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg=
|
||||||
|
github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
|
||||||
github.com/go-jose/go-jose/v4 v4.1.4 h1:moDMcTHmvE6Groj34emNPLs/qtYXRVcd6S7NHbHz3kA=
|
github.com/go-jose/go-jose/v4 v4.1.4 h1:moDMcTHmvE6Groj34emNPLs/qtYXRVcd6S7NHbHz3kA=
|
||||||
github.com/go-jose/go-jose/v4 v4.1.4/go.mod h1:x4oUasVrzR7071A4TnHLGSPpNOm2a21K9Kf04k1rs08=
|
github.com/go-jose/go-jose/v4 v4.1.4/go.mod h1:x4oUasVrzR7071A4TnHLGSPpNOm2a21K9Kf04k1rs08=
|
||||||
|
github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
|
||||||
github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI=
|
github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI=
|
||||||
github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
|
github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
|
||||||
github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
|
github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
|
||||||
@@ -28,10 +33,16 @@ github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek
|
|||||||
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
|
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
|
||||||
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
|
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
|
||||||
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
|
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
|
||||||
|
github.com/google/s2a-go v0.1.9 h1:LGD7gtMgezd8a/Xak7mEWL0PjoTQFvpRudN895yqKW0=
|
||||||
|
github.com/google/s2a-go v0.1.9/go.mod h1:YA0Ei2ZQL3acow2O62kdp9UlnvMmU7kA6Eutn0dXayM=
|
||||||
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
||||||
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||||
github.com/jhump/protoreflect v1.18.0 h1:TOz0MSR/0JOZ5kECB/0ufGnC2jdsgZ123Rd/k4Z5/2w=
|
github.com/googleapis/enterprise-certificate-proxy v0.3.11 h1:vAe81Msw+8tKUxi2Dqh/NZMz7475yUvmRIkXr4oN2ao=
|
||||||
github.com/jhump/protoreflect v1.18.0/go.mod h1:ezWcltJIVF4zYdIFM+D/sHV4Oh5LNU08ORzCGfwvTz8=
|
github.com/googleapis/enterprise-certificate-proxy v0.3.11/go.mod h1:RFV7MUdlb7AgEq2v7FmMCfeSMCllAzWxFgRdusoGks8=
|
||||||
|
github.com/googleapis/gax-go/v2 v2.17.0 h1:RksgfBpxqff0EZkDWYuz9q/uWsTVz+kf43LsZ1J6SMc=
|
||||||
|
github.com/googleapis/gax-go/v2 v2.17.0/go.mod h1:mzaqghpQp4JDh3HvADwrat+6M3MOIDp5YKHhb9PAgDY=
|
||||||
|
github.com/jhump/protoreflect v1.18.1 h1:h4odAaLg9wyn7yHxMF7sSkJ7JfLwK1oy37/1Pi212GE=
|
||||||
|
github.com/jhump/protoreflect v1.18.1/go.mod h1:I2yar2oJEMf0k4EMryPzfV0tvGwN/SejJziYBOpETQo=
|
||||||
github.com/jhump/protoreflect/v2 v2.0.0-beta.1 h1:Dw1rslK/VotaUGYsv53XVWITr+5RCPXfvvlGrM/+B6w=
|
github.com/jhump/protoreflect/v2 v2.0.0-beta.1 h1:Dw1rslK/VotaUGYsv53XVWITr+5RCPXfvvlGrM/+B6w=
|
||||||
github.com/jhump/protoreflect/v2 v2.0.0-beta.1/go.mod h1:D9LBEowZyv8/iSu97FU2zmXG3JxVTmNw21mu63niFzU=
|
github.com/jhump/protoreflect/v2 v2.0.0-beta.1/go.mod h1:D9LBEowZyv8/iSu97FU2zmXG3JxVTmNw21mu63niFzU=
|
||||||
github.com/petermattis/goid v0.0.0-20260113132338-7c7de50cc741 h1:KPpdlQLZcHfTMQRi6bFQ7ogNO0ltFT4PmtwTLW4W+14=
|
github.com/petermattis/goid v0.0.0-20260113132338-7c7de50cc741 h1:KPpdlQLZcHfTMQRi6bFQ7ogNO0ltFT4PmtwTLW4W+14=
|
||||||
@@ -40,41 +51,45 @@ github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 h1:GFCKgm
|
|||||||
github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10/go.mod h1:t/avpk3KcrXxUnYOhZhMXJlSEyie6gQbtLq5NM3loB8=
|
github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10/go.mod h1:t/avpk3KcrXxUnYOhZhMXJlSEyie6gQbtLq5NM3loB8=
|
||||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||||
github.com/spiffe/go-spiffe/v2 v2.6.0 h1:l+DolpxNWYgruGQVV0xsfeya3CsC7m8iBzDnMpsbLuo=
|
github.com/spiffe/go-spiffe/v2 v2.7.0 h1:uXe1MflJoHw58wAUvxVlcM7WpKtijWG7I1UidcGh6g4=
|
||||||
github.com/spiffe/go-spiffe/v2 v2.6.0/go.mod h1:gm2SeUoMZEtpnzPNs2Csc0D/gX33k1xIx7lEzqblHEs=
|
github.com/spiffe/go-spiffe/v2 v2.7.0/go.mod h1:47Q0Q9/AqGha8QLHp+kxpH4Wca7X7EnOtlIJy3mxZ3U=
|
||||||
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
|
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
|
||||||
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
|
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
|
||||||
go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64=
|
go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64=
|
||||||
go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y=
|
go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y=
|
||||||
go.opentelemetry.io/otel v1.39.0 h1:8yPrr/S0ND9QEfTfdP9V+SiwT4E0G7Y5MO7p85nis48=
|
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.61.0 h1:F7Jx+6hwnZ41NSFTO5q4LYDtJRXBf2PD0rNBkeB/lus=
|
||||||
go.opentelemetry.io/otel v1.39.0/go.mod h1:kLlFTywNWrFyEdH0oj2xK0bFYZtHRYUdv1NklR/tgc8=
|
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.61.0/go.mod h1:UHB22Z8QsdRDrnAtX4PntOl36ajSxcdUMt1sF7Y6E7Q=
|
||||||
go.opentelemetry.io/otel/metric v1.39.0 h1:d1UzonvEZriVfpNKEVmHXbdf909uGTOQjA0HF0Ls5Q0=
|
go.opentelemetry.io/otel v1.44.0 h1:JjwHmHpA4iZ3wBxluu2fbbE7j4kqlE8jXyAyPXH7HqU=
|
||||||
go.opentelemetry.io/otel/metric v1.39.0/go.mod h1:jrZSWL33sD7bBxg1xjrqyDjnuzTUB0x1nBERXd7Ftcs=
|
go.opentelemetry.io/otel v1.44.0/go.mod h1:BMgjTHL9WPRlRjL2oZCBTL4whCGtXch2H4BhOPIAyYc=
|
||||||
go.opentelemetry.io/otel/sdk v1.39.0 h1:nMLYcjVsvdui1B/4FRkwjzoRVsMK8uL/cj0OyhKzt18=
|
go.opentelemetry.io/otel/metric v1.44.0 h1:1w0gILTcHdr3YI+ixLyjemwrVnsMURbTZFrSYCdDdmc=
|
||||||
go.opentelemetry.io/otel/sdk v1.39.0/go.mod h1:vDojkC4/jsTJsE+kh+LXYQlbL8CgrEcwmt1ENZszdJE=
|
go.opentelemetry.io/otel/metric v1.44.0/go.mod h1:8O7hanEPBNgEMmybD3s2VBKcgWOCsA6tzHBPODAiquo=
|
||||||
go.opentelemetry.io/otel/sdk/metric v1.39.0 h1:cXMVVFVgsIf2YL6QkRF4Urbr/aMInf+2WKg+sEJTtB8=
|
go.opentelemetry.io/otel/sdk v1.44.0 h1:nHYwb9lK+fJPU/dnT6s7W7Z8itMWyqrnVfbheVYrZ58=
|
||||||
go.opentelemetry.io/otel/sdk/metric v1.39.0/go.mod h1:xq9HEVH7qeX69/JnwEfp6fVq5wosJsY1mt4lLfYdVew=
|
go.opentelemetry.io/otel/sdk v1.44.0/go.mod h1:Osuydd3Se74nqjAKxid74N5eC+jfEqfTegHRnq58oK0=
|
||||||
go.opentelemetry.io/otel/trace v1.39.0 h1:2d2vfpEDmCJ5zVYz7ijaJdOF59xLomrvj7bjt6/qCJI=
|
go.opentelemetry.io/otel/sdk/metric v1.44.0 h1:3LlKgI+VjbVsjNRFZJZAJ30WjXC5VkNRks6si09iEfI=
|
||||||
go.opentelemetry.io/otel/trace v1.39.0/go.mod h1:88w4/PnZSazkGzz/w84VHpQafiU4EtqqlVdxWy+rNOA=
|
go.opentelemetry.io/otel/sdk/metric v1.44.0/go.mod h1:5B5pMARnXxKhltooO4xUuCBorl65a4EpnTalObqOigA=
|
||||||
golang.org/x/net v0.49.0 h1:eeHFmOGUTtaaPSGNmjBKpbng9MulQsJURQUAfUwY++o=
|
go.opentelemetry.io/otel/trace v1.44.0 h1:jxF5CsGYCe74MCRx2X4g7WsY/VBKRqqpNvXlX/6gtIk=
|
||||||
golang.org/x/net v0.49.0/go.mod h1:/ysNB2EvaqvesRkuLAyjI1ycPZlQHM3q01F02UY/MV8=
|
go.opentelemetry.io/otel/trace v1.44.0/go.mod h1:oLl1jrMQAVo6v3GAggN+1VH9VIz9iUSvW53sW1Q8PIE=
|
||||||
golang.org/x/oauth2 v0.34.0 h1:hqK/t4AKgbqWkdkcAeI8XLmbK+4m4G5YeQRrmiotGlw=
|
golang.org/x/crypto v0.55.0 h1:+KWHjbgOaAQ66dh/YlkZKHlz9ZUlq61AFirAR9ntP8M=
|
||||||
golang.org/x/oauth2 v0.34.0/go.mod h1:lzm5WQJQwKZ3nwavOZ3IS5Aulzxi68dUSgRHujetwEA=
|
golang.org/x/crypto v0.55.0/go.mod h1:uq0V9dE/fzQuJtbnL+2EhWOE63vo164FY8xqEnV9xis=
|
||||||
golang.org/x/sync v0.19.0 h1:vV+1eWNmZ5geRlYjzm2adRgW2/mcpevXNg50YZtPCE4=
|
golang.org/x/net v0.58.0 h1:ynWG7rqYi4ccpTEuPZ2QGWHktVEM9DMCj9yzDE0Q7To=
|
||||||
golang.org/x/sync v0.19.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI=
|
golang.org/x/net v0.58.0/go.mod h1:YwCddHnFlT7eLQqVprV19OnhLGtc5xOKgE0RyqgfWAU=
|
||||||
golang.org/x/sys v0.40.0 h1:DBZZqJ2Rkml6QMQsZywtnjnnGvHza6BTfYFWY9kjEWQ=
|
golang.org/x/oauth2 v0.36.0 h1:peZ/1z27fi9hUOFCAZaHyrpWG5lwe0RJEEEeH0ThlIs=
|
||||||
golang.org/x/sys v0.40.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
|
golang.org/x/oauth2 v0.36.0/go.mod h1:YDBUJMTkDnJS+A4BP4eZBjCqtokkg1hODuPjwiGPO7Q=
|
||||||
golang.org/x/text v0.33.0 h1:B3njUFyqtHDUI5jMn1YIr5B0IE2U0qck04r6d4KPAxE=
|
golang.org/x/sync v0.22.0 h1:SZjpbeLmrCk4xhRSZFNZW5gFUeCeFgjekvI/+gfScek=
|
||||||
golang.org/x/text v0.33.0/go.mod h1:LuMebE6+rBincTi9+xWTY8TztLzKHc/9C1uBCG27+q8=
|
golang.org/x/sync v0.22.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0=
|
||||||
|
golang.org/x/sys v0.47.0 h1:o7XGOvZQCADBQQ4Y7VNq2dRWQR7JmOUW8Kxx4ZsNgWs=
|
||||||
|
golang.org/x/sys v0.47.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw=
|
||||||
|
golang.org/x/text v0.41.0 h1:vz/seA0lnX87Othu2f/0L24RcgrXD9/YFTSuGjj3rH8=
|
||||||
|
golang.org/x/text v0.41.0/go.mod h1:jvf1O8ajNzZqhSrQBPbutR/EB83Cc0CFrezNQIwbb5M=
|
||||||
gonum.org/v1/gonum v0.17.0 h1:VbpOemQlsSMrYmn7T2OUvQ4dqxQXU+ouZFQsZOx50z4=
|
gonum.org/v1/gonum v0.17.0 h1:VbpOemQlsSMrYmn7T2OUvQ4dqxQXU+ouZFQsZOx50z4=
|
||||||
gonum.org/v1/gonum v0.17.0/go.mod h1:El3tOrEuMpv2UdMrbNlKEh9vd86bmQ6vqIcDwxEOc1E=
|
gonum.org/v1/gonum v0.17.0/go.mod h1:El3tOrEuMpv2UdMrbNlKEh9vd86bmQ6vqIcDwxEOc1E=
|
||||||
google.golang.org/genproto/googleapis/api v0.0.0-20260120221211-b8f7ae30c516 h1:vmC/ws+pLzWjj/gzApyoZuSVrDtF1aod4u/+bbj8hgM=
|
google.golang.org/genproto/googleapis/api v0.0.0-20260526163538-3dc84a4a5aaa h1:Kjn0N0tCrDgiAFW+lGO4JZ3ck44CehvJQMAwj9QF0G8=
|
||||||
google.golang.org/genproto/googleapis/api v0.0.0-20260120221211-b8f7ae30c516/go.mod h1:p3MLuOwURrGBRoEyFHBT3GjUwaCQVKeNqqWxlcISGdw=
|
google.golang.org/genproto/googleapis/api v0.0.0-20260526163538-3dc84a4a5aaa/go.mod h1:q4lMZS6kskjT5HvCPrnnypcDPVJqT/f4nfxmkE7gryY=
|
||||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20260120221211-b8f7ae30c516 h1:sNrWoksmOyF5bvJUcnmbeAmQi8baNhqg5IWaI3llQqU=
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20260825221802-da73d73af1c5 h1:1VUiZAXyC+zmiFYi+WLtBzr68Cj8wOofHjjrA/kkizc=
|
||||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20260120221211-b8f7ae30c516/go.mod h1:j9x/tPzZkyxcgEFkiKEEGxfvyumM01BEtsW8xzOahRQ=
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20260825221802-da73d73af1c5/go.mod h1:DjtHYE8FKJLivXcBEjGwndXfIC23G0VpXiXKqG179uA=
|
||||||
google.golang.org/grpc v1.80.0 h1:Xr6m2WmWZLETvUNvIUmeD5OAagMw3FiKmMlTdViWsHM=
|
google.golang.org/grpc v1.83.2 h1:EManeRomTObA0BU7I8vXgg/78uE5MJ9M8B39EX2WscU=
|
||||||
google.golang.org/grpc v1.80.0/go.mod h1:ho/dLnxwi3EDJA4Zghp7k2Ec1+c2jqup0bFkw07bwF4=
|
google.golang.org/grpc v1.83.2/go.mod h1:YPI1hK3kDked6iHvgX3tR0y+nX/qpMFKhPgFsokw1S8=
|
||||||
google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE=
|
google.golang.org/protobuf v1.36.12 h1:pJOKDDOyeXErUroCihFAd5LQuwXBSpVnKGrj5o/fwxc=
|
||||||
google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco=
|
google.golang.org/protobuf v1.36.12/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco=
|
||||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
|
|||||||
+78
-10
@@ -20,11 +20,13 @@ import (
|
|||||||
"slices"
|
"slices"
|
||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
|
"sync"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/golang/protobuf/proto" //lint:ignore SA1019 we have to import these because some of their types appear in exported API
|
"github.com/golang/protobuf/proto"
|
||||||
"github.com/jhump/protoreflect/desc" //lint:ignore SA1019 same as above
|
"github.com/jhump/protoreflect/desc"
|
||||||
"github.com/jhump/protoreflect/desc/protoprint"
|
"github.com/jhump/protoreflect/desc/protoprint"
|
||||||
"github.com/jhump/protoreflect/dynamic" //lint:ignore SA1019 same as above
|
"github.com/jhump/protoreflect/dynamic"
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
"google.golang.org/grpc/connectivity"
|
"google.golang.org/grpc/connectivity"
|
||||||
"google.golang.org/grpc/credentials"
|
"google.golang.org/grpc/credentials"
|
||||||
@@ -568,9 +570,6 @@ func ClientTLSConfig(insecureSkipVerify bool, cacertFile, clientCertFile, client
|
|||||||
// client certs. The serverCertFile and serverKeyFile must both not be blank.
|
// client certs. The serverCertFile and serverKeyFile must both not be blank.
|
||||||
func ServerTransportCredentials(cacertFile, serverCertFile, serverKeyFile string, requireClientCerts bool) (credentials.TransportCredentials, error) {
|
func ServerTransportCredentials(cacertFile, serverCertFile, serverKeyFile string, requireClientCerts bool) (credentials.TransportCredentials, error) {
|
||||||
var tlsConf tls.Config
|
var tlsConf tls.Config
|
||||||
// TODO(jh): Remove this line once https://github.com/golang/go/issues/28779 is fixed
|
|
||||||
// in Go tip. Until then, the recently merged TLS 1.3 support breaks the TLS tests.
|
|
||||||
tlsConf.MaxVersion = tls.VersionTLS12
|
|
||||||
|
|
||||||
// Load the server certificates from disk
|
// Load the server certificates from disk
|
||||||
certificate, err := tls.LoadX509KeyPair(serverCertFile, serverKeyFile)
|
certificate, err := tls.LoadX509KeyPair(serverCertFile, serverKeyFile)
|
||||||
@@ -617,8 +616,8 @@ func BlockingDial(ctx context.Context, network, address string, creds credential
|
|||||||
}
|
}
|
||||||
|
|
||||||
var err error
|
var err error
|
||||||
if strings.HasPrefix(address, "xds:///") {
|
if strings.HasPrefix(address, "xds://") {
|
||||||
// The xds:/// prefix is used to signal to the gRPC client to use an xDS server to resolve the
|
// The xds:// prefix is used to signal to the gRPC client to use an xDS server to resolve the
|
||||||
// target. The relevant credentials will be automatically pulled from the GRPC_XDS_BOOTSTRAP or
|
// target. The relevant credentials will be automatically pulled from the GRPC_XDS_BOOTSTRAP or
|
||||||
// GRPC_XDS_BOOTSTRAP_CONFIG env vars.
|
// GRPC_XDS_BOOTSTRAP_CONFIG env vars.
|
||||||
creds, err = xdsCredentials.NewClientCredentials(xdsCredentials.ClientOptions{FallbackCreds: creds})
|
creds, err = xdsCredentials.NewClientCredentials(xdsCredentials.ClientOptions{FallbackCreds: creds})
|
||||||
@@ -632,7 +631,16 @@ func BlockingDial(ctx context.Context, network, address string, creds credential
|
|||||||
// custom dialer that can provide that info. That means we manage the TLS handshake.
|
// custom dialer that can provide that info. That means we manage the TLS handshake.
|
||||||
result := make(chan interface{}, 1)
|
result := make(chan interface{}, 1)
|
||||||
|
|
||||||
|
// dialCompleted is closed once the outcome of the dial (ready connection
|
||||||
|
// or error) is known, so that connection teardown no longer needs to wait
|
||||||
|
// for a pending TLS alert to be read.
|
||||||
|
dialCompleted := make(chan struct{})
|
||||||
|
var dialCompletedOnce sync.Once
|
||||||
|
completeDial := func() { dialCompletedOnce.Do(func() { close(dialCompleted) }) }
|
||||||
|
defer completeDial()
|
||||||
|
|
||||||
writeResult := func(res interface{}) {
|
writeResult := func(res interface{}) {
|
||||||
|
completeDial()
|
||||||
// non-blocking write: we only need the first result
|
// non-blocking write: we only need the first result
|
||||||
select {
|
select {
|
||||||
case result <- res:
|
case result <- res:
|
||||||
@@ -645,6 +653,7 @@ func BlockingDial(ctx context.Context, network, address string, creds credential
|
|||||||
creds = &errSignalingCreds{
|
creds = &errSignalingCreds{
|
||||||
TransportCredentials: creds,
|
TransportCredentials: creds,
|
||||||
writeResult: writeResult,
|
writeResult: writeResult,
|
||||||
|
dialCompleted: dialCompleted,
|
||||||
}
|
}
|
||||||
|
|
||||||
switch network {
|
switch network {
|
||||||
@@ -727,13 +736,72 @@ func BlockingDial(ctx context.Context, network, address string, creds credential
|
|||||||
// it will use the writeResult function to notify on error.
|
// it will use the writeResult function to notify on error.
|
||||||
type errSignalingCreds struct {
|
type errSignalingCreds struct {
|
||||||
credentials.TransportCredentials
|
credentials.TransportCredentials
|
||||||
writeResult func(res interface{})
|
writeResult func(res interface{})
|
||||||
|
dialCompleted <-chan struct{}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *errSignalingCreds) ClientHandshake(ctx context.Context, addr string, rawConn net.Conn) (net.Conn, credentials.AuthInfo, error) {
|
func (c *errSignalingCreds) ClientHandshake(ctx context.Context, addr string, rawConn net.Conn) (net.Conn, credentials.AuthInfo, error) {
|
||||||
conn, auth, err := c.TransportCredentials.ClientHandshake(ctx, addr, rawConn)
|
conn, auth, err := c.TransportCredentials.ClientHandshake(ctx, addr, rawConn)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.writeResult(err)
|
c.writeResult(err)
|
||||||
|
return conn, auth, err
|
||||||
}
|
}
|
||||||
return conn, auth, err
|
// Wrap the connection to capture post-handshake errors, e.g.:
|
||||||
|
// - TLS 1.3 client cert rejection (server sends alert after handshake)
|
||||||
|
// - Plaintext client to TLS server (server closes conn immediately)
|
||||||
|
return &errSignalingConn{Conn: conn, writeResult: c.writeResult, dialCompleted: c.dialCompleted}, auth, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// maxTLSAlertWait is an upper bound on how long a failing dial's connection
|
||||||
|
// teardown waits for a pending TLS alert to be read. It is a heuristic: long
|
||||||
|
// enough for the reader goroutine to be scheduled even on a loaded machine,
|
||||||
|
// short enough to not noticeably delay a failing dial.
|
||||||
|
const maxTLSAlertWait = 50 * time.Millisecond
|
||||||
|
|
||||||
|
// errSignalingConn wraps a net.Conn to capture read errors and report
|
||||||
|
// them via writeResult. Close is delayed until the dial has completed to
|
||||||
|
// give the reader a chance to read a pending TLS alert before the
|
||||||
|
// connection is closed.
|
||||||
|
type errSignalingConn struct {
|
||||||
|
net.Conn
|
||||||
|
writeResult func(res interface{})
|
||||||
|
dialCompleted <-chan struct{}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *errSignalingConn) Read(b []byte) (int, error) {
|
||||||
|
n, err := c.Conn.Read(b)
|
||||||
|
if err != nil {
|
||||||
|
c.writeResult(err)
|
||||||
|
}
|
||||||
|
return n, err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *errSignalingConn) Close() error {
|
||||||
|
// With TLS 1.3, the server may reject the connection *after* the
|
||||||
|
// handshake completes (e.g. a missing client cert), by sending an alert.
|
||||||
|
// If the transport closes the connection before that alert is read, the
|
||||||
|
// caller sees a less useful error (e.g. "use of closed network
|
||||||
|
// connection") instead of the TLS alert. So while the outcome of the
|
||||||
|
// dial is still undecided, give the reader a brief window to read a
|
||||||
|
// pending alert before closing the connection.
|
||||||
|
select {
|
||||||
|
case <-c.dialCompleted:
|
||||||
|
case <-time.After(maxTLSAlertWait):
|
||||||
|
}
|
||||||
|
return c.Conn.Close()
|
||||||
|
}
|
||||||
|
|
||||||
|
// UsesXDS forwards the optional UsesXDS marker of the wrapped credentials. The
|
||||||
|
// xDS credentials returned for "xds://" targets implement this method, and
|
||||||
|
// grpc-go's cds balancer relies on a type assertion for it to decide whether to
|
||||||
|
// apply the security configuration (e.g. UpstreamTlsContext) delivered by the
|
||||||
|
// management server. Because errSignalingCreds embeds the TransportCredentials
|
||||||
|
// interface, that extra method is not promoted automatically, so we forward it
|
||||||
|
// explicitly. Without this, xDS-supplied mTLS is silently ignored and the
|
||||||
|
// connection falls back to the plain credentials.
|
||||||
|
func (c *errSignalingCreds) UsesXDS() bool {
|
||||||
|
if x, ok := c.TransportCredentials.(interface{ UsesXDS() bool }); ok {
|
||||||
|
return x.UsesXDS()
|
||||||
|
}
|
||||||
|
return false
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-3
@@ -12,9 +12,9 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/golang/protobuf/jsonpb" //lint:ignore SA1019 we have to import these because some of their types appear in exported API
|
"github.com/golang/protobuf/jsonpb"
|
||||||
"github.com/golang/protobuf/proto" //lint:ignore SA1019 same as above
|
"github.com/golang/protobuf/proto"
|
||||||
"github.com/jhump/protoreflect/desc" //lint:ignore SA1019 same as above
|
"github.com/jhump/protoreflect/desc"
|
||||||
"github.com/jhump/protoreflect/grpcreflect"
|
"github.com/jhump/protoreflect/grpcreflect"
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
"google.golang.org/grpc/codes"
|
"google.golang.org/grpc/codes"
|
||||||
|
|||||||
@@ -9,10 +9,10 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
|
|
||||||
"github.com/golang/protobuf/jsonpb" //lint:ignore SA1019 we have to import these because some of their types appear in exported API
|
"github.com/golang/protobuf/jsonpb"
|
||||||
"github.com/golang/protobuf/proto" //lint:ignore SA1019 same as above
|
"github.com/golang/protobuf/proto"
|
||||||
"github.com/jhump/protoreflect/desc" //lint:ignore SA1019 same as above
|
"github.com/jhump/protoreflect/desc"
|
||||||
"github.com/jhump/protoreflect/dynamic" //lint:ignore SA1019 same as above
|
"github.com/jhump/protoreflect/dynamic"
|
||||||
"github.com/jhump/protoreflect/dynamic/grpcdynamic"
|
"github.com/jhump/protoreflect/dynamic/grpcdynamic"
|
||||||
"github.com/jhump/protoreflect/grpcreflect"
|
"github.com/jhump/protoreflect/grpcreflect"
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
@@ -106,7 +106,7 @@ func InvokeRPC(ctx context.Context, source DescriptorSource, ch grpcdynamic.Chan
|
|||||||
case isNotFoundError(err):
|
case isNotFoundError(err):
|
||||||
return fmt.Errorf("target server does not expose service %q", svc)
|
return fmt.Errorf("target server does not expose service %q", svc)
|
||||||
}
|
}
|
||||||
return fmt.Errorf("failed to query for service descriptor %q: %v", svc, err)
|
return fmt.Errorf("failed to query for service descriptor %q: %w", svc, err)
|
||||||
}
|
}
|
||||||
sd, ok := dsc.(*desc.ServiceDescriptor)
|
sd, ok := dsc.(*desc.ServiceDescriptor)
|
||||||
if !ok {
|
if !ok {
|
||||||
@@ -155,7 +155,7 @@ func invokeUnary(ctx context.Context, stub grpcdynamic.Stub, md *desc.MethodDesc
|
|||||||
|
|
||||||
err := requestData(req)
|
err := requestData(req)
|
||||||
if err != nil && err != io.EOF {
|
if err != nil && err != io.EOF {
|
||||||
return fmt.Errorf("error getting request data: %v", err)
|
return fmt.Errorf("error getting request data: %w", err)
|
||||||
}
|
}
|
||||||
if err != io.EOF {
|
if err != io.EOF {
|
||||||
// verify there is no second message, which is a usage error
|
// verify there is no second message, which is a usage error
|
||||||
@@ -163,7 +163,7 @@ func invokeUnary(ctx context.Context, stub grpcdynamic.Stub, md *desc.MethodDesc
|
|||||||
if err == nil {
|
if err == nil {
|
||||||
return fmt.Errorf("method %q is a unary RPC, but request data contained more than 1 message", md.GetFullyQualifiedName())
|
return fmt.Errorf("method %q is a unary RPC, but request data contained more than 1 message", md.GetFullyQualifiedName())
|
||||||
} else if err != io.EOF {
|
} else if err != io.EOF {
|
||||||
return fmt.Errorf("error getting request data: %v", err)
|
return fmt.Errorf("error getting request data: %w", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -205,7 +205,7 @@ func invokeClientStream(ctx context.Context, stub grpcdynamic.Stub, md *desc.Met
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("error getting request data: %v", err)
|
return fmt.Errorf("error getting request data: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
err = str.SendMsg(req)
|
err = str.SendMsg(req)
|
||||||
@@ -249,7 +249,7 @@ func invokeServerStream(ctx context.Context, stub grpcdynamic.Stub, md *desc.Met
|
|||||||
|
|
||||||
err := requestData(req)
|
err := requestData(req)
|
||||||
if err != nil && err != io.EOF {
|
if err != nil && err != io.EOF {
|
||||||
return fmt.Errorf("error getting request data: %v", err)
|
return fmt.Errorf("error getting request data: %w", err)
|
||||||
}
|
}
|
||||||
if err != io.EOF {
|
if err != io.EOF {
|
||||||
// verify there is no second message, which is a usage error
|
// verify there is no second message, which is a usage error
|
||||||
@@ -257,7 +257,7 @@ func invokeServerStream(ctx context.Context, stub grpcdynamic.Stub, md *desc.Met
|
|||||||
if err == nil {
|
if err == nil {
|
||||||
return fmt.Errorf("method %q is a server-streaming RPC, but request data contained more than 1 message", md.GetFullyQualifiedName())
|
return fmt.Errorf("method %q is a server-streaming RPC, but request data contained more than 1 message", md.GetFullyQualifiedName())
|
||||||
} else if err != io.EOF {
|
} else if err != io.EOF {
|
||||||
return fmt.Errorf("error getting request data: %v", err)
|
return fmt.Errorf("error getting request data: %w", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -326,7 +326,7 @@ func invokeBidi(ctx context.Context, stub grpcdynamic.Stub, md *desc.MethodDescr
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err = fmt.Errorf("error getting request data: %v", err)
|
err = fmt.Errorf("error getting request data: %w", err)
|
||||||
cancel()
|
cancel()
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|||||||
+14
-60
@@ -7,73 +7,27 @@ The release process consists of a handful of tasks:
|
|||||||
2. Build binaries for various platforms. This is done using the local `go` tool and uses `GOOS` and `GOARCH` environment variables to cross-compile for supported platforms.
|
2. Build binaries for various platforms. This is done using the local `go` tool and uses `GOOS` and `GOARCH` environment variables to cross-compile for supported platforms.
|
||||||
3. Creates a release in GitHub, uploads the binaries, and creates provisional release notes (in the form of a change log).
|
3. Creates a release in GitHub, uploads the binaries, and creates provisional release notes (in the form of a change log).
|
||||||
4. Build a docker image for the new release.
|
4. Build a docker image for the new release.
|
||||||
5. Push the docker image to Docker Hub, with both a version tag and the "latest" tag.
|
5. Push the docker image to `ghcr.io`, with both a version tag and the "latest" tag.
|
||||||
6. Submits a PR to update the [Homebrew](https://brew.sh/) recipe with the latest version.
|
|
||||||
|
|
||||||
Most of this is automated via a script in this same directory. The main thing you will need is a GitHub personal access token, which will be used for creating the release in GitHub (so you need write access to the fullstorydev/grpcurl repo) and to open a Homebrew pull request.
|
Most of this is automated via a script in this same directory. The main thing you will need is a GitHub personal access token, which will be used for creating the release in GitHub (so you need write access to the fullstorydev/grpcurl repo) and to open a Homebrew pull request.
|
||||||
|
|
||||||
## Creating a new release
|
## Creating a new release
|
||||||
|
|
||||||
So, to actually create a new release, just run the script in this directory.
|
Go to the [Release workflow](https://github.com/fullstorydev/grpcurl/actions/workflows/release.yml), click **Run workflow**, and provide:
|
||||||
|
|
||||||
First, you need a version number for the new release, following sem-ver format: `v<Major>.<Minor>.<Patch>`. Second, you need a personal access token for GitHub.
|
* **Branch**: the branch or commit to release from (usually `master`).
|
||||||
|
* **version**: the version number for the new release, in sem-ver format: `v<Major>.<Minor>.<Patch>`, e.g. `v2.3.4`.
|
||||||
|
* **dry_run**: check this to build everything but publish nothing. Useful for validating a change to the release tooling. The binaries are attached to the workflow run as an artifact.
|
||||||
|
|
||||||
We'll use `v2.3.4` as an example version and `abcdef0123456789abcdef` as an example GitHub token:
|
The workflow then:
|
||||||
|
1. Verifies the version is well-formed and that the tag does not already exist.
|
||||||
|
2. Runs the tests.
|
||||||
|
3. Creates and pushes the release tag.
|
||||||
|
4. Cross-compiles binaries for all supported platforms, creates the GitHub release with generated release notes, and uploads the archives. (This is goreleaser, driven by `.goreleaser.yml`.)
|
||||||
|
5. Builds a multi-arch (`linux/amd64`, `linux/arm64`) Docker image and pushes it to `ghcr.io`, tagged with both the version and `latest`.
|
||||||
|
|
||||||
```sh
|
## Release notes
|
||||||
# from the root of the repo
|
|
||||||
GITHUB_TOKEN=abcdef0123456789abcd \
|
|
||||||
./releasing/do-release.sh v2.3.4
|
|
||||||
```
|
|
||||||
|
|
||||||
Wasn't that easy! There is one last step: update the release notes in GitHub. By default, the script just records a change log of commit descriptions. Use that log (and, if necessary, drill into individual PRs included in the release) to flesh out notes in the format of the `RELEASE_NOTES.md` file _in this directory_. Then login to GitHub, go to the new release, edit the notes, and paste in the markdown you just wrote.
|
Release notes are generated, never hand-written. `changelog.use: github-native` in `.goreleaser.yml` hands the job to GitHub's own release-notes generator, which lists every PR merged since the previous tag with its title, link, and author, and credits new contributors.
|
||||||
|
|
||||||
That should be all there is to it! If things go wrong and you have to re-do part of the process, see the sections below.
|
`.github/release.yml` controls how those PRs are grouped. Labels are optional — an unlabeled PR lands in a catch-all "Changes" section — so this needs no ongoing upkeep. Two things make the notes read better, if you want them:
|
||||||
|
|
||||||
----
|
|
||||||
|
|
||||||
### GitHub Releases
|
|
||||||
The GitHub release is the first step performed by the `do-release.sh` script. So generally, if there is an issue with that step, you can re-try the whole script.
|
|
||||||
|
|
||||||
Note, if running the script did something wrong, you may have to first login to GitHub and remove uploaded artifacts for a botched release attempt. In general, this is _very undesirable_. Releases should usually be considered immutable. Instead of removing uploaded assets and providing new ones, it is often better to remove uploaded assets (to make bad binaries no longer available) and then _release a new patch version_. (You can edit the release notes for the botched version explaining why there are no artifacts for it.)
|
|
||||||
|
|
||||||
The steps to do a GitHub-only release (vs. running the entire script) are the following:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
# from the root of the repo
|
|
||||||
git tag v2.3.4
|
|
||||||
GITHUB_TOKEN=abcdef0123456789abcdef \
|
|
||||||
GO111MODULE=on \
|
|
||||||
make release
|
|
||||||
```
|
|
||||||
|
|
||||||
The `git tag ...` step is necessary because the release target requires that the current SHA have a sem-ver tag. That's the version it will use when creating the release.
|
|
||||||
|
|
||||||
This will create the release in GitHub with provisional release notes that just include a change log of commit messages. You still need to login to GitHub and revise those notes to adhere to the recommended format. (See `RELEASE_NOTES.md` in this directory.)
|
|
||||||
|
|
||||||
### Docker Hub Releases
|
|
||||||
|
|
||||||
To re-run only the Docker Hub release steps, you can manually run through each step in the "Docker" section of `do_release.sh`.
|
|
||||||
|
|
||||||
If the `docker push ...` steps fail, you may need to run `docker login`, enter your Docker Hub login credentials, and then try to push again.
|
|
||||||
|
|
||||||
### Homebrew Releases
|
|
||||||
|
|
||||||
The last step is to update the Homebrew recipe to use the latest version. First, we need to compute the SHA256 checksum for the source archive:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
# download the source archive from GitHub
|
|
||||||
URL=https://github.com/fullstorydev/grpcurl/archive/refs/tags/v2.3.4.tar.gz
|
|
||||||
curl -L -o tmp.tgz $URL
|
|
||||||
# and compute the SHA
|
|
||||||
SHA="$(sha256sum < tmp.tgz | awk '{ print $1 }')"
|
|
||||||
```
|
|
||||||
|
|
||||||
To actually create the brew PR, you need your GitHub personal access token again, as well as the URL and SHA from the previous step:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
HOMEBREW_GITHUB_API_TOKEN=abcdef0123456789abcdef \
|
|
||||||
brew bump-formula-pr --url $URL --sha256 $SHA grpcurl
|
|
||||||
```
|
|
||||||
|
|
||||||
This creates a PR to bump the formula to the new version. When this PR is merged by brew maintainers, the new version becomes available!
|
|
||||||
|
|||||||
@@ -1,11 +0,0 @@
|
|||||||
## Changes
|
|
||||||
|
|
||||||
### Command-line tool
|
|
||||||
|
|
||||||
* _In this list, describe the changes to the command-line tool._
|
|
||||||
* _Use one bullet per change. Include both bug-fixes and improvements. Omit this section if there are no changes that impact the command-line tool._
|
|
||||||
|
|
||||||
### Go package "github.com/fullstorydev/grpcurl"
|
|
||||||
|
|
||||||
* _In this list, describe the changes to exported API in the main package in this repo: "github.com/fullstorydev/grpcurl". These will often be closely related to changes to the command-line tool, though not always: changes that only impact the cmd/grpcurl directory of this repo do not impact exported API._
|
|
||||||
* _Use one bullet per change. Include both bug-fixes and improvements. Omit this section if there are no changes that impact the exported API._
|
|
||||||
+9
-11
@@ -37,8 +37,9 @@ $PREFIX git checkout go.mod go.sum
|
|||||||
|
|
||||||
# make sure credentials are valid for later push steps; this might
|
# make sure credentials are valid for later push steps; this might
|
||||||
# be interactive since this will prompt for username and password
|
# be interactive since this will prompt for username and password
|
||||||
# if there are no valid current credentials.
|
# if there are no valid current credentials. Use a GitHub personal access
|
||||||
$PREFIX docker login
|
# token with the write:packages scope as the password.
|
||||||
|
$PREFIX docker login ghcr.io
|
||||||
echo "$VERSION" > VERSION
|
echo "$VERSION" > VERSION
|
||||||
|
|
||||||
# Docker Buildx support is included in Docker 19.03
|
# Docker Buildx support is included in Docker 19.03
|
||||||
@@ -48,15 +49,12 @@ $PREFIX docker run --privileged --rm tonistiigi/binfmt:qemu-v6.1.0 --install all
|
|||||||
# Create a new builder instance
|
# Create a new builder instance
|
||||||
export DOCKER_CLI_EXPERIMENTAL=enabled
|
export DOCKER_CLI_EXPERIMENTAL=enabled
|
||||||
$PREFIX docker buildx create --use --name multiarch-builder --node multiarch-builder0
|
$PREFIX docker buildx create --use --name multiarch-builder --node multiarch-builder0
|
||||||
# push to docker hub, both the given version as a tag and for "latest" tag
|
# push to GHCR, both the given version as a tag and for "latest" tag
|
||||||
$PREFIX docker buildx build --platform linux/amd64,linux/s390x,linux/arm64,linux/ppc64le --tag fullstorydev/grpcurl:${VERSION} --tag fullstorydev/grpcurl:latest --push --progress plain --no-cache .
|
$PREFIX docker buildx build --platform linux/amd64,linux/s390x,linux/arm64,linux/ppc64le --tag ghcr.io/fullstorydev/grpcurl:${VERSION} --tag ghcr.io/fullstorydev/grpcurl:latest --push --progress plain --no-cache .
|
||||||
$PREFIX docker buildx build --platform linux/amd64,linux/s390x,linux/arm64,linux/ppc64le --tag fullstorydev/grpcurl:${VERSION}-alpine --tag fullstorydev/grpcurl:latest-alpine --push --progress plain --no-cache --target alpine .
|
$PREFIX docker buildx build --platform linux/amd64,linux/s390x,linux/arm64,linux/ppc64le --tag ghcr.io/fullstorydev/grpcurl:${VERSION}-alpine --tag ghcr.io/fullstorydev/grpcurl:latest-alpine --push --progress plain --no-cache --target alpine .
|
||||||
rm VERSION
|
rm VERSION
|
||||||
|
|
||||||
# Homebrew release
|
# Homebrew release
|
||||||
|
#
|
||||||
URL="https://github.com/fullstorydev/grpcurl/archive/refs/tags/${VERSION}.tar.gz"
|
# Nothing to do. Homebrew's tooling polls for new releases and opens the
|
||||||
curl -L -o tmp.tgz "$URL"
|
# homebrew-core bump PR on its own. See releasing/README.md.
|
||||||
SHA="$(sha256sum < tmp.tgz | awk '{ print $1 }')"
|
|
||||||
rm tmp.tgz
|
|
||||||
HOMEBREW_GITHUB_API_TOKEN="$GITHUB_TOKEN" $PREFIX brew bump-formula-pr --url "$URL" --sha256 "$SHA" grpcurl
|
|
||||||
|
|||||||
+86
-59
@@ -2,6 +2,7 @@ package grpcurl_test
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"crypto/tls"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net"
|
"net"
|
||||||
"strings"
|
"strings"
|
||||||
@@ -10,6 +11,7 @@ import (
|
|||||||
|
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
"google.golang.org/grpc/credentials"
|
"google.golang.org/grpc/credentials"
|
||||||
|
"google.golang.org/grpc/peer"
|
||||||
|
|
||||||
. "github.com/fullstorydev/grpcurl"
|
. "github.com/fullstorydev/grpcurl"
|
||||||
grpcurl_testing "github.com/fullstorydev/grpcurl/internal/testing"
|
grpcurl_testing "github.com/fullstorydev/grpcurl/internal/testing"
|
||||||
@@ -101,64 +103,85 @@ func TestRequireClientCertTLS(t *testing.T) {
|
|||||||
simpleTest(t, e.cc)
|
simpleTest(t, e.cc)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestTLS12(t *testing.T) {
|
||||||
|
serverCreds, err := ServerTransportCredentials("", "internal/testing/tls/server.crt", "internal/testing/tls/server.key", false)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("failed to create server creds: %v", err)
|
||||||
|
}
|
||||||
|
tlsConf, err := ClientTLSConfig(false, "internal/testing/tls/ca.crt", "", "")
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("failed to create client TLS config: %v", err)
|
||||||
|
}
|
||||||
|
tlsConf.MaxVersion = tls.VersionTLS12
|
||||||
|
|
||||||
|
e, err := createTestServerAndClient(serverCreds, credentials.NewTLS(tlsConf))
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("failed to setup server and client: %v", err)
|
||||||
|
}
|
||||||
|
defer e.Close()
|
||||||
|
|
||||||
|
tlsVersion := negotiatedTLSVersion(t, e.cc)
|
||||||
|
if tlsVersion != tls.VersionTLS12 {
|
||||||
|
t.Errorf("expected TLS 1.2, got 0x%04x", tlsVersion)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestTLS13(t *testing.T) {
|
||||||
|
serverCreds, err := ServerTransportCredentials("", "internal/testing/tls/server.crt", "internal/testing/tls/server.key", false)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("failed to create server creds: %v", err)
|
||||||
|
}
|
||||||
|
clientCreds, err := ClientTransportCredentials(false, "internal/testing/tls/ca.crt", "", "")
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("failed to create client creds: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
e, err := createTestServerAndClient(serverCreds, clientCreds)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("failed to setup server and client: %v", err)
|
||||||
|
}
|
||||||
|
defer e.Close()
|
||||||
|
|
||||||
|
tlsVersion := negotiatedTLSVersion(t, e.cc)
|
||||||
|
if tlsVersion != tls.VersionTLS13 {
|
||||||
|
t.Errorf("expected TLS 1.3, got 0x%04x", tlsVersion)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func negotiatedTLSVersion(t *testing.T, cc *grpc.ClientConn) uint16 {
|
||||||
|
t.Helper()
|
||||||
|
cl := grpcurl_testing.NewTestServiceClient(cc)
|
||||||
|
ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second)
|
||||||
|
defer cancel()
|
||||||
|
var p peer.Peer
|
||||||
|
_, err := cl.UnaryCall(ctx, &grpcurl_testing.SimpleRequest{}, grpc.WaitForReady(true), grpc.Peer(&p))
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("RPC failed: %v", err)
|
||||||
|
}
|
||||||
|
tlsInfo, ok := p.AuthInfo.(credentials.TLSInfo)
|
||||||
|
if !ok {
|
||||||
|
t.Fatalf("expected TLS auth info, got %T", p.AuthInfo)
|
||||||
|
}
|
||||||
|
return tlsInfo.State.Version
|
||||||
|
}
|
||||||
|
|
||||||
func TestBrokenTLS_ClientPlainText(t *testing.T) {
|
func TestBrokenTLS_ClientPlainText(t *testing.T) {
|
||||||
serverCreds, err := ServerTransportCredentials("", "internal/testing/tls/server.crt", "internal/testing/tls/server.key", false)
|
serverCreds, err := ServerTransportCredentials("", "internal/testing/tls/server.crt", "internal/testing/tls/server.key", false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("failed to create server creds: %v", err)
|
t.Fatalf("failed to create server creds: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// client connection (usually) succeeds since client is not waiting for TLS handshake
|
// Plaintext client to TLS server: the server expects a TLS handshake,
|
||||||
// (we try several times, but if we never get a connection and the error message is
|
// gets an HTTP/2 preface instead, and closes the connection.
|
||||||
// a known/expected possibility, we'll just bail)
|
e, err := createTestServerAndClient(serverCreds, nil)
|
||||||
var e testEnv
|
|
||||||
failCount := 0
|
|
||||||
for {
|
|
||||||
e, err = createTestServerAndClient(serverCreds, nil)
|
|
||||||
if err == nil {
|
|
||||||
// success!
|
|
||||||
defer e.Close()
|
|
||||||
break
|
|
||||||
}
|
|
||||||
|
|
||||||
if strings.Contains(err.Error(), "deadline exceeded") ||
|
|
||||||
strings.Contains(err.Error(), "use of closed network connection") {
|
|
||||||
// It is possible that the connection never becomes healthy:
|
|
||||||
// 1) grpc connects successfully
|
|
||||||
// 2) grpc client tries to send HTTP/2 preface and settings frame
|
|
||||||
// 3) server, expecting handshake, closes the connection
|
|
||||||
// 4) in the client, the write fails, so the connection never
|
|
||||||
// becomes ready
|
|
||||||
// The client will attempt to reconnect on transient errors, so
|
|
||||||
// may eventually bump into the connect time limit. This used to
|
|
||||||
// result in a "deadline exceeded" error, but more recent versions
|
|
||||||
// of the grpc library report any underlying I/O error instead, so
|
|
||||||
// we also check for "use of closed network connection".
|
|
||||||
failCount++
|
|
||||||
if failCount > 5 {
|
|
||||||
return // bail...
|
|
||||||
}
|
|
||||||
// we'll try again
|
|
||||||
|
|
||||||
} else {
|
|
||||||
// some other error occurred, so we'll consider that a test failure
|
|
||||||
t.Fatalf("failed to setup server and client: %v", err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// but request fails because server closes connection upon seeing request
|
|
||||||
// bytes that are not a TLS handshake
|
|
||||||
cl := grpcurl_testing.NewTestServiceClient(e.cc)
|
|
||||||
_, err = cl.UnaryCall(context.Background(), &grpcurl_testing.SimpleRequest{})
|
|
||||||
if err == nil {
|
if err == nil {
|
||||||
t.Fatal("expecting failure")
|
e.Close()
|
||||||
|
t.Fatal("expecting failure when connecting plaintext to TLS server")
|
||||||
}
|
}
|
||||||
// various errors possible when server closes connection
|
if !strings.Contains(err.Error(), "EOF") &&
|
||||||
if !strings.Contains(err.Error(), "transport is closing") &&
|
|
||||||
!strings.Contains(err.Error(), "connection is unavailable") &&
|
|
||||||
!strings.Contains(err.Error(), "use of closed network connection") &&
|
!strings.Contains(err.Error(), "use of closed network connection") &&
|
||||||
!strings.Contains(err.Error(), "all SubConns are in TransientFailure") {
|
!strings.Contains(err.Error(), "connection reset by peer") {
|
||||||
|
t.Fatalf("expecting connection closed error, got: %v", err)
|
||||||
t.Fatalf("expecting transport failure, got: %v", err)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -253,12 +276,14 @@ func TestBrokenTLS_ClientNotTrusted(t *testing.T) {
|
|||||||
e.Close()
|
e.Close()
|
||||||
t.Fatal("expecting TLS failure setting up server and client")
|
t.Fatal("expecting TLS failure setting up server and client")
|
||||||
}
|
}
|
||||||
// Check for either the old error (Go <=1.24) or the new one (Go 1.25+)
|
// The exact TLS alert varies by Go version and TLS version negotiated:
|
||||||
// Go 1.24: "bad certificate"
|
// - TLS 1.2: "bad certificate" (Go <=1.24) or "handshake failure" (Go 1.25+)
|
||||||
// Go 1.25: "handshake failure"
|
// - TLS 1.3: "certificate required" (server rejects after handshake)
|
||||||
errMsg := err.Error()
|
errMsg := err.Error()
|
||||||
if !strings.Contains(errMsg, "bad certificate") && !strings.Contains(errMsg, "handshake failure") {
|
if !strings.Contains(errMsg, "bad certificate") &&
|
||||||
t.Fatalf("expecting a specific TLS certificate or handshake error, got: %v", err)
|
!strings.Contains(errMsg, "handshake failure") &&
|
||||||
|
!strings.Contains(errMsg, "certificate required") {
|
||||||
|
t.Fatalf("expecting a TLS certificate error, got: %v", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -297,12 +322,14 @@ func TestBrokenTLS_RequireClientCertButNonePresented(t *testing.T) {
|
|||||||
e.Close()
|
e.Close()
|
||||||
t.Fatal("expecting TLS failure setting up server and client")
|
t.Fatal("expecting TLS failure setting up server and client")
|
||||||
}
|
}
|
||||||
// Check for either the old error (Go <=1.24) or the new one (Go 1.25+)
|
// The exact TLS alert varies by Go version and TLS version negotiated:
|
||||||
// Go 1.24: "bad certificate"
|
// - TLS 1.2: "bad certificate" (Go <=1.24) or "handshake failure" (Go 1.25+)
|
||||||
// Go 1.25: "handshake failure"
|
// - TLS 1.3: "certificate required" (server rejects after handshake)
|
||||||
errMsg := err.Error()
|
errMsg := err.Error()
|
||||||
if !strings.Contains(errMsg, "bad certificate") && !strings.Contains(errMsg, "handshake failure") {
|
if !strings.Contains(errMsg, "bad certificate") &&
|
||||||
t.Fatalf("expecting a specific TLS certificate or handshake error, got: %v", err)
|
!strings.Contains(errMsg, "handshake failure") &&
|
||||||
|
!strings.Contains(errMsg, "certificate required") {
|
||||||
|
t.Fatalf("expecting a TLS certificate error, got: %v", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user