1
0
mirror of https://github.com/golang/go synced 2024-11-23 19:20:03 -07:00

net: put [ ] around IPv6 addresses for Dial

Update #538.

R=r
CC=golang-dev
https://golang.org/cl/229045
This commit is contained in:
Russ Cox 2010-03-03 17:30:39 -08:00
parent 74b131c0ab
commit e53f7d8993

View File

@ -49,7 +49,11 @@ func _DNS_ReadConfig() (*_DNS_Config, os.Error) {
// just an IP address. Otherwise we need DNS
// to look it up.
name := f[1]
if len(ParseIP(name)) != 0 {
switch len(ParseIP(name)) {
case 16:
name = "[" + name + "]"
fallthrough
case 4:
a = a[0 : n+1]
a[n] = name
conf.servers = a