1.8 KiB
CasTor 🦫
Tor HTTP proxy with balanced Tor instances.
Requirements
Usage
Quickstart
This command will start one Tor instance and HAProxy:
docker-compose up
The HTTP proxy will be running on port 8080.
Start multiple Tor instances
Use the docker-compose scale option to set the number of Tor instance to start
For instance to start 5 Tor instances:
docker-compose up --scale tor=5
Run proxy on a different port
Proxy port can be set using the environement varaible HTTP_PROXY_PORT
. You can specify it in the .env
file or dirrectly in the shell such as:
export HTTP_PROXY_PORT=8080
Test the proxy
Once the application is started, you can test your proxy with curl
:
# test without the proxy
$ curl https://ipinfo.io/ip
A.B.C.D # => your current IP address
# test with the proxy
$ curl -x http://localhost:8080 https://ipinfo.io/ip
W.X.Y.Z # => Tor exit node IP address
How is it working ?
When you run the command docker-compose up
, you start at least 3 services (more if you scaled up the number of Tor instances): tor, conf-generator and haproxy.
The first service started is tor, this service is running a Tor instance with a Tor HTTP Tunnel (mandatory to have an HTTP proxy rather than a sock proxy).
The second service is conf-generator, this services runs a python script that does the following things:
- get all the IP address of the Tor instances within the docker network (using the Docker API)
- generate an HAProxy configuration file with the retrieved IPs
The final service is an HAProxy load balancer using the configuration file generated by conf-generator.