解决consul client以IPv6地址格式register consul server health check时报错:[Check socket connection failed ... too many colons in address] (#1790)

pull/1799/head
zjx-ERROR 3 years ago committed by GitHub
parent 9ea78f302d
commit 0f23c1c516
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      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{

Loading…
Cancel
Save