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 (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
|
"fmt"
|
||||||
)
|
)
|
||||||
|
|
||||||
// DNSModeMapping is a mapping for EnhancedMode enum
|
// DNSModeMapping is a mapping for EnhancedMode enum
|
||||||
var DNSModeMapping = map[string]DNSMode{
|
var DNSModeMapping = map[string]DNSMode{
|
||||||
DNSNormal.String(): DNSNormal,
|
DNSNormal.String(): DNSNormal,
|
||||||
DNSFakeIP.String(): DNSFakeIP,
|
DNSFakeIP.String(): DNSFakeIP,
|
||||||
DNSMapping.String(): DNSMapping,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -28,7 +28,7 @@ func (e *DNSMode) UnmarshalYAML(unmarshal func(any) error) error {
|
||||||
}
|
}
|
||||||
mode, exist := DNSModeMapping[tp]
|
mode, exist := DNSModeMapping[tp]
|
||||||
if !exist {
|
if !exist {
|
||||||
return errors.New("invalid mode")
|
return fmt.Errorf("invalid mode: %s", tp)
|
||||||
}
|
}
|
||||||
*e = mode
|
*e = mode
|
||||||
return nil
|
return nil
|
||||||
|
|
|
@ -87,9 +87,15 @@ func withMapping(mapping *cache.LruCache) middleware {
|
||||||
case *D.A:
|
case *D.A:
|
||||||
ip = a.A
|
ip = a.A
|
||||||
ttl = a.Hdr.Ttl
|
ttl = a.Hdr.Ttl
|
||||||
|
if !ip.IsGlobalUnicast() {
|
||||||
|
continue
|
||||||
|
}
|
||||||
case *D.AAAA:
|
case *D.AAAA:
|
||||||
ip = a.AAAA
|
ip = a.AAAA
|
||||||
ttl = a.Hdr.Ttl
|
ttl = a.Hdr.Ttl
|
||||||
|
if !ip.IsGlobalUnicast() {
|
||||||
|
continue
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
@ -181,9 +187,6 @@ func newHandler(resolver *Resolver, mapper *ResolverEnhancer) handler {
|
||||||
|
|
||||||
if mapper.mode == C.DNSFakeIP {
|
if mapper.mode == C.DNSFakeIP {
|
||||||
middlewares = append(middlewares, withFakeIP(mapper.fakePool))
|
middlewares = append(middlewares, withFakeIP(mapper.fakePool))
|
||||||
}
|
|
||||||
|
|
||||||
if mapper.mode != C.DNSNormal {
|
|
||||||
middlewares = append(middlewares, withMapping(mapper.mapping))
|
middlewares = append(middlewares, withMapping(mapper.mapping))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -133,11 +133,6 @@ func updateDNS(c *config.DNS) {
|
||||||
Policy: c.NameServerPolicy,
|
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)
|
r := dns.NewResolver(cfg)
|
||||||
m := dns.NewEnhancer(cfg)
|
m := dns.NewEnhancer(cfg)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue