重构连接监听与处理代码逻辑,连接信息存储于全局通过接口展示

This commit is contained in:
2025-05-19 09:41:41 +08:00
parent aa967fbd6a
commit 24351e1c56
8 changed files with 126 additions and 67 deletions

View File

@@ -2,6 +2,7 @@ package app
import (
"proxy-server/gateway/core"
"proxy-server/utils"
)
type Stoppable interface {
@@ -16,6 +17,12 @@ var (
Assigns = core.SyncMap[uint16, int32]{} // 转发端口 -> 节点 ID
Edges = core.SyncMap[int32, uint16]{} // 节点 ID -> 转发端口
Permits = core.SyncMap[int32, *core.Permit]{} // 转发端口 -> 权限配置
CtrlConnWg utils.CountWaitGroup // 控制通道计数器
DataConnWg utils.CountWaitGroup // 数据通道计数器
FwdLesWg utils.CountWaitGroup // 转发监听端口计数器
UserConnWg utils.CountWaitGroup // 用户连接计数器
UserConnMap core.SyncMap[string, *core.Conn] // 用户连接暂存
)
func AddEdge(id int32, port uint16) {