forked from elastic/beats
-
Notifications
You must be signed in to change notification settings - Fork 0
/
errors.go
45 lines (37 loc) · 1.23 KB
/
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
40
41
42
43
44
45
package dns
import (
"fmt"
)
// All dns protocol errors are defined here.
type dnsError struct {
message string
}
func (e *dnsError) Error() string {
if e == nil {
return "<nil>"
}
return e.message
}
func (e *dnsError) responseError() string {
return "Response: " + e.Error()
}
// Common
var (
nonDNSMsg = &dnsError{message: "Message's data could not be decoded as DNS"}
duplicateQueryMsg = &dnsError{message: "Another query with the same DNS ID from this client " +
"was received so this query was closed without receiving a response"}
noResponse = &dnsError{message: "No response to this query was received"}
orphanedResponse = &dnsError{message: "Response: received without an associated Query"}
)
// EDNS
var (
udpPacketTooLarge = &dnsError{message: fmt.Sprintf("Non-EDNS packet has size greater than %d", maxDNSPacketSize)}
respEdnsNoSupport = &dnsError{message: "Responder does not support EDNS"}
respEdnsUnexpected = &dnsError{message: "Unexpected EDNS answer"}
)
// TCP
var (
zeroLengthMsg = &dnsError{message: "Message's length was set to zero"}
unexpectedLengthMsg = &dnsError{message: "Unexpected message data length"}
incompleteMsg = &dnsError{message: "Message's data is incomplete"}
)