blockbuilder

package
v2.0.0-rc3 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrAllowedHostNotValid = errors.New("allowed host is not valid")
	ErrBlockedHostNotValid = errors.New("blocked host is not valid")
)
View Source
var ErrBadStatusCode = errors.New("bad HTTP status code")

Functions

This section is empty.

Types

type Builder

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

func New

func New(settings Settings) *Builder

func (*Builder) BuildAll

func (b *Builder) BuildAll(ctx context.Context) (result Result)

type Interface

type Interface interface {
	BuildAll(ctx context.Context) Result
}

type Result

type Result struct {
	BlockedHostnames  []string
	BlockedIPs        []netip.Addr
	BlockedIPPrefixes []netip.Prefix
	// Errors contains all errors encountered.
	Errors []error
}

type Settings

type Settings struct {
	Client               *http.Client
	BlockMalicious       *bool
	BlockAds             *bool
	BlockSurveillance    *bool
	AllowedHosts         []string
	AllowedIPs           []netip.Addr
	AllowedIPPrefixes    []netip.Prefix
	AddBlockedHosts      []string
	AddBlockedIPs        []netip.Addr
	AddBlockedIPPrefixes []netip.Prefix
}

func (*Settings) SetDefaults

func (s *Settings) SetDefaults()

func (*Settings) String

func (s *Settings) String() string

func (*Settings) ToLinesNode

func (s *Settings) ToLinesNode() (node *gotree.Node)

func (Settings) Validate

func (s Settings) Validate() (err error)

Jump to

Keyboard shortcuts

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