新增有效期getValidAt #1727 (#1732)

* 界面标题描述纠正

* 新增有效期getValidAt #1727

* fix err

* fix-err-again

* fix-err

* fix

* fix-4

* rename

* fix

* fix

* code clean
This commit is contained in:
Cato : Love the world and myself 2022-09-24 16:56:19 +08:00 committed by GitHub
parent 2028b0ef9c
commit 3ed6e38ad3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -215,6 +215,7 @@ public final class MultiplayerManager {
public static class HiperSession extends ManagedProcess {
private final EventManager<HiperExitEvent> onExit = new EventManager<>();
private final EventManager<HiperIPEvent> onIPAllocated = new EventManager<>();
private final EventManager<HiperShowValidAtEvent> onValidAt = new EventManager<>();
private final BufferedWriter writer;
private int error = 0;
@ -251,6 +252,10 @@ public final class MultiplayerManager {
if (msg.contains("Failed to load certificate from config")) {
error = HiperExitEvent.FAILED_LOAD_CONFIG;
}
if (msg.contains("Validity of client certificate")) {
Optional<String> validAt = tryCast(logJson.get("valid"), String.class);
validAt.ifPresent(s -> onValidAt.fireEvent(new HiperShowValidAtEvent(this, s)));
}
}
if (logJson.containsKey("network")) {
@ -295,6 +300,10 @@ public final class MultiplayerManager {
return onIPAllocated;
}
public EventManager<HiperShowValidAtEvent> onValidAt() {
return onValidAt;
}
}
public static class HiperExitEvent extends Event {
@ -329,6 +338,19 @@ public final class MultiplayerManager {
}
}
public static class HiperShowValidAtEvent extends Event {
private final String validAt;
public HiperShowValidAtEvent(Object source, String validAt) {
super(source);
this.validAt = validAt;
}
public String getValidAt() {
return validAt;
}
}
public static class HiperExitException extends RuntimeException {
private final int exitCode;
private final boolean ready;