Reviewers: agl1,
Message:
Hello agl@golang.org (cc: golang-dev@googlegroups.com),
I'd like you to review this change to
https://code.google.com/p/go.net
Description:
go.net/proxy: fix IP address determination
net.IP represents an IPv4 address as IPv4-mapped IPv6 address.
Please review this at http://codereview.appspot.com/6782078/
Affected files:
M proxy/socks5.go
Index: proxy/socks5.go
===================================================================
--- a/proxy/socks5.go
+++ b/proxy/socks5.go
@@ -142,7 +142,7 @@
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)