@echo off
setlocal

if not exist "%~dp0lib\start-socks.ps1" (
    echo ERROR: script not found: "%~dp0lib\start-socks.ps1"
    pause
    exit /b 1
)

powershell.exe -NoProfile -ExecutionPolicy Bypass -File "%~dp0lib\start-socks.ps1"
set "EXIT_CODE=%ERRORLEVEL%"

echo.
if not "%EXIT_CODE%"=="0" (
    echo O tunel terminou com erro: %EXIT_CODE%
) else (
    echo O tunel foi encerrado.
)
pause
exit /b %EXIT_CODE%
