diff options
| author | mhsanaei <ho3ein.sanaei@gmail.com> | 2024-07-01 20:22:35 +0300 |
|---|---|---|
| committer | mhsanaei <ho3ein.sanaei@gmail.com> | 2024-07-01 20:22:35 +0300 |
| commit | 2da7dda794db6f471c587d499b73e34a9337a6e0 (patch) | |
| tree | 7bd83341e2ac1bd1cec9dfffae56e9f9fb6eb6c9 | |
| parent | 39aae6fd1625bd6a645368aa36b1e736f9e3d7f7 (diff) | |
grpc.Dial is deprecated: use NewClient instead
| -rw-r--r-- | xray/api.go | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/xray/api.go b/xray/api.go index 5242a613..ac384ed4 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) |
