mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 19:11:53 +07:00
[PR #6868] [MERGED] feat(sub): opt-in dns and sniffer from remote Clash rules #6490
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#6490
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/6868
Author: @yelloduxx
Created: 10/18/2026
Status: ✅ Merged
Merged: 10/24/2026
Merged by: @MHSanaei
Base:
main← Head:feat/clash-remote-dns📝 Commits (5)
723b4b8feat(sub): opt-in dns and sniffer from remote Clash rules78b0a2cfeat(settings): add the Clash remote DNS switch89414e6fix(sub): skip a malformed remote dns or sniffer instead of the whole routing5df319edocs(api): sync openapi.json with subClashRemoteDNS97b3f1dtest(frontend): outlast the AntD Form error debounce in component teardown📊 Changes
44 files changed (+355 additions, -46 deletions)
View changed files
📝
docs/public/openapi.json(+8 -0)📝
frontend/public/openapi.json(+8 -0)📝
frontend/src/generated/examples.ts(+2 -0)📝
frontend/src/generated/schemas.ts(+8 -0)📝
frontend/src/generated/types.ts(+2 -0)📝
frontend/src/generated/zod.ts(+2 -0)📝
frontend/src/models/setting.ts(+1 -0)📝
frontend/src/pages/settings/SubscriptionGeneralTab.tsx(+10 -0)📝
frontend/src/schemas/setting.ts(+1 -0)📝
frontend/src/test/setup.components.ts(+6 -0)📝
frontend/src/test/subscription-general-tab.test.tsx(+23 -0)📝
internal/sub/clash_external_shadowsocks_test.go(+1 -1)📝
internal/sub/clash_external_vless_test.go(+1 -1)📝
internal/sub/clash_info_node_test.go(+4 -4)➕
internal/sub/clash_remote_dns_test.go(+162 -0)📝
internal/sub/clash_service.go(+45 -19)📝
internal/sub/clash_service_test.go(+1 -1)📝
internal/sub/controller.go(+6 -1)📝
internal/sub/external_config_test.go(+1 -1)📝
internal/sub/external_only_sub_test.go(+1 -1)...and 24 more files
📄 Description
Summary
Adds a "Use DNS from remote rules" switch (
subClashRemoteDNS, off by default) to Settings → Subscription → Clash / Mihomo. When the global routing rules field holds a URL and the switch is on, the panel also takes thednsandsniffersections from the remote document.Why
Public Mihomo templates such as roscomvpn ship
rules,rule-providersandproxy-groupstogether with adnsblock that those rules depend on (fake-ip ranges, nameserver policy, fallback filters). Pasting the template inline keeps itsdns, becausemergeClashRulesYAMLcopies every key. Pointing the field at the template URL drops it, becausemergeRemoteClashRulesonly accepts the route-graph keys. The generated subscription then has nodnssection, and clients fall back to their built-in resolvers. A URL is the form that stays current without editing the panel, so admins who want the template's DNS today have to give up auto-refresh.The switch is opt-in because a remote
dnsblock controls where clients send every lookup. It should come only from a source the admin trusts.Refs #6363, #6671 (other requests to take more from the remote Clash source).
Type of change
Areas affected
How was this tested?
go build ./...,go vet ./...,go test ./internal/sub/... ./internal/web/....internal/sub/clash_remote_dns_test.go:dns/snifferare ignored, as before;dnsorsnifferis skipped, and the remote routing still applies;dnsand no rules, groups or providers is still rejected when fetched;TestClashSubscriptionRemoteDNSFollowsSettingbuilds a full Clash subscription through the controller and checks thednssection follows the setting.setting_clash_test.gocovers the default and the getter.subscription-general-tab.test.tsxcovers the switch.npm run gen(no diff afterwards),npm run lint,npm run typecheck,npm run build,npx vitest(unit and components).https://raw.githubusercontent.com/hydraponique/roscomvpn-routing/main/MIHOMO/default.yamland turned the switch on. The Clash subscription then carried the template'sdnsandsniffersections, the generated proxies and allRULE-SETrules.Screenshots / recordings
The new switch under the routing rules field (en-US):
Breaking changes
None. The switch defaults to off, and the subscription output is unchanged until an admin turns it on. A malformed remote
dnsorsnifferis skipped rather than rejected, so it never costs a template its routing.Checklist
go build ./...and the test suite pass locally.npm run lint,npm run typecheck, andnpm run buildpass.🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.