blocklist

package
v0.18.1 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlockList

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

func NewBlockList

func NewBlockList(name string, url string, fpRate float64, logger *slog.Logger) *BlockList

func (*BlockList) Disable added in v0.13.0

func (blocklist *BlockList) Disable(duration time.Duration) time.Time

func (*BlockList) Fetch added in v0.14.0

func (blockList *BlockList) Fetch(ctx context.Context) error

func (*BlockList) IsBlocked

func (blockList *BlockList) IsBlocked(fqdn string) (bool, error)

Returns whether the URL (or part of the URL) is on a block list. If true, might be a false positive, but if false (i.e. allowed) is definitely not blocked

func (*BlockList) Load

func (blocklist *BlockList) Load(items []string)

func (*BlockList) Metadata added in v0.15.0

func (BlockList *BlockList) Metadata(attr, defaultValue string) string

func (*BlockList) Name added in v0.14.0

func (BlockList *BlockList) Name() string

func (*BlockList) Reenable added in v0.13.0

func (blocklist *BlockList) Reenable() bool

func (*BlockList) Status added in v0.13.0

func (blocklist *BlockList) Status() *BlocklistStatus

func (*BlockList) URL added in v0.14.0

func (blockList *BlockList) URL() string

type BlocklistStatus added in v0.13.0

type BlocklistStatus struct {
	URL               string            `json:"url"`
	Size              uint              `json:"size"`
	MetaData          map[string]string `json:"metadata,omitempty"`
	LastUpdated       *time.Time        `json:"last_updated,omitempty"`
	DisabledUntil     *time.Time        `json:"disabled_until,omitempty"`
	FalsePositiveRate float64           `json:"estimated_false_positive_rate"`
}

type ScannerFunc added in v0.14.0

type ScannerFunc func(string) bool

type Updater added in v0.14.0

type Updater struct {
	Blocklists []*BlockList
	Timeout    time.Duration
}

func NewUpdater added in v0.14.0

func NewUpdater(blocklists []*BlockList, timeout time.Duration) *Updater

func (*Updater) Run added in v0.14.0

func (job *Updater) Run()

Jump to

Keyboard shortcuts

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