redis: support IPv6 addresses with no port
This commit is contained in:
parent
1accab02ed
commit
71ff50633e
|
@ -114,7 +114,7 @@ const defaultPort = "6379"
|
||||||
func (r *Redis) gatherServer(addr *url.URL, acc plugins.Accumulator) error {
|
func (r *Redis) gatherServer(addr *url.URL, acc plugins.Accumulator) error {
|
||||||
_, _, err := net.SplitHostPort(addr.Host)
|
_, _, err := net.SplitHostPort(addr.Host)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
addr.Host = addr.Host + ":" + defaultPort
|
addr.Host = net.JoinHostPort(addr.Host, defaultPort)
|
||||||
}
|
}
|
||||||
|
|
||||||
c, err := net.Dial("tcp", addr.Host)
|
c, err := net.Dial("tcp", addr.Host)
|
||||||
|
|
Loading…
Reference in New Issue