新增 github.com/xiaoqidun/limit 依赖,替换原有的全局速率限制器, 实现针对客户端 IP 的细粒度限流控制。在服务启动时初始化限流器, 并在程序退出前确保后台任务正确停止。同时更新 go.work 和 login/go.sum 文件以包含新的依赖项。此外,在 logic/main.go 中添加了主玩家数据 保存逻辑以确保服务关闭时数据持久化。
14 lines
580 B
Go
14 lines
580 B
Go
Copyright 2025 肖其顿
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
you may not use this file except in compliance with the License.
|
|
You may obtain a copy of the License at
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
See the License for the specific language governing permissions and
|
|
limitations under the License.
|