From 0705db2f4240353ea0f7343c998c1cb347a6c77d Mon Sep 17 00:00:00 2001 From: zhyuri <4649294+zhyuri@users.noreply.github.com> Date: Thu, 19 Dec 2024 12:18:05 -0500 Subject: [PATCH] remove unix option --- cmd/grpcurl/grpcurl.go | 14 ++------------ cmd/grpcurl/unix.go | 15 --------------- grpcurl.go | 2 +- tls_settings_test.go | 2 +- 4 files changed, 4 insertions(+), 29 deletions(-) delete mode 100644 cmd/grpcurl/unix.go diff --git a/cmd/grpcurl/grpcurl.go b/cmd/grpcurl/grpcurl.go index 80f87bfc..aaead292 100644 --- a/cmd/grpcurl/grpcurl.go +++ b/cmd/grpcurl/grpcurl.go @@ -45,8 +45,6 @@ var version = noVersion var ( exit = os.Exit - isUnixSocket func() bool // nil when run on non-unix platform - flags = flag.NewFlagSet(os.Args[0], flag.ExitOnError) help = flags.Bool("help", false, prettify(` @@ -483,13 +481,6 @@ func main() { if *maxMsgSz > 0 { opts = append(opts, grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(*maxMsgSz))) } - network := "tcp" - if isUnixSocket != nil && isUnixSocket() { - network = "unix" - if *authority == "" { - *authority = "localhost" - } - } var creds credentials.TransportCredentials if *plaintext { if *authority != "" { @@ -556,7 +547,7 @@ func main() { blockingDialTiming := dialTiming.Child("BlockingDial") defer blockingDialTiming.Done() - cc, err := grpcurl.BlockingDial(ctx, network, target, creds, opts...) + cc, err := grpcurl.BlockingDial(ctx, target, creds, opts...) if err != nil { fail(err, "Failed to dial target host %q", target) } @@ -881,8 +872,7 @@ method's request type will be sent. The address will typically be in the form "host:port" where host can be an IP address or a hostname and port is a numeric port or service name. If an IPv6 address is given, it must be surrounded by brackets, like "[2001:db8::1]". For -Unix variants, if a -unix=true flag is present, then the address must be the -path to the domain socket. +Unix variants, the address must start with schema "unix://" followed by the path. Available flags: `, os.Args[0]) diff --git a/cmd/grpcurl/unix.go b/cmd/grpcurl/unix.go deleted file mode 100644 index cae4bed8..00000000 --- a/cmd/grpcurl/unix.go +++ /dev/null @@ -1,15 +0,0 @@ -//go:build darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || windows -// +build darwin dragonfly freebsd linux netbsd openbsd solaris windows - -package main - -var ( - unix = flags.Bool("unix", false, prettify(` - Indicates that the server address is the path to a Unix domain socket.`)) -) - -func init() { - isUnixSocket = func() bool { - return *unix - } -} diff --git a/grpcurl.go b/grpcurl.go index 9c8b08ba..b727382a 100644 --- a/grpcurl.go +++ b/grpcurl.go @@ -609,7 +609,7 @@ func ServerTransportCredentials(cacertFile, serverCertFile, serverKeyFile string // BlockingDial is a helper method to dial the given address, using optional TLS credentials, // and blocking until the returned connection is ready. If the given credentials are nil, the // connection will be insecure (plain-text). -func BlockingDial(ctx context.Context, network, address string, creds credentials.TransportCredentials, opts ...grpc.DialOption) (*grpc.ClientConn, error) { +func BlockingDial(ctx context.Context, address string, creds credentials.TransportCredentials, opts ...grpc.DialOption) (*grpc.ClientConn, error) { if creds == nil { creds = insecure.NewCredentials() } diff --git a/tls_settings_test.go b/tls_settings_test.go index b12a2514..eaef68d2 100644 --- a/tls_settings_test.go +++ b/tls_settings_test.go @@ -333,7 +333,7 @@ func createTestServerAndClient(serverCreds, clientCreds credentials.TransportCre ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second) defer cancel() - cc, err := BlockingDial(ctx, "tcp", fmt.Sprintf("127.0.0.1:%d", port), clientCreds) + cc, err := BlockingDial(ctx, fmt.Sprintf("127.0.0.1:%d", port), clientCreds) if err != nil { return e, err }