fix: zapret2 fixes and xray update

This commit is contained in:
FUFSoB committed 2026-10-23 23:56:33 +05:00
1 parent 20f1bdd110
commit 564ea9e24f
11 files changed
+219 -41

No files matched your search

+14
View File
@@ -50,6 +50,8 @@ let
daemonStart = zapret2Global.config.systemd.services.${globalService}.serviceConfig.ExecStart;
cutoffProbe =
zapret2Global.config.systemd.services.proxy-suite-zapret2-cutoff.serviceConfig.ExecStart;
z2kCutoffProbe =
zapret2Z2k.config.systemd.services.proxy-suite-zapret2-cutoff.serviceConfig.ExecStart;
socksStart = fixture: fixture.config.systemd.services.proxy-suite-socks.serviceConfig.ExecStart;
directSync = builtins.head (
lib.splitString " " zapret2Global.config.systemd.services.proxy-suite-zapret2-direct.serviceConfig.ExecStart
@@ -319,6 +321,13 @@ in
# nfqws2-keenetic learns with detect.lua too: its own profile only reads the auto list.
grep -qE -- " --new --filter-tcp=443 --filter-l7=tls --in-range=-s65536 --out-range=-s32768 --payload=all --lua-desync=ps_learn:auto=[^ ]+:exclude=[^ ]+/etc/nfqws2/lists/exclude.list,[^ ]+zapret-hosts-user-exclude.txt:" "${globalRuntime}/config"
test "$(grep -oF -- '<HOSTLIST>' "${globalRuntime}/config" | wc -l)" = 0
# The profile that takes the learned sites follows their transfers ahead of rotation,
# its filters back at their defaults after; circular keeps its name for its sites.
grep -qE -- " --in-range=-s65536 --payload=all --lua-desync=ps_watch:fails=3:time=300:win=32:log --in-range=x --payload=all --in-range=-s5556 [^ ]+ --lua-desync=circular:[^ ]*:key=circular_3_1:" "${globalRuntime}/config"
grep -qE -- " --lua-desync=ps_watch:fails=3:time=300:win=32:log --in-range=x --payload=all --out-range=-s34228 --in-range=-s5556 --lua-desync=z2k_sni_pick:[^ ]*:key=rkn_tcp:" "${z2kRuntime}/config"
test "$(grep -oF -- 'ps_watch:' "${z2kRuntime}/config" | wc -l)" = 1
if grep -qF -- 'ps_watch' "${tunedRuntime}/config"; then exit 1; fi
if grep -qF -- '<STALLWATCH>' "${tunedRuntime}/config"; then exit 1; fi
# Counted failures and switches, named by circular key and host; the switch
# is the one that stuck, after the state layer's revert.
LOG=$(grep -oE '/nix/store/[^ ]+-strategy-log\.lua' "${z2kRuntime}/config") lua -e '
@@ -456,6 +465,11 @@ in
printf '24940\t300.ya.ru\n14061\tad.adriver.ru\n' >sni.txt
test "$("$rules" asn.txt sni.txt nets.txt)" = '{"version":1,"rules":[]}'
# A name helps only where z2k's profiles put it in: elsewhere none is searched for,
# one kept from before is dropped, and every cut-off network goes to the proxy.
grep -qF -- 'if [ 0 = 0 ] && [ -s sni.txt ]; then' ${cutoffProbe}
grep -qF -- 'if [ 1 = 0 ] && [ -s sni.txt ]; then' ${z2kCutoffProbe}
# The probe is built from z2k's source and knows its tcp16 mode.
detect=$(grep -o '/nix/store/[^:]*-z2k-detect-[^:/]*/bin' ${cutoffProbe} | head -n1)
"$detect/z2k-detect" tcp16 -h 2>/dev/null
+28
View File
@@ -235,6 +235,34 @@ end
assert(verdicts()["149.154.167.99 ip"] == "blocked" and not verdicts()["192.168.1.1 ip"], "blocked by address")
syn("149.154.167.99", true)
assert(verdicts()["149.154.167.99 ip"] == "reachable", "an answer clears it")
-- A learned site a strategy got through, cut short past the first 4 KB since: three cut
-- transfers keep it on the proxy. Finished ones, ones the client hung up on, and ones
-- past the queue window say nothing.
local function watch(track, outgoing, opts) ps_watch(nil, packet(track, outgoing, opts)) end
for i = 1, 3 do
local t = flow("i.scdn.co")
watch(t, true, { l7 = "tls_client_hello", payload = "hello" })
watch(t, false, { s = 1, payload = record(16000) .. string.rep("x", 6000), n = 5 })
watch(t, false, { s = 6006, payload = string.rep("x", 2000), n = 7 })
fire("psws_")
assert((verdicts()["i.scdn.co cutoff"] == "stalls") == (i == 3), "stalls after three cut transfers")
end
for _, case in ipairs({ "whole", "hangup", "big" }) do
for _ = 1, 3 do
local t = flow(case .. ".example")
if case == "whole" then
watch(t, false, { s = 1, payload = record(3) .. "abc", n = 2 })
elseif case == "hangup" then
watch(t, false, { s = 1, payload = record(16000) .. "x", n = 2 })
watch(t, true, { flags = TH_FIN + 16 })
else
watch(t, false, { s = 1, payload = record(60000) .. "z", n = 32 })
end
fire("psws_")
end
assert(not verdicts()[case .. ".example cutoff"], case .. ": no verdict")
end
-- A wildcard domain whose every fresh name resets: past its share of the list, the site
-- itself is learned, which covers the rest, rather than one more name of it.
local f2 = io.open(auto, "a")