net.JoinHostPort will add [ and ]

dont do this in the clientconfig
This commit is contained in:
Miek Gieben 2012-12-26 17:58:18 +01:00
parent 35eaf9f14a
commit 3e3234c4ea
1 changed files with 8 additions and 7 deletions

View File

@ -50,13 +50,14 @@ func ClientConfigFromFile(conf string) (*ClientConfig, error) {
// just an IP address. Otherwise we need DNS
// to look it up.
name := f[1]
switch x := net.ParseIP(name); true {
case x.To4() != nil:
c.Servers = append(c.Servers, name)
case x.To16() != nil:
name = "[" + name + "]"
c.Servers = append(c.Servers, name)
}
// Don't use this. net.JoinHostPort will fix this for you
// switch x := net.ParseIP(name); true {
// case x.To4() != nil:
// c.Servers = append(c.Servers, name)
// case x.To16() != nil:
// name = "[" + name + "]"
c.Servers = append(c.Servers, name)
// }
}
case "domain": // set search path to just this domain