From 2da7dda794db6f471c587d499b73e34a9337a6e0 Mon Sep 17 00:00:00 2001 From: mhsanaei Date: Mon, 1 Jul 2024 19:22:35 +0200 Subject: [PATCH] grpc.Dial is deprecated: use NewClient instead --- xray/api.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/xray/api.go b/xray/api.go index 5242a6130..ac384ed4d 100644 --- a/xray/api.go +++ b/xray/api.go @@ -35,10 +35,11 @@ func (x *XrayAPI) Init(apiPort int) (err error) { if apiPort == 0 { return common.NewError("xray api port wrong:", apiPort) } - x.grpcClient, err = grpc.Dial(fmt.Sprintf("127.0.0.1:%v", apiPort), grpc.WithTransportCredentials(insecure.NewCredentials())) + conn, err := grpc.NewClient(fmt.Sprintf("127.0.0.1:%v", apiPort), grpc.WithTransportCredentials(insecure.NewCredentials())) if err != nil { return err } + x.grpcClient = conn x.isConnected = true hsClient := command.NewHandlerServiceClient(x.grpcClient)