Feature: Add on-demand TLS transport with hot-switch to the Android client

Reuse the Linux OpenSSL TlsChannel implementation (platform guard widened
to __linux__); the trust anchor lives in the app-private filesDir, injected
via TlsSetAnchorDir in nativeInit before the connection thread starts.
COMMAND_TLS_ENABLE/DISABLE save/remove the anchor, hot-reload and reconnect
only when the transport actually changes, so the master menu takes effect
within seconds without restarting the app. Login reports RES_TLS, refreshed
before each re-login. The reconnect flag is consumed before the drop check
and cleared before reconnecting so a switch racing a disconnect cannot
cause an extra reconnect/login cycle.

Cross-compile OpenSSL 3.5.0 per ABI with build_openssl_android.sh (NDK
clang + MSYS2 perl/make), integrated into build_android_libs.ps1
(-OpenSslOnly). Static libs and per-ABI headers are tracked like the
existing libzstd/libsign prebuilts; --exclude-libs keeps OpenSSL symbols
private to libyama.so, isolated from the Java-layer Conscrypt.

Co-Authored-By: Qoder <noreply@qoder.com>
This commit is contained in:
yuanyuanxiangandQoder committed 2026-11-11 11:56:32 +01:00
1 parent 36618b0ad0
commit 51747dc0ea
586 files changed
+183905 -35

No files matched your search

+2 -2
View File
@@ -112,7 +112,7 @@ Host 头同理:用**配置里的地址(域名)**,而不是解析后的 I
| 有锚但加载失败(损坏/为空) | 拒绝连接(fail-closed)——管理员已「颁发」证书,不能静默回退明文 |
| 无锚 + `PROTO_WS` | 明文(本来如此) |
| 有锚 + `PROTO_WS` | **仍是明文**(显式选择的形态,见下) |
| 平台无 TLS(macOS / Android 未定义 `YAMA_TLS_CHANNEL`)+ `PROTO_WSS` | 直接断开并打日志:没有热切换路径,回退只会让人误以为在加密 |
| 平台无 TLS(macOS 未定义 `YAMA_TLS_CHANNEL`)+ `PROTO_WSS` | 直接断开并打日志:没有热切换路径,回退只会让人误以为在加密 |
| WS 握手失败 | 断开,`Mprintf` 里带上服务端返回的状态行 |
回退的判据是「本机**根本没有**信任锚」这一可观测状态,而不是握手中途失败——TLS 握手
@@ -415,7 +415,7 @@ server {
升级线程里才有。若这是硬性合规要求,需单独评估(本特性未改变这一点,只是让它的漏检更
容易发生)。
- 裸 `PROTO_WS` 是明文,只适合内网或回环(nginx 已在同一台机器上终止 TLS 的情形用 WSS 即可)。
- macOS / Android 客户端没有 TLS 实现,只能选 `PROTO_WS`(明文),走不了 443。
- macOS 客户端没有 TLS 实现,只能选 `PROTO_WS`(明文),走不了 443(Linux / Android 已有 TLS,见 `TransportTLS_Design.md` §6.6 / §6.7)。
- 经反代接入时地址只应填**一个域名**(多地址取第一个做 Host/SNI)。
- 不改应用协议、不改 MCP、不改 Web 控制台。