同程有借 v1.0.0版本的 MD5 值为:e33397cdbab33543d0c134ec96d77fb8

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


package com.bonree.sdk.bm;

import com.bonree.sdk.bm.a;
import com.bonree.sdk.bm.h;
import com.bonree.sdk.bq.a;
import com.bonree.sdk.bw.v;
import java.io.IOException;
import java.net.Inet4Address;
import java.net.Inet6Address;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.Collection;
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.CopyOnWriteArrayList;
import java.util.concurrent.CopyOnWriteArraySet;
import java.util.logging.Level;
import java.util.logging.Logger;
public class e extends a {
    private static List<com.bonree.sdk.bt.d> f5187g = new CopyOnWriteArrayList();
    private static Set<Inet4Address> f5188h = new CopyOnWriteArraySet();
    private static Set<Inet6Address> f5189i = new CopyOnWriteArraySet();
    private static final Set<String> f5190j;
    private static boolean f5191o = true;
    private final Set<InetAddress> f5192k;
    private boolean f5193l;
    private boolean f5194m;
    private boolean f5195n;

    static {
        a(com.bonree.sdk.bt.b.f5364b);
        a(com.bonree.sdk.bt.c.f5367b);
        a(com.bonree.sdk.bt.e.f5369b);
        try {
            f5188h.add(com.bonree.sdk.by.g.a("8.8.8.8"));
        } catch (IllegalArgumentException e9) {
            a.f5172a.log(Level.WARNING, "Could not add static IPv4 DNS Server", (Throwable) e9);
        }
        try {
            f5189i.add(com.bonree.sdk.by.g.b("[2001:4860:4860::8888]"));
        } catch (IllegalArgumentException e10) {
            a.f5172a.log(Level.WARNING, "Could not add static IPv6 DNS Server", (Throwable) e10);
        }
        f5190j = Collections.newSetFromMap(new ConcurrentHashMap(4));
    }

    public e() {
        this.f5192k = Collections.newSetFromMap(new ConcurrentHashMap(4));
        this.f5193l = false;
        this.f5194m = false;
        this.f5195n = true;
    }

    private List<InetAddress> b() {
        InetAddress h9;
        List<InetAddress> d9 = d();
        if (this.f5195n) {
            InetAddress inetAddress = null;
            int i9 = f.f5196a[this.f5178f.ordinal()];
            if (i9 == 1) {
                h9 = h();
                inetAddress = i();
            } else if (i9 == 2) {
                h9 = i();
                inetAddress = h();
            } else if (i9 == 3) {
                h9 = h();
            } else if (i9 == 4) {
                h9 = i();
            } else {
                throw new AssertionError("Unknown ipVersionSetting: " + this.f5178f);
            }
            d9.add(h9);
            if (inetAddress != null) {
                d9.add(inetAddress);
            }
        }
        return d9;
    }

    private static List<InetAddress> d() {
        InetAddress byName;
        List<String> c9 = c();
        if (c9 == null) {
            return new ArrayList();
        }
        a.EnumC0059a enumC0059a = a.f5173e;
        ArrayList arrayList = enumC0059a.f5182v4 ? new ArrayList(c9.size()) : null;
        ArrayList arrayList2 = enumC0059a.f5183v6 ? new ArrayList(c9.size()) : null;
        int i9 = 0;
        for (String str : c9) {
            if (!f5191o && !com.bonree.sdk.by.g.c(str)) {
                throw new AssertionError();
            }
            try {
                byName = InetAddress.getByName(str);
            } catch (UnknownHostException e9) {
                Logger logger = a.f5172a;
                Level level = Level.SEVERE;
                logger.log(level, "Could not transform '" + str + "' to InetAddress", (Throwable) e9);
            }
            if (byName instanceof Inet4Address) {
                if (enumC0059a.f5182v4) {
                    arrayList.add((Inet4Address) byName);
                }
            } else if (byName instanceof Inet6Address) {
                if (enumC0059a.f5183v6) {
                    arrayList2.add((Inet6Address) byName);
                }
            } else {
                throw new AssertionError("The address '" + byName + "' is neither of type Inet(4|6)Address");
            }
            i9++;
        }
        ArrayList arrayList3 = new ArrayList(i9);
        int i10 = f.f5196a[enumC0059a.ordinal()];
        if (i10 == 1) {
            arrayList3.addAll(arrayList);
            arrayList3.addAll(arrayList2);
        } else if (i10 == 2) {
            arrayList3.addAll(arrayList2);
            arrayList3.addAll(arrayList);
        } else if (i10 == 3) {
            arrayList3.addAll(arrayList);
        } else if (i10 == 4) {
            arrayList3.addAll(arrayList2);
        }
        return arrayList3;
    }

    private boolean e() {
        return this.f5193l;
    }

    private boolean f() {
        return this.f5194m;
    }

    private boolean g() {
        return this.f5195n;
    }

    private InetAddress h() {
        return (InetAddress) com.bonree.sdk.ai.d.a(f5188h, this.f5175b);
    }

    private InetAddress i() {
        return (InetAddress) com.bonree.sdk.ai.d.a(f5189i, this.f5175b);
    }

