97 lines
3.8 KiB
PowerShell
97 lines
3.8 KiB
PowerShell
# ==========================================
|
||
# 🚀 VPN PROXY CONTROL CENTER (WINDOWS)
|
||
# ==========================================
|
||
# Главный скрипт управления. Запускать от имени Администратора.
|
||
# Использование: .\manage.ps1 [-Debug]
|
||
|
||
param([switch]$Debug)
|
||
|
||
$ScriptDir = if ($PSScriptRoot) { $PSScriptRoot } else { Split-Path -Parent $MyInvocation.MyCommand.Path }
|
||
$LibDir = "$ScriptDir\scripts\lib"
|
||
|
||
# Проверка библиотек
|
||
if (!(Test-Path "$LibDir\Common.ps1")) {
|
||
Write-Host "❌ Ошибка: Не найдены библиотеки в $LibDir" -ForegroundColor Red
|
||
exit 1
|
||
}
|
||
|
||
. "$LibDir\Common.ps1"
|
||
. "$LibDir\System.ps1"
|
||
|
||
# Установка режима отладки
|
||
if ($Debug) {
|
||
Set-DebugMode -Enabled $true
|
||
}
|
||
|
||
Ensure-Admin
|
||
|
||
while ($true) {
|
||
Write-Header "VPN PROXY CONTROL CENTER" -ClearScreen
|
||
|
||
# --- СБОР СТАТУСОВ ---
|
||
|
||
# 1. Native Sing-box
|
||
$sbStatus = Get-TaskStatus -Name "SingBoxProxy"
|
||
$sbStr = if ($sbStatus -eq "Running") { "РАБОТАЕТ" } else { "ОСТАНОВЛЕН" }
|
||
$sbColor = if ($sbStatus -eq "Running") { "Green" } else { "Yellow" }
|
||
if (!$sbStatus) { $sbStr = "НЕ УСТАНОВЛЕН"; $sbColor = "Gray" }
|
||
|
||
# 2. Discord Proxy
|
||
$discSvc = Get-Service -Name "ProxiFyreService" -ErrorAction SilentlyContinue
|
||
$discStr = if ($discSvc.Status -eq 'Running') { "АКТИВЕН" } else { "НЕ АКТИВЕН" }
|
||
$discColor = if ($discSvc.Status -eq 'Running') { "Green" } else { "Gray" }
|
||
|
||
# --- ОТРИСОВКА МЕНЮ ---
|
||
|
||
Write-Host " [1] 📦 VPN Клиент (Sing-box)" -NoNewline -ForegroundColor White
|
||
Write-Host " [$sbStr]" -ForegroundColor $sbColor
|
||
Write-Host " Основной способ. Поддерживает UDP и игры." -ForegroundColor Gray
|
||
|
||
# Показываем информацию о подключении если sing-box работает
|
||
if ($sbStatus -eq "Running") {
|
||
$LocalProxyPort = 1080
|
||
. "$LibDir\Net.ps1"
|
||
$ips = Get-LocalIPs
|
||
|
||
Write-Host ""
|
||
Write-Host " 📡 ПОДКЛЮЧЕНИЕ К ПРОКСИ" -ForegroundColor Cyan
|
||
Write-Host " ─────────────────────────────" -ForegroundColor DarkGray
|
||
Write-Host " Локально: " -NoNewline -ForegroundColor Gray
|
||
Write-Host "127.0.0.1:$LocalProxyPort" -ForegroundColor Green
|
||
|
||
if ($ips) {
|
||
Write-Host " Из сети:" -ForegroundColor Gray
|
||
foreach ($ip in $ips) {
|
||
Write-Host " ${ip}:$LocalProxyPort" -ForegroundColor Yellow
|
||
}
|
||
}
|
||
Write-Host ""
|
||
}
|
||
Write-Host ""
|
||
|
||
Write-Host " [2] 🎮 Настройка Discord/Vesktop" -NoNewline -ForegroundColor White
|
||
Write-Host " [$discStr]" -ForegroundColor $discColor
|
||
Write-Host " Маршрутизация приложений через прокси." -ForegroundColor Gray
|
||
Write-Host ""
|
||
|
||
Write-Host " ---------------------------------------" -ForegroundColor DarkGray
|
||
|
||
|
||
Write-Host " [3] 🔄 Обновить статус" -ForegroundColor White
|
||
Write-Host " [L] 📜 Просмотр логов" -ForegroundColor White
|
||
Write-Host " [U] ❌ Удалить всё (Uninstall)" -ForegroundColor Red
|
||
Write-Host " [q] Выход" -ForegroundColor White
|
||
Write-Host ""
|
||
|
||
$choice = Read-Host "👉 Ваш выбор"
|
||
|
||
switch ($choice) {
|
||
"1" { & "$ScriptDir\scripts\setup-singbox.ps1" }
|
||
"2" { & "$ScriptDir\scripts\setup-discord.ps1" }
|
||
"3" { continue }
|
||
"l" { & "$ScriptDir\scripts\view-logs.ps1" }
|
||
"u" { & "$ScriptDir\scripts\uninstall-all.ps1" }
|
||
"q" { exit }
|
||
}
|
||
}
|