Feature(client): support host transfer in the macOS client
Mirror the Android semantics: move the main link to the assigned master immediately, persist the record in config so it survives restarts, return to the original master on expiry or early return, and revert after the new master stays unreachable for 60s. Share requests are answered as unsupported, and the capability matrix is updated accordingly. A target counts as unusable when the connection is refused or when it is accepted but never passes MasterSettings (a foreign service on that port, or a master built with another key). The latter used to be retried forever, stranding the host until expiry; both shapes now count toward the revert gate and reset only once a connection verifies. Early return clears the persisted record at once, so a crash before the main loop restores the original master cannot resurrect the transfer on restart. Endpoints from the command or the record are bounds-checked before being written into CONNECT_ADDRESS (strcpy_s is strcpy on POSIX), config access is serialized across the receive and main threads, the new validTo is published before the pending target so expiry cannot undo a fresh transfer, and a stale early-return flag is cleared when a new transfer applies or one is reverted. The Linux client was rebuilt with the shared header changes; the macOS side is not compiled here and still needs a build on a Mac. Co-Authored-By: deepseek-flash
This commit is contained in:
1 parent
913b74097b
commit
de9e9a7369
5 files changed
+342
-12
No files matched your search
@@ -23,10 +23,10 @@
|
||||
| 远程切换传输协议(TCP/WS/WSS) | ✓ | — | — | — |
|
||||
| 客户端 ID 重建(克隆机撞 ID) | ✓ | — | — | — |
|
||||
| 分享主机 / 取消分享 | ✓ | ✓ | — | — |
|
||||
| 转移主机(到期自动复原) | ✓ | ✓ | — | ✓ |
|
||||
| 转移主机(到期自动复原) | ✓ | ✓ | ✓ | ✓ |
|
||||
|
||||
说明:
|
||||
- 分享/转移:Android 实现转移、不实现分享(收到分享命令会回“不支持”);macOS 两者均未实现。
|
||||
- 分享/转移:Android 实现转移、不实现分享(收到分享命令会回“不支持”);macOS 同样只实现转移(收包即迁移主连接,记录存 `~/.config/ghost/config.conf` 的 `transfer` 键,连不上目标满 60 秒且连续失败 3 次后退回原主控),分享命令回“不支持”。
|
||||
- **WebSocket/WSS 是“出包能力”,不是“运行时切换能力”**:四个平台的网络层(`IOCPClient` + `WsChannel.h`)都实现了 WS/WSS,生成客户端时把「协议」选为 WebSocket 或 WS+TLS 即可,客户端启动后按烘焙的 `protoType` 连接(需经反向代理入口;WSS 还需内嵌或在线下发的信任锚)。但运行时的「协议切换」菜单走 `COMMAND_SET_PROTO`,只有 Windows 客户端处理该命令并声明 `CLIENT_CAP_PROTO_SWITCH`;其他平台该菜单整组置灰,菜单里勾选 TCP 只是当前实际连接的传输,不代表客户端只能走 TCP。
|
||||
- UDP/KCP/HTTP 伪装传输:只有 Windows 客户端有对应实现;Linux/macOS/Android 的网络层只处理 TCP/WS/WSS,出包时选其他协议不会生效。
|
||||
- 并发上线(`RUNNING_PARALLEL`)只有 Windows 客户端实现;其他平台按单实例运行。
|
||||
|
||||
Reference in new issue
Block a user