Skip to content

Commit

Permalink
Update Mojang auth address
Browse files Browse the repository at this point in the history
  • Loading branch information
LexManos committed Feb 27, 2024
1 parent 387b558 commit b8ed51a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
12 changes: 8 additions & 4 deletions src/main/java/net/minecraftforge/installer/DownloadUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import java.nio.file.Files;
import java.nio.file.StandardCopyOption;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.function.Function;
import java.util.stream.Collectors;
Expand Down Expand Up @@ -257,12 +258,12 @@ private static URLConnection getConnection(String address) {
return connection;
} catch (SSLHandshakeException e) {
System.out.println("Failed to establish connection to " + address);
System.out.println(" Host: " + url.getHost() + " [" + getIps(url.getHost()).stream().collect(Collectors.joining(", ")) + "]");
System.out.println(" Host: " + url.getHost() + " [" + getIpString(url.getHost()) + "]");
e.printStackTrace();
return null;
} catch (IOException e) {
System.out.println("Failed to establish connection to " + address);
System.out.println(" Host: " + url.getHost() + " [" + getIps(url.getHost()).stream().collect(Collectors.joining(", ")) + "]");
System.out.println(" Host: " + url.getHost() + " [" + getIpString(url.getHost()) + "]");
e.printStackTrace();
return null;
}
Expand All @@ -273,9 +274,12 @@ public static List<String> getIps(String host) {
InetAddress[] addresses = InetAddress.getAllByName(host);
return Arrays.stream(addresses).map(InetAddress::getHostAddress).collect(Collectors.toList());
} catch (UnknownHostException e1) {
e1.printStackTrace();
return Arrays.asList("Unknown");
}
return null;
}

public static String getIpString(String host) {
return getIps(host).stream().collect(Collectors.joining(", "));
}

public static boolean checkCertificate(String host) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import java.util.Locale;
import java.util.Map;
import java.util.regex.Pattern;
import java.util.stream.Collectors;

import javax.swing.JOptionPane;
import javax.swing.UIManager;
Expand Down Expand Up @@ -96,9 +95,10 @@ public static void main(String[] args) throws IOException, URISyntaxException {
"libraries.minecraft.net",
"launchermeta.mojang.com",
"piston-meta.mojang.com",
"sessionserver.mojang.com",
"authserver.mojang.com",
}) {
monitor.message("Host: " + host + " [" + DownloadUtils.getIps(host).stream().collect(Collectors.joining(", ")) + "]");
monitor.message("Host: " + host + " [" + DownloadUtils.getIpString(host) + "]");
}

for (String host : new String[] {
Expand Down

0 comments on commit b8ed51a

Please sign in to comment.