Does OkHttp support authentication for SOCKS proxies as of now? I looked into the documentation (http://square.github.io/okhttp/javadoc/com/squareup/okhttp/Authenticator.html) and it looks like this is just for HTTP proxies?
Yep, exactly. Actually our SOCKS support is all pretty limited. Right now we're relying on the SOCKS implementation that's built into the JVM; but we have been tempted to do our own in the application layer. Are you interested in spending a week or two to contribute code?
Yup, I'd be glad to. I guess the
out.write(NO_AUTH);
out.write(USER_PASSW)
bit from https://github.com/square/okhttp/issues/1359 should be most relevant. How exactly would I go about it?
You'll need to implement SOCKS completely first, so we can stop relying on the built-in proxy that Java gives us. That'll require a mechanism to test your implementation also, kind of like MockWebServer. Once that's all in, then authentication should just slide in!
I tried using what https://github.com/fengyouchao/sockslib did and it seems to work.
with a custom factory that returns sockslib.client.SocksSocket
@drallieiv I would appreciate it if you could please add a code example of how to use sockslib for socks5 + authentication.
Thanks!
Maybe this will help https://stackoverflow.com/a/56422925/9466638
Won't fix. We have had multiple Socks PRs that have languished.
Most helpful comment
I tried using what https://github.com/fengyouchao/sockslib did and it seems to work.
with a custom factory that returns sockslib.client.SocksSocket