Merge branch 'tuoyun' of github.com:OpenIMSDK/Open-IM-Server into tuoyun

pull/232/head
wangchuxiao 3 years ago
commit 0b4ba548a5

@ -1 +1 @@
Subproject commit fddfa30348d77fe7d5767ef410b1f30d042062bf Subproject commit b0897aa3abe719729c2ce099404f08806917bfe3

@ -4,7 +4,7 @@
serverversion: 2.0.0 serverversion: 2.0.0
#---------------Infrastructure configuration---------------------# #---------------Infrastructure configuration---------------------#
etcd: etcd:
etcdSchema: openIM #默认即可 etcdSchema: openim #默认即可
etcdAddr: [ 127.0.0.1:2379 ] #单机部署时,默认即可 etcdAddr: [ 127.0.0.1:2379 ] #单机部署时,默认即可
mysql: mysql:
@ -150,7 +150,7 @@ rpcregistername: #rpc注册服务名默认即可
openImOrganizationName: Organization openImOrganizationName: Organization
openImConversationName: Conversation openImConversationName: Conversation
openImCacheName: Cache openImCacheName: Cache
openImRealTimeCommName: RealTimeComm
log: log:
storageLocation: ../logs/ storageLocation: ../logs/
rotationTime: 24 rotationTime: 24

