公网中转部署教程
公网中转是服务器端服务(不是桌面端客户端),让手机在外网也能控制桌面端。Linux 4 步即可完成,Windows 命令见末尾。
公网中转是服务器端服务(不是桌面端客户端),让手机在外网也能控制桌面端。Linux 4 步即可完成,Windows 命令见末尾。
最重要:一份配置只能绑一台桌面端!
每台桌面端必须使用各自独立的配置;切勿把同一份 JSON / 同一个 tunnelId 给多台桌面端共用——否则会导致连接错乱、互相顶掉、无法正常使用。多台桌面端请分别执行 create 生成各自独立的配置。
在你的公网服务器(Linux)上执行一键安装脚本,自动装好并启动中转服务。
wget -qO- http://bash.sukeyun.com/tunnel-server/scripts/install-pchat-tunnel.sh | bash
curl -fsSL http://bash.sukeyun.com/tunnel-server/scripts/install-pchat-tunnel.sh | bash
为每台桌面端创建独立配置,命令执行后会直接输出一段 JSON。
bash /opt/pchat-tunnel/scripts/pchat-tunnel-manager.sh create
把整段 JSON 复制到桌面端:设置 → 联机 → 公网中转,粘贴后保存。
手机端选择公网二维码扫码,即可在外网连接并远程操控桌面端。
bash /opt/pchat-tunnel/scripts/pchat-tunnel-manager.sh open-portsstatus 确认服务在运行、logs 看日志;粘贴不上多半是 JSON 复制不全或配错了桌面端。Commands
中转服务日常管理命令,Linux / Windows 切换查看,点右上角「复制」即可整条复制运行。
bash /opt/pchat-tunnel/scripts/pchat-tunnel-manager.sh status
查看服务是否运行、是否已开机自启。
bash /opt/pchat-tunnel/scripts/pchat-tunnel-manager.sh logs
实时滚动输出运行日志,排查连接问题用,Ctrl + C 退出。
bash /opt/pchat-tunnel/scripts/pchat-tunnel-manager.sh restart
改了配置或服务异常时重启;启动 / 停止换成 start / stop。
bash /opt/pchat-tunnel/scripts/pchat-tunnel-manager.sh create office
为每台桌面端生成独立配置,office 为自定义名称,可省略。
bash /opt/pchat-tunnel/scripts/pchat-tunnel-manager.sh list
列出已创建的全部桌面端配置、状态与手机端公网地址。
bash /opt/pchat-tunnel/scripts/pchat-tunnel-manager.sh config office
重新打印某台桌面端要粘贴的 JSON,office 换成对应 tunnelId。
bash /opt/pchat-tunnel/scripts/pchat-tunnel-manager.sh remove <tunnelId>
删除指定配置并断开其连接,<tunnelId> 用 list 里的值替换。
bash /opt/pchat-tunnel/scripts/pchat-tunnel-manager.sh open-ports
放行隧道端口 36300 与 SSH(跳过数据库等敏感端口);云服务器仍需在「安全组」放行 36300。
wget -qO- http://bash.sukeyun.com/tunnel-server/scripts/install-pchat-tunnel.sh | bash
安装或升级到最新版,自动保留已有 tunnelId / 配置;没有 wget 用 curl -fsSL。
iwr -UseBasicParsing http://bash.sukeyun.com/tunnel-server/scripts/install-pchat-tunnel.ps1 -OutFile $env:TEMP\install-pchat-tunnel.ps1; powershell -NoProfile -ExecutionPolicy Bypass -File $env:TEMP\install-pchat-tunnel.ps1
以管理员 PowerShell执行,安装或升级中转服务。
powershell -NoProfile -ExecutionPolicy Bypass -File C:\ProgramData\PChatTunnel\pchat-tunnel-manager.ps1 status
查看服务是否运行、是否已开机自启。
powershell -NoProfile -ExecutionPolicy Bypass -File C:\ProgramData\PChatTunnel\pchat-tunnel-manager.ps1 logs
实时输出运行日志,排查连接问题用。
powershell -NoProfile -ExecutionPolicy Bypass -File C:\ProgramData\PChatTunnel\pchat-tunnel-manager.ps1 restart
改了配置或服务异常时重启;启动 / 停止换成 start / stop。
powershell -NoProfile -ExecutionPolicy Bypass -File C:\ProgramData\PChatTunnel\pchat-tunnel-manager.ps1 create office
为每台桌面端生成独立配置,office 为自定义名称,可省略。
powershell -NoProfile -ExecutionPolicy Bypass -File C:\ProgramData\PChatTunnel\pchat-tunnel-manager.ps1 list
列出已创建的全部桌面端配置、状态与手机端公网地址。
powershell -NoProfile -ExecutionPolicy Bypass -File C:\ProgramData\PChatTunnel\pchat-tunnel-manager.ps1 config office
重新打印某台桌面端要粘贴的 JSON,office 换成对应 tunnelId。
powershell -NoProfile -ExecutionPolicy Bypass -File C:\ProgramData\PChatTunnel\pchat-tunnel-manager.ps1 remove <tunnelId>
删除指定配置并断开其连接,<tunnelId> 用 list 里的值替换。
start、停止 stop、开机自启 enable / disable / autostart、卸载 uninstall,把上面对应命令末尾的动作词替换即可(Linux / Windows 通用)。Windows 无 open-ports 子命令,请在系统防火墙与云「安全组」放行 TCP 36300。即将开始下载安装包。若系统提示来自未识别开发者,可在「系统设置 → 隐私与安全性」中选择仍要打开。
若打开或安装时提示「安装包已损坏」或无法打开,请打开「终端」执行以下命令移除隔离属性(请先将 Pchat桌面版.app 拖入「应用程序」文件夹):
应用程序路径:/Applications/Pchat桌面版.app
若应用安装在其他位置,请将命令末尾路径替换为实际的 Pchat桌面版.app 路径。