Commit Graph

44 Commits

Author SHA1 Message Date
wangjia 23bf3077c8 docs(kb): 流量记账口径知识库 — 连接页实时(含直连) vs 统计页累计(仅代理)
记录两处上下行数字口径差异:连接页来自内核 Clash API 全局吞吐含直连,
统计页来自节点 v2ray_api per-user 计数仅代理;差额=直连,设计使然。
含对账口径警示。登记进 docs/index.html 知识库分类。决策:保持现状不改连接页口径。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-29 21:04:50 +08:00
wangjia 2b20a611d7 docs(test): 记录本轮交互组件人工验证(确认框/搜索框/toast);toast 超长文本待测
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-29 20:33:48 +08:00
wangjia 606e5e9e54 docs(plan): P4 收口 —— 每设备归因链路已交付,展示层过滤归 #10
每设备流量归因基础设施由 P1-P3 完整交付(注册→dp_uuid→usage_device_daily,
store 测试已锁)。统计页设备下拉「真过滤」需 per-device 每日曲线 API(现 provider
只给窗口聚合,对不齐月/周/日卡),归入统计整改 #10;端到端需真连客户端人工验证。
不做 ConnectNode 兜底(登录已注册;connect 体无 name/platform)。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-29 06:14:19 +08:00
wangjia 58526b09e6 feat(client): P6 DevicesScreen 重做 + DevicePlatform 枚举
ci-pangolin / Lint — shellcheck (push) Successful in 7s
ci-pangolin / OpenAPI Sync Check (push) Successful in 19s
ci-pangolin / Redline Scan — 脱敏 (UI 文案) (push) Successful in 7s
ci-pangolin / Flutter — analyze + test (push) Successful in 23s
ci-pangolin / Portable SQL — 可移植性 (mysql/sqlite) (push) Successful in 5s
ci-pangolin / Codegen Drift — token 生成物未漂移 (push) Successful in 5s
ci-pangolin / Go — build + test (push) Successful in 9s
ci-pangolin / E2E Smoke — L4 进程级端到端 (push) Successful in 14s
ci-pangolin / Go — integration (mysql/redis testcontainers) (push) Failing after 4m12s
ci-pangolin / Golden — 视觉回归 (components + auth) (push) Successful in 15s
回应「状态码用枚举更好」:新增 DevicePlatform 枚举(线格式 fromWire 解析,
UI 只碰枚举,穷尽 switch),Device.platformKind getter;platform 图标按枚举 switch。
DevicesScreen 按 §7 视觉稿重做:行内 名称+「本机」标 / 平台·客户端版本·最后登录 /
在线绿点光晕·离线灰点 + 行尾 ⋯ 菜单(强制退出 / 清除登录信息·危险红)+ 危险二次
确认弹窗;本机行不显示 ⋯(不自我踢)。l10n 新增在线/离线/最后登录/从未登录/强制
退出/清除登录信息/取消 + 确认文案(中英);「当前设备」改「本机」。
新图标 moreVertical/trash/alertTriangle。localDeviceIdProvider 供本机判定。
测试:devices_screen widget 3 例(本机标+在线/离线+版本渲染 / ⋯菜单→强制退出→
确认→POST logout / 清除→DELETE);全量 flutter test 58 绿。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-29 06:10:37 +08:00
wangjia bcc114088c feat(devices): P3 强制退出 + 清除增强(per-device 凭证吊销)
ci-pangolin / Lint — shellcheck (push) Successful in 9s
ci-pangolin / OpenAPI Sync Check (push) Successful in 17s
ci-pangolin / Redline Scan — 脱敏 (UI 文案) (push) Successful in 5s
ci-pangolin / Flutter — analyze + test (push) Successful in 26s
ci-pangolin / Portable SQL — 可移植性 (mysql/sqlite) (push) Successful in 5s
ci-pangolin / Codegen Drift — token 生成物未漂移 (push) Successful in 5s
ci-pangolin / Go — build + test (push) Successful in 12s
ci-pangolin / E2E Smoke — L4 进程级端到端 (push) Successful in 15s
ci-pangolin / Go — integration (mysql/redis testcontainers) (push) Failing after 4m4s
ci-pangolin / Golden — 视觉回归 (components + auth) (push) Successful in 15s
后端:新端点 POST /v1/me/devices/{uuid}/logout(ForceLogout:吊销该设备会话+
丢 Redis JTI,设备留列表)。DeleteDevice 增强:先吊销会话再删设备(FK ON DELETE
CASCADE 清理会话行)+ 按 dp_uuid 吊销数据面凭证。CredentialRevoker 接口改
per-device RevokeDevice(dpUUID),由 nodes.Service 实现(查 connect_credentials
持有节点→推 CommandTypeRevoke + 删凭证行),main 注入替 NoopRevoker;devices 注入
SessionPort/JTIRevoker。修 SQLite 跨连接死锁(会话吊销移到 delete tx 之前)。
migration 000016 sessions FK 加 ON DELETE CASCADE。
客户端:account_api.forceLogout + devicesProvider.forceLogout(UI 留 P6)。
测试:ForceLogout(吊销会话+JTI+设备保留+403/404)+ DeleteDevice(级联+按 dp_uuid
吊销);NoopRevoker 改 dp_uuid;全量 server/flutter 测试绿。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-29 06:01:41 +08:00
wangjia 2f298f0a0a feat(devices): P2 sessions 表 + 在线/最后登录/客户端版本
ci-pangolin / Lint — shellcheck (push) Successful in 8s
ci-pangolin / OpenAPI Sync Check (push) Successful in 18s
ci-pangolin / Redline Scan — 脱敏 (UI 文案) (push) Successful in 6s
ci-pangolin / Flutter — analyze + test (push) Successful in 24s
ci-pangolin / Portable SQL — 可移植性 (mysql/sqlite) (push) Successful in 5s
ci-pangolin / Codegen Drift — token 生成物未漂移 (push) Successful in 4s
ci-pangolin / Go — build + test (push) Successful in 11s
ci-pangolin / E2E Smoke — L4 进程级端到端 (push) Successful in 14s
ci-pangolin / Go — integration (mysql/redis testcontainers) (push) Failing after 4m13s
ci-pangolin / Golden — 视觉回归 (components + auth) (push) Successful in 14s
migration 000016(mysql+sqlite,含 down):新增 sessions 表(绑 device+refresh JTI)
+ devices 加 client_version/totp_trusted_until。devices 唯一键改 + platform CHECK
加 linux(需 SQLite 表重建)拆出后续迁移,降风险。

