Prechádzať zdrojové kódy

Revert "grpc.WithInsecure is deprecated"

This reverts commit 0b896d9c31a38e6498992aeb61b19f6d93219f0a.
MHSanaei 1 rok pred
rodič
commit
957d9e24fb
1 zmenil súbory, kde vykonal 1 pridanie a 5 odobranie
  1. 1 5
      xray/process.go

+ 1 - 5
xray/process.go

@@ -4,7 +4,6 @@ import (
 	"bufio"
 	"bytes"
 	"context"
-	"crypto/tls"
 	"encoding/json"
 	"errors"
 	"fmt"
@@ -21,7 +20,6 @@ import (
 	"github.com/Workiva/go-datastructures/queue"
 	statsservice "github.com/xtls/xray-core/app/stats/command"
 	"google.golang.org/grpc"
-	"google.golang.org/grpc/credentials"
 )
 
 var trafficRegex = regexp.MustCompile("(inbound|outbound)>>>([^>]+)>>>traffic>>>(downlink|uplink)")
@@ -245,9 +243,7 @@ func (p *process) GetTraffic(reset bool) ([]*Traffic, []*ClientTraffic, error) {
 	if p.apiPort == 0 {
 		return nil, nil, common.NewError("xray api port wrong:", p.apiPort)
 	}
-	creds := credentials.NewTLS(&tls.Config{InsecureSkipVerify: true})
-	conn, err := grpc.Dial(fmt.Sprintf("127.0.0.1:%v", p.apiPort), grpc.WithTransportCredentials(creds))
-
+	conn, err := grpc.Dial(fmt.Sprintf("127.0.0.1:%v", p.apiPort), grpc.WithInsecure())
 	if err != nil {
 		return nil, nil, err
 	}