glob

package
v1.8.9 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EXACT  = "exact"
	GLOB   = "glob"
	REGEXP = "regexp"
)
View Source
const (
	// DefaultGlobCacheSize is the default maximum number of compiled glob patterns to cache.
	// This limit prevents memory exhaustion from untrusted RBAC patterns.
	// 10,000 patterns should be sufficient for most deployments while limiting
	// memory usage to roughly ~10MB (assuming ~1KB per compiled pattern).
	DefaultGlobCacheSize = 10000
)

Variables

This section is empty.

Functions

func Match

func Match(pattern, text string, separators ...rune) bool

Match tries to match a text with a given glob pattern. Compiled glob patterns are cached for performance.

func MatchStringInList

func MatchStringInList(list []string, item string, patternMatch string) bool

MatchStringInList will return true if item is contained in list. patternMatch; can be set to exact, glob, regexp. If patternMatch; is set to exact, the item must be an exact match. If patternMatch; is set to glob, the item must match a glob pattern. If patternMatch; is set to regexp, the item must match a regular expression or glob.

func MatchWithError

func MatchWithError(pattern, text string, separators ...rune) (bool, error)

MatchWithError tries to match a text with a given glob pattern. Returns error if the glob pattern fails to compile. Compiled glob patterns are cached for performance.

func SetCacheSize

func SetCacheSize(maxEntries int)

SetCacheSize reinitializes the glob cache with the given maximum number of entries. This should be called early during process startup, before concurrent access begins.

Types

This section is empty.

Jump to

Keyboard shortcuts

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