Documentation
¶
Overview ¶
Package matcher provides pattern matching utilities for IP addresses, CIDR blocks, domains, wildcard patterns, and address:port combinations.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Matcher ¶
Matcher is a generic pattern matcher that tests whether a given value matches any of the pre-configured patterns.
func AddrMatcher ¶
AddrMatcher creates a Matcher for a list of HOST:PORT addresses. The host can be an IP address (e.g. 192.168.1.1), 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 ¶
CIDRMatcher creates a Matcher for a list of CIDR notation IP addresses.
func DomainMatcher ¶
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 IPRangeMatcher ¶ added in v0.0.3
IPRangeMatcher creates a Matcher for a list of IP ranges (e.g. "192.168.1.1-192.168.1.255").
func NopMatcher ¶ added in v0.0.3
func NopMatcher() Matcher
NopMatcher creates a Matcher that never matches anything.
func WildcardMatcher ¶
WildcardMatcher creates a Matcher for wildcard domain patterns. The pattern can be a wildcard such as "*.example.com", "*.example.com:80", or "*.example.com:0-65535".