fix: better logs and zapret2

This commit is contained in:
FUFSoB committed 2026-10-04 17:43:33 +05:00
1 parent 552bfd53b1
commit 2452d6fbe1
8 files changed
+121 -27

No files matched your search

+27 -8
View File
@@ -106,18 +106,37 @@ let
src = sources.z2k;
generator = builtins.readFile "${src}/lib/config_official.sh";
ports = name: between "config_official.sh" "\n${name}=\"" "\"" generator;
# Its silence detector, the only one that sees a dead QUIC flow (it sends less, not
# more), knows the YouTube pools alone; rkn_quic (z2k-profiles.template.sh) joins them.
# It took any reply for an answer, but DPI that lets the server's first flight through
# and drops the rest leaves a flow dead with a reply or two (every Discord host): such
# a flow neither failed nor, past udp_in, succeeded, and rotation never moved. A flow
# is answered now past udp_in replies, as the success detector judges it.
quicSilence = pkgs.writeText "z2k-quic-silence.lua" (
lib.pipe (builtins.readFile "${src}/files/lua/z2k-quic-silence.lua") [
(patch "z2k-quic-silence.lua" "local Z2K_QUIC_POOLS = { yt_quic = true, gv_quic = true }"
"local Z2K_QUIC_POOLS = { yt_quic = true, gv_quic = true, rkn_quic = true }"
)
(patch "z2k-quic-silence.lua"
" if not desync.outgoing then\n crec.z2k_quic_answered = true\n"
" if not desync.outgoing then\n if (pos_get(desync, 'n') or 0) > (tonumber(desync.arg.udp_in) or 1) then crec.z2k_quic_answered = true end\n"
)
]
);
in
{
# Its S99zapret2 order. z2k-range-rand resolves the ranges its strategies
# write (repeats=6-10); without it nfqws2 sends each fake once.
luaInit = map (name: "${src}/files/lua/${name}.lua") [
"z2k-alert"
"z2k-quic-silence"
"z2k-tcp16"
"z2k-fooling-ext"
"z2k-range-rand"
"z2k-modern-core"
];
luaInit =
map (name: if name == "z2k-quic-silence" then quicSilence else "${src}/files/lua/${name}.lua")
[
"z2k-alert"
"z2k-quic-silence"
"z2k-tcp16"
"z2k-fooling-ext"
"z2k-range-rand"
"z2k-modern-core"
];
# As its S99zapret2 runs nfqws2: a connection without SNI (some TVs and apps, a
# SYN before the ClientHello its syndata strategies act on) takes the name last
# seen on that IP, so it still meets its site's profile and strategy.
@@ -70,6 +70,32 @@ awk -v disc="--hostlist=$root/lists/discovered-domains.txt" \
printf " --new --filter-tcp=%s --filter-l7=tls %s%s <HOSTLIST>%s", ports[learner], wl, esuf, hsuf
}' raw >body
# QUIC to blocked sites: z2k rotates QUIC strategies over YouTube's list alone, and DPI
# drops QUIC to the rest by name (every Discord host), so a browser stalls on each
# HTTP/3 attempt before it falls back to TCP. rkn_quic is its YouTube QUIC profile over
# the sites rkn_tcp handles, right after it: YouTube's hosts still meet yt_quic first.
# Its udp_in is 4: there DPI lets the server's first flight (two packets from Cloudflare)
# through before it drops the flow, which at udp_in=1 counted as a success and undid
# every failure counted; a real handshake brings back more.
awk -v yt="--hostlist=$root/extra_strats/UDP/YT/List.txt" \
-v rkn="--hostlist=$root/extra_strats/TCP/RKN/List.txt --hostlist=$root/extra_strats/TCP_Discord.txt <HOSTLIST_NOAUTO>$hostlistSuffix" '
{
n = split($0, p, / --new /)
for (i = 1; i <= n; i++) {
printf "%s%s", (i > 1 ? " --new " : ""), p[i]
if (p[i] ~ /key=yt_quic:/ && (k = index(p[i], yt))) {
q = substr(p[i], 1, k - 1) rkn substr(p[i], k + length(yt))
gsub(/key=yt_quic:/, "key=rkn_quic:", q)
if (!sub(/:udp_in=1:/, ":udp_in=4:", q)) { print "z2k YouTube QUIC udp_in=1 not found" > "/dev/stderr"; exit 1 }
printf " --new %s", q
found++
}
}
}
END { if (found != 1) { print "z2k YouTube QUIC profile not found" > "/dev/stderr"; exit 1 } }
' body >body.quic
mv body.quic body
awk -v z=@z2k@ '
match($0, /^([A-Z0-9_]+_BLOB)="\$ZAPRET_BASE\/([^"]+)"/, m) { file[m[1]] = m[2] }
match($0, /--blob=([a-z0-9_]+):@\$([A-Z0-9_]+_BLOB)/, m) { printf "--blob=%s:@%s/%s ", m[1], z, file[m[2]] }