mirror of
https://github.com/fullstorydev/grpcurl.git
synced 2026-05-22 19:51:44 +03:00
Restore Unix socket support (#498)
https://github.com/fullstorydev/grpcurl/issues/496 Restore -unix to working properly by default with the default dialer.
This commit is contained in:
@@ -484,12 +484,12 @@ 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"
|
||||
}
|
||||
if isUnixSocket != nil && isUnixSocket() && !strings.HasPrefix(target, "unix://") {
|
||||
// prepend unix:// to the address if it's not already there
|
||||
// this is to maintain backwards compatibility because the custom dialer is replaced by
|
||||
// the default dialer in grpc-go.
|
||||
// https://github.com/fullstorydev/grpcurl/pull/480
|
||||
target = "unix://" + target
|
||||
}
|
||||
var creds credentials.TransportCredentials
|
||||
if *plaintext {
|
||||
@@ -557,7 +557,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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user