This commit is contained in:
M66B
2024-01-02 18:59:34 +01:00
parent f80792ca2d
commit 48007f5857
6 changed files with 13 additions and 36 deletions

View File

@@ -309,29 +309,6 @@ public class DnsHelper {
}
}
static InetAddress getByName(Context context, String host) throws UnknownHostException {
return getAllByName(context, host)[0];
}
static InetAddress[] getAllByName(Context context, String host) throws UnknownHostException {
List<InetAddress> result = new ArrayList<>();
boolean[] has46 = ConnectionHelper.has46(context);
if (has46[0])
for (DnsRecord a : lookup(context, host, "a"))
result.add(a.address);
if (has46[1])
for (DnsRecord aaaa : lookup(context, host, "aaaa"))
result.add(aaaa.address);
if (result.size() == 0)
throw new UnknownHostException(host);
else
return result.toArray(new InetAddress[0]);
}
private static List<String> getDnsServers(Context context) {
List<String> result = new ArrayList<>();
result.add(DEFAULT_DNS);