Socket
Socket
Sign inDemoInstall

@amilajack/node-openvpn

Package Overview
Dependencies
3
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @amilajack/node-openvpn

Communicate with a openvpn instance via telnet


Version published
Weekly downloads
1
decreased by-50%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

node-openvpn

Build Status NPM version Dependency Status npm

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

Installation

npm install @amilajack/node-openvpn

Example

import openvpnmanager from '@amilajack/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);

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

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

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

openvpn.on('error', 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

// and finally when/if you want to
openvpnmanager.disconnect();

openvpn.on('disconnected', () => {
  //emits on disconnect
  openvpnmanager.destroy(); //finally destroy the disconnected manager
});

Keywords

FAQs

Last updated on 22 Sep 2018

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc