- M0: libghostty SSH 终端(渲染/输入/连接)+ 白屏修复(OutputGate) + 会话状态机/自动重连 - M1: tsnet 用户态组网 + SSH-over-tsnet(fd 桥),shell 级真机验证;R5(Go+gvisor+C+++Swift 同进程) retire - M1.5: tmux -CC 原生 tab(MVP) - 结构: packages/(TXCore·TXTransport), apps/TerminalX, vendor/(libghostty-spm/libssh2/mbedtls/tsnet-bridge), artifacts/ - 文档: CLAUDE.md + docs/HANDOFF.md(新会话入口) - 环境: 认证代理→依赖 vendor 本地化;Go 在 ~/.local/go;仅模拟器/未签名 - 待续: M2 mosh, tmux 多 pane, M4 安全(host key/SE) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
60 lines
2.2 KiB
Objective-C
60 lines
2.2 KiB
Objective-C
// Objective-C API for talking to terminalx/tsnetbridge/tsnetbridge Go package.
|
||
// gobind -lang=objc terminalx/tsnetbridge/tsnetbridge
|
||
//
|
||
// File is generated by gobind. Do not edit.
|
||
|
||
#ifndef __Tsnetbridge_H__
|
||
#define __Tsnetbridge_H__
|
||
|
||
@import Foundation;
|
||
#include "ref.h"
|
||
#include "Universe.objc.h"
|
||
|
||
|
||
@class TsnetbridgeNode;
|
||
|
||
/**
|
||
* Node 包装一个嵌入式 tsnet 节点。gomobile 导出为引用型对象。
|
||
*/
|
||
@interface TsnetbridgeNode : NSObject <goSeqRefInterface> {
|
||
}
|
||
@property(strong, readonly) _Nonnull id _ref;
|
||
|
||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||
/**
|
||
* NewNode 创建(不启动)一个 tsnet 节点。stateDir 唯一、hostname 展示在管理台。
|
||
*/
|
||
- (nullable instancetype)init:(NSString* _Nullable)stateDir hostname:(NSString* _Nullable)hostname;
|
||
/**
|
||
* Close 释放节点。
|
||
*/
|
||
- (BOOL)close:(NSError* _Nullable* _Nullable)error;
|
||
/**
|
||
* DialTCPFD 经 tsnet 连接 tailnet 内 host:port,返回一个已连接的 socket fd 供 libssh2 使用。
|
||
实现:tsnet.Dial 得到 net.Conn(netstack 虚拟连接,无真实 fd)→ socketpair(AF_UNIX) →
|
||
两条 goroutine 双向 io.Copy 泵 → 把 socketpair 的另一端 fd 返回给 Swift。
|
||
Swift 侧 close(fd) 会触发泵结束并关闭 tsConn。返回 -1 + error 表示失败。
|
||
*/
|
||
- (BOOL)dialTCPFD:(NSString* _Nullable)hostOrIP port:(long)port timeoutMs:(long)timeoutMs ret0_:(int64_t* _Nullable)ret0_ error:(NSError* _Nullable* _Nullable)error;
|
||
/**
|
||
* PeersJSON 返回 tailnet 内其它节点列表(name/ip/online/os)的 JSON,用于选择连接目标。
|
||
*/
|
||
- (NSString* _Nonnull)peersJSON;
|
||
/**
|
||
* SelfIP 返回本节点的 Tailscale IPv4(经 LocalClient().Status() 取;未就绪返回空串)。
|
||
*/
|
||
- (NSString* _Nonnull)selfIP;
|
||
/**
|
||
* UpWithAuthKey 用 auth key 启动并等待 Running(timeoutMs 到则返回 error)。
|
||
gomobile 友好签名:基本类型入参、error 出参。
|
||
*/
|
||
- (BOOL)upWithAuthKey:(NSString* _Nullable)authKey timeoutMs:(long)timeoutMs error:(NSError* _Nullable* _Nullable)error;
|
||
@end
|
||
|
||
/**
|
||
* NewNode 创建(不启动)一个 tsnet 节点。stateDir 唯一、hostname 展示在管理台。
|
||
*/
|
||
FOUNDATION_EXPORT TsnetbridgeNode* _Nullable TsnetbridgeNewNode(NSString* _Nullable stateDir, NSString* _Nullable hostname);
|
||
|
||
#endif
|