删除IP名单中某个IP时,也会删除WAF保存在内存中的名单中的IP

This commit is contained in:
GoEdgeLab
2021-11-05 14:58:10 +08:00
parent e36b214cf0
commit 8174713431
3 changed files with 20 additions and 0 deletions

View File

@@ -6,6 +6,7 @@ import (
"github.com/TeaOSLab/EdgeNode/internal/remotelogs"
"github.com/TeaOSLab/EdgeNode/internal/rpc"
"github.com/TeaOSLab/EdgeNode/internal/utils"
"github.com/TeaOSLab/EdgeNode/internal/waf"
"github.com/iwind/TeaGo/Tea"
"sync"
"time"
@@ -125,6 +126,16 @@ func (this *IPListManager) fetch() (hasNext bool, err error) {
if item.IsDeleted {
list.Delete(item.Id)
// 从临时名单中删除
if len(item.IpFrom) > 0 && len(item.IpTo) == 0 {
switch item.ListType {
case "black":
waf.SharedIPBlackList.RemoveIP(item.IpFrom)
case "white":
waf.SharedIPWhiteList.RemoveIP(item.IpFrom)
}
}
// 操作事件
SharedActionManager.DeleteItem(item.ListType, item)