From 370e6abf676913dbf990959ee4d14278db16fda1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E7=95=8C?= Date: Sat, 11 Nov 2023 19:16:24 +0800 Subject: [PATCH] Fix authentication failed error message --- go.mod | 1 + go.sum | 2 ++ tuic/service.go | 4 +++- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index c5b9a41..63c83f0 100644 --- a/go.mod +++ b/go.mod @@ -3,6 +3,7 @@ module github.com/sagernet/sing-quic go 1.20 require ( + github.com/gofrs/uuid/v5 v5.0.0 github.com/sagernet/quic-go v0.0.0-20231008035953-32727fef9460 github.com/sagernet/sing v0.2.17 golang.org/x/crypto v0.14.0 diff --git a/go.sum b/go.sum index b7c6caa..9ad67f8 100644 --- a/go.sum +++ b/go.sum @@ -7,6 +7,8 @@ github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI= github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls= +github.com/gofrs/uuid/v5 v5.0.0 h1:p544++a97kEL+svbcFbCQVM9KFu0Yo25UoISXGNNH9M= +github.com/gofrs/uuid/v5 v5.0.0/go.mod h1:CDOjlDMVAtN56jqyRUZh58JT31Tiw7/oQyEXZV+9bD8= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= diff --git a/tuic/service.go b/tuic/service.go index e8a191a..e173bbb 100644 --- a/tuic/service.go +++ b/tuic/service.go @@ -23,6 +23,8 @@ import ( M "github.com/sagernet/sing/common/metadata" N "github.com/sagernet/sing/common/network" aTLS "github.com/sagernet/sing/common/tls" + + "github.com/gofrs/uuid/v5" ) type ServiceOptions struct { @@ -243,7 +245,7 @@ func (s *serverSession[U]) handleUniStream(stream quic.ReceiveStream) error { copy(userUUID[:], buffer.Range(2, 2+16)) user, loaded := s.userMap[userUUID] if !loaded { - return E.New("authentication: unknown user ", userUUID) + return E.New("authentication: unknown user ", uuid.UUID(userUUID)) } handshakeState := s.quicConn.ConnectionState() tuicToken, err := handshakeState.ExportKeyingMaterial(string(userUUID[:]), []byte(s.passwordMap[user]), 32)