diff --git a/Build/V2rayUTool b/Build/V2rayUTool index 5be5a48..48db74c 100755 Binary files a/Build/V2rayUTool and b/Build/V2rayUTool differ diff --git a/V2rayU.xcodeproj/project.pbxproj b/V2rayU.xcodeproj/project.pbxproj index 8138170..7fb33f8 100644 --- a/V2rayU.xcodeproj/project.pbxproj +++ b/V2rayU.xcodeproj/project.pbxproj @@ -13,7 +13,6 @@ 6608D9DC2182C6D200A0E0DD /* v2rayInbound.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6608D9DB2182C6D200A0E0DD /* v2rayInbound.swift */; }; 6608D9DE2182C92D00A0E0DD /* v2rayOutbound.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6608D9DD2182C92D00A0E0DD /* v2rayOutbound.swift */; }; 6608D9E22182C9C100A0E0DD /* v2rayStream.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6608D9E12182C9C100A0E0DD /* v2rayStream.swift */; }; - 660C8CA22181CBAA00896361 /* V2rayUTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 660C8CA12181CBAA00896361 /* V2rayUTests.swift */; }; 660D0E5A216E0158000C2922 /* V2rayServer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 660D0E59216E0158000C2922 /* V2rayServer.swift */; }; 66107B8622DEDBE4002FFB60 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 66107B8822DEDBE4002FFB60 /* Localizable.strings */; }; 6610ECB721742AFD008FC401 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 664EB378216C9A5F00B6AE0D /* MainMenu.xib */; }; @@ -22,7 +21,6 @@ 66193A8623EE45B200289B6A /* PreferenceRouting.swift in Sources */ = {isa = PBXBuildFile; fileRef = 66193A8523EE45B200289B6A /* PreferenceRouting.swift */; }; 66193A8923EE46BC00289B6A /* PreferenceRouting.xib in Resources */ = {isa = PBXBuildFile; fileRef = 66193A8723EE46BC00289B6A /* PreferenceRouting.xib */; }; 663F040625ED4B2C00687600 /* V2rayLaunch.swift in Sources */ = {isa = PBXBuildFile; fileRef = 663F040525ED4B2C00687600 /* V2rayLaunch.swift */; }; - 66406AF42183320000B56041 /* Sample.swift in Sources */ = {isa = PBXBuildFile; fileRef = 66406AF32183320000B56041 /* Sample.swift */; }; 664EB375216C9A5E00B6AE0D /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 664EB374216C9A5E00B6AE0D /* AppDelegate.swift */; }; 664EB377216C9A5F00B6AE0D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 664EB376216C9A5F00B6AE0D /* Assets.xcassets */; }; 664EB392216CA9E800B6AE0D /* ConfigWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 664EB390216CA9E800B6AE0D /* ConfigWindow.swift */; }; @@ -32,6 +30,7 @@ 667029D321AFB86E0079EF41 /* QrcodeWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 667029D121AFB86E0079EF41 /* QrcodeWindow.xib */; }; 66784AFC2170486D00AD307F /* Util.swift in Sources */ = {isa = PBXBuildFile; fileRef = 66784AFB2170486D00AD307F /* Util.swift */; }; 66784B0021704E1300AD307F /* V2rayCore.swift in Sources */ = {isa = PBXBuildFile; fileRef = 66784AFF21704E1300AD307F /* V2rayCore.swift */; }; + 66847A5D2A531F7B00930C48 /* main.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6646669221CBC0860094F0B7 /* main.swift */; }; 669312932413FC5E00C043F8 /* SwiftyPing.swift in Sources */ = {isa = PBXBuildFile; fileRef = 669312922413FC5E00C043F8 /* SwiftyPing.swift */; }; 66973EB721797719001FEA1E /* ServiceManagement.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 66973EB621797719001FEA1E /* ServiceManagement.framework */; }; 66A77BE3268225790097A126 /* v2ray-core in Resources */ = {isa = PBXBuildFile; fileRef = 66A77BE2268225790097A126 /* v2ray-core */; }; @@ -64,16 +63,6 @@ F260898E336CFA5EAB07ADC9 /* Pods_V2rayU.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 66A5CE4521706B5A009B08B2 /* Pods_V2rayU.framework */; }; /* End PBXBuildFile section */ -/* Begin PBXContainerItemProxy section */ - 660C8CA42181CBAA00896361 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 664EB369216C9A5E00B6AE0D /* Project object */; - proxyType = 1; - remoteGlobalIDString = 664EB370216C9A5E00B6AE0D; - remoteInfo = V2rayU; - }; -/* End PBXContainerItemProxy section */ - /* Begin PBXCopyFilesBuildPhase section */ 66973ECA21797A6B001FEA1E /* Copy Files */ = { isa = PBXCopyFilesBuildPhase; @@ -130,9 +119,6 @@ 6608D9DB2182C6D200A0E0DD /* v2rayInbound.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = v2rayInbound.swift; sourceTree = ""; }; 6608D9DD2182C92D00A0E0DD /* v2rayOutbound.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = v2rayOutbound.swift; sourceTree = ""; }; 6608D9E12182C9C100A0E0DD /* v2rayStream.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = v2rayStream.swift; sourceTree = ""; }; - 660C8C9F2181CBAA00896361 /* V2rayUTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = V2rayUTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; - 660C8CA12181CBAA00896361 /* V2rayUTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = V2rayUTests.swift; sourceTree = ""; }; - 660C8CA32181CBAA00896361 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 660D0E59216E0158000C2922 /* V2rayServer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = V2rayServer.swift; sourceTree = ""; usesTabs = 0; wrapsLines = 0; }; 66107B8722DEDBE4002FFB60 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/Localizable.strings"; sourceTree = ""; }; 66107B8922DEE445002FFB60 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = ""; }; @@ -143,7 +129,6 @@ 66193A9323EF1EF600289B6A /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "../zh-Hans.lproj/PreferenceRouting.strings"; sourceTree = ""; }; 66193A9523EF1EFA00289B6A /* zh-HK */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-HK"; path = "../zh-HK.lproj/PreferenceRouting.strings"; sourceTree = ""; }; 663F040525ED4B2C00687600 /* V2rayLaunch.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = V2rayLaunch.swift; sourceTree = ""; }; - 66406AF32183320000B56041 /* Sample.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Sample.swift; sourceTree = ""; }; 6646669221CBC0860094F0B7 /* main.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = main.swift; sourceTree = ""; }; 664666A021CBD6C60094F0B7 /* libPods-V2rayUTool.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = "libPods-V2rayUTool.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 664B95DD217062A500DBC941 /* Alamofire */ = {isa = PBXFileReference; lastKnownFileType = folder; name = Alamofire; path = Pods/Alamofire; sourceTree = ""; }; @@ -184,7 +169,6 @@ 66AD5333241496FF0070529C /* V2rayU-Bridging-header.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "V2rayU-Bridging-header.h"; sourceTree = ""; }; 66BC2B88228C589E00FBB716 /* V2raySubscribe.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = V2raySubscribe.swift; sourceTree = ""; }; 66C5B194240B58B8008A22CA /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = ../en.lproj/PreferenceAdvance.strings; sourceTree = ""; }; - 66C5B197240C17F2008A22CA /* main.go */ = {isa = PBXFileReference; lastKnownFileType = text; path = main.go; sourceTree = ""; }; 66C5B19A240D3476008A22CA /* V2rayUHelper */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.executable"; path = V2rayUHelper; sourceTree = ""; }; 66F07CF8236D79540088A4AE /* ping.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ping.swift; sourceTree = ""; }; 66F3029922AA9C0900FCA4E2 /* V2rayUTool */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.executable"; path = V2rayUTool; sourceTree = ""; }; @@ -234,13 +218,6 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - 660C8C9C2181CBAA00896361 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; 664EB36E216C9A5E00B6AE0D /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; @@ -284,21 +261,10 @@ path = v2ray; sourceTree = ""; }; - 660C8CA02181CBAA00896361 /* V2rayUTests */ = { - isa = PBXGroup; - children = ( - 66406AF32183320000B56041 /* Sample.swift */, - 660C8CA12181CBAA00896361 /* V2rayUTests.swift */, - 660C8CA32181CBAA00896361 /* Info.plist */, - ); - path = V2rayUTests; - sourceTree = ""; - }; 6646669121CBC0860094F0B7 /* V2rayUTool */ = { isa = PBXGroup; children = ( 6646669221CBC0860094F0B7 /* main.swift */, - 66C5B197240C17F2008A22CA /* main.go */, ); path = V2rayUTool; sourceTree = ""; @@ -311,7 +277,6 @@ 6683B1EA21C2AD1A004A1C5F /* pac */, 66FEAD44217D75D7009DECF9 /* Build */, 664EB373216C9A5E00B6AE0D /* V2rayU */, - 660C8CA02181CBAA00896361 /* V2rayUTests */, 6604E43A21798F2A00E54AE1 /* V2rayULauncher */, 6646669121CBC0860094F0B7 /* V2rayUTool */, 664EB372216C9A5E00B6AE0D /* Products */, @@ -326,7 +291,6 @@ children = ( 664EB371216C9A5E00B6AE0D /* V2rayU.app */, 6604E43921798F2900E54AE1 /* V2rayULauncher.app */, - 660C8C9F2181CBAA00896361 /* V2rayUTests.xctest */, 66F302B722AAA95000FCA4E2 /* V2rayUTool */, ); name = Products; @@ -464,24 +428,6 @@ productReference = 6604E43921798F2900E54AE1 /* V2rayULauncher.app */; productType = "com.apple.product-type.application"; }; - 660C8C9E2181CBAA00896361 /* V2rayUTests */ = { - isa = PBXNativeTarget; - buildConfigurationList = 660C8CA82181CBAA00896361 /* Build configuration list for PBXNativeTarget "V2rayUTests" */; - buildPhases = ( - 660C8C9B2181CBAA00896361 /* Sources */, - 660C8C9C2181CBAA00896361 /* Frameworks */, - 660C8C9D2181CBAA00896361 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - 660C8CA52181CBAA00896361 /* PBXTargetDependency */, - ); - name = V2rayUTests; - productName = V2rayUTests; - productReference = 660C8C9F2181CBAA00896361 /* V2rayUTests.xctest */; - productType = "com.apple.product-type.bundle.unit-test"; - }; 664EB370216C9A5E00B6AE0D /* V2rayU */ = { isa = PBXNativeTarget; buildConfigurationList = 664EB37F216C9A5F00B6AE0D /* Build configuration list for PBXNativeTarget "V2rayU" */; @@ -536,10 +482,6 @@ CreatedOnToolsVersion = 10.0; LastSwiftMigration = ""; }; - 660C8C9E2181CBAA00896361 = { - CreatedOnToolsVersion = 10.0; - TestTargetID = 664EB370216C9A5E00B6AE0D; - }; 664EB370216C9A5E00B6AE0D = { CreatedOnToolsVersion = 10.0; LastSwiftMigration = ""; @@ -574,7 +516,6 @@ targets = ( 664EB370216C9A5E00B6AE0D /* V2rayU */, 6604E43821798F2900E54AE1 /* V2rayULauncher */, - 660C8C9E2181CBAA00896361 /* V2rayUTests */, 66F302B622AAA95000FCA4E2 /* V2rayUTool */, ); }; @@ -588,13 +529,6 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - 660C8C9D2181CBAA00896361 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; 664EB36F216C9A5E00B6AE0D /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; @@ -672,15 +606,6 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - 660C8C9B2181CBAA00896361 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 660C8CA22181CBAA00896361 /* V2rayUTests.swift in Sources */, - 66406AF42183320000B56041 /* Sample.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; 664EB36D216C9A5E00B6AE0D /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; @@ -720,19 +645,12 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 66847A5D2A531F7B00930C48 /* main.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ -/* Begin PBXTargetDependency section */ - 660C8CA52181CBAA00896361 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 664EB370216C9A5E00B6AE0D /* V2rayU */; - targetProxy = 660C8CA42181CBAA00896361 /* PBXContainerItemProxy */; - }; -/* End PBXTargetDependency section */ - /* Begin PBXVariantGroup section */ 66107B8822DEDBE4002FFB60 /* Localizable.strings */ = { isa = PBXVariantGroup; @@ -866,6 +784,7 @@ COMBINE_HIDPI_IMAGES = YES; DEVELOPMENT_TEAM = RJYEH6TCJD; INFOPLIST_FILE = V2rayULauncher/Info.plist; + INFOPLIST_KEY_CFBundleDisplayName = V2rayULauncher; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/../Frameworks", @@ -884,10 +803,12 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_ENTITLEMENTS = V2rayULauncher/V2rayULauncher.entitlements; CODE_SIGN_IDENTITY = "Mac Developer"; + "CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - DEVELOPMENT_TEAM = RJYEH6TCJD; + DEVELOPMENT_TEAM = UA5X5UL787; INFOPLIST_FILE = V2rayULauncher/Info.plist; + INFOPLIST_KEY_CFBundleDisplayName = V2rayULauncher; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/../Frameworks", @@ -900,50 +821,6 @@ }; name = Release; }; - 660C8CA62181CBAA00896361 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - BUNDLE_LOADER = "$(TEST_HOST)"; - CODE_SIGN_IDENTITY = "Mac Developer"; - CODE_SIGN_STYLE = Automatic; - COMBINE_HIDPI_IMAGES = YES; - DEVELOPMENT_TEAM = RJYEH6TCJD; - INFOPLIST_FILE = V2rayUTests/Info.plist; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/../Frameworks", - "@loader_path/../Frameworks", - ); - MACOSX_DEPLOYMENT_TARGET = 10.14; - PRODUCT_BUNDLE_IDENTIFIER = net.yanue.v2rayu.V2rayUTests; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 4.2; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/V2rayU.app/Contents/MacOS/V2rayU"; - }; - name = Debug; - }; - 660C8CA72181CBAA00896361 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - BUNDLE_LOADER = "$(TEST_HOST)"; - CODE_SIGN_IDENTITY = "Mac Developer"; - CODE_SIGN_STYLE = Automatic; - COMBINE_HIDPI_IMAGES = YES; - DEVELOPMENT_TEAM = RJYEH6TCJD; - INFOPLIST_FILE = V2rayUTests/Info.plist; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/../Frameworks", - "@loader_path/../Frameworks", - ); - MACOSX_DEPLOYMENT_TARGET = 10.14; - PRODUCT_BUNDLE_IDENTIFIER = net.yanue.v2rayu.V2rayUTests; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 4.2; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/V2rayU.app/Contents/MacOS/V2rayU"; - }; - name = Release; - }; 664EB37D216C9A5F00B6AE0D /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { @@ -1081,6 +958,7 @@ DEVELOPMENT_TEAM = RJYEH6TCJD; ENABLE_ONLY_ACTIVE_RESOURCES = YES; INFOPLIST_FILE = V2rayU/Info.plist; + INFOPLIST_KEY_CFBundleDisplayName = V2rayU; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/../Frameworks", @@ -1092,6 +970,9 @@ PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; SKIP_INSTALL = NO; + SUPPORTED_PLATFORMS = macosx; + SUPPORTS_MACCATALYST = NO; + SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO; SWIFT_OBJC_BRIDGING_HEADER = "Common/V2rayU-Bridging-header.h"; SWIFT_SWIFT3_OBJC_INFERENCE = Default; SWIFT_VERSION = 4.2; @@ -1104,14 +985,16 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_IDENTITY = "Apple Development"; + "CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; COPY_PHASE_STRIP = NO; CURRENT_PROJECT_VERSION = 3.4.0; DEFINES_MODULE = YES; - DEVELOPMENT_TEAM = RJYEH6TCJD; + DEVELOPMENT_TEAM = UA5X5UL787; ENABLE_ONLY_ACTIVE_RESOURCES = YES; INFOPLIST_FILE = V2rayU/Info.plist; + INFOPLIST_KEY_CFBundleDisplayName = V2rayU; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/../Frameworks", @@ -1123,6 +1006,9 @@ PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; SKIP_INSTALL = NO; + SUPPORTED_PLATFORMS = macosx; + SUPPORTS_MACCATALYST = NO; + SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO; SWIFT_OBJC_BRIDGING_HEADER = "Common/V2rayU-Bridging-header.h"; SWIFT_SWIFT3_OBJC_INFERENCE = Default; SWIFT_VERSION = 4.2; @@ -1135,7 +1021,9 @@ CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; DEVELOPMENT_TEAM = RJYEH6TCJD; + INFOPLIST_FILE = ""; MACOSX_DEPLOYMENT_TARGET = 10.14; + PRODUCT_BUNDLE_IDENTIFIER = net.yanue.V2rayUTool; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; SWIFT_VERSION = 5.0; @@ -1146,9 +1034,12 @@ isa = XCBuildConfiguration; buildSettings = { CODE_SIGN_IDENTITY = "Apple Development"; + "CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development"; CODE_SIGN_STYLE = Automatic; - DEVELOPMENT_TEAM = RJYEH6TCJD; + DEVELOPMENT_TEAM = UA5X5UL787; + INFOPLIST_FILE = ""; MACOSX_DEPLOYMENT_TARGET = 10.14; + PRODUCT_BUNDLE_IDENTIFIER = net.yanue.V2rayUTool; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; SWIFT_VERSION = 5.0; @@ -1167,15 +1058,6 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - 660C8CA82181CBAA00896361 /* Build configuration list for PBXNativeTarget "V2rayUTests" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 660C8CA62181CBAA00896361 /* Debug */, - 660C8CA72181CBAA00896361 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; 664EB36C216C9A5E00B6AE0D /* Build configuration list for PBXProject "V2rayU" */ = { isa = XCConfigurationList; buildConfigurations = ( diff --git a/V2rayU/V2rayLaunch.swift b/V2rayU/V2rayLaunch.swift index 77bbaff..8b342d1 100644 --- a/V2rayU/V2rayLaunch.swift +++ b/V2rayU/V2rayLaunch.swift @@ -186,60 +186,5 @@ class V2rayLaunch: NSObject { static func checkPorts() -> Bool { return true - // stop old v2ray process - self.Stop() - // stop pac server - webServer.stop() - - let localSockPort = UserDefaults.get(forKey: .localSockPort) ?? "1080" - let localSockHost = UserDefaults.get(forKey: .localSockHost) ?? "127.0.0.1" - let localHttpPort = UserDefaults.get(forKey: .localHttpPort) ?? "1087" - let localHttpHost = UserDefaults.get(forKey: .localHttpHost) ?? "127.0.0.1" - let localPacPort = UserDefaults.get(forKey: .localPacPort) ?? "11085" - - // check same port - if localSockPort == localHttpPort { - makeToast(message: "the ports (sock,http) cannot be the same: " + localHttpPort) - return false - } - - if localHttpPort == localPacPort { - makeToast(message: "the ports (http,pac) cannot be the same:" + localPacPort) - return false - } - - if localSockPort == localPacPort { - makeToast(message: "the ports (sock,pac) cannot be the same:" + localPacPort) - return false - } - - // check port is used - if !self.checkPort(host: localSockHost, port: localSockPort, tip: "socks") { - return false - } - - if !self.checkPort(host: localHttpHost, port: localHttpPort, tip: "http") { - return false - } - - if !self.checkPort(host: "0.0.0.0", port: localPacPort, tip: "pac") { - return false - } - - return true - } - - static func checkPort(host: String, port: String, tip: String) -> Bool { - // shell("/bin/bash",["-c","cd ~ && ls -la"]) - let cmd = "cd " + AppHomePath + " && chmod +x ./V2rayUHelper && ./V2rayUHelper -cmd port -h " + host + " -p " + port - let res = shell(launchPath: "/bin/bash", arguments: ["-c", cmd]) - - NSLog("checkPort: res=(\(String(describing: res))) cmd=(\(cmd))") - - if res != "ok" { - makeToast(message: tip + " error - " + (res ?? ""), displayDuration: 5) - return false - } - return true } } diff --git a/V2rayU/cmd.sh b/V2rayU/cmd.sh index 9db54e4..1eb8060 100755 --- a/V2rayU/cmd.sh +++ b/V2rayU/cmd.sh @@ -14,10 +14,4 @@ sudo chown root:admin ${cmd} sudo chmod a+rx ${cmd} sudo chmod +s ${cmd} -cmd="./V2rayUHelper" - -sudo chown root:admin ${cmd} -sudo chmod a+rx ${cmd} -sudo chmod +s ${cmd} - echo 'done' diff --git a/V2rayU/install.sh b/V2rayU/install.sh index 2625dda..faaa7d8 100755 --- a/V2rayU/install.sh +++ b/V2rayU/install.sh @@ -11,7 +11,6 @@ rm -fr ~/.V2rayU/v2ray-core rm -fr ~/.V2rayU/pac # copy -\cp -rv ./V2rayUHelper ~/.V2rayU/ \cp -rf ./V2rayUTool ~/.V2rayU/ \cp -rv ./cmd.sh ~/.V2rayU/ \cp -rf ./pac ~/.V2rayU/ @@ -34,10 +33,5 @@ sudo chown root:admin ${cmd} sudo chmod a+rx ${cmd} sudo chmod +s ${cmd} -cmd="./V2rayUHelper" -sudo chown root:admin ${cmd} -sudo chmod a+rx ${cmd} -sudo chmod +s ${cmd} - echo 'done' diff --git a/V2rayU/ping.swift b/V2rayU/ping.swift index fea85bc..ca45971 100644 --- a/V2rayU/ping.swift +++ b/V2rayU/ping.swift @@ -116,20 +116,6 @@ class PingSpeed: NSObject { } } - func pingInCmd() { - let cmd = "cd " + AppHomePath + " && chmod +x ./V2rayUHelper && ./V2rayUHelper -cmd ping -t 5s -f ./" + pingJsonFileName - // print("cmd", cmd) - let res = runShell(launchPath: "/bin/bash", arguments: ["-c", cmd]) - - NSLog("pingInCmd: res=(\(String(describing: res))) cmd=(\(cmd))") - - // 这里直接判断ok有问题,res里面还有lookup - if res?.contains("ok config.") ?? false { - // res is: ok config.xxxx - fastV2rayName = res!.replacingOccurrences(of: "ok ", with: "") - } - } - func parsePingResult() { let jsonText = try? String(contentsOfFile: pingJsonFilePath, encoding: String.Encoding.utf8) guard let json = try? JSON(data: (jsonText ?? "").data(using: String.Encoding.utf8, allowLossyConversion: false)!) else { diff --git a/V2rayUTests/Info.plist b/V2rayUTests/Info.plist deleted file mode 100644 index 6c40a6c..0000000 --- a/V2rayUTests/Info.plist +++ /dev/null @@ -1,22 +0,0 @@ - - - - - CFBundleDevelopmentRegion - $(DEVELOPMENT_LANGUAGE) - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - BNDL - CFBundleShortVersionString - 1.0 - CFBundleVersion - 1 - - diff --git a/V2rayUTests/Sample.swift b/V2rayUTests/Sample.swift deleted file mode 100644 index 8be69cb..0000000 --- a/V2rayUTests/Sample.swift +++ /dev/null @@ -1,164 +0,0 @@ -// -// Sample.swift -// V2rayUTests -// -// Created by yanue on 2018/10/26. -// Copyright © 2018 yanue. All rights reserved. -// - -import Foundation - -let jsonTxt = """ -{ - "inbound": { - "port": "1080", - "listen": "localhost", - "protocol": "http", - "tab": "aaaa", - "settings": { - "timeout": 0, - "accounts": [ - { - "user": "my-username", - "pass": "my-password" - } - ], - "allowTransparent": false, - "userLevel": 0 - } - }, - "inboundDetour": [ - { - "port": 1080, - "listen": "127.0.0.1", - "protocol": "socks", - "settings": { - "auth": "noauth", - "timeout": 360, - "udp": true - } - } - ], - "outbound": { - "tag": "agentout", - "protocol": "vmess", - "streamSettings": { - "network": "h2", - "httpSettings": { - "host": [ - "host" - ], - "path": "/ssl" - }, - "tlsSettings": {}, - "security": "tls" - }, - "settings": { - "vnext": [ - { - "users": [ - { - "alterId": 64, - "id": "uuid" - } - ], - "port": 443, - "address": "host" - } - ] - } - }, - "outboundDetour": [ - { - "tag": "direct", - "protocol": "freedom", - "settings": { - "response": null - } - }, - { - "tag": "blockout", - "protocol": "blackhole", - "settings": { - "response": { - "type": "http" - } - } - } - ], - "routing": { - "settings": { - "domainStrategy": "IPIfNonMatch", - "rules": [ - { - "type": "field", - "outboundTag": "direct", - "ip": [ - "geoip:private" - ] - }, - { - "type": "field", - "outboundTag": "direct", - "domain": [ - "geosite:cn" - ] - }, - { - "type": "field", - "outboundTag": "direct", - "ip": [ - "geoip:cn" - ] - } - ] - } - } -} -""" - -struct PersonProfile1: Codable { - var desc: String = "aaa" -} - -struct PersonProfile2: Codable { - var intro: String = "aaa" -} - -struct Person: Codable { - var name: String = "bbb" - - var profile1: PersonProfile1? - var profile2: PersonProfile2? - - enum CodingKeys: String, CodingKey { - case name = "title" - case setting - } -} - -extension Person { - init(from decoder: Decoder) throws { - - let vals = try decoder.container(keyedBy: CodingKeys.self) - name = try vals.decode(String.self, forKey: CodingKeys.name) - if name == "aa" { - try vals.decode(PersonProfile1.self, forKey: .setting) - } else { - try vals.decode(PersonProfile2.self, forKey: .setting) - } - } - - func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encode(name, forKey: .name) - // var profile = container.nestedContainer(keyedBy: CodingKeys.self, forKey: .setting) - // try profile.encode(self.profile, forKey: .setting) - if name == "aa" { - try container.encode(self.profile1, forKey: .setting) - } else { - try container.encode(self.profile2, forKey: .setting) - } - - } -} diff --git a/V2rayUTests/V2rayUTests.swift b/V2rayUTests/V2rayUTests.swift deleted file mode 100644 index 2a4f1a5..0000000 --- a/V2rayUTests/V2rayUTests.swift +++ /dev/null @@ -1,124 +0,0 @@ -// -// V2rayUTests.swift -// V2rayUTests -// -// Created by yanue on 2018/10/25. -// Copyright © 2018 yanue. All rights reserved. -// - -import XCTest -@testable import V2rayU -import SwiftyJSON - - -class V2rayUTests: XCTestCase { -// override func setUp() { -// // Put setup code here. This method is called before the invocation of each test method in the class. -// } -// -// override func tearDown() { -// // Put teardown code here. This method is called after the invocation of each test method in the class. -// } - - func testImportVmess() { - let url = "vmess://eyJhZGQiOiJhLnYycmF5LndvcmxkIiwiYWRkZGF0ZSI6bnVsbCwiYWlkIjoiNjQiLCJjb3VudHJ5IjpudWxsLCJkYXRhIjpudWxsLCJlcnJvcmNvdW50IjpudWxsLCJob3N0IjoiIiwiaWQiOiJjNzYwYTkzYi1iNjUyLTQ0YTAtOTdkOC0yNGI3YTg4OWM5MmMiLCJtX3N0YXRpb25fY25fbXMiOm51bGwsIm1fc3RhdGlvbl9jbl9zdGF0dXMiOm51bGwsIm1zIjpudWxsLCJuZXQiOiJoMiIsInBhdGgiOiIvZmdxIiwicG9ydCI6NDQzLCJwcyI6IlNTUlNIQVJFLkNPTSIsInN0YXR1cyI6bnVsbCwidGxzIjoidGxzIiwidHlwZSI6Im5vbmUiLCJ2IjoiMiJ9" - let importUri = ImportUri() - importUri.importVmessUri(uri: url) - print("vmess1", importUri.error, importUri.json) - } - - - func testInbound() { - var inbound = V2rayInbound() - inbound.protocol = V2rayProtocolInbound.vmess - inbound.settingHttp = V2rayInboundHttp() - inbound.settingSocks = V2rayInboundSocks() - inbound.settingShadowsocks = V2rayInboundShadowsocks() - inbound.settingVMess = V2rayInboundVMess() -// inbound.streamSettings = V2rayStreamSettings() - - let encoder = JSONEncoder() - encoder.outputFormatting = .prettyPrinted //输出格式好看点 - let data = try! encoder.encode(inbound) - print(String(data: data, encoding: .utf8)!) - - } - - func testOutbound() { - var outbound = V2rayOutbound() - outbound.protocol = V2rayProtocolOutbound.vmess - outbound.settingSocks = V2rayOutboundSocks() - outbound.settingShadowsocks = V2rayOutboundShadowsocks() - let v2next = V2rayOutboundVMessItem( - address: "", - port: 0, - users: [V2rayOutboundVMessUser(id: "aaa", alterId: 0, level: 0, security: "")] - ) - outbound.settingVMess = V2rayOutboundVMess(vnext: [v2next]) - - let encoder = JSONEncoder() - encoder.outputFormatting = .prettyPrinted //输出格式好看点 - let data = try! encoder.encode(outbound) - print(String(data: data, encoding: .utf8)!) - - } - - func testV2ray() { - let v2rayCfg = V2rayConfig() - v2rayCfg.parseJson(jsonText: jsonTxt) - if v2rayCfg.errors.count > 0 { - print("err:", v2rayCfg.errors) - return - } - - v2rayCfg.isNewVersion = false; - v2rayCfg.httpPort = "8080" - v2rayCfg.socksPort = "1990" - - print("js", v2rayCfg.combineManual()) - } - - func testExample() { - // This is an example of a functional test case. - // Use XCTAssert and related functions to verify your tests produce the correct results. - - var ming = Person() - ming.name = "aa" - ming.profile1 = PersonProfile1() - - let encoder = JSONEncoder() - encoder.outputFormatting = .prettyPrinted //输出格式好看点 - let data = try! encoder.encode(ming) - print(String(data: data, encoding: .utf8)!) - -// print(V2ray.toJSONString(prettyPrint:true) ?? "") // 序列化为格式化后的JSON字符串 - } - - func testBase64() { - let str = """ -vmess://eyJ2IjogIjIiLCAicHMiOiAiIiwgImFkZCI6ICIxMDguMTYwLjEzMS4xMiIsICJwb3J0IjogMjE2OTYsICJhaWQiOiAxNiwgInR5cGUiOiAidXRwIiwgIm5ldCI6ICJrY3AiLCAicGF0aCI6ICIiLCAiaG9zdCI6ICIiLCAiaWQiOiAiNTMxNjVlMWUtNDBjMS0xMWU5LTlmMzEtNTYwMDAxZTA2YzY5IiwgInRscyI6ICJub25lIn0= -vmess://eyJhZGQiOiJmci5zYW5neXUudHciLCJhaWQiOiIyMzMiLCJncm91cCI6Ind3dy5zc3JzaGFyZS5jb20iLCJob3N0IjoiZnIuc2FuZ3l1LnR3IiwiaWQiOiJjZTE0ZDc4OC0wZjc5LTQ5MWUtODVjYS0wNTI0MDYxMmYyOGEiLCJtcyI6MjM2LCJuZXQiOiJ3cyIsInBhdGgiOiIvIiwicG9ydCI6NDQzLCJwcyI6IkBTU1JPT0xfZnIuc2FuZ3l1LnR3Iiwic3RhdHVzIjoidHJ1ZSIsInRscyI6InRscyIsInR5cGUiOiJub25lIiwidiI6IjIiLCJ2MnJheWlkIjoiNTQ2MTAwMjQtMmE4Ny00NGIxLWJjYjgtMmRkODhkMjVjMWZiIn0= -""" - print(str.base64Encoded()) - let st1 = "c3NyOi8vTlM0eE1ERXVORGt1TVRrNk1UWTJNRFU2YjNKcFoybHVPbUZsY3kweU5UWXRZMlppT25Cc1lXbHVPbUpWWkZsTlZscHNZV3BHVUZKck9ESXZQM0psYldGeWEzTTlWVEZPVTFaRk9WQlVSamwxWkZkNGMweFVSVEpPYWtFeFQycEJkeVpuY205MWNEMVdNV1JZVEd4T1ZGVnNVbEJVTUhkMVVUQTVUZwpzc3I6Ly9OUzR4TURFdU5Ea3VNVGs2TVRZMk1EUTZiM0pwWjJsdU9tRmxjeTB5TlRZdFkyWmlPbkJzWVdsdU9tSlZaRmxOVmxwc1lXcEdVRkpyT0RJdlAzSmxiV0Z5YTNNOVZURk9VMVpGT1ZCVVJqbDFaRmQ0YzB4VVJUSk9ha0V3VDJwQmVDWm5jbTkxY0QxV01XUllUR3hPVkZWc1VsQlVNSGQxVVRBNVRn".base64Decoded() - print(st1) - } - - func testUrl(){ - let url = "http://奥/奥神队" - let charSet = NSMutableCharacterSet() - charSet.formUnion(with: CharacterSet.urlQueryAllowed) - charSet.addCharacters(in: "#") - let url1 = url.addingPercentEncoding(withAllowedCharacters: charSet as CharacterSet)! - print("url1",url1); - guard let rUrl = URL(string: url1) else { - print("not url") - return - } - if rUrl.scheme == nil || rUrl.host == nil { - print("not url 1") - } - print("url",rUrl.scheme,rUrl.host,rUrl.baseURL,rUrl.path) - - } -} diff --git a/V2rayUTool/main.go b/V2rayUTool/main.go deleted file mode 100644 index d9035e9..0000000 --- a/V2rayUTool/main.go +++ /dev/null @@ -1,166 +0,0 @@ -/** - * Created by GoLand. - * User: yanue - * Date: 2019/2/28 - * Time: 17:34 - */ - -package main - -import ( - "encoding/json" - "flag" - "fmt" - "github.com/sparrc/go-ping" - "io/ioutil" - "net" - "os" - "sync" - "time" -) - -var host = "" -var port = "" -var file = "" -var help bool -var cmd string -var wait time.Duration - -func init() { - flag.BoolVar(&help, "help", false, "-help this help") - flag.StringVar(&cmd, "cmd", "", "-cmd: ping or port") - - // for check port - flag.StringVar(&host, "h", "", "-h host") - flag.StringVar(&port, "p", "", "-p port") - - // for ping - flag.StringVar(&file, "f", "", "-f file") - flag.DurationVar(&wait, "t", 2*time.Second, "-t timeout for ping") - - flag.Usage = func() { - fmt.Println(usage) - flag.PrintDefaults() - } - flag.Parse() - - if help { - flag.Usage() - } -} - -const usage = "V2rayUHelper - check port is free or ping multi host \nUsage: \n V2rayUPort -cmd port -h host -p port\n V2rayUPort -cmd ping -f file \n Options:" - -func main() { - if len(os.Args) < 2 { - flag.Usage() - return - } - - switch cmd { - case "port": - checkPort() - case "ping": - pingByFile() - default: - flag.Usage() - } - - os.Exit(0) -} - -func checkPort() { - _, err := net.Listen("tcp", host+":"+port) - if err != nil { - fmt.Println(err.Error()) - return - } - - fmt.Println("ok") - return -} - -type Server struct { - Name string `json:"name"` - Host string `json:"host"` - Ping string `json:"ping"` -} - -var list []Server -var fastIdx int = -1 -var fastSpeed time.Duration = 2 * time.Second - -func pingByFile() { - if len(file) == 0 { - flag.Usage() - return - } - - txt, err := ioutil.ReadFile(file) - if err != nil { - fmt.Println("'error read:", err.Error()) - return - } - - list = make([]Server, 0) - - err = json.Unmarshal(txt, &list) - if err != nil { - fmt.Println("error Unmarshal:", err.Error()) - return - } - - fastSpeed = wait - wg := &sync.WaitGroup{} - for idx, item := range list { - wg.Add(1) - go pingHost(idx, item.Host, wg) - } - wg.Wait() - - txt, err = json.Marshal(list) - if err != nil { - fmt.Println("error Marshal:", err.Error()) - return - } - err = ioutil.WriteFile(file, txt, 0777) - if err != nil { - fmt.Println("error save:", err.Error()) - return - } - if fastIdx > -1 { - item := list[fastIdx] - fmt.Println("ok", item.Name) - return - } - fmt.Println("error no found servers") -} - -func pingHost(idx int, host string, wg *sync.WaitGroup) { - defer wg.Done() - - pinger, err := ping.NewPinger(host) - if err != nil { - fmt.Printf("ERROR: %s\n", err.Error()) - return - } - - pinger.OnRecv = func(pkt *ping.Packet) { - //fmt.Printf("%d bytes from %s: icmp_seq=%d time=%v ttl=%v\n", pkt.Nbytes, pkt.IPAddr, pkt.Seq, pkt.Rtt, pkt.Ttl) - if pkt.Rtt < fastSpeed { - fastSpeed = pkt.Rtt - fastIdx = idx - } - list[idx].Ping = fmt.Sprintf("%v", pkt.Rtt) - } - - pinger.OnFinish = func(stats *ping.Statistics) { - } - - pinger.Count = 1 - pinger.Interval = 1 - pinger.Timeout = wait - pinger.SetPrivileged(false) - - pinger.Run() -}