matcher

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2024 License: MIT Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Matcher

type Matcher interface {
	Match(v string) bool
}

Matcher is a generic pattern matcher, it gives the match result of the given pattern for specific v.

func AddrMatcher

func AddrMatcher(addrs []string) Matcher

AddrMatcher creates a Matcher with a list of HOST:PORT addresses. the host can be an IP (e.g. 192.168.1.1) address, a plain domain such as 'example.com', or a special pattern '.example.com' that matches 'example.com' and any subdomain 'abc.example.com', 'def.abc.example.com' etc. The PORT can be a single port number or port range MIN-MAX(e.g. 0-65535).

func CIDRMatcher

func CIDRMatcher(inets []*net.IPNet) Matcher

CIDRMatcher creates a Matcher for a list of CIDR notation IP addresses.

func DomainMatcher

func DomainMatcher(domains []string) Matcher

DomainMatcher creates a Matcher for a list of domains, the domain should be a plain domain such as 'example.com', or a special pattern '.example.com' that matches 'example.com' and any subdomain 'abc.example.com', 'def.abc.example.com' etc.

func IPMatcher

func IPMatcher(ips []net.IP) Matcher

IPMatcher creates a Matcher with a list of IP addresses.

func WildcardMatcher

func WildcardMatcher(patterns []string) Matcher

WildcardMatcher creates a Matcher for a specific wildcard domain pattern, the pattern can be a wildcard such as '*.exmaple.com', '*.example.com:80', or '*.example.com:0-65535'

Jump to

Keyboard shortcuts

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