| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- @echo off
- chcp 65001 >nul 2>&1
- echo ========================================
- echo Network Topology Discovery System - Build Script
- echo ========================================
- echo.
- REM Check if go.mod exists
- if not exist go.mod (
- echo Error: go.mod not found!
- echo Please run this script from the project root directory.
- echo.
- echo Current directory: %CD%
- echo.
- pause
- exit /b 1
- )
- echo [1/3] Cleaning old files...
- if exist network-topology.exe del network-topology.exe
- echo.
- echo [2/3] Building program...
- set GOOS=windows
- set GOARCH=amd64
- set CGO_ENABLED=1
- set CXX=x86_64-w64-mingw32-g++
- go build -o network-topology.exe -ldflags="-s -w" ./cmd
- if %ERRORLEVEL% NEQ 0 (
- echo.
- echo Build failed!
- pause
- exit /b 1
- )
- echo.
- echo [3/3] Creating config file example...
- if not exist config.json (
- echo Creating default config file...
- 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 Build Complete!
- echo ========================================
- echo.
- echo Usage:
- echo network-topology.exe (Use default config)
- echo network-topology.exe config.json (Use specified config)
- echo.
- echo Web UI: http://localhost:8080
- echo.
- pause
|