Merge pull request #540 from cubxxw/fix/copy

feat: add test file
pull/546/head
Xinwei Xiong 1 year ago committed by GitHub
commit ccf2cdaab2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,31 @@
# Ignore files and directories starting with a dot
# Ignore specific files
.dockerignore
# Ignore build artifacts
_output/
logs/
# Ignore non-essential documentation
README.md
README-zh_CN.md
CONTRIBUTING.md
CHANGELOG/
# LICENSE
# Ignore testing and linting configuration
.golangci.yml
# Ignore deployment-related files
docker-compose.yaml
deployments/
# Ignore assets
assets/
# Ignore components
components/
# Ignore tools and scripts
.github/

@ -0,0 +1,36 @@
name: OpenIM Build Docker Images
on:
push:
tags:
- v*
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
bin:
- ssserver
- sslocal
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Docker metadata
id: metadata
uses: docker/metadata-action@v4
with:
images: ghcr.io/${{ github.repository_owner }}/openim-${{ matrix.bin }}
- name: Build and release Docker images
uses: docker/build-push-action@v3
with:
platforms: linux/386,linux/amd64,linux/arm64/v8
target: ${{ matrix.bin }}
tags: ${{ steps.metadata.outputs.tags }}
push: true

@ -83,7 +83,7 @@ jobs:
- name: Build source code for host platform
run: |
make multiarch
make build
echo "Build source code for host platform successfully"
# - name: Collect Test Coverage File
@ -132,22 +132,3 @@ jobs:
# - name: Test docker image
# run: |
# docker build -t openim:ci-build .
# goreleaser-test:
# runs-on: ubuntu-20.04
# steps:
# - name: Checkout
# uses: actions/checkout@v3
# with:
# fetch-depth: 0
# - name: Set up Go
# uses: actions/setup-go@v3
# with:
# go-version: ${{ env.GO_VERSION }}
# - name: Run GoReleaser
# uses: goreleaser/goreleaser-action@v4
# with:
# version: latest
# args: release --clean --skip-publish --snapshot

1
.gitignore vendored

@ -353,7 +353,6 @@ cscope.po.out
*testsdir
*testsfile
*testsfiles
*test
*testdir
*testfile
*testfiles

