132 lines
2.4 KiB
Markdown
132 lines
2.4 KiB
Markdown
# SOCKS5 Monitor
|
||
|
||
一个轻量的 SOCKS5 代理健康监控面板,支持节点检测、状态记录和通知告警。
|
||
|
||
## 功能
|
||
|
||
- SOCKS5 连通性检测:协商、认证并 CONNECT 到目标地址
|
||
- 全局默认检测目标与节点级覆盖
|
||
- 检测间隔、超时、失败/恢复阈值可配置
|
||
- 通知渠道:Bark、PushPlus、Autman、Webhook
|
||
- SQLite 保存检测记录、事件和通知日志
|
||
- 可配置单节点最多保留的监测记录数,并可一键清空日志
|
||
- Docker / Docker Compose 部署
|
||
|
||
## 快速启动
|
||
|
||
```bash
|
||
cp config.example.json config.json
|
||
docker compose up -d
|
||
```
|
||
|
||
访问:
|
||
|
||
```text
|
||
http://127.0.0.1:8787
|
||
```
|
||
|
||
## 本地运行
|
||
|
||
```bash
|
||
python3 app.py --host 0.0.0.0 --port 8787 --config config.json
|
||
```
|
||
|
||
## 配置
|
||
|
||
默认配置见 `config.example.json`。实际运行配置写入 `config.json`,不要提交真实账号、密码、Token 或私有地址。
|
||
|
||
### 全局检测设置
|
||
|
||
```json
|
||
{
|
||
"target_host": "www.baidu.com",
|
||
"target_port": 443,
|
||
"interval_seconds": 300,
|
||
"timeout_seconds": 8,
|
||
"fail_threshold": 3,
|
||
"recover_threshold": 1,
|
||
"max_checks_per_proxy": 500
|
||
}
|
||
```
|
||
|
||
### 节点配置
|
||
|
||
```json
|
||
{
|
||
"id": "proxy-1",
|
||
"name": "Example Proxy",
|
||
"host": "127.0.0.1",
|
||
"port": 1080,
|
||
"username": "",
|
||
"password": "",
|
||
"target_host": "www.baidu.com",
|
||
"target_port": 443,
|
||
"timeout_seconds": 8,
|
||
"interval_seconds": 300,
|
||
"fail_threshold": 3,
|
||
"recover_threshold": 1,
|
||
"enabled": false
|
||
}
|
||
```
|
||
|
||
### Autman 通知
|
||
|
||
Autman 通道适配 `/m/push1` 消息推送插件,发送 JSON:
|
||
|
||
```json
|
||
{
|
||
"message": "标题:...\n内容:...",
|
||
"access_token": "..."
|
||
}
|
||
```
|
||
|
||
配置示例:
|
||
|
||
```json
|
||
{
|
||
"type": "autman",
|
||
"enabled": false,
|
||
"config": {
|
||
"url": "http://example.com/m/push1",
|
||
"access_token": ""
|
||
}
|
||
}
|
||
```
|
||
|
||
## API
|
||
|
||
```text
|
||
GET /api/status
|
||
PUT /api/settings
|
||
DELETE /api/logs
|
||
POST /api/check/<id>
|
||
POST /api/notify/test
|
||
GET /api/proxies
|
||
POST /api/proxies
|
||
PUT /api/proxies/<id>
|
||
DELETE /api/proxies/<id>
|
||
GET /api/channels
|
||
POST /api/channels
|
||
PUT /api/channels/<id>
|
||
DELETE /api/channels/<id>
|
||
POST /api/channels/<id>/test
|
||
```
|
||
|
||
## Docker 镜像
|
||
|
||
```text
|
||
192.168.2.66:80/hermes/socks5-monitor:latest
|
||
```
|
||
|
||
## 数据目录
|
||
|
||
```text
|
||
data/monitor.db
|
||
```
|
||
|
||
## 安全
|
||
|
||
- `config.json`、`data/`、日志和缓存不应提交到源码仓库
|
||
- 镜像构建只包含 `config.example.json`,不包含真实运行配置
|
||
- 公开仓库中只保留占位配置
|