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
DnsServerAddressStreamProviderimplementation 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>currentMappingsprivate java.util.concurrent.atomic.AtomicLonglastRefreshprivate static InternalLoggerloggerprivate static longREFRESH_INTERVALprivate static java.util.Comparator<DnsResolver>RESOLVER_COMPARATORprivate static java.lang.ThrowableUNAVAILABILITY_CAUSE
-
Constructor Summary
Constructors Constructor Description MacOSDnsServerAddressStreamProvider()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static voidensureAvailability()static booleanisAvailable()private static voidloadNativeLibrary()DnsServerAddressStreamnameServerAddressStream(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.ThrowableunavailabilityCause()
-
-
-
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:DnsServerAddressStreamProviderAsk this provider for the name servers to query forhostname.- Specified by:
nameServerAddressStreamin interfaceDnsServerAddressStreamProvider- Parameters:
hostname- The hostname for which to lookup the DNS server addressed to use. If this is the finalDnsServerAddressStreamProviderto be queried then generally empty string or'.'correspond to the defaultDnsServerAddressStream.- Returns:
- The
DnsServerAddressStreamwhich should be used to resolvehostname.
-
resolvers
private static DnsResolver[] resolvers()
-
-