From 9b0033dd0d783b4b31e8a17cc5c1fa8695aa7aa5 Mon Sep 17 00:00:00 2001 From: GoEdgeLab Date: Tue, 16 Nov 2021 09:02:55 +0800 Subject: [PATCH] =?UTF-8?q?API=E5=8F=96=E6=B6=88=E5=AF=B9=E8=8A=82?= =?UTF-8?q?=E7=82=B9=E6=97=B6=E9=92=9F=E7=9A=84=E6=A3=80=E6=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/rpc/services/service_base.go | 7 ------- internal/rpc/utils/utils.go | 7 ------- 2 files changed, 14 deletions(-) diff --git a/internal/rpc/services/service_base.go b/internal/rpc/services/service_base.go index 9c53ae86..65669160 100644 --- a/internal/rpc/services/service_base.go +++ b/internal/rpc/services/service_base.go @@ -16,7 +16,6 @@ import ( "github.com/iwind/TeaGo/lists" "github.com/iwind/TeaGo/maps" "google.golang.org/grpc/metadata" - "time" ) type BaseService struct { @@ -162,12 +161,6 @@ func (this *BaseService) ValidateNodeId(ctx context.Context, roles ...rpcutils.U return rpcutils.UserTypeNone, 0, errors.New("decode token error: " + err.Error()) } - timestamp := m.GetInt64("timestamp") - if time.Now().Unix()-timestamp > 600 { - // 请求超过10分钟认为超时 - return rpcutils.UserTypeNone, 0, errors.New("authenticate timeout, please check your system clock") - } - role = apiToken.Role switch apiToken.Role { case rpcutils.UserTypeNode: diff --git a/internal/rpc/utils/utils.go b/internal/rpc/utils/utils.go index bbe71cc9..476cb750 100644 --- a/internal/rpc/utils/utils.go +++ b/internal/rpc/utils/utils.go @@ -13,7 +13,6 @@ import ( "github.com/iwind/TeaGo/lists" "github.com/iwind/TeaGo/maps" "google.golang.org/grpc/metadata" - "time" ) type UserType = string @@ -125,12 +124,6 @@ func ValidateRequest(ctx context.Context, userTypes ...UserType) (userType UserT return UserTypeNone, 0, 0, errors.New("decode token error: " + err.Error()) } - timestamp := m.GetInt64("timestamp") - if time.Now().Unix()-timestamp > 600 { - // 请求超过10分钟认为超时 - return UserTypeNone, 0, 0, errors.New("authenticate timeout, please check your system clock") - } - t := m.GetString("type") if len(userTypes) > 0 && !lists.ContainsString(userTypes, t) { return UserTypeNone, 0, 0, errors.New("not supported node type: '" + t + "'")