后端:新 internal/sessions Store(Create/Rotate/Revoke/RevokeByDevice/
LastLoginByDevice);TokenManager 外露 refresh JTI(IssueWithJTI/RefreshWithJTI/
ParseRefreshJTI);auth.Service 注入 SessionStore——登录建会话、刷新轮换、登出吊销;
DeviceRegistrar 返回 deviceID;ReportUsage 心跳 touch devices.last_seen(在线判定);
devices.ListDevices 经 LastLoginSource 注入返回 online(last_seen<3min)/client_version/
last_login;RegisterIfAbsent 存 client_version。
客户端:Device model 加 online/clientVersion/lastLogin(fromJson 自动解析)。
测试:sessions store 3 例 + ListDevices 在线/最后登录 + device model 2 例 +
migration v16;全量 go test/flutter test 绿。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-29 00:50:24 +08:00
wangjia 889cff4556 docs(plan): 设备&会话管理 实现计划 P1-P6(md执行源 + html阅读版 + 登记 + 链接)
新增 docs/superpowers/plans/2026-06-29-device-session-management.md(执行真相,
checkbox) + docs/device-session-management-plan.html(阅读版);登记进 index.html
「实现计划」;总方案顶部加「→ 实现计划」链接。P1 设备注册打通→P2 sessions表+
在线→P3 强制退出/清除→P4 每设备流量→P5 2FA(future)→P6 UI重做。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-29 00:15:35 +08:00
wangjia 7fd2fed441 docs(design): §7 UI 改真实 token 视觉稿(替换字符画)
用 design/colors_and_type.css 真实色值(clay/sand 暖色浅色主题)做 HTML/CSS
还原稿,替换粗糙 ASCII:A 设备列表(在线绿点光晕/离线灰点+最后登录/本机标)
+ B 行尾 ⋯ 操作菜单(强制退出/清除登录信息危险红) + C 清除危险二次确认弹窗。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-29 00:05:15 +08:00
wangjia e8261e8984 docs(design): 换用户uuid不变(唯一键改 UNIQUE(user_id,uuid)) + 按设备去重健壮性
§3.2.1 ⑤:device_id 安装级、与账户无关→换用户不变;故 devices 唯一键须从
全局 UNIQUE(uuid) 改为 UNIQUE(user_id,uuid)(000016),同机两账号=两行各自
dp_uuid。⑥:别用终身严格去重,改按活跃/在线计数+N天自动回收+用户自助清理。
§3.2 schema/表同步标注唯一键变更。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-28 23:54:52 +08:00
wangjia a3731ce11c docs(design): 补 device uuid 生成机制(随机UUIDv4+安全存储+重装影响)
§3.2.1 ④:uuid=客户端首启 Uuid().v4() 随机生成、立即写 flutter_secure_storage
跨重启恒定;不绑硬件ID(五端唯一可靠合规);各平台安全区存储 + 卸载重装影响
(iOS Keychain 保留/Android 清);对设备计数的含义。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-28 23:46:37 +08:00
wangjia c1994ad048 docs(design): devices 表补全字段 + name来源/三时间戳/按设备限登录数 释疑
§3.2 列出 devices 完整 9 列(含来源迁移 + platform CHECK 需加 linux);
新增 §3.2.1:① name 由客户端 device_info_plus 按平台取(主机名/机型)上报;
② created_at/last_seen/最后登录(session) 三时间戳辨析;③ 设备身份键
(user_id,uuid) + RegisterIfAbsent maxDevices 作「按设备控制登录数」抓手
(累计 vs 同时在线两种口径)。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-28 23:43:37 +08:00
wangjia 31ac76e3d5 docs(design): 设备&会话管理 + 每设备流量归因 全局设计(HTML)
新增 docs/device-session-management-design.html 并登记进 docs/index.html
「设计方案」分类。覆盖三端:控制面 sessions 表绑设备 + RegisterIfAbsent
接线、数据面每设备 dp_uuid 记账(usage_device_daily)、前端「我的设备」
(在线/客户端版本/最后登录 + 强制退出/清除登录信息)。核心洞察:后端大半
已建但 RegisterIfAbsent 未接线致 devices 表空。含 P1–P5 实现路线。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-28 23:29:47 +08:00
wangjia 1a6eb7ac9a docs(stats): stats-overhaul 计划/测试清单 + index 登记
- stats-overhaul 实现计划(md 真相源 + html 阅读版)
- 功能×测试覆盖清单(feature-test-coverage-checklist.html)
- docs/index.html 登记上述文档

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-28 18:13:49 +08:00
wangjia e7b37d7719 test(ci): 刀3 — CI 单点韧性:runner 离线告警(缺口③)
ci-pangolin / Lint — shellcheck (pull_request) Successful in 9s
ci-pangolin / OpenAPI Sync Check (pull_request) Successful in 23s
ci-pangolin / Redline Scan — 脱敏 (UI 文案) (pull_request) Successful in 5s
ci-pangolin / Flutter — analyze + test (pull_request) Failing after 37s
ci-pangolin / Portable SQL — 可移植性 (mysql/sqlite) (pull_request) Successful in 6s
ci-pangolin / Codegen Drift — token 生成物未漂移 (pull_request) Successful in 4s
ci-pangolin / Go — build + test (pull_request) Successful in 19s
ci-pangolin / E2E Smoke — L4 进程级端到端 (pull_request) Successful in 17s
ci-pangolin / Go — integration (mysql/redis testcontainers) (pull_request) Successful in 4m16s
ci-pangolin / Golden — 视觉回归 (components + auth) (pull_request) Successful in 15s
ci-pangolin / Lint — shellcheck (push) Successful in 5s
ci-pangolin / OpenAPI Sync Check (push) Successful in 23s
ci-pangolin / Redline Scan — 脱敏 (UI 文案) (push) Successful in 6s
ci-pangolin / Flutter — analyze + test (push) Failing after 15s
ci-pangolin / Portable SQL — 可移植性 (mysql/sqlite) (push) Successful in 5s
ci-pangolin / Codegen Drift — token 生成物未漂移 (push) Successful in 5s
ci-pangolin / Go — build + test (push) Successful in 7s
ci-pangolin / E2E Smoke — L4 进程级端到端 (push) Successful in 19s
ci-pangolin / Go — integration (mysql/redis testcontainers) (push) Failing after 4m29s
ci-pangolin / Golden — 视觉回归 (components + auth) (push) Successful in 13s
CI 整条吊在一台 mac,关机/掉线即全停且无人知道。新增
deploy/runner/runner-deadman.sh(仿 bootstrap/monitor/deadman-watch.sh):
放另一台常在线主机,每 3 分钟查 gitea Actions API 里 mac-pangolin-2 的 status,
连续 offline 到阈值 → Telegram 告警,恢复也通知;API 取不到时跳过不误报。