@ -1,38 +1,31 @@
# Build Stage
FROM golang as build
# go mod Installation source, container environment variable addition will override the default variable value
ENV GO111MODULE=on
ENV GOPROXY=https://goproxy.cn,direct
# Set go mod installation source and proxy
ARG GO111MODULE=on
ARG GOPROXY=https://goproxy.cn,direct
ENV GO111MODULE=$GO111MODULE
ENV GOPROXY=$GOPROXY
# Set up the working directory
WORKDIR /Open-IM-Server
# add all files to the container
COPY . .
WORKDIR /Open-IM-Server/scripts
RUN chmod +x *.sh
RUN /bin/sh -c ./build_all_service.sh
# Copy all files to the container
ADD . .
#Blank image Multi-Stage Build
FROM ubuntu
RUN /bin/sh -c "make build"
RUN rm -rf /var/lib/apt/lists/*
RUN apt-get update && apt-get install apt-transport-https && apt-get install procps\
&&apt-get install net-tools
#Non-interactive operation
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get install -y vim curl tzdata gawk
#Time zone adjusted to East eighth District
RUN ln -fs /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && dpkg-reconfigure -f noninteractive tzdata
# Production Stage
FROM alpine
RUN apk --no-cache add tzdata
#set directory to map logs,config file,scripts file.
VOLUME ["/Open-IM-Server/logs","/Open-IM-Server/config","/Open-IM-Server/scripts","/Open-IM-Server/db/sdk"]
# Set directory to map logs, config files, scripts, and SDK
VOLUME ["/Open-IM-Server/logs", "/Open-IM-Server/config", "/Open-IM-Server/scripts", "/Open-IM-Server/db/sdk"]
#Copy scripts files and binary files to the blank image
# Copy scripts and binary files to the production image
COPY --from=build /Open-IM-Server/scripts /Open-IM-Server/scripts
COPY --from=build /Open-IM-Server/_output/bin/platforms/linux/amd64 /Open-IM-Server/_output/bin/platforms/linux/amd64
COPY --from=build /Open-IM-Server/_output/bin/platforms/linux/arm64 /Open-IM-Server/_output/bin/platforms/linux/arm64
WORKDIR /Open-IM-Server/scripts

@ -1,3 +1,17 @@
// Copyright © 2023 OpenIM. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package main
import (

@ -100,7 +100,7 @@ services:
openim_server:
image: ghcr.io/openimsdk/openim-server:v3.0.0-alpha.0
image: ghcr.io/openimsdk/openim-server:v3.0.0-alpha.1
container_name: openim-server
volumes:
- ./logs:/Open-IM-Server/logs

@ -1,3 +1,17 @@
// Copyright © 2023 OpenIM. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package api
import (

@ -1,3 +1,17 @@
// Copyright © 2023 OpenIM. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package msgtransfer
import (

@ -1,3 +1,17 @@
// Copyright © 2023 OpenIM. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package push
import (

@ -1,3 +1,17 @@
// Copyright © 2023 OpenIM. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package conversation
import (

@ -1,3 +1,17 @@
// Copyright © 2023 OpenIM. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package group
import (

@ -1,3 +1,17 @@
// Copyright © 2023 OpenIM. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package group
import (

@ -1,3 +1,17 @@
// Copyright © 2023 OpenIM. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package msg
import (

@ -1,3 +1,17 @@
// Copyright © 2023 OpenIM. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package msg
import (

@ -1,3 +1,17 @@
// Copyright © 2023 OpenIM. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package third
import (

@ -1,3 +1,17 @@
// Copyright © 2023 OpenIM. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package third
import (

@ -1,3 +1,17 @@
// Copyright © 2023 OpenIM. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package third
import (

@ -1,3 +1,17 @@
// Copyright © 2023 OpenIM. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package user
import (

@ -1,3 +1,17 @@
// Copyright © 2023 OpenIM. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package tools
import (

@ -1,3 +1,17 @@
// Copyright © 2023 OpenIM. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package tools
import (

@ -1,3 +1,17 @@
// Copyright © 2023 OpenIM. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package apiresp
type ApiFormat interface {

@ -47,8 +47,7 @@ type ForceLogoutReq struct {
OperationID string `json:"operationID" binding:"required"`
}
type ForceLogoutResp struct {
}
type ForceLogoutResp struct{}
type ParseTokenReq struct {
OperationID string `json:"operationID" binding:"required"`

@ -68,16 +68,14 @@ type SetConversationReq struct {
OperationID string `json:"operationID" binding:"required"`
}
type SetConversationResp struct {
}
type SetConversationResp struct{}
type ModifyConversationFieldReq struct {
Conversation
FieldType int32 `json:"fieldType" binding:"required"`
UserIDList []string `json:"userIDList" binding:"required"`
OperationID string `json:"operationID" binding:"required"`
}
type ModifyConversationFieldResp struct {
}
type ModifyConversationFieldResp struct{}
type BatchSetConversationsReq struct {
Conversations []Conversation `json:"conversations" binding:"required"`
@ -130,5 +128,4 @@ type SetRecvMsgOptReq struct {
NotificationType int32 `json:"notificationType"`
}
type SetRecvMsgOptResp struct {
}
type SetRecvMsgOptResp struct{}

@ -185,8 +185,7 @@ type AddBlacklistReq struct {
ToUserID string `json:"toUserID" binding:"required"`
FromUserID string `json:"fromUserID" binding:"required"`
}
type AddBlacklistResp struct {
}
type AddBlacklistResp struct{}
type ImportFriendReq struct {
FriendUserIDList []string `json:"friendUserIDList" binding:"required"`
@ -212,15 +211,13 @@ type AddFriendResponseReq struct {
HandleResult int32 `json:"flag" binding:"required,oneof=-1 0 1"`
HandleMsg string `json:"handleMsg"`
}
type AddFriendResponseResp struct {
}
type AddFriendResponseResp struct{}
type DeleteFriendReq struct {
ToUserID string `json:"toUserID" binding:"required"`
FromUserID string `json:"fromUserID" binding:"required"`
}
type DeleteFriendResp struct {
}
type DeleteFriendResp struct{}
type GetBlackListReq struct {
FromUserID string `json:"fromUserID" binding:"required"`
@ -234,15 +231,13 @@ type SetFriendRemarkReq struct {
FromUserID string `json:"fromUserID" binding:"required"`
Remark string `json:"remark"`
}
type SetFriendRemarkResp struct {
}
type SetFriendRemarkResp struct{}
type RemoveBlacklistReq struct {
ToUserID string `json:"toUserID" binding:"required"`
FromUserID string `json:"fromUserID" binding:"required"`
}
type RemoveBlacklistResp struct {
}
type RemoveBlacklistResp struct{}
type IsFriendReq struct {
ToUserID string `json:"toUserID" binding:"required"`
@ -266,7 +261,7 @@ type GetFriendListResp struct {
AddSource int32 `json:"addSource"`
OperatorUserID string `json:"operatorUserID"`
Ex string `json:"ex"`
//FriendUser *UserInfo // TODO
// FriendUser *UserInfo // TODO
}
type GetFriendApplyListReq struct {

@ -25,8 +25,7 @@ type KickGroupMemberReq struct {
OperationID string `json:"operationID" binding:"required"`
}
type KickGroupMemberResp struct {
//UserIDResultList []*UserIDResult `json:"data"`
// UserIDResultList []*UserIDResult `json:"data"`
}
type GetGroupMembersInfoReq struct {
@ -46,8 +45,7 @@ type InviteUserToGroupReq struct {
OperationID string `json:"operationID" binding:"required"`
}
type InviteUserToGroupResp struct {
//UserIDResultList []*UserIDResult `json:"data"`
// UserIDResultList []*UserIDResult `json:"data"`
}
type GetJoinedGroupListReq struct {
@ -114,8 +112,9 @@ type CreateGroupResp struct {
type GetGroupApplicationListReq struct {
OperationID string `json:"operationID" binding:"required"`
FromUserID string `json:"fromUserID" binding:"required"` //作为管理员或群主收到的 进群申请
FromUserID string `json:"fromUserID" binding:"required"` // 作为管理员或群主收到的 进群申请
}
type GetGroupApplicationListResp struct {
GroupRequestList []*sdkws.GroupRequest `json:"-"`
Data []map[string]interface{} `json:"data" swaggerignore:"true"`
@ -163,12 +162,11 @@ type GetGroupInfoResp struct {
type ApplicationGroupResponseReq struct {
OperationID string `json:"operationID" binding:"required"`
GroupID string `json:"groupID" binding:"required"`
FromUserID string `json:"fromUserID" binding:"required"` //application from FromUserID
FromUserID string `json:"fromUserID" binding:"required"` // application from FromUserID
HandledMsg string `json:"handledMsg"`
HandleResult int32 `json:"handleResult" binding:"required,oneof=-1 1"`
}
type ApplicationGroupResponseResp struct {
}
type ApplicationGroupResponseResp struct{}
type JoinGroupReq struct {
GroupID string `json:"groupID" binding:"required"`
@ -178,15 +176,13 @@ type JoinGroupReq struct {
InviterUserID string `json:"inviterUserID"`
}
type JoinGroupResp struct {
}
type JoinGroupResp struct{}
type QuitGroupReq struct {
GroupID string `json:"groupID" binding:"required"`
OperationID string `json:"operationID" binding:"required"`
}
type QuitGroupResp struct {
}
type QuitGroupResp struct{}
type SetGroupInfoReq struct {
GroupID string `json:"groupID" binding:"required"`
@ -201,8 +197,7 @@ type SetGroupInfoReq struct {
ApplyMemberFriend *int32 `json:"applyMemberFriend"`
}
type SetGroupInfoResp struct {
}
type SetGroupInfoResp struct{}
type TransferGroupOwnerReq struct {
GroupID string `json:"groupID" binding:"required"`
@ -210,15 +205,13 @@ type TransferGroupOwnerReq struct {
NewOwnerUserID string `json:"newOwnerUserID" binding:"required"`
OperationID string `json:"operationID" binding:"required"`
}
type TransferGroupOwnerResp struct {
}
type TransferGroupOwnerResp struct{}
type DismissGroupReq struct {
GroupID string `json:"groupID" binding:"required"`
OperationID string `json:"operationID" binding:"required"`
}
type DismissGroupResp struct {
}
type DismissGroupResp struct{}
type MuteGroupMemberReq struct {
OperationID string `json:"operationID" binding:"required"`
@ -226,30 +219,26 @@ type MuteGroupMemberReq struct {
UserID string `json:"userID" binding:"required"`
MutedSeconds uint32 `json:"mutedSeconds" binding:"required"`
}
type MuteGroupMemberResp struct {
}
type MuteGroupMemberResp struct{}
type CancelMuteGroupMemberReq struct {
OperationID string `json:"operationID" binding:"required"`
GroupID string `json:"groupID" binding:"required"`
UserID string `json:"userID" binding:"required"`
}
type CancelMuteGroupMemberResp struct {
}
type CancelMuteGroupMemberResp struct{}
type MuteGroupReq struct {
OperationID string `json:"operationID" binding:"required"`
GroupID string `json:"groupID" binding:"required"`
}
type MuteGroupResp struct {
}
type MuteGroupResp struct{}
type CancelMuteGroupReq struct {
OperationID string `json:"operationID" binding:"required"`
GroupID string `json:"groupID" binding:"required"`
}
type CancelMuteGroupResp struct {
}
type CancelMuteGroupResp struct{}
type SetGroupMemberNicknameReq struct {
OperationID string `json:"operationID" binding:"required"`
@ -258,8 +247,7 @@ type SetGroupMemberNicknameReq struct {
Nickname string `json:"nickname"`
}
type SetGroupMemberNicknameResp struct {
}
type SetGroupMemberNicknameResp struct{}
type SetGroupMemberInfoReq struct {
OperationID string `json:"operationID" binding:"required"`
@ -271,8 +259,7 @@ type SetGroupMemberInfoReq struct {
Ex *string `json:"ex"`
}
type SetGroupMemberInfoResp struct {
}
type SetGroupMemberInfoResp struct{}
type GetGroupAbstractInfoReq struct {
OperationID string `json:"operationID"`

@ -36,15 +36,14 @@ type GetUsersOnlineStatusReq struct {
UserIDList []string `json:"userIDList" binding:"required,lte=200"`
}
type GetUsersOnlineStatusResp struct {
//SuccessResult []*msggateway.GetUsersOnlineStatusResp_SuccessResult `json:"data"`
// SuccessResult []*msggateway.GetUsersOnlineStatusResp_SuccessResult `json:"data"`
}
type AccountCheckReq struct {
OperationID string `json:"operationID" binding:"required"`
CheckUserIDList []string `json:"checkUserIDList" binding:"required,lte=100"`
}
type AccountCheckResp struct {
}
type AccountCheckResp struct{}
type ManagementSendMsg struct {
SendID string `json:"sendID" binding:"required"`

@ -1,3 +1,17 @@
// Copyright © 2023 OpenIM. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package apistruct
type DelMsgReq struct {
@ -6,16 +20,14 @@ type DelMsgReq struct {
OperationID string `json:"operationID,omitempty" binding:"required"`
}
type DelMsgResp struct {
}
type DelMsgResp struct{}
type CleanUpMsgReq struct {
UserID string `json:"userID" binding:"required"`
OperationID string `json:"operationID" binding:"required"`
}
type CleanUpMsgResp struct {
}
type CleanUpMsgResp struct{}
type DelSuperGroupMsgReq struct {
UserID string `json:"userID" binding:"required"`
@ -25,8 +37,7 @@ type DelSuperGroupMsgReq struct {
OperationID string `json:"operationID" binding:"required"`
}
type DelSuperGroupMsgResp struct {
}
type DelSuperGroupMsgResp struct{}
type MsgDeleteNotificationElem struct {
GroupID string `json:"groupID"`
@ -41,8 +52,7 @@ type SetMsgMinSeqReq struct {
OperationID string `json:"operationID" binding:"required"`
}
type SetMsgMinSeqResp struct {
}
type SetMsgMinSeqResp struct{}
type PictureBaseInfo struct {
UUID string `mapstructure:"uuid"`

@ -58,8 +58,7 @@ type UploadUpdateAppReq struct {
UpdateLog string `form:"updateLog" binding:"required"`
}
type UploadUpdateAppResp struct {
}
type UploadUpdateAppResp struct{}
type GetDownloadURLReq struct {
OperationID string `json:"operationID" binding:"required"`
@ -111,21 +110,19 @@ type GetRTCInvitationInfoStartAppResp struct {
}
/**
* FCMToken
* FCMToken.
*/
type FcmUpdateTokenReq struct {
OperationID string `json:"operationID" binding:"required"`
Platform int `json:"platform" binding:"required,min=1,max=2"` //only for ios + android
Platform int `json:"platform" binding:"required,min=1,max=2"` // only for ios + android
FcmToken string `json:"fcmToken" binding:"required"`
}
type FcmUpdateTokenResp struct {
}
type FcmUpdateTokenResp struct{}
type SetAppBadgeReq struct {
OperationID string `json:"operationID" binding:"required"`
FromUserID string `json:"fromUserID" binding:"required"`
AppUnreadCount int32 `json:"appUnreadCount"`
}
type SetAppBadgeResp struct {
}
type SetAppBadgeResp struct{}

