From 2fa07be5f38aaec9d0970c0304040abd55417bb5 Mon Sep 17 00:00:00 2001 From: problematicconsumer Date: Mon, 1 Jan 2024 18:52:00 +0330 Subject: [PATCH] Add dns routing option --- shared/config.go | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/shared/config.go b/shared/config.go index ebafe3f..787fcc3 100644 --- a/shared/config.go +++ b/shared/config.go @@ -36,6 +36,7 @@ type ConfigOptions struct { SetSystemProxy bool `json:"set-system-proxy"` BypassLAN bool `json:"bypass-lan"` EnableFakeDNS bool `json:"enable-fake-dns"` + EnableDNSRouting bool `json:"enable-dns-routing"` IndependentDNSCache bool `json:"independent-dns-cache"` GeoIPPath string `json:"geoip-path"` GeoSitePath string `json:"geosite-path"` @@ -327,15 +328,17 @@ func BuildConfig(configOpt ConfigOptions, input option.Options) option.Options { dnsRules = append(dnsRules, dnsRule) } - for _, dnsRule := range dnsRules { - if dnsRule.IsValid() { - options.DNS.Rules = append( - options.DNS.Rules, - option.DNSRule{ - Type: C.RuleTypeDefault, - DefaultOptions: dnsRule, - }, - ) + if configOpt.EnableDNSRouting { + for _, dnsRule := range dnsRules { + if dnsRule.IsValid() { + options.DNS.Rules = append( + options.DNS.Rules, + option.DNSRule{ + Type: C.RuleTypeDefault, + DefaultOptions: dnsRule, + }, + ) + } } }