Sam - September 21, 2016
So you have purchased a paid or found a free SOCKS server but your software requires a HTTPS proxy, here is how you can convert it to work with HTTP & HTTPS proxy protocols.
In this quick tutorial we will be using the free software available on http://www.delegate.org/delegate/
DeleGate is a general purpose proxy server that supports HTTP, HTTPS, SOCKS4, SOCKS4a and SOCKS5 protocols.
You can do much more than just host a “proxy server” with DeleGate, you can also relay other proxies and convert protocols with full ACL (access control list) support.
Additionally it can also be a proxy for protocol specific functions such as DNS, SMTP, IMAP, etc
A full list of supported functionality can be found here: http://www.delegate.org/delegate/Manual.shtml
To convert your SOCKS proxy into a HTTP(S) proxy do the following:
Choose your binary (already compiled) distribution from this URL:
http://delegate.hpcc.jp/anonftp/DeleGate/download.html
We will be installing it on an Ubuntu server so we will choose the Linux distribution
wget "http://delegate.hpcc.jp/anonftp/DeleGate/bin/linux/latest/linux2.6-dg9_9_13.tar.gz"
output:
--2016-09-21 01:50:19-- http://delegate.hpcc.jp/anonftp/DeleGate/bin/linux/latest/linux2.6-dg9_9_13.tar.gz
Resolving delegate.hpcc.jp (delegate.hpcc.jp)... 163.220.3.3
Connecting to delegate.hpcc.jp (delegate.hpcc.jp)|163.220.3.3|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 3018925 (2.9M) [application/octet-stream]
Saving to: ‘linux2.6-dg9_9_13.tar.gz’
linux2.6-dg9_9_13.tar.gz 100%[============================================================================>] 2.88M 4.20MB/s in 0.7s
2016-09-21 01:50:20 (4.20 MB/s) - ‘linux2.6-dg9_9_13.tar.gz’ saved [3018925/3018925]
Then extract the archive using tar
tar xf linux2.6-dg9_9_13.tar.gz
Now the folder dg9_9_13 will be available in the same directory
root@vpn-tutorial:~/tutorial# ls
dg9_9_13 linux2.6-dg9_9_13.tar.gz
Great, now the binary file that we want to use is located in ./dg9_9_13/DGROOT/bin/dg9_9_13
You can make this more accessible by placing this in /usr/local/bin/ by executing the following command:
sudo mv ./dg9_9_13/DGROOT/bin/dg9_9_13 /usr/local/bin/delegate
Now the quickest and simplest way to convert your SOCKS4 or SOCKS5 proxy to a HTTP(S) proxy is by executing this command:
delegate ADMIN="contact@localhost" -Plocalhost:2000 SERVER=https SOCKS=PROXYIP:PORT RELAY=proxy PERMIT="*:*:localhost.localdomain" -v
Break down of parameters
ADMIN=”contact@localhost”
This is a required parameter and you can place any kind of string here it doesn’t have to be an email address
-Plocalhost:2000
This is your listening IP:Port in this case I chose localhost so it doesn’t allow open access to the world. You can change this to your IP address if you want to use it remotely.
SERVER=https
This is what kind of server we want to be, you can change this to SOCKS if you want to relay SOCKS to SOCKS instead of HTTPS to SOCKS
SOCKS=PROXYIP:PORT
This is the actual proxy we are using
RELAY=proxy
DeleGate supports a few type of relaying methods which I won’t go into here but for our example you need to set it as proxy. Full details here: http://www.delegate.org/delegate/Manual.shtml?RELAY
PERMIT=”*:*:localhost.localdomain”
You can restrict the type of traffic with this parameter and the location *:* means any type of traffic followed by :localhost means the source IP (in this case just our local host). You could restrict the proxy to only allow http://www traffic using this PERMIT=”http:www:localhost”
-v
Verbose! Let’s see the output for debugging purposes.
Running this command will give you a bunch of output and if there were any errors that it cannot handle it will simply exit
Now using another terminal window you can test the proxy and if you kept localhost permit directive then make sure you’re executing this command from the same server.
Command:
curl -x localhost:2000 ip-api.com/json -v
output:
* Trying ::1...
* connect to ::1 port 2000 failed: Connection refused
* Trying 127.0.0.1...
* Connected to localhost (127.0.0.1) port 2000 (#0)
> GET http://ip-api.com/json HTTP/1.1
> Host: ip-api.com
> User-Agent: curl/7.47.0
> Accept: */*
> Proxy-Connection: Keep-Alive
>
< HTTP/1.1 200 OK
< DeleGate-Ver: 9.9.13 (delay=11)
< Access-Control-Allow-Origin: *
< Content-Type: application/json; charset=utf-8
< Date: Wed, 21 Sep 2016 02:22:41 GMT
< Via: 1.1 - (DeleGate/9.9.13)
< Proxy-Connection: keep-alive, timeout=60, maxreq=60
< Content-Length: 320
<
* Connection #0 to host localhost left intact
{"as":"AS20473 Choopa, LLC","city":"Singapore","country":"Singapore","countryCode":"SG","isp":"Choopa, LLC","lat":1.2931,"lon":103.8558,"org":"Vultr Holdings, LLC","query":"45.32.109.73","region":"01","regionName":"Central Singapore Community Development Council","status":"success","timezone":"Asia/Singapore","zip":""}
That’s all I’ll be covering in this quick tutorial, there’s genuinely a whole heap of stuff you can do with DeleGate and I would encourage you to checkout their online Manual. If you have any issues following this tutorial then feel free to comment below and I’ll try to trouble shoot it with you.