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 (#588)

Signed-off-by: Denis Tingajkin <denis.tingajkin@xored.com>
  • Loading branch information
denis-tingaikin authored Nov 16, 2020
1 parent e7687f1 commit a04f342
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 a04f342

Please sign in to comment.