@echo off
title FRP-SOCKS Tunnel
cd /d "%~dp0"

echo === Cleaning up old processes ===
taskkill /F /IM gost.exe >nul 2>&1
taskkill /F /IM frpc.exe >nul 2>&1
timeout /t 1 /nobreak >nul

echo === Starting gost SOCKS5 proxy on port 1080 ===
start "gost" /B cmd /c "gost.exe -L socks5://127.0.0.1:1080 > gost.log 2>&1"
timeout /t 2 /nobreak >nul

echo === Starting frpc tunnel (with auto-reconnect) ===
frpc.exe -c frpc.toml

echo === frpc exited, cleaning up gost ===
taskkill /F /IM gost.exe >nul 2>&1
echo === Press any key to close ===
pause >nul
