sdk final

This commit is contained in:
robin
2026-03-05 16:53:59 +08:00
parent a10f3f3740
commit 491ade1bc3
44 changed files with 1595 additions and 960 deletions

View File

@@ -37,8 +37,8 @@ static int const MAX_UPDATE_RETRY_COUNT = 2;
@interface HttpdnsScheduleCenter ()
// v4v6<EFBFBD><EFBFBD>?<EFBFBD><EFBFBD>?
// <EFBFBD><EFBFBD>?
// v4v6??
// ?
@property (nonatomic, assign) int currentActiveServiceHostIndex;
@property (nonatomic, assign) int currentActiveUpdateHostIndex;
@@ -85,7 +85,7 @@ static int const MAX_UPDATE_RETRY_COUNT = 2;
_scheduleCenterResultPath = [[HttpdnsPersistenceUtils scheduleCenterResultDirectory]
stringByAppendingPathComponent:kScheduleRegionConfigLocalCacheFileName];
// <EFBFBD><EFBFBD>?
// ?
_lastScheduleCenterConnectDate = [NSDate dateWithTimeIntervalSinceNow:(- 24 * 60 * 60)];
}
return self;
@@ -93,11 +93,11 @@ static int const MAX_UPDATE_RETRY_COUNT = 2;
- (void)initRegion:(NSString *)region {
if (![[HttpdnsRegionConfigLoader getAvailableRegionList] containsObject:region]) {
region = NEW_HTTPDNS_DEFAULT_REGION_KEY;
region = Trust_HTTPDNS_DEFAULT_REGION_KEY;
}
// region<EFBFBD><EFBFBD>?
// region<EFBFBD><EFBFBD>?
// region?
// region?
[self initServerListByRegion:region];
//
@@ -112,7 +112,7 @@ static int const MAX_UPDATE_RETRY_COUNT = 2;
self.currentActiveUpdateHostIndex = 0;
});
// region<EFBFBD><EFBFBD>?
// region?
[self asyncUpdateRegionScheduleConfig];
}
@@ -125,7 +125,7 @@ static int const MAX_UPDATE_RETRY_COUNT = 2;
}
NSDictionary *scheduleCenterResult = (NSDictionary *)obj;
// NSNumber/NSStringNSNull<EFBFBD><EFBFBD>?
// NSNumber/NSStringNSNull?
id ts = [scheduleCenterResult objectForKey:kLastUpdateUnixTimestampKey];
if ([ts respondsToSelector:@selector(doubleValue)]) {
NSDate *lastUpdateDate = [NSDate dateWithTimeIntervalSince1970:[ts doubleValue]];
@@ -135,7 +135,7 @@ static int const MAX_UPDATE_RETRY_COUNT = 2;
});
}
// <EFBFBD><EFBFBD>?
// ?
- (void)asyncUpdateRegionConfigAfterAtLeast:(NSTimeInterval)interval {
__block BOOL shouldUpdate = NO;
dispatch_sync(_scheduleConfigLocalOperationQueue, ^{
@@ -170,10 +170,10 @@ static int const MAX_UPDATE_RETRY_COUNT = 2;
if (error || !scheduleCenterResult) {
HttpdnsLogDebug("Update region config failed, error: %@", error);
// <EFBFBD><EFBFBD>?
// ?
[self rotateUpdateServerHost];
// 3<EFBFBD><EFBFBD>?
// 3?
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)((retryCount + 1) * NSEC_PER_SEC)), self->_scheduleFetchConfigAsyncQueue, ^{
[self asyncUpdateRegionScheduleConfigAtRetry:retryCount + 1];
});
@@ -192,8 +192,8 @@ static int const MAX_UPDATE_RETRY_COUNT = 2;
}
- (void)updateRegionConfig:(NSDictionary *)scheduleCenterResult {
NSArray *v4Result = [scheduleCenterResult objectForKey:kNewHttpdnsRegionConfigV4HostKey];
NSArray *v6Result = [scheduleCenterResult objectForKey:kNewHttpdnsRegionConfigV6HostKey];
NSArray *v4Result = [scheduleCenterResult objectForKey:kTrustHttpdnsRegionConfigV4HostKey];
NSArray *v6Result = [scheduleCenterResult objectForKey:kTrustHttpdnsRegionConfigV6HostKey];
dispatch_sync(_scheduleConfigLocalOperationQueue, ^{
HttpdnsRegionConfigLoader *regionConfigLoader = [HttpdnsRegionConfigLoader sharedInstance];
@@ -260,7 +260,7 @@ static int const MAX_UPDATE_RETRY_COUNT = 2;
});
if (timeToUpdate) {
// server<EFBFBD><EFBFBD>?<EFBFBD><EFBFBD>?0
// server??0
[self asyncUpdateRegionConfigAfterAtLeast:30];
}
}
@@ -286,8 +286,8 @@ static int const MAX_UPDATE_RETRY_COUNT = 2;
}
- (NSString *)currentActiveServiceServerV4Host {
// <EFBFBD><EFBFBD>?
// httpdns<EFBFBD><EFBFBD>?
// ?
// httpdns?
[self asyncUpdateRegionConfigAfterAtLeast:(24 * 60 * 60)];
// HTTPDNS_DEBUG_V4_SERVICE_IP