1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-12-22 20:47:57 +01:00

Add DNSSEC support to DnsOverXmppMiniDnsResolver

This commit is contained in:
Florian Schmaus 2019-04-09 21:00:08 +02:00
parent fc45e1b905
commit a1c88f1fad

View file

@ -24,22 +24,30 @@ import org.minidns.DnsClient;
import org.minidns.dnsmessage.DnsMessage;
import org.minidns.dnsmessage.Question;
import org.minidns.dnsqueryresult.DnsQueryResult;
import org.minidns.dnssec.DnssecClient;
import org.minidns.dnssec.DnssecQueryResult;
public class DnsOverXmppMiniDnsResolver implements DnsOverXmppResolver {
public final class DnsOverXmppMiniDnsResolver implements DnsOverXmppResolver {
public static final DnsOverXmppMiniDnsResolver INSTANCE = new DnsOverXmppMiniDnsResolver(new DnsClient());
public static final DnsOverXmppMiniDnsResolver INSTANCE = new DnsOverXmppMiniDnsResolver();
private final DnsClient dnsClient;
private final DnsClient dnsClient = new DnsClient();
private final DnssecClient dnssecClient = new DnssecClient();
public DnsOverXmppMiniDnsResolver(DnsClient dnsClient) {
this.dnsClient = dnsClient;
private DnsOverXmppMiniDnsResolver() {
}
@Override
public DnsMessage resolve(DnsMessage query) throws IOException {
Question question = query.getQuestion();
DnsQueryResult dnsQueryResult = dnsClient.query(question);
final DnsQueryResult dnsQueryResult;
if (query.isDnssecOk()) {
DnssecQueryResult dnssecQueryResult = dnssecClient.queryDnssec(question);
dnsQueryResult = dnssecQueryResult.dnsQueryResult;
} else {
dnsQueryResult = dnsClient.query(question);
}
return dnsQueryResult.response;
}