mslxdff 0.1.185 → 0.1.186

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mslxdff",
3
- "version": "0.1.185",
3
+ "version": "0.1.186",
4
4
  "description": "测试项目,请勿使用。",
5
5
  "type": "module",
6
6
  "bin": {
@@ -115,25 +115,37 @@ export function fmtPool({ pooled, total, exits }) {
115
115
  }
116
116
 
117
117
  /**
118
- * 身份指纹:每个端口的短设备 id / WARP 内网地址 / 对端端点 / 注册时间。
118
+ * 身份指纹:每个端口的短设备 id / WARP 内网 IPv6 尾段 / 对端端点 / 注册时间。
119
119
  * 为什么必须有:4 条隧道只拿到 2 个出口地址时(真机 2026-10-17),只有这组读数能区分
120
- * 「设备本身被写重复了」和「CF 的共享 NAT 把不同设备折叠成一个出口」——没有它就只能猜。
120
+ * 「设备本身被写重复了」和「CF 把不同设备折叠成一个出口」——没有它就只能猜。
121
+ *
122
+ * ⚠ 判据**不看 IPv4**:`172.16.0.2` 是 WARP 的**固定接口地址**(6 次实测全是它:组长 4 台 +
123
+ * 本机 2 台;公开的 wgcf 生成配置里同样是 `Address = 172.16.0.2/32`),按它判「重复」是误报
124
+ * (2026-10-17 十一次修订前确实这么误报过)。每台设备真正唯一的是 **IPv6**(`2606:4700:110:…`)
125
+ * 与密钥对,所以指纹打 v6 尾段。
121
126
  */
127
+ /** v6 尾段做指纹(`2606:4700:110:81b5:56ec:72b3:9542:e3de` → `…:9542:e3de`);缺了给「无」。 */
128
+ export function v6Tail(v6) {
129
+ const s = String(v6 || "");
130
+ if (!s) return "无";
131
+ const parts = s.split(":");
132
+ return parts.length > 2 ? `…:${parts.slice(-2).join(":")}` : s;
133
+ }
122
134
  export function fmtIdentityDetail(nodes = []) {
123
135
  const out = [];
124
136
  const byId = new Map();
125
- const byV4 = new Map();
137
+ const byEp = new Map();
126
138
  for (const n of nodes || []) {
127
139
  if (n?.id) byId.set(n.id, [...(byId.get(n.id) || []), n.port]);
128
- if (n?.v4) byV4.set(n.v4, [...(byV4.get(n.v4) || []), n.port]);
129
- out.push(`[warp-pool] :${n?.port} 设备=${n?.id ? String(n.id).slice(0, 8) : "无id"} 内网=${n?.v4 || "无"} 端点=${n?.endpoint || "?"} 注册=${String(n?.registeredAt || "?").slice(0, 19)}`);
140
+ if (n?.endpoint) byEp.set(n.endpoint, [...(byEp.get(n.endpoint) || []), n.port]);
141
+ out.push(`[warp-pool] :${n?.port} 设备=${n?.id ? String(n.id).slice(0, 8) : "无id"} 内网v6=${v6Tail(n?.v6)} 端点=${n?.endpoint || "?"} 注册=${String(n?.registeredAt || "?").slice(0, 19)}`);
130
142
  }
131
- // cut 只给设备 id 用(UUID 太长):内网地址必须原样打,截短了就成了「172.16.0」
132
- const dups = (m, cut = 0) => [...m.entries()].filter(([, p]) => p.length > 1).map(([k, p]) => `${cut ? String(k).slice(0, cut) : String(k)} ← :${p.join(",:")}`).join(";");
133
- const dupId = dups(byId, 8);
134
- const dupV4 = dups(byV4);
143
+ const dupId = [...byId.entries()].filter(([, p]) => p.length > 1).map(([k, p]) => `${String(k).slice(0, 8)} ← :${p.join(",:")}`).join(";");
135
144
  if (dupId) out.push(`[warp-pool] ${MARK.warn} 设备 id 重复:${dupId} —— 同一个 WARP 设备被写到多个端口,出口必然相同;删掉重复端口的 node-<port>.json 再重启,它会重新注册`);
136
- if (dupV4) out.push(`[warp-pool] ${MARK.warn} WARP 内网地址重复:${dupV4} —— 同一内网地址必是同一出口`);
145
+ // 端点全同 = 大家都从同一个 CF 入口出去(CF 对每次注册都回同一个 hostname):出口撞车由此而来
146
+ const total = (nodes || []).length;
147
+ const sameEp = [...byEp.entries()].find(([, p]) => total > 1 && p.length === total);
148
+ if (sameEp) out.push(`[warp-pool] ${MARK.step} ${total} 条隧道都用同一个端点(${sameEp[0]})—— CF 对每次注册都回同一个 hostname,故大家都从同一个 CF 入口出去,出口地址撞车由此而来(想分散:把 node-<port>.json 的 endpoint 改成别的 WARP 入口 IP 后重启)`);
137
149
  return out;
138
150
  }
139
151