3
0
Mirror von https://github.com/PaperMC/Velocity.git synchronisiert 2024-11-16 21:10:30 +01:00

Add option to disable ip logging (#614) (#650)

Dieser Commit ist enthalten in:
ebony-lamp 2022-03-08 23:24:45 -08:00 committet von GitHub
Ursprung b5dcaa2315
Commit 94e8b0df43
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23
3 geänderte Dateien mit 18 neuen und 3 gelöschten Zeilen

Datei anzeigen

@ -73,6 +73,7 @@ public class VelocityConfiguration implements ProxyConfig {
@Expose private final Advanced advanced;
@Expose private final Query query;
private final Metrics metrics;
@Expose private boolean enablePlayerAddressLogging = true;
private net.kyori.adventure.text.@MonotonicNonNull Component motdAsComponent;
private @Nullable Favicon favicon;
@ -88,8 +89,9 @@ public class VelocityConfiguration implements ProxyConfig {
private VelocityConfiguration(String bind, String motd, int showMaxPlayers, boolean onlineMode,
boolean preventClientProxyConnections, boolean announceForge,
PlayerInfoForwarding playerInfoForwardingMode, byte[] forwardingSecret,
boolean onlineModeKickExistingPlayers, PingPassthroughMode pingPassthrough, Servers servers,
ForcedHosts forcedHosts, Advanced advanced, Query query, Metrics metrics) {
boolean onlineModeKickExistingPlayers, PingPassthroughMode pingPassthrough,
boolean enablePlayerAddressLogging, Servers servers,ForcedHosts forcedHosts,
Advanced advanced, Query query, Metrics metrics) {
this.bind = bind;
this.motd = motd;
this.showMaxPlayers = showMaxPlayers;
@ -100,6 +102,7 @@ public class VelocityConfiguration implements ProxyConfig {
this.forwardingSecret = forwardingSecret;
this.onlineModeKickExistingPlayers = onlineModeKickExistingPlayers;
this.pingPassthrough = pingPassthrough;
this.enablePlayerAddressLogging = enablePlayerAddressLogging;
this.servers = servers;
this.forcedHosts = forcedHosts;
this.advanced = advanced;
@ -351,6 +354,10 @@ public class VelocityConfiguration implements ProxyConfig {
return pingPassthrough;
}
public boolean isPlayerAddressLoggingEnabled() {
return enablePlayerAddressLogging;
}
public boolean isBungeePluginChannelEnabled() {
return advanced.isBungeePluginMessageChannel();
}
@ -386,6 +393,7 @@ public class VelocityConfiguration implements ProxyConfig {
.add("advanced", advanced)
.add("query", query)
.add("favicon", favicon)
.add("enablePlayerAddressLogging", enablePlayerAddressLogging)
.toString();
}
@ -459,6 +467,7 @@ public class VelocityConfiguration implements ProxyConfig {
Boolean preventClientProxyConnections = config.getOrElse("prevent-client-proxy-connections",
true);
Boolean kickExisting = config.getOrElse("kick-existing-players", false);
Boolean enablePlayerAddressLogging = config.getOrElse("enable-player-address-logging", true);
return new VelocityConfiguration(
bind,
@ -471,6 +480,7 @@ public class VelocityConfiguration implements ProxyConfig {
forwardingSecret,
kickExisting,
pingPassthroughMode,
enablePlayerAddressLogging,
new Servers(serversConfig),
new ForcedHosts(forcedHostsConfig),
new Advanced(advancedConfig),

Datei anzeigen

@ -830,7 +830,9 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player {
@Override
public String toString() {
return "[connected player] " + profile.getName() + " (" + getRemoteAddress() + ")";
boolean isPlayerAddressLoggingEnabled = server.getConfiguration().isPlayerAddressLoggingEnabled();
String playerIp = isPlayerAddressLoggingEnabled ? getRemoteAddress().toString() : "<ip address withheld>";
return "[connected player] " + profile.getName() + " (" + playerIp + ")";
}
@Override

Datei anzeigen

@ -62,6 +62,9 @@ kick-existing-players = false
# configuration is used if no servers could be contacted.
ping-passthrough = "DISABLED"
# If not enabled (default is true) player IP addresses will be replaced by <ip address withheld> in logs
enable-player-address-logging = true
[servers]
# Configure your servers here. Each key represents the server's name, and the value
# represents the IP address of the server to connect to.