I am a newbie to node.js and looking for some example code or pointers on connecting through PPTP to a private virtual ip address using VPN connection. I have a node.js server running on aws that currently uses udp to connect to a public ip address. However, this needs to be changed to tunnel into the private vpn.
I have the uid,pwd and apn for the vpn. What are the steps I would need to take to tunnel in, and then connect to the private ip?
Appreciate any tips you might have.
Thanks M
this is too old a question but for this, it has already several answers in StackOverflow, in that one of the best and I used methods is using the node-openvpn package.
first thing first we need to install the package
npm install node-openvpn
at your index.js or server.js use below code
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
};
const auth = {
user: 'vpnUserName',
pass: 'vpnPassword',
};
const openvpn = openvpnmanager.connect(opts)
openvpn.on('connected', () => {
openvpnmanager.authorize(auth);
});
here you can read more about the node-openvpn
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With