Update Relay Pattern format to include dollar sign

This commit is contained in:
Shelikhoo 2022-06-15 13:20:58 +01:00
parent ddf72025d1
commit 97dea533da
No known key found for this signature in database
GPG key ID: C4D5E79D22B25316
4 changed files with 24 additions and 15 deletions

View file

@ -3,9 +3,14 @@ package namematcher
import "strings"
func NewNameMatcher(rule string) NameMatcher {
rule = strings.TrimSuffix(rule, "$")
return NameMatcher{suffix: strings.TrimPrefix(rule, "^"), exact: strings.HasPrefix(rule, "^")}
}
func IsValidRule(rule string) bool {
return strings.HasSuffix(rule, "$")
}
type NameMatcher struct {
exact bool
suffix string