完善客户端与服务端注册,端口分配和协议交互逻辑

This commit is contained in:
2025-05-14 17:46:34 +08:00
parent f86cf47e86
commit 75569d2d6d
14 changed files with 313 additions and 277 deletions

View File

@@ -9,6 +9,7 @@ import (
)
type Config struct {
Id *int32
}
type Service struct {
@@ -22,6 +23,8 @@ type Service struct {
ctrlConnWg utils.CountWaitGroup
dataConnWg utils.CountWaitGroup
userConnWg utils.CountWaitGroup
fwdPortMap map[uint16]int32 // 转发端口映射key 为端口号value 为边缘节点 ID
}
func New(config *Config) *Service {
@@ -31,9 +34,10 @@ func New(config *Config) *Service {
ctx, cancel := context.WithCancel(context.Background())
return &Service{
Config: config,
ctx: ctx,
cancel: cancel,
Config: config,
ctx: ctx,
cancel: cancel,
fwdPortMap: make(map[uint16]int32),
}
}