Package tigase.util.dns
Class DNSResolverDefault
java.lang.Object
tigase.util.dns.DNSResolverDefault
- All Implemented Interfaces:
DNSResolverIfc
DNSResolver class for handling DNS names
-
Field Summary
Modifier and TypeFieldDescriptionFields inherited from interface tigase.util.dns.DNSResolverIfc
rand, TIGASE_PRIMARY_ADDRESS, TIGASE_SECONDARY_ADDRESS
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionMethod provides default host information for the installation.String[]
Method provides an array of all local host informations, by default it contains defaultHost.String[]
getHostIPs
(String hostname) Resolve all IP addresses for the givenhostname
DNSEntry[]
getHostSRV_Entries
(String hostname, String service, int defPort) Retrieves list of DNS entries for givenhostname
.Method provides alternative host information for the current instance.protected static boolean
isHostValid
(String host) static void
main
method outputting various information about hostnamesvoid
setPrimaryHost
(String tigasePrimaryHost) void
setSecondaryHost
(String tigaseSecondaryHost) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface tigase.util.dns.DNSResolverIfc
getHostIP, getHostSRV_Entries, getHostSRV_Entry, getHostSRV_Entry, getHostSRV_IP
-
Field Details
-
ip_cache
-
srv_cache
-
-
Constructor Details
-
DNSResolverDefault
protected DNSResolverDefault()
-
-
Method Details
-
isHostValid
-
main
main
method outputting various information about hostnames- Parameters:
args
- aString[]
containing domains to query, if none provided default one will be used- Throws:
Exception
-
getDefaultHosts
Description copied from interface:DNSResolverIfc
Method provides an array of all local host informations, by default it contains defaultHost.- Specified by:
getDefaultHosts
in interfaceDNSResolverIfc
- Returns:
- an array of all local hosts.
-
getDefaultHost
Description copied from interface:DNSResolverIfc
Method provides default host information for the installation. It can be both hostname or IP address.- Specified by:
getDefaultHost
in interfaceDNSResolverIfc
- Returns:
- a default host information.
-
getPrimaryHost
-
setPrimaryHost
-
getSecondaryHost
Description copied from interface:DNSResolverIfc
Method provides alternative host information for the current instance. By default falls back to the default host information.- Specified by:
getSecondaryHost
in interfaceDNSResolverIfc
- Returns:
- alternative host information.
-
setSecondaryHost
-
getHostIPs
Resolve all IP addresses for the givenhostname
- Specified by:
getHostIPs
in interfaceDNSResolverIfc
- Parameters:
hostname
- the domain name for which this record is valid- Returns:
- Array of all
IP addresses
on which target host provide service. - Throws:
UnknownHostException
-
getHostSRV_Entries
public DNSEntry[] getHostSRV_Entries(String hostname, String service, int defPort) throws UnknownHostException Description copied from interface:DNSResolverIfc
Retrieves list of DNS entries for givenhostname
. Allow specifying particular type of SRV record.- Specified by:
getHostSRV_Entries
in interfaceDNSResolverIfc
- Parameters:
hostname
- the domain name for which this record is validservice
- type of SRV records, for example_xmpp-server._tcp
defPort
- default port number in case DNS records is missing one.- Returns:
- Array of the DNSEntry records
- Throws:
UnknownHostException
-