Is there any command line tool can be used to convert a Socks5 proxy to HTTP proxy?
I searched for an answer from 2015 that said I could use Polipo, but it has been discontinued.
Is there any other tool can do it? Thanks a lot.
Is there any command line tool can be used to convert a Socks5 proxy to HTTP proxy?
I searched for an answer from 2015 that said I could use Polipo, but it has been discontinued.
Is there any other tool can do it? Thanks a lot.
This can be done with gost, which can serve proxies using many proxy protocols and tunnel traffic through to others.
$ gost -L=http://:8080 -F=socks5://proxy.domain.name:1080
Basically, SOCKS5 and HTTP speak completely different languages, so you can't just 'convert' a SOCKS5 to an HTTP proxy. You need to run some kind of intermediate software that will handle the handoff between the two proxies.
NOTE: This is an untested solution because I have no proxies on my network for testing. However, the concept and configuration appears to be sound for proxying proxy traffic, though again this is untested.
There is a project out there called python-proxy
(pproxy
is the executable). It is not my project, but it seems like this is capable of doing proxy-to-proxy conversion and handoff.
To start, install this on whichever system is going to run your HTTP proxy that Synology can talk to, even if it's on your SOCKS5 proxy server. Install python3-pip
first so you can use PyPI projects and software:
sudo apt install python3-pip
sudo pip3 install pproxy[accelerated]
This will install the Python proxy tool system wide, and have C-library integrations that will improve performance. If for some reason this doesn't install properly, then just use the plain pproxy tool after making sure you remove pproxy accelerated first (just say yes if it prompts at uninstall, if it says its not installed then just do the install command):
sudo pip3 uninstall pproxy
sudo pip3 install pproxy
NOTE: I'm assuming that the connection is your Synology to an HTTP proxy, and then you want to hand the HTTP proxy stuff off to a SOCKS5 proxy. You can clarify in response to my comment on your question and I will alter this answer accordingly.
Then, theoretically, you would use this to run it on the system that will 'host' this 'http to socks5' proxy tool:
pproxy -l http://0.0.0.0:8080 -ru socks5://socks5.proxy.ip.or.domain:port
You would then point your Synology NAS to the http address and port combo for the system running the tool (if that server running pproxy
has IP 10.20.30.40
then you would point the NAS at http://10.20.30.40:8080
for the proxy)
This should, in theory, handle the 'proxy handoff' between two different proxy types.
Again, I have not tested this, but the code and proxy theory do appear to be sound.
How I solved this:
tsocks
package (very useful tool on its own) and configure it for using your SOCKS5 proxy - this allows to tunnel some programs like apt
via SOCKS5 (although not everything will work)tinyproxy-bin
package, default configuration file example can be found at https://tinyproxy.github.io ; There is also tinyproxy
package, but I only needed tinyproxy
binary.tsocks tinyproxy -d -c ~/tinyproxy.conf
(example that will not daemonize and assumes that the sample configuration file is created in home directory)Alternatively, you may try different options (tinyproxy
package, daemonize) but I didn't test them.