| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_EDNS_PAYLOADSIZE
The default EDNS payload size
|
static int |
DEFAULT_PORT
The default port to send queries to
|
| Constructor and Description |
|---|
SimpleResolver()
Creates a SimpleResolver.
|
SimpleResolver(InetAddress host)
Creates a SimpleResolver that will query the specified host
|
SimpleResolver(InetSocketAddress host)
Creates a SimpleResolver that will query the specified host
|
SimpleResolver(String hostname)
Creates a SimpleResolver that will query the specified host
|
| Modifier and Type | Method and Description |
|---|---|
InetSocketAddress |
getAddress()
Gets the destination address associated with this SimpleResolver.
|
OPTRecord |
getEDNS()
Gets the EDNS information on outgoing messages.
|
boolean |
getIgnoreTruncation()
Gets whether truncated responses will be ignored.
|
int |
getPort()
Gets the port to communicate with on the server
|
boolean |
getTCP()
Gets whether TCP connections will be used by default
|
Duration |
getTimeout()
Gets the amount of time to wait for a response before giving up.
|
TSIG |
getTSIGKey()
Get the TSIG key that messages will be signed with.
|
CompletionStage<Message> |
sendAsync(Message query)
Asynchronously sends a message to a single server, registering a listener to receive a callback
on success or exception.
|
void |
setAddress(InetAddress addr)
Sets the address of the server to communicate with (on the default DNS port)
|
void |
setAddress(InetSocketAddress addr)
Sets the address of the server to communicate with.
|
static void |
setDefaultResolver(InetSocketAddress hostname)
Sets the default host (initially localhost) to query
|
static void |
setDefaultResolver(String hostname)
Sets the default host (initially localhost) to query
|
void |
setEDNS(int version,
int payloadSize,
int flags,
List<EDNSOption> options)
Sets the EDNS information on outgoing messages.
|
void |
setEDNS(OPTRecord optRecord)
Sets the EDNS information on outgoing messages.
|
void |
setIgnoreTruncation(boolean flag)
Sets whether truncated responses will be ignored.
|
void |
setLocalAddress(InetAddress addr)
Sets the local address to bind to when sending messages.
|
void |
setLocalAddress(InetSocketAddress addr)
Sets the local address to bind to when sending messages.
|
void |
setPort(int port)
Sets the port to communicate with on the server
|
void |
setTCP(boolean flag)
Sets whether TCP connections will be used by default
|
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
|
String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitsend, sendAsync, setEDNS, setEDNS, setTimeout, setTimeoutpublic static final int DEFAULT_PORT
public static final int DEFAULT_EDNS_PAYLOADSIZE
public SimpleResolver()
throws UnknownHostException
UnknownHostException - Failure occurred while finding the hostResolverConfigpublic SimpleResolver(String hostname) throws UnknownHostException
UnknownHostException - Failure occurred while finding the hostpublic SimpleResolver(InetSocketAddress host)
public SimpleResolver(InetAddress host)
public InetSocketAddress getAddress()
public static void setDefaultResolver(InetSocketAddress hostname)
public static void setDefaultResolver(String hostname)
public int getPort()
public void setPort(int port)
Resolverpublic void setAddress(InetSocketAddress addr)
addr - The address of the DNS serverpublic void setAddress(InetAddress addr)
addr - The address of the DNS serverpublic void setLocalAddress(InetSocketAddress addr)
addr - The local address to send messages from.public void setLocalAddress(InetAddress addr)
addr - The local address to send messages from.public boolean getTCP()
public void setTCP(boolean flag)
Resolverpublic boolean getIgnoreTruncation()
public void setIgnoreTruncation(boolean flag)
ResolversetIgnoreTruncation in interface Resolverflag - Indicates whether truncated responses should be ignored.public OPTRecord getEDNS()
OPTRecord for EDNS or null if EDNS is disabled.public void setEDNS(OPTRecord optRecord)
optRecord - the OPTRecord for EDNS options or null to disable EDNS.setEDNS(int, int, int, List)public void setEDNS(int version,
int payloadSize,
int flags,
List<EDNSOption> options)
ResolversetEDNS in interface Resolverversion - 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.OPTRecordpublic TSIG getTSIGKey()
null if not specified.public void setTSIGKey(TSIG key)
ResolversetTSIGKey in interface Resolverkey - The keypublic void setTimeout(Duration timeout)
ResolversetTimeout in interface Resolvertimeout - The amount of time to wait.public Duration getTimeout()
ResolvergetTimeout in interface ResolverResolver.setTimeout(Duration)public CompletionStage<Message> sendAsync(Message query)
Copyright © 2021 dnsjava.org. All rights reserved.