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:
parent
fc45e1b905
commit
a1c88f1fad
1 changed files with 14 additions and 6 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue