Environment variable 'ALL_PROXY=socks5h://example.com' is commonly
used to specify a SOCKS5 proxy server.
In curl, 'socks5' means the host name will be resolved locally,
and 'socks5h' means the host name will be resolved by the server.
Go SOCKS5 client always uses the server to resolve host names.
So this change just added socks5h as a supported URL scheme.
Fixesgolang/go#13454
Change-Id: I06d2b07f66cd0923c114dba4df0f884b39e58bc0
Reviewed-on: https://go-review.googlesource.com/c/156517
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
This change factors out the code related to SOCKS protocol version 5
from the golang/x/net/proxy package and provides new SOCKS-specific
API to fix the following:
- inflexbility of forward proxy connection setup; e.g., no support for
context-based deadline or canceling, no support for dial deadline,
no support for working with external authentication mechanisms,
- useless error values for troubleshooting.
The new package socks is supposed to be used by the net/http package
of standard library and proxy package of golang.org/x/net repository.
Fixesgolang/go#11682.
Updates golang/go#17759.
Updates golang/go#19354.
Updates golang/go#19688.
Fixesgolang/go#21333.
Change-Id: I24098ac8522dcbdceb03d534147c5101ec9e7350
Reviewed-on: https://go-review.googlesource.com/38278
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Split off a new SOCKS5 connect() method from Dial.
connect() takes an existing connection to a socks5 server, and
commands the server to extend that connection to a given target
address and port.
Change-Id: I5dbba58a67a0d884bda3d3ac194dc18bdebe74ab
Reviewed-on: https://go-review.googlesource.com/36643
Reviewed-by: Adam Langley <agl@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
SOCKS5 uses a single-byte field for domain name length. This change
causes dials to domain names longer than 255 chars to fail instead
of sending an invalid request to the proxy.
LGTM=mikioh.mikioh
R=golang-codereviews, mikioh.mikioh
CC=golang-codereviews
https://golang.org/cl/90790044
The code was using the SOCKS version number (5) where it should have been using the username/password protocol version number (1).
With this change, username/password authentication actually works.
R=golang-dev
CC=golang-dev
https://golang.org/cl/10134044
Both types IPv6 IPv4-mapped address and IPv4-compatible
address are not allowed to be used in wire protocols.
Fixesgolang/go#4709.
Thank you raptium for original CL 6922050.
R=golang-dev, agl
CC=golang-dev, raptium
https://golang.org/cl/7220047
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 change copies exp/proxy to go.net without any code changes. A
followup CL will remove exp/proxy.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6449097