z2k/lib
Necronicle 3681570fdb bootstrap: 4-layer GitHub fetch fallback (ISP-block-resistant)
Some Russian ISPs (MGTS, Rostelecom recent) intermittently block
raw.githubusercontent.com via DNS poisoning or SNI filter, making the
first curl in z2k.sh fail and the entire install abort. Borrow z4r's
DNS-override trick, stack three mirrors in front of it.

New z2k_fetch() wrapper, defined inline in z2k.sh (bootstrap-safe) and
duplicated in lib/utils.sh (for modules). Tries in order:

  1. raw.githubusercontent.com                         — primary
  2. cdn.jsdelivr.net/gh/<owner>/<repo>@<branch>/<p>   — CDN, 12h edge
     cache (purgeable via purge.jsdelivr.net/gh/...)
  3. gh-proxy.com/<raw-url>                           — reverse-proxy,
     no cache, works from RU
  4. Keenetic-only: nslookup <host> 8.8.8.8 + ndmc "ip host <host> <ip>"
     then retry layers 1+2 — mirrors zapret4rocket z4r.sh:1075-1107.

Replaces every direct curl to raw.github or ${GITHUB_RAW}/... across
z2k.sh (14 sites), lib/install.sh (4 sites: two AloofLibra/zapret4rocket
lua/orchestrator fetches + two bol-van/zapret2 custom.d examples),
lib/menu.sh (tg-mtproxy binary download), and the standalone cron
files/z2k-update-lists.sh (which gets its own inline copy of the
function — it is not source'd via utils.sh).

Smoke-tested: all three delivering layers fetch the same 29272-byte
z2k.sh, and a bogus path correctly falls through all layers and
returns 1. Layer 4 (ndmc) not tested on the Mac — semantics copied
verbatim from z4r, which proves it on Keenetic in production.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-23 23:26:58 +03:00
..
config.sh whitelist: add ozon.ru, ozone.ru, ozonusercontent.com 2026-04-13 14:43:04 +03:00
config_official.sh rkn_tcp: add z2k_tls_stalled failure detector for silent handshakes 2026-04-14 18:46:54 +03:00
install.sh bootstrap: 4-layer GitHub fetch fallback (ISP-block-resistant) 2026-04-23 23:26:58 +03:00
menu.sh bootstrap: 4-layer GitHub fetch fallback (ISP-block-resistant) 2026-04-23 23:26:58 +03:00
strategies.sh feat: IPv6 support, web panel, ECH detection, integration tests 2026-04-11 01:17:22 +03:00
system_init.sh fix: comprehensive code review — 40 fixes across 14 files 2026-03-19 00:38:58 +03:00
utils.sh bootstrap: 4-layer GitHub fetch fallback (ISP-block-resistant) 2026-04-23 23:26:58 +03:00
webpanel.sh webpanel: auto-detect LAN IP with bridge-first priority 2026-04-18 15:02:48 +03:00