Skip to content

Commit

Permalink
Fix OS specific url handling for unix:// scheme in transport
Browse files Browse the repository at this point in the history
This adds handling for "unix://" scheme under Windows with absolute
paths (containing drive letter). This replicates the behavior from
`ssh_forwarder.go` (pkg/sshclient/ssh_forwarder.go#L114).

Test command:
gvproxy.exe -debug -listen-qemu unix:///C:/Users/User/AppData/Local/Temp/podman/gvproxy.sock

Signed-off-by: Arthur Sengileyev <[email protected]>
  • Loading branch information
arixmkii committed Jul 23, 2024
1 parent 6dbbe08 commit ae9b91a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pkg/transport/listen.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,18 @@ import (
"errors"
"net"
"net/url"
"runtime"
"strings"
)

func defaultListenURL(url *url.URL) (net.Listener, error) {
switch url.Scheme {
case "unix":
return net.Listen(url.Scheme, url.Path)
path := url.Path
if runtime.GOOS == "windows" {
path = strings.TrimPrefix(path, "/")
}
return net.Listen(url.Scheme, path)
case "tcp":
return net.Listen("tcp", url.Host)
default:
Expand Down

0 comments on commit ae9b91a

Please sign in to comment.