Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

support unix-abstract schema #4079

Merged
merged 9 commits into from
Dec 22, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions internal/grpcutil/target_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ func TestParseTargetString(t *testing.T) {
{targetStr: "unix-abstract:/ a///://::!@#$%^&*()b", want: resolver.Target{Scheme: "unix-abstract", Authority: "", Endpoint: "/ a///://::!@#$%^&*()b"}},
{targetStr: "unix-abstract:passthrough:abc", want: resolver.Target{Scheme: "unix-abstract", Authority: "", Endpoint: "passthrough:abc"}},
{targetStr: "unix-abstract:unix:///abc", want: resolver.Target{Scheme: "unix-abstract", Authority: "", Endpoint: "unix:///abc"}},
{targetStr: "unix-abstract:///a/b/c", want: resolver.Target{Scheme: "unix-abstract", Authority: "", Endpoint: "///a/b/c"}},
{targetStr: "unix-abstract://authority/a/b/c", want: resolver.Target{Scheme: "unix-abstract", Authority: "", Endpoint: "//authority/a/b/c"}},

{targetStr: "passthrough:///unix:///a/b/c", want: resolver.Target{Scheme: "passthrough", Authority: "", Endpoint: "unix:///a/b/c"}},
} {
Expand Down
5 changes: 0 additions & 5 deletions internal/transport/http_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -603,11 +603,6 @@ func newFramer(conn net.Conn, writeBufferSize, readBufferSize int, maxHeaderList
// parseDialTarget returns the network and address to pass to dialer.
func parseDialTarget(target string) (string, string) {
net := "tcp"
if strings.HasPrefix(target, "unix-abstract:") {
// handle unix-abstract:addr which will fail with url.Parse
// and need prepend "\x00" to the parsed address
return "unix", "\x00" + strings.SplitN(target, ":", 2)[1]
}
m1 := strings.Index(target, ":")
m2 := strings.Index(target, ":/")
// handle unix:addr which will fail with url.Parse
Expand Down
4 changes: 0 additions & 4 deletions internal/transport/http_util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,10 +268,6 @@ func (s) TestParseDialTarget(t *testing.T) {
{"unix://domain", "unix", "domain"},
{"unix://etcd:0", "unix", "etcd:0"},
{"unix:///etcd:0", "unix", "/etcd:0"},
{"unix-abstract:abc", "unix", "\x00abc"},
{"unix-abstract:abc edf", "unix", "\x00abc edf"},
{"unix-abstract:///abc", "unix", "\x00///abc"},
{"unix-abstract:unix:abc", "unix", "\x00unix:abc"},
{"passthrough://unix://domain", "tcp", "passthrough://unix://domain"},
{"https://google.com:443", "tcp", "https://google.com:443"},
{"dns:///google.com", "tcp", "dns:///google.com"},
Expand Down