我正在尝试创建Android示例VPN应用。
我通过引用https://developer.android.com/guide/topics/connectivity/vpn#java创建了VpnService
VpnService.Builder builder = new VpnService.Builder();
// Create a local TUN interface using predetermined addresses. In your app,
// you typically use values returned from the VPN gateway during handshaking.
ParcelFileDescriptor localTunnel = builder
.addAddress("192.168.2.2", 24)
.addRoute("0.0.0.0", 0)
.addDnsServer("192.168.1.1")
.establish();
<service android:name=".MyVpnService"
android:permission="android.permission.BIND_VPN_SERVICE">
<intent-filter>
<action android:name="android.net.VpnService"/>
</intent-filter>
</service>
VPN服务启动。但是,当我尝试浏览Google或其他网址时。无法加载?有人可以解释我
.addAddress(“ 192.168.2.2”,24)这是什么地址==>这将创建TUN接口
但是这个TUN界面将如何与Internet通信??