Skip to content

Iternyx/node-openvpn

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

node-openvpn

npm version

Communicate to an OpenVpn client instance via telenet, for node.

	var openvpnmanager = require('node-openvpn');

	var 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
    };
    var auth = {
        user: 'vpnUserName',
        pass: 'vpnPassword',
    };

    var openvpn = openvpnmanager.connect(opts)

    openvpn.on('connected', function() { //will be emited on successful interfacing with openvpn instance
        openvpnmanager.authorize(auth);
    });

    openvpn.on('console-output', function(output) { //emits console output of openvpn instance as a string
        console.log(output)
    });

    openvpn.on('state-change', function(state) { //emits console output of openvpn state as a array
        console.log(state)
    });

    openvpn.on('error', function(error) { //emits console output of openvpn state as a string
        console.log(error)
    });

    openvpnmanager.getLog(console.log) //get all console logs up to this point

Installation

$ npm install node-openvpn

About

Communicate with a openvpn instance via telnet.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%