Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(externalTrafficJob): External Traffic Inform #2660

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

AliAkhgar
Copy link

@AliAkhgar AliAkhgar commented Feb 9, 2025

External Traffic Inform

This feature allows System Admins to have a central server synced on par with 3x-ui system in order to keep a unified track of client(s) traffic(s) when using multiple 3X-UI as nodes. 3xOption

How does it work?

Simply, the result of XrayTrafficJob is sent to an external API every time traffic job is triggered.

What's the philosophy?

Upon registering user(s) on single or multiple 3X-UI, we have more than 1 source of truth to obtain clients traffic. Directly reading client's traffic through 3X-UI DB/API would be a bad practice as inbounds might be revoked and users are re-registered to new inbounds.

And also, 3X-UI QueryStats is designed to work with Reset: True flag which resets clients/inbound traffics once it is read from Xray-Core. This enforces to have 3X-UI as the only supervisor capable of reading 3X-UI directly from Xray-Core process.
With all said, the only option to have client(s) traffic on par with 3X-UI, is that 3X-UI itself provide it for external use.

Why is it required?

Once multiple instances of 3X-UI are servicing the same clients, System Admins can have a hard time to have all users traffic information in a single place, especially when a user can consume a certain amount of traffic, which may be from 2 or more 3X-UI servers. This help monitoring and management, for keeping track of client's usage cap limit across multiple 3X-UI instances, eliminating a lot of hassle for central control server.

This can be the first step to enable multiple 3X-UIs to be matched with a central server or controller.

Casual Visualization

This helps developers and system admins understand how the feature can help to maintain unified control server. optionVisualization Having the 3X-UI itself send client(s) traffic to External API would better way to go as syncing central server to read traffic from Xray-Core just before 3X-UI seems not doable.

To Reviewers

Please feel free to correct me or suggest audits on the changes. All translations have been done.

Also this feature has been implemented in 'Subscription' tab which might not be the best place.

This feature saves a lot of hassle for managing users from a central server and can be helpful to many.

Technical

Data is sent through RestAPI inside request body, this API can be validated with an API Key or IP Limitations on the end-server.

Also, System Admins are advised to use https protocol in order to be considered a secure communication.

System Admins might need to increase client_max_body_size on their end-server web service if they host many clients simultaneously on a single 3X-UI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant