1
0
Fork 0

add pubkey auth

This commit is contained in:
Sen 2025-05-29 03:04:44 +02:00
parent bdf67a89f7
commit 5a394749bf
Signed by: sen
GPG key ID: 3AC50A6F47D1B722
24 changed files with 822 additions and 107 deletions

View file

@ -41,6 +41,7 @@ import client.audio.Volume;
import client.gui.FileCallback;
import client.gui.Font;
import client.gui.Gui;
import client.gui.GuiConnect.ServerInfo;
import client.gui.GuiConsole;
import client.gui.GuiInfo;
import client.gui.GuiLoading;
@ -513,14 +514,14 @@ public class Client implements IThreadListener {
return networkmanager;
}
public void connect(String address, int port, String user, String pass, String access) {
this.displayGuiScreen(GuiLoading.makeWaitTask("Verbinde zu " + (address == null ? "localhost" : address) + ":" + port + " ..."));
Log.NETWORK.info("Verbinde zu " + (address == null ? "localhost" : address) + ":" + port);
public void connect(ServerInfo server) {
this.displayGuiScreen(GuiLoading.makeWaitTask("Verbinde zu " + (server.getAddress() == null ? "localhost" : server.getAddress()) + ":" + server.getPort() + " ..."));
Log.NETWORK.info("Verbinde zu " + (server.getAddress() == null ? "localhost" : server.getAddress()) + ":" + server.getPort());
final NetConnection connection;
try
{
connection = createNetworkManagerAndConnect(address == null ? InetAddress.getLoopbackAddress() : InetAddress.getByName(IDN.toASCII(address)), port);
connection.setNetHandler(new ClientLoginHandler(connection, this, user, access, pass));
connection = createNetworkManagerAndConnect(server.getAddress() == null ? InetAddress.getLoopbackAddress() : InetAddress.getByName(IDN.toASCII(server.getAddress())), server.getPort());
connection.setNetHandler(new ClientLoginHandler(connection, this, server));
connection.sendPacket(new HPacketHandshake(Util.PROTOCOL), new GenericFutureListener<Future<? super Void>>() {
public void operationComplete(Future<? super Void> u) throws Exception {
connection.setConnectionState(PacketRegistry.LOGIN);
@ -530,7 +531,7 @@ public class Client implements IThreadListener {
catch (UnknownHostException u)
{
Log.NETWORK.error(u, "Konnte nicht zu Server verbinden");
this.disconnected("Unbekannter Hostname: " + (address == null ? "localhost" : address));
this.disconnected("Unbekannter Hostname: " + (server.getAddress() == null ? "localhost" : server.getAddress()));
return;
}
catch (Exception e)