Skip to content

Commit

Permalink
新增reality,SHADOWSOCKS2022,utls
Browse files Browse the repository at this point in the history
  • Loading branch information
yanue committed Jul 7, 2023
1 parent f21be35 commit 80a1900
Show file tree
Hide file tree
Showing 9 changed files with 428 additions and 218 deletions.
4 changes: 2 additions & 2 deletions Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,6 @@ SPEC CHECKSUMS:
Swifter: 2327ef5d872c638aebab79646ce494af508b0c8f
SwiftyJSON: 36413e04c44ee145039d332b4f4e2d3e8d6c4db7

PODFILE CHECKSUM: 6196a63d3d6fcd5c461152d1c910391f609a3bba
PODFILE CHECKSUM: 3f6e12f5bdf95edf74d1950966165eb7069a2640

COCOAPODS: 1.12.1
COCOAPODS: 1.8.4
4 changes: 2 additions & 2 deletions V2rayU.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -773,7 +773,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_ENTITLEMENTS = V2rayULauncher/V2rayULauncher.entitlements;
CODE_SIGN_IDENTITY = "Mac Developer";
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
DEVELOPMENT_TEAM = RJYEH6TCJD;
Expand All @@ -796,7 +796,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_ENTITLEMENTS = V2rayULauncher/V2rayULauncher.entitlements;
CODE_SIGN_IDENTITY = "Mac Developer";
CODE_SIGN_IDENTITY = "Apple Development";
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
Expand Down
259 changes: 190 additions & 69 deletions V2rayU/Base.lproj/ConfigWindow.xib

Large diffs are not rendered by default.

66 changes: 50 additions & 16 deletions V2rayU/ConfigWindow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,11 @@ class ConfigWindowController: NSWindowController, NSWindowDelegate, NSTabViewDel
@IBOutlet weak var wsView: NSView!
@IBOutlet weak var h2View: NSView!
@IBOutlet weak var quicView: NSView!
@IBOutlet weak var tlsView: NSView!
@IBOutlet weak var realityView: NSView!

@IBOutlet weak var switchNetwork: NSPopUpButton!
@IBOutlet weak var switchSecurity: NSPopUpButton!

// kcp setting
@IBOutlet weak var kcpMtu: NSTextField!
Expand All @@ -116,9 +119,13 @@ class ConfigWindowController: NSWindowController, NSWindowDelegate, NSTabViewDel
@IBOutlet weak var quicHeaderType: NSPopUpButton!

@IBOutlet weak var streamSecurity: NSPopUpButton!
@IBOutlet weak var streamAllowSecure: NSButton!
@IBOutlet weak var streamTlsAllowInsecure: NSButton!
@IBOutlet weak var streamTlsServerName: NSTextField!

@IBOutlet weak var streamRealityServerName: NSTextField!
@IBOutlet weak var streamRealityPublicKey: NSTextField!
@IBOutlet weak var streamRealityShortId: NSTextField!
@IBOutlet weak var streamRealitySpiderX: NSTextField!

override func awakeFromNib() {
// set table drag style
serversTableView.registerForDraggedTypes([NSPasteboard.PasteboardType(rawValue: tableViewDragType)])
Expand Down Expand Up @@ -325,13 +332,19 @@ class ConfigWindowController: NSWindowController, NSWindowDelegate, NSTabViewDel
if self.switchNetwork.indexOfSelectedItem >= 0 {
v2rayConfig.streamNetwork = self.switchNetwork.titleOfSelectedItem!
}
v2rayConfig.streamTlsAllowInsecure = self.streamAllowSecure.state.rawValue > 0
v2rayConfig.streamXtlsAllowInsecure = self.streamAllowSecure.state.rawValue > 0
// security
if self.streamSecurity.indexOfSelectedItem >= 0 {
v2rayConfig.streamTlsSecurity = self.streamSecurity.titleOfSelectedItem!
}
v2rayConfig.streamTlsServerName = self.streamTlsServerName.stringValue
v2rayConfig.streamXtlsServerName = self.streamTlsServerName.stringValue
v2rayConfig.streamSecurity = self.streamSecurity.titleOfSelectedItem!
}
// tls
v2rayConfig.securityTls.allowInsecure = self.streamTlsAllowInsecure.state.rawValue > 0
v2rayConfig.securityTls.serverName = self.streamTlsServerName.stringValue
// reality
v2rayConfig.securityReality.serverName = self.streamRealityServerName.stringValue
v2rayConfig.securityReality.publicKey = self.streamRealityPublicKey.stringValue
v2rayConfig.securityReality.shortId = self.streamRealityShortId.stringValue
v2rayConfig.securityReality.spiderX = self.streamRealitySpiderX.stringValue

