Explorar el Código

support ipv6:remove the square brackets from the value of ipv6

hangzws hace 7 años
padre
commit
1066cbd657
Se han modificado 1 ficheros con 4 adiciones y 0 borrados
  1. 4 0
      oss/conn.go

+ 4 - 0
oss/conn.go

@@ -524,7 +524,11 @@ func (um *urlMaker) Init(endpoint string, isCname bool, isProxy bool) {
 	host, _, err := net.SplitHostPort(um.NetLoc)
 	if err != nil {
 		host = um.NetLoc
+		if host[0] == '[' && host[len(host)-1] == ']' {
+			host = host[1 : len(host)-1]
+		}
 	}
+
 	ip := net.ParseIP(host)
 	if ip != nil {
 		um.Type = urlTypeIP