[GH-ISSUE #6622] [Feature]: Opt-in post-expiry throttling, window-based traffic quotas, and per-client speed limits #4428

Open
opened 2026-10-31 20:39:36 +07:00 by bsakaguchi · 0 comments
Owner

Originally created by @mioolio on GitHub (Sep 22, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/6622

Yes. Currently, when a client reaches its traffic limit or expiry date, 3X-UI disables the client completely. There is no soft-throttle option. This gives users no grace period and can be disruptive for shared, family, or commercial nodes.

The existing traffic reset is inbound-level (trafficReset = hourly / daily / weekly / monthly). It cannot prevent a single client from consuming the whole inbound quota in a short period. For example, on a shared node with a 100GB daily quota, one user can download a large amount in a few minutes and exhaust the node before other users can use it.

There is also no per-client speed limit exposed in the panel. All clients on the same inbound share bandwidth, so a single client can saturate the node. Administrators currently have to edit Xray config manually or use external scripts, which may be overwritten by the panel.

Describe the solution you'd like

I would like to propose an opt-in, disabled-by-default set of client-level traffic controls:

  1. Post-expiry / post-quota throttling instead of hard cut-off

    • When a client reaches its total traffic or expiry time, the admin can choose:
      • Disable — current behavior, default.
      • Throttle — apply a configurable speed limit.
    • Example: after 100GB/month is used, limit the client to 1 Mbps instead of disabling it.
    • This should be configurable per client and default to Disable to preserve current behavior.
  2. Window-based quota

    • Allow a client-level quota window, for example 10GB per 2 hours.
    • When the client exceeds the window quota, apply an action:
      • Throttle to a configured speed until the window resets, or
      • Disable until the window resets.
    • The window should reset automatically, independent of the main total traffic or expiry.
    • Example: daily total is 100GB, but the window quota is 10GB every 2 hours. If the user exceeds 10GB in 2 hours, throttle them until the next 2-hour window.
    • This is optional and disabled by default.
  3. Per-client speed limit

    • Add upload/download speed limit fields in the client edit form.
    • The value can be in Kbps or Mbps, with 0 or empty meaning unlimited.
    • Use Xray-core's native rate-limiting mechanism if possible, such as per-level policy uplink/downlink, or another reliable per-client method.
    • Default: unlimited, so existing clients are not affected.
  4. All features opt-in

    • Every new option should default to the current behavior.
    • No existing client should be throttled or limited unless the admin explicitly enables it.

Alternatives you've considered

No response

Concrete use case

  • Keep hard cut-off only: This is the current behavior, but it is not ideal for users who need temporary low-speed access after using their quota.
  • External tc/iptables scripts: They can limit by IP, but all clients may share the same inbound and port, and IPs are not stable. They are also hard to manage from the panel.
  • Manual Xray config editing: Possible for speed limits, but the panel may overwrite it, and it does not scale.
  • Inbound-level traffic reset only: The existing trafficReset resets all clients in an inbound. It does not prevent one client from bursting through the quota in a short window.
  • Separate inbound per user: This can isolate quotas and speed limits, but it is not practical for many users and increases port/config complexity.
  • Third-party billing or limiting panels: Some panels support these features, but 3X-UI users would need to migrate or run extra services.

Mockups, screenshots, or examples

No response

Which parts of the panel would this affect?

Frontend (UI / panel pages), 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 @mioolio on GitHub (Sep 22, 2026). Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/6622 ### Is your feature request related to a problem? Yes. Currently, when a client reaches its traffic limit or expiry date, 3X-UI disables the client completely. There is no soft-throttle option. This gives users no grace period and can be disruptive for shared, family, or commercial nodes. The existing traffic reset is inbound-level (`trafficReset` = hourly / daily / weekly / monthly). It cannot prevent a single client from consuming the whole inbound quota in a short period. For example, on a shared node with a 100GB daily quota, one user can download a large amount in a few minutes and exhaust the node before other users can use it. There is also no per-client speed limit exposed in the panel. All clients on the same inbound share bandwidth, so a single client can saturate the node. Administrators currently have to edit Xray config manually or use external scripts, which may be overwritten by the panel. ### Describe the solution you'd like I would like to propose an opt-in, disabled-by-default set of client-level traffic controls: 1. **Post-expiry / post-quota throttling instead of hard cut-off** - When a client reaches its total traffic or expiry time, the admin can choose: - `Disable` — current behavior, default. - `Throttle` — apply a configurable speed limit. - Example: after 100GB/month is used, limit the client to 1 Mbps instead of disabling it. - This should be configurable per client and default to `Disable` to preserve current behavior. 2. **Window-based quota** - Allow a client-level quota window, for example `10GB per 2 hours`. - When the client exceeds the window quota, apply an action: - `Throttle` to a configured speed until the window resets, or - `Disable` until the window resets. - The window should reset automatically, independent of the main total traffic or expiry. - Example: daily total is 100GB, but the window quota is 10GB every 2 hours. If the user exceeds 10GB in 2 hours, throttle them until the next 2-hour window. - This is optional and disabled by default. 3. **Per-client speed limit** - Add upload/download speed limit fields in the client edit form. - The value can be in Kbps or Mbps, with `0` or empty meaning unlimited. - Use Xray-core's native rate-limiting mechanism if possible, such as per-level policy uplink/downlink, or another reliable per-client method. - Default: unlimited, so existing clients are not affected. 4. **All features opt-in** - Every new option should default to the current behavior. - No existing client should be throttled or limited unless the admin explicitly enables it. ### Alternatives you've considered _No response_ ### Concrete use case - **Keep hard cut-off only**: This is the current behavior, but it is not ideal for users who need temporary low-speed access after using their quota. - **External tc/iptables scripts**: They can limit by IP, but all clients may share the same inbound and port, and IPs are not stable. They are also hard to manage from the panel. - **Manual Xray config editing**: Possible for speed limits, but the panel may overwrite it, and it does not scale. - **Inbound-level traffic reset only**: The existing `trafficReset` resets all clients in an inbound. It does not prevent one client from bursting through the quota in a short window. - **Separate inbound per user**: This can isolate quotas and speed limits, but it is not practical for many users and increases port/config complexity. - **Third-party billing or limiting panels**: Some panels support these features, but 3X-UI users would need to migrate or run extra services. ### Mockups, screenshots, or examples _No response_ ### Which parts of the panel would this affect? Frontend (UI / panel pages), Other ### Are you willing to help? - [x] I'd like to implement this feature myself and open a PR. - [x] 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.
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#4428
No description provided.