tencent cloud

Smart Media Hosting

Custom DNS

PDF
포커스 모드
폰트 크기
마지막 업데이트 시간: 2026-01-07 11:03:12

Introduction

This document provides instructions on SMH SDK configuration customization for DNS.

Custom DNS

It is generally used to integrate HTTP DNS, implement domain hijacking prevention, and accelerate DNS resolution.
Configure DNS through the static member `dnsFetch` of `SMHService`.
SMHService.dnsFetch = QCloudHttpClient.QCloudDnsFetch { hostname ->
//Get the IP list corresponding to the hostname
//return corresponding InetAddress list
return inetAddressList;
}
}

Integrating HTTP DNS

The following uses Tencent Cloud HTTP DNS as an example.
1. Initialize the Tencent Cloud HTTP DNS SDK. Please refer to Tencent Cloud HTTP DNS official documentation.
2. Configure Tencent Cloud HTTP DNS via SMHService.dnsFetch to implement SMH SDK integration with HTTP DNS.
SMHService.dnsFetch = QCloudHttpClient.QCloudDnsFetch { hostname ->
val ips = MSDKDnsResolver.getInstance().getAddrByName(hostname)
val ipArr = ips.split(";")
if (ipArr.isEmpty()) {
emptyList<InetAddress>()
} else {
val inetAddressList: MutableList<InetAddress> = ArrayList(ipArr.size)
for (ip in ipArr) {
if ("0" == ip) {
continue
}
try {
val inetAddress = InetAddress.getByName(ip)
inetAddressList.add(inetAddress)
} catch (ignored: UnknownHostException) {
}
}
inetAddressList
}
}


도움말 및 지원

문제 해결에 도움이 되었나요?

피드백