fix(client/macos): urltest 延迟改走注入的 clash API(对齐 Windows),内核侧打点
诊断:即便专开 Group client,扩展回的 urltest 数组恒空——根因是服务端下发配置无 experimental.clash_api,sing-box 不暴露出站组/urltest 历史,libbox Group 命令拿不到。 修复(与 Windows 完全同法):扩展内向配置注入 clash_api(127.0.0.1 本地监听)+ cache_file, StatsCollector 经本地 HTTP 查 /proxies 找 URLTest 组、/group/<name>/delay 取真实延迟。 速率仍走 libbox Status。新增内核侧 NSLog 打点 kernel delay(<group>)=<tag:ms>,并把该值 塞进 stats 的 diag 字段经主 app 可读日志透出——一眼分清「内核有没有算出延迟」vs「外面没拿到」。 扩展代码变更 → CURRENT_PROJECT_VERSION 46→47。 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -67,8 +67,9 @@ final class StatsClient: NSObject {
|
||||
if self.diagTick % 5 == 0 {
|
||||
let urls = (obj["urltestResults"] as? [[String: Any]]) ?? []
|
||||
let pairs = urls.map { "\($0["tag"] ?? "?")=\($0["delayMs"] ?? -1)" }.joined(separator: ",")
|
||||
NSLog("[pangolin/stats] dl=%@ ul=%@ urltest[%d]=%@",
|
||||
"\(obj["downloadSpeed"] ?? 0)", "\(obj["uploadSpeed"] ?? 0)", urls.count, pairs)
|
||||
NSLog("[pangolin/stats] dl=%@ ul=%@ urltest[%d]=%@ diag=%@",
|
||||
"\(obj["downloadSpeed"] ?? 0)", "\(obj["uploadSpeed"] ?? 0)", urls.count, pairs,
|
||||
"\(obj["diag"] ?? "-")")
|
||||
}
|
||||
self.emit(obj)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user