forked from elastic/beats
-
Notifications
You must be signed in to change notification settings - Fork 4
/
errors.go
39 lines (32 loc) · 988 Bytes
/
errors.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package dns
// All dns protocol errors are defined here.
type Error interface {
error
ResponseError() string
}
type DNSError struct {
Err string
}
func (e *DNSError) Error() string {
if e == nil {
return "<nil>"
}
return e.Err
}
func (e *DNSError) ResponseError() string {
return "Response: " + e.Error()
}
// Messages
var (
NonDnsMsg = &DNSError{Err: "Message's data could not be decoded as DNS"}
ZeroLengthMsg = &DNSError{Err: "Message's length was set to zero"}
UnexpectedLengthMsg = &DNSError{Err: "Unexpected message data length"}
DuplicateQueryMsg = &DNSError{Err: "Another query with the same DNS ID from this client " +
"was received so this query was closed without receiving a response"}
IncompleteMsg = &DNSError{Err: "Message's data is incomplete"}
NoResponse = &DNSError{Err: "No response to this query was received"}
)
// TCP responses
var (
OrphanedResponse = &DNSError{Err: "Response: received without an associated Query"}
)