响应字段已对照真 gitea API 核验({"runners":[{"name":...,"status":"online"}]}),
shellcheck 干净,实跑验证 online→不告警、缺失→进告警分支。

docs/ci-runner.md 增「韧性」节(告警部署 + cron/launchd)并标注持久化激活仍待
本机手动跑(pkill/launchctl,Claude 跑不了);验证段 job 数 9→10。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-25 23:04:35 +08:00
wangjia 55d368d98b docs(test): 测试架构补「⑩ 已知缺口/测试盲区」单一跟踪源
把散在对话里的盲区收进架构文档,作为单一跟踪源(补一项划一项):
- A 覆盖盲区:前端统计上屏数值未验证(诉求半覆盖)、真实流量数据路径
  (注入非真出网,最大盲区)、原生隧道层零自动化、契约双份可能漂移。
- B 运维/工程缺口:CI 单点 mac(持久化未激活)、go-integration 裸宿主脆性、
  analyze 严格化(B1)+ golden 全集(B2)被 stats-overhaul 耦合阻塞、
  golden 本地难重生。
每项标严重度 + 现状为什么 + 何时怎么补;同步登记 docs/index.html。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-25 21:30:54 +08:00
wangjia 97b2ac02f1 ci: pangolin runner launchd 持久化(start script + plist)
ci-pangolin / Lint — shellcheck (pull_request) Successful in 8s
ci-pangolin / OpenAPI Sync Check (pull_request) Successful in 20s
ci-pangolin / Redline Scan — 脱敏 (UI 文案) (pull_request) Successful in 6s
ci-pangolin / Flutter — analyze + test (pull_request) Successful in 43s
ci-pangolin / Portable SQL — 可移植性 (mysql/sqlite) (pull_request) Successful in 6s
ci-pangolin / Codegen Drift — token 生成物未漂移 (pull_request) Successful in 4s
ci-pangolin / Go — build + test (pull_request) Successful in 2m5s
ci-pangolin / E2E Smoke — L4 进程级端到端 (pull_request) Successful in 2m11s
ci-pangolin / Golden — 视觉回归 (components + auth) (pull_request) Successful in 34s
mac-pangolin-2 从临时后台进程改成开机自启的 launchd 服务,仿 jiu 的 com.jiu.act-runner:
- deploy/runner/act_runner_pangolin_start.sh:等 jiu relay(13000)就绪 → 起 daemon →
  退出自重启;PATH 含 docker/node/go(host 模式 job 要用)
