diff --git a/.github/workflows/version-check.yml b/.github/workflows/version-check.yml index 19801018..2bac5294 100644 --- a/.github/workflows/version-check.yml +++ b/.github/workflows/version-check.yml @@ -19,4 +19,3 @@ jobs: grep -qF "## ${RELEASE_VERSION}" CHANGELOG.md grep -qF "\"${RELEASE_VERSION}\"" README.md grep -qF "static NSString *const kQiniuVersion = @\"${RELEASE_VERSION}\";" QiniuSDK/Utils/QNVersion.h - grep -qF "${RELEASE_VERSION}" QiniuSDK/info.plist diff --git a/QiniuDemo/Podfile b/QiniuDemo/Podfile index 8012c859..1532ff0d 100755 --- a/QiniuDemo/Podfile +++ b/QiniuDemo/Podfile @@ -6,6 +6,7 @@ target "QiniuDemo" do # pod 'Qiniu', '~> 7.4.0' # pod 'Qiniu', '7.1.7' pod 'Qiniu',:path => '../' + pod 'HappyDNS',:path => '../../happy-dns-objc' end target "QiniuDemoTests" do diff --git a/QiniuDemo/QiniuDemo.xcodeproj/project.pbxproj b/QiniuDemo/QiniuDemo.xcodeproj/project.pbxproj index 6abd3b26..0995e5c6 100644 --- a/QiniuDemo/QiniuDemo.xcodeproj/project.pbxproj +++ b/QiniuDemo/QiniuDemo.xcodeproj/project.pbxproj @@ -8,7 +8,6 @@ /* Begin PBXBuildFile section */ 26F62ADDD5B6306E978C9A3F /* libPods-QiniuDemoTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 14CB2139715DD7B6FD5B146E /* libPods-QiniuDemoTests.a */; }; - 4545D3142BAD7D0C00932C3F /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = 4545D3132BAD7D0C00932C3F /* PrivacyInfo.xcprivacy */; }; 4561F02C28D9A6F80098A697 /* UploadResource_14M.zip in Resources */ = {isa = PBXBuildFile; fileRef = 4561F02B28D9A6F80098A697 /* UploadResource_14M.zip */; }; 45E6080929ADD57100634200 /* UploadResource_1G.zip in Resources */ = {isa = PBXBuildFile; fileRef = 45E6080829ADD57100634200 /* UploadResource_1G.zip */; }; 93D230241C86D7F700434F6D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 93D230231C86D7F700434F6D /* main.m */; }; @@ -43,7 +42,6 @@ 14CB2139715DD7B6FD5B146E /* libPods-QiniuDemoTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-QiniuDemoTests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 24EE530BBB100BED89B08A3D /* Pods-QiniuDemo.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-QiniuDemo.release.xcconfig"; path = "Pods/Target Support Files/Pods-QiniuDemo/Pods-QiniuDemo.release.xcconfig"; sourceTree = ""; }; 3189882026469145003CCA68 /* QiniuDemo.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = QiniuDemo.entitlements; sourceTree = ""; }; - 4545D3132BAD7D0C00932C3F /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = PrivacyInfo.xcprivacy; sourceTree = ""; }; 4561F02B28D9A6F80098A697 /* UploadResource_14M.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; path = UploadResource_14M.zip; sourceTree = ""; }; 4561F02F28D9AB090098A697 /* Configure.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Configure.h; sourceTree = ""; }; 45E6080829ADD57100634200 /* UploadResource_1G.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; path = UploadResource_1G.zip; sourceTree = ""; }; @@ -171,7 +169,6 @@ 93D230301C86D7F700434F6D /* LaunchScreen.storyboard */, 93D230331C86D7F700434F6D /* Info.plist */, 93D230221C86D7F700434F6D /* Supporting Files */, - 4545D3132BAD7D0C00932C3F /* PrivacyInfo.xcprivacy */, ); path = QiniuDemo; sourceTree = ""; @@ -272,7 +269,7 @@ TargetAttributes = { 93D2301E1C86D7F700434F6D = { CreatedOnToolsVersion = 7.2; - DevelopmentTeam = X2US9XXC6H; + DevelopmentTeam = W2TP34G2MM; }; 93D230371C86D7F700434F6D = { CreatedOnToolsVersion = 7.2; @@ -309,7 +306,6 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - 4545D3142BAD7D0C00932C3F /* PrivacyInfo.xcprivacy in Resources */, 93D230321C86D7F700434F6D /* LaunchScreen.storyboard in Resources */, 45E6080929ADD57100634200 /* UploadResource_1G.zip in Resources */, 4561F02C28D9A6F80098A697 /* UploadResource_14M.zip in Resources */, @@ -342,10 +338,12 @@ ); inputPaths = ( "${PODS_ROOT}/Target Support Files/Pods-QiniuDemo/Pods-QiniuDemo-resources.sh", + "${PODS_CONFIGURATION_BUILD_DIR}/HappyDNS/HappyDNS.privacy.bundle", "${PODS_CONFIGURATION_BUILD_DIR}/Qiniu/Qiniu.privacy.bundle", ); name = "[CP] Copy Pods Resources"; outputPaths = ( + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/HappyDNS.privacy.bundle", "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/Qiniu.privacy.bundle", ); runOnlyForDeploymentPostprocessing = 0; @@ -566,7 +564,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_ENTITLEMENTS = QiniuDemo/QiniuDemo.entitlements; "CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development"; - DEVELOPMENT_TEAM = X2US9XXC6H; + DEVELOPMENT_TEAM = W2TP34G2MM; INFOPLIST_FILE = QiniuDemo/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 12.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; @@ -587,7 +585,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_ENTITLEMENTS = QiniuDemo/QiniuDemo.entitlements; "CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development"; - DEVELOPMENT_TEAM = X2US9XXC6H; + DEVELOPMENT_TEAM = W2TP34G2MM; INFOPLIST_FILE = QiniuDemo/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 12.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; diff --git a/QiniuDemo/QiniuDemo/ViewController.m b/QiniuDemo/QiniuDemo/ViewController.m index 7530d18e..a9d8ae3a 100755 --- a/QiniuDemo/QiniuDemo/ViewController.m +++ b/QiniuDemo/QiniuDemo/ViewController.m @@ -73,7 +73,7 @@ - (IBAction)uploadAction:(UIButton *)sender { path = [[NSBundle mainBundle] pathForResource:@"UploadResource_14M.zip" ofType:nil]; // path = [[NSBundle mainBundle] pathForResource:@"UploadResource_9M.zip" ofType:nil]; // path = [[NSBundle mainBundle] pathForResource:@"UploadResource_49M.zip" ofType:nil]; - path = [[NSBundle mainBundle] pathForResource:@"UploadResource_1G.zip" ofType:nil]; +// path = [[NSBundle mainBundle] pathForResource:@"UploadResource_1G.zip" ofType:nil]; // NSFileManager *manager = [NSFileManager defaultManager]; // NSURL *desktopUrl = [manager URLsForDirectory:NSDesktopDirectory inDomains:NSUserDomainMask].firstObject; @@ -139,6 +139,7 @@ - (void)uploadImageToQNFilePath:(NSString *)filePath complete:(dispatch_block_t) NSString *key = [NSString stringWithFormat:@"iOS_Demo_%@", [NSDate date]]; key = @"iOS-Test"; self.token = YourToken; + self.token = @"5cJEzNSnh3PjOHZR_E0u1HCkXw4Bw1ZSuWQI9ufz:-ul1AJ8Fvpc7WhtpVT91Pvdfreo=:eyJzY29wZSI6InpvbmUwLXNwYWNlIiwiZGVhZGxpbmUiOjM0MzM3NDYyNTl9"; QNConfiguration *configuration = [QNConfiguration build:^(QNConfigurationBuilder *builder) { @@ -147,11 +148,16 @@ - (void)uploadImageToQNFilePath:(NSString *)filePath complete:(dispatch_block_t) // builder.useHttps = NO; builder.useConcurrentResumeUpload = false; - builder.concurrentTaskCount = 10; + builder.concurrentTaskCount = 2; builder.resumeUploadVersion = QNResumeUploadVersionV2; builder.putThreshold = 4*1024*1024; - builder.chunkSize = 1*1024*1024; -// builder.zone = [[QNFixedZone alloc] initWithUpDomainList:@[kUploadFixHost00, kUploadFixHost01]]; + builder.chunkSize = 5*1024*1024; + builder.accelerateUploading = true; +// builder.zone = [[QNFixedZone alloc] initWithAccUpDomainList:@[@"zone0-space.kodo-accelerate.cn-east-1.qiniucs.com"] +// upList:@[kUploadFixHost00] +// oldUpList:@[] +// regionId:@"custom"]; + // [[QNFixedZone alloc] initWithUpDomainList:@[kUploadFixHost00, kUploadFixHost01]]; NSString *recorderPath = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents"]; NSLog(@"== record path:%@", recorderPath); builder.recorder = [QNFileRecorder fileRecorderWithFolder:recorderPath error:nil]; diff --git a/QiniuSDK.xcodeproj/project.pbxproj b/QiniuSDK.xcodeproj/project.pbxproj index 37b2a15c..488dd254 100644 --- a/QiniuSDK.xcodeproj/project.pbxproj +++ b/QiniuSDK.xcodeproj/project.pbxproj @@ -360,6 +360,8 @@ 4551E56724D0065100447285 /* NSData+QNMD5.h in Headers */ = {isa = PBXBuildFile; fileRef = 4551E56524D0065100447285 /* NSData+QNMD5.h */; }; 4551E56824D0065100447285 /* NSData+QNMD5.m in Sources */ = {isa = PBXBuildFile; fileRef = 4551E56624D0065100447285 /* NSData+QNMD5.m */; }; 4551E56924D0065100447285 /* NSData+QNMD5.m in Sources */ = {isa = PBXBuildFile; fileRef = 4551E56624D0065100447285 /* NSData+QNMD5.m */; }; + 45BDB3C32C045E8F00F184D7 /* QiniuSDK_Mac.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = DF2CDDFF19DAC05500CE01FB /* QiniuSDK_Mac.dylib */; }; + 45BDB3C42C045E8F00F184D7 /* QiniuSDK_Mac.dylib in Embed Libraries */ = {isa = PBXBuildFile; fileRef = DF2CDDFF19DAC05500CE01FB /* QiniuSDK_Mac.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; 45CBC6C32AA9B05A00962B47 /* QNFixZoneTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 45CBC6C22AA9B05A00962B47 /* QNFixZoneTest.m */; }; 45CBC6C42AA9B05A00962B47 /* QNFixZoneTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 45CBC6C22AA9B05A00962B47 /* QNFixZoneTest.m */; }; 45CBC6D22ABA9FFF00962B47 /* QNCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 45CBC6D02ABA9FFF00962B47 /* QNCache.h */; }; @@ -370,6 +372,8 @@ 45CBC6D82ABAE24900962B47 /* QNCacheTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 45CBC6D62ABAE24900962B47 /* QNCacheTest.m */; }; 45E0B28A2A1F0596009B1BC7 /* QNConfigurationTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 45E0B2892A1F0596009B1BC7 /* QNConfigurationTest.m */; }; 45E0B28B2A1F0596009B1BC7 /* QNConfigurationTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 45E0B2892A1F0596009B1BC7 /* QNConfigurationTest.m */; }; + 5E721E890A824FA68D6EE8BA /* libPods-QiniuSDK_iOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 43AF08370B1B79540BB41B4B /* libPods-QiniuSDK_iOS.a */; }; + 90C40F412BC772AAE58363D3 /* libPods-QiniuSDK_MacTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D15EA855D2DBDE6728E87462 /* libPods-QiniuSDK_MacTests.a */; }; CC25135C244C7EB3003F4C65 /* QNBaseUpload.h in Headers */ = {isa = PBXBuildFile; fileRef = CC25135A244C7EB3003F4C65 /* QNBaseUpload.h */; }; CC25135D244C7EB3003F4C65 /* QNBaseUpload.m in Sources */ = {isa = PBXBuildFile; fileRef = CC25135B244C7EB3003F4C65 /* QNBaseUpload.m */; }; CC25135E244C7EB3003F4C65 /* QNBaseUpload.m in Sources */ = {isa = PBXBuildFile; fileRef = CC25135B244C7EB3003F4C65 /* QNBaseUpload.m */; }; @@ -387,7 +391,6 @@ CCF661062355C2C00018A41E /* QNConcurrentResumeUploadTest.m in Sources */ = {isa = PBXBuildFile; fileRef = CCF661052355C2C00018A41E /* QNConcurrentResumeUploadTest.m */; }; CCF661072355C4480018A41E /* QNConcurrentResumeUploadTest.m in Sources */ = {isa = PBXBuildFile; fileRef = CCF661052355C2C00018A41E /* QNConcurrentResumeUploadTest.m */; }; CCF661082355C5120018A41E /* QiniuSDK.h in Headers */ = {isa = PBXBuildFile; fileRef = DF2CDE5819DAC6A400CE01FB /* QiniuSDK.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DF0A03231B3BABEC00E3778C /* QiniuSDK_Mac.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = DF2CDDFF19DAC05500CE01FB /* QiniuSDK_Mac.dylib */; }; DF0A03241B3BAC3900E3778C /* QNFormUploadTest.m in Sources */ = {isa = PBXBuildFile; fileRef = DF3C504619DD7BA6000F548F /* QNFormUploadTest.m */; }; DF0A03251B3BAC5700E3778C /* libQiniuSDK_iOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DF2CDE1A19DAC08400CE01FB /* libQiniuSDK_iOS.a */; }; DF0A03261B3BAC6E00E3778C /* QNBase64Test.m in Sources */ = {isa = PBXBuildFile; fileRef = DF2CDE7019DAE90300CE01FB /* QNBase64Test.m */; }; @@ -433,10 +436,36 @@ DFF525341A6235D100D02BA1 /* QNSessionManager.m in Sources */ = {isa = PBXBuildFile; fileRef = DFF525301A6235D100D02BA1 /* QNSessionManager.m */; }; DFF525391A64079B00D02BA1 /* QNSessionTest.m in Sources */ = {isa = PBXBuildFile; fileRef = DFF525381A64079B00D02BA1 /* QNSessionTest.m */; }; DFFE0E6019E6575600D7A0FC /* QNFileRecorderTest.m in Sources */ = {isa = PBXBuildFile; fileRef = DFFE0E5F19E6575600D7A0FC /* QNFileRecorderTest.m */; }; + EDACA7C80C5C64FAE735B1F6 /* libPods-QiniuSDK_Mac.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F14D0FE3BA304F86A17EDF33 /* libPods-QiniuSDK_Mac.a */; }; + F7EF38B5DE8F99F7DFBEA851 /* libPods-QiniuSDK_iOSTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 6E309CFDCAA7E76E8668531D /* libPods-QiniuSDK_iOSTests.a */; }; FDEA88661DAC10D000D037E5 /* QNAutoZoneTest.m in Sources */ = {isa = PBXBuildFile; fileRef = FDEA88651DAC10D000D037E5 /* QNAutoZoneTest.m */; }; FDEA88671DAC10D000D037E5 /* QNAutoZoneTest.m in Sources */ = {isa = PBXBuildFile; fileRef = FDEA88651DAC10D000D037E5 /* QNAutoZoneTest.m */; }; /* End PBXBuildFile section */ +/* Begin PBXContainerItemProxy section */ + 45BDB3C52C045E8F00F184D7 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = DF2CDDF719DAC05500CE01FB /* Project object */; + proxyType = 1; + remoteGlobalIDString = DF2CDDFE19DAC05500CE01FB; + remoteInfo = QiniuSDK_Mac; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 45BDB3C72C045E8F00F184D7 /* Embed Libraries */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + 45BDB3C42C045E8F00F184D7 /* QiniuSDK_Mac.dylib in Embed Libraries */, + ); + name = "Embed Libraries"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + /* Begin PBXFileReference section */ 135958056D8FF4295F3D9AB0 /* Pods-QiniuSDK_iOSTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-QiniuSDK_iOSTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-QiniuSDK_iOSTests/Pods-QiniuSDK_iOSTests.release.xcconfig"; sourceTree = ""; }; 3115471C243476CF00D77B8B /* QNTransactionTest.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = QNTransactionTest.m; sourceTree = ""; }; @@ -595,6 +624,7 @@ 31FE6A0925A8320200C02B27 /* QNConnectChecker.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = QNConnectChecker.h; sourceTree = ""; }; 31FE6A0A25A8320200C02B27 /* QNConnectChecker.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = QNConnectChecker.m; sourceTree = ""; }; 32036F4A07041AC3410DBF2F /* Pods-QiniuSDK_Mac.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-QiniuSDK_Mac.release.xcconfig"; path = "Pods/Target Support Files/Pods-QiniuSDK_Mac/Pods-QiniuSDK_Mac.release.xcconfig"; sourceTree = ""; }; + 43AF08370B1B79540BB41B4B /* libPods-QiniuSDK_iOS.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-QiniuSDK_iOS.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 451164182B05C86900F2D9FC /* QNUrlUtils.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = QNUrlUtils.h; sourceTree = ""; }; 451164192B05C86900F2D9FC /* QNUrlUtils.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = QNUrlUtils.m; sourceTree = ""; }; 451A36B424BD893D00754A15 /* QNReportConfig.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = QNReportConfig.h; sourceTree = ""; }; @@ -616,6 +646,7 @@ 6663602DA8CC701EA3B11F04 /* Pods-QiniuSDK_iOS.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-QiniuSDK_iOS.debug.xcconfig"; path = "Pods/Target Support Files/Pods-QiniuSDK_iOS/Pods-QiniuSDK_iOS.debug.xcconfig"; sourceTree = ""; }; 69B20FB4731F84969BC5AEBE /* Pods-QiniuSDK_Mac.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-QiniuSDK_Mac.debug.xcconfig"; path = "Pods/Target Support Files/Pods-QiniuSDK_Mac/Pods-QiniuSDK_Mac.debug.xcconfig"; sourceTree = ""; }; 6DD894AA2A19370381AD4201 /* Pods-QiniuSDK_iOSTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-QiniuSDK_iOSTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-QiniuSDK_iOSTests/Pods-QiniuSDK_iOSTests.debug.xcconfig"; sourceTree = ""; }; + 6E309CFDCAA7E76E8668531D /* libPods-QiniuSDK_iOSTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-QiniuSDK_iOSTests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; B62E937FF4E75CDD482C35E8 /* Pods-QiniuSDK_MacTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-QiniuSDK_MacTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-QiniuSDK_MacTests/Pods-QiniuSDK_MacTests.release.xcconfig"; sourceTree = ""; }; CC25135A244C7EB3003F4C65 /* QNBaseUpload.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = QNBaseUpload.h; sourceTree = ""; }; CC25135B244C7EB3003F4C65 /* QNBaseUpload.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = QNBaseUpload.m; sourceTree = ""; }; @@ -629,6 +660,7 @@ CC3F322222C0CCDF00F23681 /* QNUploadInfoReporter.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = QNUploadInfoReporter.m; sourceTree = ""; }; CCC3A50622DC10CB00D835B1 /* QNConcurrentResumeUpload.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = QNConcurrentResumeUpload.h; sourceTree = ""; }; CCF661052355C2C00018A41E /* QNConcurrentResumeUploadTest.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = QNConcurrentResumeUploadTest.m; sourceTree = ""; }; + D15EA855D2DBDE6728E87462 /* libPods-QiniuSDK_MacTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-QiniuSDK_MacTests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; D84AF95CA892E1089E26F959 /* Pods-QiniuSDK_iOS.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-QiniuSDK_iOS.release.xcconfig"; path = "Pods/Target Support Files/Pods-QiniuSDK_iOS/Pods-QiniuSDK_iOS.release.xcconfig"; sourceTree = ""; }; DF0D23CC19DCE6C400D6B68F /* QNResponseInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QNResponseInfo.h; sourceTree = ""; }; DF0D23CE19DCE6E500D6B68F /* QNResponseInfo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = QNResponseInfo.m; sourceTree = ""; }; @@ -665,6 +697,7 @@ DFF525301A6235D100D02BA1 /* QNSessionManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = QNSessionManager.m; sourceTree = ""; }; DFF525381A64079B00D02BA1 /* QNSessionTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = QNSessionTest.m; sourceTree = ""; }; DFFE0E5F19E6575600D7A0FC /* QNFileRecorderTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = QNFileRecorderTest.m; sourceTree = ""; }; + F14D0FE3BA304F86A17EDF33 /* libPods-QiniuSDK_Mac.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-QiniuSDK_Mac.a"; sourceTree = BUILT_PRODUCTS_DIR; }; FDEA88651DAC10D000D037E5 /* QNAutoZoneTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = QNAutoZoneTest.m; sourceTree = ""; }; /* End PBXFileReference section */ @@ -673,6 +706,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 5E721E890A824FA68D6EE8BA /* libPods-QiniuSDK_iOS.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -681,6 +715,7 @@ buildActionMask = 2147483647; files = ( DF293C9119DB85CB00799011 /* libz.dylib in Frameworks */, + EDACA7C80C5C64FAE735B1F6 /* libPods-QiniuSDK_Mac.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -688,8 +723,9 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - DF0A03231B3BABEC00E3778C /* QiniuSDK_Mac.dylib in Frameworks */, + 45BDB3C32C045E8F00F184D7 /* QiniuSDK_Mac.dylib in Frameworks */, DF293C9219DB85EB00799011 /* libz.dylib in Frameworks */, + 90C40F412BC772AAE58363D3 /* libPods-QiniuSDK_MacTests.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -698,6 +734,7 @@ buildActionMask = 2147483647; files = ( DF0A03251B3BAC5700E3778C /* libQiniuSDK_iOS.a in Frameworks */, + F7EF38B5DE8F99F7DFBEA851 /* libPods-QiniuSDK_iOSTests.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -917,6 +954,10 @@ A955AABD20BF51BFE5032419 /* Frameworks */ = { isa = PBXGroup; children = ( + F14D0FE3BA304F86A17EDF33 /* libPods-QiniuSDK_Mac.a */, + D15EA855D2DBDE6728E87462 /* libPods-QiniuSDK_MacTests.a */, + 43AF08370B1B79540BB41B4B /* libPods-QiniuSDK_iOS.a */, + 6E309CFDCAA7E76E8668531D /* libPods-QiniuSDK_iOSTests.a */, ); name = Frameworks; sourceTree = ""; @@ -1340,10 +1381,12 @@ DF2CDE0619DAC05500CE01FB /* Sources */, DF2CDE0719DAC05500CE01FB /* Frameworks */, DF2CDE0819DAC05500CE01FB /* Resources */, + 45BDB3C72C045E8F00F184D7 /* Embed Libraries */, ); buildRules = ( ); dependencies = ( + 45BDB3C62C045E8F00F184D7 /* PBXTargetDependency */, ); name = QiniuSDK_MacTests; productName = QiniuSDK_MacTests; @@ -1807,6 +1850,14 @@ }; /* End PBXSourcesBuildPhase section */ +/* Begin PBXTargetDependency section */ + 45BDB3C62C045E8F00F184D7 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = DF2CDDFE19DAC05500CE01FB /* QiniuSDK_Mac */; + targetProxy = 45BDB3C52C045E8F00F184D7 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + /* Begin XCBuildConfiguration section */ 31259E4724E63B9700CF7531 /* Debug */ = { isa = XCBuildConfiguration; diff --git a/QiniuSDK/Common/QNAutoZone.m b/QiniuSDK/Common/QNAutoZone.m index d59fad10..5537d155 100644 --- a/QiniuSDK/Common/QNAutoZone.m +++ b/QiniuSDK/Common/QNAutoZone.m @@ -14,6 +14,8 @@ #import "QNRequestTransaction.h" #import "QNZoneInfo.h" #import "QNUpToken.h" +#import "QNUploadOption.h" +#import "QNConfiguration.h" #import "QNResponseInfo.h" #import "QNFixedZone.h" #import "QNSingleFlight.h" @@ -88,9 +90,9 @@ - (void)setDefaultZones:(NSArray *)zones { } - (QNZonesInfo *)getZonesInfoWithToken:(QNUpToken *_Nullable)token { - + if (token == nil) return nil; - NSString *cacheKey = [self makeCacheKey:token.index]; + NSString *cacheKey = [self makeCacheKey:nil akAndBucket:token.index]; QNZonesInfo *zonesInfo = nil; @synchronized (self) { zonesInfo = self.zonesDic[cacheKey]; @@ -110,23 +112,37 @@ - (void)setZonesInfo:(QNZonesInfo *)info forKey:(NSString *)key { } - (void)preQuery:(QNUpToken *)token on:(QNPrequeryReturn)ret { + [self query:[QNConfiguration defaultConfiguration] token:token on:^(QNResponseInfo * _Nullable responseInfo, QNUploadRegionRequestMetrics * _Nullable metrics, QNZonesInfo * _Nullable zonesInfo) { + if (!ret) { + return; + } + + if (responseInfo.isOK) { + ret(0, responseInfo, metrics); + } else { + ret(responseInfo.statusCode, responseInfo, metrics); + } + }]; +} +- (void)query:(QNConfiguration *)config token:(QNUpToken *)token on:(QNQueryReturn)ret { if (token == nil || ![token isValid]) { - ret(-1, [QNResponseInfo responseInfoWithInvalidToken:@"invalid token"], nil); + ret([QNResponseInfo responseInfoWithInvalidToken:@"invalid token"], nil, nil); return; } QNUploadRegionRequestMetrics *cacheMetrics = [QNUploadRegionRequestMetrics emptyMetrics]; [cacheMetrics start]; - NSString *cacheKey = [self makeCacheKey:token.index]; + + NSString *cacheKey = [self makeCacheKey:config akAndBucket:token.index]; QNZonesInfo *zonesInfo = [[QNAutoZone zoneShareCache] cacheForKey:cacheKey]; // 临时的 zonesInfo 仅能使用一次 if (zonesInfo != nil && zonesInfo.isValid && !zonesInfo.isTemporary) { [cacheMetrics end]; [self setZonesInfo:zonesInfo forKey:cacheKey]; - ret(0, [QNResponseInfo successResponse], cacheMetrics); + ret([QNResponseInfo successResponse], cacheMetrics, zonesInfo); return; } @@ -134,7 +150,7 @@ - (void)preQuery:(QNUpToken *)token on:(QNPrequeryReturn)ret { QNSingleFlight *singleFlight = [QNAutoZone UCQuerySingleFlight]; [singleFlight perform:token.index action:^(QNSingleFlightComplete _Nonnull complete) { kQNStrongSelf; - QNRequestTransaction *transaction = [self createUploadRequestTransaction:token]; + QNRequestTransaction *transaction = [self createUploadRequestTransaction:config token:token]; kQNWeakSelf; kQNWeakObj(transaction); @@ -163,37 +179,47 @@ - (void)preQuery:(QNUpToken *)token on:(QNPrequeryReturn)ret { if ([zonesInfo isValid]) { [self setZonesInfo:zonesInfo forKey:cacheKey]; [[QNAutoZone zoneShareCache] cache:zonesInfo forKey:cacheKey atomically:false]; - ret(0, responseInfo, metrics); + ret(responseInfo, metrics, zonesInfo); } else { - ret(NSURLErrorCannotDecodeRawData, responseInfo, metrics); + responseInfo = [QNResponseInfo errorResponseInfo:NSURLErrorCannotDecodeRawData errorDesc:[NSString stringWithFormat:@"origin response:%@", responseInfo]]; + ret(responseInfo, metrics, nil); } } else { if (self.defaultZone != nil) { // 备用只能用一次 QNZonesInfo *info = [self.defaultZone getZonesInfoWithToken:token]; [self setZonesInfo:info forKey:cacheKey]; - ret(0, responseInfo, metrics); + responseInfo = [QNResponseInfo successResponseWithDesc:[NSString stringWithFormat:@"origin response:%@", responseInfo]]; + ret(responseInfo, metrics, info); } else if (zonesInfo != nil) { // 缓存有,但是失效也可使用 [self setZonesInfo:zonesInfo forKey:cacheKey]; - ret(0, responseInfo, metrics); + responseInfo = [QNResponseInfo successResponseWithDesc:[NSString stringWithFormat:@"origin response:%@", responseInfo]]; + ret(responseInfo, metrics, zonesInfo); } else { - ret(kQNNetworkError, responseInfo, metrics); + ret(responseInfo, metrics, nil); } } }]; } -- (QNRequestTransaction *)createUploadRequestTransaction:(QNUpToken *)token { +- (QNRequestTransaction *)createUploadRequestTransaction:(QNConfiguration *)config token:(QNUpToken *)token { + if (config == nil) { + config = [QNConfiguration defaultConfiguration]; + } + NSArray *hosts = nil; if (self.ucHosts && self.ucHosts.count > 0) { hosts = [self.ucHosts copy]; } else { hosts = kQNPreQueryHosts; } - QNRequestTransaction *transaction = [[QNRequestTransaction alloc] initWithHosts:hosts - regionId:QNZoneInfoEmptyRegionId - token:token]; + QNRequestTransaction *transaction = [[QNRequestTransaction alloc] initWithConfig:config + uploadOption:[QNUploadOption defaultOptions] + hosts:hosts + regionId:QNZoneInfoEmptyRegionId + key:@"" + token:token]; @synchronized (self) { [self.transactions addObject:transaction]; } @@ -208,9 +234,20 @@ - (void)destroyUploadRequestTransaction:(QNRequestTransaction *)transaction { } } -- (NSString *)makeCacheKey:(NSString *)akAndBucket { - NSString *ucHost = self.ucHosts.firstObject; - NSString *cacheKey = [NSString stringWithFormat:@"%@:%@", ucHost, akAndBucket]; +- (NSString *)makeCacheKey:(QNConfiguration *)config akAndBucket:(NSString *)akAndBucket { + NSString *key = akAndBucket; + if (config != nil) { + key = [NSString stringWithFormat:@"%@:%d",key, config.accelerateUploading]; + } + + NSString *hosts = @""; + for (NSString *host in self.ucHosts) { + if (!host) { + continue; + } + hosts = [NSString stringWithFormat:@"%@:%@", hosts, host]; + } + NSString *cacheKey = [NSString stringWithFormat:@"%@:%@", hosts, akAndBucket]; return [QNUrlSafeBase64 encodeString:cacheKey]; } diff --git a/QiniuSDK/Common/QNConfig.h b/QiniuSDK/Common/QNConfig.h index b39401bf..bed8269a 100644 --- a/QiniuSDK/Common/QNConfig.h +++ b/QiniuSDK/Common/QNConfig.h @@ -13,6 +13,6 @@ #define kQNPreQueryHost01 @"kodo-config.qiniuapi.com" #define kQNPreQueryHost02 @"uc.qbox.me" #define kQNPreQueryHost03 @"api.qiniu.com" -#define kQNPreQueryHosts @[kQNPreQueryHost00, kQNPreQueryHost01, kQNPreQueryHost02, kQNPreQueryHost03] +#define kQNPreQueryHosts @[kQNPreQueryHost00, kQNPreQueryHost01, kQNPreQueryHost02] #define kQNUpLogHost @"uplog.qbox.me" diff --git a/QiniuSDK/Common/QNFixedZone.h b/QiniuSDK/Common/QNFixedZone.h index f1c74a2b..a2114afe 100644 --- a/QiniuSDK/Common/QNFixedZone.h +++ b/QiniuSDK/Common/QNFixedZone.h @@ -63,6 +63,21 @@ NS_ASSUME_NONNULL_BEGIN */ - (instancetype)initWithUpDomainList:(NSArray *)upList; + +/** + * Zone初始化方法 + * + * @param accUpList 加速上传服务器地址列表 + * @param upList 默认上传服务器地址列表 + * @param oldUpList 支持 SNI 的上传服务器地址列表 + * @param regionId 区域 ID + * @return Zone实例 + */ +- (instancetype)initWithAccUpDomainList:(NSArray *)accUpList + upList:(NSArray *)upList + oldUpList:(NSArray *)oldUpList + regionId:(NSString *)regionId; + /** * Zone初始化方法 * diff --git a/QiniuSDK/Common/QNFixedZone.m b/QiniuSDK/Common/QNFixedZone.m index 81485e91..426f41fb 100644 --- a/QiniuSDK/Common/QNFixedZone.m +++ b/QiniuSDK/Common/QNFixedZone.m @@ -8,6 +8,7 @@ #import "QNFixedZone.h" #import "QNZoneInfo.h" +#import "QNResponseInfo.h" @interface QNFixedZone () @@ -136,11 +137,21 @@ - (QNZonesInfo *)createZonesInfo:(NSArray *)upDomains - (QNZonesInfo *)createZonesInfo:(NSArray *)upDomains oldUpDomains:(NSArray *)oldUpDomains regionId:(NSString *)regionId { - if (!upDomains && upDomains.count == 0) { + return [self createZonesInfo:nil domains:upDomains oldDomains:oldUpDomains regionId:regionId]; +} + +- (QNZonesInfo *)createZonesInfo:(NSArray *)accDomains + domains:(NSArray *)domains + oldDomains:(NSArray *)oldDomains + regionId:(NSString *)regionId { + if ((!accDomains || accDomains.count == 0) && (!domains || domains.count == 0)) { return nil; } - QNZoneInfo *zoneInfo = [QNZoneInfo zoneInfoWithMainHosts:upDomains oldHosts:oldUpDomains regionId:regionId]; + QNZoneInfo *zoneInfo = [QNZoneInfo zoneInfoWithAccHosts:accDomains + mainHosts:domains + oldHosts:oldDomains + regionId:regionId]; QNZonesInfo *zonesInfo = [[QNZonesInfo alloc] initWithZonesInfo:@[zoneInfo]]; return zonesInfo; } @@ -166,10 +177,23 @@ - (instancetype)initWithUpDomainList:(NSArray *)upList } return self; } +- (instancetype)initWithAccUpDomainList:(NSArray *)accUpList + upList:(NSArray *)upList + oldUpList:(NSArray *)oldUpList + regionId:(NSString *)regionId { + if (self = [super init]) { + self.zonesInfo = [self createZonesInfo:accUpList domains:upList oldDomains:oldUpList regionId:regionId]; + } + return self; +} - (QNZonesInfo *)getZonesInfoWithToken:(QNUpToken *)token { return self.zonesInfo; } +- (void)query:(QNConfiguration * _Nullable)config token:(QNUpToken * _Nullable)token on:(QNQueryReturn _Nullable)ret { + ret([QNResponseInfo successResponse], nil, self.zonesInfo); +} + @end diff --git a/QiniuSDK/Common/QNZone.h b/QiniuSDK/Common/QNZone.h index ed73bc2e..f8c4e7e7 100644 --- a/QiniuSDK/Common/QNZone.h +++ b/QiniuSDK/Common/QNZone.h @@ -10,22 +10,29 @@ NS_ASSUME_NONNULL_BEGIN -@class QNResponseInfo, QNUpToken, QNZonesInfo, QNUploadRegionRequestMetrics; +@class QNConfiguration, QNResponseInfo, QNUpToken, QNZonesInfo, QNUploadRegionRequestMetrics; typedef void (^QNPrequeryReturn)(int code, QNResponseInfo * _Nullable httpResponseInfo, QNUploadRegionRequestMetrics * _Nullable metrics); +typedef void (^QNQueryReturn)(QNResponseInfo * _Nullable httpResponseInfo, QNUploadRegionRequestMetrics * _Nullable metrics, QNZonesInfo * _Nullable zonesInfo); @interface QNZone : NSObject /// 根据token查询相关 Zone 信息【内部使用】 /// @param token token 信息 /// @param ret 查询回调 -- (void)preQuery:(QNUpToken * _Nullable)token - on:(QNPrequeryReturn _Nullable)ret; +- (void)preQuery:(QNUpToken * _Nullable)token on:(QNPrequeryReturn _Nullable)ret; /// 根据token获取ZonesInfo 【内部使用】 /// @param token token信息 - (QNZonesInfo *)getZonesInfoWithToken:(QNUpToken * _Nullable)token; + +/// 根据token查询相关 Zone 信息【内部使用】 +/// @param config 配置信息 +/// @param token token 信息 +/// @param ret 查询回调 +- (void)query:(QNConfiguration * _Nullable)config token:(QNUpToken * _Nullable)token on:(QNQueryReturn _Nullable)ret; + @end NS_ASSUME_NONNULL_END diff --git a/QiniuSDK/Common/QNZone.m b/QiniuSDK/Common/QNZone.m index f973130d..1e35364a 100644 --- a/QiniuSDK/Common/QNZone.m +++ b/QiniuSDK/Common/QNZone.m @@ -9,6 +9,8 @@ #import "QNZone.h" #import "QNUpToken.h" #import "QNZoneInfo.h" +#import "QNConfiguration.h" +#import "QNResponseInfo.h" @implementation QNZone @@ -21,4 +23,8 @@ - (void)preQuery:(QNUpToken *)token ret(0, nil, nil); } +- (void)query:(QNConfiguration * _Nullable)config token:(QNUpToken * _Nullable)token on:(QNQueryReturn _Nullable)ret { + ret([QNResponseInfo responseInfoWithSDKInteriorError:@"impl query"], nil, nil); +} + @end diff --git a/QiniuSDK/Common/QNZoneInfo.h b/QiniuSDK/Common/QNZoneInfo.h index 8911bb67..f6803014 100644 --- a/QiniuSDK/Common/QNZoneInfo.h +++ b/QiniuSDK/Common/QNZoneInfo.h @@ -19,6 +19,7 @@ extern NSString *const QNZoneInfoEmptyRegionId; @property(nonatomic, assign, readonly)long ttl; @property(nonatomic, assign, readonly)BOOL http3Enabled; @property(nonatomic, strong, readonly)NSArray *domains; +@property(nonatomic, strong, readonly)NSArray *acc_domains; @property(nonatomic, strong, readonly)NSArray *old_domains; @property(nonatomic, copy, readonly)NSString *regionId; @@ -28,10 +29,16 @@ extern NSString *const QNZoneInfoEmptyRegionId; + (QNZoneInfo *)zoneInfoWithMainHosts:(NSArray *)mainHosts regionId:(NSString * _Nullable)regionId; + + (QNZoneInfo *)zoneInfoWithMainHosts:(NSArray *)mainHosts oldHosts:(NSArray * _Nullable)oldHosts regionId:(NSString * _Nullable)regionId; ++ (QNZoneInfo *)zoneInfoWithAccHosts:(NSArray *)accHosts + mainHosts:(NSArray *)mainHosts + oldHosts:(NSArray * _Nullable)oldHosts + regionId:(NSString * _Nullable)regionId; + /// 根据键值对构造对象 【内部使用】 /// @param detailInfo 键值对信息 + (QNZoneInfo *)zoneInfoFromDictionary:(NSDictionary *)detailInfo; diff --git a/QiniuSDK/Common/QNZoneInfo.m b/QiniuSDK/Common/QNZoneInfo.m index 305a2968..9c0c1002 100644 --- a/QiniuSDK/Common/QNZoneInfo.m +++ b/QiniuSDK/Common/QNZoneInfo.m @@ -20,6 +20,7 @@ @interface QNZoneInfo() @property(nonatomic, assign) long ttl; @property(nonatomic, assign) BOOL http3Enabled; @property(nonatomic, strong) NSArray *domains; +@property(nonatomic, strong) NSArray *acc_domains; @property(nonatomic, strong) NSArray *old_domains; @property(nonatomic, strong) NSArray *allHosts; @@ -53,6 +54,32 @@ + (QNZoneInfo *)zoneInfoWithMainHosts:(NSArray *)mainHosts return zoneInfo; } ++ (QNZoneInfo *)zoneInfoWithAccHosts:(NSArray *)accHosts + mainHosts:(NSArray *)mainHosts + oldHosts:(NSArray * _Nullable)oldHosts + regionId:(NSString * _Nullable)regionId { + if ((!accHosts || ![accHosts isKindOfClass:[NSArray class]] || accHosts.count == 0) && + (!mainHosts || ![mainHosts isKindOfClass:[NSArray class]] || mainHosts.count == 0)) { + return nil; + } + + if (accHosts && ![accHosts isKindOfClass:[NSArray class]]) { + accHosts = nil; + } + + if (mainHosts && ![mainHosts isKindOfClass:[NSArray class]]) { + mainHosts = nil; + } + + QNZoneInfo *zoneInfo = [QNZoneInfo zoneInfoFromDictionary:@{@"ttl" : @(-1), + @"region" : regionId ?: QNZoneInfoEmptyRegionId, + @"up" : @{@"acc_domains" : accHosts ?: @[], + @"domains" : mainHosts ?: @[], + @"old" : oldHosts ?: @[]}, + }]; + return zoneInfo; +} + + (QNZoneInfo *)zoneInfoFromDictionary:(NSDictionary *)detail { if (![detail isKindOfClass:[NSDictionary class]]) { return nil; @@ -75,6 +102,7 @@ + (QNZoneInfo *)zoneInfoFromDictionary:(NSDictionary *)detail { http3Enabled = [detailInfo[@"features"][@"http3"][@"enabled"] boolValue]; } NSDictionary *up = [detailInfo objectForKey:@"up"]; + NSArray *acc_domains = [up objectForKey:@"acc_domains"]; NSArray *domains = [up objectForKey:@"domains"]; NSArray *old_domains = [up objectForKey:@"old"]; @@ -82,6 +110,10 @@ + (QNZoneInfo *)zoneInfoFromDictionary:(NSDictionary *)detail { QNZoneInfo *zoneInfo = [[QNZoneInfo alloc] init:ttl regionId:regionId]; zoneInfo.buildDate = [NSDate dateWithTimeIntervalSince1970:timestamp]; zoneInfo.http3Enabled = http3Enabled; + if ([acc_domains isKindOfClass:[NSArray class]]) { + zoneInfo.acc_domains = acc_domains; + [allHosts addObjectsFromArray:domains]; + } if ([domains isKindOfClass:[NSArray class]]) { zoneInfo.domains = domains; [allHosts addObjectsFromArray:domains]; diff --git a/QiniuSDK/Http/Dns/QNDnsPrefetch.h b/QiniuSDK/Http/Dns/QNDnsPrefetch.h index 8c3ffca0..26b5e73d 100644 --- a/QiniuSDK/Http/Dns/QNDnsPrefetch.h +++ b/QiniuSDK/Http/Dns/QNDnsPrefetch.h @@ -43,6 +43,7 @@ NS_ASSUME_NONNULL_BEGIN /// @param currentZone 当前区域 /// @param token token信息 - (BOOL)addDnsCheckAndPrefetchTransaction:(QNZone *)currentZone token:(QNUpToken *)token; +- (BOOL)addDnsCheckAndPrefetchTransaction:(QNConfiguration *)config zone:(QNZone *)currentZone token:(QNUpToken *)token; /// 设置定时事务:检测已缓存DNS有效情况事务 无效会重新预取 - (void)setDnsCheckWhetherCachedValidTransactionAction; diff --git a/QiniuSDK/Http/Dns/QNDnsPrefetch.m b/QiniuSDK/Http/Dns/QNDnsPrefetch.m index c6221959..fb0fc498 100644 --- a/QiniuSDK/Http/Dns/QNDnsPrefetch.m +++ b/QiniuSDK/Http/Dns/QNDnsPrefetch.m @@ -303,11 +303,11 @@ - (void)localFetch{ } //MARK: -- 检测并预取 /// 根据token检测Dns缓存信息时效,无效则预取。 完成预取操作返回YES,反之返回NO -- (void)checkAndPrefetchDnsIfNeed:(QNZone *)currentZone token:(QNUpToken *)token{ +- (void)checkAndPrefetchDnsIfNeed:(QNConfiguration *)config zone:(QNZone *)currentZone token:(QNUpToken *)token{ if ([self prepareToPreFetch] == NO) { return; } - NSArray *hosts = [self getCurrentZoneHosts:currentZone token:token]; + NSArray *hosts = [self getCurrentZoneHosts:config zone:currentZone token:token]; if (hosts == nil) { return; } @@ -679,16 +679,24 @@ - (void)clearDnsDiskCache:(NSError **)error { return [localHosts copy]; } -- (NSArray *)getCurrentZoneHosts:(QNZone *)currentZone +- (NSArray *)getCurrentZoneHosts:(QNConfiguration *)config + zone:(QNZone *)currentZone token:(QNUpToken *)token{ if (!currentZone || !token || !token.token) { return nil; } - [currentZone preQuery:token on:^(int code, QNResponseInfo *responseInfo, QNUploadRegionRequestMetrics *metrics) { + + __block QNZonesInfo *zonesInfo = nil; + [currentZone query:config token:token on:^(QNResponseInfo * _Nullable httpResponseInfo, QNUploadRegionRequestMetrics * _Nullable metrics, QNZonesInfo * _Nullable info) { + zonesInfo = info; dispatch_semaphore_signal(self.semaphore); }]; dispatch_semaphore_wait(self.semaphore, DISPATCH_TIME_FOREVER); + if (zonesInfo == nil) { + return nil; + } + QNZonesInfo *autoZonesInfo = [currentZone getZonesInfoWithToken:token]; NSMutableArray *autoHosts = [NSMutableArray array]; NSArray *zoneInfoList = autoZonesInfo.zonesInfo; @@ -785,7 +793,12 @@ - (void)addDnsLocalLoadTransaction{ }); } -- (BOOL)addDnsCheckAndPrefetchTransaction:(QNZone *)currentZone token:(QNUpToken *)token{ +- (BOOL)addDnsCheckAndPrefetchTransaction:(QNZone *)currentZone token:(QNUpToken *)token { + return [self addDnsCheckAndPrefetchTransaction:[QNConfiguration defaultConfiguration] zone:currentZone token:token]; +} + +- (BOOL)addDnsCheckAndPrefetchTransaction:(QNConfiguration *)config zone:(QNZone *)currentZone token:(QNUpToken *)token { + if (!token) { return NO; } @@ -802,7 +815,7 @@ - (BOOL)addDnsCheckAndPrefetchTransaction:(QNZone *)currentZone token:(QNUpToken if (![transactionManager existTransactionsForName:token.token]) { QNTransaction *transaction = [QNTransaction transaction:token.token after:0 action:^{ - [kQNDnsPrefetch checkAndPrefetchDnsIfNeed:currentZone token:token]; + [kQNDnsPrefetch checkAndPrefetchDnsIfNeed:config zone:currentZone token:token]; }]; [transactionManager addTransaction:transaction]; diff --git a/QiniuSDK/Http/QNResponseInfo.h b/QiniuSDK/Http/QNResponseInfo.h index 3646d009..f021ee78 100755 --- a/QiniuSDK/Http/QNResponseInfo.h +++ b/QiniuSDK/Http/QNResponseInfo.h @@ -55,11 +55,14 @@ @property (nonatomic, readonly) BOOL isHostUnavailable; /// 在断点续上传过程中,ctx 信息已过期。 @property (nonatomic, readonly) BOOL isCtxExpiedError; +/// 是否是加速配置错误 +@property (nonatomic, readonly) BOOL isTransferAccelerationConfigureError; /// 是否为 七牛响应 @property (nonatomic, readonly, getter=isNotQiniu) BOOL notQiniu; //MARK:-- 构造函数 【内部使用】 + (instancetype)successResponse; ++ (instancetype)successResponseWithDesc:(NSString *)desc; + (instancetype)cancelResponse; + (instancetype)responseInfoWithNetworkError:(NSString *)desc; + (instancetype)responseInfoWithInvalidArgument:(NSString *)desc; diff --git a/QiniuSDK/Http/QNResponseInfo.m b/QiniuSDK/Http/QNResponseInfo.m index abe7fcd7..e3341220 100755 --- a/QiniuSDK/Http/QNResponseInfo.m +++ b/QiniuSDK/Http/QNResponseInfo.m @@ -28,9 +28,13 @@ @interface QNResponseInfo () @implementation QNResponseInfo + (instancetype)successResponse{ + return [QNResponseInfo successResponseWithDesc:@"inter:ok"]; +} + ++ (instancetype)successResponseWithDesc:(NSString *)desc { QNResponseInfo *responseInfo = [[QNResponseInfo alloc] init]; responseInfo.statusCode = 200; - responseInfo.message = @"inter:ok"; + responseInfo.message = desc; responseInfo.xlog = @"inter:xlog"; responseInfo.reqId = @"inter:reqid"; return responseInfo; @@ -234,6 +238,10 @@ - (BOOL)couldRetry { return YES; } + if ([self isTransferAccelerationConfigureError]) { + return YES; + } + if (self.isCancelled || _statusCode == 100 || (_statusCode > 300 && _statusCode < 400) @@ -253,6 +261,10 @@ - (BOOL)couldRegionRetry{ return YES; } + if ([self isTransferAccelerationConfigureError]) { + return YES; + } + if (self.isCancelled || _statusCode == 100 || (_statusCode > 300 && _statusCode < 500 && _statusCode != 406) @@ -272,6 +284,10 @@ - (BOOL)couldHostRetry{ return YES; } + if ([self isTransferAccelerationConfigureError]) { + return NO; + } + if (self.isCancelled || _statusCode == 100 || (_statusCode > 300 && _statusCode < 500 && _statusCode != 406) @@ -297,7 +313,8 @@ - (BOOL)canConnectToHost{ - (BOOL)isHostUnavailable{ // 基本不可恢复,注:会影响下次请求,范围太大可能会造成大量的timeout - if (_statusCode == 502 || _statusCode == 503 || _statusCode == 504 || _statusCode == 599) { + if ([self isTransferAccelerationConfigureError] || + _statusCode == 502 || _statusCode == 503 || _statusCode == 504 || _statusCode == 599) { return true; } else { return false; @@ -308,6 +325,11 @@ - (BOOL)isCtxExpiedError { return _statusCode == 701 || (_statusCode == 612 && [_message containsString:@"no such uploadId"]); } +- (BOOL)isTransferAccelerationConfigureError { + NSString *errorDesc = [NSString stringWithFormat:@"%@", self.error]; + return [errorDesc containsString:@"transfer acceleration is not configured on this bucket"]; +} + - (BOOL)isConnectionBroken { return _statusCode == kQNNetworkError || _statusCode == NSURLErrorNotConnectedToInternet; } diff --git a/QiniuSDK/Http/ServerRegion/QNUploadDomainRegion.h b/QiniuSDK/Http/ServerRegion/QNUploadDomainRegion.h index bcade144..8e8c5d00 100644 --- a/QiniuSDK/Http/ServerRegion/QNUploadDomainRegion.h +++ b/QiniuSDK/Http/ServerRegion/QNUploadDomainRegion.h @@ -10,8 +10,12 @@ NS_ASSUME_NONNULL_BEGIN +@class QNConfiguration; + @interface QNUploadDomainRegion : NSObject +- (instancetype)initWithConfig:(QNConfiguration *)config; + @end NS_ASSUME_NONNULL_END diff --git a/QiniuSDK/Http/ServerRegion/QNUploadDomainRegion.m b/QiniuSDK/Http/ServerRegion/QNUploadDomainRegion.m index 371eee15..daf72f12 100644 --- a/QiniuSDK/Http/ServerRegion/QNUploadDomainRegion.m +++ b/QiniuSDK/Http/ServerRegion/QNUploadDomainRegion.m @@ -170,9 +170,12 @@ @interface QNUploadDomainRegion() // 是否冻结过Host,PS:如果没有冻结过 Host,则当前 Region 上传也就不会有错误信息,可能会返回-9,所以必须要再进行一次尝试 @property(atomic , assign)BOOL hasFreezeHost; @property(atomic , assign)BOOL isAllFrozen; +@property(atomic , assign)BOOL enableAccelerateUpload; // 局部http2冻结管理对象 @property(nonatomic, strong)QNUploadServerFreezeManager *partialHttp2Freezer; @property(nonatomic, strong)QNUploadServerFreezeManager *partialHttp3Freezer; +@property(nonatomic, strong)NSArray *accDomainHostList; +@property(nonatomic, strong)NSDictionary *accDomainDictionary; @property(nonatomic, strong)NSArray *domainHostList; @property(nonatomic, strong)NSDictionary *domainDictionary; @property(nonatomic, strong)NSArray *oldDomainHostList; @@ -182,8 +185,19 @@ @interface QNUploadDomainRegion() @end @implementation QNUploadDomainRegion +- (instancetype)initWithConfig:(QNConfiguration *)config { + if (self = [super init]) { + if (config) { + self.enableAccelerateUpload = config.accelerateUploading; + } + } + return self; +} + - (BOOL)isValid{ - return !self.isAllFrozen && (self.domainHostList.count > 0 || self.oldDomainHostList.count > 0); + return !self.isAllFrozen && + ((self.enableAccelerateUpload && self.accDomainHostList > 0) || + self.domainHostList.count > 0 || self.oldDomainHostList.count > 0); } - (void)setupRegionData:(QNZoneInfo *)zoneInfo{ @@ -196,6 +210,16 @@ - (void)setupRegionData:(QNZoneInfo *)zoneInfo{ self.http3Enabled = false; NSMutableArray *serverGroups = [NSMutableArray array]; + NSMutableArray *accDomainHostList = [NSMutableArray array]; + if (zoneInfo.acc_domains) { + [serverGroups addObjectsFromArray:zoneInfo.acc_domains]; + [accDomainHostList addObjectsFromArray:zoneInfo.acc_domains]; + } + self.accDomainHostList = accDomainHostList; + self.accDomainDictionary = [self createDomainDictionary:serverGroups]; + + + [serverGroups removeAllObjects]; NSMutableArray *domainHostList = [NSMutableArray array]; if (zoneInfo.domains) { [serverGroups addObjectsFromArray:zoneInfo.domains]; @@ -245,14 +269,44 @@ - (void)updateIpListFormHost:(NSString *)host { [self freezeServerIfNeed:responseInfo freezeServer:freezeServer]; - QNUploadServer *server = nil; - NSArray *hostList = self.domainHostList; - NSDictionary *domainInfo = self.domainDictionary; - if (requestState.isUseOldServer && self.oldDomainHostList.count > 0 && self.oldDomainDictionary.count > 0) { - hostList = self.oldDomainHostList; - domainInfo = self.oldDomainDictionary; + BOOL accelerate = YES; + @synchronized (self) { + if (self.enableAccelerateUpload && responseInfo.isTransferAccelerationConfigureError) { + self.enableAccelerateUpload = NO; + } + accelerate = self.enableAccelerateUpload; } + NSMutableArray *hostList = [NSMutableArray array]; + NSMutableDictionary *domainInfo = [NSMutableDictionary dictionary]; + if (requestState.isUseOldServer) { + if (self.oldDomainHostList.count > 0 && self.oldDomainDictionary.count > 0) { + [hostList addObjectsFromArray:self.oldDomainHostList]; + [domainInfo addEntriesFromDictionary:self.oldDomainDictionary]; + } + } else { + + // 优先使用 acc + if (accelerate && + self.accDomainHostList.count > 0 && + self.accDomainDictionary.count > 0) { + [hostList addObjectsFromArray:self.accDomainHostList]; + [domainInfo addEntriesFromDictionary:self.accDomainDictionary]; + } + + if (self.domainHostList.count > 0 && + self.domainDictionary.count > 0){ + [hostList addObjectsFromArray:self.domainHostList]; + [domainInfo addEntriesFromDictionary:self.domainDictionary]; + } + } + + if (hostList.count == 0 || domainInfo.count == 0) { + return nil; + } + + + QNUploadServer *server = nil; // 1. 优先使用http3 if (self.http3Enabled) { for (NSString *host in hostList) { diff --git a/QiniuSDK/Storage/QNBaseUpload.m b/QiniuSDK/Storage/QNBaseUpload.m index fe49dfca..8d8ef1af 100644 --- a/QiniuSDK/Storage/QNBaseUpload.m +++ b/QiniuSDK/Storage/QNBaseUpload.m @@ -106,11 +106,18 @@ - (void)run { [self.metrics start]; kQNWeakSelf; - [_config.zone preQuery:self.token on:^(int code, QNResponseInfo *responseInfo, QNUploadRegionRequestMetrics *metrics) { + [_config.zone query:self.config token:self.token on:^(QNResponseInfo * _Nullable responseInfo, QNUploadRegionRequestMetrics * _Nullable metrics, QNZonesInfo * _Nullable zonesInfo) { + kQNStrongSelf; self.metrics.ucQueryMetrics = metrics; - if (code == 0) { + if (responseInfo != nil && responseInfo.isOK && zonesInfo) { + if (![self setupRegions:zonesInfo]) { + responseInfo = [QNResponseInfo responseInfoWithInvalidArgument:[NSString stringWithFormat:@"setup regions host fail, origin response:%@", responseInfo]]; + [self complete:responseInfo response:responseInfo.responseDictionary]; + return; + } + int prepareCode = [self prepareToUpload]; if (prepareCode == 0) { [self startToUpload]; @@ -119,6 +126,11 @@ - (void)run { [self complete:responseInfoP response:responseInfoP.responseDictionary]; } } else { + if (responseInfo == nil) { + // responseInfo 一定会有值 + responseInfo = [QNResponseInfo responseInfoWithSDKInteriorError:@"can't get regions"]; + } + [self complete:responseInfo response:responseInfo.responseDictionary]; } }]; @@ -129,11 +141,7 @@ - (BOOL)reloadUploadInfo { } - (int)prepareToUpload{ - int ret = 0; - if (![self setupRegions]) { - ret = -1; - } - return ret; + return 0; } - (void)startToUpload{ @@ -205,11 +213,15 @@ - (void)complete:(QNResponseInfo *)info } //MARK:-- region -- (BOOL)setupRegions{ +- (BOOL)setupRegions:(QNZonesInfo *)zonesInfo{ + if (zonesInfo == nil || zonesInfo.zonesInfo == nil || zonesInfo.zonesInfo.count == 0) { + return NO; + } + NSMutableArray *defaultRegions = [NSMutableArray array]; - NSArray *zoneInfos = [self.config.zone getZonesInfoWithToken:self.token].zonesInfo; + NSArray *zoneInfos = zonesInfo.zonesInfo; for (QNZoneInfo *zoneInfo in zoneInfos) { - QNUploadDomainRegion *region = [[QNUploadDomainRegion alloc] init]; + QNUploadDomainRegion *region = [[QNUploadDomainRegion alloc] initWithConfig:self.config]; [region setupRegionData:zoneInfo]; if (region.isValid) { [defaultRegions addObject:region]; diff --git a/QiniuSDK/Storage/QNConfiguration.h b/QiniuSDK/Storage/QNConfiguration.h index 0726ca0d..e5cb7f9e 100644 --- a/QiniuSDK/Storage/QNConfiguration.h +++ b/QiniuSDK/Storage/QNConfiguration.h @@ -105,6 +105,11 @@ typedef void (^QNConfigurationBuilderBlock)(QNConfigurationBuilder *builder); */ @property (nonatomic, assign) BOOL allowBackupHost; +/** + * 是否允许使用加速域名,默认为 false + */ +@property (nonatomic, assign, readonly) BOOL accelerateUploading; + /** * 持久化记录接口,可以实现将记录持久化到文件,数据库等 */ @@ -219,7 +224,7 @@ typedef void (^QNConfigurationBuilderBlock)(QNConfigurationBuilder *builder); @property(nonatomic, copy) NSArray *dohIpv6Servers; /** - * Host全局冻结时间 单位:秒 默认:10 推荐范围:[5 ~ 30] + * Host全局冻结时间 单位:秒 默认:60 推荐范围:[30 ~ 120] * 当某个Host的上传失败后并且可能短时间无法恢复,会冻结该Host */ @property(nonatomic, assign)UInt32 globalHostFrozenTime; @@ -297,6 +302,12 @@ typedef void (^QNConfigurationBuilderBlock)(QNConfigurationBuilder *builder); */ @property (nonatomic, assign) BOOL allowBackupHost; +/** + * 是否允许使用加速域名,默认为 false + */ +@property (nonatomic, assign) BOOL accelerateUploading; + + /** * 是否开启并发分片上传,默认为NO */ diff --git a/QiniuSDK/Storage/QNConfiguration.m b/QiniuSDK/Storage/QNConfiguration.m index 54f38e8e..7262a62d 100644 --- a/QiniuSDK/Storage/QNConfiguration.m +++ b/QiniuSDK/Storage/QNConfiguration.m @@ -64,6 +64,7 @@ - (instancetype)initWithBuilder:(QNConfigurationBuilder *)builder { _useHttps = builder.useHttps; _allowBackupHost = builder.allowBackupHost; + _accelerateUploading = builder.accelerateUploading; } return self; @@ -110,7 +111,7 @@ - (void)setupData{ _udpDnsEnable = true; _defaultUdpDnsIpv4Servers = [self parseBase64Array:@"WyIyMjMuNS41LjUiLCAiMTE0LjExNC4xMTQuMTE0IiwgIjEuMS4xLjEiLCAiOC44LjguOCJd"]; - _globalHostFrozenTime = 10; + _globalHostFrozenTime = 60; _partialHostFrozenTime = 5*60; _connectCheckEnable = YES; @@ -280,6 +281,7 @@ - (instancetype)init { _useHttps = YES; _allowBackupHost = YES; + _accelerateUploading = NO; _useConcurrentResumeUpload = NO; _resumeUploadVersion = QNResumeUploadVersionV1; _concurrentTaskCount = 3; diff --git a/QiniuSDK/Storage/QNUploadManager.m b/QiniuSDK/Storage/QNUploadManager.m index b4d43369..bea8933d 100644 --- a/QiniuSDK/Storage/QNUploadManager.m +++ b/QiniuSDK/Storage/QNUploadManager.m @@ -135,7 +135,7 @@ - (void)putData:(NSData *)data } QNServerConfigMonitor.token = token; - [[QNTransactionManager shared] addDnsCheckAndPrefetchTransaction:self.config.zone token:t]; + [[QNTransactionManager shared] addDnsCheckAndPrefetchTransaction:self.config zone:self.config.zone token:t]; QNUpTaskCompletionHandler complete = ^(QNResponseInfo *info, NSString *key, QNUploadTaskMetrics *metrics, NSDictionary *resp) { [QNUploadManager complete:token @@ -339,7 +339,7 @@ - (void)putInternal:(id)source }; QNServerConfigMonitor.token = token; - [[QNTransactionManager shared] addDnsCheckAndPrefetchTransaction:self.config.zone token:t]; + [[QNTransactionManager shared] addDnsCheckAndPrefetchTransaction:self.config zone:self.config.zone token:t]; long long sourceSize = [source getSize]; if (sourceSize > 0 && sourceSize <= self.config.putThreshold) { diff --git a/QiniuSDKTests/QNTestConfig.h b/QiniuSDKTests/QNTestConfig.h index 347ff213..8edac2a5 100755 --- a/QiniuSDKTests/QNTestConfig.h +++ b/QiniuSDKTests/QNTestConfig.h @@ -7,15 +7,15 @@ // #import // 华东上传凭证 -static NSString *const token_z0 = @"dxVQk8gyk3WswArbNhdKIwmwibJ9nFsQhMNUmtIM:vOTAAiEjVihd1GsSHmxlAU8T6vM=:eyJzY29wZSI6ImtvZG8tcGhvbmUtem9uZTAtc3BhY2UiLCJkZWFkbGluZSI6MTcxNzk5OTUyNCwgInJldHVybkJvZHkiOiJ7XCJmb29cIjokKHg6Zm9vKSwgXCJiYXJcIjokKHg6YmFyKSwgXCJtaW1lVHlwZVwiOiQobWltZVR5cGUpLCBcImhhc2hcIjokKGV0YWcpLCBcImtleVwiOiQoa2V5KSwgXCJmbmFtZVwiOiQoZm5hbWUpLCBcImZzaXplXCI6JChmc2l6ZSl9In0="; +static NSString *const token_z0 = @"dxVQk8gyk3WswArbNhdKIwmwibJ9nFsQhMNUmtIM:xe5aSXbBWwhl4mM24N9I66BsSFA=:eyJzY29wZSI6ImtvZG8tcGhvbmUtem9uZTAtc3BhY2UiLCJkZWFkbGluZSI6MTcyMTk3NDg2NiwgInJldHVybkJvZHkiOiJ7XCJmb29cIjokKHg6Zm9vKSwgXCJiYXJcIjokKHg6YmFyKSwgXCJtaW1lVHlwZVwiOiQobWltZVR5cGUpLCBcImhhc2hcIjokKGV0YWcpLCBcImtleVwiOiQoa2V5KSwgXCJmbmFtZVwiOiQoZm5hbWUpLCBcImZzaXplXCI6JChmc2l6ZSl9In0="; // 华北上传凭证 -static NSString *const token_z1 = @"dxVQk8gyk3WswArbNhdKIwmwibJ9nFsQhMNUmtIM:UDefrplLAoWDjRc_WPCA8ent6x4=:eyJzY29wZSI6ImtvZG8tcGhvbmUtem9uZTEtc3BhY2UiLCJkZWFkbGluZSI6MTcxNzk5OTUyNCwgInJldHVybkJvZHkiOiJ7XCJmb29cIjokKHg6Zm9vKSwgXCJiYXJcIjokKHg6YmFyKSwgXCJtaW1lVHlwZVwiOiQobWltZVR5cGUpLCBcImhhc2hcIjokKGV0YWcpLCBcImtleVwiOiQoa2V5KSwgXCJmbmFtZVwiOiQoZm5hbWUpLCBcImZzaXplXCI6JChmc2l6ZSl9In0="; +static NSString *const token_z1 = @"dxVQk8gyk3WswArbNhdKIwmwibJ9nFsQhMNUmtIM:9M53e7PrF9cIACf7dJqL68ib3Xw=:eyJzY29wZSI6ImtvZG8tcGhvbmUtem9uZTEtc3BhY2UiLCJkZWFkbGluZSI6MTcyMTk3NDg2NiwgInJldHVybkJvZHkiOiJ7XCJmb29cIjokKHg6Zm9vKSwgXCJiYXJcIjokKHg6YmFyKSwgXCJtaW1lVHlwZVwiOiQobWltZVR5cGUpLCBcImhhc2hcIjokKGV0YWcpLCBcImtleVwiOiQoa2V5KSwgXCJmbmFtZVwiOiQoZm5hbWUpLCBcImZzaXplXCI6JChmc2l6ZSl9In0="; // 华南上传凭证 -static NSString *const token_z2 = @"dxVQk8gyk3WswArbNhdKIwmwibJ9nFsQhMNUmtIM:FVPdEs2eLOpONihNtlx3KB-3OIU=:eyJzY29wZSI6ImtvZG8tcGhvbmUtem9uZTItc3BhY2UiLCJkZWFkbGluZSI6MTcxNzk5OTUyNCwgInJldHVybkJvZHkiOiJ7XCJmb29cIjokKHg6Zm9vKSwgXCJiYXJcIjokKHg6YmFyKSwgXCJtaW1lVHlwZVwiOiQobWltZVR5cGUpLCBcImhhc2hcIjokKGV0YWcpLCBcImtleVwiOiQoa2V5KSwgXCJmbmFtZVwiOiQoZm5hbWUpLCBcImZzaXplXCI6JChmc2l6ZSl9In0="; +static NSString *const token_z2 = @"dxVQk8gyk3WswArbNhdKIwmwibJ9nFsQhMNUmtIM:aqT24g8L2l5m48piwNF07kzjaRM=:eyJzY29wZSI6ImtvZG8tcGhvbmUtem9uZTItc3BhY2UiLCJkZWFkbGluZSI6MTcyMTk3NDg2NiwgInJldHVybkJvZHkiOiJ7XCJmb29cIjokKHg6Zm9vKSwgXCJiYXJcIjokKHg6YmFyKSwgXCJtaW1lVHlwZVwiOiQobWltZVR5cGUpLCBcImhhc2hcIjokKGV0YWcpLCBcImtleVwiOiQoa2V5KSwgXCJmbmFtZVwiOiQoZm5hbWUpLCBcImZzaXplXCI6JChmc2l6ZSl9In0="; // 北美上传凭证 -static NSString *const token_na0 = @"dxVQk8gyk3WswArbNhdKIwmwibJ9nFsQhMNUmtIM:hvGD4q8SDrakpm_-ZRuMKfRxnk4=:eyJzY29wZSI6ImtvZG8tcGhvbmUtem9uZS1uYTAtc3BhY2UiLCJkZWFkbGluZSI6MTcxNzk5OTUyNCwgInJldHVybkJvZHkiOiJ7XCJmb29cIjokKHg6Zm9vKSwgXCJiYXJcIjokKHg6YmFyKSwgXCJtaW1lVHlwZVwiOiQobWltZVR5cGUpLCBcImhhc2hcIjokKGV0YWcpLCBcImtleVwiOiQoa2V5KSwgXCJmbmFtZVwiOiQoZm5hbWUpLCBcImZzaXplXCI6JChmc2l6ZSl9In0="; +static NSString *const token_na0 = @"dxVQk8gyk3WswArbNhdKIwmwibJ9nFsQhMNUmtIM:XhDgtrzmt9-rHxoFG5yuvs66zsA=:eyJzY29wZSI6ImtvZG8tcGhvbmUtem9uZS1uYTAtc3BhY2UiLCJkZWFkbGluZSI6MTcyMTk3NDg2NiwgInJldHVybkJvZHkiOiJ7XCJmb29cIjokKHg6Zm9vKSwgXCJiYXJcIjokKHg6YmFyKSwgXCJtaW1lVHlwZVwiOiQobWltZVR5cGUpLCBcImhhc2hcIjokKGV0YWcpLCBcImtleVwiOiQoa2V5KSwgXCJmbmFtZVwiOiQoZm5hbWUpLCBcImZzaXplXCI6JChmc2l6ZSl9In0="; // 东南亚上传凭证 -static NSString *const token_as0 = @"dxVQk8gyk3WswArbNhdKIwmwibJ9nFsQhMNUmtIM:SBE9cPtvW61dGpIFAtkCfZBGTIc=:eyJzY29wZSI6ImtvZG8tcGhvbmUtem9uZS1hczAtc3BhY2UiLCJkZWFkbGluZSI6MTcxNzk5OTUyNCwgInJldHVybkJvZHkiOiJ7XCJmb29cIjokKHg6Zm9vKSwgXCJiYXJcIjokKHg6YmFyKSwgXCJtaW1lVHlwZVwiOiQobWltZVR5cGUpLCBcImhhc2hcIjokKGV0YWcpLCBcImtleVwiOiQoa2V5KSwgXCJmbmFtZVwiOiQoZm5hbWUpLCBcImZzaXplXCI6JChmc2l6ZSl9In0="; +static NSString *const token_as0 = @"dxVQk8gyk3WswArbNhdKIwmwibJ9nFsQhMNUmtIM:XLUuoKOGRk3_ptDyqcYQ1ebTewg=:eyJzY29wZSI6ImtvZG8tcGhvbmUtem9uZS1hczAtc3BhY2UiLCJkZWFkbGluZSI6MTcyMTk3NDg2NiwgInJldHVybkJvZHkiOiJ7XCJmb29cIjokKHg6Zm9vKSwgXCJiYXJcIjokKHg6YmFyKSwgXCJtaW1lVHlwZVwiOiQobWltZVR5cGUpLCBcImhhc2hcIjokKGV0YWcpLCBcImtleVwiOiQoa2V5KSwgXCJmbmFtZVwiOiQoZm5hbWUpLCBcImZzaXplXCI6JChmc2l6ZSl9In0="; // 华北浙江2上传凭证 -static NSString *const token_cn_east_2 = @"dxVQk8gyk3WswArbNhdKIwmwibJ9nFsQhMNUmtIM:6VhwX-CEVo6tSFtJYuTQTStsfxc=:eyJzY29wZSI6ImtvZG8tcGhvbmUtY24tZWFzdC0yIiwiZGVhZGxpbmUiOjE3MTc5OTk1MjQsICJyZXR1cm5Cb2R5Ijoie1wiZm9vXCI6JCh4OmZvbyksIFwiYmFyXCI6JCh4OmJhciksIFwibWltZVR5cGVcIjokKG1pbWVUeXBlKSwgXCJoYXNoXCI6JChldGFnKSwgXCJrZXlcIjokKGtleSksIFwiZm5hbWVcIjokKGZuYW1lKSwgXCJmc2l6ZVwiOiQoZnNpemUpfSJ9"; -static NSString *const invalidBucketToken = @"dxVQk8gyk3WswArbNhdKIwmwibJ9nFsQhMNUmtIM:Dbn-bihW4WPkiIuIF0W_LYSKIZ0=:eyJzY29wZSI6InpvbmVfaW52YWxpZCIsImRlYWRsaW5lIjoxNzE3OTk5NTI0LCAicmV0dXJuQm9keSI6IntcImZvb1wiOiQoeDpmb28pLCBcImJhclwiOiQoeDpiYXIpLCBcIm1pbWVUeXBlXCI6JChtaW1lVHlwZSksIFwiaGFzaFwiOiQoZXRhZyksIFwia2V5XCI6JChrZXkpLCBcImZuYW1lXCI6JChmbmFtZSksIFwiZnNpemVcIjokKGZzaXplKX0ifQ=="; +static NSString *const token_cn_east_2 = @"dxVQk8gyk3WswArbNhdKIwmwibJ9nFsQhMNUmtIM:u2cQREILLeJb3iJjYuUJeQIH3NU=:eyJzY29wZSI6ImtvZG8tcGhvbmUtY24tZWFzdC0yIiwiZGVhZGxpbmUiOjE3MjE5NzQ4NjYsICJyZXR1cm5Cb2R5Ijoie1wiZm9vXCI6JCh4OmZvbyksIFwiYmFyXCI6JCh4OmJhciksIFwibWltZVR5cGVcIjokKG1pbWVUeXBlKSwgXCJoYXNoXCI6JChldGFnKSwgXCJrZXlcIjokKGtleSksIFwiZm5hbWVcIjokKGZuYW1lKSwgXCJmc2l6ZVwiOiQoZnNpemUpfSJ9"; +static NSString *const invalidBucketToken = @"dxVQk8gyk3WswArbNhdKIwmwibJ9nFsQhMNUmtIM:40uqxrlkWJNlN1aNVVAZX7u46Fk=:eyJzY29wZSI6InpvbmVfaW52YWxpZCIsImRlYWRsaW5lIjoxNzIxOTc0ODY2LCAicmV0dXJuQm9keSI6IntcImZvb1wiOiQoeDpmb28pLCBcImJhclwiOiQoeDpiYXIpLCBcIm1pbWVUeXBlXCI6JChtaW1lVHlwZSksIFwiaGFzaFwiOiQoZXRhZyksIFwia2V5XCI6JChrZXkpLCBcImZuYW1lXCI6JChmbmFtZSksIFwiZnNpemVcIjokKGZzaXplKX0ifQ==";