* dnsfilter: refactor: a simple approach to convert Reason to string

This commit is contained in:
Simon Zolin
2019-07-23 11:43:30 +03:00
parent a9fbb93f0f
commit b66e370ffc
2 changed files with 17 additions and 16 deletions

View File

@@ -133,6 +133,23 @@ const (
FilteredSafeSearch
)
func (i Reason) String() string {
names := []string{
"NotFilteredNotFound",
"NotFilteredWhiteList",
"NotFilteredError",
"FilteredBlackList",
"FilteredSafeBrowsing",
"FilteredParental",
"FilteredInvalid",
"FilteredSafeSearch",
}
if uint(i) >= uint(len(names)) {
return ""
}
return names[i]
}
type dnsFilterContext struct {
stats Stats
dialCache gcache.Cache // "host" -> "IP" cache for safebrowsing and parental control servers