CarrotChat v2.8.60.240131版本的 MD5 值为:2baf8b9f31830b86b5c5a85ae6b47e05
以下内容为反编译后的 b.java 源代码,内容仅作参考
package de.measite.minidns;
import de.measite.minidns.AbstractDNSClient;
import de.measite.minidns.DNSMessage;
import de.measite.minidns.d.d;
import de.measite.minidns.d.e;
import de.measite.minidns.util.MultipleIoException;
import java.io.IOException;
import java.net.Inet4Address;
import java.net.Inet6Address;
import java.net.InetAddress;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArraySet;
import java.util.logging.Level;
import java.util.logging.Logger;
public class b extends AbstractDNSClient {
static final List<d> h = new ArrayList();
static final Set<Inet4Address> i;
static final Set<Inet6Address> j;
private static final Set<String> k;
private final Set<InetAddress> l;
private boolean m;
private boolean n;
private boolean o;
static class a {
static final int[] a;
static final int[] f15523b;
static {
int[] iArr = new int[DNSMessage.RESPONSE_CODE.values().length];
f15523b = iArr;
try {
iArr[DNSMessage.RESPONSE_CODE.NO_ERROR.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
try {
f15523b[DNSMessage.RESPONSE_CODE.NX_DOMAIN.ordinal()] = 2;
} catch (NoSuchFieldError unused2) {
}
int[] iArr2 = new int[AbstractDNSClient.IpVersionSetting.values().length];
a = iArr2;
try {
iArr2[AbstractDNSClient.IpVersionSetting.v4v6.ordinal()] = 1;
} catch (NoSuchFieldError unused3) {
}
try {
a[AbstractDNSClient.IpVersionSetting.v6v4.ordinal()] = 2;
} catch (NoSuchFieldError unused4) {
}
try {
a[AbstractDNSClient.IpVersionSetting.v4only.ordinal()] = 3;
} catch (NoSuchFieldError unused5) {
}
try {
a[AbstractDNSClient.IpVersionSetting.v6only.ordinal()] = 4;
} catch (NoSuchFieldError unused6) {
}
}
}
static {
CopyOnWriteArraySet copyOnWriteArraySet = new CopyOnWriteArraySet();
i = copyOnWriteArraySet;
j = new CopyOnWriteArraySet();
addDnsServerLookupMechanism(de.measite.minidns.d.b.f15535d);
addDnsServerLookupMechanism(de.measite.minidns.d.c.f15536d);
addDnsServerLookupMechanism(e.f15537d);
try {
copyOnWriteArraySet.add(de.measite.minidns.util.e.ipv4From("8.8.8.8"));
} catch (IllegalArgumentException e2) {
AbstractDNSClient.f15480b.log(Level.WARNING, "Could not add static IPv4 DNS Server", (Throwable) e2);
}
try {
j.add(de.measite.minidns.util.e.ipv6From("[2001:4860:4860::8888]"));
} catch (IllegalArgumentException e3) {
AbstractDNSClient.f15480b.log(Level.WARNING, "Could not add static IPv6 DNS Server", (Throwable) e3);
}
k = Collections.newSetFromMap(new ConcurrentHashMap(4));
}
public b() {
this.l = Collections.newSetFromMap(new ConcurrentHashMap(4));
this.m = false;
this.n = false;
this.o = true;
}
public static boolean addBlacklistedDnsServer(String str) {
return k.add(str);
}
public static synchronized void addDnsServerLookupMechanism(d dVar) {
synchronized (b.class) {
if (!dVar.isAvailable()) {
Logger logger = AbstractDNSClient.f15480b;
logger.fine("Not adding " + dVar.getName() + " as it is not available.");
return;
}
List<d> list = h;
list.add(dVar);
Collections.sort(list);
}
}
public static synchronized String[] findDNS() {
String[] strArr;
synchronized (b.class) {
strArr = null;
Iterator<d> it = h.iterator();
while (true) {
if (!it.hasNext()) {
break;
}
d next = it.next();
String[] dnsServerAddresses = next.getDnsServerAddresses();
if (dnsServerAddresses != null) {
ArrayList arrayList = new ArrayList(Arrays.asList(dnsServerAddresses));
Iterator it2 = arrayList.iterator();
while (it2.hasNext()) {
String str = (String) it2.next();
if (k.contains(str)) {
Logger logger = AbstractDNSClient.f15480b;
logger.fine("The DNS server lookup mechanism '" + next.getName() + "' returned a blacklisted result: '" + str + "'");
it2.remove();
}
}
if (!arrayList.isEmpty()) {
break;
}
}
strArr = dnsServerAddresses;
}
}
return strArr;
}
public static boolean removeBlacklistedDnsServer(String str) {
return k.remove(str);
}
public static synchronized boolean removeDNSServerLookupMechanism(d dVar) {
boolean remove;
synchronized (b.class) {
remove = h.remove(dVar);
}
return remove;
}
@Override
public DNSMessage.b f(DNSMessage.b bVar) {
bVar.setRecursionDesired(true);
bVar.getEdnsBuilder().setUdpPayloadSize(this.g.getUdpPayloadSize()).setDnssecOk(this.m);
return bVar;
}
public InetAddress getRandomHarcodedIpv6DnsServer() {
return (InetAddress) de.measite.minidns.util.c.getRandomFrom(j, this.f15483e);
}
public InetAddress getRandomHardcodedIpv4DnsServer() {
return (InetAddress) de.measite.minidns.util.c.getRandomFrom(i, this.f15483e);
}
public boolean isAskForDnssec() {
return this.m;
}
public boolean isDisableResultFilter() {
return this.n;
}
public boolean isUseHardcodedDnsServersEnabled() {
return this.o;
}
@Override
public DNSMessage query(DNSMessage.b bVar) throws IOException {
int length;
int i2;
InetAddress randomHardcodedIpv4DnsServer;
InetAddress randomHarcodedIpv6DnsServer;
DNSMessage build = f(bVar).build();
de.measite.minidns.a aVar = this.f;
DNSMessage dNSMessage = aVar == null ? null : aVar.get(build);
if (dNSMessage != null) {
return dNSMessage;
}
String[] findDNS = findDNS();
if (findDNS == null) {
findDNS = new String[0];
length = 0;
} else {
length = findDNS.length;
}
ArrayList<InetAddress> arrayList = new ArrayList(length + 2);
for (String str : findDNS) {
if (str != null && !str.isEmpty()) {
arrayList.add(InetAddress.getByName(str));
} else {
AbstractDNSClient.f15480b.finest("findDns() returned null or empty string as dns server");
}
}
InetAddress[] inetAddressArr = new InetAddress[2];
if (this.o) {
int i3 = a.a[AbstractDNSClient.f15481c.ordinal()];
if (i3 == 1) {
randomHardcodedIpv4DnsServer = getRandomHardcodedIpv4DnsServer();
randomHarcodedIpv6DnsServer = getRandomHarcodedIpv6DnsServer();
} else if (i3 != 2) {
if (i3 == 3) {
randomHardcodedIpv4DnsServer = getRandomHardcodedIpv4DnsServer();
} else if (i3 != 4) {
randomHardcodedIpv4DnsServer = null;
randomHarcodedIpv6DnsServer = null;
} else {
randomHardcodedIpv4DnsServer = getRandomHarcodedIpv6DnsServer();
}
randomHarcodedIpv6DnsServer = null;
} else {
randomHardcodedIpv4DnsServer = getRandomHarcodedIpv6DnsServer();
randomHarcodedIpv6DnsServer = getRandomHardcodedIpv4DnsServer();
}
inetAddressArr[0] = randomHardcodedIpv4DnsServer;
inetAddressArr[1] = randomHarcodedIpv6DnsServer;
}
for (int i4 = 0; i4 < 2; i4++) {
InetAddress inetAddress = inetAddressArr[i4];
if (inetAddress != null) {
arrayList.add(inetAddress);
}
}
ArrayList arrayList2 = new ArrayList(arrayList.size());
for (InetAddress inetAddress2 : arrayList) {
if (this.l.contains(inetAddress2)) {
AbstractDNSClient.f15480b.finer("Skipping " + inetAddress2 + " because it was marked as \"recursion not available\"");
} else {
try {
DNSMessage query = query(build, inetAddress2);
if (query != null) {
if (!query.i) {
if (this.l.add(inetAddress2)) {
AbstractDNSClient.f15480b.warning("The DNS server " + inetAddress2 + " returned a response without the \"recursion available\" (RA) flag set. This likely indicates a misconfiguration because the server is not suitable for DNS resolution");
}
} else if (this.n || (i2 = a.f15523b[query.f15486d.ordinal()]) == 1 || i2 == 2) {
return query;
} else {
String str2 = "Response from " + inetAddress2 + " asked for " + build.getQuestion() + " with error code: " + query.f15486d + '.';
Logger logger = AbstractDNSClient.f15480b;
if (!logger.isLoggable(Level.FINE)) {
str2 = str2 + "\n" + query;
}
logger.warning(str2);
}
}
} catch (IOException e2) {
arrayList2.add(e2);
}
}
}
MultipleIoException.throwIfRequired(arrayList2);
return null;
}
public void setAskForDnssec(boolean z) {
this.m = z;
}
public void setDisableResultFilter(boolean z) {
this.n = z;
}
public void setUseHardcodedDnsServers(boolean z) {
this.o = z;
}
public b(de.measite.minidns.a aVar) {
super(aVar);
this.l = Collections.newSetFromMap(new ConcurrentHashMap(4));
this.m = false;
this.n = false;
this.o = true;
}
}