aboutsummaryrefslogtreecommitdiff
path: root/middleware/pkg/response/classify.go
diff options
context:
space:
mode:
Diffstat (limited to 'middleware/pkg/response/classify.go')
-rw-r--r--middleware/pkg/response/classify.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/middleware/pkg/response/classify.go b/middleware/pkg/response/classify.go
index 65055dff4..e22c2e0ad 100644
--- a/middleware/pkg/response/classify.go
+++ b/middleware/pkg/response/classify.go
@@ -18,6 +18,22 @@ const (
OtherError
)
+func (t Type) String() string {
+ switch t {
+ case Success:
+ return "NOERROR"
+ case NameError:
+ return "NXDOMAIN"
+ case NoData:
+ return "NODATA"
+ case Delegation:
+ return "DELEGATION"
+ case OtherError:
+ return "OTHERERROR"
+ }
+ return ""
+}
+
// Classify classifies a message, it returns the Type.
func Classify(m *dns.Msg) (Type, *dns.OPT) {
opt := m.IsEdns0()