Co-authored-by: GPT-6 <gpt-6@openai.com>
zapret2-autotune
Go CLI for scanning and checking YouTube TLS bypass strategies with blockcheckw.
Exact cache-host proposal
zapret-autotune tune googlevideo --video-id dQw4w9WgXcQ --proxy socks5://localhost:1080
Both flags are required. The validated Android 21.02.35 player request discovers
exactly one current cache hostname through the explicit proxy. blockcheckw
then scans only that hostname for TLS1.2/TLS1.3, checks the shortlist with
--take 10 --passes 3, ranks fully passing strategies by measured data-transfer
speed/latency, and checks the exact combined arguments 3/3 on both protocols.
The proxy is for discovery; blockcheckw uses its own network path, not that proxy.
No Selectel speedtest is used. This is not a YouTube playback/SABR test.
Only after successful transactional persistence does this command print one
inert NFQWS2_OPT profile filtered by the exact discovered hostname, never
the googlevideo.com wildcard. Cache hosts rotate; one host is not wildcard
evidence. GGC proposals use --hostlist-domains=^<discovered-host>: the ^
prefix disables Zapret2's default subdomain matching, so untested subdomains
are not included. Only validated lowercase *.googlevideo.com hostnames are
accepted; commas and a leading ^ in the discovered hostname are rejected.
Schema-v3 candidates use group googlevideo, one exact endpoint, and
both endpoint×TLS measurements with raw JSON and timestamps. An additive v3
cache-run journal records failed attempts without candidates and successful
attempts atomically with their candidate/evidence; legacy frontend runs keep
their existing target constraint. Database failures emit no options.
history and strategies youtube include the cache group and exact endpoint;
status still describes the legacy frontend journal only.
Signed URLs are not printed. Scanner diagnostics are retained in restricted
artifact files rather than relayed to the terminal. No configuration is applied,
no profile is marked active, and no service is restarted. The staged pipeline is
scan/propose now → eventual install → monitoring/recovery; the latter stages are
not implemented. No-argument tune youtube remains frontend-only and unchanged.
Cache-host discovery
zapret-autotune discover youtube --video-id dQw4w9WgXcQ --proxy socks5://localhost:1080
Both flags are required. Use a proxy address reachable from the CLI; in Docker,
localhost is the container itself, not the Docker host. Proxy credentials,
cookies, and API credentials are not supported. This command requires curl
with --json support and POSTs to the YouTube player API through SOCKS5 using
Android client 21.02.35, SDK 30, Android 11. Requests time out after 30 seconds;
responses are limited to 1 MiB and must have playability status OK and a valid
HTTPS serverAbrStreamingUrl under .googlevideo.com.
Output is JSON containing only videoId and hostnames; signed streaming URLs
are never printed. Cache hosts may rotate. This is cache-host discovery only,
not verification of real video transfer: a discovered SABR URL can return
sabr.malformed_config on GET. Discovery does not fetch media, persist results,
apply production configuration, or restart services. Invalid input and failed
requests return nonzero with sanitized errors.
Build the Docker image with:
docker build -t zapret-autotune .
The tune youtube command scans and checks candidate strategies; it prints a
proposed NFQWS2_OPT and does not apply configuration or restart services.
Tune runs are recorded in pure-Go SQLite (no CGO). A verified combined candidate
and its TLS1.2/TLS1.3 3/3 pass results are committed together before options are
printed; failed scans/checks are recorded as failed runs without a candidate.
Database initialization or persistence errors return nonzero and emit no options.
status shows the latest recorded run, or explicitly says there is no recorded
run. Candidates are PROPOSED, not active; there is no apply command and
production health is not checked. A later failed run is shown instead of an older
proposal. An output-write failure can leave a verified proposal recorded, but
still returns nonzero.
Set ZAPRET_AUTOTUNE_DB to override the default database path
/var/lib/zapret-autotune/autotune.db. The parent directory is created if needed;
it must be writable. In Docker, mount that directory to retain history:
docker run --rm -v autotune-data:/var/lib/zapret-autotune zapret-autotune status
Schema version 3 is initialized transactionally on tune and status; subsequent
opens are idempotent and newer, unsupported schema versions are rejected.
Schema v3 adds immutable strategy candidate definitions (group, declared exact
endpoints, args and normalized-args fingerprint) and endpoint/protocol evidence.
Each newly successful tune saves its exact verified combined frontend profile for
youtube.com, both TLS measurements, raw measurement JSON and checked timestamps
in the same transaction as the existing run. Qualification requires every declared
endpoint to pass exactly 3/3 for both TLS1.2 and TLS1.3, with full success/coverage.
Existing v2 history is unchanged and is not backfilled into independent candidates.
Candidates have no active/installed state; apply and monitor remain unimplemented.
The explicit tune googlevideo path adds exact-cache proposals only.
Proposed runs store a SHA-256 fingerprint of validated arguments with separator
whitespace normalized and argument order preserved; repeated proposals retain
separate history rows. Failed runs have no fingerprint. Version 1 history is
upgraded atomically, rejecting invalid proposed arguments without changing it.