diff --git a/README.MD b/README.MD
index c082761..b405884 100644
--- a/README.MD
+++ b/README.MD
@@ -85,7 +85,7 @@ public class Server extends ProtocolServer {
import me.openautonomousconnection.protocol.ProtocolBridge;
import me.openautonomousconnection.protocol.ProtocolSettings;
import me.openautonomousconnection.protocol.ProtocolVersion;
-import me.openautonomousconnection.protocol.domain.Domain;
+import me.openautonomousconnection.protocol.infoName.Domain;
import me.openautonomousconnection.protocol.side.ProtocolClient;
import me.openautonomousconnection.protocol.utils.SiteType;
@@ -103,7 +103,7 @@ public class Client extends ProtocolClient {
}
@Override
- public void handleHTMLContent(SiteType siteType, Domain domain, String htmlContent) {
+ public void handleHTMLContent(SiteType siteType, Domain infoName, String htmlContent) {
System.out.println("Website html content received. This site is " + siteType.name);
System.out.println(htmlContent); // Render content in a webview for example
}
diff --git a/pom.xml b/pom.xml
index cbb86c6..5831d6b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -87,7 +87,7 @@
dev.unlegitdqrk
unlegitlibrary
- 1.6.5
+ 1.6.6
org.projectlombok
diff --git a/src/main/java/org/openautonomousconnection/protocol/ProtocolBridge.java b/src/main/java/org/openautonomousconnection/protocol/ProtocolBridge.java
index 37bb447..9055d75 100644
--- a/src/main/java/org/openautonomousconnection/protocol/ProtocolBridge.java
+++ b/src/main/java/org/openautonomousconnection/protocol/ProtocolBridge.java
@@ -5,20 +5,20 @@ import lombok.Getter;
import lombok.Setter;
import org.openautonomousconnection.protocol.annotations.ProtocolInfo;
import org.openautonomousconnection.protocol.listeners.ClientListener;
-import org.openautonomousconnection.protocol.listeners.DNSServerListener;
+import org.openautonomousconnection.protocol.listeners.INSServerListener;
import org.openautonomousconnection.protocol.listeners.WebServerListener;
import org.openautonomousconnection.protocol.packets.OACPacket;
import org.openautonomousconnection.protocol.packets.v1_0_0.beta.AuthPacket;
import org.openautonomousconnection.protocol.packets.v1_0_0.beta.GetDestinationPacket;
import org.openautonomousconnection.protocol.packets.v1_0_0.beta.UnsupportedClassicPacket;
-import org.openautonomousconnection.protocol.packets.v1_0_0.beta.ValidateDomainPacket;
+import org.openautonomousconnection.protocol.packets.v1_0_0.beta.ValidateInfoNamePacket;
import org.openautonomousconnection.protocol.packets.v1_0_0.classic.Classic_DomainPacket;
import org.openautonomousconnection.protocol.side.client.ProtocolClient;
-import org.openautonomousconnection.protocol.side.dns.ProtocolDNSServer;
+import org.openautonomousconnection.protocol.side.ins.ProtocolINSServer;
import org.openautonomousconnection.protocol.side.web.ProtocolWebServer;
import org.openautonomousconnection.protocol.versions.ProtocolVersion;
import org.openautonomousconnection.protocol.versions.v1_0_0.classic.handlers.ClassicHandlerClient;
-import org.openautonomousconnection.protocol.versions.v1_0_0.classic.handlers.ClassicHandlerDNSServer;
+import org.openautonomousconnection.protocol.versions.v1_0_0.classic.handlers.ClassicHandlerINSServer;
import org.openautonomousconnection.protocol.versions.v1_0_0.classic.handlers.ClassicHandlerWebServer;
import org.openautonomousconnection.protocol.versions.v1_0_0.classic.utils.Classic_ClientListener;
@@ -53,7 +53,7 @@ public final class ProtocolBridge {
* The protocol side instances
*/
@Getter
- private ProtocolDNSServer protocolDNSServer;
+ private ProtocolINSServer protocolINSServer;
/**
* The protocol side instances
@@ -68,11 +68,11 @@ public final class ProtocolBridge {
private ProtocolWebServer protocolWebServer;
/**
- * The classic protocol handlers for dns server side
+ * The classic protocol handlers for INS server side
*/
@Getter
@Setter
- private ClassicHandlerDNSServer classicHandlerDNSServer;
+ private ClassicHandlerINSServer classicHandlerINSServer;
/**
* The classic protocol handlers for web server side
@@ -96,19 +96,19 @@ public final class ProtocolBridge {
private Proxy proxy;
/**
- * Initialize the ProtocolBridge instance for the DNS server side
+ * Initialize the ProtocolBridge instance for the INS server side
*
- * @param protocolDNSServer The ProtocolDNSServer instance
+ * @param protocolINSServer The ProtocolINSServer instance
* @param protocolSettings The ProtocolSettings instance
* @param protocolVersion The ProtocolVersion instance
* @param logFolder The folder to store the log files
* @throws Exception if an error occurs while initializing the ProtocolBridge
*/
- @ProtocolInfo(protocolSide = ProtocolVersion.ProtocolSide.DNS)
- public ProtocolBridge(ProtocolDNSServer protocolDNSServer, ProtocolSettings protocolSettings, ProtocolVersion protocolVersion, File logFolder) throws Exception {
+ @ProtocolInfo(protocolSide = ProtocolVersion.ProtocolSide.INS)
+ public ProtocolBridge(ProtocolINSServer protocolINSServer, ProtocolSettings protocolSettings, ProtocolVersion protocolVersion, File logFolder) throws Exception {
// Assign the parameters to the class fields
- this.protocolDNSServer = protocolDNSServer;
- this.protocolDNSServer.setProtocolBridge(this);
+ this.protocolINSServer = protocolINSServer;
+ this.protocolINSServer.setProtocolBridge(this);
this.protocolSettings = protocolSettings;
this.protocolVersion = protocolVersion;
@@ -189,14 +189,14 @@ public final class ProtocolBridge {
// 1.0.0-BETA packets
AuthPacket v100bAuthPath = new AuthPacket();
UnsupportedClassicPacket v100bUnsupportedClassicPacket = new UnsupportedClassicPacket();
- ValidateDomainPacket v100bValidateDomainPacket = new ValidateDomainPacket();
+ ValidateInfoNamePacket v100BValidateInfoNamePacket = new ValidateInfoNamePacket();
GetDestinationPacket v100bGetDestinationPacket = new GetDestinationPacket();
if (isPacketSupported(v100bAuthPath)) protocolSettings.packetHandler.registerPacket(v100bAuthPath);
if (isPacketSupported(v100bUnsupportedClassicPacket))
protocolSettings.packetHandler.registerPacket(v100bUnsupportedClassicPacket);
- if (isPacketSupported(v100bValidateDomainPacket))
- protocolSettings.packetHandler.registerPacket(v100bValidateDomainPacket);
+ if (isPacketSupported(v100BValidateInfoNamePacket))
+ protocolSettings.packetHandler.registerPacket(v100BValidateInfoNamePacket);
if (isPacketSupported(v100bGetDestinationPacket))
protocolSettings.packetHandler.registerPacket(v100bGetDestinationPacket);
}
@@ -211,9 +211,9 @@ public final class ProtocolBridge {
if (isClassicSupported()) protocolSettings.eventManager.registerListener(Classic_ClientListener.class);
else protocolSettings.eventManager.unregisterListener(Classic_ClientListener.class);
- // DNS Listeners
- if (isRunningAsDNSServer()) {
- protocolSettings.eventManager.registerListener(DNSServerListener.class);
+ // INS Listeners
+ if (isRunningAsINSServer()) {
+ protocolSettings.eventManager.registerListener(INSServerListener.class);
protocolSettings.eventManager.unregisterListener(WebServerListener.class);
protocolSettings.eventManager.unregisterListener(ClientListener.class);
}
@@ -221,14 +221,14 @@ public final class ProtocolBridge {
// Web Listeners
if (isRunningAsWebServer()) {
protocolSettings.eventManager.registerListener(WebServerListener.class);
- protocolSettings.eventManager.unregisterListener(DNSServerListener.class);
+ protocolSettings.eventManager.unregisterListener(INSServerListener.class);
protocolSettings.eventManager.unregisterListener(ClientListener.class);
}
// Client Listeners
if (isRunningAsClient()) {
protocolSettings.eventManager.registerListener(ClientListener.class);
- protocolSettings.eventManager.unregisterListener(DNSServerListener.class);
+ protocolSettings.eventManager.unregisterListener(INSServerListener.class);
protocolSettings.eventManager.unregisterListener(WebServerListener.class);
}
}
@@ -333,27 +333,27 @@ public final class ProtocolBridge {
return
(isRunningAsClient() && protocolVersion.getProtocolSide() == ProtocolVersion.ProtocolSide.CLIENT) ||
(isRunningAsClient() && protocolVersion.getProtocolSide() == ProtocolVersion.ProtocolSide.CLIENT_WEB) ||
- (isRunningAsClient() && protocolVersion.getProtocolSide() == ProtocolVersion.ProtocolSide.CLIENT_DNS) ||
+ (isRunningAsClient() && protocolVersion.getProtocolSide() == ProtocolVersion.ProtocolSide.CLIENT_INS) ||
(isRunningAsClient() && protocolVersion.getProtocolSide() == ProtocolVersion.ProtocolSide.ALL) ||
(isRunningAsWebServer() && protocolVersion.getProtocolSide() == ProtocolVersion.ProtocolSide.WEB) ||
(isRunningAsWebServer() && protocolVersion.getProtocolSide() == ProtocolVersion.ProtocolSide.CLIENT_WEB) ||
- (isRunningAsWebServer() && protocolVersion.getProtocolSide() == ProtocolVersion.ProtocolSide.WEB_DNS) ||
+ (isRunningAsWebServer() && protocolVersion.getProtocolSide() == ProtocolVersion.ProtocolSide.WEB_INS) ||
(isRunningAsWebServer() && protocolVersion.getProtocolSide() == ProtocolVersion.ProtocolSide.ALL) ||
- (isRunningAsDNSServer() && protocolVersion.getProtocolSide() == ProtocolVersion.ProtocolSide.DNS) ||
- (isRunningAsDNSServer() && protocolVersion.getProtocolSide() == ProtocolVersion.ProtocolSide.WEB_DNS) ||
- (isRunningAsDNSServer() && protocolVersion.getProtocolSide() == ProtocolVersion.ProtocolSide.CLIENT_DNS) ||
- (isRunningAsDNSServer() && protocolVersion.getProtocolSide() == ProtocolVersion.ProtocolSide.ALL);
+ (isRunningAsINSServer() && protocolVersion.getProtocolSide() == ProtocolVersion.ProtocolSide.INS) ||
+ (isRunningAsINSServer() && protocolVersion.getProtocolSide() == ProtocolVersion.ProtocolSide.WEB_INS) ||
+ (isRunningAsINSServer() && protocolVersion.getProtocolSide() == ProtocolVersion.ProtocolSide.CLIENT_INS) ||
+ (isRunningAsINSServer() && protocolVersion.getProtocolSide() == ProtocolVersion.ProtocolSide.ALL);
}
/**
- * Check if the current instance is running as a DNS server
+ * Check if the current instance is running as a INS server
*
- * @return true if the current instance is running as a DNS server, false otherwise
+ * @return true if the current instance is running as a INS server, false otherwise
*/
- public boolean isRunningAsDNSServer() {
- return protocolDNSServer != null;
+ public boolean isRunningAsINSServer() {
+ return protocolINSServer != null;
}
/**
diff --git a/src/main/java/org/openautonomousconnection/protocol/listeners/ClientListener.java b/src/main/java/org/openautonomousconnection/protocol/listeners/ClientListener.java
index 27535ce..75ee1a5 100644
--- a/src/main/java/org/openautonomousconnection/protocol/listeners/ClientListener.java
+++ b/src/main/java/org/openautonomousconnection/protocol/listeners/ClientListener.java
@@ -41,7 +41,7 @@ public final class ClientListener extends EventListener {
*/
@Listener
public void onDisconnect(ClientDisconnectedEvent event) {
- ProtocolBridge.getInstance().getProtocolClient().onDNSDisconnect(event);
+ ProtocolBridge.getInstance().getProtocolClient().onINSDisconnect(event);
}
}
diff --git a/src/main/java/org/openautonomousconnection/protocol/listeners/DNSServerListener.java b/src/main/java/org/openautonomousconnection/protocol/listeners/INSServerListener.java
similarity index 73%
rename from src/main/java/org/openautonomousconnection/protocol/listeners/DNSServerListener.java
rename to src/main/java/org/openautonomousconnection/protocol/listeners/INSServerListener.java
index 09cea1d..1c2f829 100644
--- a/src/main/java/org/openautonomousconnection/protocol/listeners/DNSServerListener.java
+++ b/src/main/java/org/openautonomousconnection/protocol/listeners/INSServerListener.java
@@ -6,35 +6,35 @@ import dev.unlegitdqrk.unlegitlibrary.network.system.server.events.ConnectionHan
import dev.unlegitdqrk.unlegitlibrary.network.system.server.events.ConnectionHandlerDisconnectedEvent;
import org.openautonomousconnection.protocol.ProtocolBridge;
import org.openautonomousconnection.protocol.annotations.ProtocolInfo;
-import org.openautonomousconnection.protocol.side.dns.ConnectedProtocolClient;
+import org.openautonomousconnection.protocol.side.ins.ConnectedProtocolClient;
import org.openautonomousconnection.protocol.versions.ProtocolVersion;
/**
- * Listener for DNS server connection events.
+ * Listener for INS server connection events.
*/
-@ProtocolInfo(protocolSide = ProtocolVersion.ProtocolSide.DNS)
-public final class DNSServerListener extends EventListener {
+@ProtocolInfo(protocolSide = ProtocolVersion.ProtocolSide.INS)
+public final class INSServerListener extends EventListener {
/**
- * Handles the event when a connection handler connects to the DNS server.
- * Adds the connected client to the ProtocolBridge's DNS server client list.
+ * Handles the event when a connection handler connects to the INS server.
+ * Adds the connected client to the ProtocolBridge's INS server client list.
*
* @param event The connection handler connected event.
*/
@Listener
public void onConnect(ConnectionHandlerConnectedEvent event) {
- ProtocolBridge.getInstance().getProtocolDNSServer().getClients().add(new ConnectedProtocolClient(event.getConnectionHandler()));
+ ProtocolBridge.getInstance().getProtocolINSServer().getClients().add(new ConnectedProtocolClient(event.getConnectionHandler()));
}
/**
- * Handles the event when a connection handler disconnects from the DNS server.
- * Removes the disconnected client from the ProtocolBridge's DNS server client list.
+ * Handles the event when a connection handler disconnects from the INS server.
+ * Removes the disconnected client from the ProtocolBridge's INS server client list.
*
* @param event The connection handler disconnected event.
*/
@Listener
public void onDisconnect(ConnectionHandlerDisconnectedEvent event) {
- ProtocolBridge.getInstance().getProtocolDNSServer().getClients().removeIf(client ->
+ ProtocolBridge.getInstance().getProtocolINSServer().getClients().removeIf(client ->
client.getConnectionHandler().getClientID() == -1);
}
diff --git a/src/main/java/org/openautonomousconnection/protocol/packets/OACPacket.java b/src/main/java/org/openautonomousconnection/protocol/packets/OACPacket.java
index a545be5..a9ea79c 100644
--- a/src/main/java/org/openautonomousconnection/protocol/packets/OACPacket.java
+++ b/src/main/java/org/openautonomousconnection/protocol/packets/OACPacket.java
@@ -4,7 +4,7 @@ import dev.unlegitdqrk.unlegitlibrary.network.system.packets.Packet;
import dev.unlegitdqrk.unlegitlibrary.network.system.packets.PacketHandler;
import lombok.Getter;
import org.openautonomousconnection.protocol.versions.ProtocolVersion;
-import org.openautonomousconnection.protocol.versions.v1_0_0.beta.DNSResponseCode;
+import org.openautonomousconnection.protocol.versions.v1_0_0.beta.INSResponseCode;
import java.io.IOException;
import java.io.ObjectInputStream;
@@ -25,7 +25,7 @@ public abstract class OACPacket extends Packet {
/**
* The response code for the packet, defaulting to RESPONSE_NOT_REQUIRED.
*/
- private DNSResponseCode responseCode = DNSResponseCode.RESPONSE_NOT_REQUIRED;
+ private INSResponseCode responseCode = INSResponseCode.RESPONSE_NOT_REQUIRED;
/**
* Constructor for OACPacket.
@@ -41,18 +41,18 @@ public abstract class OACPacket extends Packet {
/**
* Gets the response code for the packet.
*
- * @return The DNSResponseCode associated with the packet.
+ * @return The INSResponseCode associated with the packet.
*/
- protected final DNSResponseCode getResponseCode() {
+ protected final INSResponseCode getResponseCode() {
return responseCode;
}
/**
* Sets the response code for the packet.
*
- * @param responseCode The DNSResponseCode to set for the packet.
+ * @param responseCode The INSResponseCode to set for the packet.
*/
- protected final void setResponseCode(DNSResponseCode responseCode) {
+ protected final void setResponseCode(INSResponseCode responseCode) {
this.responseCode = responseCode;
}
@@ -80,8 +80,8 @@ public abstract class OACPacket extends Packet {
// Read the response code if the protocol version is not classic
if (protocolVersion != ProtocolVersion.PV_1_0_0_CLASSIC)
- responseCode = (DNSResponseCode) objectInputStream.readObject();
- else responseCode = DNSResponseCode.RESPONSE_NOT_REQUIRED;
+ responseCode = (INSResponseCode) objectInputStream.readObject();
+ else responseCode = INSResponseCode.RESPONSE_NOT_REQUIRED;
// Call the response code read handler
onResponseCodeRead(packetHandler, objectInputStream);
diff --git a/src/main/java/org/openautonomousconnection/protocol/packets/v1_0_0/beta/AuthPacket.java b/src/main/java/org/openautonomousconnection/protocol/packets/v1_0_0/beta/AuthPacket.java
index 050fa1b..0a639c7 100644
--- a/src/main/java/org/openautonomousconnection/protocol/packets/v1_0_0/beta/AuthPacket.java
+++ b/src/main/java/org/openautonomousconnection/protocol/packets/v1_0_0/beta/AuthPacket.java
@@ -6,12 +6,12 @@ import dev.unlegitdqrk.unlegitlibrary.network.system.server.ConnectionHandler;
import dev.unlegitdqrk.unlegitlibrary.network.utils.NetworkUtils;
import org.openautonomousconnection.protocol.ProtocolBridge;
import org.openautonomousconnection.protocol.packets.OACPacket;
-import org.openautonomousconnection.protocol.side.client.events.ConnectedToProtocolDNSServerEvent;
-import org.openautonomousconnection.protocol.side.dns.ConnectedProtocolClient;
-import org.openautonomousconnection.protocol.side.dns.events.ConnectedProtocolClientEvent;
+import org.openautonomousconnection.protocol.side.client.events.ConnectedToProtocolINSServerEvent;
+import org.openautonomousconnection.protocol.side.ins.ConnectedProtocolClient;
+import org.openautonomousconnection.protocol.side.ins.events.ConnectedProtocolClientEvent;
import org.openautonomousconnection.protocol.side.web.ConnectedWebClient;
import org.openautonomousconnection.protocol.versions.ProtocolVersion;
-import org.openautonomousconnection.protocol.versions.v1_0_0.beta.DNSResponseCode;
+import org.openautonomousconnection.protocol.versions.v1_0_0.beta.INSResponseCode;
import java.io.File;
import java.io.IOException;
@@ -33,7 +33,7 @@ public final class AuthPacket extends OACPacket {
@Override
public void onWrite(PacketHandler packetHandler, ObjectOutputStream objectOutputStream) throws IOException, ClassNotFoundException {
- if (protocolBridge.isRunningAsDNSServer()) {
+ if (protocolBridge.isRunningAsINSServer()) {
objectOutputStream.writeObject(protocolBridge.getProtocolVersion());
// Read ca files
@@ -41,22 +41,22 @@ public final class AuthPacket extends OACPacket {
String caPem = "N/A";
String caSrl = "N/A";
try {
- objectOutputStream.writeUTF(protocolBridge.getProtocolDNSServer().getFolderStructure().caPrefix + NetworkUtils.getPublicIPAddress());
+ objectOutputStream.writeUTF(protocolBridge.getProtocolINSServer().getFolderStructure().caPrefix + NetworkUtils.getPublicIPAddress());
caKey = FileUtils.readFileFull(new File(
- protocolBridge.getProtocolDNSServer().getFolderStructure().privateCAFolder,
- protocolBridge.getProtocolDNSServer().getFolderStructure().caPrefix + NetworkUtils.getPublicIPAddress() + ".key"));
+ protocolBridge.getProtocolINSServer().getFolderStructure().privateCAFolder,
+ protocolBridge.getProtocolINSServer().getFolderStructure().caPrefix + NetworkUtils.getPublicIPAddress() + ".key"));
caPem = FileUtils.readFileFull(new File(
- protocolBridge.getProtocolDNSServer().getFolderStructure().publicCAFolder,
- protocolBridge.getProtocolDNSServer().getFolderStructure().caPrefix + NetworkUtils.getPublicIPAddress() + ".pem"));
+ protocolBridge.getProtocolINSServer().getFolderStructure().publicCAFolder,
+ protocolBridge.getProtocolINSServer().getFolderStructure().caPrefix + NetworkUtils.getPublicIPAddress() + ".pem"));
caSrl = FileUtils.readFileFull(new File(
- protocolBridge.getProtocolDNSServer().getFolderStructure().publicCAFolder,
- protocolBridge.getProtocolDNSServer().getFolderStructure().caPrefix + NetworkUtils.getPublicIPAddress() + ".srl"));
+ protocolBridge.getProtocolINSServer().getFolderStructure().publicCAFolder,
+ protocolBridge.getProtocolINSServer().getFolderStructure().caPrefix + NetworkUtils.getPublicIPAddress() + ".srl"));
} catch (Exception exception) {
protocolBridge.getLogger().exception("Failed to read ca-files", exception);
- setResponseCode(DNSResponseCode.RESPONSE_AUTH_FAILED);
+ setResponseCode(INSResponseCode.RESPONSE_AUTH_FAILED);
}
// Send ca data
@@ -64,27 +64,27 @@ public final class AuthPacket extends OACPacket {
objectOutputStream.writeUTF(caPem);
objectOutputStream.writeUTF(caSrl);
} else if (protocolBridge.isRunningAsClient()) {
- objectOutputStream.writeInt(protocolBridge.getProtocolClient().getClientDNSConnection().getClientID());
+ objectOutputStream.writeInt(protocolBridge.getProtocolClient().getClientINSConnection().getClientID());
objectOutputStream.writeObject(protocolBridge.getProtocolVersion());
}
}
@Override
public void onRead(PacketHandler packetHandler, ObjectInputStream objectInputStream) throws IOException, ClassNotFoundException {
- if (protocolBridge.isRunningAsDNSServer() || protocolBridge.isRunningAsWebServer()) {
+ if (protocolBridge.isRunningAsINSServer() || protocolBridge.isRunningAsWebServer()) {
int clientID = objectInputStream.readInt();
ProtocolVersion clientVersion = (ProtocolVersion) objectInputStream.readObject();
- ConnectionHandler connectionHandler = protocolBridge.getProtocolDNSServer().getNetworkServer().getConnectionHandlerByID(clientID);
+ ConnectionHandler connectionHandler = protocolBridge.getProtocolINSServer().getNetworkServer().getConnectionHandlerByID(clientID);
if (!protocolBridge.isVersionSupported(clientVersion)) {
- setResponseCode(DNSResponseCode.RESPONSE_AUTH_FAILED);
+ setResponseCode(INSResponseCode.RESPONSE_AUTH_FAILED);
connectionHandler.disconnect();
return;
- } else setResponseCode(DNSResponseCode.RESPONSE_AUTH_SUCCESS);
+ } else setResponseCode(INSResponseCode.RESPONSE_AUTH_SUCCESS);
- if (protocolBridge.isRunningAsDNSServer()) {
- ConnectedProtocolClient client = protocolBridge.getProtocolDNSServer().getClientByID(clientID);
+ if (protocolBridge.isRunningAsINSServer()) {
+ ConnectedProtocolClient client = protocolBridge.getProtocolINSServer().getClientByID(clientID);
client.setClientVersion(clientVersion);
protocolBridge.getProtocolSettings().eventManager.executeEvent(new ConnectedProtocolClientEvent(client));
} else {
@@ -95,10 +95,10 @@ public final class AuthPacket extends OACPacket {
ProtocolVersion serverVersion = (ProtocolVersion) objectInputStream.readObject();
if (!protocolBridge.isVersionSupported(serverVersion)) {
- setResponseCode(DNSResponseCode.RESPONSE_AUTH_FAILED);
- protocolBridge.getProtocolClient().getClientDNSConnection().disconnect();
+ setResponseCode(INSResponseCode.RESPONSE_AUTH_FAILED);
+ protocolBridge.getProtocolClient().getClientINSConnection().disconnect();
return;
- } else setResponseCode(DNSResponseCode.RESPONSE_AUTH_SUCCESS);
+ } else setResponseCode(INSResponseCode.RESPONSE_AUTH_SUCCESS);
String caPrefix = objectInputStream.readUTF();
@@ -107,7 +107,7 @@ public final class AuthPacket extends OACPacket {
String caSrl = objectInputStream.readUTF();
if (caKey.equalsIgnoreCase("N/A") || caPem.equalsIgnoreCase("N/A") || caSrl.equalsIgnoreCase("N/A"))
- setResponseCode(DNSResponseCode.RESPONSE_AUTH_FAILED);
+ setResponseCode(INSResponseCode.RESPONSE_AUTH_FAILED);
else {
File caPemFile = new File(protocolBridge.getProtocolClient().getFolderStructure().publicCAFolder, caPrefix + ".pem");
@@ -124,12 +124,12 @@ public final class AuthPacket extends OACPacket {
FileUtils.writeFile(caKeyFile, caSrl);
} catch (Exception exception) {
protocolBridge.getLogger().exception("Failed to create/save ca-files", exception);
- setResponseCode(DNSResponseCode.RESPONSE_AUTH_FAILED);
+ setResponseCode(INSResponseCode.RESPONSE_AUTH_FAILED);
}
}
protocolBridge.getProtocolClient().setServerVersion(serverVersion);
- protocolBridge.getProtocolSettings().eventManager.executeEvent(new ConnectedToProtocolDNSServerEvent());
+ protocolBridge.getProtocolSettings().eventManager.executeEvent(new ConnectedToProtocolINSServerEvent());
}
}
}
diff --git a/src/main/java/org/openautonomousconnection/protocol/packets/v1_0_0/beta/GetDestinationPacket.java b/src/main/java/org/openautonomousconnection/protocol/packets/v1_0_0/beta/GetDestinationPacket.java
index e87ba98..190a201 100644
--- a/src/main/java/org/openautonomousconnection/protocol/packets/v1_0_0/beta/GetDestinationPacket.java
+++ b/src/main/java/org/openautonomousconnection/protocol/packets/v1_0_0/beta/GetDestinationPacket.java
@@ -4,31 +4,31 @@ import dev.unlegitdqrk.unlegitlibrary.network.system.packets.PacketHandler;
import org.openautonomousconnection.protocol.ProtocolBridge;
import org.openautonomousconnection.protocol.packets.OACPacket;
import org.openautonomousconnection.protocol.versions.ProtocolVersion;
-import org.openautonomousconnection.protocol.versions.v1_0_0.beta.DNSResponseCode;
-import org.openautonomousconnection.protocol.versions.v1_0_0.beta.Domain;
+import org.openautonomousconnection.protocol.versions.v1_0_0.beta.INSResponseCode;
+import org.openautonomousconnection.protocol.versions.v1_0_0.beta.InfoName;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
public final class GetDestinationPacket extends OACPacket {
- private Domain domain;
+ private InfoName infoName;
private int clientID;
- private DNSResponseCode validationResponse;
+ private INSResponseCode validationResponse;
private String destination;
- // DNS-Server Constructor
- public GetDestinationPacket(Domain domain, DNSResponseCode validationResponse, String destination) {
+ // INS-Server Constructor
+ public GetDestinationPacket(InfoName infoName, INSResponseCode validationResponse, String destination) {
this();
- this.domain = domain;
+ this.infoName = infoName;
this.validationResponse = validationResponse;
this.destination = destination;
}
// Client Constructor
- public GetDestinationPacket(Domain domain, DNSResponseCode validationResponse) {
+ public GetDestinationPacket(InfoName infoName, INSResponseCode validationResponse) {
this();
- this.domain = domain;
+ this.infoName = infoName;
this.validationResponse = validationResponse;
this.destination = destination;
}
@@ -41,13 +41,13 @@ public final class GetDestinationPacket extends OACPacket {
@Override
public void onWrite(PacketHandler packetHandler, ObjectOutputStream objectOutputStream) throws IOException, ClassNotFoundException {
if (ProtocolBridge.getInstance().isRunningAsClient()) {
- if (validationResponse != DNSResponseCode.RESPONSE_DOMAIN_FULLY_EXIST) return;
+ if (validationResponse != INSResponseCode.RESPONSE_INFONAME_FULLY_EXIST) return;
- objectOutputStream.writeInt(ProtocolBridge.getInstance().getProtocolClient().getClientDNSConnection().getClientID());
- objectOutputStream.writeObject(domain);
+ objectOutputStream.writeInt(ProtocolBridge.getInstance().getProtocolClient().getClientINSConnection().getClientID());
+ objectOutputStream.writeObject(infoName);
objectOutputStream.writeObject(validationResponse);
- } else if (ProtocolBridge.getInstance().isRunningAsDNSServer()) {
- objectOutputStream.writeObject(domain);
+ } else if (ProtocolBridge.getInstance().isRunningAsINSServer()) {
+ objectOutputStream.writeObject(infoName);
objectOutputStream.writeObject(validationResponse);
objectOutputStream.writeUTF(destination);
}
@@ -55,16 +55,16 @@ public final class GetDestinationPacket extends OACPacket {
@Override
public void onRead(PacketHandler packetHandler, ObjectInputStream objectInputStream) throws IOException, ClassNotFoundException {
- if (ProtocolBridge.getInstance().isRunningAsDNSServer()) {
+ if (ProtocolBridge.getInstance().isRunningAsINServer()) {
clientID = objectInputStream.readInt();
- domain = (Domain) objectInputStream.readObject();
- validationResponse = (DNSResponseCode) objectInputStream.readObject();
+ infoName = (InfoName) objectInputStream.readObject();
+ validationResponse = (INSResponseCode) objectInputStream.readObject();
} else if (ProtocolBridge.getInstance().isRunningAsClient()) {
- domain = (Domain) objectInputStream.readObject();
- validationResponse = (DNSResponseCode) objectInputStream.readObject();
+ infoName = (InfoName) objectInputStream.readObject();
+ validationResponse = (INSResponseCode) objectInputStream.readObject();
destination = objectInputStream.readUTF();
- ProtocolBridge.getInstance().getProtocolClient().getDestinationCompleted(domain, destination, validationResponse);
+ ProtocolBridge.getInstance().getProtocolClient().getDestinationCompleted(infoName, destination, validationResponse);
}
}
@@ -72,14 +72,14 @@ public final class GetDestinationPacket extends OACPacket {
protected void onResponseCodeRead(PacketHandler packetHandler, ObjectInputStream objectInputStream) {
super.onResponseCodeRead(packetHandler, objectInputStream);
- if (ProtocolBridge.getInstance().isRunningAsDNSServer()) {
- if (validationResponse != DNSResponseCode.RESPONSE_DOMAIN_FULLY_EXIST) return;
- destination = domain.getDestination();
+ if (ProtocolBridge.getInstance().isRunningAsINSServer()) {
+ if (validationResponse != INSResponseCode.RESPONSE_INFONAME_FULLY_EXIST) return;
+ destination = infoName.getDestination();
try {
- ProtocolBridge.getInstance().getProtocolDNSServer().getClientByID(clientID).getConnectionHandler().sendPacket(new GetDestinationPacket(domain, validationResponse, destination));
+ ProtocolBridge.getInstance().getProtocolINSServer().getClientByID(clientID).getConnectionHandler().sendPacket(new GetDestinationPacket(infoName, validationResponse, destination));
} catch (IOException | ClassNotFoundException exception) {
- ProtocolBridge.getInstance().getProtocolDNSServer().domainDestinationPacketFailedSend(ProtocolBridge.getInstance().getProtocolDNSServer().getClientByID(clientID), domain, validationResponse, exception);
+ ProtocolBridge.getInstance().getProtocolINSServer().infoNameDestinationPacketFailedSend(ProtocolBridge.getInstance().getProtocolINSServer().getClientByID(clientID), infoName, validationResponse, exception);
}
}
}
diff --git a/src/main/java/org/openautonomousconnection/protocol/packets/v1_0_0/beta/UnsupportedClassicPacket.java b/src/main/java/org/openautonomousconnection/protocol/packets/v1_0_0/beta/UnsupportedClassicPacket.java
index 63e27bc..d28b1b6 100644
--- a/src/main/java/org/openautonomousconnection/protocol/packets/v1_0_0/beta/UnsupportedClassicPacket.java
+++ b/src/main/java/org/openautonomousconnection/protocol/packets/v1_0_0/beta/UnsupportedClassicPacket.java
@@ -4,7 +4,7 @@ import dev.unlegitdqrk.unlegitlibrary.network.system.packets.PacketHandler;
import org.openautonomousconnection.protocol.ProtocolBridge;
import org.openautonomousconnection.protocol.packets.OACPacket;
import org.openautonomousconnection.protocol.versions.ProtocolVersion;
-import org.openautonomousconnection.protocol.versions.v1_0_0.beta.DNSResponseCode;
+import org.openautonomousconnection.protocol.versions.v1_0_0.beta.INSResponseCode;
import java.io.IOException;
import java.io.ObjectInputStream;
@@ -29,18 +29,18 @@ public final class UnsupportedClassicPacket extends OACPacket {
@Override
public void onWrite(PacketHandler packetHandler, ObjectOutputStream objectOutputStream) throws IOException, ClassNotFoundException {
if (ProtocolBridge.getInstance().isRunningAsClient())
- objectOutputStream.writeInt(ProtocolBridge.getInstance().getProtocolClient().getClientDNSConnection().getClientID());
+ objectOutputStream.writeInt(ProtocolBridge.getInstance().getProtocolClient().getClientINSConnection().getClientID());
objectOutputStream.writeUTF(unsupportedClassicPacket.getName());
objectOutputStream.writeInt(content.length);
for (Object o : content) objectOutputStream.writeObject(o);
- setResponseCode(DNSResponseCode.RESPONSE_NOT_REQUIRED);
+ setResponseCode(INSResponseCode.RESPONSE_NOT_REQUIRED);
}
@Override
public void onRead(PacketHandler packetHandler, ObjectInputStream objectInputStream) throws IOException, ClassNotFoundException {
int clientID = 0;
- if (ProtocolBridge.getInstance().isRunningAsDNSServer()) clientID = objectInputStream.readInt();
+ if (ProtocolBridge.getInstance().isRunningAsINSServer()) clientID = objectInputStream.readInt();
String className = objectInputStream.readUTF();
int size = objectInputStream.readInt();
content = new Object[size];
@@ -49,12 +49,12 @@ public final class UnsupportedClassicPacket extends OACPacket {
content[i] = objectInputStream.readObject();
}
- if (ProtocolBridge.getInstance().isRunningAsDNSServer())
- ProtocolBridge.getInstance().getClassicHandlerDNSServer().unsupportedClassicPacket(className, content, ProtocolBridge.getInstance().getProtocolDNSServer().getClientByID(clientID));
+ if (ProtocolBridge.getInstance().isRunningAsINSServer())
+ ProtocolBridge.getInstance().getClassicHandlerINSServer().unsupportedClassicPacket(className, content, ProtocolBridge.getInstance().getProtocolINSServer().getClientByID(clientID));
else if (ProtocolBridge.getInstance().isRunningAsClient())
ProtocolBridge.getInstance().getClassicHandlerClient().unsupportedClassicPacket(className, content);
else if (ProtocolBridge.getInstance().isRunningAsWebServer())
- ProtocolBridge.getInstance().getClassicHandlerWebServer().unsupportedClassicPacket(className, content, ProtocolBridge.getInstance().getProtocolDNSServer().getClientByID(clientID));
+ ProtocolBridge.getInstance().getClassicHandlerWebServer().unsupportedClassicPacket(className, content, ProtocolBridge.getInstance().getProtocolINSServer().getClientByID(clientID));
}
}
diff --git a/src/main/java/org/openautonomousconnection/protocol/packets/v1_0_0/beta/ValidateDomainPacket.java b/src/main/java/org/openautonomousconnection/protocol/packets/v1_0_0/beta/ValidateInfoNamePacket.java
similarity index 59%
rename from src/main/java/org/openautonomousconnection/protocol/packets/v1_0_0/beta/ValidateDomainPacket.java
rename to src/main/java/org/openautonomousconnection/protocol/packets/v1_0_0/beta/ValidateInfoNamePacket.java
index 632da66..98b9726 100644
--- a/src/main/java/org/openautonomousconnection/protocol/packets/v1_0_0/beta/ValidateDomainPacket.java
+++ b/src/main/java/org/openautonomousconnection/protocol/packets/v1_0_0/beta/ValidateInfoNamePacket.java
@@ -4,55 +4,55 @@ import dev.unlegitdqrk.unlegitlibrary.network.system.packets.PacketHandler;
import org.openautonomousconnection.protocol.ProtocolBridge;
import org.openautonomousconnection.protocol.packets.OACPacket;
import org.openautonomousconnection.protocol.versions.ProtocolVersion;
-import org.openautonomousconnection.protocol.versions.v1_0_0.beta.Domain;
+import org.openautonomousconnection.protocol.versions.v1_0_0.beta.InfoName;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
-public final class ValidateDomainPacket extends OACPacket {
- private Domain domain;
+public final class ValidateInfoNamePacket extends OACPacket {
+ private InfoName infoName;
private int clientID;
private ProtocolBridge protocolBridge;
- public ValidateDomainPacket(Domain domain, ProtocolBridge protocolBridge) {
+ public ValidateInfoNamePacket(InfoName infoName, ProtocolBridge protocolBridge) {
this();
- this.domain = domain;
+ this.infoName = infoName;
this.protocolBridge = protocolBridge;
}
- public ValidateDomainPacket() {
+ public ValidateInfoNamePacket() {
super(6, ProtocolVersion.PV_1_0_0_BETA);
}
@Override
public void onWrite(PacketHandler packetHandler, ObjectOutputStream objectOutputStream) throws IOException, ClassNotFoundException {
if (protocolBridge.isRunningAsClient())
- objectOutputStream.writeInt(protocolBridge.getProtocolClient().getClientDNSConnection().getClientID());
- else if (protocolBridge.isRunningAsDNSServer())
- setResponseCode(protocolBridge.getProtocolDNSServer().validateDomain(domain));
+ objectOutputStream.writeInt(protocolBridge.getProtocolClient().getClientINSConnection().getClientID());
+ else if (protocolBridge.isRunningAsINSServer())
+ setResponseCode(protocolBridge.getProtocolINSServer().validateInfoName(infoName));
- objectOutputStream.writeObject(domain);
+ objectOutputStream.writeObject(infoName);
}
@Override
public void onRead(PacketHandler packetHandler, ObjectInputStream objectInputStream) throws IOException, ClassNotFoundException {
- if (protocolBridge.isRunningAsDNSServer()) clientID = objectInputStream.readInt();
- domain = (Domain) objectInputStream.readObject();
+ if (protocolBridge.isRunningAsINSServer()) clientID = objectInputStream.readInt();
+ infoName = (InfoName) objectInputStream.readObject();
}
@Override
protected void onResponseCodeRead(PacketHandler packetHandler, ObjectInputStream objectInputStream) {
super.onResponseCodeRead(packetHandler, objectInputStream);
- if (protocolBridge.isRunningAsDNSServer()) {
+ if (protocolBridge.isRunningAsINSServer()) {
try {
- protocolBridge.getProtocolDNSServer().getClientByID(clientID).getConnectionHandler().sendPacket(new ValidateDomainPacket(domain, protocolBridge));
+ protocolBridge.getProtocolINSServer().getClientByID(clientID).getConnectionHandler().sendPacket(new ValidateInfoNamePacket(infoName, protocolBridge));
} catch (IOException | ClassNotFoundException e) {
- protocolBridge.getProtocolDNSServer().validationPacketSendFailed(domain, protocolBridge.getProtocolDNSServer().getClientByID(clientID), e);
+ protocolBridge.getProtocolINSServer().validationPacketSendFailed(infoName, protocolBridge.getProtocolINSServer().getClientByID(clientID), e);
}
} else if (protocolBridge.isRunningAsClient())
- protocolBridge.getProtocolClient().validationCompleted(domain, getResponseCode());
+ protocolBridge.getProtocolClient().validationCompleted(infoName, getResponseCode());
}
}
diff --git a/src/main/java/org/openautonomousconnection/protocol/packets/v1_0_0/classic/Classic_DomainPacket.java b/src/main/java/org/openautonomousconnection/protocol/packets/v1_0_0/classic/Classic_DomainPacket.java
index ddcb726..5f4dabd 100644
--- a/src/main/java/org/openautonomousconnection/protocol/packets/v1_0_0/classic/Classic_DomainPacket.java
+++ b/src/main/java/org/openautonomousconnection/protocol/packets/v1_0_0/classic/Classic_DomainPacket.java
@@ -35,12 +35,12 @@ public final class Classic_DomainPacket extends OACPacket {
@Override
public void onWrite(PacketHandler packetHandler, ObjectOutputStream objectOutputStream) throws IOException, ClassNotFoundException {
- if (ProtocolBridge.getInstance().isRunningAsDNSServer()) {
+ if (ProtocolBridge.getInstance().isRunningAsINSServer()) {
objectOutputStream.writeInt(clientID);
objectOutputStream.writeObject(requestDomain);
objectOutputStream.writeObject(domain);
} else if (ProtocolBridge.getInstance().isRunningAsClient()) {
- clientID = ProtocolBridge.getInstance().getProtocolClient().getClientDNSConnection().getClientID();
+ clientID = ProtocolBridge.getInstance().getProtocolClient().getClientINSConnection().getClientID();
objectOutputStream.writeInt(clientID);
objectOutputStream.writeObject(requestDomain);
}
@@ -50,30 +50,30 @@ public final class Classic_DomainPacket extends OACPacket {
@Override
public void onRead(PacketHandler packetHandler, ObjectInputStream objectInputStream) throws IOException, ClassNotFoundException {
- if (ProtocolBridge.getInstance().isRunningAsDNSServer()) {
+ if (ProtocolBridge.getInstance().isRunningAsINSServer()) {
clientID = objectInputStream.readInt();
requestDomain = (Classic_RequestDomain) objectInputStream.readObject();
Classic_ProtocolVersion protocolVersion = (Classic_ProtocolVersion) objectInputStream.readObject();
try {
- domain = ProtocolBridge.getInstance().getClassicHandlerDNSServer().getDomain(requestDomain);
+ domain = ProtocolBridge.getInstance().getClassicHandlerINSServer().getDomain(requestDomain);
} catch (SQLException exception) {
exception.printStackTrace();
}
- ProtocolBridge.getInstance().getProtocolDNSServer().getNetworkServer().getEventManager().executeEvent(new Classic_DomainPacketReceivedEvent(protocolVersion, domain, requestDomain, clientID));
+ ProtocolBridge.getInstance().getProtocolINSServer().getNetworkServer().getEventManager().executeEvent(new Classic_DomainPacketReceivedEvent(protocolVersion, domain, requestDomain, clientID));
- if (ProtocolBridge.getInstance().getProtocolDNSServer().getClientByID(clientID).supportClientClassic())
- ProtocolBridge.getInstance().getProtocolDNSServer().getNetworkServer().getConnectionHandlerByID(clientID).sendPacket(new Classic_DomainPacket(clientID, requestDomain, domain));
+ if (ProtocolBridge.getInstance().getProtocolINSServer().getClientByID(clientID).supportClientClassic())
+ ProtocolBridge.getInstance().getProtocolINSServer().getNetworkServer().getConnectionHandlerByID(clientID).sendPacket(new Classic_DomainPacket(clientID, requestDomain, domain));
else
- ProtocolBridge.getInstance().getProtocolDNSServer().getNetworkServer().getConnectionHandlerByID(clientID).sendPacket(new UnsupportedClassicPacket(Classic_PingPacket.class, new Object[]{clientID, requestDomain, domain}));
+ ProtocolBridge.getInstance().getProtocolINSServer().getNetworkServer().getConnectionHandlerByID(clientID).sendPacket(new UnsupportedClassicPacket(Classic_PingPacket.class, new Object[]{clientID, requestDomain, domain}));
} else if (ProtocolBridge.getInstance().isRunningAsClient()) {
clientID = objectInputStream.readInt();
requestDomain = (Classic_RequestDomain) objectInputStream.readObject();
domain = (Classic_Domain) objectInputStream.readObject();
Classic_ProtocolVersion protocolVersion = (Classic_ProtocolVersion) objectInputStream.readObject();
- ProtocolBridge.getInstance().getProtocolClient().getClientDNSConnection().getEventManager().executeEvent(new Classic_DomainPacketReceivedEvent(protocolVersion, domain, requestDomain, clientID));
+ ProtocolBridge.getInstance().getProtocolClient().getClientINSConnection().getEventManager().executeEvent(new Classic_DomainPacketReceivedEvent(protocolVersion, domain, requestDomain, clientID));
} else if (ProtocolBridge.getInstance().isRunningAsWebServer()) {
clientID = objectInputStream.readInt();
requestDomain = (Classic_RequestDomain) objectInputStream.readObject();
diff --git a/src/main/java/org/openautonomousconnection/protocol/packets/v1_0_0/classic/Classic_MessagePacket.java b/src/main/java/org/openautonomousconnection/protocol/packets/v1_0_0/classic/Classic_MessagePacket.java
index e1547c6..47211e5 100644
--- a/src/main/java/org/openautonomousconnection/protocol/packets/v1_0_0/classic/Classic_MessagePacket.java
+++ b/src/main/java/org/openautonomousconnection/protocol/packets/v1_0_0/classic/Classic_MessagePacket.java
@@ -27,10 +27,10 @@ public final class Classic_MessagePacket extends OACPacket {
@Override
public void onWrite(PacketHandler packetHandler, ObjectOutputStream objectOutputStream) throws IOException, ClassNotFoundException {
- if (ProtocolBridge.getInstance().isRunningAsDNSServer() || ProtocolBridge.getInstance().isRunningAsWebServer())
+ if (ProtocolBridge.getInstance().isRunningAsINSServer() || ProtocolBridge.getInstance().isRunningAsWebServer())
objectOutputStream.writeInt(clientID);
else if (ProtocolBridge.getInstance().isRunningAsClient()) {
- clientID = ProtocolBridge.getInstance().getProtocolClient().getClientDNSConnection().getClientID();
+ clientID = ProtocolBridge.getInstance().getProtocolClient().getClientINSConnection().getClientID();
objectOutputStream.writeInt(clientID);
}
@@ -40,12 +40,12 @@ public final class Classic_MessagePacket extends OACPacket {
@Override
public void onRead(PacketHandler packetHandler, ObjectInputStream objectInputStream) throws IOException, ClassNotFoundException {
- if (ProtocolBridge.getInstance().isRunningAsDNSServer()) {
+ if (ProtocolBridge.getInstance().isRunningAsINSServer()) {
clientID = objectInputStream.readInt();
String message = objectInputStream.readUTF();
Classic_ProtocolVersion protocolVersion = (Classic_ProtocolVersion) objectInputStream.readObject();
- ProtocolBridge.getInstance().getClassicHandlerDNSServer().handleMessage(ProtocolBridge.getInstance().getProtocolDNSServer().getClientByID(clientID), message, protocolVersion);
+ ProtocolBridge.getInstance().getClassicHandlerINSServer().handleMessage(ProtocolBridge.getInstance().getProtocolINSServer().getClientByID(clientID), message, protocolVersion);
} else if (ProtocolBridge.getInstance().isRunningAsClient()) {
clientID = objectInputStream.readInt();
String message = objectInputStream.readUTF();
@@ -57,7 +57,7 @@ public final class Classic_MessagePacket extends OACPacket {
String message = objectInputStream.readUTF();
Classic_ProtocolVersion protocolVersion = (Classic_ProtocolVersion) objectInputStream.readObject();
- ProtocolBridge.getInstance().getClassicHandlerWebServer().handleMessage(ProtocolBridge.getInstance().getProtocolDNSServer().getClientByID(clientID), message, protocolVersion);
+ ProtocolBridge.getInstance().getClassicHandlerWebServer().handleMessage(ProtocolBridge.getInstance().getProtocolINSServer().getClientByID(clientID), message, protocolVersion);
}
}
}
diff --git a/src/main/java/org/openautonomousconnection/protocol/packets/v1_0_0/classic/Classic_PingPacket.java b/src/main/java/org/openautonomousconnection/protocol/packets/v1_0_0/classic/Classic_PingPacket.java
index bdac3e7..d0e4028 100644
--- a/src/main/java/org/openautonomousconnection/protocol/packets/v1_0_0/classic/Classic_PingPacket.java
+++ b/src/main/java/org/openautonomousconnection/protocol/packets/v1_0_0/classic/Classic_PingPacket.java
@@ -5,7 +5,7 @@ import org.openautonomousconnection.protocol.ProtocolBridge;
import org.openautonomousconnection.protocol.packets.OACPacket;
import org.openautonomousconnection.protocol.packets.v1_0_0.beta.UnsupportedClassicPacket;
import org.openautonomousconnection.protocol.versions.ProtocolVersion;
-import org.openautonomousconnection.protocol.versions.v1_0_0.beta.DNSResponseCode;
+import org.openautonomousconnection.protocol.versions.v1_0_0.beta.INSResponseCode;
import org.openautonomousconnection.protocol.versions.v1_0_0.classic.events.Classic_PingPacketReceivedEvent;
import org.openautonomousconnection.protocol.versions.v1_0_0.classic.objects.Classic_Domain;
import org.openautonomousconnection.protocol.versions.v1_0_0.classic.objects.Classic_RequestDomain;
@@ -38,13 +38,13 @@ public final class Classic_PingPacket extends OACPacket {
@Override
public void onWrite(PacketHandler packetHandler, ObjectOutputStream objectOutputStream) throws IOException, ClassNotFoundException {
- if (ProtocolBridge.getInstance().isRunningAsDNSServer()) {
+ if (ProtocolBridge.getInstance().isRunningAsINSServer()) {
objectOutputStream.writeInt(clientID);
objectOutputStream.writeObject(requestDomain);
objectOutputStream.writeObject(domain);
objectOutputStream.writeBoolean(reachable);
} else if (ProtocolBridge.getInstance().isRunningAsClient()) {
- clientID = ProtocolBridge.getInstance().getProtocolClient().getClientDNSConnection().getClientID();
+ clientID = ProtocolBridge.getInstance().getProtocolClient().getClientINSConnection().getClientID();
objectOutputStream.writeInt(clientID);
objectOutputStream.writeObject(requestDomain);
}
@@ -54,23 +54,23 @@ public final class Classic_PingPacket extends OACPacket {
@Override
public void onRead(PacketHandler packetHandler, ObjectInputStream objectInputStream) throws IOException, ClassNotFoundException {
- if (ProtocolBridge.getInstance().isRunningAsDNSServer()) {
+ if (ProtocolBridge.getInstance().isRunningAsINSServer()) {
clientID = objectInputStream.readInt();
requestDomain = (Classic_RequestDomain) objectInputStream.readObject();
protocolVersion = (Classic_ProtocolVersion) objectInputStream.readObject();
try {
- domain = ProtocolBridge.getInstance().getClassicHandlerDNSServer().ping(requestDomain);
+ domain = ProtocolBridge.getInstance().getClassicHandlerINSServer().ping(requestDomain);
} catch (SQLException exception) {
exception.printStackTrace();
}
reachable = domain != null;
- ProtocolBridge.getInstance().getProtocolDNSServer().getNetworkServer().getEventManager().executeEvent(new Classic_PingPacketReceivedEvent(protocolVersion, domain, requestDomain, reachable, clientID));
- if (ProtocolBridge.getInstance().getProtocolDNSServer().getClientByID(clientID).supportClientClassic())
- ProtocolBridge.getInstance().getProtocolDNSServer().getNetworkServer().getConnectionHandlerByID(clientID).sendPacket(new Classic_PingPacket(requestDomain, domain, reachable));
+ ProtocolBridge.getInstance().getProtocolINSServer().getNetworkServer().getEventManager().executeEvent(new Classic_PingPacketReceivedEvent(protocolVersion, domain, requestDomain, reachable, clientID));
+ if (ProtocolBridge.getInstance().getProtocolINSServer().getClientByID(clientID).supportClientClassic())
+ ProtocolBridge.getInstance().getProtocolINSServer().getNetworkServer().getConnectionHandlerByID(clientID).sendPacket(new Classic_PingPacket(requestDomain, domain, reachable));
else
- ProtocolBridge.getInstance().getProtocolDNSServer().getNetworkServer().getConnectionHandlerByID(clientID).sendPacket(new UnsupportedClassicPacket(Classic_PingPacket.class, new Object[]{requestDomain, domain, reachable}));
+ ProtocolBridge.getInstance().getProtocolINSServer().getNetworkServer().getConnectionHandlerByID(clientID).sendPacket(new UnsupportedClassicPacket(Classic_PingPacket.class, new Object[]{requestDomain, domain, reachable}));
} else if (ProtocolBridge.getInstance().isRunningAsClient()) {
clientID = objectInputStream.readInt();
requestDomain = (Classic_RequestDomain) objectInputStream.readObject();
@@ -78,8 +78,8 @@ public final class Classic_PingPacket extends OACPacket {
boolean reachable = objectInputStream.readBoolean();
Classic_ProtocolVersion protocolVersion = (Classic_ProtocolVersion) objectInputStream.readObject();
- ProtocolBridge.getInstance().getProtocolClient().validationCompleted(domain.getDomain(), reachable ? DNSResponseCode.RESPONSE_DOMAIN_FULLY_EXIST : DNSResponseCode.RESPONSE_DOMAIN_FULLY_NOT_EXIST);
- ProtocolBridge.getInstance().getProtocolClient().getClientDNSConnection().getEventManager().executeEvent(new Classic_PingPacketReceivedEvent(protocolVersion, domain, requestDomain, reachable, clientID));
+ ProtocolBridge.getInstance().getProtocolClient().validationCompleted(domain.getInfoName(), reachable ? INSResponseCode.RESPONSE_INFONAME_FULLY_EXIST : INSResponseCode.RESPONSE_INFONAME_FULLY_NOT_EXIST);
+ ProtocolBridge.getInstance().getProtocolClient().getClientINSConnection().getEventManager().executeEvent(new Classic_PingPacketReceivedEvent(protocolVersion, domain, requestDomain, reachable, clientID));
} else if (ProtocolBridge.getInstance().isRunningAsWebServer()) {
clientID = objectInputStream.readInt();
requestDomain = (Classic_RequestDomain) objectInputStream.readObject();
diff --git a/src/main/java/org/openautonomousconnection/protocol/side/client/ProtocolClient.java b/src/main/java/org/openautonomousconnection/protocol/side/client/ProtocolClient.java
index 71f7f08..2951274 100644
--- a/src/main/java/org/openautonomousconnection/protocol/side/client/ProtocolClient.java
+++ b/src/main/java/org/openautonomousconnection/protocol/side/client/ProtocolClient.java
@@ -10,12 +10,12 @@ import org.openautonomousconnection.protocol.annotations.ProtocolInfo;
import org.openautonomousconnection.protocol.exceptions.UnsupportedProtocolException;
import org.openautonomousconnection.protocol.packets.OACPacket;
import org.openautonomousconnection.protocol.packets.v1_0_0.beta.GetDestinationPacket;
-import org.openautonomousconnection.protocol.packets.v1_0_0.beta.ValidateDomainPacket;
+import org.openautonomousconnection.protocol.packets.v1_0_0.beta.ValidateInfoNamePacket;
import org.openautonomousconnection.protocol.packets.v1_0_0.classic.Classic_DomainPacket;
import org.openautonomousconnection.protocol.packets.v1_0_0.classic.Classic_PingPacket;
import org.openautonomousconnection.protocol.versions.ProtocolVersion;
-import org.openautonomousconnection.protocol.versions.v1_0_0.beta.DNSResponseCode;
-import org.openautonomousconnection.protocol.versions.v1_0_0.beta.Domain;
+import org.openautonomousconnection.protocol.versions.v1_0_0.beta.INSResponseCode;
+import org.openautonomousconnection.protocol.versions.v1_0_0.beta.InfoName;
import org.openautonomousconnection.protocol.versions.v1_0_0.classic.objects.Classic_RequestDomain;
import java.io.File;
@@ -24,14 +24,14 @@ import java.io.IOException;
import java.security.cert.CertificateException;
/**
- * Abstract class defining the client-side protocol operations and interactions with DNS and web servers.
+ * Abstract class defining the client-side protocol operations and interactions with INS and web servers.
*/
-@ProtocolInfo(protocolSide = ProtocolVersion.ProtocolSide.DNS)
+@ProtocolInfo(protocolSide = ProtocolVersion.ProtocolSide.INS)
public abstract class ProtocolClient extends DefaultMethodsOverrider {
/**
- * Handles everything with DNS-Connection.
+ * Handles everything with INS-Connection.
*/
- private final NetworkClient clientToDNS;
+ private final NetworkClient clientToINS;
/**
* Manages the folder structure for client certificates.
@@ -57,7 +57,7 @@ public abstract class ProtocolClient extends DefaultMethodsOverrider {
private ProtocolBridge protocolBridge;
/**
- * Initializes the ProtocolClient, setting up certificate folders and the DNS client connection.
+ * Initializes the ProtocolClient, setting up certificate folders and the INS client connection.
*
* @throws CertificateException if there are issues with the certificates.
* @throws IOException if there are I/O issues during initialization.
@@ -66,8 +66,8 @@ public abstract class ProtocolClient extends DefaultMethodsOverrider {
// Initialize and verify certificate folders and files
folderStructure = new ClientCertificateFolderStructure();
- // Initialize connection to DNS server
- clientToDNS = new NetworkClient.ClientBuilder().setLogger(protocolBridge.getLogger()).setProxy(protocolBridge.getProxy()).
+ // Initialize connection to INS server
+ clientToINS = new NetworkClient.ClientBuilder().setLogger(protocolBridge.getLogger()).setProxy(protocolBridge.getProxy()).
setHost(protocolBridge.getProtocolSettings().host).setPort(protocolBridge.getProtocolSettings().port).
setPacketHandler(protocolBridge.getProtocolSettings().packetHandler).setEventManager(protocolBridge.getProtocolSettings().eventManager).
setRootCAFolder(folderStructure.publicCAFolder).setClientCertificatesFolder(folderStructure.publicClientFolder, folderStructure.privateClientFolder).
@@ -75,23 +75,23 @@ public abstract class ProtocolClient extends DefaultMethodsOverrider {
}
/**
- * Gets the DNS connection client.
+ * Gets the INS connection client.
*
- * @return the NetworkClient handling the DNS connection.
+ * @return the NetworkClient handling the INS connection.
*/
- public final NetworkClient getClientDNSConnection() {
- return clientToDNS;
+ public final NetworkClient getClientINSConnection() {
+ return clientToINS;
}
/**
- * Creates a web connection to the specified domain and ports.
+ * Creates a web connection to the specified InfoName and ports.
*
- * @param domain the target domain for the web connection.
+ * @param infoName the target InfoName for the web connection.
* @param pipelinePort the port used for the pipeline connection.
* @param webPort the port used for the web connection.
* @throws Exception if there are issues creating the web connection or if the protocol is unsupported.
*/
- public final void createWebConnection(Domain domain, int pipelinePort, int webPort) throws Exception {
+ public final void createWebConnection(InfoName infoName, int pipelinePort, int webPort) throws Exception {
// Ensure the protocol supports web connections
if (!protocolBridge.isProtocolSupported(ProtocolVersion.Protocol.OAC))
throw new UnsupportedProtocolException();
@@ -107,7 +107,7 @@ public abstract class ProtocolClient extends DefaultMethodsOverrider {
}
// Verify necessary certificate files exist
- webClient = new WebClient(domain, pipelinePort, webPort, this);
+ webClient = new WebClient(infoName, pipelinePort, webPort, this);
}
/**
@@ -162,12 +162,12 @@ public abstract class ProtocolClient extends DefaultMethodsOverrider {
}
/**
- * Handles DNS disconnection events, resetting the server version and closing the web client connection if necessary.
+ * Handles INS disconnection events, resetting the server version and closing the web client connection if necessary.
*
- * @param event the ClientDisconnectedEvent triggered on DNS disconnection.
+ * @param event the ClientDisconnectedEvent triggered on INS disconnection.
*/
- public final void onDNSDisconnect(ClientDisconnectedEvent event) {
- // Reset server version on DNS disconnect
+ public final void onINSDisconnect(ClientDisconnectedEvent event) {
+ // Reset server version on INS disconnect
serverVersion = null;
// Close web client connection if it exists
@@ -302,36 +302,36 @@ public abstract class ProtocolClient extends DefaultMethodsOverrider {
}
/**
- * Validates the specified domain by sending a validation request to the DNS server.
+ * Validates the specified InfoName by sending a validation request to the INS server.
*
- * @param domain the Domain to validate.
+ * @param infoName the InfoName to validate.
* @throws IOException if there are I/O issues during the validation process.
* @throws ClassNotFoundException if there are issues with class loading during packet handling.
*/
- public final void validateDomain(Domain domain) throws IOException, ClassNotFoundException {
+ public final void validateInfoName(InfoName infoName) throws IOException, ClassNotFoundException {
// Send Classic_PingPacket if classic protocol is supported
- Classic_PingPacket cPingPacket = new Classic_PingPacket(new Classic_RequestDomain(domain.getName(), domain.getTopLevelName(), domain.getPath()), null, false);
- if (protocolBridge.isClassicSupported()) clientToDNS.sendPacket(cPingPacket);
+ Classic_PingPacket cPingPacket = new Classic_PingPacket(new Classic_RequestDomain(infoName.getName(), infoName.getTopLevelName(), infoName.getPath()), null, false);
+ if (protocolBridge.isClassicSupported()) clientToINS.sendPacket(cPingPacket);
- // Send ValidateDomainPacket
- clientToDNS.sendPacket(new ValidateDomainPacket(domain, protocolBridge));
+ // Send ValidateInfoNamePacket
+ clientToINS.sendPacket(new ValidateInfoNamePacket(infoName, protocolBridge));
}
/**
- * Requests the destination for the specified domain from the DNS server.
+ * Requests the destination for the specified InfoName from the INS server.
*
- * @param domain the Domain for which to request the destination.
- * @param responseCode the expected DNSResponseCode for the request.
+ * @param infoName the InfoName for which to request the destination.
+ * @param responseCode the expected INSResponseCode for the request.
* @throws IOException if there are I/O issues during the request process.
* @throws ClassNotFoundException if there are issues with class loading during packet handling.
*/
- public final void requestDestination(Domain domain, DNSResponseCode responseCode) throws IOException, ClassNotFoundException {
+ public final void requestInfoName(InfoName infoName, INSResponseCode responseCode) throws IOException, ClassNotFoundException {
// Send Classic_DomainPacket if classic protocol is supported
- Classic_DomainPacket cDomainPacket = new Classic_DomainPacket(0, new Classic_RequestDomain(domain.getName(), domain.getTopLevelName(), domain.getPath()), null);
- if (protocolBridge.isClassicSupported()) clientToDNS.sendPacket(cDomainPacket);
+ Classic_DomainPacket cDomainPacket = new Classic_DomainPacket(0, new Classic_RequestDomain(infoName.getName(), infoName.getTopLevelName(), infoName.getPath()), null);
+ if (protocolBridge.isClassicSupported()) clientToINS.sendPacket(cDomainPacket);
// Send GetDestinationPacket
- clientToDNS.sendPacket(new GetDestinationPacket(domain, responseCode));
+ clientToINS.sendPacket(new GetDestinationPacket(infoName, responseCode));
}
/**
@@ -343,21 +343,21 @@ public abstract class ProtocolClient extends DefaultMethodsOverrider {
}
/**
- * Callback method invoked when domain validation is completed.
+ * Callback method invoked when InfoName validation is completed.
*
- * @param domain the Domain that was validated.
- * @param responseCode the DNSResponseCode resulting from the validation.
+ * @param infoName the InfoName that was validated.
+ * @param responseCode the INSResponseCode resulting from the validation.
*/
- public abstract void validationCompleted(Domain domain, DNSResponseCode responseCode);
+ public abstract void validationCompleted(InfoName infoName, INSResponseCode responseCode);
/**
* Callback method invoked when the destination retrieval is completed.
*
- * @param domain the Domain for which the destination was requested.
+ * @param infoName the InfoName for which the destination was requested.
* @param destination the retrieved destination as a string.
- * @param validationResponse the DNSResponseCode resulting from the destination retrieval.
+ * @param validationResponse the INSResponseCode resulting from the destination retrieval.
*/
- public abstract void getDestinationCompleted(Domain domain, String destination, DNSResponseCode validationResponse);
+ public abstract void getDestinationCompleted(InfoName infoName, String destination, INSResponseCode validationResponse);
/**
* Manages the folder structure for client certificates.
diff --git a/src/main/java/org/openautonomousconnection/protocol/side/client/WebClient.java b/src/main/java/org/openautonomousconnection/protocol/side/client/WebClient.java
index d3a10d6..ad58291 100644
--- a/src/main/java/org/openautonomousconnection/protocol/side/client/WebClient.java
+++ b/src/main/java/org/openautonomousconnection/protocol/side/client/WebClient.java
@@ -1,12 +1,10 @@
package org.openautonomousconnection.protocol.side.client;
import dev.unlegitdqrk.unlegitlibrary.network.system.client.NetworkClient;
-import dev.unlegitdqrk.unlegitlibrary.network.system.server.ConnectionHandler;
import lombok.Getter;
-import org.openautonomousconnection.protocol.ProtocolBridge;
import org.openautonomousconnection.protocol.annotations.ProtocolInfo;
import org.openautonomousconnection.protocol.versions.ProtocolVersion;
-import org.openautonomousconnection.protocol.versions.v1_0_0.beta.Domain;
+import org.openautonomousconnection.protocol.versions.v1_0_0.beta.InfoName;
import javax.net.ssl.SSLParameters;
import javax.net.ssl.SSLSocket;
@@ -23,7 +21,7 @@ import java.net.Socket;
* WebClient handles secure connections to web servers through a pipeline connection.
* It manages SSL/TLS handshakes and data transmission over the established connection.
*/
-@ProtocolInfo(protocolSide = ProtocolVersion.ProtocolSide.DNS)
+@ProtocolInfo(protocolSide = ProtocolVersion.ProtocolSide.INS)
public final class WebClient {
/**
* NetworkClient instance for managing the pipeline connection to the web server.
@@ -53,13 +51,13 @@ public final class WebClient {
/**
* Constructs a WebClient instance and establishes a secure connection to the web server.
*
- * @param domain The domain information for the web server.
+ * @param infoName The InfoName information for the web server.
* @param pipelinePort The port for the pipeline connection.
* @param webPort The port for the web server connection.
* @param protocolClient The Protocol Client associated with this protocol client.
* @throws Exception If an error occurs during connection setup.
*/
- public WebClient(Domain domain, int pipelinePort, int webPort, ProtocolClient protocolClient) throws Exception {
+ public WebClient(InfoName infoName, int pipelinePort, int webPort, ProtocolClient protocolClient) throws Exception {
this.protocolClient = protocolClient;
// Initialize and connect the pipeline client
@@ -67,15 +65,15 @@ public final class WebClient {
// Set logger from ProtocolBridge
setLogger(protocolClient.getProtocolBridge().getLogger()).
// Set the destination and port for the pipeline connection
- setHost(domain.getDestination()).setPort(pipelinePort).
+ setHost(infoName.getDestination()).setPort(pipelinePort).
// Configure packet handler and event manager
setPacketHandler(protocolClient.getProtocolBridge().getProtocolSettings().packetHandler).
setEventManager(protocolClient.getProtocolBridge().getProtocolSettings().eventManager).
- // Set proxy and ssl parameters from DNS connection settings
- setProxy(protocolClient.getProtocolBridge().getProtocolClient().getClientDNSConnection().getProxy()).
- setSSLParameters(protocolClient.getProtocolBridge().getProtocolClient().getClientDNSConnection().getSocket().getSSLParameters()).
+ // Set proxy and ssl parameters from INS connection settings
+ setProxy(protocolClient.getProtocolBridge().getProtocolClient().getClientINSConnection().getProxy()).
+ setSSLParameters(protocolClient.getProtocolBridge().getProtocolClient().getClientINSConnection().getSocket().getSSLParameters()).
// Set certificates and folders for SSL
setRootCAFolder(protocolClient.getProtocolBridge().getProtocolClient().getFolderStructure().publicCAFolder).
@@ -109,10 +107,10 @@ public final class WebClient {
// Create raw socket and wrap it in SSL socket
if (proxy != null) {
Socket rawSocket = new Socket(proxy);
- rawSocket.connect(new InetSocketAddress(domain.getDestination(), webPort), 0);
- tempSocket = (SSLSocket) sslSocketFactory.createSocket(rawSocket, domain.getDestination(), webPort, true);
+ rawSocket.connect(new InetSocketAddress(infoName.getDestination(), webPort), 0);
+ tempSocket = (SSLSocket) sslSocketFactory.createSocket(rawSocket, infoName.getDestination(), webPort, true);
} else {
- tempSocket = (SSLSocket) sslSocketFactory.createSocket(domain.getDestination(), webPort);
+ tempSocket = (SSLSocket) sslSocketFactory.createSocket(infoName.getDestination(), webPort);
}
clientToWebServer = tempSocket;
@@ -177,7 +175,7 @@ public final class WebClient {
public boolean isConnected() {
return this.clientToWebServer != null && this.clientToWebServer.isConnected() && !this.clientToWebServer.isClosed()
&& this.receiveThread.isAlive() && !this.receiveThread.isInterrupted() &&
- protocolClient.getProtocolBridge().getProtocolClient().getClientDNSConnection().isConnected() && clientToWebPipeline.isConnected();
+ protocolClient.getProtocolBridge().getProtocolClient().getClientINSConnection().isConnected() && clientToWebPipeline.isConnected();
}
/**
diff --git a/src/main/java/org/openautonomousconnection/protocol/side/client/events/ConnectedToProtocolDNSServerEvent.java b/src/main/java/org/openautonomousconnection/protocol/side/client/events/ConnectedToProtocolINSServerEvent.java
similarity index 60%
rename from src/main/java/org/openautonomousconnection/protocol/side/client/events/ConnectedToProtocolDNSServerEvent.java
rename to src/main/java/org/openautonomousconnection/protocol/side/client/events/ConnectedToProtocolINSServerEvent.java
index dc0c5ab..a0ee1e1 100644
--- a/src/main/java/org/openautonomousconnection/protocol/side/client/events/ConnectedToProtocolDNSServerEvent.java
+++ b/src/main/java/org/openautonomousconnection/protocol/side/client/events/ConnectedToProtocolINSServerEvent.java
@@ -5,8 +5,8 @@ import org.openautonomousconnection.protocol.annotations.ProtocolInfo;
import org.openautonomousconnection.protocol.versions.ProtocolVersion;
/**
- * Event triggered when a client successfully connects to a DNS protocol server.
+ * Event triggered when a client successfully connects to a INS protocol server.
*/
-@ProtocolInfo(protocolSide = ProtocolVersion.ProtocolSide.DNS)
-public final class ConnectedToProtocolDNSServerEvent extends Event {
+@ProtocolInfo(protocolSide = ProtocolVersion.ProtocolSide.INS)
+public final class ConnectedToProtocolINSServerEvent extends Event {
}
diff --git a/src/main/java/org/openautonomousconnection/protocol/side/dns/ConnectedProtocolClient.java b/src/main/java/org/openautonomousconnection/protocol/side/ins/ConnectedProtocolClient.java
similarity index 93%
rename from src/main/java/org/openautonomousconnection/protocol/side/dns/ConnectedProtocolClient.java
rename to src/main/java/org/openautonomousconnection/protocol/side/ins/ConnectedProtocolClient.java
index 54a6268..1f66462 100644
--- a/src/main/java/org/openautonomousconnection/protocol/side/dns/ConnectedProtocolClient.java
+++ b/src/main/java/org/openautonomousconnection/protocol/side/ins/ConnectedProtocolClient.java
@@ -1,16 +1,15 @@
-package org.openautonomousconnection.protocol.side.dns;
+package org.openautonomousconnection.protocol.side.ins;
import dev.unlegitdqrk.unlegitlibrary.network.system.server.ConnectionHandler;
import lombok.Getter;
import org.openautonomousconnection.protocol.annotations.ProtocolInfo;
import org.openautonomousconnection.protocol.packets.OACPacket;
-import org.openautonomousconnection.protocol.side.web.ProtocolWebServer;
import org.openautonomousconnection.protocol.versions.ProtocolVersion;
/**
- * Represents a connected protocol client on the DNS server side.
+ * Represents a connected protocol client on the INS server side.
*/
-@ProtocolInfo(protocolSide = ProtocolVersion.ProtocolSide.DNS)
+@ProtocolInfo(protocolSide = ProtocolVersion.ProtocolSide.INS)
public final class ConnectedProtocolClient {
/**
@@ -23,16 +22,16 @@ public final class ConnectedProtocolClient {
* The Protocol Server associated with this protocol client.
*/
@Getter
- private final ProtocolDNSServer protocolDNSServer;
+ private final ProtocolINSServer protocolINSServer;
/**
* The protocol version of the connected client.
*/
private ProtocolVersion clientVersion = null;
- public ConnectedProtocolClient(ConnectionHandler connectionHandler, ProtocolDNSServer protocolDNSServer) {
+ public ConnectedProtocolClient(ConnectionHandler connectionHandler, ProtocolINSServer protocolINSServer) {
this.connectionHandler = connectionHandler;
- this.protocolDNSServer = protocolDNSServer;
+ this.protocolINSServer = protocolINSServer;
}
/**
diff --git a/src/main/java/org/openautonomousconnection/protocol/side/dns/ProtocolDNSServer.java b/src/main/java/org/openautonomousconnection/protocol/side/ins/ProtocolINSServer.java
similarity index 76%
rename from src/main/java/org/openautonomousconnection/protocol/side/dns/ProtocolDNSServer.java
rename to src/main/java/org/openautonomousconnection/protocol/side/ins/ProtocolINSServer.java
index dd50a0d..f432635 100644
--- a/src/main/java/org/openautonomousconnection/protocol/side/dns/ProtocolDNSServer.java
+++ b/src/main/java/org/openautonomousconnection/protocol/side/ins/ProtocolINSServer.java
@@ -1,4 +1,4 @@
-package org.openautonomousconnection.protocol.side.dns;
+package org.openautonomousconnection.protocol.side.ins;
import dev.unlegitdqrk.unlegitlibrary.file.ConfigurationManager;
import dev.unlegitdqrk.unlegitlibrary.network.system.server.NetworkServer;
@@ -8,8 +8,8 @@ import lombok.Getter;
import org.openautonomousconnection.protocol.ProtocolBridge;
import org.openautonomousconnection.protocol.annotations.ProtocolInfo;
import org.openautonomousconnection.protocol.versions.ProtocolVersion;
-import org.openautonomousconnection.protocol.versions.v1_0_0.beta.DNSResponseCode;
-import org.openautonomousconnection.protocol.versions.v1_0_0.beta.Domain;
+import org.openautonomousconnection.protocol.versions.v1_0_0.beta.INSResponseCode;
+import org.openautonomousconnection.protocol.versions.v1_0_0.beta.InfoName;
import java.io.File;
import java.io.FileNotFoundException;
@@ -19,10 +19,10 @@ import java.util.ArrayList;
import java.util.List;
/**
- * Abstract class representing a DNS server in the protocol.
+ * Abstract class representing a INS server in the protocol.
*/
-@ProtocolInfo(protocolSide = ProtocolVersion.ProtocolSide.DNS)
-public abstract class ProtocolDNSServer extends DefaultMethodsOverrider {
+@ProtocolInfo(protocolSide = ProtocolVersion.ProtocolSide.INS)
+public abstract class ProtocolINSServer extends DefaultMethodsOverrider {
/**
* The network server instance.
*/
@@ -53,13 +53,13 @@ public abstract class ProtocolDNSServer extends DefaultMethodsOverrider {
private ProtocolBridge protocolBridge;
/**
- * Constructs a ProtocolDNSServer with the specified configuration file.
+ * Constructs a ProtocolINSServer with the specified configuration file.
*
- * @param configFile The configuration file for the DNS server.
+ * @param configFile The configuration file for the INS server.
* @throws IOException If an I/O error occurs.
* @throws CertificateException If a certificate error occurs.
*/
- public ProtocolDNSServer(File configFile) throws IOException, CertificateException {
+ public ProtocolINSServer(File configFile) throws IOException, CertificateException {
// Ensure the configuration file exists
if (!configFile.exists()) configFile.createNewFile();
@@ -69,12 +69,12 @@ public abstract class ProtocolDNSServer extends DefaultMethodsOverrider {
// Set default values for configuration properties if not already set
if (!configurationManager.isSet("server.site.info")) {
- configurationManager.set("server.site.info", "DNS-SERVER INFO SITE IP");
+ configurationManager.set("server.site.info", "INS-SERVER INFO SITE IP");
configurationManager.saveProperties();
}
if (!configurationManager.isSet("server.site.register")) {
- configurationManager.set("server.site.register", "SERVER IP TO DNS-FRONTENT WEBSITE");
+ configurationManager.set("server.site.register", "SERVER IP TO INS-FRONTEND WEBSITE");
configurationManager.saveProperties();
}
@@ -162,79 +162,79 @@ public abstract class ProtocolDNSServer extends DefaultMethodsOverrider {
}
/**
- * Gets the DNS information site URL from the configuration.
+ * Gets the INS information site URL from the configuration.
*
- * @return The DNS information site URL.
+ * @return The INS information site URL.
*/
- public final String getDNSInfoSite() {
+ public final String getINSInfoSite() {
return configurationManager.getString("server.site.info");
}
/**
- * Gets the DNS registration site URL from the configuration.
+ * Gets the INS registration site URL from the configuration.
*
- * @return The DNS registration site URL.
+ * @return The INS registration site URL.
*/
- public final String getDNSRegisterSite() {
+ public final String getINSRegisterSite() {
return configurationManager.getString("server.site.register");
}
/**
- * Abstract method to retrieve the list of domains managed by the DNS server.
+ * Abstract method to retrieve the list of InfoNames managed by the INS server.
*
- * @return A list of Domain objects.
+ * @return A list of InfoName objects.
*/
- public abstract List getDomains();
+ public abstract List getInfoNames();
/**
- * @param domain The domain to look up.
- * @return The destination associated with the domain.
- * @see Domain#getDestination()
- * Abstract method to get the destination for a given domain.
+ * @param infoName The InfoName to look up.
+ * @return The destination associated with the InfoName.
+ * @see InfoName#getDestination()
+ * Abstract method to get the destination for a given InfoName.
*/
- public abstract String getDomainDestination(Domain domain);
+ public abstract String getInfoNameDestination(InfoName infoName);
/**
- * @param domain The parent domain.
+ * @param infoName The parent InfoName.
* @param subname The subname to look up.
* @return The destination associated with the subname.
- * @see Domain#getDestination()
- * Abstract method to get the destination for a given subname under a specific domain.
+ * @see InfoName#getDestination()
+ * Abstract method to get the destination for a given subname under a specific InfoName.
*/
- public abstract String getSubnameDestination(Domain domain, String subname);
+ public abstract String getSubnameDestination(InfoName infoName, String subname);
/**
- * @param topLevelName The top-level domain name.
- * @return The information site URL for the specified top-level domain.
- * @see Domain#getDestination()
- * Abstract method to get the top-level domain information site URL.
+ * @param topLevelName The top-level name.
+ * @return The information site URL for the specified top-level name.
+ * @see InfoName#getDestination()
+ * Abstract method to get the top-level name information site URL.
*/
public abstract String getTLNInfoSite(String topLevelName);
/**
- * Abstract method to validate a requested domain.
+ * Abstract method to validate a requested InfoName.
*
- * @param requestedDomain The domain to validate.
- * @return A DNSResponseCode indicating the result of the validation.
+ * @param requestedInfoName The InfoName to validate.
+ * @return A INSResponseCode indicating the result of the validation.
*/
- public abstract DNSResponseCode validateDomain(Domain requestedDomain);
+ public abstract INSResponseCode validateInfoName(InfoName requestedInfoName);
/**
* Abstract method called when a validation packet fails to send.
- * @param domain The domain associated with the validation.
+ * @param infoName The InfoName associated with the validation.
* @param client The connected protocol client.
* @param exception The exception that occurred during sending.
*/
- public abstract void validationPacketSendFailed(Domain domain, ConnectedProtocolClient client, Exception exception);
+ public abstract void validationPacketSendFailed(InfoName infoName, ConnectedProtocolClient client, Exception exception);
/**
- * Abstract method called when a domain destination packet fails to send.
+ * Abstract method called when a InfoName destination packet fails to send.
* @param client The connected protocol client.
- * @param domain The domain associated with the packet.
- * @param validationResponse The DNS response code from validation.
+ * @param infoName The InfoName associated with the packet.
+ * @param validationResponse The INS response code from validation.
* @param exception The exception that occurred during sending.
*/
- public abstract void domainDestinationPacketFailedSend(ConnectedProtocolClient client, Domain domain, DNSResponseCode validationResponse, Exception exception);
+ public abstract void infoNameDestinationPacketFailedSend(ConnectedProtocolClient client, InfoName infoName, INSResponseCode validationResponse, Exception exception);
/**
* Class representing the folder structure for server certificates.
@@ -250,8 +250,8 @@ public abstract class ProtocolDNSServer extends DefaultMethodsOverrider {
public final File publicCAFolder;
public final File publicServerFolder;
- public final String caPrefix = "ca_dns_";
- public final String certPrefix = "cert_dns_";
+ public final String caPrefix = "ca_ins_";
+ public final String certPrefix = "cert_ins_";
public ServerCertificateFolderStructure() {
certificatesFolder = new File("certificates");
diff --git a/src/main/java/org/openautonomousconnection/protocol/side/dns/events/ConnectedProtocolClientEvent.java b/src/main/java/org/openautonomousconnection/protocol/side/ins/events/ConnectedProtocolClientEvent.java
similarity index 67%
rename from src/main/java/org/openautonomousconnection/protocol/side/dns/events/ConnectedProtocolClientEvent.java
rename to src/main/java/org/openautonomousconnection/protocol/side/ins/events/ConnectedProtocolClientEvent.java
index ef76840..6891621 100644
--- a/src/main/java/org/openautonomousconnection/protocol/side/dns/events/ConnectedProtocolClientEvent.java
+++ b/src/main/java/org/openautonomousconnection/protocol/side/ins/events/ConnectedProtocolClientEvent.java
@@ -1,15 +1,15 @@
-package org.openautonomousconnection.protocol.side.dns.events;
+package org.openautonomousconnection.protocol.side.ins.events;
import dev.unlegitdqrk.unlegitlibrary.event.impl.Event;
import lombok.Getter;
import org.openautonomousconnection.protocol.annotations.ProtocolInfo;
-import org.openautonomousconnection.protocol.side.dns.ConnectedProtocolClient;
+import org.openautonomousconnection.protocol.side.ins.ConnectedProtocolClient;
import org.openautonomousconnection.protocol.versions.ProtocolVersion;
/**
- * Event triggered when a protocol client connects to the DNS server.
+ * Event triggered when a protocol client connects to the INS server.
*/
-@ProtocolInfo(protocolSide = ProtocolVersion.ProtocolSide.DNS)
+@ProtocolInfo(protocolSide = ProtocolVersion.ProtocolSide.INS)
public final class ConnectedProtocolClientEvent extends Event {
@Getter
diff --git a/src/main/java/org/openautonomousconnection/protocol/versions/ProtocolVersion.java b/src/main/java/org/openautonomousconnection/protocol/versions/ProtocolVersion.java
index 64ffe95..b2e30a4 100644
--- a/src/main/java/org/openautonomousconnection/protocol/versions/ProtocolVersion.java
+++ b/src/main/java/org/openautonomousconnection/protocol/versions/ProtocolVersion.java
@@ -14,7 +14,7 @@ public enum ProtocolVersion implements Serializable {
/**
* Support for old OAC-Project => *_old
*/
- PV_1_0_0_CLASSIC("1.0.0", ProtocolType.CLASSIC, ProtocolSide.WEB_DNS, List.of(Protocol.HTTP)),
+ PV_1_0_0_CLASSIC("1.0.0", ProtocolType.CLASSIC, ProtocolSide.WEB_INS, List.of(Protocol.HTTP)),
/**
* First Beta Version of OAC-Protocol
@@ -153,12 +153,12 @@ public enum ProtocolVersion implements Serializable {
/**
* Client Side only
*/
- CLIENT, // Protocol version can only used on Client
+ CLIENT,
/**
- * DNS Server Side only
+ * INS Server Side only
*/
- DNS,
+ INS,
/**
* Web Server Side only
@@ -166,14 +166,14 @@ public enum ProtocolVersion implements Serializable {
WEB,
/**
- * Both DNS and Web Server Side
+ * Both INS and Web Server Side
*/
- WEB_DNS,
+ WEB_INS,
/**
- * Both Client and DNS Server Side
+ * Both Client and INS Server Side
*/
- CLIENT_DNS,
+ CLIENT_INS,
/**
* Both Client and Web Server Side
diff --git a/src/main/java/org/openautonomousconnection/protocol/versions/v1_0_0/beta/DNSResponseCode.java b/src/main/java/org/openautonomousconnection/protocol/versions/v1_0_0/beta/DNSResponseCode.java
deleted file mode 100644
index 71524e3..0000000
--- a/src/main/java/org/openautonomousconnection/protocol/versions/v1_0_0/beta/DNSResponseCode.java
+++ /dev/null
@@ -1,85 +0,0 @@
-package org.openautonomousconnection.protocol.versions.v1_0_0.beta;
-
-import lombok.Getter;
-
-import java.io.Serializable;
-
-/**
- * Enum representing various DNS response codes and their descriptions.
- */
-public enum DNSResponseCode implements Serializable {
- /**
- * General Responses
- */
- RESPONSE_NOT_REQUIRED(0, "Response code not required"),
- RESPONSE_INVALID_REQUEST(1, "Invalid request"),
-
- /**
- * Authentication Responses
- */
- RESPONSE_AUTH_SUCCESS(4, "Auth success"),
- RESPONSE_AUTH_FAILED(5, "Auth failed"),
-
- /**
- * Domain Responses
- */
- RESPONSE_DOMAIN_NAME_EXIST(100, "Domainname exist"),
- RESPONSE_DOMAIN_NAME_NOT_EXIST(101, "Domainname does not exist"),
- RESPONSE_DOMAIN_NAME_CREATED(105, "Domainname created"),
- RESPONSE_DOMAIN_NAME_DELETED(106, "Domainname deleted"),
-
- /**
- * Top Level Name Responses
- */
- RESPONSE_DOMAIN_TLN_EXIST(110, "TopLevelName exist"),
- RESPONSE_DOMAIN_TLN_NOT_EXIST(111, "TopLevelName does not exist"),
- RESPONSE_DOMAIN_TLN_CREATED(115, "TopLevelName created"),
- RESPONSE_DOMAIN_TLN_DELETED(116, "TopLevelName deleted"),
-
- /**
- * Subname Responses
- */
- RESPONSE_DOMAIN_SUBNAME_EXIST(120, "Subname exist"),
- RESPONSE_DOMAIN_SUBNAME_NOT_EXIST(121, "Subname does not exist"),
- RESPONSE_DOMAIN_SUBNAME_CREATED(125, "Subname created"),
- RESPONSE_DOMAIN_SUBNAME_DELETED(126, "Subname deleted"),
-
- /**
- * Full Domain Responses
- */
- RESPONSE_DOMAIN_FULLY_EXIST(130, "Full domain exist"),
- RESPONSE_DOMAIN_FULLY_NOT_EXIST(131, "Full domain does not exist");
-
- /**
- * The numeric code representing the DNS response.
- */
- @Getter
- private final int code;
-
- /**
- * A brief description of the DNS response code.
- */
- @Getter
- private final String description;
-
- /**
- * Constructor for DNSResponseCode enum.
- *
- * @param code The numeric code of the response.
- * @param description A brief description of the response.
- */
- DNSResponseCode(int code, String description) {
- this.code = code;
- this.description = description;
- }
-
- /**
- * Returns a string representation of the DNS response code, including its code and description.
- *
- * @return a string representation of the DNS response code.
- */
- @Override
- public String toString() {
- return "{code=" + code + ";description=" + description + "}";
- }
-}
diff --git a/src/main/java/org/openautonomousconnection/protocol/versions/v1_0_0/beta/Domain.java b/src/main/java/org/openautonomousconnection/protocol/versions/v1_0_0/beta/Domain.java
deleted file mode 100644
index abd0c83..0000000
--- a/src/main/java/org/openautonomousconnection/protocol/versions/v1_0_0/beta/Domain.java
+++ /dev/null
@@ -1,172 +0,0 @@
-package org.openautonomousconnection.protocol.versions.v1_0_0.beta;
-
-import lombok.Getter;
-import org.openautonomousconnection.protocol.ProtocolBridge;
-import org.openautonomousconnection.protocol.annotations.ProtocolInfo;
-import org.openautonomousconnection.protocol.versions.ProtocolVersion;
-
-import java.io.Serializable;
-import java.util.Arrays;
-import java.util.List;
-
-/**
- * Class representing a domain with its components such as subname, name, top-level name, path, query, fragment, and protocol.
- */
-public final class Domain implements Serializable {
- /**
- * The subname of the domain (e.g., "sub" in "sub.example.com").
- */
- @Getter
- private final String subname;
-
- /**
- * The main name of the domain (e.g., "example" in "sub.example.com").
- */
- @Getter
- private final String name;
-
- /**
- * The top-level name of the domain (e.g., "com" in "sub.example.com").
- */
- @Getter
- private final String topLevelName;
-
- /**
- * The path component of the domain (e.g., "path/to/resource" in "example.com/path/to/resource").
- */
- @Getter
- private String path;
-
- /**
- * The query component of the domain (e.g., "key=value" in "example.com/path?key=value").
- */
- @Getter
- private String query;
-
- /**
- * The fragment component of the domain (e.g., "section1" in "example.com/path#section1").
- */
- @Getter
- private String fragment;
-
- /**
- * The protocol of the domain (e.g., "oac" in "oac://example.com").
- */
- @Getter
- private String protocol;
-
- /**
- * Constructs a Domain object by parsing the provided full domain string.
- *
- * @param fullDomain The full domain string to parse.
- * @throws IllegalArgumentException if the domain is invalid.
- */
- public Domain(String fullDomain) {
- // Remove protocol
- String domainWithPath = fullDomain.contains("://") ? fullDomain.split("://", 2)[1] : fullDomain;
- this.protocol = fullDomain.contains("://") ? fullDomain.split("://", 2)[0] : "";
- if (this.protocol.endsWith("://"))
- this.protocol = this.protocol.substring(0, this.protocol.length() - "://".length());
-
- // Cut path
- String[] domainPartsAndPath = domainWithPath.split("/", 2);
-
- // Get host and full path
- String host = domainPartsAndPath[0];
- String fullPath = domainPartsAndPath.length > 1 ? "/" + domainPartsAndPath[1] : "";
-
- // Split domain in labels
- List labels = Arrays.asList(host.split("\\."));
- if (labels.size() < 2) throw new IllegalArgumentException("Invalid domain: " + host);
-
- // Get subname, name and top-level name
- this.topLevelName = labels.getLast();
- this.name = labels.get(labels.size() - 2);
- this.subname = labels.size() > 2 ? String.join(".", labels.subList(0, labels.size() - 2)) : null;
-
- // Split fragment
- if (fullPath.contains("#")) {
- this.fragment = "#" + Arrays.stream(fullPath.split("#")).toList().getLast();
- fullPath = fullPath.substring(0, fullPath.length() - ("#" + fragment).length());
- } else this.fragment = "";
-
- // Split path and query
- if (fullPath.contains("?")) {
- String[] parts = fullPath.split("\\?", 2);
- this.path = parts[0];
- this.query = parts[1];
- } else {
- this.path = fullPath;
- this.query = "";
- }
-
- // Clean up path, query and fragment
- if (this.path.startsWith("/")) this.path = this.path.substring(1);
- if (this.path.endsWith("/")) this.path = this.path.substring(0, this.path.length() - 1);
-
- if (this.query.startsWith("?")) this.query = this.query.substring(1);
- if (this.fragment.startsWith("#")) this.fragment = this.fragment.substring(1);
- }
-
- /**
- * Checks if the domain has a subname.
- *
- * @return true if the domain has a subname, false otherwise.
- */
- public boolean hasSubname() {
- return subname != null;
- }
-
- /**
- * Checks if this domain is equal to another object.
- * Two domains are considered equal if their subname, name, top-level name, and protocol are equal (case-insensitive).
- *
- * @return true if the domains are equal, false otherwise.
- */
- @Override
- public boolean equals(Object obj) {
- // Check if the object is an instance of Domain
- if (!(obj instanceof Domain domain)) return false;
-
- // Compare subname, name, top-level name, and protocol (case-insensitive)
- return domain.getSubname().equalsIgnoreCase(this.subname) && domain.getName().equalsIgnoreCase(this.name) &&
- domain.getTopLevelName().equalsIgnoreCase(this.topLevelName) && domain.getProtocol().equalsIgnoreCase(this.protocol);
- }
-
- /**
- * Returns the destination associated with this domain.
- * The destination is determined based on the domain's components and the current protocol context.
- *
- * @return the destination as a string.
- */
- @ProtocolInfo(protocolSide = ProtocolVersion.ProtocolSide.DNS)
- public String getDestination() {
- // If running as client or web server, return invalid request
- if (ProtocolBridge.getInstance().isRunningAsClient() || ProtocolBridge.getInstance().isRunningAsWebServer())
- return DNSResponseCode.RESPONSE_INVALID_REQUEST.toString();
-
- // Handle special default domains
- if (this.equals(DefaultDomains.DNS_INFO_SITE))
- return ProtocolBridge.getInstance().getProtocolDNSServer().getDNSInfoSite();
- if (this.equals(DefaultDomains.DNS_REGISTER_SITE))
- return ProtocolBridge.getInstance().getProtocolDNSServer().getDNSRegisterSite();
- if (this.name.equalsIgnoreCase("about") && this.protocol.equalsIgnoreCase("oac"))
- return ProtocolBridge.getInstance().getProtocolDNSServer().getTLNInfoSite(topLevelName);
-
- // Return destination based on whether subname exists
- return !hasSubname() ? ProtocolBridge.getInstance().getProtocolDNSServer().getDomainDestination(this) : ProtocolBridge.getInstance().getProtocolDNSServer().getSubnameDestination(this, subname);
- }
-
- /**
- * Returns a string representation of the domain, including its protocol, subname, name, top-level name, path, query, and fragment.
- */
- public static class DefaultDomains {
- public static final Domain DNS_INFO_SITE = new Domain("oac://about.oac/");
- public static final Domain DNS_REGISTER_SITE = new Domain("oac://register.oac/");
-
- public static Domain TLN_INFO_SITE(String topLevelName) {
- return new Domain("oac://about." + topLevelName + "/");
- }
- }
-
-}
diff --git a/src/main/java/org/openautonomousconnection/protocol/versions/v1_0_0/beta/INSResponseCode.java b/src/main/java/org/openautonomousconnection/protocol/versions/v1_0_0/beta/INSResponseCode.java
new file mode 100644
index 0000000..ce84668
--- /dev/null
+++ b/src/main/java/org/openautonomousconnection/protocol/versions/v1_0_0/beta/INSResponseCode.java
@@ -0,0 +1,85 @@
+package org.openautonomousconnection.protocol.versions.v1_0_0.beta;
+
+import lombok.Getter;
+
+import java.io.Serializable;
+
+/**
+ * Enum representing various INS response codes and their descriptions.
+ */
+public enum INSResponseCode implements Serializable {
+ /**
+ * General Responses
+ */
+ RESPONSE_NOT_REQUIRED(0, "Response code not required"),
+ RESPONSE_INVALID_REQUEST(1, "Invalid request"),
+
+ /**
+ * Authentication Responses
+ */
+ RESPONSE_AUTH_SUCCESS(4, "Auth success"),
+ RESPONSE_AUTH_FAILED(5, "Auth failed"),
+
+ /**
+ * InfoName Responses
+ */
+ RESPONSE_INFONAME_NAME_EXIST(100, "Infoname exist"),
+ RESPONSE_INFONAME_NAME_NOT_EXIST(101, "Infoname does not exist"),
+ RESPONSE_INFONAME_NAME_CREATED(105, "Infoname created"),
+ RESPONSE_INFONAME_NAME_DELETED(106, "Infoname deleted"),
+
+ /**
+ * Top Level Name Responses
+ */
+ RESPONSE_INFONAME_TLN_EXIST(110, "TopLevelName exist"),
+ RESPONSE_INFONAME_TLN_NOT_EXIST(111, "TopLevelName does not exist"),
+ RESPONSE_INFONAME_TLN_CREATED(115, "TopLevelName created"),
+ RESPONSE_INFONAME_TLN_DELETED(116, "TopLevelName deleted"),
+
+ /**
+ * Subname Responses
+ */
+ RESPONSE_INFONAME_SUBNAME_EXIST(120, "Subname exist"),
+ RESPONSE_INFONAME_SUBNAME_NOT_EXIST(121, "Subname does not exist"),
+ RESPONSE_INFONAME_SUBNAME_CREATED(125, "Subname created"),
+ RESPONSE_INFONAME_SUBNAME_DELETED(126, "Subname deleted"),
+
+ /**
+ * Full InfoName Responses
+ */
+ RESPONSE_INFONAME_FULLY_EXIST(130, "Full Infoname exist"),
+ RESPONSE_INFONAME_FULLY_NOT_EXIST(131, "Full Infoname does not exist");
+
+ /**
+ * The numeric code representing the INS response.
+ */
+ @Getter
+ private final int code;
+
+ /**
+ * A brief description of the INS response code.
+ */
+ @Getter
+ private final String description;
+
+ /**
+ * Constructor for INSResponseCode enum.
+ *
+ * @param code The numeric code of the response.
+ * @param description A brief description of the response.
+ */
+ INSResponseCode(int code, String description) {
+ this.code = code;
+ this.description = description;
+ }
+
+ /**
+ * Returns a string representation of the INS response code, including its code and description.
+ *
+ * @return a string representation of the INS response code.
+ */
+ @Override
+ public String toString() {
+ return "{code=" + code + ";description=" + description + "}";
+ }
+}
diff --git a/src/main/java/org/openautonomousconnection/protocol/versions/v1_0_0/beta/InfoName.java b/src/main/java/org/openautonomousconnection/protocol/versions/v1_0_0/beta/InfoName.java
new file mode 100644
index 0000000..04bed43
--- /dev/null
+++ b/src/main/java/org/openautonomousconnection/protocol/versions/v1_0_0/beta/InfoName.java
@@ -0,0 +1,172 @@
+package org.openautonomousconnection.protocol.versions.v1_0_0.beta;
+
+import lombok.Getter;
+import org.openautonomousconnection.protocol.ProtocolBridge;
+import org.openautonomousconnection.protocol.annotations.ProtocolInfo;
+import org.openautonomousconnection.protocol.versions.ProtocolVersion;
+
+import java.io.Serializable;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * Class representing a InfoName with its components such as subname, name, top-level name, path, query, fragment, and protocol.
+ */
+public final class InfoName implements Serializable {
+ /**
+ * The subname of the InfoName (e.g., "sub" in "sub.example.com").
+ */
+ @Getter
+ private final String subname;
+
+ /**
+ * The main name of the InfoName (e.g., "example" in "sub.example.com").
+ */
+ @Getter
+ private final String name;
+
+ /**
+ * The top-level name of the InfoName (e.g., "com" in "sub.example.com").
+ */
+ @Getter
+ private final String topLevelName;
+
+ /**
+ * The path component of the InfoName (e.g., "path/to/resource" in "example.com/path/to/resource").
+ */
+ @Getter
+ private String path;
+
+ /**
+ * The query component of the InfoName (e.g., "key=value" in "example.com/path?key=value").
+ */
+ @Getter
+ private String query;
+
+ /**
+ * The fragment component of the InfoName (e.g., "section1" in "example.com/path#section1").
+ */
+ @Getter
+ private String fragment;
+
+ /**
+ * The protocol of the InfoName (e.g., "oac" in "oac://example.com").
+ */
+ @Getter
+ private String protocol;
+
+ /**
+ * Constructs a InfoName object by parsing the provided full InfoName string.
+ *
+ * @param fullInfoName The full InfoName string to parse.
+ * @throws IllegalArgumentException if the InfoName is invalid.
+ */
+ public InfoName(String fullInfoName) {
+ // Remove protocol
+ String infoNameWithPath = fullInfoName.contains("://") ? fullInfoName.split("://", 2)[1] : fullInfoName;
+ this.protocol = fullInfoName.contains("://") ? fullInfoName.split("://", 2)[0] : "";
+ if (this.protocol.endsWith("://"))
+ this.protocol = this.protocol.substring(0, this.protocol.length() - "://".length());
+
+ // Cut path
+ String[] infoNamePartsAndPath = infoNameWithPath.split("/", 2);
+
+ // Get host and full path
+ String host = infoNamePartsAndPath[0];
+ String fullPath = infoNamePartsAndPath.length > 1 ? "/" + infoNamePartsAndPath[1] : "";
+
+ // Split InfoName in labels
+ List labels = Arrays.asList(host.split("\\."));
+ if (labels.size() < 2) throw new IllegalArgumentException("Invalid InfoName: " + host);
+
+ // Get subname, name and top-level name
+ this.topLevelName = labels.getLast();
+ this.name = labels.get(labels.size() - 2);
+ this.subname = labels.size() > 2 ? String.join(".", labels.subList(0, labels.size() - 2)) : null;
+
+ // Split fragment
+ if (fullPath.contains("#")) {
+ this.fragment = "#" + Arrays.stream(fullPath.split("#")).toList().getLast();
+ fullPath = fullPath.substring(0, fullPath.length() - ("#" + fragment).length());
+ } else this.fragment = "";
+
+ // Split path and query
+ if (fullPath.contains("?")) {
+ String[] parts = fullPath.split("\\?", 2);
+ this.path = parts[0];
+ this.query = parts[1];
+ } else {
+ this.path = fullPath;
+ this.query = "";
+ }
+
+ // Clean up path, query and fragment
+ if (this.path.startsWith("/")) this.path = this.path.substring(1);
+ if (this.path.endsWith("/")) this.path = this.path.substring(0, this.path.length() - 1);
+
+ if (this.query.startsWith("?")) this.query = this.query.substring(1);
+ if (this.fragment.startsWith("#")) this.fragment = this.fragment.substring(1);
+ }
+
+ /**
+ * Checks if the InfoName has a subname.
+ *
+ * @return true if the InfoName has a subname, false otherwise.
+ */
+ public boolean hasSubname() {
+ return subname != null;
+ }
+
+ /**
+ * Checks if this InfoName is equal to another object.
+ * Two InfoNames are considered equal if their subname, name, top-level name, and protocol are equal (case-insensitive).
+ *
+ * @return true if the InfoNames are equal, false otherwise.
+ */
+ @Override
+ public boolean equals(Object obj) {
+ // Check if the object is an instance of InfoName
+ if (!(obj instanceof InfoName infoName)) return false;
+
+ // Compare subname, name, top-level name, and protocol (case-insensitive)
+ return infoName.getSubname().equalsIgnoreCase(this.subname) && infoName.getName().equalsIgnoreCase(this.name) &&
+ infoName.getTopLevelName().equalsIgnoreCase(this.topLevelName) && infoName.getProtocol().equalsIgnoreCase(this.protocol);
+ }
+
+ /**
+ * Returns the destination associated with this InfoName.
+ * The destination is determined based on the InfoName's components and the current protocol context.
+ *
+ * @return the destination as a string.
+ */
+ @ProtocolInfo(protocolSide = ProtocolVersion.ProtocolSide.INS)
+ public String getDestination() {
+ // If running as client or web server, return invalid request
+ if (ProtocolBridge.getInstance().isRunningAsClient() || ProtocolBridge.getInstance().isRunningAsWebServer())
+ return INSResponseCode.RESPONSE_INVALID_REQUEST.toString();
+
+ // Handle special default InfoNames
+ if (this.equals(DefaultInfoNames.INS_INFO_SITE))
+ return ProtocolBridge.getInstance().getProtocolINSServer().getINSInfoSite();
+ if (this.equals(DefaultInfoNames.INS_REGISTER_SITE))
+ return ProtocolBridge.getInstance().getProtocolINSServer().getINSRegisterSite();
+ if (this.equals(DefaultInfoNames.TLN_INFO_SITE(topLevelName)))
+ return ProtocolBridge.getInstance().getProtocolINSServer().getTLNInfoSite(topLevelName);
+
+ // Return destination based on whether subname exists
+ return !hasSubname() ? ProtocolBridge.getInstance().getProtocolINSServer().getInfoNameDestination(this) : ProtocolBridge.getInstance().getProtocolINSServer().getSubnameDestination(this, subname);
+ }
+
+ /**
+ * Returns a string representation of the InfoName, including its protocol, subname, name, top-level name, path, query, and fragment.
+ */
+ public static class DefaultInfoNames {
+ public static final InfoName INS_INFO_SITE = new InfoName("oac://info.oac/");
+ public static final InfoName INS_REGISTER_SITE = new InfoName("oac://register.oac/");
+
+ public static InfoName TLN_INFO_SITE(String topLevelName) {
+ return new InfoName("oac://about." + topLevelName + "/");
+ }
+ }
+
+}
diff --git a/src/main/java/org/openautonomousconnection/protocol/versions/v1_0_0/classic/events/Classic_DomainPacketReceivedEvent.java b/src/main/java/org/openautonomousconnection/protocol/versions/v1_0_0/classic/events/Classic_DomainPacketReceivedEvent.java
index a64dd31..504ff03 100644
--- a/src/main/java/org/openautonomousconnection/protocol/versions/v1_0_0/classic/events/Classic_DomainPacketReceivedEvent.java
+++ b/src/main/java/org/openautonomousconnection/protocol/versions/v1_0_0/classic/events/Classic_DomainPacketReceivedEvent.java
@@ -1,6 +1,7 @@
package org.openautonomousconnection.protocol.versions.v1_0_0.classic.events;
import dev.unlegitdqrk.unlegitlibrary.event.impl.Event;
+import org.openautonomousconnection.protocol.versions.v1_0_0.classic.handlers.ClassicHandlerINSServer;
import org.openautonomousconnection.protocol.versions.v1_0_0.classic.objects.Classic_Domain;
import org.openautonomousconnection.protocol.versions.v1_0_0.classic.objects.Classic_RequestDomain;
import org.openautonomousconnection.protocol.versions.v1_0_0.classic.utils.Classic_ProtocolVersion;
@@ -9,7 +10,7 @@ import org.openautonomousconnection.protocol.versions.v1_0_0.classic.utils.Class
* This event is fired when a classic domain packet is received.
* This event is deprecated and will be marked for removal in future versions.
*
- * @see org.openautonomousconnection.protocol.versions.v1_0_0.classic.handlers.ClassicHandlerDNSServer
+ * @see ClassicHandlerINSServer
* @see org.openautonomousconnection.protocol.versions.v1_0_0.classic.handlers.ClassicHandlerClient
* @see org.openautonomousconnection.protocol.versions.v1_0_0.classic.handlers.ClassicHandlerWebServer
*/
diff --git a/src/main/java/org/openautonomousconnection/protocol/versions/v1_0_0/classic/events/Classic_PingPacketReceivedEvent.java b/src/main/java/org/openautonomousconnection/protocol/versions/v1_0_0/classic/events/Classic_PingPacketReceivedEvent.java
index bba9656..34fec21 100644
--- a/src/main/java/org/openautonomousconnection/protocol/versions/v1_0_0/classic/events/Classic_PingPacketReceivedEvent.java
+++ b/src/main/java/org/openautonomousconnection/protocol/versions/v1_0_0/classic/events/Classic_PingPacketReceivedEvent.java
@@ -1,6 +1,7 @@
package org.openautonomousconnection.protocol.versions.v1_0_0.classic.events;
import dev.unlegitdqrk.unlegitlibrary.event.impl.Event;
+import org.openautonomousconnection.protocol.versions.v1_0_0.classic.handlers.ClassicHandlerINSServer;
import org.openautonomousconnection.protocol.versions.v1_0_0.classic.objects.Classic_Domain;
import org.openautonomousconnection.protocol.versions.v1_0_0.classic.objects.Classic_RequestDomain;
import org.openautonomousconnection.protocol.versions.v1_0_0.classic.utils.Classic_ProtocolVersion;
@@ -9,7 +10,7 @@ import org.openautonomousconnection.protocol.versions.v1_0_0.classic.utils.Class
* This event is fired when a classic ping packet is received.
* This event is deprecated and will be marked for removal in future versions.
*
- * @see org.openautonomousconnection.protocol.versions.v1_0_0.classic.handlers.ClassicHandlerDNSServer
+ * @see ClassicHandlerINSServer
* @see org.openautonomousconnection.protocol.versions.v1_0_0.classic.handlers.ClassicHandlerClient
* @see org.openautonomousconnection.protocol.versions.v1_0_0.classic.handlers.ClassicHandlerWebServer
*/
diff --git a/src/main/java/org/openautonomousconnection/protocol/versions/v1_0_0/classic/handlers/ClassicHandlerClient.java b/src/main/java/org/openautonomousconnection/protocol/versions/v1_0_0/classic/handlers/ClassicHandlerClient.java
index 4e420cc..b78c7e9 100644
--- a/src/main/java/org/openautonomousconnection/protocol/versions/v1_0_0/classic/handlers/ClassicHandlerClient.java
+++ b/src/main/java/org/openautonomousconnection/protocol/versions/v1_0_0/classic/handlers/ClassicHandlerClient.java
@@ -23,6 +23,6 @@ public abstract class ClassicHandlerClient {
public abstract void handleMessage(String message, Classic_ProtocolVersion protocolVersion);
public final void sendMessage(String message) throws IOException, ClassNotFoundException {
- ProtocolBridge.getInstance().getProtocolClient().getClientDNSConnection().sendPacket(new Classic_MessagePacket(message, 0));
+ ProtocolBridge.getInstance().getProtocolClient().getClientINSConnection().sendPacket(new Classic_MessagePacket(message, 0));
}
}
diff --git a/src/main/java/org/openautonomousconnection/protocol/versions/v1_0_0/classic/handlers/ClassicHandlerDNSServer.java b/src/main/java/org/openautonomousconnection/protocol/versions/v1_0_0/classic/handlers/ClassicHandlerINSServer.java
similarity index 81%
rename from src/main/java/org/openautonomousconnection/protocol/versions/v1_0_0/classic/handlers/ClassicHandlerDNSServer.java
rename to src/main/java/org/openautonomousconnection/protocol/versions/v1_0_0/classic/handlers/ClassicHandlerINSServer.java
index 4c1ca62..074a0d8 100644
--- a/src/main/java/org/openautonomousconnection/protocol/versions/v1_0_0/classic/handlers/ClassicHandlerDNSServer.java
+++ b/src/main/java/org/openautonomousconnection/protocol/versions/v1_0_0/classic/handlers/ClassicHandlerINSServer.java
@@ -1,7 +1,7 @@
package org.openautonomousconnection.protocol.versions.v1_0_0.classic.handlers;
import org.openautonomousconnection.protocol.annotations.ProtocolInfo;
-import org.openautonomousconnection.protocol.side.dns.ConnectedProtocolClient;
+import org.openautonomousconnection.protocol.side.ins.ConnectedProtocolClient;
import org.openautonomousconnection.protocol.versions.ProtocolVersion;
import org.openautonomousconnection.protocol.versions.v1_0_0.classic.objects.Classic_Domain;
import org.openautonomousconnection.protocol.versions.v1_0_0.classic.objects.Classic_RequestDomain;
@@ -10,10 +10,10 @@ import org.openautonomousconnection.protocol.versions.v1_0_0.classic.utils.Class
import java.sql.SQLException;
/**
- * Abstract class defining the DNS server-side handler for Classic protocol operations.
+ * Abstract class defining the INS server-side handler for Classic protocol operations.
*/
-@ProtocolInfo(protocolSide = ProtocolVersion.ProtocolSide.DNS)
-public abstract class ClassicHandlerDNSServer {
+@ProtocolInfo(protocolSide = ProtocolVersion.ProtocolSide.INS)
+public abstract class ClassicHandlerINSServer {
public abstract void handleMessage(ConnectedProtocolClient client, String message, Classic_ProtocolVersion protocolVersion);
public abstract Classic_Domain getDomain(Classic_RequestDomain requestDomain) throws SQLException;
diff --git a/src/main/java/org/openautonomousconnection/protocol/versions/v1_0_0/classic/handlers/ClassicHandlerWebServer.java b/src/main/java/org/openautonomousconnection/protocol/versions/v1_0_0/classic/handlers/ClassicHandlerWebServer.java
index 4457047..2a261df 100644
--- a/src/main/java/org/openautonomousconnection/protocol/versions/v1_0_0/classic/handlers/ClassicHandlerWebServer.java
+++ b/src/main/java/org/openautonomousconnection/protocol/versions/v1_0_0/classic/handlers/ClassicHandlerWebServer.java
@@ -1,7 +1,7 @@
package org.openautonomousconnection.protocol.versions.v1_0_0.classic.handlers;
import org.openautonomousconnection.protocol.annotations.ProtocolInfo;
-import org.openautonomousconnection.protocol.side.dns.ConnectedProtocolClient;
+import org.openautonomousconnection.protocol.side.ins.ConnectedProtocolClient;
import org.openautonomousconnection.protocol.versions.ProtocolVersion;
import org.openautonomousconnection.protocol.versions.v1_0_0.classic.utils.Classic_ProtocolVersion;
diff --git a/src/main/java/org/openautonomousconnection/protocol/versions/v1_0_0/classic/objects/Classic_Domain.java b/src/main/java/org/openautonomousconnection/protocol/versions/v1_0_0/classic/objects/Classic_Domain.java
index acfe6dd..0655f9e 100644
--- a/src/main/java/org/openautonomousconnection/protocol/versions/v1_0_0/classic/objects/Classic_Domain.java
+++ b/src/main/java/org/openautonomousconnection/protocol/versions/v1_0_0/classic/objects/Classic_Domain.java
@@ -1,14 +1,14 @@
package org.openautonomousconnection.protocol.versions.v1_0_0.classic.objects;
import lombok.Getter;
-import org.openautonomousconnection.protocol.versions.v1_0_0.beta.Domain;
+import org.openautonomousconnection.protocol.versions.v1_0_0.beta.InfoName;
import java.io.Serializable;
/**
- * Classic_Domain is an old representation of a domain, maintained for backward compatibility.
- * It encapsulates the domain's name, top-level domain, path, and destination.
- * This class is deprecated and users are encouraged to use the Domain class instead.
+ * Classic_Domain is an old representation of a InfoName, maintained for backward compatibility.
+ * It encapsulates the InfoName's name, top-level name, path, and destination.
+ * This class is deprecated and users are encouraged to use the InfoName class instead.
*/
@Deprecated(forRemoval = false, since = "1.0.0-BETA.3")
public class Classic_Domain implements Serializable {
@@ -16,40 +16,40 @@ public class Classic_Domain implements Serializable {
/**
* The name of the domain (e.g., "example" in "example.com").
*/
- @Deprecated(forRemoval = false, since = "1.0.0-BETA.3 | Will be replaced with a getter")
+ @Deprecated(forRemoval = false, since = "1.0.0-BETA.3")
public final String name;
/**
* The top-level domain (e.g., "com" in "example.com").
*/
- @Deprecated(forRemoval = false, since = "1.0.0-BETA.3 | Will be replaced with a getter")
+ @Deprecated(forRemoval = false, since = "1.0.0-BETA.3")
public final String topLevelDomain;
/**
* The path component of the domain (e.g., "/path/to/resource" in "example.com/path/to/resource").
*/
- @Deprecated(forRemoval = false, since = "1.0.0-BETA.3 | Will be replaced with a getter")
+ @Deprecated(forRemoval = false, since = "1.0.0-BETA.3")
public final String path;
/**
* The destination of the domain, typically the full URL or address.
*/
- @Deprecated(forRemoval = false, since = "1.0.0-BETA.3 | Will be replaced with a getter")
+ @Deprecated(forRemoval = false, since = "1.0.0-BETA.3")
private final String destination;
/**
* The encapsulated Domain object for modern usage.
*/
@Getter
- private final Domain domain;
+ private final InfoName infoName;
public Classic_Domain(String name, String topLevelDomain, String destination, String path) {
- this.domain = new Domain(name + "." + topLevelDomain + "/" + (path.startsWith("/") ? path : "/" + path));
- this.name = domain.getName();
- this.topLevelDomain = domain.getTopLevelName();
- this.destination = domain.getDestination();
- this.path = domain.getPath();
+ this.infoName = new InfoName(name + "." + topLevelDomain + "/" + (path.startsWith("/") ? path : "/" + path));
+ this.name = infoName.getName();
+ this.topLevelDomain = infoName.getTopLevelName();
+ this.destination = infoName.getDestination();
+ this.path = infoName.getPath();
}
@Override
diff --git a/src/main/java/org/openautonomousconnection/protocol/versions/v1_0_0/classic/site/Classic_SiteType.java b/src/main/java/org/openautonomousconnection/protocol/versions/v1_0_0/classic/site/Classic_SiteType.java
index 78c4547..0a82c04 100644
--- a/src/main/java/org/openautonomousconnection/protocol/versions/v1_0_0/classic/site/Classic_SiteType.java
+++ b/src/main/java/org/openautonomousconnection/protocol/versions/v1_0_0/classic/site/Classic_SiteType.java
@@ -18,7 +18,7 @@ public enum Classic_SiteType implements Serializable {
SERVER("oac-server"),
/**
- * DNS server site type.
+ * INS server site type.
*/
PUBLIC("oac"),
@@ -35,7 +35,7 @@ public enum Classic_SiteType implements Serializable {
/**
* The name of the site type.
*/
- @Deprecated(forRemoval = false, since = "1.0.0-BETA.3 | Will be replaced with a getter")
+ @Deprecated(forRemoval = false, since = "1.0.0-BETA.3")
public final String name;
Classic_SiteType(String name) {
diff --git a/src/main/java/org/openautonomousconnection/protocol/versions/v1_0_0/classic/site/Classic_WebsitesContent.java b/src/main/java/org/openautonomousconnection/protocol/versions/v1_0_0/classic/site/Classic_WebsitesContent.java
index 70941c0..66d5996 100644
--- a/src/main/java/org/openautonomousconnection/protocol/versions/v1_0_0/classic/site/Classic_WebsitesContent.java
+++ b/src/main/java/org/openautonomousconnection/protocol/versions/v1_0_0/classic/site/Classic_WebsitesContent.java
@@ -17,7 +17,7 @@ public final class Classic_WebsitesContent extends DefaultMethodsOverrider {
- 404 - This domain was not found
+ 404 - This infoName was not found