This commit is contained in:
世界
2022-06-28 21:36:12 +08:00
parent ebee459f1f
commit fc6ae4d4e7
14 changed files with 93 additions and 80 deletions
+1 -1
View File
@@ -7,7 +7,7 @@ const (
)
func ContextWithEnvironment(ctx context.Context, environment interface{}) context.Context {
return context.WithValue(ctx, environmentKey, environment) //nolint: revive
return context.WithValue(ctx, environmentKey, environment) //nolint: revive,staticcheck
}
func EnvironmentFromContext(ctx context.Context) interface{} {
@@ -216,9 +216,9 @@ func (ac *ACAutomatonMatcherGroup) MatchAny(input string) bool {
}
// Letter-Digit-Hyphen (LDH) subset (https://tools.ietf.org/html/rfc952):
// * Letters A to Z (no distinction is made between uppercase and lowercase)
// * Digits 0 to 9
// * Hyphens(-) and Periods(.)
// - Letters A to Z (no distinction is made between uppercase and lowercase)
// - Digits 0 to 9
// - Hyphens(-) and Periods(.)
//
// If for future the strmatcher are used for other scenarios than domain,
// we could add a new Charset interface to represent variable charsets.
+6 -6
View File
@@ -15,7 +15,7 @@ const (
)
// Matcher is the interface to determine a string matches a pattern.
// * This is a basic matcher to represent a certain kind of match semantic(full, substr, domain or regex).
// - This is a basic matcher to represent a certain kind of match semantic(full, substr, domain or regex).
type Matcher interface {
// Type returns the matcher's type.
Type() Type
@@ -34,8 +34,8 @@ type Matcher interface {
// MatcherGroup is an advanced type of matcher to accept a bunch of basic Matchers (of certain type, not all matcher types).
// For example:
// * FullMatcherGroup accepts FullMatcher and uses a hash table to facilitate lookup.
// * DomainMatcherGroup accepts DomainMatcher and uses a trie to optimize both memory consumption and lookup speed.
// - FullMatcherGroup accepts FullMatcher and uses a hash table to facilitate lookup.
// - DomainMatcherGroup accepts DomainMatcher and uses a trie to optimize both memory consumption and lookup speed.
type MatcherGroup interface {
// Match returns all matched matchers with their corresponding values.
Match(input string) []uint32
@@ -46,9 +46,9 @@ type MatcherGroup interface {
// IndexMatcher is a general type of matcher thats accepts all kinds of basic matchers.
// It should:
// * Accept all Matcher types with no exception.
// * Optimize string matching with a combination of MatcherGroups.
// * Obey certain priority order specification when returning matched Matchers.
// - Accept all Matcher types with no exception.
// - Optimize string matching with a combination of MatcherGroups.
// - Obey certain priority order specification when returning matched Matchers.
type IndexMatcher interface {
// Size returns number of matchers added to IndexMatcher.
Size() uint32