1
0
mirror of https://github.com/fumiama/terasu.git synced 2026-06-05 01:00:23 +08:00

fix(dns): disable false-positive deadline

This commit is contained in:
源文雨
2025-10-06 14:10:17 +08:00
parent 48a5909e84
commit 78a388f873

View File

@@ -148,7 +148,7 @@ func (ds *DNSList) lookupHostDoH(ctx context.Context, host string) (hosts []stri
return ErrSuccess
}
}
if !errors.Is(err, context.DeadlineExceeded) && !errors.Is(err, context.Canceled) {
if !errors.Is(err, context.Canceled) {
addr.disable(time.Hour) // no need to acquire write lock
}
}
@@ -195,7 +195,7 @@ func (ds *DNSList) DialContext(ctx context.Context, dialer *net.Dialer, firstFra
conn, err = dialer.DialContext(ctx, "tcp", addr.a)
if err != nil {
logrus.Debugln("[terasu.dns] -- dial tcp", host, addr, "err:", err)
if !errors.Is(err, context.DeadlineExceeded) && !errors.Is(err, context.Canceled) {
if !errors.Is(err, context.Canceled) {
addr.disable(time.Hour) // no need to acquire write lock
}
continue
@@ -230,7 +230,7 @@ func (ds *DNSList) DialContext(ctx context.Context, dialer *net.Dialer, firstFra
}
logrus.Debugln("[terasu.dns] -- hs tls", host, addr, "err:", err)
_ = tlsConn.Close()
if !errors.Is(err, context.DeadlineExceeded) && !errors.Is(err, context.Canceled) {
if !errors.Is(err, context.Canceled) {
logrus.Debugln("[terasu.dns] == disable", host, addr)
addr.disable(time.Hour) // no need to acquire write lock
}