Skip to content

Commit

Permalink
bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Ghost-chu committed Jan 1, 2025
1 parent 9fa1d92 commit bf0ede0
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,19 @@ SELECT time_bucket('7 day', "insert_time") AS bucket, peer_ip, COUNT(DISTINCT us
GROUP BY bucket, peer_ip ORDER BY count DESC
*/
banHistoryRepository
var ips = banHistoryRepository
.generateUntrustedIPAddresses(
TimeUtil.toUTC(System.currentTimeMillis() - untrustedIpAddressGenerateOffset),
OffsetDateTime.now(),
untrustedIpAddressGenerateThreshold
);
ips.forEach(inet -> {
try {
ipTries.add(IPUtil.toIPAddress(inet.getHostAddress()));
} catch (Exception e) {
log.error("Unable to convert IP address: {}", inet.getHostAddress(), e);
}
});
filterIP(ipTries);
var untrustedIps = ipMerger.merge(ipTries).stream().distinct().map(ip -> new AnalysedRule(null, ip, UNTRUSTED_IP, "Auto Generated by Sparkle")).toList();
meterRegistry.gauge("sparkle_analyse_untrusted_ip_address", Collections.emptyList(), untrustedIps.size());
Expand Down

0 comments on commit bf0ede0

Please sign in to comment.