rule

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2019 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// the constant that means ALLOW after pasring "allow" or "block"
	ALLOW = uint8(1)
	// the constant that means BLOCK after pasring "allow" or "block"
	BLOCK = uint8(0)
	// the string that represents "allow", all other results are treated as "block"
	ALLOWSTRING = "allow"
)

Variables

This section is empty.

Functions

func IsComplex added in v0.3.15

func IsComplex(ruleText string) bool

func ParseLine added in v0.3.15

func ParseLine(line string) string

parse a line, as from a file, and return the part that represents the rule

func ParseType

func ParseType(listType string) uint8

Types

type ComplexRule added in v0.3.15

type ComplexRule interface {
	IsMatch(sample string) bool
	Text() string
}

func CreateComplexRule added in v0.3.15

func CreateComplexRule(rule string) ComplexRule

type Match

type Match uint8

a match can be: allow (don't block, override/bypass block) block (explicit block) none (no reason found to block or allow)

const (
	MatchAllow Match = 2
	MatchBlock Match = 1
	MatchNone  Match = 0
)

type RuleStore

type RuleStore interface {
	Init(sessionRoot string, config *config.GudgeonConfig, lists []*config.GudgeonList)

	Load(list *config.GudgeonList, rule string)

	Finalize(sessionRoot string, lists []*config.GudgeonList)

	FindMatch(lists []*config.GudgeonList, domain string) (Match, *config.GudgeonList, string)

	Close()
}

func CreateStore

func CreateStore(storeRoot string, config *config.GudgeonConfig) (RuleStore, []uint64)

stores are created from lists of files inside a configuration

Jump to

Keyboard shortcuts

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