#!/bin/sh # End-to-end test for creator --upstream-socks, on Telemost. # # A telemost creator JOINS an existing conference (your call link, never created # here) and a telemost joiner joins the same conference to form the tunnel. We run # the pair twice - once with direct egress, once with -upstream-socks - and assert # the joiner's public egress IP CHANGES. A changed IP proves the joiner's traffic # left through the upstream SOCKS5 (your VPN client -> VPS) instead of this host. # # Needs: a real upstream SOCKS5 proxy whose exit IP differs from this machine # (an actual VPN client pointing at a VPS), plus Yandex cookies and a live call link. # # Usage: # UPSTREAM_SOCKS=127.0.0.1:1080 ./test-upstream-socks.sh # UPSTREAM_SOCKS=127.0.0.1:1080 UPSTREAM_USER=u UPSTREAM_PASS=p \ # ./test-upstream-socks.sh https://telemost.yandex.ru/j/ set -u ROOT="$(cd "$(dirname "$0")/../.." && pwd)" CREATOR="$ROOT/headless/telemost/headless-telemost-creator" JOINER="$ROOT/headless/telemost-joiner/headless-telemost-joiner" SOCKS_PORT=11080 IP_URL="https://api.ipify.org" SETTLE_TIMEOUT=45 PROBE_TIMEOUT=15 if [ $# -lt 2 ]; then echo "Usage: UPSTREAM_SOCKS=host:port $0 " >&2 exit 2 fi COOKIES="$1" TM_LINK="$2" if [ -z "${UPSTREAM_SOCKS:-}" ]; then echo "FAIL: set UPSTREAM_SOCKS=host:port (a real SOCKS5 proxy / VPN client whose exit IP differs from this host)" >&2 exit 2 fi [ -x "$CREATOR" ] || { echo "FAIL: missing $CREATOR (run ./build-headless.sh first)" >&2; exit 2; } [ -x "$JOINER" ] || { echo "FAIL: missing $JOINER (run ./build-headless.sh first)" >&2; exit 2; } [ -f "$COOKIES" ] || { echo "FAIL: cookies not found at: $COOKIES" >&2; exit 2; } echo "cookies=$COOKIES tm-link=$TM_LINK upstream=$UPSTREAM_SOCKS" CREATOR_PID="" JOINER_PID="" kill_pair() { [ -n "$JOINER_PID" ] && kill "$JOINER_PID" 2>/dev/null [ -n "$CREATOR_PID" ] && kill "$CREATOR_PID" 2>/dev/null wait 2>/dev/null JOINER_PID="" CREATOR_PID="" } trap kill_pair EXIT INT TERM # run_chain