@@ -7,6 +7,7 @@
|
||||
package connections
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"net"
|
||||
"net/url"
|
||||
"strconv"
|
||||
@@ -20,7 +21,8 @@ func fixupPort(uri *url.URL, defaultPort int) *url.URL {
|
||||
copyURI := *uri
|
||||
|
||||
host, port, err := net.SplitHostPort(uri.Host)
|
||||
if e, ok := err.(*net.AddrError); ok && strings.Contains(e.Err, "missing port") {
|
||||
e := &net.AddrError{}
|
||||
if errors.As(err, &e) && strings.Contains(e.Err, "missing port") {
|
||||
// addr is of the form "1.2.3.4" or "[fe80::1]"
|
||||
host = uri.Host
|
||||
if strings.HasPrefix(host, "[") && strings.HasSuffix(host, "]") {
|
||||
|
||||
Reference in New Issue
Block a user