[PR #4594] [CLOSED] feat: add inbound traffic multiplier #5721

Closed
opened 2026-11-02 04:03:37 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/MHSanaei/3x-ui/pull/4594
Author: @byang37
Created: 5/26/2026
Status: ❌ Closed

Base: main ← Head: pr/traffic-multiplier


📝 Commits (1)

  • 8c74a4e feat: add inbound traffic multiplier

📊 Changes

22 files changed (+359 additions, -46 deletions)

View changed files

📝 database/model/model.go (+1 -0)
📝 frontend/public/openapi.json (+2 -0)
📝 frontend/src/models/dbinbound.ts (+3 -0)
📝 frontend/src/pages/api-docs/endpoints.ts (+2 -2)
📝 frontend/src/pages/inbounds/InboundFormModal.tsx (+13 -0)
📝 frontend/src/pages/inbounds/InboundsPage.tsx (+1 -0)
📝 web/runtime/remote.go (+1 -0)
📝 web/service/inbound.go (+169 -31)
➕ web/service/inbound_traffic_multiplier_test.go (+141 -0)
📝 web/translation/ar-EG.json (+2 -1)
📝 web/translation/en-US.json (+2 -1)
📝 web/translation/es-ES.json (+2 -1)
📝 web/translation/fa-IR.json (+2 -1)
📝 web/translation/id-ID.json (+2 -1)
📝 web/translation/ja-JP.json (+2 -1)
📝 web/translation/pt-BR.json (+2 -1)
📝 web/translation/ru-RU.json (+2 -1)
📝 web/translation/tr-TR.json (+2 -1)
📝 web/translation/uk-UA.json (+2 -1)
📝 web/translation/vi-VN.json (+2 -1)

...and 2 more files

📄 Description

Summary

Add an inbound traffic multiplier setting to scale inbound upload/download traffic accounting. The multiplier is configurable from the Add/Edit Inbound UI and is applied to inbound and client traffic counters.

Why

This enables operators to bill or enforce traffic quotas using weighted traffic usage. For example, setting the multiplier to 2 counts actual upload/download usage as double for the inbound and its clients.

Type of change

  • Bug fix
  • New feature
  • Refactoring (no behavior change)
  • Documentation
  • Tests only
  • Build / CI / tooling
  • Other

Areas affected

  • Frontend (UI / panel pages)
  • Backend (API endpoints, login, settings)
  • Xray config generation
  • Subscription (share links / Clash / JSON)
  • Statistics / traffic counters
  • Database / migrations
  • Install / upgrade script
  • Docker image
  • Multi-node (sub-nodes)
  • Telegram bot

How was this tested?

Added backend tests covering inbound/client traffic accounting with a traffic multiplier, including integer saturation behavior for large counters.

Tested locally with:

go test ./database/model ./web/runtime ./web/service -count=1
cd frontend && npm run typecheck

Also verified that the PR branch contains only the traffic multiplier feature changes and does not include unrelated install/update script changes.

Screenshots / recordings

Add Inbound Dialog Screenshot:
image

Edit Inbound Dialogs Screenshot:
image

Breaking changes

None.

Existing inbounds default to a multiplier of 1, preserving current traffic accounting behavior.

Checklist

  • I tested the change locally and confirmed the described behavior.
  • I added or updated tests for the new behavior (when applicable).
  • go build ./... and the test suite pass locally.
  • For frontend changes: npm run lint, npm run typecheck, and npm run build pass.
  • I updated the Wiki / README / API docs if user-facing behavior changed.
  • My commits follow the project's existing message style.
  • I have no unrelated changes mixed into this PR.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/MHSanaei/3x-ui/pull/4594 **Author:** [@byang37](https://github.com/byang37) **Created:** 5/26/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `pr/traffic-multiplier` --- ### 📝 Commits (1) - [`8c74a4e`](https://github.com/MHSanaei/3x-ui/commit/8c74a4eff533a645d13e8bb36474542eedb7f089) feat: add inbound traffic multiplier ### 📊 Changes **22 files changed** (+359 additions, -46 deletions) <details> <summary>View changed files</summary> 📝 `database/model/model.go` (+1 -0) 📝 `frontend/public/openapi.json` (+2 -0) 📝 `frontend/src/models/dbinbound.ts` (+3 -0) 📝 `frontend/src/pages/api-docs/endpoints.ts` (+2 -2) 📝 `frontend/src/pages/inbounds/InboundFormModal.tsx` (+13 -0) 📝 `frontend/src/pages/inbounds/InboundsPage.tsx` (+1 -0) 📝 `web/runtime/remote.go` (+1 -0) 📝 `web/service/inbound.go` (+169 -31) ➕ `web/service/inbound_traffic_multiplier_test.go` (+141 -0) 📝 `web/translation/ar-EG.json` (+2 -1) 📝 `web/translation/en-US.json` (+2 -1) 📝 `web/translation/es-ES.json` (+2 -1) 📝 `web/translation/fa-IR.json` (+2 -1) 📝 `web/translation/id-ID.json` (+2 -1) 📝 `web/translation/ja-JP.json` (+2 -1) 📝 `web/translation/pt-BR.json` (+2 -1) 📝 `web/translation/ru-RU.json` (+2 -1) 📝 `web/translation/tr-TR.json` (+2 -1) 📝 `web/translation/uk-UA.json` (+2 -1) 📝 `web/translation/vi-VN.json` (+2 -1) _...and 2 more files_ </details> ### 📄 Description ## Summary Add an inbound traffic multiplier setting to scale inbound upload/download traffic accounting. The multiplier is configurable from the Add/Edit Inbound UI and is applied to inbound and client traffic counters. ## Why This enables operators to bill or enforce traffic quotas using weighted traffic usage. For example, setting the multiplier to `2` counts actual upload/download usage as double for the inbound and its clients. ## Type of change - [ ] Bug fix - [x] New feature - [ ] Refactoring (no behavior change) - [ ] Documentation - [ ] Tests only - [ ] Build / CI / tooling - [ ] Other ## Areas affected - [x] Frontend (UI / panel pages) - [x] Backend (API endpoints, login, settings) - [ ] Xray config generation - [ ] Subscription (share links / Clash / JSON) - [x] Statistics / traffic counters - [x] Database / migrations - [ ] Install / upgrade script - [ ] Docker image - [x] Multi-node (sub-nodes) - [ ] Telegram bot ## How was this tested? Added backend tests covering inbound/client traffic accounting with a traffic multiplier, including integer saturation behavior for large counters. Tested locally with: ```bash go test ./database/model ./web/runtime ./web/service -count=1 cd frontend && npm run typecheck ``` Also verified that the PR branch contains only the traffic multiplier feature changes and does not include unrelated install/update script changes. ## Screenshots / recordings Add Inbound Dialog Screenshot: <img width="1089" height="695" alt="image" src="https://github.com/user-attachments/assets/8fb209fd-4c8e-4ccb-946d-7538723d65c4" /> Edit Inbound Dialogs Screenshot: <img width="1050" height="682" alt="image" src="https://github.com/user-attachments/assets/55074630-168e-4d45-9222-78e0ed149b46" /> ## Breaking changes None. Existing inbounds default to a multiplier of 1, preserving current traffic accounting behavior. ## Checklist - [x] I tested the change locally and confirmed the described behavior. - [ ] I added or updated tests for the new behavior (when applicable). - [ ] go build ./... and the test suite pass locally. - [ ] For frontend changes: npm run lint, npm run typecheck, and npm run build pass. - [x] I updated the Wiki / README / API docs if user-facing behavior changed. - [x] My commits follow the project's existing message style. - [x] I have no unrelated changes mixed into this PR. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-02 04:03:37 +07:00
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#5721
No description provided.