mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-11-03 03:35:04 +03:00
fix(traffic): keep client accounting independent of outbound counters
The traffic poll read every Xray counter in one QueryStats reply under gRPC's default 4 MiB receive limit; past it the whole poll failed and no client was counted, so quotas stopped being enforced. Outbound counters carry tags derived from third-party link remarks, so one long remark was enough. Poll the user, inbound and outbound families separately with a 64 MiB limit, keep counting the families that answer, and cap a subscription link's slug at 64 runes so the tag stays small to begin with.
This commit is contained in:
@@ -533,6 +533,10 @@ func TestSlugAndSuggest(t *testing.T) {
|
||||
if got := SuggestTag("ru-", "Сервер 2", 0); got != "ru-сервер-2" {
|
||||
t.Errorf("unicode suggest tag got %q", got)
|
||||
}
|
||||
// The tag names Xray counters and an outbound_traffics row; a provider picks the remark.
|
||||
if got := SlugRemark(strings.Repeat("Ab ", 1<<20)); got != strings.Repeat("ab-", 21)+"a" {
|
||||
t.Errorf("megabyte remark slug = %.80q (%d bytes), want the first 64 runes", got, len(got))
|
||||
}
|
||||
}
|
||||
|
||||
// The obfs-local plugin the panel exports carries the only description of
|
||||
|
||||
Reference in New Issue
Block a user