maybe fix new server count?

This commit is contained in:
Lee 2024-04-29 07:16:51 +01:00
parent 9babf45272
commit 6eb13e18eb
4 changed files with 90 additions and 76 deletions

130
README.md

@ -1,103 +1,103 @@
# PIA Server List
![Servers](https://img.shields.io/badge/servers-5,018-blue) ![Regions](https://img.shields.io/badge/regions-97-blue) ![Last update](https://img.shields.io/badge/last_updated-Mon_Apr_29_06:00:52_UTC_2024-blue)
![Servers](https://img.shields.io/badge/servers-5,140-blue) ![Regions](https://img.shields.io/badge/regions-97-blue) ![Last update](https://img.shields.io/badge/last_updated-Mon_Apr_29_07:15:35_BST_2024-blue)
This is a list of the OpenVPN servers provided by Private Internet Access (PIA). The list is updated hourly.
## Servers
| Region | Servers |
|----------------------|---------|
| netherlands | 103 |
| au_melbourne | 94 |
| ca_montreal | 94 |
| ca_vancouver | 92 |
| ca_toronto | 91 |
| uk_london | 91 |
| us_chicago | 91 |
| us_washington_dc | 91 |
| us_silicon_valley | 91 |
| us_east | 90 |
| us_new_york | 90 |
| us_california | 88 |
| us_texas | 88 |
| us_seattle | 87 |
| switzerland | 86 |
| us_atlanta | 86 |
| us_las_vegas | 85 |
| us_west | 83 |
| us_florida | 82 |
| de_frankfurt | 82 |
| us_houston | 82 |
| japan | 80 |
| uk_southampton | 80 |
| ca_ontario | 80 |
| au_sydney | 78 |
| de_berlin | 77 |
| mexico | 76 |
| uk_manchester | 75 |
| singapore | 75 |
| sweden | 73 |
| us_denver | 73 |
| new_zealand | 73 |
| france | 69 |
| au_perth | 68 |
| czech_republic | 62 |
| ireland | 61 |
| norway | 59 |
| estonia | 58 |
| israel | 58 |
| spain | 55 |
| bahamas | 55 |
| argentina | 53 |
| brazil | 51 |
| denmark | 51 |
| netherlands | 106 |
| ca_montreal | 96 |
| ca_vancouver | 95 |
| au_melbourne | 95 |
| ca_toronto | 94 |
| us_chicago | 94 |
| us_silicon_valley | 94 |
| us_east | 93 |
| us_new_york | 93 |
| us_washington_dc | 93 |
| uk_london | 92 |
| us_california | 91 |
| us_texas | 91 |
| us_seattle | 90 |
| us_atlanta | 88 |
| us_las_vegas | 87 |
| switzerland | 87 |
| us_west | 86 |
| us_florida | 85 |
| de_frankfurt | 85 |
| us_houston | 85 |
| uk_southampton | 83 |
| ca_ontario | 83 |
| japan | 82 |
| de_berlin | 80 |
| au_sydney | 80 |
| mexico | 79 |
| uk_manchester | 77 |
| sweden | 76 |
| singapore | 76 |
| us_denver | 76 |
| new_zealand | 75 |
| au_perth | 70 |
| france | 70 |
| czech_republic | 63 |
| ireland | 62 |
| norway | 61 |
| estonia | 60 |
| israel | 59 |
| bahamas | 58 |
| spain | 56 |
| argentina | 55 |
| brazil | 52 |
| denmark | 52 |
| austria | 50 |
| panama | 49 |
| italy | 48 |
| finland | 46 |
| ukraine | 45 |
| italy | 49 |
| finland | 48 |
| ukraine | 47 |
| turkey | 45 |
| luxembourg | 45 |
| lithuania | 44 |
| turkey | 43 |
| luxembourg | 43 |
| romania | 43 |
| latvia | 43 |
| poland | 40 |
| romania | 44 |
| latvia | 44 |
| poland | 41 |
| vietnam | 40 |
| slovakia | 40 |
| belgium | 40 |
| greenland | 39 |
| slovakia | 39 |
| greece | 36 |
| greece | 37 |
| andorra | 35 |
| venezuela | 35 |
| albania | 33 |
| united_arab_emirates | 33 |
| algeria | 33 |
| taiwan | 33 |
| china | 33 |
| albania | 32 |
| united_arab_emirates | 32 |
| philippines | 31 |
| malta | 30 |
| malta | 31 |
| hungary | 29 |
| qatar | 29 |
| india | 28 |
| qatar | 28 |
| bulgaria | 27 |
| liechtenstein | 27 |
| south_africa | 27 |
| bangladesh | 27 |
| saudi_arabia | 26 |
| isle_of_man | 26 |
| south_africa | 26 |
| saudi_arabia | 25 |
| portugal | 25 |
| cyprus | 24 |
| nigeria | 24 |
| macao | 24 |
| iceland | 24 |
| montenegro | 24 |
| moldova | 23 |
| macao | 23 |
| morocco | 23 |
| kazakhstan | 23 |
| iceland | 23 |
| macedonia | 23 |
| cambodia | 22 |
| macedonia | 22 |
| egypt | 22 |
| monaco | 21 |
| egypt | 21 |
| georgia | 20 |
| hong_kong | 19 |
| serbia | 14 |

@ -0,0 +1,13 @@
package cc.fascinated.piaservers.common;
public class Config {
/**
* Are we in production?
*
* @return If we are in production
*/
public static boolean isProduction() {
return System.getenv().containsKey("ENVIRONMENT") && System.getenv("ENVIRONMENT").equals("production");
}
}

@ -12,22 +12,22 @@ public class GitUtils {
*/
public static void commitFiles(String message, Path... files) {
System.out.println("Committing files");
if (System.getenv("ENVIRONMENT").equals("production")) {
if (Config.isProduction()) {
runCommand("git", "config", "--global", "user.email", "liam+pia-servers-ci@fascinated.cc");
runCommand("git", "config", "--global", "user.name", "PIA Servers CI");
for (Path file : files) {
runCommand("git", "add", file.toAbsolutePath().toString());
}
runCommand("git", "commit", "-m", message);
runCommand("git", "push", "https://pia-servers-ci:%s@git.fascinated.cc/Fascinated/PIA-Servers".formatted(System.getenv("AUTH_TOKEN")));
}
for (Path file : files) {
runCommand("git", "add", file.toAbsolutePath().toString());
}
runCommand("git", "commit", "-m", message);
runCommand("git", "push", "https://pia-servers-ci:%s@git.fascinated.cc/Fascinated/PIA-Servers".formatted(System.getenv("AUTH_TOKEN")));
}
/**
* Clone the repository
*/
public static void cloneRepo() {
if (System.getenv("ENVIRONMENT").equals("production")) {
if (Config.isProduction()) {
System.out.println("Cloning repository");
runCommand("git", "clone", "https://git.fascinated.cc/Fascinated/PIA-Servers.git");
runCommand("mv", "PIA-Servers/.git", ".");

@ -40,6 +40,7 @@ public class PiaManager {
if (SERVERS == null) {
SERVERS = new HashSet<>();
}
System.out.println("Loaded " + SERVERS.size() + " servers from the file");
GitUtils.cloneRepo(); // Clone the repository
@ -82,13 +83,13 @@ public class PiaManager {
// Add the new servers to the list
for (PiaServerToken serverToken : piaDomain) {
// Add the server to the list
PiaServer server = new PiaServer(serverToken.getIp(), serverToken.getRegion(), new Date());
SERVERS.add(server);
boolean newServer = SERVERS.stream().noneMatch(s -> s.getIp().equals(server.getIp()));
boolean newServer = SERVERS.stream().noneMatch(server -> server.getIp().equals(serverToken.getIp()));
if (newServer) {
newServers++;
}
// Add the server to the list
SERVERS.add(new PiaServer(serverToken.getIp(), serverToken.getRegion(), new Date()));
}
// Save the servers to the file