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 🙏

© 2024 – Pkg Stats / Ryan Hefner

xdns

v1.0.0

Published

A DNS server for web / app developers . Easy to config.

Downloads

3

Readme

XDNS

A DNS server for web / app developers . Easy to config.

安装

npm install xdns -g

使用

在当前用户根目录创建文件 ~/.xdns 作为 xdns 配置文件。 此配置文件完全兼容 hosts 文件的写法,另外还支持通配符以及网卡接口名自动替换,例如:

127.0.0.1 www.baidu.com
127.0.0.1 a.xxcdn.cn b.xxcdn.cn
127.0.0.1 *.yycdn.cn
$en0$ www.qq.com

以上的写法都是支持的,www.baidu.com a.xxcdn.cn b.xxcdn.cn 以及根域名为 yycdn.cn 的域名都会被解析到 127.0.0.1

$en0$ 会被替换成当前机器上名为 en0 的网卡接口上的 IPv4 地址。

写好配置文件后,使用 sudo xdns 启动 xdns(因为 DNS Server 运行在 53 端口,所以需要 root 权限),设置你的手机或者其他设备 DNS 为运行 xdns 的电脑 IP 即可。

使用这种方式可以解决移动设备上不好绑定 hosts 的麻烦。

可用选项

  • -h --help 查看帮助
  • -V --versioin 查看版本号
  • -f --file 设置 xdns 配置文件的地址,默认为 ~/.xdns
  • -d --dns 设置远程的 dns server , 当域名不在配置文件里时,使用此 DNS 解析。默认是当前电脑的 DNS

API

xdns.init(config) 启动一个 xdns

config 支持的配置项有:

  • file xdns 配置文件的地址
  • dns 远程的 DNS server
  • hostsArr 包含 hosts 配置的数组,例如 ['127.0.0.1 www.baidu.com'] ,可以参考 sample/hostsarr.js

改名

之前叫 edns , 但是 edns 已经有了 “Extension mechanisms for DNS” 的意思,所以更名为 xdns