mirror of https://github.com/Dreamacro/clash.git
Change: remove `redir-host` as config
This commit is contained in:
parent
81b1e9f931
commit
9af6d498e7
|
@ -3,13 +3,13 @@ package constant
|
|||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// DNSModeMapping is a mapping for EnhancedMode enum
|
||||
var DNSModeMapping = map[string]DNSMode{
|
||||
DNSNormal.String(): DNSNormal,
|
||||
DNSFakeIP.String(): DNSFakeIP,
|
||||
DNSMapping.String(): DNSMapping,
|
||||
}
|
||||
|
||||
const (
|
||||
|
@ -28,7 +28,7 @@ func (e *DNSMode) UnmarshalYAML(unmarshal func(any) error) error {
|
|||
}
|
||||
mode, exist := DNSModeMapping[tp]
|
||||
if !exist {
|
||||
return errors.New("invalid mode")
|
||||
return fmt.Errorf("invalid mode: %s", tp)
|
||||
}
|
||||
*e = mode
|
||||
return nil
|
||||
|
|
|
@ -87,9 +87,15 @@ func withMapping(mapping *cache.LruCache) middleware {
|
|||
case *D.A:
|
||||
ip = a.A
|
||||
ttl = a.Hdr.Ttl
|
||||
if !ip.IsGlobalUnicast() {
|
||||
continue
|
||||
}
|
||||
case *D.AAAA:
|
||||
ip = a.AAAA
|
||||
ttl = a.Hdr.Ttl
|
||||
if !ip.IsGlobalUnicast() {
|
||||
continue
|
||||
}
|
||||
default:
|
||||
continue
|
||||
}
|
||||
|
@ -181,9 +187,6 @@ func newHandler(resolver *Resolver, mapper *ResolverEnhancer) handler {
|
|||
|
||||
if mapper.mode == C.DNSFakeIP {
|
||||
middlewares = append(middlewares, withFakeIP(mapper.fakePool))
|
||||
}
|
||||
|
||||
if mapper.mode != C.DNSNormal {
|
||||
middlewares = append(middlewares, withMapping(mapper.mapping))
|
||||
}
|
||||
|
||||
|
|
|
@ -133,11 +133,6 @@ func updateDNS(c *config.DNS) {
|
|||
Policy: c.NameServerPolicy,
|
||||
}
|
||||
|
||||
// deprecated warnning
|
||||
if cfg.EnhancedMode == C.DNSMapping {
|
||||
log.Warnln("[DNS] %s is deprecated, please use %s instead", cfg.EnhancedMode.String(), C.DNSFakeIP.String())
|
||||
}
|
||||
|
||||
r := dns.NewResolver(cfg)
|
||||
m := dns.NewEnhancer(cfg)
|
||||
|
||||
|
|
Loading…
Reference in New Issue