sholladay / os-proxy

Manage system-wide proxy settings
Mozilla Public License 2.0
20 stars 7 forks source link

Add support for SOCKS proxies #3

Open oyyd opened 7 years ago

oyyd commented 7 years ago

Hi, @sholladay. Thanks for your great repo. And is it possible for os-proxy to provide settings for the SOCKS proxy? It's much more popular than the http proxy in China for some reasons.

sholladay commented 7 years ago

Hi and you're welcome!

It's not currently possible to change SOCKS settings with this project, mainly because the operating system has different APIs for that - similar to how HTTPS is separate from HTTP proxying.

It should be fairly easy to add SOCKS support. Though, I have never used a SOCKS proxy, so I may not be the best person to work on this! From what I can tell, implementing it should be a lot like implementing HTTPS support, which I hope to get around to at some point.

There's two main questions:

I'm not sure exactly where to draw the line in terms of scope. Perhaps I should aim to support all of the protocols that the major operating systems do, since this project is supposed to be an interface to the OS. But there are a few of them, like Gopher, that might make it seem bloated. And I'm not sure how many people need these other types.

In terms of the API, would you want something like:

The plugin idea is something I've been thinking about for HTTPS, because there are cases when the same proxy should handle both HTTP and HTTPS traffic. But there's no clean way to express that in the API with the other options (none that I like, anyway). So the plugin would provide at least part of the implementation for the basic methods like get(), set() etc. HTTP would still be a built-in default and the core would continue to be responsible for watching the filesystem for changes, etc.

Anyway, those are some ideas. Let me know what you think! I'll also need to know whether Windows and Linux handle SOCKS similarly to HTTP.

oyyd commented 7 years ago

As I know, all of the osx, ubuntu, and windows somehow support SOCKS though their implementations may differ from the others greatly. It would be nice if os-proxy would support SOCKS (to me, at least:) )

In terms of the API, the plugin idea seems to be flexible as we could provide an implementation outside of this repo. The other ideas look okay too.

I would like to help with this feature when I have time.