mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-05-14 22:15:59 +08:00
Compare commits
205 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 8b81d60dce | |||
| 0ed9aa5372 | |||
| 2ace964573 | |||
| a8201aaa58 | |||
| 776fa2f4f6 | |||
| eabef540cf | |||
| d6ec8f4930 | |||
| aaf834a33b | |||
| 043f9bde59 | |||
| 170310e23c | |||
| 31a558cfea | |||
| adc4fec19b | |||
| 74beec2b85 | |||
| d7cd8ba780 | |||
| a69ebf4299 | |||
| 8085c62774 | |||
| 3e51e781a6 | |||
| fa028fdafd | |||
| d2ce4192cc | |||
| 822f689c48 | |||
| c6ade8d9bc | |||
| 0e99fb27b5 | |||
| 058a191e61 | |||
| ebd867a6d5 | |||
| 687933a63e | |||
| 1f40c87dd9 | |||
| 93ffbe2a79 | |||
| a090e602b3 | |||
| c9a48081fd | |||
| 5b026e13f6 | |||
| f1aab5ad3b | |||
| d7028f22e2 | |||
| 570c0cb9a1 | |||
| 053792e89d | |||
| 31212d4f4b | |||
| 19489afefc | |||
| 5dd494d9a2 | |||
| 2adbf9f686 | |||
| 9dbad9ce53 | |||
| 52498bf05e | |||
| e4e5608c8c | |||
| d629874468 | |||
| 7da98935b9 | |||
| d50a0abd2a | |||
| 33b9685985 | |||
| cd14f3e649 | |||
| 70eaa7d968 | |||
| f1b51f9c97 | |||
| 65398fb147 | |||
| a8575b4fc7 | |||
| 67ede12fd8 | |||
| e6b5819099 | |||
| 5cd1af5b48 | |||
| 6d1c70b8d3 | |||
| cda28cb2ee | |||
| aac7a0f5af | |||
| 0501cbcf4c | |||
| f08941c0bd | |||
| c1ed2f14c8 | |||
| 3ae5c9dca1 | |||
| ace6ef0029 | |||
| 140724d665 | |||
| c476c255b8 | |||
| cf069970bd | |||
| a8341ec86d | |||
| 23b965a20a | |||
| 2104ba787a | |||
| 15660663f6 | |||
| 4d3e79281d | |||
| 21ff7a36b8 | |||
| 42e2957bee | |||
| bd62da8e1a | |||
| df592d99dd | |||
| 39f5e13463 | |||
| 58785e9470 | |||
| 3495d75a6f | |||
| bee12423b0 | |||
| a705e595ee | |||
| 45f29c4c6f | |||
| 5f90851458 | |||
| 01515f919d | |||
| a2292b1177 | |||
| b2f5f56fa0 | |||
| 2be1e1a70d | |||
| b416cd380a | |||
| f18f54afc6 | |||
| b02830c891 | |||
| aff733bbd9 | |||
| 4a66911a61 | |||
| c9b3a017a4 | |||
| 6712d65de4 | |||
| c2a45cdbeb | |||
| 0f20e58a46 | |||
| 2f37767899 | |||
| f4c7272305 | |||
| 8a8e33763c | |||
| d55eda0bb3 | |||
| 6c7483733f | |||
| c7590c120d | |||
| b3dec3653a | |||
| 7cb42c49de | |||
| 32dffb0375 | |||
| c3d13c73ce | |||
| 0ea48af892 | |||
| 72b09864ce | |||
| d8e5fe367b | |||
| b1244c0a1b | |||
| 7a3b56955c | |||
| 5dcb7f2a80 | |||
| 64e71440e2 | |||
| e7e3b6dd15 | |||
| 06551575b1 | |||
| 912ec51315 | |||
| 1363c98cd8 | |||
| b9e49e37ea | |||
| 4bb64e301e | |||
| 1c9c911373 | |||
| 75a638f728 | |||
| 09fd45346e | |||
| 3329068bcc | |||
| aae6874928 | |||
| 6dacf23312 | |||
| bcc0cd33f1 | |||
| 0daa840eaa | |||
| ea5e69e26d | |||
| 26f0234e3d | |||
| 95ac2c62e8 | |||
| f65e4aad63 | |||
| d7f82196dc | |||
| e88f41323f | |||
| 8f483b498b | |||
| 85a75be30e | |||
| 4b13874d44 | |||
| ace77e6fd0 | |||
| 46deb5a099 | |||
| 6158ea436d | |||
| 7accffd7cd | |||
| f337b8d7cc | |||
| aeaab0a8d9 | |||
| d81b95d5a6 | |||
| 34e8961601 | |||
| b729cac998 | |||
| a08aeee0c2 | |||
| 90a466ef01 | |||
| ad14e259ba | |||
| 8a92326241 | |||
| 3e45d489b8 | |||
| 04ad424efa | |||
| 7f2270844e | |||
| c97e39fc09 | |||
| 515d7bb318 | |||
| cdf928d64e | |||
| 2440575093 | |||
| 817d2b11a5 | |||
| 4b4dce80cf | |||
| 52e15fc9d4 | |||
| 7dbaa1b8c1 | |||
| 4215d65aa7 | |||
| 62a6195a4f | |||
| 51622e77d4 | |||
| 2e14e0f767 | |||
| b219f8542b | |||
| 6d67bb9d65 | |||
| af37abb394 | |||
| dfd028625d | |||
| a87c16de0d | |||
| e77a156f29 | |||
| 082de2b6b7 | |||
| 7f19f2f046 | |||
| 0cc641d1f8 | |||
| 51cef0bc53 | |||
| d6168cbad9 | |||
| 76f2ea01bf | |||
| 37a8ddbae6 | |||
| 71873f7f0e | |||
| e124a26c52 | |||
| 09b501f7df | |||
| a86980657c | |||
| 7c3aa7ee0b | |||
| 65157ede23 | |||
| 8913ca161f | |||
| 3d7fd2c192 | |||
| b2cc597755 | |||
| d6ba0a803d | |||
| 0e6432f95a | |||
| 0dfaa49c97 | |||
| efeba3432c | |||
| f16cd5b8db | |||
| 72b23ca235 | |||
| 1871b616ba | |||
| f21623e1b8 | |||
| a2e204667f | |||
| 1ec9486452 | |||
| 2b66aafdba | |||
| 3169900f80 | |||
| 737edb985b | |||
| bc94d4e0b3 | |||
| 585715adbf | |||
| 1a12eb9703 | |||
| b4195bd81c | |||
| 5fb4ea2aa3 | |||
| 9367ad901d | |||
| c956add8b0 | |||
| 432a91cc64 | |||
| 629a322d1d |
@@ -0,0 +1,71 @@
|
|||||||
|
# For most projects, this workflow file will not need changing; you simply need
|
||||||
|
# to commit it to your repository.
|
||||||
|
#
|
||||||
|
# You may wish to alter this file to override the set of languages analyzed,
|
||||||
|
# or to provide custom queries or build logic.
|
||||||
|
#
|
||||||
|
# ******** NOTE ********
|
||||||
|
# We have attempted to detect the languages in your repository. Please check
|
||||||
|
# the `language` matrix defined below to confirm you have the correct set of
|
||||||
|
# supported CodeQL languages.
|
||||||
|
#
|
||||||
|
name: "CodeQL"
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ main ]
|
||||||
|
pull_request:
|
||||||
|
# The branches below must be a subset of the branches above
|
||||||
|
branches: [ main ]
|
||||||
|
schedule:
|
||||||
|
- cron: '23 2 * * 2'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
analyze:
|
||||||
|
name: Analyze
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
actions: read
|
||||||
|
contents: read
|
||||||
|
security-events: write
|
||||||
|
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
language: [ 'go' ]
|
||||||
|
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
|
||||||
|
# Learn more:
|
||||||
|
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
# Initializes the CodeQL tools for scanning.
|
||||||
|
- name: Initialize CodeQL
|
||||||
|
uses: github/codeql-action/init@v1
|
||||||
|
with:
|
||||||
|
languages: ${{ matrix.language }}
|
||||||
|
# If you wish to specify custom queries, you can do so here or in a config file.
|
||||||
|
# By default, queries listed here will override any specified in a config file.
|
||||||
|
# Prefix the list here with "+" to use these queries and those in the config file.
|
||||||
|
# queries: ./path/to/local/query, your-org/your-repo/queries@main
|
||||||
|
|
||||||
|
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
||||||
|
# If this step fails, then you should remove it and run the build manually (see below)
|
||||||
|
- name: Autobuild
|
||||||
|
uses: github/codeql-action/autobuild@v1
|
||||||
|
|
||||||
|
# ℹ️ Command-line programs to run using the OS shell.
|
||||||
|
# 📚 https://git.io/JvXDl
|
||||||
|
|
||||||
|
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
|
||||||
|
# and modify them (or add more) to build your code if your project
|
||||||
|
# uses a compiled language
|
||||||
|
|
||||||
|
#- run: |
|
||||||
|
# make bootstrap
|
||||||
|
# make release
|
||||||
|
|
||||||
|
- name: Perform CodeQL Analysis
|
||||||
|
uses: github/codeql-action/analyze@v1
|
||||||
+8
-1
@@ -1,2 +1,9 @@
|
|||||||
|
bin
|
||||||
|
logs
|
||||||
|
.devcontainer
|
||||||
components
|
components
|
||||||
logs
|
logs
|
||||||
|
out-test
|
||||||
|
.github
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -1,4 +1,4 @@
|
|||||||
|
|
||||||
[submodule "src/Open-IM-SDK-Core"]
|
[submodule "cmd/Open-IM-SDK-Core"]
|
||||||
path = src/Open-IM-SDK-Core
|
path = cmd/Open-IM-SDK-Core
|
||||||
url = https://github.com/OpenIMSDK/Open-IM-SDK-Core.git
|
url = https://github.com/OpenIMSDK/Open-IM-SDK-Core.git
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# Open-IM-Server
|
# Open-IM-Server
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
@@ -154,4 +154,4 @@ All images are available at https://hub.docker.com/r/lyt1123/open_im_server
|
|||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
Open-IM-Server is under the Apache 2.0 license. See the [LICENSE](https://github.com/OpenIMSDK/Open-IM-Server/blob/main/LICENSE) file for details.
|
Open-IM-Server is under the Apache 2.0 license. See the [LICENSE](https://github.com/OpenIMSDK/Open-IM-Server/blob/main/LICENSE) file for details
|
||||||
|
|||||||
Submodule
+1
Submodule cmd/Open-IM-SDK-Core added at 3699730514
@@ -0,0 +1,25 @@
|
|||||||
|
.PHONY: all build run gotool install clean help
|
||||||
|
|
||||||
|
BINARY_NAME=open_im_api
|
||||||
|
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,15 +1,16 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
apiAuth "Open_IM/src/api/auth"
|
apiAuth "Open_IM/internal/api/auth"
|
||||||
apiChat "Open_IM/src/api/chat"
|
apiChat "Open_IM/internal/api/chat"
|
||||||
"Open_IM/src/api/friend"
|
"Open_IM/internal/api/conversation"
|
||||||
"Open_IM/src/api/group"
|
"Open_IM/internal/api/friend"
|
||||||
"Open_IM/src/api/manage"
|
"Open_IM/internal/api/group"
|
||||||
apiThird "Open_IM/src/api/third"
|
"Open_IM/internal/api/manage"
|
||||||
"Open_IM/src/api/user"
|
apiThird "Open_IM/internal/api/third"
|
||||||
"Open_IM/src/common/log"
|
"Open_IM/internal/api/user"
|
||||||
"Open_IM/src/utils"
|
"Open_IM/pkg/common/log"
|
||||||
|
"Open_IM/pkg/utils"
|
||||||
"flag"
|
"flag"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"strconv"
|
"strconv"
|
||||||
@@ -17,15 +18,6 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
||||||
//logFile, err := os.OpenFile("./fatal.log", os.O_CREATE|os.O_APPEND|os.O_RDWR, 0660)
|
|
||||||
// if err != nil {
|
|
||||||
|
|
||||||
// return
|
|
||||||
// }
|
|
||||||
//syscall.Dup2(int(logFile.Fd()), int(os.Stderr.Fd()))
|
|
||||||
|
|
||||||
//log.Info("", "", "api server running...")
|
|
||||||
r := gin.Default()
|
r := gin.Default()
|
||||||
r.Use(utils.CorsHandler())
|
r.Use(utils.CorsHandler())
|
||||||
// user routing group, which handles user registration and login services
|
// user routing group, which handles user registration and login services
|
||||||
@@ -33,6 +25,7 @@ func main() {
|
|||||||
{
|
{
|
||||||
userRouterGroup.POST("/update_user_info", user.UpdateUserInfo)
|
userRouterGroup.POST("/update_user_info", user.UpdateUserInfo)
|
||||||
userRouterGroup.POST("/get_user_info", user.GetUserInfo)
|
userRouterGroup.POST("/get_user_info", user.GetUserInfo)
|
||||||
|
userRouterGroup.POST("/get_users_online_status", user.GetUsersOnlineStatus)
|
||||||
}
|
}
|
||||||
//friend routing group
|
//friend routing group
|
||||||
friendRouterGroup := r.Group("/friend")
|
friendRouterGroup := r.Group("/friend")
|
||||||
@@ -94,7 +87,16 @@ func main() {
|
|||||||
managementGroup.POST("/delete_user", manage.DeleteUser)
|
managementGroup.POST("/delete_user", manage.DeleteUser)
|
||||||
managementGroup.POST("/send_msg", manage.ManagementSendMsg)
|
managementGroup.POST("/send_msg", manage.ManagementSendMsg)
|
||||||
managementGroup.POST("/get_all_users_uid", manage.GetAllUsersUid)
|
managementGroup.POST("/get_all_users_uid", manage.GetAllUsersUid)
|
||||||
|
managementGroup.POST("/get_users_online_status", manage.GetUsersOnlineStatus)
|
||||||
}
|
}
|
||||||
|
//Conversation
|
||||||
|
conversationGroup := r.Group("/conversation")
|
||||||
|
{
|
||||||
|
conversationGroup.POST("/set_receive_message_opt", conversation.SetReceiveMessageOpt)
|
||||||
|
conversationGroup.POST("/get_receive_message_opt", conversation.GetReceiveMessageOpt)
|
||||||
|
conversationGroup.POST("/get_all_conversation_message_opt", conversation.GetAllConversationMessageOpt)
|
||||||
|
}
|
||||||
|
|
||||||
log.NewPrivateLog("api")
|
log.NewPrivateLog("api")
|
||||||
ginPort := flag.Int("port", 10000, "get ginServerPort from cmd,default 10000 as port")
|
ginPort := flag.Int("port", 10000, "get ginServerPort from cmd,default 10000 as port")
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
.PHONY: all build run gotool install clean help
|
||||||
|
|
||||||
|
BINARY_NAME=open_im_demo
|
||||||
|
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
|
||||||
|
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"Open_IM/internal/demo/register"
|
||||||
|
"Open_IM/pkg/common/log"
|
||||||
|
"Open_IM/pkg/utils"
|
||||||
|
"flag"
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
|
"strconv"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
|
||||||
|
r := gin.Default()
|
||||||
|
r.Use(utils.CorsHandler())
|
||||||
|
|
||||||
|
authRouterGroup := r.Group("/auth")
|
||||||
|
{
|
||||||
|
authRouterGroup.POST("/code", register.SendVerificationCode)
|
||||||
|
authRouterGroup.POST("/verify", register.Verify)
|
||||||
|
authRouterGroup.POST("/password", register.SetPassword)
|
||||||
|
authRouterGroup.POST("/login", register.Login)
|
||||||
|
}
|
||||||
|
log.NewPrivateLog("demo")
|
||||||
|
ginPort := flag.Int("port", 42233, "get ginServerPort from cmd,default 42233 as port")
|
||||||
|
flag.Parse()
|
||||||
|
r.Run(utils.ServerIP + ":" + strconv.Itoa(*ginPort))
|
||||||
|
}
|
||||||
@@ -2,13 +2,11 @@
|
|||||||
|
|
||||||
BINARY_NAME=open_im_msg_gateway
|
BINARY_NAME=open_im_msg_gateway
|
||||||
BIN_DIR=../../bin/
|
BIN_DIR=../../bin/
|
||||||
LAN_FILE=.go
|
|
||||||
GO_FILE:=${BINARY_NAME}${LAN_FILE}
|
|
||||||
|
|
||||||
all: gotool build
|
all: gotool build
|
||||||
|
|
||||||
build:
|
build:
|
||||||
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-w -s" -o ${BINARY_NAME} ${GO_FILE}
|
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-w -s"
|
||||||
|
|
||||||
run:
|
run:
|
||||||
@go run ./
|
@go run ./
|
||||||
@@ -1,14 +1,14 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/src/msg_gateway/gate"
|
"Open_IM/internal/msg_gateway/gate"
|
||||||
"flag"
|
"flag"
|
||||||
"sync"
|
"sync"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
rpcPort := flag.Int("rpc_port", 10500, "rpc listening port")
|
rpcPort := flag.Int("rpc_port", 10400, "rpc listening port")
|
||||||
wsPort := flag.Int("ws_port", 10800, "ws listening port")
|
wsPort := flag.Int("ws_port", 17778, "ws listening port")
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
var wg sync.WaitGroup
|
var wg sync.WaitGroup
|
||||||
wg.Add(1)
|
wg.Add(1)
|
||||||
@@ -2,13 +2,12 @@
|
|||||||
|
|
||||||
BINARY_NAME=open_im_msg_transfer
|
BINARY_NAME=open_im_msg_transfer
|
||||||
BIN_DIR=../../bin/
|
BIN_DIR=../../bin/
|
||||||
LAN_FILE=.go
|
|
||||||
GO_FILE:=${BINARY_NAME}${LAN_FILE}
|
|
||||||
|
|
||||||
all: gotool build
|
all: gotool build
|
||||||
|
|
||||||
build:
|
build:
|
||||||
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-w -s" -o ${BINARY_NAME} ${GO_FILE}
|
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-w -s"
|
||||||
|
|
||||||
run:
|
run:
|
||||||
@go run ./
|
@go run ./
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/src/msg_transfer/logic"
|
"Open_IM/internal/msg_transfer/logic"
|
||||||
"sync"
|
"sync"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -2,13 +2,11 @@
|
|||||||
|
|
||||||
BINARY_NAME=open_im_push
|
BINARY_NAME=open_im_push
|
||||||
BIN_DIR=../../bin/
|
BIN_DIR=../../bin/
|
||||||
LAN_FILE=.go
|
|
||||||
GO_FILE:=${BINARY_NAME}${LAN_FILE}
|
|
||||||
|
|
||||||
all: gotool build
|
all: gotool build
|
||||||
|
|
||||||
build:
|
build:
|
||||||
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-w -s" -o ${BINARY_NAME} ${GO_FILE}
|
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-w -s"
|
||||||
|
|
||||||
run:
|
run:
|
||||||
@go run ./
|
@go run ./
|
||||||
@@ -1,13 +1,13 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/src/push/logic"
|
"Open_IM/internal/push/logic"
|
||||||
"flag"
|
"flag"
|
||||||
"sync"
|
"sync"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
rpcPort := flag.Int("port", -1, "rpc listening port")
|
rpcPort := flag.Int("port", 10700, "rpc listening port")
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
var wg sync.WaitGroup
|
var wg sync.WaitGroup
|
||||||
wg.Add(1)
|
wg.Add(1)
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
.PHONY: all build run gotool install clean help
|
||||||
|
|
||||||
|
BINARY_NAME=open_im_timer_task
|
||||||
|
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
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,65 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
commonDB "Open_IM/pkg/common/db"
|
||||||
|
"Open_IM/pkg/common/db/mysql_model/im_mysql_model"
|
||||||
|
"Open_IM/pkg/common/log"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
log.NewPrivateLog("timer")
|
||||||
|
//for {
|
||||||
|
// fmt.Println("start delete mongodb expired record")
|
||||||
|
// timeUnixBegin := time.Now().Unix()
|
||||||
|
// count, _ := db.DB.MgoUserCount()
|
||||||
|
// fmt.Println("mongodb record count: ", count)
|
||||||
|
// for i := 0; i < count; i++ {
|
||||||
|
// time.Sleep(1 * time.Millisecond)
|
||||||
|
// uid, _ := db.DB.MgoSkipUID(i)
|
||||||
|
// fmt.Println("operate uid: ", uid)
|
||||||
|
// err := db.DB.DelUserChat(uid)
|
||||||
|
// if err != nil {
|
||||||
|
// fmt.Println("operate uid failed: ", uid, err.Error())
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// timeUnixEnd := time.Now().Unix()
|
||||||
|
// costTime := timeUnixEnd - timeUnixBegin
|
||||||
|
// if costTime > int64(config.Config.Mongo.DBRetainChatRecords*24*3600) {
|
||||||
|
// continue
|
||||||
|
// } else {
|
||||||
|
// sleepTime := 0
|
||||||
|
// if int64(config.Config.Mongo.DBRetainChatRecords*24*3600)-costTime > 24*3600 {
|
||||||
|
// sleepTime = 24 * 3600
|
||||||
|
// } else {
|
||||||
|
// sleepTime = config.Config.Mongo.DBRetainChatRecords*24*3600 - int(costTime)
|
||||||
|
// }
|
||||||
|
// fmt.Println("sleep: ", sleepTime)
|
||||||
|
// time.Sleep(time.Duration(sleepTime) * time.Second)
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
for {
|
||||||
|
uidList, err := im_mysql_model.SelectAllUID()
|
||||||
|
if err != nil {
|
||||||
|
//log.NewError("999999", err.Error())
|
||||||
|
} else {
|
||||||
|
for _, v := range uidList {
|
||||||
|
minSeq, err := commonDB.DB.GetMinSeqFromMongo(v)
|
||||||
|
if err != nil {
|
||||||
|
//log.NewError("999999", "get user minSeq err", err.Error(), v)
|
||||||
|
continue
|
||||||
|
} else {
|
||||||
|
err := commonDB.DB.SetUserMinSeq(v, minSeq)
|
||||||
|
if err != nil {
|
||||||
|
//log.NewError("999999", "set user minSeq err", err.Error(), v)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
time.Sleep(time.Duration(100) * time.Millisecond)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
.PHONY: all build run gotool install clean help
|
||||||
|
|
||||||
|
BINARY_NAME=open_im_auth
|
||||||
|
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,7 +1,7 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
rpcAuth "Open_IM/src/rpc/auth/auth"
|
rpcAuth "Open_IM/internal/rpc/auth"
|
||||||
"flag"
|
"flag"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
.PHONY: all build run gotool install clean help
|
||||||
|
|
||||||
|
BINARY_NAME=open_im_friend
|
||||||
|
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,7 +1,7 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/src/rpc/friend/friend"
|
"Open_IM/internal/rpc/friend"
|
||||||
"flag"
|
"flag"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
.PHONY: all build run gotool install clean help
|
||||||
|
|
||||||
|
BINARY_NAME=open_im_group
|
||||||
|
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,7 +1,7 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/src/rpc/group/group"
|
"Open_IM/internal/rpc/group"
|
||||||
"flag"
|
"flag"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -2,13 +2,11 @@
|
|||||||
|
|
||||||
BINARY_NAME=open_im_msg
|
BINARY_NAME=open_im_msg
|
||||||
BIN_DIR=../../../bin/
|
BIN_DIR=../../../bin/
|
||||||
LAN_FILE=.go
|
|
||||||
GO_FILE:=${BINARY_NAME}${LAN_FILE}
|
|
||||||
|
|
||||||
all: gotool build
|
all: gotool build
|
||||||
|
|
||||||
build:
|
build:
|
||||||
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-w -s" -o ${BINARY_NAME} ${GO_FILE}
|
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-w -s"
|
||||||
|
|
||||||
run:
|
run:
|
||||||
@go run ./
|
@go run ./
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
rpcChat "Open_IM/internal/rpc/chat"
|
||||||
|
"flag"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
rpcPort := flag.Int("port", 10300, "rpc listening port")
|
||||||
|
flag.Parse()
|
||||||
|
rpcServer := rpcChat.NewRpcChatServer(*rpcPort)
|
||||||
|
rpcServer.Run()
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
.PHONY: all build run gotool install clean help
|
||||||
|
|
||||||
|
BINARY_NAME=open_im_user
|
||||||
|
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,7 +1,7 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/src/rpc/user/user"
|
"Open_IM/internal/rpc/user"
|
||||||
"flag"
|
"flag"
|
||||||
)
|
)
|
||||||
|
|
||||||
+53
-18
@@ -1,14 +1,14 @@
|
|||||||
# The class cannot be named by Pascal or camel case.
|
# The class cannot be named by Pascal or camel case.
|
||||||
# If it is not used, the corresponding structure will not be set,
|
# If it is not used, the corresponding structure will not be set,
|
||||||
# and it will not be read naturally.
|
# and it will not be read naturally.
|
||||||
serverversion: 1.0.0
|
serverversion: 1.0.3
|
||||||
#---------------Infrastructure configuration---------------------#
|
#---------------Infrastructure configuration---------------------#
|
||||||
etcd:
|
etcd:
|
||||||
etcdSchema: openIM
|
etcdSchema: openIM
|
||||||
etcdAddr: [ 127.0.0.1:2379 ]
|
etcdAddr: [ 127.0.0.1:2379 ]
|
||||||
|
|
||||||
mysql:
|
mysql:
|
||||||
dbMysqlAddress: [ 127.0.0.1:3306 ]
|
dbMysqlAddress: [ 127.0.0.1:13306 ]
|
||||||
dbMysqlUserName: root
|
dbMysqlUserName: root
|
||||||
dbMysqlPassword: openIM
|
dbMysqlPassword: openIM
|
||||||
dbMysqlDatabaseName: openIM
|
dbMysqlDatabaseName: openIM
|
||||||
@@ -19,7 +19,7 @@ mysql:
|
|||||||
dbMaxLifeTime: 120
|
dbMaxLifeTime: 120
|
||||||
|
|
||||||
mongo:
|
mongo:
|
||||||
dbAddress: [ 127.0.0.1:27017 ]
|
dbAddress: [ 127.0.0.1:37017 ]
|
||||||
dbDirect: false
|
dbDirect: false
|
||||||
dbTimeout: 10
|
dbTimeout: 10
|
||||||
dbDatabase: openIM
|
dbDatabase: openIM
|
||||||
@@ -30,7 +30,7 @@ mongo:
|
|||||||
dbRetainChatRecords: 7
|
dbRetainChatRecords: 7
|
||||||
|
|
||||||
redis:
|
redis:
|
||||||
dbAddress: 127.0.0.1:6379
|
dbAddress: 127.0.0.1:16379
|
||||||
dbMaxIdle: 128
|
dbMaxIdle: 128
|
||||||
dbMaxActive: 0
|
dbMaxActive: 0
|
||||||
dbIdleTimeout: 120
|
dbIdleTimeout: 120
|
||||||
@@ -55,7 +55,7 @@ kafka:
|
|||||||
# The service ip default is empty,
|
# The service ip default is empty,
|
||||||
# automatically obtain the machine's valid network card ip as the service ip,
|
# automatically obtain the machine's valid network card ip as the service ip,
|
||||||
# otherwise the configuration ip is preferred
|
# otherwise the configuration ip is preferred
|
||||||
serverip:
|
serverip: 0.0.0.0
|
||||||
|
|
||||||
api:
|
api:
|
||||||
openImApiPort: [ 10000 ]
|
openImApiPort: [ 10000 ]
|
||||||
@@ -74,12 +74,20 @@ credential:
|
|||||||
rpcport:
|
rpcport:
|
||||||
openImUserPort: [ 10100 ]
|
openImUserPort: [ 10100 ]
|
||||||
openImFriendPort: [ 10200 ]
|
openImFriendPort: [ 10200 ]
|
||||||
openImOfflineMessagePort: [ 10300 ]
|
openImOfflineMessagePort: [ 10300]
|
||||||
openImOnlineRelayPort: [ 10400 ]
|
openImOnlineRelayPort: [ 10400 ]
|
||||||
openImGroupPort: [ 10500 ]
|
openImGroupPort: [ 10500 ]
|
||||||
openImAuthPort: [ 10600 ]
|
openImAuthPort: [ 10600 ]
|
||||||
openImPushPort: [ 10700 ]
|
openImPushPort: [ 10700 ]
|
||||||
|
c2c:
|
||||||
|
callbackBeforeSendMsg:
|
||||||
|
switch: false
|
||||||
|
timeoutStrategy: 1 #1:send
|
||||||
|
callbackAfterSendMsg:
|
||||||
|
switch: false
|
||||||
|
state:
|
||||||
|
stateChange:
|
||||||
|
switch: false
|
||||||
|
|
||||||
rpcregistername:
|
rpcregistername:
|
||||||
openImUserName: User
|
openImUserName: User
|
||||||
@@ -120,27 +128,54 @@ push:
|
|||||||
accessID: 111
|
accessID: 111
|
||||||
secretKey: 111
|
secretKey: 111
|
||||||
jpns:
|
jpns:
|
||||||
appKey: 2783339cee4de379cc798fe1
|
appKey: cf47465a368f24c659608e7e
|
||||||
masterSecret: 66e5f309e032c68cc668c28a
|
masterSecret: 02204efe3f3832947a236ee5
|
||||||
pushUrl: "https://api.jpush.cn/v3/push"
|
pushUrl: "https://api.jpush.cn/v3/push"
|
||||||
|
pushIntent: "intent:#Intent;component=io.openim.app.enterprisechat/io.openim.app.enterprisechat.MainActivity;end"
|
||||||
manager:
|
manager:
|
||||||
appManagerUid: ["openIM123456","openIM654321"]
|
appManagerUid: ["openIM123456","openIM654321"]
|
||||||
secrets: ["openIM1","openIM2"]
|
secrets: ["openIM1","openIM2"]
|
||||||
|
|
||||||
secret: tuoyun
|
secret: tuoyun
|
||||||
|
|
||||||
multiloginpolicy:
|
multiloginpolicy: 1
|
||||||
onlyOneTerminalAccess: false
|
|
||||||
mobileAndPCTerminalAccessButOtherTerminalKickEachOther: true
|
|
||||||
allTerminalAccess: false
|
|
||||||
|
|
||||||
#token config
|
#token config
|
||||||
tokenpolicy:
|
tokenpolicy:
|
||||||
accessSecret: "open_im_server"
|
accessSecret: "open_im_server"
|
||||||
# Token effective time seconds as a unit
|
# Token effective time day as a unit
|
||||||
#Seven days 7*24*60*60
|
accessExpire: 7
|
||||||
accessExpire: 604800
|
|
||||||
|
|
||||||
messagecallback:
|
messagecallback:
|
||||||
callbackSwitch: false
|
callbackUrl: "http://www.xxx.com/msg/judge"
|
||||||
callbackUrl: "http://www.xxx.com/msg/judge"
|
#TimeOut use second as unit
|
||||||
|
callbackTimeOut: 10
|
||||||
|
c2c:
|
||||||
|
callbackBeforeSendMsg:
|
||||||
|
switch: false
|
||||||
|
timeoutStrategy: 1 #1:send
|
||||||
|
callbackAfterSendMsg:
|
||||||
|
switch: false
|
||||||
|
state:
|
||||||
|
stateChange:
|
||||||
|
switch: false
|
||||||
|
|
||||||
|
#---------------demo configuration---------------------#
|
||||||
|
#The following configuration items are applied to openIM Demo configuration
|
||||||
|
demoswitch: true
|
||||||
|
demo:
|
||||||
|
openImDemoPort: [ 42233 ]
|
||||||
|
alismsverify:
|
||||||
|
accessKeyId: LTAI5tJPkn4HuuePdiLdGqe71
|
||||||
|
accessKeySecret: 4n9OJ7ZCVN1U6KeHDAtOyNeVZcjOuV1
|
||||||
|
signName: OpenIM Corporation
|
||||||
|
verificationCodeTemplateCode: SMS_2268101641
|
||||||
|
superCode: 666666
|
||||||
|
mail:
|
||||||
|
title: "openIM"
|
||||||
|
senderMail: "1765567899@qq.com"
|
||||||
|
senderAuthorizationCode: "1gxyausfoevlzbfag"
|
||||||
|
smtpAddr: "smtp.qq.com"
|
||||||
|
smtpPort: 25
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+18
-36
@@ -5,7 +5,8 @@ services:
|
|||||||
mysql:
|
mysql:
|
||||||
image: mysql:5.7
|
image: mysql:5.7
|
||||||
ports:
|
ports:
|
||||||
- 3306:3306
|
- 13306:3306
|
||||||
|
- 23306:33060
|
||||||
container_name: mysql
|
container_name: mysql
|
||||||
volumes:
|
volumes:
|
||||||
- ./components/mysql/data:/var/lib/mysql
|
- ./components/mysql/data:/var/lib/mysql
|
||||||
@@ -15,20 +16,25 @@ services:
|
|||||||
restart: always
|
restart: always
|
||||||
|
|
||||||
mongodb:
|
mongodb:
|
||||||
image: mongo
|
image: mongo:4.0
|
||||||
ports:
|
ports:
|
||||||
- 27017:27017
|
- 37017:27017
|
||||||
container_name: mongo
|
container_name: mongo
|
||||||
volumes:
|
volumes:
|
||||||
- ./components/mongodb/data:/data/db
|
- ./components/mongodb/data/db:/data/db
|
||||||
environment:
|
- ./components/mongodb/data/logs:/data/logs
|
||||||
TZ: Asia/Shanghai
|
- ./components/mongodb/data/conf:/etc/mongo
|
||||||
|
# environment:
|
||||||
|
# - MONGO_INITDB_ROOT_USERNAME=openIM
|
||||||
|
# - MONGO_INITDB_ROOT_PASSWORD=openIM
|
||||||
|
|
||||||
|
#TZ: Asia/Shanghai
|
||||||
restart: always
|
restart: always
|
||||||
|
|
||||||
redis:
|
redis:
|
||||||
image: redis
|
image: redis
|
||||||
ports:
|
ports:
|
||||||
- 6379:6379
|
- 16379:6379
|
||||||
container_name: redis
|
container_name: redis
|
||||||
volumes:
|
volumes:
|
||||||
- ./components/redis/data:/data
|
- ./components/redis/data:/data
|
||||||
@@ -82,38 +88,14 @@ services:
|
|||||||
restart: always
|
restart: always
|
||||||
command: /usr/local/bin/etcd --name etcd0 --data-dir /etcd-data --listen-client-urls http://0.0.0.0:2379 --advertise-client-urls http://0.0.0.0:2379 --listen-peer-urls http://0.0.0.0:2380 --initial-advertise-peer-urls http://0.0.0.0:2380 --initial-cluster etcd0=http://0.0.0.0:2380 --initial-cluster-token tkn --initial-cluster-state new
|
command: /usr/local/bin/etcd --name etcd0 --data-dir /etcd-data --listen-client-urls http://0.0.0.0:2379 --advertise-client-urls http://0.0.0.0:2379 --listen-peer-urls http://0.0.0.0:2380 --initial-advertise-peer-urls http://0.0.0.0:2380 --initial-cluster etcd0=http://0.0.0.0:2380 --initial-cluster-token tkn --initial-cluster-state new
|
||||||
|
|
||||||
|
open_im_server:
|
||||||
#fixme-----build from dockerfile---------
|
image: openim/open_im_server
|
||||||
# open-im-server:
|
container_name: open_im_server
|
||||||
# image: open_im_server
|
|
||||||
# container_name: open-im-server
|
|
||||||
# volumes:
|
|
||||||
# - ./logs:/Open-IM-Server/logs
|
|
||||||
# - ./config/config.yaml:/Open-IM-Server/config/config.yaml
|
|
||||||
# restart: always
|
|
||||||
# build:
|
|
||||||
# context: .
|
|
||||||
# dockerfile: deploy.Dockerfile
|
|
||||||
# depends_on:
|
|
||||||
# - mysql
|
|
||||||
# - mongodb
|
|
||||||
# - redis
|
|
||||||
# - kafka
|
|
||||||
# - etcd
|
|
||||||
# network_mode: "host"
|
|
||||||
# logging:
|
|
||||||
# driver: json-file
|
|
||||||
# options:
|
|
||||||
# max-size: "1g"
|
|
||||||
# max-file: "2"
|
|
||||||
|
|
||||||
#fixme----build from docker hub------
|
|
||||||
open-im-server:
|
|
||||||
image: lyt1123/open_im_server
|
|
||||||
container_name: open-im-server
|
|
||||||
volumes:
|
volumes:
|
||||||
- ./logs:/Open-IM-Server/logs
|
- ./logs:/Open-IM-Server/logs
|
||||||
- ./config/config.yaml:/Open-IM-Server/config/config.yaml
|
- ./config/config.yaml:/Open-IM-Server/config/config.yaml
|
||||||
|
- ./db/sdk:/Open-IM-Server/db/sdk
|
||||||
|
- ./script:/Open-IM-Server/script
|
||||||
restart: always
|
restart: always
|
||||||
depends_on:
|
depends_on:
|
||||||
- kafka
|
- kafka
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 21 KiB |
@@ -5,19 +5,23 @@ go 1.15
|
|||||||
require (
|
require (
|
||||||
github.com/Shopify/sarama v1.19.0
|
github.com/Shopify/sarama v1.19.0
|
||||||
github.com/Shopify/toxiproxy v2.1.4+incompatible // indirect
|
github.com/Shopify/toxiproxy v2.1.4+incompatible // indirect
|
||||||
|
github.com/alibabacloud-go/darabonba-openapi v0.1.11
|
||||||
|
github.com/alibabacloud-go/dysmsapi-20170525/v2 v2.0.8
|
||||||
|
github.com/alibabacloud-go/tea v1.1.17
|
||||||
github.com/antonfisher/nested-logrus-formatter v1.3.0
|
github.com/antonfisher/nested-logrus-formatter v1.3.0
|
||||||
|
github.com/bwmarrin/snowflake v0.3.0
|
||||||
github.com/coreos/go-semver v0.3.0 // indirect
|
github.com/coreos/go-semver v0.3.0 // indirect
|
||||||
github.com/dgrijalva/jwt-go v3.2.0+incompatible
|
|
||||||
github.com/dustin/go-humanize v1.0.0 // indirect
|
github.com/dustin/go-humanize v1.0.0 // indirect
|
||||||
github.com/eapache/go-resiliency v1.2.0 // indirect
|
github.com/eapache/go-resiliency v1.2.0 // indirect
|
||||||
github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21 // indirect
|
github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21 // indirect
|
||||||
github.com/eapache/queue v1.1.0 // indirect
|
github.com/eapache/queue v1.1.0 // indirect
|
||||||
github.com/frankban/quicktest v1.11.3 // indirect
|
github.com/frankban/quicktest v1.14.0 // indirect
|
||||||
github.com/garyburd/redigo v1.6.2
|
github.com/garyburd/redigo v1.6.2
|
||||||
github.com/gin-gonic/gin v1.7.0
|
github.com/gin-gonic/gin v1.7.0
|
||||||
github.com/go-playground/validator/v10 v10.4.1
|
github.com/go-playground/validator/v10 v10.4.1
|
||||||
|
github.com/golang-jwt/jwt/v4 v4.1.0
|
||||||
github.com/golang/protobuf v1.5.2
|
github.com/golang/protobuf v1.5.2
|
||||||
github.com/golang/snappy v0.0.3 // indirect
|
github.com/golang/snappy v0.0.4 // indirect
|
||||||
github.com/gorilla/websocket v1.4.2
|
github.com/gorilla/websocket v1.4.2
|
||||||
github.com/jinzhu/gorm v1.9.16
|
github.com/jinzhu/gorm v1.9.16
|
||||||
github.com/jonboulle/clockwork v0.2.2 // indirect
|
github.com/jonboulle/clockwork v0.2.2 // indirect
|
||||||
@@ -28,19 +32,22 @@ require (
|
|||||||
github.com/mitchellh/mapstructure v1.4.1
|
github.com/mitchellh/mapstructure v1.4.1
|
||||||
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646
|
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646
|
||||||
github.com/olivere/elastic/v7 v7.0.23
|
github.com/olivere/elastic/v7 v7.0.23
|
||||||
github.com/pierrec/lz4 v2.6.0+incompatible // indirect
|
github.com/pierrec/lz4 v2.6.1+incompatible // indirect
|
||||||
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect
|
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect
|
||||||
github.com/rifflock/lfshook v0.0.0-20180920164130-b9218ef580f5
|
github.com/rifflock/lfshook v0.0.0-20180920164130-b9218ef580f5
|
||||||
github.com/sirupsen/logrus v1.6.0
|
github.com/sirupsen/logrus v1.8.1
|
||||||
|
github.com/stretchr/testify v1.7.0
|
||||||
github.com/tencentyun/qcloud-cos-sts-sdk v0.0.0-20210325043845-84a0811633ca
|
github.com/tencentyun/qcloud-cos-sts-sdk v0.0.0-20210325043845-84a0811633ca
|
||||||
github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5 // indirect
|
github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5 // indirect
|
||||||
go.etcd.io/etcd v0.0.0-20200402134248-51bdeb39e698
|
go.etcd.io/etcd v0.0.0-20200402134248-51bdeb39e698
|
||||||
golang.org/x/image v0.0.0-20210220032944-ac19c3e999fb
|
golang.org/x/image v0.0.0-20210220032944-ac19c3e999fb
|
||||||
golang.org/x/net v0.0.0-20201110031124-69a78807bb2b
|
golang.org/x/net v0.0.0-20210917221730-978cfadd31cf
|
||||||
golang.org/x/tools v0.0.0-20210106214847-113979e3529a // indirect
|
golang.org/x/tools v0.0.0-20210106214847-113979e3529a // indirect
|
||||||
google.golang.org/grpc v1.33.2
|
google.golang.org/grpc v1.33.2
|
||||||
|
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect
|
||||||
|
gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df
|
||||||
gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22
|
gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22
|
||||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c
|
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b
|
||||||
sigs.k8s.io/yaml v1.2.0 // indirect
|
sigs.k8s.io/yaml v1.2.0 // indirect
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,30 @@ github.com/Shopify/toxiproxy v2.1.4+incompatible h1:TKdv8HiTLgE5wdJuEML90aBgNWso
|
|||||||
github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI=
|
github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI=
|
||||||
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
|
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
|
||||||
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
|
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
|
||||||
|
github.com/alibabacloud-go/darabonba-openapi v0.1.11 h1:w59gtSA0s87p0U5NNG/N/PIHsRP3rtj7qCP9hx9+GL8=
|
||||||
|
github.com/alibabacloud-go/darabonba-openapi v0.1.11/go.mod h1:MPJMxv7HYrFm5m9uOZWkDYsAWyZztEgnBRfk9Fg0eIU=
|
||||||
|
github.com/alibabacloud-go/darabonba-string v1.0.0/go.mod h1:93cTfV3vuPhhEwGGpKKqhVW4jLe7tDpo3LUM0i0g6mA=
|
||||||
|
github.com/alibabacloud-go/debug v0.0.0-20190504072949-9472017b5c68 h1:NqugFkGxx1TXSh/pBcU00Y6bljgDPaFdh5MUSeJ7e50=
|
||||||
|
github.com/alibabacloud-go/debug v0.0.0-20190504072949-9472017b5c68/go.mod h1:6pb/Qy8c+lqua8cFpEy7g39NRRqOWc3rOwAy8m5Y2BY=
|
||||||
|
github.com/alibabacloud-go/dysmsapi-20170525 v1.1.2 h1:AiQv4HpDWV0GAXzauPB2Xdrx4cuBo18bqNzIjMJyWjk=
|
||||||
|
github.com/alibabacloud-go/dysmsapi-20170525/v2 v2.0.8 h1:KXMiCg99Jx7B6V+DlRFbWwL9UCGippE5z1wGzhyimiA=
|
||||||
|
github.com/alibabacloud-go/dysmsapi-20170525/v2 v2.0.8/go.mod h1:8aL6tSyQIWJygF7W/Vqxdf/QDbN2S+u57k36bEA8hD8=
|
||||||
|
github.com/alibabacloud-go/endpoint-util v1.1.0 h1:r/4D3VSw888XGaeNpP994zDUaxdgTSHBbVfZlzf6b5Q=
|
||||||
|
github.com/alibabacloud-go/endpoint-util v1.1.0/go.mod h1:O5FuCALmCKs2Ff7JFJMudHs0I5EBgecXXxZRyswlEjE=
|
||||||
|
github.com/alibabacloud-go/openapi-util v0.0.9 h1:Z0DP4LFzkM/rW2nxOMiiLoQVZSeE3jVc5jrZ9Fd/UX0=
|
||||||
|
github.com/alibabacloud-go/openapi-util v0.0.9/go.mod h1:sQuElr4ywwFRlCCberQwKRFhRzIyG4QTP/P4y1CJ6Ws=
|
||||||
|
github.com/alibabacloud-go/tea v1.1.0/go.mod h1:IkGyUSX4Ba1V+k4pCtJUc6jDpZLFph9QMy2VUPTwukg=
|
||||||
|
github.com/alibabacloud-go/tea v1.1.7/go.mod h1:/tmnEaQMyb4Ky1/5D+SE1BAsa5zj/KeGOFfwYm3N/p4=
|
||||||
|
github.com/alibabacloud-go/tea v1.1.8/go.mod h1:/tmnEaQMyb4Ky1/5D+SE1BAsa5zj/KeGOFfwYm3N/p4=
|
||||||
|
github.com/alibabacloud-go/tea v1.1.11/go.mod h1:/tmnEaQMyb4Ky1/5D+SE1BAsa5zj/KeGOFfwYm3N/p4=
|
||||||
|
github.com/alibabacloud-go/tea v1.1.15/go.mod h1:nXxjm6CIFkBhwW4FQkNrolwbfon8Svy6cujmKFUq98A=
|
||||||
|
github.com/alibabacloud-go/tea v1.1.17 h1:05R5DnaJXe9sCNIe8KUgWHC/z6w/VZIwczgUwzRnul8=
|
||||||
|
github.com/alibabacloud-go/tea v1.1.17/go.mod h1:nXxjm6CIFkBhwW4FQkNrolwbfon8Svy6cujmKFUq98A=
|
||||||
|
github.com/alibabacloud-go/tea-utils v1.3.1/go.mod h1:EI/o33aBfj3hETm4RLiAxF/ThQdSngxrpF8rKUDJjPE=
|
||||||
|
github.com/alibabacloud-go/tea-utils v1.3.9 h1:TtbzxS+BXrisA7wzbAMRtlU8A2eWLg0ufm7m/Tl6fc4=
|
||||||
|
github.com/alibabacloud-go/tea-utils v1.3.9/go.mod h1:EI/o33aBfj3hETm4RLiAxF/ThQdSngxrpF8rKUDJjPE=
|
||||||
|
github.com/aliyun/credentials-go v1.1.2 h1:qU1vwGIBb3UJ8BwunHDRFtAhS6jnQLnde/yk0+Ih2GY=
|
||||||
|
github.com/aliyun/credentials-go v1.1.2/go.mod h1:ozcZaMR5kLM7pwtCMEpVmQ242suV6qTJya2bDq4X1Tw=
|
||||||
github.com/andybalholm/cascadia v1.1.0/go.mod h1:GsXiBklL0woXo1j/WYWtSYYC4ouU9PqHO0sqidkEA4Y=
|
github.com/andybalholm/cascadia v1.1.0/go.mod h1:GsXiBklL0woXo1j/WYWtSYYC4ouU9PqHO0sqidkEA4Y=
|
||||||
github.com/antonfisher/nested-logrus-formatter v1.3.0 h1:8zixYquU1Odk+vzAaAQPAdRh1ZjmUXNQ1T+dUBvlhVo=
|
github.com/antonfisher/nested-logrus-formatter v1.3.0 h1:8zixYquU1Odk+vzAaAQPAdRh1ZjmUXNQ1T+dUBvlhVo=
|
||||||
github.com/antonfisher/nested-logrus-formatter v1.3.0/go.mod h1:6WTfyWFkBc9+zyBaKIqRrg/KwMqBbodBjgbHjDz7zjA=
|
github.com/antonfisher/nested-logrus-formatter v1.3.0/go.mod h1:6WTfyWFkBc9+zyBaKIqRrg/KwMqBbodBjgbHjDz7zjA=
|
||||||
@@ -15,6 +39,8 @@ github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24
|
|||||||
github.com/beorn7/perks v1.0.0 h1:HWo1m869IqiPhD389kmkxeTalrjNbbJTC8LXupb+sl0=
|
github.com/beorn7/perks v1.0.0 h1:HWo1m869IqiPhD389kmkxeTalrjNbbJTC8LXupb+sl0=
|
||||||
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
|
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
|
||||||
github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs=
|
github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs=
|
||||||
|
github.com/bwmarrin/snowflake v0.3.0 h1:xm67bEhkKh6ij1790JB83OujPR5CzNe8QuQqAgISZN0=
|
||||||
|
github.com/bwmarrin/snowflake v0.3.0/go.mod h1:NdZxfVWX+oR6y2K0o6qAYv6gIOP9rjG0/E9WsDpxqwE=
|
||||||
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
|
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
|
||||||
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
|
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
|
||||||
github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa h1:OaNxuTZr7kxeODyLWsRMC+OD03aFUH+mW6r2d+MWa5Y=
|
github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa h1:OaNxuTZr7kxeODyLWsRMC+OD03aFUH+mW6r2d+MWa5Y=
|
||||||
@@ -25,6 +51,7 @@ github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3Ee
|
|||||||
github.com/coreos/go-systemd/v22 v22.0.0 h1:XJIw/+VlJ+87J+doOxznsAWIdmWuViOVhkQamW5YV28=
|
github.com/coreos/go-systemd/v22 v22.0.0 h1:XJIw/+VlJ+87J+doOxznsAWIdmWuViOVhkQamW5YV28=
|
||||||
github.com/coreos/go-systemd/v22 v22.0.0/go.mod h1:xO0FLkIi5MaZafQlIrOotqXZ90ih+1atmu1JpKERPPk=
|
github.com/coreos/go-systemd/v22 v22.0.0/go.mod h1:xO0FLkIi5MaZafQlIrOotqXZ90ih+1atmu1JpKERPPk=
|
||||||
github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY=
|
github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY=
|
||||||
|
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
|
||||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
@@ -48,8 +75,8 @@ github.com/erikstmartin/go-testdb v0.0.0-20160219214506-8d10e4a1bae5/go.mod h1:a
|
|||||||
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
|
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
|
||||||
github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw=
|
github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw=
|
||||||
github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g=
|
github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g=
|
||||||
github.com/frankban/quicktest v1.11.3 h1:8sXhOn0uLys67V8EsXLc6eszDs8VXWxL3iRvebPhedY=
|
github.com/frankban/quicktest v1.14.0 h1:+cqqvzZV87b4adx/5ayVOaYZ2CrvM4ejQvUdBzPPUss=
|
||||||
github.com/frankban/quicktest v1.11.3/go.mod h1:wRf/ReqHper53s+kmmSZizM8NamnL3IM0I9ntUbOk+k=
|
github.com/frankban/quicktest v1.14.0/go.mod h1:NeW+ay9A/U67EYXNFA1nPE8e/tnQv/09mUdL/ijj8og=
|
||||||
github.com/garyburd/redigo v1.6.2 h1:yE/pwKCrbLpLpQICzYTeZ7JsTA/C53wFTJHaEtRqniM=
|
github.com/garyburd/redigo v1.6.2 h1:yE/pwKCrbLpLpQICzYTeZ7JsTA/C53wFTJHaEtRqniM=
|
||||||
github.com/garyburd/redigo v1.6.2/go.mod h1:NR3MbYisc3/PwhQ00EMzDiPmrwpPxAn5GI05/YaO1SY=
|
github.com/garyburd/redigo v1.6.2/go.mod h1:NR3MbYisc3/PwhQ00EMzDiPmrwpPxAn5GI05/YaO1SY=
|
||||||
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
|
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
|
||||||
@@ -74,6 +101,8 @@ github.com/godbus/dbus/v5 v5.0.3/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5x
|
|||||||
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
|
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
|
||||||
github.com/gogo/protobuf v1.2.1 h1:/s5zKNz0uPFCZ5hddgPdo2TK2TVrUNMn0OOX8/aZMTE=
|
github.com/gogo/protobuf v1.2.1 h1:/s5zKNz0uPFCZ5hddgPdo2TK2TVrUNMn0OOX8/aZMTE=
|
||||||
github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4=
|
github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4=
|
||||||
|
github.com/golang-jwt/jwt/v4 v4.1.0 h1:XUgk2Ex5veyVFVeLm0xhusUTQybEbexJXrvPNOKkSY0=
|
||||||
|
github.com/golang-jwt/jwt/v4 v4.1.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg=
|
||||||
github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe h1:lXe2qZdvpiX5WZkZR4hgp4KJVfY3nMkvmwbVkpv1rVY=
|
github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe h1:lXe2qZdvpiX5WZkZR4hgp4KJVfY3nMkvmwbVkpv1rVY=
|
||||||
github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0=
|
github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0=
|
||||||
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
|
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
|
||||||
@@ -94,8 +123,8 @@ github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw
|
|||||||
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
|
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
|
||||||
github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw=
|
github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw=
|
||||||
github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
|
github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
|
||||||
github.com/golang/snappy v0.0.3 h1:fHPg5GQYlCeLIPB9BZqMVR5nR9A+IM5zcgeTdjMYmLA=
|
github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM=
|
||||||
github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
|
github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
|
||||||
github.com/google/btree v1.0.0 h1:0udJVsspx3VBr5FwtLhQQtuAsVc79tTq0ocGIPAU6qo=
|
github.com/google/btree v1.0.0 h1:0udJVsspx3VBr5FwtLhQQtuAsVc79tTq0ocGIPAU6qo=
|
||||||
github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
|
github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
|
||||||
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
|
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
|
||||||
@@ -103,13 +132,16 @@ github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMyw
|
|||||||
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
||||||
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||||
github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||||
github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
|
||||||
github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
|
|
||||||
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||||
|
github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ=
|
||||||
|
github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||||
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||||
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
|
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
|
||||||
github.com/google/uuid v1.0.0 h1:b4Gk+7WdP/d3HZH8EJsZpvV7EtDOgaZLtnaNGIu1adA=
|
github.com/google/uuid v1.0.0 h1:b4Gk+7WdP/d3HZH8EJsZpvV7EtDOgaZLtnaNGIu1adA=
|
||||||
github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||||
|
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
|
||||||
|
github.com/gopherjs/gopherjs v0.0.0-20200217142428-fce0ec30dd00 h1:l5lAOZEym3oK3SQ2HBHWsJUfbNBiTXJDeW2QDxw9AQ0=
|
||||||
|
github.com/gopherjs/gopherjs v0.0.0-20200217142428-fce0ec30dd00/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
|
||||||
github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
|
github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
|
||||||
github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc=
|
github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc=
|
||||||
github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
|
github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
|
||||||
@@ -137,19 +169,22 @@ github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCV
|
|||||||
github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
|
github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
|
||||||
github.com/json-iterator/go v1.1.9 h1:9yzud/Ht36ygwatGx56VwCZtlI/2AD15T1X2sjSuGns=
|
github.com/json-iterator/go v1.1.9 h1:9yzud/Ht36ygwatGx56VwCZtlI/2AD15T1X2sjSuGns=
|
||||||
github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
|
github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
|
||||||
|
github.com/json-iterator/go v1.1.10 h1:Kz6Cvnvv2wGdaG/V8yMvfkmNiXq9Ya2KUv4rouJJr68=
|
||||||
|
github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
|
||||||
|
github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo=
|
||||||
|
github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
|
||||||
github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
|
github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
|
||||||
github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q=
|
github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q=
|
||||||
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
|
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
|
||||||
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
||||||
github.com/konsorten/go-windows-terminal-sequences v1.0.3 h1:CE8S1cTafDpPvMhIxNJKvHsGVBgn1xWYf1NbHQhywc8=
|
|
||||||
github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
|
||||||
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
|
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
|
||||||
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
||||||
github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI=
|
github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0=
|
||||||
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
|
github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk=
|
||||||
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||||
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
|
|
||||||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||||
|
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
||||||
|
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
||||||
github.com/leodido/go-urn v1.2.0 h1:hpXL4XnriNwQ/ABnpepYM/1vCLWNDfUNts8dX3xTG6Y=
|
github.com/leodido/go-urn v1.2.0 h1:hpXL4XnriNwQ/ABnpepYM/1vCLWNDfUNts8dX3xTG6Y=
|
||||||
github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII=
|
github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII=
|
||||||
github.com/lestrrat-go/envload v0.0.0-20180220234015-a3eb8ddeffcc h1:RKf14vYWi2ttpEmkA4aQ3j4u9dStX2t4M8UM6qqNsG8=
|
github.com/lestrrat-go/envload v0.0.0-20180220234015-a3eb8ddeffcc h1:RKf14vYWi2ttpEmkA4aQ3j4u9dStX2t4M8UM6qqNsG8=
|
||||||
@@ -184,12 +219,14 @@ github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3Rllmb
|
|||||||
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
|
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
|
||||||
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 h1:zYyBkD/k9seD2A7fsi6Oo2LfFZAehjjQMERAvZLEDnQ=
|
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 h1:zYyBkD/k9seD2A7fsi6Oo2LfFZAehjjQMERAvZLEDnQ=
|
||||||
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646/go.mod h1:jpp1/29i3P1S/RLdc7JQKbRpFeM1dOBd8T9ki5s+AY8=
|
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646/go.mod h1:jpp1/29i3P1S/RLdc7JQKbRpFeM1dOBd8T9ki5s+AY8=
|
||||||
|
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs=
|
||||||
|
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
|
||||||
github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo=
|
github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo=
|
||||||
github.com/olivere/elastic/v7 v7.0.23 h1:b7tjMogDMhf2CisGI+L02LXLVa0ZyE82Z15XfW1e8t8=
|
github.com/olivere/elastic/v7 v7.0.23 h1:b7tjMogDMhf2CisGI+L02LXLVa0ZyE82Z15XfW1e8t8=
|
||||||
github.com/olivere/elastic/v7 v7.0.23/go.mod h1:OuWmD2DiuYhddWegBKPWQuelVKBLrW0fa/VUYgxuGTY=
|
github.com/olivere/elastic/v7 v7.0.23/go.mod h1:OuWmD2DiuYhddWegBKPWQuelVKBLrW0fa/VUYgxuGTY=
|
||||||
github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc=
|
github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc=
|
||||||
github.com/pierrec/lz4 v2.6.0+incompatible h1:Ix9yFKn1nSPBLFl/yZknTp8TU5G4Ps0JDmguYK6iH1A=
|
github.com/pierrec/lz4 v2.6.1+incompatible h1:9UY3+iC23yxF0UfGaYrGplQ+79Rg+h/q9FV9ix19jjM=
|
||||||
github.com/pierrec/lz4 v2.6.0+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY=
|
github.com/pierrec/lz4 v2.6.1+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY=
|
||||||
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||||
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||||
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
|
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
|
||||||
@@ -214,12 +251,19 @@ github.com/rifflock/lfshook v0.0.0-20180920164130-b9218ef580f5 h1:mZHayPoR0lNmnH
|
|||||||
github.com/rifflock/lfshook v0.0.0-20180920164130-b9218ef580f5/go.mod h1:GEXHk5HgEKCvEIIrSpFI3ozzG5xOKA2DVlEX/gGnewM=
|
github.com/rifflock/lfshook v0.0.0-20180920164130-b9218ef580f5/go.mod h1:GEXHk5HgEKCvEIIrSpFI3ozzG5xOKA2DVlEX/gGnewM=
|
||||||
github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg=
|
github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg=
|
||||||
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
|
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
|
||||||
|
github.com/rogpeppe/go-internal v1.6.1 h1:/FiVV8dS/e+YqF2JvO3yXRFbBLTIuSDkuC7aBOAvL+k=
|
||||||
|
github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc=
|
||||||
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
|
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
|
||||||
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
|
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
|
||||||
github.com/sirupsen/logrus v1.6.0 h1:UBcNElsrwanuuMsnGSlYmtmgbb23qDR5dG+6X6Oo89I=
|
github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE=
|
||||||
github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88=
|
github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
|
||||||
|
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
|
||||||
|
github.com/smartystreets/assertions v1.1.0/go.mod h1:tcbTF8ujkAEcZ8TElKY+i30BzYlVhC/LOxJk7iOWnoo=
|
||||||
|
github.com/smartystreets/assertions v1.1.1 h1:T/YLemO5Yp7KPzS+lVtu+WsHn8yoSwTfItdAd1r3cck=
|
||||||
github.com/smartystreets/assertions v1.1.1/go.mod h1:tcbTF8ujkAEcZ8TElKY+i30BzYlVhC/LOxJk7iOWnoo=
|
github.com/smartystreets/assertions v1.1.1/go.mod h1:tcbTF8ujkAEcZ8TElKY+i30BzYlVhC/LOxJk7iOWnoo=
|
||||||
github.com/smartystreets/go-aws-auth v0.0.0-20180515143844-0c1422d1fdb9/go.mod h1:SnhjPscd9TpLiy1LpzGSKh3bXCfxxXuqd9xmQJy3slM=
|
github.com/smartystreets/go-aws-auth v0.0.0-20180515143844-0c1422d1fdb9/go.mod h1:SnhjPscd9TpLiy1LpzGSKh3bXCfxxXuqd9xmQJy3slM=
|
||||||
|
github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s=
|
||||||
|
github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
|
||||||
github.com/smartystreets/gunit v1.4.2/go.mod h1:ZjM1ozSIMJlAz/ay4SG8PeKF00ckUp+zMHZXV9/bvak=
|
github.com/smartystreets/gunit v1.4.2/go.mod h1:ZjM1ozSIMJlAz/ay4SG8PeKF00ckUp+zMHZXV9/bvak=
|
||||||
github.com/soheilhy/cmux v0.1.4 h1:0HKaf1o97UwFjHH9o5XsHUOF+tqmdA7KEzXLpiyaw0E=
|
github.com/soheilhy/cmux v0.1.4 h1:0HKaf1o97UwFjHH9o5XsHUOF+tqmdA7KEzXLpiyaw0E=
|
||||||
github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM=
|
github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM=
|
||||||
@@ -228,13 +272,18 @@ github.com/spf13/pflag v1.0.1 h1:aCvUg6QPl3ibpQUxyLkrEkCHtPqYJL4x9AuhqVqFis4=
|
|||||||
github.com/spf13/pflag v1.0.1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
|
github.com/spf13/pflag v1.0.1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
|
||||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||||
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||||
|
github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE=
|
||||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||||
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
||||||
github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0=
|
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
|
||||||
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||||
|
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
|
||||||
|
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||||
github.com/tencentyun/qcloud-cos-sts-sdk v0.0.0-20210325043845-84a0811633ca h1:G/aIr3WiUesWHL2YGYgEqjM5tCAJ43Ml+0C18wDkWWs=
|
github.com/tencentyun/qcloud-cos-sts-sdk v0.0.0-20210325043845-84a0811633ca h1:G/aIr3WiUesWHL2YGYgEqjM5tCAJ43Ml+0C18wDkWWs=
|
||||||
github.com/tencentyun/qcloud-cos-sts-sdk v0.0.0-20210325043845-84a0811633ca/go.mod h1:b18KQa4IxHbxeseW1GcZox53d7J0z39VNONTxvvlkXw=
|
github.com/tencentyun/qcloud-cos-sts-sdk v0.0.0-20210325043845-84a0811633ca/go.mod h1:b18KQa4IxHbxeseW1GcZox53d7J0z39VNONTxvvlkXw=
|
||||||
|
github.com/tjfoc/gmsm v1.3.2 h1:7JVkAn5bvUJ7HtU08iW6UiD+UTmJTIToHCfeFzkcCxM=
|
||||||
|
github.com/tjfoc/gmsm v1.3.2/go.mod h1:HaUcFuY0auTiaHB9MHFGCPx5IaLhTUd2atbCFBQXn9w=
|
||||||
github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
|
github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
|
||||||
github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5 h1:LnC5Kc/wtumK+WB441p7ynQJzVuNRJiqddSIE3IlSEQ=
|
github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5 h1:LnC5Kc/wtumK+WB441p7ynQJzVuNRJiqddSIE3IlSEQ=
|
||||||
github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
|
github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
|
||||||
@@ -245,6 +294,8 @@ github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLY
|
|||||||
github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA=
|
github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA=
|
||||||
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2 h1:eY9dn8+vbi4tKz5Qo6v2eYzo7kUS51QINcR5jNpbZS8=
|
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2 h1:eY9dn8+vbi4tKz5Qo6v2eYzo7kUS51QINcR5jNpbZS8=
|
||||||
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU=
|
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU=
|
||||||
|
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||||
|
github.com/yuin/goldmark v1.1.30/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||||
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||||
go.etcd.io/bbolt v1.3.4 h1:hi1bXHMVrlQh6WwxAy+qZCV/SYIlqo+Ushwdpa4tAKg=
|
go.etcd.io/bbolt v1.3.4 h1:hi1bXHMVrlQh6WwxAy+qZCV/SYIlqo+Ushwdpa4tAKg=
|
||||||
go.etcd.io/bbolt v1.3.4/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ=
|
go.etcd.io/bbolt v1.3.4/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ=
|
||||||
@@ -266,6 +317,8 @@ golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8U
|
|||||||
golang.org/x/crypto v0.0.0-20191002192127-34f69633bfdc/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
golang.org/x/crypto v0.0.0-20191002192127-34f69633bfdc/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||||
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||||
golang.org/x/crypto v0.0.0-20191205180655-e7c4368fe9dd/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
golang.org/x/crypto v0.0.0-20191205180655-e7c4368fe9dd/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||||
|
golang.org/x/crypto v0.0.0-20191219195013-becbf705a915/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||||
|
golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||||
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 h1:psW17arqaxU48Z5kZ0CQnkZWQJsqcURM6tKiBApRjXI=
|
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 h1:psW17arqaxU48Z5kZ0CQnkZWQJsqcURM6tKiBApRjXI=
|
||||||
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||||
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||||
@@ -275,6 +328,7 @@ golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvx
|
|||||||
golang.org/x/lint v0.0.0-20190930215403-16217165b5de h1:5hukYrvBGR8/eNkX5mdUezrA6JiaEZDtJb9Ei+1LlBs=
|
golang.org/x/lint v0.0.0-20190930215403-16217165b5de h1:5hukYrvBGR8/eNkX5mdUezrA6JiaEZDtJb9Ei+1LlBs=
|
||||||
golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
||||||
golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc=
|
golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc=
|
||||||
|
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||||
golang.org/x/mod v0.3.0 h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4=
|
golang.org/x/mod v0.3.0 h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4=
|
||||||
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||||
golang.org/x/net v0.0.0-20180218175443-cbe0f9307d01/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
golang.org/x/net v0.0.0-20180218175443-cbe0f9307d01/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
@@ -287,14 +341,19 @@ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn
|
|||||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||||
golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||||
golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||||
|
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||||
golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
|
golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
|
||||||
|
golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
|
||||||
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
|
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
|
||||||
golang.org/x/net v0.0.0-20201110031124-69a78807bb2b h1:uwuIcX0g4Yl1NC5XAz37xsr2lTtcqevgzYNVt49waME=
|
|
||||||
golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
|
golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
|
||||||
|
golang.org/x/net v0.0.0-20210917221730-978cfadd31cf h1:R150MpwJIv1MpS0N/pc+NhTM8ajzvlmxlY5OYsrevXQ=
|
||||||
|
golang.org/x/net v0.0.0-20210917221730-978cfadd31cf/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||||
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
|
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
|
golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
@@ -302,25 +361,33 @@ golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5h
|
|||||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f h1:+Nyd8tzPX9R7BWHguqsrbFdRx3WQ/1ib8I44HXV5yTA=
|
golang.org/x/sys v0.0.0-20200509044756-6aff5f38e54f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20210423082822-04245dca01da h1:b3NXsE2LusjYGGjL5bxEVZZORm/YEFFrWFjR8eFrw/c=
|
||||||
|
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||||
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
|
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
|
||||||
golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k=
|
|
||||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||||
|
golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M=
|
||||||
|
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||||
golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2 h1:+DCIGbF/swA92ohVg0//6X2IVY3KZs6p9mix0ziNYJM=
|
golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2 h1:+DCIGbF/swA92ohVg0//6X2IVY3KZs6p9mix0ziNYJM=
|
||||||
golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||||
golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||||
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
|
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
|
||||||
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||||
|
golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||||
golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
|
golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
|
||||||
golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||||
golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||||
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||||
|
golang.org/x/tools v0.0.0-20200509030707-2212a7e161a5/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
|
||||||
golang.org/x/tools v0.0.0-20210106214847-113979e3529a h1:CB3a9Nez8M13wwlr/E2YtwoU+qYHKfC+JrDa45RXXoQ=
|
golang.org/x/tools v0.0.0-20210106214847-113979e3529a h1:CB3a9Nez8M13wwlr/E2YtwoU+qYHKfC+JrDa45RXXoQ=
|
||||||
golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
||||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||||
@@ -344,11 +411,19 @@ google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp0
|
|||||||
google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk=
|
google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk=
|
||||||
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
|
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
|
||||||
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
|
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
|
||||||
|
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc h1:2gGKlE2+asNV9m7xrywl36YYNnBG5ZQ0r/BOOxqPpmk=
|
||||||
|
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc/go.mod h1:m7x9LTH6d71AHyAX77c9yqWCCa3UKHcVEj9y7hAtKDk=
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
|
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
|
||||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
|
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU=
|
||||||
|
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
gopkg.in/cheggaaa/pb.v1 v1.0.25/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw=
|
gopkg.in/cheggaaa/pb.v1 v1.0.25/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw=
|
||||||
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
|
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
|
||||||
|
gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df h1:n7WqCuqOuCbNr617RXOY0AWRXxgwEyPp2z+p0+hgMuE=
|
||||||
|
gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df/go.mod h1:LRQQ+SO6ZHR7tOkpBDuZnXENFzX8qRjMDMyPD6BRkCw=
|
||||||
|
gopkg.in/ini.v1 v1.56.0 h1:DPMeDvGTM54DXbPkVIZsp19fp/I2K7zwA/itHYHKo8Y=
|
||||||
|
gopkg.in/ini.v1 v1.56.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
|
||||||
gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22 h1:VpOs+IwYnYBaFnrNAeB8UUWtL3vEUnzSCL1nVjPhqrw=
|
gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22 h1:VpOs+IwYnYBaFnrNAeB8UUWtL3vEUnzSCL1nVjPhqrw=
|
||||||
gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22/go.mod h1:yeKp02qBN3iKW1OzL3MGk2IdtZzaj7SFntXj72NppTA=
|
gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22/go.mod h1:yeKp02qBN3iKW1OzL3MGk2IdtZzaj7SFntXj72NppTA=
|
||||||
gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo=
|
gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo=
|
||||||
@@ -357,8 +432,9 @@ gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
|||||||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10=
|
gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10=
|
||||||
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
|
|
||||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
|
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo=
|
||||||
|
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||||
honnef.co/go/tools v0.0.1-2019.2.3 h1:3JgtbtFHMiCmsznwGVTUWbgGov+pVqnlf1dEJTNAXeM=
|
honnef.co/go/tools v0.0.1-2019.2.3 h1:3JgtbtFHMiCmsznwGVTUWbgGov+pVqnlf1dEJTNAXeM=
|
||||||
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
|
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
package apiAuth
|
package apiAuth
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/src/common/config"
|
"Open_IM/pkg/common/config"
|
||||||
"Open_IM/src/common/log"
|
"Open_IM/pkg/common/log"
|
||||||
"Open_IM/src/grpc-etcdv3/getcdv3"
|
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
||||||
pbAuth "Open_IM/src/proto/auth"
|
pbAuth "Open_IM/pkg/proto/auth"
|
||||||
"context"
|
"context"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"net/http"
|
"net/http"
|
||||||
@@ -49,6 +49,10 @@ func UserRegister(c *gin.Context) {
|
|||||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if params.Secret != config.Config.Secret {
|
||||||
|
c.JSON(http.StatusBadRequest, gin.H{"errCode": 401, "errMsg": "not authorized"})
|
||||||
|
return
|
||||||
|
}
|
||||||
pbData := newUserRegisterReq(¶ms)
|
pbData := newUserRegisterReq(¶ms)
|
||||||
|
|
||||||
log.Info("", "", "api user_register is server, [data: %s]", pbData.String())
|
log.Info("", "", "api user_register is server, [data: %s]", pbData.String())
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
package apiAuth
|
package apiAuth
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/src/common/config"
|
"Open_IM/pkg/common/config"
|
||||||
"Open_IM/src/common/log"
|
"Open_IM/pkg/common/log"
|
||||||
"Open_IM/src/grpc-etcdv3/getcdv3"
|
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
||||||
pbAuth "Open_IM/src/proto/auth"
|
pbAuth "Open_IM/pkg/proto/auth"
|
||||||
"context"
|
"context"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"net/http"
|
"net/http"
|
||||||
@@ -37,6 +37,10 @@ func UserToken(c *gin.Context) {
|
|||||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if params.Secret != config.Config.Secret {
|
||||||
|
c.JSON(http.StatusBadRequest, gin.H{"errCode": 401, "errMsg": "not authorized"})
|
||||||
|
return
|
||||||
|
}
|
||||||
pbData := newUserTokenReq(¶ms)
|
pbData := newUserTokenReq(¶ms)
|
||||||
|
|
||||||
log.Info("", "", "api user_token is server, [data: %s]", pbData.String())
|
log.Info("", "", "api user_token is server, [data: %s]", pbData.String())
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
package apiChat
|
package apiChat
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/src/common/config"
|
"Open_IM/pkg/common/config"
|
||||||
"Open_IM/src/common/log"
|
"Open_IM/pkg/common/log"
|
||||||
"Open_IM/src/grpc-etcdv3/getcdv3"
|
"Open_IM/pkg/common/token_verify"
|
||||||
pbMsg "Open_IM/src/proto/chat"
|
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
||||||
"Open_IM/src/utils"
|
pbMsg "Open_IM/pkg/proto/chat"
|
||||||
"context"
|
"context"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"net/http"
|
"net/http"
|
||||||
@@ -27,8 +27,8 @@ func UserGetSeq(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
token := c.Request.Header.Get("token")
|
token := c.Request.Header.Get("token")
|
||||||
if !utils.VerifyToken(token, params.SendID) {
|
if ok, err := token_verify.VerifyToken(token, params.SendID); !ok {
|
||||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "token validate err"})
|
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "token validate err" + err.Error()})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
pbData := pbMsg.GetMaxAndMinSeqReq{}
|
pbData := pbMsg.GetMaxAndMinSeqReq{}
|
||||||
@@ -42,7 +42,8 @@ func UserGetSeq(c *gin.Context) {
|
|||||||
msgClient := pbMsg.NewChatClient(grpcConn)
|
msgClient := pbMsg.NewChatClient(grpcConn)
|
||||||
reply, err := msgClient.GetMaxAndMinSeq(context.Background(), &pbData)
|
reply, err := msgClient.GetMaxAndMinSeq(context.Background(), &pbData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.ErrorByKv("rpc call failed to getNewSeq", pbData.OperationID, "err", err, "pbData", pbData.String())
|
log.NewError(params.OperationID, "UserGetSeq rpc failed, ", params, err.Error())
|
||||||
|
c.JSON(http.StatusBadRequest, gin.H{"errCode": 401, "errMsg": "UserGetSeq rpc failed, " + err.Error()})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
package apiChat
|
package apiChat
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/src/common/config"
|
"Open_IM/pkg/common/config"
|
||||||
"Open_IM/src/common/log"
|
"Open_IM/pkg/common/log"
|
||||||
"Open_IM/src/grpc-etcdv3/getcdv3"
|
"Open_IM/pkg/common/token_verify"
|
||||||
"Open_IM/src/proto/chat"
|
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
||||||
"Open_IM/src/utils"
|
"Open_IM/pkg/proto/chat"
|
||||||
"context"
|
"context"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"net/http"
|
"net/http"
|
||||||
@@ -30,8 +30,8 @@ func UserPullMsg(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
token := c.Request.Header.Get("token")
|
token := c.Request.Header.Get("token")
|
||||||
if !utils.VerifyToken(token, params.SendID) {
|
if ok, err := token_verify.VerifyToken(token, params.SendID); !ok {
|
||||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "token validate err"})
|
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "token validate err" + err.Error()})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
pbData := pbChat.PullMessageReq{}
|
pbData := pbChat.PullMessageReq{}
|
||||||
@@ -43,7 +43,8 @@ func UserPullMsg(c *gin.Context) {
|
|||||||
msgClient := pbChat.NewChatClient(grpcConn)
|
msgClient := pbChat.NewChatClient(grpcConn)
|
||||||
reply, err := msgClient.PullMessage(context.Background(), &pbData)
|
reply, err := msgClient.PullMessage(context.Background(), &pbData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.ErrorByKv("PullMessage error", pbData.OperationID, "err", err.Error())
|
log.NewError(params.OperationID, "UserPullMsg rpc failed, ", params, err.Error())
|
||||||
|
c.JSON(http.StatusBadRequest, gin.H{"errCode": 401, "errMsg": "UserPullMsg rpc failed, " + err.Error()})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
log.InfoByKv("rpc call success to pullMsgRep", pbData.OperationID, "ReplyArgs", reply.String(), "maxSeq", reply.GetMaxSeq(),
|
log.InfoByKv("rpc call success to pullMsgRep", pbData.OperationID, "ReplyArgs", reply.String(), "maxSeq", reply.GetMaxSeq(),
|
||||||
@@ -86,8 +87,8 @@ func UserPullMsgBySeqList(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
token := c.Request.Header.Get("token")
|
token := c.Request.Header.Get("token")
|
||||||
if !utils.VerifyToken(token, params.SendID) {
|
if ok, err := token_verify.VerifyToken(token, params.SendID); !ok {
|
||||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "token validate err"})
|
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "token validate err" + err.Error()})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
pbData := pbChat.PullMessageBySeqListReq{}
|
pbData := pbChat.PullMessageBySeqListReq{}
|
||||||
@@ -1,13 +1,13 @@
|
|||||||
package apiChat
|
package apiChat
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/src/common/config"
|
"Open_IM/pkg/common/config"
|
||||||
"Open_IM/src/common/log"
|
"Open_IM/pkg/common/log"
|
||||||
pbChat "Open_IM/src/proto/chat"
|
pbChat "Open_IM/pkg/proto/chat"
|
||||||
"Open_IM/src/utils"
|
"Open_IM/pkg/utils"
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"Open_IM/src/grpc-etcdv3/getcdv3"
|
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
@@ -27,7 +27,7 @@ type paramsUserSendMsg struct {
|
|||||||
RecvID string `json:"recvID" binding:"required"`
|
RecvID string `json:"recvID" binding:"required"`
|
||||||
ForceList []string `json:"forceList"`
|
ForceList []string `json:"forceList"`
|
||||||
Content string `json:"content" binding:"required"`
|
Content string `json:"content" binding:"required"`
|
||||||
Options map[string]interface{} `json:"options" `
|
Options map[string]int32 `json:"options" `
|
||||||
ClientMsgID string `json:"clientMsgID" binding:"required"`
|
ClientMsgID string `json:"clientMsgID" binding:"required"`
|
||||||
OffLineInfo map[string]interface{} `json:"offlineInfo" `
|
OffLineInfo map[string]interface{} `json:"offlineInfo" `
|
||||||
Ex map[string]interface{} `json:"ext"`
|
Ex map[string]interface{} `json:"ext"`
|
||||||
@@ -49,7 +49,7 @@ func newUserSendMsgReq(token string, params *paramsUserSendMsg) *pbChat.UserSend
|
|||||||
RecvID: params.Data.RecvID,
|
RecvID: params.Data.RecvID,
|
||||||
ForceList: params.Data.ForceList,
|
ForceList: params.Data.ForceList,
|
||||||
Content: params.Data.Content,
|
Content: params.Data.Content,
|
||||||
Options: utils.MapToJsonString(params.Data.Options),
|
Options: utils.MapIntToJsonString(params.Data.Options),
|
||||||
ClientMsgID: params.Data.ClientMsgID,
|
ClientMsgID: params.Data.ClientMsgID,
|
||||||
OffLineInfo: utils.MapToJsonString(params.Data.OffLineInfo),
|
OffLineInfo: utils.MapToJsonString(params.Data.OffLineInfo),
|
||||||
Ex: utils.MapToJsonString(params.Data.Ex),
|
Ex: utils.MapToJsonString(params.Data.Ex),
|
||||||
@@ -67,7 +67,7 @@ func UserSendMsg(c *gin.Context) {
|
|||||||
|
|
||||||
token := c.Request.Header.Get("token")
|
token := c.Request.Header.Get("token")
|
||||||
|
|
||||||
log.InfoByKv("Ws call success to sendMsgReq", params.OperationID, "Parameters", params)
|
log.InfoByKv("api call success to sendMsgReq", params.OperationID, "Parameters", params)
|
||||||
|
|
||||||
pbData := newUserSendMsgReq(token, ¶ms)
|
pbData := newUserSendMsgReq(token, ¶ms)
|
||||||
log.Info("", "", "api UserSendMsg call start..., [data: %s]", pbData.String())
|
log.Info("", "", "api UserSendMsg call start..., [data: %s]", pbData.String())
|
||||||
@@ -77,7 +77,12 @@ func UserSendMsg(c *gin.Context) {
|
|||||||
|
|
||||||
log.Info("", "", "api UserSendMsg call, api call rpc...")
|
log.Info("", "", "api UserSendMsg call, api call rpc...")
|
||||||
|
|
||||||
reply, _ := client.UserSendMsg(context.Background(), pbData)
|
reply, err := client.UserSendMsg(context.Background(), pbData)
|
||||||
|
if err != nil {
|
||||||
|
log.NewError(params.OperationID, "UserSendMsg rpc failed, ", params, err.Error())
|
||||||
|
c.JSON(http.StatusBadRequest, gin.H{"errCode": 401, "errMsg": "UserSendMsg rpc failed, " + err.Error()})
|
||||||
|
return
|
||||||
|
}
|
||||||
log.Info("", "", "api UserSendMsg call end..., [data: %s] [reply: %s]", pbData.String(), reply.String())
|
log.Info("", "", "api UserSendMsg call end..., [data: %s] [reply: %s]", pbData.String(), reply.String())
|
||||||
|
|
||||||
c.JSON(http.StatusOK, gin.H{
|
c.JSON(http.StatusOK, gin.H{
|
||||||
@@ -0,0 +1,194 @@
|
|||||||
|
package conversation
|
||||||
|
|
||||||
|
import (
|
||||||
|
"Open_IM/pkg/common/config"
|
||||||
|
"Open_IM/pkg/common/log"
|
||||||
|
"Open_IM/pkg/common/token_verify"
|
||||||
|
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
||||||
|
"Open_IM/pkg/proto/user"
|
||||||
|
"Open_IM/pkg/utils"
|
||||||
|
"context"
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
|
"net/http"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
|
type paramsSetReceiveMessageOpt struct {
|
||||||
|
OperationID string `json:"operationID" binding:"required"`
|
||||||
|
Option *int32 `json:"option" binding:"required"`
|
||||||
|
ConversationIdList []string `json:"conversationIdList" binding:"required"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type OptResult struct {
|
||||||
|
ConversationId string `json:"conversationId" binding:"required"`
|
||||||
|
Result int32 `json:"result" binding:"required"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type SetReceiveMessageOptResp struct {
|
||||||
|
ErrCode int32 `json:"errCode"`
|
||||||
|
ErrMsg string `json:"errMsg"`
|
||||||
|
Data []OptResult `json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type paramGetReceiveMessageOpt struct {
|
||||||
|
ConversationIdList []string `json:"conversationIdList" binding:"required"`
|
||||||
|
OperationID string `json:"operationID" binding:"required"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type GetReceiveMessageOptResp struct {
|
||||||
|
SetReceiveMessageOptResp
|
||||||
|
}
|
||||||
|
|
||||||
|
type paramGetAllConversationMessageOpt struct {
|
||||||
|
OperationID string `json:"operationID" binding:"required"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type GetAllConversationMessageOptResp struct {
|
||||||
|
SetReceiveMessageOptResp
|
||||||
|
}
|
||||||
|
|
||||||
|
//CopyStructFields
|
||||||
|
|
||||||
|
func GetAllConversationMessageOpt(c *gin.Context) {
|
||||||
|
params := paramGetAllConversationMessageOpt{}
|
||||||
|
if err := c.BindJSON(¶ms); err != nil {
|
||||||
|
log.NewError(params.OperationID, "bind json failed ", err.Error(), c)
|
||||||
|
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "bind json failed " + err.Error()})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
claims, err := token_verify.ParseToken(c.Request.Header.Get("token"))
|
||||||
|
if err != nil {
|
||||||
|
log.NewError(params.OperationID, "ParseToken failed, ", err.Error(), c.Request.Header.Get("token"))
|
||||||
|
c.JSON(http.StatusBadRequest, gin.H{"errCode": 401, "errMsg": "ParseToken failed, " + err.Error()})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
req := &user.GetAllConversationMsgOptReq{
|
||||||
|
UId: claims.UID,
|
||||||
|
OperationID: params.OperationID,
|
||||||
|
}
|
||||||
|
log.NewInfo(req.OperationID, "GetAllConversationMsgOpt req: ", req)
|
||||||
|
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName)
|
||||||
|
client := user.NewUserClient(etcdConn)
|
||||||
|
resp, err := client.GetAllConversationMsgOpt(context.Background(), req)
|
||||||
|
if err != nil {
|
||||||
|
log.NewError(params.OperationID, "GetAllConversationMsgOpt rpc failed, ", req, err.Error())
|
||||||
|
c.JSON(http.StatusBadRequest, gin.H{"errCode": 401, "errMsg": "GetAllConversationMsgOpt rpc failed, " + err.Error()})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
var ginResp GetAllConversationMessageOptResp
|
||||||
|
ginResp.ErrCode = resp.ErrCode
|
||||||
|
ginResp.ErrMsg = resp.ErrMsg
|
||||||
|
for _, v := range resp.ConversationOptResult {
|
||||||
|
var opt OptResult
|
||||||
|
err := utils.CopyStructFields(&opt, *v, "ConversationId", "Result")
|
||||||
|
if err != nil {
|
||||||
|
log.NewError(req.OperationID, "CopyStructFields failed ", err.Error())
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
ginResp.Data = append(ginResp.Data, opt)
|
||||||
|
}
|
||||||
|
log.NewInfo(req.OperationID, "GetAllConversationMsgOpt resp: ", ginResp, req)
|
||||||
|
c.JSON(http.StatusOK, ginResp)
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetReceiveMessageOpt(c *gin.Context) {
|
||||||
|
params := paramGetReceiveMessageOpt{}
|
||||||
|
if err := c.BindJSON(¶ms); err != nil {
|
||||||
|
log.NewError(params.OperationID, "bind json failed ", err.Error(), c)
|
||||||
|
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "bind json failed " + err.Error()})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
claims, err := token_verify.ParseToken(c.Request.Header.Get("token"))
|
||||||
|
if err != nil {
|
||||||
|
log.NewError(params.OperationID, "ParseToken failed, ", err.Error(), c.Request.Header.Get("token"))
|
||||||
|
c.JSON(http.StatusBadRequest, gin.H{"errCode": 401, "errMsg": "ParseToken failed, " + err.Error()})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
req := &user.GetReceiveMessageOptReq{
|
||||||
|
UId: claims.UID,
|
||||||
|
ConversationId: params.ConversationIdList,
|
||||||
|
OperationID: params.OperationID,
|
||||||
|
}
|
||||||
|
log.NewInfo(req.OperationID, "GetReceiveMessageOptReq req: ", req)
|
||||||
|
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName)
|
||||||
|
client := user.NewUserClient(etcdConn)
|
||||||
|
resp, err := client.GetReceiveMessageOpt(context.Background(), req)
|
||||||
|
if err != nil {
|
||||||
|
log.NewError(params.OperationID, "GetReceiveMessageOpt rpc failed, ", req, err.Error())
|
||||||
|
c.JSON(http.StatusBadRequest, gin.H{"errCode": 401, "errMsg": "GetReceiveMessageOpt rpc failed, " + err.Error()})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
log.NewInfo(req.OperationID, "GetReceiveMessageOptReq req: ", req, resp)
|
||||||
|
var ginResp GetReceiveMessageOptResp
|
||||||
|
ginResp.ErrCode = resp.ErrCode
|
||||||
|
ginResp.ErrMsg = resp.ErrMsg
|
||||||
|
|
||||||
|
for _, v := range resp.ConversationOptResult {
|
||||||
|
var opt OptResult
|
||||||
|
log.NewInfo("CopyStructFields begin ", v, req.OperationID)
|
||||||
|
err := utils.CopyStructFields(&opt, *v, "ConversationId", "Result")
|
||||||
|
log.NewInfo("CopyStructFields end ", v, req.OperationID)
|
||||||
|
if err != nil {
|
||||||
|
log.NewError(req.OperationID, "CopyStructFields failed ", err.Error())
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
ginResp.Data = append(ginResp.Data, opt)
|
||||||
|
}
|
||||||
|
log.NewInfo(req.OperationID, "GetReceiveMessageOpt resp: ", ginResp)
|
||||||
|
c.JSON(http.StatusOK, ginResp)
|
||||||
|
}
|
||||||
|
|
||||||
|
func SetReceiveMessageOpt(c *gin.Context) {
|
||||||
|
params := paramsSetReceiveMessageOpt{}
|
||||||
|
if err := c.BindJSON(¶ms); err != nil {
|
||||||
|
log.NewError(params.OperationID, "bind json failed ", err.Error(), c)
|
||||||
|
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "bind json failed " + err.Error()})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
claims, err := token_verify.ParseToken(c.Request.Header.Get("token"))
|
||||||
|
if err != nil {
|
||||||
|
log.NewError(params.OperationID, "ParseToken failed, ", err.Error(), c.Request.Header.Get("token"))
|
||||||
|
c.JSON(http.StatusBadRequest, gin.H{"errCode": 401, "errMsg": "ParseToken failed, " + err.Error()})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
req := &user.SetReceiveMessageOptReq{
|
||||||
|
UId: claims.UID,
|
||||||
|
Opt: *params.Option,
|
||||||
|
ConversationId: params.ConversationIdList,
|
||||||
|
OperationID: params.OperationID,
|
||||||
|
}
|
||||||
|
log.NewInfo(req.OperationID, "SetReceiveMessageOpt req: ", req)
|
||||||
|
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName)
|
||||||
|
client := user.NewUserClient(etcdConn)
|
||||||
|
resp, err := client.SetReceiveMessageOpt(context.Background(), req)
|
||||||
|
if err != nil {
|
||||||
|
log.NewError(params.OperationID, "SetReceiveMessageOpt rpc failed, ", req, err.Error())
|
||||||
|
c.JSON(http.StatusBadRequest, gin.H{"errCode": 401, "errMsg": "SetReceiveMessageOpt rpc failed, " + err.Error()})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
log.NewInfo(req.OperationID, "SetReceiveMessageOpt req: ", req, resp)
|
||||||
|
ginResp := SetReceiveMessageOptResp{
|
||||||
|
ErrCode: resp.ErrCode,
|
||||||
|
ErrMsg: resp.ErrMsg,
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, v := range resp.OptResult {
|
||||||
|
var opt OptResult
|
||||||
|
log.NewDebug("CopyStructFields begin ", v, req.OperationID)
|
||||||
|
err := utils.CopyStructFields(&opt, *v, "ConversationId", "Result")
|
||||||
|
log.NewDebug("CopyStructFields end ", v, req.OperationID)
|
||||||
|
if err != nil {
|
||||||
|
log.NewError(req.OperationID, "CopyStructFields failed ", err.Error())
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
ginResp.Data = append(ginResp.Data, opt)
|
||||||
|
}
|
||||||
|
log.NewInfo(req.OperationID, "SetReceiveMessageOpt resp: ", ginResp)
|
||||||
|
c.JSON(http.StatusOK, ginResp)
|
||||||
|
}
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
package friend
|
package friend
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/src/common/config"
|
"Open_IM/pkg/common/config"
|
||||||
"Open_IM/src/common/log"
|
"Open_IM/pkg/common/log"
|
||||||
"Open_IM/src/grpc-etcdv3/getcdv3"
|
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
||||||
pbFriend "Open_IM/src/proto/friend"
|
pbFriend "Open_IM/pkg/proto/friend"
|
||||||
"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 (
|
||||||
"Open_IM/src/common/config"
|
"Open_IM/pkg/common/config"
|
||||||
"Open_IM/src/common/log"
|
"Open_IM/pkg/common/log"
|
||||||
"Open_IM/src/grpc-etcdv3/getcdv3"
|
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
||||||
pbFriend "Open_IM/src/proto/friend"
|
pbFriend "Open_IM/pkg/proto/friend"
|
||||||
"context"
|
"context"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"net/http"
|
"net/http"
|
||||||
@@ -26,7 +26,7 @@ type paramsAddFriend struct {
|
|||||||
//
|
//
|
||||||
func ImportFriend(c *gin.Context) {
|
func ImportFriend(c *gin.Context) {
|
||||||
log.Info("", "", "ImportFriend init ....")
|
log.Info("", "", "ImportFriend init ....")
|
||||||
|
log.NewDebug("", "api importFriend start")
|
||||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName)
|
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName)
|
||||||
client := pbFriend.NewFriendClient(etcdConn)
|
client := pbFriend.NewFriendClient(etcdConn)
|
||||||
|
|
||||||
@@ -41,18 +41,19 @@ func ImportFriend(c *gin.Context) {
|
|||||||
OwnerUid: params.OwnerUid,
|
OwnerUid: params.OwnerUid,
|
||||||
Token: c.Request.Header.Get("token"),
|
Token: c.Request.Header.Get("token"),
|
||||||
}
|
}
|
||||||
log.ErrorByKv("ImportFriend Test start", params.OperationID)
|
log.NewDebug(req.OperationID, "args is ", req.String())
|
||||||
RpcResp, err := client.ImportFriend(context.Background(), req)
|
RpcResp, err := client.ImportFriend(context.Background(), req)
|
||||||
//log.ErrorByKv("ImportFriend Test end", params.OperationID, "resp", RpcResp, "err", err.Error())
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(req.Token, req.OperationID, "err=%s,ImportFriend failed", err)
|
log.NewError(req.OperationID, "rpc importFriend failed", err.Error())
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "cImportFriend failed" + err.Error()})
|
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "cImportFriend failed " + err.Error()})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
log.InfoByArgs("ImportFriend success,args=%s", RpcResp.String())
|
failedUidList := make([]string, 0)
|
||||||
resp := gin.H{"errCode": RpcResp.CommonResp.ErrorCode, "errMsg": RpcResp.CommonResp.ErrorMsg, "failedUidList": RpcResp.FailedUidList}
|
for _, v := range RpcResp.FailedUidList {
|
||||||
c.JSON(http.StatusOK, resp)
|
failedUidList = append(failedUidList, v)
|
||||||
log.InfoByArgs("ImportFriend success return,get args=%s,return args=%s", req.String(), RpcResp.String())
|
}
|
||||||
|
log.NewDebug(req.OperationID, "rpc importFriend success", RpcResp.CommonResp.ErrorMsg, RpcResp.CommonResp.ErrorCode, RpcResp.FailedUidList)
|
||||||
|
c.JSON(http.StatusOK, gin.H{"errCode": RpcResp.CommonResp.ErrorCode, "errMsg": RpcResp.CommonResp.ErrorMsg, "failedUidList": failedUidList})
|
||||||
}
|
}
|
||||||
|
|
||||||
func AddFriend(c *gin.Context) {
|
func AddFriend(c *gin.Context) {
|
||||||
@@ -80,7 +81,8 @@ func AddFriend(c *gin.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
log.InfoByArgs("call add friend rpc server success,args=%s", RpcResp.String())
|
log.InfoByArgs("call add friend rpc server success,args=%s", RpcResp.String())
|
||||||
resp := gin.H{"errCode": RpcResp.ErrorCode, "errMsg": RpcResp.ErrorMsg}
|
c.JSON(http.StatusOK, gin.H{
|
||||||
c.JSON(http.StatusOK, resp)
|
"errCode": RpcResp.ErrorCode,
|
||||||
log.InfoByArgs("api add friend success return,get args=%s,return args=%s", req.String(), RpcResp.String())
|
"errMsg": RpcResp.ErrorMsg,
|
||||||
|
})
|
||||||
}
|
}
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
package friend
|
package friend
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/src/common/config"
|
"Open_IM/pkg/common/config"
|
||||||
"Open_IM/src/common/log"
|
"Open_IM/pkg/common/log"
|
||||||
"Open_IM/src/grpc-etcdv3/getcdv3"
|
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
||||||
pbFriend "Open_IM/src/proto/friend"
|
pbFriend "Open_IM/pkg/proto/friend"
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
package friend
|
package friend
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/src/common/config"
|
"Open_IM/pkg/common/config"
|
||||||
"Open_IM/src/common/log"
|
"Open_IM/pkg/common/log"
|
||||||
"Open_IM/src/grpc-etcdv3/getcdv3"
|
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
||||||
pbFriend "Open_IM/src/proto/friend"
|
pbFriend "Open_IM/pkg/proto/friend"
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
package friend
|
package friend
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/src/common/config"
|
"Open_IM/pkg/common/config"
|
||||||
"Open_IM/src/common/log"
|
"Open_IM/pkg/common/log"
|
||||||
"Open_IM/src/grpc-etcdv3/getcdv3"
|
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
||||||
pbFriend "Open_IM/src/proto/friend"
|
pbFriend "Open_IM/pkg/proto/friend"
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
+4
-4
@@ -1,10 +1,10 @@
|
|||||||
package friend
|
package friend
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/src/common/config"
|
"Open_IM/pkg/common/config"
|
||||||
"Open_IM/src/common/log"
|
"Open_IM/pkg/common/log"
|
||||||
"Open_IM/src/grpc-etcdv3/getcdv3"
|
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
||||||
pbFriend "Open_IM/src/proto/friend"
|
pbFriend "Open_IM/pkg/proto/friend"
|
||||||
"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 (
|
||||||
"Open_IM/src/common/config"
|
"Open_IM/pkg/common/config"
|
||||||
"Open_IM/src/common/log"
|
"Open_IM/pkg/common/log"
|
||||||
"Open_IM/src/grpc-etcdv3/getcdv3"
|
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
||||||
pbFriend "Open_IM/src/proto/friend"
|
pbFriend "Open_IM/pkg/proto/friend"
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
package friend
|
package friend
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/src/common/config"
|
"Open_IM/pkg/common/config"
|
||||||
"Open_IM/src/common/log"
|
"Open_IM/pkg/common/log"
|
||||||
"Open_IM/src/grpc-etcdv3/getcdv3"
|
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
||||||
pbFriend "Open_IM/src/proto/friend"
|
pbFriend "Open_IM/pkg/proto/friend"
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
package friend
|
package friend
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/src/common/config"
|
"Open_IM/pkg/common/config"
|
||||||
"Open_IM/src/common/log"
|
"Open_IM/pkg/common/log"
|
||||||
"Open_IM/src/grpc-etcdv3/getcdv3"
|
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
||||||
pbFriend "Open_IM/src/proto/friend"
|
pbFriend "Open_IM/pkg/proto/friend"
|
||||||
"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 (
|
||||||
"Open_IM/src/common/config"
|
"Open_IM/pkg/common/config"
|
||||||
"Open_IM/src/common/log"
|
"Open_IM/pkg/common/log"
|
||||||
"Open_IM/src/grpc-etcdv3/getcdv3"
|
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
||||||
pbFriend "Open_IM/src/proto/friend"
|
pbFriend "Open_IM/pkg/proto/friend"
|
||||||
"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 (
|
||||||
"Open_IM/src/common/config"
|
"Open_IM/pkg/common/config"
|
||||||
"Open_IM/src/common/log"
|
"Open_IM/pkg/common/log"
|
||||||
"Open_IM/src/grpc-etcdv3/getcdv3"
|
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
||||||
pbFriend "Open_IM/src/proto/friend"
|
pbFriend "Open_IM/pkg/proto/friend"
|
||||||
"context"
|
"context"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"net/http"
|
"net/http"
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
package group
|
package group
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/src/common/config"
|
"Open_IM/pkg/common/config"
|
||||||
"Open_IM/src/common/log"
|
"Open_IM/pkg/common/log"
|
||||||
"Open_IM/src/grpc-etcdv3/getcdv3"
|
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
||||||
pb "Open_IM/src/proto/group"
|
pb "Open_IM/pkg/proto/group"
|
||||||
"context"
|
"context"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"net/http"
|
"net/http"
|
||||||
+6
-6
@@ -1,11 +1,11 @@
|
|||||||
package group
|
package group
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/src/common/config"
|
"Open_IM/pkg/common/config"
|
||||||
"Open_IM/src/common/log"
|
"Open_IM/pkg/common/log"
|
||||||
"Open_IM/src/grpc-etcdv3/getcdv3"
|
"Open_IM/pkg/common/token_verify"
|
||||||
"Open_IM/src/proto/group"
|
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
||||||
"Open_IM/src/utils"
|
"Open_IM/pkg/proto/group"
|
||||||
"context"
|
"context"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"net/http"
|
"net/http"
|
||||||
@@ -56,7 +56,7 @@ func GetGroupApplicationList(c *gin.Context) {
|
|||||||
pbData := newUserRegisterReq(¶ms)
|
pbData := newUserRegisterReq(¶ms)
|
||||||
|
|
||||||
token := c.Request.Header.Get("token")
|
token := c.Request.Header.Get("token")
|
||||||
if claims, err := utils.ParseToken(token); err != nil {
|
if claims, err := token_verify.ParseToken(token); err != nil {
|
||||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "token validate err"})
|
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "token validate err"})
|
||||||
return
|
return
|
||||||
} else {
|
} else {
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
package group
|
package group
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/src/common/config"
|
"Open_IM/pkg/common/config"
|
||||||
"Open_IM/src/common/log"
|
"Open_IM/pkg/common/log"
|
||||||
"Open_IM/src/grpc-etcdv3/getcdv3"
|
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
||||||
pb "Open_IM/src/proto/group"
|
pb "Open_IM/pkg/proto/group"
|
||||||
"context"
|
"context"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"net/http"
|
"net/http"
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
package group
|
package group
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/src/common/config"
|
"Open_IM/pkg/common/config"
|
||||||
"Open_IM/src/common/log"
|
"Open_IM/pkg/common/log"
|
||||||
"Open_IM/src/grpc-etcdv3/getcdv3"
|
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
||||||
pb "Open_IM/src/proto/group"
|
pb "Open_IM/pkg/proto/group"
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
+6
-6
@@ -1,11 +1,11 @@
|
|||||||
package group
|
package group
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/src/common/config"
|
"Open_IM/pkg/common/config"
|
||||||
"Open_IM/src/common/log"
|
"Open_IM/pkg/common/log"
|
||||||
"Open_IM/src/grpc-etcdv3/getcdv3"
|
"Open_IM/pkg/common/token_verify"
|
||||||
"Open_IM/src/proto/group"
|
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
||||||
"Open_IM/src/utils"
|
"Open_IM/pkg/proto/group"
|
||||||
"context"
|
"context"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"net/http"
|
"net/http"
|
||||||
@@ -63,7 +63,7 @@ func ApplicationGroupResponse(c *gin.Context) {
|
|||||||
pbData := newGroupApplicationResponse(¶ms)
|
pbData := newGroupApplicationResponse(¶ms)
|
||||||
|
|
||||||
token := c.Request.Header.Get("token")
|
token := c.Request.Header.Get("token")
|
||||||
if claims, err := utils.ParseToken(token); err != nil {
|
if claims, err := token_verify.ParseToken(token); err != nil {
|
||||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "token validate err"})
|
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "token validate err"})
|
||||||
return
|
return
|
||||||
} else {
|
} else {
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
package group
|
package group
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/src/common/config"
|
"Open_IM/pkg/common/config"
|
||||||
"Open_IM/src/common/log"
|
"Open_IM/pkg/common/log"
|
||||||
"Open_IM/src/grpc-etcdv3/getcdv3"
|
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
||||||
pb "Open_IM/src/proto/group"
|
pb "Open_IM/pkg/proto/group"
|
||||||
"context"
|
"context"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"net/http"
|
"net/http"
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
package group
|
package group
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/src/common/config"
|
"Open_IM/pkg/common/config"
|
||||||
"Open_IM/src/common/log"
|
"Open_IM/pkg/common/log"
|
||||||
"Open_IM/src/grpc-etcdv3/getcdv3"
|
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
||||||
pb "Open_IM/src/proto/group"
|
pb "Open_IM/pkg/proto/group"
|
||||||
"context"
|
"context"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"net/http"
|
"net/http"
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
package group
|
package group
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/src/common/config"
|
"Open_IM/pkg/common/config"
|
||||||
"Open_IM/src/common/log"
|
"Open_IM/pkg/common/log"
|
||||||
"Open_IM/src/grpc-etcdv3/getcdv3"
|
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
||||||
pb "Open_IM/src/proto/group"
|
pb "Open_IM/pkg/proto/group"
|
||||||
"context"
|
"context"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"net/http"
|
"net/http"
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
package group
|
package group
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/src/common/config"
|
"Open_IM/pkg/common/config"
|
||||||
"Open_IM/src/common/log"
|
"Open_IM/pkg/common/log"
|
||||||
"Open_IM/src/grpc-etcdv3/getcdv3"
|
"Open_IM/pkg/common/token_verify"
|
||||||
"Open_IM/src/proto/group"
|
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
||||||
"Open_IM/src/utils"
|
"Open_IM/pkg/proto/group"
|
||||||
"context"
|
"context"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"net/http"
|
"net/http"
|
||||||
@@ -41,7 +41,7 @@ func TransferGroupOwner(c *gin.Context) {
|
|||||||
pbData := newTransferGroupOwnerReq(¶ms)
|
pbData := newTransferGroupOwnerReq(¶ms)
|
||||||
|
|
||||||
token := c.Request.Header.Get("token")
|
token := c.Request.Header.Get("token")
|
||||||
if claims, err := utils.ParseToken(token); err != nil {
|
if claims, err := token_verify.ParseToken(token); err != nil {
|
||||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "token validate err"})
|
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "token validate err"})
|
||||||
return
|
return
|
||||||
} else {
|
} else {
|
||||||
@@ -7,12 +7,13 @@
|
|||||||
package manage
|
package manage
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/src/common/config"
|
"Open_IM/pkg/common/config"
|
||||||
"Open_IM/src/common/constant"
|
"Open_IM/pkg/common/constant"
|
||||||
"Open_IM/src/common/log"
|
"Open_IM/pkg/common/log"
|
||||||
"Open_IM/src/grpc-etcdv3/getcdv3"
|
"Open_IM/pkg/common/token_verify"
|
||||||
pbChat "Open_IM/src/proto/chat"
|
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
||||||
"Open_IM/src/utils"
|
pbChat "Open_IM/pkg/proto/chat"
|
||||||
|
"Open_IM/pkg/utils"
|
||||||
"context"
|
"context"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"github.com/go-playground/validator/v10"
|
"github.com/go-playground/validator/v10"
|
||||||
@@ -24,18 +25,20 @@ import (
|
|||||||
var validate *validator.Validate
|
var validate *validator.Validate
|
||||||
|
|
||||||
type paramsManagementSendMsg struct {
|
type paramsManagementSendMsg struct {
|
||||||
OperationID string `json:"operationID" binding:"required"`
|
OperationID string `json:"operationID" binding:"required"`
|
||||||
SendID string `json:"sendID" binding:"required"`
|
SendID string `json:"sendID" binding:"required"`
|
||||||
RecvID string `json:"recvID" binding:"required"`
|
RecvID string `json:"recvID" binding:"required"`
|
||||||
SenderNickName string `json:"senderNickName" `
|
SenderNickName string `json:"senderNickName" `
|
||||||
SenderFaceURL string `json:"senderFaceURL" `
|
SenderFaceURL string `json:"senderFaceURL" `
|
||||||
ForceList []string `json:"forceList" `
|
SenderPlatformID int32 `json:"senderPlatformID"`
|
||||||
Content map[string]interface{} `json:"content" binding:"required"`
|
ForceList []string `json:"forceList" `
|
||||||
ContentType int32 `json:"contentType" binding:"required"`
|
Content map[string]interface{} `json:"content" binding:"required"`
|
||||||
SessionType int32 `json:"sessionType" binding:"required"`
|
ContentType int32 `json:"contentType" binding:"required"`
|
||||||
|
SessionType int32 `json:"sessionType" binding:"required"`
|
||||||
|
IsOnlineOnly bool `json:"isOnlineOnly"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func newUserSendMsgReq(token string, params *paramsManagementSendMsg) *pbChat.UserSendMsgReq {
|
func newUserSendMsgReq(params *paramsManagementSendMsg) *pbChat.UserSendMsgReq {
|
||||||
var newContent string
|
var newContent string
|
||||||
switch params.ContentType {
|
switch params.ContentType {
|
||||||
case constant.Text:
|
case constant.Text:
|
||||||
@@ -49,16 +52,19 @@ func newUserSendMsgReq(token string, params *paramsManagementSendMsg) *pbChat.Us
|
|||||||
case constant.File:
|
case constant.File:
|
||||||
newContent = utils.StructToJsonString(params.Content)
|
newContent = utils.StructToJsonString(params.Content)
|
||||||
default:
|
default:
|
||||||
|
}
|
||||||
|
options := make(map[string]int32, 2)
|
||||||
|
if params.IsOnlineOnly {
|
||||||
|
options["history"] = 0
|
||||||
|
options["persistent"] = 0
|
||||||
}
|
}
|
||||||
pbData := pbChat.UserSendMsgReq{
|
pbData := pbChat.UserSendMsgReq{
|
||||||
ReqIdentifier: constant.WSSendMsg,
|
ReqIdentifier: constant.WSSendMsg,
|
||||||
Token: token,
|
|
||||||
SendID: params.SendID,
|
SendID: params.SendID,
|
||||||
SenderNickName: params.SenderNickName,
|
SenderNickName: params.SenderNickName,
|
||||||
SenderFaceURL: params.SenderFaceURL,
|
SenderFaceURL: params.SenderFaceURL,
|
||||||
OperationID: params.OperationID,
|
OperationID: params.OperationID,
|
||||||
PlatformID: 0,
|
PlatformID: params.SenderPlatformID,
|
||||||
SessionType: params.SessionType,
|
SessionType: params.SessionType,
|
||||||
MsgFrom: constant.UserMsgType,
|
MsgFrom: constant.UserMsgType,
|
||||||
ContentType: params.ContentType,
|
ContentType: params.ContentType,
|
||||||
@@ -66,6 +72,7 @@ func newUserSendMsgReq(token string, params *paramsManagementSendMsg) *pbChat.Us
|
|||||||
ForceList: params.ForceList,
|
ForceList: params.ForceList,
|
||||||
Content: newContent,
|
Content: newContent,
|
||||||
ClientMsgID: utils.GetMsgID(params.SendID),
|
ClientMsgID: utils.GetMsgID(params.SendID),
|
||||||
|
Options: utils.MapIntToJsonString(options),
|
||||||
}
|
}
|
||||||
return &pbData
|
return &pbData
|
||||||
}
|
}
|
||||||
@@ -85,8 +92,24 @@ func ManagementSendMsg(c *gin.Context) {
|
|||||||
data = TextElem{}
|
data = TextElem{}
|
||||||
case constant.Picture:
|
case constant.Picture:
|
||||||
data = PictureElem{}
|
data = PictureElem{}
|
||||||
|
case constant.Voice:
|
||||||
|
data = SoundElem{}
|
||||||
|
case constant.Video:
|
||||||
|
data = VideoElem{}
|
||||||
|
case constant.File:
|
||||||
|
data = FileElem{}
|
||||||
|
//case constant.AtText:
|
||||||
|
// data = AtElem{}
|
||||||
|
//case constant.Merger:
|
||||||
|
// data =
|
||||||
|
//case constant.Card:
|
||||||
|
//case constant.Location:
|
||||||
case constant.Custom:
|
case constant.Custom:
|
||||||
data = CustomElem{}
|
data = CustomElem{}
|
||||||
|
//case constant.Revoke:
|
||||||
|
//case constant.HasReadReceipt:
|
||||||
|
//case constant.Typing:
|
||||||
|
//case constant.Quote:
|
||||||
default:
|
default:
|
||||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 404, "errMsg": "contentType err"})
|
c.JSON(http.StatusBadRequest, gin.H{"errCode": 404, "errMsg": "contentType err"})
|
||||||
log.ErrorByKv("contentType err", c.PostForm("operationID"), "content", c.PostForm("content"))
|
log.ErrorByKv("contentType err", c.PostForm("operationID"), "content", c.PostForm("content"))
|
||||||
@@ -103,15 +126,19 @@ func ManagementSendMsg(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
token := c.Request.Header.Get("token")
|
token := c.Request.Header.Get("token")
|
||||||
if !utils.IsContain(params.SendID, config.Config.Manager.AppManagerUid) {
|
claims, err := token_verify.ParseToken(token)
|
||||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "not appManager", "sendTime": 0, "MsgID": ""})
|
if err != nil {
|
||||||
|
log.NewError(params.OperationID, "parse token failed", err.Error())
|
||||||
|
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "parse token failed", "sendTime": 0, "MsgID": ""})
|
||||||
|
}
|
||||||
|
if !utils.IsContain(claims.UID, config.Config.Manager.AppManagerUid) {
|
||||||
|
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "not authorized", "sendTime": 0, "MsgID": ""})
|
||||||
return
|
return
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
log.InfoByKv("Ws call success to ManagementSendMsgReq", params.OperationID, "Parameters", params)
|
log.InfoByKv("Ws call success to ManagementSendMsgReq", params.OperationID, "Parameters", params)
|
||||||
|
|
||||||
pbData := newUserSendMsgReq(token, ¶ms)
|
pbData := newUserSendMsgReq(¶ms)
|
||||||
log.Info("", "", "api ManagementSendMsg call start..., [data: %s]", pbData.String())
|
log.Info("", "", "api ManagementSendMsg call start..., [data: %s]", pbData.String())
|
||||||
|
|
||||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfflineMessageName)
|
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfflineMessageName)
|
||||||
@@ -0,0 +1,153 @@
|
|||||||
|
/*
|
||||||
|
** description("").
|
||||||
|
** copyright('open-im,www.open-im.io').
|
||||||
|
** author("fg,Gordon@tuoyun.net").
|
||||||
|
** time(2021/9/15 10:28).
|
||||||
|
*/
|
||||||
|
package manage
|
||||||
|
|
||||||
|
import (
|
||||||
|
"Open_IM/pkg/common/config"
|
||||||
|
"Open_IM/pkg/common/constant"
|
||||||
|
"Open_IM/pkg/common/log"
|
||||||
|
"Open_IM/pkg/common/token_verify"
|
||||||
|
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
||||||
|
pbRelay "Open_IM/pkg/proto/relay"
|
||||||
|
pbUser "Open_IM/pkg/proto/user"
|
||||||
|
"Open_IM/pkg/utils"
|
||||||
|
"context"
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
|
"net/http"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
|
type paramsDeleteUsers struct {
|
||||||
|
OperationID string `json:"operationID" binding:"required"`
|
||||||
|
DeleteUidList []string `json:"deleteUidList" binding:"required"`
|
||||||
|
}
|
||||||
|
type paramsGetAllUsersUid struct {
|
||||||
|
OperationID string `json:"operationID" binding:"required"`
|
||||||
|
}
|
||||||
|
type paramsGetUsersOnlineStatus struct {
|
||||||
|
OperationID string `json:"operationID" binding:"required"`
|
||||||
|
UserIDList []string `json:"userIDList" binding:"required,lte=200"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func DeleteUser(c *gin.Context) {
|
||||||
|
params := paramsDeleteUsers{}
|
||||||
|
if err := c.BindJSON(¶ms); err != nil {
|
||||||
|
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
log.InfoByKv("DeleteUser req come here", params.OperationID, "DeleteUidList", params.DeleteUidList)
|
||||||
|
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName)
|
||||||
|
client := pbUser.NewUserClient(etcdConn)
|
||||||
|
//defer etcdConn.Close()
|
||||||
|
|
||||||
|
req := &pbUser.DeleteUsersReq{
|
||||||
|
OperationID: params.OperationID,
|
||||||
|
DeleteUidList: params.DeleteUidList,
|
||||||
|
Token: c.Request.Header.Get("token"),
|
||||||
|
}
|
||||||
|
RpcResp, err := client.DeleteUsers(context.Background(), req)
|
||||||
|
if err != nil {
|
||||||
|
log.NewError(req.OperationID, "call delete users rpc server failed", err.Error())
|
||||||
|
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call delete users rpc server failed"})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
failedUidList := make([]string, 0)
|
||||||
|
for _, v := range RpcResp.FailedUidList {
|
||||||
|
failedUidList = append(failedUidList, v)
|
||||||
|
}
|
||||||
|
log.InfoByKv("call delete user rpc server is success", params.OperationID, "resp args", RpcResp.String())
|
||||||
|
resp := gin.H{"errCode": RpcResp.CommonResp.ErrorCode, "errMsg": RpcResp.CommonResp.ErrorMsg, "failedUidList": RpcResp.FailedUidList}
|
||||||
|
c.JSON(http.StatusOK, resp)
|
||||||
|
}
|
||||||
|
func GetAllUsersUid(c *gin.Context) {
|
||||||
|
params := paramsGetAllUsersUid{}
|
||||||
|
if err := c.BindJSON(¶ms); err != nil {
|
||||||
|
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
log.InfoByKv("GetAllUsersUid req come here", params.OperationID)
|
||||||
|
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName)
|
||||||
|
client := pbUser.NewUserClient(etcdConn)
|
||||||
|
//defer etcdConn.Close()
|
||||||
|
|
||||||
|
req := &pbUser.GetAllUsersUidReq{
|
||||||
|
OperationID: params.OperationID,
|
||||||
|
Token: c.Request.Header.Get("token"),
|
||||||
|
}
|
||||||
|
RpcResp, err := client.GetAllUsersUid(context.Background(), req)
|
||||||
|
if err != nil {
|
||||||
|
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": err.Error(), "uidList": []string{}})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
log.InfoByKv("call GetAllUsersUid rpc server is success", params.OperationID, "resp args", RpcResp.String())
|
||||||
|
resp := gin.H{"errCode": RpcResp.CommonResp.ErrorCode, "errMsg": RpcResp.CommonResp.ErrorMsg, "uidList": RpcResp.UidList}
|
||||||
|
c.JSON(http.StatusOK, resp)
|
||||||
|
|
||||||
|
}
|
||||||
|
func GetUsersOnlineStatus(c *gin.Context) {
|
||||||
|
params := paramsGetUsersOnlineStatus{}
|
||||||
|
if err := c.BindJSON(¶ms); err != nil {
|
||||||
|
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
claims, err := token_verify.ParseToken(c.Request.Header.Get("token"))
|
||||||
|
if err != nil {
|
||||||
|
log.ErrorByKv("parse token failed", params.OperationID, "err", err.Error())
|
||||||
|
c.JSON(http.StatusBadRequest, gin.H{"errCode": 401, "errMsg": err.Error()})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if !utils.IsContain(claims.UID, config.Config.Manager.AppManagerUid) {
|
||||||
|
log.ErrorByKv(" Authentication failed", params.OperationID, "args", c)
|
||||||
|
c.JSON(http.StatusBadRequest, gin.H{"errCode": 402, "errMsg": "not authorized"})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
req := &pbRelay.GetUsersOnlineStatusReq{
|
||||||
|
OperationID: params.OperationID,
|
||||||
|
UserIDList: params.UserIDList,
|
||||||
|
}
|
||||||
|
var wsResult []*pbRelay.GetUsersOnlineStatusResp_SuccessResult
|
||||||
|
var respResult []*pbRelay.GetUsersOnlineStatusResp_SuccessResult
|
||||||
|
flag := false
|
||||||
|
log.NewDebug(params.OperationID, "GetUsersOnlineStatus req come here", params.UserIDList)
|
||||||
|
grpcCons := getcdv3.GetConn4Unique(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOnlineMessageRelayName)
|
||||||
|
for _, v := range grpcCons {
|
||||||
|
client := pbRelay.NewOnlineMessageRelayServiceClient(v)
|
||||||
|
reply, err := client.GetUsersOnlineStatus(context.Background(), req)
|
||||||
|
if err != nil {
|
||||||
|
log.NewError(params.OperationID, "GetUsersOnlineStatus rpc err", req.String(), err.Error())
|
||||||
|
continue
|
||||||
|
} else {
|
||||||
|
if reply.ErrCode == 0 {
|
||||||
|
wsResult = append(wsResult, reply.SuccessResult...)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
log.NewDebug(params.OperationID, "call GetUsersOnlineStatus rpc server is success", wsResult)
|
||||||
|
//Online data merge of each node
|
||||||
|
for _, v1 := range params.UserIDList {
|
||||||
|
flag = false
|
||||||
|
temp := new(pbRelay.GetUsersOnlineStatusResp_SuccessResult)
|
||||||
|
for _, v2 := range wsResult {
|
||||||
|
if v2.UserID == v1 {
|
||||||
|
flag = true
|
||||||
|
temp.UserID = v1
|
||||||
|
temp.Status = constant.OnlineStatus
|
||||||
|
temp.DetailPlatformStatus = append(temp.DetailPlatformStatus, v2.DetailPlatformStatus...)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
if !flag {
|
||||||
|
temp.UserID = v1
|
||||||
|
temp.Status = constant.OfflineStatus
|
||||||
|
}
|
||||||
|
respResult = append(respResult, temp)
|
||||||
|
}
|
||||||
|
log.NewDebug(params.OperationID, "Finished merged data", respResult)
|
||||||
|
resp := gin.H{"errCode": 0, "errMsg": "", "successResult": respResult}
|
||||||
|
c.JSON(http.StatusOK, resp)
|
||||||
|
|
||||||
|
}
|
||||||
+4
-3
@@ -1,8 +1,9 @@
|
|||||||
package apiThird
|
package apiThird
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/src/common/config"
|
"Open_IM/pkg/common/config"
|
||||||
log2 "Open_IM/src/common/log"
|
"Open_IM/pkg/common/constant"
|
||||||
|
log2 "Open_IM/pkg/common/log"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
sts "github.com/tencentyun/qcloud-cos-sts-sdk/go"
|
sts "github.com/tencentyun/qcloud-cos-sts-sdk/go"
|
||||||
"net/http"
|
"net/http"
|
||||||
@@ -70,7 +71,7 @@ func TencentCloudStorageCredential(c *gin.Context) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
log2.Error(c.Request.Header.Get("token"), c.PostForm("optionID"), "api TencentUpLoadCredential cli.GetCredential err = %s", err.Error())
|
log2.Error(c.Request.Header.Get("token"), c.PostForm("optionID"), "api TencentUpLoadCredential cli.GetCredential err = %s", err.Error())
|
||||||
c.JSON(http.StatusOK, gin.H{
|
c.JSON(http.StatusOK, gin.H{
|
||||||
"errCode": config.ErrTencentCredential.ErrCode,
|
"errCode": constant.ErrTencentCredential.ErrCode,
|
||||||
"errMsg": err.Error(),
|
"errMsg": err.Error(),
|
||||||
"bucket": "",
|
"bucket": "",
|
||||||
"region": "",
|
"region": "",
|
||||||
@@ -0,0 +1,142 @@
|
|||||||
|
package user
|
||||||
|
|
||||||
|
import (
|
||||||
|
"Open_IM/pkg/common/config"
|
||||||
|
"Open_IM/pkg/common/constant"
|
||||||
|
"Open_IM/pkg/common/log"
|
||||||
|
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
||||||
|
pbRelay "Open_IM/pkg/proto/relay"
|
||||||
|
pbUser "Open_IM/pkg/proto/user"
|
||||||
|
"context"
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
|
"net/http"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
|
type userInfo struct {
|
||||||
|
UID string `json:"uid"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
Icon string `json:"icon"`
|
||||||
|
Gender int32 `json:"gender"`
|
||||||
|
Mobile string `json:"mobile"`
|
||||||
|
Birth string `json:"birth"`
|
||||||
|
Email string `json:"email"`
|
||||||
|
Ex string `json:"ex"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type paramsGetUsersOnlineStatus struct {
|
||||||
|
OperationID string `json:"operationID" binding:"required"`
|
||||||
|
UserIDList []string `json:"userIDList" binding:"required,lte=200"`
|
||||||
|
Secret string `json:"secret" binding:"required,max=32"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetUsersOnlineStatus(c *gin.Context) {
|
||||||
|
params := paramsGetUsersOnlineStatus{}
|
||||||
|
if err := c.BindJSON(¶ms); err != nil {
|
||||||
|
log.NewError(params.OperationID, "bind json failed ", err.Error(), c)
|
||||||
|
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if params.Secret != config.Config.Secret {
|
||||||
|
log.NewError(params.OperationID, "parse token failed ", params.Secret, config.Config.Secret)
|
||||||
|
c.JSON(http.StatusBadRequest, gin.H{"errCode": 401, "errMsg": "secret failed"})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
req := &pbRelay.GetUsersOnlineStatusReq{
|
||||||
|
OperationID: params.OperationID,
|
||||||
|
UserIDList: params.UserIDList,
|
||||||
|
}
|
||||||
|
var wsResult []*pbRelay.GetUsersOnlineStatusResp_SuccessResult
|
||||||
|
var respResult []*pbRelay.GetUsersOnlineStatusResp_SuccessResult
|
||||||
|
flag := false
|
||||||
|
log.NewDebug(params.OperationID, "GetUsersOnlineStatus req come here", params.UserIDList)
|
||||||
|
|
||||||
|
grpcCons := getcdv3.GetConn4Unique(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOnlineMessageRelayName)
|
||||||
|
for _, v := range grpcCons {
|
||||||
|
client := pbRelay.NewOnlineMessageRelayServiceClient(v)
|
||||||
|
reply, err := client.GetUsersOnlineStatus(context.Background(), req)
|
||||||
|
if err != nil {
|
||||||
|
log.NewError(params.OperationID, "GetUsersOnlineStatus rpc err", req.String(), err.Error())
|
||||||
|
continue
|
||||||
|
} else {
|
||||||
|
if reply.ErrCode == 0 {
|
||||||
|
wsResult = append(wsResult, reply.SuccessResult...)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
log.NewDebug(params.OperationID, "call GetUsersOnlineStatus rpc server is success", wsResult)
|
||||||
|
//Online data merge of each node
|
||||||
|
for _, v1 := range params.UserIDList {
|
||||||
|
flag = false
|
||||||
|
temp := new(pbRelay.GetUsersOnlineStatusResp_SuccessResult)
|
||||||
|
for _, v2 := range wsResult {
|
||||||
|
if v2.UserID == v1 {
|
||||||
|
flag = true
|
||||||
|
temp.UserID = v1
|
||||||
|
temp.Status = constant.OnlineStatus
|
||||||
|
temp.DetailPlatformStatus = append(temp.DetailPlatformStatus, v2.DetailPlatformStatus...)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if !flag {
|
||||||
|
temp.UserID = v1
|
||||||
|
temp.Status = constant.OfflineStatus
|
||||||
|
}
|
||||||
|
respResult = append(respResult, temp)
|
||||||
|
}
|
||||||
|
log.NewDebug(params.OperationID, "Finished merged data", respResult)
|
||||||
|
resp := gin.H{"errCode": 0, "errMsg": "", "successResult": respResult}
|
||||||
|
c.JSON(http.StatusOK, resp)
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetUserInfo(c *gin.Context) {
|
||||||
|
log.InfoByKv("api get userinfo init...", "")
|
||||||
|
|
||||||
|
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName)
|
||||||
|
client := pbUser.NewUserClient(etcdConn)
|
||||||
|
//defer etcdConn.Close()
|
||||||
|
|
||||||
|
params := paramsStruct{}
|
||||||
|
if err := c.BindJSON(¶ms); err != nil {
|
||||||
|
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
req := &pbUser.GetUserInfoReq{
|
||||||
|
UserIDList: params.UIDList,
|
||||||
|
OperationID: params.OperationID,
|
||||||
|
Token: c.Request.Header.Get("token"),
|
||||||
|
}
|
||||||
|
log.InfoByKv("api get user info is server", c.PostForm("OperationID"), c.Request.Header.Get("token"))
|
||||||
|
RpcResp, err := client.GetUserInfo(context.Background(), req)
|
||||||
|
if err != nil {
|
||||||
|
log.Error(req.Token, req.OperationID, "err=%s,call get user info rpc server failed", err)
|
||||||
|
c.JSON(http.StatusInternalServerError, gin.H{
|
||||||
|
"errorCode": 500,
|
||||||
|
"errorMsg": "call rpc server failed",
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
log.InfoByKv("call get user info rpc server success", params.OperationID)
|
||||||
|
if RpcResp.ErrorCode == 0 {
|
||||||
|
userInfoList := make([]userInfo, 0)
|
||||||
|
for _, user := range RpcResp.Data {
|
||||||
|
var ui userInfo
|
||||||
|
ui.UID = user.Uid
|
||||||
|
ui.Name = user.Name
|
||||||
|
ui.Icon = user.Icon
|
||||||
|
ui.Gender = user.Gender
|
||||||
|
ui.Mobile = user.Mobile
|
||||||
|
ui.Birth = user.Birth
|
||||||
|
ui.Email = user.Email
|
||||||
|
ui.Ex = user.Ex
|
||||||
|
userInfoList = append(userInfoList, ui)
|
||||||
|
}
|
||||||
|
resp := gin.H{"errCode": RpcResp.ErrorCode, "errMsg": RpcResp.ErrorMsg, "data": userInfoList}
|
||||||
|
c.JSON(http.StatusOK, resp)
|
||||||
|
} else {
|
||||||
|
resp := gin.H{"errCode": RpcResp.ErrorCode, "errMsg": RpcResp.ErrorMsg}
|
||||||
|
c.JSON(http.StatusOK, resp)
|
||||||
|
}
|
||||||
|
log.InfoByKv("api get user info return success", params.OperationID, "args=%s", RpcResp.String())
|
||||||
|
}
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
package user
|
package user
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/src/common/config"
|
"Open_IM/pkg/common/config"
|
||||||
"Open_IM/src/common/log"
|
"Open_IM/pkg/common/log"
|
||||||
"Open_IM/src/grpc-etcdv3/getcdv3"
|
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
||||||
pbUser "Open_IM/src/proto/user"
|
pbUser "Open_IM/pkg/proto/user"
|
||||||
"context"
|
"context"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"net/http"
|
"net/http"
|
||||||
@@ -0,0 +1,112 @@
|
|||||||
|
package register
|
||||||
|
|
||||||
|
import (
|
||||||
|
"Open_IM/pkg/common/config"
|
||||||
|
"Open_IM/pkg/common/constant"
|
||||||
|
"Open_IM/pkg/common/db/mysql_model/im_mysql_model"
|
||||||
|
"Open_IM/pkg/common/log"
|
||||||
|
"Open_IM/pkg/utils"
|
||||||
|
"bytes"
|
||||||
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
|
"io/ioutil"
|
||||||
|
"net/http"
|
||||||
|
)
|
||||||
|
|
||||||
|
type ParamsLogin struct {
|
||||||
|
Email string `json:"email"`
|
||||||
|
PhoneNumber string `json:"phoneNumber"`
|
||||||
|
Password string `json:"password"`
|
||||||
|
Platform int32 `json:"platform"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func Login(c *gin.Context) {
|
||||||
|
log.NewDebug("Login api is statrting...")
|
||||||
|
params := ParamsLogin{}
|
||||||
|
if err := c.BindJSON(¶ms); err != nil {
|
||||||
|
c.JSON(http.StatusBadRequest, gin.H{"errCode": constant.FormattingError, "errMsg": err.Error()})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
var account string
|
||||||
|
if params.Email != "" {
|
||||||
|
account = params.Email
|
||||||
|
} else {
|
||||||
|
account = params.PhoneNumber
|
||||||
|
}
|
||||||
|
|
||||||
|
log.InfoByKv("api Login get params", account)
|
||||||
|
|
||||||
|
queryParams := im_mysql_model.Register{
|
||||||
|
Account: account,
|
||||||
|
Password: params.Password,
|
||||||
|
}
|
||||||
|
|
||||||
|
canLogin := im_mysql_model.Login(&queryParams)
|
||||||
|
if canLogin == 1 {
|
||||||
|
log.ErrorByKv("Incorrect phone number password", account, "err", "Mobile phone number is not registered")
|
||||||
|
c.JSON(http.StatusOK, gin.H{"errCode": constant.LogicalError, "errMsg": "Mobile phone number is not registered"})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if canLogin == 2 {
|
||||||
|
log.ErrorByKv("Incorrect phone number password", account, "err", "Incorrect password")
|
||||||
|
c.JSON(http.StatusOK, gin.H{"errCode": constant.LogicalError, "errMsg": "Incorrect password"})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
resp, err := OpenIMToken(account, params.Platform)
|
||||||
|
if err != nil {
|
||||||
|
log.ErrorByKv("get token by phone number err", account, "err", err.Error())
|
||||||
|
c.JSON(http.StatusOK, gin.H{"errCode": constant.HttpError, "errMsg": err.Error()})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
response, err := ioutil.ReadAll(resp.Body)
|
||||||
|
defer resp.Body.Close()
|
||||||
|
if err != nil {
|
||||||
|
log.ErrorByKv("Failed to read file", account, "err", err.Error())
|
||||||
|
c.JSON(http.StatusOK, gin.H{"errCode": constant.IoErrot, "errMsg": err.Error()})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
imRep := IMRegisterResp{}
|
||||||
|
err = json.Unmarshal(response, &imRep)
|
||||||
|
if err != nil {
|
||||||
|
log.ErrorByKv("json parsing failed", account, "err", err.Error())
|
||||||
|
c.JSON(http.StatusOK, gin.H{"errCode": constant.FormattingError, "errMsg": err.Error()})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if imRep.ErrCode != 0 {
|
||||||
|
log.ErrorByKv("openIM Login request failed", account, "err")
|
||||||
|
c.JSON(http.StatusOK, gin.H{"errCode": constant.HttpError, "errMsg": imRep.ErrMsg})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
c.JSON(http.StatusOK, gin.H{"errCode": constant.NoError, "errMsg": "", "data": imRep.Data})
|
||||||
|
return
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func OpenIMToken(Account string, platform int32) (*http.Response, error) {
|
||||||
|
url := fmt.Sprintf("http://%s:10000/auth/user_token", utils.ServerIP)
|
||||||
|
|
||||||
|
client := &http.Client{}
|
||||||
|
params := make(map[string]interface{})
|
||||||
|
|
||||||
|
params["secret"] = config.Config.Secret
|
||||||
|
params["platform"] = platform
|
||||||
|
params["uid"] = Account
|
||||||
|
con, err := json.Marshal(params)
|
||||||
|
if err != nil {
|
||||||
|
log.ErrorByKv("json parsing failed", Account, "err", err.Error())
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
req, err := http.NewRequest("POST", url, bytes.NewBuffer([]byte(con)))
|
||||||
|
if err != nil {
|
||||||
|
log.ErrorByKv("request error", "/auth/user_token", "err", err.Error())
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
resp, err := client.Do(req)
|
||||||
|
return resp, err
|
||||||
|
}
|
||||||
@@ -0,0 +1,151 @@
|
|||||||
|
package register
|
||||||
|
|
||||||
|
import (
|
||||||
|
"Open_IM/pkg/common/config"
|
||||||
|
"Open_IM/pkg/common/constant"
|
||||||
|
"Open_IM/pkg/common/db"
|
||||||
|
"Open_IM/pkg/common/db/mysql_model/im_mysql_model"
|
||||||
|
"Open_IM/pkg/common/log"
|
||||||
|
"fmt"
|
||||||
|
openapi "github.com/alibabacloud-go/darabonba-openapi/client"
|
||||||
|
dysmsapi20170525 "github.com/alibabacloud-go/dysmsapi-20170525/v2/client"
|
||||||
|
"github.com/alibabacloud-go/tea/tea"
|
||||||
|
"github.com/garyburd/redigo/redis"
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
|
"gopkg.in/gomail.v2"
|
||||||
|
"math/rand"
|
||||||
|
"net/http"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
type paramsVerificationCode struct {
|
||||||
|
Email string `json:"email"`
|
||||||
|
PhoneNumber string `json:"phoneNumber"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func SendVerificationCode(c *gin.Context) {
|
||||||
|
log.InfoByKv("sendCode api is statrting...", "")
|
||||||
|
params := paramsVerificationCode{}
|
||||||
|
|
||||||
|
if err := c.BindJSON(¶ms); err != nil {
|
||||||
|
log.ErrorByKv("request params json parsing failed", params.PhoneNumber, params.Email, "err", err.Error())
|
||||||
|
c.JSON(http.StatusBadRequest, gin.H{"errCode": constant.FormattingError, "errMsg": err.Error()})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
var account string
|
||||||
|
if params.Email != "" {
|
||||||
|
account = params.Email
|
||||||
|
} else {
|
||||||
|
account = params.PhoneNumber
|
||||||
|
}
|
||||||
|
|
||||||
|
queryParams := im_mysql_model.GetRegisterParams{
|
||||||
|
Account: account,
|
||||||
|
}
|
||||||
|
_, err, rowsAffected := im_mysql_model.GetRegister(&queryParams)
|
||||||
|
|
||||||
|
if err == nil && rowsAffected != 0 {
|
||||||
|
log.ErrorByKv("The phone number has been registered", queryParams.Account, "err")
|
||||||
|
c.JSON(http.StatusOK, gin.H{"errCode": constant.LogicalError, "errMsg": "The phone number has been registered"})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
log.InfoByKv("begin sendSms", account)
|
||||||
|
rand.Seed(time.Now().UnixNano())
|
||||||
|
code := 100000 + rand.Intn(900000)
|
||||||
|
log.NewDebug("", config.Config.Demo)
|
||||||
|
if params.Email != "" {
|
||||||
|
m := gomail.NewMessage()
|
||||||
|
m.SetHeader(`From`, config.Config.Demo.Mail.SenderMail)
|
||||||
|
m.SetHeader(`To`, []string{account}...)
|
||||||
|
m.SetHeader(`Subject`, config.Config.Demo.Mail.Title)
|
||||||
|
m.SetBody(`text/html`, fmt.Sprintf("%d", code))
|
||||||
|
if err := gomail.NewDialer(config.Config.Demo.Mail.SmtpAddr, config.Config.Demo.Mail.SmtpPort, config.Config.Demo.Mail.SenderMail, config.Config.Demo.Mail.SenderAuthorizationCode).DialAndSend(m); err != nil {
|
||||||
|
log.ErrorByKv("send mail error", account, "err", err.Error())
|
||||||
|
c.JSON(http.StatusOK, gin.H{"errCode": constant.IntentionalError, "errMsg": err.Error()})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
client, err := CreateClient(tea.String(config.Config.Demo.AliSMSVerify.AccessKeyID), tea.String(config.Config.Demo.AliSMSVerify.AccessKeySecret))
|
||||||
|
if err != nil {
|
||||||
|
log.ErrorByKv("create sendSms client err", "", "err", err.Error())
|
||||||
|
c.JSON(http.StatusOK, gin.H{"errCode": constant.IntentionalError, "errMsg": "Enter the superCode directly in the verification code box, SuperCode can be configured in config.xml"})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
sendSmsRequest := &dysmsapi20170525.SendSmsRequest{
|
||||||
|
PhoneNumbers: tea.String(account),
|
||||||
|
SignName: tea.String(config.Config.Demo.AliSMSVerify.SignName),
|
||||||
|
TemplateCode: tea.String(config.Config.Demo.AliSMSVerify.VerificationCodeTemplateCode),
|
||||||
|
TemplateParam: tea.String(fmt.Sprintf("{\"code\":\"%d\"}", code)),
|
||||||
|
}
|
||||||
|
|
||||||
|
response, err := client.SendSms(sendSmsRequest)
|
||||||
|
if err != nil {
|
||||||
|
log.ErrorByKv("sendSms error", account, "err", err.Error())
|
||||||
|
c.JSON(http.StatusOK, gin.H{"errCode": constant.IntentionalError, "errMsg": "Enter the superCode directly in the verification code box, SuperCode can be configured in config.xml"})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if *response.Body.Code != "OK" {
|
||||||
|
log.ErrorByKv("alibabacloud sendSms error", account, "err", response.Body.Code, response.Body.Message)
|
||||||
|
c.JSON(http.StatusOK, gin.H{"errCode": constant.IntentionalError, "errMsg": "Enter the superCode directly in the verification code box, SuperCode can be configured in config.xml"})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
log.InfoByKv("begin store redis", account)
|
||||||
|
v, err := redis.Int(db.DB.Exec("TTL", account))
|
||||||
|
if err != nil {
|
||||||
|
log.ErrorByKv("get account from redis error", account, "err", err.Error())
|
||||||
|
c.JSON(http.StatusOK, gin.H{"errCode": constant.IntentionalError, "errMsg": "Enter the superCode directly in the verification code box, SuperCode can be configured in config.xml"})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
switch {
|
||||||
|
case v == -2:
|
||||||
|
_, err = db.DB.Exec("SET", account, code, "EX", 600)
|
||||||
|
if err != nil {
|
||||||
|
log.ErrorByKv("set redis error", account, "err", err.Error())
|
||||||
|
c.JSON(http.StatusOK, gin.H{"errCode": constant.IntentionalError, "errMsg": "Enter the superCode directly in the verification code box, SuperCode can be configured in config.xml"})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
data := make(map[string]interface{})
|
||||||
|
data["account"] = account
|
||||||
|
c.JSON(http.StatusOK, gin.H{"errCode": constant.NoError, "errMsg": "Verification code sent successfully!", "data": data})
|
||||||
|
log.InfoByKv("send new verification code", account)
|
||||||
|
return
|
||||||
|
case v > 540:
|
||||||
|
data := make(map[string]interface{})
|
||||||
|
data["account"] = account
|
||||||
|
c.JSON(http.StatusOK, gin.H{"errCode": constant.LogicalError, "errMsg": "Frequent operation!", "data": data})
|
||||||
|
log.InfoByKv("frequent operation", account)
|
||||||
|
return
|
||||||
|
case v < 540:
|
||||||
|
_, err = db.DB.Exec("SET", account, code, "EX", 600)
|
||||||
|
if err != nil {
|
||||||
|
c.JSON(http.StatusOK, gin.H{"errCode": constant.IntentionalError, "errMsg": "Enterthe superCode directly in the verification code box, SuperCode can be configured in config.xml"})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
data := make(map[string]interface{})
|
||||||
|
data["account"] = account
|
||||||
|
c.JSON(http.StatusOK, gin.H{"errCode": constant.NoError, "errMsg": "Verification code has been reset!", "data": data})
|
||||||
|
log.InfoByKv("Reset verification code", account)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func CreateClient(accessKeyId *string, accessKeySecret *string) (result *dysmsapi20170525.Client, err error) {
|
||||||
|
c := &openapi.Config{
|
||||||
|
// 您的AccessKey ID
|
||||||
|
AccessKeyId: accessKeyId,
|
||||||
|
// 您的AccessKey Secret
|
||||||
|
AccessKeySecret: accessKeySecret,
|
||||||
|
}
|
||||||
|
|
||||||
|
// 访问的域名
|
||||||
|
c.Endpoint = tea.String("dysmsapi.aliyuncs.com")
|
||||||
|
result = &dysmsapi20170525.Client{}
|
||||||
|
result, err = dysmsapi20170525.NewClient(c)
|
||||||
|
return result, err
|
||||||
|
}
|
||||||
@@ -0,0 +1,155 @@
|
|||||||
|
package register
|
||||||
|
|
||||||
|
import (
|
||||||
|
"Open_IM/pkg/common/config"
|
||||||
|
"Open_IM/pkg/common/constant"
|
||||||
|
"Open_IM/pkg/common/db"
|
||||||
|
"Open_IM/pkg/common/db/mysql_model/im_mysql_model"
|
||||||
|
"Open_IM/pkg/common/log"
|
||||||
|
"Open_IM/pkg/utils"
|
||||||
|
"bytes"
|
||||||
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
|
"github.com/garyburd/redigo/redis"
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
|
"io/ioutil"
|
||||||
|
"net/http"
|
||||||
|
)
|
||||||
|
|
||||||
|
type ParamsSetPassword struct {
|
||||||
|
Email string `json:"email"`
|
||||||
|
PhoneNumber string `json:"phoneNumber"`
|
||||||
|
Password string `json:"password"`
|
||||||
|
VerificationCode string `json:"verificationCode"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type Data struct {
|
||||||
|
ExpiredTime int64 `json:"expiredTime"`
|
||||||
|
Token string `json:"token"`
|
||||||
|
Uid string `json:"uid"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type IMRegisterResp struct {
|
||||||
|
Data Data `json:"data"`
|
||||||
|
ErrCode int32 `json:"errCode"`
|
||||||
|
ErrMsg string `json:"errMsg"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func SetPassword(c *gin.Context) {
|
||||||
|
log.InfoByKv("setPassword api is statrting...", "")
|
||||||
|
params := ParamsSetPassword{}
|
||||||
|
if err := c.BindJSON(¶ms); err != nil {
|
||||||
|
c.JSON(http.StatusBadRequest, gin.H{"errCode": constant.FormattingError, "errMsg": err.Error()})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
var account string
|
||||||
|
if params.Email != "" {
|
||||||
|
account = params.Email
|
||||||
|
} else {
|
||||||
|
account = params.PhoneNumber
|
||||||
|
}
|
||||||
|
|
||||||
|
log.InfoByKv("begin store redis", account)
|
||||||
|
v, err := redis.String(db.DB.Exec("GET", account))
|
||||||
|
|
||||||
|
if params.VerificationCode == config.Config.Demo.SuperCode {
|
||||||
|
goto openIMRegisterTab
|
||||||
|
}
|
||||||
|
|
||||||
|
fmt.Println("Get Redis:", v, err)
|
||||||
|
if err != nil {
|
||||||
|
log.ErrorByKv("password Verification code expired", account, "err", err.Error())
|
||||||
|
data := make(map[string]interface{})
|
||||||
|
data["phoneNumber"] = account
|
||||||
|
c.JSON(http.StatusOK, gin.H{"errCode": constant.LogicalError, "errMsg": "Verification expired!", "data": data})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if v != params.VerificationCode {
|
||||||
|
log.InfoByKv("password Verification code error", account, params.VerificationCode)
|
||||||
|
data := make(map[string]interface{})
|
||||||
|
data["PhoneNumber"] = account
|
||||||
|
c.JSON(http.StatusOK, gin.H{"errCode": constant.LogicalError, "errMsg": "Verification code error!", "data": data})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
openIMRegisterTab:
|
||||||
|
log.InfoByKv("openIM register begin", account)
|
||||||
|
resp, err := OpenIMRegister(account)
|
||||||
|
|
||||||
|
log.InfoByKv("openIM register resp", account, resp, err)
|
||||||
|
if err != nil {
|
||||||
|
log.ErrorByKv("request openIM register error", account, "err", err.Error())
|
||||||
|
c.JSON(http.StatusOK, gin.H{"errCode": constant.HttpError, "errMsg": err.Error()})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
response, err := ioutil.ReadAll(resp.Body)
|
||||||
|
defer resp.Body.Close()
|
||||||
|
if err != nil {
|
||||||
|
c.JSON(http.StatusOK, gin.H{"errCode": constant.IoErrot, "errMsg": err.Error()})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
imrep := IMRegisterResp{}
|
||||||
|
err = json.Unmarshal(response, &imrep)
|
||||||
|
if err != nil {
|
||||||
|
c.JSON(http.StatusOK, gin.H{"errCode": constant.FormattingError, "errMsg": err.Error()})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if imrep.ErrCode != 0 {
|
||||||
|
c.JSON(http.StatusOK, gin.H{"errCode": constant.HttpError, "errMsg": imrep.ErrMsg})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
queryParams := im_mysql_model.SetPasswordParams{
|
||||||
|
Account: account,
|
||||||
|
Password: params.Password,
|
||||||
|
}
|
||||||
|
|
||||||
|
log.InfoByKv("begin store mysql", account, params.Password)
|
||||||
|
_, err = im_mysql_model.SetPassword(&queryParams)
|
||||||
|
if err != nil {
|
||||||
|
log.ErrorByKv("set phone number password error", account, "err", err.Error())
|
||||||
|
c.JSON(http.StatusOK, gin.H{"errCode": constant.DatabaseError, "errMsg": err.Error()})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
log.InfoByKv("end setPassword", account)
|
||||||
|
c.JSON(http.StatusOK, gin.H{"errCode": constant.NoError, "errMsg": "", "data": imrep.Data})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func OpenIMRegister(account string) (*http.Response, error) {
|
||||||
|
url := fmt.Sprintf("http://%s:10000/auth/user_register", utils.ServerIP)
|
||||||
|
fmt.Println("1:", config.Config.Secret)
|
||||||
|
|
||||||
|
client := &http.Client{}
|
||||||
|
|
||||||
|
params := make(map[string]interface{})
|
||||||
|
|
||||||
|
params["secret"] = config.Config.Secret
|
||||||
|
params["platform"] = 2
|
||||||
|
params["uid"] = account
|
||||||
|
params["name"] = account
|
||||||
|
params["icon"] = ""
|
||||||
|
params["gender"] = 0
|
||||||
|
|
||||||
|
params["mobile"] = ""
|
||||||
|
|
||||||
|
params["email"] = ""
|
||||||
|
params["birth"] = ""
|
||||||
|
params["ex"] = ""
|
||||||
|
con, err := json.Marshal(params)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
log.InfoByKv("openIM register params", account, params)
|
||||||
|
req, err := http.NewRequest("POST", url, bytes.NewBuffer([]byte(con)))
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
resp, err := client.Do(req)
|
||||||
|
|
||||||
|
return resp, err
|
||||||
|
}
|
||||||
@@ -0,0 +1,70 @@
|
|||||||
|
package register
|
||||||
|
|
||||||
|
import (
|
||||||
|
"Open_IM/pkg/common/config"
|
||||||
|
"Open_IM/pkg/common/constant"
|
||||||
|
"Open_IM/pkg/common/db"
|
||||||
|
"Open_IM/pkg/common/log"
|
||||||
|
|
||||||
|
"github.com/garyburd/redigo/redis"
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
|
"net/http"
|
||||||
|
)
|
||||||
|
|
||||||
|
type paramsCertification struct {
|
||||||
|
Email string `json:"email"`
|
||||||
|
PhoneNumber string `json:"phoneNumber"`
|
||||||
|
VerificationCode string `json:"verificationCode"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func Verify(c *gin.Context) {
|
||||||
|
log.InfoByKv("Verify api is statrting...", "")
|
||||||
|
params := paramsCertification{}
|
||||||
|
|
||||||
|
if err := c.BindJSON(¶ms); err != nil {
|
||||||
|
log.ErrorByKv("request params json parsing failed", "", "err", err.Error())
|
||||||
|
c.JSON(http.StatusBadRequest, gin.H{"errCode": constant.FormattingError, "errMsg": err.Error()})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
log.NewInfo("recv req: ", params)
|
||||||
|
|
||||||
|
var account string
|
||||||
|
if params.Email != "" {
|
||||||
|
account = params.Email
|
||||||
|
} else {
|
||||||
|
account = params.PhoneNumber
|
||||||
|
}
|
||||||
|
|
||||||
|
if params.VerificationCode == config.Config.Demo.SuperCode {
|
||||||
|
log.InfoByKv("Super Code Verified successfully", account)
|
||||||
|
data := make(map[string]interface{})
|
||||||
|
data["account"] = account
|
||||||
|
data["verificationCode"] = params.VerificationCode
|
||||||
|
c.JSON(http.StatusOK, gin.H{"errCode": constant.NoError, "errMsg": "Verified successfully!", "data": data})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
log.NewInfo("0", " params.VerificationCode != config.Config.Demo.SuperCode", params.VerificationCode, config.Config.Demo)
|
||||||
|
log.InfoByKv("begin get form redis", account)
|
||||||
|
v, err := redis.String(db.DB.Exec("GET", account))
|
||||||
|
log.InfoByKv("redis phone number and verificating Code", account, v)
|
||||||
|
if err != nil {
|
||||||
|
log.ErrorByKv("Verification code expired", account, "err", err.Error())
|
||||||
|
data := make(map[string]interface{})
|
||||||
|
data["account"] = account
|
||||||
|
c.JSON(http.StatusOK, gin.H{"errCode": constant.LogicalError, "errMsg": "Verification code expired!", "data": data})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if params.VerificationCode == v {
|
||||||
|
log.InfoByKv("Verified successfully", account)
|
||||||
|
data := make(map[string]interface{})
|
||||||
|
data["account"] = account
|
||||||
|
data["verificationCode"] = params.VerificationCode
|
||||||
|
c.JSON(http.StatusOK, gin.H{"errCode": constant.NoError, "errMsg": "Verified successfully!", "data": data})
|
||||||
|
return
|
||||||
|
} else {
|
||||||
|
log.InfoByKv("Verification code error", account, params.VerificationCode)
|
||||||
|
data := make(map[string]interface{})
|
||||||
|
data["account"] = account
|
||||||
|
c.JSON(http.StatusOK, gin.H{"errCode": constant.LogicalError, "errMsg": "Verification code error!", "data": data})
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
package gate
|
package gate
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/src/common/config"
|
"Open_IM/pkg/common/config"
|
||||||
"Open_IM/src/common/log"
|
"Open_IM/pkg/common/log"
|
||||||
"github.com/go-playground/validator/v10"
|
"github.com/go-playground/validator/v10"
|
||||||
"sync"
|
"sync"
|
||||||
)
|
)
|
||||||
@@ -1,18 +1,17 @@
|
|||||||
package gate
|
package gate
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/src/common/config"
|
"Open_IM/pkg/common/config"
|
||||||
"Open_IM/src/common/constant"
|
"Open_IM/pkg/common/constant"
|
||||||
"Open_IM/src/common/log"
|
"Open_IM/pkg/common/log"
|
||||||
"Open_IM/src/grpc-etcdv3/getcdv3"
|
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
||||||
pbChat "Open_IM/src/proto/chat"
|
pbChat "Open_IM/pkg/proto/chat"
|
||||||
pbWs "Open_IM/src/proto/sdk_ws"
|
open_im_sdk "Open_IM/pkg/proto/sdk_ws"
|
||||||
"Open_IM/src/utils"
|
"Open_IM/pkg/utils"
|
||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
"encoding/gob"
|
"encoding/gob"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
|
||||||
"github.com/golang/protobuf/proto"
|
"github.com/golang/protobuf/proto"
|
||||||
"github.com/gorilla/websocket"
|
"github.com/gorilla/websocket"
|
||||||
"runtime"
|
"runtime"
|
||||||
@@ -31,7 +30,7 @@ func (ws *WServer) msgParse(conn *UserConn, binaryMsg []byte) {
|
|||||||
dec := gob.NewDecoder(b)
|
dec := gob.NewDecoder(b)
|
||||||
err := dec.Decode(&m)
|
err := dec.Decode(&m)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.ErrorByKv("ws json Unmarshal err", "", "err", err.Error())
|
log.ErrorByKv("ws Decode err", "", "err", err.Error())
|
||||||
ws.sendErrMsg(conn, 200, err.Error(), constant.WSDataError, "", "")
|
ws.sendErrMsg(conn, 200, err.Error(), constant.WSDataError, "", "")
|
||||||
err = conn.Close()
|
err = conn.Close()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -44,7 +43,6 @@ func (ws *WServer) msgParse(conn *UserConn, binaryMsg []byte) {
|
|||||||
ws.sendErrMsg(conn, 201, err.Error(), m.ReqIdentifier, m.MsgIncr, m.OperationID)
|
ws.sendErrMsg(conn, 201, err.Error(), m.ReqIdentifier, m.MsgIncr, m.OperationID)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
//if !utils.VerifyToken(m.Token, m.SendID) {
|
//if !utils.VerifyToken(m.Token, m.SendID) {
|
||||||
// ws.sendErrMsg(conn, 202, "token validate err", m.ReqIdentifier, m.MsgIncr,m.OperationID)
|
// ws.sendErrMsg(conn, 202, "token validate err", m.ReqIdentifier, m.MsgIncr,m.OperationID)
|
||||||
// return
|
// return
|
||||||
@@ -63,12 +61,32 @@ func (ws *WServer) msgParse(conn *UserConn, binaryMsg []byte) {
|
|||||||
go ws.pullMsgBySeqListReq(conn, &m)
|
go ws.pullMsgBySeqListReq(conn, &m)
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
|
|
||||||
log.NewInfo("", "goroutine num is ", runtime.NumGoroutine())
|
log.NewInfo("", "goroutine num is ", runtime.NumGoroutine())
|
||||||
|
}
|
||||||
|
func (ws *WServer) getSeqReq(conn *UserConn, m *Req) {
|
||||||
|
log.NewInfo(m.OperationID, "Ws call success to getNewSeq", m.MsgIncr, m.SendID, m.ReqIdentifier)
|
||||||
|
pbData := pbChat.GetMaxAndMinSeqReq{}
|
||||||
|
nReply := new(pbChat.GetMaxAndMinSeqResp)
|
||||||
|
pbData.UserID = m.SendID
|
||||||
|
pbData.OperationID = m.OperationID
|
||||||
|
grpcConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfflineMessageName)
|
||||||
|
if grpcConn == nil {
|
||||||
|
log.ErrorByKv("get grpcConn err", pbData.OperationID, "args", m)
|
||||||
|
}
|
||||||
|
msgClient := pbChat.NewChatClient(grpcConn)
|
||||||
|
reply, err := msgClient.GetMaxAndMinSeq(context.Background(), &pbData)
|
||||||
|
if err != nil {
|
||||||
|
log.ErrorByKv("rpc call failed to getSeqReq", pbData.OperationID, "err", err, "pbData", pbData.String())
|
||||||
|
nReply.ErrCode = 200
|
||||||
|
nReply.ErrMsg = err.Error()
|
||||||
|
ws.getSeqResp(conn, m, nReply)
|
||||||
|
} else {
|
||||||
|
log.InfoByKv("rpc call success to getSeqReq", pbData.OperationID, "replyData", reply.String())
|
||||||
|
ws.getSeqResp(conn, m, reply)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
func (ws *WServer) getSeqResp(conn *UserConn, m *Req, pb *pbChat.GetMaxAndMinSeqResp) {
|
func (ws *WServer) getSeqResp(conn *UserConn, m *Req, pb *pbChat.GetMaxAndMinSeqResp) {
|
||||||
var mReplyData pbWs.GetMaxAndMinSeqResp
|
var mReplyData open_im_sdk.GetMaxAndMinSeqResp
|
||||||
mReplyData.MaxSeq = pb.GetMaxSeq()
|
mReplyData.MaxSeq = pb.GetMaxSeq()
|
||||||
mReplyData.MinSeq = pb.GetMinSeq()
|
mReplyData.MinSeq = pb.GetMinSeq()
|
||||||
b, _ := proto.Marshal(&mReplyData)
|
b, _ := proto.Marshal(&mReplyData)
|
||||||
@@ -82,29 +100,38 @@ func (ws *WServer) getSeqResp(conn *UserConn, m *Req, pb *pbChat.GetMaxAndMinSeq
|
|||||||
}
|
}
|
||||||
ws.sendMsg(conn, mReply)
|
ws.sendMsg(conn, mReply)
|
||||||
}
|
}
|
||||||
func (ws *WServer) getSeqReq(conn *UserConn, m *Req) {
|
func (ws *WServer) pullMsgReq(conn *UserConn, m *Req) {
|
||||||
log.NewInfo(m.OperationID, "Ws call success to getNewSeq", m.MsgIncr, m.SendID, m.ReqIdentifier)
|
log.NewInfo(m.OperationID, "Ws call success to pullMsgReq", m.ReqIdentifier, m.MsgIncr, m.SendID)
|
||||||
pbData := pbChat.GetMaxAndMinSeqReq{}
|
nReply := new(pbChat.PullMessageResp)
|
||||||
pbData.UserID = m.SendID
|
isPass, errCode, errMsg, data := ws.argsValidate(m, constant.WSPullMsg)
|
||||||
pbData.OperationID = m.OperationID
|
if isPass {
|
||||||
grpcConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfflineMessageName)
|
pbData := pbChat.PullMessageReq{}
|
||||||
if grpcConn == nil {
|
pbData.UserID = m.SendID
|
||||||
log.ErrorByKv("get grpcConn err", pbData.OperationID, "args", m)
|
pbData.OperationID = m.OperationID
|
||||||
|
pbData.SeqBegin = data.(SeqData).SeqBegin
|
||||||
|
pbData.SeqEnd = data.(SeqData).SeqEnd
|
||||||
|
grpcConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfflineMessageName)
|
||||||
|
msgClient := pbChat.NewChatClient(grpcConn)
|
||||||
|
reply, err := msgClient.PullMessage(context.Background(), &pbData)
|
||||||
|
if err != nil {
|
||||||
|
log.ErrorByKv("PullMessage error", pbData.OperationID, "err", err.Error())
|
||||||
|
nReply.ErrCode = 200
|
||||||
|
nReply.ErrMsg = err.Error()
|
||||||
|
ws.pullMsgResp(conn, m, nReply)
|
||||||
|
} else {
|
||||||
|
log.InfoByKv("rpc call success to pullMsgRep", pbData.OperationID, "ReplyArgs", reply.String(), "maxSeq", reply.GetMaxSeq(),
|
||||||
|
"MinSeq", reply.GetMinSeq(), "singLen", len(reply.GetSingleUserMsg()), "groupLen", len(reply.GetGroupUserMsg()))
|
||||||
|
ws.pullMsgResp(conn, m, reply)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
nReply.ErrCode = errCode
|
||||||
|
nReply.ErrMsg = errMsg
|
||||||
|
ws.pullMsgResp(conn, m, nReply)
|
||||||
}
|
}
|
||||||
msgClient := pbChat.NewChatClient(grpcConn)
|
|
||||||
reply, err := msgClient.GetMaxAndMinSeq(context.Background(), &pbData)
|
|
||||||
if err != nil {
|
|
||||||
log.ErrorByKv("rpc call failed to getSeqReq", pbData.OperationID, "err", err, "pbData", pbData.String())
|
|
||||||
return
|
|
||||||
}
|
|
||||||
log.InfoByKv("rpc call success to getSeqReq", pbData.OperationID, "replyData", reply.String())
|
|
||||||
ws.getSeqResp(conn, m, reply)
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ws *WServer) pullMsgResp(conn *UserConn, m *Req, pb *pbChat.PullMessageResp) {
|
func (ws *WServer) pullMsgResp(conn *UserConn, m *Req, pb *pbChat.PullMessageResp) {
|
||||||
log.NewInfo(m.OperationID, "pullMsgResp come here ", pb.String())
|
log.NewInfo(m.OperationID, "pullMsgResp come here ", pb.String())
|
||||||
var mReplyData pbWs.PullMessageBySeqListResp
|
var mReplyData open_im_sdk.PullMessageBySeqListResp
|
||||||
a, err := json.Marshal(pb.SingleUserMsg)
|
a, err := json.Marshal(pb.SingleUserMsg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.NewError(m.OperationID, "GetSingleUserMsg,json marshal,err", err.Error())
|
log.NewError(m.OperationID, "GetSingleUserMsg,json marshal,err", err.Error())
|
||||||
@@ -139,41 +166,14 @@ func (ws *WServer) pullMsgResp(conn *UserConn, m *Req, pb *pbChat.PullMessageRes
|
|||||||
ws.sendMsg(conn, mReply)
|
ws.sendMsg(conn, mReply)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ws *WServer) pullMsgReq(conn *UserConn, m *Req) {
|
|
||||||
log.NewInfo(m.OperationID, "Ws call success to pullMsgReq", m.ReqIdentifier, m.MsgIncr, m.SendID)
|
|
||||||
reply := new(pbChat.PullMessageResp)
|
|
||||||
isPass, errCode, errMsg, data := ws.argsValidate(m, constant.WSPullMsg)
|
|
||||||
if isPass {
|
|
||||||
pbData := pbChat.PullMessageReq{}
|
|
||||||
pbData.UserID = m.SendID
|
|
||||||
pbData.OperationID = m.OperationID
|
|
||||||
pbData.SeqBegin = data.(SeqData).SeqBegin
|
|
||||||
pbData.SeqEnd = data.(SeqData).SeqEnd
|
|
||||||
grpcConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfflineMessageName)
|
|
||||||
msgClient := pbChat.NewChatClient(grpcConn)
|
|
||||||
reply, err := msgClient.PullMessage(context.Background(), &pbData)
|
|
||||||
if err != nil {
|
|
||||||
log.ErrorByKv("PullMessage error", pbData.OperationID, "err", err.Error())
|
|
||||||
return
|
|
||||||
}
|
|
||||||
log.InfoByKv("rpc call success to pullMsgRep", pbData.OperationID, "ReplyArgs", reply.String(), "maxSeq", reply.GetMaxSeq(),
|
|
||||||
"MinSeq", reply.GetMinSeq(), "singLen", len(reply.GetSingleUserMsg()), "groupLen", len(reply.GetGroupUserMsg()))
|
|
||||||
ws.pullMsgResp(conn, m, reply)
|
|
||||||
} else {
|
|
||||||
reply.ErrCode = errCode
|
|
||||||
reply.ErrMsg = errMsg
|
|
||||||
ws.pullMsgResp(conn, m, reply)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
func (ws *WServer) pullMsgBySeqListReq(conn *UserConn, m *Req) {
|
func (ws *WServer) pullMsgBySeqListReq(conn *UserConn, m *Req) {
|
||||||
log.NewInfo(m.OperationID, "Ws call success to pullMsgBySeqListReq start", m.SendID, m.ReqIdentifier, m.MsgIncr)
|
log.NewInfo(m.OperationID, "Ws call success to pullMsgBySeqListReq start", m.SendID, m.ReqIdentifier, m.MsgIncr)
|
||||||
reply := new(pbChat.PullMessageResp)
|
nReply := new(pbChat.PullMessageResp)
|
||||||
isPass, errCode, errMsg, data := ws.argsValidate(m, constant.WSPullMsgBySeqList)
|
isPass, errCode, errMsg, data := ws.argsValidate(m, constant.WSPullMsgBySeqList)
|
||||||
log.NewInfo(m.OperationID, "Ws call success to pullMsgBySeqListReq middle", m.SendID, m.ReqIdentifier, m.MsgIncr, data.(pbWs.PullMessageBySeqListReq).SeqList)
|
log.NewInfo(m.OperationID, "Ws call success to pullMsgBySeqListReq middle", m.SendID, m.ReqIdentifier, m.MsgIncr, data.(open_im_sdk.PullMessageBySeqListReq).SeqList)
|
||||||
if isPass {
|
if isPass {
|
||||||
pbData := pbChat.PullMessageBySeqListReq{}
|
pbData := pbChat.PullMessageBySeqListReq{}
|
||||||
pbData.SeqList = data.(pbWs.PullMessageBySeqListReq).SeqList
|
pbData.SeqList = data.(open_im_sdk.PullMessageBySeqListReq).SeqList
|
||||||
pbData.UserID = m.SendID
|
pbData.UserID = m.SendID
|
||||||
pbData.OperationID = m.OperationID
|
pbData.OperationID = m.OperationID
|
||||||
grpcConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfflineMessageName)
|
grpcConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfflineMessageName)
|
||||||
@@ -181,45 +181,25 @@ func (ws *WServer) pullMsgBySeqListReq(conn *UserConn, m *Req) {
|
|||||||
reply, err := msgClient.PullMessageBySeqList(context.Background(), &pbData)
|
reply, err := msgClient.PullMessageBySeqList(context.Background(), &pbData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.NewError(pbData.OperationID, "pullMsgBySeqListReq err", err.Error())
|
log.NewError(pbData.OperationID, "pullMsgBySeqListReq err", err.Error())
|
||||||
reply.ErrCode = 200
|
nReply.ErrCode = 200
|
||||||
reply.ErrMsg = err.Error()
|
nReply.ErrMsg = err.Error()
|
||||||
|
ws.pullMsgResp(conn, m, nReply)
|
||||||
} else {
|
} else {
|
||||||
log.NewInfo(pbData.OperationID, "rpc call success to pullMsgBySeqListReq", reply.String(), reply.GetMaxSeq(), reply.GetMinSeq(), len(reply.GetSingleUserMsg()), len(reply.GetGroupUserMsg()))
|
log.NewInfo(pbData.OperationID, "rpc call success to pullMsgBySeqListReq", reply.String(), reply.GetMaxSeq(), reply.GetMinSeq(), len(reply.GetSingleUserMsg()), len(reply.GetGroupUserMsg()))
|
||||||
|
ws.pullMsgResp(conn, m, reply)
|
||||||
}
|
}
|
||||||
ws.pullMsgResp(conn, m, reply)
|
|
||||||
} else {
|
} else {
|
||||||
reply.ErrCode = errCode
|
nReply.ErrCode = errCode
|
||||||
reply.ErrMsg = errMsg
|
nReply.ErrMsg = errMsg
|
||||||
ws.pullMsgResp(conn, m, reply)
|
ws.pullMsgResp(conn, m, nReply)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ws *WServer) sendMsgResp(conn *UserConn, m *Req, pb *pbChat.UserSendMsgResp, sendTime int64) {
|
|
||||||
// := make(map[string]interface{})
|
|
||||||
|
|
||||||
var mReplyData pbWs.UserSendMsgResp
|
|
||||||
mReplyData.ClientMsgID = pb.GetClientMsgID()
|
|
||||||
mReplyData.ServerMsgID = pb.GetServerMsgID()
|
|
||||||
mReplyData.SendTime = sendTime
|
|
||||||
b, _ := proto.Marshal(&mReplyData)
|
|
||||||
mReply := Resp{
|
|
||||||
ReqIdentifier: m.ReqIdentifier,
|
|
||||||
MsgIncr: m.MsgIncr,
|
|
||||||
ErrCode: pb.GetErrCode(),
|
|
||||||
ErrMsg: pb.GetErrMsg(),
|
|
||||||
OperationID: m.OperationID,
|
|
||||||
Data: b,
|
|
||||||
}
|
|
||||||
ws.sendMsg(conn, mReply)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (ws *WServer) sendMsgReq(conn *UserConn, m *Req, sendTime int64) {
|
func (ws *WServer) sendMsgReq(conn *UserConn, m *Req, sendTime int64) {
|
||||||
log.NewInfo(m.OperationID, "Ws call success to sendMsgReq start", m.MsgIncr, m.ReqIdentifier, m.SendID, sendTime)
|
log.NewInfo(m.OperationID, "Ws call success to sendMsgReq start", m.MsgIncr, m.ReqIdentifier, m.SendID, sendTime)
|
||||||
reply := new(pbChat.UserSendMsgResp)
|
nReply := new(pbChat.UserSendMsgResp)
|
||||||
isPass, errCode, errMsg, pData := ws.argsValidate(m, constant.WSSendMsg)
|
isPass, errCode, errMsg, pData := ws.argsValidate(m, constant.WSSendMsg)
|
||||||
if isPass {
|
if isPass {
|
||||||
data := pData.(pbWs.UserSendMsgReq)
|
data := pData.(open_im_sdk.UserSendMsgReq)
|
||||||
pbData := pbChat.UserSendMsgReq{
|
pbData := pbChat.UserSendMsgReq{
|
||||||
ReqIdentifier: m.ReqIdentifier,
|
ReqIdentifier: m.ReqIdentifier,
|
||||||
Token: m.Token,
|
Token: m.Token,
|
||||||
@@ -244,27 +224,47 @@ func (ws *WServer) sendMsgReq(conn *UserConn, m *Req, sendTime int64) {
|
|||||||
reply, err := client.UserSendMsg(context.Background(), &pbData)
|
reply, err := client.UserSendMsg(context.Background(), &pbData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.NewError(pbData.OperationID, "UserSendMsg err", err.Error())
|
log.NewError(pbData.OperationID, "UserSendMsg err", err.Error())
|
||||||
reply.ErrCode = 200
|
nReply.ErrCode = 200
|
||||||
reply.ErrMsg = err.Error()
|
nReply.ErrMsg = err.Error()
|
||||||
|
ws.sendMsgResp(conn, m, nReply, sendTime)
|
||||||
} else {
|
} else {
|
||||||
log.NewInfo(pbData.OperationID, "rpc call success to sendMsgReq", reply.String())
|
log.NewInfo(pbData.OperationID, "rpc call success to sendMsgReq", reply.String())
|
||||||
|
ws.sendMsgResp(conn, m, reply, sendTime)
|
||||||
}
|
}
|
||||||
ws.sendMsgResp(conn, m, reply, sendTime)
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
reply.ErrCode = errCode
|
nReply.ErrCode = errCode
|
||||||
reply.ErrMsg = errMsg
|
nReply.ErrMsg = errMsg
|
||||||
ws.sendMsgResp(conn, m, reply, sendTime)
|
ws.sendMsgResp(conn, m, nReply, sendTime)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
func (ws *WServer) sendMsgResp(conn *UserConn, m *Req, pb *pbChat.UserSendMsgResp, sendTime int64) {
|
||||||
|
// := make(map[string]interface{})
|
||||||
|
|
||||||
|
var mReplyData open_im_sdk.UserSendMsgResp
|
||||||
|
mReplyData.ClientMsgID = pb.GetClientMsgID()
|
||||||
|
mReplyData.ServerMsgID = pb.GetServerMsgID()
|
||||||
|
mReplyData.SendTime = sendTime
|
||||||
|
b, _ := proto.Marshal(&mReplyData)
|
||||||
|
mReply := Resp{
|
||||||
|
ReqIdentifier: m.ReqIdentifier,
|
||||||
|
MsgIncr: m.MsgIncr,
|
||||||
|
ErrCode: pb.GetErrCode(),
|
||||||
|
ErrMsg: pb.GetErrMsg(),
|
||||||
|
OperationID: m.OperationID,
|
||||||
|
Data: b,
|
||||||
|
}
|
||||||
|
ws.sendMsg(conn, mReply)
|
||||||
|
}
|
||||||
|
|
||||||
func (ws *WServer) sendMsg(conn *UserConn, mReply interface{}) {
|
func (ws *WServer) sendMsg(conn *UserConn, mReply interface{}) {
|
||||||
var b bytes.Buffer
|
var b bytes.Buffer
|
||||||
enc := gob.NewEncoder(&b)
|
enc := gob.NewEncoder(&b)
|
||||||
err := enc.Encode(mReply)
|
err := enc.Encode(mReply)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println(err)
|
log.NewError(mReply.(Resp).OperationID, mReply.(Resp).ReqIdentifier, mReply.(Resp).ErrCode, mReply.(Resp).ErrMsg, "Encode Msg error", conn.RemoteAddr().String(), ws.getUserUid(conn), err.Error())
|
||||||
|
return
|
||||||
}
|
}
|
||||||
err = ws.writeMsg(conn, websocket.BinaryMessage, b.Bytes())
|
err = ws.writeMsg(conn, websocket.BinaryMessage, b.Bytes())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -1,22 +1,23 @@
|
|||||||
package gate
|
package gate
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/src/common/config"
|
"Open_IM/pkg/common/config"
|
||||||
"Open_IM/src/common/constant"
|
"Open_IM/pkg/common/constant"
|
||||||
"Open_IM/src/common/log"
|
"Open_IM/pkg/common/log"
|
||||||
"Open_IM/src/grpc-etcdv3/getcdv3"
|
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
||||||
pbRelay "Open_IM/src/proto/relay"
|
pbRelay "Open_IM/pkg/proto/relay"
|
||||||
pbWs "Open_IM/src/proto/sdk_ws"
|
open_im_sdk "Open_IM/pkg/proto/sdk_ws"
|
||||||
"Open_IM/src/utils"
|
"Open_IM/pkg/utils"
|
||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
"encoding/gob"
|
"encoding/gob"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/golang/protobuf/proto"
|
"github.com/golang/protobuf/proto"
|
||||||
"github.com/gorilla/websocket"
|
|
||||||
"google.golang.org/grpc"
|
|
||||||
"net"
|
"net"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/gorilla/websocket"
|
||||||
|
"google.golang.org/grpc"
|
||||||
)
|
)
|
||||||
|
|
||||||
type RPCServer struct {
|
type RPCServer struct {
|
||||||
@@ -58,7 +59,7 @@ func (r *RPCServer) MsgToUser(_ context.Context, in *pbRelay.MsgToUserReq) (*pbR
|
|||||||
log.InfoByKv("PushMsgToUser is arriving", in.OperationID, "args", in.String())
|
log.InfoByKv("PushMsgToUser is arriving", in.OperationID, "args", in.String())
|
||||||
var resp []*pbRelay.SingleMsgToUser
|
var resp []*pbRelay.SingleMsgToUser
|
||||||
var RecvID string
|
var RecvID string
|
||||||
msg := pbWs.MsgData{
|
msg := open_im_sdk.MsgData{
|
||||||
SendID: in.SendID,
|
SendID: in.SendID,
|
||||||
RecvID: in.RecvID,
|
RecvID: in.RecvID,
|
||||||
MsgFrom: in.MsgFrom,
|
MsgFrom: in.MsgFrom,
|
||||||
@@ -83,7 +84,7 @@ func (r *RPCServer) MsgToUser(_ context.Context, in *pbRelay.MsgToUserReq) (*pbR
|
|||||||
enc := gob.NewEncoder(&replyBytes)
|
enc := gob.NewEncoder(&replyBytes)
|
||||||
err := enc.Encode(mReply)
|
err := enc.Encode(mReply)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println(err)
|
log.NewError(in.OperationID, "data encode err", err.Error())
|
||||||
}
|
}
|
||||||
switch in.GetSessionType() {
|
switch in.GetSessionType() {
|
||||||
case constant.SingleChatType:
|
case constant.SingleChatType:
|
||||||
@@ -92,33 +93,75 @@ func (r *RPCServer) MsgToUser(_ context.Context, in *pbRelay.MsgToUserReq) (*pbR
|
|||||||
RecvID = strings.Split(in.GetRecvID(), " ")[0]
|
RecvID = strings.Split(in.GetRecvID(), " ")[0]
|
||||||
}
|
}
|
||||||
var tag bool
|
var tag bool
|
||||||
|
var UIDAndPID []string
|
||||||
userIDList := genUidPlatformArray(RecvID)
|
userIDList := genUidPlatformArray(RecvID)
|
||||||
for _, v := range userIDList {
|
for _, v := range userIDList {
|
||||||
|
UIDAndPID = strings.Split(v, " ")
|
||||||
if conn := ws.getUserConn(v); conn != nil {
|
if conn := ws.getUserConn(v); conn != nil {
|
||||||
UIDAndPID := strings.Split(v, " ")
|
|
||||||
tag = true
|
tag = true
|
||||||
resultCode := sendMsgToUser(conn, replyBytes.Bytes(), in, UIDAndPID[1], UIDAndPID[0])
|
resultCode := sendMsgToUser(conn, replyBytes.Bytes(), in, UIDAndPID[1], UIDAndPID[0])
|
||||||
temp := &pbRelay.SingleMsgToUser{
|
temp := &pbRelay.SingleMsgToUser{
|
||||||
ResultCode: resultCode,
|
ResultCode: resultCode,
|
||||||
RecvID: UIDAndPID[0],
|
RecvID: UIDAndPID[0],
|
||||||
RecvPlatFormID: utils.PlatformNameToID(UIDAndPID[1]),
|
RecvPlatFormID: constant.PlatformNameToID(UIDAndPID[1]),
|
||||||
|
}
|
||||||
|
resp = append(resp, temp)
|
||||||
|
} else {
|
||||||
|
temp := &pbRelay.SingleMsgToUser{
|
||||||
|
ResultCode: -1,
|
||||||
|
RecvID: UIDAndPID[0],
|
||||||
|
RecvPlatFormID: constant.PlatformNameToID(UIDAndPID[1]),
|
||||||
}
|
}
|
||||||
resp = append(resp, temp)
|
resp = append(resp, temp)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//Single chat sender synchronization message
|
||||||
|
if in.GetSessionType() == constant.SingleChatType {
|
||||||
|
userIDList = genUidPlatformArray(in.SendID)
|
||||||
|
for _, v := range userIDList {
|
||||||
|
UIDAndPID = strings.Split(v, " ")
|
||||||
|
if conn := ws.getUserConn(v); conn != nil {
|
||||||
|
_ = sendMsgToUser(conn, replyBytes.Bytes(), in, UIDAndPID[1], UIDAndPID[0])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if !tag {
|
if !tag {
|
||||||
log.NewError(in.OperationID, "push err ,ws conn not in map", in.String())
|
log.NewError(in.OperationID, "push err ,no matched ws conn not in map", in.String())
|
||||||
}
|
}
|
||||||
return &pbRelay.MsgToUserResp{
|
return &pbRelay.MsgToUserResp{
|
||||||
Resp: resp,
|
Resp: resp,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
func (r *RPCServer) GetUsersOnlineStatus(_ context.Context, req *pbRelay.GetUsersOnlineStatusReq) (*pbRelay.GetUsersOnlineStatusResp, error) {
|
||||||
|
log.NewDebug(req.OperationID, "rpc GetUsersOnlineStatus arrived server", req.String())
|
||||||
|
var UIDAndPID []string
|
||||||
|
var resp pbRelay.GetUsersOnlineStatusResp
|
||||||
|
for _, v1 := range req.UserIDList {
|
||||||
|
userIDList := genUidPlatformArray(v1)
|
||||||
|
temp := new(pbRelay.GetUsersOnlineStatusResp_SuccessResult)
|
||||||
|
temp.UserID = v1
|
||||||
|
for _, v2 := range userIDList {
|
||||||
|
UIDAndPID = strings.Split(v2, " ")
|
||||||
|
if conn := ws.getUserConn(v2); conn != nil {
|
||||||
|
ps := new(pbRelay.GetUsersOnlineStatusResp_SuccessDetail)
|
||||||
|
ps.Platform = UIDAndPID[1]
|
||||||
|
ps.Status = constant.OnlineStatus
|
||||||
|
temp.Status = constant.OnlineStatus
|
||||||
|
temp.DetailPlatformStatus = append(temp.DetailPlatformStatus, ps)
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if temp.Status == constant.OnlineStatus {
|
||||||
|
resp.SuccessResult = append(resp.SuccessResult, temp)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return &resp, nil
|
||||||
|
}
|
||||||
func sendMsgToUser(conn *UserConn, bMsg []byte, in *pbRelay.MsgToUserReq, RecvPlatForm, RecvID string) (ResultCode int64) {
|
func sendMsgToUser(conn *UserConn, bMsg []byte, in *pbRelay.MsgToUserReq, RecvPlatForm, RecvID string) (ResultCode int64) {
|
||||||
err := ws.writeMsg(conn, websocket.BinaryMessage, bMsg)
|
err := ws.writeMsg(conn, websocket.BinaryMessage, bMsg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.ErrorByKv("PushMsgToUser is failed By Ws", "", "Addr", conn.RemoteAddr().String(),
|
log.ErrorByKv("PushMsgToUser is failed By Ws", "", "Addr", conn.RemoteAddr().String(),
|
||||||
"error", err, "senderPlatform", utils.PlatformIDToName(in.PlatformID), "recvPlatform", RecvPlatForm, "args", in.String(), "recvID", RecvID)
|
"error", err, "senderPlatform", constant.PlatformIDToName(in.PlatformID), "recvPlatform", RecvPlatForm, "args", in.String(), "recvID", RecvID)
|
||||||
ResultCode = -2
|
ResultCode = -2
|
||||||
return ResultCode
|
return ResultCode
|
||||||
} else {
|
} else {
|
||||||
@@ -129,8 +172,8 @@ func sendMsgToUser(conn *UserConn, bMsg []byte, in *pbRelay.MsgToUserReq, RecvPl
|
|||||||
|
|
||||||
}
|
}
|
||||||
func genUidPlatformArray(uid string) (array []string) {
|
func genUidPlatformArray(uid string) (array []string) {
|
||||||
for i := 1; i <= utils.LinuxPlatformID; i++ {
|
for i := 1; i <= constant.LinuxPlatformID; i++ {
|
||||||
array = append(array, uid+" "+utils.PlatformIDToName(int32(i)))
|
array = append(array, uid+" "+constant.PlatformIDToName(int32(i)))
|
||||||
}
|
}
|
||||||
return array
|
return array
|
||||||
}
|
}
|
||||||
@@ -7,9 +7,9 @@
|
|||||||
package gate
|
package gate
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/src/common/constant"
|
"Open_IM/pkg/common/constant"
|
||||||
"Open_IM/src/common/log"
|
"Open_IM/pkg/common/log"
|
||||||
pbWs "Open_IM/src/proto/sdk_ws"
|
open_im_sdk "Open_IM/pkg/proto/sdk_ws"
|
||||||
"github.com/golang/protobuf/proto"
|
"github.com/golang/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -59,7 +59,7 @@ type SeqListData struct {
|
|||||||
func (ws *WServer) argsValidate(m *Req, r int32) (isPass bool, errCode int32, errMsg string, returnData interface{}) {
|
func (ws *WServer) argsValidate(m *Req, r int32) (isPass bool, errCode int32, errMsg string, returnData interface{}) {
|
||||||
switch r {
|
switch r {
|
||||||
case constant.WSSendMsg:
|
case constant.WSSendMsg:
|
||||||
data := pbWs.UserSendMsgReq{}
|
data := open_im_sdk.UserSendMsgReq{}
|
||||||
if err := proto.Unmarshal(m.Data, &data); err != nil {
|
if err := proto.Unmarshal(m.Data, &data); err != nil {
|
||||||
log.ErrorByKv("Decode Data struct err", "", "err", err.Error(), "reqIdentifier", r)
|
log.ErrorByKv("Decode Data struct err", "", "err", err.Error(), "reqIdentifier", r)
|
||||||
return false, 203, err.Error(), nil
|
return false, 203, err.Error(), nil
|
||||||
@@ -71,7 +71,7 @@ func (ws *WServer) argsValidate(m *Req, r int32) (isPass bool, errCode int32, er
|
|||||||
}
|
}
|
||||||
return true, 0, "", data
|
return true, 0, "", data
|
||||||
case constant.WSPullMsgBySeqList:
|
case constant.WSPullMsgBySeqList:
|
||||||
data := pbWs.PullMessageBySeqListReq{}
|
data := open_im_sdk.PullMessageBySeqListReq{}
|
||||||
if err := proto.Unmarshal(m.Data, &data); err != nil {
|
if err := proto.Unmarshal(m.Data, &data); err != nil {
|
||||||
log.ErrorByKv("Decode Data struct err", "", "err", err.Error(), "reqIdentifier", r)
|
log.ErrorByKv("Decode Data struct err", "", "err", err.Error(), "reqIdentifier", r)
|
||||||
return false, 203, err.Error(), nil
|
return false, 203, err.Error(), nil
|
||||||
@@ -1,9 +1,14 @@
|
|||||||
package gate
|
package gate
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/src/common/config"
|
"Open_IM/pkg/common/config"
|
||||||
"Open_IM/src/common/log"
|
"Open_IM/pkg/common/constant"
|
||||||
"Open_IM/src/utils"
|
"Open_IM/pkg/common/db"
|
||||||
|
"Open_IM/pkg/common/log"
|
||||||
|
"Open_IM/pkg/common/token_verify"
|
||||||
|
"Open_IM/pkg/utils"
|
||||||
|
"bytes"
|
||||||
|
"encoding/gob"
|
||||||
"github.com/gorilla/websocket"
|
"github.com/gorilla/websocket"
|
||||||
"net/http"
|
"net/http"
|
||||||
"sync"
|
"sync"
|
||||||
@@ -53,10 +58,10 @@ func (ws *WServer) wsHandler(w http.ResponseWriter, r *http.Request) {
|
|||||||
} else {
|
} else {
|
||||||
//Connection mapping relationship,
|
//Connection mapping relationship,
|
||||||
//userID+" "+platformID->conn
|
//userID+" "+platformID->conn
|
||||||
SendID := query["sendID"][0] + " " + utils.PlatformIDToName(int32(utils.StringToInt64(query["platformID"][0])))
|
|
||||||
//Initialize a lock for each user
|
//Initialize a lock for each user
|
||||||
newConn := &UserConn{conn, new(sync.Mutex)}
|
newConn := &UserConn{conn, new(sync.Mutex)}
|
||||||
ws.addUserConn(SendID, newConn)
|
ws.addUserConn(query["sendID"][0], int32(utils.StringToInt64(query["platformID"][0])), newConn, query["token"][0])
|
||||||
go ws.readMsg(newConn)
|
go ws.readMsg(newConn)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -86,20 +91,70 @@ func (ws *WServer) writeMsg(conn *UserConn, a int, msg []byte) error {
|
|||||||
return conn.WriteMessage(a, msg)
|
return conn.WriteMessage(a, msg)
|
||||||
|
|
||||||
}
|
}
|
||||||
func (ws *WServer) addUserConn(uid string, conn *UserConn) {
|
func (ws *WServer) MultiTerminalLoginChecker(uid string, platformID int32, newConn *UserConn, token string) {
|
||||||
|
switch config.Config.MultiLoginPolicy {
|
||||||
|
case constant.AllLoginButSameTermKick:
|
||||||
|
if oldConn, ok := ws.wsUserToConn[genMapKey(uid, platformID)]; ok {
|
||||||
|
log.NewDebug("", uid, platformID, "kick old conn")
|
||||||
|
ws.sendKickMsg(oldConn, newConn)
|
||||||
|
m, err := db.DB.GetTokenMapByUidPid(uid, constant.PlatformIDToName(platformID))
|
||||||
|
if err != nil {
|
||||||
|
log.NewError("", "get token from redis err", err.Error())
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if m == nil {
|
||||||
|
log.NewError("", "get token from redis err", "m is nil")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
for k, _ := range m {
|
||||||
|
if k != token {
|
||||||
|
m[k] = constant.KickedToken
|
||||||
|
}
|
||||||
|
}
|
||||||
|
log.NewDebug("get map is ", m)
|
||||||
|
err = db.DB.SetTokenMapByUidPid(uid, platformID, m)
|
||||||
|
if err != nil {
|
||||||
|
log.NewError("", "SetTokenMapByUidPid err", err.Error())
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = oldConn.Close()
|
||||||
|
delete(ws.wsConnToUser, oldConn)
|
||||||
|
if err != nil {
|
||||||
|
log.NewError("", "conn close err", err.Error())
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
log.NewDebug("no other conn", ws.wsUserToConn)
|
||||||
|
}
|
||||||
|
|
||||||
|
case constant.SingleTerminalLogin:
|
||||||
|
case constant.WebAndOther:
|
||||||
|
}
|
||||||
|
}
|
||||||
|
func (ws *WServer) sendKickMsg(oldConn, newConn *UserConn) {
|
||||||
|
mReply := Resp{
|
||||||
|
ReqIdentifier: constant.WSKickOnlineMsg,
|
||||||
|
ErrCode: constant.ErrTokenInvalid.ErrCode,
|
||||||
|
ErrMsg: constant.ErrTokenInvalid.ErrMsg,
|
||||||
|
}
|
||||||
|
var b bytes.Buffer
|
||||||
|
enc := gob.NewEncoder(&b)
|
||||||
|
err := enc.Encode(mReply)
|
||||||
|
if err != nil {
|
||||||
|
log.NewError(mReply.OperationID, mReply.ReqIdentifier, mReply.ErrCode, mReply.ErrMsg, "Encode Msg error", oldConn.RemoteAddr().String(), newConn.RemoteAddr().String(), err.Error())
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = ws.writeMsg(oldConn, websocket.BinaryMessage, b.Bytes())
|
||||||
|
if err != nil {
|
||||||
|
log.NewError(mReply.OperationID, mReply.ReqIdentifier, mReply.ErrCode, mReply.ErrMsg, "WS WriteMsg error", oldConn.RemoteAddr().String(), newConn.RemoteAddr().String(), err.Error())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
func (ws *WServer) addUserConn(uid string, platformID int32, conn *UserConn, token string) {
|
||||||
|
key := genMapKey(uid, platformID)
|
||||||
rwLock.Lock()
|
rwLock.Lock()
|
||||||
defer rwLock.Unlock()
|
defer rwLock.Unlock()
|
||||||
if oldConn, ok := ws.wsUserToConn[uid]; ok {
|
ws.MultiTerminalLoginChecker(uid, platformID, conn, token)
|
||||||
err := oldConn.Close()
|
ws.wsConnToUser[conn] = key
|
||||||
delete(ws.wsConnToUser, oldConn)
|
ws.wsUserToConn[key] = conn
|
||||||
if err != nil {
|
|
||||||
log.ErrorByKv("close err", "", "uid", uid, "conn", conn)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
log.InfoByKv("this user is first login", "", "uid", uid)
|
|
||||||
}
|
|
||||||
ws.wsConnToUser[conn] = uid
|
|
||||||
ws.wsUserToConn[uid] = conn
|
|
||||||
log.WarnByKv("WS Add operation", "", "wsUser added", ws.wsUserToConn, "uid", uid, "online_num", len(ws.wsUserToConn))
|
log.WarnByKv("WS Add operation", "", "wsUser added", ws.wsUserToConn, "uid", uid, "online_num", len(ws.wsUserToConn))
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -146,10 +201,11 @@ func (ws *WServer) headerCheck(w http.ResponseWriter, r *http.Request) bool {
|
|||||||
status := http.StatusUnauthorized
|
status := http.StatusUnauthorized
|
||||||
query := r.URL.Query()
|
query := r.URL.Query()
|
||||||
if len(query["token"]) != 0 && len(query["sendID"]) != 0 && len(query["platformID"]) != 0 {
|
if len(query["token"]) != 0 && len(query["sendID"]) != 0 && len(query["platformID"]) != 0 {
|
||||||
if !utils.VerifyToken(query["token"][0], query["sendID"][0]) {
|
if ok, err := token_verify.VerifyToken(query["token"][0], query["sendID"][0]); !ok {
|
||||||
|
e := err.(*constant.ErrInfo)
|
||||||
log.ErrorByKv("Token verify failed", "", "query", query)
|
log.ErrorByKv("Token verify failed", "", "query", query)
|
||||||
w.Header().Set("Sec-Websocket-Version", "13")
|
w.Header().Set("Sec-Websocket-Version", "13")
|
||||||
http.Error(w, http.StatusText(status), status)
|
http.Error(w, e.ErrMsg, int(e.ErrCode))
|
||||||
return false
|
return false
|
||||||
} else {
|
} else {
|
||||||
log.InfoByKv("Connection Authentication Success", "", "token", query["token"][0], "userID", query["sendID"][0])
|
log.InfoByKv("Connection Authentication Success", "", "token", query["token"][0], "userID", query["sendID"][0])
|
||||||
@@ -163,3 +219,6 @@ func (ws *WServer) headerCheck(w http.ResponseWriter, r *http.Request) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
func genMapKey(uid string, platformID int32) string {
|
||||||
|
return uid + " " + constant.PlatformIDToName(platformID)
|
||||||
|
}
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
package logic
|
package logic
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/src/common/db"
|
"Open_IM/pkg/common/db"
|
||||||
"Open_IM/src/common/db/mysql_model/im_mysql_model"
|
"Open_IM/pkg/common/db/mysql_model/im_mysql_model"
|
||||||
"Open_IM/src/common/log"
|
"Open_IM/pkg/common/log"
|
||||||
pbMsg "Open_IM/src/proto/chat"
|
pbMsg "Open_IM/pkg/proto/chat"
|
||||||
"Open_IM/src/utils"
|
"Open_IM/pkg/utils"
|
||||||
)
|
)
|
||||||
|
|
||||||
func saveUserChat(uid string, pbMsg *pbMsg.MsgSvrToPushSvrChatMsg) error {
|
func saveUserChat(uid string, pbMsg *pbMsg.MsgSvrToPushSvrChatMsg) error {
|
||||||
+33
-27
@@ -1,14 +1,14 @@
|
|||||||
package logic
|
package logic
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/src/common/config"
|
"Open_IM/pkg/common/config"
|
||||||
"Open_IM/src/common/constant"
|
"Open_IM/pkg/common/constant"
|
||||||
kfk "Open_IM/src/common/kafka"
|
kfk "Open_IM/pkg/common/kafka"
|
||||||
"Open_IM/src/common/log"
|
"Open_IM/pkg/common/log"
|
||||||
"Open_IM/src/grpc-etcdv3/getcdv3"
|
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
||||||
pbMsg "Open_IM/src/proto/chat"
|
pbMsg "Open_IM/pkg/proto/chat"
|
||||||
pbPush "Open_IM/src/proto/push"
|
pbPush "Open_IM/pkg/proto/push"
|
||||||
"Open_IM/src/utils"
|
"Open_IM/pkg/utils"
|
||||||
"context"
|
"context"
|
||||||
"github.com/Shopify/sarama"
|
"github.com/Shopify/sarama"
|
||||||
"github.com/golang/protobuf/proto"
|
"github.com/golang/protobuf/proto"
|
||||||
@@ -33,7 +33,7 @@ func (mc *HistoryConsumerHandler) Init() {
|
|||||||
|
|
||||||
func (mc *HistoryConsumerHandler) handleChatWs2Mongo(msg []byte, msgKey string) {
|
func (mc *HistoryConsumerHandler) handleChatWs2Mongo(msg []byte, msgKey string) {
|
||||||
log.InfoByKv("chat come mongo!!!", "", "chat", string(msg))
|
log.InfoByKv("chat come mongo!!!", "", "chat", string(msg))
|
||||||
time := utils.GetCurrentTimestampBySecond()
|
time := utils.GetCurrentTimestampByNano()
|
||||||
pbData := pbMsg.WSToMsgSvrChatMsg{}
|
pbData := pbMsg.WSToMsgSvrChatMsg{}
|
||||||
err := proto.Unmarshal(msg, &pbData)
|
err := proto.Unmarshal(msg, &pbData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -54,52 +54,58 @@ func (mc *HistoryConsumerHandler) handleChatWs2Mongo(msg []byte, msgKey string)
|
|||||||
pbSaveData.OperationID = pbData.OperationID
|
pbSaveData.OperationID = pbData.OperationID
|
||||||
pbSaveData.RecvID = pbData.RecvID
|
pbSaveData.RecvID = pbData.RecvID
|
||||||
pbSaveData.PlatformID = pbData.PlatformID
|
pbSaveData.PlatformID = pbData.PlatformID
|
||||||
Options := utils.JsonStringToMap(pbData.Options)
|
options := utils.JsonStringToMap(pbData.Options)
|
||||||
//Control whether to store offline messages (mongo)
|
//Control whether to store offline messages (mongo)
|
||||||
isHistory := utils.GetSwitchFromOptions(Options, "history")
|
isHistory := utils.GetSwitchFromOptions(options, "history")
|
||||||
//Control whether to store history messages (mysql)
|
//Control whether to store history messages (mysql)
|
||||||
isPersist := utils.GetSwitchFromOptions(Options, "persistent")
|
isPersist := utils.GetSwitchFromOptions(options, "persistent")
|
||||||
if pbData.SessionType == constant.SingleChatType {
|
switch pbData.SessionType {
|
||||||
log.Info("", "", "msg_transfer chat type = SingleChatType", isHistory, isPersist)
|
case constant.SingleChatType:
|
||||||
|
log.NewDebug(pbSaveData.OperationID, "msg_transfer chat type = SingleChatType", isHistory, isPersist)
|
||||||
if isHistory {
|
if isHistory {
|
||||||
if msgKey == pbSaveData.RecvID {
|
if msgKey == pbSaveData.RecvID {
|
||||||
err := saveUserChat(pbData.RecvID, &pbSaveData)
|
err := saveUserChat(pbData.RecvID, &pbSaveData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.ErrorByKv("data insert to mongo err", pbSaveData.OperationID, "data", pbSaveData.String(), "err", err.Error())
|
log.NewError(pbSaveData.OperationID, "single data insert to mongo err", err.Error(), pbSaveData.String())
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if msgKey == pbSaveData.SendID {
|
} else if msgKey == pbSaveData.SendID {
|
||||||
err := saveUserChat(pbData.SendID, &pbSaveData)
|
err := saveUserChat(pbData.SendID, &pbSaveData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.ErrorByKv("data insert to mongo err", pbSaveData.OperationID, "data", pbSaveData.String(), "err", err.Error())
|
log.NewError(pbSaveData.OperationID, "single data insert to mongo err", err.Error(), pbSaveData.String())
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
log.NewInfo(pbSaveData.OperationID, "saveUserChat cost time ", utils.GetCurrentTimestampBySecond()-time)
|
log.NewDebug(pbSaveData.OperationID, "saveUserChat cost time ", utils.GetCurrentTimestampByNano()-time)
|
||||||
}
|
}
|
||||||
if msgKey == pbSaveData.RecvID {
|
if msgKey == pbSaveData.RecvID {
|
||||||
pbSaveData.Options = pbData.Options
|
pbSaveData.Options = pbData.Options
|
||||||
pbSaveData.OfflineInfo = pbData.OfflineInfo
|
pbSaveData.OfflineInfo = pbData.OfflineInfo
|
||||||
go sendMessageToPush(&pbSaveData)
|
go sendMessageToPush(&pbSaveData)
|
||||||
log.NewInfo(pbSaveData.OperationID, "sendMessageToPush cost time ", utils.GetCurrentTimestampBySecond()-time)
|
log.NewDebug(pbSaveData.OperationID, "sendMessageToPush cost time ", utils.GetCurrentTimestampByNano()-time)
|
||||||
}
|
}
|
||||||
|
|
||||||
log.InfoByKv("msg_transfer handle topic success...", "", "")
|
case constant.GroupChatType:
|
||||||
} else if pbData.SessionType == constant.GroupChatType {
|
log.NewDebug(pbSaveData.OperationID, "msg_transfer chat type = GroupChatType", isHistory, isPersist)
|
||||||
log.Info("", "", "msg_transfer chat type = GroupChatType")
|
|
||||||
if isHistory {
|
if isHistory {
|
||||||
uidAndGroupID := strings.Split(pbData.RecvID, " ")
|
uidAndGroupID := strings.Split(pbData.RecvID, " ")
|
||||||
saveUserChat(uidAndGroupID[0], &pbSaveData)
|
err := saveUserChat(uidAndGroupID[0], &pbSaveData)
|
||||||
|
if err != nil {
|
||||||
|
log.NewError(pbSaveData.OperationID, "group data insert to mongo err", pbSaveData.String(), uidAndGroupID[0], err.Error())
|
||||||
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
pbSaveData.Options = pbData.Options
|
pbSaveData.Options = pbData.Options
|
||||||
pbSaveData.OfflineInfo = pbData.OfflineInfo
|
pbSaveData.OfflineInfo = pbData.OfflineInfo
|
||||||
sendMessageToPush(&pbSaveData)
|
go sendMessageToPush(&pbSaveData)
|
||||||
log.InfoByKv("msg_transfer handle topic success...", "", "")
|
default:
|
||||||
} else {
|
log.NewError(pbSaveData.OperationID, "SessionType error", pbSaveData.String())
|
||||||
log.Error("", "", "msg_transfer recv chat err, chat.MsgFrom = %d", pbData.SessionType)
|
return
|
||||||
}
|
}
|
||||||
|
log.NewDebug(pbSaveData.OperationID, "msg_transfer handle topic data to database success...", pbSaveData.String())
|
||||||
}
|
}
|
||||||
|
|
||||||
func (HistoryConsumerHandler) Setup(_ sarama.ConsumerGroupSession) error { return nil }
|
func (HistoryConsumerHandler) Setup(_ sarama.ConsumerGroupSession) error { return nil }
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
package logic
|
package logic
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/src/common/config"
|
"Open_IM/pkg/common/config"
|
||||||
"Open_IM/src/common/kafka"
|
"Open_IM/pkg/common/kafka"
|
||||||
"Open_IM/src/common/log"
|
"Open_IM/pkg/common/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@@ -20,6 +20,6 @@ func Init() {
|
|||||||
}
|
}
|
||||||
func Run() {
|
func Run() {
|
||||||
//register mysqlConsumerHandler to
|
//register mysqlConsumerHandler to
|
||||||
//go persistentCH.persistentConsumerGroup.RegisterHandleAndConsumer(&persistentCH)
|
go persistentCH.persistentConsumerGroup.RegisterHandleAndConsumer(&persistentCH)
|
||||||
go historyCH.historyConsumerGroup.RegisterHandleAndConsumer(&historyCH)
|
go historyCH.historyConsumerGroup.RegisterHandleAndConsumer(&historyCH)
|
||||||
}
|
}
|
||||||
+9
-9
@@ -7,13 +7,13 @@
|
|||||||
package logic
|
package logic
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/src/common/config"
|
"Open_IM/pkg/common/config"
|
||||||
"Open_IM/src/common/constant"
|
"Open_IM/pkg/common/constant"
|
||||||
"Open_IM/src/common/db/mysql_model/im_mysql_msg_model"
|
"Open_IM/pkg/common/db/mysql_model/im_mysql_msg_model"
|
||||||
kfk "Open_IM/src/common/kafka"
|
kfk "Open_IM/pkg/common/kafka"
|
||||||
"Open_IM/src/common/log"
|
"Open_IM/pkg/common/log"
|
||||||
pbMsg "Open_IM/src/proto/chat"
|
pbMsg "Open_IM/pkg/proto/chat"
|
||||||
"Open_IM/src/utils"
|
"Open_IM/pkg/utils"
|
||||||
"github.com/Shopify/sarama"
|
"github.com/Shopify/sarama"
|
||||||
"github.com/golang/protobuf/proto"
|
"github.com/golang/protobuf/proto"
|
||||||
"strings"
|
"strings"
|
||||||
@@ -40,9 +40,9 @@ func (pc *PersistentConsumerHandler) handleChatWs2Mysql(msg []byte, msgKey strin
|
|||||||
log.ErrorByKv("msg_transfer Unmarshal chat err", "", "chat", string(msg), "err", err.Error())
|
log.ErrorByKv("msg_transfer Unmarshal chat err", "", "chat", string(msg), "err", err.Error())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
Options := utils.JsonStringToMap(pbData.Options)
|
options := utils.JsonStringToMap(pbData.Options)
|
||||||
//Control whether to store history messages (mysql)
|
//Control whether to store history messages (mysql)
|
||||||
isPersist := utils.GetSwitchFromOptions(Options, "persistent")
|
isPersist := utils.GetSwitchFromOptions(options, "persistent")
|
||||||
//Only process receiver data
|
//Only process receiver data
|
||||||
if isPersist {
|
if isPersist {
|
||||||
if msgKey == pbData.RecvID && pbData.SessionType == constant.SingleChatType {
|
if msgKey == pbData.RecvID && pbData.SessionType == constant.SingleChatType {
|
||||||
@@ -1,32 +1,36 @@
|
|||||||
package push
|
package push
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/src/common/config"
|
"Open_IM/internal/push/jpush/common"
|
||||||
"Open_IM/src/push/jpush/common"
|
"Open_IM/internal/push/jpush/requestBody"
|
||||||
"Open_IM/src/push/jpush/requestBody"
|
"Open_IM/pkg/common/config"
|
||||||
"bytes"
|
"bytes"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"io/ioutil"
|
||||||
"net/http"
|
"net/http"
|
||||||
)
|
)
|
||||||
|
|
||||||
type JPushResp struct {
|
type JPushResp struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func JGAccountListPush(accounts []string, jsonCustomContent string, platform string) (*http.Response, error) {
|
func JGAccountListPush(accounts []string, content, detailContent, platform string) ([]byte, error) {
|
||||||
|
|
||||||
var pf requestBody.Platform
|
var pf requestBody.Platform
|
||||||
_ = pf.SetPlatform(platform)
|
_ = pf.SetPlatform(platform)
|
||||||
var au requestBody.Audience
|
var au requestBody.Audience
|
||||||
au.SetAlias(accounts)
|
au.SetAlias(accounts)
|
||||||
var no requestBody.Notification
|
var no requestBody.Notification
|
||||||
no.SetAlert(jsonCustomContent)
|
no.SetAlert(content, platform)
|
||||||
var me requestBody.Message
|
var me requestBody.Message
|
||||||
me.SetMsgContent(jsonCustomContent)
|
me.SetMsgContent(detailContent)
|
||||||
|
var o requestBody.Options
|
||||||
|
o.SetApnsProduction(false)
|
||||||
var po requestBody.PushObj
|
var po requestBody.PushObj
|
||||||
po.SetPlatform(&pf)
|
po.SetPlatform(&pf)
|
||||||
po.SetAudience(&au)
|
po.SetAudience(&au)
|
||||||
po.SetNotification(&no)
|
po.SetNotification(&no)
|
||||||
po.SetMessage(&me)
|
po.SetMessage(&me)
|
||||||
|
po.SetOptions(&o)
|
||||||
|
|
||||||
con, err := json.Marshal(po)
|
con, err := json.Marshal(po)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -42,9 +46,13 @@ func JGAccountListPush(accounts []string, jsonCustomContent string, platform str
|
|||||||
req.Header.Set("Authorization", common.GetAuthorization(config.Config.Push.Jpns.AppKey, config.Config.Push.Jpns.MasterSecret))
|
req.Header.Set("Authorization", common.GetAuthorization(config.Config.Push.Jpns.AppKey, config.Config.Push.Jpns.MasterSecret))
|
||||||
|
|
||||||
resp, err := client.Do(req)
|
resp, err := client.Do(req)
|
||||||
defer resp.Body.Close()
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return resp, nil
|
defer resp.Body.Close()
|
||||||
|
result, err := ioutil.ReadAll(resp.Body)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return result, nil
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
package requestBody
|
||||||
|
|
||||||
|
import (
|
||||||
|
"Open_IM/pkg/common/config"
|
||||||
|
"Open_IM/pkg/common/constant"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Notification struct {
|
||||||
|
Alert string `json:"alert,omitempty"`
|
||||||
|
Android Android `json:"android,omitempty"`
|
||||||
|
IOS Ios `json:"ios,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type Android struct {
|
||||||
|
Alert string `json:"alert,omitempty"`
|
||||||
|
Intent struct {
|
||||||
|
URL string `json:"url,omitempty"`
|
||||||
|
} `json:"intent,omitempty"`
|
||||||
|
}
|
||||||
|
type Ios struct {
|
||||||
|
Alert string `json:"alert,omitempty"`
|
||||||
|
Sound string `json:"sound,omitempty"`
|
||||||
|
Badge string `json:"badge,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (n *Notification) SetAlert(alert, platform string) {
|
||||||
|
n.Alert = alert
|
||||||
|
switch platform {
|
||||||
|
case constant.AndroidPlatformStr:
|
||||||
|
n.Android.Alert = alert
|
||||||
|
n.SetAndroidIntent()
|
||||||
|
case constant.IOSPlatformStr:
|
||||||
|
n.IOS.Alert = alert
|
||||||
|
n.IOS.Sound = "default"
|
||||||
|
n.IOS.Badge = "+1"
|
||||||
|
default:
|
||||||
|
}
|
||||||
|
}
|
||||||
|
func (n *Notification) SetAndroidIntent() {
|
||||||
|
n.Android.Intent.URL = config.Config.Push.Jpns.PushIntent
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package requestBody
|
||||||
|
|
||||||
|
type Options struct {
|
||||||
|
ApnsProduction bool `json:"apns_production"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *Options) SetApnsProduction(c bool) {
|
||||||
|
o.ApnsProduction = c
|
||||||
|
}
|
||||||
+3
-3
@@ -1,7 +1,7 @@
|
|||||||
package requestBody
|
package requestBody
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/src/utils"
|
"Open_IM/pkg/common/constant"
|
||||||
"errors"
|
"errors"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -53,9 +53,9 @@ func (p *Platform) Set(os string) error {
|
|||||||
}
|
}
|
||||||
func (p *Platform) SetPlatform(platform string) error {
|
func (p *Platform) SetPlatform(platform string) error {
|
||||||
switch platform {
|
switch platform {
|
||||||
case utils.AndroidPlatformStr:
|
case constant.AndroidPlatformStr:
|
||||||
return p.SetAndroid()
|
return p.SetAndroid()
|
||||||
case utils.IOSPlatformStr:
|
case constant.IOSPlatformStr:
|
||||||
return p.SetIOS()
|
return p.SetIOS()
|
||||||
default:
|
default:
|
||||||
return errors.New("platform err")
|
return errors.New("platform err")
|
||||||
@@ -5,6 +5,7 @@ type PushObj struct {
|
|||||||
Audience interface{} `json:"audience"`
|
Audience interface{} `json:"audience"`
|
||||||
Notification interface{} `json:"notification,omitempty"`
|
Notification interface{} `json:"notification,omitempty"`
|
||||||
Message interface{} `json:"message,omitempty"`
|
Message interface{} `json:"message,omitempty"`
|
||||||
|
Options interface{} `json:"options,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *PushObj) SetPlatform(pf *Platform) {
|
func (p *PushObj) SetPlatform(pf *Platform) {
|
||||||
@@ -22,3 +23,6 @@ func (p *PushObj) SetNotification(no *Notification) {
|
|||||||
func (p *PushObj) SetMessage(m *Message) {
|
func (p *PushObj) SetMessage(m *Message) {
|
||||||
p.Message = m
|
p.Message = m
|
||||||
}
|
}
|
||||||
|
func (p *PushObj) SetOptions(o *Options) {
|
||||||
|
p.Options = o
|
||||||
|
}
|
||||||
@@ -7,10 +7,10 @@
|
|||||||
package logic
|
package logic
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/src/common/config"
|
"Open_IM/pkg/common/config"
|
||||||
"Open_IM/src/common/kafka"
|
"Open_IM/pkg/common/constant"
|
||||||
"Open_IM/src/common/log"
|
"Open_IM/pkg/common/kafka"
|
||||||
"Open_IM/src/utils"
|
"Open_IM/pkg/common/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@@ -24,7 +24,7 @@ func Init(rpcPort int) {
|
|||||||
log.NewPrivateLog(config.Config.ModuleName.PushName)
|
log.NewPrivateLog(config.Config.ModuleName.PushName)
|
||||||
rpcServer.Init(rpcPort)
|
rpcServer.Init(rpcPort)
|
||||||
pushCh.Init()
|
pushCh.Init()
|
||||||
pushTerminal = []int32{utils.IOSPlatformID, utils.AndroidPlatformID}
|
pushTerminal = []int32{constant.IOSPlatformID, constant.AndroidPlatformID}
|
||||||
}
|
}
|
||||||
func init() {
|
func init() {
|
||||||
producer = kafka.NewKafkaProducer(config.Config.Kafka.Ws2mschat.Addr, config.Config.Kafka.Ws2mschat.Topic)
|
producer = kafka.NewKafkaProducer(config.Config.Kafka.Ws2mschat.Addr, config.Config.Kafka.Ws2mschat.Topic)
|
||||||
@@ -7,11 +7,12 @@
|
|||||||
package logic
|
package logic
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/src/common/config"
|
"Open_IM/pkg/common/config"
|
||||||
kfk "Open_IM/src/common/kafka"
|
kfk "Open_IM/pkg/common/kafka"
|
||||||
"Open_IM/src/common/log"
|
"Open_IM/pkg/common/log"
|
||||||
pbChat "Open_IM/src/proto/chat"
|
pbChat "Open_IM/pkg/proto/chat"
|
||||||
pbRelay "Open_IM/src/proto/relay"
|
pbRelay "Open_IM/pkg/proto/relay"
|
||||||
|
"Open_IM/pkg/utils"
|
||||||
"github.com/Shopify/sarama"
|
"github.com/Shopify/sarama"
|
||||||
"github.com/golang/protobuf/proto"
|
"github.com/golang/protobuf/proto"
|
||||||
)
|
)
|
||||||
@@ -53,7 +54,7 @@ func (ms *PushConsumerHandler) handleMs2PsChat(msg []byte) {
|
|||||||
sendPbData.PlatformID = pbData.PlatformID
|
sendPbData.PlatformID = pbData.PlatformID
|
||||||
sendPbData.RecvSeq = pbData.RecvSeq
|
sendPbData.RecvSeq = pbData.RecvSeq
|
||||||
//Call push module to send message to the user
|
//Call push module to send message to the user
|
||||||
MsgToUser(&sendPbData, pbData.OfflineInfo, pbData.Options)
|
MsgToUser(&sendPbData, pbData.OfflineInfo, utils.JsonStringToMap(pbData.Options))
|
||||||
}
|
}
|
||||||
func (PushConsumerHandler) Setup(_ sarama.ConsumerGroupSession) error { return nil }
|
func (PushConsumerHandler) Setup(_ sarama.ConsumerGroupSession) error { return nil }
|
||||||
func (PushConsumerHandler) Cleanup(_ sarama.ConsumerGroupSession) error { return nil }
|
func (PushConsumerHandler) Cleanup(_ sarama.ConsumerGroupSession) error { return nil }
|
||||||
@@ -1,12 +1,12 @@
|
|||||||
package logic
|
package logic
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/src/common/config"
|
"Open_IM/pkg/common/config"
|
||||||
"Open_IM/src/common/log"
|
"Open_IM/pkg/common/log"
|
||||||
"Open_IM/src/grpc-etcdv3/getcdv3"
|
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
||||||
"Open_IM/src/proto/push"
|
"Open_IM/pkg/proto/push"
|
||||||
pbRelay "Open_IM/src/proto/relay"
|
pbRelay "Open_IM/pkg/proto/relay"
|
||||||
"Open_IM/src/utils"
|
"Open_IM/pkg/utils"
|
||||||
"context"
|
"context"
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
"net"
|
"net"
|
||||||
@@ -65,7 +65,7 @@ func (r *RPCServer) PushMsg(_ context.Context, pbData *pbPush.PushMsgReq) (*pbPu
|
|||||||
sendPbData.PlatformID = pbData.PlatformID
|
sendPbData.PlatformID = pbData.PlatformID
|
||||||
sendPbData.RecvSeq = pbData.RecvSeq
|
sendPbData.RecvSeq = pbData.RecvSeq
|
||||||
//Call push module to send message to the user
|
//Call push module to send message to the user
|
||||||
MsgToUser(&sendPbData, pbData.OfflineInfo, pbData.Options)
|
MsgToUser(&sendPbData, pbData.OfflineInfo, utils.JsonStringToMap(pbData.Options))
|
||||||
return &pbPush.PushMsgResp{
|
return &pbPush.PushMsgResp{
|
||||||
ResultCode: 0,
|
ResultCode: 0,
|
||||||
}, nil
|
}, nil
|
||||||
@@ -0,0 +1,155 @@
|
|||||||
|
/*
|
||||||
|
** description("").
|
||||||
|
** copyright('open-im,www.open-im.io').
|
||||||
|
** author("fg,Gordon@open-im.io").
|
||||||
|
** time(2021/3/5 14:31).
|
||||||
|
*/
|
||||||
|
package logic
|
||||||
|
|
||||||
|
import (
|
||||||
|
push "Open_IM/internal/push/jpush"
|
||||||
|
rpcChat "Open_IM/internal/rpc/chat"
|
||||||
|
"Open_IM/pkg/common/config"
|
||||||
|
"Open_IM/pkg/common/constant"
|
||||||
|
"Open_IM/pkg/common/log"
|
||||||
|
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
||||||
|
pbChat "Open_IM/pkg/proto/chat"
|
||||||
|
pbGroup "Open_IM/pkg/proto/group"
|
||||||
|
pbRelay "Open_IM/pkg/proto/relay"
|
||||||
|
"Open_IM/pkg/utils"
|
||||||
|
"context"
|
||||||
|
"encoding/json"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
|
type OpenIMContent struct {
|
||||||
|
SessionType int `json:"sessionType"`
|
||||||
|
From string `json:"from"`
|
||||||
|
To string `json:"to"`
|
||||||
|
Seq int64 `json:"seq"`
|
||||||
|
}
|
||||||
|
type AtContent struct {
|
||||||
|
Text string `json:"text"`
|
||||||
|
AtUserList []string `json:"atUserList"`
|
||||||
|
IsAtSelf bool `json:"isAtSelf"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func MsgToUser(sendPbData *pbRelay.MsgToUserReq, OfflineInfo string, Options map[string]int32) {
|
||||||
|
var wsResult []*pbRelay.SingleMsgToUser
|
||||||
|
isOfflinePush := utils.GetSwitchFromOptions(Options, "offlinePush")
|
||||||
|
log.InfoByKv("Get chat from msg_transfer And push chat", sendPbData.OperationID, "PushData", sendPbData, Options, isOfflinePush)
|
||||||
|
grpcCons := getcdv3.GetConn4Unique(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOnlineMessageRelayName)
|
||||||
|
//Online push message
|
||||||
|
log.InfoByKv("test", sendPbData.OperationID, "len grpc", len(grpcCons), "data", sendPbData)
|
||||||
|
for _, v := range grpcCons {
|
||||||
|
msgClient := pbRelay.NewOnlineMessageRelayServiceClient(v)
|
||||||
|
reply, err := msgClient.MsgToUser(context.Background(), sendPbData)
|
||||||
|
if err != nil {
|
||||||
|
log.InfoByKv("push data to client rpc err", sendPbData.OperationID, "err", err)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if reply != nil && reply.Resp != nil {
|
||||||
|
wsResult = append(wsResult, reply.Resp...)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
log.InfoByKv("push_result", sendPbData.OperationID, "result", wsResult, "sendData", sendPbData)
|
||||||
|
if sendPbData.ContentType != constant.Typing && sendPbData.ContentType != constant.HasReadReceipt {
|
||||||
|
if isOfflinePush {
|
||||||
|
for _, v := range wsResult {
|
||||||
|
if v.ResultCode == 0 {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
//supported terminal
|
||||||
|
for _, t := range pushTerminal {
|
||||||
|
if v.RecvPlatFormID == t {
|
||||||
|
//Use offline push messaging
|
||||||
|
var UIDList []string
|
||||||
|
UIDList = append(UIDList, v.RecvID)
|
||||||
|
customContent := OpenIMContent{
|
||||||
|
SessionType: int(sendPbData.SessionType),
|
||||||
|
From: sendPbData.SendID,
|
||||||
|
To: sendPbData.RecvID,
|
||||||
|
Seq: sendPbData.RecvSeq,
|
||||||
|
}
|
||||||
|
bCustomContent, _ := json.Marshal(customContent)
|
||||||
|
jsonCustomContent := string(bCustomContent)
|
||||||
|
var content string
|
||||||
|
switch sendPbData.ContentType {
|
||||||
|
case constant.Text:
|
||||||
|
content = constant.ContentType2PushContent[constant.Text]
|
||||||
|
case constant.Picture:
|
||||||
|
content = constant.ContentType2PushContent[constant.Picture]
|
||||||
|
case constant.Voice:
|
||||||
|
content = constant.ContentType2PushContent[constant.Voice]
|
||||||
|
case constant.Video:
|
||||||
|
content = constant.ContentType2PushContent[constant.Video]
|
||||||
|
case constant.File:
|
||||||
|
content = constant.ContentType2PushContent[constant.File]
|
||||||
|
case constant.AtText:
|
||||||
|
a := AtContent{}
|
||||||
|
_ = utils.JsonStringToStruct(sendPbData.Content, &a)
|
||||||
|
if utils.IsContain(v.RecvID, a.AtUserList) {
|
||||||
|
content = constant.ContentType2PushContent[constant.AtText] + constant.ContentType2PushContent[constant.Common]
|
||||||
|
} else {
|
||||||
|
content = constant.ContentType2PushContent[constant.GroupMsg]
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
content = constant.ContentType2PushContent[constant.Common]
|
||||||
|
}
|
||||||
|
pushResult, err := push.JGAccountListPush(UIDList, content, jsonCustomContent, constant.PlatformIDToName(t))
|
||||||
|
if err != nil {
|
||||||
|
log.NewError(sendPbData.OperationID, "offline push error", sendPbData.String(), err.Error(), constant.PlatformIDToName(t))
|
||||||
|
} else {
|
||||||
|
log.NewDebug(sendPbData.OperationID, "offline push return result is ", string(pushResult), sendPbData, constant.PlatformIDToName(t))
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func SendMsgByWS(m *pbChat.WSToMsgSvrChatMsg) {
|
||||||
|
m.MsgID = rpcChat.GetMsgID(m.SendID)
|
||||||
|
m.ClientMsgID = m.MsgID
|
||||||
|
switch m.SessionType {
|
||||||
|
case constant.SingleChatType:
|
||||||
|
sendMsgToKafka(m, m.SendID, "msgKey--sendID")
|
||||||
|
sendMsgToKafka(m, m.RecvID, "msgKey--recvID")
|
||||||
|
case constant.GroupChatType:
|
||||||
|
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName)
|
||||||
|
client := pbGroup.NewGroupClient(etcdConn)
|
||||||
|
req := &pbGroup.GetGroupAllMemberReq{
|
||||||
|
GroupID: m.RecvID,
|
||||||
|
Token: config.Config.Secret,
|
||||||
|
OperationID: m.OperationID,
|
||||||
|
}
|
||||||
|
reply, err := client.GetGroupAllMember(context.Background(), req)
|
||||||
|
if err != nil {
|
||||||
|
log.Error(m.Token, m.OperationID, "rpc getGroupInfo failed, err = %s", err.Error())
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if reply.ErrorCode != 0 {
|
||||||
|
log.Error(m.Token, m.OperationID, "rpc getGroupInfo failed, err = %s", reply.ErrorMsg)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
groupID := m.RecvID
|
||||||
|
for i, v := range reply.MemberList {
|
||||||
|
m.RecvID = v.UserId + " " + groupID
|
||||||
|
sendMsgToKafka(m, utils.IntToString(i), "msgKey--recvID+\" \"+groupID")
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func sendMsgToKafka(m *pbChat.WSToMsgSvrChatMsg, key string, flag string) {
|
||||||
|
pid, offset, err := producer.SendMessage(m, key)
|
||||||
|
if err != nil {
|
||||||
|
log.ErrorByKv("kafka send failed", m.OperationID, "send data", m.String(), "pid", pid, "offset", offset, "err", err.Error(), flag, key)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
package logic
|
package logic
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/src/common/config"
|
tpns "Open_IM/internal/push/sdk/tpns-server-sdk-go/go"
|
||||||
tpns "Open_IM/src/push/sdk/tpns-server-sdk-go/go"
|
"Open_IM/internal/push/sdk/tpns-server-sdk-go/go/auth"
|
||||||
"Open_IM/src/push/sdk/tpns-server-sdk-go/go/auth"
|
"Open_IM/internal/push/sdk/tpns-server-sdk-go/go/common"
|
||||||
"Open_IM/src/push/sdk/tpns-server-sdk-go/go/common"
|
"Open_IM/internal/push/sdk/tpns-server-sdk-go/go/req"
|
||||||
"Open_IM/src/push/sdk/tpns-server-sdk-go/go/req"
|
"Open_IM/pkg/common/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
var badgeType = -2
|
var badgeType = -2
|
||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
package common
|
package common
|
||||||
|
|
||||||
import (
|
import (
|
||||||
tpns "Open_IM/src/push/sdk/tpns-server-sdk-go/go"
|
tpns "Open_IM/internal/push/sdk/tpns-server-sdk-go/go"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
package req
|
package req
|
||||||
|
|
||||||
import (
|
import (
|
||||||
tpns "Open_IM/src/push/sdk/tpns-server-sdk-go/go"
|
tpns "Open_IM/internal/push/sdk/tpns-server-sdk-go/go"
|
||||||
"bytes"
|
"bytes"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"io"
|
"io"
|
||||||
@@ -1,12 +1,11 @@
|
|||||||
package rpcAuth
|
package auth
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/src/common/config"
|
"Open_IM/pkg/common/config"
|
||||||
"Open_IM/src/common/log"
|
"Open_IM/pkg/common/log"
|
||||||
|
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
||||||
"Open_IM/src/grpc-etcdv3/getcdv3"
|
pbAuth "Open_IM/pkg/proto/auth"
|
||||||
pbAuth "Open_IM/src/proto/auth"
|
"Open_IM/pkg/utils"
|
||||||
"Open_IM/src/utils"
|
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
"net"
|
"net"
|
||||||
"strconv"
|
"strconv"
|
||||||
@@ -1,15 +1,18 @@
|
|||||||
package rpcAuth
|
package auth
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/src/common/db/mysql_model/im_mysql_model"
|
"Open_IM/pkg/common/db/mysql_model/im_mysql_model"
|
||||||
"Open_IM/src/common/log"
|
"Open_IM/pkg/common/log"
|
||||||
pbAuth "Open_IM/src/proto/auth"
|
pbAuth "Open_IM/pkg/proto/auth"
|
||||||
"context"
|
"context"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (rpc *rpcAuth) UserRegister(_ context.Context, pb *pbAuth.UserRegisterReq) (*pbAuth.UserRegisterResp, error) {
|
func (rpc *rpcAuth) UserRegister(_ context.Context, pb *pbAuth.UserRegisterReq) (*pbAuth.UserRegisterResp, error) {
|
||||||
log.Info("", "", "rpc user_register start, [data: %s]", pb.String())
|
log.Info("", "", "rpc user_register start, [data: %s]", pb.String())
|
||||||
|
|
||||||
|
//if len(pb.UID) == 0 {
|
||||||
|
// pb.UID = utils.GenID()
|
||||||
|
//}
|
||||||
if err := im_mysql_model.UserRegister(pb); err != nil {
|
if err := im_mysql_model.UserRegister(pb); err != nil {
|
||||||
log.Error("", "", "rpc user_register error, [data: %s] [err: %s]", pb.String(), err.Error())
|
log.Error("", "", "rpc user_register error, [data: %s] [err: %s]", pb.String(), err.Error())
|
||||||
return &pbAuth.UserRegisterResp{Success: false}, err
|
return &pbAuth.UserRegisterResp{Success: false}, err
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
package rpcAuth
|
package auth
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/src/common/db/mysql_model/im_mysql_model"
|
"Open_IM/pkg/common/db/mysql_model/im_mysql_model"
|
||||||
"Open_IM/src/common/log"
|
"Open_IM/pkg/common/log"
|
||||||
pbAuth "Open_IM/src/proto/auth"
|
"Open_IM/pkg/common/token_verify"
|
||||||
"Open_IM/src/utils"
|
pbAuth "Open_IM/pkg/proto/auth"
|
||||||
"context"
|
"context"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -18,7 +18,7 @@ func (rpc *rpcAuth) UserToken(_ context.Context, pb *pbAuth.UserTokenReq) (*pbAu
|
|||||||
}
|
}
|
||||||
log.Info("", "", "rpc user_token call..., im_mysql_model.AppServerFindFromUserByUserID")
|
log.Info("", "", "rpc user_token call..., im_mysql_model.AppServerFindFromUserByUserID")
|
||||||
|
|
||||||
tokens, expTime, err := utils.CreateToken(pb.UID, "", pb.Platform)
|
tokens, expTime, err := token_verify.CreateToken(pb.UID, pb.Platform)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("", "", "rpc user_token call..., utils.CreateToken fail [uid: %s] [err: %s]", pb.UID, err.Error())
|
log.Error("", "", "rpc user_token call..., utils.CreateToken fail [uid: %s] [err: %s]", pb.UID, err.Error())
|
||||||
return &pbAuth.UserTokenResp{ErrCode: 500, ErrMsg: err.Error()}, err
|
return &pbAuth.UserTokenResp{ErrCode: 500, ErrMsg: err.Error()}, err
|
||||||
@@ -1,16 +1,16 @@
|
|||||||
package rpcChat
|
package chat
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"github.com/garyburd/redigo/redis"
|
"github.com/garyburd/redigo/redis"
|
||||||
|
|
||||||
commonDB "Open_IM/src/common/db"
|
commonDB "Open_IM/pkg/common/db"
|
||||||
"Open_IM/src/common/log"
|
"Open_IM/pkg/common/log"
|
||||||
|
|
||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
pbMsg "Open_IM/src/proto/chat"
|
pbMsg "Open_IM/pkg/proto/chat"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (rpc *rpcChat) GetMaxAndMinSeq(_ context.Context, in *pbMsg.GetMaxAndMinSeqReq) (*pbMsg.GetMaxAndMinSeqResp, error) {
|
func (rpc *rpcChat) GetMaxAndMinSeq(_ context.Context, in *pbMsg.GetMaxAndMinSeqReq) (*pbMsg.GetMaxAndMinSeqResp, error) {
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user