Commit 3805a431 authored by Mikio Hara's avatar Mikio Hara

go.net/proxy: fix IP address determination

net.IP represents either an IPv4 or IPv6 address. In case of
the address of IPv4 node, it uses IPv4-mapped IPv6 address
format by default.

R=agl, dave
CC=golang-dev
https://golang.org/cl/6782078
parent 811c2f5e
......@@ -142,7 +142,7 @@ func (s *socks5) Dial(network, addr string) (net.Conn, error) {
buf = append(buf, socks5Version, socks5Connect, 0 /* reserved */)
if ip := net.ParseIP(host); ip != nil {
if len(ip) == 4 {
if ip.To4() != nil {
buf = append(buf, socks5IP4)
} else {
buf = append(buf, socks5IP6)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment