Add VPS health endpoint

This commit is contained in:
litoral05
2026-05-07 15:38:47 +01:00
parent 8b849e6560
commit 66adf1b42b
2 changed files with 35 additions and 1 deletions
@@ -21,7 +21,7 @@ public class WireGuardVpsService {
public Set<String> findUsedVpnIps() {
SshCommandResult result = sshService.executeOnConfiguredVps(
"sudo wg show wg0 allowed-ips"
"sudo /usr/local/sbin/lr-wg-used-ips"
);
if (result.exitCode() != 0) {
@@ -65,4 +65,18 @@ public class WireGuardVpsService {
true
);
}
public String getVpsHealthJson() {
SshCommandResult result = sshService.executeOnConfiguredVps(
"sudo /usr/local/sbin/lr-vps-health"
);
if (result.exitCode() != 0) {
throw new SshCommandException(
"Failed to query VPS health: " + result.stderr()
);
}
return result.stdout();
}
}