Package io.netty.resolver.dns.macos
Class MacOSDnsServerAddressStreamProvider
- java.lang.Object
-
- io.netty.resolver.dns.macos.MacOSDnsServerAddressStreamProvider
-
- All Implemented Interfaces:
DnsServerAddressStreamProvider
public final class MacOSDnsServerAddressStreamProvider extends java.lang.Object implements DnsServerAddressStreamProvider
DnsServerAddressStreamProvider
implementation which makes use of the same mechanism as Apple's open source mDNSResponder to retrieve the current nameserver configuration of the system.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.Map<java.lang.String,DnsServerAddresses>
currentMappings
private java.util.concurrent.atomic.AtomicLong
lastRefresh
private static InternalLogger
logger
private static long
REFRESH_INTERVAL
private static java.util.Comparator<DnsResolver>
RESOLVER_COMPARATOR
private static java.lang.Throwable
UNAVAILABILITY_CAUSE
-
Constructor Summary
Constructors Constructor Description MacOSDnsServerAddressStreamProvider()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static void
ensureAvailability()
static boolean
isAvailable()
private static void
loadNativeLibrary()
DnsServerAddressStream
nameServerAddressStream(java.lang.String hostname)
Ask this provider for the name servers to query forhostname
.private static DnsResolver[]
resolvers()
private static java.util.Map<java.lang.String,DnsServerAddresses>
retrieveCurrentMappings()
static java.lang.Throwable
unavailabilityCause()
-
-
-
Field Detail
-
RESOLVER_COMPARATOR
private static final java.util.Comparator<DnsResolver> RESOLVER_COMPARATOR
-
UNAVAILABILITY_CAUSE
private static final java.lang.Throwable UNAVAILABILITY_CAUSE
-
logger
private static final InternalLogger logger
-
REFRESH_INTERVAL
private static final long REFRESH_INTERVAL
-
currentMappings
private volatile java.util.Map<java.lang.String,DnsServerAddresses> currentMappings
-
lastRefresh
private final java.util.concurrent.atomic.AtomicLong lastRefresh
-
-
Method Detail
-
loadNativeLibrary
private static void loadNativeLibrary()
-
isAvailable
public static boolean isAvailable()
-
ensureAvailability
public static void ensureAvailability()
-
unavailabilityCause
public static java.lang.Throwable unavailabilityCause()
-
retrieveCurrentMappings
private static java.util.Map<java.lang.String,DnsServerAddresses> retrieveCurrentMappings()
-
nameServerAddressStream
public DnsServerAddressStream nameServerAddressStream(java.lang.String hostname)
Description copied from interface:DnsServerAddressStreamProvider
Ask this provider for the name servers to query forhostname
.- Specified by:
nameServerAddressStream
in interfaceDnsServerAddressStreamProvider
- Parameters:
hostname
- The hostname for which to lookup the DNS server addressed to use. If this is the finalDnsServerAddressStreamProvider
to be queried then generally empty string or'.'
correspond to the defaultDnsServerAddressStream
.- Returns:
- The
DnsServerAddressStream
which should be used to resolvehostname
.
-
resolvers
private static DnsResolver[] resolvers()
-
-