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 # 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. This is a list of the OpenVPN servers provided by Private Internet Access (PIA). The list is updated hourly.
## Servers ## Servers
| Region | Servers | | Region | Servers |
|----------------------|---------| |----------------------|---------|
| netherlands | 103 | | netherlands | 106 |
| au_melbourne | 94 | | ca_montreal | 96 |
| ca_montreal | 94 | | ca_vancouver | 95 |
| ca_vancouver | 92 | | au_melbourne | 95 |
| ca_toronto | 91 | | ca_toronto | 94 |
| uk_london | 91 | | us_chicago | 94 |
| us_chicago | 91 | | us_silicon_valley | 94 |
| us_washington_dc | 91 | | us_east | 93 |
| us_silicon_valley | 91 | | us_new_york | 93 |
| us_east | 90 | | us_washington_dc | 93 |
| us_new_york | 90 | | uk_london | 92 |
| us_california | 88 | | us_california | 91 |
| us_texas | 88 | | us_texas | 91 |
| us_seattle | 87 | | us_seattle | 90 |
| switzerland | 86 | | us_atlanta | 88 |
| us_atlanta | 86 | | us_las_vegas | 87 |
| us_las_vegas | 85 | | switzerland | 87 |
| us_west | 83 | | us_west | 86 |
| us_florida | 82 | | us_florida | 85 |
| de_frankfurt | 82 | | de_frankfurt | 85 |
| us_houston | 82 | | us_houston | 85 |
| japan | 80 | | uk_southampton | 83 |
| uk_southampton | 80 | | ca_ontario | 83 |
| ca_ontario | 80 | | japan | 82 |
| au_sydney | 78 | | de_berlin | 80 |
| de_berlin | 77 | | au_sydney | 80 |
| mexico | 76 | | mexico | 79 |
| uk_manchester | 75 | | uk_manchester | 77 |
| singapore | 75 | | sweden | 76 |
| sweden | 73 | | singapore | 76 |
| us_denver | 73 | | us_denver | 76 |
| new_zealand | 73 | | new_zealand | 75 |
| france | 69 | | au_perth | 70 |
| au_perth | 68 | | france | 70 |
| czech_republic | 62 | | czech_republic | 63 |
| ireland | 61 | | ireland | 62 |
| norway | 59 | | norway | 61 |
| estonia | 58 | | estonia | 60 |
| israel | 58 | | israel | 59 |
| spain | 55 | | bahamas | 58 |
| bahamas | 55 | | spain | 56 |
| argentina | 53 | | argentina | 55 |
| brazil | 51 | | brazil | 52 |
| denmark | 51 | | denmark | 52 |
| austria | 50 | | austria | 50 |
| panama | 49 | | panama | 49 |
| italy | 48 | | italy | 49 |
| finland | 46 | | finland | 48 |
| ukraine | 45 | | ukraine | 47 |
| turkey | 45 |
| luxembourg | 45 |
| lithuania | 44 | | lithuania | 44 |
| turkey | 43 | | romania | 44 |
| luxembourg | 43 | | latvia | 44 |
| romania | 43 | | poland | 41 |
| latvia | 43 |
| poland | 40 |
| vietnam | 40 | | vietnam | 40 |
| slovakia | 40 |
| belgium | 40 | | belgium | 40 |
| greenland | 39 | | greenland | 39 |
| slovakia | 39 | | greece | 37 |
| greece | 36 |
| andorra | 35 | | andorra | 35 |
| venezuela | 35 | | venezuela | 35 |
| albania | 33 |
| united_arab_emirates | 33 |
| algeria | 33 | | algeria | 33 |
| taiwan | 33 | | taiwan | 33 |
| china | 33 | | china | 33 |
| albania | 32 |
| united_arab_emirates | 32 |
| philippines | 31 | | philippines | 31 |
| malta | 30 | | malta | 31 |
| hungary | 29 | | hungary | 29 |
| qatar | 29 |
| india | 28 | | india | 28 |
| qatar | 28 |
| bulgaria | 27 | | bulgaria | 27 |
| liechtenstein | 27 | | liechtenstein | 27 |
| south_africa | 27 |
| bangladesh | 27 | | bangladesh | 27 |
| saudi_arabia | 26 |
| isle_of_man | 26 | | isle_of_man | 26 |
| south_africa | 26 |
| saudi_arabia | 25 |
| portugal | 25 | | portugal | 25 |
| cyprus | 24 | | cyprus | 24 |
| nigeria | 24 | | nigeria | 24 |
| macao | 24 |
| iceland | 24 |
| montenegro | 24 | | montenegro | 24 |
| moldova | 23 | | moldova | 23 |
| macao | 23 |
| morocco | 23 | | morocco | 23 |
| kazakhstan | 23 | | kazakhstan | 23 |
| iceland | 23 | | macedonia | 23 |
| cambodia | 22 | | cambodia | 22 |
| macedonia | 22 | | egypt | 22 |
| monaco | 21 | | monaco | 21 |
| egypt | 21 |
| georgia | 20 | | georgia | 20 |
| hong_kong | 19 | | hong_kong | 19 |
| serbia | 14 | | 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) { public static void commitFiles(String message, Path... files) {
System.out.println("Committing 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.email", "liam+pia-servers-ci@fascinated.cc");
runCommand("git", "config", "--global", "user.name", "PIA Servers CI"); runCommand("git", "config", "--global", "user.name", "PIA Servers CI");
}
for (Path file : files) { for (Path file : files) {
runCommand("git", "add", file.toAbsolutePath().toString()); runCommand("git", "add", file.toAbsolutePath().toString());
} }
runCommand("git", "commit", "-m", message); runCommand("git", "commit", "-m", message);
runCommand("git", "push", "https://pia-servers-ci:%s@git.fascinated.cc/Fascinated/PIA-Servers".formatted(System.getenv("AUTH_TOKEN"))); runCommand("git", "push", "https://pia-servers-ci:%s@git.fascinated.cc/Fascinated/PIA-Servers".formatted(System.getenv("AUTH_TOKEN")));
} }
}
/** /**
* Clone the repository * Clone the repository
*/ */
public static void cloneRepo() { public static void cloneRepo() {
if (System.getenv("ENVIRONMENT").equals("production")) { if (Config.isProduction()) {
System.out.println("Cloning repository"); System.out.println("Cloning repository");
runCommand("git", "clone", "https://git.fascinated.cc/Fascinated/PIA-Servers.git"); runCommand("git", "clone", "https://git.fascinated.cc/Fascinated/PIA-Servers.git");
runCommand("mv", "PIA-Servers/.git", "."); runCommand("mv", "PIA-Servers/.git", ".");

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