Proxy addition phase 1

This commit is contained in:
mohammed jasem alaajel 2021-05-17 02:10:02 +04:00 committed by Govindas
parent d89691212a
commit b09dd121fc
19 changed files with 163 additions and 51 deletions

View File

@ -29,4 +29,4 @@ jobs:
# Artifact name # Artifact name
name: RediSkript_JAR name: RediSkript_JAR
# Destination path # Destination path
path: target/Red* path: target/*.jar

110
RediSkript-bukkit/pom.xml Normal file
View File

@ -0,0 +1,110 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>RediSkript</artifactId>
<groupId>net.limework</groupId>
<version>1.4.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>RediSkript-bukkit</artifactId>
<repositories>
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/org/spigotmc/spigot-api/</url>
</repository>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
<repository>
<id>commons-pool2</id>
<url>https://mvnrepository.com/artifact/org.apache.commons/commons-pool2</url>
</repository>
<repository>
<id>PaperMC</id>
<url>https://repo.destroystokyo.com/repository/maven-public/</url>
</repository>
<repository>
<id>sk89q</id>
<url>http://maven.sk89q.com/repo</url>
</repository>
</repositories>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.3</version>
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.0</version>
<configuration>
<outputDirectory>../target</outputDirectory>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>com.github.SkriptLang</groupId>
<artifactId>Skript</artifactId>
<version>2.5.3</version>
<type>jar</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.16.5-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
<version>3.5.1</version>
</dependency>
<dependency>
<groupId>net.limework</groupId>
<artifactId>RediSkript-core</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</project>

View File

@ -56,7 +56,9 @@ public class RedisController extends BinaryJedisPubSub implements Runnable {
config.getInt("Redis.TimeOut"), config.getInt("Redis.TimeOut"),
config.getString("Redis.Password"), config.getString("Redis.Password"),
config.getBoolean("Redis.useTLS")); config.getBoolean("Redis.useTLS"));
encryption = new Encryption(config); encryption = new Encryption(config.getBoolean("Redis.EncryptMessages"),
config.getString("Redis.EncryptionKe"),
config.getString("Redis.MacKey"));
setupChannels(config); setupChannels(config);
isConnectionBroken = new AtomicBoolean(true); isConnectionBroken = new AtomicBoolean(true);
isConnecting = new AtomicBoolean(false); isConnecting = new AtomicBoolean(false);

25
RediSkript-core/pom.xml Normal file
View File

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>RediSkript</artifactId>
<groupId>net.limework</groupId>
<version>1.4.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>RediSkript-core</artifactId>
<dependencies>
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
<version>3.5.1</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,11 @@
package net.limework.rediskript;
import redis.clients.jedis.BinaryJedisPubSub;
public abstract class Subscriber extends BinaryJedisPubSub implements Runnable {
}

View File

@ -1,6 +1,5 @@
package net.limework.rediskript.data; package net.limework.rediskript.data;
import org.bukkit.configuration.Configuration;
import org.cryptomator.siv.SivMode; import org.cryptomator.siv.SivMode;
import org.cryptomator.siv.UnauthenticCiphertextException; import org.cryptomator.siv.UnauthenticCiphertextException;
@ -9,17 +8,17 @@ import java.nio.charset.StandardCharsets;
public class Encryption { public class Encryption {
private boolean encryptionEnabled; private final boolean encryptionEnabled;
private String encryptionKey; private String encryptionKey;
private String macKey; private String macKey;
private final SivMode AES_SIV = new SivMode(); private final SivMode AES_SIV = new SivMode();
public Encryption(Configuration config){ public Encryption(boolean encryptionEnabled, String encryptionKey, String macKey){
encryptionEnabled = config.getBoolean("Redis.EncryptMessages"); this.encryptionEnabled = encryptionEnabled;
if (encryptionEnabled) { if (this.encryptionEnabled) {
// AES encryption // AES encryption
encryptionKey = config.getString("Redis.EncryptionKey"); this.encryptionKey = encryptionKey;
macKey = config.getString("Redis.MacKey"); this.macKey = encryptionKey;
} }
} }

49
pom.xml
View File

@ -6,8 +6,12 @@
<groupId>net.limework</groupId> <groupId>net.limework</groupId>
<artifactId>RediSkript</artifactId> <artifactId>RediSkript</artifactId>
<version>1.3.3</version> <version>1.4.0-SNAPSHOT</version>
<packaging>jar</packaging> <modules>
<module>RediSkript-core</module>
<module>RediSkript-bukkit</module>
</modules>
<packaging>pom</packaging>
<build> <build>
<resources> <resources>
@ -46,48 +50,9 @@
</plugins> </plugins>
</build> </build>
<repositories>
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/org/spigotmc/spigot-api/</url>
</repository>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
<repository>
<id>commons-pool2</id>
<url>https://mvnrepository.com/artifact/org.apache.commons/commons-pool2</url>
</repository>
<repository>
<id>PaperMC</id>
<url>https://repo.destroystokyo.com/repository/maven-public/</url>
</repository>
<repository>
<id>sk89q</id>
<url>http://maven.sk89q.com/repo</url>
</repository>
</repositories>
<dependencies> <dependencies>
<dependency>
<groupId>com.github.SkriptLang</groupId>
<artifactId>Skript</artifactId>
<version>2.5.3</version>
<type>jar</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.16.5-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
<version>3.5.1</version>
</dependency>
<dependency> <dependency>
<groupId>org.json</groupId> <groupId>org.json</groupId>
<artifactId>json</artifactId> <artifactId>json</artifactId>