重命名包 client 为 edge;重命名包 server 为 gateway

This commit is contained in:
2025-05-16 17:04:03 +08:00
parent 22f3c37478
commit 20ac7dbd91
37 changed files with 65 additions and 75 deletions

27
gateway/globals/redis.go Normal file
View File

@@ -0,0 +1,27 @@
package globals
import (
"github.com/redis/go-redis/v9"
"log/slog"
"net"
"proxy-server/gateway/env"
)
var Redis *redis.Client
func InitRedis() {
Redis = redis.NewClient(&redis.Options{
Addr: net.JoinHostPort(env.RedisHost, env.RedisPort),
DB: env.RedisDb,
Password: env.RedisPass,
})
}
func ExitRedis() {
if Redis != nil {
var err = Redis.Close()
if err != nil {
slog.Warn("关闭 Redis 连接失败", "err", err)
}
}
}