Package org.jitsi.dnssec.validator
Class ValidatingResolver
- java.lang.Object
-
- org.jitsi.dnssec.validator.ValidatingResolver
-
- All Implemented Interfaces:
org.xbill.DNS.Resolver
public class ValidatingResolver extends java.lang.Object implements org.xbill.DNS.ResolverThis resolver validates responses with DNSSEC.
-
-
Field Summary
Fields Modifier and Type Field Description static intVALIDATION_REASON_QCLASSThe QCLASS being used for the injection of the reason why the validator came to the returned result.
-
Constructor Summary
Constructors Constructor Description ValidatingResolver(org.xbill.DNS.Resolver headResolver)Creates a new instance of this class.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TrustAnchorStoregetTrustAnchors()Gets the store with the loaded trust anchors.voidinit(java.util.Properties config)Initialize the module.voidloadTrustAnchors(java.io.InputStream data)Load the trust anchor file into the trust anchor store.org.xbill.DNS.Messagesend(org.xbill.DNS.Message query)Sends a message and validates the response with DNSSEC before returning it.java.lang.ObjectsendAsync(org.xbill.DNS.Message query, org.xbill.DNS.ResolverListener listener)Not implemented.voidsetEDNS(int level)This is a no-op, EDNS is always set to level 0.voidsetEDNS(int level, int payloadSize, int flags, java.util.List options)The method is forwarded to the resolver, but always ensure that the level is 0 and the flags contains DO.voidsetIgnoreTruncation(boolean flag)This is a no-op, truncation is never ignored.voidsetPort(int port)Forwards the data to the head resolver passed at construction time.voidsetTCP(boolean flag)Forwards the data to the head resolver passed at construction time.voidsetTimeout(int secs)Sets the amount of time to wait for a response before giving up.voidsetTimeout(int secs, int msecs)Sets the amount of time to wait for a response before giving up.voidsetTSIGKey(org.xbill.DNS.TSIG key)Forwards the data to the head resolver passed at construction time.
-
-
-
Field Detail
-
VALIDATION_REASON_QCLASS
public static final int VALIDATION_REASON_QCLASS
The QCLASS being used for the injection of the reason why the validator came to the returned result.- See Also:
- Constant Field Values
-
-
Method Detail
-
init
public void init(java.util.Properties config) throws java.io.IOExceptionInitialize the module. The only recognized configuration value is org.jitsi.dnssec.trust_anchor_file.- Parameters:
config- The configuration data for this module.- Throws:
java.io.IOException- When the file specified in the config does not exist or cannot be read.
-
loadTrustAnchors
public void loadTrustAnchors(java.io.InputStream data) throws java.io.IOExceptionLoad the trust anchor file into the trust anchor store. The trust anchors are currently stored in a zone file format list of DNSKEY or DS records.- Parameters:
data- The trust anchor data.- Throws:
java.io.IOException- when the trust anchor data could not be read.
-
getTrustAnchors
public TrustAnchorStore getTrustAnchors()
Gets the store with the loaded trust anchors.- Returns:
- The store with the loaded trust anchors.
-
setPort
public void setPort(int port)
Forwards the data to the head resolver passed at construction time.- Specified by:
setPortin interfaceorg.xbill.DNS.Resolver- Parameters:
port- The IP destination port for the queries sent.- See Also:
Resolver.setPort(int)
-
setTCP
public void setTCP(boolean flag)
Forwards the data to the head resolver passed at construction time.- Specified by:
setTCPin interfaceorg.xbill.DNS.Resolver- Parameters:
flag-trueto enable TCP,falseto disable it.- See Also:
Resolver.setTCP(boolean)
-
setIgnoreTruncation
public void setIgnoreTruncation(boolean flag)
This is a no-op, truncation is never ignored.- Specified by:
setIgnoreTruncationin interfaceorg.xbill.DNS.Resolver- Parameters:
flag- unused
-
setEDNS
public void setEDNS(int level)
This is a no-op, EDNS is always set to level 0.- Specified by:
setEDNSin interfaceorg.xbill.DNS.Resolver- Parameters:
level- unused
-
setEDNS
public void setEDNS(int level, int payloadSize, int flags, java.util.List options)The method is forwarded to the resolver, but always ensure that the level is 0 and the flags contains DO.- Specified by:
setEDNSin interfaceorg.xbill.DNS.Resolver- Parameters:
level- unused, always set to 0.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,ExtendedFlags.DOis always appended.options- EDNS options to be set in the OPT record, specified as a List of OPTRecord.Option elements.- See Also:
Resolver.setEDNS(int, int, int, java.util.List)
-
setTSIGKey
public void setTSIGKey(org.xbill.DNS.TSIG key)
Forwards the data to the head resolver passed at construction time.- Specified by:
setTSIGKeyin interfaceorg.xbill.DNS.Resolver- Parameters:
key- The key.- See Also:
Resolver.setTSIGKey(org.xbill.DNS.TSIG)
-
setTimeout
public void setTimeout(int secs, int msecs)Sets the amount of time to wait for a response before giving up. This applies only to the head resolver, the time for an actual query to the validating resolver IS higher.- Specified by:
setTimeoutin interfaceorg.xbill.DNS.Resolver- Parameters:
secs- The number of seconds to wait.msecs- The number of milliseconds to wait.
-
setTimeout
public void setTimeout(int secs)
Sets the amount of time to wait for a response before giving up. This applies only to the head resolver, the time for an actual query to the validating resolver IS higher.- Specified by:
setTimeoutin interfaceorg.xbill.DNS.Resolver- Parameters:
secs- The number of seconds to wait.
-
send
public org.xbill.DNS.Message send(org.xbill.DNS.Message query) throws java.io.IOExceptionSends a message and validates the response with DNSSEC before returning it.- Specified by:
sendin interfaceorg.xbill.DNS.Resolver- Parameters:
query- The query to send.- Returns:
- The validated response message.
- Throws:
java.io.IOException- An error occurred while sending or receiving.
-
sendAsync
public java.lang.Object sendAsync(org.xbill.DNS.Message query, org.xbill.DNS.ResolverListener listener)Not implemented.- Specified by:
sendAsyncin interfaceorg.xbill.DNS.Resolver- Parameters:
query- The query to sendlistener- The object containing the callbacks.- Returns:
- An identifier, which is also a parameter in the callback
- Throws:
java.lang.UnsupportedOperationException- Always
-
-