Package org.xbill.DNS
Class DohResolverCommon
java.lang.Object
org.xbill.DNS.DohResolverCommon
- All Implemented Interfaces:
Resolver
- Direct Known Subclasses:
DohResolver
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final Stringprotected Executorprotected final AtomicLongprotected final AsyncSemaphoreMaximum concurrent HTTP/2 streams or HTTP/1.1 connections.protected OPTRecordprotected Durationprotected TSIGprotected Stringprotected boolean -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedDohResolverCommon(String uriTemplate, int maxConcurrentRequests) Creates a new DoH resolver that performs lookups with HTTP GET and the default timeout (5s). -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract <T> CompletableFuture<T> Deprecated.(package private) longGets the amount of time to wait for a response before giving up.Gets the current URI used for resolving.protected StringgetUrl(byte[] queryBytes) booleanReturnstrueif the HTTP method POST to resolve,falseif GET is used.protected MessageprepareQuery(Message query) voidsetEDNS(int version, int payloadSize, int flags, List<EDNSOption> options) Sets the EDNS information on outgoing messages.voidsetExecutor(Executor executor) Deprecated.voidsetIgnoreTruncation(boolean flag) Not implemented.voidsetPort(int port) Not implemented.voidsetTCP(boolean flag) Not implemented.voidsetTimeout(Duration timeout) Sets the amount of time to wait for a response before giving up.voidsetTSIGKey(TSIG key) Specifies the TSIG key that messages will be signed withvoidsetUriTemplate(String uriTemplate) Sets the URI to use for resolving, e.g.voidsetUsePost(boolean usePost) Sets the HTTP method to use for resolving.protected final <T> CompletableFuture<T> timeoutFailedFuture(Message query, String message, Throwable inner) protected final <T> CompletableFuture<T> timeoutFailedFuture(Message query, Throwable inner) toString()protected voidverifyTSIG(Message query, Message response, byte[] b, TSIG tsig) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.xbill.DNS.Resolver
send, sendAsync, sendAsync, sendAsync, setEDNS, setEDNS, setTimeout, setTimeout
-
Field Details
-
maxConcurrentRequests
Maximum concurrent HTTP/2 streams or HTTP/1.1 connections.rfc7540#section-6.5.2 recommends a minimum of 100 streams for HTTP/2.
-
lastRequest
-
APPLICATION_DNS_MESSAGE
- See Also:
-
usePost
protected boolean usePost -
timeout
-
uriTemplate
-
queryOPT
-
tsig
-
defaultExecutor
-
-
Constructor Details
-
DohResolverCommon
Creates a new DoH resolver that performs lookups with HTTP GET and the default timeout (5s).- Parameters:
uriTemplate- the URI to use for resolving, e.g.https://dns.google/dns-querymaxConcurrentRequests- Maximum concurrent HTTP/2 streams for Java 11+ or HTTP/1.1 connections for Java 8. On Java 8 this cannot exceed the system propertyhttp.maxConnections.
-
-
Method Details
-
getNanoTime
long getNanoTime() -
setPort
public void setPort(int port) Not implemented. Specify the port insetUriTemplate(String)if required. -
setTCP
public void setTCP(boolean flag) Not implemented. -
setIgnoreTruncation
public void setIgnoreTruncation(boolean flag) Not implemented.- Specified by:
setIgnoreTruncationin interfaceResolver- Parameters:
flag- Indicates whether truncated responses should be ignored.
-
setEDNS
Sets the EDNS information on outgoing messages. -
setTSIGKey
Description copied from interface:ResolverSpecifies the TSIG key that messages will be signed with- Specified by:
setTSIGKeyin interfaceResolver- Parameters:
key- The key
-
setTimeout
Description copied from interface:ResolverSets the amount of time to wait for a response before giving up.- Specified by:
setTimeoutin interfaceResolver- Parameters:
timeout- The amount of time to wait.
-
getTimeout
Description copied from interface:ResolverGets the amount of time to wait for a response before giving up.- Specified by:
getTimeoutin interfaceResolver- See Also:
-
getUrl
-
prepareQuery
-
verifyTSIG
-
isUsePost
public boolean isUsePost()Returnstrueif the HTTP method POST to resolve,falseif GET is used. -
setUsePost
public void setUsePost(boolean usePost) Sets the HTTP method to use for resolving.- Parameters:
usePost-trueto use POST,falseto use GET (the default).
-
getUriTemplate
Gets the current URI used for resolving. -
setUriTemplate
Sets the URI to use for resolving, e.g.https://dns.google/dns-query -
getExecutor
Deprecated.not applicable ifResolver.sendAsync(Message, Executor)is used.Gets the defaultExecutorfor request handling, defaults toForkJoinPool.commonPool().- Since:
- 3.3
-
setExecutor
Deprecated.Sets the defaultExecutorfor request handling.- Parameters:
executor- The newExecutor, can benull(which is equivalent toForkJoinPool.commonPool()).- Since:
- 3.3
-
toString
-
failedFuture
-
timeoutFailedFuture
-
timeoutFailedFuture
protected final <T> CompletableFuture<T> timeoutFailedFuture(Message query, String message, Throwable inner)
-
Resolver.sendAsync(Message, Executor)is used.