Proxy Master v3.4.9版本的 MD5 值为:14d0aa2468d13530c8f6e96bcc114bf5

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


package za;

import android.os.Build;
import android.text.TextUtils;
import com.google.android.gms.common.internal.ImagesContract;
import com.google.android.gms.games.Games;
import com.v2ray.ang.dto.V2rayConfig;
import java.io.BufferedReader;
import java.io.Reader;
import java.io.StringReader;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Locale;
import java.util.Map;
import java.util.Scanner;
import java.util.Vector;
public final class a {
    public final String[] f37465a = {"config", "tls-server"};
    public final String[] f37466b = {"tls-client", "allow-recursive-routing", "askpass", "auth-nocache", "up", "down", "route-up", "ipchange", "route-pre-down", "auth-user-pass-verify", "block-outside-dns", "client-cert-not-required", "dhcp-release", "dhcp-renew", "dh", "group", "ip-win32", "ifconfig-nowarn", "management-hold", "management", "management-client", "management-query-remote", "management-query-passwords", "management-query-proxy", "management-external-key", "management-forget-disconnect", "management-signal", "management-log-cache", "management-up-down", "management-client-user", "management-client-group", "pause-exit", "preresolve", "plugin", "machine-readable-output", "persist-key", "push", "register-dns", "route-delay", "route-gateway", "route-metric", "route-method", Games.EXTRA_STATUS, "script-security", "show-net-up", "suppress-timestamps", "tap-sleep", "tmp-dir", "tun-ipv6", "topology", "user", "win-sys"};
    public final String[][] f37467c = {new String[]{"setenv", "IV_GUI_VER"}, new String[]{"setenv", "IV_SSO"}, new String[]{"setenv", "IV_PLAT_VER"}, new String[]{"setenv", "IV_OPENVPN_GUI_VERSION"}, new String[]{"engine", "dynamic"}, new String[]{"setenv", "CLIENT_CERT"}, new String[]{"resolv-retry", "60"}};
    public final HashSet<String> f37468d = new HashSet<>(Arrays.asList(ImagesContract.LOCAL, "remote", "float", "port", "connect-retry", "connect-timeout", "connect-retry-max", "link-mtu", "tun-mtu", "tun-mtu-extra", "fragment", "mtu-disc", "local-port", "remote-port", "bind", "nobind", "proto", "http-proxy", "http-proxy-retry", "http-proxy-timeout", "http-proxy-option", "socks-proxy", "socks-proxy-retry", "http-proxy-user-pass", "explicit-exit-notify"));
    public final HashMap<String, Vector<Vector<String>>> f37469e = new HashMap<>();
    public final HashMap<String, Vector<String>> f37470f = new HashMap<>();

    public static class C0440a extends Exception {
        public C0440a(String str) {
            super(str);
        }
    }

    public static void a(wa.g gVar, Vector vector, boolean z6) {
        boolean z9 = false;
        if (z6) {
            Iterator it = vector.iterator();
            boolean z10 = false;
            while (it.hasNext()) {
                Vector vector2 = (Vector) it.next();
                for (int i10 = 1; i10 < vector2.size(); i10++) {
                    if (((String) vector2.get(i10)).equals("block-local")) {
                        gVar.Q = false;
                    } else if (((String) vector2.get(i10)).equals("unblock-local")) {
                        gVar.Q = true;
                    } else if (((String) vector2.get(i10)).equals("!ipv4")) {
                        z10 = true;
                    } else if (((String) vector2.get(i10)).equals("ipv6")) {
                        gVar.G = true;
                    }
                }
            }
            z9 = z10;
        }
        if (!z6 || z9) {
            return;
        }
        gVar.f36250q = true;
    }

    public static void b(Vector vector, BufferedReader bufferedReader) {
        String trim = ((String) vector.get(0)).trim();
        if (!trim.startsWith("<") || !trim.endsWith(">")) {
            return;
        }
        String substring = trim.substring(1, trim.length() - 1);
        String format = String.format("</%s>", substring);
        String str = "[[INLINE]]";
        while (true) {
            String readLine = bufferedReader.readLine();
            if (readLine == null) {
                throw new C0440a(String.format("No endtag </%s> for starttag <%s> found", substring, substring));
            }
            if (readLine.trim().equals(format)) {
                if (str.endsWith("\n")) {
                    str = str.substring(0, str.length() - 1);
                }
                vector.clear();
                vector.add(substring);
                vector.add(str);
                return;
            }
            str = android.support.v4.media.b.l(android.support.v4.media.b.l(str, readLine), "\n");
        }
    }

