优化连接管理和日志记录

This commit is contained in:
2025-02-27 23:11:36 +08:00
parent 38d5341e84
commit 037c2c53c6
11 changed files with 436 additions and 403 deletions

View File

@@ -95,13 +95,13 @@ func New(conf *Config) (*Server, error) {
wg: utils.CountWaitGroup{},
Name: conf.Name,
Port: conf.Port,
Conn: make(chan ProxyConn, 100),
Conn: make(chan ProxyConn),
}, nil
}
// Run 监听端口
func (s *Server) Run() error {
slog.Info("启动 socks5 代理服务")
slog.Debug("启动 socks5 代理服务")
// 监听端口
host := s.config.Host
@@ -112,7 +112,7 @@ func (s *Server) Run() error {
return errors.Wrap(err, "监听端口失败")
}
defer utils.Close(ls)
slog.Info("正在监听端口", slog.Uint64("port", uint64(port)))
slog.Debug("正在监听端口", slog.Uint64("port", uint64(port)))
// 处理连接
connCh := utils.ChanConnAccept(s.ctx, ls)