This commit is contained in:
2026-06-11 02:41:13 +03:00
parent 8abf7174e9
commit 6d25d43ce2
4 changed files with 17 additions and 8 deletions
+2 -3
View File
@@ -141,7 +141,7 @@ Authentication: pass `x-node-auth-key` as gRPC metadata (or in the `authKey` fie
| `GetLatestConfig` | `authKey` | `revision`, `clientMapJson`, `mtprotoClientMapJson`, `servicesJson` | Config fields are JSON-encoded strings |
| `ConfirmConfigApplied` | `authKey`, `revision` | `ok` | Equivalent to `POST /node/config/applied` |
| `ReportNodeStats` | `authKey`, `system{}`, `xray{}`, `mtprotoJson` | `ok` | Reports CPU/RAM/disk/network/xray/mtproto snapshot; stored in Redis; drives `GET /admin/nodes/:id/runtime-status` and stats history |
| `ReportOnlineUsers` | `authKey`, `users[]` | `ok` | Reports currently connected users with their IPs every 5 s; Core stores Redis TTL keys and upserts `user_ips` table |
| `ReportOnlineUsers` | `authKey`, `users[]` | `ok` | Reports currently connected users with their IPs every 5 s; Core stores Redis TTL keys and updates IP history |
`ReportNodeStats` nested fields:
- `system`: `uptimeSeconds`, `cpuPercent`, `cpuCores`, `ramUsed`, `ramTotal`, `diskUsed`, `diskTotal`, `netRxPerSec`, `netTxPerSec`, `netRxTotal`, `netTxTotal`
@@ -152,5 +152,4 @@ Authentication: pass `x-node-auth-key` as gRPC metadata (or in the `authKey` fie
The node sends `ReportNodeStats` every 2 s. `GET /admin/nodes/:id/runtime-status` returns the latest stored snapshot without polling the node; `?fromNode=true` forces a live HTTP fetch instead.
The node sends `ReportOnlineUsers` every 5 s. Core sets `online:user:{userId}` and `online:inbound:{nodeProtocolId}:user:{userId}` Redis keys with TTL 20 s, upserts IP history into `user_ips`, and emits `user.online` domain event when the user had a gap > 10 s.
The node sends `ReportOnlineUsers` every 5 s. Core sets `online:user:{userId}` and `online:inbound:{nodeProtocolId}:user:{userId}` Redis keys with TTL 20 s. Existing `(userId, ip)` rows only receive a new `lastSeenAt`; missing pairs are inserted. When IPinfo is configured, a daily job stores formatted country and ASN data in `user_ips.info`. Core also emits a `user.online` domain event when the user had a gap > 10 s.