public final class DefaultDnsServerAddressStreamProvider extends java.lang.Object implements DnsServerAddressStreamProvider
DnsServerAddressStreamProvider
which will use predefined default DNS servers to use for DNS resolution.
These defaults do not respect your host's machines defaults.
This may use the JDK's blocking DNS resolution to bootstrap the default DNS server addresses.
限定符和类型 | 字段和说明 |
---|---|
static DefaultDnsServerAddressStreamProvider |
INSTANCE |
限定符和类型 | 方法和说明 |
---|---|
static DnsServerAddresses |
defaultAddresses()
Returns the
DnsServerAddresses that yields the system DNS server addresses sequentially. |
static java.util.List<java.net.InetSocketAddress> |
defaultAddressList()
Returns the list of the system DNS server addresses.
|
DnsServerAddressStream |
nameServerAddressStream(java.lang.String hostname)
Ask this provider for the name servers to query for
hostname . |
public static final DefaultDnsServerAddressStreamProvider INSTANCE
public DnsServerAddressStream nameServerAddressStream(java.lang.String hostname)
DnsServerAddressStreamProvider
hostname
.nameServerAddressStream
在接口中 DnsServerAddressStreamProvider
hostname
- The hostname for which to lookup the DNS server addressed to use.
If this is the final DnsServerAddressStreamProvider
to be queried then generally empty
string or '.'
correspond to the default DnsServerAddressStream
.DnsServerAddressStream
which should be used to resolve hostname
.public static java.util.List<java.net.InetSocketAddress> defaultAddressList()
"8.8.8.8"
and "8.8.4.4"
, the addresses of the
Google public DNS servers.public static DnsServerAddresses defaultAddresses()
DnsServerAddresses
that yields the system DNS server addresses sequentially. If it failed to
retrieve the list of the system DNS server addresses from the environment, it will use "8.8.8.8"
and
"8.8.4.4"
, the addresses of the Google public DNS servers.
This method has the same effect with the following code:
DnsServerAddresses.sequential(DnsServerAddresses.defaultAddressList());