mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2025-09-09 10:19:41 +02:00
Bump MiniDNS to 0.3.0-alpha1
Also add minidns-core as dependency to smack-core. This requires increasing the minimum required Android SDK level to 9, as this is what MiniDNS requires.
This commit is contained in:
parent
6c4a02691e
commit
a91ca2aebf
21 changed files with 156 additions and 237 deletions
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
*
|
||||
* Copyright 2013-2017 Florian Schmaus
|
||||
* Copyright 2013-2018 Florian Schmaus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -37,6 +37,8 @@ import org.jivesoftware.smack.util.dns.DNSResolver;
|
|||
import org.jivesoftware.smack.util.dns.HostAddress;
|
||||
import org.jivesoftware.smack.util.dns.SRVRecord;
|
||||
|
||||
import org.minidns.dnsname.DNSName;
|
||||
|
||||
/**
|
||||
* A DNS resolver (mostly for SRV records), which makes use of the API provided in the javax.* namespace.
|
||||
*
|
||||
|
@ -81,12 +83,12 @@ public class JavaxResolver extends DNSResolver implements SmackInitializer {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected List<SRVRecord> lookupSRVRecords0(String name, List<HostAddress> failedAddresses, DnssecMode dnssecMode) {
|
||||
protected List<SRVRecord> lookupSRVRecords0(DNSName name, List<HostAddress> failedAddresses, DnssecMode dnssecMode) {
|
||||
List<SRVRecord> res = null;
|
||||
|
||||
Attribute srvAttribute;
|
||||
try {
|
||||
Attributes dnsLookup = dirContext.getAttributes(name, new String[] { "SRV" });
|
||||
Attributes dnsLookup = dirContext.getAttributes(name.ace, new String[] { "SRV" });
|
||||
srvAttribute = dnsLookup.get("SRV");
|
||||
if (srvAttribute == null)
|
||||
return null;
|
||||
|
@ -108,7 +110,14 @@ public class JavaxResolver extends DNSResolver implements SmackInitializer {
|
|||
int priority = Integer.parseInt(srvRecordEntries[srvRecordEntries.length - 4]);
|
||||
int port = Integer.parseInt(srvRecordEntries[srvRecordEntries.length - 2]);
|
||||
int weight = Integer.parseInt(srvRecordEntries[srvRecordEntries.length - 3]);
|
||||
String host = srvRecordEntries[srvRecordEntries.length - 1];
|
||||
String srvTarget = srvRecordEntries[srvRecordEntries.length - 1];
|
||||
// Strip trailing '.' from srvTarget.
|
||||
// Later MiniDNS version may do the right thing when DNSName.from() is called with a DNS name string
|
||||
// having a trailing dot, so this can possibly be removed in future Smack versions.
|
||||
if (srvTarget.length() > 0 && srvTarget.charAt(srvTarget.length() - 1) == '.') {
|
||||
srvTarget = srvTarget.substring(0, srvTarget.length() - 1);
|
||||
}
|
||||
DNSName host = DNSName.from(srvTarget);
|
||||
|
||||
List<InetAddress> hostAddresses = lookupHostAddress0(host, failedAddresses, dnssecMode);
|
||||
if (shouldContinue(name, host, hostAddresses)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue