Commit Graph

2 Commits

Author SHA1 Message Date
Hamed fb14c8358a fix(inbounds): distinguish unavailable online attribution (#7289)
Distinguish unavailable, pending, explicitly idle and legacy inbound online reports across REST, WebSocket and node snapshots. Require hosting-node emails and matching inbound activity; use a labeled node-wide fallback only for confirmed unsupported endpoints (HTTP 404/405).

Track Xray freshness separately from sidecar observations and prevent accounting retries from publishing online state across core replacement. Preserve partial sidecar reports through mixed-version relays using the reserved nonempty NUL marker. Retain GUID/tag remapping and attached-client filtering.

Validated on the reviewed head: all 12 CI jobs and Docs CI passed, including 2,332 frontend tests, mandatory PostgreSQL attribution regressions, race checks, Xray/node E2E and all four master/node version combinations. Exact client attribution across simultaneously active shared-client inbounds remains an estimate; older nodes may omit idle GUIDs during rollout.

Fixes #7283.
2026-12-03 02:37:40 +03:30
Sanaei 22fe0c4cd9 feat(mtproto): record client IPs and enforce the IP limit for MTProto clients
Every client the panel serves has its connected addresses recorded and its
IP limit applied, whichever process carries it. MTProto clients are served
by mtg, never by Xray, so the core's online list could not see them: their
IP log stayed empty and a configured limitIp never fired, although the form
offers both for every protocol.

mtg-multi 1.17.0 reports users.<name>.active_ips in /stats. The manager
keeps them from each scrape together with the time an address was first
seen connected, so the scan can keep the newest addresses and ban the
oldest, and the IP scan merges them the way it already merges kernel-mode
AmneziaWG peers. A failed scrape drops the addresses instead of leaving
them live, and loopback addresses (a relay in front of mtg) are skipped as
the core skips them.

Enforcement is the existing fail2ban path. The temporary credential drop
is Xray-only, so on Windows, where it is the only mechanism, an MTProto
limit is recorded but not enforced.
2026-11-29 12:13:19 +03:30