mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-12-22 08:31:07 +03:00
[ANY] Remove reg limiter
This commit is contained in:
parent
b7b7afbdbb
commit
c9ccf36252
4 changed files with 0 additions and 56 deletions
|
@ -11,7 +11,6 @@ public abstract class Component {
|
|||
public static void registerComponents() {
|
||||
if (!registredComp) {
|
||||
providers.register("authLimiter", AuthLimiterComponent.class);
|
||||
providers.register("regLimiter", RegLimiterComponent.class);
|
||||
providers.register("commandRemover", CommandRemoverComponent.class);
|
||||
providers.register("proguard", ProGuardComponent.class);
|
||||
providers.register("whitelist", WhitelistComponent.class);
|
||||
|
|
|
@ -1,34 +0,0 @@
|
|||
package pro.gravit.launchserver.components;
|
||||
|
||||
import pro.gravit.launchserver.LaunchServer;
|
||||
import pro.gravit.launchserver.manangers.hook.AuthHookManager;
|
||||
import pro.gravit.utils.HookException;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class RegLimiterComponent extends IPLimiter implements AutoCloseable {
|
||||
|
||||
public transient LaunchServer launchServer;
|
||||
public String message;
|
||||
|
||||
public List<String> excludeIps = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
public void init(LaunchServer launchServer) {
|
||||
this.launchServer = launchServer;
|
||||
launchServer.authHookManager.registraion.registerHook(this::registerHook);
|
||||
}
|
||||
|
||||
public boolean registerHook(AuthHookManager.RegContext context) {
|
||||
if (!check(context.ip)) {
|
||||
throw new HookException(message);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
launchServer.authHookManager.registraion.unregisterHook(this::registerHook);
|
||||
}
|
||||
}
|
|
@ -15,7 +15,6 @@
|
|||
import pro.gravit.launchserver.components.AuthLimiterComponent;
|
||||
import pro.gravit.launchserver.components.Component;
|
||||
import pro.gravit.launchserver.components.ProGuardComponent;
|
||||
import pro.gravit.launchserver.components.RegLimiterComponent;
|
||||
import pro.gravit.utils.helper.JVMHelper;
|
||||
|
||||
import java.io.File;
|
||||
|
@ -87,11 +86,6 @@ public static LaunchServerConfig getDefault(LaunchServer.LaunchServerEnv env) {
|
|||
authLimiterComponent.rateLimitMillis = SECONDS.toMillis(8);
|
||||
authLimiterComponent.message = "Превышен лимит авторизаций";
|
||||
newConfig.components.put("authLimiter", authLimiterComponent);
|
||||
RegLimiterComponent regLimiterComponent = new RegLimiterComponent();
|
||||
regLimiterComponent.rateLimit = 3;
|
||||
regLimiterComponent.rateLimitMillis = HOURS.toMillis(10);
|
||||
regLimiterComponent.message = "Превышен лимит регистраций";
|
||||
newConfig.components.put("regLimiter", regLimiterComponent);
|
||||
ProGuardComponent proGuardComponent = new ProGuardComponent();
|
||||
newConfig.components.put("proguard", proGuardComponent);
|
||||
return newConfig;
|
||||
|
|
|
@ -16,19 +16,4 @@ public class AuthHookManager {
|
|||
public final BiHookSet<AuthManager.CheckServerReport, Client> postCheckServerHook = new BiHookSet<>();
|
||||
public final BiHookSet<JoinServerResponse, Client> joinServerHook = new BiHookSet<>();
|
||||
public final BiHookSet<SetProfileResponse, Client> setProfileHook = new BiHookSet<>();
|
||||
public final HookSet<RegContext> registraion = new HookSet<>();
|
||||
|
||||
public static class RegContext {
|
||||
public final String login;
|
||||
public final String password;
|
||||
public final String ip;
|
||||
public final boolean trustContext;
|
||||
|
||||
public RegContext(String login, String password, String ip, boolean trustContext) {
|
||||
this.login = login;
|
||||
this.password = password;
|
||||
this.ip = ip;
|
||||
this.trustContext = trustContext;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue