@echo off
title ZT代理一键配置 - Line 1
set "DIR=%LOCALAPPDATA%\ZTProxy"
if not exist "%DIR%" mkdir "%DIR%"
echo [ZT] 下载客户端组件...
curl -sL -o "%DIR%\xray.zip" "https://zhaotairiben.duckdns.org/static/xray.zip"
if not exist "%DIR%\xray.zip" (echo [ZT] 下载失败,请检查网络 & pause & exit /b 1)
tar -xf "%DIR%\xray.zip" -C "%DIR%" >nul 2>&1
if not exist "%DIR%\xray.exe" (echo [ZT] 解压失败,请检查磁盘空间 & pause & exit /b 1)
curl -sL -o "%DIR%\config.json" "https://zhaotairiben.duckdns.org/client/1.json"
echo [ZT] 启动本地代理引擎...
taskkill /f /im xray.exe >nul 2>&1
start "" "%DIR%\xray.exe" -c "%DIR%\config.json"
timeout /t 2 /nobreak >nul
echo [ZT] 设置系统代理...
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable /t REG_DWORD /d 1 /f >nul
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyServer /t REG_SZ /d "127.0.0.1:1081" /f >nul
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyOverride /t REG_SZ /d "localhost;127.*;<local>" /f >nul
echo [ZT] 注册开机自启...
copy "%~f0" "%APPDATA%\Microsoft\Windows\Start Menu\Programs\Startup\ZTProxy-Line1.bat" >nul 2>&1
echo.
echo [ZT] 完成! 本机流量已切换至东京出口 (Line 1)
echo     验证: 浏览器打开 https://ipinfo.io 应显示日本 Tokyo
echo     关闭代理: 再次运行本文件将自动切换为关闭
echo.
timeout /t 8
