L2+L4+L5: WAN 准备(NAT 仿真 relay-only/docker · 故障注入 · 加固/运维) - #54
Merged
Merged
Conversation
onboard:DoctorStatus 增 WARN;新增「监听地址」检查(0.0.0.0/公网 → WARN + 修复建议,不使 ok=false);cli 对 WARN 显示 hint。 RELAY-OPS.md:relay=transport-only(SEALING §1.6)、自托管/替换、加固清单、故障降级;RUNBOOK 互链;PROTOCOL-INVARIANTS §8(L2/L4/L5 行)。
wan-hardening:LossyProvider(确定性拨号丢包/延迟)有界收敛且丢包可观测;peerWhitelist 负例与对照。 grant.test:监听地址 WARN/PASS。collab-e2e:全量负载下放宽超时/循环(断言不变)。
verify:wan:l2:真实 libp2p circuit relay,仅交换 /p2p-circuit 地址——relay-only 收敛、授权负例、relay 重启、IP 变更、relay 不可达降级直连(L4)。
docker-compose.wan.yml + wan-nat-{relay,peer}:relay 公开 + 两 peer 隔离网络无入站;verify:wan:l2:docker 驱动(无 docker → SKIP 明列)。
CI:ubuntu 增 verify:wan:l2 步骤 + 独立 wan-nat(docker compose)job。
kicker 每轮确保连接并触发 anti-entropy;等待放宽到 55s。断言不变。
…ab 慢 runner 等待放宽 容器 peer sync 开 pushOnWrite(默认库关);collab-e2e jest 超时 120s、等待 90s。断言不变。
A→B 也建常驻以支持 push(协商 accept/子任务);kicker 仅触发 anti-entropy。全量 6× 734 绿。
根因:worker1 可能在“已执行、done 未发布”窗口被杀 → A 永久缺该 done。改为按 A 存储 done 计数触发 kill。本机 5× 7/7。
…败时回显子套件输出 remote:延迟可见等待加重试+触发 anti-entropy;驱动循环周期兜底;deadline 90s→150s。 collab:worker 循环每轮触发 anti-entropy。 verify:fleet:all:失败时打印该套件 PASS/FAIL 行(诊断)。断言不变。本机 remote 3×/collab 3×/all 均绿。
loop 40000、wait 90s;本机 5× 12/12。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
L2+L4+L5 · WAN 准备(NAT 仿真 · 故障注入 · 加固/运维)
只进 CI/本机可重复验证:NAT/relay 仿真(本机 relay-only + docker 三容器隔离网络)、确定性故障注入、加固与运维。
git diff origin/main...HEAD -- src/为空(不改 core 语义/线格式);未碰桥/Self-Skills。主张 → 命令/输出 → 覆盖
/p2p-circuit)verify:wan:l2① · docker①(隔离网络)verify:wan:l2② · docker② {secretCount:0}verify:wan:l2③verify:wan:l2④verify:wan:l2⑤direct-degradedtests/sync/wan-hardening.test.ts(L4)wan-hardeningpeerWhitelist ·tests/p2p/ConnectionManager.test.ts·Libp2pProvider.test.tstests/fleet/grant.test.ts 监听地址verify:fleet:all126/126红 → 绿(断言原文)
Libp2pProvider去掉circuitRelayTransport//p2p-circuit监听(rebuild,S9)verify:wan:l2①/③FAIL A 已获得 relay 预留地址+ ①/③ FAIL → 还原 7/7isPrivateListenHost恒true0.0.0.0 → WARN✕ Expected "WARN" Received "PASS"→ 还原 ✓L2 · 本机 relay-only 仿真(
verify:wan:l2,7/7)L2 · docker NAT 隔离(CI job,4/4)
三容器:
relay(公开)+peera/peerb(各自net-a/net-b,无入站端口);peer 仅知 relay,经/p2p-circuit互连。(docker 中未重复 relay 重启/IP 变更;两者由本机
verify:wan:l2③④ 覆盖同一 libp2p relay 代码路径。)新 CI job
build / test / lint(含新增npm run verify:wan:l2步骤)✅WAN NAT isolation (docker compose, relay + 2 NAT peers)✅ 新增windows …✅ ·semantic recall✅35367109902(四个 job 全绿)。L5 · 加固清单(既有/新增)与 doctor 告警
MAX_FRAME_BYTES4 MiB(编码/解码越界抛错)tests/p2p/Libp2pProvider.test.tsConnectionManager.maxConnections(默认 100,超限拒绝)tests/p2p/ConnectionManager.test.tssync.peerWhitelist(未列对端会话被忽略)tests/sync/wan-hardening.test.ts监听地址:0.0.0.0/公网 → WARN + 建议(不使ok=false)tests/fleet/grant.test.ts文档
packages/fleet/RELAY-OPS.md:relay = transport-only(SEALING §1.6)、自托管/替换、加固清单、故障降级、docker/本机验证入口。PROTOCOL-INVARIANTS.md §8:L2/L4/L5 行 → 测试/脚本名。RUNBOOK.md §3互链 RELAY-OPS。顺带修复(CI 暴露的真实脆弱点,非放水)
worker1可能在「已执行、done 未发布」窗口被杀 → A 永久缺该 done。改为按 A 已观测 ≥8 条 done 触发 kill(本机 5× 7/7)。未做项 / 风险
peerWhitelist未列对端为“忽略会话”(非拒绝错误)。测试方式