mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 19:11:53 +07:00
[PR #6519] [MERGED] fix(xray): migrate the dns outbound off its legacy nonIPQuery and blockTypes #6326
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#6326
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/6519
Author: @BlindMaster24
Created: 9/14/2026
Status: ✅ Merged
Merged: 9/14/2026
Merged by: @MHSanaei
Base:
main← Head:fix/dns-outbound-legacy-keys📝 Commits (2)
f99bf6afix(xray): migrate the dns outbound off its legacy nonIPQuery and blockTypesad1b899fix(xray): read a dns outbound's null keys and protocol id like the core📊 Changes
2 files changed (+531 additions, -1 deletions)
View changed files
📝
internal/database/db.go(+156 -1)➕
internal/database/dns_outbound_legacy_keys_migration_test.go(+375 -0)📄 Description
Summary
A one-shot seeder (
DNSOutboundLegacyKeysFix) that converts a storeddnsoutbound's legacynonIPQuery/blockTypesinto therulesthe pinned core reads, then drops both keys. The conversion reproduces the core's own legacy builder, in its order: the blocked qTypes, then thehijackfor qType 1/28, then the mode's answer for everything else.Why
xray-coretreats these two keys as removed, and last release they are worse than deprecated — they are a start failure when mixed with rules:The panel is what put them there. The dns outbound card in the Vue panel wrote both keys with defaults on every save —
web/assets/js/model/outbound.jsjust beforea62c6376:so a panel that ever created a dns outbound carries
nonIPQuerywhether or not the operator ever touched that field.a62c6376replaced the card withrulesand kept a read-time conversion; the React rewrite (#4599) dropped that conversion, so on today's panel the legacy policy is not shown in the card and is silently deleted the next time that outbound is saved.Three user-visible shapes of this:
rulesnever starts the core at all (the error above). The seeder keeps the rules and drops the legacy keys, which is the only combination the core accepts.Verified against the vendored core without this change (probe swept across all 55 golden fixtures, the default template and each outbound shape):
While auditing the pinned core for a key it warns about or refuses that the panel still writes, this was the last unhandled one:
freedom.domainStrategyis fixed separately (#6515), andfreedom.ipsBlockedis already handled by theFreedomFinalRulesReverseFixseeder. Everything else the core prints is a feature notice (VMess/Trojan/shadowsocks/WS/gRPC), not a key the panel should stop writing.Type of change
Areas affected
How was this tested?
go test ./internal/database/ -run 'DNSOutboundLegacyKeys|RewriteDNSOutboundLegacyKeys' -vblockTypesas a list, a bare number and a comma-separated string, a missing mode defaulting to reject as the core does, existingruleswinning over the legacy pair, a dns outbound already on rules untouched, and a non-dns outbound with the same key names untouched.xray.ValidateOutboundConfig, withcommon/logcaptured viaRegisterHandler): the legacy outbound loads with the deprecation warning, the mixed one is refused, and after the rewrite both load with no warning and no error — so the fix is measured on the core's own verdict rather than on the panel's JSON.changed=false.runSeeders(false)list to prove the history gate stops a second rewrite of a hand-edited template.Local note, same as the rest of this package's DB tests: this checkout has no C compiler, so Go was exercised with
CGO_ENABLED=0plus an-overlaythat stubs the one cgo-only call (sqlite3.SQLiteConn.Backup) — no file in this PR is replaced. The DB-path test self-skips in that build (sqlite needs cgo) and is the one that runs on CI.Screenshots / recordings
N/A — no UI change.
Breaking changes
None. The seeder runs before the config is generated, and the rules it writes express the same policy the core used to derive from the legacy keys, so a converted outbound behaves as it did. Operators who never had a dns outbound are untouched.
Checklist
go build ./...and the test suite pass locally. (no C compiler here — see the note above; CI runs the cgo path)npm run lint,npm run typecheck, andnpm run buildpass.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.