Skip to content

Commit

Permalink
fix #1353, grpc
Browse files Browse the repository at this point in the history
  • Loading branch information
yanue committed Jul 21, 2024
1 parent a6209d3 commit de04b2e
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion V2rayU/ConfigWindow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 =======================
Expand Down
2 changes: 1 addition & 1 deletion V2rayU/Import.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 10 additions & 0 deletions V2rayU/Uri.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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://[email protected]:443?flow=xtls-rprx-splite&encryption=none&security=xtls&sni=aaaaa&type=http&host=00.com&path=%2fvl#vless1
func encode() -> String {
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
}
Expand Down
3 changes: 2 additions & 1 deletion V2rayU/v2ray/v2rayStream.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit de04b2e

Please sign in to comment.