diff options
author | 2016-04-09 11:13:04 +0100 | |
---|---|---|
committer | 2016-04-09 11:13:04 +0100 | |
commit | db3d689a8ac2bec199e5643394ffa779341acde0 (patch) | |
tree | 01e8a18adb3bb7c2d6bf73b9ab2964452136e97f /middleware/rcode.go | |
parent | 16c035731c528f986a93d01b18244cad7d71e725 (diff) | |
download | coredns-db3d689a8ac2bec199e5643394ffa779341acde0.tar.gz coredns-db3d689a8ac2bec199e5643394ffa779341acde0.tar.zst coredns-db3d689a8ac2bec199e5643394ffa779341acde0.zip |
EDNS: return error on wrong version. (#95)
Split up the previous changes a bit. This PR only returns the expected
error when the received packet has the wrong EDNS version.
EDNS0 handling in the middleware needs a nicer abstraction, like
ReflectEdns() or something.
Diffstat (limited to 'middleware/rcode.go')
-rw-r--r-- | middleware/rcode.go | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/middleware/rcode.go b/middleware/rcode.go new file mode 100644 index 000000000..989f90fdd --- /dev/null +++ b/middleware/rcode.go @@ -0,0 +1,14 @@ +package middleware + +import ( + "strconv" + + "github.com/miekg/dns" +) + +func RcodeToString(rcode int) string { + if str, ok := dns.RcodeToString[rcode]; ok { + return str + } + return "RCODE" + strconv.Itoa(rcode) +} |