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

wdns

v0.0.1-alpha.1

Published

用于 Windows 管理 DNS 的命令行工具

Readme

WDNS

用于 Windows 管理 DNS 的命令行工具

此项目代码基本由AI完成编写

功能特性

  • 🔍 查看当前 DNS 配置 - 显示所有网络接口的 DNS 设置
  • 添加 DNS 配置 - 保存自定义的 DNS 配置供后续使用
  • 📋 交互式配置选择 - 通过列表界面选择和应用 DNS 配置
  • 快速设置 - 通过配置名称快速应用 DNS 设置
  • 🔄 重置 DNS - 一键重置为自动获取 DNS
  • 🛡️ 系统兼容性检查 - 确保仅在 Windows 系统上运行

使用方法

安装

npm install -g wdns

查看当前 DNS 配置

wdns view

显示当前电脑所有网络接口的 DNS 配置信息。

添加 DNS 配置

# 添加只有首选 DNS 的配置
wdns add <配置名称> <首选DNS>

# 添加有首选和备选 DNS 的配置
wdns add <配置名称> <首选DNS> <备选DNS>

示例:

wdns add "Google DNS" 8.8.8.8 8.8.4.4
wdns add "Cloudflare DNS" 1.1.1.1 1.0.0.1
wdns add "阿里 DNS" 223.5.5.5 223.6.6.6

交互式选择配置

wdns list

显示已添加的配置名称列表,可以:

  • 使用上下箭头键选择配置
  • 按回车键确认并应用配置
  • 选择删除选项来管理配置

快速设置配置

wdns set <配置名称>

直接通过配置名称设置 DNS,无需交互式选择。

示例:

wdns set "Google DNS"
wdns set "Cloudflare DNS"

重置 DNS 为自动获取

wdns reset

将 DNS 设置重置为自动获取(DHCP)。

安装说明

前置要求

  • Windows 10/11
  • Node.js 16+
  • 管理员权限(修改 DNS 设置时需要)

开发模式

在开发过程中,可以使用以下命令:

# 开发模式运行
npm run dev -- <command>

# 示例
npm run dev -- view
npm run dev -- add "Test DNS" 8.8.8.8
npm run dev -- list
npm run dev -- set "Test DNS"
npm run dev -- reset

注意事项

⚠️ 重要提醒

  1. 管理员权限:修改 DNS 设置需要管理员权限,请以管理员身份运行命令提示符或 PowerShell
  2. 系统兼容性:此工具仅支持 Windows 系统,使用 netsh 命令进行 DNS 管理
  3. 网络接口:工具会自动检测并修改已连接的 WLAN 或以太网接口
  4. 配置存储:DNS 配置保存在用户主目录的 .wdns 文件夹中

🔧 故障排除

权限问题

  • 确保以管理员身份运行命令行工具
  • 检查 Windows 用户账户控制 (UAC) 设置

网络接口问题

  • 检查网络连接是否正常
  • 确认网络适配器已启用
  • 尝试重启网络适配器

配置文件问题

  • 如果配置文件损坏,可以删除 %USERPROFILE%\.wdns 文件夹

使用示例

完整工作流程

# 1. 查看当前 DNS 配置
wdns view

# 2. 添加常用 DNS 配置
wdns add "Google DNS" 8.8.8.8 8.8.4.4
wdns add "Cloudflare DNS" 1.1.1.1 1.0.0.1
wdns add "阿里 DNS" 223.5.5.5 223.6.6.6

# 3. 快速切换到 Google DNS
wdns set "Google DNS"

# 4. 或使用交互式选择
wdns list

# 5. 重置为自动获取
wdns reset

项目结构

wdns/
├── src/
│   ├── commands/          # 命令实现
│   │   ├── view.ts        # 查看命令
│   │   ├── add.ts         # 添加命令
│   │   ├── list.ts        # 列表命令
│   │   ├── set.ts         # 设置命令
│   │   └── reset.ts       # 重置命令
│   ├── utils/             # 工具类
│   │   ├── dns-utils.ts   # DNS 操作
│   │   ├── config-manager.ts # 配置管理
│   │   └── system-check.ts # 系统检查
│   └── types/             # 类型定义
├── package.json
├── tsconfig.json
└── README.md

许可证

MIT License

贡献

欢迎提交 Issue 和 Pull Request!