Skip to content

Commit

Permalink
修复ss-security为none,修复导入reality-serverName为sni
Browse files Browse the repository at this point in the history
  • Loading branch information
yanue committed Jul 17, 2023
1 parent 5325d8e commit e87fe6b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
14 changes: 9 additions & 5 deletions V2rayU/Import.swift
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ class ImportUri {
}

let v2ray = V2rayConfig()
v2ray.streamNetwork = "tcp" // 必须为tcp
v2ray.streamSecurity = "none" // ss 必须为 none

var ssServer = V2rayOutboundShadowsockServer()
ssServer.address = ss.host
ssServer.port = ss.port
Expand Down Expand Up @@ -123,6 +126,9 @@ class ImportUri {
self.remark = ssr.remark

let v2ray = V2rayConfig()
v2ray.streamNetwork = "tcp" // 必须为tcp
v2ray.streamSecurity = "none" // ss 必须为 none

var ssServer = V2rayOutboundShadowsockServer()
ssServer.address = ssr.host
ssServer.port = ssr.port
Expand Down Expand Up @@ -253,16 +259,13 @@ class ImportUri {
// stream
v2ray.streamNetwork = vmess.type
v2ray.streamSecurity = vmess.security
v2ray.securityTls.serverName = vmess.host
if vmess.host.count == 0 {
v2ray.securityTls.serverName = vmess.address
}
v2ray.securityTls.serverName = vmess.sni // default tls sni

if v2ray.streamSecurity == "reality" {
v2ray.securityReality.publicKey = vmess.pbk
v2ray.securityReality.fingerprint = vmess.fp
v2ray.securityReality.shortId = vmess.sid
v2ray.securityReality.serverName = vmess.address
v2ray.securityReality.serverName = vmess.sni
}

// kcp
Expand Down Expand Up @@ -325,6 +328,7 @@ class ImportUri {
v2ray.streamNetwork = "tcp"
v2ray.streamSecurity = trojan.security
v2ray.securityTls.allowInsecure = true
v2ray.securityTls.serverName = svr.sni // default tls sni

v2ray.serverProtocol = V2rayProtocolOutbound.trojan.rawValue
// check is valid
Expand Down
4 changes: 4 additions & 0 deletions V2rayU/Uri.swift
Original file line number Diff line number Diff line change
Expand Up @@ -588,6 +588,10 @@ class VlessUri {
}
}

if vmess.sni.count == 0 {
vmess.sni = address
}

self.remark = (url.fragment ?? "vless").urlDecoded()
}
}
5 changes: 3 additions & 2 deletions V2rayU/v2ray/V2rayConfig.swift
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@ class V2rayConfig: NSObject {
var streamQuic = QuicSettings()
var routing = V2rayRouting()

// tls
var streamSecurity = "tls" // none|tls|xtls|reality
// tls 默认需为none,shadowsocks需为none
var streamSecurity = "none" // none|tls|xtls|reality
var securityTls = TlsSettings() // tls|xtls
var securityReality = RealitySettings() // reality

Expand Down Expand Up @@ -474,6 +474,7 @@ class V2rayConfig: NSObject {
self.error = "missing shadowsocks.method";
return
}
s.security = "none" // 需为none
break
case V2rayProtocolOutbound.socks.rawValue:
if self.serverSocks5.servers.count == 0 {
Expand Down

0 comments on commit e87fe6b

Please sign in to comment.