blob: 4834b0dade47b0d17fe048e444e1f69177b65d63 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
#!/usr/bin/env sh
if [ "$ROUTE_TOR" = 1 ] || [ "$ROUTE_TOR" = 2 ]; then
cat > /etc/tor/torrc <<- EOF
Log notice stdout
SocksPort ${TOR_PORT:-9050} # Default: Bind to localhost:9050 for local connections.
MaxCircuitDirtiness ${MAX_CIRCUIT:-2700}
CircuitBuildTimeout ${CIRCUIT_TIMEOUT:-2700}
ExitNodes ${EXIT_NODES:-{CH\}}
ExcludeExitNodes ${EXCLUDE_EXIT_NODES:-{US\}}
StrictNodes 1
EOF
# check loop health tor
while :; do
if pgrep tor > /dev/null 2>&1; then
checkurl=$(curl --socks5 "localhost:${TOR_PORT:-9050}" -o /dev/null 2>&1 -s -w "%{http_code}\n" "${URL_CHECK:-https://www.youtube.com/results?search_query=rms}")
case ${checkurl} in
302|502|500) pkill tor > /dev/null 2>&1 && tor -f /etc/tor/torrc --runasdaemon 1 ;;
esac
else
tor -f /etc/tor/torrc --runasdaemon 1
fi
sleep 15
done
fi
|