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

@wwkit/nets

v0.1.9

Published

Unified network services: SOCKS5 over SSH tunnel (sks) + frp intranet penetration (frp), CLI managers in one package

Readme

@wwkit/nets

统一网络工程:一个包承载四个服务组——SSH 隧道 SOCKS5 代理(nets lsks,原 sshproxy)、阿里云 SOCKS5 代理(nets sks)、frp 内网穿透(nets frp,原 frpproxy)、Tailscale mesh 组网(nets tailscale),加上公共 Web 控制台(nets web,概览 + 四服务 Dashboard + Docs + 配置页),共享同一份配置、同一套 SSH 客户端与公共工具层。

安装: npm i -g @wwkit/nets
命令: nets lsks <子命令>   nets sks <子命令>   nets frp <子命令>   nets tailscale <子命令>   nets web
      (sshproxy/frpproxy 及顶级 sks/frp 已于 2026-09-29 下线,全部降为 nets 服务组子命令;高频操作建议用控制台 nets web)

四个服务 + 一个控制台

| 命令 | 能力(子命令) | 原包 | |---|---|---| | nets lsks | setup、tunnel on\|off、proxy on\|off、chrome on\|off、ssh、start、stop、status、debug、web、help、version | @wwkit/sshproxy | | nets sks | setup、start、stop、restart、status、doctor、config、help、version | 新增(阿里云 dante) | | nets frp | setup、config、config add <port> [--remote --name]、config rm <port\|name>、start、stop、restart、status [--local]、doctor、logs [--lines N]、help、version | @wwkit/frpproxy | | nets tailscale | install、up [--authkey]、down、setup、exit-node [--off]、status、doctor、config、help、version | 新增 | | nets | web [start\|stop\|restart\|status](裸 web ≡ web start,启动类自动打开浏览器)、upgrade、version、help —— 公共 Web 控制台 | 新增 |

  • nets lsks:本机经远端 SSH 隧道获得 SOCKS5/HTTP 代理与代理 Chrome(隧道启动器 = autossh 或系统 ssh)。
  • nets sks:通过 SSH 在阿里云主机部署常驻 dante SOCKS5 代理(端口 9101),本机可离线,其他设备直连。
  • nets frp:远端服务器部署 frps、本机跑 frpc,把本地 web/API 服务经公网中继暴露出去(无需公网 IP)。
  • nets tailscale:WireGuard mesh 组网,P2P 直连时流量不经阿里云(零带宽费),阿里云作 DERP 兜底中继 / 可选 exit node。
  • nets web:启动本地控制台(默认 http://127.0.0.1:9100),一个页面同时管理四服务(状态/开关/体检/隧道条目增删/日志/配置编辑),并内置各服务使用文档。

Web 控制台

  • 无构建:Vue 3 + Element Plus 均以本地 vendor 静态文件引入(assets/vendor/),零 CDN 运行时依赖,assets/ 静态资源改动即时生效(no-cache)。
  • 页面结构:顶部导航(概览 / LSKS / SKS / FRP / TAILSCALE / CONFIG)+ 每个服务的 Dashboard / Docs 两个子页。
  • 每个服务 Dashboard 统一为三模块:客户端配置(本机)→ 服务器端配置 / 测试 → 访问链接;状态用色点 + 文本,启停用 switch 开关,初始化未完成时显示「初始化」按钮。
  • 需要用户手动介入的步骤(如 tailscale 登录授权、exit node 控制台 Approve、云安全组放行)在操作后于页面内展示,Docs 页亦有完整说明。

配置

统一文件:~/.config/nets/config.json5(JSON5,支持 // 注释与尾逗号)。 根级平铺 = 公共 SSH(四服务共用的中继/跳板机)+ 公共 Web 控制台 + 公共域名;服务私有配置分别在 lsks.* / sks.* / frp.* / tailscale.*:

{
  // 公共 SSH(四服务 setup/隧道共用)
  host: '{env:SSH_HOST}',
  port: 22,
  user: '{env:SSH_USER}',
  password: '{env:SSH_PASSWORD}',
  timeout: 30,

  // 公共 Web 控制台(nets web 触发)
  web: { host: '127.0.0.1', port: 9100 },

  // 公共公网域名(解析到根级 host;web 页面显示 IP 与域名两种访问地址)
  domain: 'deepblueauto.top',

  // lsks 私有:本地 SOCKS5 监听(SSH 隧道)
  lsks: {
    socks5: { host: '127.0.0.1', port: 9102 },
  },

  // sks 私有:阿里云 SOCKS5 监听端口(dante)
  sks: {
    proxy: { port: 9101 },
  },

  // tailscale 私有:DERP 中继端口 + exit node 开关
  tailscale: {
    derper: { tlsPort: 443, stunPort: 3478, binDir: '/opt/tailscale' },
    exitNode: false,
  },

  frp: {
    server: { port: 7000 },          // frps 中继端口(公网放行)
    proxies: [                        // 隧道条目;remotePort 缺省 = localPort
      // { name: 'opencode', localPort: 9080 },
    ],
    version: '0.61.1',
    downloadMirrors: [/* frp release 下载源,按序尝试 */],
  },
}

装配链(仓库标准):内置 src/config.json5 → 用户文件 → ${NETS_CONFIG_CONTENT} 注入层 → deep-merge → {env:XXX} 解析(env 取系统环境变量或包目录 .env)。 环境变量:NETS_CONFIG_DIR(换配置目录)、NETS_CONFIG_CONTENT(注入配置,测试隔离用)。

端口速查:web 控制台 9100 · sks(dante)9101 · lsks(本地 SOCKS5)9102 · frps 中继 7000 · tailscale DERP TLS 443 / STUN 3478(默认)。

从旧包迁移(自动)

首次运行任意 nets(nets lsks / nets frp / nets web)命令时自动执行(隔离环境跳过):

  1. 配置:~/.config/{sshproxy,frpproxy}/config.json5 逐键映射到统一结构—— frpproxy.server.{host,sshPort,sshUser,sshPassword} → 根级平铺、frpsPort → frp.server.port、 proxies → frp.proxies;sshproxy 根键与 socks5/web → 根级 + lsks.*(两份并存时 root SSH 以 sshproxy 为准)。目标已自定义则只提示不覆盖;迁移成功后旧原件改名 config.json5.migrated.bak。
  2. 运行态:frpc.toml、.creds.json(token)、id_ed25519(.pub)、bin/ 复制进 ~/.config/nets/ (复制不动原件,运行中的 frpc 不中断);存活的 frpc.pid 同值写入新目录。
  3. lsks 状态目录:~/.local/share/sshproxy → ~/.local/share/sks(目录重命名,一次性)。

旧包 @wwkit/sshproxy / @wwkit/frpproxy 已从仓库删除(2026-09-29,覆盖性自检通过后下线): 功能由本包全部承接;旧库 API 等价导出见 src/index.js(有守门测试)。

目录结构

src/
  config.json5            内置配置模板
  index.js                库入口(re-export shared + 四服务公共 API)
  cli.js                  nets 顶级命令(web start|stop|restart|status、upgrade、help、version;启动类自动开浏览器)
  migrate-config.js       旧配置 → 统一配置迁移
  shared/                 公共层:config/cli/ssh/sshkey/proc/doctor/admin/creds
  web/                    公共 Web 控制台
    server.js             HTTP 服务:概览 + 四服务 API + config 读写 + 静态页(密码脱敏)
    lifecycle.js          控制台生命周期(nets web 共用,PID ~/.local/share/sks/proxy-web.pid)
    public/index.html     Vue 3 + Element Plus(本地 vendor)+ 各视图容器
    public/assets/        app.js(createApp + 全局 $api/$esc/$message)+ components/(11 个组件)+ style.css
  services/
    registry.js           服务注册表(lsks/sks/frp/tailscale 分发,挂配置迁移钩子)
    lsks/                 ProxyManager/OSystem/SshCommands/init + cli(SSH 隧道 SOCKS5)
    sks/                  manager/overview + cli(阿里云 dante 代理)
    frp/                  manager/toml/config/creds/frpbin/migrate + cli
    tailscale/            manager + cli(mesh 组网)
bin/index.js              唯一入口(bin map 仅 nets 一键;完整两级 nets lsks|sks|frp|tailscale,无别名)
scripts/postinstall.js    幂等同步配置模板(首次复制/升级补齐),不启动服务
tests/<category>/...      分类优先 × 源码镜像(unit/integration)

开发与测试

pnpm install
pnpm --filter @wwkit/nets run ut    # 单元测试(tests/unit)
pnpm --filter @wwkit/nets run it    # 集成测试(真实子进程/端口,隔离配置)

测试隔离三件套:NETS_CONFIG_DIR(临时目录)+ NETS_CONFIG_CONTENT(注入配置)+ JEST_WORKER_ID(jest 进程内自动存在,用于门控一切真实路径迁移/启动)。禁止触碰真实隧道、 系统代理与 ~/.config/{sshproxy,frpproxy} 原件。