mirror of
https://github.com/golang/net.git
synced 2026-03-31 10:27:08 +09:00
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
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user