mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-11-15 03:31:15 +03:00
Случайный порт при передаче параметров
This commit is contained in:
parent
311fee0443
commit
a9a9a78983
5 changed files with 12 additions and 1 deletions
|
@ -83,6 +83,11 @@ public void setPort(int port) {
|
|||
body.append(port);
|
||||
body.append(";");
|
||||
}
|
||||
public void setClientPort(int port) {
|
||||
body.append("this.clientPort = ");
|
||||
body.append(port);
|
||||
body.append(";");
|
||||
}
|
||||
|
||||
public ClassPool getPool() {
|
||||
return pool;
|
||||
|
|
|
@ -173,6 +173,7 @@ private void stdBuild() throws IOException {
|
|||
jaConfigurator.setPort(server.config.port);
|
||||
jaConfigurator.setProjectName(server.config.projectName);
|
||||
jaConfigurator.setSecretKey(SecurityHelper.randomStringToken());
|
||||
jaConfigurator.setClientPort(32148 + SecurityHelper.newRandom().nextInt(512));
|
||||
server.buildHookManager.registerAllClientModuleClass(jaConfigurator);
|
||||
try (ZipInputStream input = new ZipInputStream(
|
||||
IOHelper.newInput(IOHelper.getResourceURL("Launcher.jar")))) {
|
||||
|
|
|
@ -160,7 +160,7 @@ public void write(HOutput output) throws IOException {
|
|||
|
||||
private static final String[] EMPTY_ARRAY = new String[0];
|
||||
private static final String SOCKET_HOST = "127.0.0.1";
|
||||
private static final int SOCKET_PORT = 32148;
|
||||
private static final int SOCKET_PORT = Launcher.getConfig().clientPort;
|
||||
private static final String MAGICAL_INTEL_OPTION = "-XX:HeapDumpPath=ThisTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump";
|
||||
private static final boolean isUsingWrapper = true;
|
||||
@SuppressWarnings("unused")
|
||||
|
|
|
@ -4,6 +4,7 @@ public class AutogenConfig {
|
|||
public String projectname;
|
||||
public String address;
|
||||
public int port;
|
||||
public int clientPort;
|
||||
private boolean isInitModules;
|
||||
public String secretKeyClient;
|
||||
|
||||
|
|
|
@ -34,6 +34,7 @@ public static AutogenConfig getAutogenConfig() {
|
|||
public final InetSocketAddress address;
|
||||
@LauncherAPI
|
||||
public final String projectname;
|
||||
public final int clientPort;
|
||||
public String secretKeyClient;
|
||||
@LauncherAPI
|
||||
public final RSAPublicKey publicKey;
|
||||
|
@ -48,6 +49,7 @@ public LauncherConfig(HInput input) throws IOException, InvalidKeySpecException
|
|||
ADDRESS_OVERRIDE == null ? localAddress : ADDRESS_OVERRIDE, config.port);
|
||||
publicKey = SecurityHelper.toPublicRSAKey(input.readByteArray(SecurityHelper.CRYPTO_MAX_LENGTH));
|
||||
projectname = config.projectname;
|
||||
clientPort = config.clientPort;
|
||||
secretKeyClient = config.secretKeyClient;
|
||||
// Read signed runtime
|
||||
int count = input.readLength(0);
|
||||
|
@ -72,6 +74,7 @@ public LauncherConfig(String address, int port, RSAPublicKey publicKey, Map<Stri
|
|||
this.publicKey = Objects.requireNonNull(publicKey, "publicKey");
|
||||
this.runtime = Collections.unmodifiableMap(new HashMap<>(runtime));
|
||||
this.projectname = projectname;
|
||||
this.clientPort = 32148;
|
||||
}
|
||||
|
||||
@LauncherAPI
|
||||
|
@ -81,6 +84,7 @@ public LauncherConfig(String address, int port, RSAPublicKey publicKey, Map<Stri
|
|||
this.publicKey = Objects.requireNonNull(publicKey, "publicKey");
|
||||
this.runtime = Collections.unmodifiableMap(new HashMap<>(runtime));
|
||||
this.projectname = "Minecraft";
|
||||
this.clientPort = 32148;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue