blocklist

package
v0.0.0-...-97a175b Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Block

type Block struct {
	Domain   string `yaml:"domain"`   // Domain name to be blocked.
	Category string `yaml:"category"` // Category of the reason for blocking (e.g., advertising).
	Reason   string `yaml:"reason"`   // Long reason for the domain being blocked.
}

Block represents a single blocked domain with its category and reason for being blocked.

type BlockList

type BlockList []Block

BlockList is a slice of Block, representing a list of blocked domains and their details.

func New

func New(blockListURLs []string) *BlockList

New initializes a BlockList from a list of URLs pointing to blocklists. It downloads and parses the blocklists concurrently for efficiency.

func (*BlockList) Check

func (bl *BlockList) Check(domain string) bool

Check checks if a domain is present in the block list and returns true if found.

func (*BlockList) Query

func (bl *BlockList) Query(domain string) *Block

Query checks if a domain is present in the block list and returns the corresponding Block if found.

Jump to

Keyboard shortcuts

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