- deploy/runner/com.pangolin.act-runner.plist:RunAtLoad + KeepAlive
- docs/ci-runner.md:持久化章节改为实际部署步骤(cp + launchctl load)
复用 jiu 的 relay 13000(端口已占,不另起)。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-25 20:06:21 +08:00
wangjia 034a585e3b docs(ci): runner 设置记录(决定用 1 个 mac-pangolin-2 + 清理/持久化)
ci-pangolin / Lint — shellcheck (pull_request) Successful in 5s
ci-pangolin / OpenAPI Sync Check (pull_request) Successful in 17s
ci-pangolin / Redline Scan — 脱敏 (UI 文案) (pull_request) Successful in 6s
ci-pangolin / Flutter — analyze + test (pull_request) Successful in 39s
ci-pangolin / Portable SQL — 可移植性 (mysql/sqlite) (pull_request) Successful in 5s
ci-pangolin / Codegen Drift — token 生成物未漂移 (pull_request) Successful in 5s
ci-pangolin / Go — build + test (pull_request) Successful in 2m5s
ci-pangolin / E2E Smoke — L4 进程级端到端 (pull_request) Successful in 2m13s
ci-pangolin / Golden — 视觉回归 (components + auth) (pull_request) Successful in 31s
记录 pangolin CI 的 self-hosted runner:决定保留 1 个(mac-pangolin-2,项目级、
mac host 模式、label nas、复用 jiu 的 relay 13000),含 config、为何 host+mac、
relay 原因、已删 orphan(mac-pangolin id5)的清理命令、持久化(launchd)TODO。
登记进 docs/index.html。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-25 18:52:54 +08:00
wangjia bb2688cede test(ci): L3 golden 进 CI(components+auth 子集,Linux 权威基线)
L3 视觉回归真进 CI(此前卡 docker daemon 未起 + dirty 纠缠;现启 Docker 落地干净子集):
- 在 ghcr.io/cirruslabs/flutter 容器重生成 components+auth 的 14 张 Linux 权威基线
  (auth_login/connect 三态/quota/smart_card;mac 渲染与 CI Linux 不一致,故钉死 Linux),
  容器内 --update-goldens 后无 flag 复跑幂等通过
