diff --git a/core-private-routes.md b/core-private-routes.md index 7456da8..6a5eab8 100644 --- a/core-private-routes.md +++ b/core-private-routes.md @@ -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. diff --git a/core-routes.md b/core-routes.md index 05b23b0..e90729a 100644 --- a/core-routes.md +++ b/core-routes.md @@ -70,6 +70,7 @@ This file lists the current HTTP routes exposed by Core, grouped by access level | `POST` | `/admin/users` | `CreateAdminUserDto` | Creates a user account | | `GET` | `/admin/users/:id` | none | User detail | | `GET` | `/admin/users/:id/stats` | none | User stats | +| `GET` | `/admin/users/:id/ips` | none | Flat IP history ordered by latest use (`lastSeenAt DESC`) | | `PATCH` | `/admin/users/:id` | `UpdateUserDto` | Updates email, password, role, block flag, name, comment | | `PATCH` | `/admin/users/:id/status` | `UpdateUserStatusDto` | Approves, rejects, or restores a user | | `GET` | `/admin/users/:id/referees` | none | Users invited by this user | @@ -203,10 +204,11 @@ This file lists the current HTTP routes exposed by Core, grouped by access level | Method | Route | Input | Output / Notes | | --- | --- | --- | --- | -| `GET` | `/admin/settings/:category` | none | Returns settings for the given category (`panel`, `subscription`, `telegram`) | +| `GET` | `/admin/settings/:category` | none | Returns settings for the given category (`panel`, `subscription`, `telegram`, `ipinfo`) | | `PATCH` | `/admin/settings/panel` | `PanelSettingsDto` | Updates panel settings | | `PATCH` | `/admin/settings/subscription` | `SubscriptionSettingsDto` | Updates subscription delivery settings | | `PATCH` | `/admin/settings/telegram` | `TelegramSettingsDto` | Updates Telegram bot settings | +| `PATCH` | `/admin/settings/ipinfo` | `IpInfoSettingsDto` | Updates the IPinfo Lite API token | ## Admin routes - broadcasts @@ -368,4 +370,3 @@ This file lists the current HTTP routes exposed by Core, grouped by access level - `CreateBroadcastDto` - `text`, `filters?` (`{ nodeIds?: number[] }`), `scheduledAt?` - `UpdateBroadcastDto` - partial `CreateBroadcastDto` - diff --git a/core.md b/core.md index 465a87e..586c272 100644 --- a/core.md +++ b/core.md @@ -16,7 +16,8 @@ This page is public operator documentation. It describes behavior, API, environm - Routing rule sets with rules, balancers, and blocking options. - External subscription source ingestion and testing. - Public subscription exports for VPN clients. -- Platform settings management (panel, subscription delivery, Telegram). +- Platform settings management (panel, subscription delivery, Telegram, IPinfo). +- User IP history with optional daily country and ASN enrichment through IPinfo Lite. - Telegram broadcast messages with user filtering and delivery tracking. - Referral system with code-based self-approval for pending users. - Audit logs, usage queries, metrics, and health checks. @@ -168,14 +169,14 @@ Missing or unknown `format` falls back to `v2ray`. ## Admin API Groups -- `/admin/users` - users, approval status, block flag, profile fields, stats, referees. +- `/admin/users` - users, approval status, block flag, profile fields, stats, referees, and IP history. - `/admin/tariffs` - tariff CRUD. - `/admin/subscriptions` - subscriptions and subscription links. - `/admin/links` - subscription link operations (reset, update, delete). - `/admin/nodes` - nodes, protocols, sync, runtime operations, masking sites, outbounds, observatory, routing balancers. - `/admin/routing-rule-sets` - reusable routing templates. - `/admin/external-subscriptions` - external source CRUD and URL testing. -- `/admin/settings` - platform settings (panel, subscription delivery, Telegram). +- `/admin/settings` - platform settings (panel, subscription delivery, Telegram, IPinfo). - `/admin/broadcasts` - Telegram broadcast messages with delivery tracking. - `/admin/logs` - audit log viewer data. - `/admin/usage` - traffic usage rows. diff --git a/panel.md b/panel.md index 40b30f0..f59a8c4 100644 --- a/panel.md +++ b/panel.md @@ -70,6 +70,14 @@ This page is public operator documentation. It describes panel capabilities, rou - Configure panel access settings (allowed hosts, root path). - Configure subscription delivery settings (update interval, display name, support URL). - Configure Telegram bot token. +- Configure the IPinfo Lite token used for daily user IP enrichment. + +### User IP History + +- View the number of recorded IP addresses on the admin user overview. +- Open IP history grouped by enriched network information. +- Expand a group to view each IP with first-seen and last-used timestamps. +- Groups and addresses are ordered by most recent use. ### Broadcasts