    public static boolean h(String str) {
        if (str.equals("udp") || str.equals("udp4") || str.equals("udp6")) {
            return true;
        }
        if (str.equals("tcp-client") || str.equals(V2rayConfig.DEFAULT_NETWORK) || str.equals("tcp4") || str.endsWith("tcp4-client") || str.equals("tcp6") || str.endsWith("tcp6-client")) {
            return false;
        }
        throw new C0440a("Unsupported option to --proto ".concat(str));
    }

    public static Vector k(String str) {
        Vector vector = new Vector();
        if (str.length() == 0) {
            return vector;
        }
        boolean z6 = true;
        String str2 = "";
        int i10 = 0;
        boolean z9 = false;
        char c10 = 0;
        while (true) {
            char charAt = i10 < str.length() ? str.charAt(i10) : (char) 0;
            if (!z9 && charAt == '\\' && !z6) {
                z9 = true;
            } else if (z6) {
                if (!(Character.isWhitespace(charAt) || charAt == 0)) {
                    if (charAt == ';' || charAt == '#') {
                        break;
                    } else if (!z9 && charAt == '\"') {
                        z6 = true;
                    } else if (z9 || charAt != '\'') {
                        z6 = true;
                        c10 = charAt;
                    } else {
                        z6 = true;
                    }
                }
                if (z6) {
                    vector.add(str2);
                    z6 = true;
                    str2 = "";
                    c10 = 0;
                }
                if (z9 && c10 != 0 && c10 != '\\' && c10 != '\"') {
                    if (!(!Character.isWhitespace(c10) || c10 == 0)) {
                        throw new C0440a("Options warning: Bad backslash ('\\') usage");
                    }
                }
                z9 = false;
            } else {
                if (z6) {
                    if (!z9) {
                    }
                    c10 = charAt;
                } else if (z6) {
                    if (!z9) {
                    }
                    c10 = charAt;
                } else if (z6) {
                }
                if (z6) {
                }
                if (z9) {
                    if (!(!Character.isWhitespace(c10) || c10 == 0)) {
                    }
                }
                z9 = false;
            }
            if (c10 != 0) {
                str2 = str2 + c10;
            }
            int i11 = i10 + 1;
            if (i10 >= str.length()) {
                break;
            }
            i10 = i11;
        }
        return vector;
    }

