Files
clash-web/README.md
T

59 lines
2.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Clash Web
通过浏览器管理 Clash/Mihomo 订阅、代理节点、分流规则、连接、日志和外网连通性测试。使用 Vue 3、Go 和 SQLite,Mihomo 作为独立代理内核运行,服务部署在 Linux VM 上。
## 开发
需要 Go 1.24+、Node.js 22.12+ 或 24+、npm 和 Python 3。从项目根目录执行:
```bash
make build
make assets
./bin/clashweb --mihomo ./bin/mihomo --init
./bin/mihomo -d ./data/mihomo -f ./data/mihomo/config.yaml
```
在另一终端启动管理服务:
```bash
./bin/clashweb --mihomo ./bin/mihomo
```
打开 `http://127.0.0.1:8080`,用启动日志中的首次设置令牌创建管理员密码。开发环境保持 TUN 关闭。
依赖和内核已准备时,可直接复用,无需重复执行安装、下载命令。前端热更新、测试和配置说明见 [开发文档](docs/development.md)。
## 部署
在开发机生成 Linux amd64 部署包:
```bash
python3 scripts/package.py
```
完整包 `clashweb-linux-amd64.tar.gz` 用于首次部署,`clashweb-update-linux-amd64.tar.gz` 用于升级管理程序;两者均带 SHA-256 校验文件。目标 VM 无需安装 Go、Node.js 或 npm。
安装服务、TUN 网关和客户端接入见 [部署文档](docs/deployment.md),程序、内核与规则升级见 [升级文档](docs/upgrading.md)。网络准备及 systemd 安装脚本在目标 VM 上运行。
## 文档
- [API](docs/api.md)
- [开发与测试](docs/development.md)
- [部署与恢复](docs/deployment.md)
- [升级与回退](docs/upgrading.md)
- [第三方组件](docs/third-party.md)
## 项目结构
```text
cmd/clashweb/ Go 服务入口
internal/app/ 认证、SQLite、订阅及 Mihomo 控制
web/src/ Vue 页面、组件和状态管理
web/e2e/ 浏览器测试
scripts/ 构建资源、部署、诊断与打包工具
deploy/ systemd 服务定义
docs/ API、开发和运维文档
```
仓库仅包含源码、锁文件、测试与部署资料。本机数据库、配置密钥、内核二进制、规则文件、依赖目录、构建输出、测试缓存和部署包不提交到 Git。