HttpsRecord


public class HttpsRecord
extends Object

java.lang.Object
   ↳ android.net.dns.HttpsRecord


Class to represent a HTTPS DNS response record.

See RFC 9460 for more details on the expected structure and contents.

Summary

Constants

String DEFAULT_ALPN_ID

Public methods

List<String> getAlpnIds()

Returns the list of Application-Layer Protocol Negotiation (ALPN) protocol identifiers contained in the HTTPS record.

EchConfigList getEchConfigList()

Returns the EchConfigList contained in the HTTPS record, if present.

List<InetAddress> getIpAddressHints()

Returns the list of IP hints (IPv4 & IPv6) contained in the HTTPS record.

String getOwnerName()

Returns the owner name of the HTTPS record.

int getPort()

Returns the port of the HTTPS record, defaulting to 443 if not specified in the record.

int getPriority()

Returns the priority of the HTTPS record, i.e.

String getTargetName()

Returns the target name of the HTTPS record.

Inherited methods

Constants

DEFAULT_ALPN_ID

public static final String DEFAULT_ALPN_ID

Constant Value: "http/1.1"

Public methods

getAlpnIds

public List<String> getAlpnIds ()

Returns the list of Application-Layer Protocol Negotiation (ALPN) protocol identifiers contained in the HTTPS record.

If the record does not specify no-default-alpn SvcParamKey, the list will contain the default ALPN ID "http/1.1".

See RFC 9460 7.1 for more details.

Returns
List<String> This value cannot be null.

getEchConfigList

public EchConfigList getEchConfigList ()

Returns the EchConfigList contained in the HTTPS record, if present.

This value should be passed into ERROR(/SSLEngines#setEchConfigList()) or ERROR(/SSLSockets#setEchConfigList()) to enable ECH in a TLS handshake.

Returns
EchConfigList This value may be null.

Throws
InvalidEchDataException

getIpAddressHints

public List<InetAddress> getIpAddressHints ()

Returns the list of IP hints (IPv4 & IPv6) contained in the HTTPS record.

This method returns all the hints present in the record, including address families that are not present on the current network. To determine which IP addresses to use when establishing a connection, use HttpsEndpoint.getIpAddresses() instead.

The list is sorted according to RFC 6724. See RFC 9460 7.3 for more details.

Returns
List<InetAddress> This value cannot be null.

getOwnerName

public String getOwnerName ()

Returns the owner name of the HTTPS record.

This should be used as the effective target name if the HTTPS record target name is an empty string.

Returns
String This value cannot be null.

getPort

public int getPort ()

Returns the port of the HTTPS record, defaulting to 443 if not specified in the record.

See RFC 9460 7.2 for more details.

Returns
int

getPriority

public int getPriority ()

Returns the priority of the HTTPS record, i.e. the contents of the SvcPriority field.

If the priority is 0, the record is considered AliasMode, and will not contain any IP hints, port, ALPN IDs, or ECH configurations. Otherwise, it is ServiceMode.

Because RR sets are unordered, this priority field is used to impose an ordering, where smaller values are recommended for use over those with a larger priority value.

See RFC 9460 2.4 for more details.

Returns
int Value is between 0 and 65535 inclusive

getTargetName

public String getTargetName ()

Returns the target name of the HTTPS record.

If the target name is an empty string, RFC 9460 2.5 specifies that this indicates special rules. For AliasMode RRs, this indicates that the service is not available or does not exist. For ServiceMode RRs, this indicates the record's owner name is the effective target name.

Returns
String This value cannot be null.