Feat(client): add TLS transport to the macOS client
macOS shares the Linux transport: TlsChannel.h now dispatches __APPLE__ to the OpenSSL implementation, so handshake, pinned trust anchor, reload and removal all come from client/TlsChannelLinux.cpp. Only the platform glue is new: ConfigDir() follows initConfigPaths (HOME, then getpwuid(), then /tmp; no XDG) so the anchor sits next to config.conf, and ExeDir() uses _NSGetExecutablePath. First connect stays plaintext. The operator turns TLS on from the online list: COMMAND_TLS_ENABLE carries the anchor PEM, COMMAND_TLS_DISABLE removes it. macos/main.mm saves the anchor, calls TlsReload() and only reconnects when the transport actually changed, so re-saving the same anchor does not drop a live session. RES_TLS is filled from TlsEnabled() and refreshed on every reconnect; fillLoginInfo clears szReserved first now, because AddReserved appends and it runs twice on a group change. CMake builds arm64 only (deployment target 11.0) and links Homebrew openssl@3 statically when libcrypto.a is present, so the binary carries no Homebrew path dependency. Not built or run on a Mac yet: the Apple branch was syntax-checked under WSL and the login refresh probe-tested; macos/README.txt has the build and verify steps. Co-Authored-By: deepseek-flash
This commit is contained in:
1 parent
3d87ec6720
commit
b743de6747
12 files changed
+298
-38
No files matched your search
+6
-1
@@ -17,6 +17,7 @@
|
||||
#endif
|
||||
|
||||
#include <iostream>
|
||||
#include <cstdio> // fprintf:macOS 非 ObjC 翻译单元的 Mprintf 走 stderr
|
||||
#include <fstream>
|
||||
#include <mutex>
|
||||
#include <queue>
|
||||
@@ -390,7 +391,11 @@ inline const char* getFileName(const char* path)
|
||||
#ifdef __OBJC__
|
||||
#define Mprintf(format, ...) NSLog(@"%@", [NSString stringWithFormat:@(format), ##__VA_ARGS__])
|
||||
#else
|
||||
#define Mprintf(format, ...) printf(format, ##__VA_ARGS__)
|
||||
// 非 ObjC 翻译单元(IOCPClient/FileManager/TlsChannel 等)没有 NSLog,只能写流。
|
||||
// 必须写 stderr:macos/main.mm 把 stderr 重定向到 /tmp/ghost.log(daemon 与 App bundle
|
||||
// 两种启动方式都做,App bundle 还设了 CFLOG_FORCE_STDERR 让 NSLog 也落到同一文件);
|
||||
// stdout 在 App bundle / login item 启动时没人接收,写过去的日志会直接丢掉。
|
||||
#define Mprintf(format, ...) fprintf(stderr, format, ##__VA_ARGS__)
|
||||
#endif
|
||||
#elif defined(__ANDROID__)
|
||||
#include <android/log.h>
|
||||
|
||||
Reference in new issue
Block a user