feat(sub): opt-in dns and sniffer from remote Clash rules (#6868)

Public Mihomo templates ship rules, rule-providers and proxy-groups together
with a dns block those rules depend on (fake-ip ranges, nameserver policy).
Pasting a template inline keeps its dns, but pointing the global routing rules
at its URL dropped it, so URL users had to give up auto-refresh to keep it.

A new switch, subClashRemoteDNS (off by default), also takes the remote dns and
sniffer maps. It is opt-in because a remote dns block decides where clients send
every lookup. A malformed dns or sniffer value is skipped, not the whole template.
The component-test teardown now outlasts AntD Form's 10ms error debounce, which
otherwise fired after jsdom was gone.
This commit is contained in:
Duxxie
2026-10-24 05:21:04 +03:00
committed by GitHub
parent 3acdfd9dea
commit c3394fefed
44 changed files with 355 additions and 46 deletions
+4 -4
View File
@@ -56,7 +56,7 @@ func TestSubClash_InfoNode_Active(t *testing.T) {
sub := NewSubService("{{EMAIL}}|📊{{TRAFFIC_LEFT}}")
sub.subInfoNodeEnable = true
clash := NewSubClashService(false, "", sub)
clash := NewSubClashService(false, "", false, sub)
out, _, err := clash.GetClash("sub-clash", "sub.example.com")
if err != nil {
@@ -115,7 +115,7 @@ func TestSubClash_InfoNode_Expired(t *testing.T) {
sub := NewSubService("{{INBOUND}}")
sub.subInfoNodeEnable = true
sub.subExpiredTemplate = service.DefaultSubExpiredTemplate
clash := NewSubClashService(false, "", sub)
clash := NewSubClashService(false, "", false, sub)
out, _, err := clash.GetClash("sub-clash-exp", "sub.example.com")
if err != nil {
@@ -178,7 +178,7 @@ func TestSubClash_InfoNode_Depleted(t *testing.T) {
sub := NewSubService("{{INBOUND}}")
sub.subInfoNodeEnable = true
sub.subTrafficDepletedTemplate = service.DefaultSubTrafficDepletedTemplate
clash := NewSubClashService(false, "", sub)
clash := NewSubClashService(false, "", false, sub)
out, _, err := clash.GetClash("sub-clash-dep", "sub.example.com")
if err != nil {
@@ -225,7 +225,7 @@ func TestSubClash_InfoNode_ProxyGroupOrder_DoesNotDefaultToDummy(t *testing.T) {
sub := NewSubService("{{EMAIL}}|📊{{TRAFFIC_LEFT}}|{{STATUS}}")
sub.subInfoNodeEnable = true
clash := NewSubClashService(false, "", sub)
clash := NewSubClashService(false, "", false, sub)
out, _, err := clash.GetClash("sub-clash", "sub.example.com")
if err != nil {