Fix: mapping dns should not stale
This commit is contained in:
parent
40bbd3dfdb
commit
c1d027d6d1
@ -78,7 +78,7 @@ func NewEnhancer(cfg Config) *ResolverEnhancer {
|
|||||||
|
|
||||||
if cfg.EnhancedMode != C.DNSNormal {
|
if cfg.EnhancedMode != C.DNSNormal {
|
||||||
fakePool = cfg.Pool
|
fakePool = cfg.Pool
|
||||||
mapping = cache.New(cache.WithSize(4096), cache.WithStale(true))
|
mapping = cache.New(cache.WithSize(4096))
|
||||||
}
|
}
|
||||||
|
|
||||||
return &ResolverEnhancer{
|
return &ResolverEnhancer{
|
||||||
|
@ -100,6 +100,9 @@ func withMapping(mapping *cache.LruCache) middleware {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ttl < 1 {
|
||||||
|
ttl = 1
|
||||||
|
}
|
||||||
mapping.SetWithExpire(ip.String(), host, time.Now().Add(time.Second*time.Duration(ttl)))
|
mapping.SetWithExpire(ip.String(), host, time.Now().Add(time.Second*time.Duration(ttl)))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user