RustMinerSystem

文档

群控与远程转发 API

RustMinerSystem 群控 TOKEN、客户端列表、远程客户端维护和 Base64 路径转发接口。

群控与远程转发 API

群控接口让一个 RustMinerSystem 实例读取其他实例的状态。群控 API 属于高权限凭据,应只在受信任实例之间使用。

群控凭据和客户端

方法 路径 用途
GET /api/remote/token 获取当前实例的群控 API。
GET /api/remote/refresh/token 刷新群控 API,旧值立即失效。
GET /api/remote/list 获取已添加的远程客户端。
POST /api/remote/new 添加远程客户端。
POST /api/remote/{id} 更新远程客户端。
DELETE /api/remote/{id} 删除远程客户端。

添加和更新请求:

{
  "name": "Hong Kong Proxy 01",
  "endpoint": "https://proxy.example.com/safe-route",
  "token": "<远程实例群控 API>"
}

endpoint 应包含远程实例的协议、端口和安全路径,但末尾不需要 /

转发远程请求

POST /api/remote/q/{id}/{m}/{p}
<自定义请求头名称>: <API 凭据>
Content-Type: application/json
路径参数 说明
id 远程客户端记录 ID。
m 请求模式;当前前端固定为 0
p 远程 API 路径去掉 /api/ 后的 Base64 编码。

例如远程路径 /api/ports 先转换为 ports,再编码为 Base64,放入 {p}

当前前端通过该接口读取:

/api/ports
/api/stat/currency/{currency}
/api/device/stats
/api/currency/online/stat/{coin}
/api/sys/stat
/api/sys/base/info
/api/local/version
/api/sys/starttime

外层请求始终为 POST,当前读取请求的主体通常是空对象。远程请求失败时,前端会把客户端标记为部分可用或离线。

安全建议

  • 群控 API 与通用 API 凭据用途不同,应分别保存和轮换。
  • 刷新群控 API 后,立即更新所有上级管理实例。
  • 对远程 endpoint 使用 HTTPS,并限制来源 IP。
  • 禁止让不可信用户控制 {p},否则可能扩大可转发接口范围。
  • 日志中应隐藏客户端 token 和完整转发路径参数。