ip 请求次数限制4 日志修改2
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user