Reformatted code using IntelliJ

This commit is contained in:
Finn
2025-09-29 18:46:31 +02:00
parent f9ec00add4
commit facac103e7
30 changed files with 298 additions and 153 deletions

View File

@@ -71,6 +71,7 @@ public enum ProtocolVersion implements Serializable {
/**
* Returns a string representation of the protocol version, including its version, type, side, supported protocols, and compatible versions.
*
* @return a string representation of the protocol version.
*/
@Override
@@ -89,6 +90,7 @@ public enum ProtocolVersion implements Serializable {
/**
* Builds a name for the protocol version combining its version and type.
*
* @return a string representing the name of the protocol version.
*/
public final String buildName() {
@@ -105,6 +107,7 @@ public enum ProtocolVersion implements Serializable {
/**
* Returns the name of the protocol in uppercase.
*
* @return the name of the protocol in uppercase.
*/
@Override
@@ -134,6 +137,7 @@ public enum ProtocolVersion implements Serializable {
/**
* Returns the name of the protocol in uppercase.
*
* @return the name of the protocol in uppercase.
*/
@Override
@@ -179,11 +183,11 @@ public enum ProtocolVersion implements Serializable {
/**
* All Sides
*/
ALL
;
ALL;
/**
* Returns the name of the protocol in uppercase.
*
* @return the name of the protocol in uppercase.
*/
@Override

View File

@@ -75,6 +75,7 @@ public enum DNSResponseCode implements Serializable {
/**
* Returns a string representation of the DNS response code, including its code and description.
*
* @return a string representation of the DNS response code.
*/
@Override

View File

@@ -110,19 +110,21 @@ public final class Domain implements Serializable {
/**
* Checks if the domain has a subname.
*
* @return true if the domain has a subname, false otherwise.
*/
public final boolean hasSubname() {
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 final boolean equals(Object obj) {
public boolean equals(Object obj) {
// Check if the object is an instance of Domain
if (!(obj instanceof Domain domain)) return false;
@@ -134,10 +136,11 @@ public final class Domain implements Serializable {
/**
* 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 final String getDestination() {
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();

View File

@@ -1,14 +1,14 @@
package org.openautonomousconnection.protocol.versions.v1_0_0.classic.events;
import dev.unlegitdqrk.unlegitlibrary.event.impl.Event;
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.utils.Classic_ProtocolVersion;
import org.openautonomousconnection.protocol.versions.v1_0_0.classic.objects.Classic_RequestDomain;
import org.openautonomousconnection.protocol.versions.v1_0_0.classic.utils.Classic_ProtocolVersion;
/**
* 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 org.openautonomousconnection.protocol.versions.v1_0_0.classic.handlers.ClassicHandlerClient
* @see org.openautonomousconnection.protocol.versions.v1_0_0.classic.handlers.ClassicHandlerWebServer
@@ -29,22 +29,22 @@ public final class Classic_DomainPacketReceivedEvent extends Event {
}
@Override
protected final Object clone() throws CloneNotSupportedException {
protected Object clone() throws CloneNotSupportedException {
return super.clone();
}
@Override
public final boolean equals(Object obj) {
public boolean equals(Object obj) {
return super.equals(obj);
}
@Override
public final String toString() {
public String toString() {
return super.toString();
}
@Override
public final int hashCode() {
public int hashCode() {
return super.hashCode();
}
}

View File

@@ -2,12 +2,13 @@ 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.objects.Classic_Domain;
import org.openautonomousconnection.protocol.versions.v1_0_0.classic.utils.Classic_ProtocolVersion;
import org.openautonomousconnection.protocol.versions.v1_0_0.classic.objects.Classic_RequestDomain;
import org.openautonomousconnection.protocol.versions.v1_0_0.classic.utils.Classic_ProtocolVersion;
/**
* 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 org.openautonomousconnection.protocol.versions.v1_0_0.classic.handlers.ClassicHandlerClient
* @see org.openautonomousconnection.protocol.versions.v1_0_0.classic.handlers.ClassicHandlerWebServer
@@ -29,22 +30,22 @@ public final class Classic_PingPacketReceivedEvent extends Event {
}
@Override
protected final Object clone() throws CloneNotSupportedException {
protected Object clone() throws CloneNotSupportedException {
return super.clone();
}
@Override
public final boolean equals(Object obj) {
public boolean equals(Object obj) {
return super.equals(obj);
}
@Override
public final String toString() {
public String toString() {
return super.toString();
}
@Override
public final int hashCode() {
public int hashCode() {
return super.hashCode();
}
}

View File

@@ -4,8 +4,8 @@ import org.openautonomousconnection.protocol.annotations.ProtocolInfo;
import org.openautonomousconnection.protocol.side.dns.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.utils.Classic_ProtocolVersion;
import org.openautonomousconnection.protocol.versions.v1_0_0.classic.objects.Classic_RequestDomain;
import org.openautonomousconnection.protocol.versions.v1_0_0.classic.utils.Classic_ProtocolVersion;
import java.sql.SQLException;

View File

@@ -11,6 +11,7 @@ public final class ClassicConverter {
/**
* Converts a Classic_Domain object to a Domain object.
*
* @param classicDomain the Classic_Domain object to convert
* @return the converted Domain object
*/
@@ -21,6 +22,7 @@ public final class ClassicConverter {
/**
* Converts a Domain object to a Classic_Domain object.
*
* @param newDomain the Domain object to convert
* @return the converted Classic_Domain object
*/
@@ -31,6 +33,7 @@ public final class ClassicConverter {
/**
* Converts a Classic_ProtocolVersion to a ProtocolVersion.
*
* @param classicProtocolVersion the Classic_ProtocolVersion to convert
* @return the converted ProtocolVersion
*/
@@ -42,6 +45,7 @@ public final class ClassicConverter {
/**
* Converts a ProtocolVersion to a Classic_ProtocolVersion.
*
* @param newProtocolVersion the ProtocolVersion to convert
* @return the converted Classic_ProtocolVersion
*/

View File

@@ -28,6 +28,7 @@ public final class Classic_ClientListener extends EventListener {
* Handles the event when a domain packet is received.
* It checks if the domain exists and sends a ping request to the DNS server.
* If the domain does not exist, it handles the error accordingly.
*
* @param event The event containing domain information.
*/
@Listener
@@ -57,6 +58,7 @@ public final class Classic_ClientListener extends EventListener {
* Handles the event when a ping packet is received.
* If the domain is reachable, it fetches the HTML content from the domain.
* If not reachable, it handles the error accordingly.
*
* @param event The event containing ping response information.
*/
@Listener
@@ -91,22 +93,22 @@ public final class Classic_ClientListener extends EventListener {
}
@Override
protected final Object clone() throws CloneNotSupportedException {
protected Object clone() throws CloneNotSupportedException {
return super.clone();
}
@Override
public final boolean equals(Object obj) {
public boolean equals(Object obj) {
return super.equals(obj);
}
@Override
public final String toString() {
public String toString() {
return super.toString();
}
@Override
public final int hashCode() {
public int hashCode() {
return super.hashCode();
}
}

View File

@@ -16,6 +16,7 @@ class Classic_DomainUtils extends DefaultMethodsOverrider {
/**
* Extracts the top-level domain (TLD) from a given URL.
*
* @param url The URL from which to extract the TLD.
* @return The top-level domain as a string.
* @throws MalformedURLException If the URL is malformed.
@@ -46,9 +47,10 @@ class Classic_DomainUtils extends DefaultMethodsOverrider {
/**
* Extracts the domain name (excluding the TLD) from a given URL.
*
* @param url The URL from which to extract the domain name.
* @return The domain name as a string.
* @throws URISyntaxException If the URL syntax is incorrect.
* @throws URISyntaxException If the URL syntax is incorrect.
* @throws MalformedURLException If the URL is malformed.
*/
public static String getDomainName(String url) throws URISyntaxException, MalformedURLException {
@@ -71,6 +73,7 @@ class Classic_DomainUtils extends DefaultMethodsOverrider {
/**
* Extracts the path component from a given URL.
*
* @param url The URL from which to extract the path.
* @return The path as a string.
*/