diff --git a/sub/subService.go b/sub/subService.go index 0ae46e02..18bf7bd5 100644 --- a/sub/subService.go +++ b/sub/subService.go @@ -209,7 +209,8 @@ func (s *SubService) genVmessLink(inbound *model.Inbound, email string) string { obj["path"], _ = quic["key"].(string) case "grpc": grpc, _ := stream["grpcSettings"].(map[string]interface{}) - obj["path"] = grpc["serviceName"].(string) + obj["path"], _ = grpc["serviceName"].(string) + obj["authority"], _ = grpc["authority"].(string) if grpc["multiMode"].(bool) { obj["type"] = "multi" } @@ -348,6 +349,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" } @@ -533,6 +535,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" } @@ -714,6 +717,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/outbound.js b/web/assets/js/model/outbound.js index 517272f7..aa169893 100644 --- a/web/assets/js/model/outbound.js +++ b/web/assets/js/model/outbound.js @@ -257,19 +257,21 @@ class QuicStreamSettings extends CommonClass { } class GrpcStreamSettings extends CommonClass { - constructor(serviceName="", multiMode=false) { + constructor(serviceName="", authority="", multiMode=false) { super(); this.serviceName = serviceName; + this.authority = authority; this.multiMode = multiMode; } static fromJson(json={}) { - return new GrpcStreamSettings(json.serviceName, json.multiMode); + return new GrpcStreamSettings(json.serviceName, json.authority, json.multiMode); } toJson() { return { serviceName: this.serviceName, + authority: this.authority, multiMode: this.multiMode, } } @@ -640,7 +642,7 @@ class Outbound extends CommonClass { json.path, json.type ? json.type : 'none'); } else if (network === 'grpc') { - stream.grpc = new GrpcStreamSettings(json.path, json.type == 'multi'); + stream.grpc = new GrpcStreamSettings(json.path, json.authority, json.type == 'multi'); } else if (network === 'httpupgrade') { stream.httpupgrade = new HttpUpgradeStreamSettings(json.path,json.host); } @@ -682,7 +684,10 @@ class Outbound extends CommonClass { url.searchParams.get('key') ?? '', headerType ?? 'none'); } else if (type === 'grpc') { - stream.grpc = new GrpcStreamSettings(url.searchParams.get('serviceName') ?? '', url.searchParams.get('mode') == 'multi'); + stream.grpc = new GrpcStreamSettings( + url.searchParams.get('serviceName') ?? '', + url.searchParams.get('authority') ?? '', + url.searchParams.get('mode') == 'multi'); } else if (type === 'httpupgrade') { stream.httpupgrade = new HttpUpgradeStreamSettings(path,host); } diff --git a/web/assets/js/model/xray.js b/web/assets/js/model/xray.js index 1ec620b2..47dd28cb 100644 --- a/web/assets/js/model/xray.js +++ b/web/assets/js/model/xray.js @@ -435,19 +435,21 @@ class QuicStreamSettings extends XrayCommonClass { } class GrpcStreamSettings extends XrayCommonClass { - constructor(serviceName="", multiMode=false) { + constructor(serviceName="", authority="", multiMode=false) { super(); this.serviceName = serviceName; + this.authority = authority; this.multiMode = multiMode; } static fromJson(json={}) { - return new GrpcStreamSettings(json.serviceName, json.multiMode); + return new GrpcStreamSettings(json.serviceName, json.authority, json.multiMode); } toJson() { return { serviceName: this.serviceName, + authority: this.authority, multiMode: this.multiMode, } } @@ -1079,6 +1081,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' } @@ -1154,6 +1157,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"); } @@ -1261,6 +1265,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"); } @@ -1347,6 +1352,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/outbound.html b/web/html/xui/form/outbound.html index d2513262..9955c330 100644 --- a/web/html/xui/form/outbound.html +++ b/web/html/xui/form/outbound.html @@ -333,6 +333,9 @@ + + + diff --git a/web/html/xui/form/stream/stream_grpc.html b/web/html/xui/form/stream/stream_grpc.html index 4874f35a..bd44a33b 100644 --- a/web/html/xui/form/stream/stream_grpc.html +++ b/web/html/xui/form/stream/stream_grpc.html @@ -3,6 +3,9 @@ + + +