mirror of
https://github.com/logos-messaging/go-multiaddr.git
synced 2026-01-04 05:53:05 +00:00
fix unix path handling on windows
* Convert to windows paths when converting from a multiaddr to a net.Addr * Convert from windows paths when converting from a net.Addr to a multiaddr Also, don't "clean". `filepath.Clean` is _usually_ correct but not _technically_ correct in all cases. We should leave cleaning to the application.
This commit is contained in:
parent
1b2246d7be
commit
d66032c340
@ -192,7 +192,7 @@ func DialArgs(m ma.Multiaddr) (string, string, error) {
|
|||||||
}
|
}
|
||||||
return network, "[" + ip + "]" + ":" + port, nil
|
return network, "[" + ip + "]" + ":" + port, nil
|
||||||
case "unix":
|
case "unix":
|
||||||
return network, ip, nil
|
return network, filepath.FromSlash(ip), nil
|
||||||
default:
|
default:
|
||||||
return "", "", fmt.Errorf("%s is not a 'thin waist' address", m)
|
return "", "", fmt.Errorf("%s is not a 'thin waist' address", m)
|
||||||
}
|
}
|
||||||
@ -263,6 +263,6 @@ func parseUnixNetAddr(a net.Addr) (ma.Multiaddr, error) {
|
|||||||
if !ok {
|
if !ok {
|
||||||
return nil, errIncorrectNetAddr
|
return nil, errIncorrectNetAddr
|
||||||
}
|
}
|
||||||
cleaned := filepath.Clean(ac.Name)
|
|
||||||
return ma.NewComponent("unix", cleaned)
|
return ma.NewComponent("unix", filepath.ToSlash(ac.Name))
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user