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 🙏

© 2024 – Pkg Stats / Ryan Hefner

outlinevpn-api

v3.0.0

Published

The Outline VPN API client

Downloads

140

Readme

Outline VPN API

Badges: DeepScan grade

A Nodejs Client package for managing Outline servers: Jigsaw-Code/outline-server

GitHub: github.com/murka/outlinevpn-api
NPM: npm.im/outlinevpn-api

Usage

import { OutlineVPN } from "outlinevpn-api";

const client = new OutlineVPN({
  apiUrl: "https://your-server.com/api",
  fingerprint: "your-server-certificate-fingerprint",
});

Server Management

Get Server Info

// Returns: Server details including name, ID, metrics status etc.
const server = await client.getServer();

Rename Server

const success = await client.renameServer("My Server");

Configure Server Settings

Set Hostname

const success = await client.setHostnameForAccessKeys("example.com");

Set Default Port

const success = await client.setPortForNewAccessKeys(12345);

Manage Data Limits

// Set default data limit for new keys
await client.setDefaultDataLimit(1000000000); // 1GB in bytes

// Remove default data limit
await client.deleteDefaultDataLimit();

Access Key Management

List Access Keys

const accessKeys = await client.getAccessKeys();

Create Access Key

// Create with default settings
const key = await client.createAccessKey();

// Create with custom options
const customKey = await client.createAccessKey({
  name: "Custom Key",
  password: "custom-password",
  port: 8388,
});

// Create with specific ID
const keyWithId = await client.createAccessKeyWithId("custom-id", {
  name: "Named Key",
});

Manage Existing Access Key

// Get specific key
const key = await client.getAccessKey("key-id");

// Rename key
await client.renameAccessKey("key-id", "New Name");

// Set data limit for key
await client.addDataLimit("key-id", 1000000000); // 1GB

// Remove data limit
await client.deleteDataLimit("key-id");

// Delete key
await client.deleteAccessKey("key-id");

Metrics

Usage Statistics

// Get data usage per access key
const usage = await client.getDataUsage();

// Get metrics sharing status
const metrics = await client.getShareMetrics();

// Enable/disable metrics sharing
await client.setShareMetrics(true);

Error Handling

The API throws several types of errors:

try {
  await client.getAccessKey("non-existent");
} catch (error) {
  if (error instanceof NotFoundError) {
    // Handle 404
  } else if (error instanceof ValidationError) {
    // Handle validation errors
  } else if (error instanceof OutlineError) {
    // Handle other API errors
  }
}

Types

Server

interface Server {
  name: string;
  serverId: string;
  metricsEnabled: boolean;
  createdTimestampMs: number;
  portForNewAccessKeys?: number;
  hostnameForAccessKeys?: string;
  accessKeyDataLimit?: {
    bytes: number;
  };
  version?: string;
}

Access Key

interface AccessKey {
  id: string;
  name: string;
  password: string;
  port: number;
  method: string;
  accessUrl: string;
  limit?: {
    bytes: number;
  };
}

Response Codes

| Code | Description | | ---- | ------------------------------------ | | 200 | Successful GET request | | 201 | Resource created successfully | | 204 | Successful operation with no content | | 400 | Invalid request/parameters | | 404 | Resource not found | | 409 | Conflict (e.g., port already in use) | | 500 | Server error |