mirror of
https://github.com/PaperMC/Waterfall.git
synced 2025-01-14 11:41:24 +01:00
Updated Source
This commit is contained in:
parent
acf4669a3b
commit
06fe87ce3f
@ -1 +1 @@
|
||||
Subproject commit 61700eb820cb16034a0ed94d54182e37736294e9
|
||||
Subproject commit 27e2885ab3759536fb5a16a3ff388511f3665ad8
|
@ -1,4 +1,4 @@
|
||||
From ece80e18ec59cfbc0b97676bf2a09b26a97375ff Mon Sep 17 00:00:00 2001
|
||||
From f3a05a0d743b35976ff51154c5b17003668c37c8 Mon Sep 17 00:00:00 2001
|
||||
From: Troy Frew <fuzzy_bot@arenaga.me>
|
||||
Date: Tue, 15 Nov 2016 10:31:04 -0500
|
||||
Subject: [PATCH] 1.7.x Protocol Patch
|
||||
@ -1512,7 +1512,7 @@ index b0125245..8c2a743a 100644
|
||||
{
|
||||
this.compressionThreshold = compressionThreshold;
|
||||
diff --git a/proxy/src/main/java/net/md_5/bungee/connection/DownstreamBridge.java b/proxy/src/main/java/net/md_5/bungee/connection/DownstreamBridge.java
|
||||
index 443d19bd..326de178 100644
|
||||
index 9e180c30..d54d8539 100644
|
||||
--- a/proxy/src/main/java/net/md_5/bungee/connection/DownstreamBridge.java
|
||||
+++ b/proxy/src/main/java/net/md_5/bungee/connection/DownstreamBridge.java
|
||||
@@ -20,6 +20,7 @@ import io.netty.buffer.Unpooled;
|
||||
@ -1523,7 +1523,7 @@ index 443d19bd..326de178 100644
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap; // Waterfall
|
||||
import java.util.List;
|
||||
@@ -173,7 +174,7 @@ public class DownstreamBridge extends PacketHandler
|
||||
@@ -179,7 +180,7 @@ public class DownstreamBridge extends PacketHandler
|
||||
switch ( objective.getAction() )
|
||||
{
|
||||
case 0:
|
||||
@ -1532,7 +1532,7 @@ index 443d19bd..326de178 100644
|
||||
break;
|
||||
case 1:
|
||||
serverScoreboard.removeObjective( objective.getName() );
|
||||
@@ -183,7 +184,7 @@ public class DownstreamBridge extends PacketHandler
|
||||
@@ -189,7 +190,7 @@ public class DownstreamBridge extends PacketHandler
|
||||
if ( oldObjective != null )
|
||||
{
|
||||
oldObjective.setValue( objective.getValue() );
|
||||
@ -1541,7 +1541,7 @@ index 443d19bd..326de178 100644
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@@ -280,16 +281,28 @@ public class DownstreamBridge extends PacketHandler
|
||||
@@ -286,16 +287,28 @@ public class DownstreamBridge extends PacketHandler
|
||||
|
||||
if ( pluginMessage.getTag().equals( con.getPendingConnection().getVersion() >= ProtocolConstants.MINECRAFT_1_13 ? "minecraft:brand" : "MC|Brand" ) )
|
||||
{
|
||||
@ -1581,7 +1581,7 @@ index 443d19bd..326de178 100644
|
||||
con.unsafe().sendPacket( pluginMessage );
|
||||
throw CancelSendSignal.INSTANCE;
|
||||
diff --git a/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java b/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java
|
||||
index 4b40b465..13deb6c9 100644
|
||||
index 7e6027aa..fe6ff143 100644
|
||||
--- a/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java
|
||||
+++ b/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java
|
||||
@@ -12,6 +12,13 @@ import java.util.List;
|
||||
@ -1669,7 +1669,7 @@ index 4d7b1b23..ad3bdee5 100644
|
||||
con.getServer().disconnect( "Quitting" );
|
||||
}
|
||||
diff --git a/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap.java b/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap.java
|
||||
index 45f4449c..77274ec4 100644
|
||||
index a5acf512..67b68a3b 100644
|
||||
--- a/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap.java
|
||||
+++ b/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap.java
|
||||
@@ -35,6 +35,10 @@ public abstract class EntityMap
|
||||
|
2321
Waterfall-Proxy-Patches/0004-FlameCord-General-Patch.patch
Normal file
2321
Waterfall-Proxy-Patches/0004-FlameCord-General-Patch.patch
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,173 +0,0 @@
|
||||
From 548ab6001046830731ac6246fcd2160df7b07f5e Mon Sep 17 00:00:00 2001
|
||||
From: Juan Cruz Linsalata <LinsaFTW@users.noreply.github.com>
|
||||
Date: Thu, 3 Sep 2020 18:37:43 -0300
|
||||
Subject: [PATCH] FlameCord Whitelist servers addresses
|
||||
|
||||
|
||||
diff --git a/flamecord/.factorypath b/flamecord/.factorypath
|
||||
index f398f41e..ed4e646c 100644
|
||||
--- a/flamecord/.factorypath
|
||||
+++ b/flamecord/.factorypath
|
||||
@@ -1,4 +1,5 @@
|
||||
<factorypath>
|
||||
+ <factorypathentry kind="VARJAR" id="M2_REPO/com/google/code/gson/gson/2.8.0/gson-2.8.0.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/com/google/guava/guava/21.0/guava-21.0.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/com/google/code/findbugs/findbugs-annotations/3.0.1/findbugs-annotations-3.0.1.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/projectlombok/lombok/1.18.10/lombok-1.18.10.jar" enabled="true" runInBatchMode="false"/>
|
||||
diff --git a/flamecord/src/main/java/dev/_2lstudios/flamecord/FlameCord.java b/flamecord/src/main/java/dev/_2lstudios/flamecord/FlameCord.java
|
||||
index 3a7f56ee..29c1573a 100644
|
||||
--- a/flamecord/src/main/java/dev/_2lstudios/flamecord/FlameCord.java
|
||||
+++ b/flamecord/src/main/java/dev/_2lstudios/flamecord/FlameCord.java
|
||||
@@ -1,5 +1,6 @@
|
||||
package dev._2lstudios.flamecord;
|
||||
|
||||
+import java.util.Collection;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import dev._2lstudios.flamecord.configuration.FlameCordConfiguration;
|
||||
@@ -21,21 +22,25 @@ public class FlameCord {
|
||||
private final ModulesConfiguration modulesConfiguration;
|
||||
@Getter
|
||||
private final MessagesConfiguration messagesConfiguration;
|
||||
+ @Getter
|
||||
private final Thread thread;
|
||||
|
||||
- public static void renew(final Logger logger) {
|
||||
+ public static void renew(final Logger logger, final Collection<String> whitelistedAddresses) {
|
||||
if (FlameCord.instance != null) {
|
||||
FlameCord.instance.thread.interrupt();
|
||||
}
|
||||
|
||||
- FlameCord.instance = new FlameCord(logger);
|
||||
+ final FlameCord instance = new FlameCord(logger, whitelistedAddresses);
|
||||
+
|
||||
+ FlameCord.instance = instance;
|
||||
}
|
||||
|
||||
- private FlameCord(final Logger logger) {
|
||||
- final ConfigurationProvider configurationProvider = YamlConfiguration.getProvider(YamlConfiguration.class);
|
||||
+ private FlameCord(final Logger logger, final Collection<String> whitelistedAddresses) {
|
||||
+ final ConfigurationProvider configurationProvider = ConfigurationProvider.getProvider(YamlConfiguration.class);
|
||||
|
||||
this.flameCordConfiguration = new FlameCordConfiguration(configurationProvider);
|
||||
- this.firewallManager = new FirewallManager(logger, flameCordConfiguration.getFirewallSeconds());
|
||||
+ this.firewallManager = new FirewallManager(logger, whitelistedAddresses,
|
||||
+ flameCordConfiguration.getFirewallSeconds());
|
||||
this.modulesConfiguration = new ModulesConfiguration(configurationProvider);
|
||||
this.messagesConfiguration = new MessagesConfiguration(logger, configurationProvider);
|
||||
this.thread = new Thread() {
|
||||
diff --git a/flamecord/src/main/java/dev/_2lstudios/flamecord/firewall/FirewallManager.java b/flamecord/src/main/java/dev/_2lstudios/flamecord/firewall/FirewallManager.java
|
||||
index a90c8426..8a474758 100644
|
||||
--- a/flamecord/src/main/java/dev/_2lstudios/flamecord/firewall/FirewallManager.java
|
||||
+++ b/flamecord/src/main/java/dev/_2lstudios/flamecord/firewall/FirewallManager.java
|
||||
@@ -12,20 +12,35 @@ import lombok.Getter;
|
||||
|
||||
public class FirewallManager {
|
||||
private final Logger logger;
|
||||
+ private final Collection<String> whitelistedAddresses;
|
||||
private final Collection<String> firewalled;
|
||||
private final int defaultSeconds;
|
||||
@Getter
|
||||
private int seconds;
|
||||
|
||||
- public FirewallManager(final Logger logger, final int defaultSeconds) {
|
||||
+ public FirewallManager(final Logger logger, final Collection<String> whitelistedAddresses,
|
||||
+ final int defaultSeconds) {
|
||||
this.logger = logger;
|
||||
+ this.whitelistedAddresses = whitelistedAddresses;
|
||||
this.firewalled = new HashSet<>();
|
||||
this.defaultSeconds = defaultSeconds;
|
||||
this.seconds = defaultSeconds;
|
||||
}
|
||||
|
||||
+ public boolean isWhitelisted(final SocketAddress address) {
|
||||
+ final String addressString = address.toString();
|
||||
+
|
||||
+ for (final String whitelistedAddressString : whitelistedAddresses) {
|
||||
+ if (addressString.endsWith(whitelistedAddressString)) {
|
||||
+ return true;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
public void addFirewalled(final SocketAddress address) {
|
||||
- if (FlameCord.getInstance().getFlameCordConfiguration().isFirewallEnabled()) {
|
||||
+ if (FlameCord.getInstance().getFlameCordConfiguration().isFirewallEnabled() && !isWhitelisted(address)) {
|
||||
final InetSocketAddress iNetSocketAddress = (InetSocketAddress) address;
|
||||
final String hostString = iNetSocketAddress.getHostString();
|
||||
|
||||
diff --git a/proxy/src/main/java/net/md_5/bungee/BungeeCord.java b/proxy/src/main/java/net/md_5/bungee/BungeeCord.java
|
||||
index 4351b1f4..1ed2ffaf 100644
|
||||
--- a/proxy/src/main/java/net/md_5/bungee/BungeeCord.java
|
||||
+++ b/proxy/src/main/java/net/md_5/bungee/BungeeCord.java
|
||||
@@ -288,19 +288,30 @@ public class BungeeCord extends ProxyServer {
|
||||
workerEventLoopGroup = PipelineUtils.newEventLoopGroup(0,
|
||||
new ThreadFactoryBuilder().setNameFormat("Netty Worker IO Thread #%1$d").build());
|
||||
|
||||
+ // FlameCord - Load config before
|
||||
+ config.load();
|
||||
+
|
||||
// FlameCord - Use own module system and reload FlameCord
|
||||
/*
|
||||
* File moduleDirectory = new File( "modules" ); moduleManager.load( this,
|
||||
* moduleDirectory ); pluginManager.detectPlugins( moduleDirectory );
|
||||
*/
|
||||
- FlameCord.renew(logger);
|
||||
+ // FlameCord - Collect ips from servers
|
||||
+ final Collection<String> whitelistedAddresses = new HashSet<>();
|
||||
+
|
||||
+ for (final ServerInfo serverInfo : getServers().values()) {
|
||||
+ whitelistedAddresses.add(serverInfo.getSocketAddress().toString());
|
||||
+ }
|
||||
+
|
||||
+ FlameCord.renew(logger, whitelistedAddresses);
|
||||
registerModules();
|
||||
|
||||
pluginsFolder.mkdir();
|
||||
pluginManager.detectPlugins(pluginsFolder);
|
||||
|
||||
pluginManager.loadPlugins();
|
||||
- config.load();
|
||||
+ // FlameCord - Load config before
|
||||
+ // config.load();
|
||||
|
||||
if (config.isForgeSupport()) {
|
||||
registerChannel(ForgeConstants.FML_TAG);
|
||||
@@ -823,7 +834,14 @@ public class BungeeCord extends ProxyServer {
|
||||
break;
|
||||
}
|
||||
case "reload": {
|
||||
- FlameCord.renew(logger);
|
||||
+ // FlameCord - Collect ips from servers
|
||||
+ final Collection<String> whitelistedAddresses = new HashSet<>();
|
||||
+
|
||||
+ for (final ServerInfo serverInfo : getServers().values()) {
|
||||
+ whitelistedAddresses.add(serverInfo.getSocketAddress().toString());
|
||||
+ }
|
||||
+
|
||||
+ FlameCord.renew(logger, whitelistedAddresses);
|
||||
sender.sendMessage(TextComponent
|
||||
.fromLegacyText(messagesConfiguration.getTranslation("flamecord_reload")));
|
||||
break;
|
||||
diff --git a/proxy/src/main/java/net/md_5/bungee/netty/HandlerBoss.java b/proxy/src/main/java/net/md_5/bungee/netty/HandlerBoss.java
|
||||
index 23a2028b..8e92f5e8 100644
|
||||
--- a/proxy/src/main/java/net/md_5/bungee/netty/HandlerBoss.java
|
||||
+++ b/proxy/src/main/java/net/md_5/bungee/netty/HandlerBoss.java
|
||||
@@ -147,11 +147,7 @@ public class HandlerBoss extends ChannelInboundHandlerAdapter {
|
||||
final SocketAddress remoteAddress = channel.remoteAddress();
|
||||
|
||||
if (remoteAddress != null) {
|
||||
- final Throwable causeCause = cause.getCause();
|
||||
-
|
||||
- if (causeCause == null || !causeCause.getMessage().contains("TO_CLIENT")) {
|
||||
- flameCord.getFirewallManager().addFirewalled(remoteAddress);
|
||||
- }
|
||||
+ flameCord.getFirewallManager().addFirewalled(remoteAddress);
|
||||
}
|
||||
}
|
||||
|
||||
--
|
||||
2.27.0.windows.1
|
||||
|
@ -0,0 +1,76 @@
|
||||
From 8dee9ecddb83e174e6878cf4ec5a35f0d02701a7 Mon Sep 17 00:00:00 2001
|
||||
From: Juan Cruz Linsalata <LinsaFTW@users.noreply.github.com>
|
||||
Date: Sun, 18 Oct 2020 16:24:25 -0300
|
||||
Subject: [PATCH] Made proxyping cancellable
|
||||
|
||||
|
||||
diff --git a/api/src/main/java/net/md_5/bungee/api/event/ProxyPingEvent.java b/api/src/main/java/net/md_5/bungee/api/event/ProxyPingEvent.java
|
||||
index 4baa06a9..05bccaca 100644
|
||||
--- a/api/src/main/java/net/md_5/bungee/api/event/ProxyPingEvent.java
|
||||
+++ b/api/src/main/java/net/md_5/bungee/api/event/ProxyPingEvent.java
|
||||
@@ -2,10 +2,13 @@ package net.md_5.bungee.api.event;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
+import lombok.Getter;
|
||||
+import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
import net.md_5.bungee.api.Callback;
|
||||
import net.md_5.bungee.api.ServerPing;
|
||||
import net.md_5.bungee.api.connection.PendingConnection;
|
||||
+import net.md_5.bungee.api.plugin.Cancellable;
|
||||
|
||||
/**
|
||||
* Called when the proxy is pinged with packet 0xFE from the server list.
|
||||
@@ -13,9 +16,12 @@ import net.md_5.bungee.api.connection.PendingConnection;
|
||||
@Data
|
||||
@ToString(callSuper = false)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
-public class ProxyPingEvent extends AsyncEvent<ProxyPingEvent>
|
||||
+// FlameCord - Make ProxyPingEvent cancellable
|
||||
+public class ProxyPingEvent extends AsyncEvent<ProxyPingEvent> implements Cancellable
|
||||
{
|
||||
-
|
||||
+ @Getter
|
||||
+ @Setter
|
||||
+ private boolean cancelled = false;
|
||||
/**
|
||||
* The connection asking for a ping response.
|
||||
*/
|
||||
diff --git a/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java b/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java
|
||||
index 138dffa0..dfc5ed93 100644
|
||||
--- a/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java
|
||||
+++ b/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java
|
||||
@@ -278,21 +278,21 @@ public class InitialHandler extends PacketHandler implements PendingConnection
|
||||
@Override
|
||||
public void done(ProxyPingEvent pingResult, Throwable error)
|
||||
{
|
||||
- Gson gson = handshake.getProtocolVersion() == ProtocolConstants.MINECRAFT_1_7_2 ? BungeeCord.getInstance().gsonLegacy : BungeeCord.getInstance().gson; // Travertine
|
||||
- if ( bungee.getConnectionThrottle() != null )
|
||||
- {
|
||||
- bungee.getConnectionThrottle().unthrottle( getSocketAddress() );
|
||||
- }
|
||||
-
|
||||
- // FlameCord - Close if response is null
|
||||
+ // FlameCord - Return and close if response is null or cancelled
|
||||
// FlameCord - Return if connection is closed
|
||||
- if (pingResult.getResponse() == null) {
|
||||
+ if (pingResult.getResponse() == null || pingResult.isCancelled()) {
|
||||
ch.close();
|
||||
return;
|
||||
} else if (ch.isClosed()) {
|
||||
return;
|
||||
}
|
||||
|
||||
+ Gson gson = handshake.getProtocolVersion() == ProtocolConstants.MINECRAFT_1_7_2 ? BungeeCord.getInstance().gsonLegacy : BungeeCord.getInstance().gson; // Travertine
|
||||
+ if ( bungee.getConnectionThrottle() != null )
|
||||
+ {
|
||||
+ bungee.getConnectionThrottle().unthrottle( getSocketAddress() );
|
||||
+ }
|
||||
+
|
||||
// Travertine start
|
||||
if ( ProtocolConstants.isBeforeOrEq( handshake.getProtocolVersion() , ProtocolConstants.MINECRAFT_1_8 ) )
|
||||
{
|
||||
--
|
||||
2.27.0.windows.1
|
||||
|
@ -1,30 +0,0 @@
|
||||
From efe1b091836279bb375f6770fb8d98c4e5c1c4ed Mon Sep 17 00:00:00 2001
|
||||
From: Juan Cruz Linsalata <LinsaFTW@users.noreply.github.com>
|
||||
Date: Thu, 3 Sep 2020 19:36:44 -0300
|
||||
Subject: [PATCH] FlameCord Defaulted timeout from 30000 to 5000
|
||||
|
||||
|
||||
diff --git a/proxy/src/main/java/net/md_5/bungee/conf/Configuration.java b/proxy/src/main/java/net/md_5/bungee/conf/Configuration.java
|
||||
index 85d2197a..a984370e 100644
|
||||
--- a/proxy/src/main/java/net/md_5/bungee/conf/Configuration.java
|
||||
+++ b/proxy/src/main/java/net/md_5/bungee/conf/Configuration.java
|
||||
@@ -29,13 +29,12 @@ import net.md_5.bungee.util.CaseInsensitiveSet;
|
||||
* Core configuration for the proxy.
|
||||
*/
|
||||
@Getter
|
||||
-public abstract class Configuration implements ProxyConfig
|
||||
-{
|
||||
-
|
||||
+public abstract class Configuration implements ProxyConfig {
|
||||
+ // FlameCord - Default from 30000 to 5000
|
||||
/**
|
||||
* Time before users are disconnected due to no network activity.
|
||||
*/
|
||||
- private int timeout = 30000;
|
||||
+ private int timeout = 5000;
|
||||
/**
|
||||
* UUID used for metrics.
|
||||
*/
|
||||
--
|
||||
2.27.0.windows.1
|
||||
|
Loading…
Reference in New Issue
Block a user