WAF动作增加显示HTML内容

This commit is contained in:
刘祥超
2021-02-26 16:33:58 +08:00
parent 2a7fd997dc
commit a1e93303f9
6 changed files with 130 additions and 21 deletions

View File

@@ -110,27 +110,40 @@ func (this *IPList) Contains(ip uint64) bool {
}
// 是否包含一组IP
func (this *IPList) ContainsIPStrings(ipStrings []string) bool {
func (this *IPList) ContainsIPStrings(ipStrings []string) (found bool, item *IPItem) {
if len(ipStrings) == 0 {
return false
return
}
this.locker.RLock()
if this.isAll {
itemIds := this.ipMap[0]
if len(itemIds) > 0 {
itemId := itemIds[0]
item = this.itemsMap[itemId]
}
this.locker.RUnlock()
return true
found = true
return
}
for _, ipString := range ipStrings {
if len(ipString) == 0 {
continue
}
_, ok := this.ipMap[utils.IP2Long(ipString)]
itemIds, ok := this.ipMap[utils.IP2Long(ipString)]
if ok {
if len(itemIds) > 0 {
itemId := itemIds[0]
item = this.itemsMap[itemId]
}
this.locker.RUnlock()
return true
found = true
return
}
}
this.locker.RUnlock()
return false
return
}
// 在不加锁的情况下删除某个Item