tencent cloud

Cloud Object Storage

Release Notes and Announcements
Release Notes
Announcements
Product Introduction
Overview
Features
Use Cases
Strengths
Concepts
Regions and Access Endpoints
Specifications and Limits
Service Regions and Service Providers
Billing
Billing Overview
Billing Method
Billable Items
Free Tier
Billing Examples
Viewing and Downloading Bill
Payment Overdue
FAQs
Getting Started
Console
Getting Started with COSBrowser
User Guide
Creating Request
Bucket
Object
Data Management
Batch Operation
Global Acceleration
Monitoring and Alarms
Operations Center
Data Processing
Content Moderation
Smart Toolbox
Data Processing Workflow
Application Integration
User Tools
Tool Overview
Installation and Configuration of Environment
COSBrowser
COSCLI (Beta)
COSCMD
COS Migration
FTP Server
Hadoop
COSDistCp
HDFS TO COS
GooseFS-Lite
Online Tools
Diagnostic Tool
Use Cases
Overview
Access Control and Permission Management
Performance Optimization
Accessing COS with AWS S3 SDK
Data Disaster Recovery and Backup
Domain Name Management Practice
Image Processing
Audio/Video Practices
Workflow
Direct Data Upload
Content Moderation
Data Security
Data Verification
Big Data Practice
COS Cost Optimization Solutions
Using COS in the Third-party Applications
Migration Guide
Migrating Local Data to COS
Migrating Data from Third-Party Cloud Storage Service to COS
Migrating Data from URL to COS
Migrating Data Within COS
Migrating Data Between HDFS and COS
Data Lake Storage
Cloud Native Datalake Storage
Metadata Accelerator
GooseFS
Data Processing
Data Processing Overview
Image Processing
Media Processing
Content Moderation
File Processing Service
File Preview
Troubleshooting
Obtaining RequestId
Slow Upload over Public Network
403 Error for COS Access
Resource Access Error
POST Object Common Exceptions
API Documentation
Introduction
Common Request Headers
Common Response Headers
Error Codes
Request Signature
Action List
Service APIs
Bucket APIs
Object APIs
Batch Operation APIs
Data Processing APIs
Job and Workflow
Content Moderation APIs
Cloud Antivirus API
SDK Documentation
SDK Overview
Preparations
Android SDK
C SDK
C++ SDK
.NET(C#) SDK
Flutter SDK
Go SDK
iOS SDK
Java SDK
JavaScript SDK
Node.js SDK
PHP SDK
Python SDK
React Native SDK
Mini Program SDK
Error Codes
Harmony SDK
Endpoint SDK Quality Optimization
Security and Compliance
Data Disaster Recovery
Data Security
Cloud Access Management
FAQs
Popular Questions
General
Billing
Domain Name Compliance Issues
Bucket Configuration
Domain Names and CDN
Object Operations
Logging and Monitoring
Permission Management
Data Processing
Data Security
Pre-signed URL Issues
SDKs
Tools
APIs
Agreements
Service Level Agreement
Privacy Policy
Data Processing And Security Agreement
Contact Us
Glossary

DNS Resolution Optimization

PDF
Mode fokus
Ukuran font
Terakhir diperbarui: 2026-02-05 11:09:19

Introduction

This article describes how to access COS using the HTTPDNS service via the COS SDK.

Feature Overview

The mobile COS SDK uses LocalDNS by default. During DNS resolution, issues such as abnormal resolution, domain hijacking, and cross-network access may occur. By integrating HTTPDNS, these problems can be avoided, addressing challenges caused by abnormal domain resolution in mobile internet services.
Therefore, if you are sensitive to the success rate and latency of COS operations such as uploads and downloads, you can use the HTTPDNS service to access COS.

Prerequisites

Before performing the operations, you need to activate the HTTPDNS service and add the corresponding COS domain names. The detailed steps are as follows:
1. Go to the HTTPDNS console to activate it. For specific operations, see activate HTTPDNS.
2. In the HTTPDNS console, add the COS primary domain myqcloud.com. For specific operations, see add domain.
3. Obtain HTTPDNS configuration information. For specific instructions, see configuration information instructions.
Note:
Although HTTPDNS offers a certain free quota, exceeding it will incur fees. For details, see the HTTPDNS pricing.

Operation Steps

Step 1: HTTPDNS Configuration

Please refer to the HTTPDNS SDK configuration (Android, iOS) for the integration and configuration of the HTTPDNS SDK. The COS SDK automatically configures the SDK access business method by default. You do not need to concern yourself with the SDK access business method (Android, iOS) during the configuration of the HTTPDNS SDK.

Step 2: COS SDK Integration

Android
iOS
1. By initializing the COS Service, obtain the CosXmlService.
2. Integrate HTTPDNS via the addCustomerDNSFetch method of CosXmlService.
// Obtain the CosXmlService
cosXmlService.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;
});
1. To integrate HTTPDNS, first add the HTTPDNS library dependency in the Podfile file.
pod 'QCloudCore/DNSLoader' // DNSLoader module, which internally encapsulates Tencent HTTPDNS
2. Import the header file and define the member variable dnsloader.
#import "QCloudHTTPDNSLoader.h"

@property (nonatomic,strong)QCloudHTTPDNSLoader * dnsloader;
3. Configure HTTPDNS parameters by sequentially assigning the configuration parameters generated in Step 1 to their corresponding fields.
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 IP
config.dnsId = 1; // Authorization ID, applied for via the Tencent Cloud console and sent via email, used for domain name resolution authentication.
config.dnsKey = @"*******"; // des key
config.encryptType = QCloudHttpDnsEncryptTypeDES; // Controls the encryption type
config.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;

Example Projects

Bantuan dan Dukungan

Apakah halaman ini membantu?

masukan