Dernières optimisations
This commit is contained in:
parent
82818f3c94
commit
5dcd3c6405
@ -3,7 +3,6 @@ package lightcontainer.domains;
|
||||
import lightcontainer.domains.client.Context;
|
||||
import lightcontainer.enumerations.TaskStatus;
|
||||
import lightcontainer.protocol.ProtocolWriter;
|
||||
import lightcontainer.utils.Log;
|
||||
|
||||
/**
|
||||
* Une tâche exécutable
|
||||
|
@ -1,6 +1,5 @@
|
||||
package lightcontainer.domains.client;
|
||||
|
||||
import lightcontainer.repository.ClientHandlerRepository;
|
||||
import lightcontainer.repository.ReadOnlyClientRepository;
|
||||
import lightcontainer.storage.File;
|
||||
import lightcontainer.storage.ReadOnlyFile;
|
||||
|
@ -22,7 +22,7 @@ import java.util.Objects;
|
||||
* @version 1.1
|
||||
* @see Runnable
|
||||
* @see AutoCloseable
|
||||
* @since 1.0Z
|
||||
* @since 1.0
|
||||
*/
|
||||
public class StoreProcessor extends UnicastThread implements AutoCloseable {
|
||||
// Variables
|
||||
|
@ -3,7 +3,6 @@ package lightcontainer.domains.server;
|
||||
import lightcontainer.domains.client.StoreProcessor;
|
||||
import lightcontainer.interfaces.MulticastSPR;
|
||||
import lightcontainer.interfaces.ProtocolRepository;
|
||||
import lightcontainer.protocol.ProtocolReader;
|
||||
import lightcontainer.protocol.rules.reader.HelloRule;
|
||||
import lightcontainer.repository.FileFrontEnd;
|
||||
import lightcontainer.utils.Log;
|
||||
@ -11,7 +10,6 @@ import lightcontainer.utils.NetChooser;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.*;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
/**
|
||||
* StoreMulticastRunnable
|
||||
@ -29,7 +27,7 @@ public class MulticastServerListener implements Runnable {
|
||||
private final String multicast_address;
|
||||
private final int multicast_port;
|
||||
private final String network_interface;
|
||||
private FileFrontEnd ffe;
|
||||
private final FileFrontEnd ffe;
|
||||
private final MulticastSPR repository;
|
||||
private final ProtocolRepository protocolRep;
|
||||
|
||||
|
@ -5,15 +5,12 @@ import lightcontainer.domains.client.Context;
|
||||
import lightcontainer.interfaces.ProtocolRepository;
|
||||
import lightcontainer.interfaces.UnicastCHR;
|
||||
import lightcontainer.repository.FileFrontEnd;
|
||||
import lightcontainer.storage.AppData;
|
||||
import lightcontainer.storage.Repository;
|
||||
|
||||
import javax.net.ssl.SSLServerSocket;
|
||||
import javax.net.ssl.SSLServerSocketFactory;
|
||||
import javax.net.ssl.SSLSocket;
|
||||
import java.io.IOException;
|
||||
import java.net.ServerSocket;
|
||||
import java.net.Socket;
|
||||
|
||||
public class UnicastServerListener implements Runnable {
|
||||
// Variables
|
||||
|
@ -1,7 +1,6 @@
|
||||
package lightcontainer.interfaces;
|
||||
|
||||
import lightcontainer.domains.client.ClientHandler;
|
||||
import lightcontainer.domains.server.MulticastServerListener;
|
||||
import lightcontainer.domains.server.UnicastServerListener;
|
||||
import lightcontainer.protocol.ProtocolWriter;
|
||||
import lightcontainer.repository.ClientHandlerRepository;
|
||||
|
@ -1,7 +1,6 @@
|
||||
package lightcontainer.protocol;
|
||||
|
||||
import lightcontainer.domains.client.Context;
|
||||
import lightcontainer.utils.Log;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
|
@ -3,7 +3,6 @@ package lightcontainer.protocol.rules.reader;
|
||||
import lightcontainer.domains.client.Context;
|
||||
import lightcontainer.interfaces.ProtocolRepository;
|
||||
import lightcontainer.protocol.ProtocolReader;
|
||||
import lightcontainer.protocol.StandardizedDefinitions;
|
||||
import lightcontainer.protocol.rules.writer.EraseFileRule;
|
||||
import lightcontainer.protocol.rules.writer.RemoveFileErrorRule;
|
||||
import lightcontainer.storage.ReadOnlyFile;
|
||||
|
@ -3,7 +3,6 @@ package lightcontainer.protocol.rules.reader;
|
||||
import lightcontainer.domains.client.Context;
|
||||
import lightcontainer.interfaces.ProtocolRepository;
|
||||
import lightcontainer.protocol.ProtocolReader;
|
||||
import lightcontainer.protocol.StandardizedDefinitions;
|
||||
import lightcontainer.protocol.rules.writer.GetFileErrorRule;
|
||||
|
||||
import static lightcontainer.protocol.StandardizedDefinitions.SBE_RETRIEVE_RESULT_ERROR;
|
||||
|
@ -6,7 +6,6 @@ import lightcontainer.protocol.ProtocolReader;
|
||||
import lightcontainer.protocol.rules.writer.GetFileErrorRule;
|
||||
import lightcontainer.protocol.rules.writer.GetFileOkRule;
|
||||
import lightcontainer.utils.FileReceiver;
|
||||
import lightcontainer.utils.Log;
|
||||
import lightcontainer.utils.SHA;
|
||||
|
||||
import java.io.InputStream;
|
||||
@ -38,7 +37,7 @@ public class RetrieveOkRule extends ProtocolReader {
|
||||
// Variables
|
||||
private final String filename;
|
||||
private final long filesize;
|
||||
private String hashedFileContent;
|
||||
private final String hashedFileContent;
|
||||
|
||||
public Result(Context context, String filename, long filesize, String hashedFileContent) {
|
||||
super(context);
|
||||
|
@ -3,10 +3,12 @@ package lightcontainer.protocol.rules.reader;
|
||||
import lightcontainer.domains.client.Context;
|
||||
import lightcontainer.interfaces.ProtocolRepository;
|
||||
import lightcontainer.protocol.ProtocolReader;
|
||||
import lightcontainer.protocol.StandardizedDefinitions;
|
||||
import lightcontainer.protocol.rules.writer.SaveFileErrorRule;
|
||||
import lightcontainer.protocol.rules.writer.SendfileRule;
|
||||
import lightcontainer.utils.*;
|
||||
import lightcontainer.utils.AES_GCM;
|
||||
import lightcontainer.utils.FileReceiver;
|
||||
import lightcontainer.utils.SHA;
|
||||
import lightcontainer.utils.ShaHasher;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
@ -3,7 +3,6 @@ package lightcontainer.protocol.rules.reader;
|
||||
import lightcontainer.domains.client.Context;
|
||||
import lightcontainer.interfaces.ProtocolRepository;
|
||||
import lightcontainer.protocol.ProtocolReader;
|
||||
import lightcontainer.protocol.StandardizedDefinitions;
|
||||
import lightcontainer.protocol.rules.writer.SaveFileErrorRule;
|
||||
|
||||
import static lightcontainer.protocol.StandardizedDefinitions.SBE_SEND_RESULT_ERROR;
|
||||
|
@ -3,7 +3,6 @@ package lightcontainer.protocol.rules.reader;
|
||||
import lightcontainer.domains.client.Context;
|
||||
import lightcontainer.interfaces.ProtocolRepository;
|
||||
import lightcontainer.protocol.ProtocolReader;
|
||||
import lightcontainer.protocol.StandardizedDefinitions;
|
||||
import lightcontainer.protocol.rules.writer.SignErrorRule;
|
||||
import lightcontainer.protocol.rules.writer.SignOkRule;
|
||||
|
||||
|
@ -2,7 +2,6 @@ package lightcontainer.protocol.rules.reader;
|
||||
|
||||
import lightcontainer.domains.client.Context;
|
||||
import lightcontainer.protocol.ProtocolReader;
|
||||
import lightcontainer.protocol.StandardizedDefinitions;
|
||||
|
||||
import static lightcontainer.protocol.StandardizedDefinitions.CLIENT_SIGN_OUT;
|
||||
|
||||
|
@ -1,8 +1,6 @@
|
||||
package lightcontainer.protocol.rules.writer;
|
||||
|
||||
import lightcontainer.protocol.ProtocolWriter;
|
||||
import lightcontainer.protocol.StandardizedDefinitions;
|
||||
import lightcontainer.utils.Log;
|
||||
|
||||
import static lightcontainer.protocol.StandardizedDefinitions.FFE_ERASE_FILE;
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
package lightcontainer.protocol.rules.writer;
|
||||
|
||||
import lightcontainer.protocol.ProtocolWriter;
|
||||
import lightcontainer.protocol.StandardizedDefinitions;
|
||||
|
||||
import static lightcontainer.protocol.StandardizedDefinitions.FFE_FILE_LIST_RESULT;
|
||||
|
||||
|
@ -4,7 +4,6 @@ import lightcontainer.domains.client.Context;
|
||||
import lightcontainer.protocol.ProtocolWriter;
|
||||
import lightcontainer.utils.DeepFileEraser;
|
||||
import lightcontainer.utils.FileSender;
|
||||
import lightcontainer.utils.Log;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
|
@ -3,7 +3,6 @@ package lightcontainer.protocol.rules.writer;
|
||||
import lightcontainer.domains.client.Context;
|
||||
import lightcontainer.protocol.ProtocolWriter;
|
||||
import lightcontainer.utils.DeepFileEraser;
|
||||
import lightcontainer.utils.Log;
|
||||
|
||||
import static lightcontainer.protocol.StandardizedDefinitions.FFE_SAVE_FILE_OK;
|
||||
|
||||
|
@ -2,9 +2,7 @@ package lightcontainer.protocol.rules.writer;
|
||||
|
||||
import lightcontainer.domains.client.Context;
|
||||
import lightcontainer.protocol.ProtocolWriter;
|
||||
import lightcontainer.protocol.StandardizedDefinitions;
|
||||
import lightcontainer.utils.FileSender;
|
||||
import lightcontainer.utils.Log;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
|
@ -1,7 +1,6 @@
|
||||
package lightcontainer.protocol.rules.writer;
|
||||
|
||||
import lightcontainer.protocol.ProtocolWriter;
|
||||
import lightcontainer.protocol.StandardizedDefinitions;
|
||||
|
||||
import static lightcontainer.protocol.StandardizedDefinitions.FFE_SIGN_ERROR;
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
package lightcontainer.protocol.rules.writer;
|
||||
|
||||
import lightcontainer.protocol.ProtocolWriter;
|
||||
import lightcontainer.protocol.StandardizedDefinitions;
|
||||
|
||||
import static lightcontainer.protocol.StandardizedDefinitions.FFE_SIGN_OK;
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
package lightcontainer.repository;
|
||||
|
||||
import lightcontainer.domains.Task;
|
||||
import lightcontainer.domains.client.Context;
|
||||
import lightcontainer.domains.client.StoreProcessor;
|
||||
import lightcontainer.domains.Task;
|
||||
import lightcontainer.interfaces.ClientHandlerFFE;
|
||||
import lightcontainer.interfaces.ProtocolRepository;
|
||||
import lightcontainer.interfaces.StoreProcessorFFE;
|
||||
@ -14,7 +14,7 @@ import java.util.concurrent.ConcurrentLinkedDeque;
|
||||
|
||||
public class FileFrontEnd implements ClientHandlerFFE, StoreProcessorFFE {
|
||||
// Variables
|
||||
private Deque<Task> tasks = new ConcurrentLinkedDeque<>();
|
||||
private final Deque<Task> tasks = new ConcurrentLinkedDeque<>();
|
||||
private final ClientHandlerRepository clientRepository; // TODO -> pourquoi pas une interface ? end
|
||||
private final StoreProcessorRepository storeRepository; // TODO -> pourquoi pas une interface ? end
|
||||
private ProtocolRepository protocolRepository;
|
||||
|
@ -8,7 +8,6 @@ import lightcontainer.interfaces.MulticastSPR;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.Set;
|
||||
// TODO : C'est genre un ClientHandlerManager quoi hein, normal qu'il fasse blinder de chose ;)
|
||||
|
||||
|
@ -1,7 +1,5 @@
|
||||
package lightcontainer.storage;
|
||||
|
||||
import lightcontainer.utils.Log;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
@ -1,7 +1,6 @@
|
||||
package lightcontainer.storage;
|
||||
|
||||
import lightcontainer.utils.BCryptHasher;
|
||||
import lightcontainer.utils.Log;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
|
@ -3,7 +3,8 @@ package lightcontainer.utils;
|
||||
import javax.crypto.*;
|
||||
import javax.crypto.spec.GCMParameterSpec;
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
import java.io.*;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.security.*;
|
||||
import java.util.Base64;
|
||||
|
@ -3,12 +3,7 @@ package lightcontainer.utils;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.InputStream;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
import java.security.GeneralSecurityException;
|
||||
import java.security.MessageDigest;
|
||||
import java.util.Base64;
|
||||
|
||||
/**
|
||||
* SHA 256 Hashing and borrowing Class [DO NOT EDIT]
|
||||
|
@ -1 +1,10 @@
|
||||
{"unicast_port":8000,"multicast_ip":"224.66.66.1","multicast_port":15502,"network_interface":"tun0","tls":false,"storagePath":"/home/benjamin/ffe","users":[{"name":"90004142","password":"$2a$10$4/YHWJNlS40X5duOYpRaPOk7XcE5eWXqpTBfnWivDx9BeIjpPxs.u","aes_key":"i7+O+euhXRqgjW2IGmW+5KfPuS+olP11S+J44q4rdnY=","files":[]},{"name":"900024935","password":"$2a$10$nsLkeXZrkpFtvp/Db63cseLvP7DEMtfwMxHbFzF/T15xuYZW1EhC2","aes_key":"hT4t7hB2n3iq/2EdZP32HAbO8o/gY20y9uF0QO/BgaU=","files":[]},{"name":"900039267","password":"$2a$10$kYrVuD.ILwuXdB7FBxOtwupBpGGdSauMOGuA4OUpYobbWE8Fh2VRu","aes_key":"d8ESyVJuCZrDmUY94uKdpCd7IG5ZjOwaAeMEcL6TWvU=","files":[]},{"name":"aaaaa","password":"$2a$10$mhJW5GO3xGKeZBURpdBvi.IuhZBCCosvej/XI3RlPqYsoAb2id8V2","aes_key":"GBKZZ+kmXqb0QEXac9AJZuaAjCykb2m4W+aPNHp4V0Q=","files":[]},{"name":"900038231","password":"$2a$10$8l1ZBBG.fzHVn6XryuXrfemqgBJ/cZXnbNuiGX/iGLOIVXr7dQ1OW","aes_key":"I3jt+93WG5f5nsbyMeBNBS39RRTq03AVeTs2x7wRzew=","files":[]},{"name":"900018980","password":"$2a$10$Z0KO/nc6NliGbFSKNyiGVeEaFTlwIERr6gZEJ3AehC8F3GbKaU2M2","aes_key":"Bxoonmos9zTStu8xoZJ3alsySjXztU1e5km07J8XHbE=","files":[]},{"name":"900031619","password":"$2a$10$/lLbtuR8354764g6MWJgP.yxMQyapwm/wj.n21bUgG.ABlkSoiaKK","aes_key":"m0FlcdCIsTbz/3OSWwr535jozKLYizddIBBgkjG7Bf0=","files":[]},{"name":"123456789","password":"$2a$10$zYzJHeUZXcLPCbeHcvVeGuXxFLAyu6QuPl243M6Jdm1LJzq5RzmuW","aes_key":"D22bldMnDxgR1YWEdzcSNqG0Jqwi5AWlcFKZhuH9/jk=","files":[]},{"name":"900033729","password":"$2a$10$/xovzQW0k.i/91z9AtyKuOaz./XEYJantFER3uPxeFvNvuE6rQzv.","aes_key":"j/CCk8TH0TZ96SyA+R76bAJP9l5sx4hXFrGKQ1+Eixo=","files":[]},{"name":"900015602","password":"$2a$10$48WmUiwoOafmyq74jTcj1uC3Q3Pccl7B1LEBxZMwz.Chj9P0hvIgu","aes_key":"eKGrhHdsHodSubNDWXG1IxrkdZO7MjHD317qLxnmQB8=","files":[]},{"name":"900030864","password":"$2a$10$VHHHic9iaMGQAQvwlEHhfOed0kIt1Im2SiD7wrtOuzl5ZbeTzqNJK","aes_key":"i5yTL2okyVTKkxaHYSB6JeG3o+v4HkIBohFyCYeraBI=","files":[]},{"name":"900013901","password":"$2a$10$aFYP84tfEmRrbOHZf6wTou8NFlVynOSmeYTNKo0kZqPFUMc.IN1uq","aes_key":"0Bk+UvERHWZX8t5pRnN0adX89rR9QQBrFkW+g50NzgY=","files":[]},{"name":"900021093","password":"$2a$10$1Vf4XUaH8qZrVV7U3ynUD.8AJyqvXaGFYA/XPNrNShznAxfrM9UB2","aes_key":"18Hlf3PsCzAO4MawJdZONENW3n1QLeUp0DtlFP6tzz8=","files":[]},{"name":"900042724","password":"$2a$10$QmWBlwkP.K08mY4XDf8WmOxepXvpBWOGpqrNrPQuRbK8fklUw9V5q","aes_key":"d+Ts4ri4hFbZdO3HXfza4ycAHDq0YdxBQ503DsC24CE=","files":[]},{"name":"900028534","password":"$2a$10$HUFfWTMSWay1EL5t1uidSe58GPREvavjN1SsDo/4CM58WWo1obiX2","aes_key":"ZikM2g8iTS5vLsENkcespYlEQhgQFpBW5k1CFifXZpo=","files":[]},{"name":"90006184","password":"$2a$10$GslCWOSL1znNJYR80xbvIuoDmaWN2FoNmk1fzqfhXdHJgOsRIU2F.","aes_key":"iCgLxd7w3XFHVeoldSuyrlRierCkiD1F33QaQqQ+RV8=","files":[]},{"name":"900043975","password":"$2a$10$C7aaCyVoga63NhQRFvNT0uZmw/i5nQZkl.kYzQE7m99OtEMMoz03e","aes_key":"t5J/WIryBVIaxuxhsnlGJtNdd13TD/+JiJ703TxJQbI=","files":[]},{"name":"900026119","password":"$2a$10$Uu8hTLKJ6laJk4Hnxqw6rOcbws.MK4mSHvGhGSsfNgVoIAeACz302","aes_key":"Yt9OFnVdL4Q6OrGPL3JJbsMydZ3mpLR8FLip5Y5asBw=","files":[]},{"name":"900049525","password":"$2a$10$91Yhg.if8Cb/6iVeh7Hq2.WJq7PGDaZBWlJZ5nQihrokBqfVcaHQ6","aes_key":"CjA40gwN/NgmlTbgAVJwGbIK4lQTpHKLfqFoY4eYabI=","files":[]},{"name":"900049924","password":"$2a$10$ahfO42ImHO8n9CM6HzvUBuv7GoVx2U29aPo2w/6YBlfkd97oD0B0G","aes_key":"iioHKN0vMqrI2q/42ho3Wz99CKOYhVUwg+KvL0hp16Y=","files":[]},{"name":"900049517","password":"$2a$10$8IQr27MBkYZI0Fvh9UBwvekTM6PYsbRK4BJS/TweSYC3XdPyDEk0e","aes_key":"WgcV03geOWoVsE29g3zJeM44r9sK6HqoRK4qLwQ9jyQ=","files":[]}]}
|
||||
{
|
||||
"unicast_port": 8000,
|
||||
"multicast_ip": "224.66.66.1",
|
||||
"multicast_port": 15502,
|
||||
"network_interface": "tun0",
|
||||
"tls": false,
|
||||
"storagePath": "C:\\Users\\ledou\\Documents\\ffe",
|
||||
"users": [
|
||||
]
|
||||
}
|
@ -3,9 +3,6 @@
|
||||
*/
|
||||
package lightcontainer;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
class AppTest {
|
||||
// @Test void appHasAGreeting() {
|
||||
// App classUnderTest = new App();
|
||||
|
@ -3,8 +3,6 @@ package lightcontainer.protocol.rules.reader;
|
||||
import lightcontainer.protocol.ProtocolReader;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
class HelloRuleTest {
|
||||
|
||||
@Test
|
||||
|
@ -1,11 +1,7 @@
|
||||
package lightcontainer.protocol.rules.writer;
|
||||
|
||||
import lightcontainer.protocol.ProtocolWriter;
|
||||
import lightcontainer.protocol.rules.reader.SignoutRule;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
class SignoutRuleTest {
|
||||
|
||||
@Test
|
||||
|
@ -1,13 +1,5 @@
|
||||
package lightcontainer.storage;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
|
||||
public class JsonAdapterTests {
|
||||
/*
|
||||
@Test
|
||||
|
@ -1,17 +1,5 @@
|
||||
package lightcontainer.storage;
|
||||
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
|
||||
public class RepositoryTests {
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user