跳转到内容

Admin API

FF1 Master 提供 REST API,用于批量运维与脚本化操作。路径前缀 /api/,用 API Token(Bearer)认证,按 scope 授权。

在控制台签发 API Token(GET/POST /api/tokens),调用时带:

Authorization: Bearer <token>

Scope 形如 resource:action

| Scope | 能力 | |-------|------| | nodes:read / nodes:write | 节点读 / 写 | | rules:read / rules:write | 转发规则读 / 写 | | tunnels:read / tunnels:write | 隧道读 / 写 | | users:read / users:write | 用户读 / 写 | | audit:read | 审计只读 | | license:read | 授权只读 | | * | 全部(谨慎使用) |

| 领域 | 路径 | |------|------| | 登录 | POST /api/auth/login | | Token | GET/POST /api/tokensDELETE /api/tokens/{id} | | 节点 | GET /api/nodesGET/PUT/DELETE /api/nodes/{id}POST /api/nodes | | 节点装机 | POST /api/nodes/{id}/install-sshPOST /api/nodes/{id}/reinstall | | 转发规则 | GET/POST /api/rulesGET/PUT /api/rules/{id}POST /api/rules/{id}/sync | | 隧道 | GET/POST /api/tunnelsGET/PUT/DELETE /api/tunnels/{id} | | 设置 | GET/PATCH /api/settings | | 审计 | GET /api/audit-logs | | 仪表盘 | GET /api/dashboardGET /api/dashboard/traffic |

批量操作:POST /api/nodes/batch-deletePOST /api/rules/batch-delete 等。

列出节点:

Terminal window
curl -sS -H "Authorization: Bearer $FF1_TOKEN" \
"https://master.example.com/api/nodes"

新建并下发一条转发规则后触发同步:

Terminal window
curl -sS -X POST -H "Authorization: Bearer $FF1_TOKEN" \
"https://master.example.com/api/rules/123/sync"
  • Token 权限大,按最小 scope 签发,勿泄露
  • 写操作记入 审计日志
  • 批量脚本注意速率,避免与在线运维争用 SQLite 写锁