[GH-ISSUE #5068] [Feature]: [speed limit/ traffic shaping/ abuse guard] #3568

Closed
opened 2026-10-31 20:33:23 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @myxeni64b on GitHub (Jun 8, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5068

The feature is so essentially and can be added to the amazing 3x-ui, I build a tiny useful tools:
Try this -> https://github.com/myxeni64b/xui-bw-guard
Good luck

Describe the solution you'd like

It can be integrated into the ecosystem easily, ready to contribute if you would like!

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?

Other

Are you willing to help?

  • I'd like to implement this feature myself and open a PR.
  • I can help test once a PR is open.

Before submitting

  • I searched existing issues and this feature has not been requested.
  • This feature request is written in English.
Originally created by @myxeni64b on GitHub (Jun 8, 2026). Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5068 ### Is your feature request related to a problem? The feature is so essentially and can be added to the amazing 3x-ui, I build a tiny useful tools: Try this -> https://github.com/myxeni64b/xui-bw-guard Good luck ### Describe the solution you'd like It can be integrated into the ecosystem easily, ready to contribute if you would like! ### 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? Other ### Are you willing to help? - [ ] I'd like to implement this feature myself and open a PR. - [ ] I can help test once a PR is open. ### Before submitting - [x] I searched [existing issues](../issues?q=is%3Aissue) and this feature has not been requested. - [x] This feature request is written in English.
Author
Owner

@github-actions[bot] commented on GitHub (Jun 8, 2026):

Thanks for the feature request and for building xui-bw-guard!

Current state of the codebase

Per-client speed/bandwidth limiting is not implemented in 3x-ui today. Confirmed by reading the source:

  • The Client model (database/model/model.go) has fields for traffic quota (TotalGB), IP limits (LimitIP), expiry, and reset period — but no speed/rate limit fields.
  • The xray config builder in xray/ generates no per-user traffic-shaping directives.
  • Similar requests were previously filed as #2934 and #3263.

Why this is non-trivial to integrate

Xray-core itself does not expose a per-user bandwidth throttle in its config. Speed limiting at the OS level typically requires Linux tc (traffic control) rules keyed on per-client identifiers — which is exactly the approach external tools like xui-bw-guard take. Integrating this natively into 3x-ui would require:

  1. New fields in the Client model and DB migrations.
  2. The panel applying/removing tc rules when clients are created, updated, or disabled — which means the panel process needs elevated network privileges.
  3. Handling edge cases: Docker containers (requires NET_ADMIN/NET_RAW caps), multi-node setups, traffic reset cycles, etc.

To move this forward

If you'd like to open a PR, it would help to clarify a few things first:

  • What mechanism does xui-bw-guard use for rate limiting (e.g., tc qdisc, iptables, eBPF)?
  • Should limits be per-inbound or per-client (email)?
  • How should it behave in multi-node deployments?
  • Does it need to handle Docker environments where host-level tc rules are absent?

A concrete design proposal (even a short one in the PR description) would help maintainers evaluate the approach before implementation work begins.

<!-- gh-comment-id:4644649115 --> @github-actions[bot] commented on GitHub (Jun 8, 2026): Thanks for the feature request and for building [xui-bw-guard](https://github.com/myxeni64b/xui-bw-guard)\! **Current state of the codebase** Per-client speed/bandwidth limiting is not implemented in 3x-ui today. Confirmed by reading the source: - The `Client` model ([database/model/model.go](https://github.com/MHSanaei/3x-ui/blob/main/database/model/model.go)) has fields for traffic quota (`TotalGB`), IP limits (`LimitIP`), expiry, and reset period — but no speed/rate limit fields. - The xray config builder in `xray/` generates no per-user traffic-shaping directives. - Similar requests were previously filed as #2934 and #3263. **Why this is non-trivial to integrate** Xray-core itself does not expose a per-user bandwidth throttle in its config. Speed limiting at the OS level typically requires Linux `tc` (traffic control) rules keyed on per-client identifiers — which is exactly the approach external tools like xui-bw-guard take. Integrating this natively into 3x-ui would require: 1. New fields in the `Client` model and DB migrations. 2. The panel applying/removing `tc` rules when clients are created, updated, or disabled — which means the panel process needs elevated network privileges. 3. Handling edge cases: Docker containers (requires `NET_ADMIN`/`NET_RAW` caps), multi-node setups, traffic reset cycles, etc. **To move this forward** If you'd like to open a PR, it would help to clarify a few things first: - What mechanism does xui-bw-guard use for rate limiting (e.g., `tc qdisc`, `iptables`, eBPF)? - Should limits be per-inbound or per-client (email)? - How should it behave in multi-node deployments? - Does it need to handle Docker environments where host-level `tc` rules are absent? A concrete design proposal (even a short one in the PR description) would help maintainers evaluate the approach before implementation work begins.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
MHSanaei/3x-ui#3568
No description provided.