Documentation ¶
Overview ¶
Package composite implements a composite filter based on several types of filters and the logic of the filter application.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // SafeBrowsing is the safe-browsing filter to apply, if any. SafeBrowsing *hashprefix.Filter // AdultBlocking is the adult-content filter to apply, if any. AdultBlocking *hashprefix.Filter // NewRegisteredDomains is the newly registered domains filter to apply, if // any. NewRegisteredDomains *hashprefix.Filter // GeneralSafeSearch is the general safe-search filter to apply, if any. GeneralSafeSearch *safesearch.Filter // YouTubeSafeSearch is the youtube safe-search filter to apply, if any. YouTubeSafeSearch *safesearch.Filter // Custom is the custom rule-list filter of the profile, if any. Custom *rulelist.Immutable // RuleLists are the enabled rule-list filters of the profile or filtering // group. RuleLists []*rulelist.Refreshable // ServiceLists are the rule-list filters of the profile's enabled blocked // services, if any. ServiceLists []*rulelist.Immutable }
Config is the configuration structure for the composite filter.
type Filter ¶
type Filter struct {
// contains filtered or unexported fields
}
Filter is a composite filter based on several types of safe-search and rule-list filters.
An empty composite filter is a filter that always returns a nil filtering result.
func New ¶
New returns a new composite filter. If c is nil or empty, f returns a filter that always returns a nil filtering result.
func (*Filter) FilterRequest ¶
func (f *Filter) FilterRequest( ctx context.Context, req *dns.Msg, ri *agd.RequestInfo, ) (r internal.Result, err error)
FilterRequest implements the internal.Interface interface for *Filter. If there is a safe-search result, it returns it. Otherwise, it returns the action created from the filter list network rule with the highest priority. If f is empty, it returns nil with no error.
func (*Filter) FilterResponse ¶
func (f *Filter) FilterResponse( _ context.Context, resp *dns.Msg, ri *agd.RequestInfo, ) (r internal.Result, err error)
FilterResponse implements the internal.Interface interface for *Filter. It returns the action created from the filter list network rule with the highest priority. If f is empty, it returns nil with no error.