Restore Unix socket support#498
Merged
dragonsinth merged 6 commits intofullstorydev:masterfrom Mar 18, 2025
Merged
Conversation
jhump
reviewed
Dec 19, 2024
jhump
reviewed
Dec 20, 2024
Contributor
jhump
left a comment
There was a problem hiding this comment.
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.
Comment on lines
+486
to
+492
| 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 | ||
| } |
Contributor
There was a problem hiding this comment.
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.
dragonsinth
approved these changes
Mar 18, 2025
Member
dragonsinth
left a comment
There was a problem hiding this comment.
LGTM, sorry I was on sabbatical when this PR was happening.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #496
Context
#480 introduced a behaviour change by replacing custom dialer with the default one from grpc-go, where
grpcurl -unix /path/to/proxyno 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-unixoption is used but the address is not a RFC 3986 compliant URI. This change restored the previous behaviour for-unix.localhostfor-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 setslocalhostas the default authority for unix networktype, this default option is no longer needed.networkingrpcurl.BlockingDial.grpcurl package
Depending on the
network, theBlockingDialAPI performs different actionsunix://to the-unixaddress and always sets network to empty.tcp, validate the address doesn't haveunix://prefix., prependunix://` 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