流利说-英语 v8.47.26版本的 MD5 值为:0079dce5ff96e6cdbc95c261b3f51387

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


package com.liulishuo.thanossdk.network.dns.provider;

import com.liulishuo.thanossdk.utils.ThanosSelfLog;
import java.util.ArrayList;
import java.util.Iterator;
import kotlin.collections.ak;
import kotlin.e.j;
import kotlin.e.n;
import kotlin.i;
import kotlin.jvm.internal.o;
import kotlin.jvm.internal.t;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
import okhttp3.ResponseBody;
import org.json.JSONArray;
import org.json.JSONObject;

@i
public final class a implements com.liulishuo.thanossdk.network.dns.b {
    private final OkHttpClient bUd;
    private final String iTD;
    private final String id;

    public a(OkHttpClient.Builder okHttpBuilder, String id, String apiUrl) {
        t.f(okHttpBuilder, "okHttpBuilder");
        t.f(id, "id");
        t.f(apiUrl, "apiUrl");
        this.id = id;
        this.iTD = apiUrl;
        this.bUd = okHttpBuilder.build();
    }

    public a(OkHttpClient.Builder builder, String str, String str2, int i, o oVar) {
        this(builder, str, (i & 4) != 0 ? "203.107.1.33" : str2);
    }

    @Override
    public com.liulishuo.thanossdk.network.dns.a te(String domain) {
        Response response;
        boolean z;
        t.f(domain, "domain");
        com.liulishuo.thanossdk.network.dns.a aVar = new com.liulishuo.thanossdk.network.dns.a();
        try {
            response = this.bUd.newCall(new Request.Builder().url("http://" + this.iTD + '/' + this.id + "/d?host=" + domain).build()).execute();
            t.d(response, "response");
        } catch (Exception e) {
            aVar.lJ(false);
            aVar.td("AliYun query error, exception = " + e.getMessage());
            ThanosSelfLog.a(ThanosSelfLog.iUo, null, new kotlin.jvm.a.a<String>() {
                {
                    super(0);
                }

                @Override
                public final String invoke() {
                    return "AliYun query error, exception = " + e.getMessage();
                }
            }, 1, null);
        }
        if (response.isSuccessful()) {
            ResponseBody body = response.body();
            String string = body != null ? body.string() : null;
            String str = string;
            if (str != null && str.length() != 0) {
                z = false;
                if (z) {
                    JSONArray jSONArray = new JSONObject(string).getJSONArray("ips");
                    if (jSONArray.length() > 0) {
                        aVar.lJ(true);
                        j eG = n.eG(0, jSONArray.length());
                        ArrayList arrayList = new ArrayList(kotlin.collections.t.a(eG, 10));
                        Iterator<Integer> it = eG.iterator();
                        while (it.hasNext()) {
                            arrayList.add(jSONArray.getString(((ak) it).nextInt()));
                        }
                        aVar.ez(arrayList);
                        return aVar;
                    }
                    throw new RuntimeException("AliYun ips is empty");
                }
                throw new RuntimeException("AliYun response body is empty");
            }
            z = true;
            if (z) {
            }
        } else {
            throw new RuntimeException("AliYun response is not Successful");
        }
    }

    @Override
    public String dky() {
        return this.iTD;
    }
}