This commit is contained in:
M66B 2021-12-02 20:19:04 +01:00
parent ec6b58697e
commit dec9f9c4fa
1 changed files with 0 additions and 26 deletions

View File

@ -91,18 +91,6 @@ public class DnsHelper {
}
}
static InetAddress lookupMx(Context context, String domain) {
try {
DnsRecord[] records = lookup(context, domain, "mx");
if (records.length > 0)
return InetAddress.getByName(records[0].name);
} catch (Throwable ex) {
Log.w(ex);
}
return null;
}
@NonNull
static DnsRecord[] lookup(Context context, String name, String type) throws UnknownHostException {
int rtype;
@ -284,18 +272,4 @@ public class DnsHelper {
this.port = port;
}
}
static void test(Context context) {
try {
String domain = "gmail.com";
checkMx(context, new Address[]{Log.myAddress()});
InetAddress iaddr = lookupMx(context, domain);
DnsRecord[] records = DnsHelper.lookup(context, "_imaps._tcp." + domain, "srv");
if (records.length == 0)
throw new UnknownHostException(domain);
Log.i("DNS iaddr=" + iaddr + " srv=" + records[0].name + ":" + records[0].port);
} catch (Throwable ex) {
Log.e("DNS", ex);
}
}
}