// tcp
if self.tcpHeaderType.indexOfSelectedItem >= 0 {
v2rayConfig.streamTcp.header.type = self.tcpHeaderType.titleOfSelectedItem!
Expand Down Expand Up @@ -445,14 +458,18 @@ class ConfigWindowController: NSWindowController, NSWindowDelegate, NSTabViewDel
self.switchNetwork.selectItem(withTitle: v2rayConfig.streamNetwork)
self.switchSteamView(network: v2rayConfig.streamNetwork)

self.streamAllowSecure.intValue = v2rayConfig.streamTlsAllowInsecure ? 1 : 0
self.streamSecurity.selectItem(withTitle: v2rayConfig.streamTlsSecurity)
self.streamTlsServerName.stringValue = v2rayConfig.streamTlsServerName
if v2rayConfig.streamTlsSecurity == "xtls" {
self.streamTlsServerName.stringValue = v2rayConfig.streamXtlsServerName
self.streamAllowSecure.intValue = v2rayConfig.streamXtlsAllowInsecure ? 1 : 0
}

self.switchSecurityView(securityTitle: v2rayConfig.streamSecurity)
self.streamSecurity.selectItem(withTitle: v2rayConfig.streamSecurity)
self.streamTlsAllowInsecure.intValue = v2rayConfig.securityTls.allowInsecure ? 1 : 0
self.streamTlsServerName.stringValue = v2rayConfig.securityTls.serverName

// reality
self.streamRealityServerName.stringValue = v2rayConfig.securityReality.serverName
self.streamRealityPublicKey.stringValue = v2rayConfig.securityReality.publicKey
self.streamRealityPublicKey.stringValue = v2rayConfig.securityReality.publicKey
self.streamRealityShortId.stringValue = v2rayConfig.securityReality.shortId
self.streamRealitySpiderX.stringValue = v2rayConfig.securityReality.spiderX

// tcp
self.tcpHeaderType.selectItem(withTitle: v2rayConfig.streamTcp.header.type)

Expand Down Expand Up @@ -706,7 +723,24 @@ class ConfigWindowController: NSWindowController, NSWindowDelegate, NSTabViewDel
break
}
}

func switchSecurityView(securityTitle: String) {
print("switchSecurityView",securityTitle)
self.tlsView.isHidden = true
self.realityView.isHidden = true
if securityTitle == "reality" {
self.realityView.isHidden = false
} else {
self.tlsView.isHidden = false
}
}

@IBAction func switchSteamSecurity(_ sender: NSPopUpButtonCell) {
if let item = switchSecurity.selectedItem {
self.switchSecurityView(securityTitle: item.title)
}
}

@IBAction func switchSteamNetwork(_ sender: NSPopUpButtonCell) {
if let item = switchNetwork.selectedItem {
self.switchSteamView(network: item.title)
Expand Down
18 changes: 9 additions & 9 deletions V2rayU/Import.swift
Original file line number Diff line number Diff line change
Expand Up @@ -182,13 +182,13 @@ class ImportUri {

// stream
v2ray.streamNetwork = vmess.network
v2ray.streamTlsAllowInsecure = vmess.allowInsecure
v2ray.streamTlsSecurity = vmess.tls
v2ray.streamTlsServerName = vmess.tlsServer
v2ray.streamSecurity = vmess.tls
v2ray.securityTls.allowInsecure = vmess.allowInsecure
v2ray.securityTls.serverName = vmess.tlsServer

// tls servername for h2 or ws
if vmess.tlsServer.count == 0 && (vmess.network == V2rayStreamSettings.network.h2.rawValue || vmess.network == V2rayStreamSettings.network.ws.rawValue) {
v2ray.streamTlsServerName = vmess.netHost
v2ray.securityTls.serverName = vmess.tlsServer
}

// kcp
Expand Down Expand Up @@ -255,10 +255,10 @@ class ImportUri {

// stream
v2ray.streamNetwork = vmess.type
v2ray.streamTlsSecurity = vmess.security
v2ray.streamXtlsServerName = vmess.host
v2ray.streamSecurity = vmess.security
v2ray.securityTls.serverName = vmess.host
if vmess.host.count == 0 {
v2ray.streamXtlsServerName = vmess.address
v2ray.securityTls.serverName = vmess.address
}

// kcp
Expand Down Expand Up @@ -319,8 +319,8 @@ class ImportUri {
v2ray.enableMux = false
// tcp
v2ray.streamNetwork = "tcp"
v2ray.streamTlsSecurity = trojan.security
v2ray.streamTlsAllowInsecure = true
v2ray.streamSecurity = trojan.security
v2ray.securityTls.allowInsecure = true

v2ray.serverProtocol = V2rayProtocolOutbound.trojan.rawValue
// check is valid
Expand Down
6 changes: 3 additions & 3 deletions V2rayU/Share.swift
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ class ShareUri {
self.share.path = self.v2ray.streamWs.path
}

self.share.tls = self.v2ray.streamTlsSecurity
self.share.tls = self.v2ray.streamSecurity
}

// Shadowsocks
Expand Down Expand Up @@ -158,8 +158,8 @@ class ShareUri {
}
ss.remark = self.remark

ss.security = self.v2ray.streamTlsSecurity
ss.host = self.v2ray.streamXtlsServerName
ss.security = self.v2ray.streamSecurity
ss.host = self.v2ray.securityTls.serverName

ss.type = self.v2ray.streamNetwork

Expand Down
Loading

0 comments on commit 80a1900

Please sign in to comment.