[GH-ISSUE #5825] [Feature]: Client-side balancer #4048

Closed
opened 2026-10-31 20:36:47 +07:00 by bsakaguchi · 4 comments
Owner

Originally created by @isleuntothyself on GitHub (Jul 6, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5825

3x-ui supports load balancers but they are server-side only, so there is no way to create a "fastest location" or "auto-pick" option in a subscription (like many commercial VPN services do)

Describe the solution you'd like

i would love 3x-ui to support a client-side balancer that can be included in the subscription (JSON or other formats)

specifically:

add an option to include a balancer outbound in a subscription (with the ability to configure it as if you would do with a balancer) that the client can use locally. the client would then ping the available outbounds and automatically connect to the suitable one

Alternatives you've considered

in some panels (like Remnawave) this can be achieved by customizing the JSON subscription, but switching to other panels is not really what i want

i know that some proxy clients have the ability to sort the inbounds by ping (basically picking "the fastest one") but a lot of my users use other clients that don't have such a feature

Concrete use case

No response

Mockups, screenshots, or examples

No response

Which parts of the panel would this affect?

Subscription (share links / Clash / JSON), Xray config generation, Backend (API endpoints, login, settings), Frontend (UI / panel pages)

Are you willing to help?

  • I'd like to implement this feature myself and open a PR.
  • I can help test once a PR is open.

Before submitting

  • I searched existing issues and this feature has not been requested.
  • This feature request is written in English.
Originally created by @isleuntothyself on GitHub (Jul 6, 2026). Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5825 ### Is your feature request related to a problem? 3x-ui supports load balancers but they are server-side only, so there is no way to create a "fastest location" or "auto-pick" option in a subscription (like many commercial VPN services do) ### Describe the solution you'd like i would love 3x-ui to support a client-side balancer that can be included in the subscription (JSON or other formats) specifically: add an option to include a balancer outbound in a subscription (with the ability to configure it as if you would do with a balancer) that the client can use locally. the client would then ping the available outbounds and automatically connect to the suitable one ### Alternatives you've considered in some panels (like Remnawave) this can be achieved by customizing the JSON subscription, but switching to other panels is not really what i want i know that some proxy clients have the ability to sort the inbounds by ping (basically picking "the fastest one") but a lot of my users use other clients that don't have such a feature ### Concrete use case _No response_ ### Mockups, screenshots, or examples _No response_ ### Which parts of the panel would this affect? Subscription (share links / Clash / JSON), Xray config generation, Backend (API endpoints, login, settings), Frontend (UI / panel pages) ### Are you willing to help? - [ ] I'd like to implement this feature myself and open a PR. - [ ] I can help test once a PR is open. ### Before submitting - [x] I searched [existing issues](../issues?q=is%3Aissue) and this feature has not been requested. - [x] This feature request is written in English.
bsakaguchi 2026-10-31 20:36:47 +07:00
Author
Owner

@github-actions[bot] commented on GitHub (Jul 6, 2026):

Thanks for the detailed request. I confirmed there is no such feature today, and traced exactly what would (and would not) need to change.

Current state (confirmed in source)

3x-ui generates three subscription formats, in internal/sub/, none of which currently emit a client-evaluated balancer/health-check group:

  • Raw share links (internal/sub/links.go): a flat base64 list of vless://, vmess://, etc. There is no grouping concept at all here — any "pick the fastest" behavior for this format has to come from the client app itself (which matches what you already observed: some clients sort by ping, most don't).
  • JSON (internal/sub/json_service.go, template in internal/sub/default.json): this is a full Xray-core client config (local inbounds + outbounds + routing). GetJson (json_service.go:60) currently builds one independent config per server/client, each with a single hardcoded "proxy" outbound tag, and when there is more than one it just concatenates them into a JSON array (json_service.go:127-133) rather than merging them into one config with multiple outbounds. Xray-core itself does support a routing.balancers array plus observatory/burstObservatory health-checking (that is literally what 3x-ui's own server-side balancer feature under Xray Settings → Balancers uses — see Observatory/BurstObservatory in internal/xray/config.go:23-24 and frontend/src/pages/xray/balancers/), so an Xray-core-based client could in principle honor a "fastest outbound" config the same way the server does. 3x-ui just doesn't generate that shape today.
  • Clash/Mihomo (internal/sub/clash_service.go): by default only a type: select proxy-group is generated (clash_service.go:89-97). There is a partial workaround here already: enabling Settings → Subscription → Clash/Mihomo routing (subClashEnableRouting) and putting a full YAML block in Clash/Mihomo Rules (subClashRules) lets you override proxy-groups with a fallback/url-test group via mergeClashRulesYAML (clash_service.go:712). The catch: the proxies list must be typed out with exact, hardcoded proxy names — there's no templating, and it breaks if remark names change. This was covered in more depth in #5095.

How this request differs from prior ones

This isn't a duplicate of any existing issue I could find:

  • #5095 asked for the same "auto-pick fastest" behavior but scoped only to Clash/Mihomo proxy-groups.
  • #5316 and #4928 are about server-side balancing (subscription-sourced outbounds feeding a balancer, or balancing traffic across backend nodes), not a client-evaluated balancer shipped in the subscription.

Your ask is broader — a balancer definition, configurable like the existing server-side one, that gets embedded into the subscription output (JSON and/or other formats) so the client itself does the health-checking — which none of the above cover.

Given the scope (new settings, JSON-subscription config generation changes to merge multiple outbounds + balancers/observatory into a single config, and UI work), this is a substantial feature rather than a small fix. I've left it labeled enhancement; a maintainer will need to weigh in on prioritization and design (e.g., whether it's JSON-only at first, given raw links and non-Xray-core clients can't honor this at all).

This reply was generated automatically; a maintainer may follow up.

<!-- gh-comment-id:4888441802 --> @github-actions[bot] commented on GitHub (Jul 6, 2026): Thanks for the detailed request. I confirmed there is no such feature today, and traced exactly what would (and would not) need to change. **Current state (confirmed in source)** 3x-ui generates three subscription formats, in `internal/sub/`, none of which currently emit a client-evaluated balancer/health-check group: - **Raw share links** (`internal/sub/links.go`): a flat base64 list of `vless://`, `vmess://`, etc. There is no grouping concept at all here — any "pick the fastest" behavior for this format has to come from the client app itself (which matches what you already observed: some clients sort by ping, most don't). - **JSON** (`internal/sub/json_service.go`, template in `internal/sub/default.json`): this is a full Xray-core client config (local `inbounds` + `outbounds` + `routing`). `GetJson` (json_service.go:60) currently builds **one independent config per server/client**, each with a single hardcoded `"proxy"` outbound tag, and when there is more than one it just concatenates them into a JSON array (json_service.go:127-133) rather than merging them into one config with multiple outbounds. Xray-core itself does support a `routing.balancers` array plus `observatory`/`burstObservatory` health-checking (that is literally what 3x-ui's own server-side balancer feature under Xray Settings → Balancers uses — see `Observatory`/`BurstObservatory` in `internal/xray/config.go:23-24` and `frontend/src/pages/xray/balancers/`), so an Xray-core-based client could in principle honor a "fastest outbound" config the same way the server does. 3x-ui just doesn't generate that shape today. - **Clash/Mihomo** (`internal/sub/clash_service.go`): by default only a `type: select` proxy-group is generated (clash_service.go:89-97). There is a partial workaround here already: enabling **Settings → Subscription → Clash/Mihomo routing** (`subClashEnableRouting`) and putting a full YAML block in **Clash/Mihomo Rules** (`subClashRules`) lets you override `proxy-groups` with a `fallback`/`url-test` group via `mergeClashRulesYAML` (clash_service.go:712). The catch: the `proxies` list must be typed out with exact, hardcoded proxy names — there's no templating, and it breaks if remark names change. This was covered in more depth in #5095. **How this request differs from prior ones** This isn't a duplicate of any existing issue I could find: - #5095 asked for the same "auto-pick fastest" behavior but scoped only to Clash/Mihomo proxy-groups. - #5316 and #4928 are about **server-side** balancing (subscription-sourced outbounds feeding a balancer, or balancing traffic across backend nodes), not a client-evaluated balancer shipped in the subscription. Your ask is broader — a balancer definition, configurable like the existing server-side one, that gets embedded into the subscription output (JSON and/or other formats) so the client itself does the health-checking — which none of the above cover. Given the scope (new settings, JSON-subscription config generation changes to merge multiple outbounds + `balancers`/`observatory` into a single config, and UI work), this is a substantial feature rather than a small fix. I've left it labeled `enhancement`; a maintainer will need to weigh in on prioritization and design (e.g., whether it's JSON-only at first, given raw links and non-Xray-core clients can't honor this at all). *This reply was generated automatically; a maintainer may follow up.*
Author
Owner

@DIMFLIX commented on GitHub (Jul 13, 2026):

bump

<!-- gh-comment-id:4958542813 --> @DIMFLIX commented on GitHub (Jul 13, 2026): bump
Author
Owner

@varp commented on GitHub (Jul 22, 2026):

+1

<!-- gh-comment-id:5041771980 --> @varp commented on GitHub (Jul 22, 2026): +1
Author
Owner

@isleuntothyself commented on GitHub (Aug 24, 2026):

implemented in 3.7.0, thanks @DIMFLIX

<!-- gh-comment-id:5396140905 --> @isleuntothyself commented on GitHub (Aug 24, 2026): implemented in 3.7.0, thanks @DIMFLIX
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#4048
No description provided.