mirror of
https://github.com/Sagit-chu/flvx.git
synced 2026-10-13 12:46:36 +08:00
feat: add tunnel probe target UI
This commit is contained in:
@@ -8,6 +8,8 @@ interface TunnelFormInput {
|
||||
inNodeId: TunnelChainNode[];
|
||||
outNodeId?: TunnelChainNode[];
|
||||
trafficRatio: number;
|
||||
probeTargetHost?: string;
|
||||
probeTargetPort?: number;
|
||||
}
|
||||
|
||||
interface TunnelNodeInput {
|
||||
@@ -26,6 +28,8 @@ export const createTunnelFormDefaults = () => {
|
||||
trafficRatio: 1.0,
|
||||
inIp: "",
|
||||
ipPreference: "",
|
||||
probeTargetHost: "",
|
||||
probeTargetPort: 0,
|
||||
status: 1,
|
||||
};
|
||||
};
|
||||
@@ -63,6 +67,21 @@ export const validateTunnelForm = (
|
||||
errors.trafficRatio = "流量倍率须大于0,支持小数(如 0.5)";
|
||||
}
|
||||
|
||||
const probeHost = (form.probeTargetHost || "").trim();
|
||||
const probePort = Number(form.probeTargetPort || 0);
|
||||
|
||||
if (probeHost || probePort > 0) {
|
||||
if (!probeHost) {
|
||||
errors.probeTargetHost = "请输入测试目标 Host";
|
||||
} else if (probeHost.includes("://") || /[\s/?#]/.test(probeHost)) {
|
||||
errors.probeTargetHost = "Host 不能包含协议、空格或路径";
|
||||
}
|
||||
|
||||
if (!Number.isInteger(probePort) || probePort < 1 || probePort > 65535) {
|
||||
errors.probeTargetPort = "端口必须是 1-65535";
|
||||
}
|
||||
}
|
||||
|
||||
if (form.type === 2) {
|
||||
if (!form.outNodeId || form.outNodeId.length === 0) {
|
||||
errors.outNodeId = "请至少选择一个出口节点";
|
||||
|
||||
Reference in New Issue
Block a user