diff --git a/README.md b/README.md index ea56287c..60917f46 100644 --- a/README.md +++ b/README.md @@ -100,15 +100,15 @@ external-controller: 127.0.0.1:9090 # secret: "" dns: - enable: true # set true to enable dns - ipv6: false # default is false - listen: 0.0.0.0:53 - enhanced-mode: redir-host - nameserver: - - 114.114.114.114 - - tls://dns.rubyfish.cn:853 # dns over tls - fallback: # concurrent request with nameserver, fallback used when GEOIP country isn't CN - - 8.8.8.8 + # enable: true # set true to enable dns (default is false) + # ipv6: false # default is false + # listen: 0.0.0.0:53 + # enhanced-mode: redir-host + # nameserver: + # - 114.114.114.114 + # - tls://dns.rubyfish.cn:853 # dns over tls + # fallback: # concurrent request with nameserver, fallback used when GEOIP country isn't CN + # - 8.8.8.8 Proxy: diff --git a/config/config.go b/config/config.go index 775f9497..f2ac2dbb 100644 --- a/config/config.go +++ b/config/config.go @@ -95,6 +95,9 @@ func readConfig(path string) (*rawConfig, error) { Rule: []string{}, Proxy: []map[string]interface{}{}, ProxyGroup: []map[string]interface{}{}, + DNS: &rawDNS{ + Enable: false, + }, } err = yaml.Unmarshal([]byte(data), &rawConfig) return rawConfig, err diff --git a/dns/client.go b/dns/client.go index 162f1640..b443c5c0 100644 --- a/dns/client.go +++ b/dns/client.go @@ -250,6 +250,8 @@ func New(config Config) *Resolver { mmdb, _ = geoip2.Open(C.Path.MMDB()) }) + println(config.EnhancedMode) + r := &Resolver{ main: transform(config.Main), ipv6: config.IPv6, diff --git a/dns/util.go b/dns/util.go index c64e4978..4102a584 100644 --- a/dns/util.go +++ b/dns/util.go @@ -15,13 +15,15 @@ import ( var ( // EnhancedModeMapping is a mapping for EnhancedMode enum EnhancedModeMapping = map[string]EnhancedMode{ + NORMAL.String(): NORMAL, FAKEIP.String(): FAKEIP, MAPPING.String(): MAPPING, } ) const ( - FAKEIP EnhancedMode = iota + NORMAL EnhancedMode = iota + FAKEIP MAPPING ) @@ -65,6 +67,8 @@ func (e EnhancedMode) MarshalJSON() ([]byte, error) { func (e EnhancedMode) String() string { switch e { + case NORMAL: + return "normal" case FAKEIP: return "fakeip" case MAPPING: