From 0f23c1c5167ee80ff3742449258bf024ce0f28f3 Mon Sep 17 00:00:00 2001 From: zjx-ERROR <39952974+zjx-ERROR@users.noreply.github.com> Date: Thu, 27 Jan 2022 10:42:23 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3consul=20client=E4=BB=A5IPv6?= =?UTF-8?q?=E5=9C=B0=E5=9D=80=E6=A0=BC=E5=BC=8Fregister=20consul=20server?= =?UTF-8?q?=20health=20check=E6=97=B6=E6=8A=A5=E9=94=99:[Check=20socket=20?= =?UTF-8?q?connection=20failed=20...=20too=20many=20colons=20in=20address]?= =?UTF-8?q?=20(#1790)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- contrib/registry/consul/client.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/registry/consul/client.go b/contrib/registry/consul/client.go index ed505974a..46321b8e2 100644 --- a/contrib/registry/consul/client.go +++ b/contrib/registry/consul/client.go @@ -98,7 +98,8 @@ func (c *Client) Register(_ context.Context, svc *registry.ServiceInstance, enab } addr := raw.Hostname() port, _ := strconv.ParseUint(raw.Port(), 10, 16) - checkAddresses = append(checkAddresses, fmt.Sprintf("%s:%d", addr, port)) + + checkAddresses = append(checkAddresses, net.JoinHostPort(addr, strconv.FormatUint(port, 10))) addresses[raw.Scheme] = api.ServiceAddress{Address: endpoint, Port: int(port)} } asr := &api.AgentServiceRegistration{