aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2019-04-10 17:05:30 +0700
committerShulhan <ms@kilabit.info>2019-04-12 19:14:02 +0700
commitf43e8fd05681ee455c93b464ed5586a83de71fc3 (patch)
treeda05d72185c57b448197130b39b40f6a0acc279b
parentde54b360eb48a7932595c99cef7c1d6230f1db99 (diff)
downloadpakakeh.go-f43e8fd05681ee455c93b464ed5586a83de71fc3.tar.xz
dns: add mapping of response code to human readable names
This mapping can be used to print an error message based on error code on response.
-rw-r--r--lib/dns/dns.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/dns/dns.go b/lib/dns/dns.go
index 467659d0..450709a6 100644
--- a/lib/dns/dns.go
+++ b/lib/dns/dns.go
@@ -214,3 +214,16 @@ const (
// zone transfer) for particular data.
RCodeRefused
)
+
+//
+// rcodeNames contains mapping of response code with their human readable
+// names.
+//
+var rcodeNames = map[ResponseCode]string{
+ RCodeOK: "OK",
+ RCodeErrFormat: "ERR_FORMAT",
+ RCodeErrServer: "ERR_SERVER",
+ RCodeErrName: "ERR_NAME",
+ RCodeNotImplemented: "ERR_NOT_IMPLEMENTED",
+ RCodeRefused: "ERR_REFUSED",
+}