mirror of
https://github.com/Sagit-chu/flvx.git
synced 2026-09-30 08:16:37 +08:00
修复v6 添加隧道类型选择
This commit is contained in:
@@ -257,6 +257,16 @@ public class TunnelServiceImpl extends ServiceImpl<TunnelMapper, Tunnel> impleme
|
||||
// 设置流量计算类型
|
||||
tunnel.setFlow(tunnelDto.getFlow());
|
||||
|
||||
// 设置协议类型(仅隧道转发需要)
|
||||
if (tunnelDto.getType() == TUNNEL_TYPE_TUNNEL_FORWARD) {
|
||||
// 隧道转发时,设置协议类型,默认为tls
|
||||
String protocol = StrUtil.isNotBlank(tunnelDto.getProtocol()) ? tunnelDto.getProtocol() : "tls";
|
||||
tunnel.setProtocol(protocol);
|
||||
} else {
|
||||
// 端口转发时,协议类型为null
|
||||
tunnel.setProtocol(null);
|
||||
}
|
||||
|
||||
return tunnel;
|
||||
}
|
||||
|
||||
@@ -310,6 +320,13 @@ public class TunnelServiceImpl extends ServiceImpl<TunnelMapper, Tunnel> impleme
|
||||
return R.err(ERROR_SAME_NODE_NOT_ALLOWED);
|
||||
}
|
||||
|
||||
// 验证协议类型
|
||||
String protocol = tunnelDto.getProtocol();
|
||||
if (StrUtil.isNotBlank(protocol) &&
|
||||
!protocol.equals("tls") && !protocol.equals("tcp") && !protocol.equals("mtls")) {
|
||||
return R.err("协议类型只能为tls、tcp或mtls");
|
||||
}
|
||||
|
||||
// 验证出口节点是否存在
|
||||
Node outNode = nodeService.getById(tunnelDto.getOutNodeId());
|
||||
if (outNode == null) {
|
||||
|
||||
Reference in New Issue
Block a user