@ -11,8 +11,6 @@ require (
github.com/alibabacloud-go/tea v1.1.17 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/bwmarrin/snowflake v0.3.0
github.com/coreos/etcd v3.3.27+incompatible // indirect
github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f // 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
@ -34,8 +32,6 @@ require (
github.com/lestrrat-go/file-rotatelogs v2.4.0+incompatible github.com/lestrrat-go/file-rotatelogs v2.4.0+incompatible
github.com/lestrrat-go/strftime v1.0.4 // indirect github.com/lestrrat-go/strftime v1.0.4 // indirect
github.com/lib/pq v1.2.0 // indirect github.com/lib/pq v1.2.0 // indirect
//github.com/livekit/protocol v0.11.14-0.20220223195254-d8c251e13231 // indirect
//github.com/livekit/server-sdk-go v0.9.1
github.com/mattn/go-sqlite3 v1.14.6 // indirect github.com/mattn/go-sqlite3 v1.14.6 // indirect
github.com/minio/minio-go/v7 v7.0.22 github.com/minio/minio-go/v7 v7.0.22
github.com/mitchellh/mapstructure v1.4.2 github.com/mitchellh/mapstructure v1.4.2
@ -46,24 +42,22 @@ require (
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.8.1 github.com/sirupsen/logrus v1.8.1
github.com/spf13/viper v1.9.0
github.com/stretchr/testify v1.7.0 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 go.etcd.io/etcd/api/v3 v3.5.4
//go.etcd.io/etcd v3.3.27+incompatible go.etcd.io/etcd/client/v3 v3.5.4
go.etcd.io/etcd v0.0.0-20200402134248-51bdeb39e698
go.mongodb.org/mongo-driver v1.8.3 go.mongodb.org/mongo-driver v1.8.3
golang.org/x/crypto v0.0.0-20210817164053-32db794688a5 // indirect
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-20220127200216-cd36cc0744dd golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd
google.golang.org/genproto v0.0.0-20210828152312-66f60bf46e71 // indirect
google.golang.org/grpc v1.42.0 google.golang.org/grpc v1.42.0
google.golang.org/grpc/examples v0.0.0-20220311002955-722367c4a737 // indirect
google.golang.org/protobuf v1.27.1 google.golang.org/protobuf v1.27.1
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect
gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df
gopkg.in/ini.v1 v1.66.2 // indirect gopkg.in/ini.v1 v1.66.2 // indirect
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-20210107192922-496545a6307b gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b
sigs.k8s.io/yaml v1.2.0 // indirect
) )
replace google.golang.org/grpc => google.golang.org/grpc v1.29.0 replace google.golang.org/grpc => google.golang.org/grpc v1.29.0

669
go.sum

File diff suppressed because it is too large Load Diff

@ -14,9 +14,7 @@ import (
"encoding/gob" "encoding/gob"
"github.com/golang/protobuf/proto" "github.com/golang/protobuf/proto"
"github.com/gorilla/websocket" "github.com/gorilla/websocket"
"google.golang.org/grpc"
"runtime" "runtime"
"strconv"
"strings" "strings"
) )
@ -205,21 +203,15 @@ func (ws *WServer) sendSignalMsgReq(conn *UserConn, m *Req) {
isPass, errCode, errMsg, pData := ws.argsValidate(m, constant.WSSendSignalMsg) isPass, errCode, errMsg, pData := ws.argsValidate(m, constant.WSSendSignalMsg)
if isPass { if isPass {
signalResp := pbRtc.SignalResp{} signalResp := pbRtc.SignalResp{}
//isPass2, errCode2, errMsg2, signalResp, msgData := ws.signalMessageAssemble(pData.(*sdk_ws.SignalReq), m.OperationID) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImRealTimeCommName)
connGrpc, err := grpc.Dial(config.Config.Rtc.Address+":"+strconv.Itoa(config.Config.Rtc.Port), grpc.WithInsecure()) rtcClient := pbRtc.NewRtcServiceClient(etcdConn)
if err != nil {
log.NewError(m.OperationID, utils.GetSelfFuncName(), "grpc.Dial failed", err.Error())
ws.sendSignalMsgResp(conn, 204, "create grpc failed"+err.Error(), m, nil)
return
}
rtcClient := pbRtc.NewRtcServiceClient(connGrpc)
req := &pbRtc.SignalMessageAssembleReq{ req := &pbRtc.SignalMessageAssembleReq{
SignalReq: pData.(*pbRtc.SignalReq), SignalReq: pData.(*pbRtc.SignalReq),
OperationID: m.OperationID, OperationID: m.OperationID,
} }
respPb, err := rtcClient.SignalMessageAssemble(context.Background(), req) respPb, err := rtcClient.SignalMessageAssemble(context.Background(), req)
if err != nil { if err != nil {
log.NewError(m.OperationID, utils.GetSelfFuncName(), "SignalMessageAssemble", err.Error(), config.Config.Rtc.Address+":"+strconv.Itoa(config.Config.Rtc.Port)) log.NewError(m.OperationID, utils.GetSelfFuncName(), "SignalMessageAssemble", err.Error(), config.Config.RpcRegisterName.OpenImRealTimeCommName)
ws.sendSignalMsgResp(conn, 204, "grpc SignalMessageAssemble failed: "+err.Error(), m, &signalResp) ws.sendSignalMsgResp(conn, 204, "grpc SignalMessageAssemble failed: "+err.Error(), m, &signalResp)
return return
} }

@ -6,7 +6,6 @@ import (
"path/filepath" "path/filepath"
"runtime" "runtime"
"github.com/spf13/viper"
"gopkg.in/yaml.v3" "gopkg.in/yaml.v3"
) )
@ -120,6 +119,7 @@ type config struct {
OpenImOrganizationName string `yaml:"openImOrganizationName"` OpenImOrganizationName string `yaml:"openImOrganizationName"`
OpenImConversationName string `yaml:"openImConversationName"` OpenImConversationName string `yaml:"openImConversationName"`
OpenImCacheName string `yaml:"openImCacheName"` OpenImCacheName string `yaml:"openImCacheName"`
OpenImRealTimeCommName string `yaml:"openImRealTimeCommName"`
} }
Etcd struct { Etcd struct {
EtcdSchema string `yaml:"etcdSchema"` EtcdSchema string `yaml:"etcdSchema"`
@ -429,21 +429,11 @@ type PDefaultTips struct {
} }
func init() { func init() {
//path, _ := os.Getwd()
//bytes, err := ioutil.ReadFile(path + "/config/config.yaml")
// if we cd Open-IM-Server/src/utils and run go test
// it will panic cannot find config/config.yaml
cfgName := os.Getenv("CONFIG_NAME") cfgName := os.Getenv("CONFIG_NAME")
if len(cfgName) == 0 { if len(cfgName) == 0 {
cfgName = Root + "/config/config.yaml" cfgName = Root + "/config/config.yaml"
} }
viper.SetConfigFile(cfgName)
err := viper.ReadInConfig()
if err != nil {
panic(err.Error())
}
bytes, err := ioutil.ReadFile(cfgName) bytes, err := ioutil.ReadFile(cfgName)
if err != nil { if err != nil {
panic(err.Error()) panic(err.Error())

@ -4,7 +4,7 @@ import (
"Open_IM/pkg/common/log" "Open_IM/pkg/common/log"
"context" "context"
"fmt" "fmt"
"go.etcd.io/etcd/clientv3" clientv3 "go.etcd.io/etcd/client/v3"
"net" "net"
"strconv" "strconv"
"strings" "strings"

@ -4,8 +4,10 @@ import (
"Open_IM/pkg/common/log" "Open_IM/pkg/common/log"
"context" "context"
"fmt" "fmt"
"go.etcd.io/etcd/clientv3" "go.etcd.io/etcd/api/v3/mvccpb"
"go.etcd.io/etcd/mvcc/mvccpb" clientv3 "go.etcd.io/etcd/client/v3"
//"go.etcd.io/etcd/mvcc/mvccpb"
//"google.golang.org/genproto/googleapis/ads/googleads/v1/services" //"google.golang.org/genproto/googleapis/ads/googleads/v1/services"
"google.golang.org/grpc" "google.golang.org/grpc"
"google.golang.org/grpc/balancer/roundrobin" "google.golang.org/grpc/balancer/roundrobin"

Loading…
Cancel
Save