Remove stack buffer usage

This commit is contained in:
世界
2023-07-03 21:45:32 +08:00
parent 9c8565cf21
commit 07ce5e0d22
16 changed files with 49 additions and 289 deletions

View File

@@ -4,7 +4,6 @@ import (
"context"
"net"
"github.com/sagernet/sing/common"
"github.com/sagernet/sing/common/auth"
"github.com/sagernet/sing/common/buf"
"github.com/sagernet/sing/common/bufio"
@@ -59,7 +58,7 @@ func (s *Service[K]) UpdateUsers(userList []K, passwordList []string) error {
func (s *Service[K]) NewConnection(ctx context.Context, conn net.Conn, metadata M.Metadata) error {
var key [KeyLength]byte
n, err := conn.Read(common.Dup(key[:]))
n, err := conn.Read(key[:])
if err != nil {
return err
} else if n != KeyLength {