Openfire 3.9.3 Javadoc

org.jivesoftware.openfire.net
Class DNSUtil

java.lang.Object
  extended by org.jivesoftware.openfire.net.DNSUtil

public class DNSUtil
extends Object

Utilty class to perform DNS lookups for XMPP services.

Author:
Matt Tucker

Nested Class Summary
static class DNSUtil.HostAddress
          Encapsulates a hostname and port.
static class DNSUtil.WeightedHostAddress
          The representation of weighted address.
 
Constructor Summary
DNSUtil()
           
 
Method Summary
static Map<String,DNSUtil.HostAddress> getDnsOverride()
          Returns the internal DNS that allows to specify target IP addresses and ports to use for domains.
static List<DNSUtil.WeightedHostAddress> prioritize(DNSUtil.WeightedHostAddress[] records)
           
static List<DNSUtil.HostAddress> resolveXMPPDomain(String domain, int defaultPort)
          Returns a sorted list of host names and ports that the specified XMPP domain can be reached at for server-to-server communication.
static DNSUtil.HostAddress resolveXMPPServerDomain(String domain, int defaultPort)
          Deprecated. replaced with support for multiple srv records, see resolveXMPPDomain(String, int)
static void setDnsOverride(Map<String,DNSUtil.HostAddress> dnsOverride)
          Sets the internal DNS that allows to specify target IP addresses and ports to use for domains.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DNSUtil

public DNSUtil()
Method Detail

resolveXMPPServerDomain

@Deprecated
public static DNSUtil.HostAddress resolveXMPPServerDomain(String domain,
                                                                     int defaultPort)
Deprecated. replaced with support for multiple srv records, see resolveXMPPDomain(String, int)

Returns the host name and port that the specified XMPP server can be reached at for server-to-server communication. A DNS lookup for a SRV record in the form "_xmpp-server._tcp.example.com" is attempted, according to section 14.4 of RFC 3920. If that lookup fails, a lookup in the older form of "_jabber._tcp.example.com" is attempted since servers that implement an older version of the protocol may be listed using that notation. If that lookup fails as well, it's assumed that the XMPP server lives at the host resolved by a DNS lookup at the specified domain on the specified default port.

As an example, a lookup for "example.com" may return "im.example.com:5269".

Parameters:
domain - the domain.
defaultPort - default port to return if the DNS look up fails.
Returns:
a HostAddress, which encompasses the hostname and port that the XMPP server can be reached at for the specified domain.

resolveXMPPDomain

public static List<DNSUtil.HostAddress> resolveXMPPDomain(String domain,
                                                          int defaultPort)
Returns a sorted list of host names and ports that the specified XMPP domain can be reached at for server-to-server communication. A DNS lookup for a SRV record in the form "_xmpp-server._tcp.example.com" is attempted, according to section 14.4 of RFC 3920. If that lookup fails, a lookup in the older form of "_jabber._tcp.example.com" is attempted since servers that implement an older version of the protocol may be listed using that notation. If that lookup fails as well, it's assumed that the XMPP server lives at the host resolved by a DNS lookup at the specified domain on the specified default port.

As an example, a lookup for "example.com" may return "im.example.com:5269".

Parameters:
domain - the domain.
defaultPort - default port to return if the DNS look up fails.
Returns:
a list of HostAddresses, which encompasses the hostname and port that the XMPP server can be reached at for the specified domain.

getDnsOverride

public static Map<String,DNSUtil.HostAddress> getDnsOverride()
Returns the internal DNS that allows to specify target IP addresses and ports to use for domains. The internal DNS will be checked up before performing an actual DNS SRV lookup.

Returns:
the internal DNS that allows to specify target IP addresses and ports to use for domains.

setDnsOverride

public static void setDnsOverride(Map<String,DNSUtil.HostAddress> dnsOverride)
Sets the internal DNS that allows to specify target IP addresses and ports to use for domains. The internal DNS will be checked up before performing an actual DNS SRV lookup.

Parameters:
dnsOverride - the internal DNS that allows to specify target IP addresses and ports to use for domains.

prioritize

public static List<DNSUtil.WeightedHostAddress> prioritize(DNSUtil.WeightedHostAddress[] records)

Openfire 3.9.3 Javadoc

Copyright © 2003-2008 Jive Software.