feat(externalTrafficJob): External Traffic Inform #2660
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.How does it work?
Simply, the result ofXrayTrafficJob
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 withReset: 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.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.