Lafeng / deblocus

An Excellent Proxy.
MIT License
185 stars 42 forks source link

IPv6 problem #21

Closed ghost closed 9 years ago

ghost commented 9 years ago

Browser got an IPv6 address from local DNS and tried to connect but: E0905 521 multiplexer.go:380] Cannot connect to [2404:6800:4005:808::200e:443] for error: dial tcp: too many colons in address 2404:6800:4005:809::2004:443

ghost commented 9 years ago
diff --git a/tunnel/d5.go b/tunnel/d5.go
index 9afc075..cdd5f0e 100644
--- a/tunnel/d5.go
+++ b/tunnel/d5.go
@@ -154,7 +154,7 @@ func (s *S5Step1) parseSocks5Request() string {
                host = net.IP(buf[:net.IPv4len]).String()
                ofs = net.IPv4len
        case IPV6:
-               host = net.IP(buf[:net.IPv6len]).String()
+               host = "[" + net.IP(buf[:net.IPv6len]).String() + "]"
                ofs = net.IPv6len
        case DOMAIN:
                dlen := int(buf[0])

And becomes: E0906 4620 multiplexer.go:380] Cannot connect to [[2404:6800:4005:808::200e]:80] for error: dial tcp [2404:6800:4005:808::200e]:80: connect: network is unreachable