core: v2ray.com/core/common/strmatcher Index | Files

package strmatcher

import "v2ray.com/core/common/strmatcher"

Index

Package Files

domain_matcher.go full_matcher.go matchers.go strmatcher.go

type DomainMatcherGroup Uses

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

DomainMatcherGroup is a IndexMatcher for a large set of Domain matchers. Visible for testing only.

func (*DomainMatcherGroup) Add Uses

func (g *DomainMatcherGroup) Add(domain string, value uint32)

func (*DomainMatcherGroup) Match Uses

func (g *DomainMatcherGroup) Match(domain string) uint32

type FullMatcherGroup Uses

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

func (*FullMatcherGroup) Add Uses

func (g *FullMatcherGroup) Add(domain string, value uint32)

func (*FullMatcherGroup) Match Uses

func (g *FullMatcherGroup) Match(str string) uint32

type IndexMatcher Uses

type IndexMatcher interface {
    // Match returns the the index of a matcher that matches the input. It returns 0 if no such matcher exists.
    Match(input string) uint32
}

IndexMatcher is the interface for matching with a group of matchers.

type Matcher Uses

type Matcher interface {
    // Match returns true if the given string matches a predefined pattern.
    Match(string) bool
}

Matcher is the interface to determine a string matches a pattern.

type MatcherGroup Uses

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

MatcherGroup is an implementation of IndexMatcher. Empty initialization works.

func (*MatcherGroup) Add Uses

func (g *MatcherGroup) Add(m Matcher) uint32

Add adds a new Matcher into the MatcherGroup, and returns its index. The index will never be 0.

func (*MatcherGroup) Match Uses

func (g *MatcherGroup) Match(pattern string) uint32

Match implements IndexMatcher.Match.

func (*MatcherGroup) Size Uses

func (g *MatcherGroup) Size() uint32

Size returns the number of matchers in the MatcherGroup.

type Type Uses

type Type byte

Type is the type of the matcher.

const (
    // Full is the type of matcher that the input string must exactly equal to the pattern.
    Full Type = iota
    // Substr is the type of matcher that the input string must contain the pattern as a sub-string.
    Substr
    // Domain is the type of matcher that the input string must be a sub-domain or itself of the pattern.
    Domain
    // Regex is the type of matcher that the input string must matches the regular-expression pattern.
    Regex
)

func (Type) New Uses

func (t Type) New(pattern string) (Matcher, error)

New creates a new Matcher based on the given pattern.

Package strmatcher imports 2 packages (graph) and is imported by 6 packages. Updated 2019-07-19. Refresh now. Tools for package owners.