Files
workspace/code/allapp/allapp-go2/utils/pathx/path.go
T
2026-02-25 17:31:09 +08:00

20 lines
340 B
Go

package pathx
import (
"allapp/conf"
"strings"
)
// MatchPath 判断给定路径是否在白名单中
func MatchPath(path string, whitelist []string) bool {
baseUrl := conf.GetConf().Server.BaseUrl
for _, p := range whitelist {
fullPath := baseUrl + p
if strings.HasPrefix(path, fullPath) {
return true
}
}
return false
}