From d8714e64e400ef873c2adc4d929a07d7890727b9 Mon Sep 17 00:00:00 2001 From: Miek Gieben Date: Thu, 14 Sep 2017 09:36:06 +0100 Subject: Remove the word middleware (#1067) * Rename middleware to plugin first pass; mostly used 'sed', few spots where I manually changed text. This still builds a coredns binary. * fmt error * Rename AddMiddleware to AddPlugin * Readd AddMiddleware to remain backwards compat --- plugin/pkg/rcode/rcode.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 plugin/pkg/rcode/rcode.go (limited to 'plugin/pkg/rcode/rcode.go') diff --git a/plugin/pkg/rcode/rcode.go b/plugin/pkg/rcode/rcode.go new file mode 100644 index 000000000..32863f0b2 --- /dev/null +++ b/plugin/pkg/rcode/rcode.go @@ -0,0 +1,16 @@ +package rcode + +import ( + "strconv" + + "github.com/miekg/dns" +) + +// ToString convert the rcode to the official DNS string, or to "RCODE"+value if the RCODE +// value is unknown. +func ToString(rcode int) string { + if str, ok := dns.RcodeToString[rcode]; ok { + return str + } + return "RCODE" + strconv.Itoa(rcode) +} -- cgit v1.2.3