mirror of
https://github.com/M66B/FairEmail.git
synced 2025-01-02 13:14:39 +00:00
Added NS lookup
This commit is contained in:
parent
78b05d2f13
commit
84f416fc00
1 changed files with 8 additions and 1 deletions
|
@ -34,6 +34,7 @@ import org.xbill.DNS.ARecord;
|
|||
import org.xbill.DNS.Lookup;
|
||||
import org.xbill.DNS.MXRecord;
|
||||
import org.xbill.DNS.Message;
|
||||
import org.xbill.DNS.NSRecord;
|
||||
import org.xbill.DNS.Record;
|
||||
import org.xbill.DNS.SOARecord;
|
||||
import org.xbill.DNS.SRVRecord;
|
||||
|
@ -82,6 +83,9 @@ public class DnsHelper {
|
|||
static DnsRecord[] lookup(Context context, String name, String type, int timeout) throws UnknownHostException {
|
||||
int rtype;
|
||||
switch (type) {
|
||||
case "ns":
|
||||
rtype = Type.NS;
|
||||
break;
|
||||
case "mx":
|
||||
rtype = Type.MX;
|
||||
break;
|
||||
|
@ -194,7 +198,10 @@ public class DnsHelper {
|
|||
if (records != null)
|
||||
for (Record record : records) {
|
||||
Log.i("Found record=" + record);
|
||||
if (record instanceof MXRecord) {
|
||||
if (record instanceof NSRecord) {
|
||||
NSRecord ns = (NSRecord) record;
|
||||
result.add(new DnsRecord(ns.getTarget().toString(true)));
|
||||
} else if (record instanceof MXRecord) {
|
||||
MXRecord mx = (MXRecord) record;
|
||||
result.add(new DnsRecord(mx.getTarget().toString(true)));
|
||||
} else if (record instanceof SOARecord) {
|
||||
|
|
Loading…
Reference in a new issue