mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 19:11:53 +07:00
[GH-ISSUE #5660] [Feature]: Per-Node Traffic Limit for Subscriptions #3944
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#3944
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 @hiradjaguar on GitHub (Jun 29, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5660
Is your feature request related to a problem?
It would be very useful to have the ability to define traffic limits separately for each node within a single subscription.
Describe the solution you'd like
For example:
Node 1 (Cloudflare): Unlimited traffic
Node 2 (Tunnel): 10 GB traffic
Currently, the traffic limit is applied to the entire subscription. It would be great if each node could have its own independent traffic quota.
This would allow users to use Cloudflare nodes without limitation while restricting bandwidth usage on more expensive or limited tunnel nodes.
When the traffic limit of one node is reached, only that specific node should become unavailable, while the other nodes in the subscription continue to work normally.
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 feature request. The current codebase does not support per-node traffic limits; below is a summary of how traffic limits work today and what this proposal would require to implement.
Current architecture
Traffic limits are applied at two scopes:
Totalquota (stored inClientTraffic.Total). In multi-node setups, the master panel aggregates per-node usage intoclient_global_trafficsand pushes that aggregate to each node every ~30 seconds (internal/web/job/node_traffic_sync_job.go→maybePushGlobals). Nodes then enforce the limit against the combined global total, not just local usage.Totalfield (internal/database/model/model.go). When the inbound's cumulative traffic reaches that ceiling, the inbound is disabled as a whole.There is no per-node traffic limit concept anywhere in the schema or enforcement logic. The
node_client_trafficstable (internal/database/model/node_client_traffic.go) stores per-node accounting baselines for delta calculation, but carries no quota field.What implementing this would require
This feature does not map cleanly onto the current data model. A rough set of changes needed:
node_client_traffics) that stores a per-(node, client) quota, plus a migration ininternal/database/db.go.internal/web/service/inbound_disable.gocontains the depletion query (depletedClientsCond). It would need to evaluate per-node quotas against per-node usage, then disable a client only on the relevant node while leaving it active on others. The current design disables a client globally (across all inbounds on all nodes for that email).internal/web/job/node_traffic_sync_job.goandinternal/web/runtime/remote.gopush/pull aggregate stats; they would need to carry per-node quota assignments to each node.Subscription-Userinfoheader (internal/sub/controller.go) reports a single globaltotalvalue. Per-node limits would require a different representation or a node-specific subscription URL.This is a non-trivial architectural change, not an additive feature, because it requires disaggregating what is currently a global enforcement model.
Related prior work
A PR implementing this would be welcome; the
PR welcomedlabel can be added if someone volunteers to take it on.This reply was generated automatically; a maintainer may follow up.