feat: add fake-ip-filter-mode in dns

https://github.com/MetaCubeX/mihomo/issues/1479
This commit is contained in:
wwqgtxx
2024-08-31 09:59:48 +08:00
parent 08ac9a3fae
commit f6164ac195
5 changed files with 100 additions and 1 deletions

View File

@@ -205,6 +205,7 @@ type RawDNS struct {
EnhancedMode C.DNSMode `yaml:"enhanced-mode" json:"enhanced-mode"`
FakeIPRange string `yaml:"fake-ip-range" json:"fake-ip-range"`
FakeIPFilter []string `yaml:"fake-ip-filter" json:"fake-ip-filter"`
FakeIPFilterMode C.FilterMode `yaml:"fake-ip-filter-mode" json:"fake-ip-filter-mode"`
DefaultNameserver []string `yaml:"default-nameserver" json:"default-nameserver"`
CacheAlgorithm string `yaml:"cache-algorithm" json:"cache-algorithm"`
NameServerPolicy *orderedmap.OrderedMap[string, any] `yaml:"nameserver-policy" json:"nameserver-policy"`
@@ -474,6 +475,7 @@ func DefaultRawConfig() *RawConfig {
"www.msftnsci.com",
"www.msftconnecttest.com",
},
FakeIPFilterMode: C.FilterBlackList,
},
NTP: RawNTP{
Enable: false,
@@ -1458,6 +1460,7 @@ func parseDNS(rawCfg *RawConfig, hosts *trie.DomainTrie[resolver.HostValue], rul
IPNet: fakeIPRange,
Size: 1000,
Host: host,
Mode: cfg.FakeIPFilterMode,
Persistence: rawCfg.Profile.StoreFakeIP,
})
if err != nil {