@echo off
title HakiCat Tunnel - Keep this window open
color 0B

echo ============================================================
echo    HakiCat One-Click Tunnel
echo ============================================================
echo.
echo   This maps this PC's SSH to port 2222 on the server,
echo   so the server-side assistant can reach this computer.
echo.
echo   IMPORTANT: Keep this window OPEN. Closing it drops the tunnel.
echo.
echo ------------------------------------------------------------
echo.

set SERVER=64.90.27.5
set SERVER_USER=root
set RPORT=2222

where ssh >nul 2>nul
if errorlevel 1 (
  echo [ERROR] ssh not found.
  echo         Install OpenSSH Client:
  echo         Settings - Apps - Optional features - Add - OpenSSH Client
  echo.
  pause
  exit /b 1
)

echo Server: %SERVER%    User: %SERVER_USER%    Reverse port: %RPORT%
echo.
echo You will be asked for the SERVER password.
echo (Nothing shows while typing - that is normal.)
echo.

:loop
echo [%date% %time%] connecting...
ssh -N -o ServerAliveInterval=20 -o ServerAliveCountMax=3 -o ExitOnForwardFailure=yes -o StrictHostKeyChecking=no -R %RPORT%:127.0.0.1:22 %SERVER_USER%@%SERVER%
echo.
echo [%date% %time%] disconnected. Reconnecting in 10s... (Ctrl+C to quit)
timeout /t 10 /nobreak >nul
goto loop
