重命名客户端相关术语为节点;移动 utils 包到根路径;优化网关对节点各种连接状态的处理,并在节点断联后统一清理资源
This commit is contained in:
@@ -4,17 +4,17 @@ import (
|
||||
"context"
|
||||
"encoding/hex"
|
||||
"errors"
|
||||
"io"
|
||||
"log/slog"
|
||||
"net"
|
||||
"proxy-server/gateway/core"
|
||||
"proxy-server/gateway/env"
|
||||
"proxy-server/gateway/fwd/dispatcher"
|
||||
"proxy-server/gateway/fwd/metrics"
|
||||
"proxy-server/pkg/utils"
|
||||
"proxy-server/utils"
|
||||
"time"
|
||||
)
|
||||
|
||||
func (s *Service) listenUser(port uint16, ctrl net.Conn) error {
|
||||
func (s *Service) listenUser(port uint16, ctrl io.Writer) error {
|
||||
dspt, err := dispatcher.New(port, time.Duration(env.AppUserTimeout)*time.Second)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -48,7 +48,7 @@ func (s *Service) listenUser(port uint16, ctrl net.Conn) error {
|
||||
}
|
||||
}
|
||||
|
||||
func (s *Service) processUserConn(user *core.Conn, ctrl net.Conn) (err error) {
|
||||
func (s *Service) processUserConn(user *core.Conn, ctrl io.Writer) (err error) {
|
||||
|
||||
// 发送代理命令
|
||||
err = s.sendProxy(ctrl, user.Tag, user.Dest.String())
|
||||
|
||||
Reference in New Issue
Block a user