android - 以编程方式连接 vpn 为 android ios 做出本机反应
问题描述
我是原生反应新手,我想为 Android 和 IOS 制作一个 VPN 客户端应用程序。VPN 协议应该是 IPSec 或 IKEv2 或任何其他协议。我试过这些:
1.OpenVPN
node-openvpn和openvpn-bin但没有运气
const openvpnmanager = require('node-openvpn'); **
const opts = {
host: '127.0.0.1', // normally '127.0.0.1', will default to if undefined
port: 1337, //port openvpn management console
timeout: 1500, //timeout for connection - optional, will default to 1500ms if undefined
logpath: 'log.txt' //optional write openvpn console output to file, can be relative path or absolute
};
const auth = {
user: 'vpnUserName',
pass: 'vpnPassword',
};
const openvpn = openvpnmanager.connect(opts)
// will be emited on successful interfacing with openvpn instance
openvpn.on('connected', () => {
openvpnmanager.authorize(auth);
})
2. react原生开启设置
react-native-device-setting和react-native-open-settings,他们已经展示了以编程方式打开 android 手机设置,例如:
安装包:npm install react-native-device-settings --save
用法:
import DeviceSettings from 'react-native-device-settings';
DeviceSettings.open(); // Open settings menu
DeviceSettings.app(); // Open app settings menu
DeviceSettings.wifi(); // Open wifi settings menu
但是没有办法打开 VPN 设置和配置 VPN。47306057也问过同样的问题
我需要一些方向或方法来解决这个问题。有没有我应该在android studio中使用或制作VPN应用程序的库或其他东西,然后在此处导入aar文件。它会起作用吗?
谁能帮我解决这个问题?谢谢
解决方案
推荐阅读
- r - R中的预处理数据:使用通配符过滤和替换
- python - 如何从熊猫数据框中删除重复行但仅在某个范围内?
- javascript - 使用 .trigger('submit') 时 Html.BeginForm 未提交
- typescript - Vue 路由器只显示一个组件
- c# - 在 xamarin 项目 System.InvalidCastException:“指定的演员表无效。”
- python - Echo 服务器聊天应用程序有连接问题
- python - 从拆分命令管道输出到另一个函数
- ruby-on-rails - 预加载与记录子集的 has_many 关联
- apache-spark - 理解一个窗口函数的例子
- go - 当有未知数量的输入时如何关闭通道?