update README.md with latest ports and project structure

This commit is contained in:
祀梦
2026-01-27 21:32:39 +08:00
parent 253350d1f2
commit 74fa0c60ad

View File

@@ -14,13 +14,13 @@
## 📦 技术栈
### 后端
- **框架**: FastAPI (端口 3000)
- **框架**: FastAPI (端口 8923)
- **数据库**: SQLite + aiosqlite
- **异步**: asyncio
- **实时通信**: WebSocket
### 前端
- **框架**: Vue 3 + Vite (端口 8080)
- **框架**: Vue 3 + Vite (端口 6173)
- **UI库**: Element Plus
- **状态管理**: Pinia
- **图表**: ECharts
@@ -44,7 +44,11 @@ npm install
### 3. 启动服务
#### 方式一:使用启动脚本(推荐)
双击运行 `start.bat` 选择启动方式
```bash
cd script
start.bat
```
#### 方式二:手动启动
@@ -59,9 +63,16 @@ cd frontend
npm run dev
```
#### 停止服务
```bash
cd script
stop.bat
```
### 4. 访问 WebUI
打开浏览器访问:**http://localhost:8080**
打开浏览器访问:**http://localhost:6173**
## 📁 项目结构
@@ -69,27 +80,41 @@ npm run dev
ProxyPool/
├── api_server.py # FastAPI 后端服务器
├── tasks_manager.py # 任务管理器
├── main.py # 原始命令行入口
├── requirements.txt # Python 依赖
├── start.bat # 启动脚本
├── main.py # 爬虫主程序
├── config.py # 配置文件
├── requirements.txt # Python 依赖
├── .env.example # 环境变量示例
├── core/ # 核心模块
│ ├── crawler.py # 爬虫基类
│ ├── validator.py # 代理验证器
│ ├── sqlite.py # 数据库管理
── plugin_manager.py# 插件管理器
│ └── log.py # 日志配置
├── script/ # 启动脚本
│ ├── start.bat # Windows 启动脚本
│ ├── start.ps1 # PowerShell 启动脚本
│ ├── stop.bat # Windows 停止脚本
── README.md # 脚本说明文档
├── plugins/ # 代理源插件
│ ├── __init__.py
── speedx.py # SpeedX 代理源
├── core/ # 核心模块
│ ├── crawler.py # 爬虫基类
── validator.py # 代理验证器
│ ├── sqlite.py # 数据库管理
│ ├── plugin_manager.py # 插件管理器
│ ├── log.py # 日志配置
│ └── auth.py # 认证模块
├── frontend/ # Vue3 前端
├── plugins/ # 代理源插件
│ ├── fate0.py # Fate0 代理源
│ ├── ip3366.py # IP3366 代理源
│ ├── ip89.py # IP89 代理源
│ ├── kuaidaili.py # 快代理源
│ ├── yundaili.py # 云代理源
│ ├── speedx.py # SpeedX 代理源
│ └── proxylist_download.py # ProxyList 代理源
├── frontend/ # Vue3 前端
│ ├── src/
│ │ ├── api/ # API 封装
│ │ ├── stores/ # Pinia 状态管理
│ │ ├── views/ # 页面组件
│ │ ├── router/ # 路由配置
│ │ ├── components/ # 通用组件
│ │ ├── App.vue
│ │ ├── main.js
│ │ └── style.css # 全局样式
@@ -97,8 +122,8 @@ ProxyPool/
│ ├── package.json
│ └── vite.config.js
└── data/ # 数据存储目录
└── proxy_pool.db # SQLite 数据库
└── db/ # 数据存储目录
└── proxies.sqlite # SQLite 数据库
```
## 🎨 主题切换
@@ -144,7 +169,7 @@ GET /api/scheduler
### WebSocket 连接
```
ws://localhost:3000/ws
ws://localhost:8923/ws
```
## 🐛 调试指南
@@ -169,16 +194,16 @@ ws://localhost:3000/ws
### 数据不更新?
1. **检查数据库**
- 确认 `data/proxy_pool.db` 文件存在
- 确认 `db/proxies.sqlite` 文件存在
- 使用 SQLite 客户端打开查看数据
2. **手动测试 API**
```bash
# 获取统计信息
curl http://localhost:3000/api/stats
curl http://localhost:8923/api/stats
# 获取代理列表
curl -X POST http://localhost:3000/api/proxies \
curl -X POST http://localhost:8923/api/proxies \
-H "Content-Type: application/json" \
-d '{"page": 1, "page_size": 20}'
```
@@ -202,7 +227,7 @@ ws://localhost:3000/ws
## 🔧 常见问题
### Q: 启动后端口被占用?
A: 修改 `api_server.py` 最后一行的端口号(默认3000)或 `frontend/vite.config.js` 中的端口号(默认8080
A: 修改 `api_server.py` 最后一行的端口号(默认8923)或 `frontend/vite.config.js` 中的端口号(默认6173
### Q: 爬虫无法抓取代理?
A: 检查网络连接,确保能访问目标网站,或尝试更换代理源插件
@@ -211,7 +236,10 @@ A: 检查网络连接,确保能访问目标网站,或尝试更换代理源
A: 增加验证超时时间,或减少并发验证数量
### Q: 数据库文件在哪里?
A: 默认在 `data/proxy_pool.db`,可在 `core/sqlite.py` 中修改 `db_path`
A: 默认在 `db/proxies.sqlite`,可在 `core/sqlite.py` 中修改 `db_path`
### Q: 如何清空数据库?
A: 运行命令 `python -c "from core.sqlite import SQLiteManager; import asyncio; asyncio.run(SQLiteManager().clear_all())"`
## 📄 License