mirror of
https://github.com/Sagit-chu/flvx.git
synced 2026-09-30 00:06:38 +08:00
优化ui 添加诊断功能
This commit is contained in:
@@ -7,4 +7,6 @@ public class GostDto {
|
||||
private Integer code;
|
||||
|
||||
private String msg;
|
||||
|
||||
private Object data; // 添加数据字段,用于存储响应的详细数据
|
||||
}
|
||||
|
||||
@@ -5,6 +5,9 @@ import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.Max;
|
||||
import javax.validation.constraints.DecimalMin;
|
||||
import javax.validation.constraints.DecimalMax;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
public class TunnelDto {
|
||||
@@ -44,6 +47,11 @@ public class TunnelDto {
|
||||
@NotNull(message = "流量计算类型不能为空")
|
||||
private Integer flow;
|
||||
|
||||
// 流量倍率,默认为1.0
|
||||
@DecimalMin(value = "0.0", message = "流量倍率不能小于0.0")
|
||||
@DecimalMax(value = "100.0", message = "流量倍率不能大于100.0")
|
||||
private BigDecimal trafficRatio = new BigDecimal("1.0");
|
||||
|
||||
// 协议类型(隧道转发时使用:tls、tcp、mtls),默认为tls
|
||||
private String protocol;
|
||||
|
||||
|
||||
@@ -5,6 +5,9 @@ import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.Max;
|
||||
import javax.validation.constraints.DecimalMin;
|
||||
import javax.validation.constraints.DecimalMax;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
public class TunnelUpdateDto {
|
||||
@@ -18,6 +21,11 @@ public class TunnelUpdateDto {
|
||||
@NotNull(message = "流量计算类型不能为空")
|
||||
private Integer flow;
|
||||
|
||||
// 流量倍率
|
||||
@DecimalMin(value = "0.0", message = "流量倍率不能小于0.0")
|
||||
@DecimalMax(value = "100.0", message = "流量倍率不能大于100.0")
|
||||
private BigDecimal trafficRatio;
|
||||
|
||||
@NotNull(message = "入口端口开始不能为空")
|
||||
@Min(value = 1, message = "入口端口开始必须大于0")
|
||||
@Max(value = 65535, message = "入口端口开始不能超过65535")
|
||||
|
||||
@@ -70,12 +70,27 @@ public class WebSocketServer extends TextWebSocketHandler {
|
||||
JSONObject responseJson = JSONObject.parseObject(message.getPayload());
|
||||
String requestId = responseJson.getString("requestId");
|
||||
String responseMessage = responseJson.getString("message");
|
||||
String responseType = responseJson.getString("type");
|
||||
JSONObject responseData = responseJson.getJSONObject("data");
|
||||
|
||||
if (requestId != null) {
|
||||
CompletableFuture<GostDto> future = pendingRequests.remove(requestId);
|
||||
if (future != null) {
|
||||
GostDto result = new GostDto();
|
||||
result.setMsg(responseMessage != null ? responseMessage : "无响应消息");
|
||||
|
||||
// 根据响应类型处理不同的数据
|
||||
if ("PingResponse".equals(responseType) && responseData != null) {
|
||||
// 特殊处理ping响应,将完整的响应数据返回
|
||||
result.setMsg(responseMessage != null ? responseMessage : "OK");
|
||||
result.setData(responseData); // 保存ping详细结果
|
||||
} else {
|
||||
// 其他类型的响应
|
||||
result.setMsg(responseMessage != null ? responseMessage : "无响应消息");
|
||||
if (responseData != null) {
|
||||
result.setData(responseData);
|
||||
}
|
||||
}
|
||||
|
||||
future.complete(result);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user