Умная маршрутизация трафика через разные proxy с гибкими правилами
О проекте • Возможности • Установка • Быстрый старт • Команды • Разработка
SmartRoute — CLI/TUI-приложение на Rust для умной маршрутизации трафика через разные proxy-ноды.
Проект работает поверх sing-box и позволяет удобно управлять:
- глобальным proxy для всего трафика;
- отдельными правилами для сайтов;
- отдельными локальными SOCKS-портами для приложений;
- цепочками proxy из нескольких нод;
- kill-switch для блокировки direct-трафика;
- диагностикой утечек DNS/SNI;
- импортом и обновлением proxy-подписок.
SmartRoute — это не VPN, а локальный smart proxy router.
[Global proxy] → используется для всего трафика по умолчанию
[S] Site rule → отдельный proxy/chain для сайта
[A] App profile → отдельный локальный SOCKS-порт для приложения
[C] Chain proxy → цепочка из нескольких proxy-нод
[Global] → ru-chain
[S] youtube.com → 5-gbit-tcp-3
[S] github.com → chain "git"
[A] Steam → chain "gaming"
[A] Browser → local SOCKS port 127.0.0.1:1082
[C] ru-chain → tcp-1 → youtube
[C] git → 5-gbit-3 → 5-gbit
- 🎯 Site rules — отдельный proxy или chain для конкретных доменов.
- 📱 App profiles — отдельные локальные SOCKS-порты для приложений.
- ⛓️ Chain proxy — цепочки из нескольких proxy-нод.
- 🌐 Global proxy — дефолтный outbound для всего трафика.
- 🖥️ TUI-интерфейс — управление через терминал.
- 🌍 RU/EN интерфейс — переключение языка в TUI.
- 🔒 Kill-switch
- Linux: через
nftables. - Windows: через Windows Firewall.
- Linux: через
- 🔍 DNS leak-test — проверка DNS-утечек.
- 🕵️ SNI leak-test — проверка видимости target domain.
- ✅ Whitelist-compatible checks — проверка маскировки трафика.
- 🛡️ Reality/uTLS masks — управление fingerprint и SNI.
- 📥 Импорт подписок — импорт proxy-нод из subscription URL.
- 🔄 Merge-nodes — обновление нод без потери rules/chains/profiles.
- 💾 Backup/restore — автоматические бэкапы конфигурации.
- 🏥 Health-check — проверка работоспособности SmartRoute.
- 🔧 Auto-repair — автоматическое восстановление.
- 📋 Doctor — валидация конфигурации.
- 🚀 Autostart
- Linux: systemd.
- Windows: Task Scheduler.
- 🦀 Rust — быстрый нативный бинарник.
- 📊 Structured logging — логи с уровнями
trace/debug/info/warn/error. - ⚛️ Atomic writes — защита конфигов от повреждения.
- 🧪 Unit-тесты — тесты критичной логики.
- 🪟 Windows support — сборка, тесты и
.exeinstaller. - 🐧 Linux support — systemd, nftables, стандартные CLI tools.
Скачайте последнюю версию установщика из раздела Releases:
SmartRoute-Setup-x64.exe
Страница релизов:
https://github.com/PA3MA3AH/smartroute/releases
После установки SmartRoute будет доступен из PowerShell/CMD:
smartroute.exe --helpC:\ProgramData\SmartRoute\run
C:\ProgramData\SmartRoute\config
- Windows 10/11 x64.
sing-box.exeдолжен быть установлен и доступен вPATH.
Если sing-box.exe лежит в отдельной папке, укажите путь вручную:
setx SMARTROUTE_SINGBOX "C:\path\to\sing-box.exe" /MПосле этого перезапустите PowerShell/Terminal.
smartroute.exe doctor C:\ProgramData\SmartRoute\config\imported.toml
smartroute.exe start C:\ProgramData\SmartRoute\config\imported.toml
smartroute.exe status
smartroute.exe stopЭти команды запускайте из PowerShell или Windows Terminal от имени администратора:
smartroute.exe kill-switch enable C:\ProgramData\SmartRoute\config\imported.toml
smartroute.exe kill-switch status
smartroute.exe kill-switch disablesmartroute.exe autostart enable C:\ProgramData\SmartRoute\config\imported.toml
smartroute.exe autostart status
smartroute.exe autostart disablesudo pacman -S --needed rust cargo git curl sing-box nftables iproute2sudo apt install rust cargo git curl nftables iproute2sing-box для Debian/Ubuntu может потребоваться установить отдельно:
https://sing-box.sagernet.org/
git clone https://github.com/PA3MA3AH/smartroute.git
cd smartroute
cargo build --release
sudo cp target/release/smartroute /usr/local/bin/Проверка:
smartroute --helpВажно:
install.shожидает Linux binary artifact в GitHub Releases. Если в релизе есть только Windows installer, используйте сборку из исходников.
curl -fsSL https://raw.githubusercontent.com/PA3MA3AH/smartroute/master/install.sh | sudo bashили:
wget -qO- https://raw.githubusercontent.com/PA3MA3AH/smartroute/master/install.sh | sudo bashLinux:
sudo mkdir -p /etc/smartroute
sudo nano /etc/smartroute/config.tomlWindows:
notepad C:\ProgramData\SmartRoute\config\config.toml[general]
mode = "socks"
listen = "127.0.0.1"
listen_port = 1081
final_outbound = "my-proxy"
[[nodes]]
tag = "my-proxy"
type = "vless"
server = "example.com"
port = 443
uuid = "your-uuid"
security = "reality"
server_name = "example.com"
reality_public_key = "your-public-key"
reality_short_id = ""
utls_fingerprint = "chrome"Linux:
smartroute doctor /etc/smartroute/config.tomlWindows:
smartroute.exe doctor C:\ProgramData\SmartRoute\config\config.tomlLinux:
sudo smartroute start /etc/smartroute/config.tomlWindows:
smartroute.exe start C:\ProgramData\SmartRoute\config\config.tomlsmartroute statusНа Windows:
smartroute.exe statusSmartRoute имеет терминальный интерфейс управления.
Linux:
sudo smartroute uiWindows:
smartroute.exe uiВ TUI можно:
- запускать/останавливать SmartRoute;
- включать daemon;
- менять global proxy;
- добавлять site rules;
- создавать app profiles;
- создавать chain proxy;
- смотреть rules/chains/app ports;
- импортировать subscription URL;
- запускать проверки.
smartroute start <config>
smartroute stop
smartroute status
smartroute daemon <config>smartroute uismartroute doctor <config>
smartroute health <config>
smartroute repair <config>smartroute rule add <config> domain_suffix youtube.com my-proxy
smartroute rule list <config>smartroute import-url --output nodes.toml "https://example.com/sub"
smartroute merge-nodes base.toml nodes.toml -o base.tomlsmartroute backup <config>
smartroute restore <config> --latestLinux:
sudo smartroute kill-switch enable <config>
sudo smartroute kill-switch status
sudo smartroute kill-switch disableWindows, PowerShell от администратора:
smartroute.exe kill-switch enable C:\ProgramData\SmartRoute\config\config.toml
smartroute.exe kill-switch status
smartroute.exe kill-switch disableLinux:
sudo smartroute autostart enable <config>
sudo smartroute autostart status
sudo smartroute autostart disableWindows, PowerShell от администратора:
smartroute.exe autostart enable C:\ProgramData\SmartRoute\config\config.toml
smartroute.exe autostart status
smartroute.exe autostart disableLinux:
sudo smartroute leak-test <config> --domain youtube.com -i eth0
sudo smartroute dns-test <config> --domain youtube.com -i eth0
sudo smartroute whitelist test <config> --domain youtube.com -i eth0Некоторые leak-test команды требуют
tcpdump,tsharkи root-доступ.
[general]
mode = "socks"
listen = "127.0.0.1"
listen_port = 1081
final_outbound = "my-proxy"[[nodes]]
tag = "my-proxy"
type = "vless"
server = "example.com"
port = 443
uuid = "your-uuid"
security = "reality"
server_name = "example.com"
reality_public_key = "your-public-key"
reality_short_id = ""
utls_fingerprint = "chrome"[[rules]]
type = "domain_suffix"
value = "youtube.com"
outbound = "my-proxy"[[chains]]
tag = "my-chain"
outbounds = ["proxy-1", "proxy-2"][[local_profiles]]
tag = "browser"
listen = "127.0.0.1"
listen_port = 1082
outbound = "my-chain"После запуска приложение может использовать отдельный локальный SOCKS-порт:
127.0.0.1:1082
Linux:
RUST_LOG=debug sudo smartroute start config.tomlWindows PowerShell:
$env:RUST_LOG="debug"
smartroute.exe start C:\ProgramData\SmartRoute\config\config.tomlДоступные уровни:
trace
debug
info
warn
error
Linux:
export SMARTROUTE_SINGBOX="/usr/bin/sing-box"Windows:
setx SMARTROUTE_SINGBOX "C:\path\to\sing-box.exe" /Mcargo build
cargo build --releasecargo test
cargo test --libcargo fmtcargo check --all-targetsWindows installer собирается GitHub Actions workflow:
Actions → Windows Installer → Run workflow
Результат появляется в artifacts:
SmartRoute-Setup-x64.exe
Для релиза создайте tag:
git tag v0.1.0
git push origin v0.1.0Workflow автоматически:
- Соберёт
smartroute.exe. - Соберёт
SmartRoute-Setup-x64.exe. - Создаст GitHub Release.
- Прикрепит installer к релизу.
CI проверяет проект на Linux и Windows:
cargo fmt
cargo check --all-targets
cargo test --all
Windows installer workflow собирает отдельный .exe установщик.
- SmartRoute не является VPN.
- SmartRoute работает как локальный proxy router.
- Для работы требуется
sing-box. - На Windows
kill-switchиспользует Windows Firewall. - На Linux
kill-switchиспользуетnftables. - Для
kill-switchиautostartобычно нужны права администратора/root. - Windows installer не включает
sing-box.exe; установите его отдельно.
- Telegram: @PA3MA3AH
- Issues: GitHub Issues
- Discussions: GitHub Discussions
Этот проект распространяется под лицензией MIT.
Подробности в файле LICENSE.
- sing-box — универсальная proxy-платформа.
- ratatui — TUI-фреймворк.
- crossterm — терминальный backend.
- Всем контрибьюторам проекта.
Сделано с ❤️ на Rust