dnsfilter -- small code cleanup

This commit is contained in:
Eugene Bujak 2018-09-07 16:10:43 +03:00
parent 3b9aaff861
commit 6fc50cd743
1 changed files with 3 additions and 3 deletions

View File

@ -521,11 +521,11 @@ func (d *Dnsfilter) checkSafeBrowsing(host string) (Result, error) {
} }
func (d *Dnsfilter) checkParental(host string) (Result, error) { func (d *Dnsfilter) checkParental(host string) (Result, error) {
format2 := func(hashparam string) string { format := func(hashparam string) string {
url := fmt.Sprintf(defaultParentalURL, hashparam, d.config.parentalSensitivity) url := fmt.Sprintf(defaultParentalURL, hashparam, d.config.parentalSensitivity)
return url return url
} }
handleBody2 := func(body []byte, hashes map[string]bool) (Result, error) { handleBody := func(body []byte, hashes map[string]bool) (Result, error) {
// parse json // parse json
var m []struct { var m []struct {
Blocked bool `json:"blocked"` Blocked bool `json:"blocked"`
@ -551,7 +551,7 @@ func (d *Dnsfilter) checkParental(host string) (Result, error) {
} }
return result, nil return result, nil
} }
result, err := d.lookupCommon(host, &stats.Parental, parentalCache, false, format2, handleBody2) result, err := d.lookupCommon(host, &stats.Parental, parentalCache, false, format, handleBody)
return result, err return result, err
} }