npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@ad0nis/openvpn-manager

v0.2.0

Published

Provides an API for connecting to, sending commands to, and receiving messages from an OpenVPN management socket

Readme

OpenVPN Manager Wrapper

OpenVPN Manager Wrapper is a lightweight TypeScript library with no dependencies, providing a convenient interface for interacting with the OpenVPN Management Interface. It allows you to connect to the server, manage clients, and receive real-time events.

The library relies only on the standard Node.js API. You can easily adapt the methods for other runtimes (Deno, Bun). The project is written in TypeScript, giving you static typing and IDE autocompletion.

For seamless integration with NestJS, check out the wrapper:
👉 openvpn-manager-nestjs

Documentation in Russian

Features

  • Client connection and disconnection events
  • Retrieve the full list of active clients
  • Monitor client traffic
  • Send commands to the OpenVPN server

Quick Start

install

npm

npm install @ad0nis/openvpn-manager

yarn

yarn add @ad0nis/openvpn-manager

Create an instance of OpenvpnManager and connect to the server. To learn how to configure the OpenVPN Manager, see this guide or the official OpenVPN documentation.

// Initialize connection to the OpenVPN API
const api = new OpenvpnManager({
  id: "srv1",         // Server identifier (any string)
  host: "127.0.0.1",  // Address of the OpenVPN Manager
  port: 7505,         // Port of the OpenVPN Manager
  timeout: 5000,      // Connection timeout in ms (default 5000)
});

// Connect
await api.connect();

At this point, the connection to OpenVPN is established. To receive events, subscribe to the desired ones:

// Connected client
api.on("client:connection", (client: ConnectionClient) => {
  // Handle connected client
});
    
// Get client list
api.once("client:list", (clients: Cl) => {
  // Handle list of clients. Triggered once
});

A full list of available events can be found in the Events section.

Constructor Options

Additional parameters available when creating an instance of OpenvpnManager:

  • event — custom EventEmitter for event handling (by default, an internal emitter is created).
  • logger — logger for log management (by default, console is used).
// Import helper for typing
import { CustomEventType } from "openvpn-manager/event-responses.types";

// Create emitter
const emitter = new EventEmitter<CustomEventType>();

const api = new OpenvpnManager(
  {
    id: "1",
    host: "127.0.0.1",
    port: 7505,
    timeout: 5000,
  },
  {
    event: emitter, 	// Custom event emitter
    logger: console, 	// Default logger is console, but you can pass your own
  }
);

Events

All events and interfaces can be found in the types file

| Event | Type | Description | |---------------------|--------------------|----------------------------------------------------------| | client:connection | ClientConnection | Triggered when a client connects | | client:list | Cl | List of connected clients | | byte:count | ByteCount | Client traffic information | | client:disconnect | ClientDisconnect | Returns an array of CommonName values (will be expanded) | | socket:error | SocketError | Socket error during connection |

Status

The status method returns information about connected clients:

  • CN (Client Name)
  • Real address (IP:Port)
  • Virtual IP address
  • Incoming and outgoing traffic volume
  • Connection date and time

For more details, see the OpenVPN Management Interface Documentation

Sending Commands

The writeSocket method allows sending raw commands directly to the OpenVPN Manager socket. This method performs no extra processing — it simply writes the provided string to the socket. Each command must end with \r\n.

Example:

api.writeSocket("status 2\r\n"); // <- \r\n is required at the end of each command

To handle responses, subscribe to the global data event. It is global because it reports all messages received from OpenVPN.

[!NOTE] This is a low-level method — it doesn’t perform any additional processing, only writes to the socket.

Example:

api.on("data", (data: string) => {
  // Handle data
});