Fix lint errors

This commit is contained in:
世界
2026-05-14 22:53:22 +08:00
parent 4b55717612
commit 2c2e08e608
38 changed files with 284 additions and 333 deletions
+2 -8
View File
@@ -61,10 +61,7 @@ type ClientOptions struct {
}
func NewClient(options ClientOptions) *Client {
cacheCapacity := options.CacheCapacity
if cacheCapacity < 1024 {
cacheCapacity = 1024
}
cacheCapacity := max(options.CacheCapacity, 1024)
client := &Client{
ctx: options.Context,
timeout: options.Timeout,
@@ -426,10 +423,7 @@ func (c *Client) loadResponse(question dns.Question, transport adapter.DNSTransp
c.cache.Remove(key)
return nil, 0, false
}
nowTTL := int(expireAt.Sub(timeNow).Seconds())
if nowTTL < 0 {
nowTTL = 0
}
nowTTL := max(int(expireAt.Sub(timeNow).Seconds()), 0)
response = response.Copy()
normalizeTTL(response, uint32(nowTTL))
return response, nowTTL, false