2018-07-15 12:58:44 +02:00
|
|
|
From d1f44b716a78cdd29ddc056b4f717872e86c0909 Mon Sep 17 00:00:00 2001
|
2016-05-28 18:34:39 +02:00
|
|
|
From: Janmm14 <computerjanimaus@yahoo.de>
|
|
|
|
Date: Sat, 12 Dec 2015 23:43:30 +0100
|
|
|
|
Subject: [PATCH] Optional server list ping logging.
|
|
|
|
|
|
|
|
Add IPs to the log where user names are shown.
|
|
|
|
|
|
|
|
This avoids spamming the logs with connection notices.
|
|
|
|
Server list pings are only logged if the log_server_list_pings config.yml option is true, defaults to false
|
|
|
|
|
|
|
|
diff --git a/api/src/main/java/net/md_5/bungee/api/ProxyConfig.java b/api/src/main/java/net/md_5/bungee/api/ProxyConfig.java
|
2017-01-17 16:05:13 +01:00
|
|
|
index 66d0b8a1..5a49050a 100644
|
2016-05-28 18:34:39 +02:00
|
|
|
--- a/api/src/main/java/net/md_5/bungee/api/ProxyConfig.java
|
|
|
|
+++ b/api/src/main/java/net/md_5/bungee/api/ProxyConfig.java
|
|
|
|
@@ -89,6 +89,11 @@ public interface ProxyConfig
|
|
|
|
*/
|
|
|
|
boolean isMetrics();
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Whether we log server list pings
|
|
|
|
+ */
|
|
|
|
+ boolean isLogServerListPing();
|
|
|
|
+
|
|
|
|
// Throttling options
|
|
|
|
|
|
|
|
/**
|
2016-11-26 21:39:19 +01:00
|
|
|
diff --git a/proxy/src/main/java/io/github/waterfallmc/waterfall/conf/WaterfallConfiguration.java b/proxy/src/main/java/io/github/waterfallmc/waterfall/conf/WaterfallConfiguration.java
|
2017-01-17 16:05:13 +01:00
|
|
|
index e56d3591..68f25460 100644
|
2016-11-26 21:39:19 +01:00
|
|
|
--- a/proxy/src/main/java/io/github/waterfallmc/waterfall/conf/WaterfallConfiguration.java
|
|
|
|
+++ b/proxy/src/main/java/io/github/waterfallmc/waterfall/conf/WaterfallConfiguration.java
|
2016-10-25 18:57:11 +02:00
|
|
|
@@ -16,6 +16,13 @@ public class WaterfallConfiguration extends Configuration {
|
2016-05-28 18:34:39 +02:00
|
|
|
*/
|
|
|
|
private boolean metrics = true;
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Whether we log server list pings
|
|
|
|
+ * <p>
|
|
|
|
+ * Default is false (don't log)
|
|
|
|
+ */
|
|
|
|
+ private boolean logServerListPing = false;
|
|
|
|
+
|
|
|
|
/*
|
|
|
|
* Throttling options
|
|
|
|
* Helps prevent players from overloading the servers behind us
|
2016-10-25 18:57:11 +02:00
|
|
|
@@ -35,6 +42,7 @@ public class WaterfallConfiguration extends Configuration {
|
2016-05-28 18:34:39 +02:00
|
|
|
YamlConfig config = new YamlConfig(new File("waterfall.yml"));
|
|
|
|
config.load(false); // Load, but no permissions
|
|
|
|
metrics = config.getBoolean("metrics", metrics);
|
|
|
|
+ logServerListPing = config.getBoolean( "log_server_list_ping", logServerListPing );
|
|
|
|
// Throttling options
|
|
|
|
tabThrottle = config.getInt("throttling.tab_complete", tabThrottle);
|
|
|
|
}
|
2016-10-25 18:57:11 +02:00
|
|
|
@@ -48,4 +56,9 @@ public class WaterfallConfiguration extends Configuration {
|
2016-05-28 18:34:39 +02:00
|
|
|
public int getTabThrottle() {
|
|
|
|
return tabThrottle;
|
|
|
|
}
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public boolean isLogServerListPing() {
|
|
|
|
+ return logServerListPing;
|
|
|
|
+ }
|
|
|
|
}
|
2016-11-26 21:39:19 +01:00
|
|
|
diff --git a/proxy/src/main/java/net/md_5/bungee/ServerConnector.java b/proxy/src/main/java/net/md_5/bungee/ServerConnector.java
|
2018-07-15 12:58:44 +02:00
|
|
|
index 44821171..47904de1 100644
|
2016-11-26 21:39:19 +01:00
|
|
|
--- a/proxy/src/main/java/net/md_5/bungee/ServerConnector.java
|
|
|
|
+++ b/proxy/src/main/java/net/md_5/bungee/ServerConnector.java
|
2018-07-15 12:58:44 +02:00
|
|
|
@@ -405,6 +405,6 @@ public class ServerConnector extends PacketHandler
|
2016-11-26 21:39:19 +01:00
|
|
|
@Override
|
|
|
|
public String toString()
|
|
|
|
{
|
|
|
|
- return "[" + user.getName() + "] <-> ServerConnector [" + target.getName() + "]";
|
|
|
|
+ return "[" + user.getName() + "|" + user.getAddress() + "] <-> ServerConnector [" + target.getName() + "]";
|
|
|
|
}
|
|
|
|
}
|
2016-05-28 18:34:39 +02:00
|
|
|
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
|
2018-07-15 12:58:44 +02:00
|
|
|
index 23417849..b5a4a929 100644
|
2016-05-28 18:34:39 +02:00
|
|
|
--- a/proxy/src/main/java/net/md_5/bungee/connection/DownstreamBridge.java
|
|
|
|
+++ b/proxy/src/main/java/net/md_5/bungee/connection/DownstreamBridge.java
|
2018-07-15 12:58:44 +02:00
|
|
|
@@ -518,6 +518,6 @@ public class DownstreamBridge extends PacketHandler
|
2016-05-28 18:34:39 +02:00
|
|
|
@Override
|
|
|
|
public String toString()
|
|
|
|
{
|
|
|
|
- return "[" + con.getName() + "] <-> DownstreamBridge <-> [" + server.getInfo().getName() + "]";
|
|
|
|
+ return "[" + con.getAddress() + "|" + con.getName() + "] <-> DownstreamBridge <-> [" + server.getInfo().getName() + "]";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
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
|
2018-07-15 12:58:44 +02:00
|
|
|
index d1e9d556..59053de2 100644
|
2016-05-28 18:34:39 +02:00
|
|
|
--- a/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java
|
|
|
|
+++ b/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java
|
2018-07-15 12:58:44 +02:00
|
|
|
@@ -293,19 +293,22 @@ public class InitialHandler extends PacketHandler implements PendingConnection
|
2016-05-28 18:34:39 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
this.virtualHost = InetSocketAddress.createUnresolved( handshake.getHost(), handshake.getPort() );
|
|
|
|
- bungee.getLogger().log( Level.INFO, "{0} has connected", this );
|
|
|
|
|
|
|
|
bungee.getPluginManager().callEvent( new PlayerHandshakeEvent( InitialHandler.this, handshake ) );
|
|
|
|
|
|
|
|
switch ( handshake.getRequestedProtocol() )
|
|
|
|
{
|
|
|
|
case 1:
|
|
|
|
+ if (BungeeCord.getInstance().getConfig().isLogServerListPing()) {
|
|
|
|
+ bungee.getLogger().log( Level.INFO, "{0} is pinging", this );
|
|
|
|
+ }
|
|
|
|
// Ping
|
|
|
|
thisState = State.STATUS;
|
|
|
|
ch.setProtocol( Protocol.STATUS );
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
// Login
|
|
|
|
+ bungee.getLogger().log( Level.INFO, "{0} has connected", this );
|
|
|
|
thisState = State.USERNAME;
|
|
|
|
ch.setProtocol( Protocol.LOGIN );
|
|
|
|
|
2018-07-15 12:58:44 +02:00
|
|
|
@@ -624,7 +627,7 @@ public class InitialHandler extends PacketHandler implements PendingConnection
|
2016-05-28 18:34:39 +02:00
|
|
|
@Override
|
|
|
|
public String toString()
|
|
|
|
{
|
|
|
|
- return "[" + ( ( getName() != null ) ? getName() : getAddress() ) + "] <-> InitialHandler";
|
|
|
|
+ return "[" + getAddress() + ( getName() != null ? "|" + getName() : "" ) + "] <-> InitialHandler";
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
diff --git a/proxy/src/main/java/net/md_5/bungee/connection/UpstreamBridge.java b/proxy/src/main/java/net/md_5/bungee/connection/UpstreamBridge.java
|
2018-07-15 12:58:44 +02:00
|
|
|
index af1c7deb..81f09a80 100644
|
2016-05-28 18:34:39 +02:00
|
|
|
--- a/proxy/src/main/java/net/md_5/bungee/connection/UpstreamBridge.java
|
|
|
|
+++ b/proxy/src/main/java/net/md_5/bungee/connection/UpstreamBridge.java
|
2018-07-15 12:58:44 +02:00
|
|
|
@@ -246,6 +246,6 @@ public class UpstreamBridge extends PacketHandler
|
2016-05-28 18:34:39 +02:00
|
|
|
@Override
|
|
|
|
public String toString()
|
|
|
|
{
|
|
|
|
- return "[" + con.getName() + "] -> UpstreamBridge";
|
|
|
|
+ return "[" + con.getAddress() + "|" + con.getName() + "] -> UpstreamBridge";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
--
|
2018-07-15 12:58:44 +02:00
|
|
|
2.15.1.windows.2
|
2016-05-28 18:34:39 +02:00
|
|
|
|