ruletree

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2025 License: Apache-2.0, BSD-2-Clause-Views, BSD-3-Clause, + 4 more Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RuleTree

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

RuleTree is a trie-based filter that is capable of parsing Adblock-style and hosts rules and matching URLs against them.

The filter is safe for concurrent use.

func NewRuleTree

func NewRuleTree() *RuleTree

func (*RuleTree) AddRule

func (rt *RuleTree) AddRule(rawRule string, filterName *string) error

func (*RuleTree) FindMatchingRulesReq

func (rt *RuleTree) FindMatchingRulesReq(req *http.Request) (rules []rule.Rule)

FindMatchingRulesReq finds all rules that match the given request.

func (*RuleTree) FindMatchingRulesRes

func (rt *RuleTree) FindMatchingRulesRes(req *http.Request, res *http.Response) (rules []rule.Rule)

FindMatchingRulesRes finds all rules that match the given response. It assumes that the request that generated the response has already been matched by FindMatchingRulesReq.

Jump to

Keyboard shortcuts

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