feat: 完成 M2 mosh(LAN + tsnet 端到端验证)
- mosh(blinksh/ios C++)+protobuf-lite 交叉编译为 MoshCore.xcframework (CommonCrypto 后端、含 arm64 模拟器 slice;绕 autotools 用 CMake 直编 + 手写 config.h) - tsnet 桥新增 UDP relay(StartMoshRelay:loopback↔tsnet.Dial 逐包搬运) - MoshSession(pipe↔FILE*/pthread/SIGWINCH)+ MoshConnectScanner(TXCore,+4 单测=39) - SSHTerminalModel 编排:SSH 引导 mosh-server→解析 MOSH CONNECT→relay→mosh 接管 - LAN 直连 + mosh-over-tsnet 均端到端验证通过,R1(tsnet UDP 数据报语义) 证伪 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
83
vendor/build/mosh/CMakeLists.txt
vendored
Normal file
83
vendor/build/mosh/CMakeLists.txt
vendored
Normal file
@@ -0,0 +1,83 @@
|
||||
cmake_minimum_required(VERSION 3.20)
|
||||
project(moshios CXX)
|
||||
|
||||
# 直接编译 blinksh/mosh(ios 分支) 的 src/*.cc 为静态库,绕过 autotools。
|
||||
# 特性宏由同目录手写 config.h 提供(-I 本目录,且优先于 src 树内任何 config.h)。
|
||||
# 变量入参:
|
||||
# MOSH_SRC —— vendor/mosh/src 绝对路径
|
||||
# PROTOBUF_SRC —— vendor/protobuf/src 绝对路径(提供 protobuf-lite 头)
|
||||
if(NOT DEFINED MOSH_SRC)
|
||||
message(FATAL_ERROR "MOSH_SRC 未设置")
|
||||
endif()
|
||||
if(NOT DEFINED PROTOBUF_SRC)
|
||||
message(FATAL_ERROR "PROTOBUF_SRC 未设置")
|
||||
endif()
|
||||
|
||||
set(CMAKE_CXX_STANDARD 14)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_CXX_EXTENSIONS ON) # gnu++14(mosh 用到 GNU 扩展)
|
||||
|
||||
# 依据 src/*/Makefile.am 的 BUILD_IOS_CONTROLLER 分支精确选取源文件。
|
||||
# 关键:terminal 用 terminaldisplayinit_ios.cc(非 terminaldisplayinit.cc,后者需 ncurses);
|
||||
# frontend 仅取 moshiosbridge/iosclient/terminaloverlay(排除 mosh-client/server/mosh/stmclient)。
|
||||
set(MOSH_SOURCES
|
||||
${MOSH_SRC}/crypto/base64.cc
|
||||
${MOSH_SRC}/crypto/crypto.cc
|
||||
${MOSH_SRC}/crypto/ocb.cc
|
||||
${MOSH_SRC}/network/compressor.cc
|
||||
${MOSH_SRC}/network/network.cc
|
||||
${MOSH_SRC}/network/networktransport.cc
|
||||
${MOSH_SRC}/network/transportfragment.cc
|
||||
${MOSH_SRC}/network/transportsender.cc
|
||||
${MOSH_SRC}/statesync/completeterminal.cc
|
||||
${MOSH_SRC}/statesync/user.cc
|
||||
${MOSH_SRC}/terminal/parseraction.cc
|
||||
${MOSH_SRC}/terminal/parser.cc
|
||||
${MOSH_SRC}/terminal/parserstate.cc
|
||||
${MOSH_SRC}/terminal/terminal.cc
|
||||
${MOSH_SRC}/terminal/terminaldispatcher.cc
|
||||
${MOSH_SRC}/terminal/terminaldisplay.cc
|
||||
${MOSH_SRC}/terminal/terminaldisplayinit_ios.cc
|
||||
${MOSH_SRC}/terminal/terminalframebuffer.cc
|
||||
${MOSH_SRC}/terminal/terminalfunctions.cc
|
||||
${MOSH_SRC}/terminal/terminaluserinput.cc
|
||||
${MOSH_SRC}/util/locale_utils.cc
|
||||
${MOSH_SRC}/util/pty_compat.cc
|
||||
${MOSH_SRC}/util/select.cc
|
||||
${MOSH_SRC}/util/swrite.cc
|
||||
${MOSH_SRC}/util/timestamp.cc
|
||||
${MOSH_SRC}/protobufs/hostinput.pb.cc
|
||||
${MOSH_SRC}/protobufs/transportinstruction.pb.cc
|
||||
${MOSH_SRC}/protobufs/userinput.pb.cc
|
||||
${MOSH_SRC}/frontend/moshiosbridge.cc
|
||||
${MOSH_SRC}/frontend/iosclient.cc
|
||||
${MOSH_SRC}/frontend/terminaloverlay.cc
|
||||
)
|
||||
|
||||
add_library(moshios STATIC ${MOSH_SOURCES})
|
||||
|
||||
target_include_directories(moshios PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR} # 手写 config.h(必须最先)
|
||||
${MOSH_SRC}
|
||||
${MOSH_SRC}/crypto
|
||||
${MOSH_SRC}/network
|
||||
${MOSH_SRC}/statesync
|
||||
${MOSH_SRC}/terminal
|
||||
${MOSH_SRC}/util
|
||||
${MOSH_SRC}/protobufs
|
||||
${MOSH_SRC}/frontend
|
||||
${PROTOBUF_SRC}
|
||||
)
|
||||
|
||||
# 1.3.2 老代码在 Xcode 26/新 clang 下告警多;关掉噪声,绝不开 -Werror。
|
||||
# 强制前置 <cstdint>:protobuf 3.21.12 的 stubs/port.h 用了 int8_t 却未自带 stdint 包含,
|
||||
# iOS SDK 头链比 host macOS 严格,会报 "unknown type name 'int8_t'"。全 TU 注入即修复。
|
||||
target_compile_options(moshios PRIVATE
|
||||
"SHELL:-include cstdint"
|
||||
-Wno-deprecated-declarations
|
||||
-Wno-deprecated-register
|
||||
-Wno-register
|
||||
-Wno-unused-parameter
|
||||
-Wno-writable-strings
|
||||
-fno-strict-aliasing
|
||||
)
|
||||
56
vendor/build/mosh/config.h
vendored
Normal file
56
vendor/build/mosh/config.h
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
/* config.h — 手写替代 mosh autotools 的 configure 产物(iOS/macOS/Apple Silicon)。
|
||||
* 本环境缺 autoconf/automake,故不跑 ./autogen.sh;改由 CMake 直接编 src/*.cc,
|
||||
* 用本文件提供全部特性宏。仅面向 Darwin(iOS device/simulator, macOS arm64)。
|
||||
* 依据:configure.ac 的 AC_CHECK 系列 + 各 .cc 里实际引用的 HAVE / USE 宏收敛而来。 */
|
||||
#ifndef MOSH_TX_CONFIG_H
|
||||
#define MOSH_TX_CONFIG_H
|
||||
|
||||
/* --- 包标识(仅用于版本串打印) --- */
|
||||
#define PACKAGE_NAME "mosh"
|
||||
#define PACKAGE_STRING "mosh 1.3.2"
|
||||
#define PACKAGE_VERSION "1.3.2"
|
||||
#define VERSION "1.3.2"
|
||||
|
||||
/* --- iOS controller 模式:只编 client 库(对应 --enable-ios-controller) --- */
|
||||
#define IOS_CONTROLLER 1
|
||||
|
||||
/* --- crypto 后端:Apple CommonCrypto(iOS/macOS 系统内建,无需 OpenSSL/mbedTLS) ---
|
||||
* ocb.cc 用 `#elif USE_APPLE_COMMON_CRYPTO_AES` 选择 <CommonCrypto/CommonCryptor.h>。 */
|
||||
#define USE_APPLE_COMMON_CRYPTO_AES 1
|
||||
#define USE_OPENSSL_AES 0
|
||||
#define USE_NETTLE_AES 0
|
||||
#define USE_REFERENCE_AES 0
|
||||
#define USE_AES_NI 0
|
||||
|
||||
/* --- 时间源:iOS/macOS 均有 clock_gettime(CLOCK_MONOTONIC) --- */
|
||||
#define HAVE_CLOCK_GETTIME 1
|
||||
#define HAVE_GETTIMEOFDAY 1
|
||||
#define HAVE_MACH_ABSOLUTE_TIME 1
|
||||
|
||||
/* --- 字节序:Darwin 用 <libkern/OSByteOrder.h>(byteorder.h 的 HAVE_OSX_SWAP 分支) --- */
|
||||
#define HAVE_OSX_SWAP 1
|
||||
#define HAVE_DECL_BE64TOH 0
|
||||
#define HAVE_DECL_BETOH64 0
|
||||
|
||||
/* --- 编译器内建(clang 全支持) --- */
|
||||
#define HAVE_DECL___BUILTIN_CTZ 1
|
||||
#define HAVE_DECL___BUILTIN_BSWAP64 1
|
||||
|
||||
/* --- Darwin/iOS 存在的头文件 --- */
|
||||
#define HAVE_LANGINFO_H 1
|
||||
#define HAVE_SYS_UIO_H 1
|
||||
#define HAVE_PATHS_H 1
|
||||
#define HAVE_UTIL_H 1
|
||||
#define HAVE_UTMPX_H 1
|
||||
|
||||
/* --- Darwin/iOS 存在的函数 --- */
|
||||
#define HAVE_POSIX_MEMALIGN 1
|
||||
#define HAVE_PSELECT 1
|
||||
#define HAVE_CFMAKERAW 1
|
||||
#define HAVE_FORKPTY 1
|
||||
|
||||
/* 说明:IP_MTU_DISCOVER / IP_RECVTOS(Linux only) 与 HAVE_IUTF8 均以 #ifdef 判定,
|
||||
* 此处不定义即自动跳过(network.cc 相关分支只在 Linux 生效;HAVE_IUTF8 仅被
|
||||
* 已排除的 mosh-server.cc/stmclient.cc 使用)。 */
|
||||
|
||||
#endif /* MOSH_TX_CONFIG_H */
|
||||
Reference in New Issue
Block a user