diff --git a/go.mod b/go.mod index 1357fd854..b11884c0e 100644 --- a/go.mod +++ b/go.mod @@ -27,7 +27,7 @@ require ( github.com/mitchellh/mapstructure v1.5.0 github.com/openimsdk/gomake v0.0.6 github.com/openimsdk/protocol v0.0.63 - github.com/openimsdk/tools v0.0.48 + github.com/openimsdk/tools v0.0.49-alpha.1 github.com/redis/go-redis/v9 v9.5.1 github.com/spf13/cobra v1.8.0 github.com/spf13/viper v1.18.2 diff --git a/go.sum b/go.sum index d4c9121bb..b0867c341 100644 --- a/go.sum +++ b/go.sum @@ -182,8 +182,8 @@ github.com/openimsdk/gomake v0.0.6 h1:bJmQWDHBj8PQ7oGJ2SL3Gsx0k5CdI/BPfGzlGcV105 github.com/openimsdk/gomake v0.0.6/go.mod h1:PndCozNc2IsQIciyn9mvEblYWZwJmAI+06z94EY+csI= github.com/openimsdk/protocol v0.0.63 h1:9DnweZe9nEYDFa4fGTbC9Cqi0gLUdtBhRo1NRP2X3WQ= github.com/openimsdk/protocol v0.0.63/go.mod h1:OZQA9FR55lseYoN2Ql1XAHYKHJGu7OMNkUbuekrKCM8= -github.com/openimsdk/tools v0.0.48 h1:GgRtYtMNlJ0PzCR9XQzMVDv7O+Sp8Hg9Grrlnh8HFGE= -github.com/openimsdk/tools v0.0.48/go.mod h1:P4oGP1Pd+d4ctbLD5U/XQTgl8yu8Hd3skx640Fr69ko= +github.com/openimsdk/tools v0.0.49-alpha.1 h1:LtlKh5t/1b1tNikR9LWwV9PIJclUNsVqpEzEke4CMtk= +github.com/openimsdk/tools v0.0.49-alpha.1/go.mod h1:P4oGP1Pd+d4ctbLD5U/XQTgl8yu8Hd3skx640Fr69ko= github.com/pelletier/go-toml/v2 v2.1.0 h1:FnwAJ4oYMvbT/34k9zzHuZNrhlz48GB3/s6at6/MHO4= github.com/pelletier/go-toml/v2 v2.1.0/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc= github.com/pion/datachannel v1.5.5 h1:10ef4kwdjije+M9d7Xm9im2Y3O6A6ccQb0zcqZcJew8= diff --git a/internal/api/admin/start.go b/internal/api/admin/start.go index 08bcce51c..ce30a64b8 100644 --- a/internal/api/admin/start.go +++ b/internal/api/admin/start.go @@ -60,8 +60,8 @@ func Start(ctx context.Context, index int, config *Config) error { adminApi := New(chatClient, adminClient, im, &base) mwApi := chatmw.New(adminClient) gin.SetMode(gin.ReleaseMode) - engine := gin.Default() - engine.Use(mw.CorsHandler(), mw.GinParseOperationID()) + engine := gin.New() + engine.Use(gin.Recovery(), mw.CorsHandler(), mw.GinParseOperationID()) SetAdminRoute(engine, adminApi, mwApi) return engine.Run(fmt.Sprintf(":%d", apiPort)) } diff --git a/internal/api/chat/start.go b/internal/api/chat/start.go index 6b30d235e..d5291c6ad 100644 --- a/internal/api/chat/start.go +++ b/internal/api/chat/start.go @@ -59,8 +59,8 @@ func Start(ctx context.Context, index int, config *Config) error { adminApi := New(chatClient, adminClient, im, &base) mwApi := chatmw.New(adminClient) gin.SetMode(gin.ReleaseMode) - engine := gin.Default() - engine.Use(mw.CorsHandler(), mw.GinParseOperationID()) + engine := gin.New() + engine.Use(gin.Recovery(), mw.CorsHandler(), mw.GinParseOperationID()) SetChatRoute(engine, adminApi, mwApi) return engine.Run(fmt.Sprintf(":%d", apiPort)) } diff --git a/internal/rpc/admin/start.go b/internal/rpc/admin/start.go index c8ed81ea6..36ac9801a 100644 --- a/internal/rpc/admin/start.go +++ b/internal/rpc/admin/start.go @@ -17,6 +17,7 @@ import ( "github.com/openimsdk/tools/db/redisutil" "github.com/openimsdk/tools/discovery" "github.com/openimsdk/tools/errs" + "github.com/openimsdk/tools/mw" "google.golang.org/grpc" "google.golang.org/grpc/credentials/insecure" "math/rand" @@ -49,7 +50,7 @@ func Start(ctx context.Context, config *Config, client discovery.SvcDiscoveryReg if err != nil { return err } - conn, err := client.GetConn(ctx, config.Share.RpcRegisterName.Chat, grpc.WithTransportCredentials(insecure.NewCredentials())) + conn, err := client.GetConn(ctx, config.Share.RpcRegisterName.Chat, grpc.WithTransportCredentials(insecure.NewCredentials()), mw.GrpcClient()) if err != nil { return err } diff --git a/internal/rpc/chat/start.go b/internal/rpc/chat/start.go index 7a4a3e7dc..ed62eaeaa 100644 --- a/internal/rpc/chat/start.go +++ b/internal/rpc/chat/start.go @@ -9,6 +9,7 @@ import ( "github.com/openimsdk/tools/db/mongoutil" "github.com/openimsdk/tools/discovery" "github.com/openimsdk/tools/errs" + "github.com/openimsdk/tools/mw" "google.golang.org/grpc" "google.golang.org/grpc/credentials/insecure" "time" @@ -52,7 +53,7 @@ func Start(ctx context.Context, config *Config, client discovery.SvcDiscoveryReg if err != nil { return err } - conn, err := client.GetConn(ctx, config.Share.RpcRegisterName.Admin, grpc.WithTransportCredentials(insecure.NewCredentials())) + conn, err := client.GetConn(ctx, config.Share.RpcRegisterName.Admin, grpc.WithTransportCredentials(insecure.NewCredentials()), mw.GrpcClient()) if err != nil { return err }