coredns/middleware/pkg/rcode/rcode.go
Michael Grosser ece3cf8ecf Fix various issues with formatting and typos (#424)
* Fix typos

* Simplify code

* Fix error usage
2016-11-13 14:03:12 +00:00

16 lines
311 B
Go

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)
}