aboutsummaryrefslogtreecommitdiffstats
path: root/core/entrypoint-tor.sh
diff options
context:
space:
mode:
authorJesús <heckyel@hyperbola.info>2021-08-01 22:41:02 -0500
committerJesús <heckyel@hyperbola.info>2021-08-01 22:41:02 -0500
commita0c6b0c8e22d4c6119eb26fa62d0a39ae4400501 (patch)
tree1d7ea763d460a8bd3200eedfe12fcf9e8ff8f1a2 /core/entrypoint-tor.sh
parentae37d5106ff855731280834c791b2f4bc684d96c (diff)
downloadyt-local-docker-a0c6b0c8e22d4c6119eb26fa62d0a39ae4400501.tar.lz
yt-local-docker-a0c6b0c8e22d4c6119eb26fa62d0a39ae4400501.tar.xz
yt-local-docker-a0c6b0c8e22d4c6119eb26fa62d0a39ae4400501.zip
refactory syntax entrypoint-tor
Diffstat (limited to 'core/entrypoint-tor.sh')
-rw-r--r--core/entrypoint-tor.sh18
1 files changed, 8 insertions, 10 deletions
diff --git a/core/entrypoint-tor.sh b/core/entrypoint-tor.sh
index 90a49c5..17f526f 100644
--- a/core/entrypoint-tor.sh
+++ b/core/entrypoint-tor.sh
@@ -4,23 +4,21 @@ 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:-300}
-CircuitBuildTimeout ${CIRCUIT_TIMEOUT:-300}
+MaxCircuitDirtiness ${MAX_CIRCUIT:-2700}
+CircuitBuildTimeout ${CIRCUIT_TIMEOUT:-2700}
ExcludeExitNodes {US}
StrictNodes 1
EOF
- tor -f /etc/tor/torrc --runasdaemon 1
-
# check loop health tor
while :; do
- if pgrep tor > /dev/null; then
- checkurl=$(curl --socks5 "localhost:${TOR_PORT:-9050}" -o /dev/null -s -w "%{http_code}\n" "${URL_CHECK:-https://www.youtube.com/results?search_query=rms}")
- if [ "$checkurl" = '502' ] || [ "$checkurl" = '302' ]; then
- pkill tor && tor -f /etc/tor/torrc --runasdaemon 1
- fi
+ 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) pkill tor > /dev/null 2>&1 && tor -f /etc/tor/torrc --runasdaemon 1 ;;
+ esac
else
tor -f /etc/tor/torrc --runasdaemon 1
fi
- sleep 5
+ sleep 15
done
fi