From 6a88a46b519c064d3b46f83b51e09dc92cde8e66 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Fri, 16 Apr 2021 11:28:15 -0400 Subject: [PATCH] Fall back to the loopback address when resolving autoconfigured remote (#2090) This way, if it errors, you're not stuck with 'unknown host: auto' when actually connecting. --- .../src/main/java/org/geysermc/connector/GeyserConnector.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/connector/src/main/java/org/geysermc/connector/GeyserConnector.java b/connector/src/main/java/org/geysermc/connector/GeyserConnector.java index ae6dbbe1d..03bf7538c 100644 --- a/connector/src/main/java/org/geysermc/connector/GeyserConnector.java +++ b/connector/src/main/java/org/geysermc/connector/GeyserConnector.java @@ -160,12 +160,13 @@ public class GeyserConnector { if (config.isDebugMode()) { ex.printStackTrace(); } + config.getRemote().setAddress(InetAddress.getLoopbackAddress().getHostAddress()); } } String remoteAddress = config.getRemote().getAddress(); - int remotePort = config.getRemote().getPort(); // Filters whether it is not an IP address or localhost, because otherwise it is not possible to find out an SRV entry. if (!remoteAddress.matches(IP_REGEX) && !remoteAddress.equalsIgnoreCase("localhost")) { + int remotePort; try { // Searches for a server address and a port from a SRV record of the specified host name InitialDirContext ctx = new InitialDirContext();