    public final wa.g c() {
        boolean z6;
        int i10;
        int i11;
        int i12;
        Vector e10;
        Vector d10;
        Vector e11;
        int i13;
        HashMap<String, Vector<String>> hashMap;
        Vector<String> vector;
        String[] strArr;
        boolean z9;
        Iterator<Vector<Vector<String>>> it;
        boolean z10;
        b[] bVarArr;
        String join;
        wa.g gVar = new wa.g();
        gVar.f36227e0 = "unknown";
        boolean z11 = false;
        gVar.f36252r = false;
        gVar.f36234i = false;
        gVar.f36250q = false;
        gVar.G = false;
        gVar.f36256u = false;
        gVar.f36255t = false;
        gVar.I = false;
        gVar.Q = true;
        gVar.f36223c0 = false;
        gVar.S = 0;
        gVar.F = false;
        HashMap<String, Vector<Vector<String>>> hashMap2 = this.f37469e;
        if (hashMap2.containsKey("client") || hashMap2.containsKey("pull")) {
            gVar.f36252r = true;
            hashMap2.remove("pull");
            hashMap2.remove("client");
        }
        int i14 = 2;
        Vector e12 = e(1, 2, "secret");
        int i15 = 3;
        if (e12 != null) {
            gVar.f36220b = 4;
            gVar.f36238k = true;
            gVar.f36228f = (String) e12.get(1);
            if (e12.size() == 3) {
                gVar.f36226e = (String) e12.get(2);
            }
        } else {
            z11 = true;
        }
        Vector d11 = d(1, 4, "route");
        if (d11 != null) {
            Iterator it2 = d11.iterator();
            String str = "";
            String str2 = str;
            while (it2.hasNext()) {
                Vector vector2 = (Vector) it2.next();
                String str3 = vector2.size() >= i15 ? (String) vector2.get(i14) : "255.255.255.255";
                String str4 = vector2.size() >= 4 ? (String) vector2.get(i15) : "vpn_gateway";
                try {
                    o.f fVar = new o.f((String) vector2.get(1), str3);
                    if (str4.equals("net_gateway")) {
                        str2 = str2 + fVar.toString() + " ";
                    } else {
                        str = str + fVar.toString() + " ";
                    }
                    i14 = 2;
                    i15 = 3;
                } catch (ArrayIndexOutOfBoundsException unused) {
                    throw new C0440a(android.support.v4.media.b.y("Could not parse netmask of route ", str3));
                } catch (NumberFormatException unused2) {
                    throw new C0440a(android.support.v4.media.b.y("Could not parse netmask of route ", str3));
                }
            }
            gVar.f36254s = str;
            gVar.R = str2;
        }
        Vector d12 = d(1, 4, "route-ipv6");
        if (d12 != null) {
            Iterator it3 = d12.iterator();
            String str5 = "";
            while (it3.hasNext()) {
                str5 = android.support.v4.media.b.q(o.h.b(str5), (String) ((Vector) it3.next()).get(1), " ");
            }
            gVar.H = str5;
        }
        if (e(0, 0, "route-nopull") != null) {
            gVar.f36261z = true;
        }
        Vector d13 = d(1, 2, "tls-auth");
        if (d13 != null) {
            Iterator it4 = d13.iterator();
            while (it4.hasNext()) {
                Vector vector3 = (Vector) it4.next();
                if (vector3 != null) {
                    if (!((String) vector3.get(1)).equals("[inline]")) {
                        gVar.f36228f = (String) vector3.get(1);
                        gVar.f36238k = true;
                    }
                    if (vector3.size() == 3) {
                        gVar.f36226e = (String) vector3.get(2);
                    }
                }
            }
        }
        Vector e13 = e(1, 1, "key-direction");
        if (e13 != null) {
            gVar.f36226e = (String) e13.get(1);
        }
        String[] strArr2 = {"tls-crypt", "tls-crypt-v2"};
        for (int i16 = 0; i16 < 2; i16++) {
            String str6 = strArr2[i16];
            Vector e14 = e(1, 1, str6);
            if (e14 != null) {
                gVar.f36238k = true;
                gVar.f36228f = (String) e14.get(1);
                gVar.f36226e = str6;
            }
        }
        Vector d14 = d(0, 7, "redirect-gateway");
        if (d14 != null) {
            a(gVar, d14, true);
        }
        Vector d15 = d(0, 5, "redirect-private");
        if (d15 != null) {
            a(gVar, d15, false);
        }
        Vector e15 = e(1, 1, "dev");
        Vector e16 = e(1, 1, "dev-type");
        if ((e16 == null || !((String) e16.get(1)).equals("tun")) && ((e15 == null || !((String) e15.get(1)).startsWith("tun")) && !(e16 == null && e15 == null))) {
            throw new C0440a("Sorry. Only tun mode is supported. See the FAQ for more detail");
        }
        Vector e17 = e(0, 2, "mssfix");
        if (e17 != null) {
            if (e17.size() >= 2) {
                try {
                    gVar.S = Integer.parseInt((String) e17.get(1));
                } catch (NumberFormatException unused3) {
                    throw new C0440a("Argument to --mssfix has to be an integer");
                }
            } else {
                gVar.S = 1450;
            }
            if (e17.size() >= 3 && !((String) e17.get(2)).equals("mtu")) {
                throw new C0440a("Second argument to --mssfix unkonwn");
            }
        }
        Vector e18 = e(1, 1, "tun-mtu");
        if (e18 != null) {
            try {
                gVar.f36221b0 = Integer.parseInt((String) e18.get(1));
            } catch (NumberFormatException unused4) {
                throw new C0440a("Argument to --tun-mtu has to be an integer");
            }
        }
        Vector e19 = e(1, 1, "mode");
        if (e19 == null || ((String) e19.get(1)).equals("p2p")) {
            int i17 = 2;
            Vector d16 = d(2, 2, "dhcp-option");
            if (d16 != null) {
                Iterator it5 = d16.iterator();
                while (it5.hasNext()) {
                    Vector vector4 = (Vector) it5.next();
                    String str7 = (String) vector4.get(1);
                    String str8 = (String) vector4.get(i17);
                    if (str7.equals("DOMAIN")) {
                        gVar.f36248p = (String) vector4.get(i17);
                    } else if (str7.equals("DNS")) {
                        gVar.f36246o = true;
                        if (gVar.f36240l.equals("9.9.9.9")) {
                            gVar.f36240l = str8;
                            gVar.f36242m = "";
                        } else {
                            gVar.f36242m = str8;
                        }
                    }
                    i17 = 2;
                }
            }
            Vector e20 = e(2, 2, "ifconfig");
            if (e20 != null) {
                try {
                    gVar.f36244n = new o.f((String) e20.get(1), (String) e20.get(2)).toString();
                } catch (NumberFormatException e21) {
                    throw new C0440a("Could not pase ifconfig IP address: " + e21.getLocalizedMessage());
                }
            }
            if (e(0, 0, "remote-random-hostname") != null) {
                gVar.A = true;
            }
            if (e(0, 0, "float") != null) {
                gVar.B = true;
            }
            if (e(0, 1, "comp-lzo") != null) {
                gVar.f36234i = true;
            }
            Vector e22 = e(1, 1, "ncp-ciphers");
            Vector e23 = e(1, 1, "data-ciphers");
            Vector e24 = e(1, 1, "cipher");
            if (e24 != null) {
                gVar.E = (String) e24.get(1);
            }
            if (e23 != null) {
                gVar.f36235i0 = (String) e23.get(1);
            } else if (e22 != null) {
                gVar.f36235i0 = (String) e22.get(1);
            }
            Vector e25 = e(1, 1, "tls-cert-profile");
            if (e25 != null) {
                String str9 = (String) e25.get(1);
                String[] strArr3 = {"insecure", "preferred", "legacy", "suiteb"};
                int i18 = 0;
                while (true) {
                    if (i18 >= 4) {
                        break;
                    } else if (strArr3[i18].equals(str9)) {
                        gVar.f36247o0 = str9;
                        break;
                    } else {
                        i18++;
                    }
                }
                if (!str9.equals(gVar.f36247o0)) {
                    throw new C0440a(android.support.v4.media.c.o("Invalid tls-cert-profile '", str9, "'"));
                }
            }
            Vector e26 = e(1, 9, "provider");
            if (e26 != null) {
                String lowerCase = ((String) e26.get(1)).toLowerCase(Locale.ROOT);
                if (lowerCase.equals("legacy:default") || lowerCase.equals("default:legacy")) {
                    gVar.f36245n0 = true;
                }
                Iterator it6 = e26.iterator();
                while (it6.hasNext()) {
                    if ("legacy".equals(((String) it6.next()).toLowerCase(Locale.ROOT))) {
                        gVar.f36245n0 = true;
                    }
                }
            }
            Vector e27 = e(1, 1, "compat-mode");
            if (e27 != null) {
                Scanner scanner = new Scanner((String) e27.get(1));
                scanner.useDelimiter("\\.");
                gVar.f36243m0 = (scanner.nextInt() * 100) + (scanner.nextInt() * 10000) + scanner.nextInt();
            }
            Vector e28 = e(1, 1, "auth");
            if (e28 != null) {
                gVar.N = (String) e28.get(1);
            }
            Vector e29 = e(1, 1, "ca");
            if (e29 != null) {
                gVar.f36232h = (String) e29.get(1);
            }
            Vector d17 = d(1, 1, "peer-fingerprint");
            if (d17 != null) {
                gVar.f36239k0 = true;
                Iterator it7 = d17.iterator();
                while (it7.hasNext()) {
                    Vector vector5 = (Vector) it7.next();
                    if (((String) vector5.get(1)).startsWith("[[INLINE]]")) {
                        gVar.f36241l0 += ((String) vector5.get(1)).substring(10) + "\n";
                    } else {
                        StringBuilder sb2 = new StringBuilder();
                        sb2.append(gVar.f36241l0);
                        gVar.f36241l0 = android.support.v4.media.b.q(sb2, (String) vector5.get(1), "\n");
                    }
                }
            }
            Vector e30 = e(1, 1, "cert");
            if (e30 != null) {
                gVar.f36224d = (String) e30.get(1);
                z11 = false;
                gVar.f36220b = 0;
            }
            Vector e31 = e(1, 1, "key");
            if (e31 != null) {
                gVar.f36230g = (String) e31.get(1);
            }
            Vector e32 = e(1, 1, "pkcs12");
            if (e32 != null) {
                gVar.f36236j = (String) e32.get(1);
                i10 = 2;
                gVar.f36220b = 2;
                z6 = false;
            } else {
                z6 = z11;
                i10 = 2;
            }
            if (e(1, 1, "cryptoapicert") != null) {
                gVar.f36220b = i10;
                z6 = false;
            }
            Vector e33 = e(1, i10, "compat-names");
            Vector e34 = e(1, 1, "no-name-remapping");
            Vector e35 = e(1, 1, "tls-remote");
            if (e35 != null) {
                gVar.f36257v = (String) e35.get(1);
                gVar.f36255t = true;
                gVar.O = 0;
                if (e33 != null) {
                    i11 = 2;
                } else {
                    i11 = 2;
                }
            } else {
                i11 = 2;
            }
            Vector e36 = e(1, i11, "verify-x509-name");
            if (e36 != null) {
                gVar.f36257v = (String) e36.get(1);
                gVar.f36255t = true;
                if (e36.size() <= i11) {
                    gVar.O = i11;
                } else if (((String) e36.get(i11)).equals("name")) {
                    gVar.O = 3;
                } else if (((String) e36.get(i11)).equals("subject")) {
                    gVar.O = i11;
                } else if (!((String) e36.get(i11)).equals("name-prefix")) {
                    throw new C0440a("Unknown parameter to verify-x509-name: " + ((String) e36.get(i11)));
                } else {
                    gVar.O = 4;
                }
            }
            Vector e37 = e(1, 1, "x509-username-field");
            if (e37 != null) {
                gVar.P = (String) e37.get(1);
            }
            Vector e38 = e(1, 1, "verb");
            if (e38 != null) {
                String str10 = (String) e38.get(1);
            }
            if (e(0, 0, "nobind") != null) {
                gVar.F = true;
            }
            if (e(0, 0, "persist-tun") != null) {
                gVar.I = true;
            }
            if (e(0, 0, "push-peer-info") != null) {
                gVar.f36223c0 = true;
            }
            Vector e39 = e(1, 2, "connect-retry");
            if (e39 != null) {
                gVar.K = (String) e39.get(1);
                if (e39.size() > 2) {
                    gVar.L = (String) e39.get(2);
                }
            }
            Vector e40 = e(1, 1, "connect-retry-max");
            if (e40 != null) {
                gVar.J = (String) e40.get(1);
            }
            Vector<Vector<String>> d18 = d(1, 1, "remote-cert-tls");
            if (d18 != null) {
                if (d18.get(0).get(1).equals("server")) {
                    gVar.f36256u = true;
                } else {
                    hashMap2.put("remotetls", d18);
                }
            }
            Vector e41 = e(0, 1, "auth-user-pass");
            if (e41 != null) {
                if (z6) {
                    gVar.f36220b = 3;
                } else {
                    int i19 = gVar.f36220b;
                    if (i19 == 0) {
                        gVar.f36220b = 5;
                    } else if (i19 == 2) {
                        gVar.f36220b = 7;
                    }
                }
                if (e41.size() > 1) {
                    if (!((String) e41.get(1)).startsWith("[[INLINE]]")) {
                        String str11 = (String) e41.get(1);
                    }
                    gVar.f36260y = null;
                    String[] split = wa.g.f((String) e41.get(1)).split("\n");
                    if (split.length >= 2) {
                        gVar.f36260y = split[0];
                        gVar.f36258w = split[1];
                    }
                }
            }
            Vector e42 = e(1, 1, "auth-retry");
            if (e42 != null) {
                if (!((String) e42.get(1)).equals("none")) {
                    if (((String) e42.get(1)).equals("nointeract")) {
                        i12 = 2;
                        gVar.f36219a0 = 2;
                    } else if (!((String) e42.get(1)).equals("interact")) {
                        throw new C0440a("Unknown parameter to auth-retry: " + ((String) e42.get(2)));
                    } else {
                        gVar.f36219a0 = 2;
                        i12 = 2;
                    }
                    e10 = e(1, i12, "crl-verify");
                    if (e10 != null) {
                        if (e10.size() == 3 && ((String) e10.get(i12)).equals("dir")) {
                            StringBuilder sb3 = new StringBuilder();
                            sb3.append(gVar.D);
                            if (Build.VERSION.SDK_INT > 26) {
                                StringBuilder sb4 = new StringBuilder();
                                Iterator it8 = e10.iterator();
                                if (it8.hasNext()) {
                                    while (true) {
                                        sb4.append((CharSequence) it8.next());
                                        if (!it8.hasNext()) {
                                            break;
                                        }
                                        sb4.append((CharSequence) " ");
                                    }
                                }
                                join = sb4.toString();
                            } else {
                                join = TextUtils.join(" ", e10);
                            }
                            gVar.D = android.support.v4.media.b.q(sb3, join, "\n");
                        } else {
                            gVar.Y = (String) e10.get(1);
                        }
                    }
                    f0.c<b, b[]> j10 = j(null);
                    gVar.T = j10.f22437b;
                    d10 = d(1, 1, "connection");
                    if (gVar.T.length > 0 || d10 == null) {
                        if (d10 != null) {
                            gVar.T = new b[d10.size()];
                            Iterator it9 = d10.iterator();
                            int i20 = 0;
                            while (it9.hasNext()) {
                                a aVar = new a();
                                aVar.i(new StringReader(((String) ((Vector) it9.next()).get(1)).substring(10)));
                                b[] bVarArr2 = aVar.j(j10.f22436a).f22437b;
                                if (bVarArr2.length != 1) {
                                    throw new C0440a("A <connection> block must have exactly one remote");
                                }
                                gVar.T[i20] = bVarArr2[0];
                                i20++;
                            }
                        }
                        if (e(0, 0, "remote-random") != null) {
                            gVar.U = true;
                        }
                        e11 = e(1, 1, "proto-force");
                        if (e11 != null) {
                            String str12 = (String) e11.get(1);
                            if (str12.equals("udp")) {
                                z10 = true;
                            } else if (!str12.equals(V2rayConfig.DEFAULT_NETWORK)) {
                                throw new C0440a(String.format("Unknown protocol %s in proto-force", str12));
                            } else {
                                z10 = false;
                            }
                            for (b bVar : gVar.T) {
                                if (bVar.f37473d == z10) {
                                    bVar.f37476g = false;
                                }
                            }
                        }
                        String[] strArr4 = {"PROFILE", "FRIENDLY_NAME"};
                        i13 = 0;
                        while (true) {
                            hashMap = this.f37470f;
                            if (i13 < 2) {
                                break;
                            }
                            Vector<String> vector6 = hashMap.get(strArr4[i13]);
                            if (vector6 != null && vector6.size() > 1) {
                                gVar.f36222c = vector6.get(1);
                            }
                            i13++;
                        }
                        vector = hashMap.get("USERNAME");
                        if (vector != null && vector.size() > 1) {
                            gVar.f36260y = vector.get(1);
                        }
                        for (String str13 : this.f37465a) {
                            if (hashMap2.containsKey(str13)) {
                                throw new C0440a(String.format("Unsupported Option %s encountered in config file. Aborting", str13));
                            }
                        }
                        z9 = false;
                        for (String str14 : this.f37466b) {
                            hashMap2.remove(str14);
                        }
                        for (Vector<Vector<String>> vector7 : hashMap2.values()) {
                            Iterator<Vector<String>> it10 = vector7.iterator();
                            while (it10.hasNext()) {
                                if (!g(it10.next())) {
                                    z9 = true;
                                }
                            }
                        }
                        if (z9) {
                            gVar.D = "# These options found in the config file do not map to config settings:\n" + gVar.D;
                            while (hashMap2.values().iterator().hasNext()) {
                                gVar.D += f(it.next());
                            }
                            gVar.C = true;
                        }
                        if (gVar.f36257v.equals(gVar.f36227e0)) {
                            gVar.f36257v = "";
                        }
                        return gVar;
                    }
                    throw new C0440a("Using a <connection> block and --remote is not allowed.");
                }
                gVar.f36219a0 = 0;
            }
            i12 = 2;
            e10 = e(1, i12, "crl-verify");
            if (e10 != null) {
            }
            f0.c<b, b[]> j102 = j(null);
            gVar.T = j102.f22437b;
            d10 = d(1, 1, "connection");
            if (gVar.T.length > 0) {
            }
            if (d10 != null) {
            }
            if (e(0, 0, "remote-random") != null) {
            }
            e11 = e(1, 1, "proto-force");
            if (e11 != null) {
            }
            String[] strArr42 = {"PROFILE", "FRIENDLY_NAME"};
            i13 = 0;
            while (true) {
                hashMap = this.f37470f;
                if (i13 < 2) {
                }
                i13++;
            }
            vector = hashMap.get("USERNAME");
            if (vector != null) {
                gVar.f36260y = vector.get(1);
            }
            while (r6 < r3) {
            }
            z9 = false;
            while (r7 < r6) {
            }
            while (r3.hasNext()) {
            }
            if (z9) {
            }
            if (gVar.f36257v.equals(gVar.f36227e0)) {
            }
            return gVar;
        }
        throw new C0440a("Invalid mode for --mode specified, need p2p");
    }

