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

@vmosedge/proxy-sdk

v1.0.9

Published

SDK for managing proxy

Readme

VMOS Edge Proxy SDK

一个用于管理和运行代理服务的 Node.js SDK。支持多协议解析和链式代理请求。

特性

  • 多协议支持: 自动解析 VLESS, VMESS, SS, SSR, Trojan, TUIC, Hysteria, Hysteria2, Wireguard, HTTP, SOCKS5 等多种代理 URI。
  • 内置二进制: 自动识别并运行对应平台的二进制文件(支持 Windows, macOS, Linux)。
  • 链式代理: 支持将多个代理节点串联成代理链。
  • 一键请求: 提供简便的 API 直接通过代理发起 HTTP/HTTPS 请求。
  • 状态透明: 所有异步方法均返回统一的响应格式,明确暴露成功或失败状态。
  • 生命周期管理: 自动管理工作目录、配置文件并在进程退出时自动清理。

安装

npm install @vmosedge/proxy-sdk

快速开始

发起代理请求

可以直接使用代理 URI 发起请求,SDK 会自动启动代理服务并在请求完成后关闭。

import { VMOSEdgeProxy } from '@vmosedge/proxy-sdk';

const proxy = new VMOSEdgeProxy();

async function run() {
  const vlessNode = 'vless://...';
  const vmessNode = 'vmess://...';

  // 链式代理示例 (节点1 -> 节点2)
  const res = await proxy.request(
    [vlessNode, vmessNode],
    { url: 'https://api.ipify.org?format=json' },
    { 'mixed-port': 10086 }
  );

  if (res.success) {
    console.log('Your IP Info:', res.data);
  } else {
    console.error('Request failed:', res.error);
  }
}

run();

手动管理代理服务

如果需要持久运行代理服务或手动控制开关。

import { VMOSEdgeProxy } from '@vmosedge/proxy-sdk';

const proxy = new VMOSEdgeProxy();

async function startProxy() {
  const res = await proxy.start({
    "mixed-port": 10809,
    "proxies": [] 
  });

  if (res.success) {
    console.log('代理服务已启动,监听端口 10809');
  } else {
    console.error('启动失败:', res.error);
  }
}

// 停止服务
// proxy.stop();

API

new VMOSEdgeProxy(config?: ProxyConfig)

初始化 SDK。

  • config.timeout: 默认启动超时时间(毫秒)。
  • config.logLevel: 日志级别 (debug, info, warn, error, none)。
  • config.cleanupOnStop: 停止时是否清理工作目录,默认 true

async start(config?: any, timeout?: number): Promise<ProxyResponse>

启动代理服务。

  • config: 配置文件对象。
  • timeout: 启动超时时间(毫秒)。

async reload(config?: any): Promise<ProxyResponse>

重新加载配置而不停止进程。

async request(proxies: (string|any)[], req: AxiosRequestConfig, config?: any): Promise<ProxyResponse>

通过代理链发起单次请求。

  • proxies: 代理 URI 或配置对象数组。
  • req: Axios 请求配置。
  • config: 额外的全局配置。

stop(): ProxyResponse

停止代理服务。

响应格式

所有异步方法返回 ProxyResponse 对象:

interface ProxyResponse<T = any> {
  success: boolean;
  data?: T;
  error?: string;
}

许可证

MIT