From de04b2ee1dbc24f7b2a2b9dcb7cb4ac6735733f9 Mon Sep 17 00:00:00 2001 From: yanue Date: Sun, 21 Jul 2024 17:42:59 +0800 Subject: [PATCH] fix #1353, grpc --- V2rayU/ConfigWindow.swift | 2 +- V2rayU/Import.swift | 2 +- V2rayU/Uri.swift | 10 ++++++++++ V2rayU/v2ray/v2rayStream.swift | 3 ++- 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/V2rayU/ConfigWindow.swift b/V2rayU/ConfigWindow.swift index 109eec1a..a87b2ead 100644 --- a/V2rayU/ConfigWindow.swift +++ b/V2rayU/ConfigWindow.swift @@ -528,7 +528,7 @@ class ConfigWindowController: NSWindowController, NSWindowDelegate, NSTabViewDel // grpc self.grpcServiceName.stringValue = v2rayConfig.streamGrpc.serviceName - self.grpcUseragent.stringValue = v2rayConfig.streamGrpc.user_agent + self.grpcUseragent.stringValue = v2rayConfig.streamGrpc.user_agent ?? "" self.grpcMulti.intValue = v2rayConfig.streamGrpc.multiMode ? 1 : 0 // ========================== stream end ======================= diff --git a/V2rayU/Import.swift b/V2rayU/Import.swift index 1a581bba..635cfdce 100644 --- a/V2rayU/Import.swift +++ b/V2rayU/Import.swift @@ -359,7 +359,7 @@ class ImportUri { // grpc v2ray.streamGrpc.serviceName = vmess.path - v2ray.streamGrpc.multiMode = vmess.type == "multi" // v2rayN + v2ray.streamGrpc.multiMode = vmess.grpcMode == "multi" // v2rayN // tcp v2ray.streamTcp.header.type = vmess.type diff --git a/V2rayU/Uri.swift b/V2rayU/Uri.swift index 34c96008..4a253c13 100644 --- a/V2rayU/Uri.swift +++ b/V2rayU/Uri.swift @@ -519,6 +519,7 @@ class VlessUri { var fp: String = "" // fingerprint var pbk: String = "" // reality public key var sid: String = "" // reality shortId + var grpcMode:String = "" // vless://f2a5064a-fabb-43ed-a2b6-8ffeb970df7f@00.com:443?flow=xtls-rprx-splite&encryption=none&security=xtls&sni=aaaaa&type=http&host=00.com&path=%2fvl#vless1 func encode() -> String { @@ -567,6 +568,9 @@ class VlessUri { break case "flow": self.flow = item.value as! String + if self.flow.isEmpty { + self.flow = "xtls-rprx-vision" + } break case "encryption": self.encryption = item.value as! String @@ -598,6 +602,12 @@ class VlessUri { case "sid": self.sid = item.value as! String break + case "serviceName": + self.path = item.value as! String + break + case "mode": + self.grpcMode = item.value as! String + break default: break } diff --git a/V2rayU/v2ray/v2rayStream.swift b/V2rayU/v2ray/v2rayStream.swift index 90c3df4c..5e6be777 100644 --- a/V2rayU/v2ray/v2rayStream.swift +++ b/V2rayU/v2ray/v2rayStream.swift @@ -205,9 +205,10 @@ struct QuicSettingHeader: Codable { } struct GrpcSettings: Codable { + var authority: String? var serviceName: String = "" var multiMode: Bool = false - var user_agent: String = "" + var user_agent: String? var idle_timeout: Int = 60 var health_check_timeout: Int = 60 var permit_without_stream: Bool = false