mirror of
https://github.com/bufanyun/hotgo.git
synced 2025-10-11 20:43:44 +08:00
发布v2.8.4版本,更新内容请查看:https://github.com/bufanyun/hotgo/tree/v2.0/docs/guide-zh-CN/addon-version-upgrade.md
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
Reference in New Issue
Block a user