Sye*_*hah 9 vpn android node.js ios react-native
我是本机反应的新手,我想为 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);
})Run Code Online (Sandbox Code Playgroud)
2. 反应原生打开设置
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 menuRun Code Online (Sandbox Code Playgroud)
但是没有办法打开 VPN 设置和配置 VPN。47306057也问过同样的问题
我需要一些方向或方法来解决这个问题。有没有我应该使用的库或其他东西,或者在 android studio 中制作 VPN 应用程序,然后在此处导入 aar 文件。它会起作用吗?
任何人都可以帮我解决这个问题吗?谢谢
| 归档时间: |
|
| 查看次数: |
2604 次 |
| 最近记录: |