tencent cloud

Smart Media Hosting

Custom DNS

PDF
Modo Foco
Tamanho da Fonte
Última atualização: 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
}
}


Ajuda e Suporte

Esta página foi útil?

comentários