mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-05-15 16:42:38 +08:00
Merge remote-tracking branch 'origin/errcode' into errcode
# Conflicts: # internal/rpc/msg/delete.go # internal/rpc/msg/send_pull.go # pkg/common/db/cache/msg.go # pkg/common/db/cache/redis.go # pkg/common/db/cache/redis_test.go
This commit is contained in:
commit
ae8478dc5e
191
cmd/api/main.go
191
cmd/api/main.go
@ -1,201 +1,36 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
apiAuth "Open_IM/internal/api/auth"
|
"OpenIM/internal/api"
|
||||||
"Open_IM/internal/api/conversation"
|
"OpenIM/internal/api/third"
|
||||||
"Open_IM/internal/api/friend"
|
"OpenIM/pkg/common/config"
|
||||||
"Open_IM/internal/api/group"
|
"OpenIM/pkg/common/log"
|
||||||
"Open_IM/internal/api/manage"
|
|
||||||
apiChat "Open_IM/internal/api/msg"
|
|
||||||
apiThird "Open_IM/internal/api/third"
|
|
||||||
"Open_IM/internal/api/user"
|
|
||||||
"Open_IM/pkg/common/config"
|
|
||||||
"Open_IM/pkg/common/log"
|
|
||||||
"Open_IM/pkg/common/middleware"
|
|
||||||
"Open_IM/pkg/common/tokenverify"
|
|
||||||
"flag"
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"io"
|
|
||||||
"os"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
swaggerFiles "github.com/swaggo/files"
|
"OpenIM/pkg/common/constant"
|
||||||
ginSwagger "github.com/swaggo/gin-swagger"
|
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
|
||||||
//"syscall"
|
|
||||||
"Open_IM/pkg/common/constant"
|
|
||||||
prome "Open_IM/pkg/common/prome"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// @title open-IM-Server API
|
|
||||||
// @version 1.0
|
|
||||||
// @description open-IM-Server 的API服务器文档, 文档中所有请求都有一个operationID字段用于链路追踪
|
|
||||||
|
|
||||||
// @license.name Apache 2.0
|
|
||||||
// @license.url http://www.apache.org/licenses/LICENSE-2.0.html
|
|
||||||
// @BasePath /
|
|
||||||
func main() {
|
func main() {
|
||||||
log.NewPrivateLog(constant.LogFileName)
|
log.NewPrivateLog(constant.LogFileName)
|
||||||
gin.SetMode(gin.ReleaseMode)
|
router := api.NewGinRouter()
|
||||||
f, _ := os.Create("../logs/api.log")
|
go third.MinioInit()
|
||||||
gin.DefaultWriter = io.MultiWriter(f)
|
configPath := flag.String("config_path", "../config/", "config folder")
|
||||||
// gin.SetMode(gin.DebugMode)
|
flag.Parse()
|
||||||
r := gin.New()
|
if err := config.InitConfig(*configPath); err != nil {
|
||||||
r.Use(gin.Recovery())
|
panic(err.Error())
|
||||||
r.Use(middleware.GinParseOperationID)
|
|
||||||
log.Info("load config: ", config.Config)
|
|
||||||
r.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler))
|
|
||||||
if config.Config.Prometheus.Enable {
|
|
||||||
prome.NewApiRequestCounter()
|
|
||||||
prome.NewApiRequestFailedCounter()
|
|
||||||
prome.NewApiRequestSuccessCounter()
|
|
||||||
r.Use(prome.PromeTheusMiddleware)
|
|
||||||
r.GET("/metrics", prome.PrometheusHandler())
|
|
||||||
}
|
|
||||||
// user routing group, which handles user registration and login services
|
|
||||||
userRouterGroup := r.Group("/user")
|
|
||||||
{
|
|
||||||
userRouterGroup.POST("/update_user_info", user.UpdateUserInfo) //1
|
|
||||||
userRouterGroup.POST("/set_global_msg_recv_opt", user.SetGlobalRecvMessageOpt)
|
|
||||||
userRouterGroup.POST("/get_users_info", user.GetUsersPublicInfo) //1
|
|
||||||
userRouterGroup.POST("/get_self_user_info", user.GetSelfUserInfo) //1
|
|
||||||
userRouterGroup.POST("/get_users_online_status", user.GetUsersOnlineStatus) //1
|
|
||||||
userRouterGroup.POST("/get_users_info_from_cache", user.GetUsersInfoFromCache)
|
|
||||||
userRouterGroup.POST("/get_user_friend_from_cache", user.GetFriendIDListFromCache)
|
|
||||||
userRouterGroup.POST("/get_black_list_from_cache", user.GetBlackIDListFromCache)
|
|
||||||
userRouterGroup.POST("/get_all_users_uid", manage.GetAllUsersUid) //1
|
|
||||||
userRouterGroup.POST("/account_check", manage.AccountCheck) //1
|
|
||||||
// userRouterGroup.POST("/get_users_online_status", manage.GetUsersOnlineStatus) //1
|
|
||||||
userRouterGroup.POST("/get_users", user.GetUsers)
|
|
||||||
}
|
|
||||||
////friend routing group
|
|
||||||
friendRouterGroup := r.Group("/friend")
|
|
||||||
{
|
|
||||||
// friendRouterGroup.POST("/get_friends_info", friend.GetFriendsInfo)
|
|
||||||
friendRouterGroup.POST("/add_friend", friend.AddFriend) //1
|
|
||||||
friendRouterGroup.POST("/delete_friend", friend.DeleteFriend) //1
|
|
||||||
friendRouterGroup.POST("/get_friend_apply_list", friend.GetFriendApplyList) //1
|
|
||||||
friendRouterGroup.POST("/get_self_friend_apply_list", friend.GetSelfApplyList) //1
|
|
||||||
friendRouterGroup.POST("/get_friend_list", friend.GetFriendList) //1
|
|
||||||
friendRouterGroup.POST("/add_friend_response", friend.AddFriendResponse) //1
|
|
||||||
friendRouterGroup.POST("/set_friend_remark", friend.SetFriendRemark) //1
|
|
||||||
|
|
||||||
friendRouterGroup.POST("/add_black", friend.AddBlack) //1
|
|
||||||
friendRouterGroup.POST("/get_black_list", friend.GetBlacklist) //1
|
|
||||||
friendRouterGroup.POST("/remove_black", friend.RemoveBlacklist) //1
|
|
||||||
|
|
||||||
friendRouterGroup.POST("/import_friend", friend.ImportFriend) //1
|
|
||||||
friendRouterGroup.POST("/is_friend", friend.IsFriend) //1
|
|
||||||
}
|
|
||||||
//group related routing group
|
|
||||||
groupRouterGroup := r.Group("/group")
|
|
||||||
groupRouterGroup.Use(func(c *gin.Context) {
|
|
||||||
userID, err := tokenverify.ParseUserIDFromToken(c.GetHeader("token"), c.GetString("operationID"))
|
|
||||||
if err != nil {
|
|
||||||
c.String(400, err.Error())
|
|
||||||
c.Abort()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
c.Set("opUserID", userID)
|
|
||||||
c.Next()
|
|
||||||
})
|
|
||||||
{
|
|
||||||
groupRouterGroup.POST("/create_group", group.NewCreateGroup) //1
|
|
||||||
groupRouterGroup.POST("/set_group_info", group.NewSetGroupInfo) //1
|
|
||||||
groupRouterGroup.POST("/join_group", group.JoinGroup) //1
|
|
||||||
groupRouterGroup.POST("/quit_group", group.QuitGroup) //1
|
|
||||||
groupRouterGroup.POST("/group_application_response", group.ApplicationGroupResponse) //1
|
|
||||||
groupRouterGroup.POST("/transfer_group", group.TransferGroupOwner) //1
|
|
||||||
groupRouterGroup.POST("/get_recv_group_applicationList", group.GetRecvGroupApplicationList) //1
|
|
||||||
groupRouterGroup.POST("/get_user_req_group_applicationList", group.GetUserReqGroupApplicationList)
|
|
||||||
groupRouterGroup.POST("/get_groups_info", group.GetGroupsInfo) //1
|
|
||||||
groupRouterGroup.POST("/kick_group", group.KickGroupMember) //1
|
|
||||||
// groupRouterGroup.POST("/get_group_member_list", group.FindGroupMemberAll) //no use
|
|
||||||
groupRouterGroup.POST("/get_group_all_member_list", group.GetGroupAllMemberList) //1
|
|
||||||
groupRouterGroup.POST("/get_group_members_info", group.GetGroupMembersInfo) //1
|
|
||||||
groupRouterGroup.POST("/invite_user_to_group", group.InviteUserToGroup) //1
|
|
||||||
groupRouterGroup.POST("/get_joined_group_list", group.GetJoinedGroupList)
|
|
||||||
groupRouterGroup.POST("/dismiss_group", group.DismissGroup) //
|
|
||||||
groupRouterGroup.POST("/mute_group_member", group.MuteGroupMember)
|
|
||||||
groupRouterGroup.POST("/cancel_mute_group_member", group.CancelMuteGroupMember) //MuteGroup
|
|
||||||
groupRouterGroup.POST("/mute_group", group.MuteGroup)
|
|
||||||
groupRouterGroup.POST("/cancel_mute_group", group.CancelMuteGroup)
|
|
||||||
groupRouterGroup.POST("/set_group_member_nickname", group.SetGroupMemberNickname)
|
|
||||||
groupRouterGroup.POST("/set_group_member_info", group.SetGroupMemberInfo)
|
|
||||||
groupRouterGroup.POST("/get_group_abstract_info", group.GetGroupAbstractInfo)
|
|
||||||
//groupRouterGroup.POST("/get_group_all_member_list_by_split", group.GetGroupAllMemberListBySplit)
|
|
||||||
}
|
|
||||||
superGroupRouterGroup := r.Group("/super_group")
|
|
||||||
{
|
|
||||||
superGroupRouterGroup.POST("/get_joined_group_list", group.GetJoinedSuperGroupList)
|
|
||||||
superGroupRouterGroup.POST("/get_groups_info", group.GetSuperGroupsInfo)
|
|
||||||
}
|
|
||||||
////certificate
|
|
||||||
authRouterGroup := r.Group("/auth")
|
|
||||||
{
|
|
||||||
authRouterGroup.POST("/user_register", apiAuth.UserRegister) //1
|
|
||||||
authRouterGroup.POST("/user_token", apiAuth.UserToken) //1
|
|
||||||
authRouterGroup.POST("/parse_token", apiAuth.ParseToken) //1
|
|
||||||
authRouterGroup.POST("/force_logout", apiAuth.ForceLogout) //1
|
|
||||||
}
|
|
||||||
////Third service
|
|
||||||
thirdGroup := r.Group("/third")
|
|
||||||
{
|
|
||||||
thirdGroup.POST("/tencent_cloud_storage_credential", apiThird.TencentCloudStorageCredential)
|
|
||||||
thirdGroup.POST("/ali_oss_credential", apiThird.AliOSSCredential)
|
|
||||||
thirdGroup.POST("/minio_storage_credential", apiThird.MinioStorageCredential)
|
|
||||||
thirdGroup.POST("/minio_upload", apiThird.MinioUploadFile)
|
|
||||||
thirdGroup.POST("/upload_update_app", apiThird.UploadUpdateApp)
|
|
||||||
thirdGroup.POST("/get_download_url", apiThird.GetDownloadURL)
|
|
||||||
thirdGroup.POST("/get_rtc_invitation_info", apiThird.GetRTCInvitationInfo)
|
|
||||||
thirdGroup.POST("/get_rtc_invitation_start_app", apiThird.GetRTCInvitationInfoStartApp)
|
|
||||||
thirdGroup.POST("/fcm_update_token", apiThird.FcmUpdateToken)
|
|
||||||
thirdGroup.POST("/aws_storage_credential", apiThird.AwsStorageCredential)
|
|
||||||
thirdGroup.POST("/set_app_badge", apiThird.SetAppBadge)
|
|
||||||
}
|
|
||||||
////Message
|
|
||||||
chatGroup := r.Group("/msg")
|
|
||||||
{
|
|
||||||
chatGroup.POST("/newest_seq", apiChat.GetSeq)
|
|
||||||
chatGroup.POST("/send_msg", apiChat.SendMsg)
|
|
||||||
chatGroup.POST("/pull_msg_by_seq", apiChat.PullMsgBySeqList)
|
|
||||||
chatGroup.POST("/del_msg", apiChat.DelMsg)
|
|
||||||
chatGroup.POST("/del_super_group_msg", apiChat.DelSuperGroupMsg)
|
|
||||||
chatGroup.POST("/clear_msg", apiChat.ClearMsg)
|
|
||||||
chatGroup.POST("/manage_send_msg", manage.ManagementSendMsg)
|
|
||||||
chatGroup.POST("/batch_send_msg", manage.ManagementBatchSendMsg)
|
|
||||||
chatGroup.POST("/check_msg_is_send_success", manage.CheckMsgIsSendSuccess)
|
|
||||||
chatGroup.POST("/set_msg_min_seq", apiChat.SetMsgMinSeq)
|
|
||||||
|
|
||||||
chatGroup.POST("/set_message_reaction_extensions", apiChat.SetMessageReactionExtensions)
|
|
||||||
chatGroup.POST("/get_message_list_reaction_extensions", apiChat.GetMessageListReactionExtensions)
|
|
||||||
chatGroup.POST("/add_message_reaction_extensions", apiChat.AddMessageReactionExtensions)
|
|
||||||
chatGroup.POST("/delete_message_reaction_extensions", apiChat.DeleteMessageReactionExtensions)
|
|
||||||
}
|
|
||||||
////Conversation
|
|
||||||
conversationGroup := r.Group("/conversation")
|
|
||||||
{ //1
|
|
||||||
conversationGroup.POST("/get_all_conversations", conversation.GetAllConversations)
|
|
||||||
conversationGroup.POST("/get_conversation", conversation.GetConversation)
|
|
||||||
conversationGroup.POST("/get_conversations", conversation.GetConversations)
|
|
||||||
conversationGroup.POST("/set_conversation", conversation.SetConversation)
|
|
||||||
conversationGroup.POST("/batch_set_conversation", conversation.BatchSetConversations)
|
|
||||||
conversationGroup.POST("/set_recv_msg_opt", conversation.SetRecvMsgOpt)
|
|
||||||
conversationGroup.POST("/modify_conversation_field", conversation.ModifyConversationField)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
go apiThird.MinioInit()
|
ginPort := flag.Int("port", config.Config.Api.GinPort[0], "get ginServerPort from cmd,default 10002 as port")
|
||||||
defaultPorts := config.Config.Api.GinPort
|
|
||||||
ginPort := flag.Int("port", defaultPorts[0], "get ginServerPort from cmd,default 10002 as port")
|
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
address := "0.0.0.0:" + strconv.Itoa(*ginPort)
|
address := "0.0.0.0:" + strconv.Itoa(*ginPort)
|
||||||
if config.Config.Api.ListenIP != "" {
|
if config.Config.Api.ListenIP != "" {
|
||||||
address = config.Config.Api.ListenIP + ":" + strconv.Itoa(*ginPort)
|
address = config.Config.Api.ListenIP + ":" + strconv.Itoa(*ginPort)
|
||||||
}
|
}
|
||||||
fmt.Println("start api server, address: ", address, ", OpenIM version: ", constant.CurrentVersion)
|
fmt.Println("start api server, address: ", address, ", OpenIM version: ", constant.CurrentVersion)
|
||||||
err := r.Run(address)
|
err := router.Run(address)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("", "api run failed ", address, err.Error())
|
log.Error("", "api run failed ", address, err.Error())
|
||||||
panic("api start failed " + err.Error())
|
panic("api start failed " + err.Error())
|
||||||
|
25
cmd/cmdutils/Makefile
Normal file
25
cmd/cmdutils/Makefile
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
.PHONY: all build run gotool install clean help
|
||||||
|
|
||||||
|
BINARY_NAME=open_im_cmd_utils
|
||||||
|
BIN_DIR=../../bin/
|
||||||
|
|
||||||
|
|
||||||
|
all: gotool build
|
||||||
|
|
||||||
|
build:
|
||||||
|
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-w -s"
|
||||||
|
|
||||||
|
run:
|
||||||
|
@go run ./
|
||||||
|
|
||||||
|
gotool:
|
||||||
|
go fmt ./
|
||||||
|
go vet ./
|
||||||
|
|
||||||
|
install:
|
||||||
|
make build
|
||||||
|
mv ${BINARY_NAME} ${BIN_DIR}
|
||||||
|
|
||||||
|
clean:
|
||||||
|
@if [ -f ${BINARY_NAME} ] ; then rm ${BINARY_NAME} ; fi
|
||||||
|
|
@ -1,17 +1,22 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/internal/task"
|
"OpenIM/internal/task"
|
||||||
|
"OpenIM/pkg/common/config"
|
||||||
"flag"
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
var userID = flag.String("userID", "", "userID to clear msg and reset seq")
|
var userID = flag.String("user_id", "", "userID to clear msg and reset seq")
|
||||||
var workingGroupID = flag.String("workingGroupID", "", "workingGroupID to clear msg and reset seq")
|
var superGroupID = flag.String("super_group_id", "", "superGroupID to clear msg and reset seq")
|
||||||
var fixAllSeq = flag.Bool("fixAllSeq", false, "fix seq")
|
var fixAllSeq = flag.Bool("fix_all_seq", false, "fix seq")
|
||||||
|
var configPath = flag.String("config_path", "../config/", "config folder")
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
fmt.Println(time.Now(), "start cronTask", *userID, *workingGroupID)
|
if err := config.InitConfig(*configPath); err != nil {
|
||||||
task.FixSeq(*userID, *workingGroupID, *fixAllSeq)
|
panic(err.Error())
|
||||||
|
}
|
||||||
|
fmt.Println(time.Now(), "start cronTask", *userID, *superGroupID)
|
||||||
|
task.FixSeq(*userID, *superGroupID, *fixAllSeq)
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,20 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/internal/task"
|
"OpenIM/internal/task"
|
||||||
|
"OpenIM/pkg/common/config"
|
||||||
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
fmt.Println(time.Now(), "start cronTask")
|
fmt.Println(time.Now(), "start cronTask")
|
||||||
|
var configPath = flag.String("config_path", "../config/", "config folder")
|
||||||
|
flag.Parse()
|
||||||
|
if err := config.InitConfig(*configPath); err != nil {
|
||||||
|
panic(err.Error())
|
||||||
|
}
|
||||||
if err := task.StartCronTask(); err != nil {
|
if err := task.StartCronTask(); err != nil {
|
||||||
panic(err.Error())
|
panic(err.Error())
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/internal/msggateway"
|
"OpenIM/internal/msggateway"
|
||||||
"Open_IM/pkg/common/config"
|
"OpenIM/pkg/common/config"
|
||||||
"Open_IM/pkg/common/constant"
|
"OpenIM/pkg/common/constant"
|
||||||
"Open_IM/pkg/common/log"
|
"OpenIM/pkg/common/log"
|
||||||
"flag"
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
"sync"
|
"sync"
|
||||||
@ -18,7 +18,11 @@ func main() {
|
|||||||
rpcPort := flag.Int("rpc_port", defaultRpcPorts[0], "rpc listening port")
|
rpcPort := flag.Int("rpc_port", defaultRpcPorts[0], "rpc listening port")
|
||||||
wsPort := flag.Int("ws_port", defaultWsPorts[0], "ws listening port")
|
wsPort := flag.Int("ws_port", defaultWsPorts[0], "ws listening port")
|
||||||
prometheusPort := flag.Int("prometheus_port", defaultPromePorts[0], "PushrometheusPort default listen port")
|
prometheusPort := flag.Int("prometheus_port", defaultPromePorts[0], "PushrometheusPort default listen port")
|
||||||
|
configPath := flag.String("config_path", "../config/", "config folder")
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
if err := config.InitConfig(*configPath); err != nil {
|
||||||
|
panic(err.Error())
|
||||||
|
}
|
||||||
var wg sync.WaitGroup
|
var wg sync.WaitGroup
|
||||||
wg.Add(1)
|
wg.Add(1)
|
||||||
fmt.Println("start rpc/msg_gateway server, port: ", *rpcPort, *wsPort, *prometheusPort, ", OpenIM version: ", constant.CurrentVersion, "\n")
|
fmt.Println("start rpc/msg_gateway server, port: ", *rpcPort, *wsPort, *prometheusPort, ", OpenIM version: ", constant.CurrentVersion, "\n")
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/internal/msgtransfer"
|
"OpenIM/internal/msgtransfer"
|
||||||
"Open_IM/pkg/common/config"
|
"OpenIM/pkg/common/config"
|
||||||
"Open_IM/pkg/common/constant"
|
"OpenIM/pkg/common/constant"
|
||||||
"Open_IM/pkg/common/log"
|
"OpenIM/pkg/common/log"
|
||||||
"flag"
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
"sync"
|
"sync"
|
||||||
@ -14,7 +14,11 @@ func main() {
|
|||||||
var wg sync.WaitGroup
|
var wg sync.WaitGroup
|
||||||
wg.Add(1)
|
wg.Add(1)
|
||||||
prometheusPort := flag.Int("prometheus_port", config.Config.Prometheus.MessageTransferPrometheusPort[0], "MessageTransferPrometheusPort default listen port")
|
prometheusPort := flag.Int("prometheus_port", config.Config.Prometheus.MessageTransferPrometheusPort[0], "MessageTransferPrometheusPort default listen port")
|
||||||
|
configPath := flag.String("config_path", "../config/", "config folder")
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
if err := config.InitConfig(*configPath); err != nil {
|
||||||
|
panic(err.Error())
|
||||||
|
}
|
||||||
log.NewPrivateLog(constant.LogFileName)
|
log.NewPrivateLog(constant.LogFileName)
|
||||||
msgTransfer := msgtransfer.NewMsgTransfer()
|
msgTransfer := msgtransfer.NewMsgTransfer()
|
||||||
fmt.Println("start msg_transfer server ", ", OpenIM version: ", constant.CurrentVersion, "\n")
|
fmt.Println("start msg_transfer server ", ", OpenIM version: ", constant.CurrentVersion, "\n")
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/internal/push"
|
"OpenIM/internal/push"
|
||||||
"Open_IM/pkg/common/config"
|
"OpenIM/pkg/common/config"
|
||||||
"Open_IM/pkg/common/constant"
|
"OpenIM/pkg/common/constant"
|
||||||
"Open_IM/pkg/common/log"
|
"OpenIM/pkg/common/log"
|
||||||
"flag"
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
"sync"
|
"sync"
|
||||||
@ -14,7 +14,11 @@ func main() {
|
|||||||
defaultPorts := config.Config.RpcPort.OpenImPushPort
|
defaultPorts := config.Config.RpcPort.OpenImPushPort
|
||||||
rpcPort := flag.Int("port", defaultPorts[0], "rpc listening port")
|
rpcPort := flag.Int("port", defaultPorts[0], "rpc listening port")
|
||||||
prometheusPort := flag.Int("prometheus_port", config.Config.Prometheus.MessageTransferPrometheusPort[0], "PushrometheusPort default listen port")
|
prometheusPort := flag.Int("prometheus_port", config.Config.Prometheus.MessageTransferPrometheusPort[0], "PushrometheusPort default listen port")
|
||||||
|
configPath := flag.String("config_path", "../config/", "config folder")
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
if err := config.InitConfig(*configPath); err != nil {
|
||||||
|
panic(err.Error())
|
||||||
|
}
|
||||||
var wg sync.WaitGroup
|
var wg sync.WaitGroup
|
||||||
wg.Add(1)
|
wg.Add(1)
|
||||||
log.NewPrivateLog(constant.LogFileName)
|
log.NewPrivateLog(constant.LogFileName)
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/internal/rpc/auth"
|
"OpenIM/internal/rpc/auth"
|
||||||
"Open_IM/internal/startrpc"
|
"OpenIM/internal/startrpc"
|
||||||
"Open_IM/pkg/common/config"
|
"OpenIM/pkg/common/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/internal/rpc/conversation"
|
"OpenIM/internal/rpc/conversation"
|
||||||
"Open_IM/internal/startrpc"
|
"OpenIM/internal/startrpc"
|
||||||
"Open_IM/pkg/common/config"
|
"OpenIM/pkg/common/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/internal/rpc/friend"
|
"OpenIM/internal/rpc/friend"
|
||||||
"Open_IM/internal/startrpc"
|
"OpenIM/internal/startrpc"
|
||||||
"Open_IM/pkg/common/config"
|
"OpenIM/pkg/common/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/internal/rpc/group"
|
"OpenIM/internal/rpc/group"
|
||||||
"Open_IM/internal/startrpc"
|
"OpenIM/internal/startrpc"
|
||||||
"Open_IM/pkg/common/config"
|
"OpenIM/pkg/common/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/internal/rpc/msg"
|
"OpenIM/internal/rpc/msg"
|
||||||
"Open_IM/internal/startrpc"
|
"OpenIM/internal/startrpc"
|
||||||
"Open_IM/pkg/common/config"
|
"OpenIM/pkg/common/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/internal/rpc/user"
|
"OpenIM/internal/rpc/user"
|
||||||
"Open_IM/internal/startrpc"
|
"OpenIM/internal/startrpc"
|
||||||
"Open_IM/pkg/common/config"
|
"OpenIM/pkg/common/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
||||||
startrpc.Start(config.Config.RpcPort.OpenImUserPort[0], config.Config.RpcRegisterName.OpenImUserName, config.Config.Prometheus.UserPrometheusPort[0], user.Start)
|
startrpc.Start(config.Config.RpcPort.OpenImUserPort, config.Config.RpcRegisterName.OpenImUserName, config.Config.Prometheus.UserPrometheusPort[0], user.Start)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,45 +0,0 @@
|
|||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
mongoUtils "Open_IM/cmdutils/mongo"
|
|
||||||
"Open_IM/pkg/common/config"
|
|
||||||
"context"
|
|
||||||
"flag"
|
|
||||||
"fmt"
|
|
||||||
"go.mongodb.org/mongo-driver/mongo"
|
|
||||||
"go.mongodb.org/mongo-driver/mongo/options"
|
|
||||||
)
|
|
||||||
|
|
||||||
func init() {
|
|
||||||
uri := "mongodb://sample.host:27017/?maxPoolSize=20&w=majority"
|
|
||||||
if config.Config.Mongo.DBUri != "" {
|
|
||||||
// example: mongodb://$user:$password@mongo1.mongo:27017,mongo2.mongo:27017,mongo3.mongo:27017/$DBDatabase/?replicaSet=rs0&readPreference=secondary&authSource=admin&maxPoolSize=$DBMaxPoolSize
|
|
||||||
uri = config.Config.Mongo.DBUri
|
|
||||||
} else {
|
|
||||||
if config.Config.Mongo.DBPassword != "" && config.Config.Mongo.DBUserName != "" {
|
|
||||||
uri = fmt.Sprintf("mongodb://%s:%s@%s/%s?maxPoolSize=%d", config.Config.Mongo.DBUserName, config.Config.Mongo.DBPassword, config.Config.Mongo.DBAddress,
|
|
||||||
config.Config.Mongo.DBDatabase, config.Config.Mongo.DBMaxPoolSize)
|
|
||||||
} else {
|
|
||||||
uri = fmt.Sprintf("mongodb://%s/%s/?maxPoolSize=%d",
|
|
||||||
config.Config.Mongo.DBAddress, config.Config.Mongo.DBDatabase,
|
|
||||||
config.Config.Mongo.DBMaxPoolSize)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
var err error
|
|
||||||
mongoUtils.Client, err = mongo.Connect(context.TODO(), options.Client().ApplyURI(uri))
|
|
||||||
if err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
err = mongoUtils.Client.Ping(context.TODO(), nil)
|
|
||||||
if err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
fmt.Println("Connected to MongoDB!")
|
|
||||||
}
|
|
||||||
|
|
||||||
func main() {
|
|
||||||
userID := flag.String("userID", "", "userID")
|
|
||||||
flag.Parse()
|
|
||||||
fmt.Println("userID:", *userID)
|
|
||||||
mongoUtils.GetUserAllChat(*userID)
|
|
||||||
}
|
|
@ -1,59 +0,0 @@
|
|||||||
package mongo
|
|
||||||
|
|
||||||
import (
|
|
||||||
"Open_IM/pkg/common/config"
|
|
||||||
sdkws "Open_IM/pkg/proto/sdkws"
|
|
||||||
"context"
|
|
||||||
"fmt"
|
|
||||||
"github.com/golang/protobuf/proto"
|
|
||||||
"go.mongodb.org/mongo-driver/mongo"
|
|
||||||
"gopkg.in/mgo.v2/bson"
|
|
||||||
"time"
|
|
||||||
)
|
|
||||||
|
|
||||||
var (
|
|
||||||
Client *mongo.Client
|
|
||||||
)
|
|
||||||
|
|
||||||
type MsgInfo struct {
|
|
||||||
SendTime int64
|
|
||||||
Msg []byte
|
|
||||||
}
|
|
||||||
|
|
||||||
type UserChat struct {
|
|
||||||
UID string
|
|
||||||
Msg []MsgInfo
|
|
||||||
}
|
|
||||||
|
|
||||||
func GetUserAllChat(uid string) {
|
|
||||||
ctx, _ := context.WithTimeout(context.Background(), time.Duration(config.Config.Mongo.DBTimeout)*time.Second)
|
|
||||||
collection := Client.Database(config.Config.Mongo.DBDatabase).Collection("msg")
|
|
||||||
var userChatList []UserChat
|
|
||||||
uid = uid + ":"
|
|
||||||
filter := bson.M{"uid": bson.M{"$regex": uid}}
|
|
||||||
//filter := bson.M{"uid": "17726378428:0"}
|
|
||||||
result, err := collection.Find(context.Background(), filter)
|
|
||||||
if err != nil {
|
|
||||||
fmt.Println("find error", err.Error())
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if err := result.All(ctx, &userChatList); err != nil {
|
|
||||||
fmt.Println(err.Error())
|
|
||||||
}
|
|
||||||
for _, userChat := range userChatList {
|
|
||||||
for _, msg := range userChat.Msg {
|
|
||||||
msgData := &sdkws.MsgData{}
|
|
||||||
err := proto.Unmarshal(msg.Msg, msgData)
|
|
||||||
if err != nil {
|
|
||||||
fmt.Println(err.Error(), msg)
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
fmt.Println("seq: ", msgData.Seq, "status: ", msgData.Status,
|
|
||||||
"sendID: ", msgData.SendID, "recvID: ", msgData.RecvID,
|
|
||||||
"sendTime: ", msgData.SendTime,
|
|
||||||
"clientMsgID: ", msgData.ClientMsgID,
|
|
||||||
"serverMsgID: ", msgData.ServerMsgID,
|
|
||||||
"content: ", string(msgData.Content))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -11,8 +11,8 @@ zookeeper:
|
|||||||
|
|
||||||
mysql:
|
mysql:
|
||||||
dbMysqlAddress: [ 127.0.0.1:13306 ] #mysql地址 目前仅支持单机,默认即可
|
dbMysqlAddress: [ 127.0.0.1:13306 ] #mysql地址 目前仅支持单机,默认即可
|
||||||
dbMysqlUserName: #mysql用户名,建议修改
|
dbMysqlUserName: root #mysql用户名,建议修改
|
||||||
dbMysqlPassword: # mysql密码,建议修改
|
dbMysqlPassword: openIM123 # mysql密码,建议修改
|
||||||
dbMysqlDatabaseName: openIM_v2 #默认即可
|
dbMysqlDatabaseName: openIM_v2 #默认即可
|
||||||
dbTableName: eMsg #默认即可
|
dbTableName: eMsg #默认即可
|
||||||
dbMsgTableNum: 1
|
dbMsgTableNum: 1
|
||||||
@ -30,8 +30,8 @@ mongo:
|
|||||||
dbTimeout: 60
|
dbTimeout: 60
|
||||||
dbDatabase: openIM #mongo db 默认即可
|
dbDatabase: openIM #mongo db 默认即可
|
||||||
dbSource: admin
|
dbSource: admin
|
||||||
dbUserName: #mongo用户名,建议先不设置
|
dbUserName: root #mongo用户名,建议先不设置
|
||||||
dbPassword: #mongo密码,建议先不设置
|
dbPassword: openIM123 #mongo密码,建议先不设置
|
||||||
dbMaxPoolSize: 100
|
dbMaxPoolSize: 100
|
||||||
dbRetainChatRecords: 3650 #mongo保存离线消息时间(天),根据需求修改
|
dbRetainChatRecords: 3650 #mongo保存离线消息时间(天),根据需求修改
|
||||||
chatRecordsClearTime: "* * * * *" # 每天凌晨3点清除消息,该配置和linux定时任务一样, 清理操作建议设置在用户活跃少的时候 # 0 3 * * *
|
chatRecordsClearTime: "* * * * *" # 每天凌晨3点清除消息,该配置和linux定时任务一样, 清理操作建议设置在用户活跃少的时候 # 0 3 * * *
|
||||||
@ -42,7 +42,7 @@ redis:
|
|||||||
dbMaxActive: 0
|
dbMaxActive: 0
|
||||||
dbIdleTimeout: 120
|
dbIdleTimeout: 120
|
||||||
dbUserName: #only redis version 6.0+ need username
|
dbUserName: #only redis version 6.0+ need username
|
||||||
dbPassWord: #redis密码 建议修改
|
dbPassWord: openIM123 #redis密码 建议修改
|
||||||
enableCluster: false #如果外部redis以集群方式启动,需要打开此开关
|
enableCluster: false #如果外部redis以集群方式启动,需要打开此开关
|
||||||
|
|
||||||
kafka:
|
kafka:
|
||||||
@ -113,11 +113,11 @@ credential: #腾讯cos,发送图片、视频、文件时需要,请自行申
|
|||||||
bucket: openim # 存储内容桶
|
bucket: openim # 存储内容桶
|
||||||
appBucket: app # 存储app的桶
|
appBucket: app # 存储app的桶
|
||||||
location: us-east-1
|
location: us-east-1
|
||||||
endpoint: #minio外网ip 这个ip是给客户端访问的
|
endpoint: http://127.0.0.1:10005 #minio外网ip 这个ip是给客户端访问的
|
||||||
endpointInner: http://127.0.0.1:10005 #minio内网地址 如果im server 可以通过内网访问到 minio就可以
|
endpointInner: http://127.0.0.1:10005 #minio内网地址 如果im server 可以通过内网访问到 minio就可以
|
||||||
endpointInnerEnable: true #是否启用minio内网地址 启用可以让桶初始化,IM server连接minio走内网地址访问
|
endpointInnerEnable: true #是否启用minio内网地址 启用可以让桶初始化,IM server连接minio走内网地址访问
|
||||||
accessKeyID:
|
accessKeyID: root
|
||||||
secretAccessKey:
|
secretAccessKey: openIM123
|
||||||
storageTime: 50 #文件在minio中保存的时间
|
storageTime: 50 #文件在minio中保存的时间
|
||||||
isDistributedMod: false # 是否分布式多硬盘部署 默认docker-compose中为false
|
isDistributedMod: false # 是否分布式多硬盘部署 默认docker-compose中为false
|
||||||
ali: # ali oss
|
ali: # ali oss
|
||||||
@ -203,11 +203,11 @@ push:
|
|||||||
pushIntent:
|
pushIntent:
|
||||||
enable: false # true or false (bool)
|
enable: false # true or false (bool)
|
||||||
getui: #个推推送
|
getui: #个推推送
|
||||||
pushUrl:
|
pushUrl: "https://restapi.getui.com/v2/$appId"
|
||||||
masterSecret: ""
|
masterSecret: ""
|
||||||
appKey: ""
|
appKey: ""
|
||||||
intent: ""
|
intent: ""
|
||||||
enable: # true or false (bool)
|
enable: false # true or false (bool)
|
||||||
channelID: ""
|
channelID: ""
|
||||||
channelName: ""
|
channelName: ""
|
||||||
fcm: #firebase cloud message 消息推送
|
fcm: #firebase cloud message 消息推送
|
||||||
@ -220,7 +220,7 @@ manager:
|
|||||||
secrets: [ "openIM1","openIM2", "openIM333", "openIMAdmin"]
|
secrets: [ "openIM1","openIM2", "openIM333", "openIMAdmin"]
|
||||||
appSysNotificationName: "系统通知"
|
appSysNotificationName: "系统通知"
|
||||||
|
|
||||||
secret:
|
secret: tuoyun
|
||||||
# 多端互踢策略
|
# 多端互踢策略
|
||||||
# 1:多平台登录:Android、iOS、Windows、Mac 每种平台只能一个在线,web端可以多个同时在线
|
# 1:多平台登录:Android、iOS、Windows、Mac 每种平台只能一个在线,web端可以多个同时在线
|
||||||
multiloginpolicy: 1
|
multiloginpolicy: 1
|
||||||
@ -236,11 +236,11 @@ singleMessageHasReadReceiptEnable: true
|
|||||||
|
|
||||||
#token config
|
#token config
|
||||||
tokenpolicy:
|
tokenpolicy:
|
||||||
accessSecret: #token生成相关,默认即可
|
accessSecret: "OpenIM_server" #token生成相关,默认即可
|
||||||
# Token effective time day as a unit
|
# Token effective time day as a unit
|
||||||
accessExpire: #token过期时间(天) 默认即可
|
accessExpire: 90 #token过期时间(天) 默认即可
|
||||||
messageverify:
|
messageverify:
|
||||||
friendVerify:
|
friendVerify: false
|
||||||
|
|
||||||
#ios系统推送声音以及标记计数
|
#ios系统推送声音以及标记计数
|
||||||
iospush:
|
iospush:
|
||||||
|
@ -1,43 +0,0 @@
|
|||||||
etcd:
|
|
||||||
userName:
|
|
||||||
password:
|
|
||||||
secret: openIM123 # etcd 配置密钥
|
|
||||||
|
|
||||||
mysql:
|
|
||||||
dbMysqlUserName: root #mysql用户名
|
|
||||||
dbMysqlPassword: openIM123 # mysql密码
|
|
||||||
|
|
||||||
mongo:
|
|
||||||
dbUserName: root #mongo用户名
|
|
||||||
dbPassword: openIM123 #mongo密码
|
|
||||||
|
|
||||||
redis:
|
|
||||||
dbUserName:
|
|
||||||
dbPassWord: openIM123 #redis密码
|
|
||||||
|
|
||||||
kafka:
|
|
||||||
SASLUserName:
|
|
||||||
SASLPassword:
|
|
||||||
|
|
||||||
credential:
|
|
||||||
minio:
|
|
||||||
endpoint: http://127.0.0.1:10005 #发图片视频文件需要填写
|
|
||||||
accessKeyID: root
|
|
||||||
secretAccessKey: openIM123
|
|
||||||
|
|
||||||
secret: tuoyun #建议修改
|
|
||||||
|
|
||||||
tokenpolicy:
|
|
||||||
accessSecret: "open_im_server" #token生成相关 建议修改
|
|
||||||
accessExpire: 90 #token过期时间(天) 默认即可
|
|
||||||
|
|
||||||
messageverify:
|
|
||||||
friendVerify: false #发送消息是否验证好友关系 false表示不验证好友关系
|
|
||||||
|
|
||||||
push:
|
|
||||||
getui:
|
|
||||||
pushUrl: "https://restapi.getui.com/v2/$appId"
|
|
||||||
masterSecret: "" #需添加
|
|
||||||
appKey: "" #需添加
|
|
||||||
enable: false #true启动个推推送
|
|
||||||
|
|
@ -8,8 +8,8 @@ service=(
|
|||||||
group
|
group
|
||||||
auth
|
auth
|
||||||
conversation
|
conversation
|
||||||
msggateway
|
msg_gateway
|
||||||
msgtransfer
|
msg_transfer
|
||||||
msg
|
msg
|
||||||
push
|
push
|
||||||
)
|
)
|
@ -1,14 +1,14 @@
|
|||||||
package apiAuth
|
package apiAuth
|
||||||
|
|
||||||
import (
|
import (
|
||||||
api "Open_IM/pkg/apistruct"
|
api "OpenIM/pkg/apistruct"
|
||||||
"Open_IM/pkg/common/config"
|
"OpenIM/pkg/common/config"
|
||||||
"Open_IM/pkg/common/constant"
|
"OpenIM/pkg/common/constant"
|
||||||
"Open_IM/pkg/common/log"
|
"OpenIM/pkg/common/log"
|
||||||
"Open_IM/pkg/common/tokenverify"
|
"OpenIM/pkg/common/tokenverify"
|
||||||
rpc "Open_IM/pkg/proto/auth"
|
rpc "OpenIM/pkg/proto/auth"
|
||||||
sdkws "Open_IM/pkg/proto/sdkws"
|
sdkws "OpenIM/pkg/proto/sdkws"
|
||||||
"Open_IM/pkg/utils"
|
"OpenIM/pkg/utils"
|
||||||
"context"
|
"context"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
package conversation
|
package conversation
|
||||||
|
|
||||||
import (
|
import (
|
||||||
api "Open_IM/pkg/apistruct"
|
api "OpenIM/pkg/apistruct"
|
||||||
"Open_IM/pkg/common/config"
|
"OpenIM/pkg/common/config"
|
||||||
"Open_IM/pkg/common/log"
|
"OpenIM/pkg/common/log"
|
||||||
pbConversation "Open_IM/pkg/proto/conversation"
|
pbConversation "OpenIM/pkg/proto/conversation"
|
||||||
pbUser "Open_IM/pkg/proto/user"
|
pbUser "OpenIM/pkg/proto/user"
|
||||||
"Open_IM/pkg/utils"
|
"OpenIM/pkg/utils"
|
||||||
"context"
|
"context"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
package friend
|
package friend
|
||||||
|
|
||||||
//import (
|
//import (
|
||||||
// jsonData "Open_IM/internal/utils"
|
// jsonData "OpenIM/internal/utils"
|
||||||
// api "Open_IM/pkg/apistruct"
|
// api "OpenIM/pkg/apistruct"
|
||||||
// "Open_IM/pkg/common/config"
|
// "OpenIM/pkg/common/config"
|
||||||
// "Open_IM/pkg/common/log"
|
// "OpenIM/pkg/common/log"
|
||||||
// "Open_IM/pkg/common/tokenverify"
|
// "OpenIM/pkg/common/tokenverify"
|
||||||
// "Open_IM/pkg/getcdv3"
|
// "OpenIM/pkg/getcdv3"
|
||||||
// rpc "Open_IM/pkg/proto/friend"
|
// rpc "OpenIM/pkg/proto/friend"
|
||||||
// sdkws "Open_IM/pkg/proto/sdkws"
|
// sdkws "OpenIM/pkg/proto/sdkws"
|
||||||
// "Open_IM/pkg/utils"
|
// "OpenIM/pkg/utils"
|
||||||
// "context"
|
// "context"
|
||||||
// "github.com/gin-gonic/gin"
|
// "github.com/gin-gonic/gin"
|
||||||
// "net/http"
|
// "net/http"
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
package friend
|
package friend
|
||||||
|
|
||||||
import (
|
import (
|
||||||
common "Open_IM/internal/api2rpc"
|
common "OpenIM/internal/api2rpc"
|
||||||
api "Open_IM/pkg/apistruct"
|
api "OpenIM/pkg/apistruct"
|
||||||
"Open_IM/pkg/common/config"
|
"OpenIM/pkg/common/config"
|
||||||
rpc "Open_IM/pkg/proto/friend"
|
rpc "OpenIM/pkg/proto/friend"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -1,16 +1,16 @@
|
|||||||
package group
|
package group
|
||||||
|
|
||||||
//import (
|
//import (
|
||||||
// common "Open_IM/internal/api_to_rpc"
|
// common "OpenIM/internal/api_to_rpc"
|
||||||
// api "Open_IM/pkg/apistruct"
|
// api "OpenIM/pkg/apistruct"
|
||||||
// "Open_IM/pkg/common/config"
|
// "OpenIM/pkg/common/config"
|
||||||
// "Open_IM/pkg/common/constant"
|
// "OpenIM/pkg/common/constant"
|
||||||
// "Open_IM/pkg/common/log"
|
// "OpenIM/pkg/common/log"
|
||||||
// "Open_IM/pkg/common/token_verify"
|
// "OpenIM/pkg/common/token_verify"
|
||||||
// "Open_IM/pkg/common/tracelog"
|
// "OpenIM/pkg/common/tracelog"
|
||||||
// "Open_IM/pkg/getcdv3"
|
// "OpenIM/pkg/getcdv3"
|
||||||
// rpc "Open_IM/pkg/proto/group"
|
// rpc "OpenIM/pkg/proto/group"
|
||||||
// "Open_IM/pkg/utils"
|
// "OpenIM/pkg/utils"
|
||||||
// "context"
|
// "context"
|
||||||
// "github.com/golang/protobuf/ptypes/wrappers"
|
// "github.com/golang/protobuf/ptypes/wrappers"
|
||||||
// "google.golang.org/grpc"
|
// "google.golang.org/grpc"
|
||||||
@ -20,7 +20,7 @@ package group
|
|||||||
// "net/http"
|
// "net/http"
|
||||||
// "strings"
|
// "strings"
|
||||||
//
|
//
|
||||||
// jsonData "Open_IM/internal/utils"
|
// jsonData "OpenIM/internal/utils"
|
||||||
//)
|
//)
|
||||||
|
|
||||||
// @Summary 把用户踢出群组
|
// @Summary 把用户踢出群组
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package group
|
package group
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/pkg/apistruct"
|
"OpenIM/pkg/apistruct"
|
||||||
"Open_IM/pkg/proto/group"
|
"OpenIM/pkg/proto/group"
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
package group
|
package group
|
||||||
|
|
||||||
//import (
|
//import (
|
||||||
// jsonData "Open_IM/internal/utils"
|
// jsonData "OpenIM/internal/utils"
|
||||||
// api "Open_IM/pkg/apistruct"
|
// api "OpenIM/pkg/apistruct"
|
||||||
// "Open_IM/pkg/common/config"
|
// "OpenIM/pkg/common/config"
|
||||||
// "Open_IM/pkg/common/log"
|
// "OpenIM/pkg/common/log"
|
||||||
// "Open_IM/pkg/common/token_verify"
|
// "OpenIM/pkg/common/token_verify"
|
||||||
// "Open_IM/pkg/getcdv3"
|
// "OpenIM/pkg/getcdv3"
|
||||||
// rpc "Open_IM/pkg/proto/group"
|
// rpc "OpenIM/pkg/proto/group"
|
||||||
// "Open_IM/pkg/utils"
|
// "OpenIM/pkg/utils"
|
||||||
// "context"
|
// "context"
|
||||||
// "github.com/gin-gonic/gin"
|
// "github.com/gin-gonic/gin"
|
||||||
// "net/http"
|
// "net/http"
|
||||||
|
@ -7,14 +7,14 @@
|
|||||||
package manage
|
package manage
|
||||||
|
|
||||||
import (
|
import (
|
||||||
api "Open_IM/pkg/apistruct"
|
api "OpenIM/pkg/apistruct"
|
||||||
"Open_IM/pkg/common/config"
|
"OpenIM/pkg/common/config"
|
||||||
"Open_IM/pkg/common/constant"
|
"OpenIM/pkg/common/constant"
|
||||||
"Open_IM/pkg/common/log"
|
"OpenIM/pkg/common/log"
|
||||||
"Open_IM/pkg/common/tokenverify"
|
"OpenIM/pkg/common/tokenverify"
|
||||||
pbChat "Open_IM/pkg/proto/msg"
|
pbChat "OpenIM/pkg/proto/msg"
|
||||||
sdkws "Open_IM/pkg/proto/sdkws"
|
sdkws "OpenIM/pkg/proto/sdkws"
|
||||||
"Open_IM/pkg/utils"
|
"OpenIM/pkg/utils"
|
||||||
"context"
|
"context"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
|
@ -7,14 +7,14 @@
|
|||||||
package manage
|
package manage
|
||||||
|
|
||||||
import (
|
import (
|
||||||
api "Open_IM/pkg/apistruct"
|
api "OpenIM/pkg/apistruct"
|
||||||
"Open_IM/pkg/common/config"
|
"OpenIM/pkg/common/config"
|
||||||
"Open_IM/pkg/common/constant"
|
"OpenIM/pkg/common/constant"
|
||||||
"Open_IM/pkg/common/log"
|
"OpenIM/pkg/common/log"
|
||||||
"Open_IM/pkg/common/tokenverify"
|
"OpenIM/pkg/common/tokenverify"
|
||||||
pbRelay "Open_IM/pkg/proto/relay"
|
pbRelay "OpenIM/pkg/proto/relay"
|
||||||
rpc "Open_IM/pkg/proto/user"
|
rpc "OpenIM/pkg/proto/user"
|
||||||
"Open_IM/pkg/utils"
|
"OpenIM/pkg/utils"
|
||||||
"context"
|
"context"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
package msg
|
package msg
|
||||||
|
|
||||||
import (
|
import (
|
||||||
api "Open_IM/pkg/apistruct"
|
api "OpenIM/pkg/apistruct"
|
||||||
"Open_IM/pkg/common/config"
|
"OpenIM/pkg/common/config"
|
||||||
"Open_IM/pkg/common/constant"
|
"OpenIM/pkg/common/constant"
|
||||||
"Open_IM/pkg/common/log"
|
"OpenIM/pkg/common/log"
|
||||||
"Open_IM/pkg/common/tokenverify"
|
"OpenIM/pkg/common/tokenverify"
|
||||||
rpc "Open_IM/pkg/proto/msg"
|
rpc "OpenIM/pkg/proto/msg"
|
||||||
pbCommon "Open_IM/pkg/proto/sdkws"
|
pbCommon "OpenIM/pkg/proto/sdkws"
|
||||||
"Open_IM/pkg/utils"
|
"OpenIM/pkg/utils"
|
||||||
"context"
|
"context"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"github.com/golang/protobuf/proto"
|
"github.com/golang/protobuf/proto"
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
package msg
|
package msg
|
||||||
|
|
||||||
import (
|
import (
|
||||||
api "Open_IM/pkg/apistruct"
|
api "OpenIM/pkg/apistruct"
|
||||||
"Open_IM/pkg/common/config"
|
"OpenIM/pkg/common/config"
|
||||||
"Open_IM/pkg/common/constant"
|
"OpenIM/pkg/common/constant"
|
||||||
"Open_IM/pkg/common/log"
|
"OpenIM/pkg/common/log"
|
||||||
"Open_IM/pkg/common/tokenverify"
|
"OpenIM/pkg/common/tokenverify"
|
||||||
rpc "Open_IM/pkg/proto/msg"
|
rpc "OpenIM/pkg/proto/msg"
|
||||||
"Open_IM/pkg/utils"
|
"OpenIM/pkg/utils"
|
||||||
"context"
|
"context"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
package msg
|
package msg
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/pkg/common/config"
|
"OpenIM/pkg/common/config"
|
||||||
"Open_IM/pkg/common/log"
|
"OpenIM/pkg/common/log"
|
||||||
"Open_IM/pkg/common/tokenverify"
|
"OpenIM/pkg/common/tokenverify"
|
||||||
pbChat "Open_IM/pkg/proto/msg"
|
pbChat "OpenIM/pkg/proto/msg"
|
||||||
sdkws "Open_IM/pkg/proto/sdkws"
|
sdkws "OpenIM/pkg/proto/sdkws"
|
||||||
"context"
|
"context"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
package msg
|
package msg
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/pkg/common/config"
|
"OpenIM/pkg/common/config"
|
||||||
"Open_IM/pkg/common/log"
|
"OpenIM/pkg/common/log"
|
||||||
"Open_IM/pkg/common/tokenverify"
|
"OpenIM/pkg/common/tokenverify"
|
||||||
"Open_IM/pkg/proto/msg"
|
"OpenIM/pkg/proto/msg"
|
||||||
sdkws "Open_IM/pkg/proto/sdkws"
|
sdkws "OpenIM/pkg/proto/sdkws"
|
||||||
"Open_IM/pkg/utils"
|
"OpenIM/pkg/utils"
|
||||||
"context"
|
"context"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
package msg
|
package msg
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/pkg/common/config"
|
"OpenIM/pkg/common/config"
|
||||||
"Open_IM/pkg/common/log"
|
"OpenIM/pkg/common/log"
|
||||||
pbChat "Open_IM/pkg/proto/msg"
|
pbChat "OpenIM/pkg/proto/msg"
|
||||||
sdkws "Open_IM/pkg/proto/sdkws"
|
sdkws "OpenIM/pkg/proto/sdkws"
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
|
169
internal/api/route.go
Normal file
169
internal/api/route.go
Normal file
@ -0,0 +1,169 @@
|
|||||||
|
package api
|
||||||
|
|
||||||
|
import (
|
||||||
|
"OpenIM/internal/api/auth"
|
||||||
|
"OpenIM/internal/api/conversation"
|
||||||
|
"OpenIM/internal/api/friend"
|
||||||
|
"OpenIM/internal/api/group"
|
||||||
|
"OpenIM/internal/api/manage"
|
||||||
|
"OpenIM/internal/api/msg"
|
||||||
|
"OpenIM/internal/api/third"
|
||||||
|
"OpenIM/internal/api/user"
|
||||||
|
"OpenIM/pkg/common/config"
|
||||||
|
"OpenIM/pkg/common/log"
|
||||||
|
"OpenIM/pkg/common/middleware"
|
||||||
|
"OpenIM/pkg/common/prome"
|
||||||
|
"OpenIM/pkg/common/tokenverify"
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
|
"io"
|
||||||
|
"os"
|
||||||
|
)
|
||||||
|
|
||||||
|
func NewGinRouter() *gin.Engine {
|
||||||
|
gin.SetMode(gin.ReleaseMode)
|
||||||
|
f, _ := os.Create("../logs/api.log")
|
||||||
|
gin.DefaultWriter = io.MultiWriter(f)
|
||||||
|
// gin.SetMode(gin.DebugMode)
|
||||||
|
r := gin.New()
|
||||||
|
r.Use(gin.Recovery())
|
||||||
|
r.Use(middleware.GinParseOperationID)
|
||||||
|
log.Info("load config: ", config.Config)
|
||||||
|
if config.Config.Prometheus.Enable {
|
||||||
|
prome.NewApiRequestCounter()
|
||||||
|
prome.NewApiRequestFailedCounter()
|
||||||
|
prome.NewApiRequestSuccessCounter()
|
||||||
|
r.Use(prome.PrometheusMiddleware)
|
||||||
|
r.GET("/metrics", prome.PrometheusHandler())
|
||||||
|
}
|
||||||
|
userRouterGroup := r.Group("/user")
|
||||||
|
{
|
||||||
|
userRouterGroup.POST("/update_user_info", user.UpdateUserInfo) //1
|
||||||
|
userRouterGroup.POST("/set_global_msg_recv_opt", user.SetGlobalRecvMessageOpt)
|
||||||
|
userRouterGroup.POST("/get_users_info", user.GetUsersPublicInfo) //1
|
||||||
|
userRouterGroup.POST("/get_self_user_info", user.GetSelfUserInfo) //1
|
||||||
|
userRouterGroup.POST("/get_users_online_status", user.GetUsersOnlineStatus) //1
|
||||||
|
userRouterGroup.POST("/get_users_info_from_cache", user.GetUsersInfoFromCache)
|
||||||
|
userRouterGroup.POST("/get_user_friend_from_cache", user.GetFriendIDListFromCache)
|
||||||
|
userRouterGroup.POST("/get_black_list_from_cache", user.GetBlackIDListFromCache)
|
||||||
|
userRouterGroup.POST("/get_all_users_uid", manage.GetAllUsersUid) //1
|
||||||
|
userRouterGroup.POST("/account_check", manage.AccountCheck) //1
|
||||||
|
// userRouterGroup.POST("/get_users_online_status", manage.GetUsersOnlineStatus) //1
|
||||||
|
userRouterGroup.POST("/get_users", user.GetUsers)
|
||||||
|
}
|
||||||
|
////friend routing group
|
||||||
|
friendRouterGroup := r.Group("/friend")
|
||||||
|
{
|
||||||
|
// friendRouterGroup.POST("/get_friends_info", friend.GetFriendsInfo)
|
||||||
|
friendRouterGroup.POST("/add_friend", friend.AddFriend) //1
|
||||||
|
friendRouterGroup.POST("/delete_friend", friend.DeleteFriend) //1
|
||||||
|
friendRouterGroup.POST("/get_friend_apply_list", friend.GetFriendApplyList) //1
|
||||||
|
friendRouterGroup.POST("/get_self_friend_apply_list", friend.GetSelfApplyList) //1
|
||||||
|
friendRouterGroup.POST("/get_friend_list", friend.GetFriendList) //1
|
||||||
|
friendRouterGroup.POST("/add_friend_response", friend.AddFriendResponse) //1
|
||||||
|
friendRouterGroup.POST("/set_friend_remark", friend.SetFriendRemark) //1
|
||||||
|
|
||||||
|
friendRouterGroup.POST("/add_black", friend.AddBlack) //1
|
||||||
|
friendRouterGroup.POST("/get_black_list", friend.GetBlacklist) //1
|
||||||
|
friendRouterGroup.POST("/remove_black", friend.RemoveBlacklist) //1
|
||||||
|
|
||||||
|
friendRouterGroup.POST("/import_friend", friend.ImportFriend) //1
|
||||||
|
friendRouterGroup.POST("/is_friend", friend.IsFriend) //1
|
||||||
|
}
|
||||||
|
//group related routing group
|
||||||
|
groupRouterGroup := r.Group("/group")
|
||||||
|
groupRouterGroup.Use(func(c *gin.Context) {
|
||||||
|
userID, err := tokenverify.ParseUserIDFromToken(c.GetHeader("token"), c.GetString("operationID"))
|
||||||
|
if err != nil {
|
||||||
|
c.String(400, err.Error())
|
||||||
|
c.Abort()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
c.Set("opUserID", userID)
|
||||||
|
c.Next()
|
||||||
|
})
|
||||||
|
{
|
||||||
|
groupRouterGroup.POST("/create_group", group.NewCreateGroup) //1
|
||||||
|
groupRouterGroup.POST("/set_group_info", group.NewSetGroupInfo) //1
|
||||||
|
groupRouterGroup.POST("/join_group", group.JoinGroup) //1
|
||||||
|
groupRouterGroup.POST("/quit_group", group.QuitGroup) //1
|
||||||
|
groupRouterGroup.POST("/group_application_response", group.ApplicationGroupResponse) //1
|
||||||
|
groupRouterGroup.POST("/transfer_group", group.TransferGroupOwner) //1
|
||||||
|
groupRouterGroup.POST("/get_recv_group_applicationList", group.GetRecvGroupApplicationList) //1
|
||||||
|
groupRouterGroup.POST("/get_user_req_group_applicationList", group.GetUserReqGroupApplicationList)
|
||||||
|
groupRouterGroup.POST("/get_groups_info", group.GetGroupsInfo) //1
|
||||||
|
groupRouterGroup.POST("/kick_group", group.KickGroupMember) //1
|
||||||
|
// groupRouterGroup.POST("/get_group_member_list", group.FindGroupMemberAll) //no use
|
||||||
|
groupRouterGroup.POST("/get_group_all_member_list", group.GetGroupAllMemberList) //1
|
||||||
|
groupRouterGroup.POST("/get_group_members_info", group.GetGroupMembersInfo) //1
|
||||||
|
groupRouterGroup.POST("/invite_user_to_group", group.InviteUserToGroup) //1
|
||||||
|
groupRouterGroup.POST("/get_joined_group_list", group.GetJoinedGroupList)
|
||||||
|
groupRouterGroup.POST("/dismiss_group", group.DismissGroup) //
|
||||||
|
groupRouterGroup.POST("/mute_group_member", group.MuteGroupMember)
|
||||||
|
groupRouterGroup.POST("/cancel_mute_group_member", group.CancelMuteGroupMember) //MuteGroup
|
||||||
|
groupRouterGroup.POST("/mute_group", group.MuteGroup)
|
||||||
|
groupRouterGroup.POST("/cancel_mute_group", group.CancelMuteGroup)
|
||||||
|
groupRouterGroup.POST("/set_group_member_nickname", group.SetGroupMemberNickname)
|
||||||
|
groupRouterGroup.POST("/set_group_member_info", group.SetGroupMemberInfo)
|
||||||
|
groupRouterGroup.POST("/get_group_abstract_info", group.GetGroupAbstractInfo)
|
||||||
|
//groupRouterGroup.POST("/get_group_all_member_list_by_split", group.GetGroupAllMemberListBySplit)
|
||||||
|
}
|
||||||
|
superGroupRouterGroup := r.Group("/super_group")
|
||||||
|
{
|
||||||
|
superGroupRouterGroup.POST("/get_joined_group_list", group.GetJoinedSuperGroupList)
|
||||||
|
superGroupRouterGroup.POST("/get_groups_info", group.GetSuperGroupsInfo)
|
||||||
|
}
|
||||||
|
////certificate
|
||||||
|
authRouterGroup := r.Group("/auth")
|
||||||
|
{
|
||||||
|
authRouterGroup.POST("/user_register", apiAuth.UserRegister) //1
|
||||||
|
authRouterGroup.POST("/user_token", apiAuth.UserToken) //1
|
||||||
|
authRouterGroup.POST("/parse_token", apiAuth.ParseToken) //1
|
||||||
|
authRouterGroup.POST("/force_logout", apiAuth.ForceLogout) //1
|
||||||
|
}
|
||||||
|
////Third service
|
||||||
|
thirdGroup := r.Group("/third")
|
||||||
|
{
|
||||||
|
thirdGroup.POST("/tencent_cloud_storage_credential", third.TencentCloudStorageCredential)
|
||||||
|
thirdGroup.POST("/ali_oss_credential", third.AliOSSCredential)
|
||||||
|
thirdGroup.POST("/minio_storage_credential", third.MinioStorageCredential)
|
||||||
|
thirdGroup.POST("/minio_upload", third.MinioUploadFile)
|
||||||
|
thirdGroup.POST("/upload_update_app", third.UploadUpdateApp)
|
||||||
|
thirdGroup.POST("/get_download_url", third.GetDownloadURL)
|
||||||
|
thirdGroup.POST("/get_rtc_invitation_info", third.GetRTCInvitationInfo)
|
||||||
|
thirdGroup.POST("/get_rtc_invitation_start_app", third.GetRTCInvitationInfoStartApp)
|
||||||
|
thirdGroup.POST("/fcm_update_token", third.FcmUpdateToken)
|
||||||
|
thirdGroup.POST("/aws_storage_credential", third.AwsStorageCredential)
|
||||||
|
thirdGroup.POST("/set_app_badge", third.SetAppBadge)
|
||||||
|
}
|
||||||
|
////Message
|
||||||
|
chatGroup := r.Group("/msg")
|
||||||
|
{
|
||||||
|
chatGroup.POST("/newest_seq", msg.GetSeq)
|
||||||
|
chatGroup.POST("/send_msg", msg.SendMsg)
|
||||||
|
chatGroup.POST("/pull_msg_by_seq", msg.PullMsgBySeqList)
|
||||||
|
chatGroup.POST("/del_msg", msg.DelMsg)
|
||||||
|
chatGroup.POST("/del_super_group_msg", msg.DelSuperGroupMsg)
|
||||||
|
chatGroup.POST("/clear_msg", msg.ClearMsg)
|
||||||
|
chatGroup.POST("/manage_send_msg", manage.ManagementSendMsg)
|
||||||
|
chatGroup.POST("/batch_send_msg", manage.ManagementBatchSendMsg)
|
||||||
|
chatGroup.POST("/check_msg_is_send_success", manage.CheckMsgIsSendSuccess)
|
||||||
|
chatGroup.POST("/set_msg_min_seq", msg.SetMsgMinSeq)
|
||||||
|
|
||||||
|
chatGroup.POST("/set_message_reaction_extensions", msg.SetMessageReactionExtensions)
|
||||||
|
chatGroup.POST("/get_message_list_reaction_extensions", msg.GetMessageListReactionExtensions)
|
||||||
|
chatGroup.POST("/add_message_reaction_extensions", msg.AddMessageReactionExtensions)
|
||||||
|
chatGroup.POST("/delete_message_reaction_extensions", msg.DeleteMessageReactionExtensions)
|
||||||
|
}
|
||||||
|
////Conversation
|
||||||
|
conversationGroup := r.Group("/conversation")
|
||||||
|
{ //1
|
||||||
|
conversationGroup.POST("/get_all_conversations", conversation.GetAllConversations)
|
||||||
|
conversationGroup.POST("/get_conversation", conversation.GetConversation)
|
||||||
|
conversationGroup.POST("/get_conversations", conversation.GetConversations)
|
||||||
|
conversationGroup.POST("/set_conversation", conversation.SetConversation)
|
||||||
|
conversationGroup.POST("/batch_set_conversation", conversation.BatchSetConversations)
|
||||||
|
conversationGroup.POST("/set_recv_msg_opt", conversation.SetRecvMsgOpt)
|
||||||
|
conversationGroup.POST("/modify_conversation_field", conversation.ModifyConversationField)
|
||||||
|
}
|
||||||
|
return r
|
||||||
|
}
|
@ -1,11 +1,11 @@
|
|||||||
package apiThird
|
package third
|
||||||
|
|
||||||
import (
|
import (
|
||||||
api "Open_IM/pkg/apistruct"
|
api "OpenIM/pkg/apistruct"
|
||||||
"Open_IM/pkg/common/config"
|
"OpenIM/pkg/common/config"
|
||||||
"Open_IM/pkg/common/constant"
|
"OpenIM/pkg/common/constant"
|
||||||
"Open_IM/pkg/common/log"
|
"OpenIM/pkg/common/log"
|
||||||
"Open_IM/pkg/common/tokenverify"
|
"OpenIM/pkg/common/tokenverify"
|
||||||
"fmt"
|
"fmt"
|
||||||
openapi "github.com/alibabacloud-go/darabonba-openapi/client"
|
openapi "github.com/alibabacloud-go/darabonba-openapi/client"
|
||||||
sts20150401 "github.com/alibabacloud-go/sts-20150401/client"
|
sts20150401 "github.com/alibabacloud-go/sts-20150401/client"
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
package apiThird
|
package third
|
||||||
|
|
||||||
import (
|
import (
|
||||||
api "Open_IM/pkg/apistruct"
|
api "OpenIM/pkg/apistruct"
|
||||||
"Open_IM/pkg/common/config"
|
"OpenIM/pkg/common/config"
|
||||||
"Open_IM/pkg/common/constant"
|
"OpenIM/pkg/common/constant"
|
||||||
"Open_IM/pkg/common/log"
|
"OpenIM/pkg/common/log"
|
||||||
"Open_IM/pkg/common/tokenverify"
|
"OpenIM/pkg/common/tokenverify"
|
||||||
"Open_IM/pkg/utils"
|
"OpenIM/pkg/utils"
|
||||||
"context"
|
"context"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
package apiThird
|
package third
|
||||||
|
|
||||||
import (
|
import (
|
||||||
api "Open_IM/pkg/apistruct"
|
api "OpenIM/pkg/apistruct"
|
||||||
"Open_IM/pkg/common/log"
|
"OpenIM/pkg/common/log"
|
||||||
"Open_IM/pkg/common/tokenverify"
|
"OpenIM/pkg/common/tokenverify"
|
||||||
"Open_IM/pkg/utils"
|
"OpenIM/pkg/utils"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package apiThird
|
package third
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/pkg/common/config"
|
"OpenIM/pkg/common/config"
|
||||||
"Open_IM/pkg/common/log"
|
"OpenIM/pkg/common/log"
|
||||||
"Open_IM/pkg/utils"
|
"OpenIM/pkg/utils"
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/minio/minio-go/v7"
|
"github.com/minio/minio-go/v7"
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
package apiThird
|
package third
|
||||||
|
|
||||||
import (
|
import (
|
||||||
api "Open_IM/pkg/apistruct"
|
api "OpenIM/pkg/apistruct"
|
||||||
"Open_IM/pkg/common/config"
|
"OpenIM/pkg/common/config"
|
||||||
"Open_IM/pkg/common/constant"
|
"OpenIM/pkg/common/constant"
|
||||||
"Open_IM/pkg/common/log"
|
"OpenIM/pkg/common/log"
|
||||||
"Open_IM/pkg/common/tokenverify"
|
"OpenIM/pkg/common/tokenverify"
|
||||||
_ "Open_IM/pkg/common/tokenverify"
|
_ "OpenIM/pkg/common/tokenverify"
|
||||||
"Open_IM/pkg/utils"
|
"OpenIM/pkg/utils"
|
||||||
"context"
|
"context"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"github.com/minio/minio-go/v7"
|
"github.com/minio/minio-go/v7"
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
package apiThird
|
package third
|
||||||
|
|
||||||
import (
|
import (
|
||||||
api "Open_IM/pkg/apistruct"
|
api "OpenIM/pkg/apistruct"
|
||||||
"Open_IM/pkg/common/log"
|
"OpenIM/pkg/common/log"
|
||||||
"Open_IM/pkg/common/tokenverify"
|
"OpenIM/pkg/common/tokenverify"
|
||||||
"Open_IM/pkg/utils"
|
"OpenIM/pkg/utils"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"net/http"
|
"net/http"
|
||||||
)
|
)
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
package apiThird
|
package third
|
||||||
|
|
||||||
import (
|
import (
|
||||||
api "Open_IM/pkg/apistruct"
|
api "OpenIM/pkg/apistruct"
|
||||||
"Open_IM/pkg/common/log"
|
"OpenIM/pkg/common/log"
|
||||||
"Open_IM/pkg/common/tokenverify"
|
"OpenIM/pkg/common/tokenverify"
|
||||||
"Open_IM/pkg/utils"
|
"OpenIM/pkg/utils"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"net/http"
|
"net/http"
|
||||||
)
|
)
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
package apiThird
|
package third
|
||||||
|
|
||||||
import (
|
import (
|
||||||
api "Open_IM/pkg/apistruct"
|
api "OpenIM/pkg/apistruct"
|
||||||
"Open_IM/pkg/common/config"
|
"OpenIM/pkg/common/config"
|
||||||
"Open_IM/pkg/common/constant"
|
"OpenIM/pkg/common/constant"
|
||||||
"Open_IM/pkg/common/log"
|
"OpenIM/pkg/common/log"
|
||||||
"Open_IM/pkg/common/tokenverify"
|
"OpenIM/pkg/common/tokenverify"
|
||||||
"github.com/fatih/structs"
|
"github.com/fatih/structs"
|
||||||
|
|
||||||
//"github.com/fatih/structs"
|
//"github.com/fatih/structs"
|
||||||
|
@ -1,16 +1,16 @@
|
|||||||
package user
|
package user
|
||||||
|
|
||||||
import (
|
import (
|
||||||
api "Open_IM/pkg/apistruct"
|
api "OpenIM/pkg/apistruct"
|
||||||
"Open_IM/pkg/common/config"
|
"OpenIM/pkg/common/config"
|
||||||
"Open_IM/pkg/common/constant"
|
"OpenIM/pkg/common/constant"
|
||||||
"Open_IM/pkg/common/log"
|
"OpenIM/pkg/common/log"
|
||||||
"Open_IM/pkg/common/tokenverify"
|
"OpenIM/pkg/common/tokenverify"
|
||||||
pbRelay "Open_IM/pkg/proto/relay"
|
pbRelay "OpenIM/pkg/proto/relay"
|
||||||
sdkws "Open_IM/pkg/proto/sdkws"
|
sdkws "OpenIM/pkg/proto/sdkws"
|
||||||
rpc "Open_IM/pkg/proto/user"
|
rpc "OpenIM/pkg/proto/user"
|
||||||
"Open_IM/pkg/utils"
|
"OpenIM/pkg/utils"
|
||||||
jsonData "Open_IM/pkg/utils"
|
jsonData "OpenIM/pkg/utils"
|
||||||
"context"
|
"context"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
package common
|
package common
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/pkg/common/constant"
|
"OpenIM/pkg/common/constant"
|
||||||
"Open_IM/pkg/common/log"
|
"OpenIM/pkg/common/log"
|
||||||
"Open_IM/pkg/common/tracelog"
|
"OpenIM/pkg/common/tracelog"
|
||||||
utils2 "Open_IM/pkg/utils"
|
utils2 "OpenIM/pkg/utils"
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package check
|
package check
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/pkg/common/tokenverify"
|
"OpenIM/pkg/common/tokenverify"
|
||||||
"context"
|
"context"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package check
|
package check
|
||||||
|
|
||||||
import (
|
import (
|
||||||
discoveryRegistry "Open_IM/pkg/discoveryregistry"
|
discoveryRegistry "OpenIM/pkg/discoveryregistry"
|
||||||
"context"
|
"context"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
package check
|
package check
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/pkg/common/config"
|
"OpenIM/pkg/common/config"
|
||||||
discoveryRegistry "Open_IM/pkg/discoveryregistry"
|
discoveryRegistry "OpenIM/pkg/discoveryregistry"
|
||||||
"Open_IM/pkg/proto/conversation"
|
"OpenIM/pkg/proto/conversation"
|
||||||
pbConversation "Open_IM/pkg/proto/conversation"
|
pbConversation "OpenIM/pkg/proto/conversation"
|
||||||
"context"
|
"context"
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
)
|
)
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
package check
|
package check
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/pkg/common/config"
|
"OpenIM/pkg/common/config"
|
||||||
"Open_IM/pkg/common/constant"
|
"OpenIM/pkg/common/constant"
|
||||||
discoveryRegistry "Open_IM/pkg/discoveryregistry"
|
discoveryRegistry "OpenIM/pkg/discoveryregistry"
|
||||||
"Open_IM/pkg/proto/friend"
|
"OpenIM/pkg/proto/friend"
|
||||||
sdkws "Open_IM/pkg/proto/sdkws"
|
sdkws "OpenIM/pkg/proto/sdkws"
|
||||||
"context"
|
"context"
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
)
|
)
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
package check
|
package check
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/pkg/common/config"
|
"OpenIM/pkg/common/config"
|
||||||
"Open_IM/pkg/common/constant"
|
"OpenIM/pkg/common/constant"
|
||||||
discoveryRegistry "Open_IM/pkg/discoveryregistry"
|
discoveryRegistry "OpenIM/pkg/discoveryregistry"
|
||||||
"Open_IM/pkg/proto/group"
|
"OpenIM/pkg/proto/group"
|
||||||
sdkws "Open_IM/pkg/proto/sdkws"
|
sdkws "OpenIM/pkg/proto/sdkws"
|
||||||
"Open_IM/pkg/utils"
|
"OpenIM/pkg/utils"
|
||||||
"context"
|
"context"
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
"strings"
|
"strings"
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
package check
|
package check
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/pkg/common/config"
|
"OpenIM/pkg/common/config"
|
||||||
discoveryRegistry "Open_IM/pkg/discoveryregistry"
|
discoveryRegistry "OpenIM/pkg/discoveryregistry"
|
||||||
"Open_IM/pkg/proto/msg"
|
"OpenIM/pkg/proto/msg"
|
||||||
"Open_IM/pkg/proto/sdkws"
|
"OpenIM/pkg/proto/sdkws"
|
||||||
"context"
|
"context"
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
)
|
)
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
package check
|
package check
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/pkg/common/config"
|
"OpenIM/pkg/common/config"
|
||||||
"Open_IM/pkg/common/constant"
|
"OpenIM/pkg/common/constant"
|
||||||
discoveryRegistry "Open_IM/pkg/discoveryregistry"
|
discoveryRegistry "OpenIM/pkg/discoveryregistry"
|
||||||
sdkws "Open_IM/pkg/proto/sdkws"
|
sdkws "OpenIM/pkg/proto/sdkws"
|
||||||
"Open_IM/pkg/proto/user"
|
"OpenIM/pkg/proto/user"
|
||||||
"Open_IM/pkg/utils"
|
"OpenIM/pkg/utils"
|
||||||
"context"
|
"context"
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
"strings"
|
"strings"
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
package convert
|
package convert
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/internal/common/check"
|
"OpenIM/internal/common/check"
|
||||||
"Open_IM/pkg/common/db/table/relation"
|
"OpenIM/pkg/common/db/table/relation"
|
||||||
discoveryRegistry "Open_IM/pkg/discoveryregistry"
|
discoveryRegistry "OpenIM/pkg/discoveryregistry"
|
||||||
sdk "Open_IM/pkg/proto/sdkws"
|
sdk "OpenIM/pkg/proto/sdkws"
|
||||||
utils2 "Open_IM/pkg/utils"
|
utils2 "OpenIM/pkg/utils"
|
||||||
"context"
|
"context"
|
||||||
utils "github.com/OpenIMSDK/open_utils"
|
utils "github.com/OpenIMSDK/open_utils"
|
||||||
"time"
|
"time"
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
package notification
|
package notification
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/internal/common/check"
|
"OpenIM/internal/common/check"
|
||||||
"Open_IM/pkg/common/config"
|
"OpenIM/pkg/common/config"
|
||||||
"Open_IM/pkg/common/constant"
|
"OpenIM/pkg/common/constant"
|
||||||
"Open_IM/pkg/common/tracelog"
|
"OpenIM/pkg/common/tracelog"
|
||||||
discoveryRegistry "Open_IM/pkg/discoveryregistry"
|
discoveryRegistry "OpenIM/pkg/discoveryregistry"
|
||||||
"Open_IM/pkg/proto/msg"
|
"OpenIM/pkg/proto/msg"
|
||||||
"Open_IM/pkg/proto/sdkws"
|
"OpenIM/pkg/proto/sdkws"
|
||||||
utils2 "Open_IM/pkg/utils"
|
utils2 "OpenIM/pkg/utils"
|
||||||
"context"
|
"context"
|
||||||
utils "github.com/OpenIMSDK/open_utils"
|
utils "github.com/OpenIMSDK/open_utils"
|
||||||
)
|
)
|
||||||
@ -300,6 +300,5 @@ func (c *Check) Notification(ctx context.Context, notificationMsg *NotificationM
|
|||||||
offlineInfo.Ex = ex
|
offlineInfo.Ex = ex
|
||||||
msg.OfflinePushInfo = &offlineInfo
|
msg.OfflinePushInfo = &offlineInfo
|
||||||
req.MsgData = &msg
|
req.MsgData = &msg
|
||||||
|
|
||||||
_, err = c.Msg.SendMsg(ctx, &req)
|
_, err = c.Msg.SendMsg(ctx, &req)
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package notification
|
package notification
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/pkg/common/config"
|
"OpenIM/pkg/common/config"
|
||||||
"Open_IM/pkg/common/constant"
|
"OpenIM/pkg/common/constant"
|
||||||
sdkws "Open_IM/pkg/proto/sdkws"
|
sdkws "OpenIM/pkg/proto/sdkws"
|
||||||
"context"
|
"context"
|
||||||
"github.com/golang/protobuf/jsonpb"
|
"github.com/golang/protobuf/jsonpb"
|
||||||
"github.com/golang/protobuf/proto"
|
"github.com/golang/protobuf/proto"
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
package notification
|
package notification
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/pkg/apistruct"
|
"OpenIM/pkg/apistruct"
|
||||||
"Open_IM/pkg/common/constant"
|
"OpenIM/pkg/common/constant"
|
||||||
"Open_IM/pkg/common/tracelog"
|
"OpenIM/pkg/common/tracelog"
|
||||||
"Open_IM/pkg/proto/msg"
|
"OpenIM/pkg/proto/msg"
|
||||||
sdkws "Open_IM/pkg/proto/sdkws"
|
sdkws "OpenIM/pkg/proto/sdkws"
|
||||||
"Open_IM/pkg/utils"
|
"OpenIM/pkg/utils"
|
||||||
"context"
|
"context"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
package notification
|
package notification
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/pkg/common/config"
|
"OpenIM/pkg/common/config"
|
||||||
"Open_IM/pkg/common/constant"
|
"OpenIM/pkg/common/constant"
|
||||||
pbFriend "Open_IM/pkg/proto/friend"
|
pbFriend "OpenIM/pkg/proto/friend"
|
||||||
"Open_IM/pkg/proto/sdkws"
|
"OpenIM/pkg/proto/sdkws"
|
||||||
"context"
|
"context"
|
||||||
"github.com/golang/protobuf/jsonpb"
|
"github.com/golang/protobuf/jsonpb"
|
||||||
"github.com/golang/protobuf/proto"
|
"github.com/golang/protobuf/proto"
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
package notification
|
package notification
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/pkg/common/config"
|
"OpenIM/pkg/common/config"
|
||||||
"Open_IM/pkg/common/constant"
|
"OpenIM/pkg/common/constant"
|
||||||
"Open_IM/pkg/common/log"
|
"OpenIM/pkg/common/log"
|
||||||
"Open_IM/pkg/common/tokenverify"
|
"OpenIM/pkg/common/tokenverify"
|
||||||
"Open_IM/pkg/common/tracelog"
|
"OpenIM/pkg/common/tracelog"
|
||||||
pbGroup "Open_IM/pkg/proto/group"
|
pbGroup "OpenIM/pkg/proto/group"
|
||||||
"Open_IM/pkg/proto/sdkws"
|
"OpenIM/pkg/proto/sdkws"
|
||||||
"Open_IM/pkg/utils"
|
"OpenIM/pkg/utils"
|
||||||
"context"
|
"context"
|
||||||
"github.com/golang/protobuf/jsonpb"
|
"github.com/golang/protobuf/jsonpb"
|
||||||
"github.com/golang/protobuf/proto"
|
"github.com/golang/protobuf/proto"
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package notification
|
package notification
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/pkg/common/constant"
|
"OpenIM/pkg/common/constant"
|
||||||
"Open_IM/pkg/proto/sdkws"
|
"OpenIM/pkg/proto/sdkws"
|
||||||
"context"
|
"context"
|
||||||
"github.com/golang/protobuf/jsonpb"
|
"github.com/golang/protobuf/jsonpb"
|
||||||
"github.com/golang/protobuf/proto"
|
"github.com/golang/protobuf/proto"
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package notification
|
package notification
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/pkg/common/constant"
|
"OpenIM/pkg/common/constant"
|
||||||
"context"
|
"context"
|
||||||
//"github.com/golang/protobuf/jsonpb"
|
//"github.com/golang/protobuf/jsonpb"
|
||||||
//"github.com/golang/protobuf/proto"
|
//"github.com/golang/protobuf/proto"
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package notification
|
package notification
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/pkg/common/constant"
|
"OpenIM/pkg/common/constant"
|
||||||
"Open_IM/pkg/proto/sdkws"
|
"OpenIM/pkg/proto/sdkws"
|
||||||
"context"
|
"context"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
package rpcserver
|
package rpcserver
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/internal/common/network"
|
"OpenIM/internal/common/network"
|
||||||
"Open_IM/pkg/common/constant"
|
"OpenIM/pkg/common/constant"
|
||||||
"Open_IM/pkg/common/log"
|
"OpenIM/pkg/common/log"
|
||||||
discoveryRegistry "Open_IM/pkg/discoveryregistry"
|
discoveryRegistry "OpenIM/pkg/discoveryregistry"
|
||||||
"github.com/OpenIMSDK/openKeeper"
|
"github.com/OpenIMSDK/openKeeper"
|
||||||
"net"
|
"net"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
package msggateway
|
package msggateway
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/pkg/common/config"
|
"OpenIM/pkg/common/config"
|
||||||
"Open_IM/pkg/common/log"
|
"OpenIM/pkg/common/log"
|
||||||
pbChat "Open_IM/pkg/proto/msg"
|
pbChat "OpenIM/pkg/proto/msg"
|
||||||
sdkws "Open_IM/pkg/proto/sdkws"
|
sdkws "OpenIM/pkg/proto/sdkws"
|
||||||
"Open_IM/pkg/utils"
|
"OpenIM/pkg/utils"
|
||||||
"context"
|
"context"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
package msggateway
|
package msggateway
|
||||||
|
|
||||||
import (
|
import (
|
||||||
cbapi "Open_IM/pkg/callbackstruct"
|
cbapi "OpenIM/pkg/callbackstruct"
|
||||||
"Open_IM/pkg/common/config"
|
"OpenIM/pkg/common/config"
|
||||||
"Open_IM/pkg/common/constant"
|
"OpenIM/pkg/common/constant"
|
||||||
"Open_IM/pkg/common/http"
|
"OpenIM/pkg/common/http"
|
||||||
"Open_IM/pkg/common/tracelog"
|
"OpenIM/pkg/common/tracelog"
|
||||||
"context"
|
"context"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
package msggateway
|
package msggateway
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/pkg/common/config"
|
"OpenIM/pkg/common/config"
|
||||||
"Open_IM/pkg/common/constant"
|
"OpenIM/pkg/common/constant"
|
||||||
|
|
||||||
"Open_IM/pkg/statistics"
|
"OpenIM/pkg/statistics"
|
||||||
"fmt"
|
"fmt"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
prome "Open_IM/pkg/common/prome"
|
prome "OpenIM/pkg/common/prome"
|
||||||
|
|
||||||
"github.com/go-playground/validator/v10"
|
"github.com/go-playground/validator/v10"
|
||||||
)
|
)
|
||||||
@ -40,7 +40,7 @@ func Run(prometheusPort int) {
|
|||||||
go ws.run()
|
go ws.run()
|
||||||
go rpcSvr.run()
|
go rpcSvr.run()
|
||||||
go func() {
|
go func() {
|
||||||
err := prome.StartPromeSrv(prometheusPort)
|
err := prome.StartPrometheusSrv(prometheusPort)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
package msggateway
|
package msggateway
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/pkg/common/config"
|
"OpenIM/pkg/common/config"
|
||||||
"Open_IM/pkg/common/constant"
|
"OpenIM/pkg/common/constant"
|
||||||
"Open_IM/pkg/common/log"
|
"OpenIM/pkg/common/log"
|
||||||
"Open_IM/pkg/common/prome"
|
"OpenIM/pkg/common/prome"
|
||||||
pbChat "Open_IM/pkg/proto/msg"
|
pbChat "OpenIM/pkg/proto/msg"
|
||||||
push "Open_IM/pkg/proto/push"
|
push "OpenIM/pkg/proto/push"
|
||||||
pbRtc "Open_IM/pkg/proto/rtc"
|
pbRtc "OpenIM/pkg/proto/rtc"
|
||||||
sdkws "Open_IM/pkg/proto/sdkws"
|
sdkws "OpenIM/pkg/proto/sdkws"
|
||||||
"Open_IM/pkg/utils"
|
"OpenIM/pkg/utils"
|
||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
"encoding/gob"
|
"encoding/gob"
|
||||||
@ -50,18 +50,18 @@ func (ws *WServer) msgParse(conn *UserConn, binaryMsg []byte) {
|
|||||||
case constant.WSGetNewestSeq:
|
case constant.WSGetNewestSeq:
|
||||||
log.NewInfo(m.OperationID, "getSeqReq ", m.SendID, m.MsgIncr, m.ReqIdentifier)
|
log.NewInfo(m.OperationID, "getSeqReq ", m.SendID, m.MsgIncr, m.ReqIdentifier)
|
||||||
ws.getSeqReq(conn, &m)
|
ws.getSeqReq(conn, &m)
|
||||||
prome.PromeInc(prome.GetNewestSeqTotalCounter)
|
prome.Inc(prome.GetNewestSeqTotalCounter)
|
||||||
case constant.WSSendMsg:
|
case constant.WSSendMsg:
|
||||||
log.NewInfo(m.OperationID, "sendMsgReq ", m.SendID, m.MsgIncr, m.ReqIdentifier)
|
log.NewInfo(m.OperationID, "sendMsgReq ", m.SendID, m.MsgIncr, m.ReqIdentifier)
|
||||||
ws.sendMsgReq(conn, &m)
|
ws.sendMsgReq(conn, &m)
|
||||||
prome.PromeInc(prome.MsgRecvTotalCounter)
|
prome.Inc(prome.MsgRecvTotalCounter)
|
||||||
case constant.WSSendSignalMsg:
|
case constant.WSSendSignalMsg:
|
||||||
log.NewInfo(m.OperationID, "sendSignalMsgReq ", m.SendID, m.MsgIncr, m.ReqIdentifier)
|
log.NewInfo(m.OperationID, "sendSignalMsgReq ", m.SendID, m.MsgIncr, m.ReqIdentifier)
|
||||||
ws.sendSignalMsgReq(conn, &m)
|
ws.sendSignalMsgReq(conn, &m)
|
||||||
case constant.WSPullMsgBySeqList:
|
case constant.WSPullMsgBySeqList:
|
||||||
log.NewInfo(m.OperationID, "pullMsgBySeqListReq ", m.SendID, m.MsgIncr, m.ReqIdentifier)
|
log.NewInfo(m.OperationID, "pullMsgBySeqListReq ", m.SendID, m.MsgIncr, m.ReqIdentifier)
|
||||||
ws.pullMsgBySeqListReq(conn, &m)
|
ws.pullMsgBySeqListReq(conn, &m)
|
||||||
prome.PromeInc(prome.PullMsgBySeqListTotalCounter)
|
prome.Inc(prome.PullMsgBySeqListTotalCounter)
|
||||||
case constant.WsLogoutMsg:
|
case constant.WsLogoutMsg:
|
||||||
log.NewInfo(m.OperationID, "conn.Close()", m.SendID, m.MsgIncr, m.ReqIdentifier)
|
log.NewInfo(m.OperationID, "conn.Close()", m.SendID, m.MsgIncr, m.ReqIdentifier)
|
||||||
ws.userLogoutReq(conn, &m)
|
ws.userLogoutReq(conn, &m)
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package new
|
package new
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/pkg/common/constant"
|
"OpenIM/pkg/common/constant"
|
||||||
"Open_IM/pkg/utils"
|
"OpenIM/pkg/utils"
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package new
|
package new
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/pkg/utils"
|
"OpenIM/pkg/utils"
|
||||||
"bytes"
|
"bytes"
|
||||||
"compress/gzip"
|
"compress/gzip"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package new
|
package new
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/pkg/utils"
|
"OpenIM/pkg/utils"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
)
|
)
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package new
|
package new
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/pkg/utils"
|
"OpenIM/pkg/utils"
|
||||||
"bytes"
|
"bytes"
|
||||||
"encoding/gob"
|
"encoding/gob"
|
||||||
)
|
)
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package new
|
package new
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/pkg/common/constant"
|
"OpenIM/pkg/common/constant"
|
||||||
"errors"
|
"errors"
|
||||||
"net/http"
|
"net/http"
|
||||||
)
|
)
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
package new
|
package new
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/internal/common/notification"
|
"OpenIM/internal/common/notification"
|
||||||
"Open_IM/pkg/proto/msg"
|
"OpenIM/pkg/proto/msg"
|
||||||
pbRtc "Open_IM/pkg/proto/rtc"
|
pbRtc "OpenIM/pkg/proto/rtc"
|
||||||
"Open_IM/pkg/proto/sdkws"
|
"OpenIM/pkg/proto/sdkws"
|
||||||
"context"
|
"context"
|
||||||
"github.com/go-playground/validator/v10"
|
"github.com/go-playground/validator/v10"
|
||||||
"github.com/golang/protobuf/proto"
|
"github.com/golang/protobuf/proto"
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package new
|
package new
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/pkg/common/constant"
|
"OpenIM/pkg/common/constant"
|
||||||
"Open_IM/pkg/common/tokenverify"
|
"OpenIM/pkg/common/tokenverify"
|
||||||
"Open_IM/pkg/utils"
|
"OpenIM/pkg/utils"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/go-playground/validator/v10"
|
"github.com/go-playground/validator/v10"
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
package msggateway
|
package msggateway
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/pkg/common/config"
|
"OpenIM/pkg/common/config"
|
||||||
"Open_IM/pkg/common/constant"
|
"OpenIM/pkg/common/constant"
|
||||||
"Open_IM/pkg/common/log"
|
"OpenIM/pkg/common/log"
|
||||||
prome "Open_IM/pkg/common/prome"
|
prome "OpenIM/pkg/common/prome"
|
||||||
"Open_IM/pkg/common/tokenverify"
|
"OpenIM/pkg/common/tokenverify"
|
||||||
pbRelay "Open_IM/pkg/proto/relay"
|
pbRelay "OpenIM/pkg/proto/relay"
|
||||||
sdkws "Open_IM/pkg/proto/sdkws"
|
sdkws "OpenIM/pkg/proto/sdkws"
|
||||||
"Open_IM/pkg/utils"
|
"OpenIM/pkg/utils"
|
||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
"encoding/gob"
|
"encoding/gob"
|
||||||
@ -203,7 +203,7 @@ func (r *RPCServer) SuperGroupOnlineBatchPushOneMsg(_ context.Context, req *pbRe
|
|||||||
resultCode := sendMsgBatchToUser(userConn, replyBytes.Bytes(), req, platform, v)
|
resultCode := sendMsgBatchToUser(userConn, replyBytes.Bytes(), req, platform, v)
|
||||||
if resultCode == 0 && utils.IsContainInt(platform, r.pushTerminal) {
|
if resultCode == 0 && utils.IsContainInt(platform, r.pushTerminal) {
|
||||||
tempT.OnlinePush = true
|
tempT.OnlinePush = true
|
||||||
prome.PromeInc(prome.MsgOnlinePushSuccessCounter)
|
prome.Inc(prome.MsgOnlinePushSuccessCounter)
|
||||||
log.Info(req.OperationID, "PushSuperMsgToUser is success By Ws", "args", req.String(), "recvPlatForm", constant.PlatformIDToName(platform), "recvID", v)
|
log.Info(req.OperationID, "PushSuperMsgToUser is success By Ws", "args", req.String(), "recvPlatForm", constant.PlatformIDToName(platform), "recvID", v)
|
||||||
temp.ResultCode = resultCode
|
temp.ResultCode = resultCode
|
||||||
resp = append(resp, temp)
|
resp = append(resp, temp)
|
||||||
|
@ -1,16 +1,16 @@
|
|||||||
/*
|
/*
|
||||||
** description("").
|
** description("").
|
||||||
** copyright('Open_IM,www.Open_IM.io').
|
** copyright('OpenIM,www.OpenIM.io').
|
||||||
** author("fg,Gordon@tuoyun.net").
|
** author("fg,Gordon@tuoyun.net").
|
||||||
** time(2021/5/21 15:29).
|
** time(2021/5/21 15:29).
|
||||||
*/
|
*/
|
||||||
package msggateway
|
package msggateway
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/pkg/common/constant"
|
"OpenIM/pkg/common/constant"
|
||||||
"Open_IM/pkg/common/log"
|
"OpenIM/pkg/common/log"
|
||||||
pbRtc "Open_IM/pkg/proto/rtc"
|
pbRtc "OpenIM/pkg/proto/rtc"
|
||||||
sdkws "Open_IM/pkg/proto/sdkws"
|
sdkws "OpenIM/pkg/proto/sdkws"
|
||||||
"github.com/golang/protobuf/proto"
|
"github.com/golang/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
package msggateway
|
package msggateway
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/pkg/common/config"
|
"OpenIM/pkg/common/config"
|
||||||
"Open_IM/pkg/common/constant"
|
"OpenIM/pkg/common/constant"
|
||||||
"Open_IM/pkg/common/log"
|
"OpenIM/pkg/common/log"
|
||||||
prome "Open_IM/pkg/common/prome"
|
prome "OpenIM/pkg/common/prome"
|
||||||
"Open_IM/pkg/common/tokenverify"
|
"OpenIM/pkg/common/tokenverify"
|
||||||
pbRelay "Open_IM/pkg/proto/relay"
|
pbRelay "OpenIM/pkg/proto/relay"
|
||||||
"Open_IM/pkg/utils"
|
"OpenIM/pkg/utils"
|
||||||
"bytes"
|
"bytes"
|
||||||
"compress/gzip"
|
"compress/gzip"
|
||||||
"context"
|
"context"
|
||||||
@ -351,7 +351,7 @@ func (ws *WServer) addUserConn(uid string, platformID int, conn *UserConn, token
|
|||||||
for _, v := range ws.wsUserToConn {
|
for _, v := range ws.wsUserToConn {
|
||||||
count = count + len(v)
|
count = count + len(v)
|
||||||
}
|
}
|
||||||
prome.PromeGaugeInc(prome.OnlineUserGauge)
|
prome.GaugeInc(prome.OnlineUserGauge)
|
||||||
log.Debug(operationID, "WS Add operation", "", "wsUser added", ws.wsUserToConn, "connection_uid", uid, "connection_platform", constant.PlatformIDToName(platformID), "online_user_num", len(ws.wsUserToConn), "online_conn_num", count)
|
log.Debug(operationID, "WS Add operation", "", "wsUser added", ws.wsUserToConn, "connection_uid", uid, "connection_platform", constant.PlatformIDToName(platformID), "online_user_num", len(ws.wsUserToConn), "online_conn_num", count)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -393,7 +393,7 @@ func (ws *WServer) delUserConn(conn *UserConn) {
|
|||||||
if callbackResp.ErrCode != 0 {
|
if callbackResp.ErrCode != 0 {
|
||||||
log.NewError(operationID, utils.GetSelfFuncName(), "callbackUserOffline failed", callbackResp)
|
log.NewError(operationID, utils.GetSelfFuncName(), "callbackUserOffline failed", callbackResp)
|
||||||
}
|
}
|
||||||
prome.PromeGaugeDec(prome.OnlineUserGauge)
|
prome.GaugeDec(prome.OnlineUserGauge)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package msgtransfer
|
package msgtransfer
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/pkg/common/config"
|
"OpenIM/pkg/common/config"
|
||||||
"Open_IM/pkg/common/prome"
|
"OpenIM/pkg/common/prome"
|
||||||
"fmt"
|
"fmt"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -46,7 +46,7 @@ func (m *MsgTransfer) Run(promePort int) {
|
|||||||
go m.historyMongoCH.historyConsumerGroup.RegisterHandleAndConsumer(&m.historyMongoCH)
|
go m.historyMongoCH.historyConsumerGroup.RegisterHandleAndConsumer(&m.historyMongoCH)
|
||||||
go m.modifyCH.modifyMsgConsumerGroup.RegisterHandleAndConsumer(&m.modifyCH)
|
go m.modifyCH.modifyMsgConsumerGroup.RegisterHandleAndConsumer(&m.modifyCH)
|
||||||
go func() {
|
go func() {
|
||||||
err := prome.StartPromeSrv(promePort)
|
err := prome.StartPrometheusSrv(promePort)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
@ -1,18 +1,17 @@
|
|||||||
package msgtransfer
|
package msgtransfer
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/pkg/apistruct"
|
"OpenIM/pkg/apistruct"
|
||||||
"Open_IM/pkg/common/config"
|
"OpenIM/pkg/common/config"
|
||||||
"Open_IM/pkg/common/constant"
|
"OpenIM/pkg/common/constant"
|
||||||
"Open_IM/pkg/common/db/cache"
|
"OpenIM/pkg/common/db/controller"
|
||||||
"Open_IM/pkg/common/db/controller"
|
unRelationTb "OpenIM/pkg/common/db/table/unrelation"
|
||||||
unRelationTb "Open_IM/pkg/common/db/table/unrelation"
|
kfk "OpenIM/pkg/common/kafka"
|
||||||
kfk "Open_IM/pkg/common/kafka"
|
"OpenIM/pkg/common/log"
|
||||||
"Open_IM/pkg/common/log"
|
"OpenIM/pkg/common/tracelog"
|
||||||
"Open_IM/pkg/common/tracelog"
|
pbMsg "OpenIM/pkg/proto/msg"
|
||||||
pbMsg "Open_IM/pkg/proto/msg"
|
sdkws "OpenIM/pkg/proto/sdkws"
|
||||||
sdkws "Open_IM/pkg/proto/sdkws"
|
"OpenIM/pkg/utils"
|
||||||
"Open_IM/pkg/utils"
|
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"github.com/Shopify/sarama"
|
"github.com/Shopify/sarama"
|
||||||
@ -24,7 +23,6 @@ type ModifyMsgConsumerHandler struct {
|
|||||||
modifyMsgConsumerGroup *kfk.MConsumerGroup
|
modifyMsgConsumerGroup *kfk.MConsumerGroup
|
||||||
|
|
||||||
extendMsgInterface controller.ExtendMsgInterface
|
extendMsgInterface controller.ExtendMsgInterface
|
||||||
cache cache.MsgCache
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (mmc *ModifyMsgConsumerHandler) Init() {
|
func (mmc *ModifyMsgConsumerHandler) Init() {
|
||||||
|
@ -1,17 +1,17 @@
|
|||||||
package msgtransfer
|
package msgtransfer
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/pkg/common/config"
|
"OpenIM/pkg/common/config"
|
||||||
"Open_IM/pkg/common/constant"
|
"OpenIM/pkg/common/constant"
|
||||||
"Open_IM/pkg/common/db/cache"
|
"OpenIM/pkg/common/db/cache"
|
||||||
"Open_IM/pkg/common/db/controller"
|
"OpenIM/pkg/common/db/controller"
|
||||||
"Open_IM/pkg/common/kafka"
|
"OpenIM/pkg/common/kafka"
|
||||||
"Open_IM/pkg/common/log"
|
"OpenIM/pkg/common/log"
|
||||||
"Open_IM/pkg/common/tracelog"
|
"OpenIM/pkg/common/tracelog"
|
||||||
pbMsg "Open_IM/pkg/proto/msg"
|
pbMsg "OpenIM/pkg/proto/msg"
|
||||||
pbPush "Open_IM/pkg/proto/push"
|
pbPush "OpenIM/pkg/proto/push"
|
||||||
"Open_IM/pkg/statistics"
|
"OpenIM/pkg/statistics"
|
||||||
"Open_IM/pkg/utils"
|
"OpenIM/pkg/utils"
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/Shopify/sarama"
|
"github.com/Shopify/sarama"
|
||||||
|
@ -1,16 +1,16 @@
|
|||||||
package msgtransfer
|
package msgtransfer
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/pkg/common/config"
|
"OpenIM/pkg/common/config"
|
||||||
"Open_IM/pkg/common/constant"
|
"OpenIM/pkg/common/constant"
|
||||||
"Open_IM/pkg/common/db/cache"
|
"OpenIM/pkg/common/db/cache"
|
||||||
"Open_IM/pkg/common/db/controller"
|
"OpenIM/pkg/common/db/controller"
|
||||||
kfk "Open_IM/pkg/common/kafka"
|
kfk "OpenIM/pkg/common/kafka"
|
||||||
"Open_IM/pkg/common/log"
|
"OpenIM/pkg/common/log"
|
||||||
"Open_IM/pkg/common/tracelog"
|
"OpenIM/pkg/common/tracelog"
|
||||||
pbMsg "Open_IM/pkg/proto/msg"
|
pbMsg "OpenIM/pkg/proto/msg"
|
||||||
"Open_IM/pkg/proto/sdkws"
|
"OpenIM/pkg/proto/sdkws"
|
||||||
"Open_IM/pkg/utils"
|
"OpenIM/pkg/utils"
|
||||||
"context"
|
"context"
|
||||||
"github.com/Shopify/sarama"
|
"github.com/Shopify/sarama"
|
||||||
"github.com/golang/protobuf/proto"
|
"github.com/golang/protobuf/proto"
|
||||||
|
@ -7,13 +7,13 @@
|
|||||||
package msgtransfer
|
package msgtransfer
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/pkg/common/config"
|
"OpenIM/pkg/common/config"
|
||||||
"Open_IM/pkg/common/constant"
|
"OpenIM/pkg/common/constant"
|
||||||
"Open_IM/pkg/common/db/controller"
|
"OpenIM/pkg/common/db/controller"
|
||||||
kfk "Open_IM/pkg/common/kafka"
|
kfk "OpenIM/pkg/common/kafka"
|
||||||
"Open_IM/pkg/common/log"
|
"OpenIM/pkg/common/log"
|
||||||
pbMsg "Open_IM/pkg/proto/msg"
|
pbMsg "OpenIM/pkg/proto/msg"
|
||||||
"Open_IM/pkg/utils"
|
"OpenIM/pkg/utils"
|
||||||
|
|
||||||
"github.com/Shopify/sarama"
|
"github.com/Shopify/sarama"
|
||||||
"github.com/golang/protobuf/proto"
|
"github.com/golang/protobuf/proto"
|
||||||
@ -21,7 +21,7 @@ import (
|
|||||||
|
|
||||||
type PersistentConsumerHandler struct {
|
type PersistentConsumerHandler struct {
|
||||||
persistentConsumerGroup *kfk.MConsumerGroup
|
persistentConsumerGroup *kfk.MConsumerGroup
|
||||||
chatLogInterface controller.ChatLogInterface
|
chatLogInterface controller.ChatLogDatabase
|
||||||
}
|
}
|
||||||
|
|
||||||
func (pc *PersistentConsumerHandler) Init() {
|
func (pc *PersistentConsumerHandler) Init() {
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
package push
|
package push
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/pkg/callbackstruct"
|
"OpenIM/pkg/callbackstruct"
|
||||||
"Open_IM/pkg/common/config"
|
"OpenIM/pkg/common/config"
|
||||||
"Open_IM/pkg/common/constant"
|
"OpenIM/pkg/common/constant"
|
||||||
"Open_IM/pkg/common/http"
|
"OpenIM/pkg/common/http"
|
||||||
"Open_IM/pkg/common/tracelog"
|
"OpenIM/pkg/common/tracelog"
|
||||||
"Open_IM/pkg/proto/sdkws"
|
"OpenIM/pkg/proto/sdkws"
|
||||||
"Open_IM/pkg/utils"
|
"OpenIM/pkg/utils"
|
||||||
"context"
|
"context"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
package fcm
|
package fcm
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/internal/push"
|
"OpenIM/internal/push"
|
||||||
"Open_IM/pkg/common/config"
|
"OpenIM/pkg/common/config"
|
||||||
"Open_IM/pkg/common/constant"
|
"OpenIM/pkg/common/constant"
|
||||||
"Open_IM/pkg/common/db/cache"
|
"OpenIM/pkg/common/db/cache"
|
||||||
"context"
|
"context"
|
||||||
firebase "firebase.google.com/go"
|
firebase "firebase.google.com/go"
|
||||||
"firebase.google.com/go/messaging"
|
"firebase.google.com/go/messaging"
|
||||||
@ -19,10 +19,10 @@ var Terminal = []int{constant.IOSPlatformID, constant.AndroidPlatformID, constan
|
|||||||
|
|
||||||
type Fcm struct {
|
type Fcm struct {
|
||||||
fcmMsgCli *messaging.Client
|
fcmMsgCli *messaging.Client
|
||||||
cache cache.MsgCache
|
cache cache.Cache
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewClient(cache cache.MsgCache) *Fcm {
|
func NewClient(cache cache.Cache) *Fcm {
|
||||||
opt := option.WithCredentialsFile(filepath.Join(config.Root, "config", config.Config.Push.Fcm.ServiceAccount))
|
opt := option.WithCredentialsFile(filepath.Join(config.Root, "config", config.Config.Push.Fcm.ServiceAccount))
|
||||||
fcmApp, err := firebase.NewApp(context.Background(), nil, opt)
|
fcmApp, err := firebase.NewApp(context.Background(), nil, opt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
package fcm
|
package fcm
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/internal/push"
|
"OpenIM/internal/push"
|
||||||
"Open_IM/pkg/common/db/cache"
|
"OpenIM/pkg/common/db/cache"
|
||||||
"context"
|
"context"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Test_Push(t *testing.T) {
|
func Test_Push(t *testing.T) {
|
||||||
var redis cache.MsgCache
|
var redis cache.Cache
|
||||||
offlinePusher := NewClient(redis)
|
offlinePusher := NewClient(redis)
|
||||||
err := offlinePusher.Push(context.Background(), []string{"userID1"}, "test", "test", &push.Opts{})
|
err := offlinePusher.Push(context.Background(), []string{"userID1"}, "test", "test", &push.Opts{})
|
||||||
assert.Nil(t, err)
|
assert.Nil(t, err)
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package getui
|
package getui
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/pkg/common/config"
|
"OpenIM/pkg/common/config"
|
||||||
"fmt"
|
"fmt"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -1,17 +1,17 @@
|
|||||||
package getui
|
package getui
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/internal/push"
|
"OpenIM/internal/push"
|
||||||
"Open_IM/pkg/common/config"
|
"OpenIM/pkg/common/config"
|
||||||
"Open_IM/pkg/common/db/cache"
|
"OpenIM/pkg/common/db/cache"
|
||||||
http2 "Open_IM/pkg/common/http"
|
http2 "OpenIM/pkg/common/http"
|
||||||
"Open_IM/pkg/common/log"
|
"OpenIM/pkg/common/log"
|
||||||
"Open_IM/pkg/common/tracelog"
|
"OpenIM/pkg/common/tracelog"
|
||||||
"Open_IM/pkg/utils/splitter"
|
"OpenIM/pkg/utils/splitter"
|
||||||
"github.com/go-redis/redis/v8"
|
"github.com/go-redis/redis/v8"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"Open_IM/pkg/utils"
|
"OpenIM/pkg/utils"
|
||||||
"context"
|
"context"
|
||||||
"crypto/sha256"
|
"crypto/sha256"
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
@ -38,12 +38,12 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type Client struct {
|
type Client struct {
|
||||||
cache cache.MsgCache
|
cache cache.Cache
|
||||||
tokenExpireTime int64
|
tokenExpireTime int64
|
||||||
taskIDTTL int64
|
taskIDTTL int64
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewClient(cache cache.MsgCache) *Client {
|
func NewClient(cache cache.Cache) *Client {
|
||||||
return &Client{cache: cache, tokenExpireTime: tokenExpireTime, taskIDTTL: taskIDTTL}
|
return &Client{cache: cache, tokenExpireTime: tokenExpireTime, taskIDTTL: taskIDTTL}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -70,8 +70,9 @@ func (g *Client) Push(ctx context.Context, userIDs []string, title, content stri
|
|||||||
for i, v := range s.GetSplitResult() {
|
for i, v := range s.GetSplitResult() {
|
||||||
go func(index int, userIDs []string) {
|
go func(index int, userIDs []string) {
|
||||||
defer wg.Done()
|
defer wg.Done()
|
||||||
if err = g.batchPush(ctx, token, userIDs, pushReq); err != nil {
|
if err2 := g.batchPush(ctx, token, userIDs, pushReq); err2 != nil {
|
||||||
log.NewError(tracelog.GetOperationID(ctx), "batchPush failed", i, token, pushReq)
|
log.NewError(tracelog.GetOperationID(ctx), "batchPush failed", i, token, pushReq)
|
||||||
|
err = err2
|
||||||
}
|
}
|
||||||
}(i, v.Item)
|
}(i, v.Item)
|
||||||
}
|
}
|
||||||
|
@ -7,14 +7,14 @@
|
|||||||
package push
|
package push
|
||||||
|
|
||||||
import (
|
import (
|
||||||
fcm "Open_IM/internal/push/fcm"
|
fcm "OpenIM/internal/push/fcm"
|
||||||
"Open_IM/internal/push/getui"
|
"OpenIM/internal/push/getui"
|
||||||
jpush "Open_IM/internal/push/jpush"
|
jpush "OpenIM/internal/push/jpush"
|
||||||
"Open_IM/pkg/common/config"
|
"OpenIM/pkg/common/config"
|
||||||
"Open_IM/pkg/common/constant"
|
"OpenIM/pkg/common/constant"
|
||||||
"Open_IM/pkg/common/db/cache"
|
"OpenIM/pkg/common/db/cache"
|
||||||
"Open_IM/pkg/common/prome"
|
"OpenIM/pkg/common/prome"
|
||||||
"Open_IM/pkg/statistics"
|
"OpenIM/pkg/statistics"
|
||||||
"fmt"
|
"fmt"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -55,7 +55,7 @@ func (p *Push) Run(prometheusPort int) {
|
|||||||
go p.rpcServer.run()
|
go p.rpcServer.run()
|
||||||
go p.pushCh.pushConsumerGroup.RegisterHandleAndConsumer(&p.pushCh)
|
go p.pushCh.pushConsumerGroup.RegisterHandleAndConsumer(&p.pushCh)
|
||||||
go func() {
|
go func() {
|
||||||
err := prome.StartPromeSrv(prometheusPort)
|
err := prome.StartPrometheusSrv(prometheusPort)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package body
|
package body
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/pkg/common/config"
|
"OpenIM/pkg/common/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Notification struct {
|
type Notification struct {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package body
|
package body
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/pkg/common/constant"
|
"OpenIM/pkg/common/constant"
|
||||||
"errors"
|
"errors"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
package push
|
package push
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/internal/push"
|
"OpenIM/internal/push"
|
||||||
"Open_IM/internal/push/jpush/body"
|
"OpenIM/internal/push/jpush/body"
|
||||||
"Open_IM/pkg/common/config"
|
"OpenIM/pkg/common/config"
|
||||||
http2 "Open_IM/pkg/common/http"
|
http2 "OpenIM/pkg/common/http"
|
||||||
"context"
|
"context"
|
||||||
"encoding/base64"
|
"encoding/base64"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
@ -1,20 +1,20 @@
|
|||||||
/*
|
/*
|
||||||
** description("").
|
** description("").
|
||||||
** copyright('Open_IM,www.Open_IM.io').
|
** copyright('OpenIM,www.OpenIM.io').
|
||||||
** author("fg,Gordon@tuoyun.net").
|
** author("fg,Gordon@tuoyun.net").
|
||||||
** time(2021/5/13 10:33).
|
** time(2021/5/13 10:33).
|
||||||
*/
|
*/
|
||||||
package push
|
package push
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/pkg/common/config"
|
"OpenIM/pkg/common/config"
|
||||||
"Open_IM/pkg/common/constant"
|
"OpenIM/pkg/common/constant"
|
||||||
kfk "Open_IM/pkg/common/kafka"
|
kfk "OpenIM/pkg/common/kafka"
|
||||||
"Open_IM/pkg/common/log"
|
"OpenIM/pkg/common/log"
|
||||||
"Open_IM/pkg/common/tracelog"
|
"OpenIM/pkg/common/tracelog"
|
||||||
pbChat "Open_IM/pkg/proto/msg"
|
pbChat "OpenIM/pkg/proto/msg"
|
||||||
pbPush "Open_IM/pkg/proto/push"
|
pbPush "OpenIM/pkg/proto/push"
|
||||||
"Open_IM/pkg/utils"
|
"OpenIM/pkg/utils"
|
||||||
"context"
|
"context"
|
||||||
"github.com/Shopify/sarama"
|
"github.com/Shopify/sarama"
|
||||||
"github.com/golang/protobuf/proto"
|
"github.com/golang/protobuf/proto"
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
package push
|
package push
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/pkg/common/config"
|
"OpenIM/pkg/common/config"
|
||||||
"Open_IM/pkg/common/constant"
|
"OpenIM/pkg/common/constant"
|
||||||
"Open_IM/pkg/common/db/cache"
|
"OpenIM/pkg/common/db/cache"
|
||||||
"Open_IM/pkg/common/db/controller"
|
"OpenIM/pkg/common/db/controller"
|
||||||
"Open_IM/pkg/common/log"
|
"OpenIM/pkg/common/log"
|
||||||
"Open_IM/pkg/common/prome"
|
"OpenIM/pkg/common/prome"
|
||||||
pbPush "Open_IM/pkg/proto/push"
|
pbPush "OpenIM/pkg/proto/push"
|
||||||
"Open_IM/pkg/utils"
|
"OpenIM/pkg/utils"
|
||||||
"context"
|
"context"
|
||||||
"net"
|
"net"
|
||||||
"strconv"
|
"strconv"
|
||||||
@ -25,7 +25,7 @@ type RPCServer struct {
|
|||||||
pusher Pusher
|
pusher Pusher
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *RPCServer) Init(rpcPort int, cache cache.MsgCache) {
|
func (r *RPCServer) Init(rpcPort int, cache cache.Cache) {
|
||||||
r.rpcPort = rpcPort
|
r.rpcPort = rpcPort
|
||||||
r.rpcRegisterName = config.Config.RpcRegisterName.OpenImPushName
|
r.rpcRegisterName = config.Config.RpcRegisterName.OpenImPushName
|
||||||
}
|
}
|
||||||
|
@ -7,25 +7,25 @@
|
|||||||
package push
|
package push
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/pkg/common/config"
|
"OpenIM/pkg/common/config"
|
||||||
"Open_IM/pkg/common/constant"
|
"OpenIM/pkg/common/constant"
|
||||||
"Open_IM/pkg/common/db/cache"
|
"OpenIM/pkg/common/db/cache"
|
||||||
"Open_IM/pkg/common/db/localcache"
|
"OpenIM/pkg/common/db/localcache"
|
||||||
"Open_IM/pkg/common/log"
|
"OpenIM/pkg/common/log"
|
||||||
"Open_IM/pkg/common/prome"
|
"OpenIM/pkg/common/prome"
|
||||||
"Open_IM/pkg/common/tracelog"
|
"OpenIM/pkg/common/tracelog"
|
||||||
"Open_IM/pkg/discoveryregistry"
|
"OpenIM/pkg/discoveryregistry"
|
||||||
msggateway "Open_IM/pkg/proto/msggateway"
|
msggateway "OpenIM/pkg/proto/msggateway"
|
||||||
pbRtc "Open_IM/pkg/proto/rtc"
|
pbRtc "OpenIM/pkg/proto/rtc"
|
||||||
"Open_IM/pkg/proto/sdkws"
|
"OpenIM/pkg/proto/sdkws"
|
||||||
"Open_IM/pkg/utils"
|
"OpenIM/pkg/utils"
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"github.com/golang/protobuf/proto"
|
"github.com/golang/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Pusher struct {
|
type Pusher struct {
|
||||||
cache cache.MsgCache
|
cache cache.Cache
|
||||||
client discoveryregistry.SvcDiscoveryRegistry
|
client discoveryregistry.SvcDiscoveryRegistry
|
||||||
offlinePusher OfflinePusher
|
offlinePusher OfflinePusher
|
||||||
groupLocalCache localcache.GroupLocalCache
|
groupLocalCache localcache.GroupLocalCache
|
||||||
@ -33,7 +33,7 @@ type Pusher struct {
|
|||||||
successCount int
|
successCount int
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewPusher(cache cache.MsgCache, client discoveryregistry.SvcDiscoveryRegistry, offlinePusher OfflinePusher) *Pusher {
|
func NewPusher(cache cache.Cache, client discoveryregistry.SvcDiscoveryRegistry, offlinePusher OfflinePusher) *Pusher {
|
||||||
return &Pusher{
|
return &Pusher{
|
||||||
cache: cache,
|
cache: cache,
|
||||||
client: client,
|
client: client,
|
||||||
@ -187,10 +187,10 @@ func (p *Pusher) OfflinePushMsg(ctx context.Context, sourceID string, msg *sdkws
|
|||||||
}
|
}
|
||||||
err = p.offlinePusher.Push(ctx, offlinePushUserIDs, title, content, opts)
|
err = p.offlinePusher.Push(ctx, offlinePushUserIDs, title, content, opts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
prome.PromeInc(prome.MsgOfflinePushFailedCounter)
|
prome.Inc(prome.MsgOfflinePushFailedCounter)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
prome.PromeInc(prome.MsgOfflinePushSuccessCounter)
|
prome.Inc(prome.MsgOfflinePushSuccessCounter)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,20 +1,20 @@
|
|||||||
package auth
|
package auth
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/internal/common/check"
|
"OpenIM/internal/common/check"
|
||||||
"Open_IM/pkg/common/config"
|
"OpenIM/pkg/common/config"
|
||||||
"Open_IM/pkg/common/constant"
|
"OpenIM/pkg/common/constant"
|
||||||
"Open_IM/pkg/common/db/cache"
|
"OpenIM/pkg/common/db/cache"
|
||||||
"Open_IM/pkg/common/db/controller"
|
"OpenIM/pkg/common/db/controller"
|
||||||
"Open_IM/pkg/common/db/relation"
|
"OpenIM/pkg/common/db/relation"
|
||||||
relationTb "Open_IM/pkg/common/db/table/relation"
|
relationTb "OpenIM/pkg/common/db/table/relation"
|
||||||
"Open_IM/pkg/common/log"
|
"OpenIM/pkg/common/log"
|
||||||
"Open_IM/pkg/common/tokenverify"
|
"OpenIM/pkg/common/tokenverify"
|
||||||
"Open_IM/pkg/common/tracelog"
|
"OpenIM/pkg/common/tracelog"
|
||||||
discoveryRegistry "Open_IM/pkg/discoveryregistry"
|
discoveryRegistry "OpenIM/pkg/discoveryregistry"
|
||||||
pbAuth "Open_IM/pkg/proto/auth"
|
pbAuth "OpenIM/pkg/proto/auth"
|
||||||
pbRelay "Open_IM/pkg/proto/relay"
|
pbRelay "OpenIM/pkg/proto/relay"
|
||||||
"Open_IM/pkg/utils"
|
"OpenIM/pkg/utils"
|
||||||
"context"
|
"context"
|
||||||
"github.com/OpenIMSDK/openKeeper"
|
"github.com/OpenIMSDK/openKeeper"
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
|
@ -1,16 +1,16 @@
|
|||||||
package conversation
|
package conversation
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/internal/common/check"
|
"OpenIM/internal/common/check"
|
||||||
"Open_IM/internal/common/notification"
|
"OpenIM/internal/common/notification"
|
||||||
"Open_IM/internal/tx"
|
"OpenIM/pkg/common/constant"
|
||||||
"Open_IM/pkg/common/constant"
|
"OpenIM/pkg/common/db/cache"
|
||||||
"Open_IM/pkg/common/db/cache"
|
"OpenIM/pkg/common/db/controller"
|
||||||
"Open_IM/pkg/common/db/controller"
|
"OpenIM/pkg/common/db/relation"
|
||||||
"Open_IM/pkg/common/db/relation"
|
tableRelation "OpenIM/pkg/common/db/table/relation"
|
||||||
tableRelation "Open_IM/pkg/common/db/table/relation"
|
"OpenIM/pkg/common/db/tx"
|
||||||
pbConversation "Open_IM/pkg/proto/conversation"
|
pbConversation "OpenIM/pkg/proto/conversation"
|
||||||
"Open_IM/pkg/utils"
|
"OpenIM/pkg/utils"
|
||||||
"context"
|
"context"
|
||||||
"github.com/OpenIMSDK/openKeeper"
|
"github.com/OpenIMSDK/openKeeper"
|
||||||
"github.com/dtm-labs/rockscache"
|
"github.com/dtm-labs/rockscache"
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
package friend
|
package friend
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/internal/common/convert"
|
"OpenIM/internal/common/convert"
|
||||||
"Open_IM/pkg/common/db/table/relation"
|
"OpenIM/pkg/common/db/table/relation"
|
||||||
"Open_IM/pkg/common/tokenverify"
|
"OpenIM/pkg/common/tokenverify"
|
||||||
"Open_IM/pkg/common/tracelog"
|
"OpenIM/pkg/common/tracelog"
|
||||||
pbFriend "Open_IM/pkg/proto/friend"
|
pbFriend "OpenIM/pkg/proto/friend"
|
||||||
"context"
|
"context"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
package friend
|
package friend
|
||||||
|
|
||||||
import (
|
import (
|
||||||
cbapi "Open_IM/pkg/callbackstruct"
|
cbapi "OpenIM/pkg/callbackstruct"
|
||||||
"Open_IM/pkg/common/config"
|
"OpenIM/pkg/common/config"
|
||||||
"Open_IM/pkg/common/constant"
|
"OpenIM/pkg/common/constant"
|
||||||
"Open_IM/pkg/common/http"
|
"OpenIM/pkg/common/http"
|
||||||
"Open_IM/pkg/common/tracelog"
|
"OpenIM/pkg/common/tracelog"
|
||||||
pbfriend "Open_IM/pkg/proto/friend"
|
pbfriend "OpenIM/pkg/proto/friend"
|
||||||
"context"
|
"context"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -1,19 +1,19 @@
|
|||||||
package friend
|
package friend
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/internal/common/check"
|
"OpenIM/internal/common/check"
|
||||||
"Open_IM/internal/common/convert"
|
"OpenIM/internal/common/convert"
|
||||||
"Open_IM/internal/common/notification"
|
"OpenIM/internal/common/notification"
|
||||||
"Open_IM/internal/tx"
|
"OpenIM/pkg/common/constant"
|
||||||
"Open_IM/pkg/common/constant"
|
"OpenIM/pkg/common/db/controller"
|
||||||
"Open_IM/pkg/common/db/controller"
|
"OpenIM/pkg/common/db/relation"
|
||||||
"Open_IM/pkg/common/db/relation"
|
tablerelation "OpenIM/pkg/common/db/table/relation"
|
||||||
tablerelation "Open_IM/pkg/common/db/table/relation"
|
"OpenIM/pkg/common/db/tx"
|
||||||
"Open_IM/pkg/common/tokenverify"
|
"OpenIM/pkg/common/tokenverify"
|
||||||
"Open_IM/pkg/common/tracelog"
|
"OpenIM/pkg/common/tracelog"
|
||||||
registry "Open_IM/pkg/discoveryregistry"
|
registry "OpenIM/pkg/discoveryregistry"
|
||||||
pbfriend "Open_IM/pkg/proto/friend"
|
pbfriend "OpenIM/pkg/proto/friend"
|
||||||
"Open_IM/pkg/utils"
|
"OpenIM/pkg/utils"
|
||||||
"context"
|
"context"
|
||||||
"github.com/OpenIMSDK/openKeeper"
|
"github.com/OpenIMSDK/openKeeper"
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
package group
|
package group
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/pkg/apistruct"
|
"OpenIM/pkg/apistruct"
|
||||||
"Open_IM/pkg/callbackstruct"
|
"OpenIM/pkg/callbackstruct"
|
||||||
"Open_IM/pkg/common/config"
|
"OpenIM/pkg/common/config"
|
||||||
"Open_IM/pkg/common/constant"
|
"OpenIM/pkg/common/constant"
|
||||||
"Open_IM/pkg/common/db/table/relation"
|
"OpenIM/pkg/common/db/table/relation"
|
||||||
"Open_IM/pkg/common/http"
|
"OpenIM/pkg/common/http"
|
||||||
"Open_IM/pkg/common/tracelog"
|
"OpenIM/pkg/common/tracelog"
|
||||||
"Open_IM/pkg/proto/group"
|
"OpenIM/pkg/proto/group"
|
||||||
"Open_IM/pkg/utils"
|
"OpenIM/pkg/utils"
|
||||||
"context"
|
"context"
|
||||||
"google.golang.org/protobuf/types/known/wrapperspb"
|
"google.golang.org/protobuf/types/known/wrapperspb"
|
||||||
"time"
|
"time"
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package group
|
package group
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/pkg/common/db/table/relation"
|
"OpenIM/pkg/common/db/table/relation"
|
||||||
pbGroup "Open_IM/pkg/proto/group"
|
pbGroup "OpenIM/pkg/proto/group"
|
||||||
sdkws "Open_IM/pkg/proto/sdkws"
|
sdkws "OpenIM/pkg/proto/sdkws"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package group
|
package group
|
||||||
|
|
||||||
import (
|
import (
|
||||||
pbGroup "Open_IM/pkg/proto/group"
|
pbGroup "OpenIM/pkg/proto/group"
|
||||||
sdkws "Open_IM/pkg/proto/sdkws"
|
sdkws "OpenIM/pkg/proto/sdkws"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user