This commit is contained in:
孟帅
2023-07-20 18:01:10 +08:00
parent 9113fc5297
commit 373d9627fb
492 changed files with 12170 additions and 6982 deletions

View File

@@ -97,3 +97,14 @@ func IpFilterStrategy(originIp string) (list map[string]struct{}) {
}
return list
}
// MatchIpStrategy 匹配IP策略输入ip如果在策略当中返回true
func MatchIpStrategy(rules, ip string) bool {
allowedIps := IpFilterStrategy(rules)
if _, ok := allowedIps["*"]; ok {
return true
}
_, ok := allowedIps[ip]
return ok
}