Created
December 10, 2025 13:23
-
-
Save opiums9/d8dfc5762ec13076a92c1944e420b097 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @echo off | |
| setlocal | |
| :: --- Проверка прав администратора --- | |
| net session >nul 2>&1 | |
| if %errorlevel% neq 0 ( | |
| echo Требуются права администратора. Перезапускаю с повышением... | |
| powershell -Command "Start-Process -FilePath '%~f0' -Verb RunAs" | |
| exit /b | |
| ) | |
| set "CFG=%ALLUSERSPROFILE%\Yggdrasil\yggdrasil.conf" | |
| if not exist "%CFG%" ( | |
| echo Ошибка: конфиг не найден: "%CFG%" | |
| pause | |
| exit /b 1 | |
| ) | |
| :: --- PowerShell скрипт для безопасного обновления Peers --- | |
| powershell -NoProfile -ExecutionPolicy Bypass -Command ^ | |
| "$cfg='%CFG%';" ^ | |
| "$peers=@('tls://45.95.202.21:443','tls://45.147.200.202:443','quic://srv.itrus.su:7993','wss://ygg-evn-1.wgos.org:443');" ^ | |
| "$content = Get-Content -LiteralPath $cfg;" ^ | |
| "$newContent=@();" ^ | |
| "$insidePeers=$false;" ^ | |
| "foreach ($line in $content) {" ^ | |
| " if ($line -match '^\s*Peers:\s*\[') { $insidePeers=$true; $newContent += $line; foreach ($p in $peers) { $newContent += ' ' + $p }; continue }" ^ | |
| " if ($insidePeers -and $line -match '^\s*\]') { $insidePeers=$false; $newContent += $line; continue }" ^ | |
| " if (-not $insidePeers) { $newContent += $line }" ^ | |
| "}" ^ | |
| "Set-Content -LiteralPath $cfg -Value $newContent -Encoding UTF8;" ^ | |
| "Write-Host 'Peers успешно обновлены.';" | |
| :: --- Перезапуск сервиса --- | |
| net stop yggdrasil >nul 2>&1 | |
| net start yggdrasil >nul 2>&1 | |
| echo Готово. | |
| pause |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment