Creators and joiners, built from upstream's tag with upstream's patches (links and passwords from the environment, never argv), run by the service as whitelist-bypass.nix runs them: joiners while the proxy runs, as its outbounds, creators while the suite is on, their logins kept in a working copy they refresh. proxy-ctl wl list|link|auth|join|new|restart over new API requests (whitelistBypass scope). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
48 lines
2.3 KiB
Bash
Executable File
48 lines
2.3 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# whitelist-bypass's headless ends for Windows (creators and joiners: a tunnel through the media
|
|
# servers of video calls), built from upstream's tag as upstream's pkgs/whitelist-bypass.nix
|
|
# builds them: the call link, the local proxy's password and a joiner's SOCKS password read
|
|
# from the environment by default, never the command line (any local user reads that).
|
|
#
|
|
# tools/build-whitelist-bypass.sh OUT_DIR [GOOS] (needs git, go, sed; GOOS: windows)
|
|
set -euo pipefail
|
|
OUT=$(realpath -m "${1:?output directory}")
|
|
GOOS=${2:-windows}
|
|
VERSION=0.4.4
|
|
COMMIT=7c19a7ec40900940fe0c43ea1db7768ee632393d
|
|
WORK=$(mktemp -d)
|
|
trap 'rm -rf "$WORK"' EXIT
|
|
|
|
git -c advice.detachedHead=false clone -q --depth 1 --branch "v$VERSION" https://github.com/kulikov0/whitelist-bypass "$WORK/src"
|
|
[ "$(git -C "$WORK/src" rev-parse HEAD)" = "$COMMIT" ] || { echo "tag v$VERSION moved off $COMMIT"; exit 1; }
|
|
cd "$WORK/src"
|
|
|
|
# upstream's postPatch: flag.String("NAME", "", …) defaults to os.Getenv("VAR").
|
|
env_default() {
|
|
local file="headless/$1/main.go"
|
|
grep -q "flag.String(\"$2\", \"\"," "$file" || { echo "$file has no flag $2 to patch"; exit 1; }
|
|
sed -i "s|flag.String(\"$2\", \"\",|flag.String(\"$2\", os.Getenv(\"$3\"),|" "$file"
|
|
}
|
|
for p in vk telemost wbstream dion bitrix; do env_default "$p" upstream-pass WB_UPSTREAM_PASS; done
|
|
for p in bitrix dion dion-joiner wbstream wbstream-joiner; do env_default "$p" room WB_LINK; done
|
|
for p in telemost-joiner wbstream-joiner dion-joiner bitrix-joiner; do env_default "$p" socks-pass WB_SOCKS_PASS; done
|
|
env_default bitrix-joiner link WB_LINK
|
|
env_default telemost tm-link WB_LINK
|
|
env_default telemost-joiner tm-link WB_LINK
|
|
env_default vk vk-link WB_LINK
|
|
|
|
export GOTOOLCHAIN=local CGO_ENABLED=0 GOOS GOARCH=amd64
|
|
ext=
|
|
[ "$GOOS" = windows ] && ext=.exe
|
|
rm -rf "$OUT" && mkdir -p "$OUT"
|
|
# Upstream's names (build-headless.sh): headless-<platform>-creator and -joiner.
|
|
for p in vk telemost wbstream dion bitrix; do
|
|
go build -trimpath -ldflags "-s -w" -o "$OUT/headless-$p-creator$ext" "./headless/$p"
|
|
done
|
|
for p in telemost wbstream dion bitrix; do
|
|
go build -trimpath -ldflags "-s -w" -o "$OUT/headless-$p-joiner$ext" "./headless/$p-joiner"
|
|
done
|
|
cp LICENSE "$OUT/"
|
|
echo "$VERSION" >"$OUT/.version"
|
|
echo "whitelist-bypass $VERSION ($GOOS) in $OUT"
|