Use localhost for default unix domain socket authority (#445)
This commit is contained in:
parent
252b57fd45
commit
149a93e0ec
|
|
@ -97,7 +97,8 @@ var (
|
||||||
value of the ":authority" pseudo-header in the HTTP/2 protocol. When TLS
|
value of the ":authority" pseudo-header in the HTTP/2 protocol. When TLS
|
||||||
is used, this will also be used as the server name when verifying the
|
is used, this will also be used as the server name when verifying the
|
||||||
server's certificate. It defaults to the address that is provided in the
|
server's certificate. It defaults to the address that is provided in the
|
||||||
positional arguments.`))
|
positional arguments, or 'localhost' in the case of a unix domain
|
||||||
|
socket.`))
|
||||||
userAgent = flags.String("user-agent", "", prettify(`
|
userAgent = flags.String("user-agent", "", prettify(`
|
||||||
If set, the specified value will be added to the User-Agent header set
|
If set, the specified value will be added to the User-Agent header set
|
||||||
by the grpc-go library.
|
by the grpc-go library.
|
||||||
|
|
@ -474,6 +475,13 @@ func main() {
|
||||||
if *maxMsgSz > 0 {
|
if *maxMsgSz > 0 {
|
||||||
opts = append(opts, grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(*maxMsgSz)))
|
opts = append(opts, grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(*maxMsgSz)))
|
||||||
}
|
}
|
||||||
|
network := "tcp"
|
||||||
|
if isUnixSocket != nil && isUnixSocket() {
|
||||||
|
network = "unix"
|
||||||
|
if *authority == "" {
|
||||||
|
*authority = "localhost"
|
||||||
|
}
|
||||||
|
}
|
||||||
var creds credentials.TransportCredentials
|
var creds credentials.TransportCredentials
|
||||||
if *plaintext {
|
if *plaintext {
|
||||||
if *authority != "" {
|
if *authority != "" {
|
||||||
|
|
@ -538,10 +546,6 @@ func main() {
|
||||||
}
|
}
|
||||||
opts = append(opts, grpc.WithUserAgent(grpcurlUA))
|
opts = append(opts, grpc.WithUserAgent(grpcurlUA))
|
||||||
|
|
||||||
network := "tcp"
|
|
||||||
if isUnixSocket != nil && isUnixSocket() {
|
|
||||||
network = "unix"
|
|
||||||
}
|
|
||||||
blockingDialTiming := dialTiming.Child("BlockingDial")
|
blockingDialTiming := dialTiming.Child("BlockingDial")
|
||||||
defer blockingDialTiming.Done()
|
defer blockingDialTiming.Done()
|
||||||
cc, err := grpcurl.BlockingDial(ctx, network, target, creds, opts...)
|
cc, err := grpcurl.BlockingDial(ctx, network, target, creds, opts...)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue