cleaner dns error handling
This commit is contained in:
parent
c9ea462e97
commit
963d9209ca
1 changed files with 3 additions and 4 deletions
|
|
@ -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"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue