dsh-mobile-plugin 0.5.143 → 0.5.144
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/README.md +2 -2
- package/config/agent-presets/standard/skills/dsh-mobile-kb/SKILL.md +1 -1
- package/config/agent-presets/standard/skills/dsh-mobile-kb/references/network-guide.md +1 -1
- package/config/agent-presets/standard/skills/dsh-mobile-kb/references/network.md +1 -1
- package/config/agent-presets/standard/skills/dsh-mobile-kb/references/relay-server.md +1 -1
- package/config/agent-presets/standard/skills/dsh-mobile-kb/references/relay.md +8 -9
- package/dsh-mobile-credentials/lib/credentials.js +3 -3
- package/lib/impl.js +14 -3
- package/lib/mobile/feedback.js +19 -0
- package/lib/mobile/mux.js +2 -1
- package/lib/mobile/schedule-edit.js +9 -8
- package/lib/mobile/send-continuation.js +2 -2
- package/lib/mobile/session-send.js +3 -4
- package/lib/panel/index.html +3 -4
- package/lib/relay/core.js +2 -43
- package/lib/relay/ipv6-lifetime.cjs +89 -0
- package/lib/relay/lan-discovery.cjs +4 -7
- package/lib/relay/lan-network.cjs +16 -6
- package/lib/relay/lan-port-policy.cjs +6 -14
- package/lib/relay/pairing-payload.cjs +7 -1
- package/lib/remote/host-control.cjs +14 -8
- package/lib/shared/device-headers.js +1 -3
- package/lib/sidecar-facade-worker.cjs +2 -1
- package/package.json +14 -13
package/lib/relay/core.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// 2026-11-27:零讯客户端身份两格进默认状态(连上时落盘,复用本机客户端前比对)。
|
|
2
2
|
// 2026-11-25:专属回环入口端口与兜底期手填地址备份进默认状态(运行时字段,手机配置口不开放)。
|
|
3
|
-
//
|
|
3
|
+
// 配置收敛保持两格自洽;不再按域名清理废弃内置中转地址(2026-11-29:退役清单清完,自建同名域名照常保留)。
|
|
4
4
|
// 通用线路引擎的运行时线路清单(customRoutes)随状态落盘,默认空:没接第三方线路时上报清单逐字不变。
|
|
5
5
|
// 2026-11-22:ZeroNews 本机隧道地址独立一格 zeroNewsUrl,由插件自己读、作为第一条通用线路上报。
|
|
6
6
|
/**
|
|
@@ -143,8 +143,6 @@ function loadState() {
|
|
|
143
143
|
// 「明确没有中转」,地址当场被清空。所以先把这一格撤掉,交给收敛函数从 relayUrl 生出来。
|
|
144
144
|
if (!Object.prototype.hasOwnProperty.call(raw, 'relayUrls')) delete merged.relayUrls;
|
|
145
145
|
const state = normalizeRelayAddresses(merged);
|
|
146
|
-
// 废弃的内置中转地址在老配置里按残留数据直接清掉(纯清理,不写任何停用/回补语义)。
|
|
147
|
-
stripDeprecatedBuiltinRelays(state);
|
|
148
146
|
return state;
|
|
149
147
|
} catch {
|
|
150
148
|
const state = defaultState();
|
|
@@ -194,7 +192,6 @@ function rotateIdentity(state) {
|
|
|
194
192
|
|
|
195
193
|
function saveState(state) {
|
|
196
194
|
normalizeRelayAddresses(state);
|
|
197
|
-
stripDeprecatedBuiltinRelays(state);
|
|
198
195
|
fs.mkdirSync(path.dirname(STATE_FILE), { recursive: true });
|
|
199
196
|
const tmp = `${STATE_FILE}.tmp`;
|
|
200
197
|
fs.writeFileSync(tmp, JSON.stringify(state, null, 2), { mode: 0o600 });
|
|
@@ -334,46 +331,8 @@ function tunnelWsUrl(relayUrl) {
|
|
|
334
331
|
function signLanToken(secret, instanceId, ttlSec = MOBILE_TOKEN_TTL_SEC) { return sharedToken.signLanToken(secret, instanceId, ttlSec); }
|
|
335
332
|
function verifyLanToken(secret, token, instanceId) { return sharedToken.verifyLanToken(secret, token, instanceId); }
|
|
336
333
|
|
|
337
|
-
/**
|
|
338
|
-
* 曾经内置、现已废弃的中转 host。
|
|
339
|
-
*
|
|
340
|
-
* 这几台前几版作为内置地址发给过用户(dsh.iouf.cn / dsh.yfyidc.cn / ai-hub-jd-1 是更早的
|
|
341
|
-
* 面板项,ai-hub-de-1 是最后一版内置地址),现已全部停止提供。老配置里残留的按废弃地址
|
|
342
|
-
* 直接清掉:纯数据清理,不保留识别或回补语义,也不据此判断用户是否配了自己的线路。
|
|
343
|
-
*/
|
|
344
|
-
const DEPRECATED_BUILTIN_RELAY_HOSTS = new Set([
|
|
345
|
-
'ai-hub-de-1.wnluo.com',
|
|
346
|
-
'ai-hub-jd-1.wnluo.com',
|
|
347
|
-
'dsh.iouf.cn',
|
|
348
|
-
'dsh.yfyidc.cn',
|
|
349
|
-
]);
|
|
350
|
-
function isDeprecatedBuiltinRelayUrl(url) {
|
|
351
|
-
try {
|
|
352
|
-
return DEPRECATED_BUILTIN_RELAY_HOSTS.has(new URL(String(url).trim()).host.toLowerCase());
|
|
353
|
-
} catch {
|
|
354
|
-
return false;
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
/**
|
|
359
|
-
* 把废弃的内置中转地址从配置两格里剔掉(就地改 `state`,返回有没有改动)。
|
|
360
|
-
*
|
|
361
|
-
* 读盘与落盘都无条件调用:命中即删,不判断列表里还有没有别的地址,也不写任何
|
|
362
|
-
* 「停用 / 回补」标记。删空了就让 `relayUrl` 也空,`relayUrls[0] === relayUrl` 的不变式
|
|
363
|
-
* 在这里一并维持。
|
|
364
|
-
*/
|
|
365
|
-
function stripDeprecatedBuiltinRelays(state) {
|
|
366
|
-
if (!state || typeof state !== 'object') return false;
|
|
367
|
-
const relay = relayAddressesOf(state);
|
|
368
|
-
const kept = relay.relayUrls.filter((url) => !isDeprecatedBuiltinRelayUrl(url));
|
|
369
|
-
if (kept.length === relay.relayUrls.length) return false;
|
|
370
|
-
state.relayUrls = kept;
|
|
371
|
-
state.relayUrl = kept.length ? kept[0] : '';
|
|
372
|
-
return true;
|
|
373
|
-
}
|
|
374
|
-
|
|
375
334
|
module.exports = {
|
|
376
335
|
STATE_FILE, MOBILE_TOKEN_TTL_SEC, MOBILE_BEARER_TTL_SEC, defaultState, loadState, saveState, rotatePairing, rotateIdentity, genInstanceId, genPairingCode, genPairingTicket, genHistoryKey, ensureHistoryKey,
|
|
377
336
|
tunnelWsUrl, normalizeRelayUrl, normalizeRelayUrlList, normalizeRelayAddresses, relayAddressesOf, applyRelayAddressPatch, signLanToken, verifyLanToken,
|
|
378
|
-
|
|
337
|
+
MAX_RELAY_ADDRESSES,
|
|
379
338
|
};
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
// IPv6 候选的本机「退休地址」探测:读系统网卡详情,把 preferred_lft 归零 / 标了 deprecated
|
|
2
|
+
// 的地址认出来,供候选生成直接过滤。Node 的 os.networkInterfaces() 不带这个状态,只能问系统。
|
|
3
|
+
//
|
|
4
|
+
// 这是旁路优化,不是可达性保证:任何读不到、解析不出、命令不存在的情况都退化成空集合(不过滤),
|
|
5
|
+
// 绝不让候选生成抛错或断链;真正的可达性由 ipv6-liveness 那层和手机侧实测兜底。
|
|
6
|
+
// 电信 PPPoE 重拨换前缀后,旧地址会先进入 deprecated 再消失 —— 这段窗口里它仍挂在网卡上、
|
|
7
|
+
// 看起来像正常全球单播,却已经收不到外面的连接,正是手机白等一次超时的来源。
|
|
8
|
+
'use strict'
|
|
9
|
+
|
|
10
|
+
const { execFileSync } = require('node:child_process')
|
|
11
|
+
|
|
12
|
+
const CACHE_TTL_MS = 5 * 1000
|
|
13
|
+
const PROBE_TIMEOUT_MS = 3000
|
|
14
|
+
|
|
15
|
+
/** 模块级缓存:同一批候选生成(二维码 / connection-info / 总控上报)共用一次系统读取。 */
|
|
16
|
+
let cached = null
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* 从 ifconfig / ip -6 addr 的输出里认退休地址。
|
|
20
|
+
*
|
|
21
|
+
* macOS:`inet6 240e:... prefixlen 64 autoconf deprecated pltime 0 vltime ...`
|
|
22
|
+
* Linux:`inet6 240e:.../64 scope global deprecated ...` 下一行 `valid_lft ... preferred_lft 0sec`
|
|
23
|
+
* 只认 inet6 行上的 deprecated / pltime 0,以及紧跟其后的 preferred_lft 0sec。别的文本一律不算
|
|
24
|
+
* 答案 —— 读不出就当没有,宁可多报一条让手机探一次,也不能把还在用的地址误踢。
|
|
25
|
+
*/
|
|
26
|
+
function parseRetiredAddresses(text) {
|
|
27
|
+
const out = []
|
|
28
|
+
const seen = new Set()
|
|
29
|
+
let lastAddress = null
|
|
30
|
+
const retire = (address) => {
|
|
31
|
+
const key = address.toLowerCase()
|
|
32
|
+
if (!seen.has(key)) {
|
|
33
|
+
seen.add(key)
|
|
34
|
+
out.push(key)
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
for (const line of String(text || '').split(/\r?\n/)) {
|
|
38
|
+
const hit = /^\s*inet6\s+([0-9a-fA-F:]+)(?:\/\d+)?\s*(.*)$/.exec(line)
|
|
39
|
+
if (hit) {
|
|
40
|
+
lastAddress = hit[1]
|
|
41
|
+
const rest = hit[2]
|
|
42
|
+
// macOS 把 deprecated / pltime 0 写在 inet6 行上;有就直接收。
|
|
43
|
+
if (/\bdeprecated\b/i.test(rest) || /\bpltime\s+0\b/i.test(rest)) retire(lastAddress)
|
|
44
|
+
continue
|
|
45
|
+
}
|
|
46
|
+
// Linux 把 lifetime 写在 inet6 的下一行:preferred_lft 归零就是退休。
|
|
47
|
+
if (lastAddress && /\bpreferred_lft\s+0sec\b/i.test(line)) retire(lastAddress)
|
|
48
|
+
}
|
|
49
|
+
return out
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function commandFor(platform) {
|
|
53
|
+
if (platform === 'darwin') return { cmd: 'ifconfig', args: ['-a'] }
|
|
54
|
+
if (platform === 'linux') return { cmd: 'ip', args: ['-6', 'addr', 'show'] }
|
|
55
|
+
// Windows 的 netsh 输出形态随版本/语言变,读不出就不过滤(还有 liveness 与手机实测兜底)。
|
|
56
|
+
return null
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* 当前退休的 IPv6 地址(裸地址字符串)。`platform` / `execFileSync` / `now` 可注入,守卫不用真 fork 进程。
|
|
61
|
+
* 读不到一律回空数组,并按 TTL 缓存,避免每次取候选都 fork 一次。
|
|
62
|
+
*/
|
|
63
|
+
function retiredAddresses(options = {}) {
|
|
64
|
+
const platform = typeof options.platform === 'string' ? options.platform : process.platform
|
|
65
|
+
const now = typeof options.now === 'function' ? options.now() : Date.now()
|
|
66
|
+
const ttlMs = Number(options.ttlMs) > 0 ? Number(options.ttlMs) : CACHE_TTL_MS
|
|
67
|
+
if (cached && cached.platform === platform && now - cached.at < ttlMs) return cached.value
|
|
68
|
+
let value = []
|
|
69
|
+
const command = commandFor(platform)
|
|
70
|
+
const exec = typeof options.execFileSync === 'function' ? options.execFileSync : (cmd, args) => execFileSync(cmd, args, {
|
|
71
|
+
encoding: 'utf8',
|
|
72
|
+
timeout: PROBE_TIMEOUT_MS,
|
|
73
|
+
stdio: ['ignore', 'pipe', 'ignore'],
|
|
74
|
+
maxBuffer: 1 << 20,
|
|
75
|
+
})
|
|
76
|
+
if (command) {
|
|
77
|
+
try {
|
|
78
|
+
value = parseRetiredAddresses(exec(command.cmd, command.args))
|
|
79
|
+
} catch {
|
|
80
|
+
value = []
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
cached = { platform, at: now, value }
|
|
84
|
+
return value
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function reset() { cached = null }
|
|
88
|
+
|
|
89
|
+
module.exports = { parseRetiredAddresses, retiredAddresses, reset }
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
// 2026-11-29:端口被占即换号,只有显式固定端口才保留;去掉发现能力拦截。
|
|
1
2
|
// 短暂占用先重试原端口;发现重发等待退订结束,失败保留底层原因。
|
|
2
3
|
'use strict';
|
|
3
4
|
// 只发布已监听入口;发布失败时停止换号,现有固定入口仍可使用。
|
|
4
|
-
const { canChangeLanPort } = require('./lan-port-policy.cjs');
|
|
5
5
|
|
|
6
6
|
const SERVICE_TYPE = 'dsh-mobile';
|
|
7
7
|
|
|
@@ -91,8 +91,8 @@ function createLanDiscovery({ instanceId, onChange = () => {}, makeBonjour = onE
|
|
|
91
91
|
return { publish, stop, snapshot: () => ({ ...view }) };
|
|
92
92
|
}
|
|
93
93
|
|
|
94
|
-
/**
|
|
95
|
-
async function bindLanEndpoint({ requestedPort, createProxy, discovery,
|
|
94
|
+
/** 短暂占用先重试原入口;只有显式固定端口才保留原端口,其余占用即换号。 */
|
|
95
|
+
async function bindLanEndpoint({ requestedPort, createProxy, discovery, lockReason = '', isCurrent = () => true,
|
|
96
96
|
retryDelays = [250, 750], wait = ms => new Promise(resolve => setTimeout(resolve, ms)) }) {
|
|
97
97
|
let proxy;
|
|
98
98
|
let changed = false;
|
|
@@ -104,10 +104,7 @@ async function bindLanEndpoint({ requestedPort, createProxy, discovery, store, i
|
|
|
104
104
|
await proxy.stop();
|
|
105
105
|
if (error?.code !== 'EADDRINUSE') throw error;
|
|
106
106
|
if (attempt < retryDelays.length) { await wait(retryDelays[attempt]); continue; }
|
|
107
|
-
if (lockReason) throw new Error(`端口 ${requestedPort}
|
|
108
|
-
if (!canChangeLanPort(store, instanceId)) {
|
|
109
|
-
throw new Error(`端口 ${requestedPort} 已被占用;为保留旧版或未知能力手机的连接地址,未自动换端口。请释放占用后重试。`);
|
|
110
|
-
}
|
|
107
|
+
if (lockReason) throw new Error(`端口 ${requestedPort} 已被占用;已开启固定端口,未自动换端口。请释放占用后重试。`);
|
|
111
108
|
if (!isCurrent()) throw new Error('局域网配置已更新');
|
|
112
109
|
proxy = createProxy(0);
|
|
113
110
|
try { await proxy.start(); } catch (retryError) { await proxy.stop(); throw retryError; }
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// 反馈 1569:插件跑在容器里时容器内网 eth0 不进局域网候选(按容器标记判,不按 172 地址段)。
|
|
2
|
+
// 反馈 N1(IPv6 地址变化):退休 / deprecated 的全球单播地址不进候选,避免手机拨一条已经收不到连接的旧地址。
|
|
2
3
|
// 反馈 1012:172.17/16 是真实 Wi-Fi 可用的私网段,容器 / 虚拟网卡改由网卡名黑名单挡。
|
|
3
4
|
// 反馈 1562:节点小宝 NodeBabyLink 是第三方穿透 VPN 虚拟网卡,按网卡名挡,不进局域网候选。
|
|
4
5
|
// 没有已监听端口时不产出可连接候选。
|
|
@@ -19,6 +20,7 @@ const os = require('node:os')
|
|
|
19
20
|
const { isPrivateLanAddress } = require('../shared/private-address.js')
|
|
20
21
|
const { normalizeIpVersionPolicy, allowsIpv6Candidates } = require('./net-family.cjs')
|
|
21
22
|
const ipv6Liveness = require('./ipv6-liveness.cjs')
|
|
23
|
+
const ipv6Lifetime = require('./ipv6-lifetime.cjs')
|
|
22
24
|
|
|
23
25
|
// 出站协议族策略与 IPv6 候选活性账都放在模块级:同一进程里所有取候选的入口共用一份。
|
|
24
26
|
// 每个进程(宿主 / worker)各自把自己那份配置口径设进来即可,见 `setIpVersionPolicy`。
|
|
@@ -291,24 +293,32 @@ function isGlobalUnicastV6(address) {
|
|
|
291
293
|
* ——候选是随二维码一起带走的,条数一多二维码就密到扫不动。
|
|
292
294
|
*/
|
|
293
295
|
const IPV6_CANDIDATE_MAX = 4
|
|
294
|
-
|
|
296
|
+
/**
|
|
297
|
+
* @param {object} [opts] `opts.retired` 可注入退休地址名单(函数或数组),供守卫不必真读系统网卡。
|
|
298
|
+
*/
|
|
299
|
+
function ipv6Interfaces(port, interfaces = os.networkInterfaces(), opts = {}) {
|
|
295
300
|
// ipv4-only:整条 IPv6 直连通道不产出,手机也就不会拿到会超时的 v6 候选。
|
|
296
301
|
if (!allowsIpv6Candidates(ipVersionPolicy)) return []
|
|
297
|
-
|
|
302
|
+
// 退休地址(PPPoE 重拨换前缀后的旧地址)先踢掉:它还挂在网卡上、长得也像全球单播,
|
|
303
|
+
// 但已经收不到外面的连接。读不到系统详情时名单为空,退回老行为,不让候选生成断链。
|
|
304
|
+
const retired = typeof opts.retired === 'function' ? opts.retired() : (opts.retired || ipv6Lifetime.retiredAddresses())
|
|
305
|
+
const retiredNumbers = new Set((Array.isArray(retired) ? retired : []).map(ipv6Number).filter((v) => v !== null))
|
|
306
|
+
const accept = (address) => isGlobalUnicastV6(address) && !retiredNumbers.has(ipv6Number(address))
|
|
307
|
+
const all = toCandidates(collectEndpoints(interfaces, accept, 'IPv6'), port, 'IPv6')
|
|
298
308
|
.slice(0, IPV6_CANDIDATE_MAX)
|
|
299
309
|
// 本机活性预筛:已知连不上的(临时地址轮换/前缀撤销后的死地址)先从候选里过滤掉,别再发给手机。
|
|
300
310
|
// 首轮没有结论时原样返回,探测在后台补齐(旁路,失败不影响候选生成)。
|
|
301
311
|
const alive = new Set(ipv6Liveness.defaultCache.filter(all.map((candidate) => candidate.url)))
|
|
302
312
|
return all.filter((candidate) => alive.has(candidate.url))
|
|
303
313
|
}
|
|
304
|
-
function ipv6Urls(port, interfaces = os.networkInterfaces()) {
|
|
305
|
-
return ipv6Interfaces(port, interfaces).map((candidate) => candidate.url)
|
|
314
|
+
function ipv6Urls(port, interfaces = os.networkInterfaces(), opts = {}) {
|
|
315
|
+
return ipv6Interfaces(port, interfaces, opts).map((candidate) => candidate.url)
|
|
306
316
|
}
|
|
307
|
-
function ipv6Candidates(port, interfaces = os.networkInterfaces()) {
|
|
317
|
+
function ipv6Candidates(port, interfaces = os.networkInterfaces(), opts = {}) {
|
|
308
318
|
// 与 `advertisedCandidates` 同一条口径:取不到网卡(异常)时回空清单、绝不抛 —— 它喂的
|
|
309
319
|
// 也是二维码与 `/connection-info`,把它整条控制面拖下水不值得。
|
|
310
320
|
try {
|
|
311
|
-
return ipv6Interfaces(port, interfaces)
|
|
321
|
+
return ipv6Interfaces(port, interfaces, opts)
|
|
312
322
|
} catch {
|
|
313
323
|
return []
|
|
314
324
|
}
|
|
@@ -1,18 +1,10 @@
|
|
|
1
|
+
// 2026-11-29:只有显式固定端口才锁原端口;端口被占即换号,不再看发现能力或穿透/手填地址。
|
|
1
2
|
'use strict';
|
|
2
|
-
//
|
|
3
|
-
//
|
|
3
|
+
// 只有用户自己勾了「固定端口」才锁原入口;端口被占就换一个可用的,谁也不拦。
|
|
4
|
+
// 换号后由自带隧道各自跟随落点(见装配层 syncNetwork)。
|
|
4
5
|
|
|
5
|
-
function lanPortLockReason(state
|
|
6
|
-
|
|
7
|
-
if (forwarding || state.manualLanUrl || state.manualIpv6Url || state.manualTcpUrl) return 'forwarding';
|
|
8
|
-
return '';
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
function canChangeLanPort(store, instanceId) {
|
|
12
|
-
store.refresh?.();
|
|
13
|
-
const rows = store.listActive().filter(row => row.instanceId === instanceId && row.kind !== 'computer');
|
|
14
|
-
// 没有活设备就没有手机会拿旧端口找回来;有活设备仍要求全部支持发现。
|
|
15
|
-
return rows.length === 0 || rows.every(row => row.lanDiscovery === 1);
|
|
6
|
+
function lanPortLockReason(state) {
|
|
7
|
+
return state.lanPortFixed === true ? 'fixed' : '';
|
|
16
8
|
}
|
|
17
9
|
|
|
18
10
|
function createLanPortPolicy({ state, saveState }) {
|
|
@@ -42,4 +34,4 @@ function createLanPortPolicy({ state, saveState }) {
|
|
|
42
34
|
};
|
|
43
35
|
}
|
|
44
36
|
|
|
45
|
-
module.exports = { lanPortLockReason,
|
|
37
|
+
module.exports = { lanPortLockReason, createLanPortPolicy };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// 2026-11-29:公网 IPv6 也能单独撑起一张配对码——宿主侧拒 IPv6 的限制已删,出码判据跟上。
|
|
1
2
|
// 2026-11-27:进二维码的服务商线路名字截到 40 字——名字只是显示用,长名字能把码撑到扫不出来。
|
|
2
3
|
// 2026-11-24:服务商的 http(s) 地址同时进 lanUrls,让不认 routes 的老包也能扫码走服务商直连;
|
|
3
4
|
// 二维码只带电脑自己配的线路,新机没自己的线路时蜂窝首次配对失败属于预期。
|
|
@@ -197,7 +198,11 @@ function pairingText(payload) {
|
|
|
197
198
|
* 这张二维码里有没有一条手机能拿去配对的路。
|
|
198
199
|
*
|
|
199
200
|
* 配对这一刻能拨的:中转、局域网 / 直连 / TCP 桥(都在 `lanUrls`)、服务商线路(`routes`)、
|
|
200
|
-
*
|
|
201
|
+
* 隧道与点对点、以及公网 IPv6 候选。
|
|
202
|
+
*
|
|
203
|
+
* IPv6 从「不算」改成「算」:原判据说「宿主拒公网 IPv6 来源的配对」,那条限制 2026-11-29
|
|
204
|
+
* 已删(限流换成不看来源的全局令牌桶,旧理由不成立);二维码与心跳一直把 IPv6 当可用线路
|
|
205
|
+
* 报给手机、App 也把它当合法配对入口,唯独出码判据还拦着,一台只有公网 IPv6 的电脑就出不了码。
|
|
201
206
|
*
|
|
202
207
|
* 面板与命令行两个出码入口都调这一个判据。以前各写一遍、都把 `routes` 漏了,结果一台
|
|
203
208
|
* 「只接了一家服务商」的机器(比如只挂 ZeroNews / 节点小宝 / FRP 自建 TCP)二维码出不来,
|
|
@@ -209,6 +214,7 @@ function pairingHasAddress(payload) {
|
|
|
209
214
|
(typeof p.relayUrl === 'string' && p.relayUrl)
|
|
210
215
|
|| (Array.isArray(p.lanUrls) && p.lanUrls.length > 0)
|
|
211
216
|
|| (Array.isArray(p.routes) && p.routes.length > 0)
|
|
217
|
+
|| (Array.isArray(p.ipv6Candidates) && p.ipv6Candidates.length > 0)
|
|
212
218
|
|| p.tailcat
|
|
213
219
|
|| p.p2p,
|
|
214
220
|
);
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
// IPv6 候选按真实监听端口生成,独立于 IPv4 局域网候选开关。
|
|
2
2
|
// 2026-11-22:远程桌面候选也带上插件上报的第三方线路(含 ZeroNews),与手机共用同一批。
|
|
3
|
+
// 2026-11-29:补齐 Cloudflare / 节点小宝 / FRP —— 统一走 providerLinesOf,与手机同源不再分叉。
|
|
3
4
|
'use strict';
|
|
4
5
|
// 电脑间已认证控制信令只提供隧道会合,目标固定为本机插件入口。
|
|
5
6
|
const { relayAddressesOf } = require('../relay/core.js');
|
|
6
7
|
const { advertisedCandidates, phoneCandidates, ipv6Candidates, withManualIpv6Candidate, tcpDirectTarget } = require('../relay/lan-network.cjs');
|
|
8
|
+
const { providerLinesOf } = require('../relay/provider-lines.cjs');
|
|
7
9
|
|
|
8
10
|
function routesOf({ state, lanPortInUse, lanAvailable = () => state.lanEnabled, interfaces }) {
|
|
9
11
|
const routes = [];
|
|
@@ -28,14 +30,18 @@ function routesOf({ state, lanPortInUse, lanAvailable = () => state.lanEnabled,
|
|
|
28
30
|
// 所以这里必须把它也当候选,否则远程电脑反而少一条可用的公网线路。
|
|
29
31
|
const tcp = tcpDirectTarget(state.manualTcpUrl);
|
|
30
32
|
if (tcp) push(`http://${tcp}`, 'tcp');
|
|
31
|
-
//
|
|
32
|
-
//
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
33
|
+
// 通用线路:手机与远程桌面共用同一份 providerLinesOf —— ZeroNews / 节点小宝 / FRP /
|
|
34
|
+
// 用户自定义都从这一处出,避免远程侧再各拼一遍、像以前那样漏掉后三家。tcp 的 host:port 补
|
|
35
|
+
// http 前缀(远程侧要的是可解析 URL),custom 作为表外通道排最后。
|
|
36
|
+
for (const line of providerLinesOf(state)) push(customRouteUrl(line.url, line.transport), 'custom');
|
|
37
|
+
// Cloudflare 兜底隧道:providerLinesOf 刻意不收它(免得手机把它当第三方线路重复画),
|
|
38
|
+
// 但远程桌面通道表里它是独立的一档、面板也显示,所以这里单独补一条。命名隧道优先于快速隧道,
|
|
39
|
+
// 与二维码 / 总控同一口径。
|
|
40
|
+
const cfRaw = typeof state.cloudflareNamedUrl === 'string' && state.cloudflareNamedUrl.trim()
|
|
41
|
+
? state.cloudflareNamedUrl
|
|
42
|
+
: state.cloudflareUrl;
|
|
43
|
+
const cf = typeof cfRaw === 'string' ? cfRaw.trim().replace(/\/+$/, '') : '';
|
|
44
|
+
if (cf) push(cf, 'cloudflare');
|
|
39
45
|
return routes;
|
|
40
46
|
}
|
|
41
47
|
/** 通用线路地址:http(s) 原样,tcp 的 host:port 补 http 前缀(远程侧要的是可解析 URL)。 */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
// 2026-11-29:不再上报/保存局域网发现能力位。
|
|
1
2
|
'use strict';
|
|
2
3
|
// 包名 / 构建号 / 渠道也随身份头上报:AI 反馈提交要按真实安装包报身份(2026-11-18)。
|
|
3
|
-
// 本地发现能力只在鉴权成功后随设备元信息保存。
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* 手机每次请求顺带上来的身份:设备名、机型、平台、系统版本、App 版本。
|
|
@@ -78,8 +78,6 @@ function deviceMetaFromHeaders(req) {
|
|
|
78
78
|
if (buildNumber) meta.buildNumber = buildNumber;
|
|
79
79
|
const channel = headerText(headers, CHANNEL_HEADER);
|
|
80
80
|
if (channel) meta.channel = channel;
|
|
81
|
-
const discovery = headerText(headers, 'x-dsh-lan-discovery');
|
|
82
|
-
if (discovery === '1' || discovery === '0') meta.lanDiscovery = Number(discovery);
|
|
83
81
|
return meta;
|
|
84
82
|
}
|
|
85
83
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// 2026-11-29:绑定局域网入口不再传凭据库;换号只看固定端口开关。
|
|
1
2
|
// 2026-11-26:控制台退出事件不再带走 worker,信号处理器抢在依赖加载之前注册。
|
|
2
3
|
// 2026-11-25:专属回环入口随局域网代理一起启动,实绑端口上报宿主落盘;sidecar 白名单放行该运行时字段。
|
|
3
4
|
// 主动重连只重建中转隧道,手工换址先清掉过期的自动选路账。
|
|
@@ -769,7 +770,7 @@ async function startLan() {
|
|
|
769
770
|
publishState()
|
|
770
771
|
try {
|
|
771
772
|
const result = await bindLanEndpoint({
|
|
772
|
-
requestedPort: config.lanPort, lockReason: config.lanPortLockReason || '', discovery,
|
|
773
|
+
requestedPort: config.lanPort, lockReason: config.lanPortLockReason || '', discovery,
|
|
773
774
|
isCurrent: () => own === lanGeneration,
|
|
774
775
|
createProxy: port => createLanProxy({
|
|
775
776
|
ipv4Enabled: Boolean(config.lanEnabled),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-mobile-plugin",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.144",
|
|
4
4
|
"description": "Mobile API (/api/mobile/v1) and relay client for the DSH mobile app — desktop profile build (dsh 0.2.x, peers resolved by the host)",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"icon": "./icon.png",
|
|
@@ -117,22 +117,23 @@
|
|
|
117
117
|
"yaml": "2.9.1"
|
|
118
118
|
},
|
|
119
119
|
"dshMobileReleaseNotes": {
|
|
120
|
-
"version": "0.5.
|
|
120
|
+
"version": "0.5.144",
|
|
121
121
|
"kinds": [
|
|
122
|
+
"feature",
|
|
122
123
|
"fix"
|
|
123
124
|
],
|
|
124
125
|
"notes": {
|
|
125
|
-
"zh-Hans": "-
|
|
126
|
-
"zh-Hant": "-
|
|
127
|
-
"en": "-
|
|
128
|
-
"ja": "-
|
|
129
|
-
"ko": "-
|
|
130
|
-
"de": "-
|
|
131
|
-
"es": "-
|
|
132
|
-
"fr": "-
|
|
133
|
-
"pt": "-
|
|
134
|
-
"ru": "-
|
|
135
|
-
"tr": "-
|
|
126
|
+
"zh-Hans": "- 改进 IPv6 地址处理:系统里已退役的公网 IPv6 不再当作候选地址去连接,避免因地址失效连不上。\n- 局域网端口被别的程序占用时会自动换一个可用端口,不再因为发现能力或穿透配置就锁住原端口。\n- ZeroNews 只在端口真正发生变化时才重新判断连接落点,减少无谓的重连误判。\n- 面板上的纯状态提示(只有标题和详情、没有你写的现象说明)不再误当成反馈提交,避免排查白跑一趟。",
|
|
127
|
+
"zh-Hant": "- 改進 IPv6 位址處理:系統裡已退役的公用 IPv6 不再當作候選位址去連線,避免因位址失效連不上。\n- 區域網路連線埠被其他程式占用時會自動換一個可用連線埠,不再因為探索能力或穿透設定就鎖住原連線埠。\n- ZeroNews 只在連線埠真的改變時才重新判斷連線落點,減少不必要的重連誤判。\n- 面板上的純狀態提示(只有標題和詳情、沒有你寫的現象說明)不再誤當成回饋提交,避免排查白跑一趟。",
|
|
128
|
+
"en": "- Improved IPv6 handling: public IPv6 addresses that the system has retired are no longer used as connection candidates, avoiding failed connections caused by stale addresses.\n- When a local network port is occupied by another program, the plugin now switches to a free port automatically instead of keeping the original one because of discovery or tunnel settings.\n- ZeroNews now re-evaluates its connection point only when the port actually changes, cutting down on needless reconnects and false alarms.\n- Plain status readouts in the panel (only a title and details, with no description written by you) are no longer submitted as feedback, so a report does not go nowhere.",
|
|
129
|
+
"ja": "- IPv6 アドレスの処理を改善しました。システム上すでに無効になったグローバル IPv6 アドレスを接続候補から除外し、古いアドレスによる接続失敗を防ぎます。\n- ローカルネットワークのポートが他のプログラムに占有されている場合、検出機能やトンネル設定に縛られず、自動的に空いているポートに切り替えます。\n- ZeroNews はポートが実際に変わったときだけ接続先を再判定するようになり、不要な再接続や誤判定が減りました。\n- パネルの単なるステータス表示(タイトルと詳細だけで、あなたが書いた状況説明がないもの)はフィードバックとして送られなくなり、調査が無駄になるのを防ぎます。",
|
|
130
|
+
"ko": "- IPv6 주소 처리를 개선했습니다. 시스템에서 이미 폐기된 공용 IPv6 주소를 연결 후보에서 제외해, 낡은 주소로 인한 연결 실패를 막습니다.\n- 로컬 네트워크 포트가 다른 프로그램에 점유되면 검색 기능이나 터널 설정에 묶이지 않고 자동으로 사용 가능한 포트로 바꿉니다.\n- ZeroNews는 포트가 실제로 바뀐 경우에만 연결 지점을 다시 판단하므로 불필요한 재연결과 오판이 줄었습니다.\n- 패널의 단순 상태 표시(제목과 상세만 있고 직접 쓴 상황 설명이 없는 것)는 더 이상 피드백으로 전송되지 않아 조사가 헛수고가 되는 것을 막습니다.",
|
|
131
|
+
"de": "- Verbesserte IPv6-Behandlung: Öffentliche IPv6-Adressen, die vom System bereits als veraltet markiert sind, werden nicht mehr als Verbindungsadressen verwendet. Das verhindert Verbindungsfehler durch veraltete Adressen.\n- Wenn ein lokaler Netzwerkport von einem anderen Programm belegt ist, wechselt das Plugin automatisch zu einem freien Port, statt den alten wegen Erkennungs- oder Tunnel-Einstellungen zu behalten.\n- ZeroNews bewertet den Verbindungsort nur dann neu, wenn sich der Port tatsächlich geändert hat. Überflüssige Neustarts und Fehlalarme werden so reduziert.\n- Reine Statusmeldungen im Panel (nur Titel und Details, ohne Ihre eigene Beschreibung) werden nicht mehr als Feedback übermittelt, damit eine Meldung nicht ins Leere läuft.",
|
|
132
|
+
"es": "- Se mejoró el manejo de IPv6: las direcciones IPv6 públicas que el sistema ya marcó como obsoletas dejan de usarse como candidatas de conexión, lo que evita fallos por direcciones antiguas.\n- Cuando otro programa ocupa el puerto de la red local, el plugin cambia automáticamente a uno libre en lugar de conservar el anterior por ajustes de detección o túnel.\n- ZeroNews vuelve a evaluar su punto de conexión solo cuando el puerto cambia de verdad, lo que reduce reintentos innecesarios y falsos avisos.\n- Los simples avisos de estado del panel (solo título y detalles, sin una descripción suya) ya no se envían como comentarios, para que el reporte no quede en vacío.",
|
|
133
|
+
"fr": "- Traitement IPv6 amélioré : les adresses IPv6 publiques déjà marquées comme obsolètes par le système ne sont plus utilisées comme adresses de connexion, ce qui évite les échecs dus à des adresses périmées.\n- Lorsqu'un port du réseau local est occupé par un autre programme, le plugin passe automatiquement à un port libre au lieu de conserver le port initial à cause des paramètres de détection ou de tunnel.\n- ZeroNews ne réévalue son point de connexion que lorsque le port change réellement, ce qui réduit les reconnexions inutiles et les faux positifs.\n- Les simples relevés d'état du panneau (titre et détails seulement, sans description de votre part) ne sont plus envoyés comme commentaires, afin qu'un signalement ne parte pas dans le vide.",
|
|
134
|
+
"pt": "- Melhorado o tratamento de IPv6: endereços IPv6 públicos já marcados como obsoletos pelo sistema deixam de ser usados como candidatos de conexão, evitando falhas por endereços antigos.\n- Quando uma porta da rede local está ocupada por outro programa, o plugin troca automaticamente para uma porta livre em vez de manter a original por causa de detecção ou ajustes de túnel.\n- O ZeroNews só reavalia seu ponto de conexão quando a porta realmente muda, reduzindo reconexões desnecessárias e falsos alertas.\n- Avisos simples de estado no painel (apenas título e detalhes, sem uma descrição sua) deixam de ser enviados como feedback, para que o relato não vá para lugar nenhum.",
|
|
135
|
+
"ru": "- Улучшена обработка IPv6: публичные адреса IPv6, которые система уже пометила как устаревшие, больше не используются в качестве кандидатов для подключения. Это помогает избежать ошибок связи из-за недействительных адресов.\n- Если порт локальной сети занят другой программой, плагин автоматически выбирает свободный порт вместо того, чтобы сохранять прежний из-за обнаружения или настроек туннеля.\n- ZeroNews пересматривает точку подключения только тогда, когда порт действительно изменился; это уменьшает лишние переподключения и ложные срабатывания.\n- Простые статусные сообщения на панели (только заголовок и описание, без вашего пояснения) больше не отправляются как отзыв, чтобы обращение не пропадало зря.",
|
|
136
|
+
"tr": "- IPv6 işleme iyileştirildi: sistem tarafından kullanımdan kaldırılmış olarak işaretlenen genel IPv6 adresleri artık bağlantı adayı olarak kullanılmıyor. Böylece eski adreslerden kaynaklanan bağlantı hataları önleniyor.\n- Yerel ağ portu başka bir program tarafından kullanılıyorsa eklenti, keşif veya tünel ayarlarına takılıp kalmak yerine otomatik olarak boş bir porta geçiyor.\n- ZeroNews bağlantı noktasını yalnızca port gerçekten değiştiğinde yeniden değerlendiriyor; gereksiz yeniden bağlanmalar ve yanlış uyarılar azalıyor.\n- Paneldeki yalnızca durum bilgisi taşıyan bildirimler (başlık ve ayrıntı var, sizin yazdığınız açıklama yok) artık geri bildirim olarak gönderilmiyor; böylece inceleme boşa gitmiyor."
|
|
136
137
|
}
|
|
137
138
|
}
|
|
138
139
|
}
|