create: 宿主机代理与时间同步架构(上游适配插件 + 统一 NTP 服务模型 + 静默非阻塞)
MemRelay-Operation: memory-save:host-agent-architecture-decision-2026-11-07 MemRelay-Resource: 2cf03f75-7e7f-43d3-8329-29ac06849d42
This commit is contained in:
+30
@@ -0,0 +1,30 @@
|
|||||||
|
---
|
||||||
|
title: 宿主机代理与时间同步架构(上游适配插件 + 统一 NTP 服务模型 + 静默非阻塞)
|
||||||
|
type: decision
|
||||||
|
permalink: main/projects/d5a7f581-c442-4554-87b9-ee723b8b0258/宿主机代理与时间同步架构上游适配插件-统一-ntp-服务模型-静默非阻塞
|
||||||
|
stable_id: 2cf03f75-7e7f-43d3-8329-29ac06849d42
|
||||||
|
scope: project
|
||||||
|
memory_type: decision
|
||||||
|
project_id: d5a7f581-c442-4554-87b9-ee723b8b0258
|
||||||
|
usage_profile_id: 0c9feb46-d06e-43cd-9ef0-c5813c84a998
|
||||||
|
status: active
|
||||||
|
revision: 1
|
||||||
|
request_id: host-agent-architecture-decision-2026-11-07
|
||||||
|
created_at: '2026-11-06T21:10:38.893838+00:00'
|
||||||
|
updated_at: '2026-11-06T21:10:38.893838+00:00'
|
||||||
|
tags:
|
||||||
|
- host-agent
|
||||||
|
- time-sync
|
||||||
|
- architecture
|
||||||
|
- ikuai
|
||||||
|
- ntp
|
||||||
|
---
|
||||||
|
|
||||||
|
2026-11-07 用户确认的设计(分支 feat/host-agent,计划文件 宿主机代理与首页优化_ba77e127.plan.md,接口约定 Temp/host-agent/CONTRACT.md):
|
||||||
|
- MetrixHostAgent 用 Go 编写,放在 plugins/MetrixHostAgent,主动以 WebSocket 连接 ws://127.0.0.1:8000/api/host-agent/connect(Bearer 令牌 mha_ 开头)。
|
||||||
|
- 统一 NTP 服务模型:代理把 chrony/timesyncd/ntpd/ntpsec/openntpd/busybox/none 统一成 NtpStatus 和 ntp.status/configure/service/sync_now/query 任务,网页只显示「NTP 服务」加类型标签,按 capabilities 启用按钮;设置里的 NTP 服务器由代理写入宿主机配置(托管块或 drop-in,先备份,未变不动)。
|
||||||
|
- 上游适配插件化:同步方式为自动识别 / 指定适配器 / 直接修改宿主机时间(可选停止 NTP 对时)。iKuai 为内置插件,靠未登录响应头 X-Timestamp/X-Sysbit/X-Enterprise 识别;另有自定义多步 HTTP 流程插件,占位符如 {{time.unix}}、{{secret.password | md5}}、{{ntp.host}}。适配器方式:改上游时间 -> 复核 -> 代理 ntp.sync_now 让宿主机立即对时。
|
||||||
|
- 精度秒级,偏差不到 1 秒不改,全局 30 秒冷却(单调时钟,只有真正改过才计)。
|
||||||
|
- 首页同步完全静默:不显示任何结果、原因或提示,按钮只在进行中旋转;打开首页空闲时自动同步(同浏览器 10 分钟一次,只用网络时间),手动按钮在不要求网络时间时可回落电脑时间。
|
||||||
|
- 不卡 web:前端按需加载、低优先级请求、超时与取消;后端 POST /api/host/time/sync 立即返回 job_id,后台 asyncio 任务执行,全异步不阻塞单进程 uvicorn 的事件循环。
|
||||||
|
- 2026-11-07 已验证生产容器可直接访问 iKuai 192.127.115.1 的 HTTP 80(响应头齐全)和 UDP 123(延迟 0.3ms),不需要代理转发 HTTP。
|
||||||
Reference in New Issue
Block a user