    public final Vector d(int i10, int i11, String str) {
        HashMap<String, Vector<Vector<String>>> hashMap = this.f37469e;
        Vector<Vector<String>> vector = hashMap.get(str);
        if (vector == null) {
            return null;
        }
        Iterator<Vector<String>> it = vector.iterator();
        while (it.hasNext()) {
            Vector<String> next = it.next();
            if (next.size() < i10 + 1 || next.size() > i11 + 1) {
                throw new C0440a(String.format(Locale.getDefault(), "Option %s has %d parameters, expected between %d and %d", str, Integer.valueOf(next.size() - 1), Integer.valueOf(i10), Integer.valueOf(i11)));
            }
            while (it.hasNext()) {
            }
        }
        hashMap.remove(str);
        return vector;
    }

    public final Vector e(int i10, int i11, String str) {
        Vector d10 = d(i10, i11, str);
        if (d10 == null) {
            return null;
        }
        return (Vector) d10.lastElement();
    }

    public final String f(Vector<Vector<String>> vector) {
        Iterator<Vector<String>> it = vector.iterator();
        String str = "";
        while (it.hasNext()) {
            Vector<String> next = it.next();
            if (!g(next)) {
                if (next.size() == 2 && "extra-certs".equals(next.get(0))) {
                    StringBuilder b6 = o.h.b(str);
                    b6.append(wa.g.l(next.get(0), next.get(1)));
                    str = b6.toString();
                } else {
                    Iterator<String> it2 = next.iterator();
                    while (it2.hasNext()) {
                        StringBuilder b10 = o.h.b(str);
                        b10.append(wa.g.o(it2.next()));
                        b10.append(" ");
                        str = b10.toString();
                    }
                    str = android.support.v4.media.b.l(str, "\n");
                }
            }
        }
        return str;
    }

