mirror of https://github.com/M66B/FairEmail.git
DNS improvements
This commit is contained in:
parent
ac909f825f
commit
346c125125
|
@ -200,9 +200,20 @@ public class DnsHelper {
|
||||||
|
|
||||||
Log.i("DNS query name=" + type + ":" + name);
|
Log.i("DNS query name=" + type + ":" + name);
|
||||||
ResolverResult<? extends Data> data = resolver.resolve(name, clazz);
|
ResolverResult<? extends Data> data = resolver.resolve(name, clazz);
|
||||||
|
Log.i("DNS resolved name=" + type + ":" + name +
|
||||||
|
" success=" + data.wasSuccessful() +
|
||||||
|
" rcode=" + data.getResponseCode());
|
||||||
|
|
||||||
|
try {
|
||||||
data.throwIfErrorResponse();
|
data.throwIfErrorResponse();
|
||||||
|
} catch (Throwable ex) {
|
||||||
|
Log.e("DNS error message=" + ex.getMessage());
|
||||||
|
Log.e(ex);
|
||||||
|
throw ex;
|
||||||
|
}
|
||||||
|
|
||||||
boolean secure = (data.getUnverifiedReasons() != null);
|
boolean secure = (data.getUnverifiedReasons() != null);
|
||||||
|
Log.i("DNS secure=" + secure + " dnssec=" + dnssec);
|
||||||
if (secure && dnssec) {
|
if (secure && dnssec) {
|
||||||
DnssecResultNotAuthenticException ex = data.getDnssecResultNotAuthenticException();
|
DnssecResultNotAuthenticException ex = data.getDnssecResultNotAuthenticException();
|
||||||
if (ex != null)
|
if (ex != null)
|
||||||
|
@ -268,7 +279,12 @@ public class DnsHelper {
|
||||||
for (DnsRecord record : result) {
|
for (DnsRecord record : result) {
|
||||||
record.query = name;
|
record.query = name;
|
||||||
record.secure = secure;
|
record.secure = secure;
|
||||||
|
try {
|
||||||
record.authentic = data.isAuthenticData();
|
record.authentic = data.isAuthenticData();
|
||||||
|
} catch (Throwable ex) {
|
||||||
|
Log.w(ex);
|
||||||
|
record.authentic = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ("mx".equals(type) || "srv".equals(type))
|
if ("mx".equals(type) || "srv".equals(type))
|
||||||
|
@ -568,6 +584,7 @@ public class DnsHelper {
|
||||||
@Override
|
@Override
|
||||||
public void onAnswer(@NonNull byte[] bytes, int rcode) {
|
public void onAnswer(@NonNull byte[] bytes, int rcode) {
|
||||||
try {
|
try {
|
||||||
|
Log.i("DNS rcode=" + rcode);
|
||||||
DnsMessage answer = new DnsMessage(bytes)
|
DnsMessage answer = new DnsMessage(bytes)
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setResponseCode(DnsMessage.RESPONSE_CODE.getResponseCode(rcode))
|
.setResponseCode(DnsMessage.RESPONSE_CODE.getResponseCode(rcode))
|
||||||
|
|
Loading…
Reference in New Issue