diff --git a/go-gost/gost b/go-gost/gost deleted file mode 100755 index 975029f..0000000 Binary files a/go-gost/gost and /dev/null differ diff --git a/springboot-backend/src/main/java/com/admin/common/task/WebSocketCleanupTask.java b/springboot-backend/src/main/java/com/admin/common/task/WebSocketCleanupTask.java deleted file mode 100644 index 47a60bc..0000000 --- a/springboot-backend/src/main/java/com/admin/common/task/WebSocketCleanupTask.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.admin.common.task; - -import com.admin.common.utils.WebSocketServer; -import lombok.extern.slf4j.Slf4j; -import org.springframework.scheduling.annotation.Scheduled; -import org.springframework.stereotype.Component; - -/** - * WebSocket资源清理定时任务 - * 定期清理已完成的请求、无效的session锁等,防止内存泄漏 - */ -@Slf4j -@Component -public class WebSocketCleanupTask { - - /** - * 每5分钟执行一次轻量级清理 - * 清理已完成的请求和无效的session锁 - */ - @Scheduled(fixedRate = 5 * 60 * 1000) // 5分钟 - public void lightweightCleanup() { - try { - log.debug("开始执行WebSocket轻量级清理..."); - - // 清理已完成的请求 - WebSocketServer.cleanupCompletedRequests(); - - // 清理无效的session锁 - WebSocketServer.cleanupInvalidSessionLocks(); - - } catch (Exception e) { - log.error("WebSocket轻量级清理失败", e); - } - } - - /** - * 每30分钟执行一次全面清理 - * 包括所有类型的资源清理 - */ - @Scheduled(fixedRate = 30 * 60 * 1000) // 30分钟 - public void fullCleanup() { - try { - log.info("开始执行WebSocket全面清理..."); - - // 执行全面清理 - WebSocketServer.performFullCleanup(); - - } catch (Exception e) { - log.error("WebSocket全面清理失败", e); - } - } -} \ No newline at end of file diff --git a/vite-frontend/.env.development b/vite-frontend/.env.development index 1235a09..2e92b25 100644 --- a/vite-frontend/.env.development +++ b/vite-frontend/.env.development @@ -1 +1 @@ -VITE_API_BASE=http://192.168.100.6:6365 +VITE_API_BASE=http://127.0.0.1:6365 diff --git a/vite-frontend/src/pages/forward.tsx b/vite-frontend/src/pages/forward.tsx index 967bd08..4a7b257 100644 --- a/vite-frontend/src/pages/forward.tsx +++ b/vite-frontend/src/pages/forward.tsx @@ -33,6 +33,7 @@ interface Forward { inPort: number; remoteAddr: string; strategy: string; + proxyProtocol: number; // 添加 proxy_protocol 字段 status: number; inFlow: number; outFlow: number; @@ -57,6 +58,7 @@ interface ForwardForm { inPort: number | null; remoteAddr: string; strategy: string; + proxyProtocol: boolean; // 在表单中使用 boolean 类型更方便 } interface AddressItem { @@ -106,7 +108,8 @@ export default function ForwardPage() { tunnelId: null, inPort: null, remoteAddr: '', - strategy: 'fifo' + strategy: 'fifo', + proxyProtocol: false // 新增 proxyProtocol 字段 }); // 表单验证错误 @@ -202,7 +205,8 @@ export default function ForwardPage() { tunnelId: null, inPort: null, remoteAddr: '', - strategy: 'fifo' + strategy: 'fifo', + proxyProtocol: false }); setSelectedTunnel(null); setErrors({}); @@ -219,7 +223,8 @@ export default function ForwardPage() { tunnelId: forward.tunnelId, inPort: forward.inPort, remoteAddr: forward.remoteAddr.split(',').join('\n'), - strategy: forward.strategy || 'fifo' + strategy: forward.strategy || 'fifo', + proxyProtocol: forward.proxyProtocol === 1 // 编辑时需要将数字转换为 boolean }); const tunnel = tunnels.find(t => t.id === forward.tunnelId); setSelectedTunnel(tunnel || null); @@ -297,7 +302,8 @@ export default function ForwardPage() { tunnelId: form.tunnelId, inPort: form.inPort, remoteAddr: processedRemoteAddr, - strategy: addressCount > 1 ? form.strategy : 'fifo' + strategy: addressCount > 1 ? form.strategy : 'fifo', + proxyProtocol: form.proxyProtocol ? 1 : 0 // 提交时需要将 boolean 转换为数字 }; res = await updateForward(updateData); } else { @@ -307,7 +313,8 @@ export default function ForwardPage() { tunnelId: form.tunnelId, inPort: form.inPort, remoteAddr: processedRemoteAddr, - strategy: addressCount > 1 ? form.strategy : 'fifo' + strategy: addressCount > 1 ? form.strategy : 'fifo', + proxyProtocol: form.proxyProtocol ? 1 : 0 // 创建时需要将 boolean 转换为数字 }; res = await createForward(createData); } @@ -901,6 +908,19 @@ export default function ForwardPage() { 随机模式 - 随机选择 )} + +
+
+
+ 启用PROXY Protocol + 不知道干嘛的就别动 +
+ setForm(prev => ({ ...prev, proxyProtocol: checked }))} + /> +
+
diff --git a/vite-frontend/src/pages/node.tsx b/vite-frontend/src/pages/node.tsx index 51a9d62..f0345c8 100644 --- a/vite-frontend/src/pages/node.tsx +++ b/vite-frontend/src/pages/node.tsx @@ -15,8 +15,7 @@ import { getNodeList, updateNode, deleteNode, - getNodeInstallCommand, - checkNodeStatus + getNodeInstallCommand } from "@/api"; interface Node { @@ -72,11 +71,6 @@ export default function NodePage() { const [installCommand, setInstallCommand] = useState(''); const [currentNodeName, setCurrentNodeName] = useState(''); - // 状态检查相关状态 - const [statusCheckLoading, setStatusCheckLoading] = useState(false); - const [statusCheckResult, setStatusCheckResult] = useState(null); - const [statusCheckModal, setStatusCheckModal] = useState(false); - const websocketRef = useRef(null); const reconnectTimerRef = useRef(null); const reconnectAttemptsRef = useRef(0); @@ -452,55 +446,6 @@ export default function NodePage() { } }; - // 状态检查处理函数 - const handleCheckAllStatus = async () => { - setStatusCheckLoading(true); - try { - const res = await checkNodeStatus(); - if (res.code === 0) { - setStatusCheckResult(res.data); - setStatusCheckModal(true); - - // 刷新节点列表以显示最新状态 - await loadNodes(); - - const { totalNodes, connectedNodes, inconsistentNodes } = res.data; - if (inconsistentNodes > 0) { - toast.success(`状态检查完成!修复了 ${inconsistentNodes} 个节点的状态不一致问题`); - } else { - toast.success(`状态检查完成!${connectedNodes}/${totalNodes} 个节点在线`); - } - } else { - toast.error(res.msg || '状态检查失败'); - } - } catch (error) { - toast.error('网络错误,请重试'); - } finally { - setStatusCheckLoading(false); - } - }; - - const handleCheckSingleNodeStatus = async (nodeId: number) => { - try { - const res = await checkNodeStatus(nodeId); - if (res.code === 0) { - // 刷新节点列表 - await loadNodes(); - - const result = res.data.details[0]; - if (result.fixed) { - toast.success(`节点状态已修复:${result.message}`); - } else { - toast.success(result.message); - } - } else { - toast.error(res.msg || '状态检查失败'); - } - } catch (error) { - toast.error('网络错误,请重试'); - } - }; - // 提交表单 const handleSubmit = async () => { if (!validateForm()) return; @@ -578,19 +523,6 @@ export default function NodePage() {

节点管理

- -
-
- - - -
);