- ci.yml 新增 golden job(第9个):flutter test components_golden_test + auth_redesign_golden_test
- 解耦干净:这俩只 import clean widget;stats-overhaul 的 l10n 改动纯新增(现有键未动)
  → 渲染不受影响、不裹挟 dirty;tablet/desktop-stats golden 仍耦合 stats-overhaul,待合并后并入
- docs/test-architecture.html:L3 状态更新为「已进 CI(子集)」

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-25 13:20:55 +08:00
wangjia c5223af4a1 test(ci): L3 golden 权威环境脚本(进 CI 前置准备)
golden 真进 CI 卡两个硬约束:Linux/mac 渲染不一致(mac 基线在 CI 全红)+ 基线绑定
stats-overhaul dirty 工作区。本提交备好权威环境,不裹挟 dirty、不破坏:
- scripts/update-goldens.sh:在 CI 同款镜像 cirruslabs/flutter 重生成 Linux 权威基线
  (开发者改 UI 后用它刷新,而非裸 mac --update-goldens,保持与 CI 一致)
- docs/test-architecture.html:L3 现状更新 + 列明启 CI 硬闸的两个前置条件
- 真启闸需:有 docker 的机器生成并提交 Linux 基线 + dirty 工作区合并(本机无 docker)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-25 12:16:16 +08:00
wangjia 6bd5c04cba test(ci): 第5刀c e2e-smoke CI job + 文档 L4 状态更新
- ci.yml 新增 e2e-smoke job(golang:1.25 + apt openssl/curl/python3);容器内无
  docker daemon → 脚本走内嵌 miniredis 兜底,无需 docker-in-docker——CI 走的
  正是本机已验证绿的同款路径
- docs/test-architecture.html:L4 从「完全缺·最大缺口」更新为已落地
  scripts/e2e-smoke.sh + server/test/e2e/
