feat(installer): add jsdelivr.net CDN as primary mirror for download failover

This commit is contained in:
Dushnilin
2026-08-27 19:28:59 +03:00
parent 1a314147a9
commit 4e57a9649d
3 changed files with 70 additions and 11 deletions
+11 -4
View File
@@ -63,7 +63,7 @@ Tachyon intercepts network flows via kernel **nftables** and dispatches requests
* **Static DNS Overriding (`dns_hosts`)**: Direct mapping of domains to static IP addresses in sing-box DNS and dnsmasq without editing `/etc/hosts`.
* **Remote Hosts Lists Ingestion (`hosts_list_urls`)**: Automatic background downloading and parsing of external host lists and blocklists (AdAway, StevenBlack, custom blocklists).
* **Unified Cache (`combined.txt`)**: High-performance deduplication, merging, and global caching of multiple remote host sources into a single lightweight cache.
* **GitHub Mirror Failover**: Resilient downloads that automatically retry via mirrors (`gh-proxy.com`, `ghproxy.net`) if direct access to github.com is blocked or throttled.
* **GitHub Mirror Failover**: Resilient downloads that automatically retry via mirrors (`cdn.jsdelivr.net`, `gh-proxy.com`, `ghproxy.net`) if direct access to github.com is blocked or throttled.
* **Hosts-Only Action Sections (`action = hosts`)**: Dedicated routing sections operating purely as DNS override engines without requiring an outbound proxy association.
<p align="center">
@@ -200,10 +200,13 @@ wget -O /tmp/tachyon-setup.sh https://raw.githubusercontent.com/Dushnilin/tachyo
> [!TIP]
> **Installation Mirrors (if direct access to GitHub is blocked or throttled):**
> ```bash
> # Mirror 1 (gh-proxy.com):
> # Mirror 1 (jsdelivr.net CDN):
> wget -O /tmp/tachyon-setup.sh https://cdn.jsdelivr.net/gh/Dushnilin/tachyon@main/install.sh && sh /tmp/tachyon-setup.sh
>
> # Mirror 2 (gh-proxy.com):
> wget -O /tmp/tachyon-setup.sh https://gh-proxy.com/raw.githubusercontent.com/Dushnilin/tachyon/main/install.sh && sh /tmp/tachyon-setup.sh
>
> # Mirror 2 (ghfast.top):
> # Mirror 3 (ghfast.top):
> wget -O /tmp/tachyon-setup.sh https://ghfast.top/https://raw.githubusercontent.com/Dushnilin/tachyon/main/install.sh && sh /tmp/tachyon-setup.sh
> ```
@@ -218,8 +221,12 @@ To cleanly remove Tachyon, restore stock DNS, flush nftables rules, and preserve
wget -O /tmp/tachyon-uninstall.sh https://raw.githubusercontent.com/Dushnilin/tachyon/main/uninstall.sh && sh /tmp/tachyon-uninstall.sh
```
*Via mirror gh-proxy.com:*
*Via mirrors:*
```bash
# Mirror 1 (jsdelivr.net CDN):
wget -O /tmp/tachyon-uninstall.sh https://cdn.jsdelivr.net/gh/Dushnilin/tachyon@main/uninstall.sh && sh /tmp/tachyon-uninstall.sh
# Mirror 2 (gh-proxy.com):
wget -O /tmp/tachyon-uninstall.sh https://gh-proxy.com/raw.githubusercontent.com/Dushnilin/tachyon/main/uninstall.sh && sh /tmp/tachyon-uninstall.sh
```
+11 -4
View File
@@ -63,7 +63,7 @@ Tachyon перехватывает сетевой стек через ядро *
* **Статический DNS-Overriding (`dns_hosts`)**: Прямое переопределение IP-адресов для доменов в DNS-модуле sing-box и dnsmasq без необходимости подмены `/etc/hosts`.
* **Загрузка сторонних списков Hosts (`hosts_list_urls`)**: Автоматическая фоновая загрузка и интеграция внешних реестров и списков блокировок (AdAway, StevenBlack, РКН/Антизапрет списки).
* **Умный кэш (`combined.txt`)**: Автоматическое слияние, очистка и единое кэширование нескольких источников списков с поддержкой мгновенного переиспользования.
* **Резервирование через зеркала (GitHub Mirror Retry)**: При сетевых блокировках github.com модули загрузки автоматически переключаются на зеркала (`gh-proxy.com`, `ghproxy.net`).
* **Резервирование через зеркала (GitHub Mirror Retry)**: При сетевых блокировках github.com модули загрузки автоматически переключаются на зеркала (`cdn.jsdelivr.net`, `gh-proxy.com`, `ghproxy.net`).
* **Секции чистого Hosts (`action = hosts`)**: Создание изолированных правил перенаправления DNS без обязательной привязки к прокси-нодам.
<p align="center">
@@ -200,10 +200,13 @@ wget -O /tmp/tachyon-setup.sh https://raw.githubusercontent.com/Dushnilin/tachyo
> [!TIP]
> **Зеркала установки (при блокировке или замедлении GitHub):**
> ```bash
> # Зеркало 1 (gh-proxy.com):
> # Зеркало 1 (jsdelivr.net CDN):
> wget -O /tmp/tachyon-setup.sh https://cdn.jsdelivr.net/gh/Dushnilin/tachyon@main/install.sh && sh /tmp/tachyon-setup.sh
>
> # Зеркало 2 (gh-proxy.com):
> wget -O /tmp/tachyon-setup.sh https://gh-proxy.com/raw.githubusercontent.com/Dushnilin/tachyon/main/install.sh && sh /tmp/tachyon-setup.sh
>
> # Зеркало 2 (ghfast.top):
> # Зеркало 3 (ghfast.top):
> wget -O /tmp/tachyon-setup.sh https://ghfast.top/https://raw.githubusercontent.com/Dushnilin/tachyon/main/install.sh && sh /tmp/tachyon-setup.sh
> ```
@@ -218,8 +221,12 @@ wget -O /tmp/tachyon-setup.sh https://raw.githubusercontent.com/Dushnilin/tachyo
wget -O /tmp/tachyon-uninstall.sh https://raw.githubusercontent.com/Dushnilin/tachyon/main/uninstall.sh && sh /tmp/tachyon-uninstall.sh
```
*Через зеркало gh-proxy.com:*
*Через зеркала:*
```bash
# Зеркало 1 (jsdelivr.net CDN):
wget -O /tmp/tachyon-uninstall.sh https://cdn.jsdelivr.net/gh/Dushnilin/tachyon@main/uninstall.sh && sh /tmp/tachyon-uninstall.sh
# Зеркало 2 (gh-proxy.com):
wget -O /tmp/tachyon-uninstall.sh https://gh-proxy.com/raw.githubusercontent.com/Dushnilin/tachyon/main/uninstall.sh && sh /tmp/tachyon-uninstall.sh
```
+48 -3
View File
@@ -1695,6 +1695,44 @@ download_file_once() {
esac
}
github_to_jsdelivr() {
_url="$1"
case "$_url" in
*github.com*)
_path="${_url#*github.com/}"
case "$_path" in
*/releases/download/*)
_repo_owner="$(printf '%s' "$_path" | cut -d'/' -f1)"
_repo_name="$(printf '%s' "$_path" | cut -d'/' -f2)"
_tag="$(printf '%s' "$_path" | cut -d'/' -f4)"
_file="$(printf '%s' "$_path" | cut -d'/' -f5-)"
printf 'https://cdn.jsdelivr.net/gh/%s/%s@%s/%s' "$_repo_owner" "$_repo_name" "$_tag" "$_file"
return 0
;;
*/raw/*)
_repo_owner="$(printf '%s' "$_path" | cut -d'/' -f1)"
_repo_name="$(printf '%s' "$_path" | cut -d'/' -f2)"
_branch="$(printf '%s' "$_path" | cut -d'/' -f4)"
_file="$(printf '%s' "$_path" | cut -d'/' -f5-)"
printf 'https://cdn.jsdelivr.net/gh/%s/%s@%s/%s' "$_repo_owner" "$_repo_name" "$_branch" "$_file"
return 0
;;
*/*)
_repo_owner="$(printf '%s' "$_path" | cut -d'/' -f1)"
_repo_name="$(printf '%s' "$_path" | cut -d'/' -f2)"
_ref="$(printf '%s' "$_path" | cut -d'/' -f4)"
_file="$(printf '%s' "$_path" | cut -d'/' -f5-)"
[ -n "$_file" ] && {
printf 'https://cdn.jsdelivr.net/gh/%s/%s@%s/%s' "$_repo_owner" "$_repo_name" "$_ref" "$_file"
return 0
}
;;
esac
;;
esac
printf '%s' "$_url"
}
download_with_retry() {
url="$1"
output_path="$2"
@@ -1702,14 +1740,21 @@ download_with_retry() {
dl_num="${4:-}"
dl_total="${5:-}"
attempt=1
max_attempts=3
max_attempts=4
jsdelivr_url="$(github_to_jsdelivr "$url")"
while [ "$attempt" -le "$max_attempts" ]; do
current_url="$url"
if [ "$attempt" -eq 2 ]; then
if [ "$attempt" -eq 2 ] && [ "$jsdelivr_url" != "$url" ]; then
warn "Retrying $label via jsdelivr.net CDN..."
current_url="$jsdelivr_url"
elif [ "$attempt" -eq 2 ] || ([ "$attempt" -eq 3 ] && [ "$jsdelivr_url" = "$url" ]); then
warn "Retrying $label via gh-proxy.com mirror..."
current_url="https://gh-proxy.com/$url"
elif [ "$attempt" -eq 3 ]; then
elif [ "$attempt" -eq 3 ] && [ "$jsdelivr_url" != "$url" ]; then
warn "Retrying $label via gh-proxy.com mirror..."
current_url="https://gh-proxy.com/$url"
elif [ "$attempt" -eq 4 ]; then
warn "Retrying $label via ghproxy.net mirror..."
current_url="https://ghproxy.net/$url"
fi