From 3700a33950da001e765de9235987777e53a49524 Mon Sep 17 00:00:00 2001 From: mo3et Date: Wed, 5 Nov 2025 10:43:02 +0800 Subject: [PATCH 1/2] chore: remove unused comments. --- cmd/openim-api/main.go | 14 - cmd/openim-cmdutils/main.go | 14 - cmd/openim-crontask/main.go | 14 - cmd/openim-msggateway/main.go | 14 - cmd/openim-msgtransfer/main.go | 14 - cmd/openim-push/main.go | 14 - cmd/openim-rpc/openim-rpc-auth/main.go | 14 - .../openim-rpc-conversation/main.go | 14 - cmd/openim-rpc/openim-rpc-friend/main.go | 14 - cmd/openim-rpc/openim-rpc-group/main.go | 14 - cmd/openim-rpc/openim-rpc-msg/main.go | 14 - cmd/openim-rpc/openim-rpc-third/main.go | 14 - cmd/openim-rpc/openim-rpc-user/main.go | 14 - internal/api/auth.go | 14 - internal/api/conversation.go | 14 - internal/api/custom_validator.go | 14 - internal/api/friend.go | 14 - internal/api/group.go | 24 - internal/api/init.go | 26 - internal/api/msg.go | 14 - internal/api/third.go | 14 - internal/api/user.go | 14 - internal/msggateway/callback.go | 14 - internal/msggateway/client.go | 14 - internal/msggateway/compressor.go | 14 - internal/msggateway/compressor_test.go | 14 - internal/msggateway/constant.go | 14 - internal/msggateway/context.go | 14 - internal/msggateway/encoder.go | 14 - internal/msggateway/http_error.go | 14 - internal/msggateway/hub_server.go | 35 -- internal/msggateway/init.go | 53 --- internal/msggateway/long_conn.go | 19 - internal/msggateway/message_handler.go | 14 - internal/msggateway/options.go | 14 - internal/msggateway/ws_server.go | 20 - internal/msgtransfer/init.go | 27 -- .../msgtransfer/online_history_msg_handler.go | 14 - .../online_msg_to_mongo_handler.go | 23 - internal/push/callback.go | 14 - internal/push/offlinepush/dummy/push.go | 14 - internal/push/offlinepush/fcm/push.go | 14 - internal/push/offlinepush/getui/body.go | 26 - internal/push/offlinepush/getui/push.go | 14 - .../push/offlinepush/jpush/body/audience.go | 14 - .../push/offlinepush/jpush/body/message.go | 14 - .../offlinepush/jpush/body/notification.go | 14 - .../push/offlinepush/jpush/body/options.go | 14 - .../push/offlinepush/jpush/body/platform.go | 14 - .../push/offlinepush/jpush/body/pushobj.go | 14 - internal/push/offlinepush/jpush/push.go | 14 - internal/push/offlinepush/offlinepusher.go | 14 - internal/rpc/auth/auth.go | 14 - internal/rpc/conversation/conversation.go | 14 - internal/rpc/conversation/notification.go | 14 - internal/rpc/group/cache.go | 14 - internal/rpc/group/callback.go | 14 - internal/rpc/group/convert.go | 14 - internal/rpc/group/db_map.go | 14 - internal/rpc/group/fill.go | 14 - internal/rpc/group/group.go | 14 - internal/rpc/group/notification.go | 26 - internal/rpc/group/statistics.go | 14 - internal/rpc/incrversion/option.go | 7 - internal/rpc/msg/as_read.go | 25 +- internal/rpc/msg/callback.go | 14 - internal/rpc/msg/delete.go | 14 - internal/rpc/msg/filter.go | 6 - internal/rpc/msg/msg_status.go | 14 - internal/rpc/msg/notification.go | 14 - internal/rpc/msg/revoke.go | 14 - internal/rpc/msg/send.go | 14 - internal/rpc/msg/seq.go | 14 - internal/rpc/msg/server.go | 14 - internal/rpc/msg/statistics.go | 14 - internal/rpc/msg/sync_msg.go | 14 - internal/rpc/msg/utils.go | 60 --- internal/rpc/msg/verify.go | 14 - internal/rpc/relation/black.go | 14 - internal/rpc/relation/callback.go | 14 - internal/rpc/relation/friend.go | 14 - internal/rpc/relation/notification.go | 36 -- internal/rpc/third/log.go | 14 - internal/rpc/third/s3.go | 14 - internal/rpc/third/third.go | 14 - internal/rpc/third/tool.go | 14 - internal/rpc/user/callback.go | 14 - internal/rpc/user/notification.go | 14 - internal/rpc/user/statistics.go | 14 - internal/rpc/user/user.go | 56 --- internal/tools/cron/s3.go | 43 -- pkg/apistruct/doc.go | 14 - pkg/apistruct/manage.go | 14 - pkg/apistruct/msg.go | 14 - pkg/apistruct/public.go | 14 - pkg/authverify/doc.go | 14 - pkg/authverify/token.go | 14 - pkg/callbackstruct/common.go | 14 - pkg/callbackstruct/constant.go | 14 - pkg/callbackstruct/doc.go | 14 - pkg/callbackstruct/friend.go | 14 - pkg/callbackstruct/group.go | 14 - pkg/callbackstruct/message.go | 14 - pkg/callbackstruct/msg_gateway.go | 14 - pkg/callbackstruct/push.go | 14 - pkg/callbackstruct/revoke.go | 14 - pkg/callbackstruct/user.go | 14 - pkg/common/cmd/api.go | 14 - pkg/common/cmd/auth.go | 14 - pkg/common/cmd/conversation.go | 14 - pkg/common/cmd/cron_task.go | 14 - pkg/common/cmd/doc.go | 14 - pkg/common/cmd/friend.go | 14 - pkg/common/cmd/group.go | 14 - pkg/common/cmd/msg.go | 14 - pkg/common/cmd/msg_gateway.go | 14 - pkg/common/cmd/msg_gateway_test.go | 14 - pkg/common/cmd/msg_transfer.go | 14 - pkg/common/cmd/msg_utils.go | 14 - pkg/common/cmd/push.go | 14 - pkg/common/cmd/third.go | 14 - pkg/common/cmd/user.go | 14 - pkg/common/config/config.go | 14 - pkg/common/config/constant.go | 14 - pkg/common/config/doc.go | 14 - pkg/common/config/parse.go | 14 - pkg/common/convert/black.go | 14 - pkg/common/convert/conversation.go | 14 - pkg/common/convert/doc.go | 14 - pkg/common/convert/friend.go | 14 - pkg/common/convert/group.go | 23 - pkg/common/convert/msg.go | 14 - pkg/common/convert/user.go | 14 - pkg/common/convert/user_test.go | 14 - .../discovery/direct/direct_resolver.go | 14 - pkg/common/discovery/direct/directconn.go | 173 ------- pkg/common/discovery/direct/doc.go | 14 - pkg/common/discovery/discoveryregister.go | 14 - .../discovery/discoveryregister_test.go | 47 -- pkg/common/discovery/doc.go | 14 - pkg/common/discovery/kubernetes/doc.go | 14 - pkg/common/ginprometheus/doc.go | 14 - pkg/common/ginprometheus/ginprometheus.go | 443 ------------------ pkg/common/prommetrics/grpc_auth.go | 14 - pkg/common/prommetrics/grpc_msg.go | 14 - pkg/common/prommetrics/grpc_msggateway.go | 14 - pkg/common/prommetrics/grpc_push.go | 14 - pkg/common/prommetrics/prommetrics.go | 14 - pkg/common/prommetrics/prommetrics_test.go | 68 --- pkg/common/prommetrics/transfer.go | 14 - pkg/common/servererrs/code.go | 14 - pkg/common/servererrs/predefine.go | 14 - pkg/common/servererrs/relation.go | 14 - pkg/common/startrpc/start.go | 14 - pkg/common/storage/cache/black.go | 14 - pkg/common/storage/cache/cachekey/black.go | 14 - .../storage/cache/cachekey/conversation.go | 14 - pkg/common/storage/cache/cachekey/doc.go | 14 - pkg/common/storage/cache/cachekey/friend.go | 14 - pkg/common/storage/cache/cachekey/group.go | 14 - pkg/common/storage/cache/cachekey/msg.go | 14 - pkg/common/storage/cache/cachekey/s3.go | 14 - pkg/common/storage/cache/cachekey/third.go | 14 - pkg/common/storage/cache/cachekey/user.go | 14 - pkg/common/storage/cache/conversation.go | 14 - pkg/common/storage/cache/doc.go | 14 - pkg/common/storage/cache/friend.go | 14 - pkg/common/storage/cache/group.go | 14 - pkg/common/storage/cache/msg.go | 14 - pkg/common/storage/cache/redis/batch_test.go | 9 - .../cache/redis/redis_shard_manager.go | 78 --- .../cache/redis/seq_conversation_test.go | 10 - pkg/common/storage/cache/s3.go | 14 - pkg/common/storage/cache/user.go | 14 - pkg/common/storage/common/types.go | 14 - pkg/common/storage/controller/auth.go | 8 - pkg/common/storage/controller/black.go | 14 - pkg/common/storage/controller/conversation.go | 14 - pkg/common/storage/controller/doc.go | 14 - pkg/common/storage/controller/friend.go | 14 - pkg/common/storage/controller/group.go | 14 - pkg/common/storage/controller/msg.go | 33 -- pkg/common/storage/controller/msg_transfer.go | 12 - pkg/common/storage/controller/push.go | 14 - pkg/common/storage/controller/s3.go | 14 - pkg/common/storage/controller/third.go | 14 - pkg/common/storage/controller/user.go | 14 - pkg/common/storage/database/black.go | 14 - pkg/common/storage/database/conversation.go | 14 - pkg/common/storage/database/doc.go | 14 - pkg/common/storage/database/friend.go | 14 - pkg/common/storage/database/friend_request.go | 14 - pkg/common/storage/database/group.go | 14 - pkg/common/storage/database/group_member.go | 14 - pkg/common/storage/database/group_request.go | 14 - pkg/common/storage/database/log.go | 14 - pkg/common/storage/database/mgo/black.go | 14 - pkg/common/storage/database/mgo/cache_test.go | 16 - .../storage/database/mgo/client_config.go | 14 - .../storage/database/mgo/conversation.go | 14 - pkg/common/storage/database/mgo/doc.go | 14 - pkg/common/storage/database/mgo/friend.go | 14 - .../storage/database/mgo/friend_request.go | 14 - pkg/common/storage/database/mgo/group.go | 14 - .../storage/database/mgo/group_member.go | 14 - .../storage/database/mgo/group_request.go | 14 - pkg/common/storage/database/mgo/helpers.go | 14 - pkg/common/storage/database/mgo/log.go | 14 - pkg/common/storage/database/mgo/msg.go | 20 - pkg/common/storage/database/mgo/msg_test.go | 56 --- pkg/common/storage/database/mgo/object.go | 14 - pkg/common/storage/database/mgo/user.go | 14 - .../storage/database/mgo/version_test.go | 7 - pkg/common/storage/database/msg.go | 14 - pkg/common/storage/database/object.go | 14 - pkg/common/storage/database/user.go | 14 - pkg/common/storage/model/black.go | 14 - pkg/common/storage/model/conversation.go | 14 - pkg/common/storage/model/doc.go | 14 - pkg/common/storage/model/friend.go | 14 - pkg/common/storage/model/friend_request.go | 14 - pkg/common/storage/model/group.go | 14 - pkg/common/storage/model/group_member.go | 14 - pkg/common/storage/model/group_request.go | 14 - pkg/common/storage/model/log.go | 14 - pkg/common/storage/model/msg.go | 14 - pkg/common/storage/model/object.go | 14 - pkg/common/storage/model/subscribe.go | 14 - pkg/common/storage/model/user.go | 14 - pkg/common/webhook/doc.go | 14 - pkg/common/webhook/http_client.go | 14 - pkg/common/webhook/http_client_test.go | 14 - pkg/localcache/cache.go | 14 - pkg/localcache/cache_test.go | 14 - pkg/localcache/doc.go | 14 - pkg/localcache/init.go | 14 - pkg/localcache/link/doc.go | 14 - pkg/localcache/link/link.go | 14 - pkg/localcache/link/link_test.go | 14 - pkg/localcache/lru/doc.go | 14 - pkg/localcache/lru/lru.go | 14 - pkg/localcache/lru/lru_expiration.go | 14 - pkg/localcache/lru/lru_lazy.go | 20 - pkg/localcache/lru/lru_lazy_test.go | 33 -- pkg/localcache/lru/lru_slot.go | 14 - pkg/localcache/option.go | 14 - pkg/localcache/tool.go | 14 - pkg/msgprocessor/conversation.go | 14 - pkg/msgprocessor/doc.go | 14 - pkg/msgprocessor/options.go | 14 - pkg/notification/common_user/common.go | 14 - pkg/notification/grouphash/grouphash.go | 14 - pkg/notification/msg.go | 14 - pkg/rpccache/common.go | 14 - pkg/rpccache/conversation.go | 14 - pkg/rpccache/doc.go | 14 - pkg/rpccache/friend.go | 14 - pkg/rpccache/group.go | 14 - pkg/rpccache/subscriber.go | 14 - pkg/rpccache/user.go | 14 - pkg/statistics/doc.go | 14 - pkg/statistics/statistics.go | 14 - test/e2e/api/token/token.go | 14 - test/e2e/api/user/curd.go | 14 - test/e2e/api/user/user.go | 14 - test/e2e/e2e.go | 33 -- test/e2e/e2e_test.go | 14 - test/e2e/framework/config/config.go | 14 - test/e2e/framework/config/config_test.go | 14 - .../framework/ginkgowrapper/ginkgowrapper.go | 14 - .../ginkgowrapper/ginkgowrapper_test.go | 14 - test/e2e/framework/helpers/chat/chat.go | 41 -- test/e2e/page/chat_page.go | 14 - test/e2e/page/login_page.go | 14 - test/jwt/main.go | 14 - tools/check-component/main.go | 14 - tools/imctl/main.go | 14 - tools/infra/main.go | 14 - tools/ncpu/main.go | 14 - tools/ncpu/main_test.go | 14 - tools/url2im/main.go | 14 - tools/url2im/pkg/api.go | 14 - tools/url2im/pkg/buffer.go | 14 - tools/url2im/pkg/config.go | 14 - tools/url2im/pkg/http.go | 14 - tools/url2im/pkg/manage.go | 14 - tools/url2im/pkg/md5.go | 14 - tools/url2im/pkg/progress.go | 14 - tools/versionchecker/main.go | 40 -- tools/yamlfmt/main.go | 14 - tools/yamlfmt/main_test.go | 14 - 291 files changed, 6 insertions(+), 5232 deletions(-) diff --git a/cmd/openim-api/main.go b/cmd/openim-api/main.go index 3690cfc99..f10e6c623 100644 --- a/cmd/openim-api/main.go +++ b/cmd/openim-api/main.go @@ -1,17 +1,3 @@ -// Copyright © 2023 OpenIM. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - package main import ( diff --git a/cmd/openim-cmdutils/main.go b/cmd/openim-cmdutils/main.go index 433eefb32..274928170 100644 --- a/cmd/openim-cmdutils/main.go +++ b/cmd/openim-cmdutils/main.go @@ -1,17 +1,3 @@ -// Copyright © 2023 OpenIM. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - package main import ( diff --git a/cmd/openim-crontask/main.go b/cmd/openim-crontask/main.go index 674506518..94f9c6260 100644 --- a/cmd/openim-crontask/main.go +++ b/cmd/openim-crontask/main.go @@ -1,17 +1,3 @@ -// Copyright © 2023 OpenIM. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - package main import ( diff --git a/cmd/openim-msggateway/main.go b/cmd/openim-msggateway/main.go index 6e3eda6bf..12d4ad13c 100644 --- a/cmd/openim-msggateway/main.go +++ b/cmd/openim-msggateway/main.go @@ -1,17 +1,3 @@ -// Copyright © 2023 OpenIM. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - package main import ( diff --git a/cmd/openim-msgtransfer/main.go b/cmd/openim-msgtransfer/main.go index 23b629d69..c30ecbbe3 100644 --- a/cmd/openim-msgtransfer/main.go +++ b/cmd/openim-msgtransfer/main.go @@ -1,17 +1,3 @@ -// Copyright © 2023 OpenIM. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - package main import ( diff --git a/cmd/openim-push/main.go b/cmd/openim-push/main.go index cd5106d17..5f0d42cb1 100644 --- a/cmd/openim-push/main.go +++ b/cmd/openim-push/main.go @@ -1,17 +1,3 @@ -// Copyright © 2023 OpenIM. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - package main import ( diff --git a/cmd/openim-rpc/openim-rpc-auth/main.go b/cmd/openim-rpc/openim-rpc-auth/main.go index 158b1f464..938e31bd2 100644 --- a/cmd/openim-rpc/openim-rpc-auth/main.go +++ b/cmd/openim-rpc/openim-rpc-auth/main.go @@ -1,17 +1,3 @@ -// Copyright © 2023 OpenIM. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - package main import ( diff --git a/cmd/openim-rpc/openim-rpc-conversation/main.go b/cmd/openim-rpc/openim-rpc-conversation/main.go index 5b2e66c95..73244cd86 100644 --- a/cmd/openim-rpc/openim-rpc-conversation/main.go +++ b/cmd/openim-rpc/openim-rpc-conversation/main.go @@ -1,17 +1,3 @@ -// Copyright © 2023 OpenIM. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - package main import ( diff --git a/cmd/openim-rpc/openim-rpc-friend/main.go b/cmd/openim-rpc/openim-rpc-friend/main.go index 745c40553..853a9181e 100644 --- a/cmd/openim-rpc/openim-rpc-friend/main.go +++ b/cmd/openim-rpc/openim-rpc-friend/main.go @@ -1,17 +1,3 @@ -// Copyright © 2023 OpenIM. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - package main import ( diff --git a/cmd/openim-rpc/openim-rpc-group/main.go b/cmd/openim-rpc/openim-rpc-group/main.go index 5badf934e..75d998a84 100644 --- a/cmd/openim-rpc/openim-rpc-group/main.go +++ b/cmd/openim-rpc/openim-rpc-group/main.go @@ -1,17 +1,3 @@ -// Copyright © 2023 OpenIM. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - package main import ( diff --git a/cmd/openim-rpc/openim-rpc-msg/main.go b/cmd/openim-rpc/openim-rpc-msg/main.go index 37f6cf237..bcc9946ac 100644 --- a/cmd/openim-rpc/openim-rpc-msg/main.go +++ b/cmd/openim-rpc/openim-rpc-msg/main.go @@ -1,17 +1,3 @@ -// Copyright © 2023 OpenIM. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - package main import ( diff --git a/cmd/openim-rpc/openim-rpc-third/main.go b/cmd/openim-rpc/openim-rpc-third/main.go index fcead5f89..48dd04d19 100644 --- a/cmd/openim-rpc/openim-rpc-third/main.go +++ b/cmd/openim-rpc/openim-rpc-third/main.go @@ -1,17 +1,3 @@ -// Copyright © 2023 OpenIM. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - package main import ( diff --git a/cmd/openim-rpc/openim-rpc-user/main.go b/cmd/openim-rpc/openim-rpc-user/main.go index 75ab90291..dc1fe1bc9 100644 --- a/cmd/openim-rpc/openim-rpc-user/main.go +++ b/cmd/openim-rpc/openim-rpc-user/main.go @@ -1,17 +1,3 @@ -// Copyright © 2023 OpenIM. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - package main import ( diff --git a/internal/api/auth.go b/internal/api/auth.go index 92d911b71..bbad5df0c 100644 --- a/internal/api/auth.go +++ b/internal/api/auth.go @@ -1,17 +1,3 @@ -// Copyright © 2023 OpenIM. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - package api import ( diff --git a/internal/api/conversation.go b/internal/api/conversation.go index 5a191c0ec..e222d893a 100644 --- a/internal/api/conversation.go +++ b/internal/api/conversation.go @@ -1,17 +1,3 @@ -// Copyright © 2023 OpenIM. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - package api import ( diff --git a/internal/api/custom_validator.go b/internal/api/custom_validator.go index 99c84f074..d74397647 100644 --- a/internal/api/custom_validator.go +++ b/internal/api/custom_validator.go @@ -1,17 +1,3 @@ -// Copyright © 2023 OpenIM. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - package api import ( diff --git a/internal/api/friend.go b/internal/api/friend.go index 0943e8a5d..cbe4d3f5e 100644 --- a/internal/api/friend.go +++ b/internal/api/friend.go @@ -1,17 +1,3 @@ -// Copyright © 2023 OpenIM. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - package api import ( diff --git a/internal/api/group.go b/internal/api/group.go index 926d19a8a..81649ab2b 100644 --- a/internal/api/group.go +++ b/internal/api/group.go @@ -1,17 +1,3 @@ -// Copyright © 2023 OpenIM. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - package api import ( @@ -74,7 +60,6 @@ func (o *GroupApi) GetSpecifiedUserGroupRequestInfo(c *gin.Context) { func (o *GroupApi) GetGroupsInfo(c *gin.Context) { a2r.Call(c, group.GroupClient.GetGroupsInfo, o.Client) - //a2r.Call(c, group.GroupClient.GetGroupsInfo, o.Client, c, a2r.NewNilReplaceOption(group.GroupClient.GetGroupsInfo)) } func (o *GroupApi) KickGroupMember(c *gin.Context) { @@ -83,7 +68,6 @@ func (o *GroupApi) KickGroupMember(c *gin.Context) { func (o *GroupApi) GetGroupMembersInfo(c *gin.Context) { a2r.Call(c, group.GroupClient.GetGroupMembersInfo, o.Client) - //a2r.Call(c, group.GroupClient.GetGroupMembersInfo, o.Client, c, a2r.NewNilReplaceOption(group.GroupClient.GetGroupMembersInfo)) } func (o *GroupApi) GetGroupMemberList(c *gin.Context) { @@ -126,14 +110,6 @@ func (o *GroupApi) GetGroupAbstractInfo(c *gin.Context) { a2r.Call(c, group.GroupClient.GetGroupAbstractInfo, o.Client) } -// func (g *Group) SetGroupMemberNickname(c *gin.Context) { -// a2r.Call(c, group.GroupClient.SetGroupMemberNickname, g.userClient) -//} -// -// func (g *Group) GetGroupAllMemberList(c *gin.Context) { -// a2r.Call(c, group.GroupClient.GetGroupAllMember, g.userClient) -//} - func (o *GroupApi) GroupCreateCount(c *gin.Context) { a2r.Call(c, group.GroupClient.GroupCreateCount, o.Client) } diff --git a/internal/api/init.go b/internal/api/init.go index f3548e29a..a41f9cf80 100644 --- a/internal/api/init.go +++ b/internal/api/init.go @@ -1,17 +1,3 @@ -// Copyright © 2023 OpenIM. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - package api import ( @@ -77,18 +63,6 @@ func Start(ctx context.Context, config *Config, client discovery.SvcDiscoveryReg apiCancel(err) }() - //if config.Discovery.Enable == conf.ETCD { - // cm := disetcd.NewConfigManager(client.(*etcd.SvcDiscoveryRegistryImpl).GetClient(), config.GetConfigNames()) - // cm.Watch(ctx) - //} - //sigs := make(chan os.Signal, 1) - //signal.Notify(sigs, syscall.SIGTERM) - //select { - //case val := <-sigs: - // log.ZDebug(ctx, "recv exit", "signal", val.String()) - // cancel(fmt.Errorf("signal %s", val.String())) - //case <-ctx.Done(): - //} <-apiCtx.Done() exitCause := context.Cause(apiCtx) log.ZWarn(ctx, "api server exit", exitCause) diff --git a/internal/api/msg.go b/internal/api/msg.go index 06fd14936..0dbc2f3e5 100644 --- a/internal/api/msg.go +++ b/internal/api/msg.go @@ -1,17 +1,3 @@ -// Copyright © 2023 OpenIM. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - package api import ( diff --git a/internal/api/third.go b/internal/api/third.go index 7ecb32911..8a762ea84 100644 --- a/internal/api/third.go +++ b/internal/api/third.go @@ -1,17 +1,3 @@ -// Copyright © 2023 OpenIM. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - package api import ( diff --git a/internal/api/user.go b/internal/api/user.go index 93a311a9b..9e1b7170f 100644 --- a/internal/api/user.go +++ b/internal/api/user.go @@ -1,17 +1,3 @@ -// Copyright © 2023 OpenIM. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - package api import ( diff --git a/internal/msggateway/callback.go b/internal/msggateway/callback.go index 1750f779b..2fcfd1203 100644 --- a/internal/msggateway/callback.go +++ b/internal/msggateway/callback.go @@ -1,17 +1,3 @@ -// 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 msggateway import ( diff --git a/internal/msggateway/client.go b/internal/msggateway/client.go index bdb62aece..98466e92c 100644 --- a/internal/msggateway/client.go +++ b/internal/msggateway/client.go @@ -1,17 +1,3 @@ -// 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 msggateway import ( diff --git a/internal/msggateway/compressor.go b/internal/msggateway/compressor.go index 52d315b79..d81f59005 100644 --- a/internal/msggateway/compressor.go +++ b/internal/msggateway/compressor.go @@ -1,17 +1,3 @@ -// 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 msggateway import ( diff --git a/internal/msggateway/compressor_test.go b/internal/msggateway/compressor_test.go index 952bd4d95..38dc283c0 100644 --- a/internal/msggateway/compressor_test.go +++ b/internal/msggateway/compressor_test.go @@ -1,17 +1,3 @@ -// 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 msggateway import ( diff --git a/internal/msggateway/constant.go b/internal/msggateway/constant.go index 1e7ab3bb7..94c64fa81 100644 --- a/internal/msggateway/constant.go +++ b/internal/msggateway/constant.go @@ -1,17 +1,3 @@ -// 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 msggateway import "time" diff --git a/internal/msggateway/context.go b/internal/msggateway/context.go index d73a96df4..af09b1641 100644 --- a/internal/msggateway/context.go +++ b/internal/msggateway/context.go @@ -1,17 +1,3 @@ -// 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 msggateway import ( diff --git a/internal/msggateway/encoder.go b/internal/msggateway/encoder.go index 6a5936d6d..22d4ae954 100644 --- a/internal/msggateway/encoder.go +++ b/internal/msggateway/encoder.go @@ -1,17 +1,3 @@ -// 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 msggateway import ( diff --git a/internal/msggateway/http_error.go b/internal/msggateway/http_error.go index 8d9d03522..3d90b7d99 100644 --- a/internal/msggateway/http_error.go +++ b/internal/msggateway/http_error.go @@ -1,17 +1,3 @@ -// 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 msggateway import ( diff --git a/internal/msggateway/hub_server.go b/internal/msggateway/hub_server.go index 8374af06d..b0c34c178 100644 --- a/internal/msggateway/hub_server.go +++ b/internal/msggateway/hub_server.go @@ -1,17 +1,3 @@ -// 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 msggateway import ( @@ -50,27 +36,6 @@ func (s *Server) InitServer(ctx context.Context, config *Config, disCov discover return nil } -//func (s *Server) Start(ctx context.Context, index int, conf *Config) error { -// return startrpc.Start(ctx, &conf.Discovery, &conf.MsgGateway.Prometheus, conf.MsgGateway.ListenIP, -// conf.MsgGateway.RPC.RegisterIP, -// conf.MsgGateway.RPC.AutoSetPorts, conf.MsgGateway.RPC.Ports, index, -// conf.Discovery.RpcService.MessageGateway, -// nil, -// conf, -// []string{ -// conf.Share.GetConfigFileName(), -// conf.Discovery.GetConfigFileName(), -// conf.MsgGateway.GetConfigFileName(), -// conf.WebhooksConfig.GetConfigFileName(), -// conf.RedisConfig.GetConfigFileName(), -// }, -// []string{ -// conf.Discovery.RpcService.MessageGateway, -// }, -// s.InitServer, -// ) -//} - type Server struct { msggateway.UnimplementedMsgGatewayServer diff --git a/internal/msggateway/init.go b/internal/msggateway/init.go index 40a57b1da..1a9fd065c 100644 --- a/internal/msggateway/init.go +++ b/internal/msggateway/init.go @@ -1,17 +1,3 @@ -// 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 msggateway import ( @@ -76,42 +62,3 @@ func Start(ctx context.Context, conf *Config, client discovery.SvcDiscoveryRegis return hubServer.LongConnServer.Run(ctx) } - -// -//// Start run ws server. -//func Start(ctx context.Context, index int, conf *Config) error { -// log.CInfo(ctx, "MSG-GATEWAY server is initializing", "runtimeEnv", runtimeenv.RuntimeEnvironment(), -// "rpcPorts", conf.MsgGateway.RPC.Ports, -// "wsPort", conf.MsgGateway.LongConnSvr.Ports, "prometheusPorts", conf.MsgGateway.Prometheus.Ports) -// wsPort, err := datautil.GetElemByIndex(conf.MsgGateway.LongConnSvr.Ports, index) -// if err != nil { -// return err -// } -// -// rdb, err := redisutil.NewRedisClient(ctx, conf.RedisConfig.Build()) -// if err != nil { -// return err -// } -// longServer := NewWsServer( -// conf, -// WithPort(wsPort), -// WithMaxConnNum(int64(conf.MsgGateway.LongConnSvr.WebsocketMaxConnNum)), -// WithHandshakeTimeout(time.Duration(conf.MsgGateway.LongConnSvr.WebsocketTimeout)*time.Second), -// WithMessageMaxMsgLength(conf.MsgGateway.LongConnSvr.WebsocketMaxMsgLen), -// ) -// -// hubServer := NewServer(longServer, conf, func(srv *Server) error { -// var err error -// longServer.online, err = rpccache.NewOnlineCache(srv.userClient, nil, rdb, false, longServer.subscriberUserOnlineStatusChanges) -// return err -// }) -// -// go longServer.ChangeOnlineStatus(4) -// -// netDone := make(chan error) -// go func() { -// err = hubServer.Start(ctx, index, conf) -// netDone <- err -// }() -// return hubServer.LongConnServer.Run(netDone) -//} diff --git a/internal/msggateway/long_conn.go b/internal/msggateway/long_conn.go index c1b3e27c9..0b8b56d25 100644 --- a/internal/msggateway/long_conn.go +++ b/internal/msggateway/long_conn.go @@ -1,17 +1,3 @@ -// 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 msggateway import ( @@ -123,11 +109,6 @@ func (d *GWebSocket) Dial(urlStr string, requestHeader http.Header) (*http.Respo func (d *GWebSocket) IsNil() bool { return d.conn == nil - // - // if d.conn != nil { - // return false - // } - // return true } func (d *GWebSocket) SetConnNil() { diff --git a/internal/msggateway/message_handler.go b/internal/msggateway/message_handler.go index ca15e1ef6..2008b5ff2 100644 --- a/internal/msggateway/message_handler.go +++ b/internal/msggateway/message_handler.go @@ -1,17 +1,3 @@ -// 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 msggateway import ( diff --git a/internal/msggateway/options.go b/internal/msggateway/options.go index b65f8e36c..99ac5a541 100644 --- a/internal/msggateway/options.go +++ b/internal/msggateway/options.go @@ -1,17 +1,3 @@ -// 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 msggateway import "time" diff --git a/internal/msggateway/ws_server.go b/internal/msggateway/ws_server.go index bc7a2fa5f..7725793b3 100644 --- a/internal/msggateway/ws_server.go +++ b/internal/msggateway/ws_server.go @@ -96,19 +96,6 @@ func (ws *WsServer) SetDiscoveryRegistry(ctx context.Context, disCov discovery.C return nil } -//func (ws *WsServer) SetUserOnlineStatus(ctx context.Context, client *Client, status int32) { -// err := ws.userClient.SetUserStatus(ctx, client.UserID, status, client.PlatformID) -// if err != nil { -// log.ZWarn(ctx, "SetUserStatus err", err) -// } -// switch status { -// case constant.Online: -// ws.webhookAfterUserOnline(ctx, &ws.msgGatewayConfig.WebhooksConfig.AfterUserOnline, client.UserID, client.PlatformID, client.IsBackground, client.ctx.GetConnID()) -// case constant.Offline: -// ws.webhookAfterUserOffline(ctx, &ws.msgGatewayConfig.WebhooksConfig.AfterUserOffline, client.UserID, client.PlatformID, client.ctx.GetConnID()) -// } -//} - func (ws *WsServer) UnRegister(c *Client) { ws.unregisterChan <- c } @@ -285,13 +272,6 @@ func (ws *WsServer) registerClient(client *Client) { _ = ws.sendUserOnlineInfoToOtherNode(client.ctx, client) }() } - - //wg.Add(1) - //go func() { - // defer wg.Done() - // ws.SetUserOnlineStatus(client.ctx, client, constant.Online) - //}() - wg.Wait() log.ZDebug(client.ctx, "user online", "online user Num", ws.onlineUserNum.Load(), "online user conn Num", ws.onlineUserConnNum.Load()) diff --git a/internal/msgtransfer/init.go b/internal/msgtransfer/init.go index 35026c79a..ade9c4a72 100644 --- a/internal/msgtransfer/init.go +++ b/internal/msgtransfer/init.go @@ -1,17 +1,3 @@ -// Copyright © 2023 OpenIM. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - package msgtransfer import ( @@ -73,19 +59,6 @@ func Start(ctx context.Context, config *Config, client discovery.SvcDiscoveryReg return err } - //if config.Discovery.Enable == conf.ETCD { - // cm := disetcd.NewConfigManager(client.(*etcd.SvcDiscoveryRegistryImpl).GetClient(), []string{ - // config.MsgTransfer.GetConfigFileName(), - // config.RedisConfig.GetConfigFileName(), - // config.MongodbConfig.GetConfigFileName(), - // config.KafkaConfig.GetConfigFileName(), - // config.Share.GetConfigFileName(), - // config.WebhooksConfig.GetConfigFileName(), - // config.Discovery.GetConfigFileName(), - // conf.LogConfigFileName, - // }) - // cm.Watch(ctx) - //} mongoProducer, err := builder.GetTopicProducer(ctx, config.KafkaConfig.ToMongoTopic) if err != nil { return err diff --git a/internal/msgtransfer/online_history_msg_handler.go b/internal/msgtransfer/online_history_msg_handler.go index 8b212774a..7a6a010c3 100644 --- a/internal/msgtransfer/online_history_msg_handler.go +++ b/internal/msgtransfer/online_history_msg_handler.go @@ -1,17 +1,3 @@ -// Copyright © 2023 OpenIM. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - package msgtransfer import ( diff --git a/internal/msgtransfer/online_msg_to_mongo_handler.go b/internal/msgtransfer/online_msg_to_mongo_handler.go index 147bd37b0..b12c09861 100644 --- a/internal/msgtransfer/online_msg_to_mongo_handler.go +++ b/internal/msgtransfer/online_msg_to_mongo_handler.go @@ -1,17 +1,3 @@ -// Copyright © 2023 OpenIM. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - package msgtransfer import ( @@ -66,13 +52,4 @@ func (mc *OnlineHistoryMongoConsumerHandler) HandleChatWs2Mongo(val mq.Message) for _, msgData := range msgFromMQ.MsgData { mc.webhookAfterMsgSaveDB(ctx, &mc.config.WebhooksConfig.AfterMsgSaveDB, msgData) } - - //var seqs []int64 - //for _, msg := range msgFromMQ.MsgData { - // seqs = append(seqs, msg.Seq) - //} - //if err := mc.msgTransferDatabase.DeleteMessagesFromCache(ctx, msgFromMQ.ConversationID, seqs); err != nil { - // log.ZError(ctx, "remove cache msg from redis err", err, "msg", - // msgFromMQ.MsgData, "conversationID", msgFromMQ.ConversationID) - //} } diff --git a/internal/push/callback.go b/internal/push/callback.go index 2d1b8090d..d8f98fb78 100644 --- a/internal/push/callback.go +++ b/internal/push/callback.go @@ -1,17 +1,3 @@ -// 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/push/offlinepush/dummy/push.go b/internal/push/offlinepush/dummy/push.go index 1babbc798..b3e405698 100644 --- a/internal/push/offlinepush/dummy/push.go +++ b/internal/push/offlinepush/dummy/push.go @@ -1,17 +1,3 @@ -// 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 dummy import ( diff --git a/internal/push/offlinepush/fcm/push.go b/internal/push/offlinepush/fcm/push.go index 463b72759..8a9d4b719 100644 --- a/internal/push/offlinepush/fcm/push.go +++ b/internal/push/offlinepush/fcm/push.go @@ -1,17 +1,3 @@ -// 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 fcm import ( diff --git a/internal/push/offlinepush/getui/body.go b/internal/push/offlinepush/getui/body.go index 2f2469b4f..013ad0124 100644 --- a/internal/push/offlinepush/getui/body.go +++ b/internal/push/offlinepush/getui/body.go @@ -1,17 +1,3 @@ -// 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 getui import ( @@ -74,18 +60,6 @@ type Settings struct { type strategy struct { Default int64 `json:"default"` - //IOS int64 `json:"ios"` - //St int64 `json:"st"` - //Hw int64 `json:"hw"` - //Ho int64 `json:"ho"` - //XM int64 `json:"xm"` - //XMG int64 `json:"xmg"` - //VV int64 `json:"vv"` - //Op int64 `json:"op"` - //OpG int64 `json:"opg"` - //MZ int64 `json:"mz"` - //HosHw int64 `json:"hoshw"` - //WX int64 `json:"wx"` } type Audience struct { diff --git a/internal/push/offlinepush/getui/push.go b/internal/push/offlinepush/getui/push.go index e82b62c7a..9bb5ce459 100644 --- a/internal/push/offlinepush/getui/push.go +++ b/internal/push/offlinepush/getui/push.go @@ -1,17 +1,3 @@ -// 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 getui import ( diff --git a/internal/push/offlinepush/jpush/body/audience.go b/internal/push/offlinepush/jpush/body/audience.go index 9db66ffe6..44e34592d 100644 --- a/internal/push/offlinepush/jpush/body/audience.go +++ b/internal/push/offlinepush/jpush/body/audience.go @@ -1,17 +1,3 @@ -// 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 body const ( diff --git a/internal/push/offlinepush/jpush/body/message.go b/internal/push/offlinepush/jpush/body/message.go index e885d1d69..ebd23aca2 100644 --- a/internal/push/offlinepush/jpush/body/message.go +++ b/internal/push/offlinepush/jpush/body/message.go @@ -1,17 +1,3 @@ -// 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 body type Message struct { diff --git a/internal/push/offlinepush/jpush/body/notification.go b/internal/push/offlinepush/jpush/body/notification.go index 383b3fb26..58d872e37 100644 --- a/internal/push/offlinepush/jpush/body/notification.go +++ b/internal/push/offlinepush/jpush/body/notification.go @@ -1,17 +1,3 @@ -// 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 body import ( diff --git a/internal/push/offlinepush/jpush/body/options.go b/internal/push/offlinepush/jpush/body/options.go index 2edf80cf0..323637414 100644 --- a/internal/push/offlinepush/jpush/body/options.go +++ b/internal/push/offlinepush/jpush/body/options.go @@ -1,17 +1,3 @@ -// 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 body type Options struct { diff --git a/internal/push/offlinepush/jpush/body/platform.go b/internal/push/offlinepush/jpush/body/platform.go index 5654165fa..e7026fe66 100644 --- a/internal/push/offlinepush/jpush/body/platform.go +++ b/internal/push/offlinepush/jpush/body/platform.go @@ -1,17 +1,3 @@ -// 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 body import ( diff --git a/internal/push/offlinepush/jpush/body/pushobj.go b/internal/push/offlinepush/jpush/body/pushobj.go index 3dc133d0a..e56285d18 100644 --- a/internal/push/offlinepush/jpush/body/pushobj.go +++ b/internal/push/offlinepush/jpush/body/pushobj.go @@ -1,17 +1,3 @@ -// 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 body type PushObj struct { diff --git a/internal/push/offlinepush/jpush/push.go b/internal/push/offlinepush/jpush/push.go index 2694902f2..fd64a32c8 100644 --- a/internal/push/offlinepush/jpush/push.go +++ b/internal/push/offlinepush/jpush/push.go @@ -1,17 +1,3 @@ -// 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 jpush import ( diff --git a/internal/push/offlinepush/offlinepusher.go b/internal/push/offlinepush/offlinepusher.go index 17d5d7071..2e4c5c602 100644 --- a/internal/push/offlinepush/offlinepusher.go +++ b/internal/push/offlinepush/offlinepusher.go @@ -1,17 +1,3 @@ -// 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 offlinepush import ( diff --git a/internal/rpc/auth/auth.go b/internal/rpc/auth/auth.go index a78a714ca..80a3de67d 100644 --- a/internal/rpc/auth/auth.go +++ b/internal/rpc/auth/auth.go @@ -1,17 +1,3 @@ -// 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 auth import ( diff --git a/internal/rpc/conversation/conversation.go b/internal/rpc/conversation/conversation.go index c9bfd3c56..6d2c27e92 100644 --- a/internal/rpc/conversation/conversation.go +++ b/internal/rpc/conversation/conversation.go @@ -1,17 +1,3 @@ -// Copyright © 2023 OpenIM. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - package conversation import ( diff --git a/internal/rpc/conversation/notification.go b/internal/rpc/conversation/notification.go index 6e865ba42..95cd6d90f 100644 --- a/internal/rpc/conversation/notification.go +++ b/internal/rpc/conversation/notification.go @@ -1,17 +1,3 @@ -// Copyright © 2023 OpenIM. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - package conversation import ( diff --git a/internal/rpc/group/cache.go b/internal/rpc/group/cache.go index 27b9eb126..f9938748e 100644 --- a/internal/rpc/group/cache.go +++ b/internal/rpc/group/cache.go @@ -1,17 +1,3 @@ -// Copyright © 2023 OpenIM. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - package group import ( diff --git a/internal/rpc/group/callback.go b/internal/rpc/group/callback.go index 8ed4afe5a..dbb7ba49c 100644 --- a/internal/rpc/group/callback.go +++ b/internal/rpc/group/callback.go @@ -1,17 +1,3 @@ -// Copyright © 2023 OpenIM. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - package group import ( diff --git a/internal/rpc/group/convert.go b/internal/rpc/group/convert.go index 26277a56d..6bc776532 100644 --- a/internal/rpc/group/convert.go +++ b/internal/rpc/group/convert.go @@ -1,17 +1,3 @@ -// Copyright © 2023 OpenIM. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - package group import ( diff --git a/internal/rpc/group/db_map.go b/internal/rpc/group/db_map.go index 7504bc851..07e5ad223 100644 --- a/internal/rpc/group/db_map.go +++ b/internal/rpc/group/db_map.go @@ -1,17 +1,3 @@ -// Copyright © 2023 OpenIM. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - package group import ( diff --git a/internal/rpc/group/fill.go b/internal/rpc/group/fill.go index 186506a55..0e70d1868 100644 --- a/internal/rpc/group/fill.go +++ b/internal/rpc/group/fill.go @@ -1,17 +1,3 @@ -// Copyright © 2023 OpenIM. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - package group import ( diff --git a/internal/rpc/group/group.go b/internal/rpc/group/group.go index 3700c054a..e32017586 100644 --- a/internal/rpc/group/group.go +++ b/internal/rpc/group/group.go @@ -1,17 +1,3 @@ -// Copyright © 2023 OpenIM. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - package group import ( diff --git a/internal/rpc/group/notification.go b/internal/rpc/group/notification.go index 5a3cbbe26..850313455 100644 --- a/internal/rpc/group/notification.go +++ b/internal/rpc/group/notification.go @@ -1,17 +1,3 @@ -// Copyright © 2023 OpenIM. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - package group import ( @@ -223,18 +209,6 @@ func (g *NotificationSender) groupMemberDB2PB(member *model.GroupMember, appMang } } -/* func (g *NotificationSender) getUsersInfoMap(ctx context.Context, userIDs []string) (map[string]*sdkws.UserInfo, error) { - users, err := g.getUsersInfo(ctx, userIDs) - if err != nil { - return nil, err - } - result := make(map[string]*sdkws.UserInfo) - for _, user := range users { - result[user.GetUserID()] = user.(*sdkws.UserInfo) - } - return result, nil -} */ - func (g *NotificationSender) fillOpUser(ctx context.Context, targetUser **sdkws.GroupMemberFullInfo, groupID string) (err error) { return g.fillUserByUserID(ctx, mcontext.GetOpUserID(ctx), targetUser, groupID) } diff --git a/internal/rpc/group/statistics.go b/internal/rpc/group/statistics.go index 4ee3396da..17b3ec62e 100644 --- a/internal/rpc/group/statistics.go +++ b/internal/rpc/group/statistics.go @@ -1,17 +1,3 @@ -// Copyright © 2023 OpenIM. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - package group import ( diff --git a/internal/rpc/incrversion/option.go b/internal/rpc/incrversion/option.go index af1200d5c..13ab04c78 100644 --- a/internal/rpc/incrversion/option.go +++ b/internal/rpc/incrversion/option.go @@ -9,13 +9,6 @@ import ( "go.mongodb.org/mongo-driver/bson/primitive" ) -//func Limit(maxSync int, version uint64) int { -// if version == 0 { -// return 0 -// } -// return maxSync -//} - const syncLimit = 200 const ( diff --git a/internal/rpc/msg/as_read.go b/internal/rpc/msg/as_read.go index c52ce9c07..2ccce2edd 100644 --- a/internal/rpc/msg/as_read.go +++ b/internal/rpc/msg/as_read.go @@ -1,17 +1,3 @@ -// Copyright © 2023 OpenIM. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - package msg import ( @@ -160,7 +146,8 @@ func (m *msgServer) MarkConversationAsRead(ctx context.Context, req *msg.MarkCon var seqs []int64 log.ZDebug(ctx, "MarkConversationAsRead", "hasReadSeq", hasReadSeq, "req.HasReadSeq", req.HasReadSeq) - if conversation.ConversationType == constant.SingleChatType { + switch conversation.ConversationType { + case constant.SingleChatType: for i := hasReadSeq + 1; i <= req.HasReadSeq; i++ { seqs = append(seqs, i) } @@ -185,8 +172,7 @@ func (m *msgServer) MarkConversationAsRead(ctx context.Context, req *msg.MarkCon } m.sendMarkAsReadNotification(ctx, req.ConversationID, conversation.ConversationType, req.UserID, m.conversationAndGetRecvID(conversation, req.UserID), seqs, hasReadSeq) - } else if conversation.ConversationType == constant.ReadGroupChatType || - conversation.ConversationType == constant.NotificationChatType { + case constant.ReadGroupChatType, constant.NotificationChatType: if req.HasReadSeq > hasReadSeq { err = m.MsgDatabase.SetHasReadSeq(ctx, req.UserID, req.ConversationID, req.HasReadSeq) if err != nil { @@ -198,7 +184,8 @@ func (m *msgServer) MarkConversationAsRead(ctx context.Context, req *msg.MarkCon req.UserID, seqs, hasReadSeq) } - if conversation.ConversationType == constant.SingleChatType { + switch conversation.ConversationType { + case constant.SingleChatType: reqCall := &cbapi.CallbackSingleMsgReadReq{ ConversationID: conversation.ConversationID, UserID: conversation.OwnerUserID, @@ -206,7 +193,7 @@ func (m *msgServer) MarkConversationAsRead(ctx context.Context, req *msg.MarkCon ContentType: conversation.ConversationType, } m.webhookAfterSingleMsgRead(ctx, &m.config.WebhooksConfig.AfterSingleMsgRead, reqCall) - } else if conversation.ConversationType == constant.ReadGroupChatType { + case constant.ReadGroupChatType: reqCall := &cbapi.CallbackGroupMsgReadReq{ SendID: conversation.OwnerUserID, ReceiveID: req.UserID, diff --git a/internal/rpc/msg/callback.go b/internal/rpc/msg/callback.go index 49fb04477..782fbc50f 100644 --- a/internal/rpc/msg/callback.go +++ b/internal/rpc/msg/callback.go @@ -1,17 +1,3 @@ -// Copyright © 2023 OpenIM. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - package msg import ( diff --git a/internal/rpc/msg/delete.go b/internal/rpc/msg/delete.go index d24420ebb..39bfeaf1e 100644 --- a/internal/rpc/msg/delete.go +++ b/internal/rpc/msg/delete.go @@ -1,17 +1,3 @@ -// Copyright © 2023 OpenIM. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - package msg import ( diff --git a/internal/rpc/msg/filter.go b/internal/rpc/msg/filter.go index 36511ec7b..aa5d4d508 100644 --- a/internal/rpc/msg/filter.go +++ b/internal/rpc/msg/filter.go @@ -35,12 +35,6 @@ func filterMsg(msg *pbchat.SendMsgReq, attentionIds []string, deniedTypes []int3 if len(deniedTypes) != 0 && datautil.Contain(msg.MsgData.ContentType, deniedTypes...) { return false } - //if len(allowedTypes) != 0 && !isInInterval(msg.MsgData.ContentType, allowedTypes) { - // return false - //} - //if len(deniedTypes) != 0 && isInInterval(msg.MsgData.ContentType, deniedTypes) { - // return false - //} return true } diff --git a/internal/rpc/msg/msg_status.go b/internal/rpc/msg/msg_status.go index b524d6236..d086ef8cc 100644 --- a/internal/rpc/msg/msg_status.go +++ b/internal/rpc/msg/msg_status.go @@ -1,17 +1,3 @@ -// Copyright © 2023 OpenIM. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - package msg import ( diff --git a/internal/rpc/msg/notification.go b/internal/rpc/msg/notification.go index 0418823d6..18c66ab2f 100644 --- a/internal/rpc/msg/notification.go +++ b/internal/rpc/msg/notification.go @@ -1,17 +1,3 @@ -// Copyright © 2023 OpenIM. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - package msg import ( diff --git a/internal/rpc/msg/revoke.go b/internal/rpc/msg/revoke.go index 1f4d6be68..5b1e69982 100644 --- a/internal/rpc/msg/revoke.go +++ b/internal/rpc/msg/revoke.go @@ -1,17 +1,3 @@ -// Copyright © 2023 OpenIM. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - package msg import ( diff --git a/internal/rpc/msg/send.go b/internal/rpc/msg/send.go index 18ad9cc56..0d058d4c4 100644 --- a/internal/rpc/msg/send.go +++ b/internal/rpc/msg/send.go @@ -1,17 +1,3 @@ -// Copyright © 2023 OpenIM. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - package msg import ( diff --git a/internal/rpc/msg/seq.go b/internal/rpc/msg/seq.go index 6a0461dc8..d5e29f116 100644 --- a/internal/rpc/msg/seq.go +++ b/internal/rpc/msg/seq.go @@ -1,17 +1,3 @@ -// Copyright © 2023 OpenIM. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - package msg import ( diff --git a/internal/rpc/msg/server.go b/internal/rpc/msg/server.go index 48101cdd7..131de165e 100644 --- a/internal/rpc/msg/server.go +++ b/internal/rpc/msg/server.go @@ -1,17 +1,3 @@ -// Copyright © 2023 OpenIM. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - package msg import ( diff --git a/internal/rpc/msg/statistics.go b/internal/rpc/msg/statistics.go index b1f90cae4..d1b78f886 100644 --- a/internal/rpc/msg/statistics.go +++ b/internal/rpc/msg/statistics.go @@ -1,17 +1,3 @@ -// Copyright © 2023 OpenIM. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - package msg import ( diff --git a/internal/rpc/msg/sync_msg.go b/internal/rpc/msg/sync_msg.go index 259c7f85d..2d0ff89dc 100644 --- a/internal/rpc/msg/sync_msg.go +++ b/internal/rpc/msg/sync_msg.go @@ -1,17 +1,3 @@ -// Copyright © 2023 OpenIM. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - package msg import ( diff --git a/internal/rpc/msg/utils.go b/internal/rpc/msg/utils.go index e3490848c..0a6d7573c 100644 --- a/internal/rpc/msg/utils.go +++ b/internal/rpc/msg/utils.go @@ -1,17 +1,3 @@ -// Copyright © 2023 OpenIM. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - package msg import ( @@ -43,49 +29,3 @@ func (s activeConversations) Less(i, j int) bool { func (s activeConversations) Swap(i, j int) { s[i], s[j] = s[j], s[i] } - -//type seqTime struct { -// ConversationID string -// Seq int64 -// Time int64 -// Unread int64 -// Pinned bool -//} -// -//func (s seqTime) String() string { -// return fmt.Sprintf("", s.Time, s.Unread, s.Pinned) -//} -// -//type seqTimes []seqTime -// -//func (s seqTimes) Len() int { -// return len(s) -//} -// -//// Less sticky priority, unread priority, time descending -//func (s seqTimes) Less(i, j int) bool { -// iv, jv := s[i], s[j] -// if iv.Pinned && (!jv.Pinned) { -// return true -// } -// if jv.Pinned && (!iv.Pinned) { -// return false -// } -// if iv.Unread > 0 && jv.Unread == 0 { -// return true -// } -// if jv.Unread > 0 && iv.Unread == 0 { -// return false -// } -// return iv.Time > jv.Time -//} -// -//func (s seqTimes) Swap(i, j int) { -// s[i], s[j] = s[j], s[i] -//} -// -//type conversationStatus struct { -// ConversationID string -// Pinned bool -// Recv bool -//} diff --git a/internal/rpc/msg/verify.go b/internal/rpc/msg/verify.go index d0f36a388..56d52dfbc 100644 --- a/internal/rpc/msg/verify.go +++ b/internal/rpc/msg/verify.go @@ -1,17 +1,3 @@ -// Copyright © 2023 OpenIM. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - package msg import ( diff --git a/internal/rpc/relation/black.go b/internal/rpc/relation/black.go index 07a1537b1..904d1e786 100644 --- a/internal/rpc/relation/black.go +++ b/internal/rpc/relation/black.go @@ -1,17 +1,3 @@ -// Copyright © 2023 OpenIM. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - package relation import ( diff --git a/internal/rpc/relation/callback.go b/internal/rpc/relation/callback.go index 09debdea1..c08c9cfb5 100644 --- a/internal/rpc/relation/callback.go +++ b/internal/rpc/relation/callback.go @@ -1,17 +1,3 @@ -// Copyright © 2023 OpenIM. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - package relation import ( diff --git a/internal/rpc/relation/friend.go b/internal/rpc/relation/friend.go index 43909c8e3..0659dd9d6 100644 --- a/internal/rpc/relation/friend.go +++ b/internal/rpc/relation/friend.go @@ -1,17 +1,3 @@ -// Copyright © 2023 OpenIM. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - package relation import ( diff --git a/internal/rpc/relation/notification.go b/internal/rpc/relation/notification.go index 4ee45e197..2a0955d5b 100644 --- a/internal/rpc/relation/notification.go +++ b/internal/rpc/relation/notification.go @@ -1,17 +1,3 @@ -// Copyright © 2023 OpenIM. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - package relation import ( @@ -211,28 +197,6 @@ func (f *FriendNotificationSender) FriendApplicationRefusedNotification(ctx cont f.Notification(ctx, req.ToUserID, req.FromUserID, constant.FriendApplicationRejectedNotification, &tips) } -//func (f *FriendNotificationSender) FriendAddedNotification(ctx context.Context, operationID, opUserID, fromUserID, toUserID string) error { -// tips := sdkws.FriendAddedTips{Friend: &sdkws.FriendInfo{}, OpUser: &sdkws.PublicUserInfo{}} -// user, err := f.getUsersInfo(ctx, []string{opUserID}) -// if err != nil { -// return err -// } -// tips.OpUser.UserID = user[0].GetUserID() -// tips.OpUser.Ex = user[0].GetEx() -// tips.OpUser.Nickname = user[0].GetNickname() -// tips.OpUser.FaceURL = user[0].GetFaceURL() -// friends, err := f.db.FindFriendsWithError(ctx, fromUserID, []string{toUserID}) -// if err != nil { -// return err -// } -// tips.Friend, err = convert.FriendDB2Pb(ctx, friends[0], f.getUsersInfoMap) -// if err != nil { -// return err -// } -// f.Notification(ctx, fromUserID, toUserID, constant.FriendAddedNotification, &tips) -// return nil -//} - func (f *FriendNotificationSender) FriendDeletedNotification(ctx context.Context, req *relation.DeleteFriendReq) { tips := sdkws.FriendDeletedTips{FromToUserID: &sdkws.FromToUserID{ FromUserID: req.OwnerUserID, diff --git a/internal/rpc/third/log.go b/internal/rpc/third/log.go index 9a4995ace..8182f27af 100644 --- a/internal/rpc/third/log.go +++ b/internal/rpc/third/log.go @@ -1,17 +1,3 @@ -// Copyright © 2023 OpenIM. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - package third import ( diff --git a/internal/rpc/third/s3.go b/internal/rpc/third/s3.go index bfdd9f1b8..0c04bb213 100644 --- a/internal/rpc/third/s3.go +++ b/internal/rpc/third/s3.go @@ -1,17 +1,3 @@ -// Copyright © 2023 OpenIM. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - package third import ( diff --git a/internal/rpc/third/third.go b/internal/rpc/third/third.go index cea6a8522..13bb68856 100644 --- a/internal/rpc/third/third.go +++ b/internal/rpc/third/third.go @@ -1,17 +1,3 @@ -// Copyright © 2023 OpenIM. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - package third import ( diff --git a/internal/rpc/third/tool.go b/internal/rpc/third/tool.go index a063fa654..cb0c6afd5 100644 --- a/internal/rpc/third/tool.go +++ b/internal/rpc/third/tool.go @@ -1,17 +1,3 @@ -// Copyright © 2023 OpenIM. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - package third import ( diff --git a/internal/rpc/user/callback.go b/internal/rpc/user/callback.go index b58053c5a..fe2d241a4 100644 --- a/internal/rpc/user/callback.go +++ b/internal/rpc/user/callback.go @@ -1,17 +1,3 @@ -// Copyright © 2023 OpenIM. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - package user import ( diff --git a/internal/rpc/user/notification.go b/internal/rpc/user/notification.go index 4fb214f74..abc393e01 100644 --- a/internal/rpc/user/notification.go +++ b/internal/rpc/user/notification.go @@ -1,17 +1,3 @@ -// Copyright © 2023 OpenIM. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - package user import ( diff --git a/internal/rpc/user/statistics.go b/internal/rpc/user/statistics.go index 709c0146b..57f59b6f9 100644 --- a/internal/rpc/user/statistics.go +++ b/internal/rpc/user/statistics.go @@ -1,17 +1,3 @@ -// Copyright © 2023 OpenIM. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - package user import ( diff --git a/internal/rpc/user/user.go b/internal/rpc/user/user.go index 91dfe736e..8ff6901d8 100644 --- a/internal/rpc/user/user.go +++ b/internal/rpc/user/user.go @@ -1,17 +1,3 @@ -// Copyright © 2023 OpenIM. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - package user import ( @@ -153,8 +139,6 @@ func (s *userServer) GetDesignateUsers(ctx context.Context, req *pbuser.GetDesig return resp, nil } -// deprecated: -// UpdateUserInfo func (s *userServer) UpdateUserInfo(ctx context.Context, req *pbuser.UpdateUserInfoReq) (resp *pbuser.UpdateUserInfoResp, err error) { resp = &pbuser.UpdateUserInfoResp{} err = authverify.CheckAccess(ctx, req.UserInfo.UserID) @@ -205,19 +189,6 @@ func (s *userServer) UpdateUserInfoEx(ctx context.Context, req *pbuser.UpdateUse s.friendNotificationSender.UserInfoUpdatedNotification(ctx, req.UserInfo.UserID) - //friends, err := s.friendRpcClient.GetFriendIDs(ctx, req.UserInfo.UserID) - //if err != nil { - // return nil, err - //} - //if req.UserInfo.Nickname != nil || req.UserInfo.FaceURL != nil { - // if err := s.NotificationUserInfoUpdate(ctx, req.UserInfo.UserID); err != nil { - // return nil, err - // } - //} - //for _, friendID := range friends { - // s.friendNotificationSender.FriendInfoUpdatedNotification(ctx, req.UserInfo.UserID, friendID) - //} - s.webhookAfterUpdateUserInfoEx(ctx, &s.config.WebhooksConfig.AfterUpdateUserInfoEx, req) if err := s.NotificationUserInfoUpdate(ctx, req.UserInfo.UserID, oldUser); err != nil { return nil, err @@ -290,10 +261,6 @@ func (s *userServer) UserRegister(ctx context.Context, req *pbuser.UserRegisterR if len(req.Users) == 0 { return nil, errs.ErrArgs.WrapMsg("users is empty") } - // check if secret is changed - //if s.config.Share.Secret == defaultSecret { - // return nil, servererrs.ErrSecretNotChanged.Wrap() - //} if err = authverify.CheckAdmin(ctx); err != nil { return nil, err } @@ -350,8 +317,6 @@ func (s *userServer) GetGlobalRecvMessageOpt(ctx context.Context, req *pbuser.Ge } return &pbuser.GetGlobalRecvMessageOptResp{GlobalRecvMsgOpt: user[0].GlobalRecvMsgOpt}, nil } - -// GetAllUserID Get user account by page. func (s *userServer) GetAllUserID(ctx context.Context, req *pbuser.GetAllUserIDReq) (resp *pbuser.GetAllUserIDResp, err error) { total, userIDs, err := s.db.GetAllUserID(ctx, req.Pagination) if err != nil { @@ -360,7 +325,6 @@ func (s *userServer) GetAllUserID(ctx context.Context, req *pbuser.GetAllUserIDR return &pbuser.GetAllUserIDResp{Total: int32(total), UserIDs: userIDs}, nil } -// ProcessUserCommandAdd user general function add. func (s *userServer) ProcessUserCommandAdd(ctx context.Context, req *pbuser.ProcessUserCommandAddReq) (*pbuser.ProcessUserCommandAddResp, error) { err := authverify.CheckAccess(ctx, req.UserID) if err != nil { @@ -375,7 +339,6 @@ func (s *userServer) ProcessUserCommandAdd(ctx context.Context, req *pbuser.Proc if req.Ex != nil { value = req.Ex.Value } - // Assuming you have a method in s.storage to add a user command err = s.db.AddUserCommand(ctx, req.UserID, req.Type, req.Uuid, value, ex) if err != nil { return nil, err @@ -388,7 +351,6 @@ func (s *userServer) ProcessUserCommandAdd(ctx context.Context, req *pbuser.Proc return &pbuser.ProcessUserCommandAddResp{}, nil } -// ProcessUserCommandDelete user general function delete. func (s *userServer) ProcessUserCommandDelete(ctx context.Context, req *pbuser.ProcessUserCommandDeleteReq) (*pbuser.ProcessUserCommandDeleteResp, error) { err := authverify.CheckAccess(ctx, req.UserID) if err != nil { @@ -406,8 +368,6 @@ func (s *userServer) ProcessUserCommandDelete(ctx context.Context, req *pbuser.P s.userNotificationSender.UserCommandDeleteNotification(ctx, tips) return &pbuser.ProcessUserCommandDeleteResp{}, nil } - -// ProcessUserCommandUpdate user general function update. func (s *userServer) ProcessUserCommandUpdate(ctx context.Context, req *pbuser.ProcessUserCommandUpdateReq) (*pbuser.ProcessUserCommandUpdateResp, error) { err := authverify.CheckAccess(ctx, req.UserID) if err != nil { @@ -415,7 +375,6 @@ func (s *userServer) ProcessUserCommandUpdate(ctx context.Context, req *pbuser.P } val := make(map[string]any) - // Map fields from eax to val if req.Value != nil { val["value"] = req.Value.Value } @@ -423,7 +382,6 @@ func (s *userServer) ProcessUserCommandUpdate(ctx context.Context, req *pbuser.P val["ex"] = req.Ex.Value } - // Assuming you have a method in s.storage to update a user command err = s.db.UpdateUserCommand(ctx, req.UserID, req.Type, req.Uuid, val) if err != nil { return nil, err @@ -442,17 +400,14 @@ func (s *userServer) ProcessUserCommandGet(ctx context.Context, req *pbuser.Proc if err != nil { return nil, err } - // Fetch user commands from the database commands, err := s.db.GetUserCommands(ctx, req.UserID, req.Type) if err != nil { return nil, err } - // Initialize commandInfoSlice as an empty slice commandInfoSlice := make([]*pbuser.CommandInfoResp, 0, len(commands)) for _, command := range commands { - // No need to use index since command is already a pointer commandInfoSlice = append(commandInfoSlice, &pbuser.CommandInfoResp{ Type: command.Type, Uuid: command.Uuid, @@ -462,7 +417,6 @@ func (s *userServer) ProcessUserCommandGet(ctx context.Context, req *pbuser.Proc }) } - // Return the response with the slice return &pbuser.ProcessUserCommandGetResp{CommandResp: commandInfoSlice}, nil } @@ -471,17 +425,14 @@ func (s *userServer) ProcessUserCommandGetAll(ctx context.Context, req *pbuser.P if err != nil { return nil, err } - // Fetch user commands from the database commands, err := s.db.GetAllUserCommands(ctx, req.UserID) if err != nil { return nil, err } - // Initialize commandInfoSlice as an empty slice commandInfoSlice := make([]*pbuser.AllCommandInfoResp, 0, len(commands)) for _, command := range commands { - // No need to use index since command is already a pointer commandInfoSlice = append(commandInfoSlice, &pbuser.AllCommandInfoResp{ Type: command.Type, Uuid: command.Uuid, @@ -491,7 +442,6 @@ func (s *userServer) ProcessUserCommandGetAll(ctx context.Context, req *pbuser.P }) } - // Return the response with the slice return &pbuser.ProcessUserCommandGetAllResp{CommandResp: commandInfoSlice}, nil } @@ -568,7 +518,6 @@ func (s *userServer) UpdateNotificationAccountInfo(ctx context.Context, req *pbu } func (s *userServer) SearchNotificationAccount(ctx context.Context, req *pbuser.SearchNotificationAccountReq) (*pbuser.SearchNotificationAccountResp, error) { - // Check if user is an admin if err := authverify.CheckAdmin(ctx); err != nil { return nil, err } @@ -576,21 +525,17 @@ func (s *userServer) SearchNotificationAccount(ctx context.Context, req *pbuser. var users []*tablerelation.User var err error - // If a keyword is provided in the request if req.Keyword != "" { - // Find users by keyword users, err = s.db.Find(ctx, []string{req.Keyword}) if err != nil { return nil, err } - // Convert users to response format resp := s.userModelToResp(users, req.Pagination, req.AppManagerLevel) if resp.Total != 0 { return resp, nil } - // Find users by nickname if no users found by keyword users, err = s.db.FindByNickname(ctx, req.Keyword) if err != nil { return nil, err @@ -599,7 +544,6 @@ func (s *userServer) SearchNotificationAccount(ctx context.Context, req *pbuser. return resp, nil } - // If no keyword, find users with notification settings if req.AppManagerLevel != nil { users, err = s.db.FindNotification(ctx, int64(*req.AppManagerLevel)) if err != nil { diff --git a/internal/tools/cron/s3.go b/internal/tools/cron/s3.go index c42e223b8..6fdeb8a73 100644 --- a/internal/tools/cron/s3.go +++ b/internal/tools/cron/s3.go @@ -35,46 +35,3 @@ func (c *cronServer) clearS3() { } log.ZDebug(ctx, "cron deleteoutDatedData success", "deltime", deleteTime, "cont", time.Since(start), "count", count) } - -// var req *third.DeleteOutdatedDataReq -// count1, err := ExtractField(ctx, c.thirdClient.DeleteOutdatedData, req, (*third.DeleteOutdatedDataResp).GetCount) -// -// c.thirdClient.DeleteOutdatedData(ctx, &third.DeleteOutdatedDataReq{}) -// msggateway.GetUsersOnlineStatusCaller.Invoke(ctx, &msggateway.GetUsersOnlineStatusReq{}) -// -// var cli ThirdClient -// -// c111, err := cli.DeleteOutdatedData(ctx, 100) -// -// cli.ThirdClient.DeleteOutdatedData(ctx, &third.DeleteOutdatedDataReq{}) -// -// cli.AuthSign(ctx, &third.AuthSignReq{}) -// -// cli.SetAppBadge() -// -//} -// -//func extractField[A, B, C any](ctx context.Context, fn func(ctx context.Context, req *A, opts ...grpc.CallOption) (*B, error), req *A, get func(*B) C) (C, error) { -// resp, err := fn(ctx, req) -// if err != nil { -// var c C -// return c, err -// } -// return get(resp), nil -//} -// -//func ignore(_ any, err error) error { -// return err -//} -// -//type ThirdClient struct { -// third.ThirdClient -//} -// -//func (c *ThirdClient) DeleteOutdatedData(ctx context.Context, expireTime int64) (int32, error) { -// return extractField(ctx, c.ThirdClient.DeleteOutdatedData, &third.DeleteOutdatedDataReq{ExpireTime: expireTime}, (*third.DeleteOutdatedDataResp).GetCount) -//} -// -//func (c *ThirdClient) DeleteOutdatedData1(ctx context.Context, expireTime int64) error { -// return ignore(c.ThirdClient.DeleteOutdatedData(ctx, &third.DeleteOutdatedDataReq{ExpireTime: expireTime})) -//} diff --git a/pkg/apistruct/doc.go b/pkg/apistruct/doc.go index 6be41c9e5..bafe57770 100644 --- a/pkg/apistruct/doc.go +++ b/pkg/apistruct/doc.go @@ -1,15 +1 @@ -// Copyright © 2024 OpenIM. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - package apistruct // import "github.com/openimsdk/open-im-server/v3/pkg/apistruct" diff --git a/pkg/apistruct/manage.go b/pkg/apistruct/manage.go index cb2b1756f..b4b87d712 100644 --- a/pkg/apistruct/manage.go +++ b/pkg/apistruct/manage.go @@ -1,17 +1,3 @@ -// Copyright © 2023 OpenIM. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - package apistruct import ( diff --git a/pkg/apistruct/msg.go b/pkg/apistruct/msg.go index 0e1b356a1..0d35203d1 100644 --- a/pkg/apistruct/msg.go +++ b/pkg/apistruct/msg.go @@ -1,17 +1,3 @@ -// Copyright © 2023 OpenIM. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - package apistruct import "github.com/openimsdk/protocol/sdkws" diff --git a/pkg/apistruct/public.go b/pkg/apistruct/public.go index 7589b1d0f..df87660c2 100644 --- a/pkg/apistruct/public.go +++ b/pkg/apistruct/public.go @@ -1,17 +1,3 @@ -// Copyright © 2023 OpenIM. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - package apistruct type GroupAddMemberInfo struct { diff --git a/pkg/authverify/doc.go b/pkg/authverify/doc.go index 14d63a410..d5cbaae4e 100644 --- a/pkg/authverify/doc.go +++ b/pkg/authverify/doc.go @@ -1,15 +1 @@ -// Copyright © 2024 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 "github.com/openimsdk/open-im-server/v3/pkg/authverify" diff --git a/pkg/authverify/token.go b/pkg/authverify/token.go index a82eba30a..a102ce3fa 100644 --- a/pkg/authverify/token.go +++ b/pkg/authverify/token.go @@ -1,17 +1,3 @@ -// 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 ( diff --git a/pkg/callbackstruct/common.go b/pkg/callbackstruct/common.go index 9d6a325a8..51b46f871 100644 --- a/pkg/callbackstruct/common.go +++ b/pkg/callbackstruct/common.go @@ -1,17 +1,3 @@ -// 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 callbackstruct import ( diff --git a/pkg/callbackstruct/constant.go b/pkg/callbackstruct/constant.go index ef7cb502f..a5a530f6e 100644 --- a/pkg/callbackstruct/constant.go +++ b/pkg/callbackstruct/constant.go @@ -1,17 +1,3 @@ -// 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 callbackstruct const ( diff --git a/pkg/callbackstruct/doc.go b/pkg/callbackstruct/doc.go index 965186c6c..0be55a729 100644 --- a/pkg/callbackstruct/doc.go +++ b/pkg/callbackstruct/doc.go @@ -1,15 +1 @@ -// Copyright © 2024 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 callbackstruct // import "github.com/openimsdk/open-im-server/v3/pkg/callbackstruct" diff --git a/pkg/callbackstruct/friend.go b/pkg/callbackstruct/friend.go index a81746bfd..3177d0f4e 100644 --- a/pkg/callbackstruct/friend.go +++ b/pkg/callbackstruct/friend.go @@ -1,17 +1,3 @@ -// 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 callbackstruct type CallbackBeforeAddFriendReq struct { diff --git a/pkg/callbackstruct/group.go b/pkg/callbackstruct/group.go index 1f9b848cf..6d1c762a4 100644 --- a/pkg/callbackstruct/group.go +++ b/pkg/callbackstruct/group.go @@ -1,17 +1,3 @@ -// 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 callbackstruct import ( diff --git a/pkg/callbackstruct/message.go b/pkg/callbackstruct/message.go index ef8a8bb28..6021f1bdb 100644 --- a/pkg/callbackstruct/message.go +++ b/pkg/callbackstruct/message.go @@ -1,17 +1,3 @@ -// 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 callbackstruct import ( diff --git a/pkg/callbackstruct/msg_gateway.go b/pkg/callbackstruct/msg_gateway.go index ef98c4058..bd32a2729 100644 --- a/pkg/callbackstruct/msg_gateway.go +++ b/pkg/callbackstruct/msg_gateway.go @@ -1,17 +1,3 @@ -// 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 callbackstruct type CallbackUserOnlineReq struct { diff --git a/pkg/callbackstruct/push.go b/pkg/callbackstruct/push.go index 0b0f29b51..dec84ef63 100644 --- a/pkg/callbackstruct/push.go +++ b/pkg/callbackstruct/push.go @@ -1,17 +1,3 @@ -// 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 callbackstruct import common "github.com/openimsdk/protocol/sdkws" diff --git a/pkg/callbackstruct/revoke.go b/pkg/callbackstruct/revoke.go index b36985ed3..4721692db 100644 --- a/pkg/callbackstruct/revoke.go +++ b/pkg/callbackstruct/revoke.go @@ -1,17 +1,3 @@ -// 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 callbackstruct type CallbackAfterRevokeMsgReq struct { diff --git a/pkg/callbackstruct/user.go b/pkg/callbackstruct/user.go index d8640da29..1291c459a 100644 --- a/pkg/callbackstruct/user.go +++ b/pkg/callbackstruct/user.go @@ -1,17 +1,3 @@ -// 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 callbackstruct import ( diff --git a/pkg/common/cmd/api.go b/pkg/common/cmd/api.go index 7b7dbc89b..6c64a95e1 100644 --- a/pkg/common/cmd/api.go +++ b/pkg/common/cmd/api.go @@ -1,17 +1,3 @@ -// Copyright © 2023 OpenIM. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - package cmd import ( diff --git a/pkg/common/cmd/auth.go b/pkg/common/cmd/auth.go index d624e9dae..b6165cc16 100644 --- a/pkg/common/cmd/auth.go +++ b/pkg/common/cmd/auth.go @@ -1,17 +1,3 @@ -// Copyright © 2023 OpenIM. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - package cmd import ( diff --git a/pkg/common/cmd/conversation.go b/pkg/common/cmd/conversation.go index 428c442da..652665d2d 100644 --- a/pkg/common/cmd/conversation.go +++ b/pkg/common/cmd/conversation.go @@ -1,17 +1,3 @@ -// Copyright © 2023 OpenIM. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - package cmd import ( diff --git a/pkg/common/cmd/cron_task.go b/pkg/common/cmd/cron_task.go index af2cbbee9..811ad6cb3 100644 --- a/pkg/common/cmd/cron_task.go +++ b/pkg/common/cmd/cron_task.go @@ -1,17 +1,3 @@ -// Copyright © 2023 OpenIM. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - package cmd import ( diff --git a/pkg/common/cmd/doc.go b/pkg/common/cmd/doc.go index 96d80b64a..7b00043d0 100644 --- a/pkg/common/cmd/doc.go +++ b/pkg/common/cmd/doc.go @@ -1,15 +1 @@ -// Copyright © 2024 OpenIM. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - package cmd // import "github.com/openimsdk/open-im-server/v3/pkg/common/cmd" diff --git a/pkg/common/cmd/friend.go b/pkg/common/cmd/friend.go index dd850cf17..b2dc684b9 100644 --- a/pkg/common/cmd/friend.go +++ b/pkg/common/cmd/friend.go @@ -1,17 +1,3 @@ -// Copyright © 2023 OpenIM. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - package cmd import ( diff --git a/pkg/common/cmd/group.go b/pkg/common/cmd/group.go index 7a599077f..04dea3472 100644 --- a/pkg/common/cmd/group.go +++ b/pkg/common/cmd/group.go @@ -1,17 +1,3 @@ -// Copyright © 2023 OpenIM. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - package cmd import ( diff --git a/pkg/common/cmd/msg.go b/pkg/common/cmd/msg.go index c4049be05..f30b1b326 100644 --- a/pkg/common/cmd/msg.go +++ b/pkg/common/cmd/msg.go @@ -1,17 +1,3 @@ -// Copyright © 2023 OpenIM. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - package cmd import ( diff --git a/pkg/common/cmd/msg_gateway.go b/pkg/common/cmd/msg_gateway.go index 83cfb6272..2fb4288b1 100644 --- a/pkg/common/cmd/msg_gateway.go +++ b/pkg/common/cmd/msg_gateway.go @@ -1,17 +1,3 @@ -// Copyright © 2023 OpenIM. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - package cmd import ( diff --git a/pkg/common/cmd/msg_gateway_test.go b/pkg/common/cmd/msg_gateway_test.go index 929abcd86..b9866cd4f 100644 --- a/pkg/common/cmd/msg_gateway_test.go +++ b/pkg/common/cmd/msg_gateway_test.go @@ -1,17 +1,3 @@ -// Copyright © 2023 OpenIM. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - package cmd import ( diff --git a/pkg/common/cmd/msg_transfer.go b/pkg/common/cmd/msg_transfer.go index fe6c27e54..7892c8db7 100644 --- a/pkg/common/cmd/msg_transfer.go +++ b/pkg/common/cmd/msg_transfer.go @@ -1,17 +1,3 @@ -// Copyright © 2023 OpenIM. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - package cmd import ( diff --git a/pkg/common/cmd/msg_utils.go b/pkg/common/cmd/msg_utils.go index f0e590e2c..706a171fb 100644 --- a/pkg/common/cmd/msg_utils.go +++ b/pkg/common/cmd/msg_utils.go @@ -1,17 +1,3 @@ -// Copyright © 2023 OpenIM. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - package cmd import ( diff --git a/pkg/common/cmd/push.go b/pkg/common/cmd/push.go index 7cd3c481e..391d2cc87 100644 --- a/pkg/common/cmd/push.go +++ b/pkg/common/cmd/push.go @@ -1,17 +1,3 @@ -// Copyright © 2023 OpenIM. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - package cmd import ( diff --git a/pkg/common/cmd/third.go b/pkg/common/cmd/third.go index e567234e4..94011832d 100644 --- a/pkg/common/cmd/third.go +++ b/pkg/common/cmd/third.go @@ -1,17 +1,3 @@ -// Copyright © 2023 OpenIM. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - package cmd import ( diff --git a/pkg/common/cmd/user.go b/pkg/common/cmd/user.go index 190f6f892..b38ebfd37 100644 --- a/pkg/common/cmd/user.go +++ b/pkg/common/cmd/user.go @@ -1,17 +1,3 @@ -// Copyright © 2023 OpenIM. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - package cmd import ( diff --git a/pkg/common/config/config.go b/pkg/common/config/config.go index 856cbf3ec..50b06be01 100644 --- a/pkg/common/config/config.go +++ b/pkg/common/config/config.go @@ -1,17 +1,3 @@ -// 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 config import ( diff --git a/pkg/common/config/constant.go b/pkg/common/config/constant.go index fa3f0ca05..03d839526 100644 --- a/pkg/common/config/constant.go +++ b/pkg/common/config/constant.go @@ -1,17 +1,3 @@ -// Copyright © 2024 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 config import "github.com/openimsdk/tools/utils/runtimeenv" diff --git a/pkg/common/config/doc.go b/pkg/common/config/doc.go index 189a5b583..a385f5815 100644 --- a/pkg/common/config/doc.go +++ b/pkg/common/config/doc.go @@ -1,15 +1 @@ -// Copyright © 2024 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 config // import "github.com/openimsdk/open-im-server/v3/pkg/common/config" diff --git a/pkg/common/config/parse.go b/pkg/common/config/parse.go index df4ecc5a0..e129af472 100644 --- a/pkg/common/config/parse.go +++ b/pkg/common/config/parse.go @@ -1,17 +1,3 @@ -// 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 config import ( diff --git a/pkg/common/convert/black.go b/pkg/common/convert/black.go index 6c24051fd..8449de818 100644 --- a/pkg/common/convert/black.go +++ b/pkg/common/convert/black.go @@ -1,17 +1,3 @@ -// 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 convert import ( diff --git a/pkg/common/convert/conversation.go b/pkg/common/convert/conversation.go index 9389b0252..de69ceb49 100644 --- a/pkg/common/convert/conversation.go +++ b/pkg/common/convert/conversation.go @@ -1,17 +1,3 @@ -// 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 convert import ( diff --git a/pkg/common/convert/doc.go b/pkg/common/convert/doc.go index 623b4a5c0..1bce671c1 100644 --- a/pkg/common/convert/doc.go +++ b/pkg/common/convert/doc.go @@ -1,15 +1 @@ -// Copyright © 2024 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 convert // import "github.com/openimsdk/open-im-server/v3/pkg/common/convert" diff --git a/pkg/common/convert/friend.go b/pkg/common/convert/friend.go index e783ecb24..2b811b3ae 100644 --- a/pkg/common/convert/friend.go +++ b/pkg/common/convert/friend.go @@ -1,17 +1,3 @@ -// 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 convert import ( diff --git a/pkg/common/convert/group.go b/pkg/common/convert/group.go index 5e41599c6..330882124 100644 --- a/pkg/common/convert/group.go +++ b/pkg/common/convert/group.go @@ -1,17 +1,3 @@ -// 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 convert import ( @@ -136,12 +122,3 @@ func Pb2DBGroupInfo(m *sdkws.GroupInfo) *model.Group { NotificationUserID: m.NotificationUserID, } } - -// func Pb2DbGroupMember(m *sdkws.UserInfo) *relation.GroupMember { -// return &relation.GroupMember{ -// UserID: m.UserID, -// Nickname: m.Nickname, -// FaceURL: m.FaceURL, -// Ex: m.Ex, -// } -//} diff --git a/pkg/common/convert/msg.go b/pkg/common/convert/msg.go index 41f6b41f6..2002599e9 100644 --- a/pkg/common/convert/msg.go +++ b/pkg/common/convert/msg.go @@ -1,17 +1,3 @@ -// 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 convert import ( diff --git a/pkg/common/convert/user.go b/pkg/common/convert/user.go index d824fa68e..1797d0fd6 100644 --- a/pkg/common/convert/user.go +++ b/pkg/common/convert/user.go @@ -1,17 +1,3 @@ -// 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 convert import ( diff --git a/pkg/common/convert/user_test.go b/pkg/common/convert/user_test.go index be8137265..d3da01d15 100644 --- a/pkg/common/convert/user_test.go +++ b/pkg/common/convert/user_test.go @@ -1,17 +1,3 @@ -// 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 convert import ( diff --git a/pkg/common/discovery/direct/direct_resolver.go b/pkg/common/discovery/direct/direct_resolver.go index 821378277..4c6fcf770 100644 --- a/pkg/common/discovery/direct/direct_resolver.go +++ b/pkg/common/discovery/direct/direct_resolver.go @@ -1,17 +1,3 @@ -// Copyright © 2024 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 direct import ( diff --git a/pkg/common/discovery/direct/directconn.go b/pkg/common/discovery/direct/directconn.go index 1cbe56dd5..477177347 100644 --- a/pkg/common/discovery/direct/directconn.go +++ b/pkg/common/discovery/direct/directconn.go @@ -1,174 +1 @@ -// Copyright © 2024 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 direct - -//import ( -// "context" -// "fmt" -// -// config2 "github.com/openimsdk/open-im-server/v3/pkg/common/config" -// "github.com/openimsdk/tools/errs" -// "google.golang.org/grpc" -// "google.golang.org/grpc/credentials/insecure" -//) -// -//type ServiceAddresses map[string][]int -// -//func getServiceAddresses(rpcRegisterName *config2.RpcRegisterName, -// rpcPort *config2.RpcPort, longConnSvrPort []int) ServiceAddresses { -// return ServiceAddresses{ -// rpcRegisterName.OpenImUserName: rpcPort.OpenImUserPort, -// rpcRegisterName.OpenImFriendName: rpcPort.OpenImFriendPort, -// rpcRegisterName.OpenImMsgName: rpcPort.OpenImMessagePort, -// rpcRegisterName.OpenImMessageGatewayName: longConnSvrPort, -// rpcRegisterName.OpenImGroupName: rpcPort.OpenImGroupPort, -// rpcRegisterName.OpenImAuthName: rpcPort.OpenImAuthPort, -// rpcRegisterName.OpenImPushName: rpcPort.OpenImPushPort, -// rpcRegisterName.OpenImConversationName: rpcPort.OpenImConversationPort, -// rpcRegisterName.OpenImThirdName: rpcPort.OpenImThirdPort, -// } -//} -// -//type ConnDirect struct { -// additionalOpts []grpc.DialOption -// currentServiceAddress string -// conns map[string][]*grpc.ClientConn -// resolverDirect *ResolverDirect -// config *config2.GlobalConfig -//} -// -//func (cd *ConnDirect) GetClientLocalConns() map[string][]*grpc.ClientConn { -// return nil -//} -// -//func (cd *ConnDirect) GetUserIdHashGatewayHost(ctx context.Context, userId string) (string, error) { -// return "", nil -//} -// -//func (cd *ConnDirect) Register(serviceName, host string, port int, opts ...grpc.DialOption) error { -// return nil -//} -// -//func (cd *ConnDirect) UnRegister() error { -// return nil -//} -// -//func (cd *ConnDirect) CreateRpcRootNodes(serviceNames []string) error { -// return nil -//} -// -//func (cd *ConnDirect) RegisterConf2Registry(key string, conf []byte) error { -// return nil -//} -// -//func (cd *ConnDirect) GetConfFromRegistry(key string) ([]byte, error) { -// return nil, nil -//} -// -//func (cd *ConnDirect) Close() { -// -//} -// -//func NewConnDirect(config *config2.GlobalConfig) (*ConnDirect, error) { -// return &ConnDirect{ -// conns: make(map[string][]*grpc.ClientConn), -// resolverDirect: NewResolverDirect(), -// config: config, -// }, nil -//} -// -//func (cd *ConnDirect) GetConns(ctx context.Context, -// serviceName string, opts ...grpc.DialOption) ([]*grpc.ClientConn, error) { -// -// if conns, exists := cd.conns[serviceName]; exists { -// return conns, nil -// } -// ports := getServiceAddresses(&cd.config.RpcRegisterName, -// &cd.config.RpcPort, cd.config.LongConnSvr.OpenImMessageGatewayPort)[serviceName] -// var connections []*grpc.ClientConn -// for _, port := range ports { -// conn, err := cd.dialServiceWithoutResolver(ctx, fmt.Sprintf(cd.config.Rpc.ListenIP+":%d", port), append(cd.additionalOpts, opts...)...) -// if err != nil { -// return nil, errs.Wrap(fmt.Errorf("connect to port %d failed,serviceName %s, IP %s", port, serviceName, cd.config.Rpc.ListenIP)) -// } -// connections = append(connections, conn) -// } -// -// if len(connections) == 0 { -// return nil, errs.New("no connections found for service", "serviceName", serviceName).Wrap() -// } -// return connections, nil -//} -// -//func (cd *ConnDirect) GetConn(ctx context.Context, serviceName string, opts ...grpc.DialOption) (*grpc.ClientConn, error) { -// // Get service addresses -// addresses := getServiceAddresses(&cd.config.RpcRegisterName, -// &cd.config.RpcPort, cd.config.LongConnSvr.OpenImMessageGatewayPort) -// address, ok := addresses[serviceName] -// if !ok { -// return nil, errs.New("unknown service name", "serviceName", serviceName).Wrap() -// } -// var result string -// for _, addr := range address { -// if result != "" { -// result = result + "," + fmt.Sprintf(cd.config.Rpc.ListenIP+":%d", addr) -// } else { -// result = fmt.Sprintf(cd.config.Rpc.ListenIP+":%d", addr) -// } -// } -// // Try to dial a new connection -// conn, err := cd.dialService(ctx, result, append(cd.additionalOpts, opts...)...) -// if err != nil { -// return nil, errs.WrapMsg(err, "address", result) -// } -// -// // Store the new connection -// cd.conns[serviceName] = append(cd.conns[serviceName], conn) -// return conn, nil -//} -// -//func (cd *ConnDirect) GetSelfConnTarget() string { -// return cd.currentServiceAddress -//} -// -//func (cd *ConnDirect) AddOption(opts ...grpc.DialOption) { -// cd.additionalOpts = append(cd.additionalOpts, opts...) -//} -// -//func (cd *ConnDirect) CloseConn(conn *grpc.ClientConn) { -// if conn != nil { -// conn.Close() -// } -//} -// -//func (cd *ConnDirect) dialService(ctx context.Context, address string, opts ...grpc.DialOption) (*grpc.ClientConn, error) { -// options := append(opts, grpc.WithTransportCredentials(insecure.NewCredentials())) -// conn, err := grpc.DialContext(ctx, cd.resolverDirect.Scheme()+":///"+address, options...) -// -// if err != nil { -// return nil, errs.WrapMsg(err, "address", address) -// } -// return conn, nil -//} -// -//func (cd *ConnDirect) dialServiceWithoutResolver(ctx context.Context, address string, opts ...grpc.DialOption) (*grpc.ClientConn, error) { -// options := append(opts, grpc.WithTransportCredentials(insecure.NewCredentials())) -// conn, err := grpc.DialContext(ctx, address, options...) -// -// if err != nil { -// return nil, errs.Wrap(err) -// } -// return conn, nil -//} diff --git a/pkg/common/discovery/direct/doc.go b/pkg/common/discovery/direct/doc.go index 0ba0d1437..1dc77ab87 100644 --- a/pkg/common/discovery/direct/doc.go +++ b/pkg/common/discovery/direct/doc.go @@ -1,15 +1 @@ -// Copyright © 2024 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 direct // import "github.com/openimsdk/open-im-server/v3/pkg/common/discovery/direct" diff --git a/pkg/common/discovery/discoveryregister.go b/pkg/common/discovery/discoveryregister.go index 87333fcac..50dc91e7d 100644 --- a/pkg/common/discovery/discoveryregister.go +++ b/pkg/common/discovery/discoveryregister.go @@ -1,17 +1,3 @@ -// 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 discovery import ( diff --git a/pkg/common/discovery/discoveryregister_test.go b/pkg/common/discovery/discoveryregister_test.go index 63f7e94cd..650c44913 100644 --- a/pkg/common/discovery/discoveryregister_test.go +++ b/pkg/common/discovery/discoveryregister_test.go @@ -1,17 +1,3 @@ -// 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 discovery import ( @@ -25,36 +11,3 @@ func setupTestEnvironment() { os.Setenv("ZOOKEEPER_USERNAME", "") os.Setenv("ZOOKEEPER_PASSWORD", "") } - -//func TestNewDiscoveryRegister(t *testing.T) { -// setupTestEnvironment() -// conf := config.NewGlobalConfig() -// tests := []struct { -// envType string -// gatewayName string -// expectedError bool -// expectedResult bool -// }{ -// {"zookeeper", "MessageGateway", false, true}, -// {"k8s", "MessageGateway", false, true}, -// {"direct", "MessageGateway", false, true}, -// {"invalid", "MessageGateway", true, false}, -// } -// -// for _, test := range tests { -// conf.Envs.Discovery = test.envType -// conf.RpcRegisterName.OpenImMessageGatewayName = test.gatewayName -// client, err := NewDiscoveryRegister(conf) -// -// if test.expectedError { -// assert.Error(t, err) -// } else { -// assert.NoError(t, err) -// if test.expectedResult { -// assert.Implements(t, (*discovery.SvcDiscoveryRegistry)(nil), client) -// } else { -// assert.Nil(t, client) -// } -// } -// } -//} diff --git a/pkg/common/discovery/doc.go b/pkg/common/discovery/doc.go index 7a5918cfa..84baf7b67 100644 --- a/pkg/common/discovery/doc.go +++ b/pkg/common/discovery/doc.go @@ -1,15 +1 @@ -// Copyright © 2024 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 discovery // import "github.com/openimsdk/open-im-server/v3/pkg/common/discovery" diff --git a/pkg/common/discovery/kubernetes/doc.go b/pkg/common/discovery/kubernetes/doc.go index dc23ac132..47480eee5 100644 --- a/pkg/common/discovery/kubernetes/doc.go +++ b/pkg/common/discovery/kubernetes/doc.go @@ -1,15 +1 @@ -// Copyright © 2024 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 kubernetes // import "github.com/openimsdk/open-im-server/v3/pkg/common/discovery/kubernetes" diff --git a/pkg/common/ginprometheus/doc.go b/pkg/common/ginprometheus/doc.go index 7d81b7a8a..ba570e797 100644 --- a/pkg/common/ginprometheus/doc.go +++ b/pkg/common/ginprometheus/doc.go @@ -1,15 +1 @@ -// Copyright © 2024 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 ginprometheus // import "github.com/openimsdk/open-im-server/v3/pkg/common/ginprometheus" diff --git a/pkg/common/ginprometheus/ginprometheus.go b/pkg/common/ginprometheus/ginprometheus.go index 64f8a0d8a..ac9da0154 100644 --- a/pkg/common/ginprometheus/ginprometheus.go +++ b/pkg/common/ginprometheus/ginprometheus.go @@ -1,444 +1 @@ -// 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 ginprometheus - -// -//import ( -// "bytes" -// "fmt" -// "io" -// "net/http" -// "os" -// "strconv" -// "time" -// -// "github.com/gin-gonic/gin" -// "github.com/prometheus/client_golang/prometheus" -// "github.com/prometheus/client_golang/prometheus/promhttp" -//) -// -//var defaultMetricPath = "/metrics" -// -//// counter, counter_vec, gauge, gauge_vec, -//// histogram, histogram_vec, summary, summary_vec. -//var ( -// reqCounter = &Metric{ -// ID: "reqCnt", -// Name: "requests_total", -// Description: "How many HTTP requests processed, partitioned by status code and HTTP method.", -// Type: "counter_vec", -// Args: []string{"code", "method", "handler", "host", "url"}} -// -// reqDuration = &Metric{ -// ID: "reqDur", -// Name: "request_duration_seconds", -// Description: "The HTTP request latencies in seconds.", -// Type: "histogram_vec", -// Args: []string{"code", "method", "url"}, -// } -// -// resSize = &Metric{ -// ID: "resSz", -// Name: "response_size_bytes", -// Description: "The HTTP response sizes in bytes.", -// Type: "summary"} -// -// reqSize = &Metric{ -// ID: "reqSz", -// Name: "request_size_bytes", -// Description: "The HTTP request sizes in bytes.", -// Type: "summary"} -// -// standardMetrics = []*Metric{ -// reqCounter, -// reqDuration, -// resSize, -// reqSize, -// } -//) -// -///* -//RequestCounterURLLabelMappingFn is a function which can be supplied to the middleware to control -//the cardinality of the request counter's "url" label, which might be required in some contexts. -//For instance, if for a "/customer/:name" route you don't want to generate a time series for every -//possible customer name, you could use this function: -// -// func(c *gin.Context) string { -// url := c.Request.URL.Path -// for _, p := range c.Params { -// if p.Key == "name" { -// url = strings.Replace(url, p.Value, ":name", 1) -// break -// } -// } -// return url -// } -// -//which would map "/customer/alice" and "/customer/bob" to their template "/customer/:name". -//*/ -//type RequestCounterURLLabelMappingFn func(c *gin.Context) string -// -//// Metric is a definition for the name, description, type, ID, and -//// prometheus.Collector type (i.e. CounterVec, Summary, etc) of each metric. -//type Metric struct { -// MetricCollector prometheus.Collector -// ID string -// Name string -// Description string -// Type string -// Args []string -//} -// -//// Prometheus contains the metrics gathered by the instance and its path. -//type Prometheus struct { -// reqCnt *prometheus.CounterVec -// reqDur *prometheus.HistogramVec -// reqSz, resSz prometheus.Summary -// router *gin.Engine -// listenAddress string -// Ppg PrometheusPushGateway -// -// MetricsList []*Metric -// MetricsPath string -// -// ReqCntURLLabelMappingFn RequestCounterURLLabelMappingFn -// -// // gin.Context string to use as a prometheus URL label -// URLLabelFromContext string -//} -// -//// PrometheusPushGateway contains the configuration for pushing to a Prometheus pushgateway (optional). -//type PrometheusPushGateway struct { -// -// // Push interval in seconds -// PushIntervalSeconds time.Duration -// -// // Push Gateway URL in format http://domain:port -// // where JOBNAME can be any string of your choice -// PushGatewayURL string -// -// // Local metrics URL where metrics are fetched from, this could be omitted in the future -// // if implemented using prometheus common/expfmt instead -// MetricsURL string -// -// // pushgateway job name, defaults to "gin" -// Job string -//} -// -//// NewPrometheus generates a new set of metrics with a certain subsystem name. -//func NewPrometheus(subsystem string, customMetricsList ...[]*Metric) *Prometheus { -// if subsystem == "" { -// subsystem = "app" -// } -// -// var metricsList []*Metric -// -// if len(customMetricsList) > 1 { -// panic("Too many args. NewPrometheus( string, ).") -// } else if len(customMetricsList) == 1 { -// metricsList = customMetricsList[0] -// } -// metricsList = append(metricsList, standardMetrics...) -// -// p := &Prometheus{ -// MetricsList: metricsList, -// MetricsPath: defaultMetricPath, -// ReqCntURLLabelMappingFn: func(c *gin.Context) string { -// return c.FullPath() // e.g. /user/:id , /user/:id/info -// }, -// } -// -// p.registerMetrics(subsystem) -// -// return p -//} -// -//// SetPushGateway sends metrics to a remote pushgateway exposed on pushGatewayURL -//// every pushIntervalSeconds. Metrics are fetched from metricsURL. -//func (p *Prometheus) SetPushGateway(pushGatewayURL, metricsURL string, pushIntervalSeconds time.Duration) { -// p.Ppg.PushGatewayURL = pushGatewayURL -// p.Ppg.MetricsURL = metricsURL -// p.Ppg.PushIntervalSeconds = pushIntervalSeconds -// p.startPushTicker() -//} -// -//// SetPushGatewayJob job name, defaults to "gin". -//func (p *Prometheus) SetPushGatewayJob(j string) { -// p.Ppg.Job = j -//} -// -//// SetListenAddress for exposing metrics on address. If not set, it will be exposed at the -//// same address of the gin engine that is being used. -//func (p *Prometheus) SetListenAddress(address string) { -// p.listenAddress = address -// if p.listenAddress != "" { -// p.router = gin.Default() -// } -//} -// -//// SetListenAddressWithRouter for using a separate router to expose metrics. (this keeps things like GET /metrics out of -//// your content's access log). -//func (p *Prometheus) SetListenAddressWithRouter(listenAddress string, r *gin.Engine) { -// p.listenAddress = listenAddress -// if len(p.listenAddress) > 0 { -// p.router = r -// } -//} -// -//// SetMetricsPath set metrics paths. -//func (p *Prometheus) SetMetricsPath(e *gin.Engine) error { -// -// if p.listenAddress != "" { -// p.router.GET(p.MetricsPath, prometheusHandler()) -// return p.runServer() -// } else { -// e.GET(p.MetricsPath, prometheusHandler()) -// return nil -// } -//} -// -//// SetMetricsPathWithAuth set metrics paths with authentication. -//func (p *Prometheus) SetMetricsPathWithAuth(e *gin.Engine, accounts gin.Accounts) error { -// -// if p.listenAddress != "" { -// p.router.GET(p.MetricsPath, gin.BasicAuth(accounts), prometheusHandler()) -// return p.runServer() -// } else { -// e.GET(p.MetricsPath, gin.BasicAuth(accounts), prometheusHandler()) -// return nil -// } -// -//} -// -//func (p *Prometheus) runServer() error { -// return p.router.Run(p.listenAddress) -//} -// -//func (p *Prometheus) getMetrics() []byte { -// response, err := http.Get(p.Ppg.MetricsURL) -// if err != nil { -// return nil -// } -// -// defer response.Body.Close() -// -// body, _ := io.ReadAll(response.Body) -// return body -//} -// -//var hostname, _ = os.Hostname() -// -//func (p *Prometheus) getPushGatewayURL() string { -// if p.Ppg.Job == "" { -// p.Ppg.Job = "gin" -// } -// return p.Ppg.PushGatewayURL + "/metrics/job/" + p.Ppg.Job + "/instance/" + hostname -//} -// -//func (p *Prometheus) sendMetricsToPushGateway(metrics []byte) { -// req, err := http.NewRequest("POST", p.getPushGatewayURL(), bytes.NewBuffer(metrics)) -// if err != nil { -// return -// } -// -// client := &http.Client{} -// resp, err := client.Do(req) -// if err != nil { -// fmt.Println("Error sending to push gateway error:", err.Error()) -// } -// -// resp.Body.Close() -//} -// -//func (p *Prometheus) startPushTicker() { -// ticker := time.NewTicker(time.Second * p.Ppg.PushIntervalSeconds) -// go func() { -// for range ticker.C { -// p.sendMetricsToPushGateway(p.getMetrics()) -// } -// }() -//} -// -//// NewMetric associates prometheus.Collector based on Metric.Type. -//func NewMetric(m *Metric, subsystem string) prometheus.Collector { -// var metric prometheus.Collector -// switch m.Type { -// case "counter_vec": -// metric = prometheus.NewCounterVec( -// prometheus.CounterOpts{ -// Subsystem: subsystem, -// Name: m.Name, -// Help: m.Description, -// }, -// m.Args, -// ) -// case "counter": -// metric = prometheus.NewCounter( -// prometheus.CounterOpts{ -// Subsystem: subsystem, -// Name: m.Name, -// Help: m.Description, -// }, -// ) -// case "gauge_vec": -// metric = prometheus.NewGaugeVec( -// prometheus.GaugeOpts{ -// Subsystem: subsystem, -// Name: m.Name, -// Help: m.Description, -// }, -// m.Args, -// ) -// case "gauge": -// metric = prometheus.NewGauge( -// prometheus.GaugeOpts{ -// Subsystem: subsystem, -// Name: m.Name, -// Help: m.Description, -// }, -// ) -// case "histogram_vec": -// metric = prometheus.NewHistogramVec( -// prometheus.HistogramOpts{ -// Subsystem: subsystem, -// Name: m.Name, -// Help: m.Description, -// }, -// m.Args, -// ) -// case "histogram": -// metric = prometheus.NewHistogram( -// prometheus.HistogramOpts{ -// Subsystem: subsystem, -// Name: m.Name, -// Help: m.Description, -// }, -// ) -// case "summary_vec": -// metric = prometheus.NewSummaryVec( -// prometheus.SummaryOpts{ -// Subsystem: subsystem, -// Name: m.Name, -// Help: m.Description, -// }, -// m.Args, -// ) -// case "summary": -// metric = prometheus.NewSummary( -// prometheus.SummaryOpts{ -// Subsystem: subsystem, -// Name: m.Name, -// Help: m.Description, -// }, -// ) -// } -// return metric -//} -// -//func (p *Prometheus) registerMetrics(subsystem string) { -// for _, metricDef := range p.MetricsList { -// metric := NewMetric(metricDef, subsystem) -// if err := prometheus.Register(metric); err != nil { -// fmt.Println("could not be registered in Prometheus,metricDef.Name:", metricDef.Name, " error:", err.Error()) -// } -// -// switch metricDef { -// case reqCounter: -// p.reqCnt = metric.(*prometheus.CounterVec) -// case reqDuration: -// p.reqDur = metric.(*prometheus.HistogramVec) -// case resSize: -// p.resSz = metric.(prometheus.Summary) -// case reqSize: -// p.reqSz = metric.(prometheus.Summary) -// } -// metricDef.MetricCollector = metric -// } -//} -// -//// Use adds the middleware to a gin engine. -//func (p *Prometheus) Use(e *gin.Engine) error { -// e.Use(p.HandlerFunc()) -// return p.SetMetricsPath(e) -//} -// -//// UseWithAuth adds the middleware to a gin engine with BasicAuth. -//func (p *Prometheus) UseWithAuth(e *gin.Engine, accounts gin.Accounts) error { -// e.Use(p.HandlerFunc()) -// return p.SetMetricsPathWithAuth(e, accounts) -//} -// -//// HandlerFunc defines handler function for middleware. -//func (p *Prometheus) HandlerFunc() gin.HandlerFunc { -// return func(c *gin.Context) { -// if c.Request.URL.Path == p.MetricsPath { -// c.Next() -// return -// } -// -// start := time.Now() -// reqSz := computeApproximateRequestSize(c.Request) -// -// c.Next() -// -// status := strconv.Itoa(c.Writer.Status()) -// elapsed := float64(time.Since(start)) / float64(time.Second) -// resSz := float64(c.Writer.Size()) -// -// url := p.ReqCntURLLabelMappingFn(c) -// if len(p.URLLabelFromContext) > 0 { -// u, found := c.Get(p.URLLabelFromContext) -// if !found { -// u = "unknown" -// } -// url = u.(string) -// } -// p.reqDur.WithLabelValues(status, c.Request.Method, url).Observe(elapsed) -// p.reqCnt.WithLabelValues(status, c.Request.Method, c.HandlerName(), c.Request.Host, url).Inc() -// p.reqSz.Observe(float64(reqSz)) -// p.resSz.Observe(resSz) -// } -//} -// -//func prometheusHandler() gin.HandlerFunc { -// h := promhttp.Handler() -// return func(c *gin.Context) { -// h.ServeHTTP(c.Writer, c.Request) -// } -//} -// -//func computeApproximateRequestSize(r *http.Request) int { -// var s int -// if r.URL != nil { -// s = len(r.URL.Path) -// } -// -// s += len(r.Method) -// s += len(r.Proto) -// for name, values := range r.Header { -// s += len(name) -// for _, value := range values { -// s += len(value) -// } -// } -// s += len(r.Host) -// -// // r.FormData and r.MultipartForm are assumed to be included in r.URL. -// -// if r.ContentLength != -1 { -// s += int(r.ContentLength) -// } -// return s -//} diff --git a/pkg/common/prommetrics/grpc_auth.go b/pkg/common/prommetrics/grpc_auth.go index a102c5d26..7a9884f1f 100644 --- a/pkg/common/prommetrics/grpc_auth.go +++ b/pkg/common/prommetrics/grpc_auth.go @@ -1,17 +1,3 @@ -// 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 prommetrics import ( diff --git a/pkg/common/prommetrics/grpc_msg.go b/pkg/common/prommetrics/grpc_msg.go index 909fddd3d..64f801fc4 100644 --- a/pkg/common/prommetrics/grpc_msg.go +++ b/pkg/common/prommetrics/grpc_msg.go @@ -1,17 +1,3 @@ -// 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 prommetrics import ( diff --git a/pkg/common/prommetrics/grpc_msggateway.go b/pkg/common/prommetrics/grpc_msggateway.go index 0377b2fa9..91da18503 100644 --- a/pkg/common/prommetrics/grpc_msggateway.go +++ b/pkg/common/prommetrics/grpc_msggateway.go @@ -1,17 +1,3 @@ -// 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 prommetrics import ( diff --git a/pkg/common/prommetrics/grpc_push.go b/pkg/common/prommetrics/grpc_push.go index c6280ec76..35b458762 100644 --- a/pkg/common/prommetrics/grpc_push.go +++ b/pkg/common/prommetrics/grpc_push.go @@ -1,17 +1,3 @@ -// 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 prommetrics import ( diff --git a/pkg/common/prommetrics/prommetrics.go b/pkg/common/prommetrics/prommetrics.go index 3f683a50e..d580f7b19 100644 --- a/pkg/common/prommetrics/prommetrics.go +++ b/pkg/common/prommetrics/prommetrics.go @@ -1,17 +1,3 @@ -// 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 prommetrics import ( diff --git a/pkg/common/prommetrics/prommetrics_test.go b/pkg/common/prommetrics/prommetrics_test.go index be2dff7f2..a8b4b54b0 100644 --- a/pkg/common/prommetrics/prommetrics_test.go +++ b/pkg/common/prommetrics/prommetrics_test.go @@ -1,75 +1,7 @@ -// 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 prommetrics import "testing" -//func TestNewGrpcPromObj(t *testing.T) { -// // Create a custom metric to pass into the NewGrpcPromObj function. -// customMetric := prometheus.NewCounter(prometheus.CounterOpts{ -// Name: "test_metric", -// Help: "This is a test metric.", -// }) -// cusMetrics := []prometheus.Collector{customMetric} -// -// // Call NewGrpcPromObj with the custom metrics. -// reg, grpcMetrics, err := NewGrpcPromObj(cusMetrics) -// -// // Assert no error was returned. -// assert.NoError(t, err) -// -// // Assert the registry was correctly initialized. -// assert.NotNil(t, reg) -// -// // Assert the grpcMetrics was correctly initialized. -// assert.NotNil(t, grpcMetrics) -// -// // Assert that the custom metric is registered. -// mfs, err := reg.Gather() -// assert.NoError(t, err) -// assert.NotEmpty(t, mfs) // Ensure some metrics are present. -// found := false -// for _, mf := range mfs { -// if *mf.Name == "test_metric" { -// found = true -// break -// } -// } -// assert.True(t, found, "Custom metric not found in registry") -//} - -//func TestGetGrpcCusMetrics(t *testing.T) { -// conf := config2.NewGlobalConfig() -// -// config2.InitConfig(conf, "../../config") -// // Test various cases based on the switch statement in the GetGrpcCusMetrics function. -// testCases := []struct { -// name string -// expected int // The expected number of metrics for each case. -// }{ -// {conf.RpcRegisterName.OpenImMessageGatewayName, 1}, -// } -// -// for _, tc := range testCases { -// t.Run(tc.name, func(t *testing.T) { -// metrics := GetGrpcCusMetrics(tc.name, &conf.RpcRegisterName) -// assert.Len(t, metrics, tc.expected) -// }) -// } -//} - func TestName(t *testing.T) { RegistryApi() RegistryApi() diff --git a/pkg/common/prommetrics/transfer.go b/pkg/common/prommetrics/transfer.go index 51a4ca872..cde065d13 100644 --- a/pkg/common/prommetrics/transfer.go +++ b/pkg/common/prommetrics/transfer.go @@ -1,17 +1,3 @@ -// 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 prommetrics import ( diff --git a/pkg/common/servererrs/code.go b/pkg/common/servererrs/code.go index 906f890a5..c39a5cf30 100644 --- a/pkg/common/servererrs/code.go +++ b/pkg/common/servererrs/code.go @@ -1,17 +1,3 @@ -// 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 servererrs // UnknownCode represents the error code when code is not parsed or parsed code equals 0. diff --git a/pkg/common/servererrs/predefine.go b/pkg/common/servererrs/predefine.go index b1d6b06a9..8f624d423 100644 --- a/pkg/common/servererrs/predefine.go +++ b/pkg/common/servererrs/predefine.go @@ -1,17 +1,3 @@ -// 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 servererrs import "github.com/openimsdk/tools/errs" diff --git a/pkg/common/servererrs/relation.go b/pkg/common/servererrs/relation.go index 62b056147..054e96d7d 100644 --- a/pkg/common/servererrs/relation.go +++ b/pkg/common/servererrs/relation.go @@ -1,17 +1,3 @@ -// 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 servererrs import "github.com/openimsdk/tools/errs" diff --git a/pkg/common/startrpc/start.go b/pkg/common/startrpc/start.go index 9715f2aac..4cb03d685 100644 --- a/pkg/common/startrpc/start.go +++ b/pkg/common/startrpc/start.go @@ -1,17 +1,3 @@ -// 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 startrpc import ( diff --git a/pkg/common/storage/cache/black.go b/pkg/common/storage/cache/black.go index 515ce3c12..8357eb2c2 100644 --- a/pkg/common/storage/cache/black.go +++ b/pkg/common/storage/cache/black.go @@ -1,17 +1,3 @@ -// 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 cache import ( diff --git a/pkg/common/storage/cache/cachekey/black.go b/pkg/common/storage/cache/cachekey/black.go index 7d2ee2771..527ad14dc 100644 --- a/pkg/common/storage/cache/cachekey/black.go +++ b/pkg/common/storage/cache/cachekey/black.go @@ -1,17 +1,3 @@ -// Copyright © 2024 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 cachekey const ( diff --git a/pkg/common/storage/cache/cachekey/conversation.go b/pkg/common/storage/cache/cachekey/conversation.go index 909774288..418234e0e 100644 --- a/pkg/common/storage/cache/cachekey/conversation.go +++ b/pkg/common/storage/cache/cachekey/conversation.go @@ -1,17 +1,3 @@ -// Copyright © 2024 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 cachekey const ( diff --git a/pkg/common/storage/cache/cachekey/doc.go b/pkg/common/storage/cache/cachekey/doc.go index caeda4cea..2f4fda603 100644 --- a/pkg/common/storage/cache/cachekey/doc.go +++ b/pkg/common/storage/cache/cachekey/doc.go @@ -1,15 +1 @@ -// Copyright © 2024 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 cachekey // import "github.com/openimsdk/open-im-server/v3/pkg/common/storage/cachekey" diff --git a/pkg/common/storage/cache/cachekey/friend.go b/pkg/common/storage/cache/cachekey/friend.go index 8a053ca32..1a821adb5 100644 --- a/pkg/common/storage/cache/cachekey/friend.go +++ b/pkg/common/storage/cache/cachekey/friend.go @@ -1,17 +1,3 @@ -// Copyright © 2024 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 cachekey const ( diff --git a/pkg/common/storage/cache/cachekey/group.go b/pkg/common/storage/cache/cachekey/group.go index 72eb7c295..657b6519d 100644 --- a/pkg/common/storage/cache/cachekey/group.go +++ b/pkg/common/storage/cache/cachekey/group.go @@ -1,17 +1,3 @@ -// Copyright © 2024 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 cachekey import ( diff --git a/pkg/common/storage/cache/cachekey/msg.go b/pkg/common/storage/cache/cachekey/msg.go index ac449df38..6edb7d130 100644 --- a/pkg/common/storage/cache/cachekey/msg.go +++ b/pkg/common/storage/cache/cachekey/msg.go @@ -1,17 +1,3 @@ -// Copyright © 2024 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 cachekey import ( diff --git a/pkg/common/storage/cache/cachekey/s3.go b/pkg/common/storage/cache/cachekey/s3.go index 5c9540b9e..826c41108 100644 --- a/pkg/common/storage/cache/cachekey/s3.go +++ b/pkg/common/storage/cache/cachekey/s3.go @@ -1,17 +1,3 @@ -// Copyright © 2024 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 cachekey import "strconv" diff --git a/pkg/common/storage/cache/cachekey/third.go b/pkg/common/storage/cache/cachekey/third.go index 469900c34..2122c1764 100644 --- a/pkg/common/storage/cache/cachekey/third.go +++ b/pkg/common/storage/cache/cachekey/third.go @@ -1,17 +1,3 @@ -// Copyright © 2024 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 cachekey import ( diff --git a/pkg/common/storage/cache/cachekey/user.go b/pkg/common/storage/cache/cachekey/user.go index 473ca1b12..3fb877e22 100644 --- a/pkg/common/storage/cache/cachekey/user.go +++ b/pkg/common/storage/cache/cachekey/user.go @@ -1,17 +1,3 @@ -// Copyright © 2024 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 cachekey const ( diff --git a/pkg/common/storage/cache/conversation.go b/pkg/common/storage/cache/conversation.go index ac3011107..20506e197 100644 --- a/pkg/common/storage/cache/conversation.go +++ b/pkg/common/storage/cache/conversation.go @@ -1,17 +1,3 @@ -// 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 cache import ( diff --git a/pkg/common/storage/cache/doc.go b/pkg/common/storage/cache/doc.go index c74bc75c0..dda785f3d 100644 --- a/pkg/common/storage/cache/doc.go +++ b/pkg/common/storage/cache/doc.go @@ -1,15 +1 @@ -// Copyright © 2024 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 cache // import "github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache" diff --git a/pkg/common/storage/cache/friend.go b/pkg/common/storage/cache/friend.go index b451d3675..fdd141719 100644 --- a/pkg/common/storage/cache/friend.go +++ b/pkg/common/storage/cache/friend.go @@ -1,17 +1,3 @@ -// 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 cache import ( diff --git a/pkg/common/storage/cache/group.go b/pkg/common/storage/cache/group.go index 05b75745a..9c4607131 100644 --- a/pkg/common/storage/cache/group.go +++ b/pkg/common/storage/cache/group.go @@ -1,17 +1,3 @@ -// 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 cache import ( diff --git a/pkg/common/storage/cache/msg.go b/pkg/common/storage/cache/msg.go index 271ed19fe..bd20edeaf 100644 --- a/pkg/common/storage/cache/msg.go +++ b/pkg/common/storage/cache/msg.go @@ -1,17 +1,3 @@ -// 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 cache import ( diff --git a/pkg/common/storage/cache/redis/batch_test.go b/pkg/common/storage/cache/redis/batch_test.go index bbb6d76f1..885990c0d 100644 --- a/pkg/common/storage/cache/redis/batch_test.go +++ b/pkg/common/storage/cache/redis/batch_test.go @@ -10,10 +10,6 @@ import ( ) func TestName(t *testing.T) { - //var rocks rockscache.Client - //rdb := getRocksCacheRedisClient(&rocks) - //t.Log(rdb == nil) - ctx := context.Background() rdb, err := redisutil.NewRedisClient(ctx, (&config.Redis{ Address: []string{"172.16.8.48:16379"}, @@ -34,11 +30,6 @@ func TestName(t *testing.T) { if err != nil { panic(err) } - //userMgo, err := mgo.NewUserMongo(mgocli.GetDB()) - //if err != nil { - // panic(err) - //} - //rock := rockscache.NewClient(rdb, rockscache.NewDefaultOptions()) mgoSeqUser, err := mgo.NewSeqUserMongo(mgocli.GetDB()) if err != nil { panic(err) diff --git a/pkg/common/storage/cache/redis/redis_shard_manager.go b/pkg/common/storage/cache/redis/redis_shard_manager.go index 0a0263892..df56bca6b 100644 --- a/pkg/common/storage/cache/redis/redis_shard_manager.go +++ b/pkg/common/storage/cache/redis/redis_shard_manager.go @@ -28,84 +28,6 @@ type Config struct { // Option is a function type for configuring Config type Option func(c *Config) -//// NewRedisShardManager creates a new RedisShardManager instance -//func NewRedisShardManager(redisClient redis.UniversalClient, opts ...Option) *RedisShardManager { -// config := &Config{ -// batchSize: defaultBatchSize, // Default batch size is 50 keys -// continueOnError: false, -// concurrentLimit: defaultConcurrentLimit, // Default concurrent limit is 3 -// } -// for _, opt := range opts { -// opt(config) -// } -// rsm := &RedisShardManager{ -// redisClient: redisClient, -// config: config, -// } -// return rsm -//} -// -//// WithBatchSize sets the number of keys to process per batch -//func WithBatchSize(size int) Option { -// return func(c *Config) { -// c.batchSize = size -// } -//} -// -//// WithContinueOnError sets whether to continue processing on error -//func WithContinueOnError(continueOnError bool) Option { -// return func(c *Config) { -// c.continueOnError = continueOnError -// } -//} -// -//// WithConcurrentLimit sets the concurrency limit -//func WithConcurrentLimit(limit int) Option { -// return func(c *Config) { -// c.concurrentLimit = limit -// } -//} -// -//// ProcessKeysBySlot groups keys by their Redis cluster hash slots and processes them using the provided function. -//func (rsm *RedisShardManager) ProcessKeysBySlot( -// ctx context.Context, -// keys []string, -// processFunc func(ctx context.Context, slot int64, keys []string) error, -//) error { -// -// // Group keys by slot -// slots, err := groupKeysBySlot(ctx, rsm.redisClient, keys) -// if err != nil { -// return err -// } -// -// g, ctx := errgroup.WithContext(ctx) -// g.SetLimit(rsm.config.concurrentLimit) -// -// // Process keys in each slot using the provided function -// for slot, singleSlotKeys := range slots { -// batches := splitIntoBatches(singleSlotKeys, rsm.config.batchSize) -// for _, batch := range batches { -// slot, batch := slot, batch // Avoid closure capture issue -// g.Go(func() error { -// err := processFunc(ctx, slot, batch) -// if err != nil { -// log.ZWarn(ctx, "Batch processFunc failed", err, "slot", slot, "keys", batch) -// if !rsm.config.continueOnError { -// return err -// } -// } -// return nil -// }) -// } -// } -// -// if err := g.Wait(); err != nil { -// return err -// } -// return nil -//} - // groupKeysBySlot groups keys by their Redis cluster hash slots. func groupKeysBySlot(ctx context.Context, redisClient redis.UniversalClient, keys []string) (map[int64][]string, error) { slots := make(map[int64][]string) diff --git a/pkg/common/storage/cache/redis/seq_conversation_test.go b/pkg/common/storage/cache/redis/seq_conversation_test.go index d8bfdfbfb..ab1378ffe 100644 --- a/pkg/common/storage/cache/redis/seq_conversation_test.go +++ b/pkg/common/storage/cache/redis/seq_conversation_test.go @@ -131,13 +131,3 @@ func TestGetMaxSeqWithTime1(t *testing.T) { ts := newTestSeq() t.Log(ts.GetMaxSeqsWithTime(context.Background(), []string{"10000000", "12345", "111"})) } - -// -//func TestHMGET(t *testing.T) { -// ts := newTestSeq() -// res, err := ts.rdb.HMGet(context.Background(), "MALLOC_SEQ:1", "CURR", "TIME1").Result() -// if err != nil { -// panic(err) -// } -// t.Log(res) -//} diff --git a/pkg/common/storage/cache/s3.go b/pkg/common/storage/cache/s3.go index 4d899586c..ae4003a14 100644 --- a/pkg/common/storage/cache/s3.go +++ b/pkg/common/storage/cache/s3.go @@ -1,17 +1,3 @@ -// 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 cache import ( diff --git a/pkg/common/storage/cache/user.go b/pkg/common/storage/cache/user.go index 69a11635c..27256a7f3 100644 --- a/pkg/common/storage/cache/user.go +++ b/pkg/common/storage/cache/user.go @@ -1,17 +1,3 @@ -// 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 cache import ( diff --git a/pkg/common/storage/common/types.go b/pkg/common/storage/common/types.go index 759121158..0b4fb7217 100644 --- a/pkg/common/storage/common/types.go +++ b/pkg/common/storage/common/types.go @@ -1,17 +1,3 @@ -// 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 common type BatchUpdateGroupMember struct { diff --git a/pkg/common/storage/controller/auth.go b/pkg/common/storage/controller/auth.go index 488a116c3..a8a4226a1 100644 --- a/pkg/common/storage/controller/auth.go +++ b/pkg/common/storage/controller/auth.go @@ -237,14 +237,6 @@ func (a *authDatabase) checkToken(ctx context.Context, tokens map[int]map[string return nil, nil, nil, errs.New("unknown multiLogin policy").Wrap() } - //var adminTokenMaxNum = a.multiLogin.MaxNumOneEnd - //l := len(adminToken) - //if platformID == constant.AdminPlatformID { - // l++ - //} - //if l > adminTokenMaxNum { - // kickToken = append(kickToken, adminToken[:l-adminTokenMaxNum]...) - //} var deleteAdminToken []string if platformID == constant.AdminPlatformID { deleteAdminToken = adminToken diff --git a/pkg/common/storage/controller/black.go b/pkg/common/storage/controller/black.go index 8a12f2aa2..75f5f13e4 100644 --- a/pkg/common/storage/controller/black.go +++ b/pkg/common/storage/controller/black.go @@ -1,17 +1,3 @@ -// Copyright © 2023 OpenIM. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - package controller import ( diff --git a/pkg/common/storage/controller/conversation.go b/pkg/common/storage/controller/conversation.go index 27442ca66..c20b4113c 100644 --- a/pkg/common/storage/controller/conversation.go +++ b/pkg/common/storage/controller/conversation.go @@ -1,17 +1,3 @@ -// Copyright © 2023 OpenIM. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - package controller import ( diff --git a/pkg/common/storage/controller/doc.go b/pkg/common/storage/controller/doc.go index 8ade2b13a..95656edf5 100644 --- a/pkg/common/storage/controller/doc.go +++ b/pkg/common/storage/controller/doc.go @@ -1,15 +1 @@ -// Copyright © 2024 OpenIM. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - package controller // import "github.com/openimsdk/open-im-server/v3/pkg/common/storage/controller" diff --git a/pkg/common/storage/controller/friend.go b/pkg/common/storage/controller/friend.go index 806468ea1..d722d0748 100644 --- a/pkg/common/storage/controller/friend.go +++ b/pkg/common/storage/controller/friend.go @@ -1,17 +1,3 @@ -// Copyright © 2023 OpenIM. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - package controller import ( diff --git a/pkg/common/storage/controller/group.go b/pkg/common/storage/controller/group.go index 24209cd6c..a7f466ebe 100644 --- a/pkg/common/storage/controller/group.go +++ b/pkg/common/storage/controller/group.go @@ -1,17 +1,3 @@ -// Copyright © 2023 OpenIM. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - package controller import ( diff --git a/pkg/common/storage/controller/msg.go b/pkg/common/storage/controller/msg.go index f833008e8..cbb3d4167 100644 --- a/pkg/common/storage/controller/msg.go +++ b/pkg/common/storage/controller/msg.go @@ -1,17 +1,3 @@ -// Copyright © 2023 OpenIM. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - package controller import ( @@ -363,25 +349,6 @@ func (db *commonMsgDatabase) findMsgInfoBySeq(ctx context.Context, userID, docID return msgs, err } -// GetMsgBySeqsRange In the context of group chat, we have the following parameters: -// -// "maxSeq" of a conversation: It represents the maximum value of messages in the group conversation. -// "minSeq" of a conversation (default: 1): It represents the minimum value of messages in the group conversation. -// -// For a user's perspective regarding the group conversation, we have the following parameters: -// -// "userMaxSeq": It represents the user's upper limit for message retrieval in the group. If not set (default: 0), -// it means the upper limit is the same as the conversation's "maxSeq". -// "userMinSeq": It represents the user's starting point for message retrieval in the group. If not set (default: 0), -// it means the starting point is the same as the conversation's "minSeq". -// -// The scenarios for these parameters are as follows: -// -// For users who have been kicked out of the group, "userMaxSeq" can be set as the maximum value they had before -// being kicked out. This limits their ability to retrieve messages up to a certain point. -// For new users joining the group, if they don't need to receive old messages, -// "userMinSeq" can be set as the same value as the conversation's "maxSeq" at the moment they join the group. -// This ensures that their message retrieval starts from the point they joined. func (db *commonMsgDatabase) GetMsgBySeqsRange(ctx context.Context, userID string, conversationID string, begin, end, num, userMaxSeq int64) (int64, int64, []*sdkws.MsgData, error) { userMinSeq, err := db.seqUser.GetUserMinSeq(ctx, conversationID, userID) if err != nil && !errors.Is(err, redis.Nil) { diff --git a/pkg/common/storage/controller/msg_transfer.go b/pkg/common/storage/controller/msg_transfer.go index 28392d66e..73b3a2d66 100644 --- a/pkg/common/storage/controller/msg_transfer.go +++ b/pkg/common/storage/controller/msg_transfer.go @@ -38,18 +38,6 @@ type MsgTransferDatabase interface { } func NewMsgTransferDatabase(msgDocModel database.Msg, msg cache.MsgCache, seqUser cache.SeqUser, seqConversation cache.SeqConversationCache, mongoProducer, pushProducer mq.Producer) (MsgTransferDatabase, error) { - //conf, err := kafka.BuildProducerConfig(*kafkaConf.Build()) - //if err != nil { - // return nil, err - //} - //producerToMongo, err := kafka.NewKafkaProducerV2(conf, kafkaConf.Address, kafkaConf.ToMongoTopic) - //if err != nil { - // return nil, err - //} - //producerToPush, err := kafka.NewKafkaProducerV2(conf, kafkaConf.Address, kafkaConf.ToPushTopic) - //if err != nil { - // return nil, err - //} return &msgTransferDatabase{ msgDocDatabase: msgDocModel, msgCache: msg, diff --git a/pkg/common/storage/controller/push.go b/pkg/common/storage/controller/push.go index ce62a7258..dbbb7ee0d 100644 --- a/pkg/common/storage/controller/push.go +++ b/pkg/common/storage/controller/push.go @@ -1,17 +1,3 @@ -// Copyright © 2023 OpenIM. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - package controller import ( diff --git a/pkg/common/storage/controller/s3.go b/pkg/common/storage/controller/s3.go index 9ab31c5a6..2dc5c206a 100644 --- a/pkg/common/storage/controller/s3.go +++ b/pkg/common/storage/controller/s3.go @@ -1,17 +1,3 @@ -// Copyright © 2023 OpenIM. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - package controller import ( diff --git a/pkg/common/storage/controller/third.go b/pkg/common/storage/controller/third.go index a9c2ae403..a488eff7f 100644 --- a/pkg/common/storage/controller/third.go +++ b/pkg/common/storage/controller/third.go @@ -1,17 +1,3 @@ -// Copyright © 2023 OpenIM. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - package controller import ( diff --git a/pkg/common/storage/controller/user.go b/pkg/common/storage/controller/user.go index d747ce2fa..699a95bbd 100644 --- a/pkg/common/storage/controller/user.go +++ b/pkg/common/storage/controller/user.go @@ -1,17 +1,3 @@ -// Copyright © 2023 OpenIM. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - package controller import ( diff --git a/pkg/common/storage/database/black.go b/pkg/common/storage/database/black.go index 5af960abe..00a8148bb 100644 --- a/pkg/common/storage/database/black.go +++ b/pkg/common/storage/database/black.go @@ -1,17 +1,3 @@ -// 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 database import ( diff --git a/pkg/common/storage/database/conversation.go b/pkg/common/storage/database/conversation.go index d612dfc2d..6042b8aa1 100644 --- a/pkg/common/storage/database/conversation.go +++ b/pkg/common/storage/database/conversation.go @@ -1,17 +1,3 @@ -// 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 database import ( diff --git a/pkg/common/storage/database/doc.go b/pkg/common/storage/database/doc.go index 4a691442e..5cebd3b64 100644 --- a/pkg/common/storage/database/doc.go +++ b/pkg/common/storage/database/doc.go @@ -1,15 +1 @@ -// Copyright © 2024 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 database // import "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model/relation" diff --git a/pkg/common/storage/database/friend.go b/pkg/common/storage/database/friend.go index b596411fc..0f5651ed4 100644 --- a/pkg/common/storage/database/friend.go +++ b/pkg/common/storage/database/friend.go @@ -1,17 +1,3 @@ -// 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 database import ( diff --git a/pkg/common/storage/database/friend_request.go b/pkg/common/storage/database/friend_request.go index c0df77823..b90a6b3dc 100644 --- a/pkg/common/storage/database/friend_request.go +++ b/pkg/common/storage/database/friend_request.go @@ -1,17 +1,3 @@ -// 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 database import ( diff --git a/pkg/common/storage/database/group.go b/pkg/common/storage/database/group.go index 7ef22f6c9..19b8ef305 100644 --- a/pkg/common/storage/database/group.go +++ b/pkg/common/storage/database/group.go @@ -1,17 +1,3 @@ -// 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 database import ( diff --git a/pkg/common/storage/database/group_member.go b/pkg/common/storage/database/group_member.go index 0ddf0654c..e98a7beca 100644 --- a/pkg/common/storage/database/group_member.go +++ b/pkg/common/storage/database/group_member.go @@ -1,17 +1,3 @@ -// 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 database import ( diff --git a/pkg/common/storage/database/group_request.go b/pkg/common/storage/database/group_request.go index 766ea2cd5..1892af57c 100644 --- a/pkg/common/storage/database/group_request.go +++ b/pkg/common/storage/database/group_request.go @@ -1,17 +1,3 @@ -// 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 database import ( diff --git a/pkg/common/storage/database/log.go b/pkg/common/storage/database/log.go index 383cc5547..c90d37959 100644 --- a/pkg/common/storage/database/log.go +++ b/pkg/common/storage/database/log.go @@ -1,17 +1,3 @@ -// 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 database import ( diff --git a/pkg/common/storage/database/mgo/black.go b/pkg/common/storage/database/mgo/black.go index 4a7a35e6f..ed65357d9 100644 --- a/pkg/common/storage/database/mgo/black.go +++ b/pkg/common/storage/database/mgo/black.go @@ -1,17 +1,3 @@ -// 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 mgo import ( diff --git a/pkg/common/storage/database/mgo/cache_test.go b/pkg/common/storage/database/mgo/cache_test.go index ac8b22951..9ae06b1ba 100644 --- a/pkg/common/storage/database/mgo/cache_test.go +++ b/pkg/common/storage/database/mgo/cache_test.go @@ -16,22 +16,6 @@ import ( func TestName1111(t *testing.T) { coll := Mongodb().Collection("temp") - - //updatePipeline := mongo.Pipeline{ - // { - // {"$set", bson.M{ - // "age": bson.M{ - // "$toString": bson.M{ - // "$add": bson.A{ - // bson.M{"$toInt": "$age"}, - // 1, - // }, - // }, - // }, - // }}, - // }, - //} - pipeline := mongo.Pipeline{ { {"$set", bson.M{ diff --git a/pkg/common/storage/database/mgo/client_config.go b/pkg/common/storage/database/mgo/client_config.go index 0aa462899..6426af513 100644 --- a/pkg/common/storage/database/mgo/client_config.go +++ b/pkg/common/storage/database/mgo/client_config.go @@ -1,17 +1,3 @@ -// Copyright © 2023 OpenIM open source community. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - package mgo import ( diff --git a/pkg/common/storage/database/mgo/conversation.go b/pkg/common/storage/database/mgo/conversation.go index 89f13ea3d..dac51b06d 100644 --- a/pkg/common/storage/database/mgo/conversation.go +++ b/pkg/common/storage/database/mgo/conversation.go @@ -1,17 +1,3 @@ -// 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 mgo import ( diff --git a/pkg/common/storage/database/mgo/doc.go b/pkg/common/storage/database/mgo/doc.go index 3bc6611ff..6b5040d29 100644 --- a/pkg/common/storage/database/mgo/doc.go +++ b/pkg/common/storage/database/mgo/doc.go @@ -1,15 +1 @@ -// Copyright © 2024 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 mgo // import "github.com/openimsdk/open-im-server/v3/pkg/common/storage/database" diff --git a/pkg/common/storage/database/mgo/friend.go b/pkg/common/storage/database/mgo/friend.go index 76c82bac2..b6d19dec3 100644 --- a/pkg/common/storage/database/mgo/friend.go +++ b/pkg/common/storage/database/mgo/friend.go @@ -1,17 +1,3 @@ -// 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 mgo import ( diff --git a/pkg/common/storage/database/mgo/friend_request.go b/pkg/common/storage/database/mgo/friend_request.go index 64bf9205c..8dd038b83 100644 --- a/pkg/common/storage/database/mgo/friend_request.go +++ b/pkg/common/storage/database/mgo/friend_request.go @@ -1,17 +1,3 @@ -// 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 mgo import ( diff --git a/pkg/common/storage/database/mgo/group.go b/pkg/common/storage/database/mgo/group.go index 620269b43..a0c0e65cd 100644 --- a/pkg/common/storage/database/mgo/group.go +++ b/pkg/common/storage/database/mgo/group.go @@ -1,17 +1,3 @@ -// 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 mgo import ( diff --git a/pkg/common/storage/database/mgo/group_member.go b/pkg/common/storage/database/mgo/group_member.go index 510a049d0..bc1cf5c25 100644 --- a/pkg/common/storage/database/mgo/group_member.go +++ b/pkg/common/storage/database/mgo/group_member.go @@ -1,17 +1,3 @@ -// 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 mgo import ( diff --git a/pkg/common/storage/database/mgo/group_request.go b/pkg/common/storage/database/mgo/group_request.go index 1dcb3ae23..344c8441f 100644 --- a/pkg/common/storage/database/mgo/group_request.go +++ b/pkg/common/storage/database/mgo/group_request.go @@ -1,17 +1,3 @@ -// 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 mgo import ( diff --git a/pkg/common/storage/database/mgo/helpers.go b/pkg/common/storage/database/mgo/helpers.go index 23e66236a..5fcc2921e 100644 --- a/pkg/common/storage/database/mgo/helpers.go +++ b/pkg/common/storage/database/mgo/helpers.go @@ -1,17 +1,3 @@ -// 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 mgo import ( diff --git a/pkg/common/storage/database/mgo/log.go b/pkg/common/storage/database/mgo/log.go index 6ff4c6039..8099864cf 100644 --- a/pkg/common/storage/database/mgo/log.go +++ b/pkg/common/storage/database/mgo/log.go @@ -1,17 +1,3 @@ -// 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 mgo import ( diff --git a/pkg/common/storage/database/mgo/msg.go b/pkg/common/storage/database/mgo/msg.go index 315f4530b..7fa6f8355 100644 --- a/pkg/common/storage/database/mgo/msg.go +++ b/pkg/common/storage/database/mgo/msg.go @@ -1097,26 +1097,6 @@ func (m *MsgMgo) onlyFindDocIndex(ctx context.Context, docID string, indexes []i return msgDocModel[0].Msg, nil } -//func (m *MsgMgo) FindSeqs(ctx context.Context, conversationID string, seqs []int64) ([]*model.MsgInfoModel, error) { -// if len(seqs) == 0 { -// return nil, nil -// } -// result := make([]*model.MsgInfoModel, 0, len(seqs)) -// for docID, seqs := range m.model.GetDocIDSeqsMap(conversationID, seqs) { -// res, err := m.onlyFindDocIndex(ctx, docID, datautil.Slice(seqs, m.model.GetMsgIndex)) -// if err != nil { -// return nil, err -// } -// for i, re := range res { -// if re == nil || re.Msg == nil { -// continue -// } -// result = append(result, res[i]) -// } -// } -// return result, nil -//} - func (m *MsgMgo) findBeforeDocSendTime(ctx context.Context, docID string, limit int64) (int64, int64, error) { if limit == 0 { return 0, 0, nil diff --git a/pkg/common/storage/database/mgo/msg_test.go b/pkg/common/storage/database/mgo/msg_test.go index 8f3bd1e8a..7a2b44158 100644 --- a/pkg/common/storage/database/mgo/msg_test.go +++ b/pkg/common/storage/database/mgo/msg_test.go @@ -18,45 +18,6 @@ import ( ) func TestName1(t *testing.T) { - //ctx, cancel := context.WithTimeout(context.Background(), time.Second*300) - //defer cancel() - //cli := Result(mongo.Connect(ctx, options.Client().ApplyURI("mongodb://openIM:openIM123@172.16.8.66:37017/openim_v3?maxPoolSize=100").SetConnectTimeout(5*time.Second))) - // - //v := &MsgMgo{ - // coll: cli.Database("openim_v3").Collection("msg3"), - //} - // - //req := &msg.SearchMessageReq{ - // //RecvID: "3187706596", - // //SendID: "7009965934", - // ContentType: 101, - // //SendTime: "2024-05-06", - // //SessionType: 3, - // Pagination: &sdkws.RequestPagination{ - // PageNumber: 1, - // ShowNumber: 10, - // }, - //} - //total, res, err := v.SearchMessage(ctx, req) - //if err != nil { - // panic(err) - //} - // - //for i, re := range res { - // t.Logf("%d => %d | %+v", i+1, re.Msg.Seq, re.Msg.Content) - //} - // - //t.Log(total) - // - //msg, err := NewMsgMongo(cli.Database("openim_v3")) - //if err != nil { - // panic(err) - //} - //res, err := msg.GetBeforeMsg(ctx, time.Now().UnixMilli(), []string{"1:0"}, 1000) - //if err != nil { - // panic(err) - //} - //t.Log(len(res)) } func TestName10(t *testing.T) { @@ -134,23 +95,6 @@ func TestName5(t *testing.T) { t.Log(res) } -//func TestName6(t *testing.T) { -// ctx, cancel := context.WithTimeout(context.Background(), time.Second*300) -// defer cancel() -// cli := Result(mongo.Connect(ctx, options.Client().ApplyURI("mongodb://openIM:openIM123@172.16.8.135:37017/openim_v3?maxPoolSize=100").SetConnectTimeout(5*time.Second))) -// -// tmp, err := NewMsgMongo(cli.Database("openim_v3")) -// if err != nil { -// panic(err) -// } -// msg := tmp.(*MsgMgo) -// seq, sendTime, err := msg.findBeforeSendTime(ctx, "si_4924054191_9511766539", 1144) -// if err != nil { -// panic(err) -// } -// t.Log(seq, sendTime) -//} - func TestSearchMessage(t *testing.T) { ctx, cancel := context.WithTimeout(context.Background(), time.Second*300) defer cancel() diff --git a/pkg/common/storage/database/mgo/object.go b/pkg/common/storage/database/mgo/object.go index ee48c6693..23afce718 100644 --- a/pkg/common/storage/database/mgo/object.go +++ b/pkg/common/storage/database/mgo/object.go @@ -1,17 +1,3 @@ -// 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 mgo import ( diff --git a/pkg/common/storage/database/mgo/user.go b/pkg/common/storage/database/mgo/user.go index 04ecca1e8..55b56d7fe 100644 --- a/pkg/common/storage/database/mgo/user.go +++ b/pkg/common/storage/database/mgo/user.go @@ -1,17 +1,3 @@ -// 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 mgo import ( diff --git a/pkg/common/storage/database/mgo/version_test.go b/pkg/common/storage/database/mgo/version_test.go index 4576e45bc..3d7143baf 100644 --- a/pkg/common/storage/database/mgo/version_test.go +++ b/pkg/common/storage/database/mgo/version_test.go @@ -9,13 +9,6 @@ import ( "time" ) -//func Result[V any](val V, err error) V { -// if err != nil { -// panic(err) -// } -// return val -//} - func Check(err error) { if err != nil { panic(err) diff --git a/pkg/common/storage/database/msg.go b/pkg/common/storage/database/msg.go index e3c4e8ece..07ca3c64f 100644 --- a/pkg/common/storage/database/msg.go +++ b/pkg/common/storage/database/msg.go @@ -1,17 +1,3 @@ -// 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 database import ( diff --git a/pkg/common/storage/database/object.go b/pkg/common/storage/database/object.go index a0e4ebe2b..4b942d6f8 100644 --- a/pkg/common/storage/database/object.go +++ b/pkg/common/storage/database/object.go @@ -1,17 +1,3 @@ -// 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 database import ( diff --git a/pkg/common/storage/database/user.go b/pkg/common/storage/database/user.go index c597424b9..ec459a56b 100644 --- a/pkg/common/storage/database/user.go +++ b/pkg/common/storage/database/user.go @@ -1,17 +1,3 @@ -// 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 database import ( diff --git a/pkg/common/storage/model/black.go b/pkg/common/storage/model/black.go index 5e60a2fc3..0275e7e26 100644 --- a/pkg/common/storage/model/black.go +++ b/pkg/common/storage/model/black.go @@ -1,17 +1,3 @@ -// 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 model import ( diff --git a/pkg/common/storage/model/conversation.go b/pkg/common/storage/model/conversation.go index 590899b3f..5263c1f27 100644 --- a/pkg/common/storage/model/conversation.go +++ b/pkg/common/storage/model/conversation.go @@ -1,17 +1,3 @@ -// 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 model import ( diff --git a/pkg/common/storage/model/doc.go b/pkg/common/storage/model/doc.go index 5eb7b36b0..5e4a16b84 100644 --- a/pkg/common/storage/model/doc.go +++ b/pkg/common/storage/model/doc.go @@ -1,15 +1 @@ -// Copyright © 2024 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 model // import "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model/relation" diff --git a/pkg/common/storage/model/friend.go b/pkg/common/storage/model/friend.go index abcca2f2b..508ebc379 100644 --- a/pkg/common/storage/model/friend.go +++ b/pkg/common/storage/model/friend.go @@ -1,17 +1,3 @@ -// 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 model import ( diff --git a/pkg/common/storage/model/friend_request.go b/pkg/common/storage/model/friend_request.go index 7835690cb..0fa856a4d 100644 --- a/pkg/common/storage/model/friend_request.go +++ b/pkg/common/storage/model/friend_request.go @@ -1,17 +1,3 @@ -// 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 model import ( diff --git a/pkg/common/storage/model/group.go b/pkg/common/storage/model/group.go index 714fcc782..1a005cb9c 100644 --- a/pkg/common/storage/model/group.go +++ b/pkg/common/storage/model/group.go @@ -1,17 +1,3 @@ -// 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 model import ( diff --git a/pkg/common/storage/model/group_member.go b/pkg/common/storage/model/group_member.go index 4cb0703ed..60c8ef49c 100644 --- a/pkg/common/storage/model/group_member.go +++ b/pkg/common/storage/model/group_member.go @@ -1,17 +1,3 @@ -// 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 model import ( diff --git a/pkg/common/storage/model/group_request.go b/pkg/common/storage/model/group_request.go index d075699f1..7c50853b0 100644 --- a/pkg/common/storage/model/group_request.go +++ b/pkg/common/storage/model/group_request.go @@ -1,17 +1,3 @@ -// 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 model import ( diff --git a/pkg/common/storage/model/log.go b/pkg/common/storage/model/log.go index 9dc392179..f686fe9d1 100644 --- a/pkg/common/storage/model/log.go +++ b/pkg/common/storage/model/log.go @@ -1,17 +1,3 @@ -// 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 model import ( diff --git a/pkg/common/storage/model/msg.go b/pkg/common/storage/model/msg.go index 2bb4882f7..7f72364d5 100644 --- a/pkg/common/storage/model/msg.go +++ b/pkg/common/storage/model/msg.go @@ -1,17 +1,3 @@ -// 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 model import ( diff --git a/pkg/common/storage/model/object.go b/pkg/common/storage/model/object.go index e08a55d73..445e989bb 100644 --- a/pkg/common/storage/model/object.go +++ b/pkg/common/storage/model/object.go @@ -1,17 +1,3 @@ -// 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 model import ( diff --git a/pkg/common/storage/model/subscribe.go b/pkg/common/storage/model/subscribe.go index e71fef3e9..a4256cfe4 100644 --- a/pkg/common/storage/model/subscribe.go +++ b/pkg/common/storage/model/subscribe.go @@ -1,17 +1,3 @@ -// 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 model // SubscribeUserTableName collection constant. diff --git a/pkg/common/storage/model/user.go b/pkg/common/storage/model/user.go index f64d09e79..a09b0c8ad 100644 --- a/pkg/common/storage/model/user.go +++ b/pkg/common/storage/model/user.go @@ -1,17 +1,3 @@ -// 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 model import ( diff --git a/pkg/common/webhook/doc.go b/pkg/common/webhook/doc.go index 3a8e3e622..0ca0062f4 100644 --- a/pkg/common/webhook/doc.go +++ b/pkg/common/webhook/doc.go @@ -1,15 +1 @@ -// Copyright © 2024 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 webhook // import "github.com/openimsdk/open-im-server/v3/pkg/common/webhook" diff --git a/pkg/common/webhook/http_client.go b/pkg/common/webhook/http_client.go index 0cd13f6e2..834d820ef 100644 --- a/pkg/common/webhook/http_client.go +++ b/pkg/common/webhook/http_client.go @@ -1,17 +1,3 @@ -// 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 webhook import ( diff --git a/pkg/common/webhook/http_client_test.go b/pkg/common/webhook/http_client_test.go index 3c3aeb809..d770c2c07 100644 --- a/pkg/common/webhook/http_client_test.go +++ b/pkg/common/webhook/http_client_test.go @@ -1,15 +1 @@ -// 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 webhook diff --git a/pkg/localcache/cache.go b/pkg/localcache/cache.go index 07d36cf46..2e2f37f82 100644 --- a/pkg/localcache/cache.go +++ b/pkg/localcache/cache.go @@ -1,17 +1,3 @@ -// Copyright © 2024 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 localcache import ( diff --git a/pkg/localcache/cache_test.go b/pkg/localcache/cache_test.go index c206e6799..c497b7b4a 100644 --- a/pkg/localcache/cache_test.go +++ b/pkg/localcache/cache_test.go @@ -1,17 +1,3 @@ -// Copyright © 2024 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 localcache import ( diff --git a/pkg/localcache/doc.go b/pkg/localcache/doc.go index 24d44b090..ac98f1146 100644 --- a/pkg/localcache/doc.go +++ b/pkg/localcache/doc.go @@ -1,15 +1 @@ -// Copyright © 2024 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 localcache // import "github.com/openimsdk/open-im-server/v3/pkg/localcache" diff --git a/pkg/localcache/init.go b/pkg/localcache/init.go index ad339da7c..a02f017d6 100644 --- a/pkg/localcache/init.go +++ b/pkg/localcache/init.go @@ -1,17 +1,3 @@ -// Copyright © 2024 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 localcache import ( diff --git a/pkg/localcache/link/doc.go b/pkg/localcache/link/doc.go index e01e7d23d..eb7ce0769 100644 --- a/pkg/localcache/link/doc.go +++ b/pkg/localcache/link/doc.go @@ -1,15 +1 @@ -// Copyright © 2024 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 link // import "github.com/openimsdk/open-im-server/v3/pkg/localcache/link" diff --git a/pkg/localcache/link/link.go b/pkg/localcache/link/link.go index 8c7701506..4f238907b 100644 --- a/pkg/localcache/link/link.go +++ b/pkg/localcache/link/link.go @@ -1,17 +1,3 @@ -// Copyright © 2024 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 link import ( diff --git a/pkg/localcache/link/link_test.go b/pkg/localcache/link/link_test.go index bb9fee6a0..ed684e693 100644 --- a/pkg/localcache/link/link_test.go +++ b/pkg/localcache/link/link_test.go @@ -1,17 +1,3 @@ -// Copyright © 2024 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 link import ( diff --git a/pkg/localcache/lru/doc.go b/pkg/localcache/lru/doc.go index 50edcc11b..f5f410eaf 100644 --- a/pkg/localcache/lru/doc.go +++ b/pkg/localcache/lru/doc.go @@ -1,15 +1 @@ -// Copyright © 2024 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 lru // import "github.com/openimsdk/open-im-server/v3/pkg/localcache/lru" diff --git a/pkg/localcache/lru/lru.go b/pkg/localcache/lru/lru.go index 726535c48..aa6b9e140 100644 --- a/pkg/localcache/lru/lru.go +++ b/pkg/localcache/lru/lru.go @@ -1,17 +1,3 @@ -// Copyright © 2024 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 lru import "github.com/hashicorp/golang-lru/v2/simplelru" diff --git a/pkg/localcache/lru/lru_expiration.go b/pkg/localcache/lru/lru_expiration.go index df6bacbf4..135fc0d3b 100644 --- a/pkg/localcache/lru/lru_expiration.go +++ b/pkg/localcache/lru/lru_expiration.go @@ -1,17 +1,3 @@ -// Copyright © 2024 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 lru import ( diff --git a/pkg/localcache/lru/lru_lazy.go b/pkg/localcache/lru/lru_lazy.go index 4a3db46c9..504ae15c4 100644 --- a/pkg/localcache/lru/lru_lazy.go +++ b/pkg/localcache/lru/lru_lazy.go @@ -1,17 +1,3 @@ -// Copyright © 2024 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 lru import ( @@ -151,12 +137,6 @@ func (x *LazyLRU[K, V]) GetBatch(keys []K, fetch func(keys []K) (map[K]V, error) return res, err } -//func (x *LazyLRU[K, V]) Has(key K) bool { -// x.lock.Lock() -// defer x.lock.Unlock() -// return x.core.Contains(key) -//} - func (x *LazyLRU[K, V]) Set(key K, value V) { x.lock.Lock() defer x.lock.Unlock() diff --git a/pkg/localcache/lru/lru_lazy_test.go b/pkg/localcache/lru/lru_lazy_test.go index ab0fa50a0..c96ecb332 100644 --- a/pkg/localcache/lru/lru_lazy_test.go +++ b/pkg/localcache/lru/lru_lazy_test.go @@ -1,17 +1,3 @@ -// Copyright © 2024 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 lru import ( @@ -65,18 +51,10 @@ func TestName(t *testing.T) { }, func() LRU[string, string] { return NewExpirationLRU[string, string](100, time.Second*60, time.Second, target, nil) }) - //l := NewInertiaLRU[string, string](1000, time.Second*20, time.Second*5, target) fn := func(key string, n int, fetch func() (string, error)) { for i := 0; i < n; i++ { - //v, err := l.Get(key, fetch) - //if err == nil { - // t.Log("key", key, "value", v) - //} else { - // t.Error("key", key, err) - //} v, err := l.Get(key, fetch) - //time.Sleep(time.Second / 100) func(v ...any) {}(v, err) } } @@ -90,21 +68,10 @@ func TestName(t *testing.T) { tmp[key] = struct{}{} go func() { defer wg.Done() - //t.Log(key) fn(key, 10000, func() (string, error) { - return "value_" + key, nil }) }() - - //wg.Add(1) - //go func() { - // defer wg.Done() - // for i := 0; i < 10; i++ { - // l.Del(key) - // time.Sleep(time.Second / 3) - // } - //}() } wg.Wait() t.Log(len(tmp)) diff --git a/pkg/localcache/lru/lru_slot.go b/pkg/localcache/lru/lru_slot.go index 14ee3b50f..193cad374 100644 --- a/pkg/localcache/lru/lru_slot.go +++ b/pkg/localcache/lru/lru_slot.go @@ -1,17 +1,3 @@ -// Copyright © 2024 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 lru func NewSlotLRU[K comparable, V any](slotNum int, hash func(K) uint64, create func() LRU[K, V]) LRU[K, V] { diff --git a/pkg/localcache/option.go b/pkg/localcache/option.go index 7d91aba6c..b023c6c7e 100644 --- a/pkg/localcache/option.go +++ b/pkg/localcache/option.go @@ -1,17 +1,3 @@ -// Copyright © 2024 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 localcache import ( diff --git a/pkg/localcache/tool.go b/pkg/localcache/tool.go index ec04ea990..ea3590823 100644 --- a/pkg/localcache/tool.go +++ b/pkg/localcache/tool.go @@ -1,17 +1,3 @@ -// Copyright © 2024 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 localcache func AnyValue[V any](v any, err error) (V, error) { diff --git a/pkg/msgprocessor/conversation.go b/pkg/msgprocessor/conversation.go index 04d772d16..48d5b5242 100644 --- a/pkg/msgprocessor/conversation.go +++ b/pkg/msgprocessor/conversation.go @@ -1,17 +1,3 @@ -// 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 ( diff --git a/pkg/msgprocessor/doc.go b/pkg/msgprocessor/doc.go index e8c96befb..be65b0c29 100644 --- a/pkg/msgprocessor/doc.go +++ b/pkg/msgprocessor/doc.go @@ -1,15 +1 @@ -// Copyright © 2024 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 "github.com/openimsdk/open-im-server/v3/pkg/msgprocessor" diff --git a/pkg/msgprocessor/options.go b/pkg/msgprocessor/options.go index 406145ef4..153bb9ec1 100644 --- a/pkg/msgprocessor/options.go +++ b/pkg/msgprocessor/options.go @@ -1,17 +1,3 @@ -// 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 "github.com/openimsdk/protocol/constant" diff --git a/pkg/notification/common_user/common.go b/pkg/notification/common_user/common.go index 470d9c7a2..266879989 100644 --- a/pkg/notification/common_user/common.go +++ b/pkg/notification/common_user/common.go @@ -1,17 +1,3 @@ -// 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 common_user type CommonUser interface { diff --git a/pkg/notification/grouphash/grouphash.go b/pkg/notification/grouphash/grouphash.go index 5015b88c8..2573569ba 100644 --- a/pkg/notification/grouphash/grouphash.go +++ b/pkg/notification/grouphash/grouphash.go @@ -1,17 +1,3 @@ -// 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 grouphash import ( diff --git a/pkg/notification/msg.go b/pkg/notification/msg.go index ba8a9185a..900eb2275 100644 --- a/pkg/notification/msg.go +++ b/pkg/notification/msg.go @@ -1,17 +1,3 @@ -// Copyright © 2023 OpenIM. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - package notification import ( diff --git a/pkg/rpccache/common.go b/pkg/rpccache/common.go index 15b3a8e09..9a6878c39 100644 --- a/pkg/rpccache/common.go +++ b/pkg/rpccache/common.go @@ -1,17 +1,3 @@ -// Copyright © 2024 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 rpccache import ( diff --git a/pkg/rpccache/conversation.go b/pkg/rpccache/conversation.go index 162fda596..c7859185a 100644 --- a/pkg/rpccache/conversation.go +++ b/pkg/rpccache/conversation.go @@ -1,17 +1,3 @@ -// Copyright © 2024 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 rpccache import ( diff --git a/pkg/rpccache/doc.go b/pkg/rpccache/doc.go index 4244bb239..6e25f8568 100644 --- a/pkg/rpccache/doc.go +++ b/pkg/rpccache/doc.go @@ -1,15 +1 @@ -// Copyright © 2024 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 rpccache // import "github.com/openimsdk/open-im-server/v3/pkg/rpccache" diff --git a/pkg/rpccache/friend.go b/pkg/rpccache/friend.go index 8ed6c1ae9..3dbca9305 100644 --- a/pkg/rpccache/friend.go +++ b/pkg/rpccache/friend.go @@ -1,17 +1,3 @@ -// Copyright © 2024 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 rpccache import ( diff --git a/pkg/rpccache/group.go b/pkg/rpccache/group.go index 174ba7dc5..420c38b86 100644 --- a/pkg/rpccache/group.go +++ b/pkg/rpccache/group.go @@ -1,17 +1,3 @@ -// Copyright © 2024 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 rpccache import ( diff --git a/pkg/rpccache/subscriber.go b/pkg/rpccache/subscriber.go index 0cb35bebf..99b9d4852 100644 --- a/pkg/rpccache/subscriber.go +++ b/pkg/rpccache/subscriber.go @@ -1,17 +1,3 @@ -// Copyright © 2024 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 rpccache import ( diff --git a/pkg/rpccache/user.go b/pkg/rpccache/user.go index cb0704906..b7cb3b635 100644 --- a/pkg/rpccache/user.go +++ b/pkg/rpccache/user.go @@ -1,17 +1,3 @@ -// Copyright © 2024 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 rpccache import ( diff --git a/pkg/statistics/doc.go b/pkg/statistics/doc.go index 7b02631dc..fa6c565e3 100644 --- a/pkg/statistics/doc.go +++ b/pkg/statistics/doc.go @@ -1,15 +1 @@ -// Copyright © 2024 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 statistics // import "github.com/openimsdk/open-im-server/v3/pkg/statistics" diff --git a/pkg/statistics/statistics.go b/pkg/statistics/statistics.go index 222fd5cbd..5698da1f0 100644 --- a/pkg/statistics/statistics.go +++ b/pkg/statistics/statistics.go @@ -1,17 +1,3 @@ -// 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 statistics import ( diff --git a/test/e2e/api/token/token.go b/test/e2e/api/token/token.go index c862dc6db..a69b803bb 100644 --- a/test/e2e/api/token/token.go +++ b/test/e2e/api/token/token.go @@ -1,17 +1,3 @@ -// 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 token import ( diff --git a/test/e2e/api/user/curd.go b/test/e2e/api/user/curd.go index 1b56492b3..d0b424e3c 100644 --- a/test/e2e/api/user/curd.go +++ b/test/e2e/api/user/curd.go @@ -1,17 +1,3 @@ -// Copyright © 2023 OpenIM. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - package user import ( diff --git a/test/e2e/api/user/user.go b/test/e2e/api/user/user.go index fd8144acd..ce264ce48 100644 --- a/test/e2e/api/user/user.go +++ b/test/e2e/api/user/user.go @@ -1,17 +1,3 @@ -// Copyright © 2023 OpenIM. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - package user import ( diff --git a/test/e2e/e2e.go b/test/e2e/e2e.go index a3d3b1bcf..0e546298f 100644 --- a/test/e2e/e2e.go +++ b/test/e2e/e2e.go @@ -1,17 +1,3 @@ -// 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 e2e import ( @@ -21,31 +7,12 @@ import ( "github.com/openimsdk/open-im-server/v3/test/e2e/api/user" ) -// RunE2ETests checks configuration parameters (specified through flags) and then runs -// E2E tests using the Ginkgo runner. -// If a "report directory" is specified, one or more JUnit test reports will be -// generated in this directory, and cluster logs will also be saved. -// This function is called on each Ginkgo node in parallel mode. func RunE2ETests(t *testing.T) { - - // Example usage of new functions token, _ := gettoken.GetUserToken("openIM123456") - - // Example of getting user info _ = user.GetUsersInfo(token, []string{"user1", "user2"}) - - // Example of updating user info _ = user.UpdateUserInfo(token, "user1", "NewNickname", "https://github.com/openimsdk/open-im-server/blob/main/assets/logo/openim-logo.png") - - // Example of getting users' online status _ = user.GetUsersOnlineStatus(token, []string{"user1", "user2"}) - - // Example of forcing a logout _ = user.ForceLogout(token, "4950983283", 2) - - // Example of checking user account _ = user.CheckUserAccount(token, []string{"openIM123456", "anotherUserID"}) - - // Example of getting users _ = user.GetUsers(token, 1, 100) } diff --git a/test/e2e/e2e_test.go b/test/e2e/e2e_test.go index a6496679c..8fe810789 100644 --- a/test/e2e/e2e_test.go +++ b/test/e2e/e2e_test.go @@ -1,17 +1,3 @@ -// 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 e2e import ( diff --git a/test/e2e/framework/config/config.go b/test/e2e/framework/config/config.go index 14074fec1..ed3c6a258 100644 --- a/test/e2e/framework/config/config.go +++ b/test/e2e/framework/config/config.go @@ -1,17 +1,3 @@ -// 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 config import ( diff --git a/test/e2e/framework/config/config_test.go b/test/e2e/framework/config/config_test.go index 66f845db3..76441d682 100644 --- a/test/e2e/framework/config/config_test.go +++ b/test/e2e/framework/config/config_test.go @@ -1,17 +1,3 @@ -// 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 config import ( diff --git a/test/e2e/framework/ginkgowrapper/ginkgowrapper.go b/test/e2e/framework/ginkgowrapper/ginkgowrapper.go index 814d393bc..16779440b 100644 --- a/test/e2e/framework/ginkgowrapper/ginkgowrapper.go +++ b/test/e2e/framework/ginkgowrapper/ginkgowrapper.go @@ -1,15 +1 @@ -// 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 ginkgowrapper diff --git a/test/e2e/framework/ginkgowrapper/ginkgowrapper_test.go b/test/e2e/framework/ginkgowrapper/ginkgowrapper_test.go index 814d393bc..16779440b 100644 --- a/test/e2e/framework/ginkgowrapper/ginkgowrapper_test.go +++ b/test/e2e/framework/ginkgowrapper/ginkgowrapper_test.go @@ -1,15 +1 @@ -// 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 ginkgowrapper diff --git a/test/e2e/framework/helpers/chat/chat.go b/test/e2e/framework/helpers/chat/chat.go index 0613ff569..fb456bf37 100644 --- a/test/e2e/framework/helpers/chat/chat.go +++ b/test/e2e/framework/helpers/chat/chat.go @@ -1,17 +1,3 @@ -// Copyright © 2023 OpenIM. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - package main import ( @@ -29,17 +15,7 @@ var ( ) func main() { - // Define the URL to get the latest version - // latestVersionURL := "https://github.com/openimsdk/chat/releases/latest" - // latestVersion, err := getLatestVersion(latestVersionURL) - // if err != nil { - // fmt.Printf("Failed to get the latest version: %v\n", err) - // return - // } latestVersion := defaultTemplateVersion - - // getLatestVersion - // Construct the download URL downloadURL := fmt.Sprintf("https://github.com/openimsdk/chat/releases/download/%s/chat_Linux_x86_64.tar.gz", latestVersion) @@ -100,23 +76,6 @@ func main() { select {} } -/* func getLatestVersion(url string) (string, error) { - resp, err := webhook.Get(url) - if err != nil { - return "", err - } - defer resp.Body.Close() - -// location := resp.Header.Get("Location") -// if location == "" { -// return defaultTemplateVersion, nil -// } - - // Extract the version number from the URL - latestVersion := filepath.Base(location) - return latestVersion, nil -} */ - // downloadAndExtract downloads a file from a URL and extracts it to a destination directory. func downloadAndExtract(url, destDir string) error { resp, err := http.Get(url) diff --git a/test/e2e/page/chat_page.go b/test/e2e/page/chat_page.go index d92c7ec6e..52aa8377d 100644 --- a/test/e2e/page/chat_page.go +++ b/test/e2e/page/chat_page.go @@ -1,15 +1 @@ -// Copyright © 2024 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 page diff --git a/test/e2e/page/login_page.go b/test/e2e/page/login_page.go index d92c7ec6e..52aa8377d 100644 --- a/test/e2e/page/login_page.go +++ b/test/e2e/page/login_page.go @@ -1,15 +1 @@ -// Copyright © 2024 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 page diff --git a/test/jwt/main.go b/test/jwt/main.go index 0ef845237..d48b68765 100644 --- a/test/jwt/main.go +++ b/test/jwt/main.go @@ -1,17 +1,3 @@ -// Copyright © 2023 OpenIM. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - package main import ( diff --git a/tools/check-component/main.go b/tools/check-component/main.go index 993f549be..50005e8e8 100644 --- a/tools/check-component/main.go +++ b/tools/check-component/main.go @@ -1,17 +1,3 @@ -// Copyright © 2023 OpenIM. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - package main import ( diff --git a/tools/imctl/main.go b/tools/imctl/main.go index 91161326e..1a501cafc 100644 --- a/tools/imctl/main.go +++ b/tools/imctl/main.go @@ -1,17 +1,3 @@ -// Copyright © 2024 OpenIM. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - package main import "fmt" diff --git a/tools/infra/main.go b/tools/infra/main.go index f6225a352..7f45ec796 100644 --- a/tools/infra/main.go +++ b/tools/infra/main.go @@ -1,17 +1,3 @@ -// Copyright © 2023 OpenIM. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - package main import ( diff --git a/tools/ncpu/main.go b/tools/ncpu/main.go index 062618b27..ca2409a6f 100644 --- a/tools/ncpu/main.go +++ b/tools/ncpu/main.go @@ -1,17 +1,3 @@ -// Copyright © 2024 OpenIM. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - package main import ( diff --git a/tools/ncpu/main_test.go b/tools/ncpu/main_test.go index f24203226..606ce0b9a 100644 --- a/tools/ncpu/main_test.go +++ b/tools/ncpu/main_test.go @@ -1,17 +1,3 @@ -// Copyright © 2023 OpenIM. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - package main import "testing" diff --git a/tools/url2im/main.go b/tools/url2im/main.go index 9e319932f..df57a437f 100644 --- a/tools/url2im/main.go +++ b/tools/url2im/main.go @@ -1,17 +1,3 @@ -// Copyright © 2023 OpenIM. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - package main import ( diff --git a/tools/url2im/pkg/api.go b/tools/url2im/pkg/api.go index 0ef8c1db7..57f632a26 100644 --- a/tools/url2im/pkg/api.go +++ b/tools/url2im/pkg/api.go @@ -1,17 +1,3 @@ -// 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 pkg import ( diff --git a/tools/url2im/pkg/buffer.go b/tools/url2im/pkg/buffer.go index b4c104652..8ccc5c52f 100644 --- a/tools/url2im/pkg/buffer.go +++ b/tools/url2im/pkg/buffer.go @@ -1,17 +1,3 @@ -// 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 pkg import ( diff --git a/tools/url2im/pkg/config.go b/tools/url2im/pkg/config.go index 740e748cb..020395262 100644 --- a/tools/url2im/pkg/config.go +++ b/tools/url2im/pkg/config.go @@ -1,17 +1,3 @@ -// 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 pkg import "time" diff --git a/tools/url2im/pkg/http.go b/tools/url2im/pkg/http.go index 50fb30c7b..32e128524 100644 --- a/tools/url2im/pkg/http.go +++ b/tools/url2im/pkg/http.go @@ -1,17 +1,3 @@ -// 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 pkg import "net/http" diff --git a/tools/url2im/pkg/manage.go b/tools/url2im/pkg/manage.go index 9dc1de801..6f2e79c15 100644 --- a/tools/url2im/pkg/manage.go +++ b/tools/url2im/pkg/manage.go @@ -1,17 +1,3 @@ -// 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 pkg import ( diff --git a/tools/url2im/pkg/md5.go b/tools/url2im/pkg/md5.go index 26b8d47a2..0db5ba000 100644 --- a/tools/url2im/pkg/md5.go +++ b/tools/url2im/pkg/md5.go @@ -1,17 +1,3 @@ -// 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 pkg import ( diff --git a/tools/url2im/pkg/progress.go b/tools/url2im/pkg/progress.go index 5f30495c6..2d6ef3891 100644 --- a/tools/url2im/pkg/progress.go +++ b/tools/url2im/pkg/progress.go @@ -1,17 +1,3 @@ -// 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 pkg import ( diff --git a/tools/versionchecker/main.go b/tools/versionchecker/main.go index bec7daa79..b992f7111 100644 --- a/tools/versionchecker/main.go +++ b/tools/versionchecker/main.go @@ -1,17 +1,3 @@ -// Copyright © 2023 OpenIM. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - package main import ( @@ -74,26 +60,8 @@ func getGitVersion() string { return version } -// // NOTE: You'll need to provide appropriate commands for OpenIM versions. -// func getOpenIMServerVersion() string { -// // Placeholder -// openimVersion := version.GetSingleVersion() -// return "OpenIM Server: " + openimVersion + "\n" -// } - -// func getOpenIMClientVersion() (string, error) { -// openIMClientVersion, err := version.GetClientVersion() -// if err != nil { -// return "", err -// } -// return "OpenIM Client: " + openIMClientVersion.ClientVersion + "\n", nil -// } - func main() { - // red := color.New(color.FgRed).SprintFunc() - // green := color.New(color.FgGreen).SprintFunc() blue := color.New(color.FgBlue).SprintFunc() - // yellow := color.New(color.FgYellow).SprintFunc() fmt.Println(blue("## Go Version")) fmt.Println(getGoVersion()) fmt.Println(blue("## Branch Type")) @@ -102,12 +70,4 @@ func main() { fmt.Println(getDockerVersion()) fmt.Println(blue("## Kubernetes Version")) fmt.Println(getKubernetesVersion()) - // fmt.Println(blue("## OpenIM Versions")) - // fmt.Println(getOpenIMServerVersion()) - // clientVersion, err := getOpenIMClientVersion() - // if err != nil { - // fmt.Println(red("Error getting OpenIM Client Version: "), err) - // } else { - // fmt.Println(clientVersion) - // } } diff --git a/tools/yamlfmt/main.go b/tools/yamlfmt/main.go index a8d3a76f6..3d3a3a44e 100644 --- a/tools/yamlfmt/main.go +++ b/tools/yamlfmt/main.go @@ -1,17 +1,3 @@ -// 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 plan on prow tools package main diff --git a/tools/yamlfmt/main_test.go b/tools/yamlfmt/main_test.go index 0a72e496b..49515a405 100644 --- a/tools/yamlfmt/main_test.go +++ b/tools/yamlfmt/main_test.go @@ -1,17 +1,3 @@ -// Copyright © 2023 OpenIM. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - package main import ( From e321e5d47e18883ebca28477f259e185ea7e48c7 Mon Sep 17 00:00:00 2001 From: mo3et Date: Fri, 7 Nov 2025 15:57:14 +0800 Subject: [PATCH 2/2] revert changes. --- internal/rpc/msg/as_read.go | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/internal/rpc/msg/as_read.go b/internal/rpc/msg/as_read.go index 2ccce2edd..157562904 100644 --- a/internal/rpc/msg/as_read.go +++ b/internal/rpc/msg/as_read.go @@ -146,8 +146,7 @@ func (m *msgServer) MarkConversationAsRead(ctx context.Context, req *msg.MarkCon var seqs []int64 log.ZDebug(ctx, "MarkConversationAsRead", "hasReadSeq", hasReadSeq, "req.HasReadSeq", req.HasReadSeq) - switch conversation.ConversationType { - case constant.SingleChatType: + if conversation.ConversationType == constant.SingleChatType { for i := hasReadSeq + 1; i <= req.HasReadSeq; i++ { seqs = append(seqs, i) } @@ -172,7 +171,8 @@ func (m *msgServer) MarkConversationAsRead(ctx context.Context, req *msg.MarkCon } m.sendMarkAsReadNotification(ctx, req.ConversationID, conversation.ConversationType, req.UserID, m.conversationAndGetRecvID(conversation, req.UserID), seqs, hasReadSeq) - case constant.ReadGroupChatType, constant.NotificationChatType: + } else if conversation.ConversationType == constant.ReadGroupChatType || + conversation.ConversationType == constant.NotificationChatType { if req.HasReadSeq > hasReadSeq { err = m.MsgDatabase.SetHasReadSeq(ctx, req.UserID, req.ConversationID, req.HasReadSeq) if err != nil { @@ -184,8 +184,7 @@ func (m *msgServer) MarkConversationAsRead(ctx context.Context, req *msg.MarkCon req.UserID, seqs, hasReadSeq) } - switch conversation.ConversationType { - case constant.SingleChatType: + if conversation.ConversationType == constant.SingleChatType { reqCall := &cbapi.CallbackSingleMsgReadReq{ ConversationID: conversation.ConversationID, UserID: conversation.OwnerUserID, @@ -193,7 +192,7 @@ func (m *msgServer) MarkConversationAsRead(ctx context.Context, req *msg.MarkCon ContentType: conversation.ConversationType, } m.webhookAfterSingleMsgRead(ctx, &m.config.WebhooksConfig.AfterSingleMsgRead, reqCall) - case constant.ReadGroupChatType: + } else if conversation.ConversationType == constant.ReadGroupChatType { reqCall := &cbapi.CallbackGroupMsgReadReq{ SendID: conversation.OwnerUserID, ReceiveID: req.UserID,