Skip to content

Commit

Permalink
fix #1390 ,streamSettings,tcp, type 为 http 情况
Browse files Browse the repository at this point in the history
  • Loading branch information
yanue committed Jul 21, 2024
1 parent d7ad0ad commit a6209d3
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 10 deletions.
8 changes: 7 additions & 1 deletion V2rayU/Import.swift
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,13 @@ class ImportUri {

// tcp
v2ray.streamTcp.header.type = vmess.type

if v2ray.streamNetwork == "tcp" && v2ray.streamTcp.header.type == "http" {
var tcpReq = TcpSettingHeaderRequest()
tcpReq.path = [vmess.netPath]
tcpReq.headers.host = [vmess.netHost]
v2ray.streamTcp.header.request = tcpReq
}

// quic
v2ray.streamQuic.header.type = vmess.type

Expand Down
12 changes: 6 additions & 6 deletions V2rayU/v2ray/v2rayStream.swift
Original file line number Diff line number Diff line change
Expand Up @@ -100,18 +100,18 @@ struct TcpSettingHeader: Codable {
}

struct TcpSettingHeaderRequest: Codable {
var version: String = ""
var method: String = ""
var version: String = "1.1"
var method: String = "GET"
var path: [String] = []
var headers: TcpSettingHeaderRequestHeaders = TcpSettingHeaderRequestHeaders()
}

struct TcpSettingHeaderRequestHeaders: Codable {
var host: [String] = []
var userAgent: [String] = []
var acceptEncoding: [String] = []
var connection: [String] = []
var pragma: String = ""
var userAgent: [String] = ["Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36"]
var acceptEncoding: [String] = ["gzip", "deflate"]
var connection: [String] = ["keep-alive"]
var pragma: String? = "no-cache"

enum CodingKeys: String, CodingKey {
case host = "Host"
Expand Down
6 changes: 3 additions & 3 deletions V2rayU/v2ray/v2rayStruct.swift
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,13 @@ struct V2rayRouting: Codable {
}

var domainStrategy: domainStrategy = .AsIs
var domainMatcher: domainMatcher? = .hybrid
var domainMatcher: domainMatcher?
var rules: [V2rayRoutingRule] = []
var balancers: [V2rayRoutingBalancer]? = []
}

struct V2rayRoutingRule: Codable {
var domainMatcher: String? = "hybrid"
var domainMatcher: String?
var type: String = "field"
var domain: [String]? = []
var ip: [String]? = []
Expand All @@ -89,7 +89,7 @@ struct V2rayRoutingRule: Codable {
var inboundTag: [String]?
var `protocol`: [String]? // ["http", "tls", "bittorrent"]
var outboundTag: String? = "direct"
var balancerTag: String? = "balancer"
var balancerTag: String?
}

struct V2rayRoutingBalancer: Codable {
Expand Down

0 comments on commit a6209d3

Please sign in to comment.