connect vpn programmatically react native for android ios
Asked Answered
A

0

9

I am new to react native, I want to make a VPN client app for Android and IOS. VPN protocol should be IPSec or IKEv2 or any other. I have tried these:

1. OpenVPN

node-openvpn and openvpn-bin but no luck

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 native open settings

react-native-device-setting and react-native-open-settings in which they have showed to programmatically open android phone settings like:

install package: npm install react-native-device-settings --save

usage:

import DeviceSettings from 'react-native-device-settings';

DeviceSettings.open(); // Open settings menu

DeviceSettings.app(); // Open app settings menu

DeviceSettings.wifi(); // Open wifi settings menu

but there is no method to open up the VPN Settings and configure VPN. 47306057 has also asked the same problem

i need some direction or way to solve this. is there a library or something that i should use or make a VPN app in android studio and then import the aar file here. will it work?

Can anyone help me out in this? Thanks

Algebraic answered 21/4, 2020 at 9:42 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.