Closed SashaDesigN closed 8 years ago
try this:
var openvpnmanager = require('node-openvpn')
var openvpnBin = require('openvpn-bin')
var path = require('path')
var openvpnInstance = new openvpnBin('path/to/openvpn.exe', {
host: '127.0.0.1',
port: 1337,
config: path.normalize('../geo/ipvanish/ipvanish-AU-Sydney-syd-a16.ovpn')
})
openvpnInstance.initialize().then(function() {
var managerInstance = openvpnmanager.connect({ host: '127.0.0.1', port: 1337 })
managerInstance.on('connected', function() {
managerInstance.authorize({
user: 'vpnUserName',
pass: 'vpnPassword'
})
})
managerInstance.on('console-output', function(output) {
console.log(output)
})
})
Yes but I can't understand what is there path/to/openvpn.exe? I am on Linux now)
@SashaDesigN try just setting as openvpn
or alternatively find the absolute path of the openvpn executable on your system.
var openvpnInstance = new openvpnBin('openvpn', { TypeError: openvpnBin is not a function
Opes my bad (been a while since i wrote these modules :smile: ). Can you give the following a try?
var openvpnmanager = require('node-openvpn')
var openvpnBin = require('openvpn-bin')
var path = require('path')
openvpnBin.initialize('openvpn', {
host: '127.0.0.1',
port: 1337,
config: path.normalize('../geo/ipvanish/ipvanish-AU-Sydney-syd-a16.ovpn')
}).then(function() {
var managerInstance = openvpnmanager.connect({ host: '127.0.0.1', port: 1337 })
managerInstance.on('connected', function() {
managerInstance.authorize({
user: 'vpnUserName',
pass: 'vpnPassword'
})
})
managerInstance.on('console-output', function(output) {
console.log(output)
})
})
Can this be closed?
Oh yes - thanks its works
Actually it didn't work) but I use child_process and openvpn)
I want to start use OpenVPN connection in it. To do that I found 2 modules on npm (openvpn-client and openvpn-bin) - but any of them has no good docs and examples, but I try as I can to use them and it was unsuccessful.
I have Ipvanish account (login/password) with 540 .opvn files, which I can use. I try this: