chore: cleanup the patch code

This commit is contained in:
wwqgtxx
2024-09-11 16:10:35 +08:00
parent 8230bc8e7d
commit 0a2f606e1b
18 changed files with 122 additions and 185 deletions

View File

@@ -29,6 +29,7 @@ type dnsClient interface {
type dnsCache interface {
GetWithExpire(key string) (*D.Msg, time.Time, bool)
SetWithExpire(key string, value *D.Msg, expire time.Time)
Clear()
}
type result struct {
@@ -369,6 +370,12 @@ func (r *Resolver) Invalid() bool {
return len(r.main) > 0
}
func (r *Resolver) ClearCache() {
if r != nil && r.cache != nil {
r.cache.Clear()
}
}
type NameServer struct {
Net string
Addr string