[PR #6825] [CLOSED] feat(sub): export tls cipher suites as cs query param in share links #6467

Closed
opened 2026-11-02 04:08:59 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/MHSanaei/3x-ui/pull/6825
Author: @rqzbeh
Created: 10/14/2026
Status: ❌ Closed

Base: main ← Head: feat/sub-cipher-suites


📝 Commits (1)

  • dbdc1fc feat(sub): export tls cipher suites as cs query param in share links

📊 Changes

10 files changed (+125 additions, -5 deletions)

View changed files

📝 frontend/src/lib/hosts/host-link.ts (+2 -0)
📝 frontend/src/lib/xray/inbound-link.ts (+13 -0)
📝 frontend/src/pages/hosts/HostFormModal.tsx (+6 -1)
📝 frontend/src/schemas/protocols/stream/external-proxy.ts (+1 -0)
📝 frontend/src/test/host-link.test.ts (+2 -0)
📝 frontend/src/test/inbound-link.test.ts (+27 -0)
📝 internal/sub/service.go (+25 -2)
📝 internal/sub/service_test.go (+29 -0)
📝 internal/util/link/outbound.go (+5 -0)
📝 internal/util/link/outbound_helpers_test.go (+15 -2)

📄 Description

Summary

Exports custom TLS cipherSuites configured on inbounds or host overrides as the standard cs query parameter in VLESS, Trojan, and VMess share links, and parses cs back to cipherSuites when importing links. In the panel UI, the cipher suites field is dynamically disabled when uTLS fingerprint is set to a browser to match client behavior.

Why

When custom TLS cipher suites are configured on inbounds or host overrides (e.g. for DPI/censorship evasion and TLS fingerprint customization), 3x-ui included them in JSON subscriptions but omitted them from standard share links (vless://, trojan://, vmess://). Clients such as v2rayNG, Sing-box, and NekoBox, as well as configuration collectors, expect the cs= parameter to configure custom cipher suites. Additionally, in uTLS, cipher suites only take effect when fingerprint is set to unsafe or none; the UI now disables cipher suite selection when a browser fingerprint is chosen.

Type of change

  • Bug fix
  • New feature
  • Refactoring (no behavior change)
  • Documentation
  • Tests only
  • Build / CI / tooling
  • Other

Areas affected

  • Frontend (UI / panel pages)
  • Backend (API endpoints, login, settings)
  • Xray config generation
  • Subscription (share links / Clash / JSON)
  • Statistics / traffic counters
  • Database / migrations
  • Install / upgrade script
  • Docker image
  • Multi-node (sub-nodes)
  • Telegram bot

How was this tested?

  1. Backend Tests: Added unit tests in internal/sub/service_test.go and internal/util/link/outbound_helpers_test.go verifying:
    • applyShareTLSParams sets params["cs"] from tlsSettings["cipherSuites"].
    • applyExternalProxyTLSParams sets params["cs"] from host overrides.
    • ParseLink decodes cs= back to tlsSettings["cipherSuites"].
      Ran go test -v ./internal/sub/... ./internal/util/link/... (all 1093 tests pass).
  2. Frontend Tests: Added unit tests in frontend/src/test/inbound-link.test.ts and frontend/src/test/host-link.test.ts verifying that genVlessLink and hostToExternalProxyEntry export and carry cs. Ran npx vitest run src/test/inbound-link.test.ts src/test/host-link.test.ts (all 84 tests pass).
  3. Docker E2E Test: Built full Docker image 3x-ui:test from scratch, ran container, added TLS inbound with custom cipherSuites and host override, and verified that generated share links include cs=TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256.

Screenshots / recordings

N/A

Breaking changes

None.

Checklist

  • I tested the change locally and confirmed the described behavior.
  • I added or updated tests for the new behavior (when applicable).
  • go build ./... and the test suite pass locally.
  • For frontend changes: npm run lint, npm run typecheck, and npm run build pass.
  • I updated the Wiki / README / API docs if user-facing behavior changed.
  • My commits follow the project's existing message style.
  • I have no unrelated changes mixed into this PR.

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/MHSanaei/3x-ui/pull/6825 **Author:** [@rqzbeh](https://github.com/rqzbeh) **Created:** 10/14/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `feat/sub-cipher-suites` --- ### 📝 Commits (1) - [`dbdc1fc`](https://github.com/MHSanaei/3x-ui/commit/dbdc1fc118129cc655a0424ffc5cfda37df38cf5) feat(sub): export tls cipher suites as cs query param in share links ### 📊 Changes **10 files changed** (+125 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `frontend/src/lib/hosts/host-link.ts` (+2 -0) 📝 `frontend/src/lib/xray/inbound-link.ts` (+13 -0) 📝 `frontend/src/pages/hosts/HostFormModal.tsx` (+6 -1) 📝 `frontend/src/schemas/protocols/stream/external-proxy.ts` (+1 -0) 📝 `frontend/src/test/host-link.test.ts` (+2 -0) 📝 `frontend/src/test/inbound-link.test.ts` (+27 -0) 📝 `internal/sub/service.go` (+25 -2) 📝 `internal/sub/service_test.go` (+29 -0) 📝 `internal/util/link/outbound.go` (+5 -0) 📝 `internal/util/link/outbound_helpers_test.go` (+15 -2) </details> ### 📄 Description ## Summary Exports custom TLS `cipherSuites` configured on inbounds or host overrides as the standard `cs` query parameter in VLESS, Trojan, and VMess share links, and parses `cs` back to `cipherSuites` when importing links. In the panel UI, the cipher suites field is dynamically disabled when uTLS fingerprint is set to a browser to match client behavior. ## Why When custom TLS cipher suites are configured on inbounds or host overrides (e.g. for DPI/censorship evasion and TLS fingerprint customization), 3x-ui included them in JSON subscriptions but omitted them from standard share links (`vless://`, `trojan://`, `vmess://`). Clients such as v2rayNG, Sing-box, and NekoBox, as well as configuration collectors, expect the `cs=` parameter to configure custom cipher suites. Additionally, in uTLS, cipher suites only take effect when fingerprint is set to `unsafe` or none; the UI now disables cipher suite selection when a browser fingerprint is chosen. ## Type of change - [x] Bug fix - [x] New feature - [ ] Refactoring (no behavior change) - [ ] Documentation - [ ] Tests only - [ ] Build / CI / tooling - [ ] Other ## Areas affected - [x] Frontend (UI / panel pages) - [ ] Backend (API endpoints, login, settings) - [ ] Xray config generation - [x] Subscription (share links / Clash / JSON) - [ ] Statistics / traffic counters - [ ] Database / migrations - [ ] Install / upgrade script - [ ] Docker image - [ ] Multi-node (sub-nodes) - [ ] Telegram bot ## How was this tested? 1. **Backend Tests**: Added unit tests in `internal/sub/service_test.go` and `internal/util/link/outbound_helpers_test.go` verifying: - `applyShareTLSParams` sets `params["cs"]` from `tlsSettings["cipherSuites"]`. - `applyExternalProxyTLSParams` sets `params["cs"]` from host overrides. - `ParseLink` decodes `cs=` back to `tlsSettings["cipherSuites"]`. Ran `go test -v ./internal/sub/... ./internal/util/link/...` (all 1093 tests pass). 2. **Frontend Tests**: Added unit tests in `frontend/src/test/inbound-link.test.ts` and `frontend/src/test/host-link.test.ts` verifying that `genVlessLink` and `hostToExternalProxyEntry` export and carry `cs`. Ran `npx vitest run src/test/inbound-link.test.ts src/test/host-link.test.ts` (all 84 tests pass). 3. **Docker E2E Test**: Built full Docker image `3x-ui:test` from scratch, ran container, added TLS inbound with custom `cipherSuites` and host override, and verified that generated share links include `cs=TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256`. ## Screenshots / recordings N/A ## Breaking changes None. ## Checklist - [x] I tested the change locally and confirmed the described behavior. - [x] I added or updated tests for the new behavior (when applicable). - [x] `go build ./...` and the test suite pass locally. - [x] For frontend changes: `npm run lint`, `npm run typecheck`, and `npm run build` pass. - [x] I updated the Wiki / README / API docs if user-facing behavior changed. - [x] My commits follow the project's existing message style. - [x] I have no unrelated changes mixed into this PR. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-02 04:08:59 +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#6467
No description provided.