From 54b48123c5224eb92c4fe00e1642099bfa2c2309 Mon Sep 17 00:00:00 2001 From: Alireza Ahmadi Date: Sun, 14 Jul 2024 18:29:32 +0200 Subject: [PATCH] grpc dial new method Co-Authored-By: mhsanaei --- xray/api.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/xray/api.go b/xray/api.go index 9bd0c31d..b75b16a8 100644 --- a/xray/api.go +++ b/xray/api.go @@ -21,6 +21,7 @@ import ( "github.com/xtls/xray-core/proxy/vless" "github.com/xtls/xray-core/proxy/vmess" "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" ) type XrayAPI struct { @@ -34,7 +35,7 @@ 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.WithInsecure()) + x.grpcClient, err = grpc.NewClient(fmt.Sprintf("127.0.0.1:%v", apiPort), grpc.WithTransportCredentials(insecure.NewCredentials())) if err != nil { return err }