IPv6: Support host address configured with enclosing square brackets (#31226)

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
This commit is contained in:
Arve Knudsen
2021-02-15 17:55:41 +01:00
committed by GitHub
parent d56c5285e2
commit d27a72f859
2 changed files with 6 additions and 1 deletions
+2
View File
@@ -114,6 +114,8 @@ func (server *Server) Dial() error {
}
}
for _, host := range strings.Split(server.Config.Host, " ") {
// Remove any square brackets enclosing IPv6 addresses, a format we support for backwards compatibility
host = strings.TrimSuffix(strings.TrimPrefix(host, "["), "]")
address := net.JoinHostPort(host, strconv.Itoa(server.Config.Port))
if server.Config.UseSSL {
tlsCfg := &tls.Config{