diff --git a/internal/api/auth.go b/internal/api/auth.go index 76920259a..861a10e6f 100644 --- a/internal/api/auth.go +++ b/internal/api/auth.go @@ -3,7 +3,7 @@ package api import ( "context" - "github.com/OpenIMSDK/Open-IM-Server/internal/api/a2r" + "github.com/OpenIMSDK/Open-IM-Server/pkg/a2r" "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config" "github.com/OpenIMSDK/Open-IM-Server/pkg/discoveryregistry" auth "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/auth" diff --git a/internal/api/conversation.go b/internal/api/conversation.go index 721943c25..0c92b7ff4 100644 --- a/internal/api/conversation.go +++ b/internal/api/conversation.go @@ -3,7 +3,7 @@ package api import ( "context" - "github.com/OpenIMSDK/Open-IM-Server/internal/api/a2r" + "github.com/OpenIMSDK/Open-IM-Server/pkg/a2r" "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config" "github.com/OpenIMSDK/Open-IM-Server/pkg/discoveryregistry" "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/conversation" diff --git a/internal/api/friend.go b/internal/api/friend.go index 978fdbe6d..73f1c1177 100644 --- a/internal/api/friend.go +++ b/internal/api/friend.go @@ -3,7 +3,7 @@ package api import ( "context" - "github.com/OpenIMSDK/Open-IM-Server/internal/api/a2r" + "github.com/OpenIMSDK/Open-IM-Server/pkg/a2r" "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config" "github.com/OpenIMSDK/Open-IM-Server/pkg/discoveryregistry" "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/friend" diff --git a/internal/api/group.go b/internal/api/group.go index 63e4d702b..875256869 100644 --- a/internal/api/group.go +++ b/internal/api/group.go @@ -3,7 +3,7 @@ package api import ( "context" - "github.com/OpenIMSDK/Open-IM-Server/internal/api/a2r" + "github.com/OpenIMSDK/Open-IM-Server/pkg/a2r" "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config" "github.com/OpenIMSDK/Open-IM-Server/pkg/discoveryregistry" "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/group" diff --git a/internal/api/msg.go b/internal/api/msg.go index 6b9f84699..5d8ca40b0 100644 --- a/internal/api/msg.go +++ b/internal/api/msg.go @@ -3,8 +3,8 @@ package api import ( "context" "errors" - "github.com/OpenIMSDK/Open-IM-Server/internal/api/a2r" - "github.com/OpenIMSDK/Open-IM-Server/internal/apiresp" + "github.com/OpenIMSDK/Open-IM-Server/pkg/a2r" + "github.com/OpenIMSDK/Open-IM-Server/pkg/apiresp" "github.com/OpenIMSDK/Open-IM-Server/pkg/apistruct" "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config" "github.com/OpenIMSDK/Open-IM-Server/pkg/common/constant" diff --git a/internal/api/third.go b/internal/api/third.go index fb5327be2..dbff5b720 100644 --- a/internal/api/third.go +++ b/internal/api/third.go @@ -2,7 +2,7 @@ package api import ( "context" - "github.com/OpenIMSDK/Open-IM-Server/internal/api/a2r" + "github.com/OpenIMSDK/Open-IM-Server/pkg/a2r" "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config" "github.com/OpenIMSDK/Open-IM-Server/pkg/discoveryregistry" "github.com/OpenIMSDK/Open-IM-Server/pkg/errs" diff --git a/internal/api/user.go b/internal/api/user.go index b65204707..e7912e49b 100644 --- a/internal/api/user.go +++ b/internal/api/user.go @@ -2,7 +2,7 @@ package api import ( "context" - "github.com/OpenIMSDK/Open-IM-Server/internal/api/a2r" + "github.com/OpenIMSDK/Open-IM-Server/pkg/a2r" "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config" "github.com/OpenIMSDK/Open-IM-Server/pkg/common/log" "github.com/OpenIMSDK/Open-IM-Server/pkg/discoveryregistry" diff --git a/internal/msggateway/hub_server.go b/internal/msggateway/hub_server.go index 98253a009..96e56b398 100644 --- a/internal/msggateway/hub_server.go +++ b/internal/msggateway/hub_server.go @@ -2,7 +2,6 @@ package msggateway import ( "context" - "github.com/OpenIMSDK/Open-IM-Server/internal/startrpc" "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config" "github.com/OpenIMSDK/Open-IM-Server/pkg/common/constant" "github.com/OpenIMSDK/Open-IM-Server/pkg/common/prome" @@ -10,6 +9,7 @@ import ( "github.com/OpenIMSDK/Open-IM-Server/pkg/discoveryregistry" "github.com/OpenIMSDK/Open-IM-Server/pkg/errs" "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/msggateway" + "github.com/OpenIMSDK/Open-IM-Server/pkg/startrpc" "github.com/OpenIMSDK/Open-IM-Server/pkg/utils" "google.golang.org/grpc" ) diff --git a/internal/msggateway/message_handler.go b/internal/msggateway/message_handler.go index 50c2aecfb..f8beb86e6 100644 --- a/internal/msggateway/message_handler.go +++ b/internal/msggateway/message_handler.go @@ -2,9 +2,9 @@ package msggateway import ( "context" - "github.com/OpenIMSDK/Open-IM-Server/internal/common/notification" "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/msg" "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/sdkws" + "github.com/OpenIMSDK/Open-IM-Server/pkg/rpcclient/notification" "github.com/go-playground/validator/v10" "github.com/golang/protobuf/proto" ) diff --git a/internal/rpc/auth/auth.go b/internal/rpc/auth/auth.go index da47bfe9f..3852d5ff7 100644 --- a/internal/rpc/auth/auth.go +++ b/internal/rpc/auth/auth.go @@ -2,7 +2,6 @@ package auth import ( "context" - "github.com/OpenIMSDK/Open-IM-Server/internal/common/check" "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config" "github.com/OpenIMSDK/Open-IM-Server/pkg/common/constant" "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/cache" @@ -13,6 +12,7 @@ import ( "github.com/OpenIMSDK/Open-IM-Server/pkg/errs" pbAuth "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/auth" "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/msggateway" + "github.com/OpenIMSDK/Open-IM-Server/pkg/rpcclient/check" "github.com/OpenIMSDK/Open-IM-Server/pkg/utils" "google.golang.org/grpc" ) diff --git a/internal/rpc/conversation/conversaion.go b/internal/rpc/conversation/conversaion.go index 0672a2b90..a5bbb57ca 100644 --- a/internal/rpc/conversation/conversaion.go +++ b/internal/rpc/conversation/conversaion.go @@ -2,8 +2,6 @@ package conversation import ( "context" - "github.com/OpenIMSDK/Open-IM-Server/internal/common/check" - "github.com/OpenIMSDK/Open-IM-Server/internal/common/notification" "github.com/OpenIMSDK/Open-IM-Server/pkg/common/constant" "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/cache" "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/controller" @@ -12,6 +10,8 @@ import ( "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/tx" "github.com/OpenIMSDK/Open-IM-Server/pkg/discoveryregistry" pbConversation "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/conversation" + "github.com/OpenIMSDK/Open-IM-Server/pkg/rpcclient/check" + "github.com/OpenIMSDK/Open-IM-Server/pkg/rpcclient/notification" "github.com/OpenIMSDK/Open-IM-Server/pkg/utils" "google.golang.org/grpc" ) diff --git a/internal/rpc/friend/black.go b/internal/rpc/friend/black.go index e3c19af8f..9d5ef2e72 100644 --- a/internal/rpc/friend/black.go +++ b/internal/rpc/friend/black.go @@ -4,11 +4,11 @@ import ( "context" "time" - "github.com/OpenIMSDK/Open-IM-Server/internal/common/convert" "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/relation" "github.com/OpenIMSDK/Open-IM-Server/pkg/common/tokenverify" "github.com/OpenIMSDK/Open-IM-Server/pkg/common/tracelog" pbFriend "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/friend" + "github.com/OpenIMSDK/Open-IM-Server/pkg/rpcclient/convert" ) func (s *friendServer) GetPaginationBlacks(ctx context.Context, req *pbFriend.GetPaginationBlacksReq) (resp *pbFriend.GetPaginationBlacksResp, err error) { diff --git a/internal/rpc/friend/friend.go b/internal/rpc/friend/friend.go index ada168ec8..6d519a3d5 100644 --- a/internal/rpc/friend/friend.go +++ b/internal/rpc/friend/friend.go @@ -2,10 +2,6 @@ package friend import ( "context" - - "github.com/OpenIMSDK/Open-IM-Server/internal/common/check" - "github.com/OpenIMSDK/Open-IM-Server/internal/common/convert" - "github.com/OpenIMSDK/Open-IM-Server/internal/common/notification" "github.com/OpenIMSDK/Open-IM-Server/pkg/common/constant" "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/controller" "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/relation" @@ -15,6 +11,9 @@ import ( registry "github.com/OpenIMSDK/Open-IM-Server/pkg/discoveryregistry" "github.com/OpenIMSDK/Open-IM-Server/pkg/errs" pbfriend "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/friend" + "github.com/OpenIMSDK/Open-IM-Server/pkg/rpcclient/check" + "github.com/OpenIMSDK/Open-IM-Server/pkg/rpcclient/convert" + "github.com/OpenIMSDK/Open-IM-Server/pkg/rpcclient/notification" "github.com/OpenIMSDK/Open-IM-Server/pkg/utils" "google.golang.org/grpc" ) @@ -47,6 +46,7 @@ func Start(client registry.SvcDiscoveryRegistry, server *grpc.Server) error { // ok func (s *friendServer) ApplyToAddFriend(ctx context.Context, req *pbfriend.ApplyToAddFriendReq) (resp *pbfriend.ApplyToAddFriendResp, err error) { + resp = &pbfriend.ApplyToAddFriendResp{} if err := tokenverify.CheckAccessV3(ctx, req.FromUserID); err != nil { return nil, err } @@ -70,7 +70,7 @@ func (s *friendServer) ApplyToAddFriend(ctx context.Context, req *pbfriend.Apply return nil, err } s.notification.FriendApplicationAddNotification(ctx, req) - return &pbfriend.ApplyToAddFriendResp{}, nil + return resp, nil } // ok diff --git a/internal/rpc/group/group.go b/internal/rpc/group/group.go index faad8ce16..3b81a7270 100644 --- a/internal/rpc/group/group.go +++ b/internal/rpc/group/group.go @@ -3,8 +3,6 @@ package group import ( "context" "fmt" - "github.com/OpenIMSDK/Open-IM-Server/internal/common/check" - "github.com/OpenIMSDK/Open-IM-Server/internal/common/notification" "github.com/OpenIMSDK/Open-IM-Server/pkg/common/constant" "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/cache" "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/controller" @@ -19,6 +17,8 @@ import ( pbConversation "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/conversation" pbGroup "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/group" "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/sdkws" + "github.com/OpenIMSDK/Open-IM-Server/pkg/rpcclient/check" + "github.com/OpenIMSDK/Open-IM-Server/pkg/rpcclient/notification" "github.com/OpenIMSDK/Open-IM-Server/pkg/utils" "google.golang.org/grpc" "gorm.io/gorm" diff --git a/internal/rpc/msg/server.go b/internal/rpc/msg/server.go index 84a537e16..86b65a15d 100644 --- a/internal/rpc/msg/server.go +++ b/internal/rpc/msg/server.go @@ -1,7 +1,6 @@ package msg import ( - "github.com/OpenIMSDK/Open-IM-Server/internal/common/check" "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/cache" "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/controller" "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/localcache" @@ -9,6 +8,7 @@ import ( "github.com/OpenIMSDK/Open-IM-Server/pkg/common/prome" "github.com/OpenIMSDK/Open-IM-Server/pkg/discoveryregistry" "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/msg" + "github.com/OpenIMSDK/Open-IM-Server/pkg/rpcclient/check" "google.golang.org/grpc" ) diff --git a/internal/rpc/third/third.go b/internal/rpc/third/third.go index 4f971b2bb..5a4a1883c 100644 --- a/internal/rpc/third/third.go +++ b/internal/rpc/third/third.go @@ -2,7 +2,6 @@ package third import ( "context" - "github.com/OpenIMSDK/Open-IM-Server/internal/common/check" "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/cache" "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/controller" "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/obj" @@ -10,6 +9,7 @@ import ( relationTb "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/relation" "github.com/OpenIMSDK/Open-IM-Server/pkg/discoveryregistry" "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/third" + "github.com/OpenIMSDK/Open-IM-Server/pkg/rpcclient/check" "google.golang.org/grpc" ) diff --git a/internal/rpc/user/user.go b/internal/rpc/user/user.go index b7d231b22..6b6b96330 100644 --- a/internal/rpc/user/user.go +++ b/internal/rpc/user/user.go @@ -2,9 +2,6 @@ package user import ( "context" - "github.com/OpenIMSDK/Open-IM-Server/internal/common/check" - "github.com/OpenIMSDK/Open-IM-Server/internal/common/convert" - "github.com/OpenIMSDK/Open-IM-Server/internal/common/notification" "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config" "github.com/OpenIMSDK/Open-IM-Server/pkg/common/constant" "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/controller" @@ -16,6 +13,9 @@ import ( "github.com/OpenIMSDK/Open-IM-Server/pkg/errs" "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/sdkws" pbuser "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/user" + "github.com/OpenIMSDK/Open-IM-Server/pkg/rpcclient/check" + "github.com/OpenIMSDK/Open-IM-Server/pkg/rpcclient/convert" + "github.com/OpenIMSDK/Open-IM-Server/pkg/rpcclient/notification" "github.com/OpenIMSDK/Open-IM-Server/pkg/utils" "google.golang.org/grpc" ) diff --git a/internal/api/a2r/api2rpc.go b/pkg/a2r/api2rpc.go similarity index 95% rename from internal/api/a2r/api2rpc.go rename to pkg/a2r/api2rpc.go index 708088898..ebdbf11ce 100644 --- a/internal/api/a2r/api2rpc.go +++ b/pkg/a2r/api2rpc.go @@ -2,7 +2,7 @@ package a2r import ( "context" - "github.com/OpenIMSDK/Open-IM-Server/internal/apiresp" + "github.com/OpenIMSDK/Open-IM-Server/pkg/apiresp" "github.com/OpenIMSDK/Open-IM-Server/pkg/common/log" "github.com/OpenIMSDK/Open-IM-Server/pkg/errs" "github.com/gin-gonic/gin" diff --git a/internal/apiresp/gin.go b/pkg/apiresp/gin.go similarity index 100% rename from internal/apiresp/gin.go rename to pkg/apiresp/gin.go diff --git a/internal/apiresp/resp.go b/pkg/apiresp/resp.go similarity index 100% rename from internal/apiresp/resp.go rename to pkg/apiresp/resp.go diff --git a/pkg/common/cmd/rpc.go b/pkg/common/cmd/rpc.go index 3af1047bd..6c6e9b485 100644 --- a/pkg/common/cmd/rpc.go +++ b/pkg/common/cmd/rpc.go @@ -1,8 +1,8 @@ package cmd import ( - "github.com/OpenIMSDK/Open-IM-Server/internal/startrpc" "github.com/OpenIMSDK/Open-IM-Server/pkg/discoveryregistry" + "github.com/OpenIMSDK/Open-IM-Server/pkg/startrpc" "github.com/spf13/cobra" "google.golang.org/grpc" ) diff --git a/pkg/common/mw/gin.go b/pkg/common/mw/gin.go index ad90188b8..23606c041 100644 --- a/pkg/common/mw/gin.go +++ b/pkg/common/mw/gin.go @@ -3,7 +3,7 @@ package mw import ( "bytes" "encoding/json" - "github.com/OpenIMSDK/Open-IM-Server/internal/apiresp" + "github.com/OpenIMSDK/Open-IM-Server/pkg/apiresp" "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config" "github.com/OpenIMSDK/Open-IM-Server/pkg/common/constant" "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/cache" diff --git a/internal/common/network/ip.go b/pkg/common/network/ip.go similarity index 100% rename from internal/common/network/ip.go rename to pkg/common/network/ip.go diff --git a/internal/common/check/access.go b/pkg/rpcclient/check/access.go similarity index 100% rename from internal/common/check/access.go rename to pkg/rpcclient/check/access.go diff --git a/internal/common/check/black.go b/pkg/rpcclient/check/black.go similarity index 100% rename from internal/common/check/black.go rename to pkg/rpcclient/check/black.go diff --git a/internal/common/check/conversation.go b/pkg/rpcclient/check/conversation.go similarity index 100% rename from internal/common/check/conversation.go rename to pkg/rpcclient/check/conversation.go diff --git a/internal/common/check/friend.go b/pkg/rpcclient/check/friend.go similarity index 100% rename from internal/common/check/friend.go rename to pkg/rpcclient/check/friend.go diff --git a/internal/common/check/group.go b/pkg/rpcclient/check/group.go similarity index 100% rename from internal/common/check/group.go rename to pkg/rpcclient/check/group.go diff --git a/internal/common/check/msg.go b/pkg/rpcclient/check/msg.go similarity index 100% rename from internal/common/check/msg.go rename to pkg/rpcclient/check/msg.go diff --git a/internal/common/check/user.go b/pkg/rpcclient/check/user.go similarity index 100% rename from internal/common/check/user.go rename to pkg/rpcclient/check/user.go diff --git a/internal/common/convert/convert.go b/pkg/rpcclient/convert/convert.go similarity index 99% rename from internal/common/convert/convert.go rename to pkg/rpcclient/convert/convert.go index da044e436..a37fa322b 100644 --- a/internal/common/convert/convert.go +++ b/pkg/rpcclient/convert/convert.go @@ -2,10 +2,10 @@ package convert import ( "context" - "github.com/OpenIMSDK/Open-IM-Server/internal/common/check" "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/relation" discoveryRegistry "github.com/OpenIMSDK/Open-IM-Server/pkg/discoveryregistry" sdk "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/sdkws" + "github.com/OpenIMSDK/Open-IM-Server/pkg/rpcclient/check" utils2 "github.com/OpenIMSDK/Open-IM-Server/pkg/utils" utils "github.com/OpenIMSDK/open_utils" "time" diff --git a/internal/common/notification/c.go b/pkg/rpcclient/notification/c.go similarity index 99% rename from internal/common/notification/c.go rename to pkg/rpcclient/notification/c.go index 36ecf77ce..ba08c7442 100644 --- a/internal/common/notification/c.go +++ b/pkg/rpcclient/notification/c.go @@ -2,12 +2,12 @@ package notification import ( "context" - "github.com/OpenIMSDK/Open-IM-Server/internal/common/check" "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config" "github.com/OpenIMSDK/Open-IM-Server/pkg/common/constant" discoveryRegistry "github.com/OpenIMSDK/Open-IM-Server/pkg/discoveryregistry" "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/msg" "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/sdkws" + "github.com/OpenIMSDK/Open-IM-Server/pkg/rpcclient/check" utils "github.com/OpenIMSDK/open_utils" ) diff --git a/internal/common/notification/conversation.go b/pkg/rpcclient/notification/conversation.go similarity index 100% rename from internal/common/notification/conversation.go rename to pkg/rpcclient/notification/conversation.go diff --git a/internal/common/notification/extend_msg.go b/pkg/rpcclient/notification/extend_msg.go similarity index 100% rename from internal/common/notification/extend_msg.go rename to pkg/rpcclient/notification/extend_msg.go diff --git a/internal/common/notification/friend.go b/pkg/rpcclient/notification/friend.go similarity index 100% rename from internal/common/notification/friend.go rename to pkg/rpcclient/notification/friend.go diff --git a/internal/common/notification/group.go b/pkg/rpcclient/notification/group.go similarity index 100% rename from internal/common/notification/group.go rename to pkg/rpcclient/notification/group.go diff --git a/internal/common/notification/msg.go b/pkg/rpcclient/notification/msg.go similarity index 100% rename from internal/common/notification/msg.go rename to pkg/rpcclient/notification/msg.go diff --git a/internal/common/notification/super_group.go b/pkg/rpcclient/notification/super_group.go similarity index 100% rename from internal/common/notification/super_group.go rename to pkg/rpcclient/notification/super_group.go diff --git a/internal/common/notification/user.go b/pkg/rpcclient/notification/user.go similarity index 100% rename from internal/common/notification/user.go rename to pkg/rpcclient/notification/user.go diff --git a/internal/startrpc/start.go b/pkg/startrpc/start.go similarity index 97% rename from internal/startrpc/start.go rename to pkg/startrpc/start.go index c9f5860c3..c8cdfdf09 100644 --- a/internal/startrpc/start.go +++ b/pkg/startrpc/start.go @@ -2,11 +2,11 @@ package startrpc import ( "fmt" - "github.com/OpenIMSDK/Open-IM-Server/internal/common/network" "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config" "github.com/OpenIMSDK/Open-IM-Server/pkg/common/constant" "github.com/OpenIMSDK/Open-IM-Server/pkg/common/log" "github.com/OpenIMSDK/Open-IM-Server/pkg/common/mw" + "github.com/OpenIMSDK/Open-IM-Server/pkg/common/network" "github.com/OpenIMSDK/Open-IM-Server/pkg/common/prome" "github.com/OpenIMSDK/Open-IM-Server/pkg/discoveryregistry" "github.com/OpenIMSDK/Open-IM-Server/pkg/utils"