0

我正在尝试实现我自己的VpnService,但是我想在 VPN 运行时在 VPN 之外使用 Google API。我该怎么做呢?

我试过了:

            Builder builder = new Builder();
            builder.addAddress("10.0.0.2", 32);
            builder.addRoute("0.0.0.0", 0);
            builder.addDnsServer("1.1.1.1");
            builder.addDisallowedApplication(getApplicationContext().getPackageName());
            vpnInterface = builder.setSession(getString(R.string.app_name))
                    .setConfigureIntent(pendingIntent)
                    .establish();

这应该不允许当前应用程序 ID 访问 VPN。我也测试过它并Socket在没有的情况下使用它protect,它可以工作(至少对于 LAN 测试 IP)。但是 Google API 会超时和出错。

我能否以某种方式使来自 VPN 应用程序本身的所有流量通过或以某种方式protect通过 Google API 客户端?谢谢。

4

0 回答 0