blacklist

package
v1.11.0 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2021 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrBadStatusCode = errors.New("bad HTTP status code")

Functions

This section is empty.

Types

type BlackLister added in v1.6.0

type BlackLister interface {
	FilterRequest(request *dns.Msg) (blocked bool)
	FilterResponse(response *dns.Msg) (blocked bool)
}

func NewMap added in v1.6.0

func NewMap(settings Settings) BlackLister

type Builder

type Builder interface {
	All(ctx context.Context, settings BuilderSettings) (
		blockedHostnames []string, blockedIPs []netaddr.IP,
		blockedIPPrefixes []netaddr.IPPrefix, errs []error)
	Hostnames(ctx context.Context,
		blockMalicious, blockAds, blockSurveillance bool,
		additionalBlockedHostnames, allowedHostnames []string) (
		blockedHostnames []string, errs []error)
	IPs(ctx context.Context,
		blockMalicious, blockAds, blockSurveillance bool,
		additionalBlockedIPs []netaddr.IP, additionalBlockedIPPrefixes []netaddr.IPPrefix) (
		blockedIPs []netaddr.IP, blockedIPPrefixes []netaddr.IPPrefix, errs []error)
}

func NewBuilder

func NewBuilder(client *http.Client) Builder

type BuilderSettings added in v1.6.0

type BuilderSettings struct {
	BlockMalicious       bool
	BlockAds             bool
	BlockSurveillance    bool
	AllowedHosts         []string
	AddBlockedHosts      []string
	AddBlockedIPs        []netaddr.IP
	AddBlockedIPPrefixes []netaddr.IPPrefix
}

func (*BuilderSettings) Lines added in v1.6.0

func (s *BuilderSettings) Lines(indent, subSection string) (lines []string)

func (*BuilderSettings) String added in v1.6.0

func (s *BuilderSettings) String() string

type Settings added in v1.6.0

type Settings struct {
	FqdnHostnames []string
	IPs           []netaddr.IP
	IPPrefixes    []netaddr.IPPrefix
}

func (*Settings) AddBlockHostnames added in v1.6.0

func (s *Settings) AddBlockHostnames(hostnames []string)

AddBlockHostnames transforms the slice of hostnames given to FQDN hostnames and adds the new hostnames to the settings, removing any duplicate.

func (*Settings) BlockHostnames added in v1.6.0

func (s *Settings) BlockHostnames(hostnames []string)

BlockHostnames transforms the slice of hostnames given to FQDN hostnames and sets these to the settings.

func (*Settings) Lines added in v1.6.0

func (s *Settings) Lines(indent, subSection string) (lines []string)

func (*Settings) String added in v1.6.0

func (s *Settings) String() string

Directories

Path Synopsis
Package mock_blacklist is a generated GoMock package.
Package mock_blacklist is a generated GoMock package.

Jump to

Keyboard shortcuts

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