fix(speedtest): 让测速支持节点的 DialerProxyName 前置代理 - #287
Open
isdoge wants to merge 1 commit into
Open
Conversation
问题:sublinkpro 内置测速调用 MihomoDelayTest/MihomoSpeedTest 时只 传节点原始 Link,不读 Node.DialerProxyName,导致配置了前置代理的 节点测速仍走直连,无法反映 dialer 实际效果。 修复: - services/mihomo/mihomo.go: 新增 mockTunnel 实现 constant.Tunnel 与 proxydialer.Tunnel,新增 GetMihomoAdapterWithDialer 与内部 getMihomoAdapterWithContext;当传入 dialer 时构建 dialer 代理映射 并用 adapter.WithTunnelForAPI 注入 tunnel,proxyMap 写入 dialer-proxy 字段,使 hy2/trojan/vmess 等节点经 dialer 拨号。 - services/scheduler/speedtest_task.go: 延迟与速度两阶段在调用前 通过 models.GetNodeByName(n.DialerProxyName) 查询 dialer 节点, 取其 EffectiveName() 与 Link 传入测速函数。 兼容性:DialerProxyName 为空时行为与原来完全一致;GetMihomoAdapter 旧签名保留,node/sub.go、node/usage.go、services/unlock/orchestrator.go 等既有调用点无需改动。 Refs: 内部验证发现 speedtest_task.go 只传 n.Link 不带 DialerProxyName
isdoge
force-pushed
the
fix-speedtest-dialer-proxy
branch
from
August 18, 2026 07:42
55c974d to
a8dde29
Compare
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.
描述
问题:sublinkpro 内置测速调用 MihomoDelayTest/MihomoSpeedTest 时只 传节点原始 Link,不读 Node.DialerProxyName,导致配置了前置代理的
节点测速仍走直连,无法反映 dialer 实际效果。
修复:
兼容性:DialerProxyName 为空时行为与原来完全一致;GetMihomoAdapter
旧签名保留,node/sub.go、node/usage.go、services/unlock/orchestrator.go 等既有调用点无需改动。
Refs: 内部验证发现 speedtest_task.go 只传 n.Link 不带 DialerProxyName
关联 Issue
Fixes # (无对应 Issue)
更改类型
更改内容
services/mihomo/mihomo.go:
mockTunnel实现constant.Tunnel与proxydialer.Tunnel接口GetMihomoAdapterWithDialer与内部getMihomoAdapterWithContextadapter.WithTunnelForAPI注入 tunnel,proxyMap 写入dialer-proxy字段MihomoDelayTest和MihomoSpeedTest新增dialerName、dialerLink参数services/scheduler/speedtest_task.go:
models.GetNodeByName(n.DialerProxyName)查询 dialer 节点EffectiveName()与Link传入测速函数截图
不适用
检查清单
yarn run lint(无前端改动)其他说明
注意:hy2(Hysteria2)节点 + dialer 组合测速仍会返回 503 快速失败,这是 mihomo 本身的限制(之前实验已证实),不是 sublinkpro 问题。TCP 系协议(trojan/vmess/socks5)经 dialer 测速正常。
兼容性:
DialerProxyName为空时行为与原来完全一致;GetMihomoAdapter旧签名保留,node/sub.go、node/usage.go、services/unlock/orchestrator.go 等既有调用点无需改动。