Files
MoShiro/backend/probe
justme a2f88a344b
ci/woodpecker/tag/gitea-release Pipeline is pending
ci/woodpecker/tag/linux-release Pipeline failed
ci/woodpecker/tag/windows-release Pipeline was canceled
feat!: genesis-pinned operator set, server identity with an encrypted control link, key-less join codes; release key continuity
Join codes need no passkey touch and carry only public values (genesis
fingerprint, owner credentials, installer hashes). Nodes pin the genesis and
owners at enrollment and only follow passkey-signed operator set versions.
The panel's server key is listed in the set; pinned nodes require its
signature and run the control link under AES-256-GCM. Password sessions carry
no capabilities. The updater adopts a next_key from a signed manifest.

Bump version to 0.2.0. [CI SKIP]
2026-10-08 03:21:44 +08:00
..

MoShiro Probe

Probe 是网络测量的发起端,通常运行在家宽或其他需要观测的网络出口。它连接 Backend(身份、Agent 列表、状态)和 Agent(测量),执行线路任务,并把本端采集的原始数据交给 Agent 汇总上报。Probe 不提供远程命令或文件管理功能。

工作流程

Backend ──任务──> Agent <──测量会话──> Probe
   │  ▲           │                     │
   │  └──汇总并上报数据 <───┘                     │
   └─────Agent 列表、状态(Fleet 长连接)───────────┘

Probe 用 probe.json 读取面板地址(fleet.server)、身份目录(fleet.identity_dir,由 fleet-enroll 注册时生成)和本地测试限制。连上面板之后,面板下发要连接的 Agent 列表;Probe 将列表缓存到同目录的 agents.json,面板暂时连不上时靠它继续测量。身份目录里有私钥,请限制访问权限,不要提交到版本控制。

容器节点的运行方式(podman + systemd)和宿主机更新器见 ../../docs/deployment.md;Probe 也可以用 OCI 镜像 registry.oeo.one/moshiro/moshiro-probe:<version>,容器默认读取 /etc/moshiro/probe.json,命名 volume 保存身份配置和缓存,镜像以 UID/GID 1654 运行。

构建

需要 .NET SDK 10。为应用 根目录的 global.json 的 SDK 设置,请从 backend/ 目录构建:

cd backend
dotnet build probe/src/MoShiro.Probe -c Release

发布 NativeAOT 程序需要对应平台的 C/C++ 工具链;<RID> 应与构建环境和目标平台匹配:

dotnet publish probe/src/MoShiro.Probe -c Release -r <RID> -p:PublishAot=true

也可在仓库根目录运行 bash scripts/publish.sh probe <RID>,再使用 scripts/package.sh probe <RID> 生成部署包。支持平台和安装流程见 ../../docs/deployment.md。

配置与运行

在管理端添加 Probe(生成 probe 角色的加入令牌),在目标机上注册(密钥由 Probe 自己生成):

fleet-enroll --server https://panel.example.com --join <加入令牌> --name home --identity-dir /etc/moshiro

写 /etc/moshiro/probe.json:{"fleet":{"server":"https://panel.example.com","identity_dir":"/etc/moshiro"}}(install.sh probe --server … --join … --name … 会一并完成)。随后运行:

moshiro-probe --config /etc/moshiro/probe.json

不传 --config 时默认读取 /etc/moshiro/probe.json。配置中的 limits 是本地硬上限,Backend 无法远程放宽;路由器等低性能设备可调低测试码率和包速率,避免 Probe 自身成为测量瓶颈。部署时可使用仓库的 packaging/ 文件和安装脚本。

也可使用 OCI 镜像 registry.oeo.one/moshiro/moshiro-probe:<version>,自动选择 Linux amd64 或 arm64 镜像。容器默认读取 /etc/moshiro/probe.json,并在同一目录维护 agents.json 缓存,配置与缓存存放在命名 volume 中。建议使用宿主网络;当前独立 ICMP 目标任务由 Agent 执行。

设计说明

  • Probe 只执行编译进程序的测量模块。它不落盘测量数据,也不能执行命令或自行更新(更新由宿主机上的更新器完成,Probe 只写清单和请求文件)。
  • 测量模块由 backend/shared/MoShiro.Measurement/ 与 Agent 共用;Probe 负责发起连接、调度任务和记录本端数据。
  • 测量模型和协议细节见 ../../docs/measurement.md 与 ../../docs/protocol.md;整体架构见 ../../docs/architecture.md。

Docker 与 rootless/rootful Podman 共用 packaging/compose/probe/compose.yaml,配置、身份和缓存放在命名 volume 中,无需宿主配置目录、keep-id 或手动 chown。首次导入和自动更新见部署文档。