Feature: move hosts to the top
This commit is contained in:
@ -2,6 +2,7 @@ package executor
|
||||
|
||||
import (
|
||||
"github.com/Dreamacro/clash/component/auth"
|
||||
trie "github.com/Dreamacro/clash/component/domain-trie"
|
||||
"github.com/Dreamacro/clash/config"
|
||||
C "github.com/Dreamacro/clash/constant"
|
||||
"github.com/Dreamacro/clash/dns"
|
||||
@ -30,6 +31,7 @@ func ApplyConfig(cfg *config.Config, force bool) {
|
||||
updateProxies(cfg.Proxies)
|
||||
updateRules(cfg.Rules)
|
||||
updateDNS(cfg.DNS)
|
||||
updateHosts(cfg.Hosts)
|
||||
updateExperimental(cfg.Experimental)
|
||||
}
|
||||
|
||||
@ -68,7 +70,6 @@ func updateDNS(c *config.DNS) {
|
||||
Main: c.NameServer,
|
||||
Fallback: c.Fallback,
|
||||
IPv6: c.IPv6,
|
||||
Hosts: c.Hosts,
|
||||
EnhancedMode: c.EnhancedMode,
|
||||
Pool: c.FakeIPRange,
|
||||
})
|
||||
@ -83,6 +84,10 @@ func updateDNS(c *config.DNS) {
|
||||
}
|
||||
}
|
||||
|
||||
func updateHosts(tree *trie.Trie) {
|
||||
dns.DefaultHosts = tree
|
||||
}
|
||||
|
||||
func updateProxies(proxies map[string]C.Proxy) {
|
||||
tunnel := T.Instance()
|
||||
oldProxies := tunnel.Proxies()
|
||||
|
Reference in New Issue
Block a user