blockbuilder

package
v2.0.0-rc5 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2024 License: MIT Imports: 12 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 Builder

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

func New

func New(settings Settings) (builder *Builder, err error)

func (*Builder) BuildAll

func (b *Builder) BuildAll(ctx context.Context) (result 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