mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 19:11:53 +07:00
[PR #6781] [MERGED] fix(sub): default VLESS client encryption to none when the inbound has none stored #6451
Labels
No labels
backlog
bug
clarification needed
documentation
duplicate
enhancement
github_actions
good first issue
invalid
javascript
New Feature
PR welcomed
pull-request
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
MHSanaei/3x-ui#6451
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/MHSanaei/3x-ui/pull/6781
Author: @jayhemnani9910
Created: 10/10/2026
Status: ✅ Merged
Merged: 10/12/2026
Merged by: @MHSanaei
Base:
main← Head:fix/sub-vless-default-encryption📝 Commits (3)
c890ff8fix(sub): default VLESS client encryption to none when the inbound has none storede4a97c2Merge branch 'main' into fix/sub-vless-default-encryption96d0ee7Merge branch 'main' into fix/sub-vless-default-encryption📊 Changes
3 files changed (+44 additions, -9 deletions)
View changed files
📝
internal/sub/json_service.go(+1 -5)📝
internal/sub/json_service_test.go(+33 -0)📝
internal/sub/service.go(+10 -4)📄 Description
Summary
A VLESS inbound whose settings have no
encryptionkey gets"encryption": ""in every JSON subscription outbound, and Xray refuses to load that config. This treats a missing or empty value asnonein the JSON outbound and in the share link.Why
The
encryptionkey is not always stored. An inbound added throughPOST /panel/api/inbounds/addwith the body from the API docs ("decryption": "none"only,endpoints.ts:70) does not have it, and neither do VLESS inbounds saved by older panels that were never re-saved.For those inbounds:
genVlesscopies the empty value (internal/sub/json_service.go:878-884on main). Xray-core 26.9.30 then fails withinfra/conf: VLESS users: please add/set "encryption":"none" for every user.Every VLESS entry in the JSON subscription is unusable. VMess, Trojan and Shadowsocks entries in the same subscription load fine.
genVlessLinkleaves theencryptionparameter out (internal/sub/service.go:1229on main).The frontend schema already defaults this field to
none(frontend/src/schemas/protocols/inbound/vless.ts,encryption: z.string().min(1).default('none')), and so does the docs generator (docs/lib/xray/outbounds.ts:152). The Go subscription code was the only path that did not. The fix adds one small helper,vlessClientEncryption, and both Go paths use it. A real vlessenc value is passed through unchanged.Type of change
Areas affected
How was this tested?
TestSubVlessEncryptionDefaultsToNone(internal/sub/json_service_test.go) covers three settings: key missing, key empty, and a vlessenc value. It checks both the JSON outbound and the share link. Without the fix it fails:json outbound encryption = "", want "none". With the fix it passes.go test -shuffle=on -count=1 ./...: 49 packages ok, same as on main.golangci-lint run ./internal/sub/: 0 issues.encryption, then fetched the JSON subscription and ranxray run -test -con each config. Before the fix all three VLESS configs failed with the error above. After it, all 8 configs in the subscription printConfiguration OK. The httpupgrade config, used without edits, connected through the server.Breaking changes
None. Inbounds that store
encryptiongive the same output as before.Checklist
go build ./...and the test suite pass locally.npm run lint,npm run typecheck, andnpm run buildpass. (no frontend changes)🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.