BestCDN/install.bat
2025-07-26 12:59:57 +08:00

86 lines
2.0 KiB
Batchfile

@echo off
REM BestCDN Installation Script for Windows
echo BestCDN Installation Script
echo ==========================
REM Check if Python is installed
python --version >nul 2>&1
if errorlevel 1 (
echo Error: Python is not installed or not in PATH. Please install Python 3.7+ first.
pause
exit /b 1
)
echo ✓ Python found
REM Create virtual environment
echo Creating virtual environment...
python -m venv venv
if errorlevel 1 (
echo Error: Failed to create virtual environment
pause
exit /b 1
)
echo ✓ Virtual environment created
REM Activate virtual environment
echo Activating virtual environment...
call venv\Scripts\activate.bat
REM Upgrade pip
echo Upgrading pip...
python -m pip install --upgrade pip
REM Install dependencies
echo Installing dependencies...
pip install -r requirements.txt
if errorlevel 1 (
echo Error: Failed to install dependencies
pause
exit /b 1
)
echo ✓ Dependencies installed
REM Create necessary directories
echo Creating directories...
if not exist "ip_lists" mkdir ip_lists
if not exist "results" mkdir results
if not exist "logs" mkdir logs
echo ✓ Directories created
REM Create example IP list files
echo Creating example IP list files...
if not exist "ip_lists" mkdir ip_lists
REM Create example files if they don't exist
for %%p in (cloudflare fastly edgeone esa) do (
if not exist "ip_lists\%%p.txt" (
echo # %%p IP list - Replace with your actual IPs > "ip_lists\%%p.txt"
echo # Example: 192.168.1.1 >> "ip_lists\%%p.txt"
echo # Example: 10.0.0.0/24 >> "ip_lists\%%p.txt"
echo Created example file: ip_lists\%%p.txt
) else (
echo File already exists: ip_lists\%%p.txt
)
)
echo.
echo Installation completed successfully!
echo.
echo To use BestCDN:
echo 1. Activate the virtual environment:
echo venv\Scripts\activate
echo.
echo 2. Edit IP list files in ip_lists\ directory
echo.
echo 3. Run the example:
echo python example_usage.py
echo.
echo For more information, see README.md
pause