mirror of
https://github.com/M66B/FairEmail.git
synced 2025-02-24 07:01:05 +00:00
Simplification
This commit is contained in:
parent
da4c70db32
commit
b87ddb9ca6
1 changed files with 10 additions and 12 deletions
|
@ -254,10 +254,10 @@ public class DnsHelper {
|
|||
result.add(new DnsRecord(sb.toString(), 0));
|
||||
} else if (answer instanceof A) {
|
||||
A a = (A) answer;
|
||||
result.add(new DnsRecord(a.getInetAddress().getHostAddress()));
|
||||
result.add(new DnsRecord(a.getInetAddress()));
|
||||
} else if (answer instanceof AAAA) {
|
||||
AAAA aaaa = (AAAA) answer;
|
||||
result.add(new DnsRecord(aaaa.getInetAddress().getHostAddress()));
|
||||
result.add(new DnsRecord(aaaa.getInetAddress()));
|
||||
} else
|
||||
throw new IllegalArgumentException(answer.getClass().getName());
|
||||
}
|
||||
|
@ -288,19 +288,11 @@ public class DnsHelper {
|
|||
|
||||
if (has46[0])
|
||||
for (DnsRecord a : lookup(context, host, "a"))
|
||||
try {
|
||||
result.add(Inet4Address.getByName(a.response));
|
||||
} catch (UnknownHostException ex) {
|
||||
Log.e(ex);
|
||||
}
|
||||
result.add(a.address);
|
||||
|
||||
if (has46[1])
|
||||
for (DnsRecord aaaa : lookup(context, host, "aaaa"))
|
||||
try {
|
||||
result.add(Inet6Address.getByName(aaaa.response));
|
||||
} catch (UnknownHostException ex) {
|
||||
Log.e(ex);
|
||||
}
|
||||
result.add(aaaa.address);
|
||||
|
||||
if (result.size() == 0)
|
||||
throw new UnknownHostException(host);
|
||||
|
@ -371,11 +363,17 @@ public class DnsHelper {
|
|||
Integer priority;
|
||||
Integer weight;
|
||||
Boolean secure;
|
||||
InetAddress address;
|
||||
|
||||
DnsRecord(String response) {
|
||||
this.response = response;
|
||||
}
|
||||
|
||||
DnsRecord(InetAddress address) {
|
||||
this.address = address;
|
||||
this.response = address.getHostAddress();
|
||||
}
|
||||
|
||||
DnsRecord(String response, int port) {
|
||||
this.response = response;
|
||||
this.port = port;
|
||||
|
|
Loading…
Reference in a new issue