Fast Orange v3.5.3版本的 MD5 值为:33b91aba50c566533dfd683a85f79158
以下内容为反编译后的 TrojanGoFmtKt.java 源代码,内容仅作参考
package com.github.shadowsocks.fmt.trojan_go;
import androidx.autofill.HintConstants;
import com.free.vpn.proxy.hotspot.br1;
import com.free.vpn.proxy.hotspot.jf2;
import com.free.vpn.proxy.hotspot.pl0;
import com.free.vpn.proxy.hotspot.uq1;
import com.free.vpn.proxy.hotspot.x74;
import com.free.vpn.proxy.hotspot.zm2;
import com.free.vpn.proxy.hotspot.zs4;
import com.github.shadowsocks.Key;
import com.github.shadowsocks.database.DataStore;
import com.github.shadowsocks.fmt.shadowsocks.ShadowsocksFmtKt;
import com.github.shadowsocks.fmt.v2ray.StandardV2RayBean;
import com.github.shadowsocks.ktx.FormatsKt;
import com.github.shadowsocks.ktx.NetsKt;
import com.github.shadowsocks.ktx.UtilsKt;
import com.github.shadowsocks.plugin.PluginConfiguration;
import com.github.shadowsocks.plugin.PluginContract;
import com.github.shadowsocks.plugin.PluginManager;
import com.github.shadowsocks.plugin.PluginOptions;
import com.google.android.gms.appindex.ThingPropertyKeys;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import kotlin.Metadata;
import kotlin.Unit;
import libcore.Libcore;
import libcore.URL;
@Metadata(d1 = {"\u0000\"\n\u0002\u0010\u000e\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\b\n\u0000\n\u0002\u0010\u000b\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0000\u001a\u000e\u0010\u0003\u001a\u00020\u00022\u0006\u0010\u0001\u001a\u00020\u0000\u001a\n\u0010\u0004\u001a\u00020\u0000*\u00020\u0002\u001a\u001a\u0010\t\u001a\u00020\u0000*\u00020\u00022\u0006\u0010\u0006\u001a\u00020\u00052\u0006\u0010\b\u001a\u00020\u0007\u001a\u0016\u0010\u000b\u001a\u00020\u00002\u0006\u0010\n\u001a\u00020\u00002\u0006\u0010\u0006\u001a\u00020\u0005\u001a\n\u0010\u0003\u001a\u00020\u0002*\u00020\f¨\u0006\r"}, d2 = {"", "server", "Lcom/github/shadowsocks/fmt/trojan_go/TrojanGoBean;", "parseTrojanGo", "toUri", "", "port", "", "mux", "buildTrojanGoConfig", "config", "buildCustomTrojanConfig", "Lcom/free/vpn/proxy/hotspot/br1;", "shadowsocks_release"}, k = 2, mv = {1, 8, 0})
public final class TrojanGoFmtKt {
public static final String buildCustomTrojanConfig(String str, int i) {
zs4.o(str, "config");
br1 br1Var = new br1(str);
br1Var.m(Integer.valueOf(i), "local_port");
String c = pl0.c(br1Var, 4);
zs4.n(c, "conf.toStringPretty()");
return c;
}
public static final String buildTrojanGoConfig(TrojanGoBean trojanGoBean, int i, boolean z) {
int i2;
boolean z2;
zs4.o(trojanGoBean, "<this>");
br1 br1Var = new br1();
br1Var.m("client", "run_type");
br1Var.m("127.0.0.1", "local_addr");
br1Var.m(Integer.valueOf(i), "local_port");
br1Var.m(trojanGoBean.finalAddress, "remote_addr");
br1Var.m(Integer.valueOf(trojanGoBean.finalPort), "remote_port");
uq1 uq1Var = new uq1();
uq1Var.add(trojanGoBean.getPassword());
Unit unit = Unit.INSTANCE;
br1Var.m(uq1Var, HintConstants.AUTOFILL_HINT_PASSWORD);
DataStore dataStore = DataStore.INSTANCE;
if (dataStore.getEnableLog()) {
i2 = 0;
} else {
i2 = 2;
}
br1Var.m(Integer.valueOf(i2), "log_level");
if (z) {
br1 br1Var2 = new br1();
br1Var2.m(Boolean.TRUE, ThingPropertyKeys.ENABLED);
br1Var2.m(Integer.valueOf(dataStore.getMuxConcurrency()), "concurrency");
br1Var.m(br1Var2, "mux");
}
br1 br1Var3 = new br1();
if (dataStore.getIpv6Mode() <= 1) {
z2 = true;
} else {
z2 = false;
}
br1Var3.m(Boolean.valueOf(z2), "prefer_ipv4");
br1Var.m(br1Var3, StandardV2RayBean.TYPE_TCP);
String type = trojanGoBean.getType();
if (!zs4.h(type, "original") && zs4.h(type, StandardV2RayBean.TYPE_WS)) {
br1 br1Var4 = new br1();
br1Var4.m(Boolean.TRUE, ThingPropertyKeys.ENABLED);
br1Var4.m(trojanGoBean.getHost(), "host");
br1Var4.m(trojanGoBean.getPath(), PluginContract.COLUMN_PATH);
br1Var.m(br1Var4, "websocket");
}
if (x74.a1(trojanGoBean.getSni()) && zs4.h(trojanGoBean.finalAddress, "127.0.0.1")) {
String str = trojanGoBean.serverAddress;
zs4.n(str, Key.SERVER_ADDRESS);
if (!NetsKt.isIpAddress(str)) {
String str2 = trojanGoBean.serverAddress;
zs4.n(str2, Key.SERVER_ADDRESS);
trojanGoBean.setSni(str2);
}
}
br1 br1Var5 = new br1();
if (!x74.a1(trojanGoBean.getSni())) {
br1Var5.m(trojanGoBean.getSni(), "sni");
}
if (trojanGoBean.getAllowInsecure()) {
br1Var5.m(Boolean.FALSE, "verify");
}
br1Var.m(br1Var5, "ssl");
if (!zs4.h(trojanGoBean.getEncryption(), "none") && x74.r1(trojanGoBean.getEncryption(), "ss;", false)) {
br1 br1Var6 = new br1();
br1Var6.m(Boolean.TRUE, ThingPropertyKeys.ENABLED);
String encryption = trojanGoBean.getEncryption();
br1Var6.m(x74.A1(x74.v1(encryption, ";", encryption), ":"), "method");
String encryption2 = trojanGoBean.getEncryption();
br1Var6.m(x74.v1(encryption2, ":", encryption2), HintConstants.AUTOFILL_HINT_PASSWORD);
br1Var.m(br1Var6, "shadowsocks");
}
if (!x74.a1(trojanGoBean.getPlugin())) {
String plugin = trojanGoBean.getPlugin();
if (plugin == null) {
plugin = "";
}
PluginManager.InitResult init = PluginManager.INSTANCE.init(new PluginConfiguration(plugin));
if (init != null) {
String path = init.getPath();
PluginOptions options = init.getOptions();
init.getIsV2();
br1 br1Var7 = new br1();
br1Var7.m(Boolean.TRUE, ThingPropertyKeys.ENABLED);
br1Var7.m("shadowsocks", "type");
br1Var7.m(path, "command");
br1Var7.m(String.valueOf(options), "option");
br1Var.m(br1Var7, "transport_plugin");
}
}
String c = pl0.c(br1Var, 4);
zs4.n(c, "JSONObject().also { conf… }\n }.toStringPretty()");
return c;
}
public static final TrojanGoBean parseTrojanGo(br1 br1Var) {
br1 b;
br1 b2;
br1 b3;
br1 b4;
zs4.o(br1Var, "<this>");
TrojanGoBean trojanGoBean = (TrojanGoBean) FormatsKt.applyDefaultValues(new TrojanGoBean());
trojanGoBean.serverAddress = jf2.d(br1Var, "remote_addr", trojanGoBean.serverAddress);
trojanGoBean.serverPort = jf2.b(br1Var, "remote_port", trojanGoBean.serverPort);
Object obj = br1Var.get(HintConstants.AUTOFILL_HINT_PASSWORD);
int i = 0;
if (!(obj instanceof String)) {
if (obj instanceof List) {
obj = ((List) obj).get(0);
zs4.m(obj, "null cannot be cast to non-null type kotlin.String");
}
b = pl0.b(br1Var, "ssl");
if (b != null) {
String d = jf2.d(b, "sni", trojanGoBean.getSni());
zs4.n(d, "getStr(\"sni\", sni)");
trojanGoBean.setSni(d);
Boolean a = jf2.a(b, "verify", Boolean.TRUE);
zs4.n(a, "getBool(\"verify\", true)");
trojanGoBean.setAllowInsecure(a.booleanValue());
}
b2 = pl0.b(br1Var, "websocket");
if (b2 != null) {
Boolean a2 = jf2.a(b2, ThingPropertyKeys.ENABLED, Boolean.FALSE);
zs4.n(a2, "getBool(\"enabled\", false)");
if (a2.booleanValue()) {
trojanGoBean.setType(StandardV2RayBean.TYPE_WS);
String d2 = jf2.d(b2, "host", trojanGoBean.getHost());
zs4.n(d2, "getStr(\"host\", host)");
trojanGoBean.setHost(d2);
String d3 = jf2.d(b2, PluginContract.COLUMN_PATH, trojanGoBean.getPath());
zs4.n(d3, "getStr(\"path\", path)");
trojanGoBean.setPath(d3);
}
}
b3 = pl0.b(br1Var, "shadowsocks");
String str = "";
if (b3 != null) {
Boolean a3 = jf2.a(b3, ThingPropertyKeys.ENABLED, Boolean.FALSE);
zs4.n(a3, "getBool(\"enabled\", false)");
if (a3.booleanValue()) {
trojanGoBean.setEncryption("ss;" + jf2.d(b3, "method", "") + ":" + jf2.d(b3, HintConstants.AUTOFILL_HINT_PASSWORD, ""));
}
}
b4 = pl0.b(br1Var, "transport_plugin");
if (b4 != null) {
Boolean a4 = jf2.a(b4, ThingPropertyKeys.ENABLED, Boolean.FALSE);
zs4.n(a4, "getBool(\"enabled\", false)");
if (a4.booleanValue() && zs4.h(trojanGoBean.getType(), "shadowsocks")) {
PluginConfiguration pluginConfiguration = new PluginConfiguration();
String k = b4.k("command");
zs4.n(k, "getStr(\"command\")");
pluginConfiguration.setSelected(k);
uq1 a5 = pl0.a(b4, "arg");
if (a5 != null) {
Map<String, PluginOptions> pluginsOptions = pluginConfiguration.getPluginsOptions();
String selected = pluginConfiguration.getSelected();
PluginOptions pluginOptions = new PluginOptions();
Iterator it = a5.iterator();
while (it.hasNext()) {
Object next = it.next();
int i2 = i + 1;
if (i < 0) {
zm2.w0();
throw null;
}
if (i % 2 != 0) {
str = next.toString();
} else {
pluginOptions.put(str, next.toString());
}
i = i2;
}
pluginsOptions.put(selected, pluginOptions);
}
String k2 = b4.k("option");
if (k2 != null) {
pluginConfiguration.getPluginsOptions().put(pluginConfiguration.getSelected(), new PluginOptions(k2));
}
ShadowsocksFmtKt.fixInvalidParams(pluginConfiguration);
trojanGoBean.setPlugin(pluginConfiguration.toString());
}
}
return trojanGoBean;
}
trojanGoBean.setPassword((String) obj);
b = pl0.b(br1Var, "ssl");
if (b != null) {
}
b2 = pl0.b(br1Var, "websocket");
if (b2 != null) {
}
b3 = pl0.b(br1Var, "shadowsocks");
String str2 = "";
if (b3 != null) {
}
b4 = pl0.b(br1Var, "transport_plugin");
if (b4 != null) {
}
return trojanGoBean;
}
public static final String toUri(TrojanGoBean trojanGoBean) {
zs4.o(trojanGoBean, "<this>");
URL newURL = Libcore.newURL("trojan-go");
newURL.setHost(trojanGoBean.serverAddress);
Integer num = trojanGoBean.serverPort;
zs4.n(num, Key.SERVER_PORT);
newURL.setPort(num.intValue());
newURL.setUsername(trojanGoBean.getPassword());
if (!x74.a1(trojanGoBean.getSni())) {
newURL.addQueryParameter("sni", trojanGoBean.getSni());
}
if ((!x74.a1(trojanGoBean.getType())) && !zs4.h(trojanGoBean.getType(), "original")) {
newURL.addQueryParameter("type", trojanGoBean.getType());
if (zs4.h(trojanGoBean.getType(), StandardV2RayBean.TYPE_WS)) {
if (!x74.a1(trojanGoBean.getHost())) {
newURL.addQueryParameter("host", trojanGoBean.getHost());
}
if (!x74.a1(trojanGoBean.getPath())) {
newURL.addQueryParameter(PluginContract.COLUMN_PATH, trojanGoBean.getPath());
}
}
}
if ((!x74.a1(trojanGoBean.getType())) && !zs4.h(trojanGoBean.getType(), "none")) {
newURL.addQueryParameter("encryption", trojanGoBean.getEncryption());
}
if (!x74.a1(trojanGoBean.getPlugin())) {
newURL.addQueryParameter(PluginContract.SCHEME, trojanGoBean.getPlugin());
}
zs4.n(trojanGoBean.name, "name");
if (!x74.a1(r1)) {
String str = trojanGoBean.name;
zs4.n(str, "name");
newURL.setRawFragment(UtilsKt.urlSafe(str));
}
String string = newURL.getString();
zs4.n(string, "builder.string");
return string;
}
public static final TrojanGoBean parseTrojanGo(String str) {
zs4.o(str, "server");
URL parseURL = Libcore.parseURL(str);
TrojanGoBean trojanGoBean = new TrojanGoBean();
trojanGoBean.serverAddress = parseURL.getHost();
trojanGoBean.serverPort = Integer.valueOf(parseURL.getPort());
String username = parseURL.getUsername();
zs4.n(username, "link.username");
trojanGoBean.setPassword(username);
String queryParameter = NetsKt.queryParameter(parseURL, "sni");
if (queryParameter != null) {
trojanGoBean.setSni(queryParameter);
}
String queryParameter2 = NetsKt.queryParameter(parseURL, "type");
if (queryParameter2 != null) {
trojanGoBean.setType(queryParameter2);
if (zs4.h(trojanGoBean.getType(), StandardV2RayBean.TYPE_WS)) {
String queryParameter3 = NetsKt.queryParameter(parseURL, "host");
if (queryParameter3 != null) {
trojanGoBean.setHost(queryParameter3);
}
String queryParameter4 = NetsKt.queryParameter(parseURL, PluginContract.COLUMN_PATH);
if (queryParameter4 != null) {
trojanGoBean.setPath(queryParameter4);
}
}
}
String queryParameter5 = NetsKt.queryParameter(parseURL, "encryption");
if (queryParameter5 != null) {
trojanGoBean.setEncryption(queryParameter5);
}
String queryParameter6 = NetsKt.queryParameter(parseURL, PluginContract.SCHEME);
if (queryParameter6 != null) {
trojanGoBean.setPlugin(queryParameter6);
}
String fragment = parseURL.getFragment();
if (!(true ^ (fragment == null || x74.a1(fragment)))) {
fragment = null;
}
if (fragment != null) {
trojanGoBean.name = fragment;
}
return trojanGoBean;
}
}