# futures-guardian-endpoint **Repository Path**: Davy-lin/futures-guardian-endpoint ## Basic Information - **Project Name**: futures-guardian-endpoint - **Description**: No description available - **Primary Language**: Rust - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-08-08 - **Last Updated**: 2026-09-11 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # futures-guardian-endpoint ## 介绍 本仓库是**期货纪律守护者**许可证验证服务器的**端点自动发现**配置仓库。 客户端启动时通过 Gitee Raw URL 读取 `server_endpoint.json`,获取验证服务器的可用地址列表,实现零配置自动连接。 ## 工作原理 ``` 客户端启动 → 读取 Gitee Raw server_endpoint.json → 探测每个URL的 /api/health → 第一个成功的URL写入本地缓存 → 连接验证服务器 → Gitee失败 → 回退本地缓存 → 缓存不存在 → 回退编译期常量 ``` ### 三级回退机制 | 优先级 | 来源 | 说明 | |--------|------|------| | 1 | Gitee Raw URL | 从本仓库读取 `server_endpoint.json`,实时获取最新端点 | | 2 | 本地缓存 | `server_endpoint_cache.json`(客户端配置目录),上次成功连接的地址 | | 3 | 编译期常量 | `FG_ONLINE_SERVER_URL`(构建时注入的兜底地址) | ## server_endpoint.json 格式 ```json { "urls": ["http://公网IP:3000", "http://局域网IP:3000", "http://127.0.0.1:3000"], "ts": 1786288066, "port": 3000 } ``` | 字段 | 类型 | 说明 | |------|------|------| | `urls` | string[] | 服务器端点URL列表,按公网→局域网→本地排序 | | `ts` | int64 | 更新时间戳(Unix秒) | | `port` | int32 | 服务器监听端口 | ## 端点自动注册 验证服务器(license-server-ui)启动时会自动将本机IP地址注册到本仓库的 `server_endpoint.json`: 1. 探测公网IP(`api.ipify.org`)和局域网IP 2. 按公网→局域网→127.0.0.1排序去重构造端点列表 3. 通过 Gitee API 更新 `server_endpoint.json`(需要 Gitee Token) ## 相关仓库 | 仓库 | 说明 | |------|------| | [rust-ctp](https://gitee.com/Davy-lin/rust-ctp.git) | 期货纪律守护者主仓库(客户端+服务端+管理端) | ## 技术栈 - 客户端:Rust + Tauri + Vue3 + TypeScript - 服务端:Rust + axum + SQLite - 端点发现:Gitee Raw URL + HTTP健康检查 ## 许可证 私有仓库,仅供授权用户使用。