mirror of
https://github.com/TuxCoding/FastLogin.git
synced 2025-07-30 10:47:33 +02:00
Limit expire timer
This commit is contained in:
@ -47,6 +47,8 @@ import static java.util.stream.Collectors.toSet;
|
|||||||
*/
|
*/
|
||||||
public class FastLoginCore<P extends C, C, T extends PlatformPlugin<C>> {
|
public class FastLoginCore<P extends C, C, T extends PlatformPlugin<C>> {
|
||||||
|
|
||||||
|
private static final long MAX_EXPIRE_RATE = 1_000_000;
|
||||||
|
|
||||||
private final Map<String, String> localeMessages = new ConcurrentHashMap<>();
|
private final Map<String, String> localeMessages = new ConcurrentHashMap<>();
|
||||||
private final ConcurrentMap<String, Object> pendingLogin = CommonUtil.buildCache(5, -1);
|
private final ConcurrentMap<String, Object> pendingLogin = CommonUtil.buildCache(5, -1);
|
||||||
private final Collection<UUID> pendingConfirms = new HashSet<>();
|
private final Collection<UUID> pendingConfirms = new HashSet<>();
|
||||||
@ -88,8 +90,12 @@ public class FastLoginCore<P extends C, C, T extends PlatformPlugin<C>> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int maxCon = config.getInt("anti-bot.connections", 200);
|
int maxCon = config.getInt("anti-bot.connections", 200);
|
||||||
int expireTime = config.getInt("anti-bot.expire", 5);
|
long expireTime = config.getInt("anti-bot.expire", 5) * 60 * 1_000L;
|
||||||
rateLimiter = new RateLimiter(maxCon, expireTime * 60 * 1_000);
|
if (expireTime > MAX_EXPIRE_RATE) {
|
||||||
|
expireTime = MAX_EXPIRE_RATE;
|
||||||
|
}
|
||||||
|
|
||||||
|
rateLimiter = new RateLimiter(maxCon, expireTime);
|
||||||
Set<Proxy> proxies = config.getStringList("proxies")
|
Set<Proxy> proxies = config.getStringList("proxies")
|
||||||
.stream()
|
.stream()
|
||||||
.map(HostAndPort::fromString)
|
.map(HostAndPort::fromString)
|
||||||
|
Reference in New Issue
Block a user