brainstate

dontbass/torrserverwrt · source

Snapshot 0 · 2026-11-04T12:47:28Z · Shell · MIT

Content fingerprint87c4148a203c9878411e79dd6383366aab39eda6ba5dc4d87038492c71abe530

GitHub description at capture

Скрипт для установки на openwrt torserver YouROK

README at capture

<div align="center">

<img src="logo.svg" alt="TorrServer for OpenWrt" width="100%"/>

**Установщик [TorrServer](https://github.com/YouROK/TorrServer) для OpenWrt и FriendlyWrt**

[![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
[![Shell](https://img.shields.io/badge/shell-POSIX%20sh-89e051.svg)](#)
[![OpenWrt](https://img.shields.io/badge/OpenWrt-19.07%2B-00b5e2.svg)](https://openwrt.org)
[![TorrServer](https://img.shields.io/badge/TorrServer-latest-e03030.svg)](https://github.com/YouROK/TorrServer/releases/latest)
[![Release](https://img.shields.io/github/v/release/dontbass/torrserverwrt?color=e03030&label=release)](https://github.com/dontbass/torrserverwrt/releases/latest)
[![GitHub stars](https://img.shields.io/github/stars/dontbass/torrserverwrt?style=flat&color=yellow)](https://github.com/dontbass/torrserverwrt/stargazers)

[Русский](#русский) · [English](#english)

</div>

---

## Русский

### Что это

TorrServer — HTTP-сервер для **стриминга торрентов без скачивания на диск**. Идеально для домашнего медиацентра: запускаете фильм в Lampa или любом другом плеере, роутер раздаёт поток прямо из торрента.

Этот скрипт автоматизирует установку, настройку и обслуживание TorrServer на роутерах под управлением **OpenWrt** и **FriendlyWrt**.

```
  Lampa / плеер  ──▶  TorrServer (роутер)  ──▶  торрент-трекер
```

### Быстрый старт

**Linux (OpenWrt / Ubuntu / Debian / Arch / Alpine):**
```sh
curl -sSL https://raw.githubusercontent.com/dontbass/torrserverwrt/main/install.sh | sh
```

**Windows — самый простой способ (рекомендуется):**

Скачать и запустить двойным кликом → **[install.bat](https://raw.githubusercontent.com/dontbass/torrserverwrt/main/install.bat)**

Bat-файл автоматически обходит политику выполнения скриптов и не требует никаких настроек.

**Windows — через PowerShell (от имени администратора):**
```powershell
powershell -ExecutionPolicy Bypass -Command "irm https://raw.githubusercontent.com/dontbass/torrserverwrt/main/install.ps1 | iex"
```

Или скачать вручную:
```sh
# Linux
curl -O https://raw.githubusercontent.com/dontbass/torrserverwrt/main/install.sh
sh install.sh -i

# Windows (PowerShell)
Invoke-WebRequest -Uri https://raw.githubusercontent.com/dontbass/torrserverwrt/main/install.ps1 -OutFile install.ps1
.\install.ps1
```

После установки веб-интерфейс доступен по адресу `http://<IP>:8090`

### Поддерживаемые платформы

| ОС | Init-система | Установщик |
|---|---|---|
| OpenWrt / FriendlyWrt | procd | `install.sh` |
| Ubuntu / Debian / Raspberry Pi OS | systemd | `install.sh` |
| Arch Linux / Manjaro | systemd | `install.sh` |
| Alpine Linux | OpenRC | `install.sh` |
| Windows 10/11 / Server 2016+ | Task Scheduler / NSSM | `install.ps1` |

### Возможности

| | |
|---|---|
| 🌐 | Интерфейс на русском и английском — язык сохраняется между сессиями |
| 🔀 | Proxy bypass через nftables cgroupv2 — торрент-трафик идёт напрямую, минуя VPN |
| 🔍 | Автоопределение архитектуры роутера |
| ⬇️ | Загрузка последней версии TorrServer с GitHub |
| ⚙️ | Настройка службы через **procd** с автозапуском |
| 🔒 | HTTP-авторизация — включить, сменить пароль или отключить без переустановки |
| 🔌 | Смена порта без переустановки |
| 🔄 | Атомарное обновление бинаря (без `text file busy`) |
| ↩️ | Откат на старую версию при неудачном обновлении |
| ⏰ | Автообновление через cron (еженедельно) |
| 📊 | Статус: версия, uptime, адрес, логин/пароль |
| 💾 | Проверка свободного места перед загрузкой |
| 🗑️ | Корректное удаление со всеми данными |

### Команды

```sh
sh install.sh -i    # установка
sh install.sh -u    # обновление
sh install.sh -s    # статус
sh install.sh -b    # настроить прямое соединение (bypass прокси)
sh install.sh -r    # удаление
sh install.sh -h    # справка
```

Флаги: `--no-color` — без цветов (для логов), `--auto` — для cron.

### Вывод статуса

```
=============================================================
 Статус TorrServer
=============================================================
 Версия:     MatriX.142.2
 Бинарь:     TorrServer-linux-arm64
 Служба:     ЗАПУЩЕНА
 Адрес:      http://192.168.1.1:8090
 Uptime:     2ч 15м 42с
 Авториз.:   ВКЛ
 Логин:      admin
 Пароль:     mypassword
 Автообн.:   ВКЛ
 Обновление: не требуется
=============================================================
```

### Прямое соединение (Proxy Bypass)

Если на роутере установлен VPN или прокси-инструмент (nikki, podkop, sing-box, openclash, passwall, shellcrash и другие) — торрент-трафик TorrServer может пойти через него. Это нарушает правила большинства VPN-провайдеров и может привести к блокировке аккаунта.

При установке скрипт автоматически обнаруживает активные прокси-инструменты и предлагает настроить split-tunnel: TorrServer работает напрямую, весь остальной трафик — через VPN.

**Механизм:** nftables правило с приоритетом `mangle-5` (выше любого tproxy) выпускает трафик cgroup `services/torrserver` напрямую на уровне ядра. Работает с любым прокси без дополнительной настройки.

> ⚠️ **Требования:** OpenWrt **22.03 и новее** (ядро 5.10+). На OpenWrt 19.07 и 21.02 функция `socket cgroupv2` в nftables отсутствует или работает нестабильно — скрипт предупредит об этом и предложит применить на свой риск.

```sh
sh install.sh -b    # настроить/обновить bypass
```

Правило сохраняется в `/etc/nftables.d/torrserver-bypass.nft` и подхватывается fw4 автоматически после перезагрузки.

> Поддерживаемые инструменты: nikki, podkop, openclash, homeproxy, passwall, passwall2, shellcrash, sing-box и любые другие через универсальное nftables правило.

### Подключение Lampa

TorrServer нативно поддерживается в [Lampa](https://lampa.stream):

```
Lampa → Настройки → TorrServer → Адрес: http://<IP роутера>:8090
```

Нажмите «Проверить» — статус должен стать зелёным «Подключено».

### Совместимость

> **На MIPS-роутерах** стриминг может работать нестабильно из-за слабого CPU.
> Рекомендуются устройства на **ARM64**.

| Устройство | SoC | `uname -m` | Бинарь |
|---|---|---|---|
| NanoPi R2S/R4S/R5S | RK3328/RK3399 | `aarch64` | `linux-arm64` |
| Hiveton H5000M | MT7988 (A53) | `aarch64` | `linux-arm64` |
| Cudy TR3000, GL.iNet MT3000 | MT7981B | `aarch64` | `linux-arm64` |
| Raspberry Pi 3/4 (64-bit) | BCM2837/2711 | `aarch64` | `linux-arm64` |
| Raspberry Pi 2/3 (32-bit) | BCM2836/2837 | `armv7l` | `linux-arm7` |
| GL.iNet GL-AR750 | QCA9563 | `mips` | `linux-mips` |
| PC-роутер x86/x86_64 | — | `x86_64` | `linux-amd64` |
| Прочие | — | — | ручной ввод |

**Минимальные требования:** 256 МБ RAM · 80 МБ в `/opt` · curl · OpenWrt 19.07+

### Автообновление

TorrServer выходит редко. Автообновление проверяет наличие новой версии **раз в неделю** (воскресенье, 04:00) и скачивает (~70 МБ) только если она есть.

> Не рекомендуется при менее 150 МБ свободного места в `/opt`.

```sh
cat /var/log/torrserver-update.log   # лог обновлений
```

### Файлы

| Путь | Назначение |
|---|---|
| `/opt/torrserver/TorrServer-*` | Исполняемый файл |
| `/opt/torrserver/version` | Текущая версия |
| `/opt/torrserver/lang` | Выбранный язык |
| `/opt/torrserver/accs.db` | Логин/пароль (если авторизация включена) |
| `/opt/torrserver/torr/` | База торрентов |
| `/etc/init.d/torrserver` | Init-скрипт службы |
| `/var/log/torrserver-update.log` | Лог автообновлений |

---

## English

### What is this

TorrServer is an HTTP server for **streaming torrents without downloading to disk**. Perfect for a home media center: start a movie in Lampa or any other player, and the router streams it directly from the torrent.

This script automates installation, configuration, and maintenance of TorrServer on routers running **OpenWrt** and **FriendlyWrt**.

```
  Lampa / player  ──▶  TorrServer (router)  ──▶  torrent tracker
```

### Quick start

**Linux (OpenWrt / Ubuntu / Debian / Arch / Alpine):**
```sh
curl -sSL https://raw.githubusercontent.com/dontbass/torrserverwrt/main/install.sh | sh
```

**Windows — easiest way (recommended):**

Download and double-click → **[install.bat](https://raw.githubusercontent.com/dontbass/torrserverwrt/main/install.bat)**

The bat file automatically bypasses PowerShell execution policy — no configuration needed.

**Windows — via PowerShell (as Administrator):**
```powershell
powershell -ExecutionPolicy Bypass -Command "irm https://raw.githubusercontent.com/dontbass/torrserverwrt/main/install.ps1 | iex"
```

After installation the web UI is available at `http://<IP>:8090`

### Supported platforms

| OS | Init system | Installer |
|---|---|---|
| OpenWrt / FriendlyWrt | procd | `install.sh` |
| Ubuntu / Debian / Raspberry Pi OS | systemd | `install.sh` |
| Arch Linux / Manjaro | systemd | `install.sh` |
| Alpine Linux | OpenRC | `install.sh` |
| Windows 10/11 / Server 2016+ | Task Scheduler / NSSM | `install.ps1` |

### Features

| | |
|---|---|
| 🌐 | English / Russian interface — language saved between sessions |
| 🔀 | Proxy bypass via nftables cgroupv2 — torrent traffic goes direct, bypassing VPN |
| 🔍 | Auto-detection of router architecture |
| ⬇️ | Downloads the latest TorrServer version from GitHub |
| ⚙️ | Configures as a system service via **procd** with autostart |
| 🔒 | HTTP authorization — set, change or disable without reinstall |
| 🔌 | Change port without reinstall |
| 🔄 | Atomic binary update (no `text file busy`) |
| ↩️ | Rollback to old version on failed update |
| ⏰ | Auto-update via cron (weekly) |
| 📊 | Status: version, uptime, address, login/password |
| 💾 | Free space check before download |
| 🗑️ | Clean removal with all data |

### Commands

```sh
sh install.sh -i    # install
sh install.sh -u    # update
sh install.sh -s    # status
sh install.sh -b    # configure proxy bypass
sh install.sh -r    # remove
sh install.sh -h    # help
```

Flags: `--no-color` — no colors (for logs), `--auto` — for cron.

### Status output

```
=============================================================
 TorrServer Status
=============================================================
 Version:    MatriX.142.2
 Binary:     TorrServer-linux-arm64
 Service:    RUNNING
 Address:    http://192.168.1.1:8090
 Uptime:     2h 15m 42s
 Auth:       ON
 Login:      admin
 Password:   mypassword
 Auto-upd:   ON
 Update:     not required
=============================================================
```

### Proxy Bypass

If the router runs a VPN or proxy tool (nikki, podkop, sing-box, openclash, passwall, shellcrash, etc.) — TorrServer torrent traffic may go through it. BitTorrent via VPN violates most VPN providers' ToS and may get your account banned.

During installation the script detects active proxy tools and offers to configure a split-tunnel: TorrServer goes direct, everything else goes through VPN.

**Mechanism:** an nftables rule at priority `mangle-5` (higher than any tproxy) releases cgroup `services/torrserver` traffic directly at kernel level. Works with any proxy without extra configuration.

> ⚠️ **Requirements:** OpenWrt **22.03 or newer** (kernel 5.10+). On OpenWrt 19.07 and 21.02 the `socket cgroupv2` nftables feature is missing or unstable — the script will warn you and let you proceed at your own risk.

```sh
sh install.sh -b    # configure / reconfigure bypass
```

The rule is saved to `/etc/nftables.d/torrserver-bypass.nft` and loaded by fw4 automatically after reboot.

> Supported tools: nikki, podkop, openclash, homeproxy, passwall, passwall2, shellcrash, sing-box, and any other tool via the universal nftables rule.

### Lampa integration

TorrServer is natively supported in [Lampa](https://lampa.stream):

```
Lampa → Settings → TorrServer → Address: http://<router IP>:8090
```

Press «Check» — the status should turn green «Connected».

### Compatibility

> **On MIPS routers** streaming may be unstable due to weak CPU.
> **ARM64** devices are recommended.

| Device | SoC | `uname -m` | Binary |
|---|---|---|---|
| NanoPi R2S/R4S/R5S | RK3328/RK3399 | `aarch64` | `linux-arm64` |
| Hiveton H5000M | MT7988 (A53) | `aarch64` | `linux-arm64` |
| Cudy TR3000, GL.iNet MT3000 | MT7981B | `aarch64` | `linux-arm64` |
| Raspberry Pi 3/4 (64-bit) | BCM2837/2711 | `aarch64` | `linux-arm64` |
| Raspberry Pi 2/3 (32-bit) | BCM2836/2837 | `armv7l` | `linux-arm7` |
| GL.iNet GL-AR750 | QCA9563 | `mips` | `linux-mips` |
| x86/x86_64 PC router | — | `x86_64` | `linux-amd64` |
| Others | — | — | manual input |

**Minimum requirements:** 256 MB RAM · 80 MB in `/opt` · curl · OpenWrt 19.07+

### Auto-update

TorrServer releases rarely. Auto-update checks for a new version **once a week** (Sunday, 04:00) and downloads (~70 MB) only if available.

> Not recommended if less than 150 MB free in `/opt`.

```sh
cat /var/log/torrserver-update.log   # update log
```

### Files

| Path | Purpose |
|---|---|
| `/opt/torrserver/TorrServer-*` | Executable |
| `/opt/torrserver/version` | Installed version |
| `/opt/torrserver/lang` | Selected language |
| `/opt/torrserver/accs.db` | Login/password (if auth enabled) |
| `/opt/torrserver/torr/` | Torrent database |
| `/etc/init.d/torrserver` | Service init script |
| `/var/log/torrserver-update.log` | Auto-update log |

---

<div align="center">

На основе [YouROK/TorrServer](https://github.com/YouROK/TorrServer) · адаптирован для OpenWrt

</div>