- 注:本机无 docker,e2e job 未在真 nas runner 实跑;逻辑等同本机已绿的
  miniredis 路径,首次 CI 运行需观察 apt 包/go module 下载

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-25 07:06:35 +08:00
wangjia 29ddd5b453 docs(test): 测试框架架构 + 开发规范五支柱文档
- docs/test-architecture.html:分层测试金字塔(L0契约→L4 E2E) + 契约接缝
  数据流 + 四类诉求映射 + CI 流水线 + E2E 拓扑,5 张内联 SVG/表格图
- docs/dev-conventions.html:可测试性五支柱(接缝即接口/契约单源/纯逻辑分离/
  错误是值/可观测) + 支柱↔测试层咬合矩阵 + 反例对照表 + 执行机制四道闸
- docs/index.html:登记两份文档到知识库/调研,双向互链

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-24 23:25:14 +08:00
wangjia e4db3beba6 Merge branch 'main' into feature/pangolin-ios
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
# Conflicts:
#	client/lib/bridge/vpn_bridge_provider.dart
#	docs/index.html
2026-06-23 10:05:20 +08:00
wangjia c1fddcdf99 docs(android): 修正工具链记录(降Go保pin→SagerNet gomobile fork+5层环境修复)
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-22 20:05:50 +08:00
wangjia 53a2ee0b74 docs(client/ios): plan 增 HTML 阅读版 + 登记索引(双产物:.md 执行/.html 阅读) 2026-06-22 19:27:45 +08:00
wangjia e11c06225d plan(client/ios): iOS+iPad 支持实施计划(6 阶段/12 任务,TestFlight 里程碑)
A 补 libbox / B Xcode 接线 / C Provider 重写对齐 macOS / D 真机连通+内存双闸 /
E iPad 横竖屏适配 / F TestFlight 分发。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-22 19:22:05 +08:00
wangjia 84912f4dea docs(client/ios): iOS+iPad 支持设计方案(TestFlight 里程碑)+ 新建 docs 索引
五条工作线:libbox iOS 框架 / Provider 对齐 macOS 修复 / App Group IPC /
iPad 布局横屏适配 / TestFlight 分发;头号风险 NE ~50MB 内存红线设双闸。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-22 19:06:20 +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 ac0fc774cb Merge branch 'main' into feature/windows 2026-06-22 14:17:19 +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 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 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 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 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 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 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 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 53caaf54f0 docs: 同步 EC2 栈删除后的文档
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
- CLAUDE.md 重写:去掉 EC2/marzban 部署、架构、cutover/rollback 命令、自动部署 CD;
  改为自有 VPS 自建方向(RackNerd Debian 12、ssh racknerd 免密、512MB→SQLite)、
  补 server/ Go 后端与多数据库(DB_DRIVER)说明;保留设计 token 单源段
- 删 docs/回滚手册.md(EC2 edge 切换/回滚,脚本已删)
- 删 docs/备份与灾备.md(EC2 MySQL/marzban xtrabackup→S3,backup 栈已删)
- app/kernel/poc/README.md:REALITY 参数来源由 EC2 改为自建节点(single-node)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-18 07:01:13 +08:00
wangjia 5d4b484646 feat(alert): 统一告警出口 TG bot + runbook [tsk_9YMHMTfWJyNB]
新增 server/internal/alert 包(15G):
- 定义 Notifier 接口及 7 种 EventType(判封确认/补新失败/水位低/熔断/
  探针失联/心跳缺失/故障态)
- TGNotifier:Bot API 发送,Critical 事件不去重,Warning/Info 事件
  10min SETNX 去重窗口,失败重试 ≤2 次后降级至 LogNotifier
- LogNotifier:slog 结构化降级实现
- 单测:7 种事件模板 + runbook 锚点正确性;去重窗口内第二条被抑制;
  TG 5xx 重试后 fallback 且 Notify() 返回 nil;
  runbook 文件锚点与枚举一致性

