通过 SSH 动态端口转发提供本地代理,包含三种平行的部署方案。
| 方案 | 服务管理 | SOCKS5 | HTTP/HTTPS | 适合场景 |
|---|---|---|---|---|
container/ |
Docker restart policy | 127.0.0.1:1080 |
127.0.0.1:1087 |
已使用 Docker、需要环境隔离 |
macos/ |
detached CLI supervisor | 每个代理独立配置 | - | macOS 多代理后台运行与 Web 状态 |
linux/ |
systemd user service | 127.0.0.1:1080 |
- | Linux 长期后台运行 |
原生方案直接使用系统的 OpenSSH,并默认开启:
ExitOnForwardFailure=yesServerAliveInterval=15ServerAliveCountMax=3BatchMode=yes- 严格的 SSH 主机密钥校验
cd container
cp example.env my.env
cp /path/to/private-key ssh_keys/id_rsa
make runcd macos
./install.sh
vi ~/.config/sshtunnel/config.json
sshtunnel start --webcd linux
./install.sh
vi ~/.config/sshtunnel/config.env
systemctl --user restart sshtunnel各方案的安装、状态检查、日志和卸载方法见对应目录的 README。
项目使用类似 Python Enhancement Proposal(PEP)的提案文档记录重要设计决策: