diff options
author | Russ Cox <rsc@golang.org> | 2010-03-03 17:30:39 -0800 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2010-03-03 17:30:39 -0800 |
commit | e53f7d8993b4fae1e2de425e5c87852803362bd2 (patch) | |
tree | 87d101b90cfb170ad71c75a4dd9a8d3c3c7f29aa | |
parent | 74b131c0abf977a4ee94aec42412b16f30f4549c (diff) | |
download | go-e53f7d8993b4fae1e2de425e5c87852803362bd2.tar.gz go-e53f7d8993b4fae1e2de425e5c87852803362bd2.zip |
net: put [ ] around IPv6 addresses for Dial
Update #538.
R=r
CC=golang-dev
https://golang.org/cl/229045
-rw-r--r-- | src/pkg/net/dnsconfig.go | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/pkg/net/dnsconfig.go b/src/pkg/net/dnsconfig.go index 7d098583df..4be207603c 100644 --- a/src/pkg/net/dnsconfig.go +++ b/src/pkg/net/dnsconfig.go @@ -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 |