    public final boolean g(Vector<String> vector) {
        String[][] strArr;
        for (String[] strArr2 : this.f37467c) {
            if (vector.size() >= strArr2.length) {
                boolean z6 = true;
                for (int i10 = 0; i10 < strArr2.length; i10++) {
                    if (!strArr2[i10].equals(vector.get(i10))) {
                        z6 = false;
                    }
                }
                if (z6) {
                    return true;
                }
            }
        }
        return false;
    }

    public final void i(Reader reader) {
        HashMap t10 = android.support.v4.media.c.t("server-poll-timeout", "timeout-connect");
        BufferedReader bufferedReader = new BufferedReader(reader);
        int i10 = 0;
        while (true) {
            try {
                String readLine = bufferedReader.readLine();
                i10++;
                if (readLine == null) {
                    return;
                }
                if (i10 == 1) {
                    if (readLine.startsWith("PK\u0003\u0004") || readLine.startsWith("PK\u0007\u00008")) {
                        break;
                    } else if (readLine.startsWith("\ufeff")) {
                        readLine = readLine.substring(1);
                    }
                }
                if (readLine.startsWith("# OVPN_ACCESS_SERVER_")) {
                    String[] split = readLine.split("#\\sOVPN_ACCESS_SERVER_", 2)[1].split("=", 2);
                    Vector<String> vector = new Vector<>();
                    Collections.addAll(vector, split);
                    this.f37470f.put(vector.get(0), vector);
                } else {
                    Vector<String> k8 = k(readLine);
                    if (k8.size() != 0) {
                        if (k8.get(0).startsWith("--")) {
                            k8.set(0, k8.get(0).substring(2));
                        }
                        b(k8, bufferedReader);
                        String str = k8.get(0);
                        if (t10.get(str) != null) {
                            str = (String) t10.get(str);
                        }
                        HashMap<String, Vector<Vector<String>>> hashMap = this.f37469e;
                        if (!hashMap.containsKey(str)) {
                            hashMap.put(str, new Vector<>());
                        }
                        hashMap.get(str).add(k8);
                    }
                }
            } catch (OutOfMemoryError e10) {
                throw new C0440a("File too large to parse: " + e10.getLocalizedMessage());
            }
        }
        throw new C0440a("Input looks like a ZIP Archive. Import is only possible for OpenVPN config files (.ovpn/.conf)");
    }

