feat(api): add GET /v1/stats/users/active-ips endpoint

Lightweight endpoint that returns only users with active TCP connections
and their IP addresses. Calls only get_active_ips_for_users() without
collecting recent IPs or building full UserInfo, significantly reducing
CPU and memory overhead compared to /v1/stats/users.
This commit is contained in:
Mirotin Artem
2026-03-26 02:09:57 +03:00
parent b9b1271f14
commit 677195e587
2 changed files with 19 additions and 0 deletions

View File

@@ -442,6 +442,12 @@ pub(super) struct UserInfo {
pub(super) links: UserLinks,
}
#[derive(Serialize)]
pub(super) struct UserActiveIps {
pub(super) username: String,
pub(super) active_ips: Vec<IpAddr>,
}
#[derive(Serialize)]
pub(super) struct CreateUserResponse {
pub(super) user: UserInfo,