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/sshproxy

v1.0.27

Published

SOCKS5 proxy manager (client SSH tunnel / server remote), CLI + web UI

Downloads

4,328

Readme

sshproxy

SOCKS5 代理管理器(CLI + 本地 Web 管理页)。通过本地 SSH 隧道(autossh)提供 SOCKS5 代理,全局命令为 sshproxy。

安装

pnpm add -g @wwkit/sshproxy
# 或
npm i -g @wwkit/sshproxy

配置

全局配置:~/.config/sshproxy/config.json5。安装时(postinstall 钩子)自动把默认模板复制到该位置,用户可直接编辑;未复制到也可首次运行时自动生成。

{
  socks5: { host: "127.0.0.1", port: 1080 },
  host: "", port: 22, user: "", password: "", timeout: 30,
  web: { host: "127.0.0.1", port: 1081 }
}

支持 {env:XXX} 占位符与环境变量覆盖(SSHPROXY_CONFIG_DIR 指定配置目录、SSHPROXY_CONFIG_CONTENT 直接提供配置内容)。

配置加载由 @wwkit/shared 的多层加载器实现:内置默认 → SSHPROXY_CONFIG_CONTENT 注入 → 用户 config.json5 三层深合并(用户优先),并对结果统一解析 {env:XXX} 占位符。

系统内置常量(contains.json5)

路径/SSH 密钥/autossh 参数/系统代理/调试/Web 轮询等内部常量内置于 src/contains.json5(随包发布,系统级、用户不可改)。运行时始终使用内置值,不与用户配置合并。

命令

命令按功能模块划分。

隧道(SOCKS5 服务)

sshproxy tunnel on       # 启动 SSH 隧道(SOCKS5,默认 127.0.0.1:1080)
sshproxy tunnel off      # 停止隧道

tunnel on 已运行不会重复启动;首次运行会自动完成初始化(SSH 密钥/公钥/ssh config/autossh)。

系统全局代理

sshproxy proxy on        # 开启系统全局代理(隧道未运行则先启动)
sshproxy proxy off       # 关闭系统全局代理

代理 Chrome

sshproxy chrome on       # 以代理模式启动 Chrome(隧道未运行则先启动)
sshproxy chrome off      # 关闭代理 Chrome

组合命令

sshproxy start           # 隧道 + 系统代理,一键全开
sshproxy stop            # 隧道 + 系统代理 + Chrome,一键全关
sshproxy status          # 查看全部状态(隧道/系统代理/Chrome/Web)

Web 管理页

sshproxy web on           # 启动 Web 管理页(后台,默认 http://127.0.0.1:1081)
sshproxy web off          # 关闭 Web 管理页

信息与检查

sshproxy debug           # 全链路检查(验证代理是否可用)
sshproxy help            # 显示帮助

SSH 远程管理(ssh)

代理之外,sshproxy ssh ... 提供基于同一连接配置的远程管理命令(src/SshCommands.js):

sshproxy ssh connect                      # 测试 SSH 连接
sshproxy ssh exec <命令>                   # 执行远程命令
sshproxy ssh upload <本地> <远程> [-x] [--rm]   # 上传(-x 自动解压 zip/rar,--rm 解压后删除压缩包)
sshproxy ssh download <远程> <本地> [-x] [--rm] # 下载(-x 自动解压)
sshproxy ssh rsync <本地目录> [-r 远程目录] [-d] [-n]  # rsync 同步到远程
sshproxy ssh root                         # 显示远程 $HOME
sshproxy ssh login [-f]                   # 安装本地 SSH 公钥到远程(免密登录;-f 覆盖 authorized_keys)
sshproxy ssh open                         # 打开终端窗口并建立 SSH 连接
sshproxy ssh services [-a] [-f 名称]       # 列出远程服务
sshproxy ssh port <端口>                   # 查看远程端口监听进程
sshproxy ssh config                       # 显示 SSH 配置

公钥探测/安装逻辑与初始化流程共用 src/sshkey.js。

本地开发调用示例

在 monorepo 根目录或 packages/sshproxy 内均可运行。若未全局安装 sshproxy,用以下方式调用:

# 在 packages/sshproxy 目录内,直接跑源码入口
node ./bin tunnel on
node ./bin proxy on
node ./bin status

# 或从 monorepo 根目录,通过 pnpm 过滤到子包
pnpm --filter @wwkit/sshproxy exec sshproxy status

本地开发时配置走默认路径 ~/.config/sshproxy/config.json5;也可用环境变量临时指到测试配置,避免影响真实配置:

# 用临时配置目录跑(首次会自动初始化)
SSHPROXY_CONFIG_DIR=/tmp/sshproxy-dev node ./bin tunnel on

# 或直接注入配置内容
SSHPROXY_CONFIG_CONTENT='{ host: "example.com", user: "root", password: "***" }' \
  node ./bin tunnel on

Web 管理页

sshproxy web on 在后台启动 HTTP 服务(web off 关闭),提供 REST API 与静态 index.html:

  • GET /api/status — 代理状态
  • GET /api/config — 系统内置常量
  • POST /api/tunnel {action:"on"|"off"} — 隧道启停
  • POST /api/proxy {action:"on"|"off"} — 系统代理开关
  • POST /api/chrome {action:"on"|"off"} — Chrome 启停
  • POST /api/start / POST /api/stop — 一键全开/全关
  • POST /api/debug — 全链路检查

前置条件

  • autossh(macOS 可用 brew install autossh)
  • 系统代理:macOS 使用 networksetup;Linux 使用 ALL_PROXY 环境变量
  • 代理 Chrome:本机安装 Google Chrome