Giter Site home page Giter Site logo

xdns's Introduction

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

xdns's People

Contributors

allenm avatar army8735 avatar

Watchers

codecoke avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.