Ostrich VPN v1.19.0222版本的 MD5 值为:1b442e5f3dd93fd660d88d6f4b94ace3
以下内容为反编译后的 InterceptorUtil.java 源代码,内容仅作参考
package com.best.free.vpn.proxy.http;
import android.content.Context;
import android.text.TextUtils;
import com.best.free.vpn.proxy.BuildConfig;
import com.best.free.vpn.proxy.http.InterceptorUtil;
import com.best.free.vpn.proxy.util.LogKt;
import com.best.free.vpn.proxy.util.MD5Utils;
import com.google.common.net.HttpHeaders;
import java.util.Locale;
import kotlin.Metadata;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import okhttp3.Interceptor;
import okhttp3.Request;
import okhttp3.Response;
import okhttp3.logging.HttpLoggingInterceptor;
@Metadata(d1 = {"\u0000\f\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0003\u0018\u0000 \u00032\u00020\u0001:\u0001\u0003B\u0005¢\u0006\u0002\u0010\u0002¨\u0006\u0004"}, d2 = {"Lcom/best/free/vpn/proxy/http/InterceptorUtil;", "", "()V", "Companion", "vpnkt-v1.19.0(222)_release"}, k = 1, mv = {1, 9, 0}, xi = 48)
public final class InterceptorUtil {
public static final Companion INSTANCE = new Companion(null);
private static final String TAG = "InterceptorUtil";
@Metadata(d1 = {"\u0000(\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010\u000e\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\b\u0086\u0003\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002J\u0010\u0010\u0005\u001a\u00020\u00042\b\u0010\u0006\u001a\u0004\u0018\u00010\u0007J\u0006\u0010\b\u001a\u00020\tJ\u0006\u0010\n\u001a\u00020\tJ\u0006\u0010\u000b\u001a\u00020\fR\u000e\u0010\u0003\u001a\u00020\u0004X\u0082T¢\u0006\u0002\n\u0000¨\u0006\r"}, d2 = {"Lcom/best/free/vpn/proxy/http/InterceptorUtil$Companion;", "", "()V", "TAG", "", "getSignature", "context", "Landroid/content/Context;", "headerInterceptor", "Lokhttp3/Interceptor;", "ipConnect", "logInterceptor", "Lokhttp3/logging/HttpLoggingInterceptor;", "vpnkt-v1.19.0(222)_release"}, k = 1, mv = {1, 9, 0}, xi = 48)
public static final class Companion {
public Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
public final Interceptor ipConnect() {
return new Interceptor() {
@Override
public final Response intercept(Interceptor.Chain chain) {
Response ipConnect$lambda$1;
ipConnect$lambda$1 = InterceptorUtil.Companion.ipConnect$lambda$1(chain);
return ipConnect$lambda$1;
}
};
}
private Companion() {
}
public final HttpLoggingInterceptor logInterceptor() {
return new HttpLoggingInterceptor(new HttpLoggingInterceptor.Logger() {
@Override
public final void log(String str) {
InterceptorUtil.Companion.logInterceptor$lambda$0(str);
}
}).setLevel(HttpLoggingInterceptor.Level.BODY);
}
public static final void logInterceptor$lambda$0(String it) {
Intrinsics.checkNotNullParameter(it, "it");
LogKt.logD(InterceptorUtil.TAG, "Http Log ---> " + it);
}
public final Interceptor headerInterceptor() {
return new Interceptor() {
@Override
public Response intercept(Interceptor.Chain chain) {
Intrinsics.checkNotNullParameter(chain, "chain");
Request request = chain.request();
if (request.body() == null) {
return chain.proceed(request);
}
return chain.proceed(request.newBuilder().header(HttpHeaders.CONTENT_TYPE, "application/json").build());
}
};
}
public static final Response ipConnect$lambda$1(Interceptor.Chain chain) {
Intrinsics.checkNotNullParameter(chain, "chain");
Request request = chain.request();
String host = request.url().host();
LogKt.logD(InterceptorUtil.TAG, "ipConnect: host: " + host);
if (Intrinsics.areEqual(host, "13.248.170.49")) {
return chain.proceed(request.newBuilder().url(request.url().newBuilder().host("api.getgreatapps.com").build()).build().newBuilder().build());
}
if (Intrinsics.areEqual(host, "34.192.229.242")) {
return chain.proceed(request.newBuilder().url(request.url().newBuilder().host("rconf.net").build()).build().newBuilder().build());
}
return chain.proceed(request);
}
public final String getSignature(Context context) {
String str;
if (context == null) {
return "";
}
String textToMD5L32 = MD5Utils.textToMD5L32(BuildConfig.APPLICATION_ID);
String signMd5Str = MD5Utils.getSignMd5Str(context);
if (signMd5Str != null) {
Locale ENGLISH = Locale.ENGLISH;
Intrinsics.checkNotNullExpressionValue(ENGLISH, "ENGLISH");
str = signMd5Str.toUpperCase(ENGLISH);
Intrinsics.checkNotNullExpressionValue(str, "this as java.lang.String).toUpperCase(locale)");
} else {
str = null;
}
String str2 = "{\"VERSION\":\"119000222\",\"APP\":\"" + textToMD5L32 + "\"}";
if (TextUtils.isEmpty(str)) {
return "";
}
Intrinsics.checkNotNull(str);
return textToMD5L32 + MD5Utils.hmacSha1WithBase64(str2, str);
}
}
}