FAQ
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)

Search Discussions

  • Dave at Nov 16, 2012 at 10:57 am

    On 2012/11/16 10:50:14, mikio wrote:
    Hello mailto:agl@golang.org (cc: mailto:golang-dev@googlegroups.com),
    I'd like you to review this change to
    https://code.google.com/p/go.net
    Change LGTM, but not the description. I thought that net.IP represented
    either an IPv4 or IPv6 address. To me, IPv4 mapped IPv6 talks about the
    ::ffff: range.

    https://codereview.appspot.com/6782078/
  • Mikio Hara at Nov 16, 2012 at 12:12 pm

    On Fri, Nov 16, 2012 at 7:57 PM, wrote:

    Change LGTM, but not the description. I thought that net.IP represented
    either an IPv4 or IPv6 address. Yup.
    To me, IPv4 mapped IPv6 talks about the ::ffff: range.
    It represents an IPv4 address of IPv4 node as IPv6 address, surely.
    ::fff:0:0:0:0/96 is just a format of address, but net.IP uses that.
  • Mikioh Mikioh at Nov 16, 2012 at 11:22 am
    Hello agl@golang.org, dave@cheney.net (cc: golang-dev@googlegroups.com),

    Please take another look.


    http://codereview.appspot.com/6782078/
  • Agl at Nov 16, 2012 at 3:07 pm
    Surprising behaviour from net, but LGTM.

    https://codereview.appspot.com/6782078/
  • Mikioh Mikioh at Nov 17, 2012 at 5:36 am
    *** Submitted as
    http://code.google.com/p/go/source/detail?r=838dac337e60&repo=net ***

    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
    http://codereview.appspot.com/6782078


    http://codereview.appspot.com/6782078/

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-dev @
categoriesgo
postedNov 16, '12 at 10:50a
activeNov 17, '12 at 5:36a
posts6
users3
websitegolang.org

3 users in discussion

Mikioh Mikioh: 4 posts Dave: 1 post Agl: 1 post

People

Translate

site design / logo © 2022 Grokbase