浏览代码

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

hangzws 7 年之前
父节点
当前提交
1066cbd657
共有 1 个文件被更改,包括 4 次插入0 次删除
  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