All Products
Search
Document Center

HTTPDNS:Common data structure operations

Last Updated:Jun 17, 2026

Background information

HTTPDNS SDK for Android provides the following data structures and API operations for domain name resolution.

HTTPDNSResult

The data class for domain name resolution results.

getHost

Returns the domain name.

Operation definition

String getHost()

Version introduced

1.3.2

Category

HTTPDNSResult

Response description

Type

Description

String

The domain name.

getIps

Returns the resolved IPv4 addresses for a domain name.

Operation definition

String[] getIps()

Version introduced

1.3.2

Category

HTTPDNSResult

Response description

Type

Description

String []

The resolved IPv4 addresses.

getIpv6s

Returns the resolved IPv6 addresses for a domain name.

Operation definition

String[] getIpv6s()

Version introduced

2.0.2

Category

HTTPDNSResult

Response description

Type

Description

String []

The resolved IPv6 addresses.

getExtras

Returns additional parameters from domain name resolution. Available only 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 from domain name resolution.

isExpired

Checks whether the resolution result has expired, based on the time the result was obtained and the 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

The callback interface for asynchronous and custom domain name resolution.

onHttpDnsCompleted

Called when domain name resolution completes, regardless of success or 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 resolution results.

changeCacheTtl

Sets a custom TTL value.

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

Filters specific domain names from HTTPDNS resolution.

notUseHttpDns

Specifies a domain name to exclude from HTTPDNS resolution.

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: excludes the domain name from HTTPDNS resolution.

  • false: keeps the domain name in HTTPDNS resolution.

HttpDnsLogger

The logging interface.

log

Writes a log entry at the specified level.

Operation definition

void log(int level, String msg)

Version introduced

2.6.9

Associated Interface

HttpDnsLogger

Parameters

Parameter

Type

Required

Description

level

int

Yes

The log level. Valid values: Log.DEBUG, Log.INFO, Log.WARN, and Log.ERROR.

msg

String

Yes

The log message.

Region

An enumeration of supported regions.

Version introduced

2.4.2

DEFAULT

Chinese mainland. This is the default value.

HK

China (Hong Kong).

SG

Singapore.

DE

Germany.

US

United States.