fix: zapret2 & naming fixes

This commit is contained in:
fufsob committed 2026-09-14 13:15:06 +00:00
1 parent eab3adf893
commit e2da83ba56
32 files changed
+580 -261

No files matched your search

+1 -1
View File
@@ -20,7 +20,7 @@ let
table = "proxy_suite_cutoff_probe";
# try-restart fails on a unit that is not installed, so only name the ones built.
restartUnits =
lib.optional cfg.zapret.enable "zapret-discord-youtube.service"
lib.optional cfg.zapret.enable "proxy-suite-zapret.service"
++ lib.optional cfg.perAppRouting.zapret.enable "proxy-suite-per-app-zapret.service";
z2kDetect = pkgs.buildGoModule {
+17 -3
View File
@@ -93,14 +93,28 @@ let
else
pkgs.writeText "proxy-suite-zapret2" (lib.concatStringsSep " " source.blobArgs);
# The state layer undoes a rotation when the host succeeded within 30 s, unless
# a failure came later; only z2k's own detector stamps that failure. Without the
# stamp any success on a busy host (all of googlevideo.com) undoes every rotation.
failStamp = pkgs.writeText "proxy-suite-zapret2-fail-stamp.lua" ''
local count = automate_failure_counter
function automate_failure_counter(hrec, crec, fails, maxtime)
if not (crec and crec.failure) then
hrec.z2k_last_fail_ts = type(clock_getfloattime) == "function" and clock_getfloattime() or os.time()
end
return count(hrec, crec, fails, maxtime)
end
'';
# The state layer wraps circular, so it loads after the source's Lua. z2k-tcp16
# does nothing until the cutoff probe has written its maps.
optPrefix = lib.concatStringsSep " " (
map (file: "--lua-init=@${file}") (
source.luaInit
++ map (name: "${zapret2Sources.z2k}/files/lua/${name}.lua") [
"z2k-tcp16"
"z2k-state-persist"
++ [
"${zapret2Sources.z2k}/files/lua/z2k-tcp16.lua"
failStamp
"${zapret2Sources.z2k}/files/lua/z2k-state-persist.lua"
]
)
++ lib.mapAttrsToList (name: file: "--blob=${name}:@${blobPath file}") zapret2Cfg.blobs
+5 -1
View File
@@ -61,7 +61,11 @@ let
# Its init script's order. QUIC reads the learned list but never adds to it:
# browsers retry over TCP. The UDP profile carries no SNI, so no lists.
profiles = [
(args "NFQWS_ARGS_UDP")
# Its first UDP strategy's fake has no blob, which zapret2 rejects on every
# packet; nfqws1's default for unknown UDP was 64 zero bytes.
(replaceStrings [ "--lua-desync=fake:repeats=6:strategy=1" ] [
"--lua-desync=fake:blob=0x${lib.fixedWidthString 128 "0" ""}:repeats=6:strategy=1"
] (args "NFQWS_ARGS_UDP"))
"${args "NFQWS_ARGS_QUIC"} <HOSTLIST_NOAUTO> ${lists}"
"${withSniPick (args "NFQWS_ARGS")} <HOSTLIST> ${lists}"
];