mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 19:11:53 +07:00
[GH-ISSUE #5649] [Feature]: Per-Inbound Traffic Statistics for Each Client #3935
Labels
No labels
backlog
bug
clarification needed
documentation
duplicate
enhancement
github_actions
good first issue
invalid
javascript
New Feature
PR welcomed
pull-request
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
MHSanaei/3x-ui#3935
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @mldfiroozeh-droid on GitHub (Jun 29, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5649
Is your feature request related to a problem?
Currently, when a client is assigned to multiple inbound configurations, X-UI only displays the client's total traffic usage. There is no way to determine how much traffic the client has consumed through each individual inbound.
This makes it difficult to:
Analyze traffic distribution across different inbounds.
Troubleshoot routing or performance issues.
Identify which inbound is being used the most.
Generate accurate usage reports for users with multiple inbounds.
Describe the solution you'd like
Add per-inbound traffic tracking for each client.
For example, if a client is assigned to three different inbounds:
Inbound A → 12.3 GB
Inbound B → 4.8 GB
Inbound C → 0.9 GB
Total → 18.0 GB
The total traffic can remain as it is today, but the UI should also provide a breakdown of traffic usage by inbound.
Benefits
Better monitoring and troubleshooting.
More accurate traffic analytics.
Easier management of users assigned to multiple inbounds.
Improved visibility into how each inbound is being utilized.
This feature would be especially useful for administrators who use multiple inbounds for different protocols, locations, routing strategies, or load balancing.
Alternatives you've considered
No response
Concrete use case
No response
Mockups, screenshots, or examples
No response
Which parts of the panel would this affect?
No response
Are you willing to help?
Before submitting
@github-actions[bot] commented on GitHub (Jun 29, 2026):
This is a valid request. A closely related issue was filed as #4583 and subsequently closed without an implementation landing, so the underlying gap still exists.
Current implementation
Traffic accounting in 3x-ui works as follows (verified against the source):
internal/xray/client_traffic.go— theClientTrafficstruct has agorm:"unique"constraint onEmail, meaning there is exactly one row per client email in theclient_trafficstable, regardless of how many inbounds that client is attached to. TheInboundIdfield on that struct is stale once a client is linked to more than one inbound and is not used for traffic matching.internal/xray/api.go— the Xray gRPC stats service is polled on a regular interval. Two regex patterns extract the raw counters:internal/web/service/inbound_traffic.go—AddTraffic()accumulates these intoinbounds.up/inbounds.down(per inbound total) andclient_traffics.up/client_traffics.down(per client total), keyed only by email.Root constraint
Xray-core's stats gRPC service does not emit a combined per-inbound per-user counter. The two series above are independent: knowing that
user>>>aliceused 18 GB and thatinbound>>>vless-tlsserved 30 GB total does not tell you how much ofalice's 18 GB came throughvless-tls. There is noinbound>>>TAG>>>user>>>EMAIL>>>trafficstat in the Xray stats API today.Without that upstream data point, any per-inbound per-client breakdown in the 3x-ui UI would require either:
This explains why #4583 was not implemented despite being accepted as a reasonable request.
This issue has been labeled as a backlog feature. Contributions toward an upstream Xray-core stat or an alternative accounting mechanism are welcome; a PR that addresses this would be considered.
This reply was generated automatically; a maintainer may follow up.