Package org.xbill.DNS
Interface Resolver
- All Known Implementing Classes:
DohResolver
,ExtendedResolver
,SimpleResolver
,ValidatingResolver
public interface Resolver
Interface describing a resolver.
- Author:
- Brian Wellington
-
Method Summary
Modifier and TypeMethodDescriptiondefault Duration
Gets the amount of time to wait for a response before giving up.default Message
Sends a message and waits for a response.default CompletionStage
<Message> Asynchronously sends a message using the defaultForkJoinPool.commonPool()
.default CompletionStage
<Message> Asynchronously sends a message.default Object
sendAsync
(Message query, ResolverListener listener) Deprecated.default void
setEDNS
(int version) Sets the EDNS version used on outgoing messages.void
setEDNS
(int version, int payloadSize, int flags, List<EDNSOption> options) Sets the EDNS information on outgoing messages.default void
setEDNS
(int version, int payloadSize, int flags, EDNSOption... options) Sets the EDNS information on outgoing messages.void
setIgnoreTruncation
(boolean flag) Sets whether truncated responses will be ignored.void
setPort
(int port) Sets the port to communicate with on the servervoid
setTCP
(boolean flag) Sets whether TCP connections will be used by defaultdefault void
setTimeout
(int secs) Deprecated.default void
setTimeout
(int secs, int msecs) Deprecated.void
setTimeout
(Duration timeout) Sets the amount of time to wait for a response before giving up.void
setTSIGKey
(TSIG key) Specifies the TSIG key that messages will be signed with
-
Method Details
-
setPort
void setPort(int port) Sets the port to communicate with on the server- Parameters:
port
- The port to send messages to
-
setTCP
void setTCP(boolean flag) Sets whether TCP connections will be used by default- Parameters:
flag
- Indicates whether TCP connections are made
-
setIgnoreTruncation
void setIgnoreTruncation(boolean flag) Sets whether truncated responses will be ignored. If not, a truncated response over UDP will cause a retransmission over TCP.- Parameters:
flag
- Indicates whether truncated responses should be ignored.
-
setEDNS
default void setEDNS(int version) Sets the EDNS version used on outgoing messages.- Parameters:
version
- The EDNS level to use. 0 indicates EDNS0 and -1 indicates no EDNS.- Throws:
IllegalArgumentException
- An invalid level was indicated.
-
setEDNS
Sets the EDNS information on outgoing messages.- Parameters:
version
- The EDNS version to use. 0 indicates EDNS0 and -1 indicates no EDNS.payloadSize
- The maximum DNS packet size that this host is capable of receiving over UDP. If 0 is specified, the default (1280) is used.flags
- EDNS extended flags to be set in the OPT record.options
- EDNS options to be set in the OPT record, specified as a List of OPTRecord.Option elements.- Throws:
IllegalArgumentException
- An invalid field was specified.- See Also:
-
setEDNS
Sets the EDNS information on outgoing messages.- Parameters:
version
- The EDNS version to use. 0 indicates EDNS0 and -1 indicates no EDNS.payloadSize
- The maximum DNS packet size that this host is capable of receiving over UDP. If 0 is specified, the default (1280) is used.flags
- EDNS extended flags to be set in the OPT record.options
- EDNS options to be set in the OPT record, specified as a List of OPTRecord.Option elements.- Throws:
IllegalArgumentException
- An invalid field was specified.- See Also:
-
setTSIGKey
Specifies the TSIG key that messages will be signed with- Parameters:
key
- The key
-
setTimeout
Deprecated.Sets the amount of time to wait for a response before giving up.- Parameters:
secs
- The number of seconds to wait.msecs
- The number of milliseconds to wait.
-
setTimeout
Deprecated.Sets the amount of time to wait for a response before giving up.- Parameters:
secs
- The number of seconds to wait.
-
setTimeout
Sets the amount of time to wait for a response before giving up.- Parameters:
timeout
- The amount of time to wait.
-
getTimeout
Gets the amount of time to wait for a response before giving up.- See Also:
-
send
Sends a message and waits for a response.The waiting is done on the calling thread. Do not call this method from async code, and especially not from tasks running on
ForkJoinPool.commonPool()
, usesendAsync(Message)
orsendAsync(Message, Executor)
instead.- Parameters:
query
- The query to send.- Returns:
- The response
- Throws:
IOException
- An error occurred while sending or receiving.
-
sendAsync
Asynchronously sends a message using the defaultForkJoinPool.commonPool()
.The default implementation calls the deprecated
sendAsync(Message, ResolverListener)
. Implementors must override at least one of thesendAsync
methods or a stack overflow will occur.- Parameters:
query
- The query to send.- Returns:
- A future that completes when the query is finished.
-
sendAsync
Asynchronously sends a message.The default implementation calls the deprecated
sendAsync(Message, ResolverListener)
. Implementors must override at least one of thesendAsync
methods or a stack overflow will occur.- Parameters:
query
- The query to send.executor
- The service to use for async operations.- Returns:
- A future that completes when the query is finished.
-
sendAsync
Deprecated.Asynchronously sends a message registering a listener to receive a callback on success or exception. Multiple asynchronous lookups can be performed in parallel. The callback may be invoked from any thread.The default implementation calls
sendAsync(Message)
. Implementors must override at least one of thesendAsync
methods or a stack overflow will occur.- Parameters:
query
- The query to sendlistener
- The object containing the callbacks.- Returns:
- An identifier, which is also a parameter in the callback
-
sendAsync(Message)