带阿里标识的版本
This commit is contained in:
@@ -52,7 +52,7 @@
|
||||
@property (nonatomic, setter=setV6TTL:, getter=getV6TTL) int64_t v6ttl;
|
||||
@property (nonatomic, assign) int64_t lastIPv6LookupTime;
|
||||
|
||||
// 用来标记该域名为配置v4记录或v6记录的情况,避免如双栈网络下因为某个协议查不到record需要重复请求
|
||||
// 用来标记该域名为配置v4记录或v6记录的情况,避免如双栈网络下因为某个协议查不到record需要重复请<EFBFBD><EFBFBD>?
|
||||
// 这个信息不用持久化,一次APP启动周期内使用是合适的
|
||||
@property (nonatomic, assign) BOOL hasNoIpv4Record;
|
||||
@property (nonatomic, assign) BOOL hasNoIpv6Record;
|
||||
@@ -71,8 +71,8 @@
|
||||
+ (instancetype)fromDBRecord:(HttpdnsHostRecord *)IPRecord;
|
||||
|
||||
/**
|
||||
* 将当前对象转换为数据库记录对象
|
||||
* @return 数据库记录对象
|
||||
* 将当前对象转换为数据库记录对<EFBFBD><EFBFBD>?
|
||||
* @return 数据库记录对<EFBFBD><EFBFBD>?
|
||||
*/
|
||||
- (HttpdnsHostRecord *)toDBRecord;
|
||||
|
||||
@@ -83,7 +83,7 @@
|
||||
/**
|
||||
* 更新指定IP的connectedRT值并重新排序IP列表
|
||||
* @param ip 需要更新的IP地址
|
||||
* @param connectedRT 检测到的RT值,-1表示不可达
|
||||
* @param connectedRT 检测到的RT值,-1表示不可<EFBFBD><EFBFBD>?
|
||||
*/
|
||||
- (void)updateConnectedRT:(NSInteger)connectedRT forIP:(NSString *)ip;
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
|
||||
- (instancetype)init {
|
||||
if (self = [super init]) {
|
||||
// 初始化connectedRT为最大整数值
|
||||
// 初始化connectedRT为最大整数<EFBFBD><EFBFBD>?
|
||||
self.connectedRT = NSIntegerMax;
|
||||
}
|
||||
return self;
|
||||
@@ -129,13 +129,13 @@
|
||||
|
||||
- (BOOL)isIpEmptyUnderQueryIpType:(HttpdnsQueryIPType)queryType {
|
||||
if (queryType & HttpdnsQueryIPTypeIpv4) {
|
||||
// 注意,_hasNoIpv4Record为true时,说明域名没有配置ipv4ip,不是需要去请求的情况
|
||||
// 注意,_hasNoIpv4Record为true时,说明域名没有配置ipv4ip,不是需要去请求的情<EFBFBD><EFBFBD>?
|
||||
if ([HttpdnsUtil isEmptyArray:[self getV4Ips]] && !_hasNoIpv4Record) {
|
||||
return YES;
|
||||
}
|
||||
|
||||
} else if (queryType & HttpdnsQueryIPTypeIpv6 && !_hasNoIpv6Record) {
|
||||
// 注意,_hasNoIpv6Record为true时,说明域名没有配置ipv6ip,不是需要去请求的情况
|
||||
// 注意,_hasNoIpv6Record为true时,说明域名没有配置ipv6ip,不是需要去请求的情<EFBFBD><EFBFBD>?
|
||||
if ([HttpdnsUtil isEmptyArray:[self getV6Ips]] && !_hasNoIpv6Record) {
|
||||
return YES;
|
||||
}
|
||||
@@ -202,14 +202,14 @@
|
||||
}
|
||||
|
||||
- (HttpdnsHostRecord *)toDBRecord {
|
||||
// 将IP对象数组转换为IP字符串数组
|
||||
// 将IP对象数组转换为IP字符串数<EFBFBD><EFBFBD>?
|
||||
NSArray<NSString *> *v4IpStrings = [self getV4IpStrings];
|
||||
NSArray<NSString *> *v6IpStrings = [self getV6IpStrings];
|
||||
|
||||
// 创建当前时间作为modifyAt
|
||||
NSDate *currentDate = [NSDate date];
|
||||
|
||||
// 使用hostName作为cacheKey,保持与fromDBRecord方法的一致性
|
||||
// 使用hostName作为cacheKey,保持与fromDBRecord方法的一致<EFBFBD><EFBFBD>?
|
||||
return [[HttpdnsHostRecord alloc] initWithId:0 // 数据库会自动分配ID
|
||||
cacheKey:self.cacheKey
|
||||
hostName:self.hostName
|
||||
@@ -271,17 +271,17 @@
|
||||
return;
|
||||
}
|
||||
|
||||
// 根据connectedRT值对IP列表进行排序,-1值放在最后
|
||||
// 根据connectedRT值对IP列表进行排序<EFBFBD><EFBFBD>?1值放在最<EFBFBD><EFBFBD>?
|
||||
[mutableIpObjects sortUsingComparator:^NSComparisonResult(HttpdnsIpObject *obj1, HttpdnsIpObject *obj2) {
|
||||
// 如果obj1的connectedRT为-1,将其排在后面
|
||||
// 如果obj1的connectedRT<EFBFBD><EFBFBD>?1,将其排在后<EFBFBD><EFBFBD>?
|
||||
if (obj1.connectedRT == -1) {
|
||||
return NSOrderedDescending;
|
||||
}
|
||||
// 如果obj2的connectedRT为-1,将其排在后面
|
||||
// 如果obj2的connectedRT<EFBFBD><EFBFBD>?1,将其排在后<EFBFBD><EFBFBD>?
|
||||
if (obj2.connectedRT == -1) {
|
||||
return NSOrderedAscending;
|
||||
}
|
||||
// 否则按照connectedRT值从小到大排序
|
||||
// 否则按照connectedRT值从小到大排<EFBFBD><EFBFBD>?
|
||||
return obj1.connectedRT > obj2.connectedRT ? NSOrderedDescending : (obj1.connectedRT < obj2.connectedRT ? NSOrderedAscending : NSOrderedSame);
|
||||
}];
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
//
|
||||
// HttpdnsHostRecord.h
|
||||
// AlicloudHttpDNS
|
||||
// TrustHttpDNS
|
||||
//
|
||||
// Created by ElonChan(地风) on 2017/5/3.
|
||||
// Copyright © 2017年 alibaba-inc.com. All rights reserved.
|
||||
// Copyright © 2017<EFBFBD><EFBFBD>?trustapp.com. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
//
|
||||
// HttpdnsHostRecord.m
|
||||
// AlicloudHttpDNS
|
||||
// TrustHttpDNS
|
||||
//
|
||||
// Created by ElonChan(地风) on 2017/5/3.
|
||||
// Copyright © 2017年 alibaba-inc.com. All rights reserved.
|
||||
// Copyright © 2017<EFBFBD><EFBFBD>?trustapp.com. All rights reserved.
|
||||
//
|
||||
|
||||
#import "HttpdnsHostRecord.h"
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
//
|
||||
// HttpdnsRequest.h
|
||||
// AlicloudHttpDNS
|
||||
// TrustHttpDNS
|
||||
//
|
||||
// Created by xuyecan on 2024/5/19.
|
||||
// Copyright © 2024 alibaba-inc.com. All rights reserved.
|
||||
// Copyright © 2024 trustapp.com. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
#ifndef ALICLOUDHTTPDNSQUERYIPTYPE
|
||||
#define ALICLOUDHTTPDNSQUERYIPTYPE
|
||||
#ifndef TrustHTTPDNSQUERYIPTYPE
|
||||
#define TrustHTTPDNSQUERYIPTYPE
|
||||
|
||||
typedef enum {
|
||||
AlicloudHttpDNS_IPTypeV4 = 0, //ipv4
|
||||
AlicloudHttpDNS_IPTypeV6 = 1, //ipv6
|
||||
AlicloudHttpDNS_IPTypeV64 = 2, //ipv4 + ipv6
|
||||
} AlicloudHttpDNS_IPType;
|
||||
TrustHttpDNS_IPTypeV4 = 0, //ipv4
|
||||
TrustHttpDNS_IPTypeV6 = 1, //ipv6
|
||||
TrustHttpDNS_IPTypeV64 = 2, //ipv4 + ipv6
|
||||
} TrustHttpDNS_IPType;
|
||||
|
||||
typedef NS_OPTIONS(NSUInteger, HttpdnsQueryIPType) {
|
||||
HttpdnsQueryIPTypeAuto NS_SWIFT_NAME(auto) = 0,
|
||||
@@ -33,15 +33,15 @@ typedef NS_OPTIONS(NSUInteger, HttpdnsQueryIPType) {
|
||||
/// 需要解析的域名
|
||||
@property (nonatomic, copy) NSString *host;
|
||||
|
||||
/// 解析超时时间,对于同步接口,即为最大等待时间,对于异步接口,即为最大等待回调时间
|
||||
/// 默认值2秒,取值必须在0.5秒 - 5秒之间
|
||||
/// 解析超时时间,对于同步接口,即为最大等待时间,对于异步接口,即为最大等待回调时<EFBFBD><EFBFBD>?
|
||||
/// 默认<EFBFBD><EFBFBD>?秒,取值必须在0.5<EFBFBD><EFBFBD>?- 5秒之<EFBFBD><EFBFBD>?
|
||||
@property (nonatomic, assign) double resolveTimeoutInSecond;
|
||||
|
||||
/// 查询IP类型
|
||||
/// 默认为HttpdnsQueryIPTypeAuto,此类型下,SDK至少会请求解析ipv4地址,若判断到当前网络环境支持ipv6,则还会请求解析ipv6地址
|
||||
/// HttpdnsQueryIPTypeIpv4,只请求解析ipv4
|
||||
/// HttpdnsQueryIPTypeIpv6,只请求解析ipv6
|
||||
/// HttpdnsQueryIPTypeBoth,不管当前网络环境是什么,会尝试同时请求解析ipv4地址和ipv6地址,这种用法,通常需要拿到结果之后自行判断网络环境决定使用哪个结果
|
||||
/// HttpdnsQueryIPTypeBoth,不管当前网络环境是什么,会尝试同时请求解析ipv4地址和ipv6地址,这种用法,通常需要拿到结果之后自行判断网络环境决定使用哪个结<EFBFBD><EFBFBD>?
|
||||
@property (nonatomic, assign) HttpdnsQueryIPType queryIpType;
|
||||
|
||||
/// SDNS参数,针对软件自定义解析场景使用
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
//
|
||||
// HttpdnsRequest.m
|
||||
// AlicloudHttpDNS
|
||||
// TrustHttpDNS
|
||||
//
|
||||
// Created by xuyecan on 2024/5/19.
|
||||
// Copyright © 2024 alibaba-inc.com. All rights reserved.
|
||||
// Copyright © 2024 trustapp.com. All rights reserved.
|
||||
//
|
||||
|
||||
#import "HttpdnsRequest.h"
|
||||
@@ -65,7 +65,7 @@ static double const RESOLVE_HOST_MAX_TIMEOUT_IN_SEC = 5;
|
||||
} else if (_resolveTimeoutInSecond > RESOLVE_HOST_MAX_TIMEOUT_IN_SEC) {
|
||||
_resolveTimeoutInSecond = RESOLVE_HOST_MAX_TIMEOUT_IN_SEC;
|
||||
} else {
|
||||
// 在范围内的正常值
|
||||
// 在范围内的正常<EFBFBD><EFBFBD>?
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
//
|
||||
// HttpdnsRequest_Internal.h
|
||||
// AlicloudHttpDNS
|
||||
// TrustHttpDNS
|
||||
//
|
||||
// Created by xuyecan on 2024/6/19.
|
||||
// Copyright © 2024 alibaba-inc.com. All rights reserved.
|
||||
// Copyright © 2024 trustapp.com. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef HttpdnsRequest_Internal_h
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
//
|
||||
// HttpdnsResult.h
|
||||
// AlicloudHttpDNS
|
||||
// TrustHttpDNS
|
||||
//
|
||||
// Created by xuyecan on 2024/5/15.
|
||||
// Copyright © 2024 alibaba-inc.com. All rights reserved.
|
||||
// Copyright © 2024 trustapp.com. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
//
|
||||
// HttpdnsResult.m
|
||||
// AlicloudHttpDNS
|
||||
// TrustHttpDNS
|
||||
//
|
||||
// Created by xuyecan on 2024/5/15.
|
||||
// Copyright © 2024 alibaba-inc.com. All rights reserved.
|
||||
// Copyright © 2024 trustapp.com. All rights reserved.
|
||||
//
|
||||
|
||||
#import "HttpdnsResult.h"
|
||||
|
||||
Reference in New Issue
Block a user