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

super-dns

v2.0.2

Published

DNS 代理,白名单域名走 DoH 防劫持,其余透传上游 DNS

Readme

Super DNS

macOS 本机 hosts 维护守护进程。它通过 DoH 解析指定域名的 A/AAAA 记录,并维护 /etc/hosts 中由 super-dns 管理的 IPv4/IPv6 记录,避免目标域名被本机其他 DNS 模块抢答污染。

安装后命令

# 启动,两个命令等价
npx super-dns
npx super-dns start

# 关闭 root 守护进程
# 并清理 /etc/hosts 中的 super-dns 区块
npx super-dns stop

# 重启 root 守护进程
npx super-dns restart

本地开发时也可以直接执行:

node index.js
node index.js stop
node index.js restart

启动流程

执行 npx super-dnsnpx super-dns start 时:

  1. 普通用户前台进程启动
  2. 通过 macOS 系统授权弹窗请求管理员权限
  3. 授权后启动 root 后台守护进程
  4. root 进程执行首轮 DoH 解析
  5. 将解析结果写入 /etc/hosts
  6. 刷新本机 DNS 缓存
  7. 前台进程输出启动摘要后退出
  8. root 后台进程继续常驻运行

前台进程退出是正常行为,真正工作的进程是 root 后台守护进程。

配置

域名列表:

~/.config/super-dns/domains

示例(目前只支持域名全称):

# 每行一个域名,支持 # 注释
a.com
b.com
c.com

当前 hosts 模式只会写入精确域名。通配符规则会被加载、显示和记录日志,但不会写入 /etc/hosts,因为 hosts 不支持通配符。

工作方式

程序只维护 /etc/hosts 中这一段:

# BEGIN super-dns
1.2.3.4 a.com
2606:4700:3031::6815:33a3 a.com
# END super-dns

每次更新流程:

  1. 读取 ~/.config/super-dns/domains
  2. 跳过通配符,保留精确域名
  3. 通过 DoH 查询 A 和 AAAA 记录
  4. 结果变化时更新 /etc/hosts
  5. 执行 dscacheutil -flushcache
  6. 执行 killall -HUP mDNSResponder

默认每 300 秒轮询一次。配置文件发生变化后,会立即触发一次更新。

如果域名存在 IPv6 解析,程序也会写入对应 AAAA 地址。这样可以避免系统或浏览器优先选择 IPv6 时绕过 IPv4 hosts 记录。

日志

日志路径:

/tmp/super-dns.log

停止

推荐使用:

super-dns stop

程序收到 SIGINTSIGTERM 后,会清理 /etc/hosts 中的 super-dns 区块并刷新 DNS 缓存。