From 62141fa1214b56ca7b1d5e95583b0623c8046ded Mon Sep 17 00:00:00 2001
From: Alan <68671759+hanzhixiao@users.noreply.github.com>
Date: Mon, 31 Jul 2023 15:37:46 +0800
Subject: [PATCH 01/59] Docs: Update README.md (#726)
---
README.md | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 3c52475f3..5ed6664db 100644
--- a/README.md
+++ b/README.md
@@ -89,9 +89,12 @@ make check
### Compile from source
Ur need `Go 1.18` or higher version, and `make`.
+
+Version Details: https://github.com/OpenIMSDK/Open-IM-Server/blob/main/docs/conversions/version.md
+
```bash
# choose what you need
-BRANCH=release-v3.0
+BRANCH=release-v3.1
git clone -b $BRANCH https://github.com/OpenIMSDK/Open-IM-Server openim && export openim=$(pwd)/openim && cd $openim && make build
```
Read about the [OpenIM Version Policy](https://github.com/OpenIMSDK/Open-IM-Server/blob/main/docs/conversions/version.md)
From b131013b3f15d89f141beb50e07bf6b178adfdff Mon Sep 17 00:00:00 2001
From: withchao <48119764+withchao@users.noreply.github.com>
Date: Mon, 31 Jul 2023 17:41:40 +0800
Subject: [PATCH 02/59] feat: add get_group_member_user_id api (#734)
---
internal/api/group.go | 4 ++++
internal/api/route.go | 1 +
2 files changed, 5 insertions(+)
diff --git a/internal/api/group.go b/internal/api/group.go
index ab397a8ac..ad640e74f 100644
--- a/internal/api/group.go
+++ b/internal/api/group.go
@@ -139,3 +139,7 @@ func (o *GroupApi) GroupCreateCount(c *gin.Context) {
func (o *GroupApi) GetGroups(c *gin.Context) {
a2r.Call(group.GroupClient.GetGroups, o.Client, c)
}
+
+func (o *GroupApi) GetGroupMemberUserIDs(c *gin.Context) {
+ a2r.Call(group.GroupClient.GetGroupMemberUserIDs, o.Client, c)
+}
diff --git a/internal/api/route.go b/internal/api/route.go
index 1926b55f1..5dd0c4cc7 100644
--- a/internal/api/route.go
+++ b/internal/api/route.go
@@ -129,6 +129,7 @@ func NewGinRouter(discov discoveryregistry.SvcDiscoveryRegistry, rdb redis.Unive
groupRouterGroup.POST("/set_group_member_info", g.SetGroupMemberInfo)
groupRouterGroup.POST("/get_group_abstract_info", g.GetGroupAbstractInfo)
groupRouterGroup.POST("/get_groups", g.GetGroups)
+ groupRouterGroup.POST("/get_group_member_user_id", g.GetGroupMemberUserIDs)
}
superGroupRouterGroup := r.Group("/super_group", ParseToken)
{
From fb021baf526fe6922f56b45a0eb8ecb77c6b37ec Mon Sep 17 00:00:00 2001
From: Xinwei Xiong <3293172751NSS@gmail.com>
Date: Mon, 31 Jul 2023 18:39:47 +0800
Subject: [PATCH 03/59] docs: update readme version (#735)
---
docs/conversions/version.md | 27 +++++++++++++++++++++------
1 file changed, 21 insertions(+), 6 deletions(-)
diff --git a/docs/conversions/version.md b/docs/conversions/version.md
index 06e34543b..c8a3dbd1c 100644
--- a/docs/conversions/version.md
+++ b/docs/conversions/version.md
@@ -6,21 +6,36 @@ OpenIM, the open source project, employs a comprehensive version management syst
## Main Branch
-The `main` branch is where all the latest code resides. It's the hub of activity, embodying all the cutting-edge features that are currently being developed or updated. However, since it's subject to frequent changes and updates, it may not always represent the most stable version of the software. Access the `main` branch [here](https://github.com/openimsdk/openim-server/tree/main).
+The `main` branch is where all the latest code resides. It's the hub of activity, embodying all the cutting-edge features that are currently being developed or updated. However, since it's subject to frequent changes and updates, it may not always represent the most stable version of the software. Access the `main` branch [here](https://github.com/OpenIMSDK/Open-IM-Server/tree/main).
## Release Branch
-On the other hand, we have the `release` branch. For instance, in the context of version 3.1, we maintain a `release-v3.1` branch. Unlike the `main` branch, the release branch is designed to be a continuously stable and updated version of the software. This provides a reliable option for users who prefer stability over the latest, but potentially unstable, features. Access the `release-v3.1` branch [here](https://github.com/openimsdk/openim-server/tree/release-v3.1).
+On the other hand, we have the `release` branch. For instance, in the context of version 3.1, we maintain a `release-v3.1` branch. Unlike the `main` branch, the release branch is designed to be a continuously stable and updated version of the software. This provides a reliable option for users who prefer stability over the latest, but potentially unstable, features. Access the `release-v3.1` branch [here](https://github.com/OpenIMSDK/Open-IM-Server/tree/release-v3.1).
## Tag Management
-Finally, there's `tag` management. Despite having both `main` and `release` branches, `tag` serves a crucial role. Tags are immutable, i.e., they remain unchanged once created. Therefore, if you need a specific version of the software, you can use the corresponding tag. Check out the available tags [here](https://github.com/openimsdk/openim-server/tags).
+In addition to the `main` and `release` branches, `tag` also plays a pivotal role in version control. Tags are immutable, meaning once they're created, they remain unchanged. Therefore, if you need a specific version of the software, you can use the corresponding tag. All of our available tags can be viewed [here](https://github.com/OpenIMSDK/Open-IM-Server/tags).
-Moreover, our Docker image versions are closely tied with these three components. For instance, a tag might correspond to the Docker image `ghcr.io/openimsdk/openim-server:v3.1.0`, a release would be `ghcr.io/openimsdk/openim-server:release-v3.0`, and the main branch might be represented as `ghcr.io/openimsdk/openim-server:main` or `ghcr.io/openimsdk/openim-server:latest`.
+Moreover, our Docker image versions are closely tied with these three components. For example, a tag might correspond to the Docker image `ghcr.io/openimsdk/openim-server:v3.1.0`, a release might be represented as `ghcr.io/openimsdk/openim-server:release-v3.0`, and the main branch could be represented as `ghcr.io/openimsdk/openim-server:main` or `ghcr.io/openimsdk/openim-server:latest`.
-To find out more, or to contribute to our project, please visit our GitHub repository at [OpenIM Server](https://github.com/openimsdk/openim-server).
+Here is the specification of our version numbers:
-We believe that this approach offers a balanced blend of innovation and stability, enabling us to provide the best possible software to our users.
+- **Revision version number**: The third digit of the version number, representing bug fixes or code optimizations, usually no new features are added and it is backward compatible with older versions.
+
+- **Build version number**: Usually automatically generated by the system, every code submission will result in an automatic increment by 1.
+
+- Version modifiers
+
+ : These can represent the development stage and stability of the software. Common ones include:
+
+ - `alpha`: An internal testing version with many bugs, generally used for communication among developers.
+ - `beta`: A test version with many bugs, generally used for testing by eager community members, who provide feedback to the developers.
+ - `rc`: Release candidate, to be released as the official version, it's the last test version before the official version.
+ - `ga`: General Availability, the first stable release.
+ - `r/release/or nothing`: The final release version, intended for general users.
+ - `lts`: Long Term Support, the official will specify the maintenance year for this version and will fix all bugs found in this version.
+
+When adding partial functions to the project, the minor version number increases by 1, and the revision version number resets to 0. When there are major changes in the project, the major version number increases by 1. The build number is generally automatically generated by the compiler during the compilation process, only the format needs to be defined, and it does not need to be manually controlled.
## OpenIM version
From 4e7f7e8605fbaf572f64ec3708201bbede33e37e Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Mon, 31 Jul 2023 18:41:18 +0800
Subject: [PATCH 04/59] build(deps): bump github.com/spf13/cobra from 1.6.1 to
1.7.0 (#727)
Bumps [github.com/spf13/cobra](https://github.com/spf13/cobra) from 1.6.1 to 1.7.0.
- [Release notes](https://github.com/spf13/cobra/releases)
- [Commits](https://github.com/spf13/cobra/compare/v1.6.1...v1.7.0)
---
updated-dependencies:
- dependency-name: github.com/spf13/cobra
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
go.mod | 4 ++--
go.sum | 8 ++++----
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/go.mod b/go.mod
index e016ff06f..0e2045aa8 100644
--- a/go.mod
+++ b/go.mod
@@ -77,7 +77,7 @@ require (
github.com/googleapis/enterprise-certificate-proxy v0.2.5 // indirect
github.com/googleapis/gax-go/v2 v2.12.0 // indirect
github.com/hashicorp/go-uuid v1.0.2 // indirect
- github.com/inconshreveable/mousetrap v1.0.1 // indirect
+ github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/jcmturner/aescts/v2 v2.0.0 // indirect
github.com/jcmturner/dnsutils/v2 v2.0.0 // indirect
github.com/jcmturner/gofork v1.0.0 // indirect
@@ -134,7 +134,7 @@ require (
github.com/goccy/go-json v0.10.2 // indirect
github.com/lestrrat-go/strftime v1.0.6 // indirect
github.com/mattn/go-isatty v0.0.19 // indirect
- github.com/spf13/cobra v1.6.1
+ github.com/spf13/cobra v1.7.0
github.com/ugorji/go/codec v1.2.11 // indirect
go.uber.org/zap v1.24.0 // indirect
golang.org/x/crypto v0.11.0 // indirect
diff --git a/go.sum b/go.sum
index 067ef5301..49db92e88 100644
--- a/go.sum
+++ b/go.sum
@@ -180,8 +180,8 @@ github.com/hashicorp/go-uuid v1.0.2 h1:cfejS+Tpcp13yd5nYHWDI6qVCny6wyX2Mt5SGur2I
github.com/hashicorp/go-uuid v1.0.2/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
-github.com/inconshreveable/mousetrap v1.0.1 h1:U3uMjPSQEBMNp1lFxmllqCPM6P5u/Xq7Pgzkat/bFNc=
-github.com/inconshreveable/mousetrap v1.0.1/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
+github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
+github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
github.com/jcmturner/aescts/v2 v2.0.0 h1:9YKLH6ey7H4eDBXW8khjYslgyqG2xZikXP0EQFKrle8=
github.com/jcmturner/aescts/v2 v2.0.0/go.mod h1:AiaICIRyfYg35RUkr8yESTqvSy7csK90qZ5xfvvsoNs=
github.com/jcmturner/dnsutils/v2 v2.0.0 h1:lltnkeZGL0wILNvrNiVCR6Ro5PGU/SeBvVO/8c/iPbo=
@@ -298,8 +298,8 @@ github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
-github.com/spf13/cobra v1.6.1 h1:o94oiPyS4KD1mPy2fmcYYHHfCxLqYjJOhGsCHFZtEzA=
-github.com/spf13/cobra v1.6.1/go.mod h1:IOw/AERYS7UzyrGinqmz6HLUo219MORXGxhbaJUqzrY=
+github.com/spf13/cobra v1.7.0 h1:hyqWnYt1ZQShIddO5kBpj3vu05/++x6tJ6dg8EC572I=
+github.com/spf13/cobra v1.7.0/go.mod h1:uLxZILRyS/50WlhOIKD7W6V5bgeIt+4sICxh6uRMrb0=
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
From f971a148c88d9d4007264fcc8b390b53d6644df7 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Mon, 31 Jul 2023 18:41:41 +0800
Subject: [PATCH 05/59] build(deps): bump
github.com/go-playground/validator/v10 (#728)
Bumps [github.com/go-playground/validator/v10](https://github.com/go-playground/validator) from 10.14.0 to 10.14.1.
- [Release notes](https://github.com/go-playground/validator/releases)
- [Commits](https://github.com/go-playground/validator/compare/v10.14.0...v10.14.1)
---
updated-dependencies:
- dependency-name: github.com/go-playground/validator/v10
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
go.mod | 2 +-
go.sum | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/go.mod b/go.mod
index 0e2045aa8..d6be16329 100644
--- a/go.mod
+++ b/go.mod
@@ -8,7 +8,7 @@ require (
github.com/bwmarrin/snowflake v0.3.0 // indirect
github.com/dtm-labs/rockscache v0.1.1
github.com/gin-gonic/gin v1.9.1
- github.com/go-playground/validator/v10 v10.14.0
+ github.com/go-playground/validator/v10 v10.14.1
github.com/gogo/protobuf v1.3.2
github.com/golang-jwt/jwt/v4 v4.5.0
github.com/golang/protobuf v1.5.3
diff --git a/go.sum b/go.sum
index 49db92e88..623e24cbf 100644
--- a/go.sum
+++ b/go.sum
@@ -100,8 +100,8 @@ github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/o
github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY=
github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY=
github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY=
-github.com/go-playground/validator/v10 v10.14.0 h1:vgvQWe3XCz3gIeFDm/HnTIbj6UGmg/+t63MyGU2n5js=
-github.com/go-playground/validator/v10 v10.14.0/go.mod h1:9iXMNT7sEkjXb0I+enO7QXmzG6QCsPWY4zveKFVRSyU=
+github.com/go-playground/validator/v10 v10.14.1 h1:9c50NUPC30zyuKprjL3vNZ0m5oG+jU0zvx4AqHGnv4k=
+github.com/go-playground/validator/v10 v10.14.1/go.mod h1:9iXMNT7sEkjXb0I+enO7QXmzG6QCsPWY4zveKFVRSyU=
github.com/go-redis/redis v6.15.9+incompatible h1:K0pv1D7EQUjfyoMql+r/jZqCLizCGKFlFgcHWWmHQjg=
github.com/go-redis/redis v6.15.9+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA=
github.com/go-sql-driver/mysql v1.7.0/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI=
From 37611ab0dd32b97e8999549412a0e5f153016235 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Mon, 31 Jul 2023 18:43:25 +0800
Subject: [PATCH 06/59] build(deps): bump google.golang.org/grpc from 1.56.2 to
1.57.0 (#730)
Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.56.2 to 1.57.0.
- [Release notes](https://github.com/grpc/grpc-go/releases)
- [Commits](https://github.com/grpc/grpc-go/compare/v1.56.2...v1.57.0)
---
updated-dependencies:
- dependency-name: google.golang.org/grpc
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
go.mod | 2 +-
go.sum | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/go.mod b/go.mod
index d6be16329..002456235 100644
--- a/go.mod
+++ b/go.mod
@@ -27,7 +27,7 @@ require (
go.mongodb.org/mongo-driver v1.12.0
golang.org/x/image v0.9.0 // indirect
google.golang.org/api v0.134.0
- google.golang.org/grpc v1.56.2
+ google.golang.org/grpc v1.57.0
google.golang.org/protobuf v1.31.0
gopkg.in/yaml.v3 v3.0.1
gorm.io/driver/mysql v1.5.1
diff --git a/go.sum b/go.sum
index 623e24cbf..39d3269cc 100644
--- a/go.sum
+++ b/go.sum
@@ -486,8 +486,8 @@ google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTp
google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc=
google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU=
google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ=
-google.golang.org/grpc v1.56.2 h1:fVRFRnXvU+x6C4IlHZewvJOVHoOv1TUuQyoRsYnB4bI=
-google.golang.org/grpc v1.56.2/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s=
+google.golang.org/grpc v1.57.0 h1:kfzNeI/klCGD2YPMUlaGNT3pxvYfga7smW3Vth8Zsiw=
+google.golang.org/grpc v1.57.0/go.mod h1:Sd+9RMTACXwmub0zcNY2c4arhtrbBYD1AUHI/dt16Mo=
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
From a7acc8d9d27a922faa60e41ae9bcf64020c29b55 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Mon, 31 Jul 2023 18:43:34 +0800
Subject: [PATCH 07/59] build(deps): bump github.com/stretchr/testify from
1.8.3 to 1.8.4 (#731)
Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify) from 1.8.3 to 1.8.4.
- [Release notes](https://github.com/stretchr/testify/releases)
- [Commits](https://github.com/stretchr/testify/compare/v1.8.3...v1.8.4)
---
updated-dependencies:
- dependency-name: github.com/stretchr/testify
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
go.mod | 2 +-
go.sum | 3 ++-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/go.mod b/go.mod
index 002456235..3552dc765 100644
--- a/go.mod
+++ b/go.mod
@@ -23,7 +23,7 @@ require (
github.com/prometheus/client_golang v1.16.0
github.com/robfig/cron/v3 v3.0.1
github.com/sirupsen/logrus v1.9.3 // indirect
- github.com/stretchr/testify v1.8.3
+ github.com/stretchr/testify v1.8.4
go.mongodb.org/mongo-driver v1.12.0
golang.org/x/image v0.9.0 // indirect
google.golang.org/api v0.134.0
diff --git a/go.sum b/go.sum
index 39d3269cc..d82a9c662 100644
--- a/go.sum
+++ b/go.sum
@@ -314,8 +314,9 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
-github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY=
github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
+github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
+github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.563/go.mod h1:7sCQWVkxcsR38nffDW057DRGk8mUjK1Ing/EFOK8s8Y=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/kms v1.0.563/go.mod h1:uom4Nvi9W+Qkom0exYiJ9VWJjXwyxtPYTkKkaLMlfE0=
github.com/tencentyun/cos-go-sdk-v5 v0.7.42 h1:Up1704BJjI5orycXKjpVpvuOInt9GC5pqY4knyE9Uds=
From 0ca097db8f56efa26c5128a153d0736f75d28356 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Mon, 31 Jul 2023 18:51:47 +0800
Subject: [PATCH 08/59] build(deps): bump github.com/gorilla/websocket from
1.4.2 to 1.5.0 (#729)
Bumps [github.com/gorilla/websocket](https://github.com/gorilla/websocket) from 1.4.2 to 1.5.0.
- [Release notes](https://github.com/gorilla/websocket/releases)
- [Commits](https://github.com/gorilla/websocket/compare/v1.4.2...v1.5.0)
---
updated-dependencies:
- dependency-name: github.com/gorilla/websocket
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
go.mod | 2 +-
go.sum | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/go.mod b/go.mod
index 3552dc765..9180c49f3 100644
--- a/go.mod
+++ b/go.mod
@@ -12,7 +12,7 @@ require (
github.com/gogo/protobuf v1.3.2
github.com/golang-jwt/jwt/v4 v4.5.0
github.com/golang/protobuf v1.5.3
- github.com/gorilla/websocket v1.4.2
+ github.com/gorilla/websocket v1.5.0
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0
github.com/jinzhu/copier v0.3.5
github.com/lestrrat-go/file-rotatelogs v2.4.0+incompatible // indirect
diff --git a/go.sum b/go.sum
index d82a9c662..e804eb461 100644
--- a/go.sum
+++ b/go.sum
@@ -171,8 +171,8 @@ github.com/googleapis/gax-go/v2 v2.12.0 h1:A+gCJKdRfqXkr+BIRGtZLibNXf0m1f9E4HG56
github.com/googleapis/gax-go/v2 v2.12.0/go.mod h1:y+aIqrI5eb1YGMVJfuV3185Ts/D7qKpsEkdD5+I6QGU=
github.com/gorilla/securecookie v1.1.1/go.mod h1:ra0sb63/xPlUeL+yeDciTfxMRAA+MP+HVt/4epWDjd4=
github.com/gorilla/sessions v1.2.1/go.mod h1:dk2InVEVJ0sfLlnXv9EAgkf6ecYs/i80K/zI+bUmuGM=
-github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc=
-github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
+github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc=
+github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 h1:Ovs26xHkKqVztRpIrF/92BcuyuQ/YW4NSIpoGtfXNho=
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk=
github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw=
From 444dc1ae6eba7ff44053a4899bcac3bf2b8f9376 Mon Sep 17 00:00:00 2001
From: Xinwei Xiong <3293172751NSS@gmail.com>
Date: Tue, 1 Aug 2023 17:16:37 +0800
Subject: [PATCH 09/59] Update images.md (#743)
---
docs/conversions/images.md | 18 ++++++------------
1 file changed, 6 insertions(+), 12 deletions(-)
diff --git a/docs/conversions/images.md b/docs/conversions/images.md
index f2072dea2..70401ec07 100644
--- a/docs/conversions/images.md
+++ b/docs/conversions/images.md
@@ -54,22 +54,19 @@ When pulling OpenIM's Docker images, you can choose the most suitable source bas
- Pull from GitHub:
- ```
- bashCopy code
+ ```bash
docker pull ghcr.io/openimsdk/openim-server:latest
```
- Pull from Alibaba Cloud:
- ```
- bashCopy code
+ ```bash
docker pull registry.cn-hangzhou.aliyuncs.com/openimsdk/openim-server:latest
```
- Pull from Docker Hub:
- ```
- bashCopy code
+ ```bash
docker pull docker.io/openim/openim-server:latest
```
@@ -77,22 +74,19 @@ When pulling OpenIM's Docker images, you can choose the most suitable source bas
- Pull from GitHub:
- ```
- bashCopy code
+ ```bash
docker pull ghcr.io/openimsdk/openim-chat:latest
```
- Pull from Alibaba Cloud:
- ```
- bashCopy code
+ ```bash
docker pull registry.cn-hangzhou.aliyuncs.com/openimsdk/openim-chat:latest
```
- Pull from Docker Hub:
- ```
- bashCopy code
+ ```bash
docker pull docker.io/openim/openim-chat:latest
```
From b514bd89341bfafa30109808993432693b4160c7 Mon Sep 17 00:00:00 2001
From: pluto <83957921+plutoyty@users.noreply.github.com>
Date: Tue, 1 Aug 2023 22:10:02 +0800
Subject: [PATCH 10/59] Nginx reverse proxy and TLS configuration (#742)
* Resolving code conflicts after project directory changes and Add subscribe and unsubscribe mongodb operations
* Organize and update module dependencies
* Get user online status
* Get user online status
* Get user online status
* Nginx reverse proxy and TLS configuration
* update "Nginx reverse proxy and TLS configuration"
---
config/open-im-ng-example.conf | 102 ++++++---------------------------
1 file changed, 18 insertions(+), 84 deletions(-)
diff --git a/config/open-im-ng-example.conf b/config/open-im-ng-example.conf
index a817f7357..e5e584ff8 100644
--- a/config/open-im-ng-example.conf
+++ b/config/open-im-ng-example.conf
@@ -4,38 +4,28 @@ upstream im_msg_gateway{
upstream im_api{
server 127.0.0.1:10002; #IM群组用户api服务器地址 根据部署情况可指定多台
}
-upstream im_jssdk_gateway{
- server 127.0.0.1:10003; #IM jssdk服务器地址 根据部署情况可指定多台
- }
upstream storage {
server 127.0.0.1:10005; #MinIO服务器地址 暂时支持1台
}
-upstream im_admin{
- server 127.0.0.1:10006; #IM admin服务器地址 根据部署情况可指定多台
- }
upstream im_grafana{
server 127.0.0.1:10007; #IM 统计服务器地址 docker-compose启动所在机器
}
-upstream im_chat{
+upstream im_chat_api{
server 127.0.0.1:10008; #IM 商业版登录注册服务器地址 根据部署情况可指定多台
}
-upstream im_complete_admin{
+upstream im_admin_api{
server 127.0.0.1:10009; #IM 商业版admin地址 根据部署情况可指定多台
}
-upstream im_organization{
- server 127.0.0.1:10010; #IM 商业版组织架构服务器地址 根据部署情况可指定多台
- }
upstream im_open_rtc{
server 127.0.0.1:7880; #rtc 音视频通话 服务器地址 根据部署情况可指定多台
}
-
server {
listen 443;
- server_name web.rentsoft.cn; #1 web im 端 域名
+ server_name test-web.rentsoft.cn; #1 web im 端 域名
ssl on;
- ssl_certificate /etc/nginx/conf.d/ssl/web.rentsoft.cn.crt; #2 证书
- ssl_certificate_key /etc/nginx/conf.d/ssl/web.rentsoft.cn.key; #3 证书
+ ssl_certificate /etc/nginx/conf.d/ssl/test-web.rentsoft.cn.crt; #2 证书
+ ssl_certificate_key /etc/nginx/conf.d/ssl/test-web.rentsoft.cn.key; #3 证书
ssl_session_timeout 5m;
gzip on;
gzip_min_length 1k;
@@ -72,22 +62,6 @@ server {
proxy_set_header X-Forwarded-For $remote_addr;
proxy_pass http://im_api/;
}
- location /jssdk_gateway { #10003 jssdk
- proxy_http_version 1.1;
- proxy_set_header Upgrade $http_upgrade;
- proxy_set_header Connection "Upgrade";
- proxy_set_header X-real-ip $remote_addr;
- proxy_set_header X-Forwarded-For $remote_addr;
- proxy_pass http://im_jssdk_gateway/;
- }
- location ^~/admin/ { #10006 admin
- proxy_http_version 1.1;
- proxy_set_header Upgrade $http_upgrade;
- proxy_set_header Connection "Upgrade";
- proxy_set_header X-real-ip $remote_addr;
- proxy_set_header X-Forwarded-For $remote_addr;
- proxy_pass http://im_admin/;
- }
location ^~/grafana/ { #10007 prometheus
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
@@ -96,29 +70,21 @@ server {
proxy_set_header X-Forwarded-For $remote_addr;
proxy_pass http://im_grafana/;
}
- location ^~/chat/ { #10008 chat login
- proxy_http_version 1.1;
- proxy_set_header Upgrade $http_upgrade;
- proxy_set_header Connection "Upgrade";
- proxy_set_header X-real-ip $remote_addr;
- proxy_set_header X-Forwarded-For $remote_addr;
- proxy_pass http://im_chat/;
- }
+ location ^~/chat/ { #10008 im_chat_api
+ proxy_http_version 1.1;
+ proxy_set_header Upgrade $http_upgrade;
+ proxy_set_header Connection "Upgrade";
+ proxy_set_header X-real-ip $remote_addr;
+ proxy_set_header X-Forwarded-For $remote_addr;
+ proxy_pass http://im_chat_api/;
+ }
location ^~/complete_admin/ { #10009 admin
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header X-real-ip $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
- proxy_pass http://im_complete_admin/;
- }
- location ^~/organization/ { #10010 organization
- proxy_http_version 1.1;
- proxy_set_header Upgrade $http_upgrade;
- proxy_set_header Connection "Upgrade";
- proxy_set_header X-real-ip $remote_addr;
- proxy_set_header X-Forwarded-For $remote_addr;
- proxy_pass http://im_organization/;
+ proxy_pass http://im_admin_api/;
}
location ^~/open_rtc/ { #7880 rtc
proxy_http_version 1.1;
@@ -132,17 +98,17 @@ server {
server {
listen 80;
- server_name web.rentsoft.cn ; #1 web im 端 域名
+ server_name test-web.rentsoft.cn ; #1 web im 端 域名
rewrite ^(.*)$ https://${server_name}$1 permanent;
}
server {
ssl_session_timeout 5m;
listen 443;
- server_name storage.rentsoft.cn; #1 MinIO存储域名
+ server_name test-storage.rentsoft.cn; #1 MinIO存储域名
ssl on;
- ssl_certificate /etc/nginx/conf.d/ssl/storage.rentsoft.cn.crt; #证书
- ssl_certificate_key /etc/nginx/conf.d/ssl/storage.rentsoft.cn.key; #证书
+ ssl_certificate /etc/nginx/conf.d/ssl/test-storage.rentsoft.cn.crt; #证书
+ ssl_certificate_key /etc/nginx/conf.d/ssl/test-storage.rentsoft.cn.key; #证书
gzip on;
gzip_min_length 1k;
gzip_buffers 4 16k;
@@ -160,35 +126,3 @@ server {
client_max_body_size 8000M;
}
}
-
-
-server {
- listen 443;
- server_name admin.rentsoft.cn; #后台管理域名
- ssl on;
- ssl_certificate /etc/nginx/conf.d/ssl/admin.rentsoft.cn.crt; # 证书
- ssl_certificate_key /etc/nginx/conf.d/ssl/admin.rentsoft.cn.key; #证书
- ssl_session_timeout 5m;
- gzip on;
- gzip_min_length 1k;
- gzip_buffers 4 16k;
- gzip_comp_level 2;
- gzip_types text/plain application/javascript application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png;
- gzip_vary off;
- gzip_disable "MSIE [1-6]\.";
- location / {
- proxy_set_header Host $host;
- proxy_set_header X-Real-Ip $remote_addr;
- proxy_set_header X-Forwarded-For $remote_addr;
- proxy_set_header X-NginX-Proxy true;
- root /data1/online/Open-IM-Admin/dist/; #管理后台web静态资源存放路径
- index index.html;
- try_files $uri $uri/ /index.html;
- }
-}
-
-server {
- listen 80;
- server_name admin.rentsoft.cn; #管理后台 域名
- rewrite ^(.*)$ https://${server_name}$1 permanent;
-}
From 31cd19af0945c37f6b469b52f463db3e2ebc8127 Mon Sep 17 00:00:00 2001
From: Xinwei Xiong <3293172751NSS@gmail.com>
Date: Wed, 2 Aug 2023 10:24:15 +0800
Subject: [PATCH 11/59] Update docker-compose.yaml (#745)
---
docker-compose.yaml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/docker-compose.yaml b/docker-compose.yaml
index 394232df3..c28c8bc96 100644
--- a/docker-compose.yaml
+++ b/docker-compose.yaml
@@ -100,7 +100,7 @@ services:
openim_server:
- image: ghcr.io/openimsdk/openim-server:latest
+ image: ghcr.io/openimsdk/openim-server:main
container_name: openim-server
volumes:
- ./logs:/Open-IM-Server/logs
@@ -124,7 +124,7 @@ services:
max-file: "2"
openim_chat:
- image: ghcr.io/openimsdk/openim-chat:latest
+ image: ghcr.io/openimsdk/openim-chat:main
container_name: openim_chat
restart: always
depends_on:
From d9dbd739ab7b1539af5e81794fba666c39bbeb30 Mon Sep 17 00:00:00 2001
From: withchao <48119764+withchao@users.noreply.github.com>
Date: Wed, 2 Aug 2023 10:41:34 +0800
Subject: [PATCH 12/59] feat: Perfect with rpc but no api (#747)
* feat: add get_group_member_user_id api
* feat: add SendBusinessNotification api
* feat: add GetFriendIDs api
* update pkg
---
go.mod | 2 +-
go.sum | 4 ++--
internal/api/friend.go | 4 ++++
internal/api/msg.go | 47 ++++++++++++++++++++++++++++++++++++++++++
internal/api/route.go | 2 ++
5 files changed, 56 insertions(+), 3 deletions(-)
diff --git a/go.mod b/go.mod
index 9180c49f3..cbaca83b8 100644
--- a/go.mod
+++ b/go.mod
@@ -38,7 +38,7 @@ require github.com/google/uuid v1.3.0
require (
github.com/OpenIMSDK/protocol v0.0.3
- github.com/OpenIMSDK/tools v0.0.5
+ github.com/OpenIMSDK/tools v0.0.13
github.com/aliyun/aliyun-oss-go-sdk v2.2.7+incompatible
github.com/go-redis/redis v6.15.9+incompatible
github.com/go-sql-driver/mysql v1.7.1
diff --git a/go.sum b/go.sum
index e804eb461..0e6352156 100644
--- a/go.sum
+++ b/go.sum
@@ -19,8 +19,8 @@ firebase.google.com/go v3.13.0+incompatible/go.mod h1:xlah6XbEyW6tbfSklcfe5FHJIw
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/OpenIMSDK/protocol v0.0.3 h1:CFQtmnyW+1dYKVFaVaHcJ6oYuMiMdNfU2gC1xz3K/9I=
github.com/OpenIMSDK/protocol v0.0.3/go.mod h1:F25dFrwrIx3lkNoiuf6FkCfxuwf8L4Z8UIsdTHP/r0Y=
-github.com/OpenIMSDK/tools v0.0.5 h1:yBVHJ3EpIDcp8VFKPjuGr6MQvFa3t4JByZ+vmeC06/Q=
-github.com/OpenIMSDK/tools v0.0.5/go.mod h1:eg+q4A34Qmu73xkY0mt37FHGMCMfC6CtmOnm0kFEGFI=
+github.com/OpenIMSDK/tools v0.0.13 h1:rcw4HS8S2DPZR9UOBxD8/ol9UBMzXBypzOVEytDRIMo=
+github.com/OpenIMSDK/tools v0.0.13/go.mod h1:eg+q4A34Qmu73xkY0mt37FHGMCMfC6CtmOnm0kFEGFI=
github.com/QcloudApi/qcloud_sign_golang v0.0.0-20141224014652-e4130a326409/go.mod h1:1pk82RBxDY/JZnPQrtqHlUFfCctgdorsd9M06fMynOM=
github.com/Shopify/sarama v1.29.0 h1:ARid8o8oieau9XrHI55f/L3EoRAhm9px6sonbD7yuUE=
github.com/Shopify/sarama v1.29.0/go.mod h1:2QpgD79wpdAESqNQMxNc0KYMkycd4slxGdV3TWSVqrU=
diff --git a/internal/api/friend.go b/internal/api/friend.go
index f64a99ef3..91fc30347 100644
--- a/internal/api/friend.go
+++ b/internal/api/friend.go
@@ -83,3 +83,7 @@ func (o *FriendApi) ImportFriends(c *gin.Context) {
func (o *FriendApi) IsFriend(c *gin.Context) {
a2r.Call(friend.FriendClient.IsFriend, o.Client, c)
}
+
+func (o *FriendApi) GetFriendIDs(c *gin.Context) {
+ a2r.Call(friend.FriendClient.GetFriendIDs, o.Client, c)
+}
diff --git a/internal/api/msg.go b/internal/api/msg.go
index e4a8fda17..e7f06dffa 100644
--- a/internal/api/msg.go
+++ b/internal/api/msg.go
@@ -16,6 +16,8 @@ package api
import (
"github.com/OpenIMSDK/Open-IM-Server/pkg/authverify"
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
+ "github.com/OpenIMSDK/tools/mcontext"
"github.com/gin-gonic/gin"
"github.com/go-playground/validator/v10"
"github.com/mitchellh/mapstructure"
@@ -234,6 +236,51 @@ func (m *MessageApi) SendMessage(c *gin.Context) {
apiresp.GinSuccess(c, respPb)
}
+func (m *MessageApi) SendBusinessNotification(c *gin.Context) {
+ req := struct {
+ Key string `json:"key"`
+ Data string `json:"data"`
+ SendUserID string `json:"sendUserID"`
+ RecvUserID string `json:"recvUserID"`
+ }{}
+ if err := c.BindJSON(&req); err != nil {
+ apiresp.GinError(c, errs.ErrArgs.WithDetail(err.Error()).Wrap())
+ return
+ }
+ if !authverify.IsAppManagerUid(c) {
+ apiresp.GinError(c, errs.ErrNoPermission.Wrap("only app manager can send message"))
+ return
+ }
+ sendMsgReq := msg.SendMsgReq{
+ MsgData: &sdkws.MsgData{
+ SendID: req.SendUserID,
+ RecvID: req.RecvUserID,
+ Content: []byte(utils.StructToJsonString(&sdkws.NotificationElem{
+ Detail: utils.StructToJsonString(&struct {
+ Key string `json:"key"`
+ Data string `json:"data"`
+ }{Key: req.Key, Data: req.Data}),
+ })),
+ MsgFrom: constant.SysMsgType,
+ ContentType: constant.BusinessNotification,
+ SessionType: constant.SingleChatType,
+ CreateTime: utils.GetCurrentTimestampByMill(),
+ ClientMsgID: utils.GetMsgID(mcontext.GetOpUserID(c)),
+ Options: config.GetOptionsByNotification(config.NotificationConf{
+ IsSendMsg: false,
+ ReliabilityLevel: 1,
+ UnreadCount: false,
+ }),
+ },
+ }
+ respPb, err := m.Client.SendMsg(c, &sendMsgReq)
+ if err != nil {
+ apiresp.GinError(c, err)
+ return
+ }
+ apiresp.GinSuccess(c, respPb)
+}
+
func (m *MessageApi) BatchSendMsg(c *gin.Context) {
var (
req apistruct.BatchSendMsgReq
diff --git a/internal/api/route.go b/internal/api/route.go
index 5dd0c4cc7..5fd3f115a 100644
--- a/internal/api/route.go
+++ b/internal/api/route.go
@@ -102,6 +102,7 @@ func NewGinRouter(discov discoveryregistry.SvcDiscoveryRegistry, rdb redis.Unive
friendRouterGroup.POST("/remove_black", f.RemoveBlack)
friendRouterGroup.POST("/import_friend", f.ImportFriends)
friendRouterGroup.POST("/is_friend", f.IsFriend)
+ friendRouterGroup.POST("/get_friend_id", f.GetFriendIDs)
}
g := NewGroupApi(*groupRpc)
groupRouterGroup := r.Group("/group", ParseToken)
@@ -167,6 +168,7 @@ func NewGinRouter(discov discoveryregistry.SvcDiscoveryRegistry, rdb redis.Unive
msgGroup.POST("/newest_seq", m.GetSeq)
msgGroup.POST("/search_msg", m.SearchMsg)
msgGroup.POST("/send_msg", m.SendMessage)
+ msgGroup.POST("/send_business_notification", m.SendBusinessNotification)
msgGroup.POST("/pull_msg_by_seq", m.PullMsgBySeqs)
msgGroup.POST("/revoke_msg", m.RevokeMsg)
msgGroup.POST("/mark_msgs_as_read", m.MarkMsgsAsRead)
From f592a3abd751ca5be42f395f5f61f1a6c2ecb8e8 Mon Sep 17 00:00:00 2001
From: pluto <83957921+plutoyty@users.noreply.github.com>
Date: Thu, 3 Aug 2023 09:44:10 +0800
Subject: [PATCH 13/59] Fix bug 755 (#758)
* Resolving code conflicts after project directory changes and Add subscribe and unsubscribe mongodb operations
* Organize and update module dependencies
* Get user online status
* Get user online status
* Get user online status
* fix-bug-755
* Modify statusmod to a prime number to reduce hash conflicts
---
pkg/common/db/cache/user.go | 28 ++++++++++++----------------
1 file changed, 12 insertions(+), 16 deletions(-)
diff --git a/pkg/common/db/cache/user.go b/pkg/common/db/cache/user.go
index 5c76af22f..65afb400d 100644
--- a/pkg/common/db/cache/user.go
+++ b/pkg/common/db/cache/user.go
@@ -18,6 +18,8 @@ import (
"context"
"encoding/json"
"github.com/OpenIMSDK/protocol/user"
+ "github.com/OpenIMSDK/tools/errs"
+ "hash/crc32"
"strconv"
"time"
@@ -33,7 +35,7 @@ const (
userGlobalRecvMsgOptKey = "USER_GLOBAL_RECV_MSG_OPT_KEY:"
olineStatusKey = "ONLINE_STATUS:"
userOlineStatusExpireTime = time.Second * 60 * 60 * 24
- statusMod = 500
+ statusMod = 501
)
type UserCache interface {
@@ -165,11 +167,8 @@ func (u *UserCacheRedis) getOnlineStatusKey(userID string) string {
func (u *UserCacheRedis) GetUserStatus(ctx context.Context, userIDs []string) ([]*user.OnlineStatus, error) {
var res []*user.OnlineStatus
for _, userID := range userIDs {
- UserIDNum, err := strconv.Atoi(userID)
- if err != nil {
- return nil, err
- }
- var modKey = strconv.Itoa(UserIDNum % statusMod)
+ UserIDNum := crc32.ChecksumIEEE([]byte(userID))
+ var modKey = strconv.Itoa(int(UserIDNum % statusMod))
var onlineStatus user.OnlineStatus
key := olineStatusKey + modKey
result, err := u.rdb.HGet(ctx, key, userID).Result()
@@ -183,12 +182,12 @@ func (u *UserCacheRedis) GetUserStatus(ctx context.Context, userIDs []string) ([
})
continue
} else {
- return nil, err
+ return nil, errs.Wrap(err)
}
}
err = json.Unmarshal([]byte(result), &onlineStatus)
if err != nil {
- return nil, err
+ return nil, errs.Wrap(err)
}
onlineStatus.UserID = userID
res = append(res, &onlineStatus)
@@ -200,23 +199,20 @@ func (u *UserCacheRedis) GetUserStatus(ctx context.Context, userIDs []string) ([
func (u *UserCacheRedis) SetUserStatus(ctx context.Context, list []*user.OnlineStatus) error {
for _, status := range list {
var isNewKey int64
- UserIDNum, err := strconv.Atoi(status.UserID)
- if err != nil {
- return err
- }
- var modKey = strconv.Itoa(UserIDNum % statusMod)
+ UserIDNum := crc32.ChecksumIEEE([]byte(status.UserID))
+ var modKey = strconv.Itoa(int(UserIDNum % statusMod))
key := olineStatusKey + modKey
jsonData, err := json.Marshal(status)
if err != nil {
- return err
+ return errs.Wrap(err)
}
isNewKey, err = u.rdb.Exists(ctx, key).Result()
if err != nil {
- return err
+ return errs.Wrap(err)
}
_, err = u.rdb.HSet(ctx, key, status.UserID, string(jsonData)).Result()
if err != nil {
- return err
+ return errs.Wrap(err)
}
if isNewKey > 0 {
u.rdb.Expire(ctx, key, userOlineStatusExpireTime)
From 4950ccf4ec5c336edfd8dc71e8dbb0aeb9175f36 Mon Sep 17 00:00:00 2001
From: pluto <83957921+plutoyty@users.noreply.github.com>
Date: Thu, 3 Aug 2023 16:04:35 +0800
Subject: [PATCH 14/59] nginx minio configuration picture can not be sent
(#763)
* fix-bug-762
* update
* example
---
config/open-im-ng-example.conf | 112 +++++++++++++++++++++++----------
1 file changed, 78 insertions(+), 34 deletions(-)
diff --git a/config/open-im-ng-example.conf b/config/open-im-ng-example.conf
index e5e584ff8..10a2ecb52 100644
--- a/config/open-im-ng-example.conf
+++ b/config/open-im-ng-example.conf
@@ -1,31 +1,37 @@
upstream im_msg_gateway{
- server 127.0.0.1:10001; #IM消息服务器地址 根据部署情况可指定多台
+ server 127.0.0.1:10001; #IM Message server address Multiple can be specified according to the deployment
}
upstream im_api{
- server 127.0.0.1:10002; #IM群组用户api服务器地址 根据部署情况可指定多台
- }
-upstream storage {
- server 127.0.0.1:10005; #MinIO服务器地址 暂时支持1台
+ server 127.0.0.1:10002; #IM Group user api server address Multiple can be specified according to the deployment
}
upstream im_grafana{
- server 127.0.0.1:10007; #IM 统计服务器地址 docker-compose启动所在机器
+ server 127.0.0.1:10007; #IM Statistical server address The machine where docker-compose starts
}
upstream im_chat_api{
- server 127.0.0.1:10008; #IM 商业版登录注册服务器地址 根据部署情况可指定多台
+ server 127.0.0.1:10008; #IM Business version login registration server address Multiple can be specified according to the deployment
}
upstream im_admin_api{
- server 127.0.0.1:10009; #IM 商业版admin地址 根据部署情况可指定多台
+ server 127.0.0.1:10009; #IM The admin address of the commercial version can specify multiple units according to the deployment situation
}
upstream im_open_rtc{
- server 127.0.0.1:7880; #rtc 音视频通话 服务器地址 根据部署情况可指定多台
+ server 127.0.0.1:7880; #rtc Audio and video call server address Multiple devices can be specified according to the deployment
}
+upstream minio_s3_2 {
+ least_conn;
+ server 127.0.0.1:10005;
+}
+
+upstream minio_console_2 {
+ least_conn;
+ server 127.0.0.1:9090;
+}
server {
listen 443;
- server_name test-web.rentsoft.cn; #1 web im 端 域名
+ server_name your-domain.com; #your-domain.com
ssl on;
- ssl_certificate /etc/nginx/conf.d/ssl/test-web.rentsoft.cn.crt; #2 证书
- ssl_certificate_key /etc/nginx/conf.d/ssl/test-web.rentsoft.cn.key; #3 证书
+ ssl_certificate /etc/nginx/conf.d/ssl/your-domain.com.crt; #2 Certificate
+ ssl_certificate_key /etc/nginx/conf.d/ssl/your-domain.com.key; #3 Certificate
ssl_session_timeout 5m;
gzip on;
gzip_min_length 1k;
@@ -42,7 +48,7 @@ server {
proxy_set_header X-Real-Ip $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-NginX-Proxy true;
- root /data1/online/Pc-Web-Demo/build/; # web im静态资源存放路径
+ root /data1/online/Pc-Web-Demo/build/; # web im static resource storage path
index index.html;
try_files $uri $uri/ /index.html;
}
@@ -98,31 +104,69 @@ server {
server {
listen 80;
- server_name test-web.rentsoft.cn ; #1 web im 端 域名
+ server_name test-web.rentsoft.cn ; #1 web im end domain name
rewrite ^(.*)$ https://${server_name}$1 permanent;
}
+
server {
- ssl_session_timeout 5m;
- listen 443;
- server_name test-storage.rentsoft.cn; #1 MinIO存储域名
- ssl on;
- ssl_certificate /etc/nginx/conf.d/ssl/test-storage.rentsoft.cn.crt; #证书
- ssl_certificate_key /etc/nginx/conf.d/ssl/test-storage.rentsoft.cn.key; #证书
- gzip on;
- gzip_min_length 1k;
- gzip_buffers 4 16k;
- gzip_comp_level 2;
- gzip_types text/plain application/javascript application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png;
- gzip_vary off;
- gzip_disable "MSIE [1-6]\.";
+ listen 443;
+
+ server_name your-domain.com; #your-domain.com
+ ssl on;
+ ssl_certificate /etc/nginx/conf.d/ssl/your-domain.com.crt; #Certificate
+ ssl_certificate_key /etc/nginx/conf.d/ssl/your-domain.com.key; #Certificate
+ gzip on;
+ gzip_min_length 1k;
+ gzip_buffers 4 16k;
+ gzip_comp_level 2;
+ gzip_types text/plain application/javascript application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png application/wasm;
+ gzip_vary off;
+ gzip_disable "MSIE [1-6]\.";
+ # Allow special characters in headers
+ ignore_invalid_headers off;
+ # Allow any size file to be uploaded.
+ # Set to a value such as 1000m; to restrict file size to a specific value
+ client_max_body_size 0;
+ # Disable buffering
+ proxy_buffering off;
+ proxy_request_buffering off;
+
location / {
- proxy_pass http://storage;
- proxy_set_header X-Real-IP $remote_addr;
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
- proxy_set_header X-Forwarded-Proto $scheme;
- proxy_set_header Host $http_host;
- proxy_http_version 1.1;
- client_max_body_size 8000M;
+ proxy_set_header Host $http_host;
+ proxy_set_header X-Real-IP $remote_addr;
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
+ proxy_set_header X-Forwarded-Proto $scheme;
+
+ proxy_connect_timeout 300;
+ # Default is HTTP/1, keepalive is only enabled in HTTP/1.1
+ proxy_http_version 1.1;
+ proxy_set_header Connection "";
+ chunked_transfer_encoding off;
+
+ proxy_pass http://minio_s3_2; # This uses the upstream directive definition to load balance
+ }
+
+ location /minio/ui {
+ rewrite ^/minio/ui/(.*) /$1 break;
+ proxy_set_header Host $http_host;
+ proxy_set_header X-Real-IP $remote_addr;
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
+ proxy_set_header X-Forwarded-Proto $scheme;
+ proxy_set_header X-NginX-Proxy true;
+
+ # This is necessary to pass the correct IP to be hashed
+ real_ip_header X-Real-IP;
+
+ proxy_connect_timeout 300;
+
+ # To support websockets in MinIO versions released after January 2023
+ proxy_http_version 1.1;
+ proxy_set_header Upgrade $http_upgrade;
+ proxy_set_header Connection "upgrade";
+
+ chunked_transfer_encoding off;
+
+ proxy_pass http://minio_console_2; # This uses the upstream directive definition to load balance
}
}
From 7707375cf50087f70f506cb57db61bca5b9c294a Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Fri, 4 Aug 2023 11:15:05 +0800
Subject: [PATCH 15/59] build(deps): bump go.mongodb.org/mongo-driver from
1.12.0 to 1.12.1 (#764)
Bumps [go.mongodb.org/mongo-driver](https://github.com/mongodb/mongo-go-driver) from 1.12.0 to 1.12.1.
- [Release notes](https://github.com/mongodb/mongo-go-driver/releases)
- [Commits](https://github.com/mongodb/mongo-go-driver/compare/v1.12.0...v1.12.1)
---
updated-dependencies:
- dependency-name: go.mongodb.org/mongo-driver
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
go.mod | 2 +-
go.sum | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/go.mod b/go.mod
index cbaca83b8..f813ba5fe 100644
--- a/go.mod
+++ b/go.mod
@@ -24,7 +24,7 @@ require (
github.com/robfig/cron/v3 v3.0.1
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/stretchr/testify v1.8.4
- go.mongodb.org/mongo-driver v1.12.0
+ go.mongodb.org/mongo-driver v1.12.1
golang.org/x/image v0.9.0 // indirect
google.golang.org/api v0.134.0
google.golang.org/grpc v1.57.0
diff --git a/go.sum b/go.sum
index 0e6352156..f705f2efd 100644
--- a/go.sum
+++ b/go.sum
@@ -338,8 +338,8 @@ github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d/go.mod h1:rHwXgn7Jul
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
-go.mongodb.org/mongo-driver v1.12.0 h1:aPx33jmn/rQuJXPQLZQ8NtfPQG8CaqgLThFtqRb0PiE=
-go.mongodb.org/mongo-driver v1.12.0/go.mod h1:AZkxhPnFJUoH7kZlFkVKucV20K387miPfm7oimrSmK0=
+go.mongodb.org/mongo-driver v1.12.1 h1:nLkghSU8fQNaK7oUmDhQFsnrtcoNy7Z6LVFKsEecqgE=
+go.mongodb.org/mongo-driver v1.12.1/go.mod h1:/rGBTebI3XYboVmgz+Wv3Bcbl3aD0QF9zl6kDDw18rQ=
go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0=
go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo=
go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI=
From f21d64c00076b52b15995a62709d8e969a5b37f6 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Fri, 4 Aug 2023 15:29:01 +0800
Subject: [PATCH 16/59] build(deps): bump github.com/OpenIMSDK/protocol from
0.0.3 to 0.0.4 (#769)
Bumps [github.com/OpenIMSDK/protocol](https://github.com/OpenIMSDK/protocol) from 0.0.3 to 0.0.4.
- [Release notes](https://github.com/OpenIMSDK/protocol/releases)
- [Commits](https://github.com/OpenIMSDK/protocol/compare/v0.0.3...v0.0.4)
---
updated-dependencies:
- dependency-name: github.com/OpenIMSDK/protocol
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
go.mod | 2 +-
go.sum | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/go.mod b/go.mod
index f813ba5fe..686cadce4 100644
--- a/go.mod
+++ b/go.mod
@@ -37,7 +37,7 @@ require (
require github.com/google/uuid v1.3.0
require (
- github.com/OpenIMSDK/protocol v0.0.3
+ github.com/OpenIMSDK/protocol v0.0.4
github.com/OpenIMSDK/tools v0.0.13
github.com/aliyun/aliyun-oss-go-sdk v2.2.7+incompatible
github.com/go-redis/redis v6.15.9+incompatible
diff --git a/go.sum b/go.sum
index f705f2efd..9a820bfd2 100644
--- a/go.sum
+++ b/go.sum
@@ -17,8 +17,8 @@ cloud.google.com/go/storage v1.30.1/go.mod h1:NfxhC0UJE1aXSx7CIIbCf7y9HKT7Biccwk
firebase.google.com/go v3.13.0+incompatible h1:3TdYC3DDi6aHn20qoRkxwGqNgdjtblwVAyRLQwGn/+4=
firebase.google.com/go v3.13.0+incompatible/go.mod h1:xlah6XbEyW6tbfSklcfe5FHJIwjt8toICdV5Wh9ptHs=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
-github.com/OpenIMSDK/protocol v0.0.3 h1:CFQtmnyW+1dYKVFaVaHcJ6oYuMiMdNfU2gC1xz3K/9I=
-github.com/OpenIMSDK/protocol v0.0.3/go.mod h1:F25dFrwrIx3lkNoiuf6FkCfxuwf8L4Z8UIsdTHP/r0Y=
+github.com/OpenIMSDK/protocol v0.0.4 h1:zEEAi677nog+k4u3e5h36nvYeb1XAwcKQ3Uc2tzxHYs=
+github.com/OpenIMSDK/protocol v0.0.4/go.mod h1:F25dFrwrIx3lkNoiuf6FkCfxuwf8L4Z8UIsdTHP/r0Y=
github.com/OpenIMSDK/tools v0.0.13 h1:rcw4HS8S2DPZR9UOBxD8/ol9UBMzXBypzOVEytDRIMo=
github.com/OpenIMSDK/tools v0.0.13/go.mod h1:eg+q4A34Qmu73xkY0mt37FHGMCMfC6CtmOnm0kFEGFI=
github.com/QcloudApi/qcloud_sign_golang v0.0.0-20141224014652-e4130a326409/go.mod h1:1pk82RBxDY/JZnPQrtqHlUFfCctgdorsd9M06fMynOM=
From a8f5034012a23c1d692667d8a8e8e9a8287ecd02 Mon Sep 17 00:00:00 2001
From: Xinwei Xiong <3293172751NSS@gmail.com>
Date: Fri, 4 Aug 2023 19:13:22 +0800
Subject: [PATCH 17/59] fix: part of the make rules optimization (#751)
* fix: part of the make rules optimization
Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
* feat: set github hub
Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
* feat: set github hub
Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
* fix: scripts path
Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
* fix: scripts path
Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
* fix: scripts path
Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
* fix: dockerfile path
Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
* fix: gorelease quest
Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
* feat: add openim deployment build sub image
Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
* fix: docker images optimize
Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
* fix: dockerfile fix
Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
* style: fix cicd actions openimci
Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
* style: fix cicd actions openimci
Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
* feat: add sub images actions build
Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
* fix: set branch
Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
* fix: set branch
Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
* refactor: remove makefile
Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
* fix: docker release v3.1.1 images optimize
Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
* fix: add scripts path set
Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
* fix: fix env config
Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
* feat: add scripts bash path
Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
* fix: docker release v3.1.1 images optimize
Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
* fix: super docker version
Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
---------
Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
---
.github/dependabot.yml | 34 ++
.github/workflows/auto-gh-pr.yml | 28 +-
.github/workflows/auto-tag.yml | 38 +++
.github/workflows/build-docker-image.yml | 51 ++-
.github/workflows/docker-buildx.yml | 320 ++++++++++++++++++
.github/workflows/image.yml | 95 ------
.github/workflows/milestone.yml | 58 ++++
.github/workflows/openimci.yml | 8 -
.github/workflows/project-progress.yml | 2 +-
.golangci.yml | 2 +-
.goreleaser.yaml | 22 +-
Dockerfile | 28 +-
build/docker/openim-api/Dockerfile | 36 +-
build/docker/openim-cmdutils/Dockerfile | 31 ++
build/docker/openim-crontask/Dockerfile | 30 ++
build/docker/openim-msggateway/Dockerfile | 36 ++
build/docker/openim-msgtransfer/Dockerfile | 33 ++
build/docker/openim-push/Dockerfile | 35 ++
build/docker/openim-rpc-auth/Dockerfile | 38 +++
.../docker/openim-rpc-conversation/Dockerfile | 45 +++
build/docker/openim-rpc-friend/Dockerfile | 45 +++
build/docker/openim-rpc-group/Dockerfile | 45 +++
build/docker/openim-rpc-msg/Dockerfile | 45 +++
build/docker/openim-rpc-third/Dockerfile | 44 +++
build/docker/openim-rpc-user/Dockerfile | 44 +++
cmd/openim-api/Makefile | 34 --
cmd/openim-api/deploy.Dockerfile | 4 +-
cmd/openim-cmdutils/Makefile | 34 --
cmd/openim-crontask/Makefile | 34 --
cmd/openim-crontask/deploy.Dockerfile | 4 +-
cmd/openim-msggateway/Makefile | 34 --
cmd/openim-msggateway/deploy.Dockerfile | 4 +-
cmd/openim-msgtransfer/Makefile | 34 --
cmd/openim-msgtransfer/deploy.Dockerfile | 4 +-
cmd/openim-push/Makefile | 34 --
cmd/openim-push/deploy.Dockerfile | 4 +-
cmd/openim-rpc/openim-rpc-auth/Makefile | 34 --
.../openim-rpc-auth/deploy.Dockerfile | 4 +-
.../openim-rpc-conversation/Makefile | 34 --
.../openim-rpc-conversation/deploy.Dockerfile | 4 +-
cmd/openim-rpc/openim-rpc-friend/Makefile | 34 --
.../openim-rpc-friend/deploy.Dockerfile | 4 +-
cmd/openim-rpc/openim-rpc-group/Makefile | 34 --
.../openim-rpc-group/deploy.Dockerfile | 4 +-
cmd/openim-rpc/openim-rpc-msg/Makefile | 34 --
.../openim-rpc-msg/deploy.Dockerfile | 4 +-
cmd/openim-rpc/openim-rpc-third/Makefile | 34 --
.../openim-rpc-third/deploy.Dockerfile | 4 +-
cmd/openim-rpc/openim-rpc-user/Makefile | 34 --
.../openim-rpc-user/deploy.Dockerfile | 4 +-
docker-compose.yaml | 20 +-
init_docker.sh | 44 ---
install.sh | 10 +-
install_guide.sh | 2 +-
pkg/common/config/version | 2 +-
scripts/advertise.sh | 2 +-
scripts/build.cmd | 23 +-
scripts/common.sh | 2 -
scripts/docker_start_all.sh | 13 +-
scripts/enterprise/function.sh | 12 +-
scripts/enterprise/path_info.cfg | 20 +-
scripts/init_pwd.sh | 2 +-
scripts/lib/golang.sh | 1 -
scripts/make-rules/golang.mk | 2 +-
scripts/msg_transfer_start.sh | 8 +-
scripts/push_start.sh | 8 +-
scripts/start_all.sh | 8 +-
scripts/start_cron.sh | 8 +-
scripts/start_rpc_service.sh | 3 +-
scripts/stop_all.sh | 2 +-
scripts/style_info.sh | 95 +++---
test/common.sh | 1 -
72 files changed, 1173 insertions(+), 798 deletions(-)
create mode 100644 .github/workflows/auto-tag.yml
create mode 100644 .github/workflows/docker-buildx.yml
delete mode 100644 .github/workflows/image.yml
create mode 100644 .github/workflows/milestone.yml
delete mode 100644 cmd/openim-api/Makefile
delete mode 100644 cmd/openim-cmdutils/Makefile
delete mode 100644 cmd/openim-crontask/Makefile
delete mode 100644 cmd/openim-msggateway/Makefile
delete mode 100644 cmd/openim-msgtransfer/Makefile
delete mode 100644 cmd/openim-push/Makefile
delete mode 100644 cmd/openim-rpc/openim-rpc-auth/Makefile
delete mode 100644 cmd/openim-rpc/openim-rpc-conversation/Makefile
delete mode 100644 cmd/openim-rpc/openim-rpc-friend/Makefile
delete mode 100644 cmd/openim-rpc/openim-rpc-group/Makefile
delete mode 100644 cmd/openim-rpc/openim-rpc-msg/Makefile
delete mode 100644 cmd/openim-rpc/openim-rpc-third/Makefile
delete mode 100644 cmd/openim-rpc/openim-rpc-user/Makefile
delete mode 100755 init_docker.sh
diff --git a/.github/dependabot.yml b/.github/dependabot.yml
index f6150ead7..f495b588f 100644
--- a/.github/dependabot.yml
+++ b/.github/dependabot.yml
@@ -9,3 +9,37 @@ updates:
directory: "/"
schedule:
interval: "daily"
+ time: "08:00"
+ labels:
+ - "dependencies"
+ commit-message:
+ prefix: "feat"
+ include: "scope"
+ groups:
+ gomod-deps:
+ patterns:
+ - "*"
+ - package-ecosystem: "github-actions"
+ directory: "/"
+ schedule:
+ interval: "daily"
+ time: "08:00"
+ labels:
+ - "dependencies"
+ commit-message:
+ prefix: "chore"
+ include: "scope"
+ groups:
+ github-actions:
+ patterns:
+ - "*"
+ - package-ecosystem: "docker"
+ directory: "/"
+ schedule:
+ interval: "daily"
+ time: "08:00"
+ labels:
+ - "dependencies"
+ commit-message:
+ prefix: "feat"
+ include: "scope"
\ No newline at end of file
diff --git a/.github/workflows/auto-gh-pr.yml b/.github/workflows/auto-gh-pr.yml
index 1d8c90d33..0913655ca 100644
--- a/.github/workflows/auto-gh-pr.yml
+++ b/.github/workflows/auto-gh-pr.yml
@@ -18,30 +18,21 @@ on:
pull_request:
# types:
# - closed
+ issue_comment:
+ types: [created]
+ pull_request_review_comment:
+ types: [created]
jobs:
create-pr:
runs-on: ubuntu-latest
- if: github.event.pull_request.base.ref == 'main'
+ if: github.event.pull_request.base.ref == 'main' && github.event.pull_request.merged == true
steps:
- name: Check out code
uses: actions/checkout@v3
with:
fetch-depth: 0
- - name: Setup GitHub CLI
- run: |
- sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-key C99B11DEB97541F0
- sudo apt-add-repository https://cli.github.com/packages
- sudo apt-get update
- sudo apt-get install gh
- continue-on-error: true
-
- # - name: Configure GitHub CLI
- # run: |
- # git config --global user.email "3293172751ysy@gmail.com"
- # git config --global user.name "kubbot"
- # echo "${{ secrets.BOT_GITHUB_TOKEN }}" | gh auth login --with-token
- name: Create PR to release branch
run: |
ISSUEID=$(gh pr view ${{ github.event.pull_request.number }} --repo $OWNER/$REPO | grep -oP 'Fixes #\K\d+')
@@ -56,10 +47,9 @@ jobs:
gh pr edit ${{ github.event.pull_request.number }} --repo $OWNER/$REPO --add-label "$LABELS" --add-assignee "$ASSIGNEES" --milestone "$MILESTONE"
- git checkout -b bot/merge-to-release-$ISSUEID
- git push origin bot/merge-to-release-$ISSUEID
- gh pr create --base release --head bot/merge-to-release-$ISSUEID --title "Merge main to release" --body ""
-
+ # git checkout -b bot/merge-to-release-$ISSUEID
+ # git push origin bot/merge-to-release-$ISSUEID
+ # gh pr create --base release --head bot/merge-to-release-$ISSUEID --title "Merge main to release" --body ""
# gh pr create --base main --head feat/auto-release-pr-624 --title "The bug is fixed" --body "$x" --repo OpenIMSDK/Open-IM-Server --reviewer "cubxxw"
continue-on-error: true
env:
@@ -67,4 +57,4 @@ jobs:
GH_TOKEN: ${{ github.token }}
ISSUE: ${{ github.event.issue.html_url }}
OWNER: ${{ github.repository_owner }}
- REPO: ${{ github.event.repository.name }}
\ No newline at end of file
+ REPO: ${{ github.event.repository.name }}
diff --git a/.github/workflows/auto-tag.yml b/.github/workflows/auto-tag.yml
new file mode 100644
index 000000000..7e72e898d
--- /dev/null
+++ b/.github/workflows/auto-tag.yml
@@ -0,0 +1,38 @@
+name: Create Tag
+
+on:
+ issue_comment:
+ types: [created]
+ pull_request_review_comment:
+ types: [created]
+
+jobs:
+ create_tag:
+ runs-on: ubuntu-latest
+ if: startsWith(github.event.comment.body, '/create tag')
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v3
+
+ - name: Validate version number and get comment
+ id: validate
+ run: |
+ COMMENT="${{ github.event.comment.body }}"
+ VERSION=$(echo $COMMENT | cut -d ' ' -f 3)
+ TAG_COMMENT=$(echo $COMMENT | cut -d '"' -f 2)
+ if [[ $VERSION =~ ^v([0-9]+\.){2}[0-9]+$ ]]; then
+ echo "version=$VERSION" >> $GITHUB_STATE
+ echo "tag_comment=$TAG_COMMENT" >> $GITHUB_STATE
+ else
+ echo "Invalid version number."
+ exit 1
+ fi
+
+ - name: Create a new tag
+ env:
+ GH_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }}
+ run: |
+ source $GITHUB_STATE
+ git tag -a $VERSION -m "$tag_comment"
+ git push origin $VERSION
+ echo "tag_created=$VERSION" >> $GITHUB_OUTPUT
diff --git a/.github/workflows/build-docker-image.yml b/.github/workflows/build-docker-image.yml
index 3dd64c930..f9fb42500 100644
--- a/.github/workflows/build-docker-image.yml
+++ b/.github/workflows/build-docker-image.yml
@@ -23,16 +23,20 @@ on:
- v*
workflow_dispatch:
+env:
+ # Common versions
+ GO_VERSION: "1.20"
+
jobs:
- build:
+ build-dockerhub:
runs-on: ubuntu-latest
steps:
- - name: Check out the repo
+ - name: Checkout
uses: actions/checkout@v3
-
- - name: Build OpenIM Server
- run: |
- sudo make build
+ - name: Set up QEMU
+ uses: docker/setup-qemu-action@v2
+ - name: Set up Docker Buildx
+ uses: docker/setup-buildx-action@v2
# docker.io/openim/openim-server:latest
- name: Extract metadata (tags, labels) for Docker
@@ -40,6 +44,15 @@ jobs:
uses: docker/metadata-action@v4.6.0
with:
images: openim/openim-server
+ # generate Docker tags based on the following events/attributes
+ tags: |
+ type=schedule
+ type=ref,event=branch
+ type=ref,event=pr
+ type=semver,pattern={{version}}
+ type=semver,pattern={{major}}.{{minor}}
+ type=semver,pattern={{major}}
+ type=sha
- name: Log in to Docker Hub
uses: docker/login-action@v2
@@ -51,10 +64,21 @@ jobs:
uses: docker/build-push-action@v4
with:
context: .
+ # linux/ppc64le,linux/s390x
+ platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
+ build-aliyun:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v3
+ - name: Set up QEMU
+ uses: docker/setup-qemu-action@v2
+ - name: Set up Docker Buildx
+ uses: docker/setup-buildx-action@v2
# registry.cn-hangzhou.aliyuncs.com/openimsdk/openim-server:latest
- name: Extract metadata (tags, labels) for Docker
id: meta2
@@ -73,10 +97,21 @@ jobs:
uses: docker/build-push-action@v4
with:
context: .
+ # linux/ppc64le,linux/s390x
+ platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta2.outputs.tags }}
labels: ${{ steps.meta2.outputs.labels }}
+ build-ghcr:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v3
+ - name: Set up QEMU
+ uses: docker/setup-qemu-action@v2
+ - name: Set up Docker Buildx
+ uses: docker/setup-buildx-action@v2
# ghcr.io/openimsdk/openim-server:latest
- name: Extract metadata (tags, labels) for Docker
id: meta3
@@ -88,13 +123,15 @@ jobs:
uses: docker/login-action@v2
with:
registry: ghcr.io
- username: ${{ github.actor }}
+ username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
+ # linux/ppc64le,linux/s390x
+ platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta3.outputs.tags }}
labels: ${{ steps.meta3.outputs.labels }}
diff --git a/.github/workflows/docker-buildx.yml b/.github/workflows/docker-buildx.yml
new file mode 100644
index 000000000..3d1b3015f
--- /dev/null
+++ b/.github/workflows/docker-buildx.yml
@@ -0,0 +1,320 @@
+# Copyright © 2023 OpenIM open source community. 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.
+
+name: Docker Buildx Images CI
+
+on:
+ schedule:
+ - cron: '30 1 * * *'
+ push:
+ branches:
+ - release-*
+ tags:
+ - v*
+ workflow_dispatch:
+
+jobs:
+ build-ghcr:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v3
+
+ - name: Set up QEMU
+ uses: docker/setup-qemu-action@v2
+
+ - name: Set up Docker Buildx
+ uses: docker/setup-buildx-action@v2
+ with:
+ install: true
+
+ - name: Cache Docker layers
+ uses: actions/cache@v3
+ with:
+ path: /tmp/.buildx-cache
+ key: ${{ runner.os }}-buildx-${{ github.sha }}
+ restore-keys: |
+ ${{ runner.os }}-buildx-
+
+ - name: Log in to GitHub Container Registry
+ uses: docker/login-action@v2
+ with:
+ registry: ghcr.io
+ username: ${{ github.repository_owner }}
+ password: ${{ secrets.GITHUB_TOKEN }}
+
+################################################
+# build/
+# └── docker
+# ├── openim-api
+# │ └── Dockerfile
+# ├── openim-cmdutils
+# │ └── Dockerfile
+# ├── openim-crontask
+# │ └── Dockerfile
+# ├── openim-msggateway
+# │ └── Dockerfile
+# ├── openim-msgtransfer
+# │ └── Dockerfile
+# ├── openim-push
+# │ └── Dockerfile
+# ├── openim-rpc-auth
+# │ └── Dockerfile
+# ├── openim-rpc-conversation
+# │ └── Dockerfile
+# ├── openim-rpc-friend
+# │ └── Dockerfile
+# ├── openim-rpc-group
+# │ └── Dockerfile
+# ├── openim-rpc-msg
+# │ └── Dockerfile
+# ├── openim-rpc-third
+# │ └── Dockerfile
+# └── openim-rpc-user
+# └── Dockerfile
+#############################################
+
+ - name: Extract metadata (tags, labels) for Docker openim-api
+ id: meta1
+ uses: docker/metadata-action@v4.6.0
+ with:
+ images: ghcr.io/openimsdk/openim-api
+
+ - name: Build and push Docker image for openim-api
+ uses: docker/build-push-action@v4
+ with:
+ context: .
+ file: ./build/docker/openim-api/Dockerfile
+ platforms: linux/amd64,linux/arm64
+ push: ${{ github.event_name != 'pull_request' }}
+ tags: ${{ steps.meta1.outputs.tags }}
+ labels: ${{ steps.meta1.outputs.labels }}
+ cache-from: type=local,src=/tmp/.buildx-cache
+ cache-to: type=local,dest=/tmp/.buildx-cache
+
+ - name: Extract metadata (tags, labels) for Docker openim-cmdutils
+ id: meta2
+ uses: docker/metadata-action@v4.6.0
+ with:
+ images: ghcr.io/openimsdk/openim-cmdutils
+
+ - name: Build and push Docker image for openim-cmdutils
+ uses: docker/build-push-action@v4
+ with:
+ context: .
+ file: ./build/docker/openim-cmdutils/Dockerfile
+ platforms: linux/amd64,linux/arm64
+ push: ${{ github.event_name != 'pull_request' }}
+ tags: ${{ steps.meta2.outputs.tags }}
+ labels: ${{ steps.meta2.outputs.labels }}
+ cache-from: type=local,src=/tmp/.buildx-cache
+ cache-to: type=local,dest=/tmp/.buildx-cache
+
+ - name: Extract metadata (tags, labels) for Docker openim-crontask
+ id: meta3
+ uses: docker/metadata-action@v4.6.0
+ with:
+ images: ghcr.io/openimsdk/openim-crontask
+
+ - name: Build and push Docker image for openim-crontask
+ uses: docker/build-push-action@v4
+ with:
+ context: .
+ file: ./build/docker/openim-crontask/Dockerfile
+ platforms: linux/amd64,linux/arm64
+ push: ${{ github.event_name != 'pull_request' }}
+ tags: ${{ steps.meta3.outputs.tags }}
+ labels: ${{ steps.meta3.outputs.labels }}
+ cache-from: type=local,src=/tmp/.buildx-cache
+ cache-to: type=local,dest=/tmp/.buildx-cache
+
+ - name: Extract metadata (tags, labels) for Docker openim-msggateway
+ id: meta4
+ uses: docker/metadata-action@v4.6.0
+ with:
+ images: ghcr.io/openimsdk/openim-msggateway
+
+ - name: Build and push Docker image for openim-msggateway
+ uses: docker/build-push-action@v4
+ with:
+ context: .
+ file: ./build/docker/openim-msggateway/Dockerfile
+ platforms: linux/amd64,linux/arm64
+ push: ${{ github.event_name != 'pull_request' }}
+ tags: ${{ steps.meta4.outputs.tags }}
+ labels: ${{ steps.meta4.outputs.labels }}
+ cache-from: type=local,src=/tmp/.buildx-cache
+ cache-to: type=local,dest=/tmp/.buildx-cache
+
+ - name: Extract metadata (tags, labels) for Docker openim-msgtransfer
+ id: meta5
+ uses: docker/metadata-action@v4.6.0
+ with:
+ images: ghcr.io/openimsdk/openim-msgtransfer
+
+ - name: Build and push Docker image for openim-msgtransfer
+ uses: docker/build-push-action@v4
+ with:
+ context: .
+ file: ./build/docker/openim-msgtransfer/Dockerfile
+ platforms: linux/amd64,linux/arm64
+ push: ${{ github.event_name != 'pull_request' }}
+ tags: ${{ steps.meta5.outputs.tags }}
+ labels: ${{ steps.meta5.outputs.labels }}
+ cache-from: type=local,src=/tmp/.buildx-cache
+ cache-to: type=local,dest=/tmp/.buildx-cache
+
+ - name: Extract metadata (tags, labels) for Docker openim-push
+ id: meta6
+ uses: docker/metadata-action@v4.6.0
+ with:
+ images: ghcr.io/openimsdk/openim-push
+
+ - name: Build and push Docker image for openim-push
+ uses: docker/build-push-action@v4
+ with:
+ context: .
+ file: ./build/docker/openim-push/Dockerfile
+ platforms: linux/amd64,linux/arm64
+ push: ${{ github.event_name != 'pull_request' }}
+ tags: ${{ steps.meta6.outputs.tags }}
+ labels: ${{ steps.meta6.outputs.labels }}
+ cache-from: type=local,src=/tmp/.buildx-cache
+ cache-to: type=local,dest=/tmp/.buildx-cache
+
+ - name: Extract metadata (tags, labels) for Docker openim-rpc-auth
+ id: meta7
+ uses: docker/metadata-action@v4.6.0
+ with:
+ images: ghcr.io/openimsdk/openim-rpc-auth
+
+ - name: Build and push Docker image for openim-rpc-auth
+ uses: docker/build-push-action@v4
+ with:
+ context: .
+ file: ./build/docker/openim-rpc-auth/Dockerfile
+ platforms: linux/amd64,linux/arm64
+ push: ${{ github.event_name != 'pull_request' }}
+ tags: ${{ steps.meta7.outputs.tags }}
+ labels: ${{ steps.meta7.outputs.labels }}
+ cache-from: type=local,src=/tmp/.buildx-cache
+ cache-to: type=local,dest=/tmp/.buildx-cache
+
+ - name: Extract metadata (tags, labels) for Docker openim-rpc-conversation
+ id: meta8
+ uses: docker/metadata-action@v4.6.0
+ with:
+ images: ghcr.io/openimsdk/openim-rpc-conversation
+
+ - name: Build and push Docker image for openim-rpc-conversation
+ uses: docker/build-push-action@v4
+ with:
+ context: .
+ file: ./build/docker/openim-rpc-conversation/Dockerfile
+ platforms: linux/amd64,linux/arm64
+ push: ${{ github.event_name != 'pull_request' }}
+ tags: ${{ steps.meta8.outputs.tags }}
+ labels: ${{ steps.meta8.outputs.labels }}
+ cache-from: type=local,src=/tmp/.buildx-cache
+ cache-to: type=local,dest=/tmp/.buildx-cache
+
+ - name: Extract metadata (tags, labels) for Docker openim-rpc-friend
+ id: meta9
+ uses: docker/metadata-action@v4.6.0
+ with:
+ images: ghcr.io/openimsdk/openim-rpc-friend
+
+ - name: Build and push Docker image for openim-rpc-friend
+ uses: docker/build-push-action@v4
+ with:
+ context: .
+ file: ./build/docker/openim-rpc-friend/Dockerfile
+ platforms: linux/amd64,linux/arm64
+ push: ${{ github.event_name != 'pull_request' }}
+ tags: ${{ steps.meta9.outputs.tags }}
+ labels: ${{ steps.meta9.outputs.labels }}
+ cache-from: type=local,src=/tmp/.buildx-cache
+ cache-to: type=local,dest=/tmp/.buildx-cache
+
+ - name: Extract metadata (tags, labels) for Docker openim-rpc-group
+ id: meta10
+ uses: docker/metadata-action@v4.6.0
+ with:
+ images: ghcr.io/openimsdk/openim-rpc-group
+
+ - name: Build and push Docker image for openim-rpc-group
+ uses: docker/build-push-action@v4
+ with:
+ context: .
+ file: ./build/docker/openim-rpc-group/Dockerfile
+ platforms: linux/amd64,linux/arm64
+ push: ${{ github.event_name != 'pull_request' }}
+ tags: ${{ steps.meta10.outputs.tags }}
+ labels: ${{ steps.meta10.outputs.labels }}
+ cache-from: type=local,src=/tmp/.buildx-cache
+ cache-to: type=local,dest=/tmp/.buildx-cache
+
+ - name: Extract metadata (tags, labels) for Docker openim-rpc-msg
+ id: meta11
+ uses: docker/metadata-action@v4.6.0
+ with:
+ images: ghcr.io/openimsdk/openim-rpc-msg
+
+ - name: Build and push Docker image for openim-rpc-msg
+ uses: docker/build-push-action@v4
+ with:
+ context: .
+ file: ./build/docker/openim-rpc-msg/Dockerfile
+ platforms: linux/amd64,linux/arm64
+ push: ${{ github.event_name != 'pull_request' }}
+ tags: ${{ steps.meta11.outputs.tags }}
+ labels: ${{ steps.meta11.outputs.labels }}
+ cache-from: type=local,src=/tmp/.buildx-cache
+ cache-to: type=local,dest=/tmp/.buildx-cache
+
+ - name: Extract metadata (tags, labels) for Docker openim-rpc-third
+ id: meta12
+ uses: docker/metadata-action@v4.6.0
+ with:
+ images: ghcr.io/openimsdk/openim-rpc-third
+
+ - name: Build and push Docker image for openim-rpc-third
+ uses: docker/build-push-action@v4
+ with:
+ context: .
+ file: ./build/docker/openim-rpc-third/Dockerfile
+ platforms: linux/amd64,linux/arm64
+ push: ${{ github.event_name != 'pull_request' }}
+ tags: ${{ steps.meta12.outputs.tags }}
+ labels: ${{ steps.meta12.outputs.labels }}
+ cache-from: type=local,src=/tmp/.buildx-cache
+ cache-to: type=local,dest=/tmp/.buildx-cache
+
+ - name: Extract metadata (tags, labels) for Docker openim-rpc-user
+ id: meta13
+ uses: docker/metadata-action@v4.6.0
+ with:
+ images: ghcr.io/openimsdk/openim-rpc-user
+
+ - name: Build and push Docker image for openim-rpc-user
+ uses: docker/build-push-action@v4
+ with:
+ context: .
+ file: ./build/docker/openim-rpc-user/Dockerfile
+ platforms: linux/amd64,linux/arm64
+ push: ${{ github.event_name != 'pull_request' }}
+ tags: ${{ steps.meta13.outputs.tags }}
+ labels: ${{ steps.meta13.outputs.labels }}
+ cache-from: type=local,src=/tmp/.buildx-cache
+ cache-to: type=local,dest=/tmp/.buildx-cache
\ No newline at end of file
diff --git a/.github/workflows/image.yml b/.github/workflows/image.yml
deleted file mode 100644
index 2ecfad6ea..000000000
--- a/.github/workflows/image.yml
+++ /dev/null
@@ -1,95 +0,0 @@
-# Copyright © 2023 OpenIM open source community. 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.
-
-name: Build Image
-
-on:
- push:
- branches:
- - main
- paths:
- - "**.go"
- - "!**_test.go"
- - "build/**"
- tags:
- - v*
-
-jobs:
- release:
- strategy:
- matrix:
- components: [core, swagger]
- runs-on: ubuntu-20.04
- steps:
- - uses: actions/checkout@v3
- with:
- fetch-depth: 20
- - uses: dorny/paths-filter@v2
- if: ${{ !startsWith(github.ref_name, 'v') }}
- id: changes
- with:
- filters: |
- go:
- - '**.go'
- - 'build/core/Dockerfile'
- api:
- - 'openapi/**'
- - 'build/swagger/build.sh'
- - 'build/swagger/Dockerfile'
- - name: Docker meta
- id: meta
- uses: docker/metadata-action@v4
- with:
- flavor: |
- latest=false
- images: |
- ${{ secrets.DOCKERHUB_USERNAME }}/openimsdk-${{ matrix.components }}
- registry.cn-hangzhou.aliyuncs.com/${{ secrets.ALIREGISTRY_NAMESPACE }}/openimsdk-${{ matrix.components }}
- tags: |
- type=ref,event=branch
- type=sha,prefix={{branch}}-,enable=${{ github.ref_type == 'branch' }}
- type=ref,event=tag
- - name: Login to Docker Hub
- uses: docker/login-action@v2
- with:
- username: ${{ secrets.DOCKERHUB_USERNAME }}
- password: ${{ secrets.DOCKERHUB_TOKEN }}
-
- - name: Login to Ali Container Registry
- uses: docker/login-action@v2
- with:
- registry: registry.cn-hangzhou.aliyuncs.com
- username: ${{ secrets.ALIREGISTRY_USERNAME }}
- password: ${{ secrets.ALIREGISTRY_TOKEN }}
-
- - name: Condition
- id: condition
- run: |
- echo "run=${{ startsWith(github.ref_name, 'v') || ((steps.changes.outputs.go == 'true' && (matrix.components == 'core' || matrix.components == 'job')) || (steps.changes.outputs.api == 'true' && matrix.components == 'swagger')) }}" >> $GITHUB_OUTPUT
-
- - name: Set up QEMU
- if: ${{ steps.condition.outputs.run == 'true' }}
- uses: docker/setup-qemu-action@v2
- - name: Set up Docker Buildx
- if: ${{ steps.condition.outputs.run == 'true' }}
- uses: docker/setup-buildx-action@v2
- - name: Build and push
- if: ${{ steps.condition.outputs.run == 'true' }}
- uses: docker/build-push-action@v3
- with:
- context: .
- file: ./build/${{ matrix.components }}/Dockerfile
- platforms: linux/amd64
- push: true
- tags: ${{ steps.meta.outputs.tags }}
diff --git a/.github/workflows/milestone.yml b/.github/workflows/milestone.yml
new file mode 100644
index 000000000..db39943e6
--- /dev/null
+++ b/.github/workflows/milestone.yml
@@ -0,0 +1,58 @@
+# shamelessly copied from https://github.com/sigstore/cosign/blob/main/.github/workflows/milestone.yaml
+
+name: milestone
+
+on:
+ pull_request_target:
+ types: [closed]
+ branches:
+ - main
+
+jobs:
+ milestone:
+ runs-on: ubuntu-latest
+
+ permissions:
+ actions: none
+ checks: none
+ contents: read
+ deployments: none
+ issues: write
+ packages: none
+ pull-requests: write
+ repository-projects: none
+ security-events: none
+ statuses: none
+
+ steps:
+ - uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6
+ with:
+ script: |
+ if (!context.payload.pull_request.merged) {
+ console.log('PR was not merged, skipping.');
+ return;
+ }
+
+ if (!!context.payload.pull_request.milestone) {
+ console.log('PR has existing milestone, skipping.');
+ return;
+ }
+
+ milestones = await github.rest.issues.listMilestones({
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ state: 'open',
+ sort: 'due_on',
+ direction: 'asc'
+ })
+ if (milestones.data.length === 0) {
+ console.log('There are no milestones, skipping.');
+ return;
+ }
+
+ await github.rest.issues.update({
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ issue_number: context.payload.pull_request.number,
+ milestone: milestones.data[0].number
+ });
diff --git a/.github/workflows/openimci.yml b/.github/workflows/openimci.yml
index 07133126b..0e69089f9 100644
--- a/.github/workflows/openimci.yml
+++ b/.github/workflows/openimci.yml
@@ -90,19 +90,11 @@ jobs:
echo "Run unit test and get test coverage successfully"
continue-on-error: true
- - name: Initialize CodeQL
- uses: github/codeql-action/init@v2
- with:
- languages: go
-
- name: Build source code for host platform
run: |
sudo make build
echo "Build source code for host platform successfully"
- - name: Perform CodeQL Analysis
- uses: github/codeql-action/analyze@v2
-
- name: OpenIM verify copyright
run: |
sudo make verify-copyright
diff --git a/.github/workflows/project-progress.yml b/.github/workflows/project-progress.yml
index 247404aa0..d0cc10604 100644
--- a/.github/workflows/project-progress.yml
+++ b/.github/workflows/project-progress.yml
@@ -33,4 +33,4 @@ jobs:
with:
project: OpenIM-V3.1
column: In Progress
- repo-token: ${{ secrets.GITHUB_TOKEN }}
\ No newline at end of file
+ repo-token: ${{ secrets.BOT_GITHUB_TOKEN }}
\ No newline at end of file
diff --git a/.golangci.yml b/.golangci.yml
index 296bd0dc0..8bafbbe5c 100644
--- a/.golangci.yml
+++ b/.golangci.yml
@@ -114,7 +114,7 @@ linters-settings:
max-blank-identifiers: 2
dupl:
# tokens count to trigger issue, 150 by default
- threshold: 100
+ threshold: 200
errcheck:
# report about not checking of errors in type assertions: `a := b.(MyStruct)`;
# default is false: such cases aren't reported by default.
diff --git a/.goreleaser.yaml b/.goreleaser.yaml
index 31cdbd085..184949283 100644
--- a/.goreleaser.yaml
+++ b/.goreleaser.yaml
@@ -447,8 +447,8 @@ milestones:
# Repository for the milestone
# Default is extracted from the origin remote URL
repo:
- owner: user
- name: repo
+ owner: OpenIMSDK
+ name: Open-IM-Server
# Whether to close the milestone
close: true
@@ -479,6 +479,9 @@ checksum:
algorithm: sha256
release:
+
+ prerelease: auto
+
footer: |
## Welcome to the {{ .Tag }} release of [chat](https://github.com/OpenIMSDK/chat)!🎉🎉!
@@ -487,18 +490,14 @@ release:
## Helping out
- We release logs are recorded on [✨ CHANGELOG](https://github.com/OpenIMSDK/Open-IM-Server/blob/main/CHANGELOG/CHANGELOG.md)--config_folder_path
+ + We release logs are recorded on [✨CHANGELOG](https://github.com/OpenIMSDK/Open-IM-Server/blob/main/CHANGELOG/CHANGELOG.md)
- For information on versions of OpenIM and how to maintain branches, read [📚this article](https://github.com/OpenIMSDK/Open-IM-Server/blob/main/docs/conversions/version.md)
+ + For information on versions of OpenIM and how to maintain branches, read [📚this article](https://github.com/OpenIMSDK/Open-IM-Server/blob/main/docs/conversions/version.md)
- This release is only possible thanks to **all** the support of some **awesome people**!
-
- https://github.com/OpenIMSDK/Open-IM-Server/blob/main/docs/conversions/version.md
+ + If you wish to use mirroring, read OpenIM's [image management policy](https://github.com/OpenIMSDK/Open-IM-Server/blob/main/docs/conversions/images.md)
**Want to be one of them 😘?**
- Contributions to this project are welcome! Please see [CONTRIBUTING.md](https://github.com/OpenIMSDK/Open-IM-Server/blob/main/CONTRIBUTING.md) for details.
-
@@ -511,6 +510,11 @@ release:
+ > **Note**
+ > @openimbot and @kubbot have made great contributions to the community as community 🤖robots(@openimsdk/bot), respectively.
+ > Thanks to the @openimsdk/openim team for all their hard work on this release.
+ > Thank you to all the [💕developers and contributors](https://github.com/OpenIMSDK/Open-IM-Server/graphs/contributors), people from all over the world, OpenIM brings us together
+ > Contributions to this project are welcome! Please see [CONTRIBUTING.md](https://github.com/OpenIMSDK/Open-IM-Server/blob/main/CONTRIBUTING.md) for details.
## Get Involved with OpenIM!
diff --git a/Dockerfile b/Dockerfile
index 85afdf98b..4be4861f6 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,10 +1,6 @@
# Build Stage
FROM golang:1.20 AS builder
-LABEL org.opencontainers.image.source=https://github.com/OpenIMSDK/Open-IM-Server
-LABEL org.opencontainers.image.description="OpenIM Server image"
-LABEL org.opencontainers.image.licenses="Apache 2.0"
-
# Set go mod installation source and proxy
ARG GO111MODULE=on
ARG GOPROXY=https://goproxy.cn,direct
@@ -12,26 +8,26 @@ ENV GO111MODULE=$GO111MODULE
ENV GOPROXY=$GOPROXY
# Set up the working directory
-WORKDIR /Open-IM-Server
+WORKDIR /openim/openim-server
+
+COPY go.mod go.sum ./
+RUN go mod download
# Copy all files to the container
ADD . .
+RUN /bin/sh -c "make clean"
RUN /bin/sh -c "make build"
-# Production Stage
-FROM alpine
-
-RUN echo "https://mirrors.aliyun.com/alpine/v3.4/main" > /etc/apk/repositories && \
- apk --no-cache add tzdata ca-certificates bash
+FROM ghcr.io/openim-sigs/openim-bash-image:latest
-# 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"]
+WORKDIR ${SERVER_WORKDIR}
# Copy scripts and binary files to the production image
-COPY --from=builder /Open-IM-Server/scripts /Open-IM-Server/scripts
-COPY --from=builder /Open-IM-Server/_output/bin/platforms/linux/amd64 /Open-IM-Server/_output/bin/platforms/linux/amd64
+COPY --from=builder ${OPENIM_SERVER_CMDDIR} /openim/openim-server/scripts
+COPY --from=builder ${SERVER_WORKDIR}/config /openim/openim-server/config
+COPY --from=builder ${SERVER_WORKDIR}/_output/bin/platforms /openim/openim-server/_output/bin/platforms
-WORKDIR /Open-IM-Server/scripts
+VOLUME ["/openim/openim-server/logs","/openim/openim-server/config","/openim/openim-server/scripts"]
-CMD ["./docker_start_all.sh"]
\ No newline at end of file
+CMD ["bash","-c","${OPENIM_SERVER_CMDDIR}/docker_start_all.sh"]
\ No newline at end of file
diff --git a/build/docker/openim-api/Dockerfile b/build/docker/openim-api/Dockerfile
index 1bf965ea4..b0760a6d7 100644
--- a/build/docker/openim-api/Dockerfile
+++ b/build/docker/openim-api/Dockerfile
@@ -1,12 +1,32 @@
-FROM golang:1.20.0 as build
+# OpenIM base image: https://github.com/openim-sigs/openim-base-image
-WORKDIR /openim
+# Set go mod installation source and proxy
-RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
- echo "Asia/Shanghai" > /etc/timezone && \
- mkdir -p /var/log/miniblog
+FROM golang:1.20 AS builder
-COPY miniblog /openim
+ARG GO111MODULE=on
+ARG GOPROXY=https://goproxy.cn,direct
-EXPOSE 10002
-CMD ["./bin/openim-api","--port", "10002"]
\ No newline at end of file
+WORKDIR /openim/openim-server
+
+ENV GO111MODULE=$GO111MODULE
+ENV GOPROXY=$GOPROXY
+
+COPY go.mod go.sum ./
+RUN go mod download
+
+COPY . .
+
+RUN make clean
+RUN make build BINS=openim-api
+
+FROM ghcr.io/openim-sigs/openim-bash-image:latest
+
+WORKDIR /openim/openim-server
+
+COPY --from=builder /openim/openim-server/_output/bin/platforms /openim/openim-server/_output/bin/platforms
+COPY --from=builder /openim/openim-server/config /openim/openim-server/config
+
+EXPOSE ${10002}
+
+CMD ["sh","-c","${OPENIM_SERVER_BINDIR}/platforms/${OS}/${ARCH}/openim-api --port 10002 -c ${SERVER_WORKDIR}/config"]
diff --git a/build/docker/openim-cmdutils/Dockerfile b/build/docker/openim-cmdutils/Dockerfile
index e69de29bb..91e97b76f 100644
--- a/build/docker/openim-cmdutils/Dockerfile
+++ b/build/docker/openim-cmdutils/Dockerfile
@@ -0,0 +1,31 @@
+# OpenIM base image: https://github.com/openim-sigs/openim-base-image
+
+# Set go mod installation source and proxy
+
+FROM golang:1.20 AS builder
+
+ARG GO111MODULE=on
+ARG GOPROXY=https://goproxy.cn,direct
+
+WORKDIR /openim/openim-server
+
+ENV GO111MODULE=$GO111MODULE
+ENV GOPROXY=$GOPROXY
+
+COPY go.mod go.sum ./
+RUN go mod download
+
+COPY . .
+
+RUN go mod download
+RUN make clean
+RUN make build BINS=openim-cmdutils
+
+FROM ghcr.io/openim-sigs/openim-bash-image:latest
+
+WORKDIR /openim/openim-server
+
+COPY --from=builder ${SERVER_WORKDIR}/_output/bin/platforms /openim/openim-server/_output/bin/platforms
+COPY --from=builder ${SERVER_WORKDIR}/config /openim/openim-server/config
+
+CMD ["sh","-c","${OPENIM_SERVER_BINDIR}/platforms/${OS}/${ARCH}/openim-cmdutils"]
diff --git a/build/docker/openim-crontask/Dockerfile b/build/docker/openim-crontask/Dockerfile
index e69de29bb..06847dc72 100644
--- a/build/docker/openim-crontask/Dockerfile
+++ b/build/docker/openim-crontask/Dockerfile
@@ -0,0 +1,30 @@
+# OpenIM base image: https://github.com/openim-sigs/openim-base-image
+
+# Set go mod installation source and proxy
+
+FROM golang:1.20 AS builder
+
+ARG GO111MODULE=on
+ARG GOPROXY=https://goproxy.cn,direct
+
+WORKDIR /openim/openim-server
+
+ENV GO111MODULE=$GO111MODULE
+ENV GOPROXY=$GOPROXY
+
+COPY go.mod go.sum ./
+RUN go mod download
+
+COPY . .
+
+RUN make clean
+RUN make build BINS=openim-crontask
+
+FROM ghcr.io/openim-sigs/openim-bash-image:latest
+
+WORKDIR /openim/openim-server
+
+COPY --from=builder /openim/openim-server/_output/bin/platforms /openim/openim-server/_output/bin/platforms
+COPY --from=builder /openim/openim-server/config /openim/openim-server/config
+
+CMD ["sh","-c","${OPENIM_SERVER_BINDIR}/platforms/${OS}/${ARCH}/openim-crontask"]
diff --git a/build/docker/openim-msggateway/Dockerfile b/build/docker/openim-msggateway/Dockerfile
index e69de29bb..5661d7f8b 100644
--- a/build/docker/openim-msggateway/Dockerfile
+++ b/build/docker/openim-msggateway/Dockerfile
@@ -0,0 +1,36 @@
+# OpenIM base image: https://github.com/openim-sigs/openim-base-image
+
+# Set go mod installation source and proxy
+
+FROM golang:1.20 AS builder
+
+ARG GO111MODULE=on
+ARG GOPROXY=https://goproxy.cn,direct
+
+WORKDIR /openim/openim-server
+
+ENV GO111MODULE=$GO111MODULE
+ENV GOPROXY=$GOPROXY
+
+COPY go.mod go.sum ./
+RUN go mod download
+
+COPY . .
+
+RUN make clean
+RUN make build BINS=openim-msggateway
+
+FROM ghcr.io/openim-sigs/openim-bash-image:latest
+
+WORKDIR /openim/openim-server
+
+COPY --from=builder /openim/openim-server/_output/bin/platforms /openim/openim-server/_output/bin/platforms
+COPY --from=builder /openim/openim-server/config /openim/openim-server/config
+
+ENV OS ${OS}
+ENV ARCH ${ARCH}
+
+EXPOSE 10140
+EXPOSE 10001
+
+CMD ${OPENIM_SERVER_BINDIR}/platforms/${OS}/${ARCH}/openim-msggateway --port 10140 --ws_port 10001
\ No newline at end of file
diff --git a/build/docker/openim-msgtransfer/Dockerfile b/build/docker/openim-msgtransfer/Dockerfile
index e69de29bb..2c63a3716 100644
--- a/build/docker/openim-msgtransfer/Dockerfile
+++ b/build/docker/openim-msgtransfer/Dockerfile
@@ -0,0 +1,33 @@
+# OpenIM base image: https://github.com/openim-sigs/openim-base-image
+
+# Set go mod installation source and proxy
+
+FROM golang:1.20 AS builder
+
+ARG GO111MODULE=on
+ARG GOPROXY=https://goproxy.cn,direct
+
+WORKDIR /openim/openim-server
+
+ENV GO111MODULE=$GO111MODULE
+ENV GOPROXY=$GOPROXY
+
+COPY go.mod go.sum ./
+RUN go mod download
+
+COPY . .
+
+RUN make clean
+RUN make build BINS=openim-msgtransfer
+
+FROM ghcr.io/openim-sigs/openim-bash-image:latest
+
+ENV OS ${OS}
+ENV ARCH ${ARCH}
+
+WORKDIR /openim/openim-server
+
+COPY --from=builder /openim/openim-server/_output/bin/platforms /openim/openim-server/_output/bin/platforms
+COPY --from=builder /openim/openim-server/config /openim/openim-server/config
+
+CMD ${OPENIM_SERVER_BINDIR}/platforms/${OS}/${ARCH}/openim-msgtransfer
\ No newline at end of file
diff --git a/build/docker/openim-push/Dockerfile b/build/docker/openim-push/Dockerfile
index e69de29bb..1da84525e 100644
--- a/build/docker/openim-push/Dockerfile
+++ b/build/docker/openim-push/Dockerfile
@@ -0,0 +1,35 @@
+# OpenIM base image: https://github.com/openim-sigs/openim-base-image
+
+# Set go mod installation source and proxy
+
+FROM golang:1.20 AS builder
+
+ARG GO111MODULE=on
+ARG GOPROXY=https://goproxy.cn,direct
+
+WORKDIR /openim/openim-server
+
+ENV GO111MODULE=$GO111MODULE
+ENV GOPROXY=$GOPROXY
+
+COPY go.mod go.sum ./
+RUN go mod download
+
+COPY . .
+
+RUN make clean
+RUN make build BINS=openim-push
+
+FROM ghcr.io/openim-sigs/openim-bash-image:latest
+
+WORKDIR /openim/openim-server
+
+ENV OS ${OS}
+ENV ARCH ${ARCH}
+
+COPY --from=builder /openim/openim-server/_output/bin/platforms /openim/openim-server/_output/bin/platforms
+COPY --from=builder /openim/openim-server/config /openim/openim-server/config
+
+EXPOSE 10170
+
+CMD ${OPENIM_SERVER_BINDIR}/platforms/${OS}/${ARCH}/openim-push --port 10170
\ No newline at end of file
diff --git a/build/docker/openim-rpc-auth/Dockerfile b/build/docker/openim-rpc-auth/Dockerfile
index e69de29bb..d7eddad5e 100644
--- a/build/docker/openim-rpc-auth/Dockerfile
+++ b/build/docker/openim-rpc-auth/Dockerfile
@@ -0,0 +1,38 @@
+# OpenIM base image: https://github.com/openim-sigs/openim-base-image
+
+# Set go mod installation source and proxy
+
+FROM golang:1.20 AS builder
+
+ARG GO111MODULE=on
+ARG GOPROXY=https://goproxy.cn,direct
+
+WORKDIR /openim/openim-server
+
+ENV GO111MODULE=$GO111MODULE
+ENV GOPROXY=$GOPROXY
+
+COPY go.mod go.sum ./
+RUN go mod download
+
+COPY . .
+
+RUN make clean
+
+# RUN make build BINS=openim-rpc
+
+RUN CGO_ENABLED=0 go build -ldflags="-w -s" -o ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-auth ./cmd/openim-rpc/openim-rpc-auth
+
+FROM ghcr.io/openim-sigs/openim-bash-image:latest
+
+WORKDIR /openim/openim-server
+
+ENV OS ${OS}
+ENV ARCH ${ARCH}
+
+COPY --from=builder /openim/openim-server/_output/bin/platforms /openim/openim-server/_output/bin/platforms/
+COPY --from=builder /openim/openim-server/config /openim/openim-server/config
+
+EXPOSE 10160
+
+CMD ["sh","-c","${OPENIM_SERVER_BINDIR}/platforms/${OS}/${ARCH}/openim-rpc-auth --port 10160 -c ${SERVER_WORKDIR}/config"]
\ No newline at end of file
diff --git a/build/docker/openim-rpc-conversation/Dockerfile b/build/docker/openim-rpc-conversation/Dockerfile
index e69de29bb..59eaaf179 100644
--- a/build/docker/openim-rpc-conversation/Dockerfile
+++ b/build/docker/openim-rpc-conversation/Dockerfile
@@ -0,0 +1,45 @@
+# OpenIM base image: https://github.com/openim-sigs/openim-base-image
+
+# Set go mod installation source and proxy
+
+FROM golang:1.20 AS builder
+
+ARG GO111MODULE=on
+ARG GOPROXY=https://goproxy.cn,direct
+
+WORKDIR /openim/openim-server
+
+ENV GO111MODULE=$GO111MODULE
+ENV GOPROXY=$GOPROXY
+
+COPY go.mod go.sum ./
+RUN go mod download
+
+COPY . .
+
+RUN make clean
+
+RUN make build BINS=openim-rpc
+# RUN CGO_ENABLED=0 go build -ldflags="-w -s" -o ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-conversation ./cmd/openim-rpc/openim-rpc-conversation
+
+RUN rm -rf ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-friend && \
+ rm -rf ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-group && \
+ rm -rf ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-msg && \
+ rm -rf ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-third && \
+ rm -rf ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-user && \
+ rm -rf ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-auth
+
+FROM ghcr.io/openim-sigs/openim-bash-image:latest
+
+WORKDIR /openim/openim-server
+
+ENV OS ${OS}
+ENV ARCH ${ARCH}
+
+COPY --from=builder /openim/openim-server/_output/bin/platforms /openim/openim-server/_output/bin/platforms/
+COPY --from=builder /openim/openim-server/config /openim/openim-server/config
+
+EXPOSE 10230
+EXPOSE 20230
+
+CMD ["sh","-c","${OPENIM_SERVER_BINDIR}/platforms/${OS}/${ARCH}/openim-rpc-conversation --port 10230 --prometheus_port 20230 -c ${SERVER_WORKDIR}/config"]
\ No newline at end of file
diff --git a/build/docker/openim-rpc-friend/Dockerfile b/build/docker/openim-rpc-friend/Dockerfile
index e69de29bb..139ed49cb 100644
--- a/build/docker/openim-rpc-friend/Dockerfile
+++ b/build/docker/openim-rpc-friend/Dockerfile
@@ -0,0 +1,45 @@
+# OpenIM base image: https://github.com/openim-sigs/openim-base-image
+
+# Set go mod installation source and proxy
+
+FROM golang:1.20 AS builder
+
+ARG GO111MODULE=on
+ARG GOPROXY=https://goproxy.cn,direct
+
+WORKDIR /openim/openim-server
+
+ENV GO111MODULE=$GO111MODULE
+ENV GOPROXY=$GOPROXY
+
+COPY go.mod go.sum ./
+RUN go mod download
+
+COPY . .
+
+RUN make clean
+
+RUN make build BINS=openim-rpc
+# RUN CGO_ENABLED=0 go build -ldflags="-w -s" -o ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-friend ./cmd/openim-rpc/openim-rpc-friend
+
+RUN rm -rf ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-group && \
+ rm -rf ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-msg && \
+ rm -rf ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-third && \
+ rm -rf ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-user && \
+ rm -rf ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-conversation && \
+ rm -rf ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-auth
+
+FROM ghcr.io/openim-sigs/openim-bash-image:latest
+
+WORKDIR /openim/openim-server
+
+ENV OS ${OS}
+ENV ARCH ${ARCH}
+
+COPY --from=builder /openim/openim-server/_output/bin/platforms /openim/openim-server/_output/bin/platforms/
+COPY --from=builder /openim/openim-server/config /openim/openim-server/config
+
+EXPOSE 10120
+EXPOSE 20120
+
+CMD ["sh","-c","${OPENIM_SERVER_BINDIR}/platforms/${OS}/${ARCH}/openim-rpc-friend --port 10120 --prometheus_port 20120 -c ${SERVER_WORKDIR}/config"]
\ No newline at end of file
diff --git a/build/docker/openim-rpc-group/Dockerfile b/build/docker/openim-rpc-group/Dockerfile
index e69de29bb..9f18a083a 100644
--- a/build/docker/openim-rpc-group/Dockerfile
+++ b/build/docker/openim-rpc-group/Dockerfile
@@ -0,0 +1,45 @@
+# OpenIM base image: https://github.com/openim-sigs/openim-base-image
+
+# Set go mod installation source and proxy
+
+FROM golang:1.20 AS builder
+
+ARG GO111MODULE=on
+ARG GOPROXY=https://goproxy.cn,direct
+
+WORKDIR /openim/openim-server
+
+ENV GO111MODULE=$GO111MODULE
+ENV GOPROXY=$GOPROXY
+
+COPY go.mod go.sum ./
+RUN go mod download
+
+COPY . .
+
+RUN make clean
+
+RUN make build BINS=openim-rpc
+# RUN CGO_ENABLED=0 go build -ldflags="-w -s" -o ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-group ./cmd/openim-rpc/openim-rpc-group
+
+RUN rm -rf ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-friend && \
+ rm -rf ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-msg && \
+ rm -rf ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-third && \
+ rm -rf ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-user && \
+ rm -rf ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-conversation && \
+ rm -rf ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-auth
+
+FROM ghcr.io/openim-sigs/openim-bash-image:latest
+
+WORKDIR /openim/openim-server
+
+ENV OS ${OS}
+ENV ARCH ${ARCH}
+
+COPY --from=builder /openim/openim-server/_output/bin/platforms /openim/openim-server/_output/bin/platforms/
+COPY --from=builder /openim/openim-server/config /openim/openim-server/config
+
+EXPOSE 10150
+EXPOSE 20150
+
+CMD ["sh","-c","${OPENIM_SERVER_BINDIR}/platforms/${OS}/${ARCH}/openim-rpc-group --port 10150 --prometheus_port 20150 -c ${SERVER_WORKDIR}/config"]
\ No newline at end of file
diff --git a/build/docker/openim-rpc-msg/Dockerfile b/build/docker/openim-rpc-msg/Dockerfile
index e69de29bb..48af35c1f 100644
--- a/build/docker/openim-rpc-msg/Dockerfile
+++ b/build/docker/openim-rpc-msg/Dockerfile
@@ -0,0 +1,45 @@
+# OpenIM base image: https://github.com/openim-sigs/openim-base-image
+
+# Set go mod installation source and proxy
+
+FROM golang:1.20 AS builder
+
+ARG GO111MODULE=on
+ARG GOPROXY=https://goproxy.cn,direct
+
+WORKDIR /openim/openim-server
+
+ENV GO111MODULE=$GO111MODULE
+ENV GOPROXY=$GOPROXY
+
+COPY go.mod go.sum ./
+RUN go mod download
+
+COPY . .
+
+RUN make clean
+
+RUN make build BINS=openim-rpc
+# RUN CGO_ENABLED=0 go build -ldflags="-w -s" -o ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-msg ./cmd/openim-rpc/openim-rpc-msg
+
+RUN rm -rf ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-friend && \
+ rm -rf ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-group && \
+ rm -rf ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-third && \
+ rm -rf ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-user && \
+ rm -rf ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-conversation && \
+ rm -rf ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-auth
+
+FROM ghcr.io/openim-sigs/openim-bash-image:latest
+
+WORKDIR /openim/openim-server
+
+ENV OS ${OS}
+ENV ARCH ${ARCH}
+
+COPY --from=builder /openim/openim-server/_output/bin/platforms /openim/openim-server/_output/bin/platforms/
+COPY --from=builder /openim/openim-server/config /openim/openim-server/config
+
+EXPOSE 10130
+EXPOSE 20130
+
+CMD ["sh","-c","${OPENIM_SERVER_BINDIR}/platforms/${OS}/${ARCH}/openim-rpc-msg --port 10130 --prometheus_port 20130 -c ${SERVER_WORKDIR}/config"]
\ No newline at end of file
diff --git a/build/docker/openim-rpc-third/Dockerfile b/build/docker/openim-rpc-third/Dockerfile
index e69de29bb..5c4a17668 100644
--- a/build/docker/openim-rpc-third/Dockerfile
+++ b/build/docker/openim-rpc-third/Dockerfile
@@ -0,0 +1,44 @@
+# OpenIM base image: https://github.com/openim-sigs/openim-base-image
+
+# Set go mod installation source and proxy
+
+FROM golang:1.20 AS builder
+
+ARG GO111MODULE=on
+ARG GOPROXY=https://goproxy.cn,direct
+
+WORKDIR /openim/openim-server
+
+ENV GO111MODULE=$GO111MODULE
+ENV GOPROXY=$GOPROXY
+
+COPY go.mod go.sum ./
+RUN go mod download
+
+COPY . .
+
+RUN make clean
+
+RUN make build BINS=openim-rpc
+# RUN CGO_ENABLED=0 go build -ldflags="-w -s" -o ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-third ./cmd/openim-rpc/openim-rpc-third
+
+RUN rm -rf ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-friend && \
+ rm -rf ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-group && \
+ rm -rf ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-msg && \
+ rm -rf ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-user && \
+ rm -rf ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-conversation && \
+ rm -rf ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-auth
+
+FROM ghcr.io/openim-sigs/openim-bash-image:latest
+
+WORKDIR /openim/openim-server
+
+ENV OS ${OS}
+ENV ARCH ${ARCH}
+
+COPY --from=builder /openim/openim-server/_output/bin/platforms /openim/openim-server/_output/bin/platforms/
+COPY --from=builder /openim/openim-server/config /openim/openim-server/config
+
+EXPOSE 10200
+
+CMD ["sh","-c","${OPENIM_SERVER_BINDIR}/platforms/${OS}/${ARCH}/openim-rpc-third --port 10200 -c ${SERVER_WORKDIR}/config"]
\ No newline at end of file
diff --git a/build/docker/openim-rpc-user/Dockerfile b/build/docker/openim-rpc-user/Dockerfile
index e69de29bb..732368f89 100644
--- a/build/docker/openim-rpc-user/Dockerfile
+++ b/build/docker/openim-rpc-user/Dockerfile
@@ -0,0 +1,44 @@
+# OpenIM base image: https://github.com/openim-sigs/openim-base-image
+
+# Set go mod installation source and proxy
+
+FROM golang:1.20 AS builder
+
+ARG GO111MODULE=on
+ARG GOPROXY=https://goproxy.cn,direct
+
+WORKDIR /openim/openim-server
+
+ENV GO111MODULE=$GO111MODULE
+ENV GOPROXY=$GOPROXY
+
+COPY go.mod go.sum ./
+RUN go mod download
+
+COPY . .
+
+RUN make clean
+
+RUN make build BINS=openim-rpc
+# RUN CGO_ENABLED=0 go build -ldflags="-w -s" -o ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-user ./cmd/openim-rpc/openim-rpc-user
+
+RUN rm -rf ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-friend && \
+ rm -rf ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-group && \
+ rm -rf ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-msg && \
+ rm -rf ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-third && \
+ rm -rf ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-conversation && \
+ rm -rf ./_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-auth
+
+FROM ghcr.io/openim-sigs/openim-bash-image:latest
+
+WORKDIR /openim/openim-server
+
+ENV OS ${OS}
+ENV ARCH ${ARCH}
+
+COPY --from=builder /openim/openim-server/_output/bin/platforms /openim/openim-server/_output/bin/platforms/
+COPY --from=builder /openim/openim-server/config /openim/openim-server/config
+
+EXPOSE 10110
+
+CMD ["sh","-c","${OPENIM_SERVER_BINDIR}/platforms/${OS}/${ARCH}/openim-rpc-user --port 10110 -c ${SERVER_WORKDIR}/config"]
\ No newline at end of file
diff --git a/cmd/openim-api/Makefile b/cmd/openim-api/Makefile
deleted file mode 100644
index b72c6c717..000000000
--- a/cmd/openim-api/Makefile
+++ /dev/null
@@ -1,34 +0,0 @@
-.PHONY: all build run gotool install clean help
-
-NAME=openim-api
-BIN_DIR=../../bin/
-
-OS:= $(or $(os),linux)
-ARCH:=$(or $(arch),amd64)
-all: gotool build
-
-ifeq ($(OS),windows)
-
-BINARY_NAME=${NAME}.exe
-
-else
-
-BINARY_NAME=${NAME}
-
-endif
-
-build:
- CGO_ENABLED=0 GOOS=${OS} GOARCH=${ARCH}; go build -ldflags="-w -s" -o ${BINARY_NAME}
-
-run:
- @go run ./
-
-gotool:
- go fmt ./
- go vet ./
-
-install:build
- mv ${BINARY_NAME} ${BIN_DIR}
-
-clean:
- @if [ -f ${BINARY_NAME} ] ; then rm ${BINARY_NAME} ; fi
diff --git a/cmd/openim-api/deploy.Dockerfile b/cmd/openim-api/deploy.Dockerfile
index 3479e0cd3..56dd4a106 100644
--- a/cmd/openim-api/deploy.Dockerfile
+++ b/cmd/openim-api/deploy.Dockerfile
@@ -14,7 +14,7 @@
FROM ubuntu
-WORKDIR /Open-IM-Server/bin
+WORKDIR /openim/openim-server/bin
RUN apt-get update && apt-get install apt-transport-https && apt-get install procps\
&&apt-get install net-tools
@@ -27,6 +27,6 @@ RUN apt-get -qq update \
&& apt-get -qq install -y --no-install-recommends ca-certificates curl
COPY ./openim-api ./
-VOLUME ["/Open-IM-Server/logs","/Open-IM-Server/config"]
+VOLUME ["/openim/openim-server/logs","/openim/openim-server/config"]
CMD ["./openim-api","--port", "10002"]
diff --git a/cmd/openim-cmdutils/Makefile b/cmd/openim-cmdutils/Makefile
deleted file mode 100644
index e78ac33f6..000000000
--- a/cmd/openim-cmdutils/Makefile
+++ /dev/null
@@ -1,34 +0,0 @@
-.PHONY: all build run gotool install clean help
-
-NAME=openim-cmdutils
-BIN_DIR=../../bin/
-
-OS:= $(or $(os),linux)
-ARCH:=$(or $(arch),amd64)
-all: gotool build
-
-ifeq ($(OS),windows)
-
-BINARY_NAME=${NAME}.exe
-
-else
-
-BINARY_NAME=${NAME}
-
-endif
-
-build:
- CGO_ENABLED=0 GOOS=${OS} GOARCH=${ARCH}; go build -ldflags="-w -s" -o ${BINARY_NAME}
-
-run:
- @go run ./
-
-gotool:
- go fmt ./
- go vet ./
-
-install:build
- mv ${BINARY_NAME} ${BIN_DIR}
-
-clean:
- @if [ -f ${BINARY_NAME} ] ; then rm ${BINARY_NAME} ; fi
diff --git a/cmd/openim-crontask/Makefile b/cmd/openim-crontask/Makefile
deleted file mode 100644
index 58528ccb5..000000000
--- a/cmd/openim-crontask/Makefile
+++ /dev/null
@@ -1,34 +0,0 @@
-.PHONY: all build run gotool install clean help
-
-NAME=openim-crontask
-BIN_DIR=../../bin/
-
-OS:= $(or $(os),linux)
-ARCH:=$(or $(arch),amd64)
-all: gotool build
-
-ifeq ($(OS),windows)
-
-BINARY_NAME=${NAME}.exe
-
-else
-
-BINARY_NAME=${NAME}
-
-endif
-
-build:
- CGO_ENABLED=0 GOOS=${OS} GOARCH=${ARCH}; go build -ldflags="-w -s" -o ${BINARY_NAME}
-
-run:
- @go run ./
-
-gotool:
- go fmt ./
- go vet ./
-
-install:build
- mv ${BINARY_NAME} ${BIN_DIR}
-
-clean:
- @if [ -f ${BINARY_NAME} ] ; then rm ${BINARY_NAME} ; fi
diff --git a/cmd/openim-crontask/deploy.Dockerfile b/cmd/openim-crontask/deploy.Dockerfile
index ba5230c42..9ada56d26 100644
--- a/cmd/openim-crontask/deploy.Dockerfile
+++ b/cmd/openim-crontask/deploy.Dockerfile
@@ -14,7 +14,7 @@
FROM ubuntu
-WORKDIR /Open-IM-Server/bin
+WORKDIR /openim/openim-server/bin
RUN apt-get update && apt-get install apt-transport-https && apt-get install procps\
&&apt-get install net-tools
@@ -27,6 +27,6 @@ RUN apt-get -qq update \
&& apt-get -qq install -y --no-install-recommends ca-certificates curl
COPY ./openim-crontask ./
-VOLUME ["/Open-IM-Server/logs","/Open-IM-Server/config"]
+VOLUME ["/openim/openim-server/logs","/openim/openim-server/config"]
CMD ["./openim-crontask"]
diff --git a/cmd/openim-msggateway/Makefile b/cmd/openim-msggateway/Makefile
deleted file mode 100644
index d5238beae..000000000
--- a/cmd/openim-msggateway/Makefile
+++ /dev/null
@@ -1,34 +0,0 @@
-.PHONY: all build run gotool install clean help
-
-NAME=openim-rpc-msg_gateway
-BIN_DIR=../../bin/
-
-OS:= $(or $(os),linux)
-ARCH:=$(or $(arch),amd64)
-all: gotool build
-
-ifeq ($(OS),windows)
-
-BINARY_NAME=${NAME}.exe
-
-else
-
-BINARY_NAME=${NAME}
-
-endif
-
-build:
- CGO_ENABLED=0 GOOS=${OS} GOARCH=${ARCH}; go build -ldflags="-w -s" -o ${BINARY_NAME}
-
-run:
- @go run ./
-
-gotool:
- go fmt ./
- go vet ./
-
-install:build
- mv ${BINARY_NAME} ${BIN_DIR}
-
-clean:
- @if [ -f ${BINARY_NAME} ] ; then rm ${BINARY_NAME} ; fi
diff --git a/cmd/openim-msggateway/deploy.Dockerfile b/cmd/openim-msggateway/deploy.Dockerfile
index 7ba0d2235..31a30ff4b 100644
--- a/cmd/openim-msggateway/deploy.Dockerfile
+++ b/cmd/openim-msggateway/deploy.Dockerfile
@@ -14,7 +14,7 @@
FROM ubuntu
-WORKDIR /Open-IM-Server/bin
+WORKDIR /openim/openim-server/bin
RUN apt-get update && apt-get install apt-transport-https && apt-get install procps\
&&apt-get install net-tools
@@ -27,6 +27,6 @@ RUN apt-get -qq update \
&& apt-get -qq install -y --no-install-recommends ca-certificates curl
COPY ./openim-rpc-msg_gateway ./
-VOLUME ["/Open-IM-Server/logs","/Open-IM-Server/config"]
+VOLUME ["/openim/openim-server/logs","/openim/openim-server/config"]
CMD ["./openim-rpc-msg_gateway","--port", "10140" "--ws_port", "10001", "--prometheus_port", "20240"]
diff --git a/cmd/openim-msgtransfer/Makefile b/cmd/openim-msgtransfer/Makefile
deleted file mode 100644
index e2d058f6d..000000000
--- a/cmd/openim-msgtransfer/Makefile
+++ /dev/null
@@ -1,34 +0,0 @@
-.PHONY: all build run gotool install clean help
-
-NAME=openim-msgtransfer
-BIN_DIR=../../bin/
-
-OS:= $(or $(os),linux)
-ARCH:=$(or $(arch),amd64)
-all: gotool build
-
-ifeq ($(OS),windows)
-
-BINARY_NAME=${NAME}.exe
-
-else
-
-BINARY_NAME=${NAME}
-
-endif
-
-build:
- CGO_ENABLED=0 GOOS=${OS} GOARCH=${ARCH}; go build -ldflags="-w -s" -o ${BINARY_NAME}
-
-run:
- @go run ./
-
-gotool:
- go fmt ./
- go vet ./
-
-install:build
- mv ${BINARY_NAME} ${BIN_DIR}
-
-clean:
- @if [ -f ${BINARY_NAME} ] ; then rm ${BINARY_NAME} ; fi
diff --git a/cmd/openim-msgtransfer/deploy.Dockerfile b/cmd/openim-msgtransfer/deploy.Dockerfile
index 78f1f955c..7eedcbdbc 100644
--- a/cmd/openim-msgtransfer/deploy.Dockerfile
+++ b/cmd/openim-msgtransfer/deploy.Dockerfile
@@ -14,7 +14,7 @@
FROM ubuntu
-WORKDIR /Open-IM-Server/bin
+WORKDIR /openim/openim-server/bin
RUN apt-get update && apt-get install apt-transport-https && apt-get install procps\
&&apt-get install net-tools
@@ -27,6 +27,6 @@ RUN apt-get -qq update \
&& apt-get -qq install -y --no-install-recommends ca-certificates curl
COPY ./openim-msgtransfer ./
-VOLUME ["/Open-IM-Server/logs","/Open-IM-Server/config"]
+VOLUME ["/openim/openim-server/logs","/openim/openim-server/config"]
CMD ["./openim-msgtransfer","--prometheus_port", "21400"]
diff --git a/cmd/openim-push/Makefile b/cmd/openim-push/Makefile
deleted file mode 100644
index b417faecf..000000000
--- a/cmd/openim-push/Makefile
+++ /dev/null
@@ -1,34 +0,0 @@
-.PHONY: all build run gotool install clean help
-
-NAME=openim-push
-BIN_DIR=../../bin/
-
-OS:= $(or $(os),linux)
-ARCH:=$(or $(arch),amd64)
-all: gotool build
-
-ifeq ($(OS),windows)
-
-BINARY_NAME=${NAME}.exe
-
-else
-
-BINARY_NAME=${NAME}
-
-endif
-
-build:
- CGO_ENABLED=0 GOOS=${OS} GOARCH=${ARCH}; go build -ldflags="-w -s" -o ${BINARY_NAME}
-
-run:
- @go run ./
-
-gotool:
- go fmt ./
- go vet ./
-
-install:build
- mv ${BINARY_NAME} ${BIN_DIR}
-
-clean:
- @if [ -f ${BINARY_NAME} ] ; then rm ${BINARY_NAME} ; fi
diff --git a/cmd/openim-push/deploy.Dockerfile b/cmd/openim-push/deploy.Dockerfile
index 67774a6f7..6e4e44525 100644
--- a/cmd/openim-push/deploy.Dockerfile
+++ b/cmd/openim-push/deploy.Dockerfile
@@ -14,7 +14,7 @@
FROM ubuntu
-WORKDIR /Open-IM-Server/bin
+WORKDIR /openim/openim-server/bin
RUN apt-get update && apt-get install apt-transport-https && apt-get install procps\
&&apt-get install net-tools
@@ -27,6 +27,6 @@ RUN apt-get -qq update \
&& apt-get -qq install -y --no-install-recommends ca-certificates curl
COPY ./openim-push ./
-VOLUME ["/Open-IM-Server/logs","/Open-IM-Server/config"]
+VOLUME ["/openim/openim-server/logs","/openim/openim-server/config"]
CMD ["./openim-push", "--port", "10170", "--prometheus_port", "20170"]
diff --git a/cmd/openim-rpc/openim-rpc-auth/Makefile b/cmd/openim-rpc/openim-rpc-auth/Makefile
deleted file mode 100644
index 068d50fd8..000000000
--- a/cmd/openim-rpc/openim-rpc-auth/Makefile
+++ /dev/null
@@ -1,34 +0,0 @@
-.PHONY: all build run gotool install clean help
-
-NAME=openim-rpc-auth
-BIN_DIR=../../../bin/
-
-OS:= $(or $(os),linux)
-ARCH:=$(or $(arch),amd64)
-all: gotool build
-
-ifeq ($(OS),windows)
-
-BINARY_NAME=${NAME}.exe
-
-else
-
-BINARY_NAME=${NAME}
-
-endif
-
-build:
- CGO_ENABLED=0 GOOS=${OS} GOARCH=${ARCH}; go build -ldflags="-w -s" -o ${BINARY_NAME}
-
-run:
- @go run ./
-
-gotool:
- go fmt ./
- go vet ./
-
-install:build
- mv ${BINARY_NAME} ${BIN_DIR}
-
-clean:
- @if [ -f ${BINARY_NAME} ] ; then rm ${BINARY_NAME} ; fi
diff --git a/cmd/openim-rpc/openim-rpc-auth/deploy.Dockerfile b/cmd/openim-rpc/openim-rpc-auth/deploy.Dockerfile
index b529860f9..6d034303c 100644
--- a/cmd/openim-rpc/openim-rpc-auth/deploy.Dockerfile
+++ b/cmd/openim-rpc/openim-rpc-auth/deploy.Dockerfile
@@ -14,7 +14,7 @@
FROM ubuntu
-WORKDIR /Open-IM-Server/bin
+WORKDIR /openim/openim-server/bin
RUN apt-get update && apt-get install apt-transport-https && apt-get install procps\
&&apt-get install net-tools
@@ -27,6 +27,6 @@ RUN apt-get -qq update \
&& apt-get -qq install -y --no-install-recommends ca-certificates curl
COPY ./openim-rpc-auth ./
-VOLUME ["/Open-IM-Server/logs","/Open-IM-Server/config"]
+VOLUME ["/openim/openim-server/logs","/openim/openim-server/config"]
CMD ["./openim-rpc-auth", "--port", "10160"]
diff --git a/cmd/openim-rpc/openim-rpc-conversation/Makefile b/cmd/openim-rpc/openim-rpc-conversation/Makefile
deleted file mode 100644
index 4c9726011..000000000
--- a/cmd/openim-rpc/openim-rpc-conversation/Makefile
+++ /dev/null
@@ -1,34 +0,0 @@
-.PHONY: all build run gotool install clean help
-
-NAME=openim-rpc-conversation
-BIN_DIR=../../../bin/
-
-OS:= $(or $(os),linux)
-ARCH:=$(or $(arch),amd64)
-all: gotool build
-
-ifeq ($(OS),windows)
-
-BINARY_NAME=${NAME}.exe
-
-else
-
-BINARY_NAME=${NAME}
-
-endif
-
-build:
- CGO_ENABLED=0 GOOS=${OS} GOARCH=${ARCH}; go build -ldflags="-w -s" -o ${BINARY_NAME}
-
-run:
- @go run ./
-
-gotool:
- go fmt ./
- go vet ./
-
-install:build
- mv ${BINARY_NAME} ${BIN_DIR}
-
-clean:
- @if [ -f ${BINARY_NAME} ] ; then rm ${BINARY_NAME} ; fi
diff --git a/cmd/openim-rpc/openim-rpc-conversation/deploy.Dockerfile b/cmd/openim-rpc/openim-rpc-conversation/deploy.Dockerfile
index 33e5c93c1..8245e3ca1 100644
--- a/cmd/openim-rpc/openim-rpc-conversation/deploy.Dockerfile
+++ b/cmd/openim-rpc/openim-rpc-conversation/deploy.Dockerfile
@@ -14,7 +14,7 @@
FROM ubuntu
-WORKDIR /Open-IM-Server/bin
+WORKDIR /openim/openim-server/bin
RUN apt-get update && apt-get install apt-transport-https && apt-get install procps\
&&apt-get install net-tools
@@ -27,6 +27,6 @@ RUN apt-get -qq update \
&& apt-get -qq install -y --no-install-recommends ca-certificates curl
COPY ./openim-rpc-conversation ./
-VOLUME ["/Open-IM-Server/logs","/Open-IM-Server/config"]
+VOLUME ["/openim/openim-server/logs","/openim/openim-server/config"]
CMD ["./openim-rpc-conversation", "--port", "10230", "--prometheus_port","20230"]
diff --git a/cmd/openim-rpc/openim-rpc-friend/Makefile b/cmd/openim-rpc/openim-rpc-friend/Makefile
deleted file mode 100644
index e0068e97d..000000000
--- a/cmd/openim-rpc/openim-rpc-friend/Makefile
+++ /dev/null
@@ -1,34 +0,0 @@
-.PHONY: all build run gotool install clean help
-
-NAME=openim-rpc-friend
-BIN_DIR=../../../bin/
-
-OS:= $(or $(os),linux)
-ARCH:=$(or $(arch),amd64)
-all: gotool build
-
-ifeq ($(OS),windows)
-
-BINARY_NAME=${NAME}.exe
-
-else
-
-BINARY_NAME=${NAME}
-
-endif
-
-build:
- CGO_ENABLED=0 GOOS=${OS} GOARCH=${ARCH}; go build -ldflags="-w -s" -o ${BINARY_NAME}
-
-run:
- @go run ./
-
-gotool:
- go fmt ./
- go vet ./
-
-install:build
- mv ${BINARY_NAME} ${BIN_DIR}
-
-clean:
- @if [ -f ${BINARY_NAME} ] ; then rm ${BINARY_NAME} ; fi
diff --git a/cmd/openim-rpc/openim-rpc-friend/deploy.Dockerfile b/cmd/openim-rpc/openim-rpc-friend/deploy.Dockerfile
index f306a7938..5f842a631 100644
--- a/cmd/openim-rpc/openim-rpc-friend/deploy.Dockerfile
+++ b/cmd/openim-rpc/openim-rpc-friend/deploy.Dockerfile
@@ -14,7 +14,7 @@
FROM ubuntu
-WORKDIR /Open-IM-Server/bin
+WORKDIR /openim/openim-server/bin
RUN apt-get update && apt-get install apt-transport-https && apt-get install procps\
&&apt-get install net-tools
@@ -27,6 +27,6 @@ RUN apt-get -qq update \
&& apt-get -qq install -y --no-install-recommends ca-certificates curl
COPY ./openim-rpc-friend ./
-VOLUME ["/Open-IM-Server/logs","/Open-IM-Server/config"]
+VOLUME ["/openim/openim-server/logs","/openim/openim-server/config"]
CMD ["./openim-rpc-friend", "--port", "10120", "--prometheus_port","20120"]
diff --git a/cmd/openim-rpc/openim-rpc-group/Makefile b/cmd/openim-rpc/openim-rpc-group/Makefile
deleted file mode 100644
index 8ba79043d..000000000
--- a/cmd/openim-rpc/openim-rpc-group/Makefile
+++ /dev/null
@@ -1,34 +0,0 @@
-.PHONY: all build run gotool install clean help
-
-NAME=openim-rpc-group
-BIN_DIR=../../../bin/
-
-OS:= $(or $(os),linux)
-ARCH:=$(or $(arch),amd64)
-all: gotool build
-
-ifeq ($(OS),windows)
-
-BINARY_NAME=${NAME}.exe
-
-else
-
-BINARY_NAME=${NAME}
-
-endif
-
-build:
- CGO_ENABLED=0 GOOS=${OS} GOARCH=${ARCH}; go build -ldflags="-w -s" -o ${BINARY_NAME}
-
-run:
- @go run ./
-
-gotool:
- go fmt ./
- go vet ./
-
-install:build
- mv ${BINARY_NAME} ${BIN_DIR}
-
-clean:
- @if [ -f ${BINARY_NAME} ] ; then rm ${BINARY_NAME} ; fi
diff --git a/cmd/openim-rpc/openim-rpc-group/deploy.Dockerfile b/cmd/openim-rpc/openim-rpc-group/deploy.Dockerfile
index ed46edcf7..42fe164df 100644
--- a/cmd/openim-rpc/openim-rpc-group/deploy.Dockerfile
+++ b/cmd/openim-rpc/openim-rpc-group/deploy.Dockerfile
@@ -14,7 +14,7 @@
FROM ubuntu
-WORKDIR /Open-IM-Server/bin
+WORKDIR /openim/openim-server/bin
RUN apt-get update && apt-get install apt-transport-https && apt-get install procps\
&&apt-get install net-tools
@@ -27,6 +27,6 @@ RUN apt-get -qq update \
&& apt-get -qq install -y --no-install-recommends ca-certificates curl
COPY ./openim-rpc-group ./
-VOLUME ["/Open-IM-Server/logs","/Open-IM-Server/config"]
+VOLUME ["/openim/openim-server/logs","/openim/openim-server/config"]
CMD ["./openim-rpc-group", "--port", "10150", "--prometheus_port","20150"]
diff --git a/cmd/openim-rpc/openim-rpc-msg/Makefile b/cmd/openim-rpc/openim-rpc-msg/Makefile
deleted file mode 100644
index 872fbfbba..000000000
--- a/cmd/openim-rpc/openim-rpc-msg/Makefile
+++ /dev/null
@@ -1,34 +0,0 @@
-.PHONY: all build run gotool install clean help
-
-NAME=openim-rpc-msg
-BIN_DIR=../../../bin/
-
-OS:= $(or $(os),linux)
-ARCH:=$(or $(arch),amd64)
-all: gotool build
-
-ifeq ($(OS),windows)
-
-BINARY_NAME=${NAME}.exe
-
-else
-
-BINARY_NAME=${NAME}
-
-endif
-
-build:
- CGO_ENABLED=0 GOOS=${OS} GOARCH=${ARCH}; go build -ldflags="-w -s" -o ${BINARY_NAME}
-
-run:
- @go run ./
-
-gotool:
- go fmt ./
- go vet ./
-
-install:build
- mv ${BINARY_NAME} ${BIN_DIR}
-
-clean:
- @if [ -f ${BINARY_NAME} ] ; then rm ${BINARY_NAME} ; fi
diff --git a/cmd/openim-rpc/openim-rpc-msg/deploy.Dockerfile b/cmd/openim-rpc/openim-rpc-msg/deploy.Dockerfile
index 61737417e..754d782a0 100644
--- a/cmd/openim-rpc/openim-rpc-msg/deploy.Dockerfile
+++ b/cmd/openim-rpc/openim-rpc-msg/deploy.Dockerfile
@@ -14,7 +14,7 @@
FROM ubuntu
-WORKDIR /Open-IM-Server/bin
+WORKDIR /openim/openim-server/bin
RUN apt-get update && apt-get install apt-transport-https && apt-get install procps\
&&apt-get install net-tools
@@ -27,6 +27,6 @@ RUN apt-get -qq update \
&& apt-get -qq install -y --no-install-recommends ca-certificates curl
COPY ./openim-rpc-msg ./
-VOLUME ["/Open-IM-Server/logs","/Open-IM-Server/config"]
+VOLUME ["/openim/openim-server/logs","/openim/openim-server/config"]
CMD ["./openim-rpc-msg", "--port", "10130", "--prometheus_port","20130"]
diff --git a/cmd/openim-rpc/openim-rpc-third/Makefile b/cmd/openim-rpc/openim-rpc-third/Makefile
deleted file mode 100644
index 28059b2c4..000000000
--- a/cmd/openim-rpc/openim-rpc-third/Makefile
+++ /dev/null
@@ -1,34 +0,0 @@
-.PHONY: all build run gotool install clean help
-
-NAME=openim-rpc-third
-BIN_DIR=../../../bin/
-
-OS:= $(or $(os),linux)
-ARCH:=$(or $(arch),amd64)
-all: gotool build
-
-ifeq ($(OS),windows)
-
-BINARY_NAME=${NAME}.exe
-
-else
-
-BINARY_NAME=${NAME}
-
-endif
-
-build:
- CGO_ENABLED=0 GOOS=${OS} GOARCH=${ARCH}; go build -ldflags="-w -s" -o ${BINARY_NAME}
-
-run:
- @go run ./
-
-gotool:
- go fmt ./
- go vet ./
-
-install:build
- mv ${BINARY_NAME} ${BIN_DIR}
-
-clean:
- @if [ -f ${BINARY_NAME} ] ; then rm ${BINARY_NAME} ; fi
diff --git a/cmd/openim-rpc/openim-rpc-third/deploy.Dockerfile b/cmd/openim-rpc/openim-rpc-third/deploy.Dockerfile
index 29bc2d068..664ad452c 100644
--- a/cmd/openim-rpc/openim-rpc-third/deploy.Dockerfile
+++ b/cmd/openim-rpc/openim-rpc-third/deploy.Dockerfile
@@ -14,7 +14,7 @@
FROM ubuntu
-WORKDIR /Open-IM-Server/bin
+WORKDIR /openim/openim-server/bin
RUN apt-get update && apt-get install apt-transport-https && apt-get install procps\
&&apt-get install net-tools
@@ -27,6 +27,6 @@ RUN apt-get -qq update \
&& apt-get -qq install -y --no-install-recommends ca-certificates curl
COPY ./openim-rpc-third ./
-VOLUME ["/Open-IM-Server/logs","/Open-IM-Server/config"]
+VOLUME ["/openim/openim-server/logs","/openim/openim-server/config"]
CMD ["./openim-rpc-third", "--port", "10200"]
diff --git a/cmd/openim-rpc/openim-rpc-user/Makefile b/cmd/openim-rpc/openim-rpc-user/Makefile
deleted file mode 100644
index 1a7eed913..000000000
--- a/cmd/openim-rpc/openim-rpc-user/Makefile
+++ /dev/null
@@ -1,34 +0,0 @@
-.PHONY: all build run gotool install clean help
-
-NAME=openim-rpc-user
-BIN_DIR=../../../bin/
-
-OS:= $(or $(os),linux)
-ARCH:=$(or $(arch),amd64)
-all: gotool build
-
-ifeq ($(OS),windows)
-
-BINARY_NAME=${NAME}.exe
-
-else
-
-BINARY_NAME=${NAME}
-
-endif
-
-build:
- CGO_ENABLED=0 GOOS=${OS} GOARCH=${ARCH}; go build -ldflags="-w -s" -o ${BINARY_NAME}
-
-run:
- @go run ./
-
-gotool:
- go fmt ./
- go vet ./
-
-install:build
- mv ${BINARY_NAME} ${BIN_DIR}
-
-clean:
- @if [ -f ${BINARY_NAME} ] ; then rm ${BINARY_NAME} ; fi
diff --git a/cmd/openim-rpc/openim-rpc-user/deploy.Dockerfile b/cmd/openim-rpc/openim-rpc-user/deploy.Dockerfile
index 8ab7df1e7..f9663c9ba 100644
--- a/cmd/openim-rpc/openim-rpc-user/deploy.Dockerfile
+++ b/cmd/openim-rpc/openim-rpc-user/deploy.Dockerfile
@@ -14,7 +14,7 @@
FROM ubuntu
-WORKDIR /Open-IM-Server/bin
+WORKDIR /openim/openim-server/bin
RUN apt-get update && apt-get install apt-transport-https && apt-get install procps\
&&apt-get install net-tools
@@ -27,6 +27,6 @@ RUN apt-get -qq update \
&& apt-get -qq install -y --no-install-recommends ca-certificates curl
COPY ./openim-rpc-user ./
-VOLUME ["/Open-IM-Server/logs","/Open-IM-Server/config"]
+VOLUME ["/openim/openim-server/logs","/openim/openim-server/config"]
CMD ["./openim-rpc-user", "--port", "10110"]
diff --git a/docker-compose.yaml b/docker-compose.yaml
index c28c8bc96..74eafd66c 100644
--- a/docker-compose.yaml
+++ b/docker-compose.yaml
@@ -100,14 +100,12 @@ services:
openim_server:
- image: ghcr.io/openimsdk/openim-server:main
+ image: ghcr.io/openim-sigs/openim-server:v1.0.0-debug.11 #ghcr.io/openimsdk/openim-server:main
container_name: openim-server
volumes:
- - ./logs:/Open-IM-Server/logs
- - ./config/config.yaml:/Open-IM-Server/config/config.yaml
- - ./config/notification.yaml:/Open-IM-Server/config/notification.yaml
- - ${DATA_DIR}/db/sdk:/Open-IM-Server/db/sdk
- - ./scripts:/Open-IM-Server/scripts
+ - ./logs:/openim/openim-server/logs
+ - ./config:/openim/openim-server/config
+ - ./scripts:/openim/openim-server/scripts
restart: always
depends_on:
- zookeeper
@@ -123,9 +121,13 @@ services:
max-size: "1g"
max-file: "2"
- openim_chat:
- image: ghcr.io/openimsdk/openim-chat:main
- container_name: openim_chat
+ openim-chat:
+ image: ghcr.io/openim-sigs/openim-chat:v1.0.0-debug.11 # ghcr.io/openimsdk/openim-chat:main
+ container_name: openim-chat
+ volumes:
+ - ./_output/openim/openim-chat/logs:/openim/openim-chat/logs
+ - ./_output/openim/openim-chat/config:/openim/openim-chat/config
+ - ./_output/openim/openim-chat/scripts:/openim/openim-chat/scripts
restart: always
depends_on:
- mysql
diff --git a/init_docker.sh b/init_docker.sh
deleted file mode 100755
index b06eda469..000000000
--- a/init_docker.sh
+++ /dev/null
@@ -1,44 +0,0 @@
-#!/usr/bin/env bash
-
-mark=''
-for ((ratio=0;${ratio}<=100;ratio+=5))
-do
- sleep 0.2
- printf "progress:[%-40s]%d%%\r" "${mark}" "${ratio}"
- mark="##${mark}"
-done
-echo
-
-set -e
-
-# Change directory to the 'scripts' folder
-cd scripts
-
-# Grant execute permissions to all shell scripts in the 'scripts' folder
-chmod +x *.sh
-
-# Run the 'env_check.sh' script for environment checks
-./env_check.sh
-
-# Move back to the parent directory
-cd ..
-
-# Check if Docker is installed
-if ! command -v docker >/dev/null 2>&1; then
- echo "Error: Docker is not installed. Please install Docker before running this script."
- exit 1
-fi
-
-# Start Docker services using docker-compose
-if command -v docker-compose &> /dev/null
-then
- docker-compose up -d
-else
- docker compose up -d
-fi
-
-# Move back to the 'scripts' folder
-cd scripts
-
-# Run the 'docker_check_service.sh' script for Docker service checks
-./docker_check_service.sh
diff --git a/install.sh b/install.sh
index f9b9b7ec4..59ac75a06 100755
--- a/install.sh
+++ b/install.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
# Copyright © 2023 OpenIM. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -20,7 +20,7 @@ set -e
set -o pipefail
-############### OpenIM Github ###############
+############################## OpenIM Github ##############################
# ... rest of the script ...
# TODO
@@ -78,7 +78,7 @@ GITHUB_TOKEN=
# Default data directory. If you want to specify a different directory, uncomment and replace "./".
# DATA_DIR=./
-############### OpenIM Functions ###############
+############################## OpenIM Functions ##############################
# Install horizon of the script
#
# Pre-requisites:
@@ -290,7 +290,7 @@ function install_openim() {
success "OpenIM installation completed successfully. Happy chatting!"
}
-############### OpenIM Help ###############
+############################## OpenIM Help ##############################
# Function to display help message
function cmd_help() {
@@ -406,7 +406,7 @@ function parseinput() {
done
}
-############### OpenIM LOGO ###############
+############################## OpenIM LOG ##############################
# Set text color to cyan for header and URL
print_with_delay() {
text="$1"
diff --git a/install_guide.sh b/install_guide.sh
index 1c5f06fb9..a32bd24f4 100755
--- a/install_guide.sh
+++ b/install_guide.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
echo "Welcome to the Open-IM-Server installation scripts."
echo "Please select an deploy option:"
diff --git a/pkg/common/config/version b/pkg/common/config/version
index 1c5ae5820..3a285c2be 100644
--- a/pkg/common/config/version
+++ b/pkg/common/config/version
@@ -1 +1 @@
-v3.0.0
\ No newline at end of file
+v3.1.0
\ No newline at end of file
diff --git a/scripts/advertise.sh b/scripts/advertise.sh
index c1cd63f56..9d47b5ac7 100755
--- a/scripts/advertise.sh
+++ b/scripts/advertise.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
set -e
set -o pipefail
diff --git a/scripts/build.cmd b/scripts/build.cmd
index f3c086a32..d153e6d9e 100644
--- a/scripts/build.cmd
+++ b/scripts/build.cmd
@@ -1,12 +1,13 @@
+@echo off
set output_dir=%~dp0..\_output\bin\platforms\windows
-go build -o %output_dir%\api.exe ../cmd/openim-api/main.go
-go build -o %output_dir%\auth.exe ../cmd/openim-rpc/openim-rpc-auth/main.go
-go build -o %output_dir%\conversation.exe ../cmd/openim-rpc/openim-rpc-conversation/main.go
-go build -o %output_dir%\friend.exe ../cmd/openim-rpc/openim-rpc-friend/main.go
-go build -o %output_dir%\group.exe ../cmd/openim-rpc/openim-rpc-group/main.go
-go build -o %output_dir%\msg.exe ../cmd/openim-rpc/openim-rpc-msg/main.go
-go build -o %output_dir%\third.exe ../cmd/openim-rpc/openim-rpc-third/main.go
-go build -o %output_dir%\user.exe ../cmd/openim-rpc/openim-rpc-user/main.go
-go build -o %output_dir%\push.exe ../cmd/openim-push/main.go
-go build -o %output_dir%\msgtransfer.exe ../cmd/openim-msgtransfer/main.go
-go build -o %output_dir%\msggateway.exe ../cmd/openim-msggateway/main.go
\ No newline at end of file
+
+set "rpc_apps=auth conversation friend group msg third user"
+set "other_apps=api push msgtransfer msggateway"
+
+for %%a in (%rpc_apps%) do (
+ go build -o %output_dir%\%%a.exe ../cmd/openim-rpc/openim-rpc-%%a/main.go
+)
+
+for %%a in (%other_apps%) do (
+ go build -o %output_dir%\%%a.exe ../cmd/openim-%%a/main.go
+)
diff --git a/scripts/common.sh b/scripts/common.sh
index 8ae2abfa5..97d5968ba 100755
--- a/scripts/common.sh
+++ b/scripts/common.sh
@@ -104,9 +104,7 @@ openim::build::get_docker_wrapped_binaries() {
"openim-rpc-msg,${OPENIM_BASE_IMAGE_REGISTRY}/debian-base-${arch}:${debian_base_version}"
"openim-rpc-third,${OPENIM_BASE_IMAGE_REGISTRY}/debian-base-${arch}:${debian_base_version}"
"openim-rpc-user,${OPENIM_BASE_IMAGE_REGISTRY}/debian-base-${arch}:${debian_base_version}"
-
)
-
echo "${targets[@]}"
}
diff --git a/scripts/docker_start_all.sh b/scripts/docker_start_all.sh
index 421900ef4..1033b5306 100755
--- a/scripts/docker_start_all.sh
+++ b/scripts/docker_start_all.sh
@@ -22,11 +22,11 @@ OPENIM_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
#fixme Put the shell scripts name here
need_to_start_server_shell=(
- start_rpc_service.sh
- msg_gateway_start.sh
- push_start.sh
- msg_transfer_start.sh
- start_cron.sh
+ ${SCRIPTS_ROOT}/start_rpc_service.sh
+ ${SCRIPTS_ROOT}/msg_gateway_start.sh
+ ${SCRIPTS_ROOT}/push_start.sh
+ ${SCRIPTS_ROOT}/msg_transfer_start.sh
+ ${SCRIPTS_ROOT}/start_cron.sh
)
#fixme The 10 second delay to start the project is for the docker-compose one-click to start openIM when the infrastructure dependencies are not started
@@ -41,8 +41,7 @@ echo "==========================================================">>$OPENIM_ROOT/
echo "==========================================================">>$OPENIM_ROOT/logs/openIM.log 2>&1 &
echo "==========================================================">>$OPENIM_ROOT/logs/openIM.log 2>&1 &
for i in ${need_to_start_server_shell[*]}; do
- chmod +x $i
- ./$i
+ $i
done
sleep 15
diff --git a/scripts/enterprise/function.sh b/scripts/enterprise/function.sh
index e2dc96a25..8b5cb0b2b 100755
--- a/scripts/enterprise/function.sh
+++ b/scripts/enterprise/function.sh
@@ -16,12 +16,12 @@
#input:[10023,2323,3434]
#output:10023 2323 3434
list_to_string(){
-ports_list=$*
-sub_s1=`echo $ports_list | sed 's/ //g'`
-sub_s2=${sub_s1//,/ }
-sub_s3=${sub_s2#*[}
-sub_s4=${sub_s3%]*}
-ports_array=$sub_s4
+ ports_list=$*
+ sub_s1=`echo $ports_list | sed 's/ //g'`
+ sub_s2=${sub_s1//,/ }
+ sub_s3=${sub_s2#*[}
+ sub_s4=${sub_s3%]*}
+ ports_array=$sub_s4
}
remove_space(){
value=$*
diff --git a/scripts/enterprise/path_info.cfg b/scripts/enterprise/path_info.cfg
index 6ce712593..3b18bbf90 100644
--- a/scripts/enterprise/path_info.cfg
+++ b/scripts/enterprise/path_info.cfg
@@ -1,11 +1,8 @@
#Don't put the space between "="
-
-demo_server_name="openim_chat_api"
+demo_server_name="chat-api"
demo_server_binary_root="$BIN_DIR/"
-
-
#Global configuration file default dir
config_path="../.docker-compose_cfg/config.yaml"
@@ -15,15 +12,14 @@ service_source_root=(
../cmd/api/chat/
../cmd/api/admin/
#rpc service file
- ../cmd/openim-rpc/admin/
- ../cmd/openim-rpc/chat/
+ ../cmd/rpc/admin/
+ ../cmd/rpc/chat/
)
+
#service filename
service_names=(
- #api service filename
- openim_chat_api
- openim_admin_api
- #rpc service filename
- openim_admin
- openim_chat
+ chat-api
+ admin-api
+ admin-rpc
+ chat-rpc
)
diff --git a/scripts/init_pwd.sh b/scripts/init_pwd.sh
index f33c9b3dc..1e5fa3b34 100755
--- a/scripts/init_pwd.sh
+++ b/scripts/init_pwd.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
# Copyright © 2023 OpenIM. All rights reserved.
#
diff --git a/scripts/lib/golang.sh b/scripts/lib/golang.sh
index b442e1160..0d35e9198 100755
--- a/scripts/lib/golang.sh
+++ b/scripts/lib/golang.sh
@@ -35,7 +35,6 @@ openim::golang::server_targets() {
local targets=(
openim-api
openim-cmdutils
- openim-cmdutils
openim-crontask
openim-msggateway
openim-msgtransfer
diff --git a/scripts/make-rules/golang.mk b/scripts/make-rules/golang.mk
index dedcdc9fc..f4e278a8c 100644
--- a/scripts/make-rules/golang.mk
+++ b/scripts/make-rules/golang.mk
@@ -120,7 +120,7 @@ go.build.%:
@echo "===========> Building binary $(COMMAND) $(VERSION) for $(OS)_$(ARCH)"
@mkdir -p $(BIN_DIR)/platforms/$(OS)/$(ARCH)
@if [ "$(COMMAND)" == "openim-sdk-core" ]; then \
- echo "===========> DEBUG: Compilation is not yet supported $(COMMAND)"; \
+ echo "===========> DEBUG: OpenIM-SDK-Core It is no longer supported for openim-server $(COMMAND)"; \
elif [ "$(COMMAND)" == "openim-rpc" ]; then \
for d in $(wildcard $(ROOT_DIR)/cmd/openim-rpc/*); do \
cd $${d} && CGO_ENABLED=0 GOOS=$(OS) GOARCH=$(ARCH) $(GO) build $(GO_BUILD_FLAGS) -o \
diff --git a/scripts/msg_transfer_start.sh b/scripts/msg_transfer_start.sh
index b1e17769d..7221ffa49 100755
--- a/scripts/msg_transfer_start.sh
+++ b/scripts/msg_transfer_start.sh
@@ -38,10 +38,10 @@ prome_ports=($ports_array)
#Check if the service exists
#If it is exists,kill this process
-check=`ps aux | grep -w ./${openim_msgtransfer} | grep -v grep| wc -l`
+check=`ps | grep -w ./${openim_msgtransfer} | grep -v grep| wc -l`
if [ $check -ge 1 ]
then
-oldPid=`ps aux | grep -w ./${openim_msgtransfer} | grep -v grep|awk '{print $2}'`
+oldPid=`ps | grep -w ./${openim_msgtransfer} | grep -v grep|awk '{print $2}'`
kill -9 $oldPid
fi
#Waiting port recycling
@@ -59,10 +59,10 @@ for ((i = 0; i < ${msg_transfer_service_num}; i++)); do
done
#Check launched service process
-check=`ps aux | grep -w ./${openim_msgtransfer} | grep -v grep| wc -l`
+check=`ps | grep -w ./${openim_msgtransfer} | grep -v grep| wc -l`
if [ $check -ge 1 ]
then
-newPid=`ps aux | grep -w ./${openim_msgtransfer} | grep -v grep|awk '{print $2}'`
+newPid=`ps | grep -w ./${openim_msgtransfer} | grep -v grep|awk '{print $2}'`
allPorts=""
echo -e ${SKY_BLUE_PREFIX}"SERVICE START SUCCESS "${COLOR_SUFFIX}
echo -e ${SKY_BLUE_PREFIX}"SERVICE_NAME: "${COLOR_SUFFIX}${BACKGROUND_GREEN}${openim_msgtransfer}${COLOR_SUFFIX}
diff --git a/scripts/push_start.sh b/scripts/push_start.sh
index 74b9aedc9..6b26c3022 100755
--- a/scripts/push_start.sh
+++ b/scripts/push_start.sh
@@ -45,9 +45,9 @@ prome_ports=($ports_array)
#Check if the service exists
#If it is exists,kill this process
-check=$(ps aux | grep -w ./${push_name} | grep -v grep | wc -l)
+check=$(ps | grep -w ./${push_name} | grep -v grep | wc -l)
if [ $check -ge 1 ]; then
- oldPid=$(ps aux | grep -w ./${push_name} | grep -v grep | awk '{print $2}')
+ oldPid=$(ps | grep -w ./${push_name} | grep -v grep | awk '{print $2}')
kill -9 $oldPid
fi
#Waiting port recycling
@@ -61,9 +61,9 @@ done
sleep 3
#Check launched service process
-check=$(ps aux | grep -w ./${push_name} | grep -v grep | wc -l)
+check=$(ps | grep -w ./${push_name} | grep -v grep | wc -l)
if [ $check -ge 1 ]; then
- newPid=$(ps aux | grep -w ./${push_name} | grep -v grep | awk '{print $2}')
+ newPid=$(ps | grep -w ./${push_name} | grep -v grep | awk '{print $2}')
ports=$(netstat -netulp | grep -w ${newPid} | awk '{print $4}' | awk -F '[:]' '{print $NF}')
allPorts=""
diff --git a/scripts/start_all.sh b/scripts/start_all.sh
index 6470ae910..87363c547 100755
--- a/scripts/start_all.sh
+++ b/scripts/start_all.sh
@@ -27,15 +27,15 @@ source $SCRIPTS_ROOT/function.sh
cd $SCRIPTS_ROOT
+echo -e "${YELLOW_PREFIX}=======>SCRIPTS_ROOT=$SCRIPTS_ROOT${COLOR_SUFFIX}"
+echo -e "${YELLOW_PREFIX}=======>OPENIM_ROOT=$OPENIM_ROOT${COLOR_SUFFIX}"
+echo -e "${YELLOW_PREFIX}=======>pwd=$PWD${COLOR_SUFFIX}"
+
if [ ! -d "${OPENIM_ROOT}/_output/bin/platforms" ]; then
# exec build_all_service.sh
"${SCRIPTS_ROOT}/build_all_service.sh"
fi
-echo -e "${YELLOW_PREFIX}=======>SCRIPTS_ROOT=$SCRIPTS_ROOT${COLOR_SUFFIX}"
-echo -e "${YELLOW_PREFIX}=======>OPENIM_ROOT=$OPENIM_ROOT${COLOR_SUFFIX}"
-echo -e "${YELLOW_PREFIX}=======>pwd=$PWD${COLOR_SUFFIX}"
-
bin_dir="$OPENIM_ROOT/_output/bin"
logs_dir="$OPENIM_ROOT/logs"
sdk_db_dir="$OPENIM_ROOT/sdk/db/"
diff --git a/scripts/start_cron.sh b/scripts/start_cron.sh
index 79b5b9c31..2f27801be 100755
--- a/scripts/start_cron.sh
+++ b/scripts/start_cron.sh
@@ -34,10 +34,10 @@ sdk_db_dir="$OPENIM_ROOT/sdk/db/"
#Check if the service exists
#If it is exists,kill this process
-check=`ps aux | grep -w ./${cron_task_name} | grep -v grep| wc -l`
+check=`ps | grep -w ./${cron_task_name} | grep -v grep| wc -l`
if [ $check -ge 1 ]
then
-oldPid=`ps aux | grep -w ./${cron_task_name} | grep -v grep|awk '{print $2}'`
+oldPid=`ps | grep -w ./${cron_task_name} | grep -v grep|awk '{print $2}'`
kill -9 $oldPid
fi
#Waiting port recycling
@@ -50,10 +50,10 @@ nohup ./${cron_task_name} >>$OPENIM_ROOT/logs/openIM.log 2>&1 &
#done
#Check launched service process
-check=`ps aux | grep -w ./${cron_task_name} | grep -v grep| wc -l`
+check=`ps | grep -w ./${cron_task_name} | grep -v grep| wc -l`
if [ $check -ge 1 ]
then
-newPid=`ps aux | grep -w ./${cron_task_name} | grep -v grep|awk '{print $2}'`
+newPid=`ps | grep -w ./${cron_task_name} | grep -v grep|awk '{print $2}'`
allPorts=""
echo -e ${SKY_BLUE_PREFIX}"SERVICE START SUCCESS "${COLOR_SUFFIX}
echo -e ${SKY_BLUE_PREFIX}"SERVICE_NAME: "${COLOR_SUFFIX}${BACKGROUND_GREEN}${cron_task_name}${COLOR_SUFFIX}
diff --git a/scripts/start_rpc_service.sh b/scripts/start_rpc_service.sh
index f1624c34e..f42f536c2 100755
--- a/scripts/start_rpc_service.sh
+++ b/scripts/start_rpc_service.sh
@@ -30,7 +30,6 @@ echo -e "${BACKGROUND_GREEN}${CYAN_PREFIX}=======>pwd=$PWD${COLOR_SUFFIX}"
bin_dir="$BIN_DIR"
logs_dir="$OPENIM_ROOT/logs"
-sdk_db_dir="$OPENIM_ROOT/sdk/db/"
#service filename
service_filename=(
@@ -75,7 +74,7 @@ service_prometheus_port_name=(
for ((i = 0; i < ${#service_filename[*]}; i++)); do
#Check whether the service exists
- service_name="ps -aux |grep -w ${service_filename[$i]} |grep -v grep"
+ service_name="ps |grep -w ${service_filename[$i]} |grep -v grep"
count="${service_name}| wc -l"
if [ $(eval ${count}) -gt 0 ]; then
diff --git a/scripts/stop_all.sh b/scripts/stop_all.sh
index 8bd5aaf34..4fd327407 100755
--- a/scripts/stop_all.sh
+++ b/scripts/stop_all.sh
@@ -29,7 +29,7 @@ cd "$SCRIPTS_ROOT"
for i in ${service_names[*]}; do
#Check whether the service exists
- name="ps -aux |grep -w $i |grep -v grep"
+ name="ps |grep -w $i |grep -v grep"
count="${name}| wc -l"
if [ $(eval ${count}) -gt 0 ]; then
pid="${name}| awk '{print \$2}'"
diff --git a/scripts/style_info.sh b/scripts/style_info.sh
index b56eceeff..ff3a6330b 100755
--- a/scripts/style_info.sh
+++ b/scripts/style_info.sh
@@ -13,50 +13,53 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+function style-info() {
+ COLOR_SUFFIX="\033[0m" # End all colors and special effects
-COLOR_SUFFIX="\033[0m" # End all colors and special effects
-
-BLACK_PREFIX="\033[30m" # Black prefix
-RED_PREFIX="\033[31m" # Red prefix
-GREEN_PREFIX="\033[32m" # Green prefix
-YELLOW_PREFIX="\033[33m" # Yellow prefix
-BLUE_PREFIX="\033[34m" # Blue prefix
-PURPLE_PREFIX="\033[35m" # Purple prefix
-SKY_BLUE_PREFIX="\033[36m" # Sky blue prefix
-WHITE_PREFIX="\033[37m" # White prefix
-BOLD_PREFIX="\033[1m" # Bold prefix
-UNDERLINE_PREFIX="\033[4m" # Underline prefix
-ITALIC_PREFIX="\033[3m" # Italic prefix
-
-CYAN_PREFIX="033[0;36m" # Cyan prefix
-
-BACKGROUND_BLACK="\033[40m" # Black background
-BACKGROUND_RED="\033[41m" # Red background
-BACKGROUND_GREEN="\033[42m" # Green background
-BACKGROUND_YELLOW="\033[43m" # Yellow background
-BACKGROUND_BLUE="\033[44m" # Blue background
-BACKGROUND_PURPLE="\033[45m" # Purple background
-BACKGROUND_SKY_BLUE="\033[46m" # Sky blue background
-BACKGROUND_WHITE="\033[47m" # White background
-
-BLINK="\033[5m" # Blinking effect
-INVERT="\033[7m" # Invert color
-HIDE="\033[8m" # Hide text
-
-GRAY_PREFIX="\033[90m" # Gray prefix
-LIGHT_RED_PREFIX="\033[91m" # Light red prefix
-LIGHT_GREEN_PREFIX="\033[92m" # Light green prefix
-LIGHT_YELLOW_PREFIX="\033[93m" # Light yellow prefix
-LIGHT_BLUE_PREFIX="\033[94m" # Light blue prefix
-LIGHT_PURPLE_PREFIX="\033[95m" # Light purple prefix
-LIGHT_SKY_BLUE_PREFIX="\033[96m" # Light sky blue prefix
-LIGHT_WHITE_PREFIX="\033[97m" # Light white prefix
-
-BACKGROUND_GRAY="\033[100m" # Gray background
-BACKGROUND_LIGHT_RED="\033[101m" # Light red background
-BACKGROUND_LIGHT_GREEN="\033[102m" # Light green background
-BACKGROUND_LIGHT_YELLOW="\033[103m" # Light yellow background
-BACKGROUND_LIGHT_BLUE="\033[104m" # Light blue background
-BACKGROUND_LIGHT_PURPLE="\033[105m" # Light purple background
-BACKGROUND_LIGHT_SKY_BLUE="\033[106m" # Light sky blue background
-BACKGROUND_LIGHT_WHITE="\033[107m" # Light white background
+ BLACK_PREFIX="\033[30m" # Black prefix
+ RED_PREFIX="\033[31m" # Red prefix
+ GREEN_PREFIX="\033[32m" # Green prefix
+ YELLOW_PREFIX="\033[33m" # Yellow prefix
+ BLUE_PREFIX="\033[34m" # Blue prefix
+ PURPLE_PREFIX="\033[35m" # Purple prefix
+ SKY_BLUE_PREFIX="\033[36m" # Sky blue prefix
+ WHITE_PREFIX="\033[37m" # White prefix
+ BOLD_PREFIX="\033[1m" # Bold prefix
+ UNDERLINE_PREFIX="\033[4m" # Underline prefix
+ ITALIC_PREFIX="\033[3m" # Italic prefix
+
+ CYAN_PREFIX="033[0;36m" # Cyan prefix
+
+ BACKGROUND_BLACK="\033[40m" # Black background
+ BACKGROUND_RED="\033[41m" # Red background
+ BACKGROUND_GREEN="\033[42m" # Green background
+ BACKGROUND_YELLOW="\033[43m" # Yellow background
+ BACKGROUND_BLUE="\033[44m" # Blue background
+ BACKGROUND_PURPLE="\033[45m" # Purple background
+ BACKGROUND_SKY_BLUE="\033[46m" # Sky blue background
+ BACKGROUND_WHITE="\033[47m" # White background
+
+ BLINK="\033[5m" # Blinking effect
+ INVERT="\033[7m" # Invert color
+ HIDE="\033[8m" # Hide text
+
+ GRAY_PREFIX="\033[90m" # Gray prefix
+ LIGHT_RED_PREFIX="\033[91m" # Light red prefix
+ LIGHT_GREEN_PREFIX="\033[92m" # Light green prefix
+ LIGHT_YELLOW_PREFIX="\033[93m" # Light yellow prefix
+ LIGHT_BLUE_PREFIX="\033[94m" # Light blue prefix
+ LIGHT_PURPLE_PREFIX="\033[95m" # Light purple prefix
+ LIGHT_SKY_BLUE_PREFIX="\033[96m" # Light sky blue prefix
+ LIGHT_WHITE_PREFIX="\033[97m" # Light white prefix
+
+ BACKGROUND_GRAY="\033[100m" # Gray background
+ BACKGROUND_LIGHT_RED="\033[101m" # Light red background
+ BACKGROUND_LIGHT_GREEN="\033[102m" # Light green background
+ BACKGROUND_LIGHT_YELLOW="\033[103m" # Light yellow background
+ BACKGROUND_LIGHT_BLUE="\033[104m" # Light blue background
+ BACKGROUND_LIGHT_PURPLE="\033[105m" # Light purple background
+ BACKGROUND_LIGHT_SKY_BLUE="\033[106m" # Light sky blue background
+ BACKGROUND_LIGHT_WHITE="\033[107m" # Light white background
+}
+
+style-info
\ No newline at end of file
diff --git a/test/common.sh b/test/common.sh
index 904608894..e583fe8b3 100644
--- a/test/common.sh
+++ b/test/common.sh
@@ -12,4 +12,3 @@
# 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.
-
From a7b6923b745a8223fc7810b3b593b5dcd8a8b534 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Fri, 4 Aug 2023 21:21:30 +0800
Subject: [PATCH 18/59] feat(deps): bump the gomod-deps group with 1 update
(#771)
Bumps the gomod-deps group with 1 update: [github.com/aliyun/aliyun-oss-go-sdk](https://github.com/aliyun/aliyun-oss-go-sdk).
- [Release notes](https://github.com/aliyun/aliyun-oss-go-sdk/releases)
- [Changelog](https://github.com/aliyun/aliyun-oss-go-sdk/blob/master/CHANGELOG.md)
- [Commits](https://github.com/aliyun/aliyun-oss-go-sdk/compare/v2.2.7...v2.2.8)
---
updated-dependencies:
- dependency-name: github.com/aliyun/aliyun-oss-go-sdk
dependency-type: direct:production
update-type: version-update:semver-patch
dependency-group: gomod-deps
...
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
go.mod | 2 +-
go.sum | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/go.mod b/go.mod
index 686cadce4..79fb13e5b 100644
--- a/go.mod
+++ b/go.mod
@@ -39,7 +39,7 @@ require github.com/google/uuid v1.3.0
require (
github.com/OpenIMSDK/protocol v0.0.4
github.com/OpenIMSDK/tools v0.0.13
- github.com/aliyun/aliyun-oss-go-sdk v2.2.7+incompatible
+ github.com/aliyun/aliyun-oss-go-sdk v2.2.8+incompatible
github.com/go-redis/redis v6.15.9+incompatible
github.com/go-sql-driver/mysql v1.7.1
github.com/redis/go-redis/v9 v9.0.5
diff --git a/go.sum b/go.sum
index 9a820bfd2..02ba48c79 100644
--- a/go.sum
+++ b/go.sum
@@ -26,8 +26,8 @@ github.com/Shopify/sarama v1.29.0 h1:ARid8o8oieau9XrHI55f/L3EoRAhm9px6sonbD7yuUE
github.com/Shopify/sarama v1.29.0/go.mod h1:2QpgD79wpdAESqNQMxNc0KYMkycd4slxGdV3TWSVqrU=
github.com/Shopify/toxiproxy v2.1.4+incompatible h1:TKdv8HiTLgE5wdJuEML90aBgNWsokNbMijUGhmcoBJc=
github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI=
-github.com/aliyun/aliyun-oss-go-sdk v2.2.7+incompatible h1:KpbJFXwhVeuxNtBJ74MCGbIoaBok2uZvkD7QXp2+Wis=
-github.com/aliyun/aliyun-oss-go-sdk v2.2.7+incompatible/go.mod h1:T/Aws4fEfogEE9v+HPhhw+CntffsBHJ8nXQCwKr0/g8=
+github.com/aliyun/aliyun-oss-go-sdk v2.2.8+incompatible h1:6JF1bjhT0WN2srEmijfOFtVWwV91KZ6dJY1/JbdtGrI=
+github.com/aliyun/aliyun-oss-go-sdk v2.2.8+incompatible/go.mod h1:T/Aws4fEfogEE9v+HPhhw+CntffsBHJ8nXQCwKr0/g8=
github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY=
github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8=
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
From ef32a6bce9393e64765d7bea57b61c72e83e76ab Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Fri, 4 Aug 2023 21:21:37 +0800
Subject: [PATCH 19/59] chore(deps): bump the github-actions group with 9
updates (#772)
Bumps the github-actions group with 9 updates:
| Package | Update |
| --- | --- |
| [actions/checkout](https://github.com/actions/checkout) | 2 to 3 |
| [peter-evans/create-or-update-comment](https://github.com/peter-evans/create-or-update-comment) | 1 to 3 |
| [actions/github-script](https://github.com/actions/github-script) | 5 to 6 |
| [docker/setup-buildx-action](https://github.com/docker/setup-buildx-action) | 1 to 2 |
| [magnetikonline/action-golang-cache](https://github.com/magnetikonline/action-golang-cache) | 3 to 4 |
| [actions/setup-go](https://github.com/actions/setup-go) | 2 to 4 |
| [lycheeverse/lychee-action](https://github.com/lycheeverse/lychee-action) | 1.7.0 to 1.8.0 |
| [actions/setup-node](https://github.com/actions/setup-node) | 2 to 3 |
| [actions/stale](https://github.com/actions/stale) | 5 to 8 |
Updates `actions/checkout` from 2 to 3
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v2...v3)
Updates `peter-evans/create-or-update-comment` from 1 to 3
- [Release notes](https://github.com/peter-evans/create-or-update-comment/releases)
- [Commits](https://github.com/peter-evans/create-or-update-comment/compare/v1...v3)
Updates `actions/github-script` from 5 to 6
- [Release notes](https://github.com/actions/github-script/releases)
- [Commits](https://github.com/actions/github-script/compare/v5...v6)
Updates `docker/setup-buildx-action` from 1 to 2
- [Release notes](https://github.com/docker/setup-buildx-action/releases)
- [Commits](https://github.com/docker/setup-buildx-action/compare/v1...v2)
Updates `magnetikonline/action-golang-cache` from 3 to 4
- [Release notes](https://github.com/magnetikonline/action-golang-cache/releases)
- [Commits](https://github.com/magnetikonline/action-golang-cache/compare/v3...v4)
Updates `actions/setup-go` from 2 to 4
- [Release notes](https://github.com/actions/setup-go/releases)
- [Commits](https://github.com/actions/setup-go/compare/v2...v4)
Updates `lycheeverse/lychee-action` from 1.7.0 to 1.8.0
- [Release notes](https://github.com/lycheeverse/lychee-action/releases)
- [Commits](https://github.com/lycheeverse/lychee-action/compare/v1.7.0...v1.8.0)
Updates `actions/setup-node` from 2 to 3
- [Release notes](https://github.com/actions/setup-node/releases)
- [Commits](https://github.com/actions/setup-node/compare/v2...v3)
Updates `actions/stale` from 5 to 8
- [Release notes](https://github.com/actions/stale/releases)
- [Changelog](https://github.com/actions/stale/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/stale/compare/v5...v8)
---
updated-dependencies:
- dependency-name: actions/checkout
dependency-type: direct:production
update-type: version-update:semver-major
dependency-group: github-actions
- dependency-name: peter-evans/create-or-update-comment
dependency-type: direct:production
update-type: version-update:semver-major
dependency-group: github-actions
- dependency-name: actions/github-script
dependency-type: direct:production
update-type: version-update:semver-major
dependency-group: github-actions
- dependency-name: docker/setup-buildx-action
dependency-type: direct:production
update-type: version-update:semver-major
dependency-group: github-actions
- dependency-name: magnetikonline/action-golang-cache
dependency-type: direct:production
update-type: version-update:semver-major
dependency-group: github-actions
- dependency-name: actions/setup-go
dependency-type: direct:production
update-type: version-update:semver-major
dependency-group: github-actions
- dependency-name: lycheeverse/lychee-action
dependency-type: direct:production
update-type: version-update:semver-minor
dependency-group: github-actions
- dependency-name: actions/setup-node
dependency-type: direct:production
update-type: version-update:semver-major
dependency-group: github-actions
- dependency-name: actions/stale
dependency-type: direct:production
update-type: version-update:semver-major
dependency-group: github-actions
...
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
.github/workflows/auto-invite.yml | 2 +-
.github/workflows/bot-auto-cherry-pick.yml | 2 +-
.github/workflows/bot-cherry-pick.yml | 2 +-
.github/workflows/check-coverage.yml | 2 +-
.github/workflows/link-pr.yml | 2 +-
.github/workflows/milestone.yml | 2 +-
.github/workflows/opencommit.yml | 2 +-
.github/workflows/openimci.yml | 8 ++++----
.github/workflows/pull-request.yml | 2 +-
.github/workflows/release.yml | 2 +-
.github/workflows/scripts-test.yml | 2 +-
.github/workflows/stale.yml | 2 +-
12 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/.github/workflows/auto-invite.yml b/.github/workflows/auto-invite.yml
index 2bc644bfb..0fd9a4eab 100644
--- a/.github/workflows/auto-invite.yml
+++ b/.github/workflows/auto-invite.yml
@@ -27,7 +27,7 @@ jobs:
steps:
- name: Invite user to join our group
- uses: peter-evans/create-or-update-comment@v1
+ uses: peter-evans/create-or-update-comment@v3
with:
token: ${{ secrets.BOT_GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
diff --git a/.github/workflows/bot-auto-cherry-pick.yml b/.github/workflows/bot-auto-cherry-pick.yml
index 0d545813a..6861872e4 100644
--- a/.github/workflows/bot-auto-cherry-pick.yml
+++ b/.github/workflows/bot-auto-cherry-pick.yml
@@ -23,7 +23,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Comment cherry-pick command
- uses: actions/github-script@v5
+ uses: actions/github-script@v6
with:
script: |
const pr = context.payload.pull_request;
diff --git a/.github/workflows/bot-cherry-pick.yml b/.github/workflows/bot-cherry-pick.yml
index 59a4979cf..2e69e0d0a 100644
--- a/.github/workflows/bot-cherry-pick.yml
+++ b/.github/workflows/bot-cherry-pick.yml
@@ -23,7 +23,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout the latest code
- uses: actions/checkout@v2
+ uses: actions/checkout@v3
with:
token: ${{ secrets.BOT_GITHUB_TOKEN }}
fetch-depth: 0 # otherwise, you will fail to push refs to dest repo
diff --git a/.github/workflows/check-coverage.yml b/.github/workflows/check-coverage.yml
index 937af89d6..7080ef7be 100644
--- a/.github/workflows/check-coverage.yml
+++ b/.github/workflows/check-coverage.yml
@@ -44,7 +44,7 @@ jobs:
uses: actions/checkout@v3
- name: Setup Golang with cache
- uses: magnetikonline/action-golang-cache@v3
+ uses: magnetikonline/action-golang-cache@v4
with:
go-version: ${{ env.GO_VERSION }}
diff --git a/.github/workflows/link-pr.yml b/.github/workflows/link-pr.yml
index 07b9d46a9..356394f94 100644
--- a/.github/workflows/link-pr.yml
+++ b/.github/workflows/link-pr.yml
@@ -27,7 +27,7 @@ jobs:
- name: Link Checker
id: lychee
- uses: lycheeverse/lychee-action@v1.7.0
+ uses: lycheeverse/lychee-action@v1.8.0
with:
# For parameter description, see https://github.com/lycheeverse/lychee#commandline-parameters
# Actions Link address -> https://github.com/lycheeverse/lychee-action
diff --git a/.github/workflows/milestone.yml b/.github/workflows/milestone.yml
index db39943e6..a31eaa150 100644
--- a/.github/workflows/milestone.yml
+++ b/.github/workflows/milestone.yml
@@ -25,7 +25,7 @@ jobs:
statuses: none
steps:
- - uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6
+ - uses: actions/github-script@v6 # v6
with:
script: |
if (!context.payload.pull_request.merged) {
diff --git a/.github/workflows/opencommit.yml b/.github/workflows/opencommit.yml
index 36307c00f..a07b5b8b2 100644
--- a/.github/workflows/opencommit.yml
+++ b/.github/workflows/opencommit.yml
@@ -27,7 +27,7 @@ jobs:
permissions: write-all
steps:
- name: Setup Node.js Environment
- uses: actions/setup-node@v2
+ uses: actions/setup-node@v3
with:
node-version: '16'
- uses: actions/checkout@v3
diff --git a/.github/workflows/openimci.yml b/.github/workflows/openimci.yml
index 0e69089f9..d172eb251 100644
--- a/.github/workflows/openimci.yml
+++ b/.github/workflows/openimci.yml
@@ -53,7 +53,7 @@ jobs:
steps:
- name: Set up Go ${{ matrix.go_version }}
- uses: actions/setup-go@v2
+ uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go_version }}
id: go
@@ -149,7 +149,7 @@ jobs:
continue-on-error: true
- name: Set up Docker Buildx
- uses: docker/setup-buildx-action@v1
+ uses: docker/setup-buildx-action@v2
continue-on-error: true
openim-start:
@@ -163,13 +163,13 @@ jobs:
os: ["ubuntu-latest"]
steps:
- name: Set up Go ${{ matrix.go_version }}
- uses: actions/setup-go@v2
+ uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go_version }}
id: go
- name: Check out code into the Go module directory
- uses: actions/checkout@v2
+ uses: actions/checkout@v3
- name: Run OpenIM make install start
run: |
diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml
index 3405e479e..ac8904450 100644
--- a/.github/workflows/pull-request.yml
+++ b/.github/workflows/pull-request.yml
@@ -47,7 +47,7 @@ jobs:
git checkout -b cicd/patch-${{ github.event.number }}
- uses: actions/setup-node@v3
- name: Setup Go
- uses: actions/setup-go@v2
+ uses: actions/setup-go@v4
- name: Run go modules tidy
run: |
sudo make tidy
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 45ed79df2..fd019c4df 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -60,7 +60,7 @@ jobs:
matrix:
format: [ deb, rpm, apk ]
steps:
- - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3
+ - uses: actions/checkout@v3 # v3
with:
fetch-depth: 0
- uses: arduino/setup-task@e26d8975574116b0097a1161e0fe16ba75d84c1c # v1
diff --git a/.github/workflows/scripts-test.yml b/.github/workflows/scripts-test.yml
index e59e696f8..0f98197e0 100644
--- a/.github/workflows/scripts-test.yml
+++ b/.github/workflows/scripts-test.yml
@@ -38,7 +38,7 @@ jobs:
steps:
- name: Checkout code
- uses: actions/checkout@v2
+ uses: actions/checkout@v3
- name: Start Docker Compose
run: |
diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml
index 7790aa944..ba767f167 100644
--- a/.github/workflows/stale.yml
+++ b/.github/workflows/stale.yml
@@ -32,7 +32,7 @@ jobs:
pull-requests: write
steps:
- - uses: actions/stale@v5
+ - uses: actions/stale@v8
with:
repo-token: ${{ secrets.BOT_GITHUB_TOKEN }}
days-before-stale: 60
From 863c52c7bb360e1b09ff282fbf3596755ced561c Mon Sep 17 00:00:00 2001
From: pluto <2631223275@qq.com>
Date: Fri, 4 Aug 2023 21:35:33 +0800
Subject: [PATCH 20/59] Improve user subscription and unsubscription (#770)
* Improve user subscription and unsubscription
* Modification only does not delete all subscribed documents when unsubscribing
* fix build
* update
* update
* update
* update
* add log
* update
* update
* update
* delete simple log
---
internal/rpc/user/user.go | 23 ++++--
pkg/common/db/controller/user.go | 40 ++++++----
pkg/common/db/table/unrelation/user.go | 4 +
pkg/common/db/unrelation/user.go | 103 +++++++++++++++++--------
4 files changed, 114 insertions(+), 56 deletions(-)
diff --git a/internal/rpc/user/user.go b/internal/rpc/user/user.go
index 53598db0b..5425a9c13 100644
--- a/internal/rpc/user/user.go
+++ b/internal/rpc/user/user.go
@@ -250,18 +250,27 @@ func (s *userServer) GetAllUserID(ctx context.Context, req *pbuser.GetAllUserIDR
// SubscribeOrCancelUsersStatus Subscribe online or cancel online users.
func (s *userServer) SubscribeOrCancelUsersStatus(ctx context.Context, req *pbuser.SubscribeOrCancelUsersStatusReq) (resp *pbuser.SubscribeOrCancelUsersStatusResp, err error) {
- err = s.UserDatabase.SubscribeOrCancelUsersStatus(ctx, req.UserID, req.UserIDs, req.Genre)
- if err != nil {
- return nil, err
+ if req.Genre == constant.SubscriberUser {
+ err = s.UserDatabase.SubscribeUsersStatus(ctx, req.UserID, req.UserIDs)
+ if err != nil {
+ return nil, err
+ }
+ var status []*pbuser.OnlineStatus
+ status, err = s.UserDatabase.GetUserStatus(ctx, req.UserIDs)
+ if err != nil {
+ return nil, err
+ }
+ return &pbuser.SubscribeOrCancelUsersStatusResp{StatusList: status}, nil
+ } else if req.Genre == constant.Unsubscribe {
+ err = s.UserDatabase.UnsubscribeUsersStatus(ctx, req.UserID, req.UserIDs)
+ if err != nil {
+ return nil, err
+ }
}
- //var status map[string][]string
- //TODO 获取用户在线列表,返回订阅的用户的在线列表
-
return &pbuser.SubscribeOrCancelUsersStatusResp{}, nil
}
func (s *userServer) GetUserStatus(ctx context.Context, req *pbuser.GetUserStatusReq) (resp *pbuser.GetUserStatusResp, err error) {
- //TODO 是否加一个参数校验-判断req.userID的数量,每一个获取加一个限制,一次请求限制500?
onlineStatusList, err := s.UserDatabase.GetUserStatus(ctx, req.UserIDs)
if err != nil {
return nil, err
diff --git a/pkg/common/db/controller/user.go b/pkg/common/db/controller/user.go
index 5b303ebd7..a867899d9 100644
--- a/pkg/common/db/controller/user.go
+++ b/pkg/common/db/controller/user.go
@@ -17,7 +17,6 @@ package controller
import (
"context"
unRelationTb "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/unrelation"
- "github.com/OpenIMSDK/protocol/constant"
"github.com/OpenIMSDK/protocol/user"
"time"
@@ -51,8 +50,10 @@ type UserDatabase interface {
CountTotal(ctx context.Context, before *time.Time) (int64, error)
// CountRangeEverydayTotal Get the user increment in the range
CountRangeEverydayTotal(ctx context.Context, start time.Time, end time.Time) (map[string]int64, error)
- //SubscribeOrCancelUsersStatus Subscribe or unsubscribe a user's presence status
- SubscribeOrCancelUsersStatus(ctx context.Context, userID string, userIDs []string, genre int32) error
+ //SubscribeUsersStatus Subscribe a user's presence status
+ SubscribeUsersStatus(ctx context.Context, userID string, userIDs []string) error
+ // UnsubscribeUsersStatus unsubscribe a user's presence status
+ UnsubscribeUsersStatus(ctx context.Context, userID string, userIDs []string) error
// GetAllSubscribeList Get a list of all subscriptions
GetAllSubscribeList(ctx context.Context, userID string) ([]string, error)
// GetSubscribedList Get all subscribed lists
@@ -176,29 +177,34 @@ func (u *userDatabase) CountRangeEverydayTotal(ctx context.Context, start time.T
return u.userDB.CountRangeEverydayTotal(ctx, start, end)
}
-//SubscribeOrCancelUsersStatus Subscribe or unsubscribe a user's presence status
-func (u *userDatabase) SubscribeOrCancelUsersStatus(ctx context.Context, userID string, userIDs []string, genre int32) error {
- var err error
- if genre == constant.SubscriberUser {
- err = u.mongoDB.AddSubscriptionList(ctx, userID, userIDs)
- } else if genre == constant.Unsubscribe {
- err = u.mongoDB.UnsubscriptionList(ctx, userID, userIDs)
- }
+// SubscribeUsersStatus Subscribe or unsubscribe a user's presence status
+func (u *userDatabase) SubscribeUsersStatus(ctx context.Context, userID string, userIDs []string) error {
+ err := u.mongoDB.AddSubscriptionList(ctx, userID, userIDs)
+ return err
+}
+
+// UnsubscribeUsersStatus unsubscribe a user's presence status
+func (u *userDatabase) UnsubscribeUsersStatus(ctx context.Context, userID string, userIDs []string) error {
+ err := u.mongoDB.UnsubscriptionList(ctx, userID, userIDs)
return err
}
// GetAllSubscribeList Get a list of all subscriptions.
func (u *userDatabase) GetAllSubscribeList(ctx context.Context, userID string) ([]string, error) {
-
- //TODO 获取所有订阅
- return nil, nil
+ list, err := u.mongoDB.GetAllSubscribeList(ctx, userID)
+ if err != nil {
+ return nil, err
+ }
+ return list, nil
}
// GetSubscribedList Get all subscribed lists
func (u *userDatabase) GetSubscribedList(ctx context.Context, userID string) ([]string, error) {
-
- //TODO 获取所有被订阅
- return nil, nil
+ list, err := u.mongoDB.GetSubscribedList(ctx, userID)
+ if err != nil {
+ return nil, err
+ }
+ return list, nil
}
// GetUserStatus get user status
diff --git a/pkg/common/db/table/unrelation/user.go b/pkg/common/db/table/unrelation/user.go
index d264da467..8664df262 100644
--- a/pkg/common/db/table/unrelation/user.go
+++ b/pkg/common/db/table/unrelation/user.go
@@ -39,4 +39,8 @@ type UserModelInterface interface {
UnsubscriptionList(ctx context.Context, userID string, userIDList []string) error
// RemoveSubscribedListFromUser Among the unsubscribed users, delete the user from the subscribed list.
RemoveSubscribedListFromUser(ctx context.Context, userID string, userIDList []string) error
+ // GetAllSubscribeList Get all users subscribed by this user
+ GetAllSubscribeList(ctx context.Context, id string) (userIDList []string, err error)
+ // GetSubscribedList Get the user subscribed by those users
+ GetSubscribedList(ctx context.Context, id string) (userIDList []string, err error)
}
diff --git a/pkg/common/db/unrelation/user.go b/pkg/common/db/unrelation/user.go
index feec8aa21..4f1bbd017 100644
--- a/pkg/common/db/unrelation/user.go
+++ b/pkg/common/db/unrelation/user.go
@@ -17,14 +17,14 @@ package unrelation
import (
"context"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/unrelation"
+ "github.com/OpenIMSDK/tools/errs"
"github.com/OpenIMSDK/tools/utils"
"go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/mongo"
"go.mongodb.org/mongo-driver/mongo/options"
- "log"
)
-// prefixes and suffixes.
+// prefixes and suffixes.
const (
SubscriptionPrefix = "subscription_prefix"
SubscribedPrefix = "subscribed_prefix"
@@ -48,22 +48,35 @@ type UserMongoDriver struct {
// AddSubscriptionList Subscriber's handling of thresholds.
func (u *UserMongoDriver) AddSubscriptionList(ctx context.Context, userID string, userIDList []string) error {
// Check the number of lists in the key.
- filter := bson.M{SubscriptionPrefix + userID: bson.M{"$size": 1}}
- result, err := u.userCollection.Find(context.Background(), filter)
+ pipeline := mongo.Pipeline{
+ {{"$match", bson.D{{"user_id", SubscriptionPrefix + userID}}}},
+ {{"$project", bson.D{{"count", bson.D{{"$size", "$user_id_list"}}}}}},
+ }
+ // perform aggregate operations
+ cursor, err := u.userCollection.Aggregate(ctx, pipeline)
if err != nil {
- return err
+ return errs.Wrap(err)
}
- var newUserIDList []string
- for result.Next(context.Background()) {
- err := result.Decode(&newUserIDList)
+ defer cursor.Close(ctx)
+ var cnt struct {
+ Count int `bson:"count"`
+ }
+ // iterate over aggregated results
+ for cursor.Next(ctx) {
+ err := cursor.Decode(&cnt)
if err != nil {
- log.Fatal(err)
+ return errs.Wrap(err)
}
}
+ var newUserIDList []string
// If the threshold is exceeded, pop out the previous MaximumSubscription - len(userIDList) and insert it.
- if len(newUserIDList)+len(userIDList) > MaximumSubscription {
+ if cnt.Count+len(userIDList) > MaximumSubscription {
+ newUserIDList, err = u.GetAllSubscribeList(ctx, userID)
+ if err != nil {
+ return err
+ }
newUserIDList = newUserIDList[MaximumSubscription-len(userIDList):]
- _, err := u.userCollection.UpdateOne(
+ _, err = u.userCollection.UpdateOne(
ctx,
bson.M{"user_id": SubscriptionPrefix + userID},
bson.M{"$set": bson.M{"user_id_list": newUserIDList}},
@@ -71,16 +84,17 @@ func (u *UserMongoDriver) AddSubscriptionList(ctx context.Context, userID string
if err != nil {
return err
}
- //for i := 1; i <= MaximumSubscription-len(userIDList); i++ {
- // _, err := u.userCollection.UpdateOne(
- // ctx,
- // bson.M{"user_id": SubscriptionPrefix + userID},
- // bson.M{SubscriptionPrefix + userID: bson.M{"$pop": -1}},
- // )
- // if err != nil {
- // return err
- // }
- //}
+ // Another way to subscribe to N before pop,Delete after testing
+ /*for i := 1; i <= MaximumSubscription-len(userIDList); i++ {
+ _, err := u.userCollection.UpdateOne(
+ ctx,
+ bson.M{"user_id": SubscriptionPrefix + userID},
+ bson.M{SubscriptionPrefix + userID: bson.M{"$pop": -1}},
+ )
+ if err != nil {
+ return err
+ }
+ }*/
}
upsert := true
opts := &options.UpdateOptions{
@@ -93,7 +107,7 @@ func (u *UserMongoDriver) AddSubscriptionList(ctx context.Context, userID string
opts,
)
if err != nil {
- return err
+ return errs.Wrap(err)
}
for _, user := range userIDList {
_, err = u.userCollection.UpdateOne(
@@ -117,25 +131,50 @@ func (u *UserMongoDriver) UnsubscriptionList(ctx context.Context, userID string,
bson.M{"$pull": bson.M{"user_id_list": bson.M{"$in": userIDList}}},
)
if err != nil {
- return err
+ return errs.Wrap(err)
}
err = u.RemoveSubscribedListFromUser(ctx, userID, userIDList)
if err != nil {
- return err
+ return errs.Wrap(err)
}
return nil
}
// RemoveSubscribedListFromUser Among the unsubscribed users, delete the user from the subscribed list.
func (u *UserMongoDriver) RemoveSubscribedListFromUser(ctx context.Context, userID string, userIDList []string) error {
- var newUserIDList []string
- for _, value := range userIDList {
- newUserIDList = append(newUserIDList, SubscribedPrefix+value)
+ var err error
+ for _, userIDTemp := range userIDList {
+ _, err = u.userCollection.UpdateOne(
+ ctx,
+ bson.M{"user_id": SubscribedPrefix + userIDTemp},
+ bson.M{"$pull": bson.M{"user_id_list": userID}},
+ )
}
- _, err := u.userCollection.UpdateOne(
+ return errs.Wrap(err)
+}
+
+// GetAllSubscribeList Get all users subscribed by this user
+func (u *UserMongoDriver) GetAllSubscribeList(ctx context.Context, userID string) (userIDList []string, err error) {
+ var user unrelation.UserModel
+ cursor := u.userCollection.FindOne(
ctx,
- bson.M{"user_id": bson.M{"$in": newUserIDList}},
- bson.M{"$pull": bson.M{"user_id_list": userID}},
- )
- return utils.Wrap(err, "")
+ bson.M{"user_id": SubscriptionPrefix + userID})
+ err = cursor.Decode(&user)
+ if err != nil {
+ return nil, errs.Wrap(err)
+ }
+ return user.UserIDList, nil
+}
+
+// GetSubscribedList Get the user subscribed by those users
+func (u *UserMongoDriver) GetSubscribedList(ctx context.Context, userID string) (userIDList []string, err error) {
+ var user unrelation.UserModel
+ cursor := u.userCollection.FindOne(
+ ctx,
+ bson.M{"user_id": SubscribedPrefix + userID})
+ err = cursor.Decode(&user)
+ if err != nil {
+ return nil, errs.Wrap(err)
+ }
+ return user.UserIDList, nil
}
From af00960ad188bad685a72132c17029a6e9320088 Mon Sep 17 00:00:00 2001
From: Xinwei Xiong <3293172751NSS@gmail.com>
Date: Fri, 4 Aug 2023 21:38:30 +0800
Subject: [PATCH 21/59] style: add format and lint (#773)
Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
---
.github/dependabot.yml | 14 +++++++++++++
.github/workflows/auto-tag.yml | 14 +++++++++++++
.github/workflows/create_branch_on_tag.yml | 14 +++++++++++++
.github/workflows/milestone.yml | 14 +++++++++++++
build/docker/openim-api/Dockerfile | 14 +++++++++++++
build/docker/openim-cmdutils/Dockerfile | 14 +++++++++++++
build/docker/openim-crontask/Dockerfile | 14 +++++++++++++
build/docker/openim-msggateway/Dockerfile | 14 +++++++++++++
build/docker/openim-msgtransfer/Dockerfile | 14 +++++++++++++
build/docker/openim-push/Dockerfile | 14 +++++++++++++
build/docker/openim-rpc-auth/Dockerfile | 14 +++++++++++++
.../docker/openim-rpc-conversation/Dockerfile | 14 +++++++++++++
build/docker/openim-rpc-friend/Dockerfile | 14 +++++++++++++
build/docker/openim-rpc-group/Dockerfile | 14 +++++++++++++
build/docker/openim-rpc-msg/Dockerfile | 14 +++++++++++++
build/docker/openim-rpc-third/Dockerfile | 14 +++++++++++++
build/docker/openim-rpc-user/Dockerfile | 14 +++++++++++++
cmd/openim-api/main.go | 9 ++++----
internal/api/auth.go | 3 ++-
internal/api/conversation.go | 3 ++-
internal/api/friend.go | 3 ++-
internal/api/group.go | 3 ++-
internal/api/msg.go | 10 +++++----
internal/api/route.go | 18 +++++++++-------
internal/api/statistics.go | 3 ++-
internal/api/third.go | 6 ++++--
internal/api/user.go | 5 +++--
internal/msggateway/callback.go | 5 +++--
internal/msggateway/client.go | 3 ++-
internal/msggateway/hub_server.go | 11 ++++++----
internal/msggateway/message_handler.go | 3 ++-
internal/msggateway/n_ws_server.go | 11 +++++-----
internal/msgtransfer/init.go | 7 ++++---
.../msgtransfer/online_history_msg_handler.go | 12 ++++++-----
.../online_msg_to_mongo_handler.go | 5 +++--
.../msgtransfer/persistent_msg_handler.go | 7 ++++---
internal/push/callback.go | 7 ++++---
internal/push/offlinepush/fcm/push.go | 6 ++++--
internal/push/offlinepush/getui/push.go | 9 ++++----
internal/push/push_handler.go | 5 +++--
internal/push/push_rpc_server.go | 9 ++++----
internal/push/push_to_client.go | 16 +++++++-------
internal/push/tools.go | 14 +++++++++++++
internal/rpc/auth/auth.go | 10 +++++----
internal/rpc/conversation/conversaion.go | 16 +++++++-------
internal/rpc/friend/black.go | 8 ++++---
internal/rpc/friend/callback.go | 7 ++++---
internal/rpc/friend/friend.go | 15 +++++++------
internal/rpc/group/cache.go | 3 ++-
internal/rpc/group/callback.go | 11 +++++-----
internal/rpc/group/convert.go | 3 ++-
internal/rpc/group/fill.go | 3 ++-
internal/rpc/group/group.go | 14 +++++++------
internal/rpc/group/super_group.go | 7 ++++---
internal/rpc/msg/callback.go | 8 ++++---
internal/rpc/msg/delete.go | 1 +
internal/rpc/msg/message_interceptor.go | 3 ++-
internal/rpc/msg/revoke.go | 6 ++++--
internal/rpc/msg/send.go | 6 ++++--
internal/rpc/msg/server.go | 9 ++++----
internal/rpc/msg/statistics.go | 3 ++-
internal/rpc/msg/sync_msg.go | 1 +
internal/rpc/msg/utils.go | 3 ++-
internal/rpc/msg/verify.go | 3 ++-
internal/rpc/third/s3.go | 5 +++--
internal/rpc/third/third.go | 5 +++--
internal/rpc/third/tool.go | 3 ++-
internal/rpc/user/user.go | 21 +++++++++++--------
internal/tools/cron_task.go | 3 ++-
internal/tools/msg.go | 15 ++++++-------
pkg/authverify/token.go | 18 +++++++++++++++-
pkg/callbackstruct/group.go | 3 ++-
pkg/common/cmd/root.go | 1 +
pkg/common/cmd/rpc.go | 3 ++-
pkg/common/config/config.go | 1 +
pkg/common/config/parse.go | 3 ++-
pkg/common/convert/black.go | 3 ++-
pkg/common/convert/conversation.go | 3 ++-
pkg/common/convert/friend.go | 3 ++-
pkg/common/convert/group.go | 3 ++-
pkg/common/convert/msg.go | 3 ++-
pkg/common/convert/user.go | 3 ++-
pkg/common/db/cache/conversation.go | 3 ++-
pkg/common/db/cache/friend.go | 3 ++-
pkg/common/db/cache/group.go | 3 ++-
pkg/common/db/cache/init_redis.go | 3 ++-
pkg/common/db/cache/msg.go | 8 ++++---
pkg/common/db/cache/user.go | 13 ++++++------
pkg/common/db/controller/auth.go | 4 +++-
pkg/common/db/controller/black.go | 5 +++--
pkg/common/db/controller/chatlog.go | 3 ++-
pkg/common/db/controller/conversation.go | 8 ++++---
pkg/common/db/controller/friend.go | 5 +++--
pkg/common/db/controller/group.go | 7 ++++---
pkg/common/db/controller/msg.go | 5 +++--
pkg/common/db/controller/user.go | 20 ++++++++++--------
pkg/common/db/localcache/conversation.go | 3 ++-
pkg/common/db/localcache/group.go | 3 ++-
pkg/common/db/relation/black_model.go | 3 ++-
pkg/common/db/relation/chat_log_model.go | 3 ++-
pkg/common/db/relation/conversation_model.go | 3 ++-
pkg/common/db/relation/friend_model.go | 3 ++-
.../db/relation/friend_request_model.go | 3 ++-
pkg/common/db/relation/group_member_model.go | 3 ++-
pkg/common/db/relation/group_model.go | 3 ++-
pkg/common/db/relation/group_request_model.go | 3 ++-
pkg/common/db/relation/mysql_init.go | 3 ++-
pkg/common/db/relation/object_model.go | 3 ++-
pkg/common/db/relation/user_model.go | 3 ++-
pkg/common/db/s3/cont/controller.go | 3 ++-
pkg/common/db/table/unrelation/user.go | 2 +-
pkg/common/db/unrelation/mongo.go | 12 ++++++-----
pkg/common/db/unrelation/msg.go | 3 ++-
pkg/common/db/unrelation/super_group.go | 3 ++-
pkg/common/http/http_client.go | 5 +++--
pkg/common/kafka/producer.go | 3 ++-
pkg/common/startrpc/start.go | 3 ++-
pkg/msgprocessor/conversation.go | 19 +++++++++++++++--
pkg/msgprocessor/options.go | 6 ++++--
pkg/rpcclient/auth.go | 3 ++-
pkg/rpcclient/conversation.go | 3 ++-
pkg/rpcclient/friend.go | 3 ++-
pkg/rpcclient/group.go | 3 ++-
pkg/rpcclient/msg.go | 3 ++-
pkg/rpcclient/notification/conevrsation.go | 6 ++++--
pkg/rpcclient/notification/friend.go | 7 ++++---
pkg/rpcclient/notification/group.go | 7 ++++---
pkg/rpcclient/notification/msg.go | 3 ++-
pkg/rpcclient/push.go | 3 ++-
pkg/rpcclient/third.go | 3 ++-
pkg/rpcclient/user.go | 7 +++++--
scripts/advertise.sh | 14 +++++++++++++
132 files changed, 679 insertions(+), 244 deletions(-)
diff --git a/.github/dependabot.yml b/.github/dependabot.yml
index f495b588f..49ffd7173 100644
--- a/.github/dependabot.yml
+++ b/.github/dependabot.yml
@@ -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.
+
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
diff --git a/.github/workflows/auto-tag.yml b/.github/workflows/auto-tag.yml
index 7e72e898d..d6dd56139 100644
--- a/.github/workflows/auto-tag.yml
+++ b/.github/workflows/auto-tag.yml
@@ -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.
+
name: Create Tag
on:
diff --git a/.github/workflows/create_branch_on_tag.yml b/.github/workflows/create_branch_on_tag.yml
index bdb53e80a..67ab11173 100644
--- a/.github/workflows/create_branch_on_tag.yml
+++ b/.github/workflows/create_branch_on_tag.yml
@@ -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.
+
name: Create Branch on Tag
on:
diff --git a/.github/workflows/milestone.yml b/.github/workflows/milestone.yml
index a31eaa150..e0731b25f 100644
--- a/.github/workflows/milestone.yml
+++ b/.github/workflows/milestone.yml
@@ -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.
+
# shamelessly copied from https://github.com/sigstore/cosign/blob/main/.github/workflows/milestone.yaml
name: milestone
diff --git a/build/docker/openim-api/Dockerfile b/build/docker/openim-api/Dockerfile
index b0760a6d7..e20601ff4 100644
--- a/build/docker/openim-api/Dockerfile
+++ b/build/docker/openim-api/Dockerfile
@@ -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.
+
# OpenIM base image: https://github.com/openim-sigs/openim-base-image
# Set go mod installation source and proxy
diff --git a/build/docker/openim-cmdutils/Dockerfile b/build/docker/openim-cmdutils/Dockerfile
index 91e97b76f..71b55f840 100644
--- a/build/docker/openim-cmdutils/Dockerfile
+++ b/build/docker/openim-cmdutils/Dockerfile
@@ -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.
+
# OpenIM base image: https://github.com/openim-sigs/openim-base-image
# Set go mod installation source and proxy
diff --git a/build/docker/openim-crontask/Dockerfile b/build/docker/openim-crontask/Dockerfile
index 06847dc72..59d7ffb2b 100644
--- a/build/docker/openim-crontask/Dockerfile
+++ b/build/docker/openim-crontask/Dockerfile
@@ -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.
+
# OpenIM base image: https://github.com/openim-sigs/openim-base-image
# Set go mod installation source and proxy
diff --git a/build/docker/openim-msggateway/Dockerfile b/build/docker/openim-msggateway/Dockerfile
index 5661d7f8b..1c353b9e5 100644
--- a/build/docker/openim-msggateway/Dockerfile
+++ b/build/docker/openim-msggateway/Dockerfile
@@ -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.
+
# OpenIM base image: https://github.com/openim-sigs/openim-base-image
# Set go mod installation source and proxy
diff --git a/build/docker/openim-msgtransfer/Dockerfile b/build/docker/openim-msgtransfer/Dockerfile
index 2c63a3716..0db1377c1 100644
--- a/build/docker/openim-msgtransfer/Dockerfile
+++ b/build/docker/openim-msgtransfer/Dockerfile
@@ -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.
+
# OpenIM base image: https://github.com/openim-sigs/openim-base-image
# Set go mod installation source and proxy
diff --git a/build/docker/openim-push/Dockerfile b/build/docker/openim-push/Dockerfile
index 1da84525e..c1824b185 100644
--- a/build/docker/openim-push/Dockerfile
+++ b/build/docker/openim-push/Dockerfile
@@ -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.
+
# OpenIM base image: https://github.com/openim-sigs/openim-base-image
# Set go mod installation source and proxy
diff --git a/build/docker/openim-rpc-auth/Dockerfile b/build/docker/openim-rpc-auth/Dockerfile
index d7eddad5e..91326db96 100644
--- a/build/docker/openim-rpc-auth/Dockerfile
+++ b/build/docker/openim-rpc-auth/Dockerfile
@@ -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.
+
# OpenIM base image: https://github.com/openim-sigs/openim-base-image
# Set go mod installation source and proxy
diff --git a/build/docker/openim-rpc-conversation/Dockerfile b/build/docker/openim-rpc-conversation/Dockerfile
index 59eaaf179..1c598c8a8 100644
--- a/build/docker/openim-rpc-conversation/Dockerfile
+++ b/build/docker/openim-rpc-conversation/Dockerfile
@@ -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.
+
# OpenIM base image: https://github.com/openim-sigs/openim-base-image
# Set go mod installation source and proxy
diff --git a/build/docker/openim-rpc-friend/Dockerfile b/build/docker/openim-rpc-friend/Dockerfile
index 139ed49cb..46de47374 100644
--- a/build/docker/openim-rpc-friend/Dockerfile
+++ b/build/docker/openim-rpc-friend/Dockerfile
@@ -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.
+
# OpenIM base image: https://github.com/openim-sigs/openim-base-image
# Set go mod installation source and proxy
diff --git a/build/docker/openim-rpc-group/Dockerfile b/build/docker/openim-rpc-group/Dockerfile
index 9f18a083a..122a81fcf 100644
--- a/build/docker/openim-rpc-group/Dockerfile
+++ b/build/docker/openim-rpc-group/Dockerfile
@@ -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.
+
# OpenIM base image: https://github.com/openim-sigs/openim-base-image
# Set go mod installation source and proxy
diff --git a/build/docker/openim-rpc-msg/Dockerfile b/build/docker/openim-rpc-msg/Dockerfile
index 48af35c1f..ac132e132 100644
--- a/build/docker/openim-rpc-msg/Dockerfile
+++ b/build/docker/openim-rpc-msg/Dockerfile
@@ -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.
+
# OpenIM base image: https://github.com/openim-sigs/openim-base-image
# Set go mod installation source and proxy
diff --git a/build/docker/openim-rpc-third/Dockerfile b/build/docker/openim-rpc-third/Dockerfile
index 5c4a17668..5df9cce39 100644
--- a/build/docker/openim-rpc-third/Dockerfile
+++ b/build/docker/openim-rpc-third/Dockerfile
@@ -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.
+
# OpenIM base image: https://github.com/openim-sigs/openim-base-image
# Set go mod installation source and proxy
diff --git a/build/docker/openim-rpc-user/Dockerfile b/build/docker/openim-rpc-user/Dockerfile
index 732368f89..2dd14c3d1 100644
--- a/build/docker/openim-rpc-user/Dockerfile
+++ b/build/docker/openim-rpc-user/Dockerfile
@@ -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.
+
# OpenIM base image: https://github.com/openim-sigs/openim-base-image
# Set go mod installation source and proxy
diff --git a/cmd/openim-api/main.go b/cmd/openim-api/main.go
index 8350f4d05..d3b70af90 100644
--- a/cmd/openim-api/main.go
+++ b/cmd/openim-api/main.go
@@ -26,14 +26,15 @@ import (
_ "net/http/pprof"
- "github.com/OpenIMSDK/Open-IM-Server/internal/api"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/common/cmd"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/cache"
"github.com/OpenIMSDK/protocol/constant"
"github.com/OpenIMSDK/tools/discoveryregistry"
openKeeper "github.com/OpenIMSDK/tools/discoveryregistry/zookeeper"
"github.com/OpenIMSDK/tools/log"
+
+ "github.com/OpenIMSDK/Open-IM-Server/internal/api"
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/cmd"
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/cache"
)
func main() {
diff --git a/internal/api/auth.go b/internal/api/auth.go
index 11debbea9..9dcc8f7c7 100644
--- a/internal/api/auth.go
+++ b/internal/api/auth.go
@@ -17,9 +17,10 @@ package api
import (
"github.com/gin-gonic/gin"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/rpcclient"
"github.com/OpenIMSDK/protocol/auth"
"github.com/OpenIMSDK/tools/a2r"
+
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/rpcclient"
)
type AuthApi rpcclient.Auth
diff --git a/internal/api/conversation.go b/internal/api/conversation.go
index 0d8b41e37..9f25b5427 100644
--- a/internal/api/conversation.go
+++ b/internal/api/conversation.go
@@ -17,9 +17,10 @@ package api
import (
"github.com/gin-gonic/gin"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/rpcclient"
"github.com/OpenIMSDK/protocol/conversation"
"github.com/OpenIMSDK/tools/a2r"
+
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/rpcclient"
)
type ConversationApi rpcclient.Conversation
diff --git a/internal/api/friend.go b/internal/api/friend.go
index 91fc30347..9542a61f9 100644
--- a/internal/api/friend.go
+++ b/internal/api/friend.go
@@ -15,10 +15,11 @@
package api
import (
- "github.com/OpenIMSDK/Open-IM-Server/pkg/rpcclient"
"github.com/OpenIMSDK/protocol/friend"
"github.com/OpenIMSDK/tools/a2r"
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/rpcclient"
+
"github.com/gin-gonic/gin"
)
diff --git a/internal/api/group.go b/internal/api/group.go
index ad640e74f..1dbca3126 100644
--- a/internal/api/group.go
+++ b/internal/api/group.go
@@ -15,10 +15,11 @@
package api
import (
- "github.com/OpenIMSDK/Open-IM-Server/pkg/rpcclient"
"github.com/OpenIMSDK/protocol/group"
"github.com/OpenIMSDK/tools/a2r"
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/rpcclient"
+
"github.com/gin-gonic/gin"
)
diff --git a/internal/api/msg.go b/internal/api/msg.go
index e7f06dffa..da749b0ae 100644
--- a/internal/api/msg.go
+++ b/internal/api/msg.go
@@ -15,16 +15,15 @@
package api
import (
- "github.com/OpenIMSDK/Open-IM-Server/pkg/authverify"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
"github.com/OpenIMSDK/tools/mcontext"
"github.com/gin-gonic/gin"
"github.com/go-playground/validator/v10"
"github.com/mitchellh/mapstructure"
"google.golang.org/protobuf/proto"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/apistruct"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/rpcclient"
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/authverify"
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
+
"github.com/OpenIMSDK/protocol/constant"
"github.com/OpenIMSDK/protocol/msg"
"github.com/OpenIMSDK/protocol/sdkws"
@@ -33,6 +32,9 @@ import (
"github.com/OpenIMSDK/tools/errs"
"github.com/OpenIMSDK/tools/log"
"github.com/OpenIMSDK/tools/utils"
+
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/apistruct"
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/rpcclient"
)
type MessageApi struct {
diff --git a/internal/api/route.go b/internal/api/route.go
index 5fd3f115a..2dd5d030e 100644
--- a/internal/api/route.go
+++ b/internal/api/route.go
@@ -16,14 +16,16 @@ package api
import (
"context"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/authverify"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/cache"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/controller"
+ "net/http"
+
"github.com/OpenIMSDK/protocol/constant"
"github.com/OpenIMSDK/tools/apiresp"
"github.com/OpenIMSDK/tools/errs"
"github.com/OpenIMSDK/tools/tokenverify"
- "net/http"
+
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/authverify"
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/cache"
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/controller"
"github.com/gin-gonic/gin"
"github.com/gin-gonic/gin/binding"
@@ -32,12 +34,13 @@ import (
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/common/prome"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/rpcclient"
"github.com/OpenIMSDK/tools/discoveryregistry"
"github.com/OpenIMSDK/tools/log"
"github.com/OpenIMSDK/tools/mw"
+
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/prome"
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/rpcclient"
)
func NewGinRouter(discov discoveryregistry.SvcDiscoveryRegistry, rdb redis.UniversalClient) *gin.Engine {
@@ -82,7 +85,6 @@ func NewGinRouter(discov discoveryregistry.SvcDiscoveryRegistry, rdb redis.Unive
userRouterGroup.POST("/subscribe_users_status", ParseToken, u.UnSubscriberStatus)
userRouterGroup.POST("/unsubscribe_users_status", ParseToken, u.UnSubscriberStatus)
userRouterGroup.POST("/get_users_status", ParseToken, u.GetUserStatus)
-
}
// friend routing group
friendRouterGroup := r.Group("/friend", ParseToken)
diff --git a/internal/api/statistics.go b/internal/api/statistics.go
index f267a0ec1..9db38af4a 100644
--- a/internal/api/statistics.go
+++ b/internal/api/statistics.go
@@ -17,9 +17,10 @@ package api
import (
"github.com/gin-gonic/gin"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/rpcclient"
"github.com/OpenIMSDK/protocol/user"
"github.com/OpenIMSDK/tools/a2r"
+
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/rpcclient"
)
type StatisticsApi rpcclient.User
diff --git a/internal/api/third.go b/internal/api/third.go
index e480d4c11..635e434f4 100644
--- a/internal/api/third.go
+++ b/internal/api/third.go
@@ -15,16 +15,18 @@
package api
import (
- "github.com/gin-gonic/gin"
"math/rand"
"net/http"
"strconv"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/rpcclient"
+ "github.com/gin-gonic/gin"
+
"github.com/OpenIMSDK/protocol/third"
"github.com/OpenIMSDK/tools/a2r"
"github.com/OpenIMSDK/tools/errs"
"github.com/OpenIMSDK/tools/mcontext"
+
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/rpcclient"
)
type ThirdApi rpcclient.Third
diff --git a/internal/api/user.go b/internal/api/user.go
index 41f6fd4c9..9392eb423 100644
--- a/internal/api/user.go
+++ b/internal/api/user.go
@@ -17,8 +17,6 @@ package api
import (
"github.com/gin-gonic/gin"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/rpcclient"
"github.com/OpenIMSDK/protocol/constant"
"github.com/OpenIMSDK/protocol/msggateway"
"github.com/OpenIMSDK/protocol/user"
@@ -26,6 +24,9 @@ import (
"github.com/OpenIMSDK/tools/apiresp"
"github.com/OpenIMSDK/tools/errs"
"github.com/OpenIMSDK/tools/log"
+
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/rpcclient"
)
type UserApi rpcclient.User
diff --git a/internal/msggateway/callback.go b/internal/msggateway/callback.go
index 5ede3c854..11fdd0298 100644
--- a/internal/msggateway/callback.go
+++ b/internal/msggateway/callback.go
@@ -18,11 +18,12 @@ import (
"context"
"time"
+ "github.com/OpenIMSDK/protocol/constant"
+ "github.com/OpenIMSDK/tools/mcontext"
+
cbapi "github.com/OpenIMSDK/Open-IM-Server/pkg/callbackstruct"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/http"
- "github.com/OpenIMSDK/protocol/constant"
- "github.com/OpenIMSDK/tools/mcontext"
)
func url() string {
diff --git a/internal/msggateway/client.go b/internal/msggateway/client.go
index 096fd1463..9f612e021 100644
--- a/internal/msggateway/client.go
+++ b/internal/msggateway/client.go
@@ -18,10 +18,11 @@ import (
"context"
"errors"
"fmt"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/msgprocessor"
"runtime/debug"
"sync"
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/msgprocessor"
+
"google.golang.org/protobuf/proto"
"github.com/OpenIMSDK/protocol/constant"
diff --git a/internal/msggateway/hub_server.go b/internal/msggateway/hub_server.go
index e9a53cbf7..d57d41aec 100644
--- a/internal/msggateway/hub_server.go
+++ b/internal/msggateway/hub_server.go
@@ -16,20 +16,23 @@ package msggateway
import (
"context"
+
"github.com/OpenIMSDK/Open-IM-Server/pkg/authverify"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/cache"
"github.com/OpenIMSDK/tools/errs"
"google.golang.org/grpc"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/common/prome"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/common/startrpc"
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/cache"
+
"github.com/OpenIMSDK/protocol/constant"
"github.com/OpenIMSDK/protocol/msggateway"
"github.com/OpenIMSDK/tools/discoveryregistry"
"github.com/OpenIMSDK/tools/log"
"github.com/OpenIMSDK/tools/utils"
+
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/prome"
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/startrpc"
)
func (s *Server) InitServer(client discoveryregistry.SvcDiscoveryRegistry, server *grpc.Server) error {
diff --git a/internal/msggateway/message_handler.go b/internal/msggateway/message_handler.go
index 8e3512238..fdf0a6943 100644
--- a/internal/msggateway/message_handler.go
+++ b/internal/msggateway/message_handler.go
@@ -23,10 +23,11 @@ import (
"github.com/go-playground/validator/v10"
"google.golang.org/protobuf/proto"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/rpcclient"
"github.com/OpenIMSDK/protocol/msg"
"github.com/OpenIMSDK/protocol/sdkws"
"github.com/OpenIMSDK/tools/utils"
+
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/rpcclient"
)
type Req struct {
diff --git a/internal/msggateway/n_ws_server.go b/internal/msggateway/n_ws_server.go
index 67c8132ca..ee8853af6 100644
--- a/internal/msggateway/n_ws_server.go
+++ b/internal/msggateway/n_ws_server.go
@@ -17,17 +17,19 @@ package msggateway
import (
"context"
"errors"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/authverify"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/rpcclient"
"net/http"
"strconv"
"sync"
"sync/atomic"
"time"
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/authverify"
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/rpcclient"
+
+ "github.com/OpenIMSDK/protocol/constant"
+
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/cache"
- "github.com/OpenIMSDK/protocol/constant"
"github.com/redis/go-redis/v9"
@@ -91,6 +93,7 @@ func (ws *WsServer) SetDiscoveryRegistry(client discoveryregistry.SvcDiscoveryRe
u := rpcclient.NewUserRpcClient(client)
ws.userClient = &u
}
+
func (ws *WsServer) SetUserOnlineStatus(ctx context.Context, client *Client, status int32) {
err := ws.userClient.SetUserStatus(ctx, client.UserID, status, client.PlatformID)
if err != nil {
@@ -107,9 +110,7 @@ func (ws *WsServer) SetUserOnlineStatus(ctx context.Context, client *Client, sta
if err != nil {
log.ZWarn(ctx, "CallbackUserOffline err", err)
}
-
}
-
}
func (ws *WsServer) SetCacheHandler(cache cache.MsgModel) {
diff --git a/internal/msgtransfer/init.go b/internal/msgtransfer/init.go
index d54e81240..f996399b5 100644
--- a/internal/msgtransfer/init.go
+++ b/internal/msgtransfer/init.go
@@ -22,6 +22,10 @@ import (
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
+ openKeeper "github.com/OpenIMSDK/tools/discoveryregistry/zookeeper"
+ "github.com/OpenIMSDK/tools/log"
+ "github.com/OpenIMSDK/tools/mw"
+
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/cache"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/controller"
@@ -30,9 +34,6 @@ import (
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/unrelation"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/prome"
"github.com/OpenIMSDK/Open-IM-Server/pkg/rpcclient"
- openKeeper "github.com/OpenIMSDK/tools/discoveryregistry/zookeeper"
- "github.com/OpenIMSDK/tools/log"
- "github.com/OpenIMSDK/tools/mw"
)
type MsgTransfer struct {
diff --git a/internal/msgtransfer/online_history_msg_handler.go b/internal/msgtransfer/online_history_msg_handler.go
index 282f50119..8422ebddb 100644
--- a/internal/msgtransfer/online_history_msg_handler.go
+++ b/internal/msgtransfer/online_history_msg_handler.go
@@ -16,27 +16,29 @@ package msgtransfer
import (
"context"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/msgprocessor"
"strconv"
"strings"
"sync"
"time"
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/msgprocessor"
+
"github.com/OpenIMSDK/tools/errs"
"github.com/Shopify/sarama"
"github.com/go-redis/redis"
"google.golang.org/protobuf/proto"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/controller"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/common/kafka"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/rpcclient"
"github.com/OpenIMSDK/protocol/constant"
"github.com/OpenIMSDK/protocol/sdkws"
"github.com/OpenIMSDK/tools/log"
"github.com/OpenIMSDK/tools/mcontext"
"github.com/OpenIMSDK/tools/utils"
+
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/controller"
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/kafka"
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/rpcclient"
)
const (
diff --git a/internal/msgtransfer/online_msg_to_mongo_handler.go b/internal/msgtransfer/online_msg_to_mongo_handler.go
index 4a8b5e63e..e0dfc59fb 100644
--- a/internal/msgtransfer/online_msg_to_mongo_handler.go
+++ b/internal/msgtransfer/online_msg_to_mongo_handler.go
@@ -20,11 +20,12 @@ import (
"github.com/Shopify/sarama"
"google.golang.org/protobuf/proto"
+ pbMsg "github.com/OpenIMSDK/protocol/msg"
+ "github.com/OpenIMSDK/tools/log"
+
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/controller"
kfk "github.com/OpenIMSDK/Open-IM-Server/pkg/common/kafka"
- pbMsg "github.com/OpenIMSDK/protocol/msg"
- "github.com/OpenIMSDK/tools/log"
)
type OnlineHistoryMongoConsumerHandler struct {
diff --git a/internal/msgtransfer/persistent_msg_handler.go b/internal/msgtransfer/persistent_msg_handler.go
index b67e07cc0..6fcb7d187 100644
--- a/internal/msgtransfer/persistent_msg_handler.go
+++ b/internal/msgtransfer/persistent_msg_handler.go
@@ -17,14 +17,15 @@ package msgtransfer
import (
"context"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/controller"
- kfk "github.com/OpenIMSDK/Open-IM-Server/pkg/common/kafka"
"github.com/OpenIMSDK/protocol/constant"
pbMsg "github.com/OpenIMSDK/protocol/msg"
"github.com/OpenIMSDK/tools/log"
"github.com/OpenIMSDK/tools/utils"
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/controller"
+ kfk "github.com/OpenIMSDK/Open-IM-Server/pkg/common/kafka"
+
"github.com/Shopify/sarama"
"google.golang.org/protobuf/proto"
)
diff --git a/internal/push/callback.go b/internal/push/callback.go
index d5e678301..996341ac1 100644
--- a/internal/push/callback.go
+++ b/internal/push/callback.go
@@ -17,14 +17,15 @@ package push
import (
"context"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/callbackstruct"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/common/http"
"github.com/OpenIMSDK/protocol/constant"
"github.com/OpenIMSDK/protocol/sdkws"
"github.com/OpenIMSDK/tools/errs"
"github.com/OpenIMSDK/tools/mcontext"
"github.com/OpenIMSDK/tools/utils"
+
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/callbackstruct"
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/http"
)
func url() string {
diff --git a/internal/push/offlinepush/fcm/push.go b/internal/push/offlinepush/fcm/push.go
index cea90f865..ffa5db428 100644
--- a/internal/push/offlinepush/fcm/push.go
+++ b/internal/push/offlinepush/fcm/push.go
@@ -16,18 +16,20 @@ package fcm
import (
"context"
- config2 "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
"path/filepath"
+ config2 "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
+
firebase "firebase.google.com/go"
"firebase.google.com/go/messaging"
"github.com/redis/go-redis/v9"
"google.golang.org/api/option"
+ "github.com/OpenIMSDK/protocol/constant"
+
"github.com/OpenIMSDK/Open-IM-Server/internal/push/offlinepush"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/cache"
- "github.com/OpenIMSDK/protocol/constant"
)
const SinglePushCountLimit = 400
diff --git a/internal/push/offlinepush/getui/push.go b/internal/push/offlinepush/getui/push.go
index a2f887a41..1098dacae 100644
--- a/internal/push/offlinepush/getui/push.go
+++ b/internal/push/offlinepush/getui/push.go
@@ -25,15 +25,16 @@ import (
"github.com/go-redis/redis"
- "github.com/OpenIMSDK/Open-IM-Server/internal/push/offlinepush"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/cache"
- http2 "github.com/OpenIMSDK/Open-IM-Server/pkg/common/http"
"github.com/OpenIMSDK/tools/errs"
"github.com/OpenIMSDK/tools/log"
"github.com/OpenIMSDK/tools/mcontext"
"github.com/OpenIMSDK/tools/utils/splitter"
+ "github.com/OpenIMSDK/Open-IM-Server/internal/push/offlinepush"
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/cache"
+ http2 "github.com/OpenIMSDK/Open-IM-Server/pkg/common/http"
+
"github.com/OpenIMSDK/tools/utils"
)
diff --git a/internal/push/push_handler.go b/internal/push/push_handler.go
index 8e307c360..8a1a2680c 100644
--- a/internal/push/push_handler.go
+++ b/internal/push/push_handler.go
@@ -20,13 +20,14 @@ import (
"github.com/Shopify/sarama"
"google.golang.org/protobuf/proto"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
- kfk "github.com/OpenIMSDK/Open-IM-Server/pkg/common/kafka"
"github.com/OpenIMSDK/protocol/constant"
pbChat "github.com/OpenIMSDK/protocol/msg"
pbPush "github.com/OpenIMSDK/protocol/push"
"github.com/OpenIMSDK/tools/log"
"github.com/OpenIMSDK/tools/utils"
+
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
+ kfk "github.com/OpenIMSDK/Open-IM-Server/pkg/common/kafka"
)
type ConsumerHandler struct {
diff --git a/internal/push/push_rpc_server.go b/internal/push/push_rpc_server.go
index 965f890a5..c579deb45 100644
--- a/internal/push/push_rpc_server.go
+++ b/internal/push/push_rpc_server.go
@@ -20,14 +20,15 @@ import (
"google.golang.org/grpc"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/cache"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/controller"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/localcache"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/rpcclient"
"github.com/OpenIMSDK/protocol/constant"
pbPush "github.com/OpenIMSDK/protocol/push"
"github.com/OpenIMSDK/tools/discoveryregistry"
"github.com/OpenIMSDK/tools/log"
+
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/cache"
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/controller"
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/localcache"
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/rpcclient"
)
type pushServer struct {
diff --git a/internal/push/push_to_client.go b/internal/push/push_to_client.go
index b787268d0..50010ca84 100644
--- a/internal/push/push_to_client.go
+++ b/internal/push/push_to_client.go
@@ -18,8 +18,17 @@ import (
"context"
"encoding/json"
"errors"
+
"github.com/OpenIMSDK/Open-IM-Server/pkg/msgprocessor"
+ "github.com/OpenIMSDK/protocol/constant"
+ "github.com/OpenIMSDK/protocol/msggateway"
+ "github.com/OpenIMSDK/protocol/sdkws"
+ "github.com/OpenIMSDK/tools/discoveryregistry"
+ "github.com/OpenIMSDK/tools/log"
+ "github.com/OpenIMSDK/tools/mcontext"
+ "github.com/OpenIMSDK/tools/utils"
+
"github.com/OpenIMSDK/Open-IM-Server/internal/push/offlinepush"
"github.com/OpenIMSDK/Open-IM-Server/internal/push/offlinepush/fcm"
"github.com/OpenIMSDK/Open-IM-Server/internal/push/offlinepush/getui"
@@ -30,13 +39,6 @@ import (
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/localcache"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/prome"
"github.com/OpenIMSDK/Open-IM-Server/pkg/rpcclient"
- "github.com/OpenIMSDK/protocol/constant"
- "github.com/OpenIMSDK/protocol/msggateway"
- "github.com/OpenIMSDK/protocol/sdkws"
- "github.com/OpenIMSDK/tools/discoveryregistry"
- "github.com/OpenIMSDK/tools/log"
- "github.com/OpenIMSDK/tools/mcontext"
- "github.com/OpenIMSDK/tools/utils"
)
type Pusher struct {
diff --git a/internal/push/tools.go b/internal/push/tools.go
index 2135c901e..3242767b1 100644
--- a/internal/push/tools.go
+++ b/internal/push/tools.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/auth/auth.go b/internal/rpc/auth/auth.go
index 1abfc9771..4d3aee88a 100644
--- a/internal/rpc/auth/auth.go
+++ b/internal/rpc/auth/auth.go
@@ -16,14 +16,11 @@ package auth
import (
"context"
+
"github.com/OpenIMSDK/Open-IM-Server/pkg/authverify"
"google.golang.org/grpc"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/cache"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/controller"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/rpcclient"
pbAuth "github.com/OpenIMSDK/protocol/auth"
"github.com/OpenIMSDK/protocol/constant"
"github.com/OpenIMSDK/protocol/msggateway"
@@ -33,6 +30,11 @@ import (
"github.com/OpenIMSDK/tools/mcontext"
"github.com/OpenIMSDK/tools/tokenverify"
"github.com/OpenIMSDK/tools/utils"
+
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/cache"
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/controller"
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/rpcclient"
)
type authServer struct {
diff --git a/internal/rpc/conversation/conversaion.go b/internal/rpc/conversation/conversaion.go
index 6030bfa55..e880cb6c4 100644
--- a/internal/rpc/conversation/conversaion.go
+++ b/internal/rpc/conversation/conversaion.go
@@ -16,17 +16,11 @@ package conversation
import (
"context"
+
"github.com/OpenIMSDK/Open-IM-Server/pkg/msgprocessor"
"google.golang.org/grpc"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/common/convert"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/cache"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/controller"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/relation"
- tableRelation "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/relation"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/rpcclient"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/rpcclient/notification"
"github.com/OpenIMSDK/protocol/constant"
pbConversation "github.com/OpenIMSDK/protocol/conversation"
"github.com/OpenIMSDK/tools/discoveryregistry"
@@ -34,6 +28,14 @@ import (
"github.com/OpenIMSDK/tools/log"
"github.com/OpenIMSDK/tools/tx"
"github.com/OpenIMSDK/tools/utils"
+
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/convert"
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/cache"
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/controller"
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/relation"
+ tableRelation "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/relation"
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/rpcclient"
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/rpcclient/notification"
)
type conversationServer struct {
diff --git a/internal/rpc/friend/black.go b/internal/rpc/friend/black.go
index 9df5abb33..c36abe56d 100644
--- a/internal/rpc/friend/black.go
+++ b/internal/rpc/friend/black.go
@@ -16,13 +16,15 @@ package friend
import (
"context"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/authverify"
"time"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/common/convert"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/relation"
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/authverify"
+
pbFriend "github.com/OpenIMSDK/protocol/friend"
"github.com/OpenIMSDK/tools/mcontext"
+
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/convert"
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/relation"
)
func (s *friendServer) GetPaginationBlacks(
diff --git a/internal/rpc/friend/callback.go b/internal/rpc/friend/callback.go
index bd7716090..f29867bb0 100644
--- a/internal/rpc/friend/callback.go
+++ b/internal/rpc/friend/callback.go
@@ -17,13 +17,14 @@ package friend
import (
"context"
- cbapi "github.com/OpenIMSDK/Open-IM-Server/pkg/callbackstruct"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/common/http"
"github.com/OpenIMSDK/protocol/constant"
pbfriend "github.com/OpenIMSDK/protocol/friend"
"github.com/OpenIMSDK/tools/errs"
"github.com/OpenIMSDK/tools/mcontext"
+
+ cbapi "github.com/OpenIMSDK/Open-IM-Server/pkg/callbackstruct"
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/http"
)
func CallbackBeforeAddFriend(ctx context.Context, req *pbfriend.ApplyToAddFriendReq) error {
diff --git a/internal/rpc/friend/friend.go b/internal/rpc/friend/friend.go
index 7f3be3439..00ea68392 100644
--- a/internal/rpc/friend/friend.go
+++ b/internal/rpc/friend/friend.go
@@ -16,25 +16,28 @@ package friend
import (
"context"
+
"github.com/OpenIMSDK/Open-IM-Server/pkg/authverify"
+ "github.com/OpenIMSDK/tools/log"
+
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/convert"
"github.com/OpenIMSDK/Open-IM-Server/pkg/rpcclient"
- "github.com/OpenIMSDK/tools/log"
"google.golang.org/grpc"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/cache"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/controller"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/relation"
- tablerelation "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/relation"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/rpcclient/notification"
"github.com/OpenIMSDK/protocol/constant"
pbfriend "github.com/OpenIMSDK/protocol/friend"
registry "github.com/OpenIMSDK/tools/discoveryregistry"
"github.com/OpenIMSDK/tools/errs"
"github.com/OpenIMSDK/tools/tx"
"github.com/OpenIMSDK/tools/utils"
+
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/cache"
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/controller"
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/relation"
+ tablerelation "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/relation"
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/rpcclient/notification"
)
type friendServer struct {
diff --git a/internal/rpc/group/cache.go b/internal/rpc/group/cache.go
index 6275292b6..0f12cd60f 100644
--- a/internal/rpc/group/cache.go
+++ b/internal/rpc/group/cache.go
@@ -17,8 +17,9 @@ package group
import (
"context"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/common/convert"
pbGroup "github.com/OpenIMSDK/protocol/group"
+
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/convert"
)
func (s *groupServer) GetGroupInfoCache(
diff --git a/internal/rpc/group/callback.go b/internal/rpc/group/callback.go
index 72661d16b..cb49d6f74 100644
--- a/internal/rpc/group/callback.go
+++ b/internal/rpc/group/callback.go
@@ -18,17 +18,18 @@ import (
"context"
"time"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/apistruct"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/callbackstruct"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/relation"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/common/http"
"github.com/OpenIMSDK/protocol/constant"
"github.com/OpenIMSDK/protocol/group"
"github.com/OpenIMSDK/protocol/wrapperspb"
"github.com/OpenIMSDK/tools/errs"
"github.com/OpenIMSDK/tools/mcontext"
"github.com/OpenIMSDK/tools/utils"
+
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/apistruct"
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/callbackstruct"
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/relation"
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/http"
)
func CallbackBeforeCreateGroup(ctx context.Context, req *group.CreateGroupReq) (err error) {
diff --git a/internal/rpc/group/convert.go b/internal/rpc/group/convert.go
index 22dbfda5f..6f75234ff 100644
--- a/internal/rpc/group/convert.go
+++ b/internal/rpc/group/convert.go
@@ -15,8 +15,9 @@
package group
import (
- "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/relation"
"github.com/OpenIMSDK/protocol/sdkws"
+
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/relation"
)
func (s *groupServer) groupDB2PB(group *relation.GroupModel, ownerUserID string, memberCount uint32) *sdkws.GroupInfo {
diff --git a/internal/rpc/group/fill.go b/internal/rpc/group/fill.go
index 9cf15f8a2..10d326deb 100644
--- a/internal/rpc/group/fill.go
+++ b/internal/rpc/group/fill.go
@@ -17,8 +17,9 @@ package group
import (
"context"
- relationTb "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/relation"
"github.com/OpenIMSDK/tools/utils"
+
+ relationTb "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/relation"
)
func (s *groupServer) FindGroupMember(
diff --git a/internal/rpc/group/group.go b/internal/rpc/group/group.go
index a7680dfaa..3585c764a 100644
--- a/internal/rpc/group/group.go
+++ b/internal/rpc/group/group.go
@@ -31,17 +31,13 @@ import (
"github.com/OpenIMSDK/Open-IM-Server/pkg/rpcclient/notification"
+ "github.com/OpenIMSDK/tools/mw/specialerror"
+
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/convert"
"github.com/OpenIMSDK/Open-IM-Server/pkg/rpcclient"
- "github.com/OpenIMSDK/tools/mw/specialerror"
"google.golang.org/grpc"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/cache"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/controller"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/relation"
- relationTb "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/relation"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/unrelation"
"github.com/OpenIMSDK/protocol/constant"
pbGroup "github.com/OpenIMSDK/protocol/group"
"github.com/OpenIMSDK/protocol/sdkws"
@@ -50,6 +46,12 @@ import (
"github.com/OpenIMSDK/tools/log"
"github.com/OpenIMSDK/tools/mcontext"
"github.com/OpenIMSDK/tools/utils"
+
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/cache"
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/controller"
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/relation"
+ relationTb "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/relation"
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/unrelation"
)
func Start(client discoveryregistry.SvcDiscoveryRegistry, server *grpc.Server) error {
diff --git a/internal/rpc/group/super_group.go b/internal/rpc/group/super_group.go
index 070e154bc..6de16b013 100644
--- a/internal/rpc/group/super_group.go
+++ b/internal/rpc/group/super_group.go
@@ -19,14 +19,15 @@ import (
"fmt"
"strings"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/common/convert"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/relation"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/unrelation"
"github.com/OpenIMSDK/protocol/constant"
pbGroup "github.com/OpenIMSDK/protocol/group"
sdkws "github.com/OpenIMSDK/protocol/sdkws"
"github.com/OpenIMSDK/tools/errs"
"github.com/OpenIMSDK/tools/utils"
+
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/convert"
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/relation"
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/unrelation"
)
func (s *groupServer) GetJoinedSuperGroupList(
diff --git a/internal/rpc/msg/callback.go b/internal/rpc/msg/callback.go
index 5ed6a5f09..f5e4355ec 100644
--- a/internal/rpc/msg/callback.go
+++ b/internal/rpc/msg/callback.go
@@ -16,18 +16,20 @@ package msg
import (
"context"
+
"github.com/OpenIMSDK/protocol/sdkws"
"google.golang.org/protobuf/proto"
- cbapi "github.com/OpenIMSDK/Open-IM-Server/pkg/callbackstruct"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/common/http"
"github.com/OpenIMSDK/protocol/constant"
pbChat "github.com/OpenIMSDK/protocol/msg"
"github.com/OpenIMSDK/tools/errs"
"github.com/OpenIMSDK/tools/log"
"github.com/OpenIMSDK/tools/mcontext"
"github.com/OpenIMSDK/tools/utils"
+
+ cbapi "github.com/OpenIMSDK/Open-IM-Server/pkg/callbackstruct"
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/http"
)
func cbURL() string {
diff --git a/internal/rpc/msg/delete.go b/internal/rpc/msg/delete.go
index cdee8bdb5..ff258eaae 100644
--- a/internal/rpc/msg/delete.go
+++ b/internal/rpc/msg/delete.go
@@ -16,6 +16,7 @@ package msg
import (
"context"
+
"github.com/OpenIMSDK/Open-IM-Server/pkg/authverify"
"github.com/OpenIMSDK/protocol/constant"
diff --git a/internal/rpc/msg/message_interceptor.go b/internal/rpc/msg/message_interceptor.go
index 3c8bf965d..2b41ccb51 100644
--- a/internal/rpc/msg/message_interceptor.go
+++ b/internal/rpc/msg/message_interceptor.go
@@ -17,11 +17,12 @@ package msg
import (
"context"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
"github.com/OpenIMSDK/protocol/constant"
"github.com/OpenIMSDK/protocol/msg"
"github.com/OpenIMSDK/protocol/sdkws"
"github.com/OpenIMSDK/tools/errs"
+
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
)
type MessageInterceptorFunc func(ctx context.Context, req *msg.SendMsgReq) (*sdkws.MsgData, error)
diff --git a/internal/rpc/msg/revoke.go b/internal/rpc/msg/revoke.go
index 18066c1a2..d700e2df1 100644
--- a/internal/rpc/msg/revoke.go
+++ b/internal/rpc/msg/revoke.go
@@ -17,16 +17,18 @@ package msg
import (
"context"
"encoding/json"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/authverify"
"time"
- unRelationTb "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/unrelation"
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/authverify"
+
"github.com/OpenIMSDK/protocol/constant"
"github.com/OpenIMSDK/protocol/msg"
"github.com/OpenIMSDK/protocol/sdkws"
"github.com/OpenIMSDK/tools/errs"
"github.com/OpenIMSDK/tools/log"
"github.com/OpenIMSDK/tools/utils"
+
+ unRelationTb "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/unrelation"
)
func (m *msgServer) RevokeMsg(ctx context.Context, req *msg.RevokeMsgReq) (*msg.RevokeMsgResp, error) {
diff --git a/internal/rpc/msg/send.go b/internal/rpc/msg/send.go
index 8ec54e7d8..3d15bfd1d 100644
--- a/internal/rpc/msg/send.go
+++ b/internal/rpc/msg/send.go
@@ -16,9 +16,9 @@ package msg
import (
"context"
+
"github.com/OpenIMSDK/Open-IM-Server/pkg/msgprocessor"
- promePkg "github.com/OpenIMSDK/Open-IM-Server/pkg/common/prome"
"github.com/OpenIMSDK/protocol/constant"
pbConversation "github.com/OpenIMSDK/protocol/conversation"
pbMsg "github.com/OpenIMSDK/protocol/msg"
@@ -28,6 +28,8 @@ import (
"github.com/OpenIMSDK/tools/log"
"github.com/OpenIMSDK/tools/mcontext"
"github.com/OpenIMSDK/tools/utils"
+
+ promePkg "github.com/OpenIMSDK/Open-IM-Server/pkg/common/prome"
)
func (m *msgServer) SendMsg(ctx context.Context, req *pbMsg.SendMsgReq) (resp *pbMsg.SendMsgResp, error error) {
@@ -149,7 +151,7 @@ func (m *msgServer) sendMsgSingleChat(ctx context.Context, req *pbMsg.SendMsgReq
if err := m.messageVerification(ctx, req); err != nil {
return nil, err
}
- var isSend = true
+ isSend := true
isNotification := msgprocessor.IsNotificationByMsg(req.MsgData)
if !isNotification {
isSend, err = m.modifyMessageByUserMessageReceiveOpt(
diff --git a/internal/rpc/msg/server.go b/internal/rpc/msg/server.go
index fe795e0eb..3aa4033d7 100644
--- a/internal/rpc/msg/server.go
+++ b/internal/rpc/msg/server.go
@@ -19,16 +19,17 @@ import (
"google.golang.org/grpc"
+ "github.com/OpenIMSDK/protocol/constant"
+ "github.com/OpenIMSDK/protocol/conversation"
+ "github.com/OpenIMSDK/protocol/msg"
+ "github.com/OpenIMSDK/tools/discoveryregistry"
+
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/cache"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/controller"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/localcache"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/unrelation"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/prome"
"github.com/OpenIMSDK/Open-IM-Server/pkg/rpcclient"
- "github.com/OpenIMSDK/protocol/constant"
- "github.com/OpenIMSDK/protocol/conversation"
- "github.com/OpenIMSDK/protocol/msg"
- "github.com/OpenIMSDK/tools/discoveryregistry"
)
type (
diff --git a/internal/rpc/msg/statistics.go b/internal/rpc/msg/statistics.go
index c5a4658bb..dbad0721f 100644
--- a/internal/rpc/msg/statistics.go
+++ b/internal/rpc/msg/statistics.go
@@ -18,10 +18,11 @@ import (
"context"
"time"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/unrelation"
"github.com/OpenIMSDK/protocol/msg"
"github.com/OpenIMSDK/protocol/sdkws"
"github.com/OpenIMSDK/tools/utils"
+
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/unrelation"
)
func (m *msgServer) GetActiveUser(ctx context.Context, req *msg.GetActiveUserReq) (*msg.GetActiveUserResp, error) {
diff --git a/internal/rpc/msg/sync_msg.go b/internal/rpc/msg/sync_msg.go
index e91138d6c..87f5d8ca8 100644
--- a/internal/rpc/msg/sync_msg.go
+++ b/internal/rpc/msg/sync_msg.go
@@ -16,6 +16,7 @@ package msg
import (
"context"
+
"github.com/OpenIMSDK/Open-IM-Server/pkg/authverify"
"github.com/OpenIMSDK/Open-IM-Server/pkg/msgprocessor"
diff --git a/internal/rpc/msg/utils.go b/internal/rpc/msg/utils.go
index 1579bcbef..9753a3e01 100644
--- a/internal/rpc/msg/utils.go
+++ b/internal/rpc/msg/utils.go
@@ -18,10 +18,11 @@ import (
"github.com/redis/go-redis/v9"
"gorm.io/gorm"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
"github.com/OpenIMSDK/protocol/constant"
"github.com/OpenIMSDK/protocol/sdkws"
"github.com/OpenIMSDK/tools/utils"
+
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
)
func isMessageHasReadEnabled(msgData *sdkws.MsgData) bool {
diff --git a/internal/rpc/msg/verify.go b/internal/rpc/msg/verify.go
index c588d6cf7..8fbc01095 100644
--- a/internal/rpc/msg/verify.go
+++ b/internal/rpc/msg/verify.go
@@ -20,12 +20,13 @@ import (
"strconv"
"time"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
"github.com/OpenIMSDK/protocol/constant"
"github.com/OpenIMSDK/protocol/msg"
"github.com/OpenIMSDK/protocol/sdkws"
"github.com/OpenIMSDK/tools/errs"
"github.com/OpenIMSDK/tools/utils"
+
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
)
var ExcludeContentType = []int{constant.HasReadReceipt}
diff --git a/internal/rpc/third/s3.go b/internal/rpc/third/s3.go
index 38b0eb03c..2278823cf 100644
--- a/internal/rpc/third/s3.go
+++ b/internal/rpc/third/s3.go
@@ -18,13 +18,14 @@ import (
"context"
"time"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/s3/cont"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/relation"
"github.com/OpenIMSDK/protocol/third"
"github.com/OpenIMSDK/tools/errs"
"github.com/OpenIMSDK/tools/log"
"github.com/OpenIMSDK/tools/mcontext"
"github.com/OpenIMSDK/tools/utils"
+
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/s3/cont"
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/relation"
)
func (t *thirdServer) PartLimit(ctx context.Context, req *third.PartLimitReq) (*third.PartLimitResp, error) {
diff --git a/internal/rpc/third/third.go b/internal/rpc/third/third.go
index 555e9371c..2cce73763 100644
--- a/internal/rpc/third/third.go
+++ b/internal/rpc/third/third.go
@@ -27,14 +27,15 @@ import (
"google.golang.org/grpc"
+ "github.com/OpenIMSDK/protocol/third"
+ "github.com/OpenIMSDK/tools/discoveryregistry"
+
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/cache"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/controller"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/relation"
relationTb "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/relation"
"github.com/OpenIMSDK/Open-IM-Server/pkg/rpcclient"
- "github.com/OpenIMSDK/protocol/third"
- "github.com/OpenIMSDK/tools/discoveryregistry"
)
func Start(client discoveryregistry.SvcDiscoveryRegistry, server *grpc.Server) error {
diff --git a/internal/rpc/third/tool.go b/internal/rpc/third/tool.go
index 3034de674..f81a7ccf2 100644
--- a/internal/rpc/third/tool.go
+++ b/internal/rpc/third/tool.go
@@ -18,10 +18,11 @@ import (
"context"
"errors"
"fmt"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/authverify"
"strings"
"unicode/utf8"
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/authverify"
+
"github.com/OpenIMSDK/protocol/third"
"github.com/OpenIMSDK/tools/errs"
"github.com/OpenIMSDK/tools/mcontext"
diff --git a/internal/rpc/user/user.go b/internal/rpc/user/user.go
index 5425a9c13..ab45a2b2f 100644
--- a/internal/rpc/user/user.go
+++ b/internal/rpc/user/user.go
@@ -17,12 +17,21 @@ package user
import (
"context"
"errors"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/authverify"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/unrelation"
- "github.com/OpenIMSDK/tools/log"
"strings"
"time"
+ "github.com/OpenIMSDK/tools/log"
+
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/authverify"
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/unrelation"
+
+ "github.com/OpenIMSDK/protocol/constant"
+ "github.com/OpenIMSDK/protocol/sdkws"
+ pbuser "github.com/OpenIMSDK/protocol/user"
+ registry "github.com/OpenIMSDK/tools/discoveryregistry"
+ "github.com/OpenIMSDK/tools/errs"
+ "github.com/OpenIMSDK/tools/tx"
+
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/convert"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/cache"
@@ -31,12 +40,6 @@ import (
tablerelation "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/relation"
"github.com/OpenIMSDK/Open-IM-Server/pkg/rpcclient"
"github.com/OpenIMSDK/Open-IM-Server/pkg/rpcclient/notification"
- "github.com/OpenIMSDK/protocol/constant"
- "github.com/OpenIMSDK/protocol/sdkws"
- pbuser "github.com/OpenIMSDK/protocol/user"
- registry "github.com/OpenIMSDK/tools/discoveryregistry"
- "github.com/OpenIMSDK/tools/errs"
- "github.com/OpenIMSDK/tools/tx"
"google.golang.org/grpc"
diff --git a/internal/tools/cron_task.go b/internal/tools/cron_task.go
index a7333a5d4..a1756a2f8 100644
--- a/internal/tools/cron_task.go
+++ b/internal/tools/cron_task.go
@@ -21,8 +21,9 @@ import (
"github.com/robfig/cron/v3"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
"github.com/OpenIMSDK/tools/log"
+
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
)
func StartCronTask() error {
diff --git a/internal/tools/msg.go b/internal/tools/msg.go
index d13f4597a..19cb67943 100644
--- a/internal/tools/msg.go
+++ b/internal/tools/msg.go
@@ -24,13 +24,6 @@ import (
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/cache"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/controller"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/relation"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/unrelation"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/rpcclient"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/rpcclient/notification"
"github.com/OpenIMSDK/tools/discoveryregistry/zookeeper"
"github.com/OpenIMSDK/tools/errs"
"github.com/OpenIMSDK/tools/log"
@@ -38,6 +31,14 @@ import (
"github.com/OpenIMSDK/tools/mw"
"github.com/OpenIMSDK/tools/tx"
"github.com/OpenIMSDK/tools/utils"
+
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/cache"
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/controller"
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/relation"
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/unrelation"
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/rpcclient"
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/rpcclient/notification"
)
type MsgTool struct {
diff --git a/pkg/authverify/token.go b/pkg/authverify/token.go
index 0d26b6b04..e508c75cb 100644
--- a/pkg/authverify/token.go
+++ b/pkg/authverify/token.go
@@ -1,14 +1,30 @@
+// 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 authverify
import (
"context"
"fmt"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
+
"github.com/OpenIMSDK/tools/errs"
"github.com/OpenIMSDK/tools/mcontext"
"github.com/OpenIMSDK/tools/tokenverify"
"github.com/OpenIMSDK/tools/utils"
"github.com/golang-jwt/jwt/v4"
+
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
)
func Secret() jwt.Keyfunc {
diff --git a/pkg/callbackstruct/group.go b/pkg/callbackstruct/group.go
index 940356e41..8282b6546 100644
--- a/pkg/callbackstruct/group.go
+++ b/pkg/callbackstruct/group.go
@@ -15,8 +15,9 @@
package callbackstruct
import (
- "github.com/OpenIMSDK/Open-IM-Server/pkg/apistruct"
common "github.com/OpenIMSDK/protocol/sdkws"
+
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/apistruct"
)
type CallbackCommand string
diff --git a/pkg/common/cmd/root.go b/pkg/common/cmd/root.go
index 39865b9f8..96ecc20c3 100644
--- a/pkg/common/cmd/root.go
+++ b/pkg/common/cmd/root.go
@@ -16,6 +16,7 @@ package cmd
import (
"fmt"
+
config2 "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
"github.com/spf13/cobra"
diff --git a/pkg/common/cmd/rpc.go b/pkg/common/cmd/rpc.go
index 9a00353be..1f6fe16a5 100644
--- a/pkg/common/cmd/rpc.go
+++ b/pkg/common/cmd/rpc.go
@@ -20,8 +20,9 @@ import (
"github.com/spf13/cobra"
"google.golang.org/grpc"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/common/startrpc"
"github.com/OpenIMSDK/tools/discoveryregistry"
+
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/startrpc"
)
type RpcCmd struct {
diff --git a/pkg/common/config/config.go b/pkg/common/config/config.go
index 1e0bbba16..69c14eb66 100644
--- a/pkg/common/config/config.go
+++ b/pkg/common/config/config.go
@@ -16,6 +16,7 @@ package config
import (
"bytes"
+
"github.com/OpenIMSDK/tools/discoveryregistry"
"gopkg.in/yaml.v3"
)
diff --git a/pkg/common/config/parse.go b/pkg/common/config/parse.go
index e3fd99b9f..8b7999b25 100644
--- a/pkg/common/config/parse.go
+++ b/pkg/common/config/parse.go
@@ -17,11 +17,12 @@ package config
import (
_ "embed"
"fmt"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/msgprocessor"
"os"
"path/filepath"
"runtime"
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/msgprocessor"
+
"gopkg.in/yaml.v3"
"github.com/OpenIMSDK/protocol/constant"
diff --git a/pkg/common/convert/black.go b/pkg/common/convert/black.go
index cae002ada..f0f74fbcc 100644
--- a/pkg/common/convert/black.go
+++ b/pkg/common/convert/black.go
@@ -17,9 +17,10 @@ package convert
import (
"context"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/relation"
"github.com/OpenIMSDK/protocol/sdkws"
sdk "github.com/OpenIMSDK/protocol/sdkws"
+
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/relation"
)
func BlackDB2Pb(
diff --git a/pkg/common/convert/conversation.go b/pkg/common/convert/conversation.go
index 7eccad9b0..4c9a5ea4e 100644
--- a/pkg/common/convert/conversation.go
+++ b/pkg/common/convert/conversation.go
@@ -15,9 +15,10 @@
package convert
import (
- "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/relation"
"github.com/OpenIMSDK/protocol/conversation"
"github.com/OpenIMSDK/tools/utils"
+
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/relation"
)
func ConversationDB2Pb(conversationDB *relation.ConversationModel) *conversation.Conversation {
diff --git a/pkg/common/convert/friend.go b/pkg/common/convert/friend.go
index 322f9d10a..255334840 100644
--- a/pkg/common/convert/friend.go
+++ b/pkg/common/convert/friend.go
@@ -17,9 +17,10 @@ package convert
import (
"context"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/relation"
"github.com/OpenIMSDK/protocol/sdkws"
"github.com/OpenIMSDK/tools/utils"
+
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/relation"
)
func FriendPb2DB(friend *sdkws.FriendInfo) *relation.FriendModel {
diff --git a/pkg/common/convert/group.go b/pkg/common/convert/group.go
index efd2c3710..525f6ec2c 100644
--- a/pkg/common/convert/group.go
+++ b/pkg/common/convert/group.go
@@ -17,9 +17,10 @@ package convert
import (
"time"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/relation"
pbGroup "github.com/OpenIMSDK/protocol/group"
sdkws "github.com/OpenIMSDK/protocol/sdkws"
+
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/relation"
)
func Db2PbGroupInfo(m *relation.GroupModel, ownerUserID string, memberCount uint32) *sdkws.GroupInfo {
diff --git a/pkg/common/convert/msg.go b/pkg/common/convert/msg.go
index 525d35f1c..7708d7535 100644
--- a/pkg/common/convert/msg.go
+++ b/pkg/common/convert/msg.go
@@ -15,8 +15,9 @@
package convert
import (
- "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/unrelation"
"github.com/OpenIMSDK/protocol/sdkws"
+
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/unrelation"
)
func MsgPb2DB(msg *sdkws.MsgData) *unrelation.MsgDataModel {
diff --git a/pkg/common/convert/user.go b/pkg/common/convert/user.go
index 28f4781e7..26c70bb51 100644
--- a/pkg/common/convert/user.go
+++ b/pkg/common/convert/user.go
@@ -17,8 +17,9 @@ package convert
import (
"time"
- relationTb "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/relation"
"github.com/OpenIMSDK/protocol/sdkws"
+
+ relationTb "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/relation"
)
func UsersDB2Pb(users []*relationTb.UserModel) (result []*sdkws.UserInfo) {
diff --git a/pkg/common/db/cache/conversation.go b/pkg/common/db/cache/conversation.go
index 7f0290c8f..0f2eb0292 100644
--- a/pkg/common/db/cache/conversation.go
+++ b/pkg/common/db/cache/conversation.go
@@ -24,9 +24,10 @@ import (
"github.com/dtm-labs/rockscache"
"github.com/redis/go-redis/v9"
+ "github.com/OpenIMSDK/tools/utils"
+
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/relation"
relationTb "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/relation"
- "github.com/OpenIMSDK/tools/utils"
)
const (
diff --git a/pkg/common/db/cache/friend.go b/pkg/common/db/cache/friend.go
index 698f1364c..1a156cdb2 100644
--- a/pkg/common/db/cache/friend.go
+++ b/pkg/common/db/cache/friend.go
@@ -21,8 +21,9 @@ import (
"github.com/dtm-labs/rockscache"
"github.com/redis/go-redis/v9"
- relationTb "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/relation"
"github.com/OpenIMSDK/tools/utils"
+
+ relationTb "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/relation"
)
const (
diff --git a/pkg/common/db/cache/group.go b/pkg/common/db/cache/group.go
index d72f06908..e2a3f0103 100644
--- a/pkg/common/db/cache/group.go
+++ b/pkg/common/db/cache/group.go
@@ -23,9 +23,10 @@ import (
"github.com/dtm-labs/rockscache"
"github.com/redis/go-redis/v9"
+ "github.com/OpenIMSDK/tools/utils"
+
relationTb "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/relation"
unrelationTb "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/unrelation"
- "github.com/OpenIMSDK/tools/utils"
)
const (
diff --git a/pkg/common/db/cache/init_redis.go b/pkg/common/db/cache/init_redis.go
index 69bc0d484..61273f49f 100644
--- a/pkg/common/db/cache/init_redis.go
+++ b/pkg/common/db/cache/init_redis.go
@@ -22,9 +22,10 @@ import (
"github.com/redis/go-redis/v9"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
"github.com/OpenIMSDK/tools/errs"
"github.com/OpenIMSDK/tools/mw/specialerror"
+
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
)
const (
diff --git a/pkg/common/db/cache/msg.go b/pkg/common/db/cache/msg.go
index 953396fbe..30eb41ae9 100644
--- a/pkg/common/db/cache/msg.go
+++ b/pkg/common/db/cache/msg.go
@@ -16,23 +16,25 @@ package cache
import (
"context"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/msgprocessor"
"strconv"
"time"
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/msgprocessor"
+
"github.com/dtm-labs/rockscache"
"github.com/OpenIMSDK/tools/errs"
"github.com/gogo/protobuf/jsonpb"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
- unRelationTb "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/unrelation"
"github.com/OpenIMSDK/protocol/constant"
"github.com/OpenIMSDK/protocol/sdkws"
"github.com/OpenIMSDK/tools/log"
"github.com/OpenIMSDK/tools/utils"
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
+ unRelationTb "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/unrelation"
+
"github.com/redis/go-redis/v9"
)
diff --git a/pkg/common/db/cache/user.go b/pkg/common/db/cache/user.go
index 65afb400d..05374cc5f 100644
--- a/pkg/common/db/cache/user.go
+++ b/pkg/common/db/cache/user.go
@@ -17,12 +17,13 @@ package cache
import (
"context"
"encoding/json"
- "github.com/OpenIMSDK/protocol/user"
- "github.com/OpenIMSDK/tools/errs"
"hash/crc32"
"strconv"
"time"
+ "github.com/OpenIMSDK/protocol/user"
+ "github.com/OpenIMSDK/tools/errs"
+
"github.com/dtm-labs/rockscache"
"github.com/redis/go-redis/v9"
@@ -163,12 +164,12 @@ func (u *UserCacheRedis) getOnlineStatusKey(userID string) string {
return olineStatusKey + userID
}
-// GetUserStatus get user status
+// GetUserStatus get user status.
func (u *UserCacheRedis) GetUserStatus(ctx context.Context, userIDs []string) ([]*user.OnlineStatus, error) {
var res []*user.OnlineStatus
for _, userID := range userIDs {
UserIDNum := crc32.ChecksumIEEE([]byte(userID))
- var modKey = strconv.Itoa(int(UserIDNum % statusMod))
+ modKey := strconv.Itoa(int(UserIDNum % statusMod))
var onlineStatus user.OnlineStatus
key := olineStatusKey + modKey
result, err := u.rdb.HGet(ctx, key, userID).Result()
@@ -195,12 +196,12 @@ func (u *UserCacheRedis) GetUserStatus(ctx context.Context, userIDs []string) ([
return res, nil
}
-// SetUserStatus Set the user status and save it in redis
+// SetUserStatus Set the user status and save it in redis.
func (u *UserCacheRedis) SetUserStatus(ctx context.Context, list []*user.OnlineStatus) error {
for _, status := range list {
var isNewKey int64
UserIDNum := crc32.ChecksumIEEE([]byte(status.UserID))
- var modKey = strconv.Itoa(int(UserIDNum % statusMod))
+ modKey := strconv.Itoa(int(UserIDNum % statusMod))
key := olineStatusKey + modKey
jsonData, err := json.Marshal(status)
if err != nil {
diff --git a/pkg/common/db/controller/auth.go b/pkg/common/db/controller/auth.go
index d864e078b..f44263076 100644
--- a/pkg/common/db/controller/auth.go
+++ b/pkg/common/db/controller/auth.go
@@ -16,14 +16,16 @@ package controller
import (
"context"
+
"github.com/OpenIMSDK/Open-IM-Server/pkg/authverify"
"github.com/golang-jwt/jwt/v4"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/cache"
"github.com/OpenIMSDK/protocol/constant"
"github.com/OpenIMSDK/tools/tokenverify"
"github.com/OpenIMSDK/tools/utils"
+
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/cache"
)
type AuthDatabase interface {
diff --git a/pkg/common/db/controller/black.go b/pkg/common/db/controller/black.go
index 767797eb1..4a239829f 100644
--- a/pkg/common/db/controller/black.go
+++ b/pkg/common/db/controller/black.go
@@ -17,10 +17,11 @@ package controller
import (
"context"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/cache"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/relation"
"github.com/OpenIMSDK/tools/log"
"github.com/OpenIMSDK/tools/utils"
+
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/cache"
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/relation"
)
type BlackDatabase interface {
diff --git a/pkg/common/db/controller/chatlog.go b/pkg/common/db/controller/chatlog.go
index 37f620271..acf2642da 100644
--- a/pkg/common/db/controller/chatlog.go
+++ b/pkg/common/db/controller/chatlog.go
@@ -15,8 +15,9 @@
package controller
import (
- relationTb "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/relation"
pbMsg "github.com/OpenIMSDK/protocol/msg"
+
+ relationTb "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/relation"
)
type ChatLogDatabase interface {
diff --git a/pkg/common/db/controller/conversation.go b/pkg/common/db/controller/conversation.go
index 2829f963e..6c4998c59 100644
--- a/pkg/common/db/controller/conversation.go
+++ b/pkg/common/db/controller/conversation.go
@@ -16,15 +16,17 @@ package controller
import (
"context"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/msgprocessor"
"time"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/cache"
- relationTb "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/relation"
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/msgprocessor"
+
"github.com/OpenIMSDK/protocol/constant"
"github.com/OpenIMSDK/tools/log"
"github.com/OpenIMSDK/tools/tx"
"github.com/OpenIMSDK/tools/utils"
+
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/cache"
+ relationTb "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/relation"
)
type ConversationDatabase interface {
diff --git a/pkg/common/db/controller/friend.go b/pkg/common/db/controller/friend.go
index 0f9315c20..69db8dd6e 100644
--- a/pkg/common/db/controller/friend.go
+++ b/pkg/common/db/controller/friend.go
@@ -20,14 +20,15 @@ import (
"gorm.io/gorm"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/cache"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/relation"
"github.com/OpenIMSDK/protocol/constant"
"github.com/OpenIMSDK/tools/errs"
"github.com/OpenIMSDK/tools/log"
"github.com/OpenIMSDK/tools/mcontext"
"github.com/OpenIMSDK/tools/tx"
"github.com/OpenIMSDK/tools/utils"
+
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/cache"
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/relation"
)
type FriendDatabase interface {
diff --git a/pkg/common/db/controller/group.go b/pkg/common/db/controller/group.go
index ba4ae18df..2311e1f28 100644
--- a/pkg/common/db/controller/group.go
+++ b/pkg/common/db/controller/group.go
@@ -24,14 +24,15 @@ import (
"go.mongodb.org/mongo-driver/mongo"
"gorm.io/gorm"
+ "github.com/OpenIMSDK/protocol/constant"
+ "github.com/OpenIMSDK/tools/tx"
+ "github.com/OpenIMSDK/tools/utils"
+
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/cache"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/relation"
relationTb "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/relation"
unRelationTb "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/unrelation"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/unrelation"
- "github.com/OpenIMSDK/protocol/constant"
- "github.com/OpenIMSDK/tools/tx"
- "github.com/OpenIMSDK/tools/utils"
)
type GroupDatabase interface {
diff --git a/pkg/common/db/controller/msg.go b/pkg/common/db/controller/msg.go
index 7c03eb8b6..e2f1447ab 100644
--- a/pkg/common/db/controller/msg.go
+++ b/pkg/common/db/controller/msg.go
@@ -21,6 +21,9 @@ import (
"github.com/redis/go-redis/v9"
+ "github.com/OpenIMSDK/tools/errs"
+ "github.com/OpenIMSDK/tools/log"
+
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/convert"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/cache"
@@ -28,8 +31,6 @@ import (
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/unrelation"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/kafka"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/prome"
- "github.com/OpenIMSDK/tools/errs"
- "github.com/OpenIMSDK/tools/log"
"go.mongodb.org/mongo-driver/mongo"
diff --git a/pkg/common/db/controller/user.go b/pkg/common/db/controller/user.go
index a867899d9..992cc87e3 100644
--- a/pkg/common/db/controller/user.go
+++ b/pkg/common/db/controller/user.go
@@ -18,13 +18,15 @@ import (
"context"
unRelationTb "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/unrelation"
"github.com/OpenIMSDK/protocol/user"
- "time"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/cache"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/relation"
+ unRelationTb "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/unrelation"
+
"github.com/OpenIMSDK/tools/errs"
"github.com/OpenIMSDK/tools/tx"
"github.com/OpenIMSDK/tools/utils"
+
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/cache"
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/relation"
)
type UserDatabase interface {
@@ -162,17 +164,17 @@ func (u *userDatabase) IsExist(ctx context.Context, userIDs []string) (exist boo
return false, nil
}
-// GetAllUserID Get all user IDs
+// GetAllUserID Get all user IDs.
func (u *userDatabase) GetAllUserID(ctx context.Context, pageNumber, showNumber int32) (userIDs []string, err error) {
return u.userDB.GetAllUserID(ctx, pageNumber, showNumber)
}
-// CountTotal Get the total number of users
+// CountTotal Get the total number of users.
func (u *userDatabase) CountTotal(ctx context.Context, before *time.Time) (count int64, err error) {
return u.userDB.CountTotal(ctx, before)
}
-// CountRangeEverydayTotal Get the user increment in the range
+// CountRangeEverydayTotal Get the user increment in the range.
func (u *userDatabase) CountRangeEverydayTotal(ctx context.Context, start time.Time, end time.Time) (map[string]int64, error) {
return u.userDB.CountRangeEverydayTotal(ctx, start, end)
}
@@ -198,7 +200,7 @@ func (u *userDatabase) GetAllSubscribeList(ctx context.Context, userID string) (
return list, nil
}
-// GetSubscribedList Get all subscribed lists
+// GetSubscribedList Get all subscribed lists.
func (u *userDatabase) GetSubscribedList(ctx context.Context, userID string) ([]string, error) {
list, err := u.mongoDB.GetSubscribedList(ctx, userID)
if err != nil {
@@ -207,13 +209,13 @@ func (u *userDatabase) GetSubscribedList(ctx context.Context, userID string) ([]
return list, nil
}
-// GetUserStatus get user status
+// GetUserStatus get user status.
func (u *userDatabase) GetUserStatus(ctx context.Context, userIDs []string) ([]*user.OnlineStatus, error) {
onlineStatusList, err := u.cache.GetUserStatus(ctx, userIDs)
return onlineStatusList, err
}
-// SetUserStatus Set the user status and save it in redis
+// SetUserStatus Set the user status and save it in redis.
func (u *userDatabase) SetUserStatus(ctx context.Context, list []*user.OnlineStatus) error {
return u.cache.SetUserStatus(ctx, list)
}
diff --git a/pkg/common/db/localcache/conversation.go b/pkg/common/db/localcache/conversation.go
index 98720fe3a..e1243e4c1 100644
--- a/pkg/common/db/localcache/conversation.go
+++ b/pkg/common/db/localcache/conversation.go
@@ -18,8 +18,9 @@ import (
"context"
"sync"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/rpcclient"
"github.com/OpenIMSDK/protocol/conversation"
+
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/rpcclient"
)
type ConversationLocalCache struct {
diff --git a/pkg/common/db/localcache/group.go b/pkg/common/db/localcache/group.go
index 57cea7245..093353c86 100644
--- a/pkg/common/db/localcache/group.go
+++ b/pkg/common/db/localcache/group.go
@@ -18,9 +18,10 @@ import (
"context"
"sync"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/rpcclient"
"github.com/OpenIMSDK/protocol/group"
"github.com/OpenIMSDK/tools/errs"
+
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/rpcclient"
)
type GroupLocalCache struct {
diff --git a/pkg/common/db/relation/black_model.go b/pkg/common/db/relation/black_model.go
index eede403b1..9684b6f77 100644
--- a/pkg/common/db/relation/black_model.go
+++ b/pkg/common/db/relation/black_model.go
@@ -21,8 +21,9 @@ import (
"gorm.io/gorm"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/relation"
"github.com/OpenIMSDK/tools/utils"
+
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/relation"
)
type BlackGorm struct {
diff --git a/pkg/common/db/relation/chat_log_model.go b/pkg/common/db/relation/chat_log_model.go
index 76ed9be62..8ffab26ab 100644
--- a/pkg/common/db/relation/chat_log_model.go
+++ b/pkg/common/db/relation/chat_log_model.go
@@ -20,11 +20,12 @@ import (
"google.golang.org/protobuf/proto"
"gorm.io/gorm"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/relation"
"github.com/OpenIMSDK/protocol/constant"
pbMsg "github.com/OpenIMSDK/protocol/msg"
sdkws "github.com/OpenIMSDK/protocol/sdkws"
"github.com/OpenIMSDK/tools/utils"
+
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/relation"
)
type ChatLogGorm struct {
diff --git a/pkg/common/db/relation/conversation_model.go b/pkg/common/db/relation/conversation_model.go
index 0efca79aa..f58ac6e22 100644
--- a/pkg/common/db/relation/conversation_model.go
+++ b/pkg/common/db/relation/conversation_model.go
@@ -19,9 +19,10 @@ import (
"gorm.io/gorm"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/relation"
"github.com/OpenIMSDK/protocol/constant"
"github.com/OpenIMSDK/tools/utils"
+
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/relation"
)
type ConversationGorm struct {
diff --git a/pkg/common/db/relation/friend_model.go b/pkg/common/db/relation/friend_model.go
index 4b119c1f8..4ab77132d 100644
--- a/pkg/common/db/relation/friend_model.go
+++ b/pkg/common/db/relation/friend_model.go
@@ -19,8 +19,9 @@ import (
"gorm.io/gorm"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/relation"
"github.com/OpenIMSDK/tools/utils"
+
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/relation"
)
type FriendGorm struct {
diff --git a/pkg/common/db/relation/friend_request_model.go b/pkg/common/db/relation/friend_request_model.go
index d17cc680b..0abb06b44 100644
--- a/pkg/common/db/relation/friend_request_model.go
+++ b/pkg/common/db/relation/friend_request_model.go
@@ -19,8 +19,9 @@ import (
"gorm.io/gorm"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/relation"
"github.com/OpenIMSDK/tools/utils"
+
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/relation"
)
type FriendRequestGorm struct {
diff --git a/pkg/common/db/relation/group_member_model.go b/pkg/common/db/relation/group_member_model.go
index da6a58398..57b2d33e7 100644
--- a/pkg/common/db/relation/group_member_model.go
+++ b/pkg/common/db/relation/group_member_model.go
@@ -19,10 +19,11 @@ import (
"gorm.io/gorm"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/relation"
"github.com/OpenIMSDK/protocol/constant"
"github.com/OpenIMSDK/tools/ormutil"
"github.com/OpenIMSDK/tools/utils"
+
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/relation"
)
var _ relation.GroupMemberModelInterface = (*GroupMemberGorm)(nil)
diff --git a/pkg/common/db/relation/group_model.go b/pkg/common/db/relation/group_model.go
index 853f5dccd..13e96b611 100644
--- a/pkg/common/db/relation/group_model.go
+++ b/pkg/common/db/relation/group_model.go
@@ -22,10 +22,11 @@ import (
"gorm.io/gorm"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/relation"
"github.com/OpenIMSDK/tools/errs"
"github.com/OpenIMSDK/tools/ormutil"
"github.com/OpenIMSDK/tools/utils"
+
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/relation"
)
var _ relation.GroupModelInterface = (*GroupGorm)(nil)
diff --git a/pkg/common/db/relation/group_request_model.go b/pkg/common/db/relation/group_request_model.go
index 7c0497aaf..05f94c34b 100644
--- a/pkg/common/db/relation/group_request_model.go
+++ b/pkg/common/db/relation/group_request_model.go
@@ -21,8 +21,9 @@ import (
"gorm.io/gorm"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/relation"
"github.com/OpenIMSDK/tools/utils"
+
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/relation"
)
type GroupRequestGorm struct {
diff --git a/pkg/common/db/relation/mysql_init.go b/pkg/common/db/relation/mysql_init.go
index 9b8188ac4..9e06a9815 100644
--- a/pkg/common/db/relation/mysql_init.go
+++ b/pkg/common/db/relation/mysql_init.go
@@ -21,11 +21,12 @@ import (
mysqlDriver "github.com/go-sql-driver/mysql"
"gorm.io/driver/mysql"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
"github.com/OpenIMSDK/tools/errs"
"github.com/OpenIMSDK/tools/log"
"github.com/OpenIMSDK/tools/mw/specialerror"
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
+
"gorm.io/gorm"
"gorm.io/gorm/logger"
)
diff --git a/pkg/common/db/relation/object_model.go b/pkg/common/db/relation/object_model.go
index 02ba0bcf0..8a97a49d5 100644
--- a/pkg/common/db/relation/object_model.go
+++ b/pkg/common/db/relation/object_model.go
@@ -19,8 +19,9 @@ import (
"gorm.io/gorm"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/relation"
"github.com/OpenIMSDK/tools/errs"
+
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/relation"
)
type ObjectInfoGorm struct {
diff --git a/pkg/common/db/relation/user_model.go b/pkg/common/db/relation/user_model.go
index b7c592eeb..f97abdefe 100644
--- a/pkg/common/db/relation/user_model.go
+++ b/pkg/common/db/relation/user_model.go
@@ -22,8 +22,9 @@ import (
"gorm.io/gorm"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/relation"
"github.com/OpenIMSDK/tools/utils"
+
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/relation"
)
type UserGorm struct {
diff --git a/pkg/common/db/s3/cont/controller.go b/pkg/common/db/s3/cont/controller.go
index 01dbc787f..675d3a513 100644
--- a/pkg/common/db/s3/cont/controller.go
+++ b/pkg/common/db/s3/cont/controller.go
@@ -26,9 +26,10 @@ import (
"github.com/google/uuid"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/s3"
"github.com/OpenIMSDK/tools/errs"
"github.com/OpenIMSDK/tools/log"
+
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/s3"
)
func New(impl s3.Interface) *Controller {
diff --git a/pkg/common/db/table/unrelation/user.go b/pkg/common/db/table/unrelation/user.go
index 8664df262..1505829e5 100644
--- a/pkg/common/db/table/unrelation/user.go
+++ b/pkg/common/db/table/unrelation/user.go
@@ -23,7 +23,7 @@ const (
// UserModel collection structure.
type UserModel struct {
- UserID string `bson:"user_id" json:"userID"`
+ UserID string `bson:"user_id" json:"userID"`
UserIDList []string `bson:"user_id_list" json:"userIDList"`
}
diff --git a/pkg/common/db/unrelation/mongo.go b/pkg/common/db/unrelation/mongo.go
index b580f4dbd..f08bb56a4 100644
--- a/pkg/common/db/unrelation/mongo.go
+++ b/pkg/common/db/unrelation/mongo.go
@@ -17,18 +17,20 @@ package unrelation
import (
"context"
"fmt"
- "go.mongodb.org/mongo-driver/bson"
"strings"
"time"
+ "go.mongodb.org/mongo-driver/bson"
+
"go.mongodb.org/mongo-driver/mongo"
"go.mongodb.org/mongo-driver/mongo/options"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/unrelation"
"github.com/OpenIMSDK/tools/errs"
"github.com/OpenIMSDK/tools/mw/specialerror"
"github.com/OpenIMSDK/tools/utils"
+
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/unrelation"
)
const (
@@ -116,10 +118,10 @@ func (m *Mongo) createMongoIndex(collection string, isUnique bool, keys ...strin
for _, key := range keys {
if strings.HasPrefix(key, "-") {
keysDoc = append(keysDoc, bson.E{Key: strings.TrimLeft(key, "-"), Value: -1})
- //keysDoc = keysDoc.Append(strings.TrimLeft(key, "-"), bsonx.Int32(-1))
+ // keysDoc = keysDoc.Append(strings.TrimLeft(key, "-"), bsonx.Int32(-1))
} else {
keysDoc = append(keysDoc, bson.E{Key: key, Value: 1})
- //keysDoc = keysDoc.Append(key, bsonx.Int32(1))
+ // keysDoc = keysDoc.Append(key, bsonx.Int32(1))
}
}
// create index
diff --git a/pkg/common/db/unrelation/msg.go b/pkg/common/db/unrelation/msg.go
index 27f7cf5ce..bdd189f38 100644
--- a/pkg/common/db/unrelation/msg.go
+++ b/pkg/common/db/unrelation/msg.go
@@ -31,10 +31,11 @@ import (
"go.mongodb.org/mongo-driver/mongo/options"
"google.golang.org/protobuf/proto"
- table "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/unrelation"
"github.com/OpenIMSDK/protocol/sdkws"
"github.com/OpenIMSDK/tools/errs"
"github.com/OpenIMSDK/tools/utils"
+
+ table "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/unrelation"
)
var ErrMsgListNotExist = errors.New("user not have msg in mongoDB")
diff --git a/pkg/common/db/unrelation/super_group.go b/pkg/common/db/unrelation/super_group.go
index e93ab2b43..5a9bfccc8 100644
--- a/pkg/common/db/unrelation/super_group.go
+++ b/pkg/common/db/unrelation/super_group.go
@@ -21,8 +21,9 @@ import (
"go.mongodb.org/mongo-driver/mongo"
"go.mongodb.org/mongo-driver/mongo/options"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/unrelation"
"github.com/OpenIMSDK/tools/utils"
+
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/unrelation"
)
func NewSuperGroupMongoDriver(database *mongo.Database) unrelation.SuperGroupModelInterface {
diff --git a/pkg/common/http/http_client.go b/pkg/common/http/http_client.go
index a646f774e..4a132526f 100644
--- a/pkg/common/http/http_client.go
+++ b/pkg/common/http/http_client.go
@@ -24,11 +24,12 @@ import (
urlLib "net/url"
"time"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/callbackstruct"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
"github.com/OpenIMSDK/protocol/constant"
"github.com/OpenIMSDK/tools/errs"
"github.com/OpenIMSDK/tools/log"
+
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/callbackstruct"
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
)
var client http.Client
diff --git a/pkg/common/kafka/producer.go b/pkg/common/kafka/producer.go
index 754f2166d..938757d40 100644
--- a/pkg/common/kafka/producer.go
+++ b/pkg/common/kafka/producer.go
@@ -19,12 +19,13 @@ import (
"errors"
"time"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
"github.com/OpenIMSDK/protocol/constant"
log "github.com/OpenIMSDK/tools/log"
"github.com/OpenIMSDK/tools/mcontext"
"github.com/OpenIMSDK/tools/utils"
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
+
"github.com/Shopify/sarama"
"google.golang.org/protobuf/proto"
diff --git a/pkg/common/startrpc/start.go b/pkg/common/startrpc/start.go
index d78aa1ff4..9b37734e4 100644
--- a/pkg/common/startrpc/start.go
+++ b/pkg/common/startrpc/start.go
@@ -16,11 +16,12 @@ package startrpc
import (
"fmt"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
"net"
"strconv"
"time"
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
+
grpcPrometheus "github.com/grpc-ecosystem/go-grpc-prometheus"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
diff --git a/pkg/msgprocessor/conversation.go b/pkg/msgprocessor/conversation.go
index b24794af8..c0d97dc44 100644
--- a/pkg/msgprocessor/conversation.go
+++ b/pkg/msgprocessor/conversation.go
@@ -1,11 +1,26 @@
+// 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 msgprocessor
import (
+ "sort"
+ "strings"
+
"github.com/OpenIMSDK/protocol/constant"
"github.com/OpenIMSDK/protocol/sdkws"
"google.golang.org/protobuf/proto"
- "sort"
- "strings"
)
func GetNotificationConversationID(msg *sdkws.MsgData) string {
diff --git a/pkg/msgprocessor/options.go b/pkg/msgprocessor/options.go
index 920a6a2ea..c17c7cb05 100644
--- a/pkg/msgprocessor/options.go
+++ b/pkg/msgprocessor/options.go
@@ -16,8 +16,10 @@ package msgprocessor
import "github.com/OpenIMSDK/protocol/constant"
-type Options map[string]bool
-type OptionsOpt func(Options)
+type (
+ Options map[string]bool
+ OptionsOpt func(Options)
+)
func NewOptions(opts ...OptionsOpt) Options {
options := make(map[string]bool, 11)
diff --git a/pkg/rpcclient/auth.go b/pkg/rpcclient/auth.go
index cbf1324e0..69f21f38d 100644
--- a/pkg/rpcclient/auth.go
+++ b/pkg/rpcclient/auth.go
@@ -19,9 +19,10 @@ import (
"google.golang.org/grpc"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
"github.com/OpenIMSDK/protocol/auth"
"github.com/OpenIMSDK/tools/discoveryregistry"
+
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
)
func NewAuth(discov discoveryregistry.SvcDiscoveryRegistry) *Auth {
diff --git a/pkg/rpcclient/conversation.go b/pkg/rpcclient/conversation.go
index 2b7d2c392..b123a6212 100644
--- a/pkg/rpcclient/conversation.go
+++ b/pkg/rpcclient/conversation.go
@@ -20,10 +20,11 @@ import (
"google.golang.org/grpc"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
pbConversation "github.com/OpenIMSDK/protocol/conversation"
"github.com/OpenIMSDK/tools/discoveryregistry"
"github.com/OpenIMSDK/tools/errs"
+
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
)
type Conversation struct {
diff --git a/pkg/rpcclient/friend.go b/pkg/rpcclient/friend.go
index f1aaaa319..1bd004dd5 100644
--- a/pkg/rpcclient/friend.go
+++ b/pkg/rpcclient/friend.go
@@ -19,10 +19,11 @@ import (
"google.golang.org/grpc"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
"github.com/OpenIMSDK/protocol/friend"
sdkws "github.com/OpenIMSDK/protocol/sdkws"
"github.com/OpenIMSDK/tools/discoveryregistry"
+
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
)
type Friend struct {
diff --git a/pkg/rpcclient/group.go b/pkg/rpcclient/group.go
index 57dcd0fa5..7dc333de6 100644
--- a/pkg/rpcclient/group.go
+++ b/pkg/rpcclient/group.go
@@ -20,13 +20,14 @@ import (
"google.golang.org/grpc"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
"github.com/OpenIMSDK/protocol/constant"
"github.com/OpenIMSDK/protocol/group"
"github.com/OpenIMSDK/protocol/sdkws"
"github.com/OpenIMSDK/tools/discoveryregistry"
"github.com/OpenIMSDK/tools/errs"
"github.com/OpenIMSDK/tools/utils"
+
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
)
type Group struct {
diff --git a/pkg/rpcclient/msg.go b/pkg/rpcclient/msg.go
index 8e9416af9..205261dd9 100644
--- a/pkg/rpcclient/msg.go
+++ b/pkg/rpcclient/msg.go
@@ -21,13 +21,14 @@ import (
"google.golang.org/grpc"
"google.golang.org/protobuf/proto"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
"github.com/OpenIMSDK/protocol/constant"
"github.com/OpenIMSDK/protocol/msg"
"github.com/OpenIMSDK/protocol/sdkws"
"github.com/OpenIMSDK/tools/discoveryregistry"
"github.com/OpenIMSDK/tools/log"
"github.com/OpenIMSDK/tools/utils"
+
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
// "google.golang.org/protobuf/proto".
)
diff --git a/pkg/rpcclient/notification/conevrsation.go b/pkg/rpcclient/notification/conevrsation.go
index a5f57c570..d92ee82a0 100644
--- a/pkg/rpcclient/notification/conevrsation.go
+++ b/pkg/rpcclient/notification/conevrsation.go
@@ -17,9 +17,10 @@ package notification
import (
"context"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/rpcclient"
"github.com/OpenIMSDK/protocol/constant"
"github.com/OpenIMSDK/protocol/sdkws"
+
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/rpcclient"
)
type ConversationNotificationSender struct {
@@ -32,7 +33,8 @@ func NewConversationNotificationSender(msgRpcClient *rpcclient.MessageRpcClient)
// SetPrivate调用.
func (c *ConversationNotificationSender) ConversationSetPrivateNotification(ctx context.Context, sendID, recvID string,
- isPrivateChat bool, conversationID string) error {
+ isPrivateChat bool, conversationID string,
+) error {
tips := &sdkws.ConversationSetPrivateTips{
RecvID: recvID,
SendID: sendID,
diff --git a/pkg/rpcclient/notification/friend.go b/pkg/rpcclient/notification/friend.go
index ddce86c8c..213d9cdfe 100644
--- a/pkg/rpcclient/notification/friend.go
+++ b/pkg/rpcclient/notification/friend.go
@@ -19,13 +19,14 @@ import (
"github.com/OpenIMSDK/tools/mcontext"
+ "github.com/OpenIMSDK/protocol/constant"
+ pbFriend "github.com/OpenIMSDK/protocol/friend"
+ "github.com/OpenIMSDK/protocol/sdkws"
+
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/convert"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/controller"
relationTb "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/relation"
"github.com/OpenIMSDK/Open-IM-Server/pkg/rpcclient"
- "github.com/OpenIMSDK/protocol/constant"
- pbFriend "github.com/OpenIMSDK/protocol/friend"
- "github.com/OpenIMSDK/protocol/sdkws"
)
type FriendNotificationSender struct {
diff --git a/pkg/rpcclient/notification/group.go b/pkg/rpcclient/notification/group.go
index fdf77500f..1b8935654 100644
--- a/pkg/rpcclient/notification/group.go
+++ b/pkg/rpcclient/notification/group.go
@@ -18,9 +18,6 @@ import (
"context"
"fmt"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/controller"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/relation"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/rpcclient"
"github.com/OpenIMSDK/protocol/constant"
pbGroup "github.com/OpenIMSDK/protocol/group"
"github.com/OpenIMSDK/protocol/sdkws"
@@ -28,6 +25,10 @@ import (
"github.com/OpenIMSDK/tools/log"
"github.com/OpenIMSDK/tools/mcontext"
"github.com/OpenIMSDK/tools/utils"
+
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/controller"
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/relation"
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/rpcclient"
)
func NewGroupNotificationSender(
diff --git a/pkg/rpcclient/notification/msg.go b/pkg/rpcclient/notification/msg.go
index ba5aef684..53e66fc7d 100644
--- a/pkg/rpcclient/notification/msg.go
+++ b/pkg/rpcclient/notification/msg.go
@@ -17,9 +17,10 @@ package notification
import (
"context"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/rpcclient"
"github.com/OpenIMSDK/protocol/constant"
"github.com/OpenIMSDK/protocol/sdkws"
+
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/rpcclient"
)
type MsgNotificationSender struct {
diff --git a/pkg/rpcclient/push.go b/pkg/rpcclient/push.go
index 4401221c3..7b7adcfa5 100644
--- a/pkg/rpcclient/push.go
+++ b/pkg/rpcclient/push.go
@@ -19,9 +19,10 @@ import (
"google.golang.org/grpc"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
"github.com/OpenIMSDK/protocol/push"
"github.com/OpenIMSDK/tools/discoveryregistry"
+
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
)
type Push struct {
diff --git a/pkg/rpcclient/third.go b/pkg/rpcclient/third.go
index c01ab4d0c..015702a93 100644
--- a/pkg/rpcclient/third.go
+++ b/pkg/rpcclient/third.go
@@ -23,9 +23,10 @@ import (
"google.golang.org/grpc"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
"github.com/OpenIMSDK/protocol/third"
"github.com/OpenIMSDK/tools/discoveryregistry"
+
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
)
type Third struct {
diff --git a/pkg/rpcclient/user.go b/pkg/rpcclient/user.go
index 6ca60dc75..3c24efbbd 100644
--- a/pkg/rpcclient/user.go
+++ b/pkg/rpcclient/user.go
@@ -16,17 +16,19 @@ package rpcclient
import (
"context"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/authverify"
"strings"
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/authverify"
+
"google.golang.org/grpc"
- "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
"github.com/OpenIMSDK/protocol/sdkws"
"github.com/OpenIMSDK/protocol/user"
"github.com/OpenIMSDK/tools/discoveryregistry"
"github.com/OpenIMSDK/tools/errs"
"github.com/OpenIMSDK/tools/utils"
+
+ "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
)
type User struct {
@@ -154,6 +156,7 @@ func (u *UserRpcClient) GetAllUserIDs(ctx context.Context, pageNumber, showNumbe
}
return resp.UserIDs, nil
}
+
func (u *UserRpcClient) SetUserStatus(ctx context.Context, userID string, status int32, platformID int) error {
_, err := u.Client.SetUserStatus(ctx, &user.SetUserStatusReq{StatusList: []*user.OnlineStatus{{UserID: userID, Status: status, PlatformID: int32(platformID)}}})
return err
diff --git a/scripts/advertise.sh b/scripts/advertise.sh
index 9d47b5ac7..75f474bfe 100755
--- a/scripts/advertise.sh
+++ b/scripts/advertise.sh
@@ -1,4 +1,18 @@
#!/usr/bin/env bash
+# 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.
+
set -e
set -o pipefail
From ffa3b53065d6ed5329781b0a52317d5bc4200ff5 Mon Sep 17 00:00:00 2001
From: Xinwei Xiong <3293172751NSS@gmail.com>
Date: Fri, 4 Aug 2023 22:12:40 +0800
Subject: [PATCH 22/59] Update images.md (#774)
---
docs/conversions/images.md | 3 +++
1 file changed, 3 insertions(+)
diff --git a/docs/conversions/images.md b/docs/conversions/images.md
index 70401ec07..44bd7b5bf 100644
--- a/docs/conversions/images.md
+++ b/docs/conversions/images.md
@@ -11,6 +11,9 @@ OpenIM's versions correspond to GitHub's tag versions. Each time we release a ne
2. **Alibaba Cloud (registry.cn-hangzhou.aliyuncs.com):** For users in Mainland China, we also host OpenIM's Docker images on Alibaba Cloud to provide faster pull speeds. You can view all Alibaba Cloud images on this [page](https://cr.console.aliyun.com/cn-hangzhou/instances/repositories) of Alibaba Cloud Image Service (note that you need to log in to your Alibaba Cloud account first).
3. **Docker Hub (docker.io):** Docker Hub is the most commonly used Docker image hosting platform, and we also host OpenIM's images there to facilitate developers worldwide. You can view all Docker Hub images on the [OpenIM's Docker Hub page](https://hub.docker.com/r/openim).
+## Base images design
+
++ [https://github.com/openim-sigs/openim-base-image](https://github.com/openim-sigs/openim-base-image)
## OpenIM Image Design and Usage Guide
From d8fd4bfcf1ff9eed57d37d1c679ecb44bd705b01 Mon Sep 17 00:00:00 2001
From: Xinwei Xiong <3293172751NSS@gmail.com>
Date: Sun, 6 Aug 2023 13:37:16 +0800
Subject: [PATCH 23/59] Update README.md (#792)
---
README.md | 162 +++++++++++++++++++++++++++++++++++++++---------------
1 file changed, 117 insertions(+), 45 deletions(-)
diff --git a/README.md b/README.md
index 5ed6664db..98d6a8519 100644
--- a/README.md
+++ b/README.md
@@ -29,34 +29,86 @@
## What is Open-IM-Server
-Open-IM-Server is an instant messaging server developed using pure Golang, adopting JSON over WebSocket as the communication protocol. In Open-IM-Server, everything is a message, so you can easily extend custom messages without modifying the server code. With a microservice architecture, Open-IM-Server can be deployed using clusters. By deploying Open-IM-Server on a server, developers can quickly integrate instant messaging and real-time networking features into their applications, ensuring the security and privacy of business data.
+Open-IM-Server is a robust instant messaging server engineered using pure Golang, leveraging JSON over WebSocket for communication. The server treats everything as a message, facilitating straightforward customization without modifying the server code. Its microservice architecture enables deployment using clusters, ensuring high performance and scalability.
-Open-IM-Server is not a standalone product and does not include account registration and login services. For your convenience, we have open-sourced the [chat repository](https://github.com/OpenIMSDK/chat) which includes login and registration functionality. By deploying the chat business server alongside Open-IM-Server, a chat product can be set up.
+Whether you're looking to integrate instant messaging or real-time networking into your applications, Open-IM-Server is your go-to solution! :rocket:
-## Features
+It's important to note that Open-IM-Server isn't a standalone product, and it doesn't include account registration and login services. However, we've made your life easier by open-sourcing the [chat repository](https://github.com/OpenIMSDK/chat) that includes login and registration features. Deploying the chat business server alongside Open-IM-Server quickly sets up a comprehensive chat product. :busts_in_silhouette:
-- Open source
-- Easy to integrate
-- Excellent scalability
-- High performance
-- Lightweight
-- Supports multiple protocols
+## :star2: Why OpenIM
-## Community
-- Visit the official website: [OpenIM Developer Documentation](https://www.openim.online/)
+1. Comprehensive Message Type Support :speech_balloon:
+ ✅ Supports almost all types of messages, including text, images, emojis, voice, video, geographical location, files, quotes, business cards, system notifications, custom messages and more :mailbox_with_mail:
-## Quick Start
+ ✅ Supports one-on-one and multi-person audio and video calls :telephone_receiver:
-### Deploying with docker-compose
+ ✅ Provides terminal support for multiple platforms such as iOS, Android, Flutter, uni-app, ReactNative, Electron, Web, H5 :iphone:
+
+2. Efficient Meetings Anytime, Anywhere :earth_americas:
+
+ ✅ Based on IM (Instant Messaging) with 100% reliable forced signaling capabilities, it paves the way for IM systems, deeply integrated with chat applications :link:
+
+ ✅ Supports hundreds of people in a single meeting, with subscription numbers reaching thousands, and server-side audio and video recording :video_camera:
+
+3. One-on-one and Group Chats for Various Social Scenarios :busts_in_silhouette:
+
+ ✅ OpenIM has four roles: application administrator, group owner, group administrator, and regular member :man_teacher:
+
+ ✅ Powerful group features such as muting, group announcements, group validation, unlimited group members, and loading group messages as needed :loudspeaker:
+
+4. Unique Features :star2:
+
+ ✅ Supports read-and-burn private chats, customizable duration :fire:
+
+ ✅ Message editing function broadens social scenarios, making instant communication more diverse and interesting :pencil2:
+
+5. Open Source :open_hands:
+
+ ✅ The code of OpenIM is open source, self-controlled data, aimed at building a globally leading IM open source community, including client SDK and server :globe_with_meridians:
+
+ ✅ Based on open source Server, many excellent open source projects have been developed, such as [OpenKF](https://github.com/OpenIMSDK/OpenKF) (Open source AI customer service system) ✨
+
+6. Easy to Expand :wrench:
+
+ ✅ The OpenIM server is implemented in Golang, introducing an innovative "everything is a message" communication model, simplifying the implementation of custom messages and extended features :computer:
+
+7. High Performance :racing_car:
+
+ ✅ OpenIM supports a hierarchical governance architecture in the cluster, tested by a large number of users, and abstracts the storage model of online messages, offline messages, and historical messages :rocket:
+
+8. Full Platform Support :tv:
+
+ ✅ Supports native iOS, Android; cross-platform Flutter, uni-app, ReactNative; major web front-end frameworks such as React, Vue; applets; and PC platforms supported by Electron :desktop_computer:
+
+9. The ultimate deployment experience 🤖
+
+ ✅ Supports cluster deployment
+
+ ✅ Supports multi-architecture mirroring
+
+10. A large ecosystem of open source communities 🤲
+
+
+## :busts_in_silhouette: Community
+
+Explore our [OpenIM Developer Documentation](https://www.openim.online/) for more details.
+
+## :rocket: Quick Start
+
+ Deploying with Docker Compose
1. Clone the project
```bash
# choose what you need
-BRANCH=release-v3.0
+BRANCH=release-v3.1
git clone -b $BRANCH https://github.com/OpenIMSDK/Open-IM-Server openim && export openim=$(pwd)/openim && cd $openim && make build
```
+> **Note**
+>
+> Read our release policy: https://github.com/OpenIMSDK/Open-IM-Server/blob/main/docs/conversions/version.md
+
2. Modify .env
```bash
@@ -70,7 +122,7 @@ DATA_DIR=./ #designate large disk directory
3. Deploy and start
> **Note**
-> This command can only be executed once. It will modify the component passwords in docker-compose based on the PASSWORD variable in .env, and modify the component passwords in config/config.yaml. If the password in .env changes, you need to first execute docker-compose down; rm components -rf and then execute this command.
+> This command can only be executed once. It will modify the component passwords in docker-compose based on the `PASSWORD` variable in `.env`, and modify the component passwords in `config/config.yaml`. If the password in `.env` changes, you need to first execute `docker-compose down`; `rm components -rf` and then execute this command.
```
make install
@@ -84,9 +136,9 @@ make check

+
-
-### Compile from source
+ Compile from Source
Ur need `Go 1.18` or higher version, and `make`.
@@ -97,6 +149,7 @@ Version Details: https://github.com/OpenIMSDK/Open-IM-Server/blob/main/docs/conv
BRANCH=release-v3.1
git clone -b $BRANCH https://github.com/OpenIMSDK/Open-IM-Server openim && export openim=$(pwd)/openim && cd $openim && make build
```
+
Read about the [OpenIM Version Policy](https://github.com/OpenIMSDK/Open-IM-Server/blob/main/docs/conversions/version.md)
`make help` to help you see the instructions supported by OpenIM.
@@ -105,7 +158,9 @@ All services have been successfully built as shown in the figure

-### Component Configuration Instructions
+
+
+ Component Configuration Instructions
The config/config.yaml file has detailed configuration instructions for the storage components.
@@ -113,7 +168,7 @@ The config/config.yaml file has detailed configuration instructions for the stor
- Used for RPC service discovery and registration, cluster support.
- ```
+ ```bash
zookeeper:
schema: openim #Not recommended to modify
address: [ 127.0.0.1:2181 ] #address
@@ -125,7 +180,7 @@ The config/config.yaml file has detailed configuration instructions for the stor
- Used for storing users, relationships, and groups, supports master-slave database.
- ```
+ ```bash
mysql:
address: [ 127.0.0.1:13306 ] #address
username: root #username
@@ -142,7 +197,7 @@ The config/config.yaml file has detailed configuration instructions for the stor
- Used for storing offline messages, supports mongo sharded clusters.
- ```
+ ```bash
mongo:
uri: #Use this value directly if not empty
address: [ 127.0.0.1:37017 ] #address
@@ -156,7 +211,7 @@ The config/config.yaml file has detailed configuration instructions for the stor
- Used for storing message sequence numbers, latest messages, user tokens, and mysql cache, supports cluster deployment.
- ```
+ ```bash
redis:
address: [ 127.0.0.1:16379 ] #address
username: #username
@@ -167,7 +222,7 @@ The config/config.yaml file has detailed configuration instructions for the stor
- Used for message queues, for message decoupling, supports cluster deployment.
- ```
+ ```bash
kafka:
username: #username
password: #password
@@ -188,27 +243,31 @@ The config/config.yaml file has detailed configuration instructions for the stor
msgToModify: modify
```
-### Start and Stop Services
+
+
+ Start and Stop Services
Start services
```
-./start_all.sh;
+./scripts/start_all.sh;
```
Check services
```
-./check_all.sh
+./scripts/check_all.sh
```
Stop services
```
-./stop_all.sh
+./scripts/stop_all.sh
```
-### Open IM Ports
+
+
+ Open IM Ports
| TCP Port | Description | Operation |
| --------- | ------------------------------------------------------------ | ----------------------------------------------------- |
@@ -216,42 +275,55 @@ Stop services
| TCP:10002 | api port, such as user, friend, group, message interfaces. | Port release or nginx reverse proxy, and firewall off |
| TCP:10005 | Required when choosing minio storage (openIM uses minio storage by default) | Port release or nginx reverse proxy, and firewall off |
-### Open Chat Ports
+
+
+ Open Chat Ports
+
++ chat warehouse: https://github.com/OpenIMSDK/chat
| TCP Port | Description | Operation |
| --------- | --------------------------------------------------- | ----------------------------------------------------- |
| TCP:10008 | Business system, such as registration, login etc | Port release or nginx reverse proxy, and firewall off |
| TCP:10009 | Management backend, such as statistics, banning etc | Port release or nginx reverse proxy, and firewall off |
-## Relationship Between APP and OpenIM
+
-OpenIM is an open source instant messaging component, it is not an independent product. This image shows the relationship between AppServer, AppClient, Open-IM-Server and Open-IM-SDK.
+## :link: Relationship Between APP and OpenIM
-
+OpenIM isn't just an open-source instant messaging component, it's an integral part of your application ecosystem. Check out this diagram to understand how AppServer, AppClient, Open-IM-Server, and Open-IM-SDK interact.
-## Overall Architecture
+
-
+## :building_construction: Overall Architecture
-## To start developing OpenIM
-The [community repository](https://github.com/OpenIMSDK/community) hosts all information about building Kubernetes from source, how to contribute code and documentation, who to contact about what, etc.
+Delve into the heart of Open-IM-Server's functionality with our architecture diagram.
+
-## Contributing
+## :hammer_and_wrench: To start developing OpenIM
-Contributions to this project are welcome! Please see [CONTRIBUTING.md](./CONTRIBUTING.md) for details.
+The [community repository](https://github.com/OpenIMSDK/community) hosts all the information you need to start contributing to OpenIM.
-## Community Meetings
-We want anyone to get involved in our community, we offer gifts and rewards, and we welcome you to join us every Thursday night.
+## :heart: Contributing
-We take notes of each [biweekly meeting](https://github.com/OpenIMSDK/Open-IM-Server/issues/381) in [GitHub discussions](https://github.com/OpenIMSDK/Open-IM-Server/discussions/categories/meeting), and our minutes are written in [Google Docs](https://docs.google.com/document/d/1nx8MDpuG74NASx081JcCpxPgDITNTpIIos0DS6Vr9GU/edit?usp=sharing).
+We welcome all contributions to the project! For more details, please see [CONTRIBUTING.md](./CONTRIBUTING.md).
+## :calendar: Community Meetings
-## Who are using Open-IM-Server
-The [user case studies](https://github.com/OpenIMSDK/community/blob/main/ADOPTERS.md) page includes the user list of the project. You can leave a [📝comment](https://github.com/OpenIMSDK/Open-IM-Server/issues/379) to let us know your use case.
+We love community involvement! Join us for our biweekly meetings every Thursday night. We even offer gifts and rewards! :gift:
+
+You can find the meeting minutes on [GitHub discussions](https://github.com/OpenIMSDK/Open-IM-Server/discussions/categories/meeting) and our [Google Docs](https://docs.google.com/document/d/1nx8MDpuG74NASx081JcCpxPgDITNTpIIos0DS6Vr9GU/edit?usp=sharing).
+
+## :eyes: Who are using Open-IM-Server
+
+Check out our [user case studies](https://github.com/OpenIMSDK/community/blob/main/ADOPTERS.md) page for a list of the project users. Don't hesitate to leave a [📝comment](https://github.com/OpenIMSDK/Open-IM-Server/issues/379) and share your use case.

-## License
+## :page_facing_up: License
+
+Open-IM-Server is licensed under the Apache 2.0 license. See the [LICENSE](./LICENSE) file for details.
+
+## :cloud: Docker Images
-Open-IM-Server is under the Apache 2.0 license. See the [LICENSE](./LICENSE) file for details
+Our Docker images are hosted not only on GitHub but also on Alibaba Cloud and Docker Hub supporting multiple architectures. Visit [our GitHub packages](https://github.com/orgs/OpenIMSDK/packages?repo_name=Open-IM-Server) and read our [version management document](https://github.com/OpenIMSDK/Open-IM-Server/blob/main/docs/conversions/version.md) for more information.
From 5d34e3f08163a59afddb1b4f1aa6def40bfa9b5c Mon Sep 17 00:00:00 2001
From: Xinwei Xiong <3293172751NSS@gmail.com>
Date: Sun, 6 Aug 2023 15:08:11 +0800
Subject: [PATCH 24/59] Update README.md (#793)
---
README.md | 114 ++++++++++++++++++++++++++++++++++--------------------
1 file changed, 73 insertions(+), 41 deletions(-)
diff --git a/README.md b/README.md
index 98d6a8519..86c02d3da 100644
--- a/README.md
+++ b/README.md
@@ -22,12 +22,14 @@
English •
- 中文
+ 简体中文 •
+ Docs
+
-## What is Open-IM-Server
+## ✨ About OpenIM
Open-IM-Server is a robust instant messaging server engineered using pure Golang, leveraging JSON over WebSocket for communication. The server treats everything as a message, facilitating straightforward customization without modifying the server code. Its microservice architecture enables deployment using clusters, ensuring high performance and scalability.
@@ -37,61 +39,71 @@ It's important to note that Open-IM-Server isn't a standalone product, and it do
## :star2: Why OpenIM
-1. Comprehensive Message Type Support :speech_balloon:
- ✅ Supports almost all types of messages, including text, images, emojis, voice, video, geographical location, files, quotes, business cards, system notifications, custom messages and more :mailbox_with_mail:
+**🔍 Function screenshot display**
- ✅ Supports one-on-one and multi-person audio and video calls :telephone_receiver:
+
- ✅ Provides terminal support for multiple platforms such as iOS, Android, Flutter, uni-app, ReactNative, Electron, Web, H5 :iphone:
+| multiple message | Efficient meetings |
+| :------------------------: | :--------------------------------: |
+|  |  |
+| One-to-one and group chats | Special features - Custom messages |
+|  |  |
-2. Efficient Meetings Anytime, Anywhere :earth_americas:
+
- ✅ Based on IM (Instant Messaging) with 100% reliable forced signaling capabilities, it paves the way for IM systems, deeply integrated with chat applications :link:
+1. **Comprehensive Message Type Support :speech_balloon:**
+ ✅ Supports almost all types of messages, including text, images, emojis, voice, video, geographical location, files, quotes, business cards, system notifications, custom messages and more
+ ✅ Supports one-on-one and multi-person audio and video calls
- ✅ Supports hundreds of people in a single meeting, with subscription numbers reaching thousands, and server-side audio and video recording :video_camera:
+ ✅ Provides terminal support for multiple platforms such as iOS, Android, Flutter, uni-app, ReactNative, Electron, Web, H5
-3. One-on-one and Group Chats for Various Social Scenarios :busts_in_silhouette:
+2. **Efficient Meetings Anytime, Anywhere :earth_americas:**
- ✅ OpenIM has four roles: application administrator, group owner, group administrator, and regular member :man_teacher:
+ ✅ Based on IM (Instant Messaging) with 100% reliable forced signaling capabilities, it paves the way for IM systems, deeply integrated with chat applications
- ✅ Powerful group features such as muting, group announcements, group validation, unlimited group members, and loading group messages as needed :loudspeaker:
+ ✅ Supports hundreds of people in a single meeting, with subscription numbers reaching thousands, and server-side audio and video recording
-4. Unique Features :star2:
+3. **One-on-one and Group Chats for Various Social Scenarios :busts_in_silhouette:**
- ✅ Supports read-and-burn private chats, customizable duration :fire:
+ ✅ OpenIM has four roles: application administrator, group owner, group administrator, and regular member
- ✅ Message editing function broadens social scenarios, making instant communication more diverse and interesting :pencil2:
+ ✅ Powerful group features such as muting, group announcements, group validation, unlimited group members, and loading group messages as needed
-5. Open Source :open_hands:
+4. **Unique Features :star2:**
- ✅ The code of OpenIM is open source, self-controlled data, aimed at building a globally leading IM open source community, including client SDK and server :globe_with_meridians:
+ ✅ Supports read-and-burn private chats, customizable duration
- ✅ Based on open source Server, many excellent open source projects have been developed, such as [OpenKF](https://github.com/OpenIMSDK/OpenKF) (Open source AI customer service system) ✨
+ ✅ Message editing function broadens social scenarios, making instant communication more diverse and interesting
-6. Easy to Expand :wrench:
+5. **Open Source :open_hands:**
- ✅ The OpenIM server is implemented in Golang, introducing an innovative "everything is a message" communication model, simplifying the implementation of custom messages and extended features :computer:
+ ✅ The code of OpenIM is open source, self-controlled data, aimed at building a globally leading IM open source community, including client SDK and server
-7. High Performance :racing_car:
+ ✅ Based on open source Server, many excellent open source projects have been developed, such as [OpenKF](https://github.com/OpenIMSDK/OpenKF) (Open source AI customer service system)
- ✅ OpenIM supports a hierarchical governance architecture in the cluster, tested by a large number of users, and abstracts the storage model of online messages, offline messages, and historical messages :rocket:
+6. **Easy to Expand :wrench:**
-8. Full Platform Support :tv:
+ ✅ The OpenIM server is implemented in Golang, introducing an innovative "everything is a message" communication model, simplifying the implementation of custom messages and extended features
- ✅ Supports native iOS, Android; cross-platform Flutter, uni-app, ReactNative; major web front-end frameworks such as React, Vue; applets; and PC platforms supported by Electron :desktop_computer:
+7. **High Performance :racing_car:**
-9. The ultimate deployment experience 🤖
+ ✅ OpenIM supports a hierarchical governance architecture in the cluster, tested by a large number of users, and abstracts the storage model of online messages, offline messages, and historical messages
- ✅ Supports cluster deployment
+8. **Full Platform Support :tv:**
+
+ ✅ Supports native iOS, Android; cross-platform Flutter, uni-app, ReactNative; major web front-end frameworks such as React, Vue; applets; and PC platforms supported by Electron
- ✅ Supports multi-architecture mirroring
+9. **The ultimate deployment experience 🤖**
-10. A large ecosystem of open source communities 🤲
+ ✅ Supports cluster deployment
+ ✅ Supports multi-architecture mirroring, our Docker images are hosted not only on GitHub but also on Alibaba Cloud and Docker Hub supporting multiple architectures. Visit [our GitHub packages](https://github.com/orgs/OpenIMSDK/packages?repo_name=Open-IM-Server) and read our [version management document](https://github.com/OpenIMSDK/Open-IM-Server/blob/main/docs/conversions/version.md) for more information.
-## :busts_in_silhouette: Community
+10. **A large ecosystem of open source communities 🤲**
-Explore our [OpenIM Developer Documentation](https://www.openim.online/) for more details.
+ ✅ We have tens of thousands of users and many solutions to problems.
+
+ ✅ We have a large open source community called [OpenIMSDK](https://github.com/OpenIMSDK) that runs the core modules, we have an open source community called [openim-sigs](https://github.com/openim-sigs) to explore more IM-based infrastructure products.
## :rocket: Quick Start
@@ -302,28 +314,48 @@ Delve into the heart of Open-IM-Server's functionality with our architecture dia
## :hammer_and_wrench: To start developing OpenIM
-The [community repository](https://github.com/OpenIMSDK/community) hosts all the information you need to start contributing to OpenIM.
+OpenIM Our goal is to build a top-level open source community. We have a set of standards, in the [Community repository](https://github.com/OpenIMSDK/community).
+
+If you'd like to contribute to this Open-IM-Server repository, please read our [contributor documentation](https://github.com/OpenIMSDK/Open-IM-Server/blob/main/CONTRIBUTING.md).
-## :heart: Contributing
+Before you start, please make sure your changes are in demand. The best for that is to create a [new discussion](https://github.com/OpenIMSDK/Open-IM-Server/discussions/new/choose) OR [Slack Communication](https://join.slack.com/t/openimsdk/shared_invite/zt-1tmoj26uf-_FDy3dowVHBiGvLk9e5Xkg), or if you find an issue, [report it](https://github.com/OpenIMSDK/Open-IM-Server/issues/new/choose) first.
-We welcome all contributions to the project! For more details, please see [CONTRIBUTING.md](./CONTRIBUTING.md).
+- [Code Standards](https://github.com/OpenIMSDK/Open-IM-Server/blob/main/docs/conversions/go_code.md)
+- [Docker Images Standards](https://github.com/OpenIMSDK/Open-IM-Server/blob/main/docs/conversions/images.md)
+- [Directory Standards](https://github.com/OpenIMSDK/Open-IM-Server/blob/main/docs/conversions/directory.md)
+- [Commit Standards](https://github.com/OpenIMSDK/Open-IM-Server/blob/main/docs/conversions/commit.md)
+- [Versioning Standards](https://github.com/OpenIMSDK/Open-IM-Server/blob/main/docs/conversions/version.md)
+- [Interface Standards](https://github.com/OpenIMSDK/Open-IM-Server/blob/main/docs/conversions/api.md)
+- [Log Standards](https://github.com/OpenIMSDK/Open-IM-Server/blob/main/docs/conversions/log.md)
+- [Error Code Standards](https://github.com/OpenIMSDK/Open-IM-Server/blob/main/docs/conversions/error_code.md)
+
+## :busts_in_silhouette: Community
+
++ 📚 [OpenIM Community](https://github.com/OpenIMSDK/community)
++ 💕 [OpenIM Interest Group](https://github.com/Openim-sigs)
++ 🚀 [Join our Slack community](https://join.slack.com/t/openimsdk/shared_invite/zt-1tmoj26uf-_FDy3dowVHBiGvLk9e5Xkg)
++ :eyes: [Join our wechat (微信群)](https://openim-1253691595.cos.ap-nanjing.myqcloud.com/WechatIMG20.jpeg)
## :calendar: Community Meetings
-We love community involvement! Join us for our biweekly meetings every Thursday night. We even offer gifts and rewards! :gift:
+We want anyone to get involved in our community and contributing code, we offer gifts and rewards, and we welcome you to join us every Thursday night.
-You can find the meeting minutes on [GitHub discussions](https://github.com/OpenIMSDK/Open-IM-Server/discussions/categories/meeting) and our [Google Docs](https://docs.google.com/document/d/1nx8MDpuG74NASx081JcCpxPgDITNTpIIos0DS6Vr9GU/edit?usp=sharing).
+Our conference is in the [OpenIM Slack](https://join.slack.com/t/openimsdk/shared_invite/zt-1tmoj26uf-_FDy3dowVHBiGvLk9e5Xkg) 🎯, then you can search the Open-IM-Server pipeline to join
-## :eyes: Who are using Open-IM-Server
+We take notes of each [biweekly meeting](https://github.com/orgs/OpenIMSDK/discussions/categories/meeting) in [GitHub discussions](https://github.com/OpenIMSDK/Open-IM-Server/discussions/categories/meeting), Our historical meeting notes, as well as replays of the meetings are available at [Google Docs :bookmark_tabs:](https://docs.google.com/document/d/1nx8MDpuG74NASx081JcCpxPgDITNTpIIos0DS6Vr9GU/edit?usp=sharing).
-Check out our [user case studies](https://github.com/OpenIMSDK/community/blob/main/ADOPTERS.md) page for a list of the project users. Don't hesitate to leave a [📝comment](https://github.com/OpenIMSDK/Open-IM-Server/issues/379) and share your use case.
+## :eyes: Who are using OpenIM
-
+Check out our [user case studies](https://github.com/OpenIMSDK/community/blob/main/ADOPTERS.md) page for a list of the project users. Don't hesitate to leave a [📝comment](https://github.com/OpenIMSDK/Open-IM-Server/issues/379) and share your use case.
## :page_facing_up: License
-Open-IM-Server is licensed under the Apache 2.0 license. See the [LICENSE](./LICENSE) file for details.
+OpenIM is licensed under the Apache 2.0 license. See [LICENSE](https://github.com/OpenIMSDK/Open-IM-Server/tree/main/LICENSE) for the full license text.
+
+The OpenIM logo, including its variations and animated versions, displayed in this repository [OpenIM](https://github.com/OpenIMSDK/Open-IM-Server) under the [assets/logo](./assets/logo) and [assets/logo-gif](assets/logo-gif) directories, are protected by copyright laws.
-## :cloud: Docker Images
+## 🔮 Thanks to our contributors!
-Our Docker images are hosted not only on GitHub but also on Alibaba Cloud and Docker Hub supporting multiple architectures. Visit [our GitHub packages](https://github.com/orgs/OpenIMSDK/packages?repo_name=Open-IM-Server) and read our [version management document](https://github.com/OpenIMSDK/Open-IM-Server/blob/main/docs/conversions/version.md) for more information.
+
+
+
From 8cb05d50c9e507e218f1a1e2723ddd9202375c1f Mon Sep 17 00:00:00 2001
From: Xinwei Xiong <3293172751NSS@gmail.com>
Date: Sun, 6 Aug 2023 15:13:13 +0800
Subject: [PATCH 25/59] Update go_code.md (#794)
---
docs/conversions/go_code.md | 814 ++++++++++++++++++------------------
1 file changed, 403 insertions(+), 411 deletions(-)
diff --git a/docs/conversions/go_code.md b/docs/conversions/go_code.md
index 85d099f9c..6e1adf06d 100644
--- a/docs/conversions/go_code.md
+++ b/docs/conversions/go_code.md
@@ -1,66 +1,62 @@
-## Go 代码开发规范
-在Go 项目开发中,一个好的编码规范可以极大的提高代码质量。为了帮你节省时间和精力,这里我整理了一份清晰、可直接套用的 Go 编码规范,供你参考。
+## OpenIM development specification
+We have very high standards for code style and specification, and we want our products to be polished and perfect
-这份规范,是我参考了 Go 官方提供的编码规范,以及 Go 社区沉淀的一些比较合理的规范之后,加入自己的理解总结出的,它比很多公司内部的规范更全面,你掌握了,以后在面试大厂的时候,或者在大厂里写代码的时候,都会让人高看你一眼,觉得你code很专业。
+## 1. Code style
-这份编码规范中包含代码风格、命名规范、注释规范、类型、控制结构、函数、GOPATH 设置规范、依赖管理和最佳实践九类规范。如果你觉得这些规范内容太多了,看完一遍也记不住,这完全没关系。你可以多看几遍,也可以在用到时把它翻出来,在实际应用中掌握。这篇特别放送的内容,更多是作为写代码时候的一个参考手册。
+### 1.1 Code format
-## 1. 代码风格
-
-### 1.1 代码格式
-
-- 代码都必须用 `gofmt` 进行格式化。
-- 运算符和操作数之间要留空格。
-- 建议一行代码不超过120个字符,超过部分,请采用合适的换行方式换行。但也有些例外场景,例如import行、工具自动生成的代码、带tag的struct字段。
-- 文件长度不能超过800行。
-- 函数长度不能超过80行。
-- import规范
- - 代码都必须用`goimports`进行格式化(建议将代码Go代码编辑器设置为:保存时运行 `goimports`)。
- - 不要使用相对路径引入包,例如 `import ../util/net` 。
- - 包名称与导入路径的最后一个目录名不匹配时,或者多个相同包名冲突时,则必须使用导入别名。
+- Code must be formatted with `gofmt`.
+- Leave spaces between operators and operands.
+- It is recommended that a line of code does not exceed 120 characters. If the part exceeds, please use an appropriate line break method. But there are also some exception scenarios, such as import lines, code automatically generated by tools, and struct fields with tags.
+- The file length cannot exceed 800 lines.
+- Function length cannot exceed 80 lines.
+- import specification
+- All code must be formatted with `goimports` (it is recommended to set the code Go code editor to: run `goimports` on save).
+- Do not use relative paths to import packages, such as `import ../util/net`.
+- Import aliases must be used when the package name does not match the last directory name of the import path, or when multiple identical package names conflict.
```go
- // bad
- "github.com/dgrijalva/jwt-go/v4"
+// bad
+"github.com/dgrijalva/jwt-go/v4"
- //good
- jwt "github.com/dgrijalva/jwt-go/v4"
+//good
+jwt "github.com/dgrijalva/jwt-go/v4"
```
- - 导入的包建议进行分组,匿名包的引用使用一个新的分组,并对匿名包引用进行说明。
+- Imported packages are suggested to be grouped, and anonymous package references use a new group, and anonymous package references are explained.
```go
- import (
- // go 标准包
- "fmt"
-
- // 第三方包
- "github.com/jinzhu/gorm"
- "github.com/spf13/cobra"
- "github.com/spf13/viper"
-
- // 匿名包单独分组,并对匿名包引用进行说明
- // import mysql driver
- _ "github.com/jinzhu/gorm/dialects/mysql"
-
- // 内部包
- v1 "github.com/marmotedu/api/apiserver/v1"
- metav1 "github.com/marmotedu/apimachinery/pkg/meta/v1"
- "github.com/marmotedu/iam/pkg/cli/genericclioptions"
- )
+import (
+// go standard package
+"fmt"
+
+// third party package
+"github.com/jinzhu/gorm"
+"github.com/spf13/cobra"
+"github.com/spf13/viper"
+
+// Anonymous packages are grouped separately, and anonymous package references are explained
+// import mysql driver
+_ "github.com/jinzhu/gorm/dialects/mysql"
+
+// inner package
+v1 "github.com/marmotedu/api/apiserver/v1"
+metav1 "github.com/marmotedu/apimachinery/pkg/meta/v1"
+"github.com/marmotedu/iam/pkg/cli/genericclioptions"
+)
```
-### 1.2 声明、初始化和定义
+### 1.2 Declaration, initialization and definition
-当函数中需要使用到多个变量时,可以在函数开始处使用`var`声明。在函数外部声明必须使用 `var` ,不要采用 `:=` ,容易踩到变量的作用域的问题。
+When multiple variables need to be used in a function, the `var` declaration can be used at the beginning of the function. Declaration outside the function must use `var`, do not use `:=`, it is easy to step on the scope of the variable.
```go
var (
- Width int
- Height int
+Width int
+Height int
)
```
-- 在初始化结构引用时,请使用`&T{}`代替`new(T)`,以使其与结构体初始化一致。
+- When initializing a structure reference, please use `&T{}` instead of `new(T)` to make it consistent with structure initialization.
```go
// bad
@@ -71,371 +67,371 @@ sptr.Name = "bar"
sptr := &T{Name: "bar"}
```
-- struct 声明和初始化格式采用多行,定义如下。
+- The struct declaration and initialization format takes multiple lines and is defined as follows.
```go
type User struct{
- Username string
- Email string
+ Username string
+ Email string
}
user := User{
- Username: "belm",
- Email: "nosbelm@qq.com",
+Username: "belm",
+Email: "nosbelm@qq.com",
}
```
-- 相似的声明放在一组,同样适用于常量、变量和类型声明。
+- Similar declarations are grouped together, and the same applies to constant, variable, and type declarations.
```go
// bad
import "a"
import "b"
-// good
+//good
import (
- "a"
- "b"
+ "a"
+ "b"
)
```
-- 尽可能指定容器容量,以便为容器预先分配内存,例如:
+- Specify container capacity where possible to pre-allocate memory for the container, for example:
```go
v := make(map[int]string, 4)
v := make([]string, 0, 4)
```
-- 在顶层,使用标准var关键字。请勿指定类型,除非它与表达式的类型不同。
+- At the top level, use the standard var keyword. Do not specify a type unless it is different from the type of the expression.
```go
// bad
-var _s string = F()
+var_s string = F()
func F() string { return "A" }
// good
-var _s = F()
-// 由于 F 已经明确了返回一个字符串类型,因此我们没有必要显式指定_s 的类型
-// 还是那种类型
+var_s = F()
+// Since F already explicitly returns a string type, we don't need to explicitly specify the type of _s
+// still of that type
func F() string { return "A" }
```
-- 对于未导出的顶层常量和变量,使用`_`作为前缀。
+- Use `_` as a prefix for unexported top-level constants and variables.
```go
// bad
const (
- defaultHost = "127.0.0.1"
- defaultPort = 8080
+ defaultHost = "127.0.0.1"
+ defaultPort = 8080
)
// good
const (
- _defaultHost = "127.0.0.1"
- _defaultPort = 8080
+ _defaultHost = "127.0.0.1"
+ _defaultPort = 8080
)
```
-- 嵌入式类型(例如 mutex)应位于结构体内的字段列表的顶部,并且必须有一个空行将嵌入式字段与常规字段分隔开。
+- Embedded types (such as mutexes) should be at the top of the field list within the struct, and there must be a blank line separating embedded fields from regular fields.
```go
// bad
type Client struct {
- version int
- http.Client
+ version int
+ http.Client
}
-// good
+//good
type Client struct {
- http.Client
+ http.Client
- version int
+ version int
}
```
-### 1.3 错误处理
+### 1.3 Error Handling
-- `error`作为函数的值返回,必须对`error`进行处理,或将返回值赋值给明确忽略。对于`defer xx.Close()`可以不用显式处理。
+- `error` is returned as the value of the function, `error` must be handled, or the return value assigned to explicitly ignore. For `defer xx.Close()`, there is no need to explicitly handle it.
```go
func load() error {
- // normal code
+// normal code
}
// bad
load()
-// good
- _ = load()
+//good
+ _ = load()
```
-- `error`作为函数的值返回且有多个返回值的时候,`error`必须是最后一个参数。
+- When `error` is returned as the value of a function and there are multiple return values, `error` must be the last parameter.
```go
// bad
func load() (error, int) {
- // normal code
+// normal code
}
-// good
+//good
func load() (int, error) {
- // normal code
+// normal code
}
```
-- 尽早进行错误处理,并尽早返回,减少嵌套。
+- Perform error handling as early as possible and return as early as possible to reduce nesting.
```go
// bad
if err != nil {
- // error code
+// error code
} else {
- // normal code
+// normal code
}
-// good
+//good
if err != nil {
- // error handling
- return err
+// error handling
+return err
}
// normal code
```
-- 如果需要在 if 之外使用函数调用的结果,则应采用下面的方式。
+- If you need to use the result of the function call outside if, you should use the following method.
```go
// bad
if v, err := foo(); err != nil {
- // error handling
+// error handling
}
// good
v, err := foo()
if err != nil {
- // error handling
+// error handling
}
```
-- 错误要单独判断,不与其他逻辑组合判断。
+- Errors should be judged independently, not combined with other logic.
```go
// bad
v, err := foo()
-if err != nil || v == nil {
- // error handling
- return err
+if err != nil || v == nil {
+// error handling
+return err
}
-// good
+//good
v, err := foo()
if err != nil {
- // error handling
- return err
+// error handling
+return err
}
if v == nil {
- // error handling
- return errors.New("invalid value v")
+// error handling
+return errors. New("invalid value v")
}
```
-- 如果返回值需要初始化,则采用下面的方式。
+- If the return value needs to be initialized, use the following method.
```go
v, err := f()
if err != nil {
- // error handling
- return // or continue.
+ // error handling
+ return // or continue.
}
```
-- 错误描述建议
- - 错误描述用小写字母开头,结尾不要加标点符号,例如:
+- Bug description suggestions
+- Error descriptions start with a lowercase letter and do not end with punctuation, for example:
```go
- // bad
- errors.New("Redis connection failed")
- errors.New("redis connection failed.")
+// bad
+errors.New("Redis connection failed")
+errors.New("redis connection failed.")
- // good
- errors.New("redis connection failed")
+// good
+errors.New("redis connection failed")
```
- - 告诉用户他们可以做什么,而不是告诉他们不能做什么。
- - 当声明一个需求时,用must 而不是should。例如,`must be greater than 0、must match regex '[a-z]+'`。
- - 当声明一个格式不对时,用must not。例如,`must not contain`。
- - 当声明一个动作时用may not。例如,`may not be specified when otherField is empty、only name may be specified`。
- - 引用文字字符串值时,请在单引号中指示文字。例如,`ust not contain '..'`。
- - 当引用另一个字段名称时,请在反引号中指定该名称。例如,must be greater than `request`。
- - 指定不等时,请使用单词而不是符号。例如,`must be less than 256、must be greater than or equal to 0 (不要用 larger than、bigger than、more than、higher than)`。
- - 指定数字范围时,请尽可能使用包含范围。
- - 建议 Go 1.13 以上,error 生成方式为 `fmt.Errorf("module xxx: %w", err)`。
+- Tell users what they can do, not what they can't.
+- When declaring a requirement, use must instead of should. For example, `must be greater than 0, must match regex '[a-z]+'`.
+- When declaring that a format is incorrect, use must not. For example, `must not contain`.
+- Use may not when declaring an action. For example, `may not be specified when otherField is empty, only name may be specified`.
+- When quoting a literal string value, indicate the literal in single quotes. For example, `ust not contain '..'`.
+- When referencing another field name, specify that name in backticks. For example, must be greater than `request`.
+- When specifying unequal, use words instead of symbols. For example, `must be less than 256, must be greater than or equal to 0 (do not use larger than, bigger than, more than, higher than)`.
+- When specifying ranges of numbers, use inclusive ranges whenever possible.
+- Go 1.13 or above is recommended, and the error generation method is `fmt.Errorf("module xxx: %w", err)`.
-### 1.4 panic处理
+### 1.4 panic processing
-- 在业务逻辑处理中禁止使用panic。
-- 在main包中,只有当程序完全不可运行时使用panic,例如无法打开文件、无法连接数据库导致程序无法正常运行。
-- 在main包中,使用 `log.Fatal` 来记录错误,这样就可以由log来结束程序,或者将panic抛出的异常记录到日志文件中,方便排查问题。
-- 可导出的接口一定不能有panic。
-- 包内建议采用error而不是panic来传递错误。
+- Panic is prohibited in business logic processing.
+- In the main package, panic is only used when the program is completely inoperable, for example, the file cannot be opened, the database cannot be connected, and the program cannot run normally.
+- In the main package, use `log.Fatal` to record errors, so that the program can be terminated by the log, or the exception thrown by the panic can be recorded in the log file, which is convenient for troubleshooting.
+- An exportable interface must not panic.
+- It is recommended to use error instead of panic to convey errors in the package.
-### 1.5 单元测试
+### 1.5 Unit Tests
-- 单元测试文件名命名规范为 `example_test.go`。
-- 每个重要的可导出函数都要编写测试用例。
-- 因为单元测试文件内的函数都是不对外的,所以可导出的结构体、函数等可以不带注释。
-- 如果存在 `func (b *Bar) Foo` ,单测函数可以为 `func TestBar_Foo`。
+- The unit test filename naming convention is `example_test.go`.
+- Write a test case for every important exportable function.
+- Because the functions in the unit test file are not external, the exportable structures, functions, etc. can be uncommented.
+- If `func (b *Bar) Foo` exists, the single test function can be `func TestBar_Foo`.
-### 1.6 类型断言失败处理
+### 1.6 Type assertion failure handling
-- type assertion 的单个返回值针对不正确的类型将产生 panic。请始终使用 “comma ok”的惯用法。
+- A single return value from a type assertion will panic for an incorrect type. Always use the "comma ok" idiom.
```go
// bad
t := n.(int)
-// good
+//good
t, ok := n.(int)
if !ok {
- // error handling
+// error handling
}
```
-## 2. 命名规范
+## 2. Naming convention
-命名规范是代码规范中非常重要的一部分,一个统一的、短小的、精确的命名规范可以大大提高代码的可读性,也可以借此规避一些不必要的Bug。
+The naming convention is a very important part of the code specification. A uniform, short, and precise naming convention can greatly improve the readability of the code and avoid unnecessary bugs.
-### 2.1 包命名
+### 2.1 Package Naming
-- 包名必须和目录名一致,尽量采取有意义、简短的包名,不要和标准库冲突。
-- 包名全部小写,没有大写或下划线,使用多级目录来划分层级。
-- 项目名可以通过中划线来连接多个单词。
-- 包名以及包所在的目录名,不要使用复数,例如,是`net/url`,而不是`net/urls`。
-- 不要用 common、util、shared 或者 lib 这类宽泛的、无意义的包名。
-- 包名要简单明了,例如 net、time、log。
+- The package name must be consistent with the directory name, try to use a meaningful and short package name, and do not conflict with the standard library.
+- Package names are all lowercase, without uppercase or underscores, and use multi-level directories to divide the hierarchy.
+- Item names can connect multiple words with dashes.
+- Do not use plurals for the package name and the directory name where the package is located, for example, `net/url` instead of `net/urls`.
+- Don't use broad, meaningless package names like common, util, shared or lib.
+- The package name should be simple and clear, such as net, time, log.
-### 2.2 函数命名
+### 2.2 Function Naming
-- 函数名采用驼峰式,首字母根据访问控制决定使用大写或小写,例如:`MixedCaps`或者`mixedCaps`。
-- 代码生成工具自动生成的代码(如`xxxx.pb.go`)和为了对相关测试用例进行分组,而采用的下划线(如`TestMyFunction_WhatIsBeingTested`)排除此规则。
+- The function name is in camel case, and the first letter is uppercase or lowercase according to the access control decision,For example: `MixedCaps` or `mixedCaps`.
+- Code automatically generated by code generation tools (such as `xxxx.pb.go`) and underscores used to group related test cases (such as `TestMyFunction_WhatIsBeingTested`) exclude this rule.
-### 2.3 文件命名
+### 2.3 File Naming
-- 文件名要简短有意义。
-- 文件名应小写,并使用下划线分割单词。
+- Keep the filename short and meaningful.
+- Filenames should be lowercase and use underscores to separate words.
-### 2.4 结构体命名
+### 2.4 Structure Naming
-- 采用驼峰命名方式,首字母根据访问控制决定使用大写或小写,例如`MixedCaps`或者`mixedCaps`。
-- 结构体名不应该是动词,应该是名词,比如 `Node`、`NodeSpec`。
-- 避免使用Data、Info这类无意义的结构体名。
-- 结构体的声明和初始化应采用多行,例如:
+- The camel case is adopted, and the first letter is uppercase or lowercase according to the access control, such as `MixedCaps` or `mixedCaps`.
+- Struct names should not be verbs, but should be nouns, such as `Node`, `NodeSpec`.
+- Avoid using meaningless structure names such as Data and Info.
+- The declaration and initialization of the structure should take multiple lines, for example:
```go
-// User 多行声明
+// User multi-line declaration
type User struct {
- Name string
- Email string
+ name string
+ Email string
}
-// 多行初始化
+// multi-line initialization
u := User{
- UserName: "belm",
- Email: "nosbelm@qq.com",
+ UserName: "belm",
+ Email: "nosbelm@qq.com",
}
```
-### 2.5 接口命名
+### 2.5 Interface Naming
-- 接口命名的规则,基本和结构体命名规则保持一致:
- - 单个函数的接口名以 “er"”作为后缀(例如Reader,Writer),有时候可能导致蹩脚的英文,但是没关系。
- - 两个函数的接口名以两个函数名命名,例如ReadWriter。
- - 三个以上函数的接口名,类似于结构体名。
+- The interface naming rules are basically consistent with the structure naming rules:
+- Interface names of individual functions suffixed with "er"" (e.g. Reader, Writer) can sometimes lead to broken English, but that's okay.
+- The interface name of the two functions is named after the two function names, eg ReadWriter.
+- An interface name for more than three functions, similar to a structure name.
-例如:
+For example:
```
- // Seeking to an offset before the start of the file is an error.
- // Seeking to any positive offset is legal, but the behavior of subsequent
- // I/O operations on the underlying object is implementation-dependent.
- type Seeker interface {
- Seek(offset int64, whence int) (int64, error)
- }
+// Seeking to an offset before the start of the file is an error.
+// Seeking to any positive offset is legal, but the behavior of subsequent
+// I/O operations on the underlying object are implementation-dependent.
+type Seeker interface {
+Seek(offset int64, whence int) (int64, error)
+}
- // ReadWriter is the interface that groups the basic Read and Write methods.
- type ReadWriter interface {
- Reader
- Writer
- }
+// ReadWriter is the interface that groups the basic Read and Write methods.
+type ReadWriter interface {
+reader
+Writer
+}
```
-### 2.6 变量命名
+### 2.6 Variable Naming
-- 变量名必须遵循驼峰式,首字母根据访问控制决定使用大写或小写。
-- 在相对简单(对象数量少、针对性强)的环境中,可以将一些名称由完整单词简写为单个字母,例如:
- - user 可以简写为 u;
- - userID 可以简写 uid。
-- 特有名词时,需要遵循以下规则:
- - 如果变量为私有,且特有名词为首个单词,则使用小写,如 apiClient。
- - 其他情况都应当使用该名词原有的写法,如 APIClient、repoID、UserID。
+- Variable names must follow camel case, and the initial letter is uppercase or lowercase according to the access control decision.
+- In relatively simple (few objects, highly targeted) environments, some names can be abbreviated from full words to single letters, for example:
+- user can be abbreviated as u;
+- userID can be abbreviated as uid.
+- When using proper nouns, the following rules need to be followed:
+- If the variable is private and the proper noun is the first word, use lowercase, such as apiClient.
+- In other cases, the original wording of the noun should be used, such as APIClient, repoID, UserID.
-下面列举了一些常见的特有名词。
+Some common nouns are listed below.
```
// A GonicMapper that contains a list of common initialisms taken from golang/lint
var LintGonicMapper = GonicMapper{
- "API": true,
- "ASCII": true,
- "CPU": true,
- "CSS": true,
- "DNS": true,
- "EOF": true,
- "GUID": true,
- "HTML": true,
- "HTTP": true,
- "HTTPS": true,
- "ID": true,
- "IP": true,
- "JSON": true,
- "LHS": true,
- "QPS": true,
- "RAM": true,
- "RHS": true,
- "RPC": true,
- "SLA": true,
- "SMTP": true,
- "SSH": true,
- "TLS": true,
- "TTL": true,
- "UI": true,
- "UID": true,
- "UUID": true,
- "URI": true,
- "URL": true,
- "UTF8": true,
- "VM": true,
- "XML": true,
- "XSRF": true,
- "XSS": true,
-}
-```
-
-- 若变量类型为bool类型,则名称应以Has,Is,Can或Allow开头,例如:
-
-```go
-var hasConflict bool
+ "API": true,
+ "ASCII": true,
+ "CPU": true,
+ "CSS": true,
+ "DNS": true,
+ "EOF": true,
+ "GUID": true,
+ "HTML": true,
+ "HTTP": true,
+ "HTTPS": true,
+ "ID": true,
+ "IP": true,
+ "JSON": true,
+ "LHS": true,
+ "QPS": true,
+ "RAM": true,
+ "RHS": true,
+ "RPC": true,
+ "SLA": true,
+ "SMTP": true,
+ "SSH": true,
+ "TLS": true,
+ "TTL": true,
+ "UI": true,
+ "UID": true,
+ "UUID": true,
+ "URI": true,
+ "URL": true,
+ "UTF8": true,
+ "VM": true,
+ "XML": true,
+ "XSRF": true,
+ "XSS": true,
+}
+```
+
+- If the variable type is bool, the name should start with Has, Is, Can or Allow, for example:
+
+```go
+var has Conflict bool
var isExist bool
-var canManage bool
+var can Manage bool
var allowGitHook bool
```
-- 局部变量应当尽可能短小,比如使用buf指代buffer,使用i指代index。
-- 代码生成工具自动生成的代码可排除此规则(如`xxx.pb.go`里面的Id)
+- Local variables should be as short as possible, for example, use buf to refer to buffer, and use i to refer to index.
+- The code automatically generated by the code generation tool can exclude this rule (such as the Id in `xxx.pb.go`)
-### 2.7 常量命名
+### 2.7 Constant naming
-- 常量名必须遵循驼峰式,首字母根据访问控制决定使用大写或小写。
-- 如果是枚举类型的常量,需要先创建相应类型:
+- The constant name must follow the camel case, and the initial letter is uppercase or lowercase according to the access control decision.
+- If it is a constant of enumeration type, you need to create the corresponding type first:
```go
// Code defines an error code type.
@@ -443,53 +439,53 @@ type Code int
// Internal errors.
const (
- // ErrUnknown - 0: An unknown error occurred.
- ErrUnknown Code = iota
- // ErrFatal - 1: An fatal error occurred.
- ErrFatal
+ // ErrUnknown - 0: An unknown error occurred.
+ ErrUnknown Code = iota
+ // ErrFatal - 1: An fatal error occurred.
+ Err Fatal
)
```
-### 2.8 Error的命名
+### 2.8 Error naming
-- Error类型应该写成FooError的形式。
+- The Error type should be written in the form of FooError.
```go
type ExitError struct {
- // ....
+// ....
}
```
-- Error变量写成ErrFoo的形式。
+- The Error variable is written in the form of ErrFoo.
```go
-var ErrFormat = errors.New("unknown format")
+var ErrFormat = errors. New("unknown format")
```
-## 3. 注释规范
+## 3. Comment specification
-- 每个可导出的名字都要有注释,该注释对导出的变量、函数、结构体、接口等进行简要介绍。
-- 全部使用单行注释,禁止使用多行注释。
-- 和代码的规范一样,单行注释不要过长,禁止超过 120 字符,超过的请使用换行展示,尽量保持格式优雅。
-- 注释必须是完整的句子,以需要注释的内容作为开头,句点作为结尾,`格式为 // 名称 描述.`。例如:
+- Each exportable name must have a comment, which briefly introduces the exported variables, functions, structures, interfaces, etc.
+- All single-line comments are used, and multi-line comments are prohibited.
+- Same as the code specification, single-line comments should not be too long, and no more than 120 characters are allowed. If it exceeds, please use a new line to display, and try to keep the format elegant.
+- A comment must be a complete sentence, starting with the content to be commented and ending with a period, `the format is // name description.`. For example:
```go
// bad
// logs the flags in the flagset.
-func PrintFlags(flags *pflag.FlagSet) {
- // normal code
+func PrintFlags(flags *pflag. FlagSet) {
+// normal code
}
-// good
+//good
// PrintFlags logs the flags in the flagset.
-func PrintFlags(flags *pflag.FlagSet) {
- // normal code
+func PrintFlags(flags *pflag. FlagSet) {
+// normal code
}
```
-- 所有注释掉的代码在提交code review前都应该被删除,否则应该说明为什么不删除,并给出后续处理建议。
+- All commented out code should be deleted before submitting code review, otherwise, it should explain why it is not deleted, and give follow-up processing suggestions.
-- 在多段注释之间可以使用空行分隔加以区分,如下所示:
+- Multiple comments can be separated by blank lines, as follows:
```go
// Package superman implements methods for saving the world.
@@ -499,10 +495,10 @@ func PrintFlags(flags *pflag.FlagSet) {
package superman
```
-### 3.1 包注释
+### 3.1 Package Notes
-- 每个包都有且仅有一个包级别的注释。
-- 包注释统一用 // 进行注释,格式为 `// Package 包名 包描述`,例如:
+- Each package has one and only one package-level annotation.
+- Package comments are uniformly commented with // in the format of `// Package package name package description`, for example:
```go
// Package genericclioptions contains flags which can be added to you command, bound, completed, and produce
@@ -510,90 +506,90 @@ package superman
package genericclioptions
```
-### 3.2 变量/常量注释
+### 3.2 Variable/Constant Comments
-- 每个可导出的变量/常量都必须有注释说明,`格式为// 变量名 变量描述`,例如:
+- Each variable/constant that can be exported must have a comment description, `the format is // variable name variable description`, for example:
```go
// ErrSigningMethod defines invalid signing method error.
-var ErrSigningMethod = errors.New("Invalid signing method")
+var ErrSigningMethod = errors. New("Invalid signing method")
```
-- 出现大块常量或变量定义时,可在前面注释一个总的说明,然后在每一行常量的前一行或末尾详细注释该常量的定义,例如:
+- When there is a large block of constant or variable definition, you can comment a general description in front, and then comment the definition of the constant in detail before or at the end of each line of constant, for example:
```go
// Code must start with 1xxxxx.
const (
- // ErrSuccess - 200: OK.
- ErrSuccess int = iota + 100001
+ // ErrSuccess - 200: OK.
+ ErrSuccess int = iota + 100001
- // ErrUnknown - 500: Internal server error.
- ErrUnknown
+ // ErrUnknown - 500: Internal server error.
+ ErrUnknown
- // ErrBind - 400: Error occurred while binding the request body to the struct.
- ErrBind
+ // ErrBind - 400: Error occurred while binding the request body to the struct.
+ ErrBind
- // ErrValidation - 400: Validation failed.
- ErrValidation
+ // ErrValidation - 400: Validation failed.
+ ErrValidation
)
```
-### 3.3 结构体注释
+### 3.3 Structure Annotation
-- 每个需要导出的结构体或者接口都必须有注释说明,格式为 `// 结构体名 结构体描述.`。
-- 结构体内的可导出成员变量名,如果意义不明确,必须要给出注释,放在成员变量的前一行或同一行的末尾。例如:
+- Each structure or interface that needs to be exported must have a comment description, the format is `// structure name structure description.`.
+- The name of the exportable member variable in the structure, if the meaning is not clear, a comment must be given and placed before the member variable or at the end of the same line. For example:
```go
// User represents a user restful resource. It is also used as gorm model.
type User struct {
- // Standard object's metadata.
- metav1.ObjectMeta `json:"metadata,omitempty"`
+ // Standard object's metadata.
+ metav1.ObjectMeta `json:"metadata,omitempty"`
- Nickname string `json:"nickname" gorm:"column:nickname"`
- Password string `json:"password" gorm:"column:password"`
- Email string `json:"email" gorm:"column:email"`
- Phone string `json:"phone" gorm:"column:phone"`
- IsAdmin int `json:"isAdmin,omitempty" gorm:"column:isAdmin"`
+ Nickname string `json:"nickname" gorm:"column:nickname"`
+ Password string `json:"password" gorm:"column:password"`
+ Email string `json:"email" gorm:"column:email"`
+ Phone string `json:"phone" gorm:"column:phone"`
+ IsAdmin int `json:"isAdmin,omitempty" gorm:"column:isAdmin"`
}
```
-### 3.4 方法注释
+### 3.4 Method Notes
-每个需要导出的函数或者方法都必须有注释,格式为// 函数名 函数描述.,例如:
+Each function or method that needs to be exported must have a comment, the format is // function name function description., for examplelike:
```go
// BeforeUpdate run before update database record.
func (p *Policy) BeforeUpdate() (err error) {
- // normal code
- return nil
+// normal code
+return nil
}
```
-### 3.5 类型注释
+### 3.5 Type annotations
-- 每个需要导出的类型定义和类型别名都必须有注释说明,格式为 `// 类型名 类型描述.`,例如:
+- Each type definition and type alias that needs to be exported must have a comment description, the format is `// type name type description.`, for example:
```go
// Code defines an error code type.
type Code int
```
-## 4. 类型
+## 4. Type
-### 4.1 字符串
+### 4.1 Strings
-- 空字符串判断。
+- Empty string judgment.
```go
// bad
if s == "" {
- // normal code
+ // normal code
}
-// good
+//good
if len(s) == 0 {
- // normal code
+ // normal code
}
```
-- `[]byte`/`string`相等比较。
+- `[]byte`/`string` equality comparison.
```go
// bad
@@ -603,165 +599,165 @@ var s2 []byte
bytes.Equal(s1, s2) == 0
bytes.Equal(s1, s2) != 0
-// good
+//good
var s1 []byte
var s2 []byte
...
-bytes.Compare(s1, s2) == 0
-bytes.Compare(s1, s2) != 0
+bytes. Compare(s1, s2) == 0
+bytes. Compare(s1, s2) != 0
```
-- 复杂字符串使用raw字符串避免字符转义。
+- Complex strings use raw strings to avoid character escaping.
```go
// bad
regexp.MustCompile("\\.")
-// good
+//good
regexp.MustCompile(`\.`)
```
-### 4.2 切片
+### 4.2 Slicing
-- 空slice判断。
+- Empty slice judgment.
```go
// bad
if len(slice) = 0 {
- // normal code
+ // normal code
}
-// good
+//good
if slice != nil && len(slice) == 0 {
- // normal code
+ // normal code
}
```
-上面判断同样适用于map、channel。
+The above judgment also applies to map and channel.
-- 声明slice。
+- Declare a slice.
```go
// bad
s := []string{}
s := make([]string, 0)
-// good
-var s []string
+//good
+var s[]string
```
-- slice复制。
+- slice copy.
```go
// bad
var b1, b2 []byte
for i, v := range b1 {
- b2[i] = v
+ b2[i] = v
}
for i := range b1 {
- b2[i] = b1[i]
+ b2[i] = b1[i]
}
-// good
+//good
copy(b2, b1)
```
-- slice新增。
+- slice added.
```go
// bad
var a, b []int
for _, v := range a {
- b = append(b, v)
+ b = append(b, v)
}
-// good
+//good
var a, b []int
b = append(b, a...)
```
-### 4.3 结构体
+### 4.3 Structure
-- struct初始化。
+- struct initialization.
-struct以多行格式初始化。
+The struct is initialized in multi-line format.
```go
type user struct {
- Id int64
- Name string
+Id int64
+name string
}
u1 := user{100, "Colin"}
u2 := user{
- Id: 200,
- Name: "Lex",
+ Id: 200,
+ Name: "Lex",
}
```
-## 5. 控制结构
+## 5. Control Structure
### 5.1 if
-- if 接受初始化语句,约定如下方式建立局部变量。
+- if accepts the initialization statement, the convention is to create local variables in the following way.
```go
if err := loadConfig(); err != nil {
- // error handling
- return err
+// error handling
+return err
}
```
-- if 对于bool类型的变量,应直接进行真假判断。
+- if For variables of bool type, true and false judgments should be made directly.
```go
var isAllow bool
if isAllow {
- // normal code
+// normal code
}
```
### 5.2 for
-- 采用短声明建立局部变量。
+- Create local variables using short declarations.
```go
sum := 0
for i := 0; i < 10; i++ {
- sum += 1
+ sum += 1
}
```
-- 不要在 for 循环里面使用 defer,defer只有在函数退出时才会执行。
+- Don't use defer in for loop, defer will only be executed when the function exits.
```go
// bad
for file := range files {
- fd, err := os.Open(file)
- if err != nil {
- return err
- }
- defer fd.Close()
- // normal code
+fd, err := os. Open(file)
+if err != nil {
+return err
+}
+defer fd. Close()
+// normal code
}
-// good
+//good
for file := range files {
- func() {
- fd, err := os.Open(file)
- if err != nil {
- return err
- }
- defer fd.Close()
- // normal code
- }()
+func() {
+fd, err := os. Open(file)
+if err != nil {
+return err
+}
+defer fd. Close()
+// normal code
+}()
}
```
### 5.3 range
-- 如果只需要第一项(key),就丢弃第二个。
+- If only the first item (key) is needed, discard the second.
```go
for key := range keys {
@@ -769,133 +765,129 @@ for key := range keys {
}
```
-- 如果只需要第二项,则把第一项置为下划线。
+- If only the second item is required, underline the first item.
```go
sum := 0
for _, value := range array {
- sum += value
+ sum += value
}
```
### 5.4 switch
-- 必须要有default。
+- must have default.
```go
switch os := runtime.GOOS; os {
- case "linux":
- fmt.Println("Linux.")
- case "darwin":
- fmt.Println("OS X.")
- default:
- fmt.Printf("%s.\n", os)
+ case "linux":
+ fmt.Println("Linux.")
+ case "darwin":
+ fmt.Println("OS X.")
+ default:
+ fmt.Printf("%s.\n", os)
}
```
### 5.5 goto
-- 业务代码禁止使用 goto 。
-- 框架或其他底层源码尽量不用。
+- Business code prohibits the use of goto.
+- Try not to use frameworks or other low-level source code.
-## 6. 函数
+## 6. Functions
-- 传入变量和返回变量以小写字母开头。
-- 函数参数个数不能超过5个。
-- 函数分组与顺序
-- 函数应按粗略的调用顺序排序。
-- 同一文件中的函数应按接收者分组。
-- 尽量采用值传递,而非指针传递。
-- 传入参数是 map、slice、chan、interface ,不要传递指针。
+- Incoming variables and return variables start with a lowercase letter.
+- The number of function parameters cannot exceed 5.
+- Function grouping and ordering
+- Functions should be sorted in rough calling order.
+- Functions in the same file should be grouped by receiver.
+- Try to use value transfer instead of pointer transfer.
+- The incoming parameters are map, slice, chan, interface, do not pass pointers.
-### 6.1 函数参数
+### 6.1 Function parameters
-- 如果函数返回相同类型的两个或三个参数,或者如果从上下文中不清楚结果的含义,使用命名返回,其他情况不建议使用命名返回,例如:
+- If the function returns two or three arguments of the same type, or if the meaning of the result is not clear from the context, use named returns, otherwise it is not recommended to use named returns, for example:
```go
func coordinate() (x, y float64, err error) {
- // normal code
+// normal code
}
```
-- 传入变量和返回变量都以小写字母开头。
-- 尽量用值传递,非指针传递。
-- 参数数量均不能超过5个。
-- 多返回值最多返回三个,超过三个请使用 struct。
+- Both incoming and returned variables start with a lowercase letter.
+- Try to pass by value instead of pointer.
+- The number of parameters cannot exceed 5.
+- Multiple return values can return up to three, and if there are more than three, please use struct.
### 6.2 defer
-- 当存在资源创建时,应紧跟defer释放资源(可以大胆使用defer,defer在Go1.14版本中,性能大幅提升,defer的性能损耗即使在性能敏感型的业务中,也可以忽略)。
-- 先判断是否错误,再defer释放资源,例如:
+- When resources are created, resources should be released immediately after defer (defer can be used boldly, the performance of defer is greatly improved in Go1.14 version, and the performance loss of defer can be ignored even in performance-sensitive businesses).
+- First judge whether there is an error, and then defer to release resources, for example:
```go
-rep, err := http.Get(url)
+rep, err := http. Get(url)
if err != nil {
- return err
+ return err
}
defer resp.Body.Close()
```
-### 6.3 方法的接收器
+### 6.3 Method Receiver
-- 推荐以类名第一个英文首字母的小写作为接收器的命名。
-- 接收器的命名在函数超过20行的时候不要用单字符。
-- 接收器的命名不能采用me、this、self这类易混淆名称。
+- It is recommended to use the lowercase of the first English letter of the class name as the name of the receiver.
+- Don't use a single character in the name of the receiver when the function exceeds 20 lines.
+- The name of the receiver cannot use confusing names such as me, this, and self.
-### 6.4 嵌套
-- 嵌套深度不能超过4层。
+### 6.4 Nesting
+- The nesting depth cannot exceed 4 levels.
-### 6.5 变量命名
-- 变量声明尽量放在变量第一次使用的前面,遵循就近原则。
-- 如果魔法数字出现超过两次,则禁止使用,改用一个常量代替,例如:
+### 6.5 Variable Naming
+- The variable declaration should be placed before the first use of the variable as far as possible, following the principle of proximity.
+- If the magic number appears more than twice, it is forbidden to use it and use a constant instead, for example:
```go
-// PI ...
-const Prise = 3.14
+// PI...
+const Price = 3.14
func getAppleCost(n float64) float64 {
- return Prise * n
+return Price * n
}
func getOrangeCost(n float64) float64 {
- return Prise * n
+return Price * n
}
```
-## 7. GOPATH 设置规范
-- Go 1.11 之后,弱化了 GOPATH 规则,已有代码(很多库肯定是在1.11之前建立的)肯定符合这个规则,建议保留 GOPATH 规则,便于维护代码。
-- 建议只使用一个 GOPATH,不建议使用多个 GOPATH。如果使用多个GOPATH,编译生效的 bin 目录是在第一个 GOPATH 下。
+## 7. GOPATH setting specification
+- After Go 1.11, the GOPATH rule has been weakened. Existing code (many libraries must have been created before 1.11) must conform to this rule. It is recommended to keep the GOPATH rule to facilitate code maintenance.
+- Only one GOPATH is recommended, multiple GOPATHs are not recommended. If multiple GOPATHs are used, the bin directory where compilation takes effect is under the first GOPATH.
-## 8. 依赖管理
+## 8. Dependency Management
-- Go 1.11 以上必须使用 Go Modules。
-- 使用Go Modules作为依赖管理的项目时,不建议提交vendor目录。
-- 使用Go Modules作为依赖管理的项目时,必须提交go.sum文件。
+- Go 1.11 and above must use Go Modules.
+- When using Go Modules as a dependency management project, it is not recommended to submit the vendor directory.
+- When using Go Modules as a dependency management project, the go.sum file must be submitted.
-### 9. 最佳实践
+### 9. Best Practices
-- 尽量少用全局变量,而是通过参数传递,使每个函数都是“无状态”的。这样可以减少耦合,也方便分工和单元测试。
-- 在编译时验证接口的符合性,例如:
+- Minimize the use of global variables, but pass parameters, so that each function is "stateless". This reduces coupling and facilitates division of labor and unit testing.
+- Verify interface compliance at compile time, for example:
```go
type LogHandler struct {
- h http.Handler
- log *zap.Logger
+ h http.Handler
+ log *zap. Logger
}
-var _ http.Handler = LogHandler{}
+var_http.Handler = LogHandler{}
```
-- 服务器处理请求时,应该创建一个context,保存该请求的相关信息(如requestID),并在函数调用链中传递。
-
-### 9.1 性能
-- string 表示的是不可变的字符串变量,对 string 的修改是比较重的操作,基本上都需要重新申请内存。所以,如果没有特殊需要,需要修改时多使用 []byte。
-- 优先使用 strconv 而不是 fmt。
-
-### 9.2 注意事项
+- When the server processes a request, it should create a context, save the relevant information of the request (such as requestID), and pass it in the function call chain.
-- append 要小心自动分配内存,append 返回的可能是新分配的地址。
-- 如果要直接修改 map 的 value 值,则 value 只能是指针,否则要覆盖原来的值。
-- map 在并发中需要加锁。
-- 编译过程无法检查 interface{} 的转换,只能在运行时检查,小心引起 panic。
+### 9.1 Performance
+- string represents an immutable string variable, modifying string is a relatively heavy operation, and basically needs to re-apply for memory. Therefore, if there is no special need, use []byte more when you need to modify.
+- Prefer strconv over fmt.
-## 总结
+### 9.2 Precautions
-这里向你介绍了九类常用的编码规范。但今天的最后,我要在这里提醒你一句:规范是人定的,你也可以根据需要,制定符合你项目的规范,但同时我也建议你采纳这些业界沉淀下来的规范,并通过工具来确保规范的执行。
+- append Be careful about automatically allocating memory, append may return a newly allocated address.
+- If you want to directly modify the value of the map, the value can only be a pointer, otherwise the original value must be overwritten.
+- map needs to be locked during concurrency.
+- The conversion of interface{} cannot be checked during compilation, it can only be checked at runtime, be careful to cause panic.
From 863e925b301ccf93cba7840fd25e96560aef5825 Mon Sep 17 00:00:00 2001
From: Xinwei Xiong <3293172751NSS@gmail.com>
Date: Sun, 6 Aug 2023 15:33:42 +0800
Subject: [PATCH 26/59] Update README.md (#795)
---
deployments/README.md | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/deployments/README.md b/deployments/README.md
index 9c3cff05e..602371fb0 100644
--- a/deployments/README.md
+++ b/deployments/README.md
@@ -2,6 +2,17 @@
OpenIM 支持很多种集群化部署方式,包括但不限于 helm, sealos, kubeam, kubesphere, kubeflow, kuboard, kubespray, k3s, k3d, k3c, k3sup, k3v, k3x
+**目前还在开发这个模块,预计 v3.2.0 之前会有一个集群方案。**
+
+目前各个贡献者,以及之前的官方有出过一些可以参考的方案:
+
+- https://github.com/OpenIMSDK/k8s-jenkins
+- https://github.com/OpenIMSDK/Open-IM-Server-k8s-deploy
+- https://github.com/OpenIMSDK/openim-charts
+- https://github.com/showurl/deploy-openim
+
+
+
### 依赖检查
```bash
@@ -23,4 +34,4 @@ $ cd ${OpenIM_ROOT}
-### Helm安装
\ No newline at end of file
+### Helm安装
From 4e9179f30950e8454c6fb7431dbd26ddcc1a807e Mon Sep 17 00:00:00 2001
From: Xinwei Xiong <3293172751NSS@gmail.com>
Date: Sun, 6 Aug 2023 15:33:48 +0800
Subject: [PATCH 27/59] Update README.md (#796)
---
README.md | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/README.md b/README.md
index 86c02d3da..0ad2ac5f9 100644
--- a/README.md
+++ b/README.md
@@ -46,7 +46,7 @@ It's important to note that Open-IM-Server isn't a standalone product, and it do
| multiple message | Efficient meetings |
| :------------------------: | :--------------------------------: |
|  |  |
-| One-to-one and group chats | Special features - Custom messages |
+| **One-to-one and group chats** | **Special features - Custom messages** |
|  |  |
@@ -95,7 +95,7 @@ It's important to note that Open-IM-Server isn't a standalone product, and it do
9. **The ultimate deployment experience 🤖**
- ✅ Supports cluster deployment
+ ✅ Supports [cluster deployment](https://github.com/OpenIMSDK/Open-IM-Server/edit/main/deployments/README.md)
✅ Supports multi-architecture mirroring, our Docker images are hosted not only on GitHub but also on Alibaba Cloud and Docker Hub supporting multiple architectures. Visit [our GitHub packages](https://github.com/orgs/OpenIMSDK/packages?repo_name=Open-IM-Server) and read our [version management document](https://github.com/OpenIMSDK/Open-IM-Server/blob/main/docs/conversions/version.md) for more information.
@@ -118,10 +118,9 @@ git clone -b $BRANCH https://github.com/OpenIMSDK/Open-IM-Server openim && expor
```
> **Note**
->
> Read our release policy: https://github.com/OpenIMSDK/Open-IM-Server/blob/main/docs/conversions/version.md
-2. Modify .env
+2. Modify `.env`
```bash
USER=root #no need to modify
@@ -136,7 +135,7 @@ DATA_DIR=./ #designate large disk directory
> **Note**
> This command can only be executed once. It will modify the component passwords in docker-compose based on the `PASSWORD` variable in `.env`, and modify the component passwords in `config/config.yaml`. If the password in `.env` changes, you need to first execute `docker-compose down`; `rm components -rf` and then execute this command.
-```
+```bash
make install
```
From 375105997f859613a4f529380d1d48aed2980595 Mon Sep 17 00:00:00 2001
From: Xinwei Xiong <3293172751NSS@gmail.com>
Date: Sun, 6 Aug 2023 15:39:06 +0800
Subject: [PATCH 28/59] Update README.md (#797)
---
README.md | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/README.md b/README.md
index 0ad2ac5f9..56d3f71ee 100644
--- a/README.md
+++ b/README.md
@@ -52,7 +52,9 @@ It's important to note that Open-IM-Server isn't a standalone product, and it do
1. **Comprehensive Message Type Support :speech_balloon:**
- ✅ Supports almost all types of messages, including text, images, emojis, voice, video, geographical location, files, quotes, business cards, system notifications, custom messages and more
+
+ ✅ Supports almost all types of messages, including text, images, emojis, voice, video, geographical location, files, quotes, business cards, system notifications, custom messages and more
+
✅ Supports one-on-one and multi-person audio and video calls
✅ Provides terminal support for multiple platforms such as iOS, Android, Flutter, uni-app, ReactNative, Electron, Web, H5
@@ -91,7 +93,7 @@ It's important to note that Open-IM-Server isn't a standalone product, and it do
8. **Full Platform Support :tv:**
- ✅ Supports native iOS, Android; cross-platform Flutter, uni-app, ReactNative; major web front-end frameworks such as React, Vue; applets; and PC platforms supported by Electron
+ ✅ Supports native iOS, Android; cross-platform Flutter, uni-app, ReactNative; major web front-end frameworks such as React, Vue; applets; and PC platforms supported by Electron
9. **The ultimate deployment experience 🤖**
@@ -99,10 +101,10 @@ It's important to note that Open-IM-Server isn't a standalone product, and it do
✅ Supports multi-architecture mirroring, our Docker images are hosted not only on GitHub but also on Alibaba Cloud and Docker Hub supporting multiple architectures. Visit [our GitHub packages](https://github.com/orgs/OpenIMSDK/packages?repo_name=Open-IM-Server) and read our [version management document](https://github.com/OpenIMSDK/Open-IM-Server/blob/main/docs/conversions/version.md) for more information.
-10. **A large ecosystem of open source communities 🤲**
+11. **A large ecosystem of open source communities 🤲**
✅ We have tens of thousands of users and many solutions to problems.
-
+
✅ We have a large open source community called [OpenIMSDK](https://github.com/OpenIMSDK) that runs the core modules, we have an open source community called [openim-sigs](https://github.com/openim-sigs) to explore more IM-based infrastructure products.
## :rocket: Quick Start
From 0b75c52a6ead8223f39ed4d75f36fee63d33dc1b Mon Sep 17 00:00:00 2001
From: Xinwei Xiong <3293172751NSS@gmail.com>
Date: Mon, 7 Aug 2023 10:01:55 +0800
Subject: [PATCH 29/59] Create README.md (#798)
---
assets/demo/README.md | 14 ++++++++++++++
1 file changed, 14 insertions(+)
create mode 100644 assets/demo/README.md
diff --git a/assets/demo/README.md b/assets/demo/README.md
new file mode 100644
index 000000000..e25af6c6a
--- /dev/null
+++ b/assets/demo/README.md
@@ -0,0 +1,14 @@
+## :star2: Why OpenIM
+
+**🔍 Function screenshot display**
+
+
+
+
+| multiple message | Efficient meetings |
+| :---------------------------------------: | :---------------------------------------------: |
+|  |  |
+| **One-to-one and group chats** | **Special features - Custom messages** |
+|  |  |
+
+
From 5ee54c9c2ab7a9ace6ea3ccc6e30e3962916d23a Mon Sep 17 00:00:00 2001
From: Xinwei Xiong <3293172751NSS@gmail.com>
Date: Mon, 7 Aug 2023 10:04:27 +0800
Subject: [PATCH 30/59] docs: add png file (#799)
---
assets/demo/efficient-meetings.png | Bin 0 -> 1442977 bytes
assets/demo/group-chat.png | Bin 0 -> 428165 bytes
assets/demo/multiple-message.png | Bin 0 -> 953198 bytes
assets/demo/special-function.png | Bin 0 -> 325259 bytes
4 files changed, 0 insertions(+), 0 deletions(-)
create mode 100644 assets/demo/efficient-meetings.png
create mode 100644 assets/demo/group-chat.png
create mode 100644 assets/demo/multiple-message.png
create mode 100644 assets/demo/special-function.png
diff --git a/assets/demo/efficient-meetings.png b/assets/demo/efficient-meetings.png
new file mode 100644
index 0000000000000000000000000000000000000000..46b009dc375119d57e7a55f3bab921b0b572ba47
GIT binary patch
literal 1442977
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