mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 19:11:53 +07:00
[PR #5950] [MERGED] fix: stop forcing port 53 on DoH/DoQ DNS server entries #6038
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#6038
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/5950
Author: @mvanhorn
Created: 7/14/2026
Status: ✅ Merged
Merged: 7/14/2026
Merged by: @MHSanaei
Base:
main← Head:fix/5920-doh-doq-port📝 Commits (1)
8413059fix: stop forcing port 53 on DoH/DoQ DNS server entries📊 Changes
4 files changed (+55 additions, -4 deletions)
View changed files
📝
frontend/src/pages/xray/dns/DnsServerModal.tsx(+2 -1)📝
frontend/src/schemas/dns.ts(+11 -2)📝
frontend/src/test/__snapshots__/dns.test.ts.snap(+0 -1)📝
frontend/src/test/dns.test.ts(+42 -0)📄 Description
Summary
Stop the panel from writing
port: 53onto DNS-over-HTTPS / DoH-Local / DoQ server entries in the Preset DNS editor. Those encrypted schemes carry any non-standard port inside the URL, so a separateportfield is invalid for them.Why
As reported in #5920, DoH preset entries were being saved with
port: 53. Two frontend paths injected it:DnsServerObjectInnerSchemainfrontend/src/schemas/dns.tsdeclaredport: PortSchema.default(53), so every object-form entry gotport: 53even when the source JSON omitted a port. The repo's own golden fixture makes this visible: thequic+local://DoQ entry infull.jsonhas no port, yet the parsed snapshot showedport: 53.valuesToWireinDnsServerModal.tsxalways setout.port = values.portwhenever an entry was emitted in object form, addingport: 53to DoH/DoQ rows edited in the modal.Xray-core treats
https,https+local,h2c,h2c+localandquic+localas encrypted DNS transports and rejects a standalone port for them; the port belongs in the URL. The two paths above never accounted for the address scheme.Closes #5920
Type of change
Areas affected
How was this tested?
A shared
isEncryptedDnsAddresshelper now backs both paths. The Zod schema defaultsportto 53 only for non-encrypted addresses and omits it for the encrypted schemes; the modal'svaluesToWireskips the port assignment for the same set. Schemes are matched case-insensitively to mirror Xray-core'sEqualFoldcomparison.Added unit tests in
frontend/src/test/dns.test.tscovering: a plain address (8.8.8.8) and atcp://address still default toport: 53;https://,https+local://,h2c://,h2c+local://andquic+local://addresses omit the port; an uppercase scheme is treated the same; and an explicit port on an encrypted address is preserved. Thedns.test.tsgolden snapshot was regenerated so thequic+local://fixture entry no longer showsport: 53.Ran locally in
frontend/:npm run typecheck,npm run lint,npm run test(849 tests pass), andnpm run buildall succeed.Screenshots / recordings
No visible UI layout change; the fix affects the DNS config the panel emits. Behavior is covered by the unit tests and snapshot above.
Breaking changes
None. Non-encrypted DNS entries keep their existing
port: 53default, and explicit ports are always preserved.AI assistance disclosure
AI was used for assistance.
porthandling fix in the two named frontend files plus its tests and snapshot.Checklist
go build ./...and the test suite pass locally. (Frontend-only change; no Go files touched.)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.