AdGuard v3.6.45版本的 MD5 值为:ce30a13dcef92cf942973fffcc6d20fb

以下内容为反编译后的 a.java 源代码,内容仅作参考


package com.adguard.kit.net.a;

import java.io.PrintStream;
import java.util.HashMap;
import java.util.Map;
import org.apache.commons.lang3.StringUtils;
import org.b.a.ar;
import org.b.a.bd;
import org.b.a.bh;
import org.b.a.bq;
import org.b.a.ca;
import org.b.a.cd;
import org.b.a.cp;
import org.b.a.cu;
import org.slf4j.c;
import org.slf4j.d;
public final class a {
    public static final C0062a b = new C0062a((byte) 0);
    private static final c c = d.a(a.class);
    private static volatile a d;
    public final Map<String, String> f753a;

    public static final class C0062a {
        private C0062a() {
        }

        public C0062a(byte b) {
            this();
        }

        public final a a() {
            a aVar;
            a aVar2 = a.d;
            if (aVar2 == null) {
                synchronized (this) {
                    aVar = a.d;
                    if (aVar == null) {
                        aVar = new a((byte) 0);
                        a.d = aVar;
                    }
                }
                return aVar;
            }
            return aVar2;
        }
    }

    private a() {
        this.f753a = new HashMap();
    }

    public a(byte b2) {
        this();
    }

    public static String a(String str) {
        ca caVar;
        boolean z;
        long j;
        byte[] a2;
        ar arVar;
        bq bqVar;
        bq a3;
        try {
            caVar = new ca("8.8.8.8");
        } catch (Exception e) {
            e = e;
        }
        try {
            ar a4 = ar.a(bq.a(new bd(str), 16, 1));
            if (bh.a("verbose")) {
                PrintStream printStream = System.err;
                StringBuffer stringBuffer = new StringBuffer("Sending to ");
                stringBuffer.append(caVar.f1332a.getAddress().getHostAddress());
                stringBuffer.append(":");
                stringBuffer.append(caVar.f1332a.getPort());
                printStream.println(stringBuffer.toString());
            }
            if (a4.f1307a.d() == 0 && (a3 = a4.a()) != null && a3.f() == 252) {
                arVar = caVar.b(a4);
            } else {
                ar arVar2 = (ar) a4.clone();
                if (caVar.e != null && arVar2.d() == null) {
                    arVar2.a(caVar.e, 3);
                }
                if (caVar.f != null) {
                    caVar.f.a(arVar2, null);
                }
                byte[] f = arVar2.f();
                int a5 = ca.a(arVar2);
                long currentTimeMillis = System.currentTimeMillis() + caVar.g;
                boolean z2 = false;
                while (true) {
                    if (!caVar.c && f.length <= a5) {
                        z = z2;
                        if (z) {
                            j = currentTimeMillis;
                            a2 = cp.a(caVar.b, caVar.f1332a, f, a5, currentTimeMillis);
                        } else {
                            a2 = cd.a(caVar.b, caVar.f1332a, f, currentTimeMillis);
                            j = currentTimeMillis;
                        }
                        if (a2.length >= 12) {
                            throw new cu("invalid DNS header - too short");
                        }
                        int i = ((a2[0] & 255) << 8) + (a2[1] & 255);
                        int b2 = arVar2.f1307a.b();
                        if (i != b2) {
                            StringBuffer stringBuffer2 = new StringBuffer("invalid message id: expected ");
                            stringBuffer2.append(b2);
                            stringBuffer2.append("; got id ");
                            stringBuffer2.append(i);
                            String stringBuffer3 = stringBuffer2.toString();
                            if (z) {
                                throw new cu(stringBuffer3);
                            }
                            if (bh.a("verbose")) {
                                System.err.println(stringBuffer3);
                            }
                            z2 = z;
                            currentTimeMillis = j;
                        } else {
                            ar a6 = ca.a(a2);
                            ca.a(arVar2, a6, a2, caVar.f);
                            if (z || caVar.d || !a6.f1307a.b(6)) {
                                break;
                            }
                            currentTimeMillis = j;
                            z2 = true;
                        }
                    }
                    z = true;
                    if (z) {
                    }
                    if (a2.length >= 12) {
                    }
                }
            }
            bq[] a7 = arVar.a(1);
            String b3 = (a7 == null || (bqVar = a7[0]) == null) ? null : bqVar.b();
            if (b3 != null) {
                return "https://" + StringUtils.substringBetween(b3, "\"", "\"");
            }
            return null;
        } catch (Exception e2) {
            e = e2;
            c.warn("Failed to resolve fallback host with ".concat(String.valueOf(str)), (Throwable) e);
            return null;
        }
    }
}