Skip to content

Commit ad47590

Browse files
committed
feat: add openim docker
Signed-off-by: Xinwei Xiong (cubxxw) <[email protected]>
1 parent a42a44e commit ad47590

File tree

36 files changed

+113
-77
lines changed

36 files changed

+113
-77
lines changed

Diff for: internal/api/msg.go

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import (
2727
"github.com/gin-gonic/gin"
2828
"github.com/go-playground/validator/v10"
2929
"github.com/mitchellh/mapstructure"
30+
3031
"github.com/openimsdk/open-im-server/v3/pkg/authverify"
3132
"github.com/openimsdk/open-im-server/v3/pkg/common/config"
3233

Diff for: internal/push/push_rpc_server.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,10 @@ package push
1616

1717
import (
1818
"context"
19-
"github.com/OpenIMSDK/tools/utils"
2019
"sync"
2120

21+
"github.com/OpenIMSDK/tools/utils"
22+
2223
"google.golang.org/grpc"
2324

2425
"github.com/OpenIMSDK/protocol/constant"

Diff for: internal/rpc/friend/callback.go

+2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@ package friend
1616

1717
import (
1818
"context"
19+
1920
pbfriend "github.com/OpenIMSDK/protocol/friend"
2021
"github.com/OpenIMSDK/tools/utils"
22+
2123
cbapi "github.com/openimsdk/open-im-server/v3/pkg/callbackstruct"
2224
"github.com/openimsdk/open-im-server/v3/pkg/common/config"
2325
"github.com/openimsdk/open-im-server/v3/pkg/common/http"

Diff for: internal/rpc/friend/friend.go

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ package friend
1616

1717
import (
1818
"context"
19+
1920
"github.com/OpenIMSDK/tools/tx"
2021

2122
"github.com/OpenIMSDK/protocol/sdkws"

Diff for: internal/rpc/group/callback.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,10 @@ package group
1616

1717
import (
1818
"context"
19-
"github.com/OpenIMSDK/tools/log"
2019
"time"
2120

21+
"github.com/OpenIMSDK/tools/log"
22+
2223
"github.com/OpenIMSDK/protocol/constant"
2324
"github.com/OpenIMSDK/protocol/group"
2425
"github.com/OpenIMSDK/protocol/wrapperspb"

Diff for: internal/rpc/group/group.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,14 @@ package group
1717
import (
1818
"context"
1919
"fmt"
20-
"github.com/openimsdk/open-im-server/v3/pkg/callbackstruct"
2120
"math/big"
2221
"math/rand"
2322
"strconv"
2423
"strings"
2524
"time"
2625

26+
"github.com/openimsdk/open-im-server/v3/pkg/callbackstruct"
27+
2728
pbconversation "github.com/OpenIMSDK/protocol/conversation"
2829
"github.com/OpenIMSDK/protocol/wrapperspb"
2930
"github.com/OpenIMSDK/tools/tx"

Diff for: internal/rpc/msg/as_read.go

+5-3
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,18 @@ package msg
1616

1717
import (
1818
"context"
19+
1920
utils2 "github.com/OpenIMSDK/tools/utils"
2021

2122
"github.com/redis/go-redis/v9"
2223

23-
cbapi "github.com/openimsdk/open-im-server/v3/pkg/callbackstruct"
2424
"github.com/OpenIMSDK/protocol/constant"
2525
"github.com/OpenIMSDK/protocol/msg"
2626
"github.com/OpenIMSDK/protocol/sdkws"
2727
"github.com/OpenIMSDK/tools/errs"
2828
"github.com/OpenIMSDK/tools/log"
29+
30+
cbapi "github.com/openimsdk/open-im-server/v3/pkg/callbackstruct"
2931
)
3032

3133
func (m *msgServer) GetConversationsHasReadAndMaxSeq(ctx context.Context, req *msg.GetConversationsHasReadAndMaxSeqReq) (resp *msg.GetConversationsHasReadAndMaxSeqResp, err error) {
@@ -173,7 +175,7 @@ func (m *msgServer) MarkConversationAsRead(
173175
m.conversationAndGetRecvID(conversation, req.UserID), seqs, hasReadSeq); err != nil {
174176
return nil, err
175177
}
176-
178+
177179
} else if conversation.ConversationType == constant.SuperGroupChatType ||
178180
conversation.ConversationType == constant.NotificationChatType {
179181
if req.HasReadSeq > hasReadSeq {
@@ -222,4 +224,4 @@ func (m *msgServer) sendMarkAsReadNotification(
222224
log.ZWarn(ctx, "send has read Receipt err", err)
223225
}
224226
return nil
225-
}
227+
}

Diff for: internal/rpc/msg/callback.go

+2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ package msg
1616

1717
import (
1818
"context"
19+
1920
"github.com/OpenIMSDK/protocol/sdkws"
2021
"google.golang.org/protobuf/proto"
2122

@@ -24,6 +25,7 @@ import (
2425
"github.com/OpenIMSDK/tools/log"
2526
"github.com/OpenIMSDK/tools/mcontext"
2627
"github.com/OpenIMSDK/tools/utils"
28+
2729
cbapi "github.com/openimsdk/open-im-server/v3/pkg/callbackstruct"
2830

2931
"github.com/openimsdk/open-im-server/v3/pkg/common/config"

Diff for: internal/rpc/user/callback.go

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ package user
1616

1717
import (
1818
"context"
19+
1920
pbuser "github.com/OpenIMSDK/protocol/user"
2021
"github.com/OpenIMSDK/tools/utils"
2122

Diff for: pkg/apistruct/msg.go

+18-18
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ package apistruct
1616

1717
type PictureBaseInfo struct {
1818
UUID string `mapstructure:"uuid"`
19-
Type string `mapstructure:"type" validate:"required"`
19+
Type string `mapstructure:"type" validate:"required"`
2020
Size int64 `mapstructure:"size"`
21-
Width int32 `mapstructure:"width" validate:"required"`
21+
Width int32 `mapstructure:"width" validate:"required"`
2222
Height int32 `mapstructure:"height" validate:"required"`
23-
Url string `mapstructure:"url" validate:"required"`
23+
Url string `mapstructure:"url" validate:"required"`
2424
}
2525

2626
type PictureElem struct {
@@ -34,38 +34,38 @@ type SoundElem struct {
3434
SoundPath string `mapstructure:"soundPath"`
3535
SourceURL string `mapstructure:"sourceUrl" validate:"required"`
3636
DataSize int64 `mapstructure:"dataSize"`
37-
Duration int64 `mapstructure:"duration" validate:"required,min=1"`
37+
Duration int64 `mapstructure:"duration" validate:"required,min=1"`
3838
}
3939
type VideoElem struct {
40-
VideoPath string `mapstructure:"videoPath" `
40+
VideoPath string `mapstructure:"videoPath"`
4141
VideoUUID string `mapstructure:"videoUUID"`
42-
VideoURL string `mapstructure:"videoUrl" validate:"required"`
43-
VideoType string `mapstructure:"videoType" validate:"required"`
44-
VideoSize int64 `mapstructure:"videoSize" validate:"required"`
45-
Duration int64 `mapstructure:"duration" validate:"required"`
42+
VideoURL string `mapstructure:"videoUrl" validate:"required"`
43+
VideoType string `mapstructure:"videoType" validate:"required"`
44+
VideoSize int64 `mapstructure:"videoSize" validate:"required"`
45+
Duration int64 `mapstructure:"duration" validate:"required"`
4646
SnapshotPath string `mapstructure:"snapshotPath"`
4747
SnapshotUUID string `mapstructure:"snapshotUUID"`
4848
SnapshotSize int64 `mapstructure:"snapshotSize"`
49-
SnapshotURL string `mapstructure:"snapshotUrl" validate:"required"`
50-
SnapshotWidth int32 `mapstructure:"snapshotWidth" validate:"required"`
49+
SnapshotURL string `mapstructure:"snapshotUrl" validate:"required"`
50+
SnapshotWidth int32 `mapstructure:"snapshotWidth" validate:"required"`
5151
SnapshotHeight int32 `mapstructure:"snapshotHeight" validate:"required"`
5252
}
5353
type FileElem struct {
54-
FilePath string `mapstructure:"filePath" `
54+
FilePath string `mapstructure:"filePath"`
5555
UUID string `mapstructure:"uuid"`
5656
SourceURL string `mapstructure:"sourceUrl" validate:"required"`
57-
FileName string `mapstructure:"fileName" validate:"required"`
58-
FileSize int64 `mapstructure:"fileSize" validate:"required"`
57+
FileName string `mapstructure:"fileName" validate:"required"`
58+
FileSize int64 `mapstructure:"fileSize" validate:"required"`
5959
}
6060
type AtElem struct {
6161
Text string `mapstructure:"text"`
6262
AtUserList []string `mapstructure:"atUserList" validate:"required,max=1000"`
6363
IsAtSelf bool `mapstructure:"isAtSelf"`
6464
}
6565
type LocationElem struct {
66-
Description string `mapstructure:"description" `
67-
Longitude float64 `mapstructure:"longitude" validate:"required"`
68-
Latitude float64 `mapstructure:"latitude" validate:"required"`
66+
Description string `mapstructure:"description"`
67+
Longitude float64 `mapstructure:"longitude" validate:"required"`
68+
Latitude float64 `mapstructure:"latitude" validate:"required"`
6969
}
7070
type CustomElem struct {
7171
Data string `mapstructure:"data" validate:"required"`
@@ -87,7 +87,7 @@ type OANotificationElem struct {
8787
NotificationType int32 `mapstructure:"notificationType" json:"notificationType" validate:"required"`
8888
Text string `mapstructure:"text" json:"text" validate:"required"`
8989
Url string `mapstructure:"url" json:"url"`
90-
MixType int32 `mapstructure:"mixType" json:"mixType" validate:"required"`
90+
MixType int32 `mapstructure:"mixType" json:"mixType" validate:"required"`
9191
PictureElem *PictureElem `mapstructure:"pictureElem" json:"pictureElem"`
9292
SoundElem *SoundElem `mapstructure:"soundElem" json:"soundElem"`
9393
VideoElem *VideoElem `mapstructure:"videoElem" json:"videoElem"`

Diff for: pkg/common/config/config.go

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ package config
1616

1717
import (
1818
"bytes"
19+
1920
"github.com/OpenIMSDK/tools/discoveryregistry"
2021
"gopkg.in/yaml.v3"
2122
)

Diff for: pkg/common/config/parse.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ const (
3535
DefaultFolderPath = "../config/"
3636
)
3737

38-
// return absolude path join ../config/, this is k8s container config path
38+
// return absolude path join ../config/, this is k8s container config path.
3939
func GetDefaultConfigPath() string {
4040
b, err := filepath.Abs(os.Args[0])
4141
if err != nil {
@@ -45,7 +45,7 @@ func GetDefaultConfigPath() string {
4545
return filepath.Join(filepath.Dir(b), "../config/")
4646
}
4747

48-
// getProjectRoot returns the absolute path of the project root directory
48+
// getProjectRoot returns the absolute path of the project root directory.
4949
func GetProjectRoot() string {
5050
b, _ := filepath.Abs(os.Args[0])
5151

Diff for: pkg/common/convert/user.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@
1515
package convert
1616

1717
import (
18-
"github.com/OpenIMSDK/protocol/sdkws"
1918
"time"
2019

20+
"github.com/OpenIMSDK/protocol/sdkws"
21+
2122
relationtb "github.com/openimsdk/open-im-server/v3/pkg/common/db/table/relation"
2223
)
2324

Diff for: pkg/common/db/cache/group.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ const (
3939
groupMemberIDsKey = "GROUP_MEMBER_IDS:"
4040
groupMembersHashKey = "GROUP_MEMBERS_HASH2:"
4141
groupMemberInfoKey = "GROUP_MEMBER_INFO:"
42-
//groupOwnerInfoKey = "GROUP_OWNER_INFO:"
42+
//groupOwnerInfoKey = "GROUP_OWNER_INFO:".
4343
joinedGroupsKey = "JOIN_GROUPS_KEY:"
4444
groupMemberNumKey = "GROUP_MEMBER_NUM_CACHE:"
4545
groupRoleLevelMemberIDsKey = "GROUP_ROLE_LEVEL_MEMBER_IDS:"

Diff for: pkg/common/db/cache/init_redis.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ func NewRedis() (redis.UniversalClient, error) {
6666
Addr: config.Config.Redis.Address[0],
6767
Username: config.Config.Redis.Username,
6868
Password: config.Config.Redis.Password,
69-
DB: 0, // use default DB
70-
PoolSize: 100, // connection pool size
69+
DB: 0, // use default DB
70+
PoolSize: 100, // connection pool size
7171
MaxRetries: maxRetry,
7272
})
7373
}
@@ -95,4 +95,4 @@ func overrideConfigFromEnv() {
9595
if envPass := os.Getenv("REDIS_PASSWORD"); envPass != "" {
9696
config.Config.Redis.Password = envPass
9797
}
98-
}
98+
}

Diff for: pkg/common/discoveryregister/kubernetes/kubernetes.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ func (cli *K8sDR) CloseConn(conn *grpc.ClientConn) {
7777
conn.Close()
7878
}
7979

80-
// do not use this method for call rpc
80+
// do not use this method for call rpc.
8181
func (cli *K8sDR) GetClientLocalConns() map[string][]*grpc.ClientConn {
8282
fmt.Println("should not call this function!!!!!!!!!!!!!!!!!!!!!!!!!")
8383

Diff for: pkg/common/discoveryregister/zookeeper/zookeeper.go

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"github.com/OpenIMSDK/tools/discoveryregistry"
99
openkeeper "github.com/OpenIMSDK/tools/discoveryregistry/zookeeper"
1010
"github.com/OpenIMSDK/tools/log"
11+
1112
"github.com/openimsdk/open-im-server/v3/pkg/common/config"
1213
)
1314

Diff for: pkg/common/kafka/producer.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@ import (
1212
"github.com/OpenIMSDK/tools/log"
1313
"github.com/OpenIMSDK/tools/mcontext"
1414
"github.com/OpenIMSDK/tools/utils"
15-
"github.com/openimsdk/open-im-server/v3/pkg/common/config"
1615
"google.golang.org/protobuf/proto"
16+
17+
"github.com/openimsdk/open-im-server/v3/pkg/common/config"
1718
)
1819

1920
const (

Diff for: pkg/common/prommetrics/gin_api.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import ginProm "github.com/openimsdk/open-im-server/v3/pkg/common/ginprometheus"
44

55
/*
66
labels := prometheus.Labels{"label_one": "any", "label_two": "value"}
7-
ApiCustomCnt.MetricCollector.(*prometheus.CounterVec).With(labels).Inc()
7+
ApiCustomCnt.MetricCollector.(*prometheus.CounterVec).With(labels).Inc().
88
*/
99
var (
1010
ApiCustomCnt = &ginProm.Metric{

Diff for: pkg/common/version/base.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ package version
1515
// When releasing a new Kubernetes version, this file is updated by
1616
// build/mark_new_version.sh to reflect the new version, and then a
1717
// git annotated tag (using format vX.Y where X == Major version and Y
18-
// == Minor version) is created to point to the commit that updates
18+
// == Minor version) is created to point to the commit that updates.
1919
var (
2020
// TODO: Deprecate gitMajor and gitMinor, use only gitVersion
2121
// instead. First step in deprecation, keep the fields but make

Diff for: pkg/common/version/version.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ func Get() Info {
2525
}
2626
}
2727

28-
// GetClientVersion returns the git version of the OpenIM client repository
28+
// GetClientVersion returns the git version of the OpenIM client repository.
2929
func GetClientVersion() (*OpenIMClientVersion, error) {
3030
clientVersion, err := getClientVersion()
3131
if err != nil {
@@ -52,7 +52,7 @@ func getClientVersion() (string, error) {
5252
return ref.Hash().String(), nil
5353
}
5454

55-
// GetSingleVersion returns single version of sealer
55+
// GetSingleVersion returns single version of sealer.
5656
func GetSingleVersion() string {
5757
return gitVersion
5858
}

Diff for: test/e2e/api/token/token.go

+7-7
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
"net/http"
1010
)
1111

12-
// API endpoints and other constants
12+
// API endpoints and other constants.
1313
const (
1414
APIHost = "http://127.0.0.1:10002"
1515
UserTokenURL = APIHost + "/auth/user_token"
@@ -18,27 +18,27 @@ const (
1818
OperationID = "1646445464564"
1919
)
2020

21-
// UserTokenRequest represents a request to get a user token
21+
// UserTokenRequest represents a request to get a user token.
2222
type UserTokenRequest struct {
2323
Secret string `json:"secret"`
2424
PlatformID int `json:"platformID"`
2525
UserID string `json:"userID"`
2626
}
2727

28-
// UserTokenResponse represents a response containing a user token
28+
// UserTokenResponse represents a response containing a user token.
2929
type UserTokenResponse struct {
3030
Token string `json:"token"`
3131
ErrCode int `json:"errCode"`
3232
}
3333

34-
// User represents user data for registration
34+
// User represents user data for registration.
3535
type User struct {
3636
UserID string `json:"userID"`
3737
Nickname string `json:"nickname"`
3838
FaceURL string `json:"faceURL"`
3939
}
4040

41-
// UserRegisterRequest represents a request to register a user
41+
// UserRegisterRequest represents a request to register a user.
4242
type UserRegisterRequest struct {
4343
Secret string `json:"secret"`
4444
Users []User `json:"users"`
@@ -58,7 +58,7 @@ func main() {
5858
}
5959
}
6060

61-
// GetUserToken requests a user token from the API
61+
// GetUserToken requests a user token from the API.
6262
func GetUserToken(userID string) (string, error) {
6363
reqBody := UserTokenRequest{
6464
Secret: SecretKey,
@@ -88,7 +88,7 @@ func GetUserToken(userID string) (string, error) {
8888
return tokenResp.Token, nil
8989
}
9090

91-
// RegisterUser registers a new user using the API
91+
// RegisterUser registers a new user using the API.
9292
func RegisterUser(token, userID, nickname, faceURL string) error {
9393
user := User{
9494
UserID: userID,

0 commit comments

Comments
 (0)