Ver Fonte

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

hangzws há 7 anos atrás
pai
commit
1066cbd657
1 ficheiros alterados com 4 adições e 0 exclusões
  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