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