matcher

package
v0.0.0-...-928a51f Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2022 License: MIT Imports: 3 Imported by: 0

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 CIDRMatcher

func CIDRMatcher(inet *net.IPNet) Matcher

CIDRMatcher creates a Matcher for a specific CIDR notation IP address.

func DomainMatcher

func DomainMatcher(pattern string) Matcher

DomainMatcher creates a Matcher for a specific domain pattern, the pattern can be a plain domain such as 'example.com', a wildcard such as '*.exmaple.com' or a special wildcard '.example.com'.

func IPMatcher

func IPMatcher(ip net.IP) Matcher

IPMatcher creates a Matcher for a specific IP address.

func NewMatcher

func NewMatcher(pattern string) Matcher

NewMatcher creates a Matcher for the given pattern. The acutal Matcher depends on the pattern: IP Matcher if pattern is a valid IP address. CIDR Matcher if pattern is a valid CIDR address. Domain Matcher if both of the above are not.

Jump to

Keyboard shortcuts

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