[GH-ISSUE #5007] [Feature]: Add support for subscription outbound #3523

Closed
opened 2026-10-31 20:33:03 +07:00 by bsakaguchi · 3 comments
Owner

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

When adding an outbound, we have to add each config separately.

Describe the solution you'd like

Add support for subscription based outbound, with support for automatic update for that subscription so the outbounds get automatically changed when subscription gets updated.
Also support for using them is balancer.

Alternatives you've considered

Sometimes outbound gets updated and we have to manually update each outbound config

Concrete use case

No response

Mockups, screenshots, or examples

No response

Which parts of the panel would this affect?

Xray config generation

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 @rqzbeh on GitHub (Jun 6, 2026). Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5007 ### Is your feature request related to a problem? When adding an outbound, we have to add each config separately. ### Describe the solution you'd like Add support for subscription based outbound, with support for automatic update for that subscription so the outbounds get automatically changed when subscription gets updated. Also support for using them is balancer. ### Alternatives you've considered Sometimes outbound gets updated and we have to manually update each outbound config ### Concrete use case _No response_ ### Mockups, screenshots, or examples _No response_ ### Which parts of the panel would this affect? Xray config generation ### Are you willing to help? - [x] I'd like to implement this feature myself and open a PR. - [x] 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:33:03 +07:00
Author
Owner

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

Thanks for the detailed request and for offering to implement it!

Current state of outbounds in the panel (v3.2.8)

Outbounds today are managed entirely as raw JSON inside Xray Settings → Template Config (the xrayTemplateConfig DB setting). The panel stores and passes that blob directly to xray — it does not parse individual outbound entries, so there is no concept of a subscription URL for outbounds. Traffic accounting per outbound tag is tracked separately in OutboundTraffics, and there is an outbound test endpoint (/xray/testOutbound), but no subscription-fetch or auto-update mechanism exists anywhere in the codebase.

The existing subscription infrastructure (sub/) works in the opposite direction: it generates subscription links for VPN clients — it does not import subscriptions as outbounds.

Related prior request

Issue #3730 ("Be able to use subscription in the outbounds") asked for essentially the same thing. It was closed as "completed" but there is no corresponding implementation in the repo, so the feature remains unimplemented.

Scope of the work (for context when implementing)

A PR for this feature would need to touch several layers:

  1. Backend – new model and storage: A new DB model (e.g. OutboundSubscription) to store subscription URLs, update intervals, and the last-fetched outbound set.
  2. Backend – subscription parser: Fetch the URL, decode the base64 payload, and convert each line (vmess://, vless://, trojan://, ss://, etc.) into a valid xray outbound JSON object. The link formats differ per protocol, so this is the most involved part.
  3. Backend – config generation (xray/ and web/service/xray_setting.go): Merge subscription-derived outbound objects into the final xray config at restart/reload time, without overwriting manually configured outbounds.
  4. Backend – auto-update job (web/job/): A periodic job (similar to the existing traffic/expiry jobs) that re-fetches each subscription URL and updates the stored outbounds, then triggers a graceful xray reload.
  5. Backend – API endpoints (web/controller/xray_setting.go): CRUD for subscription entries and a manual refresh trigger.
  6. Frontend: A UI panel (probably inside Xray Settings or a new tab) to add/edit/delete subscription URLs and display current outbounds pulled from each.
  7. Balancer integration: Once outbounds from a subscription are stored with predictable tags, they can be referenced in the routing balancers array just like any other outbound. The main challenge is keeping tags stable across subscription refreshes.

If you plan to open a PR, it would help reviewers to see the DB schema and the subscription-parsing logic proposed upfront (as a draft PR or a design comment here).

<!-- gh-comment-id:4638399167 --> @github-actions[bot] commented on GitHub (Jun 6, 2026): Thanks for the detailed request and for offering to implement it\! **Current state of outbounds in the panel (v3.2.8)** Outbounds today are managed entirely as raw JSON inside **Xray Settings → Template Config** (the xrayTemplateConfig DB setting). The panel stores and passes that blob directly to xray — it does not parse individual outbound entries, so there is no concept of a subscription URL for outbounds. Traffic accounting per outbound tag is tracked separately in OutboundTraffics, and there is an outbound test endpoint (/xray/testOutbound), but no subscription-fetch or auto-update mechanism exists anywhere in the codebase. The existing subscription infrastructure (sub/) works in the **opposite direction**: it *generates* subscription links for VPN clients — it does not *import* subscriptions as outbounds. **Related prior request** Issue #3730 ("Be able to use subscription in the outbounds") asked for essentially the same thing. It was closed as "completed" but there is no corresponding implementation in the repo, so the feature remains unimplemented. **Scope of the work (for context when implementing)** A PR for this feature would need to touch several layers: 1. **Backend – new model and storage**: A new DB model (e.g. OutboundSubscription) to store subscription URLs, update intervals, and the last-fetched outbound set. 2. **Backend – subscription parser**: Fetch the URL, decode the base64 payload, and convert each line (vmess://, vless://, trojan://, ss://, etc.) into a valid xray outbound JSON object. The link formats differ per protocol, so this is the most involved part. 3. **Backend – config generation** (xray/ and web/service/xray_setting.go): Merge subscription-derived outbound objects into the final xray config at restart/reload time, without overwriting manually configured outbounds. 4. **Backend – auto-update job** (web/job/): A periodic job (similar to the existing traffic/expiry jobs) that re-fetches each subscription URL and updates the stored outbounds, then triggers a graceful xray reload. 5. **Backend – API endpoints** (web/controller/xray_setting.go): CRUD for subscription entries and a manual refresh trigger. 6. **Frontend**: A UI panel (probably inside Xray Settings or a new tab) to add/edit/delete subscription URLs and display current outbounds pulled from each. 7. **Balancer integration**: Once outbounds from a subscription are stored with predictable tags, they can be referenced in the routing balancers array just like any other outbound. The main challenge is keeping tags stable across subscription refreshes. If you plan to open a PR, it would help reviewers to see the DB schema and the subscription-parsing logic proposed upfront (as a draft PR or a design comment here).
Author
Owner

@DarkFIxED commented on GitHub (Jun 6, 2026):

I appreciate if you could implement it

<!-- gh-comment-id:4640652098 --> @DarkFIxED commented on GitHub (Jun 6, 2026): I appreciate if you could implement it
Author
Owner

@rqzbeh commented on GitHub (Jun 7, 2026):

https://github.com/MHSanaei/3x-ui/pull/5037
please check this out

<!-- gh-comment-id:4641408407 --> @rqzbeh commented on GitHub (Jun 7, 2026): https://github.com/MHSanaei/3x-ui/pull/5037 please check this out
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#3523
No description provided.