All Products
Search
Document Center

HTTPDNS:Common data structure operations

Last Updated:Dec 15, 2025

Background information

This topic describes the data structures and API operations commonly used in HTTPDNS SDK for Android.

HTTPDNSResult

A data class representing the results of domain name resolution.

getHost

Queries a domain name.

Operation definition

String getHost()

Version introduced

1.3.2

Category

HTTPDNSResult

Response description

Type

Description

String

The domain name.

getIps

Queries an IPv4 address to which a domain name is resolved.

Operation definition

String[] getIps()

Version introduced

1.3.2

Category

HTTPDNSResult

Response description

Type

Description

String []

The IPv4 address to which a domain name is resolved.

getIpv6s

Queries an IPv6 address to which a domain name is resolved.

Operation definition

String[] getIpv6s()

Version introduced

2.0.2

Category

HTTPDNSResult

Response description

Type

Description

String []

The IPv6 address to which a domain name is resolved.

getExtras

Queries additional parameters returned by domain name resolution, which are only available in custom resolution.

Operation definition

Map<String, String> getExtras()

Version introduced

1.3.2

Category

HTTPDNSResult

Response description

Type

Description

Map<String, String>

The additional parameters returned by domain name resolution.

isExpired

Checks whether the resolution result of a domain name expires. Expiration is calculated based on the time when the resolution result was obtained and the time to live (TTL) configured for the domain name.

Operation definition

boolean isExpired()

Version introduced

2.0.2

Category

HTTPDNSResult

Response description

Type

Description

boolean

  • True, Expired

  • false: Not expired

HttpDnsCallback

A callback operation used in asynchronous and custom domain name resolution.

onHttpDnsCompleted

A function called after domain name resolution is complete, which is triggered both on success and failure.

Operation definition

void onHttpDnsCompleted(HTTPDNSResult result)

Version introduced

2.4.0

Associated Interface

HttpDnsCallback

Parameters

Parameter

Type

Required

Description

result

HTTPDNSResult

Yes

HTTPDNSResult

CacheTtlChanger

Customizes the TTL of domain name resolution results.

changeCacheTtl

Customizes the TTL.

Interface Definition

int changeCacheTtl(String host, RequestIpType type, int ttl)

Version introduced

2.3.0

API

CacheTtlChanger

Parameters

Parameter

Type

Required

Description

host

String

Yes

The domain name.

type

RequestIpType

Yes

The type of the IP address.

ttl

int

Yes

The original TTL.

Response description

Type

Description

int

The custom TTL. If you do not need to customize the TTL, return the original TTL.

NotUseHttpDnsFilter

Excludes specific domain names from HTTPDNS resolution.

notUseHttpDns

Configures a domain name that is not resolved using HTTPDNS.

Interface Definition

boolean notUseHttpDns(String host)

Version introduced

2.4.0

API

NotUseHttpDnsFilter

Parameters

Parameter

Type

Required

Description

host

String

Yes

The domain name.

Response description

Type

Description

boolean

  • true: filters the current domain name. The current domain name is not resolved by HTTPDNS.

  • false: does not filter the current domain name. The current domain name is resolved using HTTPDNS.

ILogger

The logging operation.

log

The logging method.

Operation definition

void log(String msg)

Version introduced

1.3.2

Associated Interface

ILogger

Parameters

Parameter

Type

Required

Description

msg

String

Yes

The log.

Region

The value is of the enumerated data type.

Version introduced

2.4.2

DEFAULT

A region in the Chinese mainland. This is the default value.

HK

China (Hong Kong).

SG

Singapore.

DE

Germany.

US

United States.