From a04f342c6d6f9cb5aed6f598e9e57d60b1155cc8 Mon Sep 17 00:00:00 2001 From: Denis Tingaikin <49399980+denis-tingajkin@users.noreply.github.com> Date: Mon, 16 Nov 2020 20:54:09 +0700 Subject: [PATCH] fix: AddressToURL should not return local host in case of IP.IsUnspecified (#588) Signed-off-by: Denis Tingajkin --- pkg/tools/grpcutils/url.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/tools/grpcutils/url.go b/pkg/tools/grpcutils/url.go index 6133f0ab7..bdb7e2a4b 100644 --- a/pkg/tools/grpcutils/url.go +++ b/pkg/tools/grpcutils/url.go @@ -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 {