commit 3aab55c820d25a9881b66982589573057a67c5b1 Author: David Fifield david@bamsoftware.com Date: Sat May 24 23:39:57 2014 -0700
Honor a socks5 proxy when roundtripping through the helper. --- meek-client/helper.go | 2 +- meek-client/helper_test.go | 5 +++++ meek-client/meek-client.go | 2 +- meek-client/proxy_test.go | 1 + 4 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/meek-client/helper.go b/meek-client/helper.go index d349ff7..872f401 100644 --- a/meek-client/helper.go +++ b/meek-client/helper.go @@ -59,7 +59,7 @@ func makeProxySpec(u *url.URL) (*ProxySpec, error) { }
switch u.Scheme { - case "http", "socks4a": + case "http", "socks5", "socks4a": spec.Type = u.Scheme default: return nil, errors.New("unknown scheme") diff --git a/meek-client/helper_test.go b/meek-client/helper_test.go index f33bb38..291ab11 100644 --- a/meek-client/helper_test.go +++ b/meek-client/helper_test.go @@ -19,6 +19,7 @@ func TestMakeProxySpec(t *testing.T) { url.URL{Scheme: "http", User: url.UserPassword("username", "password"), Host: "localhost:8080"}, url.URL{Scheme: "http", Host: "localhost:-1"}, url.URL{Scheme: "http", Host: "localhost:65536"}, + url.URL{Scheme: "socks5", Host: ":"}, url.URL{Scheme: "socks4a", Host: ":"}, // "socks" and "socks4" are unknown types. url.URL{Scheme: "socks", Host: "localhost:1080"}, @@ -34,6 +35,10 @@ func TestMakeProxySpec(t *testing.T) { ProxySpec{"http", "localhost", 8080}, }, { + url.URL{Scheme: "socks5", Host: "localhost:1080"}, + ProxySpec{"socks5", "localhost", 1080}, + }, + { url.URL{Scheme: "socks4a", Host: "localhost:1080"}, ProxySpec{"socks4a", "localhost", 1080}, }, diff --git a/meek-client/meek-client.go b/meek-client/meek-client.go index b4f9dee..0093cc0 100644 --- a/meek-client/meek-client.go +++ b/meek-client/meek-client.go @@ -325,7 +325,7 @@ func checkProxyURL(u *url.URL) error { // With the helper we can use HTTP and SOCKS (because it is the // browser that does the proxying, not us). switch options.ProxyURL.Scheme { - case "http", "socks4a": + case "http", "socks5", "socks4a": default: return errors.New(fmt.Sprintf("don't understand proxy URL scheme %q", options.ProxyURL.Scheme)) } diff --git a/meek-client/proxy_test.go b/meek-client/proxy_test.go index 7ce206f..d26362d 100644 --- a/meek-client/proxy_test.go +++ b/meek-client/proxy_test.go @@ -36,6 +36,7 @@ func TestGetProxyURL(t *testing.T) { {"http://localhost:8080/path", "http://localhost:8080/path%22%7D, {"http://user@localhost:8080", "http://user@localhost:8080%22%7D, {"http://user:password@localhost:8080", "http://user:password@localhost:8080%22%7D, + {"socks5://localhost:1080", "socks5://localhost:1080"}, {"socks4a://localhost:1080", "socks4a://localhost:1080"}, {"unknown://localhost/whatever", "unknown://localhost/whatever"}, }
tor-commits@lists.torproject.org