接入 scheduler(替换旧的 NotifyFault 桩):
- detect/engine.go:故障态(Rule 5)→ EventTypeFault;
  判封确认(Rule 3)→ EventTypeBlockConfirmed
- orchestrate/deps.go:Notifier 类型别名指向 alert.Notifier
- orchestrate/replacer.go:补新失败 → EventTypeReplenishFailed;
  熔断触发 → EventTypeBreakerTripped
- probe/prober_agent.go:failCount ≥3 → EventTypeProbeAgentLost
- probe/store.go:新增 CheckHeartbeats() 供 15H 检测心跳缺失>90s

新增 docs/runbook-scheduler.md:7 节各含含义/先查什么/处置/升级条件,
锚点与代码枚举对应。

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-16 00:52:26 +08:00
wangjia 20dbb5f363 feat(backup): 备份与灾备演练系统 [tsk_bYv-CoKSwgAC]
实现 xtrabackup + binlog 增量备份、age 加密异地存储与月度 DR 演练。

## 交付内容

### deploy/backup/ —— 备份容器
- Dockerfile:Ubuntu 22.04 + xtrabackup 8.0 + age v1.2.0 + AWS CLI v2 + pg_client
- entrypoint.sh:初始化 AWS 凭据 / age 公钥,启动 crond
- crontab.txt:全量 02:00 / 增量每 15min / DR 演练每月 1 日
- scripts/lib.sh:日志 / age 加密 / S3 上传 / 连接测试等共用函数
- scripts/backup-full.sh:MySQL xtrabackup 全量 + pg_dump 全量 + SQLite 备份
- scripts/backup-inc.sh:MySQL xtrabackup 增量 + binlog flush & 归档 + pg_dump 快照
- scripts/restore.sh:从 S3 下载、解密、prepare / pg_restore 完整恢复
- scripts/dr-drill.sh:月度演练 —— RPO 验证 / 备份完整性 / MySQL 临时容器恢复 / RTO 度量
- scripts/verify-rpo-rto.sh:实时 RPO/RTO 状态检查(S3 最新备份时间戳)
- backup.env.example:配置模板(MySQL / PG / S3 / age 公钥)

### 修改已有文件
- deploy/docker-compose.yml:新增 pangolin-backup 服务
- deploy/scripts/gen-secrets.sh:幂等生成 age 密钥对 + backup.env 模板
- .gitignore:排除 age 私钥 / backup.env
- deploy/README.md:容器一览 + 备份快速命令

### docs/备份与灾备.md
S3 初始化、IAM 权限设计、age 密钥管理、MySQL 权限、DR 恢复步骤、RTO 测量标准

## 设计要点
- RPO ≤ 15min:每 15min xtrabackup 增量 + binlog flush + pg_dump 快照
- RTO ≤ 4h:月度演练度量,估算恢复时长约 2h
- 独立身份账号:备份 IAM 仅有 s3:PutObject,与生产账号完全隔离
- age 加密:公钥存服务器,私钥离线保存,S3 中无明文
- 无 crontab:cron 在容器内运行,绕过 ec2-user crontab 限制
- 幂等部署:backup.env 存在则跳过,age 密钥对存在则跳过

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-13 01:09:18 +08:00
wangjia 39e7f2fc11 回滚:rollback.sh + docs/回滚手册.md
deploy-pangolin / deploy (push) Has been cancelled
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-05-30 17:09:00 +08:00
wangjia cf96989e01 Phase 0: 容器化数据面 + CI/CD 自动部署
deploy-pangolin / deploy (push) Has been cancelled
- deploy/: Xray VLESS+REALITY (11443, 经宿主 nginx SNI 分流) + sing-box Hysteria2 (UDP 443) docker-compose
- 幂等 deploy.sh / gen-secrets.sh / print-clients.sh;受限 nginx-apply 特权脚本 + 一次性 root-setup
- .gitea/workflows/deploy.yml: NAS runner 经 SSH 远程部署到 EC2
- docs/ plan/: 设计方案与实施计划

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-05-30 11:48:47 +08:00