mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-10-02 14:56:38 +08:00
[优化] 添加自动 IP 组功能,支持按 Expr 规则聚合请求日志并更新 IP 列表
This commit is contained in:
@@ -130,6 +130,10 @@ func ListNodeAccessLogs(query NodeAccessLogQuery) (logs []*NodeAccessLog, err er
|
||||
return all[start:end], nil
|
||||
}
|
||||
|
||||
func ListNodeAccessLogsForWAFIPGroup(query NodeAccessLogQuery) ([]*NodeAccessLog, error) {
|
||||
return listNodeAccessLogsAcrossShards(query)
|
||||
}
|
||||
|
||||
func CountNodeAccessLogs(query NodeAccessLogQuery) (totalRecords int64, totalIPs int64, err error) {
|
||||
all, err := listNodeAccessLogsAcrossShards(query)
|
||||
if err != nil {
|
||||
|
||||
@@ -119,9 +119,9 @@ func ListWAFIPGroupsByIDs(ids []uint) ([]*WAFIPGroup, error) {
|
||||
return groups, err
|
||||
}
|
||||
|
||||
func ListDueSubscriptionWAFIPGroups(now time.Time) ([]*WAFIPGroup, error) {
|
||||
func ListDueWAFIPGroups(now time.Time) ([]*WAFIPGroup, error) {
|
||||
var groups []*WAFIPGroup
|
||||
err := DB.Where("type = ? AND enabled = ? AND subscription_url <> '' AND (next_sync_at IS NULL OR next_sync_at <= ?)", "subscription", true, now).
|
||||
err := DB.Where("enabled = ? AND (type = ? OR (type = ? AND subscription_url <> '')) AND (next_sync_at IS NULL OR next_sync_at <= ?)", true, "automatic", "subscription", now).
|
||||
Order("id asc").
|
||||
Find(&groups).Error
|
||||
return groups, err
|
||||
|
||||
Reference in New Issue
Block a user