Fast Orange v3.5.3版本的 MD5 值为:33b91aba50c566533dfd683a85f79158

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


package com.github.shadowsocks.utils;

import androidx.constraintlayout.widget.ConstraintLayout;
import com.free.vpn.proxy.hotspot.dz1;
import com.free.vpn.proxy.hotspot.x74;
import com.free.vpn.proxy.hotspot.zs4;
import com.github.shadowsocks.fmt.gson.GsonsKt;
import com.github.shadowsocks.fmt.wireguard.WireGuardBean;
import com.github.shadowsocks.ktx.NetsKt;
import com.github.shadowsocks.utils.cf.DeviceResponse;
import com.github.shadowsocks.utils.cf.RegisterRequest;
import com.github.shadowsocks.utils.cf.UpdateDeviceRequest;
import com.google.gson.Gson;
import io.sentry.o2;
import kotlin.Metadata;
import okhttp3.MediaType;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;
import okhttp3.ResponseBody;
import okhttp3.internal.Util;

@Metadata(d1 = {"\u0000\u001a\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010\u000e\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0000\bÆ\u0002\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002J\u0006\u0010\b\u001a\u00020\tR\u000e\u0010\u0003\u001a\u00020\u0004X\u0082T¢\u0006\u0002\n\u0000R\u000e\u0010\u0005\u001a\u00020\u0004X\u0082T¢\u0006\u0002\n\u0000R\u000e\u0010\u0006\u001a\u00020\u0004X\u0082T¢\u0006\u0002\n\u0000R\u000e\u0010\u0007\u001a\u00020\u0004X\u0082T¢\u0006\u0002\n\u0000¨\u0006\n"}, d2 = {"Lcom/github/shadowsocks/utils/Cloudflare;", "", "()V", "API_URL", "", "API_VERSION", "CLIENT_VERSION", "CLIENT_VERSION_KEY", "makeWireGuardConfiguration", "Lcom/github/shadowsocks/fmt/wireguard/WireGuardBean;", "shadowsocks_release"}, k = 1, mv = {1, 8, 0}, xi = ConstraintLayout.LayoutParams.Table.LAYOUT_CONSTRAINT_VERTICAL_CHAINSTYLE)
public final class Cloudflare {
    private static final String API_URL = "https://api.cloudflareclient.com";
    private static final String API_VERSION = "v0a1922";
    private static final String CLIENT_VERSION = "a-6.3-1922";
    private static final String CLIENT_VERSION_KEY = "CF-Client-Version";
    public static final Cloudflare INSTANCE = new Cloudflare();

    private Cloudflare() {
    }

    public final WireGuardBean makeWireGuardConfiguration() {
        o2 o2Var = new o2(15, (Object) null);
        OkHttpClient createProxyClient = NetsKt.createProxyClient();
        RegisterRequest.Companion companion = RegisterRequest.INSTANCE;
        dz1 dz1Var = (dz1) o2Var.c;
        zs4.n(dz1Var, "keyPair.publicKey");
        String newRequest = companion.newRequest(dz1Var);
        Request.Builder header = new Request.Builder().url("https://api.cloudflareclient.com/v0a1922/reg").header("Accept", "application/json").header(CLIENT_VERSION_KEY, CLIENT_VERSION);
        RequestBody.Companion companion2 = RequestBody.INSTANCE;
        MediaType.Companion companion3 = MediaType.INSTANCE;
        Response execute = createProxyClient.newCall(header.post(companion2.create(newRequest, companion3.get("application/json"))).build()).execute();
        if (execute.isSuccessful()) {
            Gson gson = GsonsKt.getGson();
            ResponseBody body = execute.body();
            zs4.l(body);
            DeviceResponse deviceResponse = (DeviceResponse) gson.fromJson(body.string(), DeviceResponse.class);
            String token = deviceResponse.getToken();
            String newRequest$default = UpdateDeviceRequest.Companion.newRequest$default(UpdateDeviceRequest.INSTANCE, null, false, 3, null);
            zs4.n(newRequest$default, "UpdateDeviceRequest.newRequest()");
            Request.Builder url = new Request.Builder().url("https://api.cloudflareclient.com/v0a1922/reg/" + deviceResponse.getId() + "/account/reg/" + deviceResponse.getId());
            StringBuilder sb = new StringBuilder("Bearer ");
            sb.append(token);
            Response execute2 = createProxyClient.newCall(url.header("Authorization", sb.toString()).header("Accept", "application/json").header(CLIENT_VERSION_KEY, CLIENT_VERSION).patch(companion2.create(newRequest$default, companion3.get("application/json"))).build()).execute();
            try {
                if (execute2.isSuccessful()) {
                    DeviceResponse.Config.Peer peer = deviceResponse.getConfig().getPeers().get(0);
                    DeviceResponse.Config.Interface.Addresses addresses = deviceResponse.getConfig().getInterfaceX().getAddresses();
                    WireGuardBean wireGuardBean = new WireGuardBean();
                    wireGuardBean.name = "CloudFlare Warp " + deviceResponse.getAccount().getId();
                    wireGuardBean.setPrivateKey(((dz1) o2Var.b).d());
                    wireGuardBean.setPeerPublicKey(peer.getPublicKey());
                    String host = peer.getEndpoint().getHost();
                    wireGuardBean.serverAddress = x74.B1(host, ":", host);
                    wireGuardBean.serverPort = Integer.valueOf(Integer.parseInt(x74.y1(peer.getEndpoint().getHost(), ":")));
                    wireGuardBean.setLocalAddress(addresses.getV4() + "\n" + addresses.getV6());
                    return wireGuardBean;
                }
                throw new IllegalStateException(execute2.toString());
            } finally {
                ResponseBody body2 = execute2.body();
                if (body2 != null) {
                    Util.closeQuietly(body2);
                }
            }
        }
        throw new IllegalStateException(execute.toString());
    }
}