mirror of
https://github.com/TeaOSLab/EdgeNode.git
synced 2025-11-03 06:40:25 +08:00
32 lines
737 B
Go
32 lines
737 B
Go
// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cloud .
|
|
|
|
package waf
|
|
|
|
import (
|
|
"sync"
|
|
|
|
"github.com/TeaOSLab/EdgeNode/internal/utils/zero"
|
|
)
|
|
|
|
var deletedIPListIdMap = map[int64]zero.Zero{} // listId => Zero
|
|
var deletedIPListLocker = sync.RWMutex{}
|
|
|
|
// AddDeletedIPList add deleted ip list
|
|
func AddDeletedIPList(ipListId int64) {
|
|
if ipListId <= 0 {
|
|
return
|
|
}
|
|
|
|
deletedIPListLocker.Lock()
|
|
deletedIPListIdMap[ipListId] = zero.Zero{}
|
|
deletedIPListLocker.Unlock()
|
|
}
|
|
|
|
// ExistDeletedIPList check if ip list has been deleted
|
|
func ExistDeletedIPList(ipListId int64) bool {
|
|
deletedIPListLocker.RLock()
|
|
_, ok := deletedIPListIdMap[ipListId]
|
|
deletedIPListLocker.RUnlock()
|
|
return ok
|
|
}
|