safesearch

package
v0.0.0-...-f179113 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 5, 2024 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

Package safesearch contains the implementation of the safe-search filter that uses lists of DNS rewrite rules to enforce safe search.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Refreshable is the configuration of the refreshable filter-list within
	// the safe-search filter.
	Refreshable *refreshable.Config

	// CacheTTL is the time to live of the result cache-items.
	//
	//lint:ignore U1000 TODO(a.garipov): Currently unused.  See AGDNS-398.
	CacheTTL time.Duration
}

Config contains configuration for the safe-search filter.

type Filter

type Filter struct {
	// contains filtered or unexported fields
}

Filter modifies the results of queries to search-engine addresses and rewrites them to the IP addresses of their safe versions.

func New

func New(c *Config, cache rulelist.ResultCache) (f *Filter, err error)

New returns a new safe-search filter. c must not be nil. The initial refresh should be called explicitly if necessary.

func (*Filter) FilterRequest

func (f *Filter) FilterRequest(
	ctx context.Context,
	req *internal.Request,
) (r internal.Result, err error)

FilterRequest implements the internal.RequestFilter interface for *Filter. It modifies the response if host matches f.

func (*Filter) ID

func (f *Filter) ID() (id internal.ID)

ID implements the internal.RequestFilter interface for *Filter.

func (*Filter) Refresh

func (f *Filter) Refresh(ctx context.Context, acceptStale bool) (err error)

Refresh reloads the rule list data. If acceptStale is true, and the cache file exists, the data is read from there regardless of its staleness.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL