Swiggy v4.51.1版本的 MD5 值为:5af7ec91512a0a8c1510e3f8bac20b8b
以下内容为反编译后的 SwiggyBaseDns.java 源代码,内容仅作参考
package in.swiggy.android.tejas.dns;
import in.swiggy.android.commons.utils.x;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.List;
import kotlin.Unit;
import kotlin.collections.r;
import kotlin.jvm.functions.n;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.o;
import okhttp3.Dns;
import org.xbill.DNS.Lookup;
import org.xbill.DNS.SimpleResolver;
public class SwiggyBaseDns implements Dns {
private static final String CLOUDFLARE_DNS_RESOLVER = "1.1.1.1";
private static final String GOOGLE_BACKUP_DNS_RESOLVER = "8.8.4.4";
private static final String GOOGLE_DNS_RESOLVER = "8.8.8.8";
private boolean initialized;
public static final Companion Companion = new Companion(null);
private static final String TAG = SwiggyBaseDns.class.getName();
public static final class Companion {
public Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private Companion() {
}
}
private final void init() {
if (this.initialized) {
return;
}
this.initialized = true;
Lookup.setDefaultResolver(new SwiggyResolver(new SimpleResolver[]{new SimpleResolver(GOOGLE_DNS_RESOLVER), new SimpleResolver(CLOUDFLARE_DNS_RESOLVER), new SimpleResolver(GOOGLE_BACKUP_DNS_RESOLVER)}, new n<Integer, String, Integer, Unit>() {
{
super(3);
}
@Override
public Unit invoke(Integer num, String str, Integer num2) {
invoke2(num, str, num2);
return Unit.a;
}
public final void invoke2(Integer num, String str, Integer num2) {
SwiggyBaseDns swiggyBaseDns = SwiggyBaseDns.this;
o.h(num);
int intValue = num.intValue();
o.h(str);
o.h(num2);
swiggyBaseDns.onDnsResolved(intValue, str, num2.intValue());
}
}));
}
@Override
public List<InetAddress> lookup(String hostname) {
List<InetAddress> s;
o.k(hostname, "hostname");
try {
init();
s = r.s(SwiggyAddress.getByName(hostname));
onCustomResolution(hostname);
return s;
} catch (Throwable th) {
x.i(TAG, th);
throw new UnknownHostException(hostname);
}
}
public void onCustomResolution(String hostName) {
o.k(hostName, "hostName");
}
public void onDnsResolved(int i, String host, int i2) {
o.k(host, "host");
}
}