Skip to content

Commit

Permalink
fix: AddressToURL should not return local host in case of IP.IsUnspec…
Browse files Browse the repository at this point in the history
…ified (networkservicemesh#588)

Signed-off-by: Denis Tingajkin <denis.tingajkin@xored.com>
Signed-off-by: Sergey Ershov <sergey.ershov@xored.com>
  • Loading branch information
denis-tingaikin authored and Sergey Ershov committed Dec 20, 2020
1 parent dcde680 commit 380b7ee
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/tools/grpcutils/url.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func URLToTarget(u *url.URL) (target string) {
func AddressToURL(addr net.Addr) *url.URL {
if tcpAddr, ok := addr.(*net.TCPAddr); ok {
if tcpAddr.IP.IsUnspecified() {
return &url.URL{Scheme: addr.Network(), Host: fmt.Sprintf("127.0.0.1:%v", tcpAddr.Port)}
return &url.URL{Scheme: addr.Network(), Host: fmt.Sprintf(":%v", tcpAddr.Port)}
}
}
if addr.Network() == unixScheme {
Expand Down

0 comments on commit 380b7ee

Please sign in to comment.