@ -16,7 +16,7 @@ package callbackstruct
type CallbackUserOnlineReq struct {
UserStatusCallbackReq
//Token string `json:"token"`
// Token string `json:"token"`
Seq int64 `json:"seq"`
IsAppBackground bool `json:"isAppBackground"`
ConnID string `json:"connID"`

@ -1,3 +1,17 @@
// Copyright © 2023 OpenIM. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package cmd
import (

@ -17,7 +17,7 @@ package constant
const (
///ContentType
//UserRelated
//UserRelated.
ContentTypeBegin = 100
Text = 101
Picture = 102
@ -45,23 +45,23 @@ const (
SignalMsg = 202
CustomNotification = 203
//SysRelated
//SysRelated.
NotificationBegin = 1000
FriendApplicationApprovedNotification = 1201 //add_friend_response
FriendApplicationRejectedNotification = 1202 //add_friend_response
FriendApplicationNotification = 1203 //add_friend
FriendApplicationApprovedNotification = 1201 // add_friend_response
FriendApplicationRejectedNotification = 1202 // add_friend_response
FriendApplicationNotification = 1203 // add_friend
FriendAddedNotification = 1204
FriendDeletedNotification = 1205 //delete_friend
FriendRemarkSetNotification = 1206 //set_friend_remark?
BlackAddedNotification = 1207 //add_black
BlackDeletedNotification = 1208 //remove_black
FriendDeletedNotification = 1205 // delete_friend
FriendRemarkSetNotification = 1206 // set_friend_remark?
BlackAddedNotification = 1207 // add_black
BlackDeletedNotification = 1208 // remove_black
FriendInfoUpdatedNotification = 1209
ConversationChangeNotification = 1300 // change conversation opt
UserNotificationBegin = 1301
UserInfoUpdatedNotification = 1303 //SetSelfInfoTip = 204
UserInfoUpdatedNotification = 1303 // SetSelfInfoTip = 204
UserNotificationEnd = 1399
OANotification = 1400
@ -113,37 +113,37 @@ const (
NotificationEnd = 5000
//status
//status.
MsgNormal = 1
MsgDeleted = 4
//MsgFrom
//MsgFrom.
UserMsgType = 100
SysMsgType = 200
//SessionType
//SessionType.
SingleChatType = 1
GroupChatType = 2
SuperGroupChatType = 3
NotificationChatType = 4
//token
//token.
NormalToken = 0
InValidToken = 1
KickedToken = 2
ExpiredToken = 3
//MultiTerminalLogin
//MultiTerminalLogin.
DefalutNotKick = 0
//Full-end login, but the same end is mutually exclusive
//Full-end login, but the same end is mutually exclusive.
AllLoginButSameTermKick = 1
//Only one of the endpoints can log in
//Only one of the endpoints can log in.
SingleTerminalLogin = 2
//The web side can be online at the same time, and the other side can only log in at one end
//The web side can be online at the same time, and the other side can only log in at one end.
WebAndOther = 3
// The PC side is mutually exclusive, and the mobile side is mutually exclusive, but the web side can be online at
// the same time
// the same time.
PcMobileAndWeb = 4
//The PC terminal can be online at the same time,but other terminal only one of the endpoints can login
//The PC terminal can be online at the same time,but other terminal only one of the endpoints can login.
PCAndOther = 5
OnlineStatus = "online"
@ -151,12 +151,12 @@ const (
Registered = "registered"
UnRegistered = "unregistered"
//MsgReceiveOpt
//MsgReceiveOpt.
ReceiveMessage = 0
NotReceiveMessage = 1
ReceiveNotNotifyMessage = 2
//OptionsKey
//OptionsKey.
IsHistory = "history"
IsPersistent = "persistent"
IsOfflinePush = "offlinePush"
@ -170,13 +170,13 @@ const (
IsNotNotification = "isNotNotification"
IsSendMsg = "isSendMsg"
//GroupStatus
//GroupStatus.
GroupOk = 0
GroupBanChat = 1
GroupStatusDismissed = 2
GroupStatusMuted = 3
//GroupType
//GroupType.
NormalGroup = 0
SuperGroup = 1
WorkingGroup = 2
@ -184,19 +184,19 @@ const (
GroupBaned = 3
GroupBanPrivateChat = 4
//UserJoinGroupSource
//UserJoinGroupSource.
JoinByAdmin = 1
JoinByInvitation = 2
JoinBySearch = 3
JoinByQRCode = 4
//Minio
//Minio.
MinioDurationTimes = 3600
//Aws
//Aws.
AwsDurationTimes = 3600
//callbackCommand
//callbackCommand.
CallbackBeforeSendSingleMsgCommand = "callbackBeforeSendSingleMsgCommand"
CallbackAfterSendSingleMsgCommand = "callbackAfterSendSingleMsgCommand"
CallbackBeforeSendGroupMsgCommand = "callbackBeforeSendGroupMsgCommand"
@ -217,19 +217,19 @@ const (
CallbackGetMessageListReactionExtensionsCommand = "callbackGetMessageListReactionExtensionsCommand"
CallbackAddMessageListReactionExtensionsCommand = "callbackAddMessageListReactionExtensionsCommand"
//callback actionCode
//callback actionCode.
ActionAllow = 0
ActionForbidden = 1
//callback callbackHandleCode
//callback callbackHandleCode.
CallbackHandleSuccess = 0
CallbackHandleFailed = 1
// minioUpload
// minioUpload.
OtherType = 1
VideoType = 2
ImageType = 3
// sendMsgStaus
// sendMsgStaus.
MsgStatusNotExist = 0
MsgIsSending = 1
MsgSendSuccessed = 2
@ -299,25 +299,27 @@ const (
Female = 2
)
const OperationID = "operationID"
const OpUserID = "opUserID"
const ConnID = "connID"
const OpUserPlatform = "platform"
const Token = "token"
const RpcCustomHeader = "customHeader" // rpc中间件自定义ctx参数
const CheckKey = "CheckKey"
const TriggerID = "triggerID"
const RemoteAddr = "remoteAddr"
const (
OperationID = "operationID"
OpUserID = "opUserID"
ConnID = "connID"
OpUserPlatform = "platform"
Token = "token"
RpcCustomHeader = "customHeader" // rpc中间件自定义ctx参数
CheckKey = "CheckKey"
TriggerID = "triggerID"
RemoteAddr = "remoteAddr"
)
const (
BecomeFriendByImport = 1 //管理员导入
BecomeFriendByApply = 2 //申请添加
BecomeFriendByImport = 1 // 管理员导入
BecomeFriendByApply = 2 // 申请添加
)
const (
ApplyNeedVerificationInviteDirectly = 0 // 申请需要同意 邀请直接进
AllNeedVerification = 1 //所有人进群需要验证,除了群主管理员邀请进群
Directly = 2 //直接进群
AllNeedVerification = 1 // 所有人进群需要验证,除了群主管理员邀请进群
Directly = 2 // 直接进群
)
const (
@ -345,7 +347,7 @@ const LogFileName = "OpenIM.log"
const LocalHost = "0.0.0.0"
// flag parse
// flag parse.
const (
FlagPort = "port"
FlagWsPort = "ws_port"

@ -15,10 +15,9 @@
package constant
// fixme 1<--->IOS 2<--->Android 3<--->Windows
//fixme 4<--->OSX 5<--->Web 6<--->MiniWeb 7<--->Linux
// fixme 4<--->OSX 5<--->Web 6<--->MiniWeb 7<--->Linux
const (
//Platform ID
//Platform ID.
IOSPlatformID = 1
AndroidPlatformID = 2
WindowsPlatformID = 3
@ -30,7 +29,7 @@ const (
IPadPlatformID = 9
AdminPlatformID = 10
//Platform string match to Platform ID
//Platform string match to Platform ID.
IOSPlatformStr = "IOS"
AndroidPlatformStr = "Android"
WindowsPlatformStr = "Windows"
@ -42,7 +41,7 @@ const (
IPadPlatformStr = "IPad"
AdminPlatformStr = "Admin"
//terminal types
//terminal types.
TerminalPC = "PC"
TerminalMobile = "Mobile"
)
@ -59,6 +58,7 @@ var PlatformID2Name = map[int]string{
IPadPlatformID: IPadPlatformStr,
AdminPlatformID: AdminPlatformStr,
}
var PlatformName2ID = map[string]int{
IOSPlatformStr: IOSPlatformID,
AndroidPlatformStr: AndroidPlatformID,
@ -71,6 +71,7 @@ var PlatformName2ID = map[string]int{
IPadPlatformStr: IPadPlatformID,
AdminPlatformStr: AdminPlatformID,
}
var PlatformName2class = map[string]string{
IOSPlatformStr: TerminalMobile,
AndroidPlatformStr: TerminalMobile,
@ -80,6 +81,7 @@ var PlatformName2class = map[string]string{
OSXPlatformStr: TerminalPC,
LinuxPlatformStr: TerminalPC,
}
var PlatformID2class = map[int]string{
IOSPlatformID: TerminalMobile,
AndroidPlatformID: TerminalMobile,
@ -93,12 +95,15 @@ var PlatformID2class = map[int]string{
func PlatformIDToName(num int) string {
return PlatformID2Name[num]
}
func PlatformNameToID(name string) int {
return PlatformName2ID[name]
}
func PlatformNameToClass(name string) string {
return PlatformName2class[name]
}
func PlatformIDToClass(num int) string {
return PlatformID2class[num]
}

@ -1,3 +1,17 @@
// Copyright © 2023 OpenIM. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package controller
import (

@ -1,3 +1,17 @@
// Copyright © 2023 OpenIM. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package controller
import (

@ -1,3 +1,17 @@
// Copyright © 2023 OpenIM. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package controller
import (

@ -1,3 +1,17 @@
// Copyright © 2023 OpenIM. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package relation
import (

@ -1,3 +1,17 @@
// Copyright © 2023 OpenIM. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package relation
import (

@ -1,3 +1,17 @@
// Copyright © 2023 OpenIM. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package relation
import (

@ -1,3 +1,17 @@
// Copyright © 2023 OpenIM. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package cont
const (

@ -1,3 +1,17 @@
// Copyright © 2023 OpenIM. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package cont
import (

@ -1,3 +1,17 @@
// Copyright © 2023 OpenIM. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package cont
import (

@ -1,3 +1,17 @@
// Copyright © 2023 OpenIM. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package cont
import (

@ -1,3 +1,17 @@
// Copyright © 2023 OpenIM. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package cont
import "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/s3"

@ -1,3 +1,17 @@
// Copyright © 2023 OpenIM. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package cos
import (

@ -1,3 +1,17 @@
// Copyright © 2023 OpenIM. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package minio
import (

@ -1,3 +1,17 @@
// Copyright © 2023 OpenIM. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package oss
import (

@ -1,3 +1,17 @@
// Copyright © 2023 OpenIM. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package oss
import (

@ -1,3 +1,17 @@
// Copyright © 2023 OpenIM. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package oss
import (

@ -1,3 +1,17 @@
// Copyright © 2023 OpenIM. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package s3
import (

@ -1,3 +1,17 @@
// Copyright © 2023 OpenIM. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package relation
import (

@ -1,3 +1,17 @@
// Copyright © 2023 OpenIM. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package relation
import (

@ -1,3 +1,17 @@
// Copyright © 2023 OpenIM. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package log
import (

@ -26,12 +26,15 @@ var mapper = []string{constant.OperationID, constant.OpUserID, constant.OpUserPl
func WithOpUserIDContext(ctx context.Context, opUserID string) context.Context {
return context.WithValue(ctx, constant.OpUserID, opUserID)
}
func WithOpUserPlatformContext(ctx context.Context, platform string) context.Context {
return context.WithValue(ctx, constant.OpUserPlatform, platform)
}
func WithTriggerIDContext(ctx context.Context, triggerID string) context.Context {
return context.WithValue(ctx, constant.TriggerID, triggerID)
}
func NewCtx(operationID string) context.Context {
c := context.Background()
ctx := context.WithValue(c, constant.OperationID, operationID)
@ -59,6 +62,7 @@ func GetOperationID(ctx context.Context) string {
}
return ""
}
func GetOpUserID(ctx context.Context) string {
if ctx.Value(constant.OpUserID) != "" {
s, ok := ctx.Value(constant.OpUserID).(string)
@ -68,6 +72,7 @@ func GetOpUserID(ctx context.Context) string {
}
return ""
}
func GetConnID(ctx context.Context) string {
if ctx.Value(constant.ConnID) != "" {
s, ok := ctx.Value(constant.ConnID).(string)
@ -87,6 +92,7 @@ func GetTriggerID(ctx context.Context) string {
}
return ""
}
func GetOpUserPlatform(ctx context.Context) string {
if ctx.Value(constant.OpUserPlatform) != "" {
s, ok := ctx.Value(constant.OpUserPlatform).(string)
@ -96,6 +102,7 @@ func GetOpUserPlatform(ctx context.Context) string {
}
return ""
}
func GetRemoteAddr(ctx context.Context) string {
if ctx.Value(constant.RemoteAddr) != "" {
s, ok := ctx.Value(constant.RemoteAddr).(string)
@ -142,8 +149,6 @@ func WithMustInfoCtx(values []string) context.Context {
ctx := context.Background()
for i, v := range values {
ctx = context.WithValue(ctx, mapper[i], v)
}
return ctx
}

@ -1,3 +1,17 @@
// Copyright © 2023 OpenIM. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package zookeeper
import (

@ -14,7 +14,7 @@
package errs
// UnknownCode 没有解析到code或解析的code=0
// UnknownCode 没有解析到code或解析的code=0.
const UnknownCode = 1000
const (
@ -34,47 +34,47 @@ const (
InvitationError = 10014
)
// 通用错误码
// 通用错误码.
const (
NoError = 0 //无错误
DatabaseError = 90002 //redis/mysql等db错误
NetworkError = 90004 //网络错误
DataError = 90007 //数据错误
NoError = 0 // 无错误
DatabaseError = 90002 // redis/mysql等db错误
NetworkError = 90004 // 网络错误
DataError = 90007 // 数据错误
CallbackError = 80000
//通用错误码
//通用错误码.
ServerInternalError = 500 //服务器内部错误
ArgsError = 1001 //输入参数错误
NoPermissionError = 1002 //权限不足
DuplicateKeyError = 1003
RecordNotFoundError = 1004 //记录不存在
RecordNotFoundError = 1004 // 记录不存在
// 账号错误码
UserIDNotFoundError = 1101 //UserID不存在 或未注册
RegisteredAlreadyError = 1102 //用户已经注册过了
// 账号错误码.
UserIDNotFoundError = 1101 // UserID不存在 或未注册
RegisteredAlreadyError = 1102 // 用户已经注册过了
// 群组错误码
GroupIDNotFoundError = 1201 //GroupID不存在
GroupIDExisted = 1202 //GroupID已存在
NotInGroupYetError = 1203 //不在群组中
DismissedAlreadyError = 1204 //群组已经解散
// 群组错误码.
GroupIDNotFoundError = 1201 // GroupID不存在
GroupIDExisted = 1202 // GroupID已存在
NotInGroupYetError = 1203 // 不在群组中
DismissedAlreadyError = 1204 // 群组已经解散
GroupTypeNotSupport = 1205
GroupRequestHandled = 1206
// 关系链错误码
CanNotAddYourselfError = 1301 //不能添加自己为好友
BlockedByPeer = 1302 //被对方拉黑
NotPeersFriend = 1303 //不是对方的好友
RelationshipAlreadyError = 1304 //已经是好友关系
// 关系链错误码.
CanNotAddYourselfError = 1301 // 不能添加自己为好友
BlockedByPeer = 1302 // 被对方拉黑
NotPeersFriend = 1303 // 不是对方的好友
RelationshipAlreadyError = 1304 // 已经是好友关系
// 消息错误码
// 消息错误码.
MessageHasReadDisable = 1401
MutedInGroup = 1402 //群成员被禁言
MutedGroup = 1403 //群被禁言
MsgAlreadyRevoke = 1404 //消息已撤回
MutedInGroup = 1402 // 群成员被禁言
MutedGroup = 1403 // 群被禁言
MsgAlreadyRevoke = 1404 // 消息已撤回
// token错误码
// token错误码.
TokenExpiredError = 1501
TokenInvalidError = 1502
TokenMalformedError = 1503
@ -83,10 +83,10 @@ const (
TokenKickedError = 1506
TokenNotExistError = 1507
// 长连接网关错误码
// 长连接网关错误码.
ConnOverMaxNumLimit = 1601
ConnArgsErr = 1602
// S3错误码
// S3错误码.
FileUploadedExpiredError = 1701 // 上传过期
)

@ -38,11 +38,11 @@ var (
ErrData = NewCodeError(DataError, "DataError")
ErrTokenExpired = NewCodeError(TokenExpiredError, "TokenExpiredError")
ErrTokenInvalid = NewCodeError(TokenInvalidError, "TokenInvalidError") //
ErrTokenMalformed = NewCodeError(TokenMalformedError, "TokenMalformedError") //格式错误
ErrTokenNotValidYet = NewCodeError(TokenNotValidYetError, "TokenNotValidYetError") //还未生效
ErrTokenUnknown = NewCodeError(TokenUnknownError, "TokenUnknownError") //未知错误
ErrTokenMalformed = NewCodeError(TokenMalformedError, "TokenMalformedError") // 格式错误
ErrTokenNotValidYet = NewCodeError(TokenNotValidYetError, "TokenNotValidYetError") // 还未生效
ErrTokenUnknown = NewCodeError(TokenUnknownError, "TokenUnknownError") // 未知错误
ErrTokenKicked = NewCodeError(TokenKickedError, "TokenKickedError")
ErrTokenNotExist = NewCodeError(TokenNotExistError, "TokenNotExistError") //在redis中不存在
ErrTokenNotExist = NewCodeError(TokenNotExistError, "TokenNotExistError") // 在redis中不存在
ErrDuplicateKey = NewCodeError(DuplicateKeyError, "DuplicateKeyError")
ErrMessageHasReadDisable = NewCodeError(MessageHasReadDisable, "MessageHasReadDisable")

@ -1,3 +1,17 @@
// Copyright © 2023 OpenIM. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package rpcclient
import (

@ -1,3 +1,17 @@
// Copyright © 2023 OpenIM. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package rpcclient
import (

@ -1,3 +1,17 @@
// Copyright © 2023 OpenIM. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package notification
import (

@ -1,3 +1,17 @@
// Copyright © 2023 OpenIM. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package notification
import (

@ -37,10 +37,12 @@ echo -e "${BOLD_PREFIX}_________________________________________________________
bin_dir="$BIN_DIR"
logs_dir="$OPENIM_ROOT/logs"
sdk_db_dir="$OPENIM_ROOT/db/sdk/"
echo "==> bin_dir=$bin_dir"
echo "==> logs_dir=$logs_dir"
echo "==> sdk_db_dir=$sdk_db_dir"
# Automatically created when there is no bin, logs folder
if [ ! -d $bin_dir ]; then
mkdir -p $bin_dir
fi
if [ ! -d $logs_dir ]; then
mkdir -p $logs_dir
fi
@ -48,20 +50,17 @@ if [ ! -d $sdk_db_dir ]; then
mkdir -p $sdk_db_dir
fi
#Include shell font styles and some basic information
OPENIM_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
echo "PWD=================>$PWD"
cd $OPENIM_ROOT
#Include shell font styles and some basic information
source ./style_info.sh
source ./path_info.sh
source ./function.sh
# CPU core number
cpu_count=$(lscpu | grep -e '^CPU(s):' | awk '{print $2}')
echo -e "${GREEN_PREFIX}======> cpu_count=$cpu_count${COLOR_SUFFIX}"
cd $OPENIM_ROOT
# Count the number of concurrent compilations (half the number of cpus)
compile_count=$((cpu_count / 2))
# Execute 'make build'
make build
# Execute 'make build' run the make command for concurrent compilation
make -j$compile_count build
if [ $? -ne 0 ]; then
echo "make build Error, script exits"

@ -23,14 +23,14 @@ LICENSE_TEMPLATE ?= $(ROOT_DIR)/scripts/LICENSE/LICENSE_TEMPLATES
.PHONY: copyright.verify
copyright.verify: tools.verify.addlicense
@echo "===========> Validate boilerplate headers for assign files starting in the $(ROOT_DIR) directory"
@$(TOOLS_DIR)/addlicense -v -check -ignore **/test/** -f $(LICENSE_TEMPLATE) $(CODE_DIRS)
@$(TOOLS_DIR)/addlicense -v -check -ignore **/test/** -ignore **pb** -f $(LICENSE_TEMPLATE) $(CODE_DIRS)
@echo "===========> End of boilerplate headers check..."
## copyright.add: Add the boilerplate headers for all files
.PHONY: copyright.add
copyright.add: tools.verify.addlicense
@echo "===========> Adding $(LICENSE_TEMPLATE) the boilerplate headers for all files"
@$(TOOLS_DIR)/addlicense -y $(shell date +"%Y") -v -c "OpenIM." -f $(LICENSE_TEMPLATE) $(CODE_DIRS)
@$(TOOLS_DIR)/addlicense -y $(shell date +"%Y") -ignore **pb** -v -c "OpenIM." -f $(LICENSE_TEMPLATE) $(CODE_DIRS)
@echo "===========> End the copyright is added..."
# Addlicense Flags:

@ -20,6 +20,34 @@
# docker registry: registry.example.com/namespace/image:tag as: registry.hub.docker.com/cubxxw/<image-name>:<tag>
#
# # If you wish built the manager image targeting other platforms you can use the --platform flag.
# # (i.e. docker build --platform linux/arm64 ). However, you must enable docker buildKit for it.
# # More info: https://docs.docker.com/develop/develop-images/build_enhancements/
# .PHONY: docker-build
# docker-build: test ## Build docker image with the manager.
# docker build -t ${IMG} .
# .PHONY: docker-push
# docker-push: ## Push docker image with the manager.
# docker push ${IMG}
# # PLATFORMS defines the target platforms for the manager image be build to provide support to multiple
# # architectures. (i.e. make docker-buildx IMG=myregistry/mypoperator:0.0.1). To use this option you need to:
# # - able to use docker buildx . More info: https://docs.docker.com/build/buildx/
# # - have enable BuildKit, More info: https://docs.docker.com/develop/develop-images/build_enhancements/
# # - be able to push the image for your registry (i.e. if you do not inform a valid value via IMG=<myregistry/image:<tag>> then the export will fail)
# # To properly provided solutions that supports more than one platform you should use this option.
# PLATFORMS ?= linux/arm64,linux/amd64,linux/s390x,linux/ppc64le
# .PHONY: docker-buildx
# docker-buildx: test ## Build and push docker image for the manager for cross-platform support
# # copy existing Dockerfile and insert --platform=${BUILDPLATFORM} into Dockerfile.cross, and preserve the original Dockerfile
# sed -e '1 s/\(^FROM\)/FROM --platform=\$$\{BUILDPLATFORM\}/; t' -e ' 1,// s//FROM --platform=\$$\{BUILDPLATFORM\}/' Dockerfile > Dockerfile.cross
# - docker buildx create --name project-v3-builder
# docker buildx use project-v3-builder
# - docker buildx build --push --platform=$(PLATFORMS) --tag ${IMG} -f Dockerfile.cross .
# - docker buildx rm project-v3-builder
# rm Dockerfile.cross
DOCKER := docker
DOCKER_SUPPORTED_API_VERSION ?= 1.32|1.40|1.41

@ -61,7 +61,7 @@ sleep 1
cd ${msg_gateway_binary_root}
for ((i = 0; i < ${#ws_ports[@]}; i++)); do
echo "==========================start msg_gateway server===========================">>$OPENIM_ROOT/logs/openIM.log
nohup ./${openim_msggateway} --port ${rpc_ports[$i]} --ws_port ${ws_ports[$i]} --prometheus_port ${prome_ports[$i]} --config_folder_path ${configfile_path} --configFolderPath ${log_path} >>$OPENIM_ROOT/logs/openIM.log 2>&1 &
nohup ./${openim_msggateway} --port ${rpc_ports[$i]} --ws_port ${ws_ports[$i]} --prometheus_port ${prome_ports[$i]} --config_folder_path ${configfile_path} >>$OPENIM_ROOT/logs/openIM.log 2>&1 &
done
#Check launched service process

@ -55,9 +55,9 @@ sleep 1
cd ${msg_transfer_binary_root}
for ((i = 0; i < ${msg_transfer_service_num}; i++)); do
prome_port=${prome_ports[$i]}
cmd="nohup ./${openim_msgtransfer} --config_folder_path ${configfile_path} --configFolderPath ${log_path}"
cmd="nohup ./${openim_msgtransfer} --config_folder_path ${configfile_path} "
if [ $prome_port != "" ]; then
cmd="$cmd --prometheus_port $prome_port --config_folder_path ${configfile_path} --configFolderPath ${log_path}"
cmd="$cmd --prometheus_port $prome_port --config_folder_path ${configfile_path} "
fi
echo "==========================start msg_transfer server===========================">>$OPENIM_ROOT/logs/openIM.log
$cmd >>$OPENIM_ROOT/logs/openIM.log 2>&1 &

@ -100,9 +100,9 @@ for ((i = 0; i < ${#service_filename[*]}; i++)); do
for ((j = 0; j < ${#service_ports[*]}; j++)); do
#Start the service in the background
if [ -z "${prome_ports[$j]}" ]; then
cmd="./${service_filename[$i]} --port ${service_ports[$j]} --config_folder_path ${configfile_path} --configFolderPath ${log_path}"
cmd="./${service_filename[$i]} --port ${service_ports[$j]} --config_folder_path ${configfile_path} "
else
cmd="./${service_filename[$i]} --port ${service_ports[$j]} --prometheus_port ${prome_ports[$j]} --config_folder_path ${configfile_path} --configFolderPath ${log_path}"
cmd="./${service_filename[$i]} --port ${service_ports[$j]} --prometheus_port ${prome_ports[$j]} --config_folder_path ${configfile_path} "
fi
if [ $i -eq 0 -o $i -eq 1 ]; then
cmd="./${service_filename[$i]} --port ${service_ports[$j]}"

@ -0,0 +1 @@
#!/usr/bin/env bash
Loading…
Cancel
Save