Tor HTTP proxy with load balancer
Find a file
2022-11-09 21:57:34 +01:00
conf-generator Initial commit 2022-11-09 21:57:34 +01:00
docs Initial commit 2022-11-09 21:57:34 +01:00
tor Initial commit 2022-11-09 21:57:34 +01:00
docker-compose.yml Initial commit 2022-11-09 21:57:34 +01:00
README.md Initial commit 2022-11-09 21:57:34 +01:00

CasTor 🦫

Tor HTTP proxy with balanced Tor instances.

Tor balance schema

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:

  1. get all the IP address of the Tor instances within the docker network (using the Docker API)
  2. 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.