Package rocks.xmpp.dns
Class DnsResolver
- java.lang.Object
-
- rocks.xmpp.dns.DnsResolver
-
public final class DnsResolver extends Object
A minimalistic DNS resolver, which can resolve SRV and TXT records in the context of XMPP.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static List<SrvRecord>
resolveSRV(CharSequence service, CharSequence domain, String nameServer, long timeout)
Resolves DNS SRV records for the given domain.static List<TxtRecord>
resolveTXT(CharSequence domain, String nameServer, long timeout)
Resolves DNS TXT records for the given domain.
-
-
-
Method Detail
-
resolveSRV
public static List<SrvRecord> resolveSRV(CharSequence service, CharSequence domain, String nameServer, long timeout) throws IOException
Resolves DNS SRV records for the given domain.The service is "xmpp-client", the protocol is "tcp", resulting in a query of
_xmpp-client._tcp.domain
.- Parameters:
service
- The service, usually "xmpp-client" or "xmpps-client".domain
- The domain.nameServer
- The name server.timeout
- The timeout.- Returns:
- The DNS SRV records.
- Throws:
IOException
- If a timeout occurs or no connection to the DNS server can be established.- See Also:
- RFC 6120 3.2.1. Preferred Process: SRV Lookup
-
resolveTXT
public static List<TxtRecord> resolveTXT(CharSequence domain, String nameServer, long timeout) throws IOException
Resolves DNS TXT records for the given domain.- Parameters:
domain
- The domain.nameServer
- The name server.timeout
- The timeout.- Returns:
- The DNS SRV records.
- Throws:
IOException
- If a timeout occurs or no connection to the DNS server can be established.- See Also:
- XEP-0156: Discovering Alternative XMPP Connection Methods
-
-