From 01cd7539f91d3dc77114a9387d5b856bdbbdbeda Mon Sep 17 00:00:00 2001 From: MHSanaei <ho3ein.sanaei@gmail.com> Date: Mon, 11 Mar 2024 13:00:00 +0330 Subject: [PATCH] New - gRPC Authority --- sub/subService.go | 4 ++++ web/assets/js/model/xray.js | 8 ++++++++ web/html/xui/form/stream/stream_grpc.html | 3 +++ 3 files changed, 15 insertions(+) diff --git a/sub/subService.go b/sub/subService.go index 8aa9b026..97473159 100644 --- a/sub/subService.go +++ b/sub/subService.go @@ -213,6 +213,7 @@ func (s *SubService) genVmessLink(inbound *model.Inbound, email string) string { case "grpc": grpc, _ := stream["grpcSettings"].(map[string]interface{}) obj["path"] = grpc["serviceName"].(string) + obj["authority"] = grpc["authority"].(string) if grpc["multiMode"].(bool) { obj["type"] = "multi" } @@ -351,6 +352,7 @@ func (s *SubService) genVlessLink(inbound *model.Inbound, email string) string { case "grpc": grpc, _ := stream["grpcSettings"].(map[string]interface{}) params["serviceName"] = grpc["serviceName"].(string) + params["authority"] = grpc["authority"].(string) if grpc["multiMode"].(bool) { params["mode"] = "multi" } @@ -571,6 +573,7 @@ func (s *SubService) genTrojanLink(inbound *model.Inbound, email string) string case "grpc": grpc, _ := stream["grpcSettings"].(map[string]interface{}) params["serviceName"] = grpc["serviceName"].(string) + params["authority"] = grpc["authority"].(string) if grpc["multiMode"].(bool) { params["mode"] = "multi" } @@ -792,6 +795,7 @@ func (s *SubService) genShadowsocksLink(inbound *model.Inbound, email string) st case "grpc": grpc, _ := stream["grpcSettings"].(map[string]interface{}) params["serviceName"] = grpc["serviceName"].(string) + params["authority"] = grpc["authority"].(string) if grpc["multiMode"].(bool) { params["mode"] = "multi" } diff --git a/web/assets/js/model/xray.js b/web/assets/js/model/xray.js index c8a4184c..9d863798 100644 --- a/web/assets/js/model/xray.js +++ b/web/assets/js/model/xray.js @@ -446,16 +446,19 @@ class QuicStreamSettings extends XrayCommonClass { class GrpcStreamSettings extends XrayCommonClass { constructor( serviceName="", + authority="", multiMode=false, ) { super(); this.serviceName = serviceName; + this.authority = authority; this.multiMode = multiMode; } static fromJson(json={}) { return new GrpcStreamSettings( json.serviceName, + json.authority, json.multiMode ); } @@ -463,6 +466,7 @@ class GrpcStreamSettings extends XrayCommonClass { toJson() { return { serviceName: this.serviceName, + authority: this.authority, multiMode: this.multiMode, } } @@ -1240,6 +1244,7 @@ class Inbound extends XrayCommonClass { obj.path = this.stream.quic.key; } else if (network === 'grpc') { obj.path = this.stream.grpc.serviceName; + obj.authority = this.stream.grpc.authority; if (this.stream.grpc.multiMode){ obj.type = 'multi' } @@ -1315,6 +1320,7 @@ class Inbound extends XrayCommonClass { case "grpc": const grpc = this.stream.grpc; params.set("serviceName", grpc.serviceName); + params.set("authority", grpc.authority); if(grpc.multiMode){ params.set("mode", "multi"); } @@ -1434,6 +1440,7 @@ class Inbound extends XrayCommonClass { case "grpc": const grpc = this.stream.grpc; params.set("serviceName", grpc.serviceName); + params.set("authority", grpc.authority); if(grpc.multiMode){ params.set("mode", "multi"); } @@ -1520,6 +1527,7 @@ class Inbound extends XrayCommonClass { case "grpc": const grpc = this.stream.grpc; params.set("serviceName", grpc.serviceName); + params.set("authority", grpc.authority); if(grpc.multiMode){ params.set("mode", "multi"); } diff --git a/web/html/xui/form/stream/stream_grpc.html b/web/html/xui/form/stream/stream_grpc.html index fcefdff9..e74a3c3f 100644 --- a/web/html/xui/form/stream/stream_grpc.html +++ b/web/html/xui/form/stream/stream_grpc.html @@ -3,6 +3,9 @@ <a-form-item label="Service Name"> <a-input v-model.trim="inbound.stream.grpc.serviceName"></a-input> </a-form-item> + <a-form-item label="Authority"> + <a-input v-model.trim="inbound.stream.grpc.authority"></a-input> + </a-form-item> <a-form-item label="Multi Mode"> <a-switch v-model="inbound.stream.grpc.multiMode"></a-switch> </a-form-item>