mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[GH-ISSUE #4785] [Feature]: Per-inbound traffic limits for clients with multiple attached inbounds #3319
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#3319
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 @ergolyam on GitHub (Jun 1, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/4785
Is your feature request related to a problem?
Yes. The new Clients page with Attached Inbounds is useful for managing one client profile across multiple inbounds, but it changed an important workflow that was possible before.
Previously, clients could be added directly inside each inbound. This allowed an admin to create the same end user on multiple inbounds, keep the same subscription ID / sub ID, and assign different traffic limits per inbound.
Example:
With the current Attached Inbounds model, the traffic limit is applied to the client globally across all attached inbounds. This means one client cannot have separate traffic limits for different attached inbounds.
Also, the old workaround is no longer possible because creating another client with the same sub ID is blocked. As a result, admins cannot keep one subscription ID while creating separate per-inbound client records with different limits.
Describe the solution you'd like
Please add support for per-inbound traffic limits for clients attached to multiple inbounds.
Possible UI behavior:
On the Clients page, when editing a client and selecting Attached Inbounds, each attached inbound could optionally have its own traffic settings:
Example:
Client: user@example.com
Sub ID: user-sub-id
Attached inbounds:
The generated subscription should still include all selected links under the same client/subscription, but traffic accounting and limit enforcement should be able to work per inbound.
Alternative solution:
If full per-inbound limits are difficult to implement now, please allow creating multiple client records with the same sub ID, as long as they are attached to different inbounds. This would restore the previous workflow where an admin could manually create separate per-inbound client entries while keeping one subscription ID.
Suggested behavior:
Alternatives you've considered
The current workaround would be to create different clients with different sub IDs for each inbound, but this breaks the user experience because the end user no longer has one stable subscription.
Another workaround was to manually create the same client per inbound, but this is no longer possible because duplicate sub IDs are blocked.
A shared traffic quota across all attached inbounds is useful for some setups, but it does not cover cases where each inbound/server/link has a different purpose or different bandwidth budget.
Concrete use case
I have one end user with one subscription. This subscription contains several VLESS links from different inbounds.
Each inbound is used for a different purpose. For example:
The user should keep one subscription, but each inbound should have its own traffic limit. If the backup inbound reaches 5 GB, only that inbound/client-link should be limited or disabled, while the other inbounds should continue working according to their own limits.
This was possible with the old workflow where clients were managed directly inside each inbound. With the new Attached Inbounds model, the traffic limit is global for the client and cannot be separated by inbound.
Mockups, screenshots, or examples
Example layout in the client edit modal:
Attached Inbounds:
Which parts of the panel would this affect?
Frontend (UI / panel pages), Subscription (share links / Clash / JSON), Statistics / traffic counters
Are you willing to help?
Before submitting
@github-actions[bot] commented on GitHub (Jun 1, 2026):
Thank you for the detailed and well-structured feature request!
This is a real architectural limitation with the current Attached Inbounds model. Right now, traffic quota and usage are tracked at the client level (globally across all attached inbounds), so there is no per-inbound traffic accounting for a given client.
To implement per-inbound traffic limits, the data model would need to change — traffic limits, used traffic, and potentially enable/disable state would need to be stored per client–inbound pair rather than per client alone. This would touch the database schema, the backend traffic accounting logic, the Xray config generation (to disable only the specific inbound's client entry when its limit is reached), and the subscription output.
Your two proposed approaches are both valid angles:
For now, the practical workaround is to use separate sub IDs per inbound (one subscription per purpose), though you've correctly noted that this breaks the single-subscription UX.
Leaving this open for the maintainers to consider. If you'd like to move toward a PR, the key files to look at are the client/traffic database model,
service/inbound.go, and the subscription handler.