windows: zapret2 with z2k's strategies and upstream's Lua layers

The zapret2-extras component (tools/build-zapret2-extras.sh): z2k at
upstream's pinned commit, its strategies made by its own generator as
upstream's z2k-profiles.template.sh runs it, with tokens where upstream
fills in the configuration at build time; its Lua, lists and fakes; and
upstream's own Lua: the extended detector (detect.lua), the per-site key
by public suffix, the fail stamp, every-change persistence and the
strategy log.

winws2 now runs, as upstream's nfqws2 does, with z2k's Lua for its
strategies, then the layers: each site's working strategy kept across
restarts (z2k's state layer), strategies keyed by site, and with
autoHostlist.extendedDetection the detector learning in place of
nfqws2's own (its last TLS profile, the stall watch where the learned
sites are). Lua arguments name paths as Cygwin does (no colon); what
winws2 writes stays under the Low-integrity folder. The server's TLS
handshake and alert records reach the detectors through a WinDivert
filter part: WinDivert has no per-flow packet window to hand them over
by. Options go to winws2 in a file (@file): z2k's alone are 55 KB, past
a Windows command line.

Both sources, with every layer, verified by winws2's --dry-run under
Wine (tools/winws-dry-run.sh). The DPI page picks the strategies and
switches the detection. proxyFallback and the cutoff probe are said to
be not on Windows yet.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
faumarayandClaude Opus 5.5 committed 2026-10-27 18:10:57 +03:00
1 parent 0a7d8d99c0
commit 9eed225ccc
10 files changed
+471 -40

No files matched your search

+4
View File
@@ -22,6 +22,7 @@ tools/build-tg-ws-proxy.sh "$DIST/components/tg-ws-proxy"
tools/build-wireproxy-awg.sh "$DIST/components/wireproxy-awg" windows
tools/build-whitelist-bypass.sh "$DIST/components/whitelist-bypass" windows
tools/build-amneziawg.sh "$DIST/components/amneziawg"
tools/build-zapret2-extras.sh "$DIST/components/zapret2-extras"
cargo build -q --release -p ps-service
target/release/proxy-suite-service stage-components --to "$DIST/components" --cache "$CACHE"
rm -rf "$DIST"/components/*.old "$DIST"/components/*.staging
@@ -59,6 +60,9 @@ echo "== THIRD-PARTY.md"
echo "- **zapret2** (winws2.exe, its Lua) and **nfqws2-keenetic** (its strategies, lists, blobs): MIT, https://github.com/bol-van/zapret2, https://github.com/nfqws/nfqws2-keenetic"
echo "- **wintun** (inside sing-box): WireGuard's prebuilt-binary license, https://www.wintun.net"
echo "- **amneziawg-go** (inside wireproxy-awg, with the suite's patch, and inside amneziawg's awg-tunnel.exe): MIT, https://github.com/amnezia-vpn/amneziawg-go"
echo "- **z2k** (zapret2-extras: its strategies, made by its own generator, its Lua and lists): MIT, https://github.com/necronicle/z2k"
echo "- **The public suffix list** (zapret2-extras' public_suffixes.txt, derived): MPL-2.0, https://publicsuffix.org"
echo "- **proxy-suite's zapret2 Lua** (zapret2-extras' lua/: the extended detector and the layers around z2k's state): MIT, this repository's modules/proxy-suite/zapret2"
echo "- **Wintun** (amneziawg's wintun.dll, as WireGuard LLC builds and signs it): its prebuilt-binaries license, components/amneziawg/wintun-LICENSE.txt"
echo "- **Go modules** (inside wireproxy-awg and whitelist-bypass, e.g. Pion's WebRTC): as each project's go.mod pins them, under their own licenses (MIT, BSD-3-Clause, Apache-2.0)"
echo "- **lyrebird** and **conjure** (Tor's pluggable transports, in the Expert Bundle): their licenses are in components/tor/docs"
+23
View File
@@ -59,4 +59,27 @@ if out=$(cd "$Z2" && wine ./winws2.exe --dry-run "${args[@]}" 2>&1) && grep -q "
else
fail=$((fail + 1)); echo "FAIL: zapret2"; grep -v -i cygwin <<<"$out" | tail -4
fi
# With the zapret2-extras component: upstream's Lua layers loaded and the extended detector
# learning, for nfqws2-keenetic's strategies and for z2k's, with the environment the service
# gives winws2.
X="$STAGE/zapret2-extras"
if [ -d "$X" ]; then
cyg() { echo "/cygdrive/z$(realpath "$1")"; }
mkdir -p "$WORK/z2/learned/circular" "$WORK/z2/learned/run"
for kind in keenetic z2k; do
# Through an options file (@file), as the service starts winws2: z2k's run past the
# 32767 characters of a Windows command line. One a line, quoted when it holds a space.
{ echo --dry-run; target/debug/examples/zapret2_args "$Z2" "$(win "$Z2")" "$(win "$WORK/z2")" "$X" "$(win "$X")" "$(cyg "$X")/" "$kind"; } |
python3 -I -c 'import sys
for a in sys.stdin.read().splitlines():
print(("\"" + a.replace("\\", "\\\\").replace("\"", "\\\"") + "\"") if (" " in a or "\"" in a) else a)' >"$WORK/winws2.conf"
if out=$(cd "$Z2" && Z2K_STATE_DIR_OVERRIDE="$(cyg "$WORK/z2/learned/circular")" Z2K_AUTOCIRCULAR_FALLBACK_OVERRIDE="$(cyg "$WORK/z2/learned/run")" \
PROXY_SUITE_ZAPRET2_VERDICTS="$(cyg "$WORK/z2/learned")/verdicts.tsv" PROXY_SUITE_PUBLIC_SUFFIXES="$(cyg "$X")/public_suffixes.txt" \
WINEDEBUG=-all wine ./winws2.exe "@$(win "$WORK")winws2.conf" 2>&1) && grep -q "parameters verified" <<<"$out"; then
echo "zapret2 ($kind, extended detection, upstream's Lua layers): verified by winws2.exe, $(grep -c -- '--lua-init' "$WORK/winws2.conf") Lua files, $(wc -l <"$WORK/winws2.conf") options"
else
fail=$((fail + 1)); echo "FAIL: zapret2 ($kind with the extras)"; grep -v -i cygwin <<<"$out" | tail -6
fi
done
fi
[ "$fail" = 0 ]