[GH-ISSUE #6945] [Bug]: Trojan Outbound Does Not Work While VLESS, VMess, and Shadowsocks Work Correctly / اتصال خروجی (Outbound) پروتکل Trojan کار نمی‌کند، در حالی که VLESS، VMess و Shadowsocks به‌درستی … #4594

Open
opened 2026-10-31 20:40:45 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @montiego on GitHub (Oct 26, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/6945

Describe the bug

Bug Description

I have encountered an issue with the Trojan protocol in the outbound configuration of the 3X-UI panel.

Whenever I add a Trojan outbound configuration, it does not work as expected. However, the exact same Trojan configuration works correctly in various clients on Android, Windows, and other platforms.

I have also tested other outbound protocols in 3X-UI, and they work correctly. VLESS, VMess, and Shadowsocks outbounds all function as expected, but Trojan outbound does not work.

Steps to Reproduce

  1. Add a Trojan outbound configuration to 3X-UI.
  2. Use a Trojan configuration that has been verified to work correctly in other clients.
  3. Try to use the outbound connection.
  4. Observe that the Trojan outbound does not work.

Expected Behavior

The Trojan outbound should work correctly when provided with a valid configuration, just like VLESS, VMess, and Shadowsocks outbounds.

Actual Behavior

The Trojan outbound fails to work, even though the same configuration works correctly in other clients and the other outbound protocols work properly in 3X-UI.

Additional Information

  • Trojan outbound: Not working.
  • VLESS outbound: Working.
  • VMess outbound: Working.
  • Shadowsocks outbound: Working.
  • The Trojan configuration has been verified to work in other clients on Android, Windows, and other platforms.

This issue appears to be specific to the handling of Trojan outbound configurations in 3X-UI.

Could you please investigate this issue and check whether there is a bug in the Trojan outbound configuration handling or its integration with the Xray core?

Thank you for your work on this project.

توضیحات باگ

در بخش تنظیمات Outbound پنل 3X-UI با پروتکل Trojan مشکل دارم.

هر بار که یک کانفیگ Trojan به بخش Outbound اضافه می‌کنم، کار نمی‌کند. با این حال، همان کانفیگ دقیق Trojan در کلاینت‌های مختلف اندروید، ویندوز و سایر پلتفرم‌ها به‌درستی کار می‌کند.

پروتکل‌های دیگر را نیز در بخش Outbound پنل آزمایش کرده‌ام و همگی به‌درستی کار می‌کنند. کانفیگ‌های VLESS، VMess و Shadowsocks بدون مشکل کار می‌کنند، اما Trojan کار نمی‌کند.

مراحل بازتولید باگ

۱. یک کانفیگ Trojan به بخش Outbound پنل 3X-UI اضافه کنید.

۲. از کانفیگی استفاده کنید که عملکرد صحیح آن در کلاینت‌های دیگر تأیید شده است.

۳. اتصال Outbound را امتحان کنید.

۴. مشاهده می‌کنید که اتصال Trojan کار نمی‌کند.

رفتار مورد انتظار

Outbound پروتکل Trojan باید با یک کانفیگ معتبر، درست مانند VLESS، VMess و Shadowsocks، به‌درستی کار کند.

رفتار واقعی

Outbound پروتکل Trojan کار نمی‌کند؛ با وجود اینکه همان کانفیگ در کلاینت‌های دیگر به‌درستی کار می‌کند و سایر پروتکل‌های Outbound نیز در پنل 3X-UI بدون مشکل هستند.

اطلاعات تکمیلی

  • Trojan: کار نمی‌کند.
  • VLESS: کار می‌کند.
  • VMess: کار می‌کند.
  • Shadowsocks: کار می‌کند.
  • کانفیگ Trojan در کلاینت‌های اندروید، ویندوز و سایر پلتفرم‌ها آزمایش شده و عملکرد صحیح آن تأیید شده است.

به نظر می‌رسد مشکل به نحوه پردازش یا پشتیبانی از تنظیمات Trojan Outbound در پنل 3X-UI مربوط باشد.

لطفاً این مشکل را بررسی کنید و مشخص کنید که آیا باگی در پردازش تنظیمات Trojan Outbound یا یکپارچه‌سازی آن با هسته Xray وجود دارد یا خیر.

از زحمات شما برای توسعه این پروژه سپاسگزارم.

How to reproduce the problem

Bug Description

I have encountered an issue with the Trojan protocol in the outbound configuration of the 3X-UI panel.

Whenever I add a Trojan outbound configuration, it does not work as expected. However, the exact same Trojan configuration works correctly in various clients on Android, Windows, and other platforms.

I have also tested other outbound protocols in 3X-UI, and they work correctly. VLESS, VMess, and Shadowsocks outbounds all function as expected, but Trojan outbound does not work.

Steps to Reproduce

  1. Add a Trojan outbound configuration to 3X-UI.
  2. Use a Trojan configuration that has been verified to work correctly in other clients.
  3. Try to use the outbound connection.
  4. Observe that the Trojan outbound does not work.

Expected Behavior

The Trojan outbound should work correctly when provided with a valid configuration, just like VLESS, VMess, and Shadowsocks outbounds.

Actual Behavior

The Trojan outbound fails to work, even though the same configuration works correctly in other clients and the other outbound protocols work properly in 3X-UI.

Additional Information

  • Trojan outbound: Not working.
  • VLESS outbound: Working.
  • VMess outbound: Working.
  • Shadowsocks outbound: Working.
  • The Trojan configuration has been verified to work in other clients on Android, Windows, and other platforms.

This issue appears to be specific to the handling of Trojan outbound configurations in 3X-UI.

Could you please investigate this issue and check whether there is a bug in the Trojan outbound configuration handling or its integration with the Xray core?

Thank you for your work on this project.

توضیحات باگ

در بخش تنظیمات Outbound پنل 3X-UI با پروتکل Trojan مشکل دارم.

هر بار که یک کانفیگ Trojan به بخش Outbound اضافه می‌کنم، کار نمی‌کند. با این حال، همان کانفیگ دقیق Trojan در کلاینت‌های مختلف اندروید، ویندوز و سایر پلتفرم‌ها به‌درستی کار می‌کند.

پروتکل‌های دیگر را نیز در بخش Outbound پنل آزمایش کرده‌ام و همگی به‌درستی کار می‌کنند. کانفیگ‌های VLESS، VMess و Shadowsocks بدون مشکل کار می‌کنند، اما Trojan کار نمی‌کند.

مراحل بازتولید باگ

۱. یک کانفیگ Trojan به بخش Outbound پنل 3X-UI اضافه کنید.

۲. از کانفیگی استفاده کنید که عملکرد صحیح آن در کلاینت‌های دیگر تأیید شده است.

۳. اتصال Outbound را امتحان کنید.

۴. مشاهده می‌کنید که اتصال Trojan کار نمی‌کند.

رفتار مورد انتظار

Outbound پروتکل Trojan باید با یک کانفیگ معتبر، درست مانند VLESS، VMess و Shadowsocks، به‌درستی کار کند.

رفتار واقعی

Outbound پروتکل Trojan کار نمی‌کند؛ با وجود اینکه همان کانفیگ در کلاینت‌های دیگر به‌درستی کار می‌کند و سایر پروتکل‌های Outbound نیز در پنل 3X-UI بدون مشکل هستند.

اطلاعات تکمیلی

  • Trojan: کار نمی‌کند.
  • VLESS: کار می‌کند.
  • VMess: کار می‌کند.
  • Shadowsocks: کار می‌کند.
  • کانفیگ Trojan در کلاینت‌های اندروید، ویندوز و سایر پلتفرم‌ها آزمایش شده و عملکرد صحیح آن تأیید شده است.

به نظر می‌رسد مشکل به نحوه پردازش یا پشتیبانی از تنظیمات Trojan Outbound در پنل 3X-UI مربوط باشد.

لطفاً این مشکل را بررسی کنید و مشخص کنید که آیا باگی در پردازش تنظیمات Trojan Outbound یا یکپارچه‌سازی آن با هسته Xray وجود دارد یا خیر.

از زحمات شما برای توسعه این پروژه سپاسگزارم.

Expected behavior

No response

Actual behavior

No response

Relevant logs


Screenshots

No response

3x-ui version

dev

Xray-core version

No response

How did you install 3x-ui?

install.sh script

Operating system

ubuntu26

Which parts of the panel are affected?

No response

Browser (only if it is a UI bug)

No response

Is the panel behind a reverse proxy or CDN?

None

Before submitting

  • I searched existing issues and this bug has not been reported.
  • I am running the latest released version of 3x-ui (or have verified the bug still exists on it).
  • This bug report is written in English.
  • I have redacted any sensitive data (tokens, real domains, client UUIDs).
Originally created by @montiego on GitHub (Oct 26, 2026). Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/6945 ### Describe the bug ### Bug Description I have encountered an issue with the Trojan protocol in the outbound configuration of the 3X-UI panel. Whenever I add a Trojan outbound configuration, it does not work as expected. However, the exact same Trojan configuration works correctly in various clients on Android, Windows, and other platforms. I have also tested other outbound protocols in 3X-UI, and they work correctly. VLESS, VMess, and Shadowsocks outbounds all function as expected, but Trojan outbound does not work. ### Steps to Reproduce 1. Add a Trojan outbound configuration to 3X-UI. 2. Use a Trojan configuration that has been verified to work correctly in other clients. 3. Try to use the outbound connection. 4. Observe that the Trojan outbound does not work. ### Expected Behavior The Trojan outbound should work correctly when provided with a valid configuration, just like VLESS, VMess, and Shadowsocks outbounds. ### Actual Behavior The Trojan outbound fails to work, even though the same configuration works correctly in other clients and the other outbound protocols work properly in 3X-UI. ### Additional Information - Trojan outbound: Not working. - VLESS outbound: Working. - VMess outbound: Working. - Shadowsocks outbound: Working. - The Trojan configuration has been verified to work in other clients on Android, Windows, and other platforms. This issue appears to be specific to the handling of Trojan outbound configurations in 3X-UI. Could you please investigate this issue and check whether there is a bug in the Trojan outbound configuration handling or its integration with the Xray core? Thank you for your work on this project. ### توضیحات باگ در بخش تنظیمات Outbound پنل 3X-UI با پروتکل Trojan مشکل دارم. هر بار که یک کانفیگ Trojan به بخش Outbound اضافه می‌کنم، کار نمی‌کند. با این حال، همان کانفیگ دقیق Trojan در کلاینت‌های مختلف اندروید، ویندوز و سایر پلتفرم‌ها به‌درستی کار می‌کند. پروتکل‌های دیگر را نیز در بخش Outbound پنل آزمایش کرده‌ام و همگی به‌درستی کار می‌کنند. کانفیگ‌های VLESS، VMess و Shadowsocks بدون مشکل کار می‌کنند، اما Trojan کار نمی‌کند. ### مراحل بازتولید باگ ۱. یک کانفیگ Trojan به بخش Outbound پنل 3X-UI اضافه کنید. ۲. از کانفیگی استفاده کنید که عملکرد صحیح آن در کلاینت‌های دیگر تأیید شده است. ۳. اتصال Outbound را امتحان کنید. ۴. مشاهده می‌کنید که اتصال Trojan کار نمی‌کند. ### رفتار مورد انتظار Outbound پروتکل Trojan باید با یک کانفیگ معتبر، درست مانند VLESS، VMess و Shadowsocks، به‌درستی کار کند. ### رفتار واقعی Outbound پروتکل Trojan کار نمی‌کند؛ با وجود اینکه همان کانفیگ در کلاینت‌های دیگر به‌درستی کار می‌کند و سایر پروتکل‌های Outbound نیز در پنل 3X-UI بدون مشکل هستند. ### اطلاعات تکمیلی - Trojan: کار نمی‌کند. - VLESS: کار می‌کند. - VMess: کار می‌کند. - Shadowsocks: کار می‌کند. - کانفیگ Trojan در کلاینت‌های اندروید، ویندوز و سایر پلتفرم‌ها آزمایش شده و عملکرد صحیح آن تأیید شده است. به نظر می‌رسد مشکل به نحوه پردازش یا پشتیبانی از تنظیمات Trojan Outbound در پنل 3X-UI مربوط باشد. لطفاً این مشکل را بررسی کنید و مشخص کنید که آیا باگی در پردازش تنظیمات Trojan Outbound یا یکپارچه‌سازی آن با هسته Xray وجود دارد یا خیر. از زحمات شما برای توسعه این پروژه سپاسگزارم. ### How to reproduce the problem ### Bug Description I have encountered an issue with the Trojan protocol in the outbound configuration of the 3X-UI panel. Whenever I add a Trojan outbound configuration, it does not work as expected. However, the exact same Trojan configuration works correctly in various clients on Android, Windows, and other platforms. I have also tested other outbound protocols in 3X-UI, and they work correctly. VLESS, VMess, and Shadowsocks outbounds all function as expected, but Trojan outbound does not work. ### Steps to Reproduce 1. Add a Trojan outbound configuration to 3X-UI. 2. Use a Trojan configuration that has been verified to work correctly in other clients. 3. Try to use the outbound connection. 4. Observe that the Trojan outbound does not work. ### Expected Behavior The Trojan outbound should work correctly when provided with a valid configuration, just like VLESS, VMess, and Shadowsocks outbounds. ### Actual Behavior The Trojan outbound fails to work, even though the same configuration works correctly in other clients and the other outbound protocols work properly in 3X-UI. ### Additional Information - Trojan outbound: Not working. - VLESS outbound: Working. - VMess outbound: Working. - Shadowsocks outbound: Working. - The Trojan configuration has been verified to work in other clients on Android, Windows, and other platforms. This issue appears to be specific to the handling of Trojan outbound configurations in 3X-UI. Could you please investigate this issue and check whether there is a bug in the Trojan outbound configuration handling or its integration with the Xray core? Thank you for your work on this project. ### توضیحات باگ در بخش تنظیمات Outbound پنل 3X-UI با پروتکل Trojan مشکل دارم. هر بار که یک کانفیگ Trojan به بخش Outbound اضافه می‌کنم، کار نمی‌کند. با این حال، همان کانفیگ دقیق Trojan در کلاینت‌های مختلف اندروید، ویندوز و سایر پلتفرم‌ها به‌درستی کار می‌کند. پروتکل‌های دیگر را نیز در بخش Outbound پنل آزمایش کرده‌ام و همگی به‌درستی کار می‌کنند. کانفیگ‌های VLESS، VMess و Shadowsocks بدون مشکل کار می‌کنند، اما Trojan کار نمی‌کند. ### مراحل بازتولید باگ ۱. یک کانفیگ Trojan به بخش Outbound پنل 3X-UI اضافه کنید. ۲. از کانفیگی استفاده کنید که عملکرد صحیح آن در کلاینت‌های دیگر تأیید شده است. ۳. اتصال Outbound را امتحان کنید. ۴. مشاهده می‌کنید که اتصال Trojan کار نمی‌کند. ### رفتار مورد انتظار Outbound پروتکل Trojan باید با یک کانفیگ معتبر، درست مانند VLESS، VMess و Shadowsocks، به‌درستی کار کند. ### رفتار واقعی Outbound پروتکل Trojan کار نمی‌کند؛ با وجود اینکه همان کانفیگ در کلاینت‌های دیگر به‌درستی کار می‌کند و سایر پروتکل‌های Outbound نیز در پنل 3X-UI بدون مشکل هستند. ### اطلاعات تکمیلی - Trojan: کار نمی‌کند. - VLESS: کار می‌کند. - VMess: کار می‌کند. - Shadowsocks: کار می‌کند. - کانفیگ Trojan در کلاینت‌های اندروید، ویندوز و سایر پلتفرم‌ها آزمایش شده و عملکرد صحیح آن تأیید شده است. به نظر می‌رسد مشکل به نحوه پردازش یا پشتیبانی از تنظیمات Trojan Outbound در پنل 3X-UI مربوط باشد. لطفاً این مشکل را بررسی کنید و مشخص کنید که آیا باگی در پردازش تنظیمات Trojan Outbound یا یکپارچه‌سازی آن با هسته Xray وجود دارد یا خیر. از زحمات شما برای توسعه این پروژه سپاسگزارم. ### Expected behavior _No response_ ### Actual behavior _No response_ ### Relevant logs ```shell ``` ### Screenshots _No response_ ### 3x-ui version dev ### Xray-core version _No response_ ### How did you install 3x-ui? install.sh script ### Operating system ubuntu26 ### Which parts of the panel are affected? _No response_ ### Browser (only if it is a UI bug) _No response_ ### Is the panel behind a reverse proxy or CDN? None ### Before submitting - [x] I searched [existing issues](../issues?q=is%3Aissue) and this bug has not been reported. - [x] I am running the latest released version of 3x-ui (or have verified the bug still exists on it). - [x] This bug report is written in English. - [x] I have redacted any sensitive data (tokens, real domains, client UUIDs).
Author
Owner

@github-actions[bot] commented on GitHub (Oct 26, 2026):

I can't tell yet whether this is a panel bug: the panel writes Trojan outbounds in the shape Xray expects, and the report has no config, logs or error text to check against. Please send the details listed below.

What I checked in the source

  • The outbound form saves Trojan as one server entry, in the standard Xray layout. frontend/src/lib/xray/outbound-form-adapter.ts:722-724:
    function trojanToWire(s: TrojanOutboundFormSettings) {
      return { servers: [{ address: s.address, port: s.port, password: s.password }] };
    }
    
    Trojan also shares the same stream, TLS/REALITY and mux code with VLESS and VMess (outbound-form-adapter.ts:883-884). Since those work for you, a fault in that shared code is unlikely.
  • The trojan:// link importers in the frontend (frontend/src/lib/xray/outbound-link-parser.ts:634-655) and in Go (internal/util/link/outbound.go:340-378) both give the same result. They use security=tls when the link doesn't set it, and type=tcp when no transport is given. So if your link is meant to run without TLS, it must contain security=none.
  • I found no earlier issue that reports this.

Please reply with:

  1. Your exact 3x-ui version. The form says dev. The current release is v3.11.0. Please give the exact version the panel shows.
  2. The Trojan outbound JSON as the panel saved it: Xray Configs → Outbounds → edit → JSON. Redact the password and the real domain, but keep every key, including streamSettings.
  3. The trojan:// link, if you imported it from one. Same redaction, but keep every query parameter (type, security, sni, fp, alpn, host, path, cs, …).
  4. The Xray log lines from the moment a connection through this outbound fails (x-ui log, or Logs in the panel). Text only, please.
  5. The result of the outbound "Test" button for this Trojan outbound, if you used it, with the exact error text.

خلاصه (فارسی): هنوز نمی‌توان گفت که این مشکل از پنل است. پنل خروجی Trojan را در ساختار استاندارد Xray ذخیره می‌کند، و بخش‌های stream/TLS آن همان کدی است که VLESS و VMess شما با آن کار می‌کنند. لطفاً موارد ۱ تا ۵ بالا را به‌صورت متن بفرستید: نسخه دقیق پنل، JSON خروجی Trojan، لینک trojan:// و لاگ Xray. پسورد و دامنه را حذف کنید.

Verdict:        Insufficient information
Severity:       N/A
Confidence:     Medium
Root cause:     None identified. Trojan outbound serialization (outbound-form-adapter.ts:722) and link import (outbound-link-parser.ts:634, internal/util/link/outbound.go:340) produce the standard Xray `servers[]` shape.
Same class:     Not applicable
Already fixed:  Not applicable
Duplicate of:   None
Evidence:       outbound-form-adapter.ts:722-724 (trojanToWire); outbound-form-adapter.ts:883-884 (Trojan shares the mux/stream path with VLESS/VMess); outbound-link-parser.ts:642 and outbound.go:356-358 (security defaults to "tls")
Not determined: Which field of the reporter's outbound differs from their working client config. The saved outbound JSON plus the Xray error line would settle it.

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

<!-- gh-comment-id:6411747772 --> @github-actions[bot] commented on GitHub (Oct 26, 2026): I can't tell yet whether this is a panel bug: the panel writes Trojan outbounds in the shape Xray expects, and the report has no config, logs or error text to check against. Please send the details listed below. **What I checked in the source** - The outbound form saves Trojan as one server entry, in the standard Xray layout. `frontend/src/lib/xray/outbound-form-adapter.ts:722-724`: ```ts function trojanToWire(s: TrojanOutboundFormSettings) { return { servers: [{ address: s.address, port: s.port, password: s.password }] }; } ``` Trojan also shares the same stream, TLS/REALITY and mux code with VLESS and VMess (`outbound-form-adapter.ts:883-884`). Since those work for you, a fault in that shared code is unlikely. - The `trojan://` link importers in the frontend (`frontend/src/lib/xray/outbound-link-parser.ts:634-655`) and in Go (`internal/util/link/outbound.go:340-378`) both give the same result. They use `security=tls` when the link doesn't set it, and `type=tcp` when no transport is given. So if your link is meant to run without TLS, it must contain `security=none`. - I found no earlier issue that reports this. **Please reply with:** 1. **Your exact 3x-ui version.** The form says `dev`. The current release is `v3.11.0`. Please give the exact version the panel shows. 2. **The Trojan outbound JSON** as the panel saved it: Xray Configs → Outbounds → edit → JSON. Redact the password and the real domain, but keep every key, including `streamSettings`. 3. **The `trojan://` link**, if you imported it from one. Same redaction, but keep every query parameter (`type`, `security`, `sni`, `fp`, `alpn`, `host`, `path`, `cs`, …). 4. **The Xray log lines** from the moment a connection through this outbound fails (`x-ui log`, or Logs in the panel). Text only, please. 5. **The result of the outbound "Test" button** for this Trojan outbound, if you used it, with the exact error text. --- **خلاصه (فارسی):** هنوز نمی‌توان گفت که این مشکل از پنل است. پنل خروجی Trojan را در ساختار استاندارد Xray ذخیره می‌کند، و بخش‌های stream/TLS آن همان کدی است که VLESS و VMess شما با آن کار می‌کنند. لطفاً موارد ۱ تا ۵ بالا را به‌صورت متن بفرستید: نسخه دقیق پنل، JSON خروجی Trojan، لینک `trojan://` و لاگ Xray. پسورد و دامنه را حذف کنید. ``` Verdict: Insufficient information Severity: N/A Confidence: Medium Root cause: None identified. Trojan outbound serialization (outbound-form-adapter.ts:722) and link import (outbound-link-parser.ts:634, internal/util/link/outbound.go:340) produce the standard Xray `servers[]` shape. Same class: Not applicable Already fixed: Not applicable Duplicate of: None Evidence: outbound-form-adapter.ts:722-724 (trojanToWire); outbound-form-adapter.ts:883-884 (Trojan shares the mux/stream path with VLESS/VMess); outbound-link-parser.ts:642 and outbound.go:356-358 (security defaults to "tls") Not determined: Which field of the reporter's outbound differs from their working client config. The saved outbound JSON plus the Xray error line would settle it. ``` *This reply was generated automatically; a maintainer may follow up.* <!-- claude-issue:analyst -->
bsakaguchi changed title from [GH-ISSUE #6945] [Bug]: Trojan Outbound Does Not Work While VLESS, VMess, and Shadowsocks Work Correctly / اتصال خروجی (Outbound) پروتکل Trojan کار نمی‌کند، در حالی که VLESS، VMess و Shadowsocks به‌درستی … to [GH-ISSUE #6945] [Bug]: Trojan Outbound Does Not Work While VLESS, VMess, and Shadowsocks Work Correctly / اتصال خروجی (Outbound) پروتکل Trojan کار نمی‌کند، در حالی که VLESS، VMess و Shadowsocks به‌درستی … 2026-11-07 20:38:21 +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#4594
No description provided.