Skip to content

Commit

Permalink
change name "edns" to "xdns"
Browse files Browse the repository at this point in the history
  • Loading branch information
allenm committed May 15, 2014
1 parent 5e1862e commit 4c487ae
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@

## EDNS
## XDNS

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

### 安装

```
npm install edns -g
npm install xdns -g
```

### 使用

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

```
127.0.0.1 www.baidu.com
Expand All @@ -24,23 +24,23 @@ $en0$ www.qq.com

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

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

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

### 可用选项

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

### API

##### edns.init(config) 启动一个 edns
##### xdns.init(config) 启动一个 xdns

config 支持的配置项有:

* file edns 配置文件的地址
* file xdns 配置文件的地址
* dns 远程的 DNS server
* hostsArr 包含 hosts 配置的数组,例如 `['127.0.0.1 www.baidu.com']` ,可以参考 sample/hostsarr.js
2 changes: 1 addition & 1 deletion bin/edns.js → bin/xdns.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ var cdns = require('../index');

program
.version(require('../package.json').version)
.option('-f, --file <path>','set cdns config file path. default to ~/.edns')
.option('-f, --file <path>','set cdns config file path. default to ~/.xdns')
.option('-d, --dns <ip>','remote dns server , default is your network\'s dns')
.parse(process.argv);

Expand Down
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "edns",
"version": "0.0.8",
"description": "A dns server for easy configue",
"name": "xdns",
"version": "0.0.9",
"description": "A DNS server for web / app developers . Easy to config.",
"main": "index.js",
"bin":{
"edns":"./bin/edns.js"
"xdns":"./bin/xdns.js"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
Expand All @@ -16,10 +16,10 @@
},
"repository":{
"type":"git",
"url":"https://github.com/allenm/edns.git"
"url":"https://github.com/allenm/xdns.git"
},
"bugs":{
"url":"https://github.com/allenm/edns/issues",
"url":"https://github.com/allenm/xdns/issues",
"email":"[email protected]"
},
"dependencies":{
Expand Down
4 changes: 2 additions & 2 deletions sample/hostsarr.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@

'use strict'

var edns = require('../index');
var xdns = require('../index');

var hostsArr = [
'127.0.0.1 xx.cdn.cn yy.cdn.cn',
'127.0.0.1 *.cdn.com',
'$en0$ www.baidu.com'
]

edns.init({
xdns.init({
hostsArr:hostsArr,
dns:'8.8.8.8'
})

0 comments on commit 4c487ae

Please sign in to comment.