Skip to content

Commit b3f3d18

Browse files
committed
bug: fix Unix address on Windows
1 parent 7894979 commit b3f3d18

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

gnet.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -752,6 +752,16 @@ func parseProtoAddr(protoAddr string) (string, string, error) {
752752
// This is for cases like this: udp://[ff02::3%lo0]:9991
753753
protoAddr = strings.ReplaceAll(protoAddr, "%", "%25")
754754

755+
if runtime.GOOS == "windows" {
756+
if strings.HasPrefix(protoAddr, "unix://") {
757+
parts := strings.SplitN(protoAddr, "://", 2)
758+
if parts[1] == "" {
759+
return "", "", errorx.ErrInvalidNetworkAddress
760+
}
761+
return parts[0], parts[1], nil
762+
}
763+
}
764+
755765
u, err := url.Parse(protoAddr)
756766
if err != nil {
757767
return "", "", err

0 commit comments

Comments
 (0)