feat: sync httpdns sdk/platform updates without large binaries

This commit is contained in:
robin
2026-03-04 17:59:14 +08:00
parent 853897a6f8
commit 532891fad0
700 changed files with 6096 additions and 2712 deletions

View File

@@ -0,0 +1,64 @@
//
// HttpdnsRequest.h
// TrustHttpDNS
//
// Created by xuyecan on 2024/5/19.
// Copyright © 2024 trustapp.com. All rights reserved.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
#ifndef TrustHTTPDNSQUERYIPTYPE
#define TrustHTTPDNSQUERYIPTYPE
typedef enum {
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,
HttpdnsQueryIPTypeIpv4 = 1 << 0,
HttpdnsQueryIPTypeIpv6 = 1 << 1,
HttpdnsQueryIPTypeBoth = HttpdnsQueryIPTypeIpv4 | HttpdnsQueryIPTypeIpv6,
};
#endif
@interface HttpdnsRequest : NSObject
/// 需要解析的域名
@property (nonatomic, copy) NSString *host;
/// 解析超时时间对于同步接口即为最大等待时间对于异步接口即为最大等待回调时<E8B083><E697B6>?
/// 默认<E9BB98><E8AEA4>?秒取值必须在0.5<EFBFBD><EFBFBD>?- 5秒之<E7A792><E4B98B>?
@property (nonatomic, assign) double resolveTimeoutInSecond;
/// 查询IP类型
/// 默认为HttpdnsQueryIPTypeAuto此类型下SDK至少会请求解析ipv4地址若判断到当前网络环境支持ipv6则还会请求解析ipv6地址
/// HttpdnsQueryIPTypeIpv4只请求解析ipv4
/// HttpdnsQueryIPTypeIpv6只请求解析ipv6
/// HttpdnsQueryIPTypeBoth不管当前网络环境是什么会尝试同时请求解析ipv4地址和ipv6地址这种用法通常需要拿到结果之后自行判断网络环境决定使用哪个结<E4B8AA><E7BB93>?
@property (nonatomic, assign) HttpdnsQueryIPType queryIpType;
/// SDNS参数针对软件自定义解析场景使用
@property (nonatomic, copy, nullable) NSDictionary<NSString *, NSString *> *sdnsParams;
/// 缓存Key针对软件自定义解析场景使用
@property (nonatomic, copy, nullable) NSString *cacheKey;
/// 请求所属的账号ID用于在多账号场景下定位实例
@property (nonatomic, assign) NSInteger accountId;
- (instancetype)initWithHost:(NSString *)host queryIpType:(HttpdnsQueryIPType)queryIpType;
- (instancetype)initWithHost:(NSString *)host queryIpType:(HttpdnsQueryIPType)queryIpType sdnsParams:(nullable NSDictionary<NSString *, NSString *> *)sdnsParams cacheKey:(nullable NSString *)cacheKey;
- (instancetype)initWithHost:(NSString *)host queryIpType:(HttpdnsQueryIPType)queryIpType sdnsParams:(nullable NSDictionary<NSString *, NSString *> *)sdnsParams cacheKey:(nullable NSString *)cacheKey resolveTimeout:(double)timeoutInSecond;
@end
NS_ASSUME_NONNULL_END