    public final f0.c<b, b[]> j(b bVar) {
        b clone;
        if (bVar != null) {
            try {
                clone = bVar.clone();
            } catch (CloneNotSupportedException e10) {
                e10.printStackTrace();
                return null;
            }
        } else {
            clone = new b();
        }
        Vector e11 = e(1, 1, "port");
        if (e11 != null) {
            clone.f37472c = (String) e11.get(1);
        }
        Vector e12 = e(1, 1, "rport");
        if (e12 != null) {
            clone.f37472c = (String) e12.get(1);
        }
        Vector e13 = e(1, 1, "proto");
        if (e13 != null) {
            clone.f37473d = h((String) e13.get(1));
        }
        Vector e14 = e(1, 1, "connect-timeout");
        int i10 = 0;
        if (e14 != null) {
            try {
                clone.f37477h = Integer.parseInt((String) e14.get(1));
            } catch (NumberFormatException e15) {
                throw new C0440a(String.format("Argument to connect-timeout (%s) must to be an integer: %s", e14.get(1), e15.getLocalizedMessage()));
            }
        }
        Vector e16 = e(1, 2, "socks-proxy");
        if (e16 == null) {
            e16 = e(2, 2, "http-proxy");
        }
        if (e16 != null) {
            if (((String) e16.get(0)).equals("socks-proxy")) {
                clone.f37478i = 3;
                clone.f37480k = "1080";
            } else {
                clone.f37478i = 2;
            }
            clone.f37479j = (String) e16.get(1);
            if (e16.size() >= 3) {
                clone.f37480k = (String) e16.get(2);
            }
        }
        Vector e17 = e(1, 1, "http-proxy-user-pass");
        if (e17 != null) {
            String[] split = wa.g.f((String) e17.get(1)).split("\n");
            if (split.length >= 2) {
                clone.f37482m = split[0];
                clone.f37483n = split[1];
                clone.f37481l = true;
            }
        }
        Vector d10 = d(1, 3, "remote");
        Vector vector = new Vector();
        HashMap<String, Vector<Vector<String>>> hashMap = this.f37469e;
        for (Map.Entry<String, Vector<Vector<String>>> entry : hashMap.entrySet()) {
            if (bVar != null || this.f37468d.contains(entry.getKey())) {
                clone.f37474e += f(entry.getValue());
                vector.add(entry.getKey());
            }
        }
        Iterator it = vector.iterator();
        while (it.hasNext()) {
            hashMap.remove((String) it.next());
        }
        String str = clone.f37474e;
        if (str != null && !"".equals(str.trim())) {
            clone.f37475f = true;
        }
        if (d10 == null) {
            d10 = new Vector();
        }
        b[] bVarArr = new b[d10.size()];
        Iterator it2 = d10.iterator();
        while (it2.hasNext()) {
            Vector vector2 = (Vector) it2.next();
            try {
                bVarArr[i10] = clone.clone();
            } catch (CloneNotSupportedException e18) {
                e18.printStackTrace();
            }
            int size = vector2.size();
            if (size != 2) {
                if (size != 3) {
                    if (size != 4) {
                        i10++;
                    } else {
                        bVarArr[i10].f37473d = h((String) vector2.get(3));
                    }
                }
                bVarArr[i10].f37472c = (String) vector2.get(2);
            }
            bVarArr[i10].f37471b = (String) vector2.get(1);
            i10++;
        }
        return new f0.c<>(clone, bVarArr);
    }
}