github.com/TeaOSLab/EdgeNode@v1.3.8/internal/waf/ip_lists_deleted.go (about) 1 // Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn . 2 3 package waf 4 5 import ( 6 "github.com/TeaOSLab/EdgeNode/internal/zero" 7 "sync" 8 ) 9 10 var deletedIPListIdMap = map[int64]zero.Zero{} // listId => Zero 11 var deletedIPListLocker = sync.RWMutex{} 12 13 // AddDeletedIPList add deleted ip list 14 func AddDeletedIPList(ipListId int64) { 15 if ipListId <= 0 { 16 return 17 } 18 19 deletedIPListLocker.Lock() 20 deletedIPListIdMap[ipListId] = zero.Zero{} 21 deletedIPListLocker.Unlock() 22 } 23 24 // ExistDeletedIPList check if ip list has been deleted 25 func ExistDeletedIPList(ipListId int64) bool { 26 deletedIPListLocker.RLock() 27 _, ok := deletedIPListIdMap[ipListId] 28 deletedIPListLocker.RUnlock() 29 return ok 30 }