Ver código fonte

Fix deprecated gRPC Dial options for Insecure connections

MHSanaei 1 ano atrás
pai
commit
783fa856c3
2 arquivos alterados com 3 adições e 2 exclusões
  1. 1 1
      web/html/xui/form/inbound.html
  2. 2 1
      xray/process.go

+ 1 - 1
web/html/xui/form/inbound.html

@@ -53,7 +53,7 @@
         </span>
         <a-date-picker :show-time="{ format: 'HH:mm:ss' }" format="YYYY-MM-DD HH:mm:ss"
                        :dropdown-class-name="themeSwitcher.darkCardClass"
-                       v-model="dbInbound._expiryTime" style="width: 300px;"></a-date-picker>
+                       v-model="dbInbound._expiryTime" style="width: 250px;"></a-date-picker>
     </a-form-item>
 </a-form>
 

+ 2 - 1
xray/process.go

@@ -20,6 +20,7 @@ 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/insecure"
 )
 
 var trafficRegex = regexp.MustCompile("(inbound|outbound)>>>([^>]+)>>>traffic>>>(downlink|uplink)")
@@ -243,7 +244,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)
 	}
-	conn, err := grpc.Dial(fmt.Sprintf("127.0.0.1:%v", p.apiPort), grpc.WithInsecure())
+	conn, err := grpc.Dial(fmt.Sprintf("127.0.0.1:%v", p.apiPort), grpc.WithTransportCredentials(insecure.NewCredentials()))
 	if err != nil {
 		return nil, nil, err
 	}