sorry i dont know that address = vanguard
This commit is contained in:
parent
f2f80cfa03
commit
6e17d8bec4
1 changed files with 23 additions and 6 deletions
|
|
@ -13,9 +13,15 @@ if [ "$1" = "vanguards" ]; then
|
||||||
TARGET_PORT=9051
|
TARGET_PORT=9051
|
||||||
|
|
||||||
echo "Waiting for Tor Control Port at $TARGET_HOST:$TARGET_PORT..."
|
echo "Waiting for Tor Control Port at $TARGET_HOST:$TARGET_PORT..."
|
||||||
while ! nc -z "$TARGET_HOST" "$TARGET_PORT"; do
|
# Use Python to wait for the port (more reliable than Alpine's nc)
|
||||||
sleep 1
|
python3 -c "import socket, time;
|
||||||
done
|
while True:
|
||||||
|
try:
|
||||||
|
with socket.create_connection(('$TARGET_HOST', $TARGET_PORT), timeout=1):
|
||||||
|
break
|
||||||
|
except (OSError, ConnectionRefusedError):
|
||||||
|
time.sleep(1)"
|
||||||
|
|
||||||
echo "Tor is awake! Resolving IP..."
|
echo "Tor is awake! Resolving IP..."
|
||||||
|
|
||||||
# Fix for ValueError: Invalid IP address
|
# Fix for ValueError: Invalid IP address
|
||||||
|
|
@ -93,11 +99,22 @@ if [ -n "$HIDDEN_SERVICE_HOSTS" ]; then
|
||||||
HOST=$(echo "$rule" | cut -d: -f2)
|
HOST=$(echo "$rule" | cut -d: -f2)
|
||||||
INT_PORT=$(echo "$rule" | cut -d: -f3)
|
INT_PORT=$(echo "$rule" | cut -d: -f3)
|
||||||
|
|
||||||
# Sanitize HOST (remove carriage returns)
|
# Sanitize HOST
|
||||||
HOST_CLEAN=$(echo "$HOST" | tr -d '\r')
|
HOST_CLEAN=$(echo "$HOST" | tr -d '\r')
|
||||||
|
|
||||||
echo "Adding Hidden Service Rule: Onion:$EXT_PORT -> $HOST_CLEAN:$INT_PORT"
|
# RESOLVE HOST TO IP FOR TOR
|
||||||
echo "HiddenServicePort $EXT_PORT $HOST_CLEAN:$INT_PORT" >> "$TOR_CONFIG"
|
# Tor is picky about hostnames in HiddenServicePort configs sometimes.
|
||||||
|
# We pre-resolve it to be safe.
|
||||||
|
echo "Resolving $HOST_CLEAN..."
|
||||||
|
if ! HOST_IP=$(python3 -c "import socket; print(socket.gethostbyname('$HOST_CLEAN'))" 2>/dev/null); then
|
||||||
|
echo "Warning: Could not resolve '$HOST_CLEAN'. Using hostname directly."
|
||||||
|
HOST_IP=$HOST_CLEAN
|
||||||
|
else
|
||||||
|
echo "Resolved $HOST_CLEAN to $HOST_IP"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Adding Hidden Service Rule: Onion:$EXT_PORT -> $HOST_IP:$INT_PORT"
|
||||||
|
echo "HiddenServicePort $EXT_PORT $HOST_IP:$INT_PORT" >> "$TOR_CONFIG"
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
echo "Warning: HIDDEN_SERVICE_HOSTS is empty. Tor will run but host nothing."
|
echo "Warning: HIDDEN_SERVICE_HOSTS is empty. Tor will run but host nothing."
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue