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

pac-proxy-cli

v1.0.4

Published

node pac proxy and web control panel

Readme

pac-proxy-cli

本机运行的 PAC / 全局代理 / 抓包 工具,提供 Web 界面与本地代理服务。支持设置系统代理、PAC 规则、HTTPS 抓包和查看流量记录。

功能特性

  • 多种代理模式:全局代理、PAC 代理、抓包代理,一键切换。
  • PAC 规则:按域名/URL 规则匹配,选择「代理」或「直连」,支持优先级
  • 上游代理:支持 SOCKS5 / HTTP 上游,本地将 SOCKS5 转为 HTTP 代理并按规则转发
  • 流量记录:查看经本机代理的请求;抓包模式下可查看解密后的请求/响应、搜索与筛选
  • 抓包代理 (MITM):HTTPS 解密、自动生成 CA 证书供下载安装,便于本地调试与分析
  • 本地 / 远程模式:本地模式配置仅存本机;远程模式需登录,PAC 规则可同步云端

环境要求

  • Node.js >= 18
  • 系统代理自动设置支持:macOSWindowsLinux(GNOME,gsettings)

启动

确保本机已安装 Node.js 18 及以上,在终端执行:

npx pac-proxy serve --port 5174

不指定 --port 时默认使用 5174。启动后会输出控制台地址,例如:

控制台已启动: http://127.0.0.1:5174

在浏览器中打开该地址即可使用。如需长期使用,也可全局安装后直接运行:

npm install -g pac-proxy-cli
pac-proxy serve --port 5174

使用说明

1. 选择运行模式

首次访问会进入「选择运行模式」:

  • 本地模式:无需登录,所有配置保存在本机(默认目录 ~/.pac-proxy
  • 远程模式:需注册/登录,PAC 规则与云端同步(依赖远程服务地址配置)

选择后进入控制台,之后可在顶部「切换模式」中更改。

2. 代理设置

代理设置 页可进行:

| 操作 | 说明 | |------------|------| | 全局代理 | 系统代理指向本机代理端口,所有 HTTP/HTTPS 经本地转发(可配置上游) | | PAC 代理 | 系统使用自动代理配置(PAC),由本机提供 PAC 脚本,按规则决定代理或直连 | | 抓包代理 | 与全局类似,但流量经 MITM 解密,可查看请求/响应内容;需安装 CA 证书 | | 清除代理设置 | 关闭系统代理并停止本地代理服务 |

  • 上游代理地址:如 socks5://127.0.0.1:1080http://proxy.example.com:8080,留空则直连
  • HTTP/HTTPS 代理端口:本地代理监听端口,默认 5175 / 5176
  • 保存后若开启「自动设置系统代理」,会尝试写入系统代理(支持 macOS / Windows / Linux GNOME)

若自动设置失败,页面会提示错误原因,可改为手动在系统或浏览器中设置代理为 127.0.0.1:端口

3. PAC 规则

PAC 规则 页管理「代理 / 直连」规则:

  • 每条规则包含:匹配模式(如 *.google.com)、动作(代理 / 直连)、优先级
  • 按优先级从高到低匹配,命中则按该条动作执行
  • 本地模式下规则保存在本机;远程模式下规则与云端同步

4. 流量记录

流量记录 页可查看经本机代理的请求:

  • 非抓包模式:列表展示时间、类型、方法、URL、动作(代理/直连),最多保留 500 条
  • 抓包模式:展示更详细列表,支持按 URL 搜索、按方法/状态码/类型筛选、排序与分页;点击「详情」可查看请求/响应头与 body(可复制 URL)

5. 抓包代理与 CA 证书

选择「抓包代理」并保存后:

  1. 系统代理会指向本机抓包代理端口,所有流量经本地解密
  2. 首次产生 HTTPS 请求后,会在默认数据目录下生成根 CA
  3. 在代理设置页点击 下载 CA 证书,将证书安装到系统或浏览器「受信任的根证书」
  4. 安装后即可正常访问 HTTPS 站点,并在「流量记录」中查看解密后的请求/响应

注意:CA 仅限本机抓包使用,请勿安装到他人设备或生产环境。

系统代理支持说明

| 平台 | 说明 | |------|------| | macOS | 通过 networksetup 设置;若遇权限问题,可配置 sudo 免密或手动在 系统设置 → 网络 → 代理 中设置 | | Windows | 通过注册表写入;失败时可手动在 设置 → 网络和 Internet → 代理 中设置 | | Linux | 仅支持 GNOMEgsettings);需在图形会话中运行。KDE / XFCE 等请手动在系统设置中配置代理 |

环境变量

| 变量 | 说明 | |------|------| | PAC_PROXY_HOME | 数据与配置根目录,默认 ~/.pac-proxy | | REMOTE_SERVER_URL | 远程模式下的服务端地址(需在运行目录的 .env 或 .env.local 中配置,供登录与 PAC 规则同步) |

许可证

MIT