# 代理管理平台 一个智能代理调度平台,支持用户通过 SOCKS5 连接,根据解锁能力和使用规则自动选择最优节点。 ## 功能特性 - **SOCKS5 代理服务**:支持用户名密码认证,连接数限制 - **智能节点调度**:基于延迟、连接数、权重的负载均衡 - **WARP IP 管理**:自动刷新 IP,解锁检测 - **解锁能力筛选**:支持 GPT、Netflix、Disney+ 等服务 - **规则引擎**:根据解锁失败、使用次数等条件自动更换 IP - **管理面板**:用户管理、节点管理、统计报表 ## 快速开始 ### 前置要求 - Go 1.21+ - PostgreSQL 15+ - Redis 7+ - Node.js 18+ (前端开发) - Docker & Docker Compose(推荐) ### 使用 Docker Compose 启动 ```bash # 克隆项目 git clone https://git.viaeon.com/your-org/proxy-platform.git cd proxy-platform # 启动服务 docker-compose -f deployments/docker-compose.yml up -d # 查看日志 docker-compose -f deployments/docker-compose.yml logs -f scheduler ``` ### 手动启动 ```bash # 安装依赖 go mod download # 启动数据库 docker-compose -f deployments/docker-compose.yml up -d postgres redis # 构建程序 make build # 启动调度中心 ./bin/scheduler # 启动节点 Agent(在另一台服务器上) ./bin/agent ``` ## 配置说明 ### 调度中心配置 (configs/scheduler.yaml) ```yaml server: host: "0.0.0.0" port: 8080 socks5: host: "0.0.0.0" port: 1080 max_connections: 10000 timeout: 30 database: host: "localhost" port: 5432 user: "postgres" password: "postgres" database: "proxy_platform" scheduler: strategy: "least_latency" # 负载均衡策略 health_check_interval: 10 ``` ### 节点 Agent 配置 (configs/agent.yaml) ```yaml agent: node_id: "node_001" name: "US-Node-1" region: "US" warp: enabled: true socks5_port: 40000 refresh_cooldown: 300 max_refresh_retries: 5 unlock: check_interval: 300 services: - name: "gpt" url: "https://chat.openai.com/" - name: "netflix" url: "https://www.netflix.com/title/80018499" ``` ## API 文档 ### 用户管理 ```bash # 创建用户 POST /api/v1/users { "username": "user1", "password": "password123", "traffic_quota": 107374182400, "expire_days": 30 } # 获取用户列表 GET /api/v1/users?page=1&page_size=20 # 更新用户 PUT /api/v1/users/:id # 删除用户 DELETE /api/v1/users/:id ``` ### 节点管理 ```bash # 创建节点 POST /api/v1/nodes { "node_id": "node_001", "name": "US-Node-1", "host": "1.2.3.4", "port": 1080, "region": "US" } # 获取节点列表 GET /api/v1/nodes # 刷新节点 IP POST /api/v1/nodes/:id/refresh-ip ``` ### Agent 接口 ```bash # 心跳上报 POST /api/v1/agent/heartbeat { "node_id": "node_001", "online": true, "warp_connected": true, "current_ip": "104.16.132.229", "connections": 42 } # 上报解锁状态 POST /api/v1/agent/unlock/report ``` ## 使用示例 ### 连接代理 ```bash # 使用 curl 测试 curl --socks5 user1:password123@127.0.0.1:1080 https://httpbin.org/ip # 使用 Python import requests proxies = { 'http': 'socks5://user1:password123@127.0.0.1:1080', 'https': 'socks5://user1:password123@127.0.0.1:1080' } response = requests.get('https://httpbin.org/ip', proxies=proxies) print(response.json()) ``` ### 节点部署 ```bash # 安装 WARP curl -fsSL https://pkg.cloudflareclient.com/install.sh | sudo bash # 连接 WARP sudo warp-cli register sudo warp-cli connect sudo warp-cli set-mode proxy # 配置 agent.yaml # 启动 Agent ./agent ``` ## 开发 ```bash # 运行测试 go test ./... # 构建所有组件 make build # 构建 Docker 镜像 make docker # 运行代码检查 make lint ``` ## License MIT