fix(share): carry the transport in the share and assign payloads

The share payload was host:port:shine and carried no transport at all, so a
shared client fell back to its baked-in protoType. Share instances also skip
ApplyProtoSwitch (ClientDll.cpp:810), so a client upgraded to WSS was shared
to a TLS front end as raw TCP and looped on HTTP/1.1 400.

Extend both payloads with an optional trailing transport field:

    share  : host:port:shine[:transport]
    assign : host:port:days:shine[:transport]

The field is omitted when the source protocol is not TCP/WS/WSS, so HTTP/UDP/
KCP hosts keep their previous behaviour instead of being silently downgraded
to plain TCP.

- server: add SelectedShareTransport(), share it between OnOnlineShare and
  OnOnlineAssignTo, and accept a tcp:// ws:// wss:// prefix in the address.
- client: parse the field on both paths and persist the assigned value to
  settings/master_transport, clearing it when the field is absent.
- share_list: dedup on host:port instead of the whole record, so re-sharing
  a host with a different transport replaces the stale entry.
- assign: guard bToken[_MAX_PATH] against the longer payload.
- lang: translate the reworded prompt and the three new messages in en_US,
  zh_TW and de_DE.

Transport is pinned at share time and does not follow a later protocol switch
on the master link; the m_bShared gate stays as-is on purpose.
This commit is contained in:
yuanyuanxiang committed 2026-11-02 14:01:39 +01:00
1 parent 951b4072e5
commit 454d25d37f
10 files changed
+266 -22

No files matched your search

+3 -3
View File
@@ -209,11 +209,11 @@ volatile EmbeddedTlsAnchor g_embeddedTlsAnchor = {
一个客户端会被指向**另一台主控**,而内嵌锚钉的是生成时那台:
```cpp
// client/ClientDll.cpp:735 —— 被转移(assigned)的客户端改连新主控
// client/ClientDll.cpp:743 —— 被转移(assigned)的客户端改连新主控
auto saved_ip = cfg.GetStr("settings", "master");
settings.SetServer(saved_ip.c_str(), saved_port);
// client/ClientDll.cpp:766 —— 分享列表里的实例连到别的分享主控
auto a = NewClientStartArg(shareList[i].c_str(), IsSharedRunning, TRUE, proto);
// client/ClientDll.cpp:788 —— 分享列表里的实例连到别的分享主控
auto a = NewClientStartArg(shareList[i].c_str(), IsSharedRunning, TRUE, proto, transport);
```
两条路径最终都走 `IOCPClient::ConnectServer` 的 `if (TlsEnabled() && ...) Handshake()`。今天的客户端没有锚,所以连过去是明文、由对方下发自己的锚;**有了内嵌锚就会用 A 的证书去校验 B,握手失败即 fail-closed,分享/转移功能直接失效且无法自愈**。