@echo off echo ======================================== echo 网络拓扑发现系统 - 编译脚本 echo ======================================== echo. echo [1/3] 清理旧文件... if exist network-topology.exe del network-topology.exe echo. echo [2/3] 编译程序... set GOOS=windows set GOARCH=amd64 go build -o network-topology.exe -ldflags="-s -w" ./cmd if %ERRORLEVEL% NEQ 0 ( echo. echo 编译失败! pause exit /b 1 ) echo. echo [3/3] 创建配置文件示例... if not exist config.json ( echo 创建默认配置文件... echo {> config.json echo "scan_ranges": ["192.168.1.0/24"],>> config.json echo "devices": [],>> config.json echo "ssh": {>> config.json echo "timeout": 10,>> config.json echo "max_retries": 3,>> config.json echo "port": 22>> config.json echo },>> config.json echo "web": {>> config.json echo "port": 8080,>> config.json echo "host": "0.0.0.0">> config.json echo },>> config.json echo "scanner": {>> config.json echo "concurrency": 10,>> config.json echo "timeout": 2>> config.json echo }>> config.json echo }>> config.json ) echo. echo ======================================== echo 编译完成! echo ======================================== echo. echo 运行方式: echo network-topology.exe (使用默认配置) echo network-topology.exe config.json (使用指定配置文件) echo. echo 访问地址: http://localhost:8080 echo. pause