cleaner dns error handling

This commit is contained in:
Joe Lothan 2026-05-20 00:35:55 -04:00
parent c9ea462e97
commit 963d9209ca

View file

@ -3,6 +3,7 @@ package main
import (
"crypto/sha256"
"encoding/hex"
"errors"
"fmt"
"io"
"net"
@ -126,10 +127,8 @@ func classifyError(err error) string {
msg := err.Error()
// DNS errors
if _, ok := err.(*net.DNSError); ok {
return "dns"
}
if strings.Contains(msg, "no such host") || strings.Contains(msg, "dns") {
var dnsErr *net.DNSError
if errors.As(err, &dnsErr) {
return "dns"
}