commit 78e518c824d9541056ba2ca870df2bb01b810b05 Author: David Fifield david@bamsoftware.com Date: Sat Nov 9 19:16:27 2013 -0800
Actually stop name resolution.
net.ResolveIPAddr still resolves "localhost" to 127.0.0.1. Use net.ParseIP instead. --- pt.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/pt.go b/pt.go index 308238c..b5466fd 100644 --- a/pt.go +++ b/pt.go @@ -270,15 +270,15 @@ func resolveAddr(addrStr string) (*net.TCPAddr, error) { if portStr == "" { return nil, net.InvalidAddrError(fmt.Sprintf("address string %q lacks a port part", addrStr)) } - ip, err := net.ResolveIPAddr("ip", ipStr) - if err != nil { - return nil, err + ip := net.ParseIP(ipStr) + if ip == nil { + return nil, net.InvalidAddrError(fmt.Sprintf("not an IP string: %q", ipStr)) } port, err := net.LookupPort("tcp", portStr) if err != nil { return nil, err } - return &net.TCPAddr{IP: ip.IP, Port: port, Zone: ip.Zone}, nil + return &net.TCPAddr{IP: ip, Port: port}, nil }
// Return a new slice, the members of which are those members of addrs having a
tor-commits@lists.torproject.org