-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is there socks5 support for websocket connections? #297
Comments
You can connect through a socks5 proxy by setting the Dialer.NetDial field to the Dial method of a SOCKS5 Dialer.
|
We use the http.ProxyFromEnvironment function to setup the Dialer.Proxy field. if proxy == nil {
proxy = http.ProxyFromEnvironment
}
...
dialer: websocket.Dialer{
Proxy: proxy,
...
}, Would it be possible to support this out of the box since golang recently added support for SOCKS5 from the environment? They have a similar implementation for the transport package here. |
How about adding this field to Dialer?
|
@garyburd Your solution looks great. It will solve the problem of needing to support SOCKS5 in our particular library NOAA. @melnikalex What do you think? |
@garyburd I like it. Thank you! |
Another approach is to bundle the x/net/proxy package. This avoids adding yet another knob to Dialer and is a much better option than vendoring all of x/net. |
- Bundle the golang.org/x/net/proxy package to x_net_proxy.go. The package contains a SOCKS5 proxy. The package is bundled to avoid adding a dependency from the weboscket package to golang.org/x/net. - Restructure the existing HTTP proxy code so the code can be used as a dialer with the proxy package. - Modify Dialer.Dial to use proxy.FromURL. - Improve tests (avoid modifying package-level data, use timeouts in tests, use correct proxy URLs in tests). Fixes #297.
Can gorilla establish websocket connections through a socks5 proxy?
If not, is there a plan to do so?
Thank you!
The text was updated successfully, but these errors were encountered: