keymatch

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidIP = errors.New("invalid textual representation of an IP address")

Functions

func GlobMatch

func GlobMatch(key1 string, key2 string) (bool, error)

GlobMatch determines whether key1 matches the pattern of key2 using glob pattern.

func IPMatch

func IPMatch(ip string, ipCIDR string) (matched bool, err error)

IPMatch determines whether IP address 'ip' matches the IP CIDR pattern.

For example, "192.168.2.123" matches "192.168.2.0/24".

func KeyMatch

func KeyMatch(key1 string, key2 string) (bool, error)

KeyMatch determines whether key1 matches the pattern of key2 (similar to RESTful path), key2 can contain a *.

For example, "/foo/bar" matches "/foo/*".

func ToExtensionFunc

func ToExtensionFunc(funcName string, fn Func) core.ExtensionFunc

Types

type Func

type Func func(key1, key2 string) (matched bool, err error)

Key match function signature.

func NewRegexMatch

func NewRegexMatch() Func

NewRegexMatch build a regex match function.

Jump to

Keyboard shortcuts

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