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