ip 请求次数限制4 日志修改2

This commit is contained in:
GYJ
2025-03-23 21:03:50 +08:00
parent 9e93e0b7d2
commit 383f08ef4d

View File

@@ -56,7 +56,6 @@ public class IpAccessCounter {
// 检查 IP 是否可以访问
public static boolean canAccess(String ip, Integer maxAccessCount) {
if (isBlacklisted(ip)) {
log.info("IpAccessCounter IP {} 被阻止访问,因为在黑名单中", ip);
return false;
}
long currentTime = System.currentTimeMillis();
@@ -81,7 +80,6 @@ public class IpAccessCounter {
private static void addToBlacklist(String ip) {
BLACKLIST.put(ip, System.currentTimeMillis());
IP_ACCESS_TIMES.remove(ip);
log.info("IP {} 已加入黑名单", ip);
}
public static void main(String[] args) throws InterruptedException {