diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 000000000..9faeff616 --- /dev/null +++ b/.dockerignore @@ -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/ diff --git a/.github/workflows/build-docker-image.yml b/.github/workflows/build-docker-image.yml new file mode 100644 index 000000000..553ae5d10 --- /dev/null +++ b/.github/workflows/build-docker-image.yml @@ -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 \ No newline at end of file diff --git a/.github/workflows/openim-ci.yml b/.github/workflows/openim-ci.yml index 73b30e42b..6460a43b1 100644 --- a/.github/workflows/openim-ci.yml +++ b/.github/workflows/openim-ci.yml @@ -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 diff --git a/.gitignore b/.gitignore index d8c6b0286..6edf18a05 100644 --- a/.gitignore +++ b/.gitignore @@ -353,7 +353,6 @@ cscope.po.out *testsdir *testsfile *testsfiles -*test *testdir *testfile *testfiles diff --git a/Dockerfile b/Dockerfile index 579c0c1d6..230b9d6d6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 +# Copy all files to the container +ADD . . -RUN /bin/sh -c ./build_all_service.sh +RUN /bin/sh -c "make build" -#Blank image Multi-Stage Build -FROM ubuntu +# Production Stage +FROM alpine -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 +RUN apk --no-cache add tzdata +# 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"] -#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"] - -#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 diff --git a/cmd/openim-msgtransfer/main.go b/cmd/openim-msgtransfer/main.go index 7f8d1ce80..aef347793 100644 --- a/cmd/openim-msgtransfer/main.go +++ b/cmd/openim-msgtransfer/main.go @@ -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 ( diff --git a/docker-compose.yaml b/docker-compose.yaml index cea3b1480..842b05ae5 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -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 diff --git a/internal/api/third.go b/internal/api/third.go index 19beeeb11..3f28aca89 100644 --- a/internal/api/third.go +++ b/internal/api/third.go @@ -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 ( diff --git a/internal/msgtransfer/init.go b/internal/msgtransfer/init.go index 1f166d743..17b350247 100644 --- a/internal/msgtransfer/init.go +++ b/internal/msgtransfer/init.go @@ -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 ( diff --git a/internal/push/push_to_client.go b/internal/push/push_to_client.go index 607d862e1..f12b4b4c8 100644 --- a/internal/push/push_to_client.go +++ b/internal/push/push_to_client.go @@ -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 ( diff --git a/internal/rpc/conversation/conversaion.go b/internal/rpc/conversation/conversaion.go index 1f45d0224..5372d4220 100644 --- a/internal/rpc/conversation/conversaion.go +++ b/internal/rpc/conversation/conversaion.go @@ -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 ( diff --git a/internal/rpc/group/group.go b/internal/rpc/group/group.go index ec5d0bdb5..161e8b8f8 100644 --- a/internal/rpc/group/group.go +++ b/internal/rpc/group/group.go @@ -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 ( diff --git a/internal/rpc/group/statistics.go b/internal/rpc/group/statistics.go index c6664b4df..9b83a5ead 100644 --- a/internal/rpc/group/statistics.go +++ b/internal/rpc/group/statistics.go @@ -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 ( diff --git a/internal/rpc/msg/server.go b/internal/rpc/msg/server.go index 17aac5040..3289a4b47 100644 --- a/internal/rpc/msg/server.go +++ b/internal/rpc/msg/server.go @@ -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 ( diff --git a/internal/rpc/msg/statistics.go b/internal/rpc/msg/statistics.go index 872ec8f18..309534507 100644 --- a/internal/rpc/msg/statistics.go +++ b/internal/rpc/msg/statistics.go @@ -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 ( diff --git a/internal/rpc/third/s3.go b/internal/rpc/third/s3.go index 4cbbd3d7d..984fca94f 100644 --- a/internal/rpc/third/s3.go +++ b/internal/rpc/third/s3.go @@ -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 ( diff --git a/internal/rpc/third/third.go b/internal/rpc/third/third.go index 7c487b1d2..99ddcb342 100644 --- a/internal/rpc/third/third.go +++ b/internal/rpc/third/third.go @@ -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 ( diff --git a/internal/rpc/third/tool.go b/internal/rpc/third/tool.go index 84017ae1f..247f3e21d 100644 --- a/internal/rpc/third/tool.go +++ b/internal/rpc/third/tool.go @@ -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 ( diff --git a/internal/rpc/user/user.go b/internal/rpc/user/user.go index 4619db4ce..9b1e691e5 100644 --- a/internal/rpc/user/user.go +++ b/internal/rpc/user/user.go @@ -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 ( diff --git a/internal/tools/conversation.go b/internal/tools/conversation.go index 1cad58248..8efa77be8 100644 --- a/internal/tools/conversation.go +++ b/internal/tools/conversation.go @@ -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 ( diff --git a/internal/tools/msg.go b/internal/tools/msg.go index 7247d32eb..18e7fb584 100644 --- a/internal/tools/msg.go +++ b/internal/tools/msg.go @@ -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 ( diff --git a/pkg/apiresp/format.go b/pkg/apiresp/format.go index 34fb85464..b53f31cbd 100644 --- a/pkg/apiresp/format.go +++ b/pkg/apiresp/format.go @@ -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 { diff --git a/pkg/apistruct/auth.go b/pkg/apistruct/auth.go index 119cbac77..a1538347d 100644 --- a/pkg/apistruct/auth.go +++ b/pkg/apistruct/auth.go @@ -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"` diff --git a/pkg/apistruct/conversation.go b/pkg/apistruct/conversation.go index c58daa634..efac9a563 100644 --- a/pkg/apistruct/conversation.go +++ b/pkg/apistruct/conversation.go @@ -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{} diff --git a/pkg/apistruct/friend.go b/pkg/apistruct/friend.go index 3b1ab919d..5aac9494e 100644 --- a/pkg/apistruct/friend.go +++ b/pkg/apistruct/friend.go @@ -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 { diff --git a/pkg/apistruct/group.go b/pkg/apistruct/group.go index 45be76cf9..a3a379164 100644 --- a/pkg/apistruct/group.go +++ b/pkg/apistruct/group.go @@ -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"` diff --git a/pkg/apistruct/manage.go b/pkg/apistruct/manage.go index 455b2fe4c..042f61aa0 100644 --- a/pkg/apistruct/manage.go +++ b/pkg/apistruct/manage.go @@ -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"` diff --git a/pkg/apistruct/msg.go b/pkg/apistruct/msg.go index a07616ff2..35351315a 100644 --- a/pkg/apistruct/msg.go +++ b/pkg/apistruct/msg.go @@ -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"` diff --git a/pkg/apistruct/third.go b/pkg/apistruct/third.go index 76ff89f62..ce4719e1f 100644 --- a/pkg/apistruct/third.go +++ b/pkg/apistruct/third.go @@ -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 { } /** - * FCM第三方上报Token + * FCM第三方上报Token. */ 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{} diff --git a/pkg/callbackstruct/msg_gateway.go b/pkg/callbackstruct/msg_gateway.go index a70f724ce..ef98c4058 100644 --- a/pkg/callbackstruct/msg_gateway.go +++ b/pkg/callbackstruct/msg_gateway.go @@ -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"` diff --git a/pkg/common/cmd/rpc.go b/pkg/common/cmd/rpc.go index c9ac80b44..239858764 100644 --- a/pkg/common/cmd/rpc.go +++ b/pkg/common/cmd/rpc.go @@ -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 ( diff --git a/pkg/common/constant/constant.go b/pkg/common/constant/constant.go index 2e5432b48..c9652984f 100644 --- a/pkg/common/constant/constant.go +++ b/pkg/common/constant/constant.go @@ -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" diff --git a/pkg/common/constant/platform_id_to_name.go b/pkg/common/constant/platform_id_to_name.go index 31b1fcdd9..169e1e758 100644 --- a/pkg/common/constant/platform_id_to_name.go +++ b/pkg/common/constant/platform_id_to_name.go @@ -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] } diff --git a/pkg/common/db/controller/conversation.go b/pkg/common/db/controller/conversation.go index 7908d163a..659d250c6 100644 --- a/pkg/common/db/controller/conversation.go +++ b/pkg/common/db/controller/conversation.go @@ -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 ( diff --git a/pkg/common/db/controller/msg.go b/pkg/common/db/controller/msg.go index f23e7580c..30a8fc265 100644 --- a/pkg/common/db/controller/msg.go +++ b/pkg/common/db/controller/msg.go @@ -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 ( diff --git a/pkg/common/db/controller/s3.go b/pkg/common/db/controller/s3.go index b3cc9dbb4..ecc438ef2 100644 --- a/pkg/common/db/controller/s3.go +++ b/pkg/common/db/controller/s3.go @@ -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 ( diff --git a/pkg/common/db/relation/conversation_model.go b/pkg/common/db/relation/conversation_model.go index f4a282af0..10b82ef7c 100644 --- a/pkg/common/db/relation/conversation_model.go +++ b/pkg/common/db/relation/conversation_model.go @@ -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 ( diff --git a/pkg/common/db/relation/group_model.go b/pkg/common/db/relation/group_model.go index f3e1aec2f..8afc97bef 100644 --- a/pkg/common/db/relation/group_model.go +++ b/pkg/common/db/relation/group_model.go @@ -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 ( diff --git a/pkg/common/db/relation/object_model.go b/pkg/common/db/relation/object_model.go index bd2d22c3f..928c72fbe 100644 --- a/pkg/common/db/relation/object_model.go +++ b/pkg/common/db/relation/object_model.go @@ -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 ( diff --git a/pkg/common/db/s3/cont/consts.go b/pkg/common/db/s3/cont/consts.go index 144370a2d..1a0467ce5 100644 --- a/pkg/common/db/s3/cont/consts.go +++ b/pkg/common/db/s3/cont/consts.go @@ -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 ( diff --git a/pkg/common/db/s3/cont/controller.go b/pkg/common/db/s3/cont/controller.go index ba834a739..0ab700e21 100644 --- a/pkg/common/db/s3/cont/controller.go +++ b/pkg/common/db/s3/cont/controller.go @@ -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 ( diff --git a/pkg/common/db/s3/cont/error.go b/pkg/common/db/s3/cont/error.go index afd1d0eba..af09779ee 100644 --- a/pkg/common/db/s3/cont/error.go +++ b/pkg/common/db/s3/cont/error.go @@ -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 ( diff --git a/pkg/common/db/s3/cont/id.go b/pkg/common/db/s3/cont/id.go index 67acfae37..47f37d4aa 100644 --- a/pkg/common/db/s3/cont/id.go +++ b/pkg/common/db/s3/cont/id.go @@ -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 ( diff --git a/pkg/common/db/s3/cont/structs.go b/pkg/common/db/s3/cont/structs.go index 160dfba70..1ebbfcaed 100644 --- a/pkg/common/db/s3/cont/structs.go +++ b/pkg/common/db/s3/cont/structs.go @@ -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" diff --git a/pkg/common/db/s3/cos/cos.go b/pkg/common/db/s3/cos/cos.go index 4b1b4aa4d..c3a2b104c 100644 --- a/pkg/common/db/s3/cos/cos.go +++ b/pkg/common/db/s3/cos/cos.go @@ -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 ( diff --git a/pkg/common/db/s3/minio/minio.go b/pkg/common/db/s3/minio/minio.go index 851464ce7..48d192420 100644 --- a/pkg/common/db/s3/minio/minio.go +++ b/pkg/common/db/s3/minio/minio.go @@ -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 ( diff --git a/pkg/common/db/s3/oss/oss.go b/pkg/common/db/s3/oss/oss.go index f2b50da50..1b5745fe1 100644 --- a/pkg/common/db/s3/oss/oss.go +++ b/pkg/common/db/s3/oss/oss.go @@ -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 ( diff --git a/pkg/common/db/s3/oss/sign.go b/pkg/common/db/s3/oss/sign.go index 82618d287..a272a64c5 100644 --- a/pkg/common/db/s3/oss/sign.go +++ b/pkg/common/db/s3/oss/sign.go @@ -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 ( diff --git a/pkg/common/db/s3/oss/sort.go b/pkg/common/db/s3/oss/sort.go index 40c9a5af1..667984ffb 100644 --- a/pkg/common/db/s3/oss/sort.go +++ b/pkg/common/db/s3/oss/sort.go @@ -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 ( diff --git a/pkg/common/db/s3/s3.go b/pkg/common/db/s3/s3.go index 4f1571b1e..55adc313c 100644 --- a/pkg/common/db/s3/s3.go +++ b/pkg/common/db/s3/s3.go @@ -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 ( diff --git a/pkg/common/db/table/relation/conversation.go b/pkg/common/db/table/relation/conversation.go index 6fd260583..3e095238f 100644 --- a/pkg/common/db/table/relation/conversation.go +++ b/pkg/common/db/table/relation/conversation.go @@ -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 ( diff --git a/pkg/common/db/table/relation/object.go b/pkg/common/db/table/relation/object.go index eb58c308d..0ed4130a6 100644 --- a/pkg/common/db/table/relation/object.go +++ b/pkg/common/db/table/relation/object.go @@ -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 ( diff --git a/pkg/common/log/sql_logger.go b/pkg/common/log/sql_logger.go index 9e9bb1be6..ae6cafb34 100644 --- a/pkg/common/log/sql_logger.go +++ b/pkg/common/log/sql_logger.go @@ -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 ( diff --git a/pkg/common/mcontext/ctx.go b/pkg/common/mcontext/ctx.go index bbca660b9..79234e2e0 100644 --- a/pkg/common/mcontext/ctx.go +++ b/pkg/common/mcontext/ctx.go @@ -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 - } diff --git a/pkg/discoveryregistry/zookeeper/discover.go b/pkg/discoveryregistry/zookeeper/discover.go index a9848ee32..089d34afe 100644 --- a/pkg/discoveryregistry/zookeeper/discover.go +++ b/pkg/discoveryregistry/zookeeper/discover.go @@ -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 ( diff --git a/pkg/errs/code.go b/pkg/errs/code.go index 3cd66611d..4b7193824 100644 --- a/pkg/errs/code.go +++ b/pkg/errs/code.go @@ -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 // 上传过期 ) diff --git a/pkg/errs/predefine.go b/pkg/errs/predefine.go index 16525420c..f11349891 100644 --- a/pkg/errs/predefine.go +++ b/pkg/errs/predefine.go @@ -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") diff --git a/pkg/rpcclient/conversation.go b/pkg/rpcclient/conversation.go index 617446852..cc9bc5358 100644 --- a/pkg/rpcclient/conversation.go +++ b/pkg/rpcclient/conversation.go @@ -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 ( diff --git a/pkg/rpcclient/msg.go b/pkg/rpcclient/msg.go index ca02ecc90..09e44884f 100644 --- a/pkg/rpcclient/msg.go +++ b/pkg/rpcclient/msg.go @@ -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 ( diff --git a/pkg/rpcclient/notification/group.go b/pkg/rpcclient/notification/group.go index 3efe76802..3f312c241 100644 --- a/pkg/rpcclient/notification/group.go +++ b/pkg/rpcclient/notification/group.go @@ -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 ( diff --git a/pkg/rpcclient/notification/msg.go b/pkg/rpcclient/notification/msg.go index 97724f727..c475291d2 100644 --- a/pkg/rpcclient/notification/msg.go +++ b/pkg/rpcclient/notification/msg.go @@ -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 ( diff --git a/scripts/build_all_service.sh b/scripts/build_all_service.sh index 3fd56b420..fd6ad6dcd 100755 --- a/scripts/build_all_service.sh +++ b/scripts/build_all_service.sh @@ -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" - -#Include shell font styles and some basic information -source ./style_info.sh -source ./path_info.sh -source ./function.sh - cd $OPENIM_ROOT -# Execute 'make build' -make build +# CPU core number +cpu_count=$(lscpu | grep -e '^CPU(s):' | awk '{print $2}') +echo -e "${GREEN_PREFIX}======> cpu_count=$cpu_count${COLOR_SUFFIX}" + +# Count the number of concurrent compilations (half the number of cpus) +compile_count=$((cpu_count / 2)) + +# 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" diff --git a/scripts/make-rules/copyright.mk b/scripts/make-rules/copyright.mk index d1c243caf..319e46945 100644 --- a/scripts/make-rules/copyright.mk +++ b/scripts/make-rules/copyright.mk @@ -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: diff --git a/scripts/make-rules/image.mk b/scripts/make-rules/image.mk index e70583c34..326507d83 100644 --- a/scripts/make-rules/image.mk +++ b/scripts/make-rules/image.mk @@ -20,6 +20,34 @@ # docker registry: registry.example.com/namespace/image:tag as: registry.hub.docker.com/cubxxw/: # +# # 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=> 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 diff --git a/scripts/msg_gateway_start.sh b/scripts/msg_gateway_start.sh index 70267c85b..cc6f0b5dd 100755 --- a/scripts/msg_gateway_start.sh +++ b/scripts/msg_gateway_start.sh @@ -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 diff --git a/scripts/msg_transfer_start.sh b/scripts/msg_transfer_start.sh index cfc0efd30..2e03b4b1a 100755 --- a/scripts/msg_transfer_start.sh +++ b/scripts/msg_transfer_start.sh @@ -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 & diff --git a/scripts/start_rpc_service.sh b/scripts/start_rpc_service.sh index 09b7f69c5..f1624c34e 100755 --- a/scripts/start_rpc_service.sh +++ b/scripts/start_rpc_service.sh @@ -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]}" diff --git a/test/common.sh b/test/common.sh new file mode 100644 index 000000000..f1f641af1 --- /dev/null +++ b/test/common.sh @@ -0,0 +1 @@ +#!/usr/bin/env bash