feat: add get private socket endpoint

This commit is contained in:
2024-01-19 21:47:22 +01:00
parent be69093c1d
commit 21cb673d33
12 changed files with 177 additions and 3 deletions

View File

@@ -1,12 +1,15 @@
package fr.titionfire.ffsaf.net2;
import com.fasterxml.jackson.databind.JsonNode;
import fr.titionfire.ffsaf.domain.service.ClubService;
import fr.titionfire.ffsaf.domain.service.CombService;
import fr.titionfire.ffsaf.net2.packet.IAction;
import fr.titionfire.ffsaf.net2.packet.RegisterAction;
import fr.titionfire.ffsaf.utils.Pair;
import io.quarkus.runtime.ShutdownEvent;
import io.quarkus.runtime.StartupEvent;
import jakarta.enterprise.event.Observes;
import jakarta.inject.Inject;
import jakarta.inject.Singleton;
import org.eclipse.microprofile.config.inject.ConfigProperty;
import org.jboss.logging.Logger;
@@ -25,8 +28,6 @@ import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Stream;
import jakarta.inject.Inject;
@Singleton
public class ServerCustom extends Thread {
private static final Logger LOGGER = Logger.getLogger("SocketServer");
@@ -38,6 +39,8 @@ public class ServerCustom extends Thread {
private SSLServerSocket server;
private boolean run;
private static ServerCustom serverCustom;
@ConfigProperty(name = "internal-port")
int port;
@@ -50,6 +53,12 @@ public class ServerCustom extends Thread {
@Inject
protected Scheduler quartz;
@Inject
public CombService combService;
@Inject
public ClubService clubService;
private PublicKey publicKey;
private X509TrustManager tm(KeyStore keystore) throws NoSuchAlgorithmException, KeyStoreException {
@@ -134,6 +143,7 @@ public class ServerCustom extends Thread {
void onStart(@Observes StartupEvent ev) {
LOGGER.info("The server is starting...");
serverCustom = this;
this.start();
}
@@ -142,6 +152,10 @@ public class ServerCustom extends Thread {
this.stop2();
}
public static ServerCustom getInstance(){
return serverCustom;
}
public Stream<Client_Thread> get_clients() {
return clients.stream();
}