// Obtain the CosXmlServicecosXmlService.addCustomerDNSFetch(hostname -> {String ips = MSDKDnsResolver.getInstance().getAddrByName(hostname);String[] ipArr = ips.split(";");if (0 == ipArr.length) {return Collections.emptyList();}List<InetAddress> inetAddressList = new ArrayList<>(ipArr.length);for (String ip : ipArr) {if ("0".equals(ip)) {continue;}try {InetAddress inetAddress = InetAddress.getByName(ip);inetAddressList.add(inetAddress);} catch (UnknownHostException ignored) {}}return inetAddressList;});
pod 'QCloudCore/DNSLoader' // DNSLoader module, which internally encapsulates Tencent HTTPDNS
#import "QCloudHTTPDNSLoader.h"@property (nonatomic,strong)QCloudHTTPDNSLoader * dnsloader;
QCloudDnsConfig config;config.appId = @"******"; // Optional. App ID, obtained from the Tencent Cloud console, used for Beacon data reporting (this parameter is invalid if Beacon is not integrated)config.dnsIp = @"0.0.0.0"; // HTTPDNS server IPconfig.dnsId = 1; // Authorization ID, applied for via the Tencent Cloud console and sent via email, used for domain name resolution authentication.config.dnsKey = @"*******"; // des keyconfig.encryptType = QCloudHttpDnsEncryptTypeDES; // Controls the encryption typeconfig.debug = YES; // Whether to enable debug logs. YES: enabled, NO: disabled. It is recommended to enable during the joint debugging phase and disable before the official launch.config.timeout = 5000; // Optional. Timeout period, unit: ms. If set to 0, it defaults to 2000ms.self.dnsloader = [[QCloudHTTPDNSLoader alloc] initWithConfig:config];[QCloudHttpDNS shareDNS].delegate = self.dnsloader;
Feedback