aboutsummaryrefslogtreecommitdiff
path: root/plugin/pkg/rcode/rcode.go
blob: d221bcbd25bb9697ad8455e510f6acf464e4c68c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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)
}