fix: better error check

This commit is contained in:
wwqgtxx 2022-11-19 23:03:14 +08:00
parent d3562ce394
commit dbbd499349

View file

@ -12,7 +12,6 @@ import (
"net/url"
"runtime"
"strconv"
"strings"
"sync"
"time"
@ -141,7 +140,7 @@ func (doh *dnsOverHTTPS) ExchangeContext(ctx context.Context, m *D.Msg) (msg *D.
msg, err = doh.exchangeHTTPS(ctx, client, m)
}
if err != nil && !strings.Contains(err.Error(), "context canceled") {
if err != nil && !errors.Is(err, context.Canceled) {
// If the request failed anyway, make sure we don't use this client.
_, resErr := doh.resetClient(ctx, err)