-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathtest.js
38 lines (35 loc) · 1.03 KB
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
var openvpnbin = require('./lib/openvpn-bin.js');
var argv = require('minimist')(process.argv.slice(2));
var path = require('path');
if (argv.init) {
var openvpnpath = path.normalize(getOpenVPNPath()), //path of openvpn exsecutable
args = {
host: '127.0.0.1',
port: 1337,
scriptSecurity: 2,
config: 'config.ovpn'
};
console.log(openvpnbin.initialize(openvpnpath, args));
}
if (argv.shutdown) {
var openvpnpath = path.normalize(getOpenVPNPath()),
args = {
host: '127.0.0.1',
port: 1337,
scriptSecurity: 2,
config: 'config.ovpn'
};
openvpnbin.initialize(openvpnpath, args);
}
function getOpenVPNPath() {
switch (process.platform) {
case 'win32':
return '../bin/openvpn.exe'
break;
case 'darwin':
return '/usr/local/opt/openvpn/sbin/openvpn';
case 'linux':
return '/usr/local/opt/openvpn/sbin/openvpn';
break;
}
}