m-uising-box panel

Deep dive · 2026-10-05

Managing traffic quotas and device limits across servers

A quota is easy on one server and surprisingly hard on five. This is how m-ui makes "20 GB and 3 devices" mean the same thing no matter which server a client connects to.

Where bytes are counted

Each server's embedded sing-box tracks bytes per user. Every 10 seconds the panel reads those counters. On the master they go straight into the user's usage and the time series. On a node they go into a monotonic per-user counter that the master pulls every 5 seconds and reconciles with a cursor, so each byte is added exactly once even if a report is retried or a node reinstalls. The user's quota is judged against the sum.

Traffic ratio

A server can carry a ratio. Traffic through a ratio-2 server counts double against the quota — a simple way to price a premium route without a second product. Charts keep the real bytes; only quota accounting is scaled, so you can still see what actually flowed.

Periodic reset

Enable auto-reset with a period in days and m-ui zeros the usage on schedule, re-enables users who were disabled for exceeding it, and records lifetime totals separately. The next reset date is shown on the user and on their landing page. Resetting manually is one click, in bulk too.

Device limits, fleet-wide

A "device" is a source IP seen on any inbound: each IPv4 address counts once and IPv6 counts per /64, and the two families are counted separately, each within the limit (a dual-stack device never counts twice, so a limit of 3 means at most 3 IPv4 addresses plus 3 IPv6 /64s). On one server that is trivial; across servers each machine only sees its own clients. The master merges online IPs from every node with its own and, in the same 5-second round, sends each node the set of IPs seen elsewhere. Every server then enforces the limit against the union, so it holds fleet-wide. Enforcement is local and immediate; only IP lists travel.

Two things to know: a phone on Wi-Fi and the same phone on mobile data are two IPs; and the user's detail drawer lists current IPs with the lines they are using, which usually explains a "why am I blocked" ticket in one look.

Speed limits

Upload and download caps in Mbps are per user and applied by the data plane on every server. They are part of plans, so trial and premium tiers differ by one dropdown.

What happens at the limit

  1. Every minute the master judges quota and expiry. A user over either is disabled in the database with the reason recorded (quota / expired); a manually disabled user is a separate case that neither a reset nor a renewal brings back on its own.
  2. On the master the inbound user table is swapped and the user's connections are closed.
  3. The next snapshot to every node no longer contains the user, so nodes drop them within seconds — nodes never judge quota themselves, which is why a network partition cannot disable users by mistake.
  4. The user can still open their landing page in a browser: it shows that they are out of traffic or expired, the next reset date, and your contact details (resellers' users see the reseller's). Only clients are cut off — a plain 404 from that moment on, and the line inbounds stop accepting them.
  5. Telegram, if configured, told you N days before expiry and at a usage percentage you chose.

Resellers as a second layer

A reseller has a budget of its own — traffic, devices, bandwidth, expiry. All of their users' usage rolls up to it. When the budget is exhausted, every user of that reseller is cut off at once, regardless of individual quotas. The accounting is monotonic: revoking and re-granting budget cannot be gamed by resets.