    @Override
    public final com.bonree.sdk.bs.c a(a.C0061a c0061a) throws IOException {
        int i9;
        com.bonree.sdk.bq.a b9 = c(c0061a).b();
        d dVar = this.f5176c;
        com.bonree.sdk.bs.a a9 = dVar == null ? null : dVar.a(b9);
        if (a9 != null) {
            return a9;
        }
        List<InetAddress> b10 = b();
        ArrayList arrayList = new ArrayList(b10.size());
        for (InetAddress inetAddress : b10) {
            if (this.f5192k.contains(inetAddress)) {
                a.f5172a.finer("Skipping " + inetAddress + " because it was marked as \"recursion not available\"");
            } else {
                try {
                    com.bonree.sdk.bs.c a10 = a(b9, inetAddress, 53);
                    com.bonree.sdk.bq.a aVar = a10.f5348a;
                    if (!aVar.f5274h) {
                        if (this.f5192k.add(inetAddress)) {
                            a.f5172a.warning("The DNS server " + inetAddress + " 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.f5194m || (i9 = f.f5197b[aVar.f5269c.ordinal()]) == 1 || i9 == 2) {
                        return a10;
                    } else {
                        String str = "Response from " + inetAddress + " asked for " + b9.b() + " with error code: " + aVar.f5269c + '.';
                        Logger logger = a.f5172a;
                        if (!logger.isLoggable(Level.FINE)) {
                            str = str + "\n" + aVar;
                        }
                        logger.warning(str);
                        arrayList.add(new h.a(b9, a10));
                    }
                } catch (IOException e9) {
                    arrayList.add(e9);
                }
            }
        }
        com.bonree.sdk.by.h.a((List<? extends IOException>) arrayList);
        throw new h.c(b9);
    }

    @Override
    protected final a.C0061a c(a.C0061a c0061a) {
        c0061a.c(true);
        c0061a.a().a(this.f5177d.b()).a(this.f5193l);
        return c0061a;
    }

    private static List<String> c() {
        com.bonree.sdk.bt.d next;
        Iterator<com.bonree.sdk.bt.d> it = f5187g.iterator();
        loop0: while (true) {
            List<String> list = null;
            while (true) {
                if (!it.hasNext()) {
                    break loop0;
                }
                try {
                    list = it.next().c();
                    continue;
                } catch (SecurityException e9) {
                    a.f5172a.log(Level.WARNING, "Could not lookup DNS server", (Throwable) e9);
                    continue;
                }
                if (list != null) {
                    break;
                }
            }
            a.f5172a.warning("The DNS server lookup mechanism '" + next.a() + "' returned not a single valid IP address after sanitazion");
        }
    }

    private e(d dVar) {
        super(dVar);
        this.f5192k = Collections.newSetFromMap(new ConcurrentHashMap(4));
        this.f5193l = false;
        this.f5194m = false;
        this.f5195n = true;
    }

    @Override
    protected final i<com.bonree.sdk.bs.c, IOException> b(a.C0061a c0061a) {
        com.bonree.sdk.bq.a b9 = c(c0061a).b();
        d dVar = this.f5176c;
        com.bonree.sdk.bs.a a9 = dVar == null ? null : dVar.a(b9);
        if (a9 != null) {
            return i.a(a9);
        }
        List<InetAddress> b10 = b();
        Iterator<InetAddress> it = b10.iterator();
        while (it.hasNext()) {
            InetAddress next = it.next();
            if (this.f5192k.contains(next)) {
                it.remove();
                Logger logger = a.f5172a;
                logger.finer("Skipping " + next + " because it was marked as \"recursion not available\"");
            }
        }
        ArrayList arrayList = new ArrayList(b10.size());
        for (InetAddress inetAddress : b10) {
            arrayList.add(b(b9, inetAddress));
        }
        return i.a((Collection) arrayList);
    }

    private void c(boolean z8) {
        this.f5195n = z8;
    }

    private static void a(com.bonree.sdk.bt.d dVar) {
        if (!dVar.d()) {
            Logger logger = a.f5172a;
            logger.fine("Not adding " + dVar.a() + " as it is not available.");
            return;
        }
        synchronized (f5187g) {
            ArrayList arrayList = new ArrayList(f5187g.size() + 1);
            arrayList.addAll(f5187g);
            arrayList.add(dVar);
            Collections.sort(arrayList);
            f5187g.clear();
            f5187g.addAll(arrayList);
        }
    }

    private static boolean b(com.bonree.sdk.bt.d dVar) {
        boolean remove;
        synchronized (f5187g) {
            remove = f5187g.remove(dVar);
        }
        return remove;
    }

    private static boolean b(String str) {
        return f5190j.remove(str);
    }

    private void b(boolean z8) {
        this.f5194m = z8;
    }

    private static boolean a(String str) {
        return f5190j.add(str);
    }

    private void a(boolean z8) {
        this.f5193l = z8;
    }

    private static com.bonree.sdk.bq.c a(com.bonree.sdk.br.a aVar) {
        return new com.bonree.sdk.bq.c(aVar, v.b.PTR);
    }

    private static com.bonree.sdk.bq.c a(Inet4Address inet4Address) {
        return a(com.bonree.sdk.br.a.a(com.bonree.sdk.by.g.a(inet4Address), com.bonree.sdk.br.a.f5321b));
    }

    private static com.bonree.sdk.bq.c a(Inet6Address inet6Address) {
        return a(com.bonree.sdk.br.a.a(com.bonree.sdk.by.g.a(inet6Address), com.bonree.sdk.br.a.f5322c));
    }

    private static com.bonree.sdk.bq.c a(InetAddress inetAddress) {
        if (inetAddress instanceof Inet4Address) {
            return a(com.bonree.sdk.br.a.a(com.bonree.sdk.by.g.a((Inet4Address) inetAddress), com.bonree.sdk.br.a.f5321b));
        }
        if (inetAddress instanceof Inet6Address) {
            return a(com.bonree.sdk.br.a.a(com.bonree.sdk.by.g.a((Inet6Address) inetAddress), com.bonree.sdk.br.a.f5322c));
        }
        throw new IllegalArgumentException("The provided inetAddress '" + inetAddress + "' is neither of type Inet4Address nor Inet6Address");
    }
}