mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-05-25 22:49:19 +08:00
commit
f16cd5b8db
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
bin
|
||||||
|
logs
|
4
.gitmodules
vendored
Normal file
4
.gitmodules
vendored
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
|
||||||
|
[submodule "cmd/Open-IM-SDK-Core"]
|
||||||
|
path = cmd/Open-IM-SDK-Core
|
||||||
|
url = https://github.com/OpenIMSDK/Open-IM-SDK-Core.git
|
@ -42,7 +42,7 @@ By deployment of the Open-IM-Server on the customer's server, developers can int
|
|||||||
2. Clone the Open-IM project to your server.
|
2. Clone the Open-IM project to your server.
|
||||||
|
|
||||||
```
|
```
|
||||||
git clone https://github.com/OpenIMSDK/Open-IM-Server.git
|
git clone https://github.com/OpenIMSDK/Open-IM-Server.git --recursive
|
||||||
```
|
```
|
||||||
|
|
||||||
3. Build and start Service.
|
3. Build and start Service.
|
||||||
@ -86,7 +86,7 @@ All images are available at https://hub.docker.com/r/lyt1123/open_im_server
|
|||||||
3. Clone the Open-IM project to your server.
|
3. Clone the Open-IM project to your server.
|
||||||
|
|
||||||
```
|
```
|
||||||
git clone https://github.com/OpenIMSDK/Open-IM-Server.git
|
git clone https://github.com/OpenIMSDK/Open-IM-Server.git --recursive
|
||||||
```
|
```
|
||||||
|
|
||||||
4. Start docker-compose with one click(Docker automatically pulls all images)
|
4. Start docker-compose with one click(Docker automatically pulls all images)
|
||||||
|
@ -2,13 +2,11 @@
|
|||||||
|
|
||||||
BINARY_NAME=open_im_api
|
BINARY_NAME=open_im_api
|
||||||
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 -o ${BINARY_NAME} ${GO_FILE}
|
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build
|
||||||
|
|
||||||
run:
|
run:
|
||||||
@go run ./
|
@go run ./
|
@ -1,14 +1,15 @@
|
|||||||
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/friend"
|
||||||
"Open_IM/src/api/group"
|
"Open_IM/internal/api/group"
|
||||||
"Open_IM/src/api/manage"
|
"Open_IM/internal/api/manage"
|
||||||
apiThird "Open_IM/src/api/third"
|
apiThird "Open_IM/internal/api/third"
|
||||||
"Open_IM/src/api/user"
|
"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"
|
||||||
@ -93,7 +94,7 @@ func main() {
|
|||||||
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)
|
||||||
}
|
}
|
||||||
|
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()
|
||||||
r.Run(utils.ServerIP + ":" + strconv.Itoa(*ginPort))
|
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,7 +1,7 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/src/msg_gateway/gate"
|
"Open_IM/internal/msg_gateway/gate"
|
||||||
"flag"
|
"flag"
|
||||||
"sync"
|
"sync"
|
||||||
)
|
)
|
@ -2,13 +2,11 @@
|
|||||||
|
|
||||||
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,7 +1,7 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/src/push/logic"
|
"Open_IM/internal/push/logic"
|
||||||
"flag"
|
"flag"
|
||||||
"sync"
|
"sync"
|
||||||
)
|
)
|
@ -1,8 +1,8 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/src/common/config"
|
"Open_IM/pkg/common/config"
|
||||||
"Open_IM/src/common/db"
|
"Open_IM/pkg/common/db"
|
||||||
"fmt"
|
"fmt"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
@ -2,13 +2,11 @@
|
|||||||
|
|
||||||
BINARY_NAME=open_im_auth
|
BINARY_NAME=open_im_auth
|
||||||
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 -o ${BINARY_NAME} ${GO_FILE}
|
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build
|
||||||
|
|
||||||
run:
|
run:
|
||||||
@go run ./
|
@go run ./
|
@ -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"
|
||||||
)
|
)
|
||||||
|
|
@ -2,13 +2,11 @@
|
|||||||
|
|
||||||
BINARY_NAME=open_im_friend
|
BINARY_NAME=open_im_friend
|
||||||
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 -o ${BINARY_NAME} ${GO_FILE}
|
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build
|
||||||
|
|
||||||
run:
|
run:
|
||||||
@go run ./
|
@go run ./
|
@ -1,7 +1,7 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/src/rpc/friend/friend"
|
"Open_IM/internal/rpc/friend"
|
||||||
"flag"
|
"flag"
|
||||||
)
|
)
|
||||||
|
|
@ -2,13 +2,11 @@
|
|||||||
|
|
||||||
BINARY_NAME=open_im_group
|
BINARY_NAME=open_im_group
|
||||||
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 -o ${BINARY_NAME} ${GO_FILE}
|
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build
|
||||||
|
|
||||||
run:
|
run:
|
||||||
@go run ./
|
@go run ./
|
@ -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 ./
|
@ -1,8 +1,8 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
rpcChat "Open_IM/src/rpc/chat/chat"
|
rpcChat "Open_IM/internal/rpc/chat"
|
||||||
"Open_IM/src/utils"
|
"Open_IM/pkg/utils"
|
||||||
"flag"
|
"flag"
|
||||||
)
|
)
|
||||||
|
|
@ -2,13 +2,11 @@
|
|||||||
|
|
||||||
BINARY_NAME=open_im_user
|
BINARY_NAME=open_im_user
|
||||||
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 -o ${BINARY_NAME} ${GO_FILE}
|
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build
|
||||||
|
|
||||||
run:
|
run:
|
||||||
@go run ./
|
@go run ./
|
@ -1,7 +1,7 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/src/rpc/user/user"
|
"Open_IM/internal/rpc/user"
|
||||||
"flag"
|
"flag"
|
||||||
)
|
)
|
||||||
|
|
@ -5,12 +5,12 @@
|
|||||||
#---------------Infrastructure configuration---------------------#
|
#---------------Infrastructure configuration---------------------#
|
||||||
etcd:
|
etcd:
|
||||||
etcdSchema: openIM
|
etcdSchema: openIM
|
||||||
etcdAddr: [ 127.0.0.1:2379 ]
|
etcdAddr: [ 81.68.126.69:2379 ]
|
||||||
|
|
||||||
mysql:
|
mysql:
|
||||||
dbMysqlAddress: [ 127.0.0.1:3306 ]
|
dbMysqlAddress: [ 81.68.126.69:13306 ]
|
||||||
dbMysqlUserName: root
|
dbMysqlUserName: openIM
|
||||||
dbMysqlPassword: openIM
|
dbMysqlPassword: 12345
|
||||||
dbMysqlDatabaseName: openIM
|
dbMysqlDatabaseName: openIM
|
||||||
dbTableName: eMsg
|
dbTableName: eMsg
|
||||||
dbMsgTableNum: 1
|
dbMsgTableNum: 1
|
||||||
@ -19,18 +19,18 @@ mysql:
|
|||||||
dbMaxLifeTime: 120
|
dbMaxLifeTime: 120
|
||||||
|
|
||||||
mongo:
|
mongo:
|
||||||
dbAddress: [ 127.0.0.1:27017 ]
|
dbAddress: [ 81.68.126.69:27017 ]
|
||||||
dbDirect: false
|
dbDirect: false
|
||||||
dbTimeout: 10
|
dbTimeout: 10
|
||||||
dbDatabase: openIM
|
dbDatabase: openIM
|
||||||
dbSource: admin
|
dbSource: openIM
|
||||||
dbUserName:
|
dbUserName: openIM
|
||||||
dbPassword:
|
dbPassword: 12345
|
||||||
dbMaxPoolSize: 20
|
dbMaxPoolSize: 20
|
||||||
dbRetainChatRecords: 7
|
dbRetainChatRecords: 7
|
||||||
|
|
||||||
redis:
|
redis:
|
||||||
dbAddress: 127.0.0.1:6379
|
dbAddress: 81.68.126.69:16379
|
||||||
dbMaxIdle: 128
|
dbMaxIdle: 128
|
||||||
dbMaxActive: 0
|
dbMaxActive: 0
|
||||||
dbIdleTimeout: 120
|
dbIdleTimeout: 120
|
||||||
@ -38,10 +38,10 @@ redis:
|
|||||||
|
|
||||||
kafka:
|
kafka:
|
||||||
ws2mschat:
|
ws2mschat:
|
||||||
addr: [ 127.0.0.1:9092 ]
|
addr: [ 81.68.126.69:9092 ]
|
||||||
topic: "ws2ms_chat"
|
topic: "ws2ms_chat"
|
||||||
ms2pschat:
|
ms2pschat:
|
||||||
addr: [ 127.0.0.1:9092 ]
|
addr: [ 81.68.126.69:9092 ]
|
||||||
topic: "ms2ps_chat"
|
topic: "ms2ps_chat"
|
||||||
consumergroupid:
|
consumergroupid:
|
||||||
msgToMongo: mongo
|
msgToMongo: mongo
|
||||||
@ -59,6 +59,8 @@ serverip:
|
|||||||
|
|
||||||
api:
|
api:
|
||||||
openImApiPort: [ 10000 ]
|
openImApiPort: [ 10000 ]
|
||||||
|
sdk:
|
||||||
|
openImSdkWsPort: [ 30000 ]
|
||||||
|
|
||||||
credential:
|
credential:
|
||||||
tencent:
|
tencent:
|
||||||
@ -86,12 +88,13 @@ rpcregistername:
|
|||||||
openImPushName: Push
|
openImPushName: Push
|
||||||
openImOnlineMessageRelayName: OnlineMessageRelay
|
openImOnlineMessageRelayName: OnlineMessageRelay
|
||||||
openImGroupName: Group
|
openImGroupName: Group
|
||||||
rpcGetTokenName: Auth
|
openImAuthName: Auth
|
||||||
|
|
||||||
log:
|
log:
|
||||||
storageLocation: ../logs/
|
storageLocation: ../logs/
|
||||||
rotationTime: 12
|
rotationTime: 24
|
||||||
remainRotationCount: 10
|
remainRotationCount: 5
|
||||||
|
remainLogLevel: 6
|
||||||
elasticSearchSwitch: false
|
elasticSearchSwitch: false
|
||||||
elasticSearchAddr: [ 127.0.0.1:9201 ]
|
elasticSearchAddr: [ 127.0.0.1:9201 ]
|
||||||
elasticSearchUser: ""
|
elasticSearchUser: ""
|
||||||
@ -103,7 +106,7 @@ modulename:
|
|||||||
pushName: push
|
pushName: push
|
||||||
|
|
||||||
longconnsvr:
|
longconnsvr:
|
||||||
websocketPort: [ 17778 ]
|
openImWsPort: [ 17778 ]
|
||||||
websocketMaxConnNum: 10000
|
websocketMaxConnNum: 10000
|
||||||
websocketMaxMsgLen: 4096
|
websocketMaxMsgLen: 4096
|
||||||
websocketTimeOut: 10
|
websocketTimeOut: 10
|
||||||
|
@ -28,7 +28,7 @@ RUN ln -fs /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && dpkg-reconfigure
|
|||||||
|
|
||||||
|
|
||||||
#set directory to map logs,config file,script file.
|
#set directory to map logs,config file,script file.
|
||||||
VOLUME ["/Open-IM-Server/logs","/Open-IM-Server/config","/Open-IM-Server/script"]
|
VOLUME ["/Open-IM-Server/logs","/Open-IM-Server/config","/Open-IM-Server/script","/Open-IM-Server/db/sdk"]
|
||||||
|
|
||||||
#Copy scripts files and binary files to the blank image
|
#Copy scripts files and binary files to the blank image
|
||||||
COPY --from=build /Open-IM-Server/script /Open-IM-Server/script
|
COPY --from=build /Open-IM-Server/script /Open-IM-Server/script
|
||||||
@ -36,4 +36,4 @@ COPY --from=build /Open-IM-Server/bin /Open-IM-Server/bin
|
|||||||
|
|
||||||
WORKDIR /Open-IM-Server/script
|
WORKDIR /Open-IM-Server/script
|
||||||
|
|
||||||
CMD ["./docker_start_all.sh"]
|
CMD ["./docker_start_all.sh"]
|
||||||
|
@ -84,25 +84,28 @@ services:
|
|||||||
|
|
||||||
|
|
||||||
#fixme-----build from dockerfile---------
|
#fixme-----build from dockerfile---------
|
||||||
# open-im-server:
|
# open-im-server:
|
||||||
# image: open_im_server
|
# image: open_im_server
|
||||||
# ports:
|
# container_name: open-im-server
|
||||||
# - 10000:10000
|
# volumes:
|
||||||
# - 17778:17778
|
# - ./logs:/Open-IM-Server/logs
|
||||||
# container_name: open-im-server
|
# - ./config/config.yaml:/Open-IM-Server/config/config.yaml
|
||||||
# volumes:
|
# restart: always
|
||||||
# - ./logs:/Open-IM-Server/logs
|
# build:
|
||||||
# - ./config/config.yaml:/Open-IM-Server/config/config.yaml
|
# context: .
|
||||||
# restart: always
|
# dockerfile: deploy.Dockerfile
|
||||||
# build:
|
# depends_on:
|
||||||
# context: .
|
# - mysql
|
||||||
# dockerfile: deploy.Dockerfile
|
# - mongodb
|
||||||
# depends_on:
|
# - redis
|
||||||
# - mysql
|
# - kafka
|
||||||
# - mongodb
|
# - etcd
|
||||||
# - redis
|
# network_mode: "host"
|
||||||
# - kafka
|
# logging:
|
||||||
# - etcd
|
# driver: json-file
|
||||||
|
# options:
|
||||||
|
# max-size: "1g"
|
||||||
|
# max-file: "2"
|
||||||
|
|
||||||
#fixme----build from docker hub------
|
#fixme----build from docker hub------
|
||||||
open-im-server:
|
open-im-server:
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
package apiAuth
|
package apiAuth
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/src/common/config"
|
pbAuth "Open_IM/pkg/proto/auth"
|
||||||
"Open_IM/src/common/log"
|
"Open_IM/pkg/common/config"
|
||||||
"Open_IM/src/grpc-etcdv3/getcdv3"
|
"Open_IM/pkg/common/log"
|
||||||
pbAuth "Open_IM/src/proto/auth"
|
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
||||||
"context"
|
"context"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"net/http"
|
"net/http"
|
||||||
@ -40,7 +40,7 @@ func newUserRegisterReq(params *paramsUserRegister) *pbAuth.UserRegisterReq {
|
|||||||
|
|
||||||
func UserRegister(c *gin.Context) {
|
func UserRegister(c *gin.Context) {
|
||||||
log.Info("", "", "api user_register init ....")
|
log.Info("", "", "api user_register init ....")
|
||||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.RpcGetTokenName)
|
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImAuthName)
|
||||||
client := pbAuth.NewAuthClient(etcdConn)
|
client := pbAuth.NewAuthClient(etcdConn)
|
||||||
//defer etcdConn.Close()
|
//defer etcdConn.Close()
|
||||||
|
|
@ -1,10 +1,10 @@
|
|||||||
package apiAuth
|
package apiAuth
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/src/common/config"
|
pbAuth "Open_IM/pkg/proto/auth"
|
||||||
"Open_IM/src/common/log"
|
"Open_IM/pkg/common/config"
|
||||||
"Open_IM/src/grpc-etcdv3/getcdv3"
|
"Open_IM/pkg/common/log"
|
||||||
pbAuth "Open_IM/src/proto/auth"
|
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
||||||
"context"
|
"context"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"net/http"
|
"net/http"
|
||||||
@ -13,7 +13,7 @@ import (
|
|||||||
|
|
||||||
type paramsUserToken struct {
|
type paramsUserToken struct {
|
||||||
Secret string `json:"secret" binding:"required,max=32"`
|
Secret string `json:"secret" binding:"required,max=32"`
|
||||||
Platform int32 `json:"platform" binding:"required,min=1,max=7"`
|
Platform int32 `json:"platform" binding:"required,min=1,max=8"`
|
||||||
UID string `json:"uid" binding:"required,min=1,max=64"`
|
UID string `json:"uid" binding:"required,min=1,max=64"`
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -27,7 +27,7 @@ func newUserTokenReq(params *paramsUserToken) *pbAuth.UserTokenReq {
|
|||||||
|
|
||||||
func UserToken(c *gin.Context) {
|
func UserToken(c *gin.Context) {
|
||||||
log.Info("", "", "api user_token init ....")
|
log.Info("", "", "api user_token init ....")
|
||||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.RpcGetTokenName)
|
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImAuthName)
|
||||||
client := pbAuth.NewAuthClient(etcdConn)
|
client := pbAuth.NewAuthClient(etcdConn)
|
||||||
//defer etcdConn.Close()
|
//defer etcdConn.Close()
|
||||||
|
|
@ -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/grpc-etcdv3/getcdv3"
|
||||||
pbMsg "Open_IM/src/proto/chat"
|
pbMsg "Open_IM/pkg/proto/chat"
|
||||||
"Open_IM/src/utils"
|
"Open_IM/pkg/utils"
|
||||||
"context"
|
"context"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"net/http"
|
"net/http"
|
@ -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/grpc-etcdv3/getcdv3"
|
||||||
"Open_IM/src/proto/chat"
|
"Open_IM/pkg/proto/chat"
|
||||||
"Open_IM/src/utils"
|
"Open_IM/pkg/utils"
|
||||||
"context"
|
"context"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"net/http"
|
"net/http"
|
@ -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"
|
@ -1,10 +1,10 @@
|
|||||||
package friend
|
package friend
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/src/common/config"
|
pbFriend "Open_IM/pkg/proto/friend"
|
||||||
"Open_IM/src/common/log"
|
"Open_IM/pkg/common/config"
|
||||||
"Open_IM/src/grpc-etcdv3/getcdv3"
|
"Open_IM/pkg/common/log"
|
||||||
pbFriend "Open_IM/src/proto/friend"
|
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
||||||
"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"
|
pbFriend "Open_IM/pkg/proto/friend"
|
||||||
"Open_IM/src/common/log"
|
"Open_IM/pkg/common/config"
|
||||||
"Open_IM/src/grpc-etcdv3/getcdv3"
|
"Open_IM/pkg/common/log"
|
||||||
pbFriend "Open_IM/src/proto/friend"
|
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
||||||
"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"
|
pbFriend "Open_IM/pkg/proto/friend"
|
||||||
"Open_IM/src/common/log"
|
"Open_IM/pkg/common/config"
|
||||||
"Open_IM/src/grpc-etcdv3/getcdv3"
|
"Open_IM/pkg/common/log"
|
||||||
pbFriend "Open_IM/src/proto/friend"
|
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
||||||
"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"
|
pbFriend "Open_IM/pkg/proto/friend"
|
||||||
"Open_IM/src/common/log"
|
"Open_IM/pkg/common/config"
|
||||||
"Open_IM/src/grpc-etcdv3/getcdv3"
|
"Open_IM/pkg/common/log"
|
||||||
pbFriend "Open_IM/src/proto/friend"
|
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
||||||
"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"
|
pbFriend "Open_IM/pkg/proto/friend"
|
||||||
"Open_IM/src/common/log"
|
"Open_IM/pkg/common/config"
|
||||||
"Open_IM/src/grpc-etcdv3/getcdv3"
|
"Open_IM/pkg/common/log"
|
||||||
pbFriend "Open_IM/src/proto/friend"
|
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
||||||
"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"
|
pbFriend "Open_IM/pkg/proto/friend"
|
||||||
"Open_IM/src/common/log"
|
"Open_IM/pkg/common/config"
|
||||||
"Open_IM/src/grpc-etcdv3/getcdv3"
|
"Open_IM/pkg/common/log"
|
||||||
pbFriend "Open_IM/src/proto/friend"
|
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
||||||
"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"
|
pbFriend "Open_IM/pkg/proto/friend"
|
||||||
"Open_IM/src/common/log"
|
"Open_IM/pkg/common/config"
|
||||||
"Open_IM/src/grpc-etcdv3/getcdv3"
|
"Open_IM/pkg/common/log"
|
||||||
pbFriend "Open_IM/src/proto/friend"
|
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
||||||
"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"
|
pbFriend "Open_IM/pkg/proto/friend"
|
||||||
"Open_IM/src/common/log"
|
"Open_IM/pkg/common/config"
|
||||||
"Open_IM/src/grpc-etcdv3/getcdv3"
|
"Open_IM/pkg/common/log"
|
||||||
pbFriend "Open_IM/src/proto/friend"
|
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
||||||
"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"
|
pbFriend "Open_IM/pkg/proto/friend"
|
||||||
"Open_IM/src/common/log"
|
"Open_IM/pkg/common/config"
|
||||||
"Open_IM/src/grpc-etcdv3/getcdv3"
|
"Open_IM/pkg/common/log"
|
||||||
pbFriend "Open_IM/src/proto/friend"
|
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
||||||
"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"
|
pbFriend "Open_IM/pkg/proto/friend"
|
||||||
"Open_IM/src/common/log"
|
"Open_IM/pkg/common/config"
|
||||||
"Open_IM/src/grpc-etcdv3/getcdv3"
|
"Open_IM/pkg/common/log"
|
||||||
pbFriend "Open_IM/src/proto/friend"
|
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
||||||
"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"
|
pbFriend "Open_IM/pkg/proto/friend"
|
||||||
"Open_IM/src/common/log"
|
"Open_IM/pkg/common/config"
|
||||||
"Open_IM/src/grpc-etcdv3/getcdv3"
|
"Open_IM/pkg/common/log"
|
||||||
pbFriend "Open_IM/src/proto/friend"
|
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
||||||
"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"
|
pb "Open_IM/pkg/proto/group"
|
||||||
"Open_IM/src/common/log"
|
"Open_IM/pkg/common/config"
|
||||||
"Open_IM/src/grpc-etcdv3/getcdv3"
|
"Open_IM/pkg/common/log"
|
||||||
pb "Open_IM/src/proto/group"
|
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
||||||
"context"
|
"context"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"net/http"
|
"net/http"
|
||||||
@ -40,7 +40,7 @@ func CreateGroup(c *gin.Context) {
|
|||||||
Notification: params.Notification,
|
Notification: params.Notification,
|
||||||
FaceUrl: params.FaceUrl,
|
FaceUrl: params.FaceUrl,
|
||||||
OperationID: params.OperationID,
|
OperationID: params.OperationID,
|
||||||
Ex: params.Ex,
|
Ex: params.Ex,
|
||||||
Token: c.Request.Header.Get("token"),
|
Token: c.Request.Header.Get("token"),
|
||||||
}
|
}
|
||||||
log.Info(req.Token, req.OperationID, "api create group is server,params=%s", req.String())
|
log.Info(req.Token, req.OperationID, "api create group is server,params=%s", req.String())
|
@ -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/grpc-etcdv3/getcdv3"
|
||||||
"Open_IM/src/proto/group"
|
"Open_IM/pkg/proto/group"
|
||||||
"Open_IM/src/utils"
|
"Open_IM/pkg/utils"
|
||||||
"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"
|
pb "Open_IM/pkg/proto/group"
|
||||||
"Open_IM/src/common/log"
|
"Open_IM/pkg/common/config"
|
||||||
"Open_IM/src/grpc-etcdv3/getcdv3"
|
"Open_IM/pkg/common/log"
|
||||||
pb "Open_IM/src/proto/group"
|
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
||||||
"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"
|
pb "Open_IM/pkg/proto/group"
|
||||||
"Open_IM/src/common/log"
|
"Open_IM/pkg/common/config"
|
||||||
"Open_IM/src/grpc-etcdv3/getcdv3"
|
"Open_IM/pkg/common/log"
|
||||||
pb "Open_IM/src/proto/group"
|
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
@ -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/grpc-etcdv3/getcdv3"
|
||||||
"Open_IM/src/proto/group"
|
"Open_IM/pkg/proto/group"
|
||||||
"Open_IM/src/utils"
|
"Open_IM/pkg/utils"
|
||||||
"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"
|
pb "Open_IM/pkg/proto/group"
|
||||||
"Open_IM/src/common/log"
|
"Open_IM/pkg/common/config"
|
||||||
"Open_IM/src/grpc-etcdv3/getcdv3"
|
"Open_IM/pkg/common/log"
|
||||||
pb "Open_IM/src/proto/group"
|
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
||||||
"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"
|
pb "Open_IM/pkg/proto/group"
|
||||||
"Open_IM/src/common/log"
|
"Open_IM/pkg/common/config"
|
||||||
"Open_IM/src/grpc-etcdv3/getcdv3"
|
"Open_IM/pkg/common/log"
|
||||||
pb "Open_IM/src/proto/group"
|
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
||||||
"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"
|
pb "Open_IM/pkg/proto/group"
|
||||||
"Open_IM/src/common/log"
|
"Open_IM/pkg/common/config"
|
||||||
"Open_IM/src/grpc-etcdv3/getcdv3"
|
"Open_IM/pkg/common/log"
|
||||||
pb "Open_IM/src/proto/group"
|
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
||||||
"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/grpc-etcdv3/getcdv3"
|
||||||
"Open_IM/src/proto/group"
|
"Open_IM/pkg/proto/group"
|
||||||
"Open_IM/src/utils"
|
"Open_IM/pkg/utils"
|
||||||
"context"
|
"context"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"net/http"
|
"net/http"
|
@ -7,12 +7,12 @@
|
|||||||
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/grpc-etcdv3/getcdv3"
|
||||||
pbChat "Open_IM/src/proto/chat"
|
pbChat "Open_IM/pkg/proto/chat"
|
||||||
"Open_IM/src/utils"
|
"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"
|
@ -7,10 +7,10 @@
|
|||||||
package manage
|
package manage
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/src/common/config"
|
pbUser "Open_IM/pkg/proto/user"
|
||||||
"Open_IM/src/common/log"
|
"Open_IM/pkg/common/config"
|
||||||
"Open_IM/src/grpc-etcdv3/getcdv3"
|
"Open_IM/pkg/common/log"
|
||||||
pbUser "Open_IM/src/proto/user"
|
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
||||||
"context"
|
"context"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"net/http"
|
"net/http"
|
@ -1,8 +1,8 @@
|
|||||||
package apiThird
|
package apiThird
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/src/common/config"
|
"Open_IM/pkg/common/config"
|
||||||
log2 "Open_IM/src/common/log"
|
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"
|
@ -1,10 +1,10 @@
|
|||||||
package user
|
package user
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/src/common/config"
|
pbUser "Open_IM/pkg/proto/user"
|
||||||
"Open_IM/src/common/log"
|
"Open_IM/pkg/common/config"
|
||||||
"Open_IM/src/grpc-etcdv3/getcdv3"
|
"Open_IM/pkg/common/log"
|
||||||
pbUser "Open_IM/src/proto/user"
|
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
||||||
"context"
|
"context"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"net/http"
|
"net/http"
|
@ -1,10 +1,10 @@
|
|||||||
package user
|
package user
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/src/common/config"
|
pbUser "Open_IM/pkg/proto/user"
|
||||||
"Open_IM/src/common/log"
|
"Open_IM/pkg/common/config"
|
||||||
"Open_IM/src/grpc-etcdv3/getcdv3"
|
"Open_IM/pkg/common/log"
|
||||||
pbUser "Open_IM/src/proto/user"
|
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
||||||
"context"
|
"context"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"net/http"
|
"net/http"
|
@ -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,12 +1,12 @@
|
|||||||
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"
|
||||||
"Open_IM/src/utils"
|
"Open_IM/pkg/utils"
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"github.com/gorilla/websocket"
|
"github.com/gorilla/websocket"
|
@ -1,12 +1,12 @@
|
|||||||
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"
|
||||||
"Open_IM/src/utils"
|
"Open_IM/pkg/utils"
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
@ -7,8 +7,8 @@
|
|||||||
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"
|
||||||
"github.com/mitchellh/mapstructure"
|
"github.com/mitchellh/mapstructure"
|
||||||
)
|
)
|
||||||
|
|
@ -1,9 +1,9 @@
|
|||||||
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"
|
||||||
"Open_IM/src/utils"
|
"Open_IM/pkg/utils"
|
||||||
"github.com/gorilla/websocket"
|
"github.com/gorilla/websocket"
|
||||||
"net/http"
|
"net/http"
|
||||||
"time"
|
"time"
|
@ -1,9 +1,9 @@
|
|||||||
package logic
|
package logic
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/src/common/db"
|
pbMsg "Open_IM/pkg/proto/chat"
|
||||||
"Open_IM/src/common/db/mysql_model/im_mysql_model"
|
"Open_IM/pkg/common/db"
|
||||||
pbMsg "Open_IM/src/proto/chat"
|
"Open_IM/pkg/common/db/mysql_model/im_mysql_model"
|
||||||
)
|
)
|
||||||
|
|
||||||
func saveUserChat(uid string, pbMsg *pbMsg.MsgSvrToPushSvrChatMsg) error {
|
func saveUserChat(uid string, pbMsg *pbMsg.MsgSvrToPushSvrChatMsg) error {
|
@ -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"
|
@ -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 (
|
@ -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"
|
@ -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/kafka"
|
||||||
"Open_IM/src/common/log"
|
"Open_IM/pkg/common/log"
|
||||||
"Open_IM/src/utils"
|
"Open_IM/pkg/utils"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
@ -7,11 +7,11 @@
|
|||||||
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"
|
||||||
"github.com/Shopify/sarama"
|
"github.com/Shopify/sarama"
|
||||||
"github.com/golang/protobuf/proto"
|
"github.com/golang/protobuf/proto"
|
||||||
)
|
)
|
@ -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"
|
@ -7,17 +7,17 @@
|
|||||||
package logic
|
package logic
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/src/common/config"
|
rpcChat "Open_IM/internal/rpc/chat"
|
||||||
"Open_IM/src/common/constant"
|
"Open_IM/internal/rpc/user/internal_service"
|
||||||
"Open_IM/src/common/log"
|
"Open_IM/pkg/common/config"
|
||||||
"Open_IM/src/grpc-etcdv3/getcdv3"
|
"Open_IM/pkg/common/constant"
|
||||||
pbChat "Open_IM/src/proto/chat"
|
"Open_IM/pkg/common/log"
|
||||||
pbGroup "Open_IM/src/proto/group"
|
pbChat "Open_IM/pkg/proto/chat"
|
||||||
pbRelay "Open_IM/src/proto/relay"
|
pbGroup "Open_IM/pkg/proto/group"
|
||||||
pbGetInfo "Open_IM/src/proto/user"
|
pbRelay "Open_IM/pkg/proto/relay"
|
||||||
rpcChat "Open_IM/src/rpc/chat/chat"
|
pbGetInfo "Open_IM/pkg/proto/user"
|
||||||
"Open_IM/src/rpc/user/internal_service"
|
"Open_IM/pkg/utils"
|
||||||
"Open_IM/src/utils"
|
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
@ -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,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,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,11 +1,11 @@
|
|||||||
package rpcAuth
|
package auth
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/src/common/config"
|
"Open_IM/pkg/common/config"
|
||||||
log2 "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"
|
||||||
"Open_IM/src/utils"
|
"Open_IM/pkg/utils"
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
"net"
|
"net"
|
||||||
"strconv"
|
"strconv"
|
||||||
@ -20,24 +20,25 @@ type rpcAuth struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func NewRpcAuthServer(port int) *rpcAuth {
|
func NewRpcAuthServer(port int) *rpcAuth {
|
||||||
|
log.NewPrivateLog("auth")
|
||||||
return &rpcAuth{
|
return &rpcAuth{
|
||||||
rpcPort: port,
|
rpcPort: port,
|
||||||
rpcRegisterName: config.Config.RpcRegisterName.RpcGetTokenName,
|
rpcRegisterName: config.Config.RpcRegisterName.OpenImAuthName,
|
||||||
etcdSchema: config.Config.Etcd.EtcdSchema,
|
etcdSchema: config.Config.Etcd.EtcdSchema,
|
||||||
etcdAddr: config.Config.Etcd.EtcdAddr,
|
etcdAddr: config.Config.Etcd.EtcdAddr,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (rpc *rpcAuth) Run() {
|
func (rpc *rpcAuth) Run() {
|
||||||
log2.Info("", "", "rpc get_token init...")
|
log.Info("", "", "rpc get_token init...")
|
||||||
|
|
||||||
address := utils.ServerIP + ":" + strconv.Itoa(rpc.rpcPort)
|
address := utils.ServerIP + ":" + strconv.Itoa(rpc.rpcPort)
|
||||||
listener, err := net.Listen("tcp", address)
|
listener, err := net.Listen("tcp", address)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log2.Error("", "", "listen network failed, err = %s, address = %s", err.Error(), address)
|
log.Error("", "", "listen network failed, err = %s, address = %s", err.Error(), address)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
log2.Info("", "", "listen network success, address = %s", address)
|
log.Info("", "", "listen network success, address = %s", address)
|
||||||
|
|
||||||
//grpc server
|
//grpc server
|
||||||
srv := grpc.NewServer()
|
srv := grpc.NewServer()
|
||||||
@ -48,14 +49,14 @@ func (rpc *rpcAuth) Run() {
|
|||||||
pbAuth.RegisterAuthServer(srv, rpc)
|
pbAuth.RegisterAuthServer(srv, rpc)
|
||||||
err = getcdv3.RegisterEtcd(rpc.etcdSchema, strings.Join(rpc.etcdAddr, ","), utils.ServerIP, rpc.rpcPort, rpc.rpcRegisterName, 10)
|
err = getcdv3.RegisterEtcd(rpc.etcdSchema, strings.Join(rpc.etcdAddr, ","), utils.ServerIP, rpc.rpcPort, rpc.rpcRegisterName, 10)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log2.Error("", "", "register rpc get_token to etcd failed, err = %s", err.Error())
|
log.Error("", "", "register rpc get_token to etcd failed, err = %s", err.Error())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
err = srv.Serve(listener)
|
err = srv.Serve(listener)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log2.Info("", "", "rpc get_token fail, err = %s", err.Error())
|
log.Info("", "", "rpc get_token fail, err = %s", err.Error())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
log2.Info("", "", "rpc get_token init success")
|
log.Info("", "", "rpc get_token init success")
|
||||||
}
|
}
|
@ -1,9 +1,9 @@
|
|||||||
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"
|
||||||
)
|
)
|
||||||
|
|
@ -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"
|
pbAuth "Open_IM/pkg/proto/auth"
|
||||||
"Open_IM/src/utils"
|
"Open_IM/pkg/utils"
|
||||||
"context"
|
"context"
|
||||||
)
|
)
|
||||||
|
|
@ -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) GetNewSeq(_ context.Context, in *pbMsg.GetNewSeqReq) (*pbMsg.GetNewSeqResp, error) {
|
func (rpc *rpcChat) GetNewSeq(_ context.Context, in *pbMsg.GetNewSeqReq) (*pbMsg.GetNewSeqResp, error) {
|
@ -1,12 +1,12 @@
|
|||||||
package rpcChat
|
package chat
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/src/common/config"
|
"Open_IM/pkg/common/config"
|
||||||
"Open_IM/src/common/kafka"
|
"Open_IM/pkg/common/kafka"
|
||||||
log2 "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"
|
||||||
"Open_IM/src/utils"
|
"Open_IM/pkg/utils"
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
"net"
|
"net"
|
||||||
"strconv"
|
"strconv"
|
||||||
@ -22,6 +22,7 @@ type rpcChat struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func NewRpcChatServer(port int) *rpcChat {
|
func NewRpcChatServer(port int) *rpcChat {
|
||||||
|
log.NewPrivateLog("msg")
|
||||||
rc := rpcChat{
|
rc := rpcChat{
|
||||||
rpcPort: port,
|
rpcPort: port,
|
||||||
rpcRegisterName: config.Config.RpcRegisterName.OpenImOfflineMessageName,
|
rpcRegisterName: config.Config.RpcRegisterName.OpenImOfflineMessageName,
|
||||||
@ -33,15 +34,15 @@ func NewRpcChatServer(port int) *rpcChat {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (rpc *rpcChat) Run() {
|
func (rpc *rpcChat) Run() {
|
||||||
log2.Info("", "", "rpc get_token init...")
|
log.Info("", "", "rpc get_token init...")
|
||||||
|
|
||||||
address := utils.ServerIP + ":" + strconv.Itoa(rpc.rpcPort)
|
address := utils.ServerIP + ":" + strconv.Itoa(rpc.rpcPort)
|
||||||
listener, err := net.Listen("tcp", address)
|
listener, err := net.Listen("tcp", address)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log2.Error("", "", "listen network failed, err = %s, address = %s", err.Error(), address)
|
log.Error("", "", "listen network failed, err = %s, address = %s", err.Error(), address)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
log2.Info("", "", "listen network success, address = %s", address)
|
log.Info("", "", "listen network success, address = %s", address)
|
||||||
|
|
||||||
//grpc server
|
//grpc server
|
||||||
srv := grpc.NewServer()
|
srv := grpc.NewServer()
|
||||||
@ -52,14 +53,14 @@ func (rpc *rpcChat) Run() {
|
|||||||
pbChat.RegisterChatServer(srv, rpc)
|
pbChat.RegisterChatServer(srv, rpc)
|
||||||
err = getcdv3.RegisterEtcd(rpc.etcdSchema, strings.Join(rpc.etcdAddr, ","), utils.ServerIP, rpc.rpcPort, rpc.rpcRegisterName, 10)
|
err = getcdv3.RegisterEtcd(rpc.etcdSchema, strings.Join(rpc.etcdAddr, ","), utils.ServerIP, rpc.rpcPort, rpc.rpcRegisterName, 10)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log2.Error("", "", "register rpc get_token to etcd failed, err = %s", err.Error())
|
log.Error("", "", "register rpc get_token to etcd failed, err = %s", err.Error())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
err = srv.Serve(listener)
|
err = srv.Serve(listener)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log2.Info("", "", "rpc get_token fail, err = %s", err.Error())
|
log.Info("", "", "rpc get_token fail, err = %s", err.Error())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
log2.Info("", "", "rpc get_token init success")
|
log.Info("", "", "rpc get_token init success")
|
||||||
}
|
}
|
@ -1,16 +1,16 @@
|
|||||||
package rpcChat
|
package chat
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/src/api/group"
|
"Open_IM/internal/api/group"
|
||||||
"Open_IM/src/common/config"
|
"Open_IM/internal/push/content_struct"
|
||||||
"Open_IM/src/common/constant"
|
"Open_IM/pkg/common/config"
|
||||||
http2 "Open_IM/src/common/http"
|
"Open_IM/pkg/common/constant"
|
||||||
"Open_IM/src/common/log"
|
http2 "Open_IM/pkg/common/http"
|
||||||
"Open_IM/src/grpc-etcdv3/getcdv3"
|
"Open_IM/pkg/common/log"
|
||||||
pbChat "Open_IM/src/proto/chat"
|
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
||||||
pbGroup "Open_IM/src/proto/group"
|
pbChat "Open_IM/pkg/proto/chat"
|
||||||
"Open_IM/src/push/content_struct"
|
pbGroup "Open_IM/pkg/proto/group"
|
||||||
"Open_IM/src/utils"
|
"Open_IM/pkg/utils"
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"math/rand"
|
"math/rand"
|
@ -1,11 +1,11 @@
|
|||||||
package friend
|
package friend
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/src/common/config"
|
"Open_IM/pkg/common/config"
|
||||||
"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"
|
||||||
pbFriend "Open_IM/src/proto/friend"
|
pbFriend "Open_IM/pkg/proto/friend"
|
||||||
"Open_IM/src/utils"
|
"Open_IM/pkg/utils"
|
||||||
"context"
|
"context"
|
||||||
)
|
)
|
||||||
|
|
@ -1,15 +1,15 @@
|
|||||||
package friend
|
package friend
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/src/common/config"
|
"Open_IM/internal/push/content_struct"
|
||||||
"Open_IM/src/common/constant"
|
"Open_IM/internal/push/logic"
|
||||||
"Open_IM/src/common/db/mysql_model/im_mysql_model"
|
"Open_IM/pkg/common/config"
|
||||||
"Open_IM/src/common/log"
|
"Open_IM/pkg/common/constant"
|
||||||
pbChat "Open_IM/src/proto/chat"
|
"Open_IM/pkg/common/db/mysql_model/im_mysql_model"
|
||||||
pbFriend "Open_IM/src/proto/friend"
|
"Open_IM/pkg/common/log"
|
||||||
"Open_IM/src/push/content_struct"
|
pbChat "Open_IM/pkg/proto/chat"
|
||||||
"Open_IM/src/push/logic"
|
pbFriend "Open_IM/pkg/proto/friend"
|
||||||
"Open_IM/src/utils"
|
"Open_IM/pkg/utils"
|
||||||
"context"
|
"context"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -110,6 +110,10 @@ func (s *friendServer) ImportFriend(ctx context.Context, req *pbFriend.ImportFri
|
|||||||
SessionType: constant.SingleChatType,
|
SessionType: constant.SingleChatType,
|
||||||
OperationID: req.OperationID,
|
OperationID: req.OperationID,
|
||||||
})
|
})
|
||||||
|
} else {
|
||||||
|
resp.CommonResp.ErrorMsg = "some uid establish failed"
|
||||||
|
resp.CommonResp.ErrorCode = 408
|
||||||
|
resp.FailedUidList = append(resp.FailedUidList, v)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,15 +1,15 @@
|
|||||||
package friend
|
package friend
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/src/common/config"
|
"Open_IM/internal/push/content_struct"
|
||||||
"Open_IM/src/common/constant"
|
"Open_IM/internal/push/logic"
|
||||||
"Open_IM/src/common/db/mysql_model/im_mysql_model"
|
"Open_IM/pkg/common/config"
|
||||||
"Open_IM/src/common/log"
|
"Open_IM/pkg/common/constant"
|
||||||
pbChat "Open_IM/src/proto/chat"
|
"Open_IM/pkg/common/db/mysql_model/im_mysql_model"
|
||||||
pbFriend "Open_IM/src/proto/friend"
|
"Open_IM/pkg/common/log"
|
||||||
"Open_IM/src/push/content_struct"
|
pbChat "Open_IM/pkg/proto/chat"
|
||||||
"Open_IM/src/push/logic"
|
pbFriend "Open_IM/pkg/proto/friend"
|
||||||
"Open_IM/src/utils"
|
"Open_IM/pkg/utils"
|
||||||
"context"
|
"context"
|
||||||
)
|
)
|
||||||
|
|
@ -1,11 +1,11 @@
|
|||||||
package friend
|
package friend
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/src/common/config"
|
"Open_IM/pkg/common/config"
|
||||||
"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"
|
||||||
pbFriend "Open_IM/src/proto/friend"
|
pbFriend "Open_IM/pkg/proto/friend"
|
||||||
"Open_IM/src/utils"
|
"Open_IM/pkg/utils"
|
||||||
"context"
|
"context"
|
||||||
)
|
)
|
||||||
|
|
@ -1,11 +1,11 @@
|
|||||||
package friend
|
package friend
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/src/common/config"
|
"Open_IM/pkg/common/config"
|
||||||
"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"
|
||||||
pbFriend "Open_IM/src/proto/friend"
|
pbFriend "Open_IM/pkg/proto/friend"
|
||||||
"Open_IM/src/utils"
|
"Open_IM/pkg/utils"
|
||||||
"context"
|
"context"
|
||||||
)
|
)
|
||||||
|
|
@ -1,13 +1,13 @@
|
|||||||
package friend
|
package friend
|
||||||
|
|
||||||
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_model"
|
"Open_IM/pkg/common/db/mysql_model/im_mysql_model"
|
||||||
"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"
|
||||||
"Open_IM/src/utils"
|
"Open_IM/pkg/utils"
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
@ -24,6 +24,7 @@ type friendServer struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func NewFriendServer(port int) *friendServer {
|
func NewFriendServer(port int) *friendServer {
|
||||||
|
log.NewPrivateLog("friend")
|
||||||
return &friendServer{
|
return &friendServer{
|
||||||
rpcPort: port,
|
rpcPort: port,
|
||||||
rpcRegisterName: config.Config.RpcRegisterName.OpenImFriendName,
|
rpcRegisterName: config.Config.RpcRegisterName.OpenImFriendName,
|
@ -1,11 +1,11 @@
|
|||||||
package friend
|
package friend
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/src/common/config"
|
"Open_IM/pkg/common/config"
|
||||||
"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"
|
||||||
pbFriend "Open_IM/src/proto/friend"
|
pbFriend "Open_IM/pkg/proto/friend"
|
||||||
"Open_IM/src/utils"
|
"Open_IM/pkg/utils"
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"strconv"
|
"strconv"
|
@ -1,12 +1,12 @@
|
|||||||
package friend
|
package friend
|
||||||
|
|
||||||
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_model"
|
"Open_IM/pkg/common/db/mysql_model/im_mysql_model"
|
||||||
"Open_IM/src/common/log"
|
"Open_IM/pkg/common/log"
|
||||||
pbFriend "Open_IM/src/proto/friend"
|
pbFriend "Open_IM/pkg/proto/friend"
|
||||||
"Open_IM/src/utils"
|
"Open_IM/pkg/utils"
|
||||||
"context"
|
"context"
|
||||||
)
|
)
|
||||||
|
|
@ -1,12 +1,12 @@
|
|||||||
package friend
|
package friend
|
||||||
|
|
||||||
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_model"
|
"Open_IM/pkg/common/db/mysql_model/im_mysql_model"
|
||||||
"Open_IM/src/common/log"
|
"Open_IM/pkg/common/log"
|
||||||
pbFriend "Open_IM/src/proto/friend"
|
pbFriend "Open_IM/pkg/proto/friend"
|
||||||
"Open_IM/src/utils"
|
"Open_IM/pkg/utils"
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
)
|
)
|
@ -1,9 +1,9 @@
|
|||||||
package friend
|
package friend
|
||||||
|
|
||||||
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"
|
||||||
pbFriend "Open_IM/src/proto/friend"
|
pbFriend "Open_IM/pkg/proto/friend"
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
)
|
)
|
@ -1,11 +1,11 @@
|
|||||||
package friend
|
package friend
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/src/common/config"
|
"Open_IM/pkg/common/config"
|
||||||
"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"
|
||||||
pbFriend "Open_IM/src/proto/friend"
|
pbFriend "Open_IM/pkg/proto/friend"
|
||||||
"Open_IM/src/utils"
|
"Open_IM/pkg/utils"
|
||||||
"context"
|
"context"
|
||||||
)
|
)
|
||||||
|
|
@ -1,11 +1,11 @@
|
|||||||
package friend
|
package friend
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/src/common/config"
|
"Open_IM/pkg/common/config"
|
||||||
"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"
|
||||||
pbFriend "Open_IM/src/proto/friend"
|
pbFriend "Open_IM/pkg/proto/friend"
|
||||||
"Open_IM/src/utils"
|
"Open_IM/pkg/utils"
|
||||||
"context"
|
"context"
|
||||||
)
|
)
|
||||||
|
|
@ -1,17 +1,17 @@
|
|||||||
package group
|
package group
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/src/common/config"
|
"Open_IM/internal/push/content_struct"
|
||||||
"Open_IM/src/common/constant"
|
"Open_IM/internal/push/logic"
|
||||||
"Open_IM/src/common/db"
|
"Open_IM/pkg/common/config"
|
||||||
"Open_IM/src/common/db/mysql_model/im_mysql_model"
|
"Open_IM/pkg/common/constant"
|
||||||
"Open_IM/src/common/log"
|
"Open_IM/pkg/common/db"
|
||||||
"Open_IM/src/grpc-etcdv3/getcdv3"
|
"Open_IM/pkg/common/db/mysql_model/im_mysql_model"
|
||||||
pbChat "Open_IM/src/proto/chat"
|
"Open_IM/pkg/common/log"
|
||||||
pbGroup "Open_IM/src/proto/group"
|
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
||||||
"Open_IM/src/push/content_struct"
|
pbChat "Open_IM/pkg/proto/chat"
|
||||||
"Open_IM/src/push/logic"
|
pbGroup "Open_IM/pkg/proto/group"
|
||||||
"Open_IM/src/utils"
|
"Open_IM/pkg/utils"
|
||||||
"context"
|
"context"
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
"net"
|
"net"
|
||||||
@ -28,6 +28,7 @@ type groupServer struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func NewGroupServer(port int) *groupServer {
|
func NewGroupServer(port int) *groupServer {
|
||||||
|
log.NewPrivateLog("group")
|
||||||
return &groupServer{
|
return &groupServer{
|
||||||
rpcPort: port,
|
rpcPort: port,
|
||||||
rpcRegisterName: config.Config.RpcRegisterName.OpenImGroupName,
|
rpcRegisterName: config.Config.RpcRegisterName.OpenImGroupName,
|
@ -1,9 +1,9 @@
|
|||||||
package group
|
package group
|
||||||
|
|
||||||
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"
|
||||||
"Open_IM/src/proto/group"
|
"Open_IM/pkg/proto/group"
|
||||||
"context"
|
"context"
|
||||||
)
|
)
|
||||||
|
|
@ -1,11 +1,11 @@
|
|||||||
package group
|
package group
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/src/common/config"
|
"Open_IM/pkg/common/config"
|
||||||
"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"
|
||||||
pbGroup "Open_IM/src/proto/group"
|
pbGroup "Open_IM/pkg/proto/group"
|
||||||
"Open_IM/src/utils"
|
"Open_IM/pkg/utils"
|
||||||
"context"
|
"context"
|
||||||
)
|
)
|
||||||
|
|
@ -1,18 +1,18 @@
|
|||||||
package group
|
package group
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/src/common/config"
|
"Open_IM/internal/push/content_struct"
|
||||||
"Open_IM/src/common/constant"
|
"Open_IM/internal/push/logic"
|
||||||
"Open_IM/src/common/db"
|
"Open_IM/pkg/common/config"
|
||||||
pbChat "Open_IM/src/proto/chat"
|
"Open_IM/pkg/common/constant"
|
||||||
"Open_IM/src/push/content_struct"
|
"Open_IM/pkg/common/db"
|
||||||
"Open_IM/src/push/logic"
|
pbChat "Open_IM/pkg/proto/chat"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
|
||||||
imdb "Open_IM/src/common/db/mysql_model/im_mysql_model"
|
imdb "Open_IM/pkg/common/db/mysql_model/im_mysql_model"
|
||||||
"Open_IM/src/common/log"
|
"Open_IM/pkg/common/log"
|
||||||
pbGroup "Open_IM/src/proto/group"
|
pbGroup "Open_IM/pkg/proto/group"
|
||||||
"Open_IM/src/utils"
|
"Open_IM/pkg/utils"
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -81,7 +81,7 @@ func (s *groupServer) InviteUserToGroup(ctx context.Context, req *pbGroup.Invite
|
|||||||
log.Error(claims.UID, req.OperationID, "FindUserByUID failed, err: ", err.Error())
|
log.Error(claims.UID, req.OperationID, "FindUserByUID failed, err: ", err.Error())
|
||||||
return &pbGroup.InviteUserToGroupResp{ErrorCode: config.ErrParam.ErrCode, ErrorMsg: config.ErrParam.ErrMsg}, nil
|
return &pbGroup.InviteUserToGroupResp{ErrorCode: config.ErrParam.ErrCode, ErrorMsg: config.ErrParam.ErrMsg}, nil
|
||||||
}*/
|
}*/
|
||||||
|
var nicknameList string
|
||||||
for _, v := range req.UidList {
|
for _, v := range req.UidList {
|
||||||
var resultNode pbGroup.Id2Result
|
var resultNode pbGroup.Id2Result
|
||||||
resultNode.UId = v
|
resultNode.UId = v
|
||||||
@ -113,7 +113,7 @@ func (s *groupServer) InviteUserToGroup(ctx context.Context, req *pbGroup.Invite
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("", "", "add mongo group member failed, db.DB.AddGroupMember fail [err: %s]", err.Error())
|
log.Error("", "", "add mongo group member failed, db.DB.AddGroupMember fail [err: %s]", err.Error())
|
||||||
}
|
}
|
||||||
|
nicknameList = nicknameList + toUserInfo.Name + " "
|
||||||
resp.Id2Result = append(resp.Id2Result, &resultNode)
|
resp.Id2Result = append(resp.Id2Result, &resultNode)
|
||||||
}
|
}
|
||||||
resp.ErrorCode = 0
|
resp.ErrorCode = 0
|
||||||
@ -121,12 +121,13 @@ func (s *groupServer) InviteUserToGroup(ctx context.Context, req *pbGroup.Invite
|
|||||||
|
|
||||||
//if claims.UID == config.Config.AppManagerUid
|
//if claims.UID == config.Config.AppManagerUid
|
||||||
if utils.IsContain(claims.UID, config.Config.Manager.AppManagerUid) {
|
if utils.IsContain(claims.UID, config.Config.Manager.AppManagerUid) {
|
||||||
|
m, _ := imdb.FindUserByUID(claims.UID)
|
||||||
var iu inviteUserToGroupReq
|
var iu inviteUserToGroupReq
|
||||||
iu.GroupID = req.GroupID
|
iu.GroupID = req.GroupID
|
||||||
iu.OperationID = req.OperationID
|
iu.OperationID = req.OperationID
|
||||||
iu.Reason = req.Reason
|
iu.Reason = req.Reason
|
||||||
iu.UidList = req.UidList
|
iu.UidList = req.UidList
|
||||||
n := content_struct.NotificationContent{1, req.GroupID, iu.ContentToString()}
|
n := content_struct.NotificationContent{1, nicknameList + " invited into the group chat by " + m.Name, iu.ContentToString()}
|
||||||
logic.SendMsgByWS(&pbChat.WSToMsgSvrChatMsg{
|
logic.SendMsgByWS(&pbChat.WSToMsgSvrChatMsg{
|
||||||
SendID: claims.UID,
|
SendID: claims.UID,
|
||||||
RecvID: req.GroupID,
|
RecvID: req.GroupID,
|
@ -1,10 +1,10 @@
|
|||||||
package group
|
package group
|
||||||
|
|
||||||
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"
|
||||||
"Open_IM/src/proto/group"
|
"Open_IM/pkg/proto/group"
|
||||||
"context"
|
"context"
|
||||||
)
|
)
|
||||||
|
|
@ -1,11 +1,11 @@
|
|||||||
package group
|
package group
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/src/common/config"
|
"Open_IM/pkg/common/config"
|
||||||
"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"
|
||||||
pbGroup "Open_IM/src/proto/group"
|
pbGroup "Open_IM/pkg/proto/group"
|
||||||
"Open_IM/src/utils"
|
"Open_IM/pkg/utils"
|
||||||
"context"
|
"context"
|
||||||
)
|
)
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user