Skip to content

Commit 6aafb28

Browse files
committed
Update README.md
1 parent 6bc21a8 commit 6aafb28

File tree

1 file changed

+27
-3
lines changed

1 file changed

+27
-3
lines changed

README.md

+27-3
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ it can significantly cut-down load times for correctly scaled applications by do
88

99
- creating a very large number of tor circuits
1010
- surfacing a single-ingress SOCKS5 proxy
11-
- adequatley load-balance backend connections
12-
- performing health-checks against each backend tor cirtuit
11+
- adequately load-balance backend connections
12+
- performing health-checks against each backend tor circuit
1313
- serving a load balancer monitoring dashboard
1414

1515
_multisocks is a fork/derivative of the excellent [Iglesys347/castor](https://github.com/Iglesys347/castor)_
@@ -70,6 +70,14 @@ to view the status of haproxy, navigate to `your-multisocks-host:1337` in a brow
7070

7171
![haproxy stats, example](.github/ha-stats.png)
7272

73+
to fetch state of each circuit you could leverage something similar to the below
74+
75+
```shell
76+
watch -n 5 "curl -s 'http://localhost:1337/;csv' \
77+
| awk -F ',' '{print \$2 \" - \" \$18}' \
78+
| grep -v 'status\|FRONT\|BACK'"
79+
```
80+
7381
## debugging
7482

7583
to trail logs, leverage `docker compose logs`
@@ -81,7 +89,7 @@ docker compose logs --timestamps --follow
8189

8290
to enter a shell in a running container, use `docker exec`.
8391

84-
to view your container names use `docker ls ` - replace `multisocks-haproxy` accordingly
92+
to view your container names use `docker ps ` - replace `multisocks-haproxy` accordingly
8593

8694
```shell
8795
docker exec -it -u root multisocks-haproxy ash
@@ -108,3 +116,19 @@ curl -sL ransomwhat.telemetry.ltd/groups \
108116
| jq -r '.[].locations[] | select(.available==true) | .slug' \
109117
| head -n 10
110118
```
119+
120+
## notes
121+
122+
the current health-check implementation leaves much room for improvement. it uses netcat to send an _authenticated_ telnet command `getinfo circuit-status`. an alternate could be to use stem, with something like the below
123+
124+
```python
125+
import stem.control
126+
def is_circuit_built():
127+
with stem.control.Controller.from_port(port=9051) as controller:
128+
controller.authenticate()
129+
circs = controller.get_circuits()
130+
for circ in circs:
131+
if circ.status == 'BUILT':
132+
return True
133+
return False
134+
```

0 commit comments

Comments
 (0)