-
Notifications
You must be signed in to change notification settings - Fork 517
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Restore Unix socket support #498
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks pretty good to me. I'm not actually a maintainer anymore, so you'll also need a review from the likes of @dragonsinth or @gpassini.
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 | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could instead set a network
local variable (that defaults to empty string) to "unix"
and then pass to BlockingDial
below. That way, you aren't duplicating the logic that also lives in BlockingDial
for this scenario.
Fixes #496
Context
#480 introduced a behaviour change by replacing custom dialer with the default one from grpc-go, where
grpcurl -unix /path/to/proxy
no longer works because the address isn't a RFC 3986 compliant URI for unix sockets.The fix aims to restore the previous behaviour in both grpcurl CLI and package API
BlockingDial
.Changes
CLI
unix://
to the address if-unix
option is used but the address is not a RFC 3986 compliant URI. This change restored the previous behaviour for-unix
.localhost
for-unix
. This default option was added in 149a93e in order to align the behaviour with popular grpc clients/servers in the customized dialer. Because we now use the grpc-go default dialer, which setslocalhost
as the default authority for unix networktype, this default option is no longer needed.network
ingrpcurl.BlockingDial
.grpcurl package
Depending on the
network
, theBlockingDial
API performs different actionsunix://
to the-unix
address and always sets network to empty.tcp
, validate the address doesn't haveunix://
prefix., prepend
unix://` if missing.Test
grpcurl -unix unix:///path/to/proxy
- worksgrpcurl -unix /path/to/proxy
- works, this is the behaviour before feat: 166: Proxy support #480grpcurl unix://path/to/proxy
- worksgrpcurl /path/to/proxy
- does not work with expected errormissing port in address