Merge from remote branch

This commit is contained in:
yaling888
2021-09-01 00:38:43 +08:00
38 changed files with 583 additions and 272 deletions

View File

@ -73,9 +73,10 @@ type DNS struct {
// FallbackFilter config
type FallbackFilter struct {
GeoIP bool `yaml:"geoip"`
IPCIDR []*net.IPNet `yaml:"ipcidr"`
Domain []string `yaml:"domain"`
GeoIP bool `yaml:"geoip"`
GeoIPCode string `yaml:"geoip-code"`
IPCIDR []*net.IPNet `yaml:"ipcidr"`
Domain []string `yaml:"domain"`
}
// Profile config
@ -124,9 +125,10 @@ type RawDNS struct {
}
type RawFallbackFilter struct {
GeoIP bool `yaml:"geoip"`
IPCIDR []string `yaml:"ipcidr"`
Domain []string `yaml:"domain"`
GeoIP bool `yaml:"geoip"`
GeoIPCode string `yaml:"geoip-code"`
IPCIDR []string `yaml:"ipcidr"`
Domain []string `yaml:"domain"`
}
type RawConfig struct {
@ -190,8 +192,9 @@ func UnmarshalRawConfig(buf []byte) (*RawConfig, error) {
UseHosts: true,
FakeIPRange: "198.18.0.1/16",
FallbackFilter: RawFallbackFilter{
GeoIP: true,
IPCIDR: []string{},
GeoIP: true,
GeoIPCode: "CN",
IPCIDR: []string{},
},
DefaultNameserver: []string{
"114.114.114.114",
@ -621,6 +624,7 @@ func parseDNS(cfg RawDNS, hosts *trie.DomainTrie) (*DNS, error) {
}
dnsCfg.FallbackFilter.GeoIP = cfg.FallbackFilter.GeoIP
dnsCfg.FallbackFilter.GeoIPCode = cfg.FallbackFilter.GeoIPCode
if fallbackip, err := parseFallbackIPCIDR(cfg.FallbackFilter.IPCIDR); err == nil {
dnsCfg.FallbackFilter.IPCIDR = fallbackip
}