繁体   English   中英

使用android vpnservice连接pptp vpn

[英]Connect pptp vpn with android vpnservice

我正在尝试编写一个可以用pptp protocol连接到我的VPN服务器的应用程序,因为我正在研究我发现用android.net.vpnservice我可以连接,但是当我读到一些文档时,我不清楚如何连接到VPN (没有用于设置用户名或密码的API,也没有用于设置我的VPN类型的API( l2tp,pptp );我还测试了Google提供的示例应用程序(toyvpn),也没有我之前提到过的内容。

这是我发现的一些代码:

// Create a new interface using the builder and save the parameters.
mInterface = builder.setSession(mServerAddress)
                .setConfigureIntent(mConfigureIntent)
                .establish();
mParameters = parameters;

嗨,这有点晚了,但我在搜索时发现了一些东西。

我也在尝试使用pptp和openvpn构建自己的VPN隧道/连接。

OpenVPN已经有了解决方案。

PPTP正在尝试以下解决方案。

如何以编程方式创建Android 4.0的新VPN接口?

上面的链接被发现在

如何以编程方式配置VPN?

我也在尝试。

对于VPN服务,您可以这样做。

 void startVPN(String name) {
   Intent i=new Intent("doenter.onevpn.ACTION_CONNECT");
   i.putExtra("name",name);
   i.putExtra("force", true); 
   i.putExtra("force_same", false); 
   startActivity(i);
      }

    void restartVPN(String name) {
      Intent i=new Intent("doenter.onevpn.ACTION_CONNECT");
     i.putExtra("name",name);
     i.putExtra("force", true); 
     i.putExtra("force_same", true); 
     startActivity(i);
  }

  void stopVPN() {
   Intent i=new Intent("doenter.onevpn.ACTION_DISCONNECT");
   // Stops any VPN regardless of name
    startActivity(i);
     } 

此链接可以帮助您获得答案。

http://doandroids.com/Apps/OneVpn/how-to/start-stop-prgrammatically/

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM