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

wireshade

v1.0.8

Published

**Node.js 终极用户态 WireGuard® 实现**

Readme

👻 WireShade Node.js 版

Node.js 终极用户态 WireGuard® 实现

npm version npm downloads License: MIT

WireShade 使您的 Node.js 应用程序能够直接连接到 WireGuard VPN,而无需 root 权限、内核模块或修改系统网络设置。它使用直接集成到 Node.js 中的自定义 Rust TCP/IP 栈(smoltcp)完全在用户态运行。

🇺🇸 English | 🇩🇪 Deutsch | 🇪🇸 Español | 🇫🇷 Français | 🇨🇳 中文


🚀 为什么选择 WireShade?

WireShade 以干净的原生用户态解决方案解决了复杂的网络实现挑战:

  • 🛡️ 隐蔽与安全: 通过安全的 WireGuard VPN 路由特定的 Node.js 流量,同时保持其余系统流量正常。非常适合 Web 爬虫机器人安全通信
  • 🌍 反向隧道: 将本地 Express 服务器、WebSocket 服务器或 Next.js 应用程序暴露给私有 VPN 网络,即使您在 NAT 或防火墙后面。
  • 🔌 零配置客户端: 无需在主机上安装 WireGuard。只需 npm install 即可。
  • 🔄 自动重连: 内置逻辑,可无缝处理连接断开和网络更改。
  • ⚡ 高性能: 由 Rust 和 NAPI-RS 提供支持,具有近乎原生的性能。

✅ 支持的平台

| 平台 | 架构 | 状态 | | :--- | :--- | :--- | | Windows | x64 | ✅ | | macOS | Intel & Apple Silicon | ✅ | | Linux | x64, ARM64 | ✅ | | Raspberry Pi | ARMv7 | ✅ | | Docker | Alpine, Debian | ✅ |

📦 安装

npm install wireshade

🛠️ 使用示例

所有示例均假设您已初始化客户端:

const { WireShade, readConfig } = require('wireshade');
const client = new WireShade(readConfig('./wg0.conf'));
await client.start();

1. HTTP/HTTPS请求 (客户端)

使用 WireShade 作为请求的透明代理。

关于 DNS 的说明: 您可以在 hosts 配置中将 internal.service 等自定义主机名直接映射到 IP 地址。WireShade 将在请求期间自动拦截并解析这些名称。

原生 http/https 模块:

const https = require('https');

https.get('https://api.internal/data', { agent: client.getHttpsAgent() }, (res) => {
    res.pipe(process.stdout);
});

Axios:

const axios = require('axios');

const response = await axios.get('https://internal.service/api', {
    httpAgent: client.getHttpAgent(),
    httpsAgent: client.getHttpsAgent()
});

2. TCP & WebSockets 到 VPN (客户端)

连接到 VPN 内部运行的原始 TCP 服务或 WebSocket。

WebSockets:

const WebSocket = require('ws');

const ws = new WebSocket('ws://10.0.0.5:8080/stream', {
    agent: client.getHttpAgent() 
});

ws.on('open', () => console.log('已连接到 VPN WebSocket!'));

3. 暴露本地服务器 (反向隧道)

使您的本地服务器通过 VPN 可访问。

Express / Next.js:

const express = require('express');
const http = require('http');
const { WireShadeServer } = require('wireshade');

const app = express();
app.get('/', (req, res) => res.send('🎉 隐藏在 VPN 内部!'));

const httpServer = http.createServer(app);
const vpnServer = new WireShadeServer(client);

// 将 VPN 套接字传输到 HTTP 服务器
vpnServer.on('connection', (socket) => httpServer.emit('connection', socket));

await vpnServer.listen(80);
console.log('服务器在线地址 http://<VPN-IP>/');

📜 许可证

MIT 许可证。

WireGuard 是 Jason A. Donenfeld 的注册商标。