From 0d4a999707da2ec0c989aa3fe2b8faff5950340c Mon Sep 17 00:00:00 2001 From: Dreamacro <305009791@qq.com> Date: Sun, 12 May 2019 10:48:07 +0800 Subject: [PATCH] Chore: adjust fake-ip ttl --- dns/server.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dns/server.go b/dns/server.go index ad955a2a..7e410355 100644 --- a/dns/server.go +++ b/dns/server.go @@ -4,7 +4,6 @@ import ( "errors" "fmt" "net" - "time" "github.com/Dreamacro/clash/log" "github.com/miekg/dns" @@ -58,10 +57,10 @@ func (s *Server) handleFakeIP(r *D.Msg) (msg *D.Msg, err error) { q := r.Question[0] - cache, expireTime := s.r.cache.GetWithExpire("fakeip:" + q.String()) + cache, _ := s.r.cache.GetWithExpire("fakeip:" + q.String()) if cache != nil { msg = cache.(*D.Msg).Copy() - setMsgTTL(msg, uint32(expireTime.Sub(time.Now()).Seconds())) + setMsgTTL(msg, 1) return } @@ -73,6 +72,7 @@ func (s *Server) handleFakeIP(r *D.Msg) (msg *D.Msg, err error) { putMsgToCache(s.r.cache, "fakeip:"+q.String(), msg) putMsgToCache(s.r.cache, ip.String(), msg) + setMsgTTL(msg, 1) }() rr := &D.A{}