0
mirror of https://github.com/XTLS/Xray-core.git synced 2025-06-13 11:59:35 +03:00

Routing: Fix regexp syntax support in UserMatcher (#3900)

This commit is contained in:
vnxme
2024-10-11 18:37:01 +03:00
committed by GitHub
parent af7232d545
commit 5164a82185

View File

@ -202,7 +202,7 @@ func NewUserMatcher(users []string) *UserMatcher {
for _, user := range users {
if len(user) > 0 {
if len(user) > 7 && strings.HasPrefix(user, "regexp:") {
if re, err := regexp.Compile(user[7:]); err != nil {
if re, err := regexp.Compile(user[7:]); err == nil {
patternsCopy = append(patternsCopy, re)
}
// Items of users slice with an invalid regexp syntax are ignored.