wangjia
126c06833d
feat(android): libbox 隧道重写对接真实 1.13.12 API,APK 编译通过(Task 5)
...
原生层照 PoC 旧/想象 API 写,与真实 sing-box 1.13.12 libbox 差距是架构级:
- 包名 libbox(非 go.libbox);无 BoxService,改 Libbox.setup + CommandServer 模型
- PangolinVpnService 重写:实现完整 PlatformInterface(15法)+CommandServerHandler
- 新增 DefaultNetworkMonitor(上报默认接口,缺则报 no available network)
- openTun 适配真实 TunOptions(RoutePrefixIterator/getMTU/StringBox DNS)
- 统计/切节点经 CommandClient(uplinkTotal/selectOutbound);MainActivity 接线
构建环境矩阵打通:Gradle 8.7(Java21)+声明式插件迁移+AGP 8.6+Kotlin 2.2.0+占位图标
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com >
2026-06-22 19:28:24 +08:00
wangjia
2a8426c357
fix(android/kernel): 补 -checklinkname=0 ldflags + JDK 自动探测,构建出 40MB libbox.aar
...
对齐 sing-box build_libbox sharedFlags 的 -ldflags(含 -checklinkname=0 放行
badlinkname 的 //go:linkname;-trimpath/-buildvcs=false/版本戳);
JDK 自动选 Android Studio JBR(macOS /usr/bin/javac 仅桩)。Task 2 完成:
三 ABI(arm64/armeabi-v7a/x86_64) libgojni.so 齐。
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com >
2026-06-22 18:59:14 +08:00
wangjia
f298b207fe
fix(android/kernel): gomobile 改用 SagerNet fork v0.1.12 + 补 linkname tags
...
原 pin golang.org/x/mobile@v0.0.0-20240604...70c4c5da7d30 是失效 revision;
对照 sing-box v1.13.12 go.mod 与 cmd/internal/build_libbox,官方用
github.com/sagernet/gomobile@v0.1.12;补 badlinkname,tfogo_checklinkname0
以适配 Go 1.24 的 //go:linkname 限制。Task 2 blocker 修复。
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com >
2026-06-22 18:48:58 +08:00
wangjia
82741ce0c4
feat(android): Dart provider 接 Android→VpnNativeBridge(Task 4)
...
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com >
2026-06-22 18:48:58 +08:00
wangjia
64c427cf11
docs(android): Android 设计方案+KillSwitch 知识库(HTML)+文档索引+实现计划
...
- docs/android-client-design.html / killswitch-design.html / index.html
- docs/superpowers/plans/2026-06-22-android-client.md
- todo/ KillSwitch 三端待办(#1 mac/#2 Android/#3 Windows)
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com >
2026-06-22 18:44:50 +08:00
wangjia
eea851737f
docs(client/windows): 合并后校正 README API 默认值说明(已随 main 改为测试节点)
...
ci-pangolin / Lint — shellcheck (push) Has been cancelled
ci-pangolin / OpenAPI Sync Check (push) Has been cancelled
ci-pangolin / Redline Scan — 脱敏 (UI 文案) (push) Has been cancelled
ci-pangolin / Flutter — analyze + test (push) Has been cancelled
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com >
2026-06-22 14:17:48 +08:00
wangjia
ac0fc774cb
Merge branch 'main' into feature/windows
2026-06-22 14:17:19 +08:00
wangjia
322d806876
fix+build(client/windows): 复查修缮——一键构建脚本 + 修 README dart-define 漏项 + 清 lint
...
- 新增 client/windows/build.ps1:拉内核→带 --dart-define 构建→出安装包一键串联,
规避 Release 漏 --dart-define 导致默认连 localhost、登录「网络请求失败」的坑。
- README:Release 命令补回 --dart-define 并加显式警告,指向一键脚本。
- 清 4 个 lint warning:desktop_vpn_bridge 多余 cast→pattern match、去多余非空断言;
nav_sidebar 删未用 import;vpn_bridge_mock 加 killSwitchEnabled getter。
- 同步 window_manager/tray_manager/screen_retriever 插件注册生成文件(win+macos)。
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com >
2026-06-22 14:17:13 +08:00
wangjia
98ba2b411e
test: VPN 黑盒测试工具改用 Python(零依赖)+ HTML 报告 + 国内外站点矩阵
...
- scripts/vpn_test.py:替换 vpn_test.sh。纯标准库(socket/ssl/urllib),覆盖国内外
常见站点矩阵(google/youtube/github/x/fb/ig/wiki/cloudflare/openai/reddit;
百度/腾讯/淘宝/京东/B站/微博/网易/知乎/阿里云),测连通+延迟+TTFB+DNS+出口IP+吞吐,
本机连通性(tun/系统扩展),生成自包含 HTML 报告(-o)。
- 延迟标准 = TLS 握手耗时(ssl 握手,纯链路往返),报告里标注 "TTL=按 TLS 计算、非 IP TTL";
TTFB 作参考。禁用 ping/tcp_connect(经 TUN 本地应答失真)。
- 删除 scripts/vpn_test.sh;文档引用同步更新为 .py。
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com >
Claude-Session: https://claude.ai/code/session_01JEHzjEcFzvGwgbxT6Wbt6c
2026-06-22 09:43:46 +08:00
wangjia
98e39629a6
docs: 固定延迟口径——延迟=TLS握手(time_appconnect),TTFB 作参考
...
明确含义与区别:TLS 握手=纯网络链路往返(不含目标后端),跨站可比,作统一延迟基准;
TTFB=TLS握手+服务器处理,含站点因素,仅作体感参考。禁用 ping/tcp_connect 当延迟
(经 TUN 被本地应答)。
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com >
Claude-Session: https://claude.ai/code/session_01JEHzjEcFzvGwgbxT6Wbt6c
2026-06-22 09:21:35 +08:00
wangjia
d7c2e22e6f
docs: Windows 客户端实现计划(plan)
...
8 任务分解 + 完成定义,配套 spec(5c9731f )。subagent-driven 执行依据。
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com >
2026-06-22 09:18:04 +08:00
wangjia
4025ce341c
build(client/windows): installer AppId 改为合法 GUID
...
原 AppId 段含非 hex 占位(PANGOLIN0001);Inno 虽接受任意串,改为规范 GUID 更清晰。
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com >
2026-06-22 09:17:31 +08:00
wangjia
8fcc4e8b75
docs+test: VPN 测试方案(黑盒+白盒)+ 修正延迟测量方法
...
- docs/vpn-test-plan.md:黑盒+白盒两方向测试方案。白盒细化:链路五段拆解、
协议/出站选择(Clash API)、接入段 vs 出海段分段 RTT、连接/流量、稳定性
(长跑/Kill switch/GFW 三元组封锁与被动探测/热重载)。含初轮报告:cara 黑盒
15 PASS;吞吐 国内直连 74Mbps vs 国外经隧道 ~10-17Mbps(瓶颈在出海段)。
- scripts/vpn_test.sh:修正延迟测量——经 TUN 代理时 ping/tcp_connect 被隧道本地
应答(2-4ms 假象),改用 TLS 握手(time_appconnect)/ TTFB 作为真实 RTT。
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com >
Claude-Session: https://claude.ai/code/session_01JEHzjEcFzvGwgbxT6Wbt6c
2026-06-22 09:17:00 +08:00
wangjia
ec0e3d1498
docs(client/windows): 更新 README — 真机构建验证 + 字体打包 + 安装包 + 踩坑
...
记录:已真机 build 通过;ATL 前置;LNK1327/mt.exe(MANIFESTUAC)与 fetch SHA pin 排错;
flutter build + ISCC 出安装包步骤;待人工验证清单(运行期连通/托盘/卸载)。
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com >
2026-06-22 09:08:19 +08:00
wangjia
18a8c9024c
build(client/windows): Inno Setup 安装包脚本 + 简中语言包
...
- pangolin.iss:打包 Release 全量(exe + flutter 运行时 + sing-box.exe + wintun.dll
+ data/字体),装到 Program Files\Pangolin,开始菜单/桌面快捷方式,卸载清理
%LOCALAPPDATA%\Pangolin。
- 随仓库附带 ChineseSimplified.isl(本机 Inno Setup 未含官方简中包),.iss 相对引用,
安装包自带中文向导。
- 已在 Windows 真机 ISCC 编译通过 → Output\pangolin-setup-1.0.0.exe(24MB)。
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com >
2026-06-22 09:06:44 +08:00
wangjia
3b16e8ff36
fix(client/windows): 关闭链接器 UAC 清单注入(/MANIFESTUAC:NO)
...
runner.exe.manifest 已声明 requireAdministrator;链接器默认还会注入 asInvoker 的
UAC 清单,两者 level 冲突 → mt.exe c1010001 → LINK LNK1327,Release 链接失败。
对 runner target 加 /MANIFESTUAC:NO,仅用 manifest 文件的 level。真机 build 通过。
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com >
2026-06-22 09:03:16 +08:00
wangjia
2d2baf887c
docs+test: macOS 隧道踩坑复盘/规则 + VPN 测试调研 + 黑盒测试工具
...
- docs/macos-sysext-realize-troubleshooting.html:补"运行时"章节(libbox 空指针、
接口时序、队列死锁、DNS 劫持)+ 运行时 checklist。
- docs/vpn-testing-research.md:VPN 测试调研(行业方法论 + GFW 专项 + Pangolin
分层测试项 + 三层测试工具设计)。
- CLAUDE.md:新增「client/ macOS 原生隧道」铁律章节(构建发版/系统扩展 realize 要求/
libbox+NE 集成/配置由服务端渲染/已知坑)。
- scripts/vpn_test.sh:客户端侧黑盒测试工具(出口 IP/DNS/可达性/延迟/吞吐/IPv6 泄漏,
PASS/WARN/FAIL,可远程跑)。
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com >
Claude-Session: https://claude.ai/code/session_01JEHzjEcFzvGwgbxT6Wbt6c
2026-06-22 09:00:10 +08:00
wangjia
cebc9a1c4f
fix(client/macos+server): 隧道运行时打通——DNS 劫持 + 死锁/空指针修复
...
接续 447f3f4(系统扩展可加载),修复"扩展能起但连上无法上网"的运行时问题,
现已在 macOS 15(cara)端到端连通:出口=节点 IP、国外站可达、DNS 经隧道解析。
服务端(clientconfig.go):
- route.rules 首条加 {"action":"hijack-dns","port":[53]}(排在 LAN 直连规则前)。
否则发往隧道 DNS(172.19.0.2:53)的查询被 172.16.0.0/12 吞去直连,域名解析失败。
sing-box 1.13 按端口劫持(protocol:dns 需先 sniff,不稳)。
客户端——保留三个真 bug 修复:
- startTunnel 的 libbox 启动移到后台队列:避免在 provider 队列同步阻塞,与
openTun→setTunnelNetworkSettings 回调三方死锁(隧道永远卡 connecting)。
- startOrReloadService(options:) 传非空 LibboxOverrideOptions():传 nil 致空指针 SIGSEGV。
- startDefaultInterfaceMonitor 阻塞到首个 path 更新再返回:修 "no available network interface"。
- 清除排障期临时诊断代码;CFBundleVersion 递增(sysextd 按版本去重)。
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com >
Claude-Session: https://claude.ai/code/session_01JEHzjEcFzvGwgbxT6Wbt6c
2026-06-22 08:57:55 +08:00
wangjia
86157dfc99
fix(kernel): fetch 脚本改内置 SHA pin(sing-box 停发 checksums.txt)+修正 wintun SHA
...
- sing-box v1.13 起 Release 不再发布 checksums.txt,原脚本下载它 404,桌面内核
拉取全平台失效。改为脚本内置各压缩包 SHA256(case 表,版本不符即报错)。
- WINTUN_SHA256 原值(90a6c2..)错误,更正为 wintun-0.14.1.zip 官方哈希(07c256..)。
- 已在 macOS 验证 windows/amd64 全流程:sing-box.exe + wintun.dll 下载+校验+解压通过。
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com >
2026-06-22 07:58:03 +08:00
wangjia
7e7854427c
docs(client): 修订 pangolin_theme 字体注释(改本地打包后过时描述)
...
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com >
2026-06-22 07:51:58 +08:00
wangjia
6fc032bac8
feat(client): 字体改本地打包(拉丁全量 + Noto Sans SC GB2312 子集)
...
生产 PangolinFonts.useBundled=true,离线可用,不再运行时拉 google_fonts;
中文经 fontFamilyFallback=[Noto Sans SC] 兜底,子集外字符再兜系统 CJK 字体。
- 拉丁:Sora/Manrope/JetBrains Mono 静态权重(复用 test/fonts)。
- 中文:Noto Sans SC 变量字体 instance 到 Regular + subset 到 GB2312 6763 字
(单权重,粗体引擎合成),client/fonts 合计约 3.4MB。
- tools/fonts/make-cjk-subset.sh 可复现生成(GB2312 字表无需联网)。
- 新增 test/unit/fonts_test.dart 锁定接线;golden 因 notdef 占位字形微调已更新。
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com >
2026-06-22 07:48:21 +08:00
wangjia
14498a3ccd
feat(client/desktop): 设定窗口默认 920x640 / 最小宽 720
...
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com >
2026-06-21 23:02:43 +08:00
wangjia
5c9731f3df
docs: Windows 客户端 bring-up + 安装包设计方案(spec)
...
brainstorming 定稿:真机测试 / MVP+Inno Setup 深度 / 子进程+UAC 数据面 /
复用 DesktopShell 原生标题栏 / 拉丁全量+Noto Sans SC 7000字子集打包。
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com >
2026-06-21 22:20:50 +08:00
wangjia
dae321a3f0
fix(web): clay-500 品牌主色 #FF0000 → #B96A3D + 固定 next 14.2.35
...
- token 重生成:--clay-500 品牌主色从占位红 #FF0000 还原为 clay #B96A3D
(usercenter public + website tokens.gen)
- usercenter package-lock:next / eslint-config-next 从 <14.3.0 固定到 14.2.35
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com >
Claude-Session: https://claude.ai/code/session_01JEHzjEcFzvGwgbxT6Wbt6c
2026-06-21 21:34:22 +08:00
wangjia
833912bb58
chore: 移除废弃 skill .claude/skills/pangolin-design.md
...
设计还原统一走全局 design-distill skill,项目内副本不再维护。
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com >
Claude-Session: https://claude.ai/code/session_01JEHzjEcFzvGwgbxT6Wbt6c
2026-06-21 21:34:22 +08:00
wangjia
447f3f494e
feat(client/macos): P1 原生隧道——PacketTunnel 系统扩展可加载 + libbox 运行
...
经长链路排查(同机对照可工作的 Tailscale),修复 macOS 系统扩展 realize
失败(OSSystemExtensionErrorDomain code=4)与 libbox 运行时崩溃,使内嵌
sing-box 的系统扩展能在 macOS 15 上激活并启动隧道。
系统扩展 realize(三个叠加根因):
- 扩展自包含:PacketTunnel 加 OTHER_LDFLAGS="" 切断对项目级 CocoaPods 链接
标志的继承(原会把 flutter_secure_storage 链进扩展);Libbox.xcframework
改纯 Link(静态),从 Embed Frameworks 移除冗余内嵌
- bundle 名 = 标识符:PRODUCT_NAME 设为 com.pangolin.pangolin.PacketTunnel
- 扩展 Info.plist 补 NSSystemExtensionUsageDescription(网络扩展类别强制要求)
- App Group 改 macOS 原生格式 BYL4KQHMTN.com.pangolin.pangolin;NEMachServiceName
以其为前缀;扩展补 network.client/server;get-task-allow=false + 签名加 --timestamp
- CFBundleVersion 随构建递增(否则 sysextd 视为同版本不更新)
libbox 运行时:
- startOrReloadService(options:) 传 nil 致空指针 SIGSEGV → 传 LibboxOverrideOptions()
- 默认接口监控阻塞到首个 path 更新再返回,修 "no available network interface"
配套:
- scripts/local_test.sh:build/sign/notarize/copy/run 一条龙(Developer ID + 公证)
- client/macos/sign_libbox.sh:构建期以 Developer ID 重签内嵌 Libbox
- VpnChannel:401 自动刷新 token、详尽 os_log;auth/api 统一走 kApiBaseUrl
- docs/macos-sysext-realize-troubleshooting.html:完整踩坑复盘
WIP / 临时(后续清理):
- 隧道运行时仍在排查:剥离远程 rule-set 后 sing-box 启动卡点未定位
- 含临时诊断代码:main.swift stderr 重定向、box.log 输出、rule-set 剥离、debug 日志
- api_config 仍指向联调节点,发版前还原
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com >
Claude-Session: https://claude.ai/code/session_01JEHzjEcFzvGwgbxT6Wbt6c
2026-06-21 21:18:33 +08:00
wangjia
43b25c8aa0
feat: 国内流量直连分流(geoip-cn / geosite-cn)— #5
...
ci-pangolin / Lint — shellcheck (push) Has been cancelled
ci-pangolin / OpenAPI Sync Check (push) Has been cancelled
ci-pangolin / Redline Scan — 脱敏 (UI 文案) (push) Has been cancelled
ci-pangolin / Flutter — analyze + test (push) Has been cancelled
国内 IP/域名直连(不走隧道)→ 省流量 + 国内访问快;非国内走代理。
- clientconfig.go: BuildClientConfig 加 ClientConfigOpts{SplitCN,RulesBaseURL};
开启时 route 加 {rule_set:[geoip-cn,geosite-cn]→direct} + 定义 rule_set
(remote .srs,download_detour:direct 直连下载)
- rules.go: 控制面静态服务 /v1/rules/{name}.srs(白名单防穿越)——自托管避免
GitHub 在国内被墙的鸡生蛋;客户端反正连控制面,可达性有保证
- nodes.go ConnectNode: 读 ?split_cn → opts;NodeAPI 加 rulesBaseURL
(PANGOLIN_PUBLIC_URL);main.go 挂 /v1/rules 路由 + RulesHandler
- 客户端: connect_api splitCN→?split_cn=1;connection_provider 传 smartRoute 偏好
- deploy/single-node: 拉 geoip-cn/geosite-cn.srs 到 $DATA_DIR/rules +
设 PANGOLIN_PUBLIC_URL/PANGOLIN_RULES_DIR
验证:go test(splitCN 开/关渲染 + RulesHandler 白名单/404)+ flutter analyze +
shellcheck;不需要节点。订阅链接暂用默认 opts、DNS 分流为后续增强。
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com >
2026-06-19 20:34:00 +08:00
wangjia
cf2bd93c93
feat(server): agent 热重载 sing-box(SIGHUP)替代全量重启( #3 )
...
sing-box 支持 SIGHUP 热重载(cmd_run.go:进程内 check()验证→close 旧实例→
start 新实例;坏配置保留旧实例继续跑、不断网)。原 agent 用 systemctl restart
(全量重启:断所有连接 + 坏配置让 sing-box 起不来全断)。
- Restarter 接口加 Reload;SystemdRestarter.Reload 取 MainPID(systemctl show
-p MainPID)发 SIGHUP——agent 与 sing-box 同 pangolin 用户,免 polkit/不改 unit;
PID 取不到或发信号失败回退 Restart
- SingBox.started:首次/进程未起走 Restart(冷启动),之后配置变更走 Reload
- noopRestarter/fakeRestarter 补 Reload;加 TestWriteAndRestartFirstColdThenReload
价值:切节点/续期/加删用户不整进程重启、不全断流;坏配置不至于打死节点。
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com >
2026-06-19 19:36:46 +08:00
wangjia
c1a52d4fc2
docs: 新节点重建 + 避风控 checklist
...
固化首个 VPS 被支付风控暂停的教训(非流量检测,是新号+信用卡+地理画像+
未及时处理验证)+ 脚本化重建步骤(bootstrap→single-node→自编 v2ray_api
sing-box→ufw→enroll→客户端 dart-define)+ 重建后备份 DB + 接 P1 实测。
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com >
2026-06-19 19:24:59 +08:00
wangjia
2a4d6c9648
build(client/macos): Runner 开启 Hardened Runtime(公证前置)
...
ci-pangolin / Lint — shellcheck (push) Has been cancelled
ci-pangolin / OpenAPI Sync Check (push) Has been cancelled
ci-pangolin / Redline Scan — 脱敏 (UI 文案) (push) Has been cancelled
ci-pangolin / Flutter — analyze + test (push) Has been cancelled
PacketTunnel 已有 ENABLE_HARDENED_RUNTIME;给 Runner 的 Debug/Release 也补上。
Developer ID 分发 + 公证要求 Hardened Runtime。
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com >
2026-06-19 16:04:53 +08:00
wangjia
fb1ef9ba01
feat(client/macos): OSSystemExtensionRequest 激活 sysext
...
ci-pangolin / Lint — shellcheck (push) Has been cancelled
ci-pangolin / OpenAPI Sync Check (push) Has been cancelled
ci-pangolin / Redline Scan — 脱敏 (UI 文案) (push) Has been cancelled
ci-pangolin / Flutter — analyze + test (push) Has been cancelled
VpnChannel.activateSystemExtensionIfNeeded 实装:start 前请求系统加载/更新
PacketTunnel sysext;首启弹「隐私与安全性」待用户允许(await 阻塞到批准,
扩展没加载隧道起不来)。SysExtActivationDelegate 处理 finish/fail/replace。
至此 macOS 原生 VPN 栈构建完整:Runner 嵌入 sysext 到
Contents/Library/SystemExtensions,编译全过。运行待:sysext 签名放行 +
systemextensionsctl developer on(或 Developer ID 公证)。
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com >
2026-06-19 15:54:14 +08:00
wangjia
f2a4290602
feat(client/macos): PacketTunnel 转 System Extension(构建通过)
...
ci-pangolin / Lint — shellcheck (push) Has been cancelled
ci-pangolin / OpenAPI Sync Check (push) Has been cancelled
ci-pangolin / Redline Scan — 脱敏 (UI 文案) (push) Has been cancelled
ci-pangolin / Flutter — analyze + test (push) Has been cancelled
macOS 站外加载隧道必须 sysext(appex 仅 App Store 可加载)。转换:
- productType app-extension→system-extension;产物 .appex→.systemextension
- 嵌入路径 PlugIns→Contents/Library/SystemExtensions(SYSTEM_EXTENSIONS_FOLDER_PATH)
- main.swift 入口(NEProvider.startSystemExtensionMode + dispatchMain;sysext 是
可执行程序,需显式 main 而非 appex 的 NSExtensionMain)
- Info.plist 加 NEMachServiceName;entitlement 换回 packet-tunnel-provider-systemextension
CFBundlePackageType 自动 SYSX,Build Succeeded(关签名)。运行还需 Developer ID
签名 + systemextensionsctl developer on + OSSystemExtensionRequest 激活。
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com >
2026-06-19 15:51:29 +08:00
wangjia
6a9a7c424e
feat(client/macos): 主 app VPN 接线编译通过 — VpnChannel 入 Runner target
...
ci-pangolin / Lint — shellcheck (push) Has been cancelled
ci-pangolin / OpenAPI Sync Check (push) Has been cancelled
ci-pangolin / Redline Scan — 脱敏 (UI 文案) (push) Has been cancelled
ci-pangolin / Flutter — analyze + test (push) Has been cancelled
- VpnChannel.swift 加入 Runner target(Compile Sources)
- Logger→NSLog(Runner 部署目标 10.15,os.Logger 需 11)+ 去掉未用的
SystemExtensions import
- 至此原生 VPN 控制链路全编译通过:主 app(NETunnelProviderManager 启停/
状态)+ 扩展(libbox)。kUseNativeVpnMacOS 仍 false(待隧道能跑切换)。
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com >
2026-06-19 15:43:42 +08:00
wangjia
c8df031741
feat(client/macos): 解开 VpnChannel 注册(主 app 接 NETunnelProviderManager)
...
ci-pangolin / Lint — shellcheck (push) Has been cancelled
ci-pangolin / OpenAPI Sync Check (push) Has been cancelled
ci-pangolin / Redline Scan — 脱敏 (UI 文案) (push) Has been cancelled
ci-pangolin / Flutter — analyze + test (push) Has been cancelled
MainFlutterWindow 启用 VpnChannel.register —— Flutter 经 pangolin/vpn 通道
启停 PacketTunnel(NETunnelProviderManager)。需 VpnChannel.swift 已入 Runner
target 的 Compile Sources。kUseNativeVpnMacOS 仍为 false(待隧道能跑再切)。
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com >
2026-06-19 15:36:38 +08:00
wangjia
665d4a949d
build(client/macos): PacketTunnel appex target + libbox/系统框架链接
...
ci-pangolin / Lint — shellcheck (push) Has been cancelled
ci-pangolin / OpenAPI Sync Check (push) Has been cancelled
ci-pangolin / Redline Scan — 脱敏 (UI 文案) (push) Has been cancelled
ci-pangolin / Flutter — analyze + test (push) Has been cancelled
Xcode 工程持久化:
- 新增 PacketTunnel App Extension target(嵌入 Runner,Packet Tunnel provider)
- 链接 Libbox.xcframework(Embed & Sign)+ SystemConfiguration/AppKit/
libresolv(Do Not Embed,libbox 内部系统代理/网络监控/DNS 依赖)
- NetworkExtension 改 Do Not Embed(系统框架不可嵌入重签)
至此 P1 隧道扩展编译+链接+签名全通(Build Succeeded)。Libbox.xcframework
本体不入 git(gitignore),按 scripts/build-libbox.sh 重编。
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com >
2026-06-19 15:33:15 +08:00
wangjia
b621d1754a
feat(client/macos): PacketTunnelProvider libbox 集成(编译+链接通过)
...
ci-pangolin / Lint — shellcheck (push) Has been cancelled
ci-pangolin / OpenAPI Sync Check (push) Has been cancelled
ci-pangolin / Redline Scan — 脱敏 (UI 文案) (push) Has been cancelled
ci-pangolin / Flutter — analyze + test (push) Has been cancelled
CommandServer 装配(LibboxSetup→NewCommandServer→start→startOrReloadService)+
完整 LibboxPlatformInterface:openTun(TunOptions→NEPacketTunnelNetworkSettings,
getpeername+utun ctl_id 取 fd)、默认接口监控(NWPathMonitor)、接口枚举、socket
绑定;LibboxCommandServerHandler 回调。
gomobile 桥接要点:实现接口用 XxxProtocol、接口型参数/返回用 (any XxxProtocol)、
三个方法被 Swift 重命名(autoDetectControl/send/usePlatformAutoDetectControl)、
CTLIOCGINFO 按 _IOWR 定义计算。
链接需补系统框架:SystemConfiguration + AppKit + libresolv(libbox 内部
系统代理/网络监控代码引用)。
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com >
2026-06-19 15:20:50 +08:00
wangjia
8367984e23
fix(client/macos): PacketTunnelProvider 改用 completion-handler 绕开 Swift 6.2 编译器崩溃
...
ci-pangolin / Lint — shellcheck (push) Has been cancelled
ci-pangolin / OpenAPI Sync Check (push) Has been cancelled
ci-pangolin / Redline Scan — 脱敏 (UI 文案) (push) Has been cancelled
ci-pangolin / Flutter — analyze + test (push) Has been cancelled
Swift 6.2.3 在为 async 重写的 startTunnel 生成 ObjC 桥接 thunk 时崩溃
(emitInjectLoadableEnum)。改用 completion-handler 形式(直接是 @objc 原型)
绕开。startTunnel/stopTunnel/handleAppMessage 三个 override 同步改。
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com >
2026-06-19 14:30:11 +08:00
wangjia
7e92a9a711
fix(client/macos): PacketTunnel 开发期用 appex NE 变体 packet-tunnel-provider
...
ci-pangolin / Lint — shellcheck (push) Has been cancelled
ci-pangolin / OpenAPI Sync Check (push) Has been cancelled
ci-pangolin / Redline Scan — 脱敏 (UI 文案) (push) Has been cancelled
ci-pangolin / Flutter — analyze + test (push) Has been cancelled
Xcode 把 target 建成 App Extension(.appex);sysext 变体 -systemextension 在
Apple Development 自动签名下签不了。开发期改用 appex 变体能编/签/本机调试;
上线转 System Extension + Developer ID 时再换回 -systemextension(注释已记)。
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com >
2026-06-19 14:20:21 +08:00
wangjia
07272f5610
fix(client/macos): P1 骨架修正 — bundle id 统一 PacketTunnel + Info.plist 精简
...
ci-pangolin / Lint — shellcheck (push) Has been cancelled
ci-pangolin / OpenAPI Sync Check (push) Has been cancelled
ci-pangolin / Redline Scan — 脱敏 (UI 文案) (push) Has been cancelled
ci-pangolin / Flutter — analyze + test (push) Has been cancelled
- VpnChannel/Provider: 扩展 bundle id 统一为 com.pangolin.pangolin.PacketTunnel
(对齐 Xcode 新建 target 的实际 id)
- PacketTunnel/Info.plist: 去掉重复 CFBundlePackageType + 多余 NEMachServiceName,
只保留 NEProviderClasses(其余标准键由 GENERATE_INFOPLIST_FILE 合并)
- .gitignore: 忽略 Frameworks/Libbox.xcframework(204MB,build-libbox.sh 产出)
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com >
2026-06-19 13:50:51 +08:00
wangjia
da8f3a4fef
feat(server): Hy2 自签 TLS 证书(方案①)— 补全 hysteria2 入站可用
...
Hy2 跑在 QUIC 上、强制 TLS,需服务端证书(不像 REALITY 借大站证书)。此前
handler_grpc 只发 ListenPort、cert 路径为空 → hysteria2 入站起不来。改为节点自签:
- agentd/hy2cert.go: ensureSelfSignedCert 生成 ECDSA P-256 自签证书到
/etc/sing-box/hy2.{crt,key}(幂等,缺失才生成;key 0600;SAN=reality SNI)
- singbox.go: writeAndRestart 渲染前对启用 hy2 的节点 ensure 证书并把
CertPath/KeyPath 写回 hy2 配置
- httpapi/clientconfig.go: hy2 出站 TLS 加 insecure:true + server_name,收自签
(两端自有,服务端鉴权靠 per-user 派生的 hy2 密码)
验证:单元测试(证书可被 crypto/tls 加载/幂等/0600)+ sing-box check 接受自签 hy2 入站。
注:节点实际启用 hy2 还需配 Hy2Port + 放行 UDP(单独步骤)。
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com >
2026-06-19 12:12:35 +08:00
wangjia
b25c8bbc2c
feat(client/macos): P1 方案B 骨架 — System Extension + NETunnelProviderManager 接线
...
ci-pangolin / Lint — shellcheck (push) Has been cancelled
ci-pangolin / OpenAPI Sync Check (push) Has been cancelled
ci-pangolin / Redline Scan — 脱敏 (UI 文案) (push) Has been cancelled
ci-pangolin / Flutter — analyze + test (push) Has been cancelled
把 PoC 的 sudo sing-box 外部二进制换成自包含、免 root 的 NEPacketTunnelProvider
(System Extension)+ 嵌入 libbox 的生产架构铺好骨架(不破坏现有 PoC 构建)。
- PacketTunnel/:扩展 target 源 — PacketTunnelProvider(LibboxSetup→NewService→start,
openTun 建 NEPacketTunnelNetworkSettings)、Info.plist(NEProviderClasses)、
entitlements(packet-tunnel-provider-systemextension + App Group)
- Runner/VpnChannel.swift:主 app 经 NETunnelProviderManager 启停 + 状态/速率回传,
对齐 Dart 侧 VpnNativeBridge 的 pangolin/vpn channel 契约
- vpn_bridge_provider.dart:kUseNativeVpnMacOS 开关(默认 false,联调通过后置 true)
- docs/p1-macos-system-extension.md:文件清单 + Xcode/签名步骤 + 待办
(Team BYL4KQHMTN;Network Extensions 已确认自助开通、无需 Apple 审批)
非破坏:新源文件未入 build target、注册行/app-group entitlements 均注释、gate 默认 false。
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com >
2026-06-19 11:07:36 +08:00
wangjia
64a1a64c3f
feat(server): 按用户精确统计流量 — agent 改读 v2ray_api StatsService
...
节点 sing-box 编入 with_v2ray_api 后,每个 dp_uuid 有独立计数器
user>>>{dp_uuid}>>>traffic>>>uplink|downlink。agent 用 QueryStats(reset=true)
取窗口 delta,按用户精确上报(替代旧 clash 节点总量分摊:单用户准、多用户近似)。
- render.go: experimental.v2ray_api(loopback :19091)+ stats.users 列全部 dp_uuid
- v2rayapi/: vendor sing-box stats.pb.go(消息)+ 手写 client(用 v2ray 规范
ServiceName 路径,绕开生成代码的 experimental.v2rayapi.* 误名)
- usage_v2ray.go: V2RayUsageSource,uplink/downlink 天然用户视角(无需 swap)
- agent.UseV2RayUsage() 取代 UseClashUsage();clash_api 保留作本地调试
节点需部署带 with_v2ray_api 的 sing-box(已编好 linux/amd64 二进制)。
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com >
2026-06-19 10:18:33 +08:00
wangjia
236e33aef9
feat(scripts): P0 完成 — libbox 嵌入式核心构建脚本(方案B)
...
scripts/build-libbox.sh:用 sagernet/gomobile fork v0.1.12 + sing-box v1.13.13
+ 官方 build_libbox,一键编出 Libbox.xcframework(Apple)/ Libbox.aar(Android)。
已本地跑通 macOS:双架构(arm64+x86_64)xcframework,Headers 暴露 LibboxNewService /
LibboxCommandClient(状态·速率)等 API。产物不入 git(~204MB),按需重编。
docs/vpn-core-embedding.md 标记 P0 完成。
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com >
2026-06-19 10:07:02 +08:00
wangjia
28dd28c285
docs: 嵌入 libbox + 系统 VPN API 替换 sudo sing-box 完整设计(方案B)
...
调研 sing-box 官方客户端架构(libbox via gomobile + NE/VpnService),产出上线标准
的核心引擎嵌入设计:各平台机制、libbox 构建流水线、Flutter 集成改造、签名/权限/
公证门槛、分阶段迁移、风险。关键结论:中国 VPN 走 App Store 外分发 → macOS 必须用
System Extension(非 App Extension)+ Developer ID + 公证 + 申请 Apple NE 权限。
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com >
2026-06-19 09:53:39 +08:00
wangjia
3f62d54d23
fix(client): 关窗口缩托盘不退出 + 单实例(一机一进程)
...
ci-pangolin / Lint — shellcheck (push) Has been cancelled
ci-pangolin / OpenAPI Sync Check (push) Has been cancelled
ci-pangolin / Redline Scan — 脱敏 (UI 文案) (push) Has been cancelled
ci-pangolin / Flutter — analyze + test (push) Has been cancelled
- 关窗口托盘也消失:根因是 AppDelegate.applicationShouldTerminateAfterLast
WindowClosed 返回 true → 关窗口即终止 app。改 false:关窗口只隐藏到托盘
(配合 window_manager preventClose+hide),app 留在托盘。
- 单实例:main 启动先 ensureSingleInstance()——loopback 47654 端口锁;已有实例
时连过去唤起其窗口显示,本进程 exit(0)。保证一机仅一个 pangolin 进程,
重复启动只会前置已有实例。
flutter analyze 0 error;测试通过。
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com >
2026-06-19 09:34:12 +08:00
wangjia
31443d0fe7
fix(client): 退出 Pangolin 时拆隧道(停内核),不再残留 sing-box/TUN
...
ci-pangolin / Lint — shellcheck (push) Has been cancelled
ci-pangolin / OpenAPI Sync Check (push) Has been cancelled
ci-pangolin / Redline Scan — 脱敏 (UI 文案) (push) Has been cancelled
ci-pangolin / Flutter — analyze + test (push) Has been cancelled
此前真退出(托盘退出 / Cmd+Q)走 windowManager.destroy(),从不先停内核,
而 sing-box 是 sudo root 子进程不随父进程退出 → 孤儿 + TUN 残留,得手动 pkill。
- system_tray:托盘「退出」前 await onBeforeQuit()(停内核)再 destroy。
- main:PangolinApp→ConsumerStatefulWidget,AppLifecycleListener.onExitRequested
在 Cmd+Q 时先停内核再退;_teardownVpn 调 vpnBridge.stop()(SIGTERM→sing-box,
拆 TUN),带 3s 超时兜底。
- 关窗口→隐藏托盘的路径不拆(保持连接,符合常驻语义)。
flutter analyze 0 error;116 tests passed。
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com >
2026-06-19 09:21:22 +08:00
wangjia
7827660a36
fix(client): 登录页 tab 滑块塌陷 + 滚动弹性(design-distill 校准)
...
ci-pangolin / Lint — shellcheck (push) Has been cancelled
ci-pangolin / OpenAPI Sync Check (push) Has been cancelled
ci-pangolin / Redline Scan — 脱敏 (UI 文案) (push) Has been cancelled
ci-pangolin / Flutter — analyze + test (push) Has been cancelled
- 胶囊 tab 活动滑块高度塌成 0(FractionallySizedBox 缺 heightFactor)→ 活动态
不可见、和背景糊一起。补 heightFactor:1.0,滑块正常填满。
- 列表无弹性回弹:SingleChildScrollView 改 ClampingScrollPhysics,大窗口放得下
就不滚(无上下拖动/滚动条),仅窗口过矮才滚。
- 加 auth_redesign golden(900x700 明/暗),按 design-distill 截图 diff 校准:
与原型 design/preview/auth_redesign.html 对比,结构/位置/尺寸零偏移
(残余差异为 headless 测试缺 CJK 字体的豆腐块,真 app 字体正常)。
flutter analyze 0 error;测试通过。
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com >
2026-06-19 08:25:56 +08:00
wangjia
9de3a6c743
feat(client): 登录/注册页重设计(居中卡片 + 暖光晕)
...
ci-pangolin / Lint — shellcheck (push) Has been cancelled
ci-pangolin / OpenAPI Sync Check (push) Has been cancelled
ci-pangolin / Redline Scan — 脱敏 (UI 文案) (push) Has been cancelled
ci-pangolin / Flutter — analyze + test (push) Has been cancelled
- auth_screen.dart 整体重排:暖色径向光晕背景 + 居中卡片;hero 用 clay 渐变
app-icon(带光晕)+ 品牌 + 标语;胶囊分段 tab(滑块)替下划线;输入框聚焦态
(accent 边 + ring 光环);主按钮微光;进入错落淡入动效。全部走 token。
- 注册第二步:已验证邮箱胶囊 + 「改邮箱」返回 + 设密码;验证码框无占位点。
- 逻辑零回归:登录/注册两段式、发码、邮箱预填、密码显隐、错误提示全保留。
- design/preview/auth_redesign.html:HTML 视觉原型(评审用,不进构建)。
flutter analyze 0 error;114 tests passed(auth 不在 golden 集,无 golden 变化)。
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com >
2026-06-19 08:10:33 +08:00
wangjia
dfc2df90c7
fix(client): 连接后延迟未探测时回退节点 TCP 探针(尽量不显示 —)
...
ci-pangolin / Lint — shellcheck (push) Has been cancelled
ci-pangolin / OpenAPI Sync Check (push) Has been cancelled
ci-pangolin / Redline Scan — 脱敏 (UI 文案) (push) Has been cancelled
ci-pangolin / Flutter — analyze + test (push) Has been cancelled
连上后 urltest 头几分钟还没探过会显示 —;现回退用节点页的 TCP 探针 ping
(连接前测得、~真实 RTT),urltest 出值后再切换。stats 页已有同款回退。
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com >
2026-06-19 07:33:08 +08:00
wangjia
03e268edc5
fix: /v1/usage 401(统计页全0真因) + 连接页速度改动态字节单位
...
ci-pangolin / Lint — shellcheck (push) Has been cancelled
ci-pangolin / OpenAPI Sync Check (push) Has been cancelled
ci-pangolin / Redline Scan — 脱敏 (UI 文案) (push) Has been cancelled
ci-pangolin / Flutter — analyze + test (push) Has been cancelled
- /v1/usage 一直 401:usage 包自定义了 ctxKey("user_id") 读 user id,但
auth.RequireAuth 把 user id 存在 codes.CtxKeyUserID 下;Go context key 按
「类型+值」比较,命名类型不同 → 取到 nil → 401 → 统计页本月流量/时长恒 0
(而 /v1/me weekly 走 account.go 直查,有数,故只半边为 0)。改 usage 读
codes.CtxKeyUserID(与 auth.UserIDFromContext 同键,/v1/me 已验证可用)。
同时修好 /v1/ads/unlock(同一函数)。
- 连接页速度:Mb/s(兆比特,小流量显示 0.0)→ 动态字节单位 B/s·KB/s·MB/s·GB/s,
小数据也看得清。
go build/test 通过;flutter analyze 0 error;114 tests passed。server 已部署。
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com >
2026-06-19 07:17:58 +08:00