HTTP Team VPN v8.5版本的 MD5 值为:3b55feb1dfe50d13aac742ed9741c669

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


package teamvpn.tunnel.tunnel.vpn.services;

import android.app.Service;
import android.content.Intent;
import android.net.VpnService;
import android.os.Build;
import android.os.ParcelFileDescriptor;
import android.util.Log;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
public class ServicesVPN extends VpnService implements ju0 {
    public static final int f15464 = 0;
    public ParcelFileDescriptor f15465;
    public Process f15466;
    public iu0 f15467;
    public boolean f15468 = true;

    @Override
    public final void onCreate() {
        super.onCreate();
        tg.m10590().m10596(this);
    }

    @Override
    public final void onDestroy() {
        super.onDestroy();
    }

    @Override
    public final void onRevoke() {
        m10504();
    }

    @Override
    public final int onStartCommand(Intent intent, int i, int i2) {
        z3 z3Var = (z3) intent.getSerializableExtra("COMMAND");
        if (z3Var.equals(z3.START_SERVICE)) {
            iu0 iu0Var = (iu0) intent.getSerializableExtra("V2RAY_CONFIG");
            this.f15467 = iu0Var;
            if (iu0Var == null) {
                onDestroy();
            }
            if (tg.m10590().m10594()) {
                tg.m10590().m10591();
            }
            if (tg.m10590().m10593(this.f15467)) {
                Log.e("TCPonlyService", "onStartCommand success => v2ray core started.");
                return 1;
            }
        } else if (z3Var.equals(z3.STOP_SERVICE)) {
            tg.m10590().m10591();
            return 1;
        } else if (z3Var.equals(z3.MEASURE_DELAY)) {
            new Thread(new qo0(this, 0), "MEASURE_CONNECTED_V2RAY_SERVER_DELAY").start();
            return 1;
        }
        onDestroy();
        return 1;
    }

    public final void m10503() {
        try {
            ProcessBuilder processBuilder = new ProcessBuilder(new ArrayList(Arrays.asList(new File(getApplicationInfo().nativeLibraryDir, "libV2ray2socks.so").getAbsolutePath(), "--netif-ipaddr", "26.26.26.2", "--netif-netmask", "255.255.255.252", "--socks-server-addr", "127.0.0.1:" + this.f15467.f7667, "--tunmtu", "1500", "--sock-path", "sock_path", "--enable-udprelay", "--loglevel", "error")));
            processBuilder.redirectErrorStream(true);
            this.f15466 = processBuilder.directory(getApplicationContext().getFilesDir()).start();
            new Thread(new qo0(this, 1), "Tun2socks_Thread").start();
            new Thread(new jk0(10, new File(getApplicationContext().getFilesDir(), "sock_path").getAbsolutePath(), this.f15465.getFileDescriptor()), "sendFd_Thread").start();
        } catch (Exception e) {
            Log.e("VPN_SERVICE", "FAILED=>", e);
            onDestroy();
        }
    }

    public final void m10504() {
        stopForeground(true);
        this.f15468 = false;
        Process process = this.f15466;
        if (process != null) {
            process.destroy();
        }
        tg.m10590().m10591();
        try {
            stopSelf();
        } catch (Exception unused) {
            Log.e("CANT_STOP", "SELF");
        }
        try {
            this.f15465.close();
        } catch (Exception unused2) {
        }
    }

    @Override
    public final void mo5517() {
        m10504();
    }

    @Override
    public final Service mo5518() {
        return this;
    }

    @Override
    public final void mo5519() {
        if (VpnService.prepare(this) != null) {
            return;
        }
        VpnService.Builder builder = new VpnService.Builder(this);
        builder.setSession(this.f15467.f7671);
        builder.setMtu(1500);
        builder.addAddress("26.26.26.1", 30);
        builder.addRoute("0.0.0.0", 0);
        builder.addDnsServer("1.1.1.1");
        builder.addDnsServer("76.76.10.197");
        if (this.f15467.f7668 != null) {
            for (int i = 0; i < this.f15467.f7668.size(); i++) {
                try {
                    builder.addDisallowedApplication((String) this.f15467.f7668.get(i));
                } catch (Exception unused) {
                }
            }
        }
        try {
            this.f15465.close();
        } catch (Exception unused2) {
        }
        if (Build.VERSION.SDK_INT >= 29) {
            builder.setMetered(false);
        }
        try {
            this.f15465 = builder.establish();
            this.f15468 = true;
            m10503();
        } catch (Exception unused3) {
            m10504();
        }
    }

    @Override
    public final boolean mo5520(int i) {
        return protect(i);
    }
}