windows: zapret-discord-youtube and tg-ws-proxy
zapret: Flowseal's release run as its service.bat runs it: the preset's winws.exe line (continuations, cmd's caret escapes, %BIN%, %LISTS%, the game filter) as winws's arguments, the user's domains and addresses in the lists upstream's module puts them in (kept in the service's own run directory, the verified release untouched), TCP timestamps on, and zapret's sites in the proxy's direct list. tools/winws-dry-run.sh has the release's own winws.exe verify every preset's arguments under Wine: all 22, both game filters. tg-ws-proxy: Flowseal's headless proxy on the embeddable CPython 3.12 with hash-pinned win_amd64 wheels (tools/build-tg-ws-proxy.sh), run with upstream's flags; its relay goes direct under the TUN. Runs under Wine. proxy-ctl: zapret status|on|off|preset|game-filter, components list|install. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
817de77d28
commit
9b0d7021f9
12 files changed
+873
-1
No files matched your search
Executable
+36
@@ -0,0 +1,36 @@
|
||||
#!/usr/bin/env bash
|
||||
# tg-ws-proxy for Windows: Flowseal's source (the headless proxy, not the tray app) on the
|
||||
# official embeddable CPython, with its dependencies as pinned win_amd64 wheels. Everything is
|
||||
# verified: the Python archive and every wheel by hash, the source by its commit.
|
||||
#
|
||||
# tools/build-tg-ws-proxy.sh OUT_DIR (needs curl, git, unzip, pip)
|
||||
set -euo pipefail
|
||||
cd "$(dirname "$0")"
|
||||
OUT=${1:?output directory}
|
||||
PY_VERSION=3.12.10
|
||||
PY_URL=https://www.python.org/ftp/python/$PY_VERSION/python-$PY_VERSION-embed-amd64.zip
|
||||
PY_SHA256=4acbed6dd1c744b0376e3b1cf57ce906f9dc9e95e68824584c8099a63025a3c3
|
||||
TG_TAG=v1.11.2
|
||||
TG_COMMIT=307a384ab7f522e34bb1a045884d0bd90f40bee5
|
||||
WORK=$(mktemp -d)
|
||||
trap 'rm -rf "$WORK"' EXIT
|
||||
|
||||
rm -rf "$OUT" && mkdir -p "$OUT/python" "$OUT/app"
|
||||
curl -sSfL -o "$WORK/python.zip" "$PY_URL"
|
||||
echo "$PY_SHA256 $WORK/python.zip" | sha256sum -c --quiet
|
||||
unzip -q "$WORK/python.zip" -d "$OUT/python"
|
||||
|
||||
pip download -q --require-hashes --no-deps --only-binary=:all: --platform win_amd64 \
|
||||
--python-version 3.12 --implementation cp --dest "$WORK/wheels" -r tg-ws-proxy-requirements.txt
|
||||
mkdir -p "$OUT/python/Lib/site-packages"
|
||||
for w in "$WORK"/wheels/*.whl; do unzip -q -o "$w" -d "$OUT/python/Lib/site-packages"; done
|
||||
|
||||
git clone -q --depth 1 --branch "$TG_TAG" https://github.com/Flowseal/tg-ws-proxy "$WORK/src"
|
||||
[ "$(git -C "$WORK/src" rev-parse HEAD)" = "$TG_COMMIT" ] || { echo "tag $TG_TAG moved off $TG_COMMIT"; exit 1; }
|
||||
cp -r "$WORK/src/proxy" "$WORK/src/utils" "$WORK/src/LICENSE" "$OUT/app/"
|
||||
|
||||
# The embeddable Python reads its path from this file alone: the standard library, the
|
||||
# wheels, and the source.
|
||||
printf 'python312.zip\n.\nLib\\site-packages\n..\\app\nimport site\n' > "$OUT/python/python312._pth"
|
||||
echo "${TG_TAG#v}+py$PY_VERSION" > "$OUT/.version"
|
||||
echo "tg-ws-proxy ${TG_TAG#v} on Python $PY_VERSION in $OUT"
|
||||
@@ -0,0 +1,15 @@
|
||||
# tg-ws-proxy's dependencies for Windows (win_amd64, CPython 3.12), as wheels, by hash.
|
||||
# Resolved from its pyproject (httpx[http2]==0.28.1, cryptography==46.0.5, certifi): what proxy/ imports.
|
||||
anyio==4.15.1 --hash=sha256:6152fdbbf9a77fdec97731721bebf7c4c44f7c29b424b0065826173efc7ed101
|
||||
certifi==2026.10.23 --hash=sha256:e9b54de76e530bb6cf0ccd036787103acb58fd42ba930ea8bf948ddbaa2f61d1
|
||||
cffi==2.1.1 --hash=sha256:f53e442b08449d42821fa4a4fba000095af9f62742a500f978a9f557ec44339a
|
||||
cryptography==46.0.5 --hash=sha256:38946c54b16c885c72c4f59846be9743d699eee2b69b6988e0a00a01f46a61a4
|
||||
h11==0.16.0 --hash=sha256:63cf8bbe7522de3bf65932fda1d9c2772064ffb3dae62d55932da54b31cb6c86
|
||||
h2==4.4.1 --hash=sha256:0e25f1462b23c9cb82d9eb02e28bc706dac2a68cb457c6a0d74d63c8a2a5d0e6
|
||||
hpack==4.2.0 --hash=sha256:858ac0b02280fa582b5080d68db0899c62a80375e0e5413a74970c5e518b6986
|
||||
httpcore==1.0.9 --hash=sha256:2d400746a40668fc9dec9810239072b40b4484b640a8c38fd654a024c7a1bf55
|
||||
httpx==0.28.1 --hash=sha256:d909fcccc110f8c7faf814ca82a9a4d816bc5a6dbfea25d6591d6985b8ba59ad
|
||||
hyperframe==6.1.0 --hash=sha256:b03380493a519fce58ea5af42e4a42317bf9bd425596f7a0835ffce80f1a42e5
|
||||
idna==3.20 --hash=sha256:ab7ae7122974553370f0bdb919e1a960b2cd1bc1ef0276416d896db81c14582c
|
||||
pycparser==3.12 --hash=sha256:a076f3f489b39b43ed13563a1dafe42447445bec2e294154ec5c57fcdda4c85e
|
||||
typing-extensions==4.16.0 --hash=sha256:481caa481374e813c1b176ada14e97f1f67a4539ce9cfeb3f350d78d6370c2e8
|
||||
Executable
+33
@@ -0,0 +1,33 @@
|
||||
#!/usr/bin/env bash
|
||||
# Every preset of Flowseal's release, with the arguments and lists the service builds,
|
||||
# checked by its own winws.exe (`--dry-run`) under Wine.
|
||||
#
|
||||
# nix develop --command nix shell nixpkgs#wineWow64Packages.stable -c tools/winws-dry-run.sh STAGE_DIR
|
||||
set -euo pipefail
|
||||
cd "$(dirname "$0")/.."
|
||||
STAGE=${1:?staged components directory}
|
||||
REL="$STAGE/zapret"
|
||||
WORK=$(mktemp -d)
|
||||
export WINEPREFIX=${WINEPREFIX:-$WORK/prefix} WINEDEBUG=-all
|
||||
trap 'wineserver -k 2>/dev/null || true; rm -rf "$WORK"' EXIT
|
||||
cargo build -q -p ps-core --example zapret_args
|
||||
win() { echo "Z:$(realpath "$1" | sed 's|/|\\|g')\\"; }
|
||||
# The lists as the service writes them: the release's, and the user's placeholders.
|
||||
mkdir -p "$WORK/lists" && cp "$REL"/lists/*.txt "$WORK/lists/"
|
||||
echo domain.example.abc > "$WORK/lists/list-general-user.txt"
|
||||
echo domain.example.abc > "$WORK/lists/list-exclude-user.txt"
|
||||
echo 203.0.113.113/32 > "$WORK/lists/ipset-exclude-user.txt"
|
||||
fail=0 n=0
|
||||
while IFS= read -r preset; do
|
||||
for game in null all; do
|
||||
mapfile -t args < <(target/debug/examples/zapret_args "$REL" "$(win "$REL")" "$(win "$WORK/lists")" "$preset" "$game")
|
||||
n=$((n + 1))
|
||||
if out=$(cd "$REL/bin" && wine ./winws.exe --dry-run "${args[@]}" 2>&1) && grep -q "parameters verified" <<<"$out"; then
|
||||
:
|
||||
else
|
||||
fail=$((fail + 1)); echo "FAIL: $preset ($game)"; grep -v Cygwin <<<"$out" | tail -4
|
||||
fi
|
||||
done
|
||||
done < <(ls "$REL"/*.bat | xargs -n1 -d '\n' basename | grep -vi '^service' | sed 's/\.bat$//')
|
||||
echo "$((n - fail))/$n preset runs verified by winws.exe"
|
||||
[ "$fail" = 0 ]
|
||||
Reference in new issue
Block a user