testing the test
Some checks failed
Fetch new Pia Servers / docker (ubuntu-latest, 2.44.0, 17, 3.8.5) (push) Failing after 14s

This commit is contained in:
Lee 2024-04-27 05:06:36 +01:00
parent 7538bd79fb
commit fc7654ccd5

@ -4,7 +4,6 @@ import cc.fascinated.piaservers.pia.PiaServer;
import cc.fascinated.piaservers.pia.PiaServerToken;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonObject;
import com.google.gson.reflect.TypeToken;
import org.codehaus.plexus.archiver.zip.ZipUnArchiver;
import lombok.SneakyThrows;
@ -38,11 +37,13 @@ public class Main {
serversFile.createNewFile();
}
List<PiaServerToken> serverDomains = getServerDomains();
System.out.println("Found " + serverDomains.size() + " server domains");
List<PiaServerToken> piaDomain = getPiaDomains();
System.out.println("Found " + piaDomain.size() + " pia domains");
// Load the serversFile from the file
List<PiaServer> servers = GSON.fromJson(Files.readString(serversFile.toPath()), new TypeToken<PiaServer>() {}.getType());
String serversJson = Files.readString(serversFile.toPath());
System.out.println(serversJson);
List<PiaServer> servers = GSON.fromJson(serversJson, new TypeToken<PiaServer>() {}.getType());
if (servers == null) {
servers = new ArrayList<>();
}
@ -59,7 +60,7 @@ public class Main {
System.out.printf("Removed %s old servers\n", toRemove.size());
// Add the new servers to the list
for (PiaServerToken serverToken : serverDomains) {
for (PiaServerToken serverToken : piaDomain) {
InetAddress address = InetAddress.getByName(serverToken.getHostname());
// Add the server to the list
@ -72,7 +73,7 @@ public class Main {
}
@SneakyThrows
private static List<PiaServerToken> getServerDomains() {
private static List<PiaServerToken> getPiaDomains() {
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create(PIA_OPENVPN_CONFIGS_URL))
.GET()