docs: 添加tmux web访问方案调研

This commit is contained in:
2026-06-29 22:17:24 +08:00
parent 1cdaba9c85
commit b730e28b1a
@@ -434,4 +434,99 @@ glm-5.2
---
## 十三、tmux Web 访问方案(补充调研)
### 13.1 可行方案
**推荐工具:gotty** - 将 tmux 会话共享为 web 应用
### 13.2 方案一:gotty(推荐)
#### 安装
**Mac (Homebrew)**:
```bash
brew install yudai/gotty/gotty
```
**Go 环境**:
```bash
go get github.com/yudai/gotty
```
#### 基本使用
**1. 启动 tmux 会话**
```bash
tmux new -s mysession
```
**2. 用 gotty 共享 tmux 会话**
```bash
gotty tmux attach -t mysession
```
**3. 访问**
- 本地访问: `http://localhost:8080`
- 局域网访问: `http://YOUR_LAN_IP:8080`
#### 局域网配置
**命令行参数**:
```bash
gotty -a 0.0.0.0 -p 8080 tmux attach -t mysession
```
**配置文件 (~/.gotty)**:
```
address = "0.0.0.0"
port = "8080"
permit_write = true
enable_basic_auth = false
```
**查看本机 IP**:
```bash
ifconfig | grep inet
# 或
ip addr show
```
### 13.3 方案二:webtmux(专为 tmux 设计)
**GitHub**: https://github.com/chrismccord/webtmux
**特点**:
- 基于 gotty,专门为 tmux 优化
- 可视化面板布局
- 触摸友好控制
- 更好的移动端支持
**基本使用**:
```bash
# 克隆项目
git clone https://github.com/chrismccord/webtmux
cd webtmux
make
# 运行
./webtmux --address 0.0.0.0 --port 8080
```
### 13.4 局域网访问要点
| 配置项 | 说明 |
|--------|------|
| **bind 0.0.0.0** | 监听所有网络接口(允许局域网访问) |
| **防火墙** | 确保端口 8080 未被阻止 |
| **获取 IP** | `ifconfig` 或 `ip addr` 查看局域网 IP |
**访问地址示例**:
```
http://192.168.1.100:8080
http://192.168.2.154:8080
```
---
**报告结束**