u
This commit is contained in:
1 parent
8408cf779f
commit
25a9e41025
58 files changed
+2079
-6308
No files matched your search
@@ -0,0 +1,19 @@
|
||||
package pathx
|
||||
|
||||
import (
|
||||
"cn/oneao/base-go/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
|
||||
}
|
||||
Reference in new issue
Block a user