diff --git a/dnsfilter/dnsfilter.go b/dnsfilter/dnsfilter.go index bc03e448..a642abe4 100644 --- a/dnsfilter/dnsfilter.go +++ b/dnsfilter/dnsfilter.go @@ -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 diff --git a/dnsfilter/reason_string.go b/dnsfilter/reason_string.go deleted file mode 100644 index cb097e52..00000000 --- a/dnsfilter/reason_string.go +++ /dev/null @@ -1,16 +0,0 @@ -// Code generated by "stringer -type=Reason"; DO NOT EDIT. - -package dnsfilter - -import "strconv" - -const _Reason_name = "NotFilteredNotFoundNotFilteredWhiteListNotFilteredErrorFilteredBlackListFilteredSafeBrowsingFilteredParentalFilteredInvalidFilteredSafeSearch" - -var _Reason_index = [...]uint8{0, 19, 39, 55, 72, 92, 108, 123, 141} - -func (i Reason) String() string { - if i < 0 || i >= Reason(len(_Reason_index)-1) { - return "Reason(" + strconv.FormatInt(int64(i), 10) + ")" - } - return _Reason_name[_Reason_index[i]:_Reason_index[i+1]] -}